Skip to content

Commit

Permalink
Release New-Relic CLI for stable version 2024-01-01 (#7402)
Browse files Browse the repository at this point in the history
* NewRelic CLI refresh

* fix issues found in manual testing

* Fix tag rules commands

* Update command for monitored-subscription

* Update history and version number

* use short abbreviation for monitored_subscription_list

* Delete recordings and fix flake8 issues

* Remove default value from configuration-name

* fix tests

* Fix tests and remove unused reference

* Fix issues

* Fix all integration tests

* Add monitored subscription test cases

* remove commented test cases

* Remove trailling whitespace

* Undo breaking changes

* Revert get-metric-status to get-metric-statu

* Add more test cases and fix breaking changes

* Fix GetMetric Status breaking change

* Fix ingestionkey secret in recordings

* Update changelog to trigger build again

* Use Production region to run tests as partner staging is not working

* Fix build

* Attempt to fix build

* Fix versioning
  • Loading branch information
dipeshbhakat-microsoft committed Apr 8, 2024
1 parent d286bdc commit 7429e7a
Show file tree
Hide file tree
Showing 38 changed files with 3,571 additions and 377 deletions.
6 changes: 5 additions & 1 deletion src/new-relic/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ Release History

1.0.0b1
++++++
* Initial release.
* Initial release.

1.0.0
++++++
* Updating capabilities as per https://github.com/Azure/azure-rest-api-specs/blob/main/specification/newrelic/resource-manager/NewRelic.Observability/stable/2024-01-01/NewRelic.json.
4 changes: 4 additions & 0 deletions src/new-relic/azext_new_relic/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ class List(AAZCommand):
"""

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

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
return self.build_paging(self._execute_operations, self._output)
Expand All @@ -45,7 +47,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema = cls._args_schema
_args_schema.location = AAZStrArg(
options=["--location"],
help="Location for NewRelic.",
help="Location of NewRelic account.",
required=True,
)
_args_schema.user_email = AAZStrArg(
Expand Down Expand Up @@ -121,7 +123,7 @@ def query_parameters(self):
required=True,
),
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2024-01-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
from .__cmd_group import *
from ._create import *
from ._delete import *
from ._get_billing_info import *
from ._get_metric_rule import *
from ._get_metric_statu 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 ._show import *
from ._switch_billing import *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Create(AAZCommand):
"""

_aaz_info = {
"version": "2022-07-01",
"version": "2024-01-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/newrelic.observability/monitors/{}", "2022-07-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/newrelic.observability/monitors/{}", "2024-01-01"],
]
}

Expand All @@ -51,6 +51,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.resource_group = AAZResourceGroupNameArg(
help="Name of resource group. You can configure the default group using az configure --defaults group=<name>.",
required=True,
)

Expand All @@ -66,7 +67,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.new_relic_account = AAZObjectArg(
options=["--new-relic-account"],
arg_group="Properties",
help="MarketplaceSubscriptionStatus of the resource",
help="MarketplaceSubscriptionStatus of the resource Support shorthand-syntax, json-file and yaml-file. Try \"??\" to show",
)
_args_schema.org_creation_source = AAZStrArg(
options=["--org-creation-source"],
Expand All @@ -77,12 +78,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.plan_data = AAZObjectArg(
options=["--plan-data"],
arg_group="Properties",
help="Plan details",
help="Plan details Support shorthand-syntax, json-file and yaml-file. Try \"??\" to show more.",
)
_args_schema.user_info = AAZObjectArg(
options=["--user-info"],
arg_group="Properties",
help="User Info",
help="User Info Support shorthand-syntax, json-file and yaml-file. Try \"??\" to show more.",
)

new_relic_account = cls._args_schema.new_relic_account
Expand Down Expand Up @@ -206,11 +207,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.identity = AAZObjectArg(
options=["--identity"],
arg_group="Resource",
help="The managed service identities assigned to this resource.",
help="The managed service identities assigned to this resource. Support shorthand-syntax, json-file and yaml-file. Try \"??\" to show more.",
)
_args_schema.location = AAZResourceLocationArg(
arg_group="Resource",
help="The geo-location where the resource lives",
help="The geo-location where the resource lives When not specified, the location of the resource group will be used.",
required=True,
fmt=AAZResourceLocationArgFormat(
resource_group_arg="resource_group",
Expand All @@ -219,7 +220,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.tags = AAZDictArg(
options=["--tags"],
arg_group="Resource",
help="Resource tags.",
help="Resource tags. Support shorthand-syntax, json-file and yaml-file. Try \"??\" to show more.",
)

identity = cls._args_schema.identity
Expand Down Expand Up @@ -324,7 +325,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2024-01-01",
required=True,
),
}
Expand Down Expand Up @@ -518,6 +519,12 @@ def _build_schema_on_200_201(cls):
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
properties.saa_s_azure_subscription_status = AAZStrType(
serialized_name="saaSAzureSubscriptionStatus",
)
properties.subscription_state = AAZStrType(
serialized_name="subscriptionState",
)
properties.user_info = AAZObjectType(
serialized_name="userInfo",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2022-07-01",
"version": "2024-01-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/newrelic.observability/monitors/{}", "2022-07-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/newrelic.observability/monitors/{}", "2024-01-01"],
]
}

