Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
# pylint: skip-file
# flake8: noqa

from ._clients import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# --------------------------------------------------------------------------------------------
# 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_client("AAZMicrosoftInsightsDataPlaneClient_monitor")
class AAZMicrosoftInsightsDataPlaneClient(AAZBaseClient):
_CLOUD_HOST_TEMPLATES = {
CloudNameEnum.AzureChinaCloud: "https://api.applicationinsights.azure.cn",
CloudNameEnum.AzureCloud: "https://api.applicationinsights.io",
CloudNameEnum.AzureUSGovernment: "https://api.applicationinsights.us",
}
_CLOUD_HOST_METADATA_INDEX = "appInsightsResourceId"

_AAD_CREDENTIAL_SCOPES = [
"https://api.applicationinsights.io/.default",
]

@classmethod
def _build_base_url(cls, ctx, **kwargs):
endpoint = cls.get_cloud_endpoint(ctx, cls._CLOUD_HOST_METADATA_INDEX)
if not endpoint:
endpoint = cls._CLOUD_HOST_TEMPLATES.get(ctx.cli_ctx.cloud.name, None)
return endpoint

@classmethod
def _build_configuration(cls, ctx, credential, **kwargs):
return AAZClientConfiguration(
credential=credential,
credential_scopes=cls._AAD_CREDENTIAL_SCOPES,
**kwargs
)


class _AAZMicrosoftInsightsDataPlaneClientHelper:
"""Helper class for AAZMicrosoftInsightsDataPlaneClient"""


@register_client("AAZMicrosoftOperationalinsightsDataPlaneClient_monitor")
class AAZMicrosoftOperationalinsightsDataPlaneClient(AAZBaseClient):
_CLOUD_HOST_TEMPLATES = {
CloudNameEnum.AzureCloud: "https://api.loganalytics.io",
}
_CLOUD_HOST_METADATA_INDEX = "logAnalyticslogAnalyticsResourceId"

_AAD_CREDENTIAL_SCOPES = [
"https://api.loganalytics.io/.default",
]

@classmethod
def _build_base_url(cls, ctx, **kwargs):
endpoint = cls.get_cloud_endpoint(ctx, cls._CLOUD_HOST_METADATA_INDEX)
if not endpoint:
endpoint = cls._CLOUD_HOST_TEMPLATES.get(ctx.cli_ctx.cloud.name, None)
return endpoint

@classmethod
def _build_configuration(cls, ctx, credential, **kwargs):
return AAZClientConfiguration(
credential=credential,
credential_scopes=cls._AAD_CREDENTIAL_SCOPES,
**kwargs
)


class _AAZMicrosoftOperationalinsightsDataPlaneClientHelper:
"""Helper class for AAZMicrosoftOperationalinsightsDataPlaneClient"""


__all__ = [
"AAZMicrosoftInsightsDataPlaneClient",
"AAZMicrosoftOperationalinsightsDataPlaneClient",
]
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class List(AAZCommand):
]
}

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
return self.build_paging(self._execute_operations, self._output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def _build_arguments_schema(cls, *args, **kwargs):
def _execute_operations(self):
self.pre_operations()
self.ActionGroupsGet(ctx=self.ctx)()
self.pre_instance_update(self.ctx.selectors.subresource.required())
self.pre_instance_update(self.ctx.selectors.subresource.get())
self.InstanceUpdateByJson(ctx=self.ctx)()
self.post_instance_update(self.ctx.selectors.subresource.required())
self.post_instance_update(self.ctx.selectors.subresource.get())
self.ActionGroupsCreateOrUpdate(ctx=self.ctx)()
self.post_operations()

Expand All @@ -106,7 +106,7 @@ def post_instance_update(self, instance):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True)
result = self.deserialize_output(self.ctx.selectors.subresource.get(), client_flatten=True)
return result

class SubresourceSelector(AAZJsonSelector):
Expand Down Expand Up @@ -301,7 +301,7 @@ def _build_schema_on_200_201(cls):
class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation):

