diff --git a/src/application-insights/HISTORY.rst b/src/application-insights/HISTORY.rst index 8355ce2bf20..8381237028b 100644 --- a/src/application-insights/HISTORY.rst +++ b/src/application-insights/HISTORY.rst @@ -3,6 +3,10 @@ Release History =============== +1.2.0 +++++++++++++++++++ +* `az monitor app-insights`: Add new command group `workbook` to support managing workbook. + 1.1.0 ++++++++++++++++++ * `az monitor app-insights component`: Add new command group `favorite` to support managing favorite. diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/__init__.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/__init__.py index 5a9d61963d6..c401f439385 100644 --- a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/__init__.py +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/__init__.py @@ -9,3 +9,8 @@ # flake8: noqa from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_create.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_create.py new file mode 100644 index 00000000000..d4b1015702b --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_create.py @@ -0,0 +1,404 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook create", +) +class Create(AAZCommand): + """Create a workbook. + + :example: Create workbook + az monitor app-insights workbook create -n 00000000-0000-0000-0000-000000000000 -g rg --serialized-data mydata --kind shared --category workbook --display-name workbookname + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks/{}", "2023-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 "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the workbook resource. The value must be an UUID.", + required=True, + ) + _args_schema.source_id = AAZStrArg( + options=["--source-id"], + help="Azure Resource Id that will fetch all linked workbooks.", + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.category = AAZStrArg( + options=["--category"], + arg_group="Properties", + help="Workbook category, as defined by the user at creation time.", + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="The description of the workbook.", + nullable=True, + ) + _args_schema.display_name = AAZStrArg( + options=["--display-name"], + arg_group="Properties", + help="The user-defined name (display name) of the workbook.", + ) + _args_schema.serialized_data = AAZStrArg( + options=["--serialized-data"], + arg_group="Properties", + help="Configuration of this particular workbook. Configuration data is a string containing valid JSON", + nullable=True, + ) + _args_schema.storage_uri = AAZStrArg( + options=["--storage-uri"], + arg_group="Properties", + help="The resourceId to the storage account when bring your own storage is used", + nullable=True, + ) + _args_schema.version = AAZStrArg( + options=["--version"], + arg_group="Properties", + help="Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData", + ) + + # define Arg Group "WorkbookProperties" + + _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="WorkbookProperties", + help="Identity used for BYOS", + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="WorkbookProperties", + help="The kind of workbook. Only valid value is shared.", + enum={"shared": "shared"}, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="WorkbookProperties", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="WorkbookProperties", + help="Resource tags.", + ) + + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + required=True, + enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, + ) + identity.user_assigned_identities = AAZDictArg( + options=["user-assigned-identities"], + help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + ) + + user_assigned_identities = cls._args_schema.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectArg( + blank={}, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkbooksCreateOrUpdate(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 WorkbooksCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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( + "sourceId", self.ctx.args.source_id, + ), + **self.serialize_query_param( + "api-version", "2023-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("identity", AAZObjectType, ".identity") + _builder.set_prop("kind", AAZStrType, ".kind") + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + + user_assigned_identities = _builder.get(".identity.userAssignedIdentities") + if user_assigned_identities is not None: + user_assigned_identities.set_elements(AAZObjectType, ".") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("category", AAZStrType, ".category", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("description", AAZStrType, ".description", typ_kwargs={"nullable": True}) + properties.set_prop("displayName", AAZStrType, ".display_name", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("serializedData", AAZStrType, ".serialized_data", typ_kwargs={"flags": {"required": True}, "nullable": True}) + properties.set_prop("storageUri", AAZStrType, ".storage_uri", typ_kwargs={"nullable": True}) + properties.set_prop("version", AAZStrType, ".version") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.etag = AAZStrType() + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.identity = AAZObjectType() + _schema_on_200_201.kind = AAZStrType() + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200_201.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200_201.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = cls._schema_on_200_201.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + system_data = cls._schema_on_200_201.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", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_delete.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_delete.py new file mode 100644 index 00000000000..324dd2f1635 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_delete.py @@ -0,0 +1,139 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a workbook. + + :example: Delete workbook + az monitor app-insights workbook delete -n 00000000-0000-0000-0000-000000000000 -g wktest + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks/{}", "2023-06-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 "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the workbook resource. The value must be an UUID.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkbooksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class WorkbooksDelete(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) + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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", "2023-06-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_list.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_list.py new file mode 100644 index 00000000000..88912a4cdd8 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_list.py @@ -0,0 +1,520 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook list", +) +class List(AAZCommand): + """List all workbooks defined within a specified resource group and category. + + :example: List workbook + az monitor app-insights workbook list -g rg --category workbook + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.insights/workbooks", "2023-06-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks", "2023-06-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, 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.resource_group = AAZResourceGroupNameArg() + _args_schema.can_fetch_content = AAZBoolArg( + options=["--can-fetch-content"], + help="Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks.", + ) + _args_schema.category = AAZStrArg( + options=["--category"], + help="Category of workbook to return.", + required=True, + enum={"TSG": "TSG", "performance": "performance", "retention": "retention", "workbook": "workbook"}, + ) + _args_schema.source_id = AAZStrArg( + options=["--source-id"], + help="Azure Resource Id that will fetch all linked workbooks.", + ) + _args_schema.tags = AAZListArg( + options=["--tags"], + help="Tags presents on each workbook returned.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.category) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) and has_value(self.ctx.args.category) + if condition_0: + self.WorkbooksListBySubscription(ctx=self.ctx)() + if condition_1: + self.WorkbooksListByResourceGroup(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.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class WorkbooksListBySubscription(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/Microsoft.Insights/workbooks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @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( + "canFetchContent", self.ctx.args.can_fetch_content, + ), + **self.serialize_query_param( + "category", self.ctx.args.category, + required=True, + ), + **self.serialize_query_param( + "tags", self.ctx.args.tags, + ), + **self.serialize_query_param( + "api-version", "2023-06-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.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType() + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.kind = AAZStrType() + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + system_data = cls._schema_on_200.value.Element.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", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class WorkbooksListByResourceGroup(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/Microsoft.Insights/workbooks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **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( + "canFetchContent", self.ctx.args.can_fetch_content, + ), + **self.serialize_query_param( + "category", self.ctx.args.category, + required=True, + ), + **self.serialize_query_param( + "sourceId", self.ctx.args.source_id, + ), + **self.serialize_query_param( + "tags", self.ctx.args.tags, + ), + **self.serialize_query_param( + "api-version", "2023-06-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.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType() + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.kind = AAZStrType() + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + system_data = cls._schema_on_200.value.Element.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", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_show.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_show.py new file mode 100644 index 00000000000..901112daa92 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_show.py @@ -0,0 +1,280 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook show", +) +class Show(AAZCommand): + """Show a single workbook by its resource name. + + :example: Show workbook + az monitor app-insights workbook show -n 00000000-0000-0000-0000-000000000000 -g wktest + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks/{}", "2023-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 "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the workbook resource. The value must be an UUID.", + required=True, + id_part="name", + ) + _args_schema.can_fetch_content = AAZBoolArg( + options=["--can-fetch-content"], + help="Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkbooksGet(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 WorkbooksGet(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/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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( + "canFetchContent", self.ctx.args.can_fetch_content, + ), + **self.serialize_query_param( + "api-version", "2023-06-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.etag = AAZStrType() + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = cls._schema_on_200.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + 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", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_update.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_update.py new file mode 100644 index 00000000000..98b9827eb4f --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/_update.py @@ -0,0 +1,553 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook update", +) +class Update(AAZCommand): + """Update a workbook. + + :example: Update workbook + az monitor app-insights workbook update -n 00000000-0000-0000-0000-000000000000 -g rg --tags tag=test + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks/{}", "2023-06-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the workbook resource. The value must be an UUID.", + required=True, + id_part="name", + ) + _args_schema.source_id = AAZStrArg( + options=["--source-id"], + help="Azure Resource Id that will fetch all linked workbooks.", + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.category = AAZStrArg( + options=["--category"], + arg_group="Properties", + help="Workbook category, as defined by the user at creation time.", + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="The description of the workbook.", + nullable=True, + ) + _args_schema.display_name = AAZStrArg( + options=["--display-name"], + arg_group="Properties", + help="The user-defined name (display name) of the workbook.", + ) + _args_schema.serialized_data = AAZStrArg( + options=["--serialized-data"], + arg_group="Properties", + help="Configuration of this particular workbook. Configuration data is a string containing valid JSON", + nullable=True, + ) + _args_schema.storage_uri = AAZStrArg( + options=["--storage-uri"], + arg_group="Properties", + help="The resourceId to the storage account when bring your own storage is used", + nullable=True, + ) + _args_schema.version = AAZStrArg( + options=["--version"], + arg_group="Properties", + help="Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData", + nullable=True, + ) + + # define Arg Group "WorkbookProperties" + + _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="WorkbookProperties", + help="Identity used for BYOS", + nullable=True, + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="WorkbookProperties", + help="The kind of workbook. Only valid value is shared.", + nullable=True, + enum={"shared": "shared"}, + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="WorkbookProperties", + help="Resource tags.", + nullable=True, + ) + + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, + ) + identity.user_assigned_identities = AAZDictArg( + options=["user-assigned-identities"], + help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + nullable=True, + ) + + user_assigned_identities = cls._args_schema.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectArg( + nullable=True, + blank={}, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkbooksGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.WorkbooksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class WorkbooksGet(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/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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", "2023-06-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() + _UpdateHelper._build_schema_workbook_read(cls._schema_on_200) + + return cls._schema_on_200 + + class WorkbooksCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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( + "sourceId", self.ctx.args.source_id, + ), + **self.serialize_query_param( + "api-version", "2023-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, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_workbook_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("kind", AAZStrType, ".kind") + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + + user_assigned_identities = _builder.get(".identity.userAssignedIdentities") + if user_assigned_identities is not None: + user_assigned_identities.set_elements(AAZObjectType, ".") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("category", AAZStrType, ".category", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("description", AAZStrType, ".description", typ_kwargs={"nullable": True}) + properties.set_prop("displayName", AAZStrType, ".display_name", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("serializedData", AAZStrType, ".serialized_data", typ_kwargs={"flags": {"required": True}, "nullable": True}) + properties.set_prop("storageUri", AAZStrType, ".storage_uri", typ_kwargs={"nullable": True}) + properties.set_prop("version", AAZStrType, ".version") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_workbook_read = None + + @classmethod + def _build_schema_workbook_read(cls, _schema): + if cls._schema_workbook_read is not None: + _schema.etag = cls._schema_workbook_read.etag + _schema.id = cls._schema_workbook_read.id + _schema.identity = cls._schema_workbook_read.identity + _schema.kind = cls._schema_workbook_read.kind + _schema.location = cls._schema_workbook_read.location + _schema.name = cls._schema_workbook_read.name + _schema.properties = cls._schema_workbook_read.properties + _schema.system_data = cls._schema_workbook_read.system_data + _schema.tags = cls._schema_workbook_read.tags + _schema.type = cls._schema_workbook_read.type + return + + cls._schema_workbook_read = _schema_workbook_read = AAZObjectType() + + workbook_read = _schema_workbook_read + workbook_read.etag = AAZStrType() + workbook_read.id = AAZStrType( + flags={"read_only": True}, + ) + workbook_read.identity = AAZObjectType() + workbook_read.kind = AAZStrType() + workbook_read.location = AAZStrType( + flags={"required": True}, + ) + workbook_read.name = AAZStrType( + flags={"read_only": True}, + ) + workbook_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + workbook_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + workbook_read.tags = AAZDictType() + workbook_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_workbook_read.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = _schema_workbook_read.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = _schema_workbook_read.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = _schema_workbook_read.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + system_data = _schema_workbook_read.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", + ) + + tags = _schema_workbook_read.tags + tags.Element = AAZStrType() + + _schema.etag = cls._schema_workbook_read.etag + _schema.id = cls._schema_workbook_read.id + _schema.identity = cls._schema_workbook_read.identity + _schema.kind = cls._schema_workbook_read.kind + _schema.location = cls._schema_workbook_read.location + _schema.name = cls._schema_workbook_read.name + _schema.properties = cls._schema_workbook_read.properties + _schema.system_data = cls._schema_workbook_read.system_data + _schema.tags = cls._schema_workbook_read.tags + _schema.type = cls._schema_workbook_read.type + + +__all__ = ["Update"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/__cmd_group.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/__cmd_group.py new file mode 100644 index 00000000000..574bf9f9e08 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/__cmd_group.py @@ -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 workbook identity", +) +class __CMDGroup(AAZCommandGroup): + """Manage workbook idneity + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/__init__.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/__init__.py new file mode 100644 index 00000000000..9fa7324972a --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# 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 ._assign import * +from ._remove import * diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/_assign.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/_assign.py new file mode 100644 index 00000000000..aa06886c633 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/_assign.py @@ -0,0 +1,466 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook identity assign", +) +class Assign(AAZCommand): + """Assign identities + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks/{}", "2023-06-01", "identity"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self.SubresourceSelector(ctx=self.ctx, name="subresource") + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--resource-name"], + help="The name of the workbook resource. The value must be an UUID.", + required=True, + ) + _args_schema.source_id = AAZStrArg( + options=["--source-id"], + help="Azure Resource Id that will fetch all linked workbooks.", + ) + + # define Arg Group "WorkbookProperties.identity" + + _args_schema = cls._args_schema + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="WorkbookProperties.identity", + help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + required=True, + enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, + ) + _args_schema.user_assigned_identities = AAZDictArg( + options=["--user-assigned-identities"], + arg_group="WorkbookProperties.identity", + help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + ) + + user_assigned_identities = cls._args_schema.user_assigned_identities + user_assigned_identities.Element = AAZObjectArg( + blank={}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkbooksGet(ctx=self.ctx)() + self.pre_instance_create() + self.InstanceCreateByJson(ctx=self.ctx)() + self.post_instance_create(self.ctx.selectors.subresource.required()) + self.WorkbooksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_create(self): + pass + + @register_callback + def post_instance_create(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True) + return result + + class SubresourceSelector(AAZJsonSelector): + + def _get(self): + result = self.ctx.vars.instance + return result.identity + + def _set(self, value): + result = self.ctx.vars.instance + result.identity = value + return + + class WorkbooksGet(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/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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", "2023-06-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() + _AssignHelper._build_schema_workbook_read(cls._schema_on_200) + + return cls._schema_on_200 + + class WorkbooksCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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( + "sourceId", self.ctx.args.source_id, + ), + **self.serialize_query_param( + "api-version", "2023-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, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _AssignHelper._build_schema_workbook_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceCreateByJson(AAZJsonInstanceCreateOperation): + + def __call__(self, *args, **kwargs): + self.ctx.selectors.subresource.set(self._create_instance()) + + def _create_instance(self): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType + ) + _builder.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + + user_assigned_identities = _builder.get(".userAssignedIdentities") + if user_assigned_identities is not None: + user_assigned_identities.set_elements(AAZObjectType, ".") + + return _instance_value + + +class _AssignHelper: + """Helper class for Assign""" + + _schema_workbook_read = None + + @classmethod + def _build_schema_workbook_read(cls, _schema): + if cls._schema_workbook_read is not None: + _schema.etag = cls._schema_workbook_read.etag + _schema.id = cls._schema_workbook_read.id + _schema.identity = cls._schema_workbook_read.identity + _schema.kind = cls._schema_workbook_read.kind + _schema.location = cls._schema_workbook_read.location + _schema.name = cls._schema_workbook_read.name + _schema.properties = cls._schema_workbook_read.properties + _schema.system_data = cls._schema_workbook_read.system_data + _schema.tags = cls._schema_workbook_read.tags + _schema.type = cls._schema_workbook_read.type + return + + cls._schema_workbook_read = _schema_workbook_read = AAZObjectType() + + workbook_read = _schema_workbook_read + workbook_read.etag = AAZStrType() + workbook_read.id = AAZStrType( + flags={"read_only": True}, + ) + workbook_read.identity = AAZObjectType() + workbook_read.kind = AAZStrType() + workbook_read.location = AAZStrType( + flags={"required": True}, + ) + workbook_read.name = AAZStrType( + flags={"read_only": True}, + ) + workbook_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + workbook_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + workbook_read.tags = AAZDictType() + workbook_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_workbook_read.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = _schema_workbook_read.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = _schema_workbook_read.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = _schema_workbook_read.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + system_data = _schema_workbook_read.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", + ) + + tags = _schema_workbook_read.tags + tags.Element = AAZStrType() + + _schema.etag = cls._schema_workbook_read.etag + _schema.id = cls._schema_workbook_read.id + _schema.identity = cls._schema_workbook_read.identity + _schema.kind = cls._schema_workbook_read.kind + _schema.location = cls._schema_workbook_read.location + _schema.name = cls._schema_workbook_read.name + _schema.properties = cls._schema_workbook_read.properties + _schema.system_data = cls._schema_workbook_read.system_data + _schema.tags = cls._schema_workbook_read.tags + _schema.type = cls._schema_workbook_read.type + + +__all__ = ["Assign"] diff --git a/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/_remove.py b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/_remove.py new file mode 100644 index 00000000000..d3e3d4e4777 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/aaz/latest/monitor/app_insights/workbook/identity/_remove.py @@ -0,0 +1,468 @@ +# -------------------------------------------------------------------------------------------- +# 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 workbook identity remove", +) +class Remove(AAZCommand): + """Remove identities + """ + + _aaz_info = { + "version": "2023-06-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.insights/workbooks/{}", "2023-06-01", "identity"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self.SubresourceSelector(ctx=self.ctx, name="subresource") + 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.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--resource-name"], + help="The name of the workbook resource. The value must be an UUID.", + required=True, + ) + _args_schema.source_id = AAZStrArg( + options=["--source-id"], + help="Azure Resource Id that will fetch all linked workbooks.", + ) + + # define Arg Group "WorkbookProperties.identity" + + _args_schema = cls._args_schema + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="WorkbookProperties.identity", + help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, + ) + _args_schema.user_assigned_identities = AAZDictArg( + options=["--user-assigned-identities"], + arg_group="WorkbookProperties.identity", + help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + nullable=True, + ) + + user_assigned_identities = cls._args_schema.user_assigned_identities + user_assigned_identities.Element = AAZObjectArg( + nullable=True, + blank={}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkbooksGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.selectors.subresource.required()) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.post_instance_update(self.ctx.selectors.subresource.required()) + self.WorkbooksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True) + return result + + class SubresourceSelector(AAZJsonSelector): + + def _get(self): + result = self.ctx.vars.instance + return result.identity + + def _set(self, value): + result = self.ctx.vars.instance + result.identity = value + return + + class WorkbooksGet(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/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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", "2023-06-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() + _RemoveHelper._build_schema_workbook_read(cls._schema_on_200) + + return cls._schema_on_200 + + class WorkbooksCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + 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( + "sourceId", self.ctx.args.source_id, + ), + **self.serialize_query_param( + "api-version", "2023-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, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _RemoveHelper._build_schema_workbook_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.selectors.subresource.required()) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + + user_assigned_identities = _builder.get(".userAssignedIdentities") + if user_assigned_identities is not None: + user_assigned_identities.set_elements(AAZObjectType, ".") + + return _instance_value + + +class _RemoveHelper: + """Helper class for Remove""" + + _schema_workbook_read = None + + @classmethod + def _build_schema_workbook_read(cls, _schema): + if cls._schema_workbook_read is not None: + _schema.etag = cls._schema_workbook_read.etag + _schema.id = cls._schema_workbook_read.id + _schema.identity = cls._schema_workbook_read.identity + _schema.kind = cls._schema_workbook_read.kind + _schema.location = cls._schema_workbook_read.location + _schema.name = cls._schema_workbook_read.name + _schema.properties = cls._schema_workbook_read.properties + _schema.system_data = cls._schema_workbook_read.system_data + _schema.tags = cls._schema_workbook_read.tags + _schema.type = cls._schema_workbook_read.type + return + + cls._schema_workbook_read = _schema_workbook_read = AAZObjectType() + + workbook_read = _schema_workbook_read + workbook_read.etag = AAZStrType() + workbook_read.id = AAZStrType( + flags={"read_only": True}, + ) + workbook_read.identity = AAZObjectType() + workbook_read.kind = AAZStrType() + workbook_read.location = AAZStrType( + flags={"required": True}, + ) + workbook_read.name = AAZStrType( + flags={"read_only": True}, + ) + workbook_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + workbook_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + workbook_read.tags = AAZDictType() + workbook_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_workbook_read.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = _schema_workbook_read.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType() + + _element = _schema_workbook_read.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = _schema_workbook_read.properties + properties.category = AAZStrType( + flags={"required": True}, + ) + properties.description = AAZStrType( + nullable=True, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"required": True}, + ) + properties.revision = AAZStrType( + nullable=True, + flags={"read_only": True}, + ) + properties.serialized_data = AAZStrType( + serialized_name="serializedData", + flags={"required": True}, + nullable=True, + ) + properties.storage_uri = AAZStrType( + serialized_name="storageUri", + nullable=True, + ) + properties.time_modified = AAZStrType( + serialized_name="timeModified", + flags={"read_only": True}, + ) + properties.user_id = AAZStrType( + serialized_name="userId", + flags={"read_only": True}, + ) + properties.version = AAZStrType() + + system_data = _schema_workbook_read.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", + ) + + tags = _schema_workbook_read.tags + tags.Element = AAZStrType() + + _schema.etag = cls._schema_workbook_read.etag + _schema.id = cls._schema_workbook_read.id + _schema.identity = cls._schema_workbook_read.identity + _schema.kind = cls._schema_workbook_read.kind + _schema.location = cls._schema_workbook_read.location + _schema.name = cls._schema_workbook_read.name + _schema.properties = cls._schema_workbook_read.properties + _schema.system_data = cls._schema_workbook_read.system_data + _schema.tags = cls._schema_workbook_read.tags + _schema.type = cls._schema_workbook_read.type + + +__all__ = ["Remove"] diff --git a/src/application-insights/azext_applicationinsights/commands.py b/src/application-insights/azext_applicationinsights/commands.py index ce695e317a5..40fc38934ce 100644 --- a/src/application-insights/azext_applicationinsights/commands.py +++ b/src/application-insights/azext_applicationinsights/commands.py @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long -# pylint: disable=too-many-statements +# pylint: disable=too-many-statements, too-many-locals from azure.cli.core.commands import CliCommandType @@ -108,6 +108,13 @@ def load_command_table(self, _): self.command_table['monitor app-insights component continues-export list'] = ExportConfigurationList(loader=self) self.command_table['monitor app-insights component continues-export delete'] = ExportConfigurationDelete(loader=self) + with self.command_group('monitor app-insights workbook'): + from .custom import WorkbookCreate, WorkbookUpdate, IdentityAssign, IdentityRemove + self.command_table['monitor app-insights workbook create'] = WorkbookCreate(loader=self) + self.command_table['monitor app-insights workbook update'] = WorkbookUpdate(loader=self) + self.command_table['monitor app-insights workbook identity assign'] = IdentityAssign(loader=self) + self.command_table['monitor app-insights workbook identity remove'] = IdentityRemove(loader=self) + with self.command_group('monitor app-insights component continues-export', command_type=export_configurations_sdk, custom_command_type=export_configurations_custom_sdk) as g: g.custom_command('create', 'create_export_configuration') g.custom_command('update', 'update_export_configuration') diff --git a/src/application-insights/azext_applicationinsights/custom.py b/src/application-insights/azext_applicationinsights/custom.py index 92cc2647de9..1f8dfb620e9 100644 --- a/src/application-insights/azext_applicationinsights/custom.py +++ b/src/application-insights/azext_applicationinsights/custom.py @@ -22,6 +22,8 @@ from .aaz.latest.monitor.app_insights.component.billing import Show as _BillingShow, Update as _BillingUpdate from .aaz.latest.monitor.app_insights.component.linked_storage import Link as _LinkedStorageAccountLink, Update as _LinkedStorageAccountUpdate, Show as _LinkedStorageAccountShow, Unlink as _LinkedStorageAccountUnlink from .aaz.latest.monitor.app_insights.component.continues_export import Delete as _ContinuesExportDelete, Show as _ContinuesExportShow, List as _ContinuesExportList +from .aaz.latest.monitor.app_insights.workbook import Create as _WorkbookCreate, Update as _WorkbookUpdate +from .aaz.latest.monitor.app_insights.workbook.identity import Assign as _IdentityAssign, Remove as _IdentityRemove logger = get_logger(__name__) HELP_MESSAGE = " Please use `az feature register --name AIWorkspacePreview --namespace microsoft.insights` to register the feature" @@ -708,3 +710,153 @@ def update_web_test(instance, def delete_web_test(client, resource_group_name, web_test_name): return client.delete(resource_group_name=resource_group_name, web_test_name=web_test_name) + + +class WorkbookCreate(_WorkbookCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.mi_system_assigned = AAZBoolArg( + options=["--mi-system-assigned"], + help="Enable system assigned identity" + ) + args_schema.mi_user_assigned = AAZListArg( + options=["--mi-user-assigned"], + help="Space separated resource IDs to add user-assigned identities.", + ) + args_schema.mi_user_assigned.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat(template="/subscriptions/{subscription}/resourceGroups/{resource_group}" + "/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}") + ) + args_schema.identity._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if not has_value(args.serialized_data): + args.serialized_data = 'null' + if args.mi_system_assigned: + args.identity.type = "SystemAssigned" + if has_value(args.mi_user_assigned): + args.identity.type = "UserAssigned" if not args.identity.type else "SystemAssigned,UserAssigned" + user_assigned_identities = {} + for identity in args.mi_user_assigned: + user_assigned_identities.update({ + identity.to_serialized_data(): {} + }) + args.identity.user_assigned_identities = user_assigned_identities + + +class WorkbookUpdate(_WorkbookUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.identity._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if not has_value(args.serialized_data): + args.serialized_data = 'null' + + +class IdentityAssign(_IdentityAssign): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.system_assigned = AAZBoolArg( + options=["--system-assigned"], + help="Enable system assigned identity" + ) + args_schema.user_assigned = AAZListArg( + options=["--user-assigned"], + help="Space separated resource IDs to add user-assigned identities.", + ) + args_schema.user_assigned.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat(template="/subscriptions/{subscription}/resourceGroups/{resource_group}" + "/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}") + ) + args_schema.type._registered = False + args_schema.type._required = False + args_schema.user_assigned_identities._registered = False + return args_schema + + def pre_operations(self): + args = self.ctx.args + if args.system_assigned: + args.type = "SystemAssigned" + if has_value(args.user_assigned): + args.type = "UserAssigned" if not args.type else "SystemAssigned,UserAssigned" + user_assigned_identities = {} + for identity in args.user_assigned: + user_assigned_identities.update({ + identity.to_serialized_data(): {} + }) + args.user_assigned_identities = user_assigned_identities + + def pre_instance_create(self): + self.ctx.vars.instance.properties.serialized_data = 'null' + old_identity = self.ctx.vars.instance.identity + args = self.ctx.args + + if args.system_assigned: + args.type = "SystemAssigned" if not old_identity.type or old_identity.type.to_serialized_data() == 'SystemAssigned' else "SystemAssigned,UserAssigned" + if has_value(args.user_assigned): + args.type = "UserAssigned" if not old_identity.type or old_identity.type.to_serialized_data() == 'UserAssigned' else "SystemAssigned,UserAssigned" + if not old_identity.type: + user_assigned_identities = {} + else: + user_assigned_identities = {} if 'UserAssigned' not in old_identity.type.to_serialized_data() else {**old_identity.user_assigned_identities.to_serialized_data()} + for identity in args.user_assigned: + user_assigned_identities.update({ + identity.to_serialized_data(): {} + }) + args.user_assigned_identities = user_assigned_identities + + +class IdentityRemove(_IdentityRemove): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + from azure.cli.core.aaz import AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.system_assigned = AAZBoolArg( + options=["--system-assigned"], + help="Enable system assigned identity" + ) + args_schema.user_assigned = AAZListArg( + options=["--user-assigned"], + help="Space separated resource IDs to add user-assigned identities.", + ) + args_schema.user_assigned.Element = AAZResourceIdArg( + fmt=AAZResourceIdArgFormat(template="/subscriptions/{subscription}/resourceGroups/{resource_group}" + "/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}") + ) + args_schema.type._registered = False + args_schema.user_assigned_identities._registered = False + return args_schema + + def pre_instance_update(self, instance): + self.ctx.vars.instance.properties.serialized_data = 'null' + args = self.ctx.args + if has_value(args.user_assigned): + user_assigned_identities = instance.user_assigned_identities + for identity in args.user_assigned: + user_assigned_identities._data.pop(identity.to_serialized_data(), None) + args.user_assigned_identities = user_assigned_identities + if instance.user_assigned_identities and 'SystemAssigned' in instance.type.to_serialized_data(): + args.type = "SystemAssigned,UserAssigned" + if not instance.user_assigned_identities and 'SystemAssigned' in instance.type.to_serialized_data(): + args.type = 'SystemAssigned' + if args.system_assigned and instance.user_assigned_identities: + args.type = 'UserAssigned' + if args.system_assigned and instance.type.to_serialized_data() == 'SystemAssigned': + args.type = 'None' + if not instance.user_assigned_identities and instance.type.to_serialized_data() == 'UserAssigned': + args.type = 'None' + + def _output(self, *args, **kwargs): + if not self.ctx.vars.instance.identity.to_serialized_data(): + return {'type': None} + return self.deserialize_output(self.ctx.selectors.subresource.required(), client_flatten=True) diff --git a/src/application-insights/azext_applicationinsights/tests/latest/recordings/test_appinsights_workbook.yaml b/src/application-insights/azext_applicationinsights/tests/latest/recordings/test_appinsights_workbook.yaml new file mode 100644 index 00000000000..c8392703c6b --- /dev/null +++ b/src/application-insights/azext_applicationinsights/tests/latest/recordings/test_appinsights_workbook.yaml @@ -0,0 +1,421 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook create + Connection: + - keep-alive + ParameterSetName: + - -g --display-name -n --category --serialized-data --kind + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook000001?api-version=2022-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001","name":"cli_test_appinsights_workbook000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_appinsights_workbook","date":"2024-01-02T11:27:36Z","module":"application-insights"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '415' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:27:40 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000002", "serializedData": "mydata"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook create + Connection: + - keep-alive + Content-Length: + - '141' + Content-Type: + - application/json + ParameterSetName: + - -g --display-name -n --category --serialized-data --kind + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2300bd53-0000-0200-0000-6593f32e0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": \"mydata\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:27:42.5231886Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"fc3de79940e6484788cd2ec294573a34\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '794' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:27:42 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook update + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2300bd53-0000-0200-0000-6593f32e0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:27:42.5231886Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"fc3de79940e6484788cd2ec294573a34\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '790' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:27:43 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2300bd53-0000-0200-0000-6593f32e0000\"", "kind": "shared", + "location": "westus", "properties": {"category": "workbook", "displayName": + "workbook000002", "serializedData": "null", "storageUri": null}, "tags": {"tag": + "test"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook update + Connection: + - keep-alive + Content-Length: + - '236' + Content-Type: + - application/json + ParameterSetName: + - -g -n --tags + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"tag\": \"\ + test\",\r\n \"hidden-title\": \"workbook000002\"\r\n },\r\n \"kind\"\ + : \"shared\",\r\n \"etag\": \"\\\"23009254-0000-0200-0000-6593f3300000\\\"\ + \",\r\n \"properties\": {\r\n \"displayName\": \"workbook000002\",\r\n\ + \ \"serializedData\": \"null\",\r\n \"version\": null,\r\n \"category\"\ + : \"workbook\",\r\n \"userId\": \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\"\ + ,\r\n \"sourceId\": null,\r\n \"timeModified\": \"2024-01-02T11:27:44.6808175Z\"\ + ,\r\n \"tags\": null,\r\n \"storageUri\": null,\r\n \"revision\"\ + : \"040cabda4c5d4a1d89bcbc6d5774ea8e\"\r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '812' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:27:45 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"tag\": \"\ + test\",\r\n \"hidden-title\": \"workbook000002\"\r\n },\r\n \"kind\"\ + : \"shared\",\r\n \"etag\": \"\\\"23009254-0000-0200-0000-6593f3300000\\\"\ + \",\r\n \"properties\": {\r\n \"displayName\": \"workbook000002\",\r\n\ + \ \"serializedData\": null,\r\n \"version\": null,\r\n \"category\"\ + : \"workbook\",\r\n \"userId\": \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\"\ + ,\r\n \"sourceId\": null,\r\n \"timeModified\": \"2024-01-02T11:27:44.6808175Z\"\ + ,\r\n \"tags\": null,\r\n \"storageUri\": null,\r\n \"revision\"\ + : \"040cabda4c5d4a1d89bcbc6d5774ea8e\"\r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '810' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:27:47 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook list + Connection: + - keep-alive + ParameterSetName: + - -g --category + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001/providers/Microsoft.Insights/workbooks?category=workbook&api-version=2023-06-01 + response: + body: + string: "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"\ + type\": null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n\ + \ \"tag\": \"test\",\r\n \"hidden-title\": \"workbook000002\"\ + \r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\"23009254-0000-0200-0000-6593f3300000\\\ + \"\",\r\n \"properties\": {\r\n \"displayName\": \"workbook000002\"\ + ,\r\n \"serializedData\": null,\r\n \"version\": null,\r\n \ + \ \"category\": \"workbook\",\r\n \"userId\": \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\"\ + ,\r\n \"sourceId\": null,\r\n \"timeModified\": \"2024-01-02T11:27:44.6808175Z\"\ + ,\r\n \"tags\": null,\r\n \"storageUri\": null,\r\n \"\ + revision\": \"040cabda4c5d4a1d89bcbc6d5774ea8e\"\r\n }\r\n }\r\n \ + \ ],\r\n \"nextLink\": null\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '952' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:27:49 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -n -y + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 02 Jan 2024 11:27:52 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/application-insights/azext_applicationinsights/tests/latest/recordings/test_appinsights_workbook_identity.yaml b/src/application-insights/azext_applicationinsights/tests/latest/recordings/test_appinsights_workbook_identity.yaml new file mode 100644 index 00000000000..d31c9a6f434 --- /dev/null +++ b/src/application-insights/azext_applicationinsights/tests/latest/recordings/test_appinsights_workbook_identity.yaml @@ -0,0 +1,1373 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - identity create + Connection: + - keep-alive + ParameterSetName: + - --name -g + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001?api-version=2022-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001","name":"cli_test_appinsights_workbook_identity000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_appinsights_workbook_identity","date":"2024-01-02T11:53:40Z","module":"application-insights"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '442' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:43 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "westus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - identity create + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json + ParameterSetName: + - --name -g + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-msi/7.0.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004?api-version=2023-01-31 + response: + body: + string: '{"location":"westus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004","name":"id000004","type":"Microsoft.ManagedIdentity/userAssignedIdentities","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","principalId":"01d1fe77-2215-4d2f-bc2a-39002afb1e4a","clientId":"73c12689-2d5f-4527-87c9-6e65bbef0e1a"}}' + headers: + cache-control: + - no-cache + content-length: + - '462' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:44 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - identity create + Connection: + - keep-alive + ParameterSetName: + - --name -g + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001?api-version=2022-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001","name":"cli_test_appinsights_workbook_identity000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_appinsights_workbook_identity","date":"2024-01-02T11:53:40Z","module":"application-insights"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '442' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:45 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "westus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - identity create + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json + ParameterSetName: + - --name -g + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-msi/7.0.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005?api-version=2023-01-31 + response: + body: + string: '{"location":"westus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005","name":"id000005","type":"Microsoft.ManagedIdentity/userAssignedIdentities","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","principalId":"47e75115-be44-4d7e-93a4-86b51a7437df","clientId":"0779774f-a876-4f3f-b978-e5e386978cce"}}' + headers: + cache-control: + - no-cache + content-length: + - '462' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:47 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook create + Connection: + - keep-alive + ParameterSetName: + - -g --display-name -n --category --kind --mi-user-assigned + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001?api-version=2022-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001","name":"cli_test_appinsights_workbook_identity000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_appinsights_workbook_identity","date":"2024-01-02T11:53:40Z","module":"application-insights"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '442' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:48 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"identity": {"type": "UserAssigned", "userAssignedIdentities": {"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004": + {}}}, "kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000002", "serializedData": "null"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook create + Connection: + - keep-alive + Content-Length: + - '392' + Content-Type: + - application/json + ParameterSetName: + - -g --display-name -n --category --kind --mi-user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500a200-0000-0200-0000-6593f94e0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:50.8531202Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"345221849e1a4a95b5592999db5dadca\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1086' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:50 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity assign + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500a200-0000-0200-0000-6593f94e0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:50.8531202Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"345221849e1a4a95b5592999db5dadca\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1084' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:52 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500a200-0000-0200-0000-6593f94e0000\"", "identity": {"type": + "UserAssigned", "userAssignedIdentities": {"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004": + {}, "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005": + {}}}, "kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000002", "serializedData": "null", "storageUri": null}, + "tags": {"hidden-title": "workbook000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity assign + Connection: + - keep-alive + Content-Length: + - '695' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {},\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500ab00-0000-0200-0000-6593f9510000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:53.1218986Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"cfa06f70bfab4ff2b0b0b78d3835217c\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1280' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:53 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {},\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500ab00-0000-0200-0000-6593f9510000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:53.1218986Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"cfa06f70bfab4ff2b0b0b78d3835217c\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1278' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:54 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500ab00-0000-0200-0000-6593f9510000\"", "identity": {"type": + "UserAssigned", "userAssignedIdentities": {"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005": + {}}}, "kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000002", "serializedData": "null", "storageUri": null}, + "tags": {"hidden-title": "workbook000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + Content-Length: + - '508' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500bf00-0000-0200-0000-6593f9530000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:55.4778167Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"57699a44e77645249985adcc9894d07d\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1086' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:55 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500bf00-0000-0200-0000-6593f9530000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:55.4778167Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"57699a44e77645249985adcc9894d07d\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1084' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:56 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500bf00-0000-0200-0000-6593f9530000\"", "identity": {"type": + "None", "userAssignedIdentities": {}}, "kind": "shared", "location": "westus", + "properties": {"category": "workbook", "displayName": "workbook000002", "serializedData": + "null", "storageUri": null}, "tags": {"hidden-title": "workbook000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + Content-Length: + - '315' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000000?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"None\",\r\n \"userAssignedIdentities\"\ + : {}\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000000\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000000\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000002\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500c700-0000-0200-0000-6593f9550000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000002\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:53:57.8842806Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"d37a40c7dc0049e09bfa042091c9d8ba\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '879' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:57 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook create + Connection: + - keep-alive + ParameterSetName: + - -g --display-name -n --category --kind + User-Agent: + - AZURECLI/2.55.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001?api-version=2022-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001","name":"cli_test_appinsights_workbook_identity000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","test":"test_appinsights_workbook_identity","date":"2024-01-02T11:53:40Z","module":"application-insights"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '442' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:53:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000003", "serializedData": "null"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook create + Connection: + - keep-alive + Content-Length: + - '139' + Content-Type: + - application/json + ParameterSetName: + - -g --display-name -n --category --kind + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500cd00-0000-0200-0000-6593f9580000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:00.5930238Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"47ff824cd0714dfcb6895e1420530f7a\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '801' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:00 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity assign + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500cd00-0000-0200-0000-6593f9580000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:00.5930238Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"47ff824cd0714dfcb6895e1420530f7a\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '799' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:01 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500cd00-0000-0200-0000-6593f9580000\"", "identity": {"type": + "UserAssigned", "userAssignedIdentities": {"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004": + {}}}, "kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000003", "serializedData": "null", "storageUri": null}, + "tags": {"hidden-title": "workbook000003"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity assign + Connection: + - keep-alive + Content-Length: + - '508' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500d400-0000-0200-0000-6593f95a0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:02.8685829Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"719dd5ba2e12451e8b47cf0fda492a45\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1086' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:02 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity assign + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500d400-0000-0200-0000-6593f95a0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:02.8685829Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"719dd5ba2e12451e8b47cf0fda492a45\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1084' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:03 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500d400-0000-0200-0000-6593f95a0000\"", "identity": {"type": + "UserAssigned", "userAssignedIdentities": {"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004": + {}, "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005": + {}}}, "kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000003", "serializedData": "null", "storageUri": null}, + "tags": {"hidden-title": "workbook000003"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity assign + Connection: + - keep-alive + Content-Length: + - '695' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {},\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500d700-0000-0200-0000-6593f95c0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:04.5404488Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"4e3cc985822745a5b950d91eaa0ce885\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1280' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:04 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000004\"\ + : {},\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500d700-0000-0200-0000-6593f95c0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:04.5404488Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"4e3cc985822745a5b950d91eaa0ce885\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1278' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:05 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500d700-0000-0200-0000-6593f95c0000\"", "identity": {"type": + "UserAssigned", "userAssignedIdentities": {"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005": + {}}}, "kind": "shared", "location": "westus", "properties": {"category": "workbook", + "displayName": "workbook000003", "serializedData": "null", "storageUri": null}, + "tags": {"hidden-title": "workbook000003"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + Content-Length: + - '508' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500dc00-0000-0200-0000-6593f95f0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:06.9529274Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"5807768610214887ae858c3f5809e132\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1086' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:06 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"\ + userAssignedIdentities\": {\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id000005\"\ + : {}\r\n }\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500dc00-0000-0200-0000-6593f95f0000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": null,\r\ + \n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:06.9529274Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"5807768610214887ae858c3f5809e132\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '1084' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:08 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"etag": "\"2500dc00-0000-0200-0000-6593f95f0000\"", "identity": {"type": + "None", "userAssignedIdentities": {}}, "kind": "shared", "location": "westus", + "properties": {"category": "workbook", "displayName": "workbook000003", "serializedData": + "null", "storageUri": null}, "tags": {"hidden-title": "workbook000003"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor app-insights workbook identity remove + Connection: + - keep-alive + Content-Length: + - '315' + Content-Type: + - application/json + ParameterSetName: + - -g -n --user-assigned + User-Agent: + - AZURECLI/2.55.0 (AAZ) azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_appinsights_workbook_identity000001/providers/Microsoft.Insights/workbooks/00000000-0000-0000-0000-000000000001?api-version=2023-06-01 + response: + body: + string: "{\r\n \"identity\": {\r\n \"type\": \"None\",\r\n \"userAssignedIdentities\"\ + : {}\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_appinsights_workbook_identity000001/providers/microsoft.insights/workbooks/00000000-0000-0000-0000-000000000001\"\ + ,\r\n \"name\": \"00000000-0000-0000-0000-000000000001\",\r\n \"type\":\ + \ null,\r\n \"location\": \"westus\",\r\n \"tags\": {\r\n \"hidden-title\"\ + : \"workbook000003\"\r\n },\r\n \"kind\": \"shared\",\r\n \"etag\": \"\\\ + \"2500e600-0000-0200-0000-6593f9620000\\\"\",\r\n \"properties\": {\r\n \ + \ \"displayName\": \"workbook000003\",\r\n \"serializedData\": \"null\"\ + ,\r\n \"version\": null,\r\n \"category\": \"workbook\",\r\n \"userId\"\ + : \"d44a2991-98c6-47c3-b59b-2b30d72cfcc2\",\r\n \"sourceId\": null,\r\n\ + \ \"timeModified\": \"2024-01-02T11:54:10.3401562Z\",\r\n \"tags\":\ + \ null,\r\n \"storageUri\": null,\r\n \"revision\": \"f09b5b58c63a4e1fabdfc331a5e1f6bc\"\ + \r\n }\r\n}" + headers: + access-control-expose-headers: + - Request-Context + cache-control: + - no-cache + content-length: + - '879' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 02 Jan 2024 11:54:09 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:0dd6a9c3-b728-41ca-aa78-7e1962e22331 + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/application-insights/azext_applicationinsights/tests/latest/test_applicationinsights_mgmt.py b/src/application-insights/azext_applicationinsights/tests/latest/test_applicationinsights_mgmt.py index c97c6490dbc..5aa2a034589 100644 --- a/src/application-insights/azext_applicationinsights/tests/latest/test_applicationinsights_mgmt.py +++ b/src/application-insights/azext_applicationinsights/tests/latest/test_applicationinsights_mgmt.py @@ -591,3 +591,94 @@ def test_appinsights_my_workbook(self, resource_group): message = "Resource type 'myWorkbooks' of provider namespace 'Microsoft.Insights' was not found in global location for api version '2021-03-08'." with self.assertRaisesRegex(ResourceNotFoundError, message): self.cmd('monitor app-insights my-workbook list -g {rg} --category performance') + + @ResourceGroupPreparer(name_prefix="cli_test_appinsights_workbook") + def test_appinsights_workbook(self, resource_group): + self.kwargs.update({ + 'workbook_name': self.create_random_name('workbook', 15) + }) + self.cmd('monitor app-insights workbook create -g {rg} --display-name {workbook_name} -n 00000000-0000-0000-0000-000000000000 --category workbook --serialized-data mydata --kind shared', checks=[ + self.check('category', 'workbook'), + self.check('displayName', '{workbook_name}'), + self.check('kind', 'shared'), + self.check('name', '00000000-0000-0000-0000-000000000000'), + self.check('serializedData', 'mydata') + ]) + self.cmd('monitor app-insights workbook update -g {rg} -n 00000000-0000-0000-0000-000000000000 --tags {{tag:test}}', checks=[ + self.check('category', 'workbook'), + self.check('displayName', '{workbook_name}'), + self.check('kind', 'shared'), + self.check('name', '00000000-0000-0000-0000-000000000000'), + self.check('tags.tag', 'test') + ]) + self.cmd('monitor app-insights workbook show -g {rg} -n 00000000-0000-0000-0000-000000000000', checks=[ + self.check('category', 'workbook'), + self.check('displayName', '{workbook_name}'), + self.check('kind', 'shared'), + self.check('name', '00000000-0000-0000-0000-000000000000'), + self.check('tags.tag', 'test') + ]) + self.cmd('monitor app-insights workbook list -g {rg} --category workbook', checks=[ + self.check('[0].category', 'workbook'), + self.check('[0].displayName', '{workbook_name}'), + self.check('[0].kind', 'shared'), + self.check('[0].name', '00000000-0000-0000-0000-000000000000'), + self.check('[0].tags.tag', 'test') + ]) + self.cmd('monitor app-insights workbook delete -g {rg} -n 00000000-0000-0000-0000-000000000000 -y') + + @ResourceGroupPreparer(name_prefix="cli_test_appinsights_workbook_identity") + def test_appinsights_workbook_identity(self, resource_group): + self.kwargs.update({ + 'workbook_name': self.create_random_name('workbook', 15), + 'workbook_name2': self.create_random_name('workbook', 15), + 'identity1': self.create_random_name('id', 10), + 'identity2': self.create_random_name('id', 10) + }) + identity1 = self.cmd('identity create --name {identity1} -g {rg}').get_output_in_json() + identity2 = self.cmd('identity create --name {identity2} -g {rg}').get_output_in_json() + self.kwargs.update({ + 'id1': identity1['id'], + 'id2': identity2['id'] + }) + self.cmd('monitor app-insights workbook create -g {rg} --display-name {workbook_name} -n 00000000-0000-0000-0000-000000000000 --category workbook --kind shared --mi-user-assigned {id1}', checks=[ + self.check('category', 'workbook'), + self.check('displayName', '{workbook_name}'), + self.check('kind', 'shared'), + self.check('name', '00000000-0000-0000-0000-000000000000'), + self.check('identity.type', 'UserAssigned'), + self.check('identity.userAssignedIdentities', {identity1['id']: {}}) + ]) + self.cmd('monitor app-insights workbook identity assign -g {rg} -n 00000000-0000-0000-0000-000000000000 --user-assigned {id2}', checks=[ + self.check('type', 'UserAssigned'), + self.check('userAssignedIdentities', {identity1['id']: {}, identity2['id']: {}}) + ]) + self.cmd('monitor app-insights workbook identity remove -g {rg} -n 00000000-0000-0000-0000-000000000000 --user-assigned {id1}', checks=[ + self.check('type', 'UserAssigned'), + self.check('userAssignedIdentities', {identity2['id']: {}}) + ]) + self.cmd('monitor app-insights workbook identity remove -g {rg} -n 00000000-0000-0000-0000-000000000000 --user-assigned {id2}', checks=[ + self.check('type', None) + ]) + + self.cmd('monitor app-insights workbook create -g {rg} --display-name {workbook_name2} -n 00000000-0000-0000-0000-000000000001 --category workbook --kind shared', checks=[ + self.check('category', 'workbook'), + self.check('displayName', '{workbook_name2}'), + self.check('kind', 'shared'), + self.check('name', '00000000-0000-0000-0000-000000000001') + ]) + self.cmd('monitor app-insights workbook identity assign -g {rg} -n 00000000-0000-0000-0000-000000000001 --user-assigned {id1}', checks=[ + self.check('type', 'UserAssigned'), + self.check('userAssignedIdentities', {identity1['id']: {}}) + ]) + self.cmd('monitor app-insights workbook identity assign -g {rg} -n 00000000-0000-0000-0000-000000000001 --user-assigned {id2}', checks=[ + self.check('type', 'UserAssigned'), + self.check('userAssignedIdentities', {identity1['id']: {}, identity2['id']: {}}) + ]) + self.cmd('monitor app-insights workbook identity remove -g {rg} -n 00000000-0000-0000-0000-000000000001 --user-assigned {id1}', checks=[ + self.check('type', 'UserAssigned'), + self.check('userAssignedIdentities', {identity2['id']: {}}) + ]) + self.cmd('monitor app-insights workbook identity remove -g {rg} -n 00000000-0000-0000-0000-000000000001 --user-assigned {id2}', checks=[ + self.check('type', None) + ]) diff --git a/src/application-insights/setup.py b/src/application-insights/setup.py index ecad86614da..53cdfdb6039 100644 --- a/src/application-insights/setup.py +++ b/src/application-insights/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "1.1.0" +VERSION = "1.2.0" CLASSIFIERS = [ 'Development Status :: 4 - Beta',