Skip to content

Commit

Permalink
[New Relic] Upgrade 2024-01-01 (#24906)
Browse files Browse the repository at this point in the history
* feature New Relic Upgrade 2024-01-01

* Create UXMetadataIssues.csv

* New Relic test design

* Update commands design and test cases
  • Loading branch information
JoyerJin authored Jun 25, 2024
1 parent b6e37ef commit 78bf4a8
Show file tree
Hide file tree
Showing 91 changed files with 3,987 additions and 1,069 deletions.
3 changes: 1 addition & 2 deletions src/NewRelic/NewRelic.Autorest/Az.NewRelic.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.NewRelic.private.dll'
FormatsToProcess = './Az.NewRelic.format.ps1xml'
FunctionsToExport = 'Get-AzNewRelicAccount', 'Get-AzNewRelicMonitor', 'Get-AzNewRelicMonitorAppService', 'Get-AzNewRelicMonitorHost', 'Get-AzNewRelicMonitorMetricRule', 'Get-AzNewRelicMonitorMetricStatus', 'Get-AzNewRelicMonitorMonitoredResource', 'Get-AzNewRelicMonitorTagRule', 'Get-AzNewRelicOrganization', 'Get-AzNewRelicPlan', 'Invoke-AzNewRelicHostMonitor', 'New-AzNewRelicMonitor', 'New-AzNewRelicMonitorTagRule', 'Remove-AzNewRelicMonitor', 'Remove-AzNewRelicMonitorTagRule', 'Switch-AzNewRelicMonitorBilling', 'Update-AzNewRelicMonitorTagRule', '*'
AliasesToExport = '*'
FunctionsToExport = 'Get-AzNewRelicAccount', 'Get-AzNewRelicBillingInfo', 'Get-AzNewRelicConnectedPartnerResource', 'Get-AzNewRelicMonitor', 'Get-AzNewRelicMonitoredAppService', 'Get-AzNewRelicMonitoredHost', 'Get-AzNewRelicMonitoredSubscription', 'Get-AzNewRelicMonitorMetricRule', 'Get-AzNewRelicMonitorMetricStatus', 'Get-AzNewRelicMonitorMonitoredResource', 'Get-AzNewRelicMonitorTagRule', 'Get-AzNewRelicOrganization', 'Get-AzNewRelicPlan', 'Invoke-AzNewRelicHostMonitor', 'New-AzNewRelicFilteringTagObject', 'New-AzNewRelicMonitor', 'New-AzNewRelicMonitoredSubscription', 'New-AzNewRelicMonitoredSubscriptionObject', 'New-AzNewRelicMonitorTagRule', 'Remove-AzNewRelicMonitor', 'Remove-AzNewRelicMonitoredSubscription', 'Remove-AzNewRelicMonitorTagRule', 'Switch-AzNewRelicMonitorBilling', 'Update-AzNewRelicMonitoredSubscription', 'Update-AzNewRelicMonitorTagRule'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'NewRelic'
Expand Down
116 changes: 98 additions & 18 deletions src/NewRelic/NewRelic.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
This directory contains the PowerShell module for the NewRelic service.

---
## Status
[![Az.NewRelic](https://img.shields.io/powershellgallery/v/Az.NewRelic.svg?style=flat-square&label=Az.NewRelic "Az.NewRelic")](https://www.powershellgallery.com/packages/Az.NewRelic/)

## Info
- Modifiable: yes
- Generated: all
Expand All @@ -31,8 +28,8 @@ For information on how to develop for `Az.NewRelic`, see [how-to.md](how-to.md).
```yaml
# pin the swagger version by using the commit id instead of branch name
commit: 6b992c049ed7d6a95465d5c0a2234fc54c87b9bf
tag: package-2022-07-01
commit: 559f989d2b38bc80db762cfd277614583dddc3bb
tag: package-2024-01-01
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
Expand All @@ -49,19 +46,53 @@ module-version: 0.1.0
title: NewRelic
subject-prefix: $(service-name)

# If there are post APIs for some kinds of actions in the RP, you may need to
# uncomment following line to support viaIdentity for these post APIs
# The next three configurations are exclusive to v3, and in v4, they are activated by default. If you are still using v3, please uncomment them.
# identity-correction-for-post: true
resourcegroup-append: true
nested-object-to-string: true

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"
# resourcegroup-append: true
# nested-object-to-string: true

directive:
- remove-operation: MonitoredSubscriptions_Update
# Rename operation
- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/monitoredSubscriptions/{configurationName}"].put.operationId
transform: >-
return "MonitoredSubscriptions_CreateOrUpdate"
# Delete body/email
- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/listConnectedPartnerResources"].post.parameters
transform: >-
return [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"name": "monitorName",
"in": "path",
"required": true,
"description": "Name of the Monitors resource",
"pattern": "^.*$",
"type": "string"
}
]
# Following are common directives which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required
# Following two directives are v4 specific
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
- where:
variant: ^CreateViaIdentity.*$
remove: true
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$|^Switch$|^SwitchViaIdentity$
variant: ^Switch$|^SwitchViaIdentity$
remove: true
- where:
subject: AppService|Host
Expand All @@ -71,6 +102,29 @@ directive:
subject: MetricRule|MetricStatus
variant: ^Get$|^GetViaIdentity$
remove: true
# duplicate with Get default config
- where:
subject: MonitoredSubscription
variant: List
remove: true
# Custom create Monitor
- where:
subject: Monitor
verb: New
hide: true
# Custom list linked resource
- where:
subject: MonitorLinkedResource
parameter-name: MonitorName
set:
parameter-name: Name
- where:
subject: MonitorLinkedResource
hide: true
- where:
subject: Monitor
verb: Get
hide: true
# Remove the set-* cmdlet
- where:
verb: Set
Expand All @@ -80,15 +134,41 @@ directive:
subject: Monitor
verb: update
remove: true
# rename parameters
# create cmdlet
- model-cmdlet:
- model-name: MonitoredSubscription
- model-name: FilteringTag
# rename subjects
- where:
subject: ^TagRule(.*)
subject: TagRule
set:
subject: MonitorTagRule
- where:
parameter-name: IdentityUserAssignedIdentity
subject: MonitorHost
set:
subject: MonitoredHost
- where:
subject: MonitorAppService
set:
subject: MonitoredAppService
# customize the body property and parameter name
# - from: source-file-csharp
# where: $
# transform: $ = $.replace('request.Content = null','request.Content = new global::System.Net.Http.StringContent(body, global::System.Text.Encoding.UTF8);');
# - where:
# verb: Get
# subject: ConnectedPartnerResource
# variant: List
# parameter-name: body
# set:
# parameter-name: EmailAddress
# Reset description
- where:
verb: Remove
subject: MonitoredSubscription
set:
parameter-name: UserAssignedIdentity
command-description: Deletes the subscriptions that are being monitored by the NewRelic monitor resource
# Format setting
- where:
model-name: AccountResource
set:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"resourceType": "monitors/monitoredSubscriptions",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.newrelic"
},
"commands": [
{
"name": "Get-AzNewRelicMonitoredSubscription",
"description": "List the subscriptions currently being monitored by the NewRelic monitor resource.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/monitoredSubscriptions/{configurationName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.newrelic/get-aznewrelicmonitoredsubscription"
},
"parameterSets": [
{
"parameters": [
"-MonitorName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "List the subscriptions currently being monitored by the NewRelic monitor resource.",
"parameters": [
{
"name": "-MonitorName",
"value": "[Path.monitorName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Remove-AzNewRelicMonitoredSubscription",
"description": "Deletes the subscriptions that are being monitored by the NewRelic monitor resource",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/monitoredSubscriptions/{configurationName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.newrelic/remove-aznewrelicmonitoredsubscription"
},
"parameterSets": [
{
"parameters": [
"-MonitorName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Deletes the subscriptions that are being monitored by the NewRelic monitor resource",
"parameters": [
{
"name": "-MonitorName",
"value": "[Path.monitorName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "monitors/tagRules",
"apiVersion": "2022-07-01",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.newrelic"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"resourceType": "monitors",
"apiVersion": "2022-07-01",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.newrelic"
},
"commands": [
{
"name": "Get-AzNewRelicMonitor",
"description": "Get a NewRelicMonitorResource",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}",
"name": "Get-AzNewRelicBillingInfo",
"description": "Get marketplace info mapped to the given monitor.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/getBillingInfo",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.newrelic/get-aznewrelicmonitor"
"url": "https://learn.microsoft.com/powershell/module/az.newrelic/get-aznewrelicbillinginfo"
},
"parameterSets": [
{
"parameters": [
"-Name <String>",
"-MonitorName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
Expand All @@ -25,10 +25,10 @@
},
"examples": [
{
"description": "Get a NewRelicMonitorResource",
"description": "Get marketplace info mapped to the given monitor.",
"parameters": [
{
"name": "-Name",
"name": "-MonitorName",
"value": "[Path.monitorName]"
},
{
Expand Down
Loading

0 comments on commit 78bf4a8

Please sign in to comment.