Skip to content

Migrate Monitor from generation to main #23877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/Monitor/ActionGroup.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ For information on how to develop for `Az.ActionGroup`, see [how-to.md](how-to.m
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
branch: 47d1d82108a0db0395ed4eca106622becee7fbb4
commit: 47d1d82108a0db0395ed4eca106622becee7fbb4

input-file:
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/actionGroups_API.json
Expand Down
8 changes: 3 additions & 5 deletions src/Monitor/ActionGroup.Autorest/generate-portal-ux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ $instance = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module]::Ins
$moduleInfo = Get-Module -Name $moduleName
$parameterSetsInfo = Get-Module -Name "$moduleName.private"

$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet")

function Test-FunctionSupported()
{
[CmdletBinding()]
Expand All @@ -53,12 +51,12 @@ function Test-FunctionSupported()
$FunctionName
)

If ($buildinfunctions.Contains($FunctionName)) {
If (-not $FunctionName.Contains("_")) {
return $false
}

$cmdletName, $parameterSetName = $FunctionName.Split("_")
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) {
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity") -or $parameterSetName.Contains("ViaJson")) {
return $false
}
If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) {
Expand Down Expand Up @@ -311,7 +309,7 @@ function New-MetadataForCmdlet()
return $result
}

$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) }
$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-FunctionSupported($_) }
$resourceTypes = @{}
foreach ($parameterSetName in $parameterSets)
{
Expand Down
27 changes: 20 additions & 7 deletions src/Monitor/ActionGroup.Autorest/generated/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ public partial class Module

public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler();

private static bool _init = false;

private static readonly global::System.Object _initLock = new global::System.Object();

private static Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module _instance;

/// <summary>the ISendAsync pipeline instance</summary>
private Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.HttpPipeline _pipeline;

/// <summary>the ISendAsync pipeline instance (when proxy is enabled)</summary>
private Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.HttpPipeline _pipelineWithProxy;

private static readonly global::System.Object _singletonLock = new global::System.Object();

public bool _useProxy = false;

public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy();
Expand All @@ -51,11 +59,8 @@ public partial class Module
/// <summary>The delegate to get the telemetry Id.</summary>
public GetTelemetryIdDelegate GetTelemetryId { get; set; }

/// <summary>Backing field for <see cref="Instance" /> property.</summary>
private static Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module _instance;

/// <summary>the singleton of this module class</summary>
public static Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module());
public static Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } }

/// <summary>The Name of this module</summary>
public string Name => @"Az.ActionGroup";
Expand Down Expand Up @@ -117,9 +122,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.HttpPipeli
/// <summary>Initialization steps performed after the module is loaded.</summary>
public void Init()
{
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } );
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } );
CustomInit();
if (_init == false)
{
lock (_initLock) {
if (_init == false) {
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } );
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } );
CustomInit();
_init = true;
}
}
}
}

/// <summary>Creates the module instance.</summary>
Expand Down
24 changes: 7 additions & 17 deletions src/Monitor/ActionGroup.Autorest/generated/api/ActionGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,6 @@ public partial class ActionGroup
/// <param name="actionGroupName">The name of the action group.</param>
/// <param name="body">The receiver to re-enable.</param>
/// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param>
/// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param>
/// <param name="onDefault">a delegate that is called when the remote service returns default (any response code not handled
/// elsewhere).</param>
/// <param name="eventListener">an <see cref="Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener" /> instance that will receive events.</param>
Expand All @@ -1302,7 +1301,7 @@ public partial class ActionGroup
/// <returns>
/// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed.
/// </returns>
public async global::System.Threading.Tasks.Task ActionGroupsEnableReceiver(string subscriptionId, string resourceGroupName, string actionGroupName, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IEnableRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeUpdate)
public async global::System.Threading.Tasks.Task ActionGroupsEnableReceiver(string subscriptionId, string resourceGroupName, string actionGroupName, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IEnableRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeUpdate)
{
var apiVersion = @"2023-01-01";
// Constant Parameters
Expand Down Expand Up @@ -1334,7 +1333,7 @@ public partial class ActionGroup
request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
// make the call
await this.ActionGroupsEnableReceiver_Call (request, onOk,onConflict,onDefault,eventListener,sender);
await this.ActionGroupsEnableReceiver_Call (request, onOk,onDefault,eventListener,sender);
}
}

