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
7 changes: 7 additions & 0 deletions src/new-relic/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
===============

1.2.0
++++++
* Updated New Relic commands to API version 2026-06-01.
* Added commands to activate, link, and retrieve SaaS resources and refresh ingestion keys.
* Added monitored-subscription listing and updated PATCH operations
* 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.

1.1.0
++++++
* Updated default value of identity argument in monitor create command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
# flake8: noqa

from .__cmd_group import *
from ._activate_saas import *
212 changes: 212 additions & 0 deletions src/new-relic/azext_new_relic/aaz/latest/new_relic/_activate_saas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command(
"new-relic activate-saas",
)
class ActivateSaas(AAZCommand):
"""Resolve the token to get the SaaS resource ID and activate the SaaS resource

:example: Activate a New Relic SaaS resource
az new-relic activate-saas --publisher-id newrelicinc1635200720692 --saas-guid 00000000-0000-0000-0000-000005430000
"""

_aaz_info = {
"version": "2026-06-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/newrelic.observability/activatesaas", "2026-06-01"],
]
}

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()

_args_schema = None

@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
if cls._args_schema is not None:
return cls._args_schema
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

# define Arg Group ""

# define Arg Group "Request"

_args_schema = cls._args_schema
_args_schema.publisher_id = AAZStrArg(
options=["--publisher-id"],
arg_group="Request",
help="Publisher Id for NewRelic resource",
required=True,
)
_args_schema.saas_guid = AAZStrArg(
options=["--saas-guid"],
arg_group="Request",
help="SaaS guid for Activate and Validate SaaS Resource",
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.SaaSActivateResource(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result

class SaaSActivateResource(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/NewRelic.Observability/activateSaaS",
**self.url_parameters
)

@property
def method(self):
return "POST"

@property
def error_format(self):
return "MgmtErrorFormat"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2026-06-01",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Content-Type", "application/json",
),
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

@property
def content(self):
_content_value, _builder = self.new_content_builder(
self.ctx.args,
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("publisherId", AAZStrType, ".publisher_id", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("saasGuid", AAZStrType, ".saas_guid", typ_kwargs={"flags": {"required": True}})

return self.serialize_content(_content_value)

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.name = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.saas_id = AAZStrType(
serialized_name="saasId",
)
_schema_on_200.system_data = AAZObjectType(
serialized_name="systemData",
flags={"read_only": True},
)
_schema_on_200.type = AAZStrType(
flags={"read_only": True},
)

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
)

return cls._schema_on_200


class _ActivateSaasHelper:
"""Helper class for ActivateSaas"""


__all__ = ["ActivateSaas"]
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class List(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01",
"version": "2026-06-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/newrelic.observability/accounts", "2024-01-01"],
["mgmt-plane", "/subscriptions/{}/providers/newrelic.observability/accounts", "2026-06-01"],
]
}

Expand Down Expand Up @@ -123,7 +123,7 @@ def query_parameters(self):
required=True,
),
**self.serialize_query_param(
"api-version", "2024-01-01",
"api-version", "2026-06-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
from ._get_billing_info import *
from ._get_metric_rule import *
from ._get_metric_statu import *
from ._latest_linked_saas import *
from ._link_saas import *
from ._list import *
from ._list_app_service import *
from ._list_connected_partner_resource import *
from ._list_host import *
from ._list_linked_resource import *
from ._monitored_resource import *
from ._refresh_ingestion_key import *
from ._show import *
from ._switch_billing import *
from ._vm_host_payload import *
Expand Down
Loading
Loading