Skip to content

Commit

Permalink
Migrate ApplicationInsights from generation to main (#20782)
Browse files Browse the repository at this point in the history
* Move ApplicationInsights to main

* Update ChangeLog.md

---------

Co-authored-by: Yabo Hu <yabhu@microsoft.com>
  • Loading branch information
azure-powershell-bot and VeryEarly authored Jan 30, 2023
1 parent 23aad2b commit 459b6f6
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 69 deletions.
66 changes: 36 additions & 30 deletions src/ApplicationInsights/ApplicationInsights.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{43DCE324-743F-44AD-A380-E57208168AC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{FF66413F-453E-425D-B003-79C16A4C2CBB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{48452AD8-CFFD-4B08-8A53-C295E5721AA9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ApplicationInsights", "Az.ApplicationInsights.csproj", "{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ApplicationInsights", "Az.ApplicationInsights.csproj", "{371A62A3-148D-42BD-95EE-DCD05A003DF0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -24,29 +26,33 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1625AD17-DDE6-4E3D-8124-D2326AEC2A7A}.Release|Any CPU.Build.0 = Release|Any CPU
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DF7B7D5-CC89-4D38-AD4E-6FC0F480F068}.Release|Any CPU.Build.0 = Release|Any CPU
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E2987C0-09B0-41DB-A1A2-7FD3F4D021C3}.Release|Any CPU.Build.0 = Release|Any CPU
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13D2CAE7-AD3B-475D-8B60-26CDCCDEED67}.Release|Any CPU.Build.0 = Release|Any CPU
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D2AE481-CB85-4882-8AF7-B93B7FEC7451}.Release|Any CPU.Build.0 = Release|Any CPU
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2243E46B-2C05-4FA0-AC0B-EFD5DA24E20D}.Release|Any CPU.Build.0 = Release|Any CPU
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E3FEA03-4F54-4AE2-B678-A3FF26CBF753}.Release|Any CPU.Build.0 = Release|Any CPU
{43DCE324-743F-44AD-A380-E57208168AC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43DCE324-743F-44AD-A380-E57208168AC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43DCE324-743F-44AD-A380-E57208168AC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43DCE324-743F-44AD-A380-E57208168AC3}.Release|Any CPU.Build.0 = Release|Any CPU
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF66413F-453E-425D-B003-79C16A4C2CBB}.Release|Any CPU.Build.0 = Release|Any CPU
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48452AD8-CFFD-4B08-8A53-C295E5721AA9}.Release|Any CPU.Build.0 = Release|Any CPU
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E79D346-6BD1-4000-95E1-AAFB2E70B8A5}.Release|Any CPU.Build.0 = Release|Any CPU
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A370B7D-04F3-4DA4-A81B-0CBE696E8F4A}.Release|Any CPU.Build.0 = Release|Any CPU
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{371A62A3-148D-42BD-95EE-DCD05A003DF0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions src/ApplicationInsights/Az.ApplicationInsights.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 1/6/2023
# Generated on: 1/30/2023
#

@{
Expand Down Expand Up @@ -141,7 +141,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Enabled output object enumerating for ''Get-AzApplicationInsights'' [#20225]'
# ReleaseNotes = ''

# Prerelease string of this module
# Prerelease = ''
Expand Down
2 changes: 1 addition & 1 deletion src/ApplicationInsights/Az.ApplicationInsights.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}

if(-not $accountsModule) {
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
}
Expand Down
1 change: 1 addition & 0 deletions src/ApplicationInsights/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added parameter validation for `Get-AzApplicationInsights` [#20697 ]

## Version 2.2.1
* Enabled output object enumerating for `Get-AzApplicationInsights` [#20225]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@ public class PSApplicationInsightsComponent
{
public PSApplicationInsightsComponent(ApplicationInsightsComponent component)
{
this.ResourceGroupName = ParseResourceGroupFromId(component.Id);
this.Name = component.Name;
this.Id = component.Id;
this.Location = component.Location;
this.Tags = component.Tag.Keys.ToDictionary(x => x, x => component.Tag[x]);
this.Kind = component.Kind;
this.Type = component.Type;
this.AppId = component.AppId;
this.ApplicationId = component.ApplicationId;
this.ApplicationType = component.ApplicationType;
this.CreationDate = component.CreationDate;
this.FlowType = component.FlowType;
this.HockeyAppId = component.HockeyAppId;
this.HockeyAppToken = component.HockeyAppToken;
this.InstrumentationKey = component.InstrumentationKey;
this.ProvisioningState = component.ProvisioningState;
this.RequestSource = component.RequestSource;
this.SamplingPercentage = component.SamplingPercentage;
this.TenantId = component.TenantId;
this.PublicNetworkAccessForIngestion = component.PublicNetworkAccessForIngestion;
this.PublicNetworkAccessForQuery = component.PublicNetworkAccessForQuery;
this.PrivateLinkScopedResources = component.PrivateLinkScopedResource.ToList();
this.RetentionInDays = component.RetentionInDay;
this.ConnectionString = component.ConnectionString;
this.ResourceGroupName = ParseResourceGroupFromId(component?.Id);
this.Name = component?.Name;
this.Id = component?.Id;
this.Location = component?.Location;
this.Tags = component?.Tag?.Keys?.ToDictionary(x => x, x => component.Tag[x]);
this.Kind = component?.Kind;
this.Type = component?.Type;
this.AppId = component?.AppId;
this.ApplicationId = component?.ApplicationId;
this.ApplicationType = component?.ApplicationType;
this.CreationDate = component?.CreationDate;
this.FlowType = component?.FlowType;
this.HockeyAppId = component?.HockeyAppId;
this.HockeyAppToken = component?.HockeyAppToken;
this.InstrumentationKey = component?.InstrumentationKey;
this.ProvisioningState = component?.ProvisioningState;
this.RequestSource = component?.RequestSource;
this.SamplingPercentage = component?.SamplingPercentage;
this.TenantId = component?.TenantId;
this.PublicNetworkAccessForIngestion = component?.PublicNetworkAccessForIngestion;
this.PublicNetworkAccessForQuery = component?.PublicNetworkAccessForQuery;
this.PrivateLinkScopedResources = component?.PrivateLinkScopedResource?.ToList();
this.RetentionInDays = component?.RetentionInDay;
this.ConnectionString = component?.ConnectionString;
}

public string Id { get; set; }
Expand Down Expand Up @@ -145,7 +145,7 @@ public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponen
ApplicationInsightsComponentQuotaStatus status)
: base(component)
{
if (billing.CurrentBillingFeature.Any(f => f.Contains("Enterprise")))
if (billing != null && billing.CurrentBillingFeature != null && billing.CurrentBillingFeature.Any(f => f.Contains("Enterprise")))
{
this.PricingPlan = "Application Insights Enterprise";
}
Expand All @@ -154,11 +154,13 @@ public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponen
this.PricingPlan = billing.CurrentBillingFeature.FirstOrDefault();
}

this.Cap = billing.DataVolumeCap.Cap;
this.ResetTime = billing.DataVolumeCap.ResetTime;
this.StopSendNotificationWhenHitCap = billing.DataVolumeCap.StopSendNotificationWhenHitCap.Value;
this.CapExpirationTime = status.ExpirationTime;
this.IsCapped = status.ShouldBeThrottled != null ? status.ShouldBeThrottled.Value : false;
this.Cap = billing?.DataVolumeCap?.Cap;
this.ResetTime = billing?.DataVolumeCap?.ResetTime;
if (billing != null && billing.DataVolumeCap != null && billing.DataVolumeCap.StopSendNotificationWhenHitCap != null) {
this.StopSendNotificationWhenHitCap = billing.DataVolumeCap.StopSendNotificationWhenHitCap.Value;
}
this.CapExpirationTime = status?.ExpirationTime;
this.IsCapped = status?.ShouldBeThrottled != null ? status.ShouldBeThrottled.Value : false;
}
}
}
2 changes: 1 addition & 1 deletion src/ApplicationInsights/custom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ These provide functionality to our HTTP pipeline and other useful features. In s
### Attributes
For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.DescriptionAttribute`
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- `Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ApplicationInsights`.
- `Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.InternalExportAttribute`
Expand Down
2 changes: 1 addition & 1 deletion src/ApplicationInsights/exports/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Exports
This directory contains the cmdlets *exported by* `Az.ApplicationInsights`. No other cmdlets in this repository are directly exported. What that means is the `Az.ApplicationInsights` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation.
This directory contains the cmdlets *exported by* `Az.ApplicationInsights`. No other cmdlets in this repository are directly exported. What that means is the `Az.ApplicationInsights` module will run [Export-ModuleMember](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation.

## Info
- Modifiable: no
Expand Down
4 changes: 2 additions & 2 deletions src/ApplicationInsights/generate-info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"swagger_commit": "f3e7c1b20f032a637069d055524549b950830c22",
"swagger_commit": "90a294fca4845153be79d926b7415be5375522ac",
"node": "v14.15.5",
"autorest": "`-- (empty)",
"autorest_core": "3.9.3",
"autorest_core": "3.9.4",
"autorest_modelerfour": "4.15.414",
"autorest_powershell": "3.0.498"
}
2 changes: 1 addition & 1 deletion src/ApplicationInsights/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder.

## Packing `Az.ApplicationInsights`
To pack `Az.ApplicationInsights` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
To pack `Az.ApplicationInsights` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.

## Module Script Details
There are multiple scripts created for performing different actions for developing `Az.ApplicationInsights`.
Expand Down
Loading

0 comments on commit 459b6f6

Please sign in to comment.