generated/api/CommvaultPowershell.cs
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.4, generator: @autorest/powershell@3.0.415) // Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Commvault.Powershell { 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Create 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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/Run" + "?" + "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="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/Run$").Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Backup/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 + "/Backup/Run" + "?" + "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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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 BackupVMGroup(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.BackupVMGroup_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 BackupVMGroupViaIdentity(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$").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.BackupVMGroup_Call(request,onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="BackupVMGroup" /> method.</summary> /// <param name="request">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 BackupVMGroup_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="BackupVMGroup" /> 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 BackupVMGroup_Validate(long vmGroupId, 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ConfigureRequestForRequestManager(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ConfigureRequestForRequestManager_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ConfigureRequestForRequestManagerViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ConfigureRequestForRequestManager_Call(request,onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ConfigureRequestForRequestManager" /> method.</summary> /// <param name="request">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 ConfigureRequestForRequestManager_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ConfigureRequestForRequestManager" /> 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 ConfigureRequestForRequestManager_Validate(long requestId, Commvault.Powershell.Models.IRmConfigureRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { // (nameof(requestId),requestId,1); 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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.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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 Laptop Plan</summary> /// <param name="body">Create a new Laptop 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 CreateLaptopPlan(Commvault.Powershell.Models.ILaptopPlan 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) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateLaptopPlan_Call(request,onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="CreateLaptopPlan" /> method.</summary> /// <param name="request">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 CreateLaptopPlan_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="CreateLaptopPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Create a new Laptop 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 CreateLaptopPlan_Validate(Commvault.Powershell.Models.ILaptopPlan 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateRequestOperation(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateRequestOperation_Call(request,onCreated,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="CreateRequestOperation" /> 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 CreateRequestOperation_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; } 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="CreateRequestOperation" /> 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 CreateRequestOperation_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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Creates 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateVMGroupV5(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateVMGroupV5_Call(request,onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="CreateVMGroupV5" /> method.</summary> /// <param name="request">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 CreateVMGroupV5_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="CreateVMGroupV5" /> 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 CreateVMGroupV5_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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. 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>[^/]+)$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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"></param> /// <param name="onOk">a delegate that is called when the 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// 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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteInstantCloneForce(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteInstantCloneForce_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteInstantCloneForceViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteInstantCloneForce_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="DeleteInstantCloneForce" /> method.</summary> /// <param name="request">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 DeleteInstantCloneForce_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="DeleteInstantCloneForce" /> 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 DeleteInstantCloneForce_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>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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 ) { // (nameof(requestId),requestId,1); } } /// <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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteSnapInstantClone(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteSnapInstantClone_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteSnapInstantCloneViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteSnapInstantClone_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="DeleteSnapInstantClone" /> method.</summary> /// <param name="request">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 DeleteSnapInstantClone_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="DeleteSnapInstantClone" /> 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 DeleteSnapInstantClone_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>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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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 Deletek8SModifier(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.Deletek8SModifier_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 Deletek8SModifierViaIdentity(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>[^/]+)$").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.Deletek8SModifier_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="Deletek8SModifier" /> method.</summary> /// <param name="request">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 Deletek8SModifier_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="Deletek8SModifier" /> 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 Deletek8SModifier_Validate(long clusterId, string modifierName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(modifierName),modifierName); } } /// <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 Deletetagvalue(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.Deletetagvalue_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 DeletetagvalueViaIdentity(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>[^/]+)$").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.Deletetagvalue_Call(request,onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref="Deletetagvalue" /> method.</summary> /// <param name="request">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 Deletetagvalue_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="Deletetagvalue" /> 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 Deletetagvalue_Validate(long tagId, string tagValue, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(tagValue),tagValue); } } /// <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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="enableAfterADelay">Provide UTC time in unix format.</param> /// <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 DisableBackupServer(long? enableAfterADelay, 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/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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="enableAfterADelay">Provide UTC time in unix format.</param> /// <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 DisableDataAgingServer(long? enableAfterADelay, 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/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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 available 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="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 DisableMaintenanceStoragePool(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/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.DisableMaintenanceStoragePool_Call(request,onOk,onBadRequest,onForbidden,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 available 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="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 DisableMaintenanceStoragePoolViaIdentity(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/StoragePool/(?<StoragePoolId>[^/]+)/maintenance/Disable$").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.DisableMaintenanceStoragePool_Call(request,onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="DisableMaintenanceStoragePool" /> method.</summary> /// <param name="request">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 DisableMaintenanceStoragePool_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="DisableMaintenanceStoragePool" /> 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 DisableMaintenanceStoragePool_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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="enableAfterADelay">Provide UTC time in unix format.</param> /// <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 DisableRestoreServer(long? enableAfterADelay, 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/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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="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 EnableMaintenanceStoragePool(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> 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/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.EnableMaintenanceStoragePool_Call(request,onOk,onBadRequest,onForbidden,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="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 EnableMaintenanceStoragePoolViaIdentity(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> 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/StoragePool/(?<StoragePoolId>[^/]+)/maintenance/Enable$").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.EnableMaintenanceStoragePool_Call(request,onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="EnableMaintenanceStoragePool" /> method.</summary> /// <param name="request">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 EnableMaintenanceStoragePool_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="EnableMaintenanceStoragePool" /> 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 EnableMaintenanceStoragePool_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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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 GetAPplicationGroups(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.GetAPplicationGroups_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 GetAPplicationGroupsViaIdentity(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$").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.GetAPplicationGroups_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="GetAPplicationGroups" /> method.</summary> /// <param name="request">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 GetAPplicationGroups_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="GetAPplicationGroups" /> 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 GetAPplicationGroups_Validate(long? clusterId, 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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 GetAllK8SModifier(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.GetAllK8SModifier_Call(request,onOk,eventListener,sender); } } /// <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 GetAllK8SModifierViaIdentity(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$").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.GetAllK8SModifier_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="GetAllK8SModifier" /> method.</summary> /// <param name="request">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 GetAllK8SModifier_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="GetAllK8SModifier" /> 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 GetAllK8SModifier_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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>[^/]+)$").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> /// 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>[^/]+)$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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, string 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())) + "&" + (string.IsNullOrEmpty(serverGroupId) ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId)) + "&" + (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, string 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$").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())) + "&" + (string.IsNullOrEmpty(serverGroupId) ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId)) + "&" + (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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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, string serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(serverGroupId),serverGroupId); 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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.ICloudStorageDetails>, global::System.Threading.Tasks.Task> 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.ICloudStorageDetails>, global::System.Threading.Tasks.Task> 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>[^/]+)$").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.ICloudStorageDetails>, global::System.Threading.Tasks.Task> 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CloudStorageDetails.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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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"></param> /// <param name="onOk">a delegate that is called when the 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// 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 GetEligibleMediaAgentsForAccessPath(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.GetEligibleMediaAgentsForAccessPath_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 GetEligibleMediaAgentsForAccessPathViaIdentity(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$").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.GetEligibleMediaAgentsForAccessPath_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="GetEligibleMediaAgentsForAccessPath" /> method.</summary> /// <param name="request">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 GetEligibleMediaAgentsForAccessPath_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="GetEligibleMediaAgentsForAccessPath" /> 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 GetEligibleMediaAgentsForAccessPath_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 the list of data sources 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="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 GetInventoryAssociatedDataSourceList(long inventoryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssociatedDatasourceList>, global::System.Threading.Tasks.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()) + "/DataSources" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryAssociatedDataSourceList_Call(request,onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of data sources 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="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 GetInventoryAssociatedDataSourceListViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssociatedDatasourceList>, global::System.Threading.Tasks.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>[^/]+)/DataSources$").Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/DataSources'"); } // 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 + "/DataSources" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryAssociatedDataSourceList_Call(request,onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref="GetInventoryAssociatedDataSourceList" /> method. /// </summary> /// <param name="request">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 GetInventoryAssociatedDataSourceList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssociatedDatasourceList>, global::System.Threading.Tasks.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InventoryAssociatedDatasourceList.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="GetInventoryAssociatedDataSourceList" /> 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 GetInventoryAssociatedDataSourceList_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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="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, 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())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.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="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="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, 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$").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())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="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, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(view),view); await eventListener.AssertNotNull(nameof(clients),clients); } } /// <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 GetK8SModifier(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.GetK8SModifier_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 GetK8SModifierViaIdentity(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>[^/]+)$").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.GetK8SModifier_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="GetK8SModifier" /> method.</summary> /// <param name="request">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 GetK8SModifier_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="GetK8SModifier" /> 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 GetK8SModifier_Validate(long clusterId, string modifierName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(modifierName),modifierName); } } /// <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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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<Commvault.Powershell.Models.ILaptopsList>, 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<Commvault.Powershell.Models.ILaptopsList>, 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$").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>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<Commvault.Powershell.Models.ILaptopsList>, 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LaptopsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 ) { // (nameof(requestId),requestId,1); } } /// <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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 ) { // (nameof(requestId),requestId,1); } } /// <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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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 GetRoles(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.GetRoles_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="GetRoles" /> method.</summary> /// <param name="request">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 GetRoles_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="GetRoles" /> 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 GetRoles_Validate(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/exclude 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="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 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> 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/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,onForbidden,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/exclude 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="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 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> 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/StoragePool/(?<storagePoolId>[^/]+)/runningJobs$").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,onForbidden,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="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 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> 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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.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="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/exclude 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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<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>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<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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.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<Commvault.Powershell.Models.IIntelliSnapClientsList[]>(()=> global::System.Linq.Enumerable.ToArray(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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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<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<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$").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>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<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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.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<Commvault.Powershell.Models.IIntelliSnapSubclients[]>(()=> global::System.Linq.Enumerable.ToArray(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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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$").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> /// 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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, int? 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, int? 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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, int? 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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, string 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())) + "&" + (string.IsNullOrEmpty(serverGroupId) ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId)) + "&" + (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, string 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$").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())) + "&" + (string.IsNullOrEmpty(serverGroupId) ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId)) + "&" + (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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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, string serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(serverGroupId),serverGroupId); 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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 GetVMList(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.GetVMList_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="GetVMList" /> method.</summary> /// <param name="request">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 GetVMList_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="GetVMList" /> 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 GetVMList_Validate(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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>[^/]+)$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Launching recovery action for a recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">RecoveryActionRequest</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 InvokeRecoveryGroupRecover(long recoveryGroupId, Commvault.Powershell.Models.IRecoveryActionRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.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( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Recover" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InvokeRecoveryGroupRecover_Call(request,onOk,onInternalServerError,eventListener,sender); } } /// <summary>Launching recovery action for a recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">RecoveryActionRequest</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 InvokeRecoveryGroupRecoverViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IRecoveryActionRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.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("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Recover$").Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Recover'"); } // 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 + "/Recover" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InvokeRecoveryGroupRecover_Call(request,onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="InvokeRecoveryGroupRecover" /> method.</summary> /// <param name="request">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 InvokeRecoveryGroupRecover_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, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } 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="InvokeRecoveryGroupRecover" /> 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">RecoveryActionRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InvokeRecoveryGroupRecover_Validate(long recoveryGroupId, Commvault.Powershell.Models.IRecoveryActionRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyAccessPathOfBucketOfCloudStorage(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyAccessPathOfBucketOfCloudStorage_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyAccessPathOfBucketOfCloudStorageViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyAccessPathOfBucketOfCloudStorage_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref="ModifyAccessPathOfBucketOfCloudStorage" /> method. /// </summary> /// <param name="request">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 ModifyAccessPathOfBucketOfCloudStorage_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyAccessPathOfBucketOfCloudStorage" /> 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 ModifyAccessPathOfBucketOfCloudStorage_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyArchiveBackupDestination(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyArchiveBackupDestination_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyArchiveBackupDestinationViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyArchiveBackupDestination_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyArchiveBackupDestination" /> method.</summary> /// <param name="request">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 ModifyArchiveBackupDestination_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyArchiveBackupDestination" /> 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 ModifyArchiveBackupDestination_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyArchivePlanById(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyArchivePlanById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyArchivePlanByIdViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyArchivePlanById_Call(request,onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyArchivePlanById" /> method.</summary> /// <param name="request">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 ModifyArchivePlanById_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyArchivePlanById" /> 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 ModifyArchivePlanById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupDestination(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupDestination_Call(request,onOk,onNotFound,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="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupDestinationDetails(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupDestinationDetails_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupDestinationDetailsViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupDestinationDetails_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyBackupDestinationDetails" /> method.</summary> /// <param name="request">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 ModifyBackupDestinationDetails_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyBackupDestinationDetails" /> 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 ModifyBackupDestinationDetails_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupDestinationViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupDestination_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="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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupDestinationWithoutPlanInfo(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupDestinationWithoutPlanInfo_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupDestinationWithoutPlanInfoViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupDestinationWithoutPlanInfo_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref="ModifyBackupDestinationWithoutPlanInfo" /> method. /// </summary> /// <param name="request">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 ModifyBackupDestinationWithoutPlanInfo_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyBackupDestinationWithoutPlanInfo" /> 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 ModifyBackupDestinationWithoutPlanInfo_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="ModifyBackupDestination" /> method.</summary> /// <param name="request">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 ModifyBackupDestination_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyBackupDestination" /> 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 ModifyBackupDestination_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupLocation(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupLocation_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBackupLocationViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBackupLocation_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyBackupLocation" /> method.</summary> /// <param name="request">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 ModifyBackupLocation_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyBackupLocation" /> 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 ModifyBackupLocation_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBlackoutWindow(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBlackoutWindow_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyBlackoutWindowViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyBlackoutWindow_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyBlackoutWindow" /> method.</summary> /// <param name="request">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 ModifyBlackoutWindow_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyBlackoutWindow" /> 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 ModifyBlackoutWindow_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyCloudStorageById(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyCloudStorageById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyCloudStorageByIdViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyCloudStorageById_Call(request,onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyCloudStorageById" /> method.</summary> /// <param name="request">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 ModifyCloudStorageById_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyCloudStorageById" /> 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 ModifyCloudStorageById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyCloudStorageMetaDataCacheById(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyCloudStorageMetaDataCacheById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyCloudStorageMetaDataCacheByIdViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyCloudStorageMetaDataCacheById_Call(request,onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyCloudStorageMetaDataCacheById" /> method.</summary> /// <param name="request">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 ModifyCloudStorageMetaDataCacheById_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyCloudStorageMetaDataCacheById" /> 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 ModifyCloudStorageMetaDataCacheById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyCompany(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyCompany_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="onOk">a delegate that is called when the 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 ModifyCompanyViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyCompany_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyCompany" /> method.</summary> /// <param name="request">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 ModifyCompany_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyCompany" /> 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 ModifyCompany_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 modify an existing data classification plan</summary> /// <param name="planId"></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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyDcPlan(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyDcPlan_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyDcPlanViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyDcPlan_Call(request,onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyDcPlan" /> method.</summary> /// <param name="request">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 ModifyDcPlan_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyDcPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId"></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 ModifyDcPlan_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyDiskAccessPath(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyDiskAccessPath_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyDiskAccessPathViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyDiskAccessPath_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyDiskAccessPath" /> method.</summary> /// <param name="request">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 ModifyDiskAccessPath_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyDiskAccessPath" /> 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 ModifyDiskAccessPath_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyDiskStorage(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyDiskStorage_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyDiskStorageViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyDiskStorage_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyDiskStorage" /> method.</summary> /// <param name="request">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 ModifyDiskStorage_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyDiskStorage" /> 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 ModifyDiskStorage_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 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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyEntitySettings(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyEntitySettings_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyEntitySettings" /> method.</summary> /// <param name="request">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 ModifyEntitySettings_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyEntitySettings" /> 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 ModifyEntitySettings_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyFailoverGroup(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyFailoverGroup_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyFailoverGroupSchedule(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyFailoverGroupSchedule_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyFailoverGroupScheduleViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyFailoverGroupSchedule_Call(request,onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyFailoverGroupSchedule" /> method.</summary> /// <param name="request">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 ModifyFailoverGroupSchedule_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyFailoverGroupSchedule" /> 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 ModifyFailoverGroupSchedule_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyFailoverGroupViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyFailoverGroup_Call(request,onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyFailoverGroup" /> method.</summary> /// <param name="request">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 ModifyFailoverGroup_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyFailoverGroup" /> 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 ModifyFailoverGroup_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyGlobalSettings(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyGlobalSettings_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyGlobalSettings" /> method.</summary> /// <param name="request">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 ModifyGlobalSettings_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyGlobalSettings" /> 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 ModifyGlobalSettings_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyHyperScaleStorageById(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyHyperScaleStorageById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyHyperScaleStorageByIdViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyHyperScaleStorageById_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyHyperScaleStorageById" /> method.</summary> /// <param name="request">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 ModifyHyperScaleStorageById_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyHyperScaleStorageById" /> 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 ModifyHyperScaleStorageById_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLaptopBackupDestination(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLaptopBackupDestination_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLaptopBackupDestinationViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLaptopBackupDestination_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyLaptopBackupDestination" /> method.</summary> /// <param name="request">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 ModifyLaptopBackupDestination_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyLaptopBackupDestination" /> 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 ModifyLaptopBackupDestination_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLaptopPlanById(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLaptopPlanById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLaptopPlanByIdViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLaptopPlanById_Call(request,onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyLaptopPlanById" /> method.</summary> /// <param name="request">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 ModifyLaptopPlanById_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyLaptopPlanById" /> 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 ModifyLaptopPlanById_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLocalAccessPath(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLocalAccessPath_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLocalAccessPathViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLocalAccessPath_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyLocalAccessPath" /> method.</summary> /// <param name="request">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 ModifyLocalAccessPath_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyLocalAccessPath" /> 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 ModifyLocalAccessPath_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLocalBackupLocation(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLocalBackupLocation_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLocalBackupLocationViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLocalBackupLocation_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyLocalBackupLocation" /> method.</summary> /// <param name="request">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 ModifyLocalBackupLocation_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyLocalBackupLocation" /> 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 ModifyLocalBackupLocation_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLocalStorage(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLocalStorage_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyLocalStorageViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyLocalStorage_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyLocalStorage" /> method.</summary> /// <param name="request">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 ModifyLocalStorage_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyLocalStorage" /> 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 ModifyLocalStorage_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyMediaAgent(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyMediaAgent_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyMediaAgentViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyMediaAgent_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyMediaAgent" /> method.</summary> /// <param name="request">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 ModifyMediaAgent_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyMediaAgent" /> 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 ModifyMediaAgent_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyObjectStorePlan(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyObjectStorePlan_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyObjectStorePlanViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyObjectStorePlan_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyObjectStorePlan" /> method.</summary> /// <param name="request">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 ModifyObjectStorePlan_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyObjectStorePlan" /> 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 ModifyObjectStorePlan_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyPlan(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyPlan_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="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyPlanViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyPlan_Call(request,onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyPlan" /> method.</summary> /// <param name="request">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 ModifyPlan_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyPlan" /> 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 ModifyPlan_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyReplicationGroup(long 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) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup/" + (replicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyReplicationGroup_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyReplicationGroupViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyReplicationGroup_Call(request,onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyReplicationGroup" /> method.</summary> /// <param name="request">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 ModifyReplicationGroup_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyReplicationGroup" /> 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 ModifyReplicationGroup_Validate(long replicationGroupId, Commvault.Powershell.Models.IUpdateReplicationGroup 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 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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyRole(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyRole_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyRoleViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyRole_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyRole" /> method.</summary> /// <param name="request">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 ModifyRole_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyRole" /> 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 ModifyRole_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifySchedulePattern(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifySchedulePattern_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifySchedulePatternViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifySchedulePattern_Call(request,onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifySchedulePattern" /> method.</summary> /// <param name="request">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 ModifySchedulePattern_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifySchedulePattern" /> 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 ModifySchedulePattern_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifySoftwareCacheDetails(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifySoftwareCacheDetails_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifySoftwareCacheDetailsViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifySoftwareCacheDetails_Call(request,onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifySoftwareCacheDetails" /> method.</summary> /// <param name="request">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 ModifySoftwareCacheDetails_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifySoftwareCacheDetails" /> 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 ModifySoftwareCacheDetails_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyTriggeredAlertsNotes(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyTriggeredAlertsNotes_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyTriggeredAlertsNotesViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyTriggeredAlertsNotes_Call(request,onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyTriggeredAlertsNotes" /> method.</summary> /// <param name="request">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 ModifyTriggeredAlertsNotes_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyTriggeredAlertsNotes" /> 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 ModifyTriggeredAlertsNotes_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyUser(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyUser_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyUserGroup(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyUserGroup_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyUserGroupViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyUserGroup_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyUserGroup" /> method.</summary> /// <param name="request">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 ModifyUserGroup_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyUserGroup" /> 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 ModifyUserGroup_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyUserViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyUser_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyUser" /> method.</summary> /// <param name="request">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 ModifyUser_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyUser" /> 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 ModifyUser_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyV4BlackoutWindow(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyV4BlackoutWindow_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyV4BlackoutWindowViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyV4BlackoutWindow_Call(request,onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyV4BlackoutWindow" /> method.</summary> /// <param name="request">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 ModifyV4BlackoutWindow_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="ModifyV4BlackoutWindow" /> 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 ModifyV4BlackoutWindow_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyVirtualMachine(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyVirtualMachine_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ModifyVirtualMachineViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ModifyVirtualMachine_Call(request,onOk,onUnauthorized,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref="ModifyVirtualMachine" /> method.</summary> /// <param name="request">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 ModifyVirtualMachine_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.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="ModifyVirtualMachine" /> 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 ModifyVirtualMachine_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> /// 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Create 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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task NewK8SModifier(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.NewK8SModifier_Call(request,onOk,eventListener,sender); } } /// <summary>Create 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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task NewK8SModifierViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.NewK8SModifier_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="NewK8SModifier" /> method.</summary> /// <param name="request">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 NewK8SModifier_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="NewK8SModifier" /> 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 NewK8SModifier_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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task NewRole(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.NewRole_Call(request,onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="NewRole" /> method.</summary> /// <param name="request">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 NewRole_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="NewRole" /> 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 NewRole_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>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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Preview of the vm to be protected in VMGroup</summary> /// <param name="hypervisorId">Hypervisor Id of VMGroup</param> /// <param name="body">vmGroupPreviewReq</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 PreviewVMGroup(long? hypervisorId, Commvault.Powershell.Models.IVMGroupPreviewReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVMGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, 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/Preview" + "?" + (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.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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PreviewVMGroup_Call(request,onOk,onInternalServerError,eventListener,sender); } } /// <summary>Preview of the vm to be protected in VMGroup</summary> /// <param name="viaIdentity"></param> /// <param name="hypervisorId">Hypervisor Id of VMGroup</param> /// <param name="body">vmGroupPreviewReq</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 PreviewVMGroupViaIdentity(global::System.String viaIdentity, long? hypervisorId, Commvault.Powershell.Models.IVMGroupPreviewReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVMGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, 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/Preview$").Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VmGroup/Preview'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/Preview" + "?" + (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.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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PreviewVMGroup_Call(request,onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="PreviewVMGroup" /> method.</summary> /// <param name="request">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 PreviewVMGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVMGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.VMGroupPreviewResp.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.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PreviewVMGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId">Hypervisor Id of VMGroup</param> /// <param name="body">vmGroupPreviewReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PreviewVMGroup_Validate(long? hypervisorId, Commvault.Powershell.Models.IVMGroupPreviewReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Updates 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 specific 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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 specific 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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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); // (nameof(sourceEntityId),sourceEntityId,1); } } /// <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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RestoreVMGroup(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RestoreVMGroup_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RestoreVMGroupViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RestoreVMGroup_Call(request,onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref="RestoreVMGroup" /> method.</summary> /// <param name="request">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 RestoreVMGroup_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="RestoreVMGroup" /> 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 RestoreVMGroup_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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>[^/]+)$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="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, Commvault.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,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="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="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, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync 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$").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,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="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="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, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 create or 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 create or 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetK8SRestoreModifier(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetK8SRestoreModifier_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetK8SRestoreModifierViaIdentity(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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetK8SRestoreModifier_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="SetK8SRestoreModifier" /> method.</summary> /// <param name="request">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 SetK8SRestoreModifier_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="SetK8SRestoreModifier" /> 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 SetK8SRestoreModifier_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 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task TestK8SModifierRestore(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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.TestK8SModifierRestore_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> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task TestK8SModifierRestoreViaIdentity(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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.TestK8SModifierRestore_Call(request,onOk,eventListener,sender); } } /// <summary>Actual wire call for <see cref="TestK8SModifierRestore" /> method.</summary> /// <param name="request">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 TestK8SModifierRestore_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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="TestK8SModifierRestore" /> 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 TestK8SModifierRestore_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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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$").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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Updates 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>Updates 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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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> /// <returns> /// A <see cref="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) { // 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$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>Updates 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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>Updates 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> /// <returns> /// A <see cref="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) { // 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>[^/]+)$").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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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> /// <returns> /// A <see cref="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) { // 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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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>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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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>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$").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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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 restore a virtual machine</summary> /// <param name="vmGuid"></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> /// <returns> /// A <see cref="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, 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) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/restore" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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="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> /// <returns> /// A <see cref="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, 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) { // 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$").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" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _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).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.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; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await 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="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, Commvault.Powershell.Models.IVMGroupRestoreRequest 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); } } } } |