def __call__(self, *args, **kwargs):
self._update_instance(self.ctx.selectors.subresource.required())
self._update_instance(self.ctx.selectors.subresource.get())

def _update_instance(self, instance):
_instance_value, _builder = self.new_content_builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def _build_arguments_schema(cls, *args, **kwargs):
def _execute_operations(self):
self.pre_operations()
self.ActionGroupsGet(ctx=self.ctx)()
self.pre_instance_update(self.ctx.selectors.subresource.required())
self.pre_instance_update(self.ctx.selectors.subresource.get())
self.InstanceUpdateByJson(ctx=self.ctx)()
self.post_instance_update(self.ctx.selectors.subresource.required())
self.post_instance_update(self.ctx.selectors.subresource.get())
self.ActionGroupsCreateOrUpdate(ctx=self.ctx)()
self.post_operations()

Expand All @@ -107,7 +107,7 @@ def post_instance_update(self, instance):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True)
result = self.deserialize_output(self.ctx.selectors.subresource.get(), client_flatten=True)
return result

class SubresourceSelector(AAZJsonSelector):
Expand Down Expand Up @@ -302,7 +302,7 @@ def _build_schema_on_200_201(cls):
class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation):

def __call__(self, *args, **kwargs):
self._update_instance(self.ctx.selectors.subresource.required())
self._update_instance(self.ctx.selectors.subresource.get())

def _update_instance(self, instance):
_instance_value, _builder = self.new_content_builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def _build_schema_on_200(cls):
_element.caller = AAZStrType(
flags={"read_only": True},
)
_element.category = AAZObjectType()
_element.category = AAZObjectType(
flags={"read_only": True},
)
_ListHelper._build_schema_localizable_string_read(_element.category)
_element.claims = AAZDictType(
flags={"read_only": True},
Expand Down Expand Up @@ -214,6 +216,7 @@ def _build_schema_on_200(cls):
)
_element.operation_name = AAZObjectType(
serialized_name="operationName",
flags={"read_only": True},
)
_ListHelper._build_schema_localizable_string_read(_element.operation_name)
_element.properties = AAZDictType(
Expand All @@ -233,10 +236,13 @@ def _build_schema_on_200(cls):
_element.resource_type = AAZObjectType(
serialized_name="resourceType",
)
_element.status = AAZObjectType()
_element.status = AAZObjectType(
flags={"read_only": True},
)
_ListHelper._build_schema_localizable_string_read(_element.status)
_element.sub_status = AAZObjectType(
serialized_name="subStatus",
flags={"read_only": True},
)
_ListHelper._build_schema_localizable_string_read(_element.sub_status)
_element.submission_timestamp = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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_group(
"monitor app-insights",
)
class __CMDGroup(AAZCommandGroup):
"""Commands for querying data in Application Insights applications.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# --------------------------------------------------------------------------------------------
# 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 .__cmd_group import *
from ._migrate_to_new_pricing_model import *
from ._query_execute import *
from ._query_show import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# --------------------------------------------------------------------------------------------
# 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(
"monitor app-insights migrate-to-new-pricing-model",
)
class MigrateToNewPricingModel(AAZCommand):
"""Enterprise Agreement Customer opted to use new pricing model.

:example: Migrate to new pricing model
az monitor app-insights migrate-to-new-pricing-model
"""

_aaz_info = {
"version": "2017-10-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.insights/migratetonewpricingmodel", "2017-10-01"],
]
}

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

_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 ""
return cls._args_schema

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

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

class EASubscriptionMigrateToNewPricingModelPost(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 [204]:
return self.on_204(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/microsoft.insights/migrateToNewPricingModel",
**self.url_parameters
)

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

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

@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", "2017-10-01",
required=True,
),
}
return parameters

def on_204(self, session):
pass


class _MigrateToNewPricingModelHelper:
"""Helper class for MigrateToNewPricingModel"""


__all__ = ["MigrateToNewPricingModel"]
Loading
Loading