Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.ApplicationInsights.private.dll'
FormatsToProcess = './Az.ApplicationInsights.format.ps1xml'
FunctionsToExport = 'Get-AzApplicationInsightsWebTest', 'New-AzApplicationInsightsWebTest', 'New-AzApplicationInsightsWebTestGeolocationObject', 'New-AzApplicationInsightsWebTestHeaderFieldObject', 'Remove-AzApplicationInsightsWebTest', 'Update-AzApplicationInsightsWebTestTag', '*'
FunctionsToExport = 'Get-AzApplicationInsights', 'Get-AzApplicationInsightsApiKey', 'Get-AzApplicationInsightsContinuousExport', 'Get-AzApplicationInsightsLinkedStorageAccount', 'Get-AzApplicationInsightsWebTest', 'New-AzApplicationInsights', 'New-AzApplicationInsightsApiKey', 'New-AzApplicationInsightsContinuousExport', 'New-AzApplicationInsightsLinkedStorageAccount', 'New-AzApplicationInsightsWebTest', 'New-AzApplicationInsightsWebTestGeolocationObject', 'New-AzApplicationInsightsWebTestHeaderFieldObject', 'Remove-AzApplicationInsights', 'Remove-AzApplicationInsightsApiKey', 'Remove-AzApplicationInsightsContinuousExport', 'Remove-AzApplicationInsightsLinkedStorageAccount', 'Remove-AzApplicationInsightsWebTest', 'Set-AzApplicationInsightsContinuousExport', 'Set-AzApplicationInsightsDailyCap', 'Set-AzApplicationInsightsPricingPlan', 'Set-AzApplicationInsightsWebTest', 'Update-AzApplicationInsights', 'Update-AzApplicationInsightsLinkedStorageAccount', 'Update-AzApplicationInsightsWebTestTag', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Expand Down
136 changes: 132 additions & 4 deletions src/ApplicationInsights/ApplicationInsights.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ require:
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/webTests_API.json

- https://github.com/Azure/azure-rest-api-specs/blob/9735d8c1580e6b56e6d4508be6ec00f46e45cb77/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/components_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/e129012901bbd9cc0f182ec5b539bccf2440ef4a/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/componentApiKeys_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/8f0d54f788304518eca62ddf281b8c889ad9613c/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/componentAnnotations_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/e129012901bbd9cc0f182ec5b539bccf2440ef4a/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/componentFeaturesAndPricing_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/e129012901bbd9cc0f182ec5b539bccf2440ef4a/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/componentContinuousExport_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/e129012901bbd9cc0f182ec5b539bccf2440ef4a/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/aiOperations_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/88e7838a09868a51de3894114355c75929847a46/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/componentLinkedStorageAccounts_API.json
module-version: 0.1.0
subject-prefix: $(service-name)

Expand All @@ -45,6 +51,10 @@ resourcegroup-append: true
nested-object-to-string: true

directive:
- from: swagger-document
where: $.info.title
transform: return "ApplicationInsightsManagementClient"

# Kind 'basic' is not supported on the server.
- from: swagger-document
where: $.definitions.WebTestProperties.properties.Kind.enum
Expand All @@ -64,12 +74,130 @@ directive:
transform: return $.replace(/providers\/Microsoft.Insights\//g, "providers/microsoft.insights/")

- where:
verb: Set
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
remove: true

# Hide ApplicationInsightsComponent related cmdlets
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
remove: true
subject: Component
verb: Remove
parameter-name: ResourceName
set:
parameter-name: Name
- where:
subject: Component
verb: Get|New|Clear|Set
hide: true
# Rename Component related cmdlets
- where:
subject: (^Component$)(.*)
set:
subject: $2

# Hide ComponentCurrentBillingFeature related cmdlets
- where:
subject: ComponentCurrentBillingFeature|ComponentQuotaStatus
hide: true

# Rename ExportConfiguration to ContinuousExport
- where:
subject: ExportConfiguration
set:
subject: ContinuousExport

# Rename parameters for New|Set ApplicationInsightsExportConfiguration
- where:
subject: ContinuousExport
verb: Get
parameter-name: ResourceName
set:
parameter-name: Name
- where:
subject: ContinuousExport
verb: New|Set
parameter-name: DestinationAccountId
set:
parameter-name: StorageAccountId
- where:
subject: ContinuousExport
verb: New|Set
parameter-name: DestinationAddress
set:
parameter-name: StorageSASUri
- where:
subject: ContinuousExport
verb: New|Set
parameter-name: DestinationStorageLocationId
set:
parameter-name: StorageLocation
- where:
subject: ContinuousExport
verb: New|Set
parameter-name: RecordTypes
set:
parameter-name: DocumentType
- where:
subject: ContinuousExport
verb: New|Set
hide: true

# Rename parameters for ComponentLinkedStorageAccount
- where:
subject: ComponentLinkedStorageAccountAndUpdate
set:
subject: ComponentLinkedStorageAccount
- where:
subject: ComponentLinkedStorageAccount
parameter-name: ResourceName
set:
parameter-name: ComponentName
- where:
subject: ComponentLinkedStorageAccount
parameter-name: LinkedStorageAccount
set:
parameter-name: LinkedStorageAccountResourceId
- where:
subject: ComponentLinkedStorageAccount
set:
subject: LinkedStorageAccount

# Rename parameter 'ResourceName' to 'Name'
- where:
subject: ApiKey|ExportConfiguration
verb: Get|Remove
parameter-name: ResourceName
set:
parameter-name: Name
alias:
- ApplicationInsightsComponentNameAlias
- ComponentNameAlias

# Rename parameter 'KeyId' to 'ApiKeyId'
- where:
subject: ApiKey
verb: Get|Remove
parameter-name: KeyId
set:
parameter-name: ApiKeyId

# Rename parameter 'InputObject' to 'ApplicationInsightsComponent'
- where:
subject: ApiKey|ExportConfiguration
verb: Get|Remove
parameter-name: InputObject
set:
parameter-name: ApplicationInsightsComponent

# Hide New-AzApplicationInsightsApiKey for customization
- where:
subject: ApiKey
verb: New
hide: true

# Hide cmdlets
- where:
subject: Annotation|AvailableFeature|FeatureCapability|PurgeStatus|ComponentTag
hide: true

# Hide the SyntheticMonitorId parameter because the default value is passed by the server.
- where:
Expand Down
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
Comment on lines +21 to +51
Copy link
Contributor

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.

https://docs.microsoft.com/powershell/module/az.applicationinsights/get-azapplicationinsightscomponent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be https://docs.microsoft.com/powershell/module/az.applicationinsights/get-azapplicationinsights

#>
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)
}
}
}
Loading