From 4cf4e6ab7e840cb0445828a9f81a55f87550b002 Mon Sep 17 00:00:00 2001 From: Xiaogang Ding Date: Fri, 17 Jan 2025 10:42:06 +0800 Subject: [PATCH] tsp - use operationId specified by the decorator @operationId --- .../src/convertor/convertor.ts | 14 +- ...ComplianceAutomationToolForMicrosoft365.cs | 2054 +++++++++-------- ...tAzAppComplianceAutomationReport_Check.cs} | 45 +- ...mplianceAutomationReport_CheckExpanded.cs} | 15 +- ...ianceAutomationReport_CheckViaIdentity.cs} | 17 +- ...omationReport_CheckViaIdentityExpanded.cs} | 17 +- ...eAutomationReport_CheckViaJsonFilePath.cs} | 15 +- ...nceAutomationReport_CheckViaJsonString.cs} | 15 +- .../tspconfig.yaml | 12 +- 9 files changed, 1106 insertions(+), 1098 deletions(-) rename tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/{TestAzAppComplianceAutomationReportNameAvailability_Check.cs => TestAzAppComplianceAutomationReport_Check.cs} (97%) rename tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/{TestAzAppComplianceAutomationReportNameAvailability_CheckExpanded.cs => TestAzAppComplianceAutomationReport_CheckExpanded.cs} (97%) rename tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/{TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentity.cs => TestAzAppComplianceAutomationReport_CheckViaIdentity.cs} (97%) rename tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/{TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded.cs => TestAzAppComplianceAutomationReport_CheckViaIdentityExpanded.cs} (97%) rename tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/{TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath.cs => TestAzAppComplianceAutomationReport_CheckViaJsonFilePath.cs} (97%) rename tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/{TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonString.cs => TestAzAppComplianceAutomationReport_CheckViaJsonString.cs} (97%) diff --git a/packages/typespec-powershell/src/convertor/convertor.ts b/packages/typespec-powershell/src/convertor/convertor.ts index c92f97bb74..3259336f5e 100644 --- a/packages/typespec-powershell/src/convertor/convertor.ts +++ b/packages/typespec-powershell/src/convertor/convertor.ts @@ -17,6 +17,7 @@ import { stat } from "fs"; import { extractPagedMetadataNested } from "../utils/operationUtil.js"; import { parseNextLinkName } from "../utils/operationUtil.js"; import { getLroMetadata } from "@azure-tools/typespec-azure-core"; +import { getOperationId } from "@typespec/openapi"; const GlobalParameter = "global-parameter"; @@ -163,9 +164,18 @@ function getOperationGroups(program: Program, client: SdkClient, psContext: SdkC return operationGroups; } +function resolveOperationId(psContext: SdkContext, op: HttpOperation, operationGroup: OperationGroup): string { + const explicitOperationId = getOperationId(psContext.program, op.operation); + if (explicitOperationId) { + return explicitOperationId; + } + return operationGroup.$key + "_" + pascalCase(op.operation.name); +} + function addOperation(psContext: SdkContext, op: HttpOperation, operationGroup: OperationGroup, model: PwshModel) { - const newOperation = new Operation(pascalCase(op.operation.name), getDoc(psContext.program, op.operation) ?? ""); - newOperation.operationId = operationGroup.$key + "_" + pascalCase(op.operation.name); + const operationId = resolveOperationId(psContext, op, operationGroup); + const newOperation = new Operation( operationId.split('_')[1] ?? pascalCase(op.operation.name), getDoc(psContext.program, op.operation) ?? ""); + newOperation.operationId = operationId; // Add Api versions newOperation.apiVersions = newOperation.apiVersions || []; newOperation.apiVersions.push({ version: getEnrichedDefaultApiVersion(psContext.program, psContext) || "" }); diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/api/AppComplianceAutomationToolForMicrosoft365.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/api/AppComplianceAutomationToolForMicrosoft365.cs index 5c1e9d37f9..292e09a7c0 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/api/AppComplianceAutomationToolForMicrosoft365.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/api/AppComplianceAutomationToolForMicrosoft365.cs @@ -4782,10 +4782,10 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } /// - /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. /// /// Report Name. - /// NameAvailabilityRequest object. + /// Parameters for the create or update operation /// 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). @@ -4795,7 +4795,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCheckNameAvailability(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ReportCreateOrUpdate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -4805,7 +4805,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4814,7 +4813,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4823,15 +4822,15 @@ public partial class AppComplianceAutomationToolForMicrosoft365 request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportCheckNameAvailability_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } /// - /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. /// /// - /// NameAvailabilityRequest object. + /// Parameters for the create or update operation /// 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). @@ -4841,7 +4840,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCheckNameAvailabilityViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -4861,7 +4860,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + reportName - + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4870,7 +4868,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4879,23 +4877,23 @@ public partial class AppComplianceAutomationToolForMicrosoft365 request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportCheckNameAvailability_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } /// - /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. /// /// - /// NameAvailabilityRequest object. + /// Parameters for the create or update operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCheckNameAvailabilityViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -4915,7 +4913,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + reportName - + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4924,7 +4921,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -4933,15 +4930,15 @@ public partial class AppComplianceAutomationToolForMicrosoft365 request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportCheckNameAvailabilityWithResult_Call (request, eventListener,sender); + return await this.ReportCreateOrUpdateWithResult_Call (request, eventListener,sender); } } /// - /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. /// /// Report Name. - /// Json string supplied to the ReportCheckNameAvailability operation + /// Json string supplied to the ReportCreateOrUpdate operation /// 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). @@ -4950,7 +4947,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCheckNameAvailabilityViaJsonString(string reportName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaJsonString(string reportName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -4960,7 +4957,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4969,7 +4965,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4978,22 +4974,22 @@ public partial class AppComplianceAutomationToolForMicrosoft365 request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportCheckNameAvailability_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } /// - /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. /// /// Report Name. - /// Json string supplied to the ReportCheckNameAvailability operation + /// Json string supplied to the ReportCreateOrUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportCheckNameAvailabilityViaJsonStringWithResult(string reportName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaJsonStringWithResult(string reportName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -5003,7 +4999,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5012,7 +5007,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -5021,23 +5016,23 @@ public partial class AppComplianceAutomationToolForMicrosoft365 request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportCheckNameAvailabilityWithResult_Call (request, eventListener,sender); + return await this.ReportCreateOrUpdateWithResult_Call (request, eventListener,sender); } } /// - /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. /// /// Report Name. - /// NameAvailabilityRequest object. + /// Parameters for the create or update operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCheckNameAvailabilityWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ReportCreateOrUpdateWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -5047,7 +5042,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5056,7 +5050,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -5065,21 +5059,19 @@ public partial class AppComplianceAutomationToolForMicrosoft365 request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportCheckNameAvailabilityWithResult_Call (request, eventListener,sender); + return await this.ReportCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportCheckNameAvailabilityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5088,8 +5080,100 @@ public partial class AppComplianceAutomationToolForMicrosoft365 { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-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 ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.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(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -5098,7 +5182,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.CheckNameAvailabilityResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); return await _result; } default: @@ -5131,7 +5215,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// Actual wire call for method. + /// 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 @@ -5141,7 +5225,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportCheckNameAvailability_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportCreateOrUpdate_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5150,8 +5234,100 @@ public partial class AppComplianceAutomationToolForMicrosoft365 { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + var operationLocation = _response.GetFirstHeader(@"Operation-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 ) + { + // delay before making the next polling request + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // 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"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { + operationLocation = _response.GetFirstHeader(@"Operation-Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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(); + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.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(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -5160,7 +5336,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.CheckNameAvailabilityResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); break; } default: @@ -5182,16 +5358,16 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// Report Name. - /// NameAvailabilityRequest object. + /// Parameters for the create or update operation /// 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 ReportCheckNameAvailability_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReportCreateOrUpdate_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -5202,21 +5378,18 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// - /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. - /// + /// Delete an AppComplianceAutomation report. /// Report Name. - /// Parameters for the create or update operation + /// a delegate that is called when the remote service returns 204 (NoContent). /// 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.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. - /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCreateOrUpdate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ReportDelete(string reportName, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -5234,34 +5407,27 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); } } - /// - /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. - /// + /// Delete an AppComplianceAutomation report. /// - /// Parameters for the create or update operation + /// a delegate that is called when the remote service returns 204 (NoContent). /// 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.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. - /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + public async global::System.Threading.Tasks.Task ReportDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -5289,77 +5455,18 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReportCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); - } - } - - /// - /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. - /// - /// - /// Parameters for the create or update operation - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. - /// Allows the caller to choose the depth of the serialization. See . - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) - { - var apiVersion = @"2024-06-27"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); - } - - // replace URI parameters with values from identity - var reportName = _match.Groups["reportName"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + reportName - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - - // 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.AppComplianceAutomation.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportCreateOrUpdateWithResult_Call (request, eventListener,sender); + await this.ReportDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); } } - /// - /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. - /// - /// Report Name. - /// Json string supplied to the ReportCreateOrUpdate operation + /// 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 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -5368,131 +5475,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportCreateOrUpdateViaJsonString(string reportName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) - { - var apiVersion = @"2024-06-27"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(jsonString, 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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReportCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); - } - } - - /// - /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. - /// - /// Report Name. - /// Json string supplied to the ReportCreateOrUpdate operation - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportCreateOrUpdateViaJsonStringWithResult(string reportName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) - { - var apiVersion = @"2024-06-27"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - - // 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.AppComplianceAutomation.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } - // set body content - request.Content = new global::System.Net.Http.StringContent(jsonString, 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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } - // make the call - return await this.ReportCreateOrUpdateWithResult_Call (request, eventListener,sender); - } - } - - /// - /// update a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report. - /// - /// Report Name. - /// Parameters for the create or update operation - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. - /// Allows the caller to choose the depth of the serialization. See . - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task ReportCreateOrUpdateWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) - { - var apiVersion = @"2024-06-27"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - - // 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.AppComplianceAutomation.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } - // make the call - return await this.ReportCreateOrUpdateWithResult_Call (request, eventListener,sender); - } - } - - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5500,20 +5483,21 @@ public partial class AppComplianceAutomationToolForMicrosoft365 try { var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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: azure-async-operation + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); var operationLocation = _response.GetFirstHeader(@"Operation-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 ) { // delay before making the next polling request - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } // while we wait, let's grab the headers and get ready to poll. if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { @@ -5536,7 +5520,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // make the polling call _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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) @@ -5585,44 +5569,38 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } // 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(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } break; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); 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.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); - return await _result; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; } default: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); - // Error Response : default - var code = (await _result)?.Code; - var message = (await _result)?.Message; - if ((null == code || null == message)) - { - // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.RestException(_response, await _result); - throw ex; - } - else - { - throw new global::System.Exception($"[{code}] : {message}"); - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -5636,8 +5614,28 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Report Name. + /// 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 ReportDelete_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(reportName),reportName); + await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); + } + } + + /// + /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. + /// + /// Report Name. /// 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). @@ -5646,7 +5644,179 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportCreateOrUpdate_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportFix(string reportName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "/fix" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReportFix_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. + /// + /// + /// 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.AppComplianceAutomation.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 ReportFixViaIdentity(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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + } + + // replace URI parameters with values from identity + var reportName = _match.Groups["reportName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + reportName + + "/fix" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReportFix_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. + /// + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportFixViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + } + + // replace URI parameters with values from identity + var reportName = _match.Groups["reportName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + reportName + + "/fix" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ReportFixWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. + /// + /// Report Name. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportFixWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "/fix" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ReportFixWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportFixWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5654,20 +5824,21 @@ public partial class AppComplianceAutomationToolForMicrosoft365 try { var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // this operation supports x-ms-long-running-operation var _originalUri = request.RequestUri.AbsoluteUri; - // declared final-state-via: azure-async-operation + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); var operationLocation = _response.GetFirstHeader(@"Operation-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 ) { // delay before making the next polling request - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // while we wait, let's grab the headers and get ready to poll. if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { @@ -5690,7 +5861,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // make the polling call _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } // if we got back an OK, take a peek inside and see if it's done if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) @@ -5739,155 +5910,59 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } // 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(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } break; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); - break; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportFixResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; } default: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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. - /// - /// Report Name. - /// Parameters for the create or update operation - /// 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 ReportCreateOrUpdate_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.IReportResource body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(reportName),reportName); - await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); - } - } - - /// Delete an AppComplianceAutomation report. - /// Report Name. - /// a delegate that is called when the remote service returns 204 (NoContent). - /// 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.AppComplianceAutomation.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 ReportDelete(string reportName, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) - { - var apiVersion = @"2024-06-27"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReportDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); - } - } - - /// Delete an AppComplianceAutomation report. - /// - /// a delegate that is called when the remote service returns 204 (NoContent). - /// 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.AppComplianceAutomation.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 ReportDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) - { - var apiVersion = @"2024-06-27"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); } - - // replace URI parameters with values from identity - var reportName = _match.Groups["reportName"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + reportName - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReportDelete_Call (request, onNoContent,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// 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 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -5896,7 +5971,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportFix_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6008,13 +6083,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportFixResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6036,15 +6105,15 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// /// Report Name. /// 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 ReportDelete_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReportFix_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -6053,6 +6122,43 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } + /// Get the AppComplianceAutomation report and its properties. + /// Report Name. + /// 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.AppComplianceAutomation.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 ReportGet(string reportName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReportGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + /// /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. /// @@ -6065,7 +6171,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportFix(string reportName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetScopingQuestions(string reportName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6075,7 +6181,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/fix" + + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6089,7 +6195,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportFix_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportGetScopingQuestions_Call (request, onOk,onDefault,eventListener,sender); } } @@ -6105,7 +6211,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportFixViaIdentity(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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetScopingQuestionsViaIdentity(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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6125,7 +6231,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + reportName - + "/fix" + + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6139,7 +6245,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportFix_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportGetScopingQuestions_Call (request, onOk,onDefault,eventListener,sender); } } @@ -6150,10 +6256,10 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportFixViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetScopingQuestionsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6173,7 +6279,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + reportName - + "/fix" + + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6187,7 +6293,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportFixWithResult_Call (request, eventListener,sender); + return await this.ReportGetScopingQuestionsWithResult_Call (request, eventListener,sender); } } @@ -6198,10 +6304,10 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportFixWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetScopingQuestionsWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6211,7 +6317,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/fix" + + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6225,293 +6331,59 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportFixWithResult_Call (request, eventListener,sender); + return await this.ReportGetScopingQuestionsWithResult_Call (request, eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportFixWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - // 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"); - var operationLocation = _response.GetFirstHeader(@"Operation-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 ) - { - // delay before making the next polling request - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - - // 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"); - } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { - operationLocation = _response.GetFirstHeader(@"Operation-Location"); - } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; - request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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(); - - // drop the old response - _response?.Dispose(); - - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - - // 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.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.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.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - break; - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; - - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportFixResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); - return await _result; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); - // Error Response : default - var code = (await _result)?.Code; - var message = (await _result)?.Message; - if ((null == code || null == message)) - { - // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.RestException(_response, await _result); - throw ex; - } - else - { - throw new global::System.Exception($"[{code}] : {message}"); - } - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } - } - } - - /// 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.AppComplianceAutomation.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 ReportFix_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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"); - var operationLocation = _response.GetFirstHeader(@"Operation-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 ) - { - // delay before making the next polling request - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.DelayBeforePolling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - - // 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"); - } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) { - operationLocation = _response.GetFirstHeader(@"Operation-Location"); - } - var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? global::System.String.IsNullOrEmpty(operationLocation) ? _originalUri : operationLocation : location : asyncOperation; - request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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(); - - // drop the old response - _response?.Dispose(); - - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.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.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + internal async global::System.Threading.Tasks.Task ReportGetScopingQuestionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportFixResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ScopingQuestions.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; } default: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } } } } @@ -6525,26 +6397,8 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. - /// - /// Report Name. - /// 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 ReportFix_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(reportName),reportName); - await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); - } - } - - /// Get the AppComplianceAutomation report and its properties. - /// Report Name. + /// 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). @@ -6553,76 +6407,65 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportGet(string reportName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportGetScopingQuestions_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { - var apiVersion = @"2024-06-27"; - // Constant Parameters using( NoSynchronizationContext ) { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReportGet_Call (request, onOk,onDefault,eventListener,sender); + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ScopingQuestions.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } /// - /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// /// Report Name. - /// 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.AppComplianceAutomation.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 ReportGetScopingQuestions(string reportName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportGetScopingQuestions_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) { - var apiVersion = @"2024-06-27"; - // Constant Parameters using( NoSynchronizationContext ) { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) - + "/getScopingQuestions" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReportGetScopingQuestions_Call (request, onOk,onDefault,eventListener,sender); + await eventListener.AssertNotNull(nameof(reportName),reportName); + await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); } } - /// - /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. - /// + /// Get the AppComplianceAutomation report and its properties. /// /// 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 @@ -6632,7 +6475,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportGetScopingQuestionsViaIdentity(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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetViaIdentity(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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6652,7 +6495,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + reportName - + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6661,26 +6503,24 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportGetScopingQuestions_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. - /// + /// Get the AppComplianceAutomation report and its properties. /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportGetScopingQuestionsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6700,7 +6540,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + reportName - + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6709,26 +6548,24 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportGetScopingQuestionsWithResult_Call (request, eventListener,sender); + return await this.ReportGetWithResult_Call (request, eventListener,sender); } } - /// - /// Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed. - /// + /// Get the AppComplianceAutomation report and its properties. /// Report Name. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportGetScopingQuestionsWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportGetWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6738,7 +6575,6 @@ public partial class AppComplianceAutomationToolForMicrosoft365 var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.AppComplianceAutomation/reports/" + global::System.Uri.EscapeDataString(reportName) - + "/getScopingQuestions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6747,26 +6583,24 @@ public partial class AppComplianceAutomationToolForMicrosoft365 // 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.AppComplianceAutomation.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportGetScopingQuestionsWithResult_Call (request, eventListener,sender); + return await this.ReportGetWithResult_Call (request, eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportGetScopingQuestionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6785,7 +6619,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ScopingQuestions.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); return await _result; } default: @@ -6818,7 +6652,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// Actual wire call for method. + /// 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 @@ -6828,7 +6662,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportGetScopingQuestions_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportGet_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6847,7 +6681,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ScopingQuestions.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); break; } default: @@ -6868,26 +6702,89 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// - /// Report Name. - /// 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 ReportGetScopingQuestions_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(reportName),reportName); - await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// Report Name. + /// 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 ReportGet_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(reportName),reportName); + await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); + } + } + + /// Get the AppComplianceAutomation report list for the tenant. + /// Skip over when retrieving results. + /// Number of elements to return when retrieving results. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. + /// The filter to apply on the operation. + /// OData order by query option. + /// The offerGuid which mapping to the reports. + /// The tenant id of the report creator. + /// 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.AppComplianceAutomation.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 ReportList(string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) + + "&" + + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) + + "&" + + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReportList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get the AppComplianceAutomation report and its properties. + /// Get the AppComplianceAutomation report list for the tenant. /// + /// Skip over when retrieving results. + /// Number of elements to return when retrieving results. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. + /// The filter to apply on the operation. + /// OData order by query option. + /// The offerGuid which mapping to the reports. + /// The tenant id of the report creator. /// 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). @@ -6896,7 +6793,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportGetViaIdentity(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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportListViaIdentity(global::System.String viaIdentity, string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6904,20 +6801,32 @@ public partial class AppComplianceAutomationToolForMicrosoft365 { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports'"); } // replace URI parameters with values from identity - var reportName = _match.Groups["reportName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + reportName + "/providers/Microsoft.AppComplianceAutomation/reports" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) + + "&" + + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) + + "&" + + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -6929,19 +6838,26 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportGet_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get the AppComplianceAutomation report and its properties. + /// Get the AppComplianceAutomation report list for the tenant. /// + /// Skip over when retrieving results. + /// Number of elements to return when retrieving results. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. + /// The filter to apply on the operation. + /// OData order by query option. + /// The offerGuid which mapping to the reports. + /// The tenant id of the report creator. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportListViaIdentityWithResult(global::System.String viaIdentity, string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6949,20 +6865,32 @@ public partial class AppComplianceAutomationToolForMicrosoft365 { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports'"); } // replace URI parameters with values from identity - var reportName = _match.Groups["reportName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + reportName + "/providers/Microsoft.AppComplianceAutomation/reports" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) + + "&" + + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) + + "&" + + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -6974,19 +6902,25 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportGetWithResult_Call (request, eventListener,sender); + return await this.ReportListWithResult_Call (request, eventListener,sender); } } - /// Get the AppComplianceAutomation report and its properties. - /// Report Name. + /// Get the AppComplianceAutomation report list for the tenant. + /// Skip over when retrieving results. + /// Number of elements to return when retrieving results. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. + /// The filter to apply on the operation. + /// OData order by query option. + /// The offerGuid which mapping to the reports. + /// The tenant id of the report creator. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportGetWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportListWithResult(string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -6994,10 +6928,23 @@ public partial class AppComplianceAutomationToolForMicrosoft365 { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports/" - + global::System.Uri.EscapeDataString(reportName) + "/providers/Microsoft.AppComplianceAutomation/reports" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) + + "&" + + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) + + "&" + + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } @@ -7009,19 +6956,19 @@ public partial class AppComplianceAutomationToolForMicrosoft365 await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportGetWithResult_Call (request, eventListener,sender); + return await this.ReportListWithResult_Call (request, eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7040,7 +6987,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers)); + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResourceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: @@ -7073,7 +7020,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// Actual wire call for method. + /// 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 @@ -7083,7 +7030,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportGet_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportList_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7102,7 +7049,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) .ReadHeaders(_response.Headers))); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResourceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -7124,88 +7071,201 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } /// - /// Validation method for method. Call this like the actual call, but you will get validation events + /// Validation method for method. Call this like the actual call, but you will get validation events /// back. /// + /// Skip over when retrieving results. + /// Number of elements to return when retrieving results. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. + /// The filter to apply on the operation. + /// OData order by query option. + /// The offerGuid which mapping to the reports. + /// The tenant id of the report creator. + /// 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 ReportList_Validate(string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(SkipToken),SkipToken); + await eventListener.AssertIsGreaterThanOrEqual(nameof(Top),Top,1); + await eventListener.AssertIsLessThanOrEqual(nameof(Top),Top,100); + await eventListener.AssertNotNull(nameof(Select),Select); + await eventListener.AssertMinimumLength(nameof(Select),Select,1); + await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertMinimumLength(nameof(Filter),Filter,1); + await eventListener.AssertNotNull(nameof(Orderby),Orderby); + await eventListener.AssertMinimumLength(nameof(Orderby),Orderby,1); + await eventListener.AssertNotNull(nameof(offerGuid),offerGuid); + await eventListener.AssertMinimumLength(nameof(offerGuid),offerGuid,1); + await eventListener.AssertNotNull(nameof(reportCreatorTenantId),reportCreatorTenantId); + await eventListener.AssertMinimumLength(nameof(reportCreatorTenantId),reportCreatorTenantId,1); + } + } + + /// + /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// /// Report Name. + /// NameAvailabilityRequest object. + /// 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.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportGet_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailability(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2024-06-27"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(reportName),reportName); - await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReportNestedResourceCheckNameAvailability_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// + /// + /// NameAvailabilityRequest object. + /// 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.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailabilityViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2024-06-27"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + } + + // replace URI parameters with values from identity + var reportName = _match.Groups["reportName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AppComplianceAutomation/reports/" + + reportName + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReportNestedResourceCheckNameAvailability_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get the AppComplianceAutomation report list for the tenant. - /// Skip over when retrieving results. - /// Number of elements to return when retrieving results. - /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. - /// The filter to apply on the operation. - /// OData order by query option. - /// The offerGuid which mapping to the reports. - /// The tenant id of the report creator. - /// 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). + /// + /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// + /// + /// NameAvailabilityRequest object. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportList(string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailabilityViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2024-06-27"; // Constant Parameters using( NoSynchronizationContext ) { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports/{reportName}'"); + } + + // replace URI parameters with values from identity + var reportName = _match.Groups["reportName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports" + "/providers/Microsoft.AppComplianceAutomation/reports/" + + reportName + + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) - + "&" - + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) - + "&" - + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.AppComplianceAutomation.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.ReportList_Call (request, onOk,onDefault,eventListener,sender); + return await this.ReportNestedResourceCheckNameAvailabilityWithResult_Call (request, eventListener,sender); } } - /// Get the AppComplianceAutomation report list for the tenant. - /// - /// Skip over when retrieving results. - /// Number of elements to return when retrieving results. - /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. - /// The filter to apply on the operation. - /// OData order by query option. - /// The offerGuid which mapping to the reports. - /// The tenant id of the report creator. + /// + /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// + /// Report Name. + /// Json string supplied to the ReportNestedResourceCheckNameAvailability operation /// 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). @@ -7214,134 +7274,94 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportListViaIdentity(global::System.String viaIdentity, string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailabilityViaJsonString(string reportName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports'"); - } - - // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports" + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) - + "&" - + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) - + "&" - + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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.AppComplianceAutomation.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, 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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReportList_Call (request, onOk,onDefault,eventListener,sender); + await this.ReportNestedResourceCheckNameAvailability_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get the AppComplianceAutomation report list for the tenant. - /// - /// Skip over when retrieving results. - /// Number of elements to return when retrieving results. - /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. - /// The filter to apply on the operation. - /// OData order by query option. - /// The offerGuid which mapping to the reports. - /// The tenant id of the report creator. + /// + /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// + /// Report Name. + /// Json string supplied to the ReportNestedResourceCheckNameAvailability operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportListViaIdentityWithResult(global::System.String viaIdentity, string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailabilityViaJsonStringWithResult(string reportName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { var apiVersion = @"2024-06-27"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AppComplianceAutomation/reports$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AppComplianceAutomation/reports'"); - } - - // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports" + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) - + "&" - + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) - + "&" - + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.AppComplianceAutomation.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, 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.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportListWithResult_Call (request, eventListener,sender); + return await this.ReportNestedResourceCheckNameAvailabilityWithResult_Call (request, eventListener,sender); } } - /// Get the AppComplianceAutomation report list for the tenant. - /// Skip over when retrieving results. - /// Number of elements to return when retrieving results. - /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. - /// The filter to apply on the operation. - /// OData order by query option. - /// The offerGuid which mapping to the reports. - /// The tenant id of the report creator. + /// + /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. + /// + /// Report Name. + /// NameAvailabilityRequest object. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task ReportListWithResult(string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailabilityWithResult(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2024-06-27"; // Constant Parameters @@ -7349,47 +7369,41 @@ public partial class AppComplianceAutomationToolForMicrosoft365 { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.AppComplianceAutomation/reports" + "/providers/Microsoft.AppComplianceAutomation/reports/" + + global::System.Uri.EscapeDataString(reportName) + + "/checkNameAvailability" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(Select) ? global::System.String.Empty : "$select=" + global::System.Uri.EscapeDataString(Select)) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (string.IsNullOrEmpty(Orderby) ? global::System.String.Empty : "$orderby=" + global::System.Uri.EscapeDataString(Orderby)) - + "&" - + (string.IsNullOrEmpty(offerGuid) ? global::System.String.Empty : "offerGuid=" + global::System.Uri.EscapeDataString(offerGuid)) - + "&" - + (string.IsNullOrEmpty(reportCreatorTenantId) ? global::System.String.Empty : "reportCreatorTenantId=" + global::System.Uri.EscapeDataString(reportCreatorTenantId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.AppComplianceAutomation.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - return await this.ReportListWithResult_Call (request, eventListener,sender); + return await this.ReportNestedResourceCheckNameAvailabilityWithResult_Call (request, eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.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 ReportListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailabilityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7408,7 +7422,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } - var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResourceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.CheckNameAvailabilityResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: @@ -7441,7 +7455,9 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } } - /// Actual wire call for method. + /// + /// 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 @@ -7451,7 +7467,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task ReportList_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailability_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.AppComplianceAutomation.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7470,7 +7486,7 @@ public partial class AppComplianceAutomationToolForMicrosoft365 case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ReportResourceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.CheckNameAvailabilityResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -7492,37 +7508,23 @@ public partial class AppComplianceAutomationToolForMicrosoft365 } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. /// - /// Skip over when retrieving results. - /// Number of elements to return when retrieving results. - /// OData Select statement. Limits the properties on each entry to just those requested, e.g. ?$select=reportName,id. - /// The filter to apply on the operation. - /// OData order by query option. - /// The offerGuid which mapping to the reports. - /// The tenant id of the report creator. + /// Report Name. + /// NameAvailabilityRequest object. /// 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 ReportList_Validate(string SkipToken, int? Top, string Select, string Filter, string Orderby, string offerGuid, string reportCreatorTenantId, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReportNestedResourceCheckNameAvailability_Validate(string reportName, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(SkipToken),SkipToken); - await eventListener.AssertIsGreaterThanOrEqual(nameof(Top),Top,1); - await eventListener.AssertIsLessThanOrEqual(nameof(Top),Top,100); - await eventListener.AssertNotNull(nameof(Select),Select); - await eventListener.AssertMinimumLength(nameof(Select),Select,1); - await eventListener.AssertNotNull(nameof(Filter),Filter); - await eventListener.AssertMinimumLength(nameof(Filter),Filter,1); - await eventListener.AssertNotNull(nameof(Orderby),Orderby); - await eventListener.AssertMinimumLength(nameof(Orderby),Orderby,1); - await eventListener.AssertNotNull(nameof(offerGuid),offerGuid); - await eventListener.AssertMinimumLength(nameof(offerGuid),offerGuid,1); - await eventListener.AssertNotNull(nameof(reportCreatorTenantId),reportCreatorTenantId); - await eventListener.AssertMinimumLength(nameof(reportCreatorTenantId),reportCreatorTenantId,1); + await eventListener.AssertNotNull(nameof(reportName),reportName); + await eventListener.AssertRegEx(nameof(reportName), reportName, @"^[-a-zA-Z0-9_]{1,50}$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_Check.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_Check.cs similarity index 97% rename from tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_Check.cs rename to tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_Check.cs index 98f4fa69c2..f61de8f5f9 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_Check.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_Check.cs @@ -12,14 +12,14 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. /// /// - /// [OpenAPI] CheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" + /// [OpenAPI] NestedResourceCheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" /// - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReportNameAvailability_Check", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReport_Check", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Description(@"Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.HttpPath(Path = "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability", ApiVersion = "2024-06-27")] - public partial class TestAzAppComplianceAutomationReportNameAvailability_Check : global::System.Management.Automation.PSCmdlet, + public partial class TestAzAppComplianceAutomationReport_Check : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IContext { @@ -110,6 +110,21 @@ public partial class TestAzAppComplianceAutomationReportNameAvailability_Check : /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + /// Backing field for property. + private string _name; + + /// Report Name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Report Name.")] + [Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Report Name.", + SerializedName = @"reportName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ReportName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + /// /// The instance of the that the remote call will use. /// @@ -131,20 +146,6 @@ public partial class TestAzAppComplianceAutomationReportNameAvailability_Check : [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } - /// Backing field for property. - private string _reportName; - - /// Report Name. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Report Name.")] - [Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"Report Name.", - SerializedName = @"reportName", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.ParameterCategory.Path)] - public string ReportName { get => this._reportName; set => this._reportName = value; } - /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior @@ -302,7 +303,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ReportCheckNameAvailability' operation")) + if (ShouldProcess($"Call remote 'ReportNestedResourceCheckNameAvailability' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token) ) { @@ -354,12 +355,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ReportCheckNameAvailability(ReportName, Body, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailability(Name, Body, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ReportName=ReportName}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -379,9 +380,9 @@ protected override void StopProcessing() } /// - /// Initializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// - public TestAzAppComplianceAutomationReportNameAvailability_Check() + public TestAzAppComplianceAutomationReport_Check() { } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckExpanded.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckExpanded.cs similarity index 97% rename from tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckExpanded.cs rename to tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckExpanded.cs index c0b53172cc..109b66292a 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckExpanded.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckExpanded.cs @@ -12,14 +12,14 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. /// /// - /// [OpenAPI] CheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" + /// [OpenAPI] NestedResourceCheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" /// - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReportNameAvailability_CheckExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReport_CheckExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Description(@"Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.HttpPath(Path = "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability", ApiVersion = "2024-06-27")] - public partial class TestAzAppComplianceAutomationReportNameAvailability_CheckExpanded : global::System.Management.Automation.PSCmdlet, + public partial class TestAzAppComplianceAutomationReport_CheckExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IContext { @@ -313,7 +313,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ReportCheckNameAvailability' operation")) + if (ShouldProcess($"Call remote 'ReportNestedResourceCheckNameAvailability' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token) ) { @@ -365,7 +365,7 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ReportCheckNameAvailability(ReportName, _body, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailability(ReportName, _body, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.UndeclaredResponseException urexception) @@ -390,10 +390,9 @@ protected override void StopProcessing() } /// - /// Initializes a new instance of the cmdlet - /// class. + /// Initializes a new instance of the cmdlet class. /// - public TestAzAppComplianceAutomationReportNameAvailability_CheckExpanded() + public TestAzAppComplianceAutomationReport_CheckExpanded() { } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentity.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaIdentity.cs similarity index 97% rename from tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentity.cs rename to tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaIdentity.cs index 08f54557e3..49b7d9195d 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentity.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaIdentity.cs @@ -12,14 +12,14 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. /// /// - /// [OpenAPI] CheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" + /// [OpenAPI] NestedResourceCheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" /// - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReportNameAvailability_CheckViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReport_CheckViaIdentity", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Description(@"Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.HttpPath(Path = "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability", ApiVersion = "2024-06-27")] - public partial class TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentity : global::System.Management.Automation.PSCmdlet, + public partial class TestAzAppComplianceAutomationReport_CheckViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IContext { @@ -296,7 +296,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ReportCheckNameAvailability' operation")) + if (ShouldProcess($"Call remote 'ReportNestedResourceCheckNameAvailability' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token) ) { @@ -350,7 +350,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.ReportCheckNameAvailabilityViaIdentity(InputObject.Id, Body, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailabilityViaIdentity(InputObject.Id, Body, onOk, onDefault, this, Pipeline); } else { @@ -359,7 +359,7 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReportName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.ReportCheckNameAvailability(InputObject.ReportName ?? null, Body, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailability(InputObject.ReportName ?? null, Body, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } @@ -385,10 +385,9 @@ protected override void StopProcessing() } /// - /// Initializes a new instance of the - /// cmdlet class. + /// Initializes a new instance of the cmdlet class. /// - public TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentity() + public TestAzAppComplianceAutomationReport_CheckViaIdentity() { } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaIdentityExpanded.cs similarity index 97% rename from tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded.cs rename to tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaIdentityExpanded.cs index 6f4568a840..3e0f717b18 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaIdentityExpanded.cs @@ -12,14 +12,14 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. /// /// - /// [OpenAPI] CheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" + /// [OpenAPI] NestedResourceCheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" /// - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReport_CheckViaIdentityExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Description(@"Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.HttpPath(Path = "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability", ApiVersion = "2024-06-27")] - public partial class TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + public partial class TestAzAppComplianceAutomationReport_CheckViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IContext { @@ -307,7 +307,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ReportCheckNameAvailability' operation")) + if (ShouldProcess($"Call remote 'ReportNestedResourceCheckNameAvailability' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token) ) { @@ -361,7 +361,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.ReportCheckNameAvailabilityViaIdentity(InputObject.Id, _body, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailabilityViaIdentity(InputObject.Id, _body, onOk, onDefault, this, Pipeline); } else { @@ -370,7 +370,7 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReportName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.ReportCheckNameAvailability(InputObject.ReportName ?? null, _body, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailability(InputObject.ReportName ?? null, _body, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } @@ -396,10 +396,9 @@ protected override void StopProcessing() } /// - /// Initializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// - public TestAzAppComplianceAutomationReportNameAvailability_CheckViaIdentityExpanded() + public TestAzAppComplianceAutomationReport_CheckViaIdentityExpanded() { } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaJsonFilePath.cs similarity index 97% rename from tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath.cs rename to tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaJsonFilePath.cs index de5ae02051..73c6e97f94 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaJsonFilePath.cs @@ -12,15 +12,15 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. /// /// - /// [OpenAPI] CheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" + /// [OpenAPI] NestedResourceCheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" /// - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReport_CheckViaJsonFilePath", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Description(@"Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.HttpPath(Path = "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability", ApiVersion = "2024-06-27")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.NotSuggestDefaultParameterSet] - public partial class TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + public partial class TestAzAppComplianceAutomationReport_CheckViaJsonFilePath : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IContext { @@ -304,7 +304,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ReportCheckNameAvailability' operation")) + if (ShouldProcess($"Call remote 'ReportNestedResourceCheckNameAvailability' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token) ) { @@ -356,7 +356,7 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ReportCheckNameAvailabilityViaJsonString(ReportName, _jsonString, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailabilityViaJsonString(ReportName, _jsonString, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.UndeclaredResponseException urexception) @@ -381,10 +381,9 @@ protected override void StopProcessing() } /// - /// Initializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// - public TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonFilePath() + public TestAzAppComplianceAutomationReport_CheckViaJsonFilePath() { } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonString.cs b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaJsonString.cs similarity index 97% rename from tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonString.cs rename to tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaJsonString.cs index 938bf9c5cd..18075038ba 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonString.cs +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/target/generated/cmdlets/TestAzAppComplianceAutomationReport_CheckViaJsonString.cs @@ -12,15 +12,15 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Cmdlets /// Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots. /// /// - /// [OpenAPI] CheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" + /// [OpenAPI] NestedResourceCheckNameAvailability=>POST:"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" /// - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReportNameAvailability_CheckViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzAppComplianceAutomationReport_CheckViaJsonString", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Models.ICheckNameAvailabilityResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Description(@"Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.HttpPath(Path = "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability", ApiVersion = "2024-06-27")] [global::Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.NotSuggestDefaultParameterSet] - public partial class TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonString : global::System.Management.Automation.PSCmdlet, + public partial class TestAzAppComplianceAutomationReport_CheckViaJsonString : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IContext { @@ -302,7 +302,7 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'ReportCheckNameAvailability' operation")) + if (ShouldProcess($"Call remote 'ReportNestedResourceCheckNameAvailability' operation")) { using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token) ) { @@ -354,7 +354,7 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.ReportCheckNameAvailabilityViaJsonString(ReportName, _jsonString, onOk, onDefault, this, Pipeline); + await this.Client.ReportNestedResourceCheckNameAvailabilityViaJsonString(ReportName, _jsonString, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.AppComplianceAutomation.Runtime.UndeclaredResponseException urexception) @@ -379,10 +379,9 @@ protected override void StopProcessing() } /// - /// Initializes a new instance of the - /// cmdlet class. + /// Initializes a new instance of the cmdlet class. /// - public TestAzAppComplianceAutomationReportNameAvailability_CheckViaJsonString() + public TestAzAppComplianceAutomationReport_CheckViaJsonString() { } diff --git a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/tspconfig.yaml b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/tspconfig.yaml index 07279c021d..07ea34d2f5 100644 --- a/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/tspconfig.yaml +++ b/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/tspconfig.yaml @@ -42,14 +42,14 @@ options: service-dir: "src" package-dir: "AppComplianceAutomation/AppComplianceAutomation.Autorest" clear-output-folder: true - azure: true + # azure: true module-version: 0.1.0 - skip-model-cmdlets: false - help-link-prefix: https://learn.microsoft.com/powershell/module/ + # skip-model-cmdlets: false + # help-link-prefix: https://learn.microsoft.com/powershell/module/ metadata: authors: Microsoft Corporation owners: Microsoft Corporation - description: 'Microsoft Azure PowerShell: AppComplianceAutomation cmdlets' + description: 'Microsoft Azure PowerShell: App ComplianceAutomation cmdlets' copyright: Microsoft Corporation. All rights reserved. tags: Azure ResourceManager ARM PSModule Sphere companyName: Microsoft Corporation @@ -60,8 +60,8 @@ options: subject-prefix: 'AppComplianceAutomation' service-name: AppComplianceAutomation module-name: "{prefix}.{service-name}" - namespace: "Microsoft.Azure.PowerShell.Cmdlets.{service-name}" - use-namespace-folders: false + # namespace: "Microsoft.Azure.PowerShell.Cmdlets.{service-name}" + # use-namespace-folders: false # output-folder: "{output-dir}" exclude-tableview-properties: - Id