Expand All @@ -47,11 +47,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema = cls._args_schema
_args_schema.monitor_name = AAZStrArg(
options=["-n", "--name", "--monitor-name"],
help="Name of the Monitors resource",
help="Name of the Monitoring resource",
required=True,
id_part="name",
)
_args_schema.resource_group = AAZResourceGroupNameArg(
help="Name of resource group. You can configure the default group using az configure --defaults group=<name>.",
required=True,
)
_args_schema.user_email = AAZStrArg(
Expand Down Expand Up @@ -151,7 +152,7 @@ def query_parameters(self):
required=True,
),
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2024-01-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# --------------------------------------------------------------------------------------------
# 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 monitor get-billing-info",
)
class GetBillingInfo(AAZCommand):
"""Get marketplace info mapped to the given monitor.
:example: Get marketplace info mapped to the given monitor.
az new-relic monitor get-billing-info --monitor-name MyNewRelicMonitor --resource-group MyResourceGroup
"""

_aaz_info = {
"version": "2024-01-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/newrelic.observability/monitors/{}/getbillinginfo", "2024-01-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 ""

_args_schema = cls._args_schema
_args_schema.monitor_name = AAZStrArg(
options=["--monitor-name"],
help="Name of the Monitoring resource",
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^.*$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
options=["--resource-group","--g"],
help="Name of resource group. You can configure the default group using az configure --defaults group=<name>.",
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.BillingInfoGet(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 BillingInfoGet(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}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/getBillingInfo",
**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(
"monitorName", self.ctx.args.monitor_name,
required=True,
),
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**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", "2024-01-01",
required=True,
),
}
return parameters

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

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.marketplace_saas_info = AAZObjectType(
serialized_name="marketplaceSaasInfo",
)
_schema_on_200.partner_billing_entity = AAZObjectType(
serialized_name="partnerBillingEntity",
)

marketplace_saas_info = cls._schema_on_200.marketplace_saas_info
marketplace_saas_info.billed_azure_subscription_id = AAZStrType(
serialized_name="billedAzureSubscriptionId",
)
marketplace_saas_info.marketplace_resource_id = AAZStrType(
serialized_name="marketplaceResourceId",
)
marketplace_saas_info.marketplace_status = AAZStrType(
serialized_name="marketplaceStatus",
)
marketplace_saas_info.marketplace_subscription_id = AAZStrType(
serialized_name="marketplaceSubscriptionId",
)
marketplace_saas_info.marketplace_subscription_name = AAZStrType(
serialized_name="marketplaceSubscriptionName",
)

partner_billing_entity = cls._schema_on_200.partner_billing_entity
partner_billing_entity.organization_id = AAZStrType(
serialized_name="organizationId",
)
partner_billing_entity.organization_name = AAZStrType(
serialized_name="organizationName",
)

return cls._schema_on_200


class _GetBillingInfoHelper:
"""Helper class for GetBillingInfo"""


__all__ = ["GetBillingInfo"]
Loading

0 comments on commit 7429e7a

Please sign in to comment.