Expand All @@ -1345,7 +1344,6 @@ public partial class ActionGroup
/// <param name="viaIdentity"></param>
/// <param name="body">The receiver to re-enable.</param>
/// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param>
/// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param>
/// <param name="onDefault">a delegate that is called when the remote service returns default (any response code not handled
/// elsewhere).</param>
/// <param name="eventListener">an <see cref="Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener" /> instance that will receive events.</param>
Expand All @@ -1354,7 +1352,7 @@ public partial class ActionGroup
/// <returns>
/// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed.
/// </returns>
public async global::System.Threading.Tasks.Task ActionGroupsEnableReceiverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IEnableRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeUpdate)
public async global::System.Threading.Tasks.Task ActionGroupsEnableReceiverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IEnableRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.SerializationMode.IncludeUpdate)
{
var apiVersion = @"2023-01-01";
// Constant Parameters
Expand Down Expand Up @@ -1398,7 +1396,7 @@ public partial class ActionGroup
request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
// make the call
await this.ActionGroupsEnableReceiver_Call (request, onOk,onConflict,onDefault,eventListener,sender);
await this.ActionGroupsEnableReceiver_Call (request, onOk,onDefault,eventListener,sender);
}
}

Expand All @@ -1411,15 +1409,14 @@ public partial class ActionGroup
/// <param name="actionGroupName">The name of the action group.</param>
/// <param name="jsonString">Json string supplied to the ActionGroupsEnableReceiver operation</param>
/// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param>
/// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param>
/// <param name="onDefault">a delegate that is called when the remote service returns default (any response code not handled
/// elsewhere).</param>
/// <param name="eventListener">an <see cref="Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener" /> instance that will receive events.</param>
/// <param name="sender">an instance of an Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync pipeline to use to make the request.</param>
/// <returns>
/// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed.
/// </returns>
public async global::System.Threading.Tasks.Task ActionGroupsEnableReceiverViaJsonString(string subscriptionId, string resourceGroupName, string actionGroupName, global::System.String jsonString, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender)
public async global::System.Threading.Tasks.Task ActionGroupsEnableReceiverViaJsonString(string subscriptionId, string resourceGroupName, string actionGroupName, global::System.String jsonString, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender)
{
var apiVersion = @"2023-01-01";
// Constant Parameters
Expand Down Expand Up @@ -1451,22 +1448,21 @@ public partial class ActionGroup
request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; }
// make the call
await this.ActionGroupsEnableReceiver_Call (request, onOk,onConflict,onDefault,eventListener,sender);
await this.ActionGroupsEnableReceiver_Call (request, onOk,onDefault,eventListener,sender);
}
}

/// <summary>Actual wire call for <see cref= "ActionGroupsEnableReceiver" /> method.</summary>
/// <param name="request">the prepared HttpRequestMessage to send.</param>
/// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param>
/// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param>
/// <param name="onDefault">a delegate that is called when the remote service returns default (any response code not handled
/// elsewhere).</param>
/// <param name="eventListener">an <see cref="Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener" /> instance that will receive events.</param>
/// <param name="sender">an instance of an Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync pipeline to use to make the request.</param>
/// <returns>
/// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed.
/// </returns>
internal async global::System.Threading.Tasks.Task ActionGroupsEnableReceiver_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender)
internal async global::System.Threading.Tasks.Task ActionGroupsEnableReceiver_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Models.IErrorResponse>, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.ISendAsync sender)
{
using( NoSynchronizationContext )
{
Expand All @@ -1488,12 +1484,6 @@ public partial class ActionGroup
await onOk(_response);
break;
}
case global::System.Net.HttpStatusCode.Conflict:
{
await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
await onConflict(_response);
break;
}
default:
{
await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
Expand Down
Loading