Skip to content

Commit 0349eb6

Browse files
shiwanijainCopilot
andauthored
Update New Relic extension to API 2026-06-01 (#10299)
* Update New Relic extension to API 2026-06-01 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cfb43a4-9a09-4e39-94a1-1a04301c1ef3 * Use supported New Relic marketplace offer Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cfb43a4-9a09-4e39-94a1-1a04301c1ef3 * Use signed-in user for New Relic tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cfb43a4-9a09-4e39-94a1-1a04301c1ef3 * Validate supported New Relic CLI operations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cfb43a4-9a09-4e39-94a1-1a04301c1ef3 * Address New Relic command review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 03b01e4a-ce74-428f-a239-e7c681f7e55e * Restore legacy CLI aliases dropped during 2026-06-01 regeneration The 2026-06-01 New Relic command regeneration explicitly pinned 'options' lists on several generated args, which silently dropped legacy aliases that are live today in the published extension (upstream/main). Restore them so existing customer scripts keep working, while keeping the new canonical option names: - monitor create/delete/get-metric-rule/get-metric-statu/ list-app-service/list-host/monitored-resource: restore '-n' and '--name' (or '--monitor-name') alongside the monitor name option. - resource-group across monitor, tag-rule and monitored-subscription commands: restore '-g', plus the historical (non-standard) '--g' alias on get-billing-info and monitored-subscription create/delete/show/update/wait. - monitor create: restore '-l' on --location. - tag-rule create/delete/show: restore '-n' and '--rule-set-name' on --name. - monitored-subscription create: restore '-n' on --monitored-subscription-list. Not added to 'update', which already uses '-n' for --configuration-name, to avoid an alias conflict. Verified with azure.cli.core.aaz: all 108 generated commands build their argument schema with zero option conflicts, and every alias token present in upstream/main for existing commands is still present. No behavior changed for new 2026-06-01-only commands/parameters. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cfb43a4-9a09-4e39-94a1-1a04301c1ef3 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cfb43a4-9a09-4e39-94a1-1a04301c1ef3 Copilot-Session: 03b01e4a-ce74-428f-a239-e7c681f7e55e
1 parent 5813689 commit 0349eb6

42 files changed

Lines changed: 2484 additions & 1287 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/new-relic/HISTORY.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Release History
44
===============
55

6+
1.2.0
7+
++++++
8+
* Updated New Relic commands to API version 2026-06-01.
9+
* Added commands to activate, link, and retrieve SaaS resources and refresh ingestion keys.
10+
* Added monitored-subscription listing and updated PATCH operations
11+
* Restored legacy parameter aliases (e.g. `-n`/`--name`/`--monitor-name`, `-g`, `-l`, `--rule-set-name`) that were inadvertently dropped during regeneration, to preserve backward compatibility with previously published commands.
12+
613
1.1.0
714
++++++
815
* Updated default value of identity argument in monitor create command.

‎src/new-relic/azext_new_relic/aaz/latest/new_relic/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
# flake8: noqa
1010

1111
from .__cmd_group import *
12+
from ._activate_saas import *
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"new-relic activate-saas",
16+
)
17+
class ActivateSaas(AAZCommand):
18+
"""Resolve the token to get the SaaS resource ID and activate the SaaS resource
19+
20+
:example: Activate a New Relic SaaS resource
21+
az new-relic activate-saas --publisher-id newrelicinc1635200720692 --saas-guid 00000000-0000-0000-0000-000005430000
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2026-06-01",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/providers/newrelic.observability/activatesaas", "2026-06-01"],
28+
]
29+
}
30+
31+
def _handler(self, command_args):
32+
super()._handler(command_args)
33+
self._execute_operations()
34+
return self._output()
35+
36+
_args_schema = None
37+
38+
@classmethod
39+
def _build_arguments_schema(cls, *args, **kwargs):
40+
if cls._args_schema is not None:
41+
return cls._args_schema
42+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
43+
44+
# define Arg Group ""
45+
46+
# define Arg Group "Request"
47+
48+
_args_schema = cls._args_schema
49+
_args_schema.publisher_id = AAZStrArg(
50+
options=["--publisher-id"],
51+
arg_group="Request",
52+
help="Publisher Id for NewRelic resource",
53+
required=True,
54+
)
55+
_args_schema.saas_guid = AAZStrArg(
56+
options=["--saas-guid"],
57+
arg_group="Request",
58+
help="SaaS guid for Activate and Validate SaaS Resource",
59+
required=True,
60+
)
61+
return cls._args_schema
62+
63+
def _execute_operations(self):
64+
self.pre_operations()
65+
self.SaaSActivateResource(ctx=self.ctx)()
66+
self.post_operations()
67+
68+
@register_callback
69+
def pre_operations(self):
70+
pass
71+
72+
@register_callback
73+
def post_operations(self):
74+
pass
75+
76+
def _output(self, *args, **kwargs):
77+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
78+
return result
79+
80+
class SaaSActivateResource(AAZHttpOperation):
81+
CLIENT_TYPE = "MgmtClient"
82+
83+
def __call__(self, *args, **kwargs):
84+
request = self.make_request()
85+
session = self.client.send_request(request=request, stream=False, **kwargs)
86+
if session.http_response.status_code in [200]:
87+
return self.on_200(session)
88+
89+
return self.on_error(session.http_response)
90+
91+
@property
92+
def url(self):
93+
return self.client.format_url(
94+
"/subscriptions/{subscriptionId}/providers/NewRelic.Observability/activateSaaS",
95+
**self.url_parameters
96+
)
97+
98+
@property
99+
def method(self):
100+
return "POST"
101+
102+
@property
103+
def error_format(self):
104+
return "MgmtErrorFormat"
105+
106+
@property
107+
def url_parameters(self):
108+
parameters = {
109+
**self.serialize_url_param(
110+
"subscriptionId", self.ctx.subscription_id,
111+
required=True,
112+
),
113+
}
114+
return parameters
115+
116+
@property
117+
def query_parameters(self):
118+
parameters = {
119+
**self.serialize_query_param(
120+
"api-version", "2026-06-01",
121+
required=True,
122+
),
123+
}
124+
return parameters
125+
126+
@property
127+
def header_parameters(self):
128+
parameters = {
129+
**self.serialize_header_param(
130+
"Content-Type", "application/json",
131+
),
132+
**self.serialize_header_param(
133+
"Accept", "application/json",
134+
),
135+
}
136+
return parameters
137+
138+
@property
139+
def content(self):
140+
_content_value, _builder = self.new_content_builder(
141+
self.ctx.args,
142+
typ=AAZObjectType,
143+
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
144+
)
145+
_builder.set_prop("publisherId", AAZStrType, ".publisher_id", typ_kwargs={"flags": {"required": True}})
146+
_builder.set_prop("saasGuid", AAZStrType, ".saas_guid", typ_kwargs={"flags": {"required": True}})
147+
148+
return self.serialize_content(_content_value)
149+
150+
def on_200(self, session):
151+
data = self.deserialize_http_content(session)
152+
self.ctx.set_var(
153+
"instance",
154+
data,
155+
schema_builder=self._build_schema_on_200
156+
)
157+
158+
_schema_on_200 = None
159+
160+
@classmethod
161+
def _build_schema_on_200(cls):
162+
if cls._schema_on_200 is not None:
163+
return cls._schema_on_200
164+
165+
cls._schema_on_200 = AAZObjectType()
166+
167+
_schema_on_200 = cls._schema_on_200
168+
_schema_on_200.id = AAZStrType(
169+
flags={"read_only": True},
170+
)
171+
_schema_on_200.name = AAZStrType(
172+
flags={"read_only": True},
173+
)
174+
_schema_on_200.saas_id = AAZStrType(
175+
serialized_name="saasId",
176+
)
177+
_schema_on_200.system_data = AAZObjectType(
178+
serialized_name="systemData",
179+
flags={"read_only": True},
180+
)
181+
_schema_on_200.type = AAZStrType(
182+
flags={"read_only": True},
183+
)
184+
185+
system_data = cls._schema_on_200.system_data
186+
system_data.created_at = AAZStrType(
187+
serialized_name="createdAt",
188+
)
189+
system_data.created_by = AAZStrType(
190+
serialized_name="createdBy",
191+
)
192+
system_data.created_by_type = AAZStrType(
193+
serialized_name="createdByType",
194+
)
195+
system_data.last_modified_at = AAZStrType(
196+
serialized_name="lastModifiedAt",
197+
)
198+
system_data.last_modified_by = AAZStrType(
199+
serialized_name="lastModifiedBy",
200+
)
201+
system_data.last_modified_by_type = AAZStrType(
202+
serialized_name="lastModifiedByType",
203+
)
204+
205+
return cls._schema_on_200
206+
207+
208+
class _ActivateSaasHelper:
209+
"""Helper class for ActivateSaas"""
210+
211+
212+
__all__ = ["ActivateSaas"]

‎src/new-relic/azext_new_relic/aaz/latest/new_relic/account/_list.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class List(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2024-01-01",
25+
"version": "2026-06-01",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/providers/newrelic.observability/accounts", "2024-01-01"],
27+
["mgmt-plane", "/subscriptions/{}/providers/newrelic.observability/accounts", "2026-06-01"],
2828
]
2929
}
3030

@@ -123,7 +123,7 @@ def query_parameters(self):
123123
required=True,
124124
),
125125
**self.serialize_query_param(
126-
"api-version", "2024-01-01",
126+
"api-version", "2026-06-01",
127127
required=True,
128128
),
129129
}

‎src/new-relic/azext_new_relic/aaz/latest/new_relic/monitor/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
from ._get_billing_info import *
1515
from ._get_metric_rule import *
1616
from ._get_metric_statu import *
17+
from ._latest_linked_saas import *
18+
from ._link_saas import *
1719
from ._list import *
1820
from ._list_app_service import *
1921
from ._list_connected_partner_resource import *
2022
from ._list_host import *
2123
from ._list_linked_resource import *
2224
from ._monitored_resource import *
25+
from ._refresh_ingestion_key import *
2326
from ._show import *
2427
from ._switch_billing import *
2528
from ._vm_host_payload import *

0 commit comments

Comments
 (0)