diff --git a/swaggerci/apimanagement.DefaultTag/generated/api/ApiManagementClient.cs b/swaggerci/apimanagement.DefaultTag/generated/api/ApiManagementClient.cs
new file mode 100644
index 000000000000..006402efedfd
--- /dev/null
+++ b/swaggerci/apimanagement.DefaultTag/generated/api/ApiManagementClient.cs
@@ -0,0 +1,119607 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.Api
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Extensions;
+
+ ///
+ /// Low-level API implementation for the ApiManagementClient service.
+ /// ApiManagement Client
+ ///
+ public partial class ApiManagementClient
+ {
+
+ /// Status of all policies of API Management services.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task AllPoliciesListByService(string resourceGroupName, string serviceName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/allPolicies"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.AllPoliciesListByService_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Status of all policies of API Management services.
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task AllPoliciesListByServiceViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/allPolicies$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/allPolicies'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/allPolicies"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.AllPoliciesListByService_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task AllPoliciesListByService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.AllPoliciesCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get
+ /// validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task AllPoliciesListByService_Validate(string resourceGroupName, string serviceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ ///
+ /// Creates new or updates existing specified API of the API Management service instance.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create or update parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiCreateOrUpdate(string resourceGroupName, string serviceName, string apiId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IApiCreateOrUpdateParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Creates new or updates existing specified API of the API Management service instance.
+ ///
+ ///
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// Create or update parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiCreateOrUpdateViaIdentity(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IApiCreateOrUpdateParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: location
+ var _finalUri = _response.GetFirstHeader(@"Location");
+ var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ var error = false;
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "failed":
+ error = true;
+ break;
+ case "succeeded":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ if (error) {
+ throw new Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.UndeclaredResponseException(_response);
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ApiContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create or update parameters.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiCreateOrUpdate_Validate(string resourceGroupName, string serviceName, string apiId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IApiCreateOrUpdateParameter body, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,256);
+ await eventListener.AssertRegEx(nameof(apiId),apiId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+
+ /// Deletes the specified API of the API Management service instance.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// Delete all revisions of the Api.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDelete(string resourceGroupName, string serviceName, string apiId, bool? deleteRevisions, string ifMatch, string subscriptionId, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "?"
+ + (null == deleteRevisions ? global::System.String.Empty : "deleteRevisions=" + global::System.Uri.EscapeDataString(deleteRevisions.ToString()))
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDelete_Call(request,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Deletes the specified API of the API Management service instance.
+ ///
+ /// Delete all revisions of the Api.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDeleteViaIdentity(global::System.String viaIdentity, bool? deleteRevisions, string ifMatch, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "?"
+ + (null == deleteRevisions ? global::System.String.Empty : "deleteRevisions=" + global::System.Uri.EscapeDataString(deleteRevisions.ToString()))
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDelete_Call(request,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: location
+ var _finalUri = _response.GetFirstHeader(@"Location");
+ var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ var error = false;
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "failed":
+ error = true;
+ break;
+ case "succeeded":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ if (error) {
+ throw new Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.UndeclaredResponseException(_response);
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation events
+ /// back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// Delete all revisions of the Api.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDelete_Validate(string resourceGroupName, string serviceName, string apiId, bool? deleteRevisions, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,256);
+ await eventListener.AssertRegEx(nameof(apiId),apiId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Creates a new Diagnostic for an API or updates an existing one.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticCreateOrUpdate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IDiagnosticContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/diagnostics/"
+ + global::System.Uri.EscapeDataString(diagnosticId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Creates a new Diagnostic for an API or updates an existing one.
+ ///
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// Create parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticCreateOrUpdateViaIdentity(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IDiagnosticContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/diagnostics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var diagnosticId = _match.Groups["diagnosticId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/diagnostics/"
+ + diagnosticId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.DiagnosticContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ case global::System.Net.HttpStatusCode.Created:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.DiagnosticContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create parameters.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticCreateOrUpdate_Validate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IDiagnosticContract body, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(diagnosticId),diagnosticId);
+ await eventListener.AssertMinimumLength(nameof(diagnosticId),diagnosticId,1);
+ await eventListener.AssertMaximumLength(nameof(diagnosticId),diagnosticId,80);
+ await eventListener.AssertRegEx(nameof(diagnosticId),diagnosticId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+
+ /// Deletes the specified Diagnostic from an API.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticDelete(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string ifMatch, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/diagnostics/"
+ + global::System.Uri.EscapeDataString(diagnosticId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Deletes the specified Diagnostic from an API.
+ ///
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticDeleteViaIdentity(global::System.String viaIdentity, string ifMatch, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/diagnostics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var diagnosticId = _match.Groups["diagnosticId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/diagnostics/"
+ + diagnosticId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response);
+ break;
+ }
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticDelete_Validate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(diagnosticId),diagnosticId);
+ await eventListener.AssertMinimumLength(nameof(diagnosticId),diagnosticId,1);
+ await eventListener.AssertMaximumLength(nameof(diagnosticId),diagnosticId,80);
+ await eventListener.AssertRegEx(nameof(diagnosticId),diagnosticId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Gets the details of the Diagnostic for an API specified by its identifier.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticGet(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/diagnostics/"
+ + global::System.Uri.EscapeDataString(diagnosticId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticGetEntityTag(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/diagnostics/"
+ + global::System.Uri.EscapeDataString(diagnosticId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier.
+ ///
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticGetEntityTagViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/diagnostics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var diagnosticId = _match.Groups["diagnosticId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/diagnostics/"
+ + diagnosticId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticGetEntityTag_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,null /* deserializeFromResponse doesn't support '-header-' /home/cloudtest/.autorest/@autorest_powershell@3.0.514/node_modules/@autorest/powershell/dist/llcsharp/schema/object.js*/);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get
+ /// validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticGetEntityTag_Validate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(diagnosticId),diagnosticId);
+ await eventListener.AssertMinimumLength(nameof(diagnosticId),diagnosticId,1);
+ await eventListener.AssertMaximumLength(nameof(diagnosticId),diagnosticId,80);
+ await eventListener.AssertRegEx(nameof(diagnosticId),diagnosticId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Gets the details of the Diagnostic for an API specified by its identifier.
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/diagnostics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var diagnosticId = _match.Groups["diagnosticId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/diagnostics/"
+ + diagnosticId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.DiagnosticContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticGet_Validate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(diagnosticId),diagnosticId);
+ await eventListener.AssertMinimumLength(nameof(diagnosticId),diagnosticId,1);
+ await eventListener.AssertMaximumLength(nameof(diagnosticId),diagnosticId,80);
+ await eventListener.AssertRegEx(nameof(diagnosticId),diagnosticId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Lists all diagnostics of an API.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// | Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------||
+ /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
+ /// Number of records to return.
+ /// Number of records to skip.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticListByService(string resourceGroupName, string serviceName, string apiId, string Filter, int? Top, int? Skip, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/diagnostics"
+ + "?"
+ + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter))
+ + "&"
+ + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString()))
+ + "&"
+ + (null == Skip ? global::System.String.Empty : "$skip=" + global::System.Uri.EscapeDataString(Skip.ToString()))
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticListByService_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Lists all diagnostics of an API.
+ ///
+ /// | Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------||
+ /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
+ /// Number of records to return.
+ /// Number of records to skip.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticListByServiceViaIdentity(global::System.String viaIdentity, string Filter, int? Top, int? Skip, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/diagnostics$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/diagnostics"
+ + "?"
+ + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter))
+ + "&"
+ + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString()))
+ + "&"
+ + (null == Skip ? global::System.String.Empty : "$skip=" + global::System.Uri.EscapeDataString(Skip.ToString()))
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticListByService_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticListByService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.DiagnosticCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get
+ /// validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// | Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------||
+ /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
+ /// Number of records to return.
+ /// Number of records to skip.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticListByService_Validate(string resourceGroupName, string serviceName, string apiId, string Filter, int? Top, int? Skip, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(Filter),Filter);
+ await eventListener.AssertIsGreaterThanOrEqual(nameof(Top),Top,1);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Updates the details of the Diagnostic for an API specified by its identifier.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Diagnostic Update parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticUpdate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IDiagnosticContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/diagnostics/"
+ + global::System.Uri.EscapeDataString(diagnosticId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Patch, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Updates the details of the Diagnostic for an API specified by its identifier.
+ ///
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// Diagnostic Update parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiDiagnosticUpdateViaIdentity(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IDiagnosticContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/diagnostics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var diagnosticId = _match.Groups["diagnosticId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/diagnostics/"
+ + diagnosticId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Patch, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiDiagnosticUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.DiagnosticContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Diagnostic identifier. Must be unique in the current API Management service instance.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Diagnostic Update parameters.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiDiagnosticUpdate_Validate(string resourceGroupName, string serviceName, string apiId, string diagnosticId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IDiagnosticContract body, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(diagnosticId),diagnosticId);
+ await eventListener.AssertMinimumLength(nameof(diagnosticId),diagnosticId,1);
+ await eventListener.AssertMaximumLength(nameof(diagnosticId),diagnosticId,80);
+ await eventListener.AssertRegEx(nameof(diagnosticId),diagnosticId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+
+ ///
+ /// Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid
+ /// for 5 minutes.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. New
+ /// formats can be added in the future.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiExportGet(string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Api.Support.ExportFormat format, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var export = @"true";
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "?"
+ + "format=" + global::System.Uri.EscapeDataString(format)
+ + "&"
+ + "export=" + global::System.Uri.EscapeDataString(export)
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiExportGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid
+ /// for 5 minutes.
+ ///
+ ///
+ /// Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. New
+ /// formats can be added in the future.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiExportGetViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Api.Support.ExportFormat format, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var export = @"true";
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "?"
+ + "format=" + global::System.Uri.EscapeDataString(format)
+ + "&"
+ + "export=" + global::System.Uri.EscapeDataString(export)
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiExportGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiExportGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ApiExportResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. New
+ /// formats can be added in the future.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiExportGet_Validate(string resourceGroupName, string serviceName, string apiId, Microsoft.Azure.PowerShell.Cmdlets.Api.Support.ExportFormat format, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,256);
+ await eventListener.AssertRegEx(nameof(apiId),apiId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(format),format);
+ await eventListener.AssertEnum(nameof(format),format,@"swagger-link", @"wsdl-link", @"wadl-link", @"openapi-link", @"openapi+json-link");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Gets the details of the API specified by its identifier.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiGet(string resourceGroupName, string serviceName, string apiId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Gets the entity state (Etag) version of the API specified by its identifier.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiGetEntityTag(string resourceGroupName, string serviceName, string apiId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Gets the entity state (Etag) version of the API specified by its identifier.
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiGetEntityTagViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiGetEntityTag_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,null /* deserializeFromResponse doesn't support '-header-' /home/cloudtest/.autorest/@autorest_powershell@3.0.514/node_modules/@autorest/powershell/dist/llcsharp/schema/object.js*/);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiGetEntityTag_Validate(string resourceGroupName, string serviceName, string apiId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,256);
+ await eventListener.AssertRegEx(nameof(apiId),apiId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Gets the details of the API specified by its identifier.
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ApiContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation events
+ /// back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API revision identifier. Must be unique in the current API Management service instance. Non-current
+ /// revision has ;rev=n as a suffix where n is the revision number.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiGet_Validate(string resourceGroupName, string serviceName, string apiId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,256);
+ await eventListener.AssertRegEx(nameof(apiId),apiId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Creates a new Attachment for the Issue in an API or updates an existing one.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentCreateOrUpdate(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IIssueAttachmentContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/attachments/"
+ + global::System.Uri.EscapeDataString(attachmentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Creates a new Attachment for the Issue in an API or updates an existing one.
+ ///
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// Create parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentCreateOrUpdateViaIdentity(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IIssueAttachmentContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/attachments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var attachmentId = _match.Groups["attachmentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/attachments/"
+ + attachmentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueAttachmentContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ case global::System.Net.HttpStatusCode.Created:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueAttachmentContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you
+ /// will get validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create parameters.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentCreateOrUpdate_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IIssueAttachmentContract body, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(attachmentId),attachmentId);
+ await eventListener.AssertMinimumLength(nameof(attachmentId),attachmentId,1);
+ await eventListener.AssertMaximumLength(nameof(attachmentId),attachmentId,256);
+ await eventListener.AssertRegEx(nameof(attachmentId),attachmentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+
+ /// Deletes the specified comment from an Issue.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentDelete(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string ifMatch, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/attachments/"
+ + global::System.Uri.EscapeDataString(attachmentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Deletes the specified comment from an Issue.
+ ///
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentDeleteViaIdentity(global::System.String viaIdentity, string ifMatch, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/attachments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var attachmentId = _match.Groups["attachmentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/attachments/"
+ + attachmentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response);
+ break;
+ }
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get
+ /// validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentDelete_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(attachmentId),attachmentId);
+ await eventListener.AssertMinimumLength(nameof(attachmentId),attachmentId,1);
+ await eventListener.AssertMaximumLength(nameof(attachmentId),attachmentId,256);
+ await eventListener.AssertRegEx(nameof(attachmentId),attachmentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ ///
+ /// Gets the details of the issue Attachment for an API specified by its identifier.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentGet(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/attachments/"
+ + global::System.Uri.EscapeDataString(attachmentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentGetEntityTag(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/attachments/"
+ + global::System.Uri.EscapeDataString(attachmentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier.
+ ///
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentGetEntityTagViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/attachments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var attachmentId = _match.Groups["attachmentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/attachments/"
+ + attachmentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentGetEntityTag_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,null /* deserializeFromResponse doesn't support '-header-' /home/cloudtest/.autorest/@autorest_powershell@3.0.514/node_modules/@autorest/powershell/dist/llcsharp/schema/object.js*/);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentGetEntityTag_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(attachmentId),attachmentId);
+ await eventListener.AssertMinimumLength(nameof(attachmentId),attachmentId,1);
+ await eventListener.AssertMaximumLength(nameof(attachmentId),attachmentId,256);
+ await eventListener.AssertRegEx(nameof(attachmentId),attachmentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ ///
+ /// Gets the details of the issue Attachment for an API specified by its identifier.
+ ///
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/attachments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var attachmentId = _match.Groups["attachmentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/attachments/"
+ + attachmentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueAttachmentContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Attachment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentGet_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(attachmentId),attachmentId);
+ await eventListener.AssertMinimumLength(nameof(attachmentId),attachmentId,1);
+ await eventListener.AssertMaximumLength(nameof(attachmentId),attachmentId,256);
+ await eventListener.AssertRegEx(nameof(attachmentId),attachmentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Lists all attachments for the Issue associated with the specified API.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// | Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------||
+ /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || userId | filter | ge, le,
+ /// eq, ne, gt, lt | substringof, contains, startswith, endswith |
+ /// Number of records to return.
+ /// Number of records to skip.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentListByService(string resourceGroupName, string serviceName, string apiId, string issueId, string Filter, int? Top, int? Skip, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/attachments"
+ + "?"
+ + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter))
+ + "&"
+ + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString()))
+ + "&"
+ + (null == Skip ? global::System.String.Empty : "$skip=" + global::System.Uri.EscapeDataString(Skip.ToString()))
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentListByService_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Lists all attachments for the Issue associated with the specified API.
+ ///
+ /// | Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------||
+ /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || userId | filter | ge, le,
+ /// eq, ne, gt, lt | substringof, contains, startswith, endswith |
+ /// Number of records to return.
+ /// Number of records to skip.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueAttachmentListByServiceViaIdentity(global::System.String viaIdentity, string Filter, int? Top, int? Skip, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/attachments$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/attachments"
+ + "?"
+ + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter))
+ + "&"
+ + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString()))
+ + "&"
+ + (null == Skip ? global::System.String.Empty : "$skip=" + global::System.Uri.EscapeDataString(Skip.ToString()))
+ + "&"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueAttachmentListByService_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentListByService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueAttachmentCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// | Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------||
+ /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || userId | filter | ge, le,
+ /// eq, ne, gt, lt | substringof, contains, startswith, endswith |
+ /// Number of records to return.
+ /// Number of records to skip.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueAttachmentListByService_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string Filter, int? Top, int? Skip, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(Filter),Filter);
+ await eventListener.AssertIsGreaterThanOrEqual(nameof(Top),Top,1);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Creates a new Comment for the Issue in an API or updates an existing one.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentCreateOrUpdate(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IIssueCommentContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/comments/"
+ + global::System.Uri.EscapeDataString(commentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Creates a new Comment for the Issue in an API or updates an existing one.
+ ///
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// Create parameters.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentCreateOrUpdateViaIdentity(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IIssueCommentContract body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/comments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var commentId = _match.Groups["commentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/comments/"
+ + commentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ if (null != ifMatch)
+ {
+ request.Headers.Add("If-Match",ifMatch);
+ }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 201 (Created).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueCommentContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ case global::System.Net.HttpStatusCode.Created:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueCommentContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. Not required when creating an entity, but required when updating an entity.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// Create parameters.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentCreateOrUpdate_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IIssueCommentContract body, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(commentId),commentId);
+ await eventListener.AssertMinimumLength(nameof(commentId),commentId,1);
+ await eventListener.AssertMaximumLength(nameof(commentId),commentId,256);
+ await eventListener.AssertRegEx(nameof(commentId),commentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+
+ /// Deletes the specified comment from an Issue.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentDelete(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string ifMatch, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/comments/"
+ + global::System.Uri.EscapeDataString(commentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Deletes the specified comment from an Issue.
+ ///
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentDeleteViaIdentity(global::System.String viaIdentity, string ifMatch, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/comments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var commentId = _match.Groups["commentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/comments/"
+ + commentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // add headers parameters
+ request.Headers.Add("If-Match",ifMatch.ToString());
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response);
+ break;
+ }
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// ETag of the Entity. ETag should match the current entity state from the header response of the GET
+ /// request or it should be * for unconditional update.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentDelete_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string ifMatch, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(commentId),commentId);
+ await eventListener.AssertMinimumLength(nameof(commentId),commentId,1);
+ await eventListener.AssertMaximumLength(nameof(commentId),commentId,256);
+ await eventListener.AssertRegEx(nameof(commentId),commentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(ifMatch),ifMatch);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Gets the details of the issue Comment for an API specified by its identifier.
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentGet(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/comments/"
+ + global::System.Uri.EscapeDataString(commentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentGetEntityTag(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.ApiManagement/service/"
+ + global::System.Uri.EscapeDataString(serviceName)
+ + "/apis/"
+ + global::System.Uri.EscapeDataString(apiId)
+ + "/issues/"
+ + global::System.Uri.EscapeDataString(issueId)
+ + "/comments/"
+ + global::System.Uri.EscapeDataString(commentId)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier.
+ ///
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentGetEntityTagViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/comments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var commentId = _match.Groups["commentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/comments/"
+ + commentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Head, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentGetEntityTag_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentGetEntityTag_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,null /* deserializeFromResponse doesn't support '-header-' /home/cloudtest/.autorest/@autorest_powershell@3.0.514/node_modules/@autorest/powershell/dist/llcsharp/schema/object.js*/);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ /// The name of the API Management service.
+ /// API identifier. Must be unique in the current API Management service instance.
+ /// Issue identifier. Must be unique in the current API Management service instance.
+ /// Comment identifier within an Issue. Must be unique in the current Issue.
+ /// The ID of the target subscription. The value must be an UUID.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentGetEntityTag_Validate(string resourceGroupName, string serviceName, string apiId, string issueId, string commentId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1);
+ await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90);
+ await eventListener.AssertNotNull(nameof(serviceName),serviceName);
+ await eventListener.AssertMinimumLength(nameof(serviceName),serviceName,1);
+ await eventListener.AssertMaximumLength(nameof(serviceName),serviceName,50);
+ await eventListener.AssertRegEx(nameof(serviceName),serviceName,@"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$");
+ await eventListener.AssertNotNull(nameof(apiId),apiId);
+ await eventListener.AssertMinimumLength(nameof(apiId),apiId,1);
+ await eventListener.AssertMaximumLength(nameof(apiId),apiId,80);
+ await eventListener.AssertNotNull(nameof(issueId),issueId);
+ await eventListener.AssertMinimumLength(nameof(issueId),issueId,1);
+ await eventListener.AssertMaximumLength(nameof(issueId),issueId,256);
+ await eventListener.AssertRegEx(nameof(issueId),issueId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(commentId),commentId);
+ await eventListener.AssertMinimumLength(nameof(commentId),commentId,1);
+ await eventListener.AssertMaximumLength(nameof(commentId),commentId,256);
+ await eventListener.AssertRegEx(nameof(commentId),commentId,@"^[^*#&+:<>?]+$");
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$");
+ }
+ }
+
+ /// Gets the details of the issue Comment for an API specified by its identifier.
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task ApiIssueCommentGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2023-05-01-preview";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ApiManagement/service/(?[^/]+)/apis/(?[^/]+)/issues/(?[^/]+)/comments/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var serviceName = _match.Groups["serviceName"].Value;
+ var apiId = _match.Groups["apiId"].Value;
+ var issueId = _match.Groups["issueId"].Value;
+ var commentId = _match.Groups["commentId"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace(
+ "/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.ApiManagement/service/"
+ + serviceName
+ + "/apis/"
+ + apiId
+ + "/issues/"
+ + issueId
+ + "/comments/"
+ + commentId
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2");
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}");
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.ApiIssueCommentGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task ApiIssueCommentGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ var sendTask = sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sendTask;
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.IssueCommentContract.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Api.Models.Api20230501Preview.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Api.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for