Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Dynatrace CLI for stable version 2023-04-27 #8164

Merged
merged 6 commits into from
Oct 21, 2024
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
4 changes: 4 additions & 0 deletions src/dynatrace/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.0.0
++++++
* Bump up `dynatrace` API version to `2023-04-27` as per https://github.com/Azure/azure-rest-api-specs/blob/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2023-04-27/dynatrace.json

0.1.0
++++++
* Initial release.
4 changes: 4 additions & 0 deletions src/dynatrace/azext_dynatrace/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 @@ -9,3 +9,4 @@
# flake8: noqa

from .__cmd_group import *
from ._get_marketplace_saas_resource_detail import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# --------------------------------------------------------------------------------------------
# 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(
"dynatrace get-marketplace-saas-resource-detail",
)
class GetMarketplaceSaasResourceDetail(AAZCommand):
"""Get Marketplace SaaS resource details of a tenant under a specific subscription

:example: Monitors_GetMarketplaceSaaSResourceDetails_MaximumSet_Gen
az dynatrace get-marketplace-saas-resource-detail --tenant-id urnmattojzhktcfw
"""

_aaz_info = {
"version": "2023-04-27",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/dynatrace.observability/getmarketplacesaasresourcedetails", "2023-04-27"],
]
}

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.tenant_id = AAZStrArg(
options=["--tenant-id"],
arg_group="Request",
help="Tenant Id",
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.MonitorsGetMarketplaceSaaSResourceDetails(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 MonitorsGetMarketplaceSaaSResourceDetails(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/Dynatrace.Observability/getMarketplaceSaaSResourceDetails",
**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", "2023-04-27",
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("tenantId", AAZStrType, ".tenant_id", 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.marketplace_saa_s_resource_id = AAZStrType(
serialized_name="marketplaceSaaSResourceId",
)
_schema_on_200.marketplace_subscription_status = AAZStrType(
serialized_name="marketplaceSubscriptionStatus",
)
_schema_on_200.plan_id = AAZStrType(
serialized_name="planId",
)

return cls._schema_on_200


class _GetMarketplaceSaasResourceDetailHelper:
"""Helper class for GetMarketplaceSaasResourceDetail"""


__all__ = ["GetMarketplaceSaasResourceDetail"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .__cmd_group import *
from ._create import *
from ._delete import *
from ._get_metric_status import *
from ._get_sso_detail import *
from ._get_vm_host_payload import *
from ._list import *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


@register_command(
"dynatrace monitor create"
"dynatrace monitor create",
)
class Create(AAZCommand):
"""Create a monitor resource
Expand Down Expand Up @@ -49,7 +49,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["-n", "--name", "--monitor-name"],
help="Monitor resource name",
required=True,
id_part="name",
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
Expand Down Expand Up @@ -181,7 +180,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["email-address"],
help="Email of the user used by Dynatrace for contacting them if needed",
fmt=AAZStrArgFormat(
pattern="^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$",
pattern="^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$",
),
)
user_info.first_name = AAZStrArg(
Expand Down Expand Up @@ -644,4 +643,8 @@ def _build_schema_on_200_201(cls):
return cls._schema_on_200_201


class _CreateHelper:
"""Helper class for Create"""


__all__ = ["Create"]
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,8 @@ def on_204(self, session):
pass


class _DeleteHelper:
"""Helper class for Delete"""


__all__ = ["Delete"]
Loading
Loading