-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[ApplicationInsights] Auto-gen ApplicationInsights cmdlets #18021
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
VeryEarly
merged 7 commits into
Azure:yabo/generation/applicationinsights
from
VeryEarly:yabo/applicationinsights
May 9, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
57bac1d
add component related swagger
VeryEarly 4e6a65f
applicationinsights
VeryEarly 7676979
update
VeryEarly 0e6f7dd
polish custom
VeryEarly ceffe2a
polish
VeryEarly 4f6a513
polish
VeryEarly d52e9c5
add examples
VeryEarly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
185 changes: 185 additions & 0 deletions
185
src/ApplicationInsights/ApplicationInsights.Autorest/custom/Get-AzApplicationInsights.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| # ---------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code | ||
| # is regenerated. | ||
| # ---------------------------------------------------------------------------------- | ||
|
|
||
| <# | ||
| .Synopsis | ||
| Returns an Application Insights component. | ||
| .Description | ||
| Returns an Application Insights component. | ||
| .Example | ||
| PS C:\> {{ Add code here }} | ||
|
|
||
| {{ Add output here }} | ||
| .Example | ||
| PS C:\> {{ Add code here }} | ||
|
|
||
| {{ Add output here }} | ||
|
|
||
| .Inputs | ||
| Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsIdentity | ||
| .Outputs | ||
| Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.Api20180501Preview.IApplicationInsightsComponent | ||
| .Notes | ||
| COMPLEX PARAMETER PROPERTIES | ||
|
|
||
| To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. | ||
|
|
||
| INPUTOBJECT <IApplicationInsightsIdentity>: Identity Parameter | ||
| [AnnotationId <String>]: The unique annotation ID. This is unique within a Application Insights component. | ||
| [ComponentName <String>]: The name of the Application Insights component resource. | ||
| [ExportId <String>]: The Continuous Export configuration ID. This is unique within a Application Insights component. | ||
| [Id <String>]: Resource identity path | ||
| [KeyId <String>]: The API Key ID. This is unique within a Application Insights component. | ||
| [PurgeId <String>]: In a purge status request, this is the Id of the operation the status of which is returned. | ||
| [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. | ||
| [ResourceName <String>]: The name of the Application Insights component resource. | ||
| [StorageType <StorageType?>]: The type of the Application Insights component data source for the linked storage account. | ||
| [SubscriptionId <String>]: The ID of the target subscription. | ||
| [WebTestName <String>]: The name of the Application Insights WebTest resource. | ||
| .Link | ||
| https://docs.microsoft.com/powershell/module/az.applicationinsights/get-azapplicationinsightscomponent | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
| #> | ||
| function Get-AzApplicationInsights { | ||
| [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.Api202002.IApplicationInsightsComponent], [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.PSApplicationInsightsComponentWithPricingPlan])] | ||
| [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] | ||
| param( | ||
| [Parameter(ParameterSetName='Get', Mandatory)] | ||
| [Parameter(ParameterSetName='ListByResourceGroupName', Mandatory)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Path')] | ||
| [System.String] | ||
| # The name of the resource group. | ||
| # The name is case insensitive. | ||
| ${ResourceGroupName}, | ||
|
|
||
| [Parameter(ParameterSetName='Get', Mandatory)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Path')] | ||
| [System.String] | ||
| # The name of the Application Insights component resource. | ||
| ${Name}, | ||
|
|
||
| [Parameter(ParameterSetName='Get')] | ||
| [Parameter(ParameterSetName='ListByResourceGroupName')] | ||
| [Parameter(ParameterSetName='ListBySubscription')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Path')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] | ||
| [System.String[]] | ||
| # The ID of the target subscription. | ||
| ${SubscriptionId}, | ||
|
|
||
| [Parameter(ParameterSetName='GetByResourceId', Mandatory)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Path')] | ||
| [System.String[]] | ||
| # The resource ID of applicationinsights component. | ||
| ${ResourceId}, | ||
|
|
||
| [Parameter(ParameterSetName='Get')] | ||
| [Parameter(ParameterSetName='GetByResourceId')] | ||
| [Alias("IncludeDailyCap", "IncludeDailyCapStatus", "IncludePricingPlan")] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Body')] | ||
| [System.Management.Automation.SwitchParameter] | ||
| ${Full}, | ||
|
|
||
| [Parameter(ParameterSetName='GetByInputObject', Mandatory, ValueFromPipeline)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Path')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsIdentity] | ||
| # Identity Parameter | ||
| # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. | ||
| ${InputObject}, | ||
|
|
||
| [Parameter()] | ||
| [Alias('AzureRMContext', 'AzureCredential')] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Azure')] | ||
| [System.Management.Automation.PSObject] | ||
| # The credentials, account, tenant, and subscription used for communication with Azure. | ||
| ${DefaultProfile}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Runtime')] | ||
| [System.Management.Automation.SwitchParameter] | ||
| # Wait for .NET debugger to attach | ||
| ${Break}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Runtime')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.SendAsyncStep[]] | ||
| # SendAsync Pipeline Steps to be appended to the front of the pipeline | ||
| ${HttpPipelineAppend}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Runtime')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.SendAsyncStep[]] | ||
| # SendAsync Pipeline Steps to be prepended to the front of the pipeline | ||
| ${HttpPipelinePrepend}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Runtime')] | ||
| [System.Uri] | ||
| # The URI for the proxy server to use | ||
| ${Proxy}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Runtime')] | ||
| [System.Management.Automation.PSCredential] | ||
| # Credentials for a proxy server to use for the remote call | ||
| ${ProxyCredential}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category('Runtime')] | ||
| [System.Management.Automation.SwitchParameter] | ||
| # Use the default credentials for the proxy | ||
| ${ProxyUseDefaultCredentials} | ||
| ) | ||
|
|
||
| process { | ||
| if ($PSBoundParameters.ContainsKey('Full')) { | ||
| $full = $PSBoundParameters['Full'] | ||
| $null = $PSBoundParameters.Remove('Full') | ||
| } | ||
| switch ($PSCmdlet.ParameterSetName) { | ||
| 'GetByResourceId' { | ||
| $resourceId = $PSBoundParameters['ResourceId'] | ||
| $null = $PSBoundParameters.Remove('ResourceId') | ||
| $component = ($resourceId | . Az.ApplicationInsights.internal\Get-AzApplicationInsightsComponent) | ||
| if ($full) { | ||
| $pricingPlan = $resourceId | . Az.ApplicationInsights.internal\Get-AzApplicationInsightsComponentCurrentBillingFeature | ||
| $dailyCapStatus = $resourceId | . Az.ApplicationInsights.internal\Get-AzApplicationInsightsComponentQuotaStatus | ||
| } | ||
| break | ||
| } | ||
| default { | ||
| if ($PSBoundParameters['Name']) { | ||
| $PSBoundParameters['ResourceName'] = $PSBoundParameters['Name'] | ||
| $null = $PSBoundParameters.Remove('Name') | ||
| if ($full) { | ||
| $pricingPlan = (. Az.ApplicationInsights.internal\Get-AzApplicationInsightsComponentCurrentBillingFeature @PSBoundParameters) | ||
| $dailyCapStatus = (. Az.ApplicationInsights.internal\Get-AzApplicationInsightsComponentQuotaStatus @PSBoundParameters) | ||
| } | ||
| } | ||
| $component = (. Az.ApplicationInsights.internal\Get-AzApplicationInsights @PSBoundParameters) | ||
| break | ||
| } | ||
| } | ||
|
|
||
| if ($full) { | ||
| $PSCmdlet.WriteObject([Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.PSApplicationInsightsComponentWithPricingPlan]::New($component, $pricingPlan, $dailyCapStatus)) | ||
| } else { | ||
| $PSCmdlet.WriteObject($component) | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields can be removed.