From 3e41259a797d130ea77898bd7b9fceaa77adcc8c Mon Sep 17 00:00:00 2001 From: Renea Moso <53649816+ReneaMoso@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:20:33 +0200 Subject: [PATCH] [Sql] `az sql mi start/stop/start-stop-schedule`: Add SQL MI manual and scheduled start stop (#26979) * Kerberos win auth initial commit * fixing conflicts * fixing conflicts 2 * generating cmdlets for manual start stop * adding examples for manual start stop * adding scheduled start stop commands except create * adding create command for scheduledstartstop * writing tests * fixing examples, adding tests * test fix * addressing comments --------- Co-authored-by: Renea Moso Co-authored-by: Renea Moso --- .../sql/aaz/latest/sql/mi/__init__.py | 2 + .../sql/aaz/latest/sql/mi/_start.py | 386 +++++ .../sql/aaz/latest/sql/mi/_stop.py | 386 +++++ .../sql/mi/startstopschedule/__cmd_group.py | 23 + .../sql/mi/startstopschedule/__init__.py | 16 + .../sql/mi/startstopschedule/_create.py | 319 ++++ .../sql/mi/startstopschedule/_delete.py | 141 ++ .../latest/sql/mi/startstopschedule/_list.py | 253 +++ .../latest/sql/mi/startstopschedule/_show.py | 241 +++ .../sql/mi/startstopschedule/_update.py | 462 +++++ .../test_sql_mi_scheduledstartstop_mgmt.yaml | 439 +++++ .../test_sql_mi_startstop_mgmt.yaml | 1528 +++++++++++++++++ .../sql/tests/latest/test_sql_commands.py | 96 ++ 13 files changed, 4292 insertions(+) create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_start.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_stop.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__cmd_group.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__init__.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_create.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_delete.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_list.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_show.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_update.py create mode 100644 src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_scheduledstartstop_mgmt.yaml create mode 100644 src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_startstop_mgmt.yaml diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/__init__.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/__init__.py index 5a9d61963d6..cf3f2a3424c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/__init__.py @@ -9,3 +9,5 @@ # flake8: noqa from .__cmd_group import * +from ._start import * +from ._stop import * diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_start.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_start.py new file mode 100644 index 00000000000..262852c6dba --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_start.py @@ -0,0 +1,386 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi start", +) +class Start(AAZCommand): + """Start the managed instance. + + :example: Start a managed instance. + az sql mi start --ids resourceId + az sql mi start --mi miName -g resourceGroup --subscription subscription + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/start", "2022-11-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ManagedInstancesStart(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 ManagedInstancesStart(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _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.sku = AAZObjectType() + _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() + 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.administrator_login = AAZStrType( + serialized_name="administratorLogin", + ) + properties.administrators = AAZObjectType() + properties.collation = AAZStrType() + properties.current_backup_storage_redundancy = AAZStrType( + serialized_name="currentBackupStorageRedundancy", + flags={"read_only": True}, + ) + properties.dns_zone = AAZStrType( + serialized_name="dnsZone", + flags={"read_only": True}, + ) + properties.fully_qualified_domain_name = AAZStrType( + serialized_name="fullyQualifiedDomainName", + flags={"read_only": True}, + ) + properties.instance_pool_id = AAZStrType( + serialized_name="instancePoolId", + ) + properties.key_id = AAZStrType( + serialized_name="keyId", + ) + properties.license_type = AAZStrType( + serialized_name="licenseType", + ) + properties.maintenance_configuration_id = AAZStrType( + serialized_name="maintenanceConfigurationId", + ) + properties.minimal_tls_version = AAZStrType( + serialized_name="minimalTlsVersion", + ) + properties.primary_user_assigned_identity_id = AAZStrType( + serialized_name="primaryUserAssignedIdentityId", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.proxy_override = AAZStrType( + serialized_name="proxyOverride", + ) + properties.public_data_endpoint_enabled = AAZBoolType( + serialized_name="publicDataEndpointEnabled", + ) + properties.requested_backup_storage_redundancy = AAZStrType( + serialized_name="requestedBackupStorageRedundancy", + ) + properties.service_principal = AAZObjectType( + serialized_name="servicePrincipal", + ) + properties.state = AAZStrType( + flags={"read_only": True}, + ) + properties.storage_size_in_gb = AAZIntType( + serialized_name="storageSizeInGB", + ) + properties.subnet_id = AAZStrType( + serialized_name="subnetId", + ) + properties.timezone_id = AAZStrType( + serialized_name="timezoneId", + ) + properties.v_cores = AAZIntType( + serialized_name="vCores", + ) + properties.virtual_cluster_id = AAZStrType( + serialized_name="virtualClusterId", + flags={"read_only": True}, + ) + properties.zone_redundant = AAZBoolType( + serialized_name="zoneRedundant", + ) + + administrators = cls._schema_on_200.properties.administrators + administrators.administrator_type = AAZStrType( + serialized_name="administratorType", + ) + administrators.azure_ad_only_authentication = AAZBoolType( + serialized_name="azureADOnlyAuthentication", + ) + administrators.login = AAZStrType() + administrators.principal_type = AAZStrType( + serialized_name="principalType", + ) + administrators.sid = AAZStrType() + administrators.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + + properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + service_principal = cls._schema_on_200.properties.service_principal + service_principal.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + service_principal.type = AAZStrType() + + sku = cls._schema_on_200.sku + sku.capacity = AAZIntType() + sku.family = AAZStrType() + sku.name = AAZStrType( + flags={"required": True}, + ) + sku.size = AAZStrType() + sku.tier = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _StartHelper: + """Helper class for Start""" + + +__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_stop.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_stop.py new file mode 100644 index 00000000000..e8182ec3220 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/_stop.py @@ -0,0 +1,386 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi stop", +) +class Stop(AAZCommand): + """Stop the managed instance. + + :example: Stop a managed instance. + az sql mi stop --ids resourceId + az sql mi stop --mi miName -g resourceGroup --subscription subscription + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/stop", "2022-11-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ManagedInstancesStop(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 ManagedInstancesStop(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _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.sku = AAZObjectType() + _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() + 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.administrator_login = AAZStrType( + serialized_name="administratorLogin", + ) + properties.administrators = AAZObjectType() + properties.collation = AAZStrType() + properties.current_backup_storage_redundancy = AAZStrType( + serialized_name="currentBackupStorageRedundancy", + flags={"read_only": True}, + ) + properties.dns_zone = AAZStrType( + serialized_name="dnsZone", + flags={"read_only": True}, + ) + properties.fully_qualified_domain_name = AAZStrType( + serialized_name="fullyQualifiedDomainName", + flags={"read_only": True}, + ) + properties.instance_pool_id = AAZStrType( + serialized_name="instancePoolId", + ) + properties.key_id = AAZStrType( + serialized_name="keyId", + ) + properties.license_type = AAZStrType( + serialized_name="licenseType", + ) + properties.maintenance_configuration_id = AAZStrType( + serialized_name="maintenanceConfigurationId", + ) + properties.minimal_tls_version = AAZStrType( + serialized_name="minimalTlsVersion", + ) + properties.primary_user_assigned_identity_id = AAZStrType( + serialized_name="primaryUserAssignedIdentityId", + ) + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.proxy_override = AAZStrType( + serialized_name="proxyOverride", + ) + properties.public_data_endpoint_enabled = AAZBoolType( + serialized_name="publicDataEndpointEnabled", + ) + properties.requested_backup_storage_redundancy = AAZStrType( + serialized_name="requestedBackupStorageRedundancy", + ) + properties.service_principal = AAZObjectType( + serialized_name="servicePrincipal", + ) + properties.state = AAZStrType( + flags={"read_only": True}, + ) + properties.storage_size_in_gb = AAZIntType( + serialized_name="storageSizeInGB", + ) + properties.subnet_id = AAZStrType( + serialized_name="subnetId", + ) + properties.timezone_id = AAZStrType( + serialized_name="timezoneId", + ) + properties.v_cores = AAZIntType( + serialized_name="vCores", + ) + properties.virtual_cluster_id = AAZStrType( + serialized_name="virtualClusterId", + flags={"read_only": True}, + ) + properties.zone_redundant = AAZBoolType( + serialized_name="zoneRedundant", + ) + + administrators = cls._schema_on_200.properties.administrators + administrators.administrator_type = AAZStrType( + serialized_name="administratorType", + ) + administrators.azure_ad_only_authentication = AAZBoolType( + serialized_name="azureADOnlyAuthentication", + ) + administrators.login = AAZStrType() + administrators.principal_type = AAZStrType( + serialized_name="principalType", + ) + administrators.sid = AAZStrType() + administrators.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + + properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + service_principal = cls._schema_on_200.properties.service_principal + service_principal.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + service_principal.type = AAZStrType() + + sku = cls._schema_on_200.sku + sku.capacity = AAZIntType() + sku.family = AAZStrType() + sku.name = AAZStrType( + flags={"required": True}, + ) + sku.size = AAZStrType() + sku.tier = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _StopHelper: + """Helper class for Stop""" + + +__all__ = ["Stop"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__cmd_group.py new file mode 100644 index 00000000000..228bdfcb9cf --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__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( + "sql mi start-stop-schedule", +) +class __CMDGroup(AAZCommandGroup): + """Manage the managed instance's start stop schedule. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__init__.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# 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 ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_create.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_create.py new file mode 100644 index 00000000000..29b3a82178a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_create.py @@ -0,0 +1,319 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi start-stop-schedule create", +) +class Create(AAZCommand): + """Create the managed instance's Start/Stop schedule. + + :example: Create schedule for managed instance. + az sql mi start-stop-schedule create --mi miName -g resourceGroup --subscription subscriptionId --schedule-list "[{'startDay':'Monday','startTime':'10:00 AM','stopDay':'Monday','stopTime':'12:00 AM'}]" + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/startstopschedules/{}", "2022-11-01-preview"], + ] + } + + 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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="The description of the schedule.", + default="", + ) + _args_schema.schedule_list = AAZListArg( + options=["--schedule-list"], + arg_group="Properties", + help="Schedule list.", + ) + _args_schema.timezone_id = AAZStrArg( + options=["--timezone-id"], + arg_group="Properties", + help="The time zone of the schedule.", + default="UTC", + ) + + schedule_list = cls._args_schema.schedule_list + schedule_list.Element = AAZObjectArg() + + _element = cls._args_schema.schedule_list.Element + _element.start_day = AAZStrArg( + options=["start-day"], + help="Start day.", + required=True, + enum={"Friday": "Friday", "Monday": "Monday", "Saturday": "Saturday", "Sunday": "Sunday", "Thursday": "Thursday", "Tuesday": "Tuesday", "Wednesday": "Wednesday"}, + ) + _element.start_time = AAZStrArg( + options=["start-time"], + help="Start time.", + required=True, + ) + _element.stop_day = AAZStrArg( + options=["stop-day"], + help="Stop day.", + required=True, + enum={"Friday": "Friday", "Monday": "Monday", "Saturday": "Saturday", "Sunday": "Sunday", "Thursday": "Thursday", "Tuesday": "Tuesday", "Wednesday": "Wednesday"}, + ) + _element.stop_time = AAZStrArg( + options=["stop-time"], + help="Stop time.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StartStopManagedInstanceSchedulesCreateOrUpdate(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 StartStopManagedInstanceSchedulesCreateOrUpdate(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/default", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("scheduleList", AAZListType, ".schedule_list", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("timeZoneId", AAZStrType, ".timezone_id") + + schedule_list = _builder.get(".properties.scheduleList") + if schedule_list is not None: + schedule_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.scheduleList[]") + if _elements is not None: + _elements.set_prop("startDay", AAZStrType, ".start_day", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("startTime", AAZStrType, ".start_time", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("stopDay", AAZStrType, ".stop_day", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("stopTime", AAZStrType, ".stop_time", typ_kwargs={"flags": {"required": True}}) + + 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.id = AAZStrType( + flags={"read_only": 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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.description = AAZStrType() + properties.next_execution_time = AAZStrType( + serialized_name="nextExecutionTime", + flags={"read_only": True}, + ) + properties.next_run_action = AAZStrType( + serialized_name="nextRunAction", + flags={"read_only": True}, + ) + properties.schedule_list = AAZListType( + serialized_name="scheduleList", + flags={"required": True}, + ) + properties.time_zone_id = AAZStrType( + serialized_name="timeZoneId", + ) + + schedule_list = cls._schema_on_200_201.properties.schedule_list + schedule_list.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.schedule_list.Element + _element.start_day = AAZStrType( + serialized_name="startDay", + flags={"required": True}, + ) + _element.start_time = AAZStrType( + serialized_name="startTime", + flags={"required": True}, + ) + _element.stop_day = AAZStrType( + serialized_name="stopDay", + flags={"required": True}, + ) + _element.stop_time = AAZStrType( + serialized_name="stopTime", + flags={"required": True}, + ) + + 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", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_delete.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_delete.py new file mode 100644 index 00000000000..f19e6e6360d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_delete.py @@ -0,0 +1,141 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi start-stop-schedule delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the managed instance's Start/Stop schedule. + + :example: Delete a managed instance start stop schedule. + az sql mi start-stop-schedule delete --ids resourceId + az sql mi start-stop-schedule delete --mi miName -g resourceGroup --subscription subscriptionId + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/startstopschedules/{}", "2022-11-01-preview"], + ] + } + + 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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StartStopManagedInstanceSchedulesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class StartStopManagedInstanceSchedulesDelete(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/default", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_list.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_list.py new file mode 100644 index 00000000000..aa0c075d351 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_list.py @@ -0,0 +1,253 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi start-stop-schedule list", +) +class List(AAZCommand): + """List the managed instance's Start/Stop schedules. + + :example: Lists the managed instance's start stop schedule. + az sql mi start-stop-schedule list --ids resourceId + az sql mi start-stop-schedule list --mi miName -g resourceGroup --subscription subscriptionId + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/startstopschedules", "2022-11-01-preview"], + ] + } + + 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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StartStopManagedInstanceSchedulesListByInstance(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 StartStopManagedInstanceSchedulesListByInstance(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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", + flags={"read_only": True}, + ) + _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.id = AAZStrType( + flags={"read_only": 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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.next_execution_time = AAZStrType( + serialized_name="nextExecutionTime", + flags={"read_only": True}, + ) + properties.next_run_action = AAZStrType( + serialized_name="nextRunAction", + flags={"read_only": True}, + ) + properties.schedule_list = AAZListType( + serialized_name="scheduleList", + flags={"required": True}, + ) + properties.time_zone_id = AAZStrType( + serialized_name="timeZoneId", + ) + + schedule_list = cls._schema_on_200.value.Element.properties.schedule_list + schedule_list.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.schedule_list.Element + _element.start_day = AAZStrType( + serialized_name="startDay", + flags={"required": True}, + ) + _element.start_time = AAZStrType( + serialized_name="startTime", + flags={"required": True}, + ) + _element.stop_day = AAZStrType( + serialized_name="stopDay", + flags={"required": True}, + ) + _element.stop_time = AAZStrType( + serialized_name="stopTime", + flags={"required": True}, + ) + + 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", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_show.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_show.py new file mode 100644 index 00000000000..593b3b1e7be --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_show.py @@ -0,0 +1,241 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi start-stop-schedule show", +) +class Show(AAZCommand): + """Get the managed instance's Start/Stop schedule. + + :example: Get the managed instance's start stop schedule. + az sql mi start-stop-schedule show --ids resourceId + az sql mi start-stop-schedule show --mi miName -g resourceGroup --subscription subscriptionId + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/startstopschedules/{}", "2022-11-01-preview"], + ] + } + + 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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StartStopManagedInstanceSchedulesGet(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 StartStopManagedInstanceSchedulesGet(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/default", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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.id = AAZStrType( + flags={"read_only": 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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.next_execution_time = AAZStrType( + serialized_name="nextExecutionTime", + flags={"read_only": True}, + ) + properties.next_run_action = AAZStrType( + serialized_name="nextRunAction", + flags={"read_only": True}, + ) + properties.schedule_list = AAZListType( + serialized_name="scheduleList", + flags={"required": True}, + ) + properties.time_zone_id = AAZStrType( + serialized_name="timeZoneId", + ) + + schedule_list = cls._schema_on_200.properties.schedule_list + schedule_list.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.schedule_list.Element + _element.start_day = AAZStrType( + serialized_name="startDay", + flags={"required": True}, + ) + _element.start_time = AAZStrType( + serialized_name="startTime", + flags={"required": True}, + ) + _element.stop_day = AAZStrType( + serialized_name="stopDay", + flags={"required": True}, + ) + _element.stop_time = AAZStrType( + serialized_name="stopTime", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_update.py b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_update.py new file mode 100644 index 00000000000..d34becb5f02 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/startstopschedule/_update.py @@ -0,0 +1,462 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "sql mi start-stop-schedule update", +) +class Update(AAZCommand): + """Update the managed instance's Start/Stop schedule. + + :example: Update (override) the managed instance's start stop schedule. + az sql mi start-stop-schedule update --ids resourceId --schedule-list "[{'startDay':'Monday','startTime':'10:00 AM','stopDay':'Monday','stopTime':'12:00 AM'}]" + az sql mi start-stop-schedule update --mi miName -g resourceGroup --subscription subscriptionId --schedule-list "[{'startDay':'Monday','startTime':'10:00 AM','stopDay':'Monday','stopTime':'12:00 AM'}]" + :example: Add schedule items to the managed instance's start stop schedule. + az sql mi start-stop-schedule update --ids resourceId --add schedule_list "{'startDay':'Monday','startTime':'10:00 AM','stopDay':'Monday','stopTime':'12:00 AM'}" + :example: Remove schedule items from the managed instance's start stop schedule. + az sql mi start-stop-schedule update --ids resourceId --remove schedule_list index(0 based) + """ + + _aaz_info = { + "version": "2022-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/startstopschedules/{}", "2022-11-01-preview"], + ] + } + + 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.managed_instance = AAZStrArg( + options=["--mi", "--managed-instance"], + help="The name of the managed instance.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the resource group.", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="The description of the schedule.", + nullable=True, + ) + _args_schema.schedule_list = AAZListArg( + options=["--schedule-list"], + arg_group="Properties", + help="Schedule list.", + ) + _args_schema.timezone_id = AAZStrArg( + options=["--timezone-id"], + arg_group="Properties", + help="The time zone of the schedule.", + nullable=True, + ) + + schedule_list = cls._args_schema.schedule_list + schedule_list.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.schedule_list.Element + _element.start_day = AAZStrArg( + options=["start-day"], + help="Start day.", + enum={"Friday": "Friday", "Monday": "Monday", "Saturday": "Saturday", "Sunday": "Sunday", "Thursday": "Thursday", "Tuesday": "Tuesday", "Wednesday": "Wednesday"}, + ) + _element.start_time = AAZStrArg( + options=["start-time"], + help="Start time.", + ) + _element.stop_day = AAZStrArg( + options=["stop-day"], + help="Stop day.", + enum={"Friday": "Friday", "Monday": "Monday", "Saturday": "Saturday", "Sunday": "Sunday", "Thursday": "Thursday", "Tuesday": "Tuesday", "Wednesday": "Wednesday"}, + ) + _element.stop_time = AAZStrArg( + options=["stop-time"], + help="Stop time.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StartStopManagedInstanceSchedulesGet(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.StartStopManagedInstanceSchedulesCreateOrUpdate(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 StartStopManagedInstanceSchedulesGet(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/default", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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_start_stop_managed_instance_schedule_read(cls._schema_on_200) + + return cls._schema_on_200 + + class StartStopManagedInstanceSchedulesCreateOrUpdate(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/default", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-11-01-preview", + 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_start_stop_managed_instance_schedule_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("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("scheduleList", AAZListType, ".schedule_list", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("timeZoneId", AAZStrType, ".timezone_id") + + schedule_list = _builder.get(".properties.scheduleList") + if schedule_list is not None: + schedule_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.scheduleList[]") + if _elements is not None: + _elements.set_prop("startDay", AAZStrType, ".start_day", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("startTime", AAZStrType, ".start_time", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("stopDay", AAZStrType, ".stop_day", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("stopTime", AAZStrType, ".stop_time", typ_kwargs={"flags": {"required": True}}) + + 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_start_stop_managed_instance_schedule_read = None + + @classmethod + def _build_schema_start_stop_managed_instance_schedule_read(cls, _schema): + if cls._schema_start_stop_managed_instance_schedule_read is not None: + _schema.id = cls._schema_start_stop_managed_instance_schedule_read.id + _schema.name = cls._schema_start_stop_managed_instance_schedule_read.name + _schema.properties = cls._schema_start_stop_managed_instance_schedule_read.properties + _schema.system_data = cls._schema_start_stop_managed_instance_schedule_read.system_data + _schema.type = cls._schema_start_stop_managed_instance_schedule_read.type + return + + cls._schema_start_stop_managed_instance_schedule_read = _schema_start_stop_managed_instance_schedule_read = AAZObjectType() + + start_stop_managed_instance_schedule_read = _schema_start_stop_managed_instance_schedule_read + start_stop_managed_instance_schedule_read.id = AAZStrType( + flags={"read_only": True}, + ) + start_stop_managed_instance_schedule_read.name = AAZStrType( + flags={"read_only": True}, + ) + start_stop_managed_instance_schedule_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + start_stop_managed_instance_schedule_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + start_stop_managed_instance_schedule_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_start_stop_managed_instance_schedule_read.properties + properties.description = AAZStrType() + properties.next_execution_time = AAZStrType( + serialized_name="nextExecutionTime", + flags={"read_only": True}, + ) + properties.next_run_action = AAZStrType( + serialized_name="nextRunAction", + flags={"read_only": True}, + ) + properties.schedule_list = AAZListType( + serialized_name="scheduleList", + flags={"required": True}, + ) + properties.time_zone_id = AAZStrType( + serialized_name="timeZoneId", + ) + + schedule_list = _schema_start_stop_managed_instance_schedule_read.properties.schedule_list + schedule_list.Element = AAZObjectType() + + _element = _schema_start_stop_managed_instance_schedule_read.properties.schedule_list.Element + _element.start_day = AAZStrType( + serialized_name="startDay", + flags={"required": True}, + ) + _element.start_time = AAZStrType( + serialized_name="startTime", + flags={"required": True}, + ) + _element.stop_day = AAZStrType( + serialized_name="stopDay", + flags={"required": True}, + ) + _element.stop_time = AAZStrType( + serialized_name="stopTime", + flags={"required": True}, + ) + + system_data = _schema_start_stop_managed_instance_schedule_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", + ) + + _schema.id = cls._schema_start_stop_managed_instance_schedule_read.id + _schema.name = cls._schema_start_stop_managed_instance_schedule_read.name + _schema.properties = cls._schema_start_stop_managed_instance_schedule_read.properties + _schema.system_data = cls._schema_start_stop_managed_instance_schedule_read.system_data + _schema.type = cls._schema_start_stop_managed_instance_schedule_read.type + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_scheduledstartstop_mgmt.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_scheduledstartstop_mgmt.yaml new file mode 100644 index 00000000000..eb664992784 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_scheduledstartstop_mgmt.yaml @@ -0,0 +1,439 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - AZURECLI/2.50.0 azsdk-python-mgmt-sql/4.0.0b10 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm?api-version=2022-08-01-preview + response: + body: + string: '{"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"provisioningState":"Succeeded","fullyQualifiedDomainName":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm.e6076e7d5e5b.database.windows.net","administratorLogin":"admin123","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Network/virtualNetworks/vnet-managed-instance-v2/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"Serbian_Cyrillic_100_CS_AS","dnsZone":"e6076e7d5e5b","publicDataEndpointEnabled":true,"proxyOverride":"Proxy","timezoneId":"UTC","maintenanceConfigurationId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default","privateEndpointConnections":[],"minimalTlsVersion":"None","currentBackupStorageRedundancy":"Geo","requestedBackupStorageRedundancy":"Geo","zoneRedundant":false},"location":"westcentralus","tags":{"do-not-delete":"true","cli-test":"true"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","name":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","type":"Microsoft.Sql/managedInstances"}' + headers: + cache-control: + - no-cache + content-length: + - '1418' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "test description", "scheduleList": [{"startDay": + "Friday", "startTime": "10:00 AM", "stopDay": "Friday", "stopTime": "11:10 AM"}], + "timeZoneId": "UTC"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule create + Connection: + - keep-alive + Content-Length: + - '184' + Content-Type: + - application/json + ParameterSetName: + - -g --mi --schedule-list --description + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}' + headers: + cache-control: + - no-cache + content-length: + - '538' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:43 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.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' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule update + Connection: + - keep-alive + ParameterSetName: + - -g --mi --add + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}' + headers: + cache-control: + - no-cache + content-length: + - '538' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "test description", "scheduleList": [{"startDay": + "Friday", "startTime": "10:00", "stopDay": "Friday", "stopTime": "11:10"}, {"startDay": + "Monday", "startTime": "10:00 AM", "stopDay": "Monday", "stopTime": "11:10 AM"}], + "timeZoneId": "UTC"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule update + Connection: + - keep-alive + Content-Length: + - '272' + Content-Type: + - application/json + ParameterSetName: + - -g --mi --add + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"},{"startDay":"Monday","startTime":"10:00","stopDay":"Monday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}' + headers: + cache-control: + - no-cache + content-length: + - '618' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.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' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule update + Connection: + - keep-alive + ParameterSetName: + - -g --mi --schedule-list + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"},{"startDay":"Monday","startTime":"10:00","stopDay":"Monday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}' + headers: + cache-control: + - no-cache + content-length: + - '618' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:46 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "test description", "scheduleList": [{"startDay": + "Friday", "startTime": "10:00 AM", "stopDay": "Friday", "stopTime": "11:10 AM"}], + "timeZoneId": "UTC"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule update + Connection: + - keep-alive + Content-Length: + - '184' + Content-Type: + - application/json + ParameterSetName: + - -g --mi --schedule-list + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}' + headers: + cache-control: + - no-cache + content-length: + - '538' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.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' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule show + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}' + headers: + cache-control: + - no-cache + content-length: + - '538' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:49 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule list + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules?api-version=2022-11-01-preview + response: + body: + string: '{"value":[{"properties":{"description":"test description","timeZoneId":"UTC","scheduleList":[{"startDay":"Friday","startTime":"10:00","stopDay":"Friday","stopTime":"11:10"}],"nextRunAction":"Start","nextExecutionTime":"2023-07-28T10:00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default","name":"default","type":"Microsoft.Sql/managedInstances/startStopSchedules"}]}' + headers: + cache-control: + - no-cache + content-length: + - '550' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:39:50 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start-stop-schedule delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --mi --yes + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/startStopSchedules/default?api-version=2022-11-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 25 Jul 2023 07:39:50 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_startstop_mgmt.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_startstop_mgmt.yaml new file mode 100644 index 00000000000..a801d6746d4 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_startstop_mgmt.yaml @@ -0,0 +1,1528 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - AZURECLI/2.50.0 azsdk-python-mgmt-sql/4.0.0b10 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm?api-version=2022-08-01-preview + response: + body: + string: '{"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"provisioningState":"Succeeded","fullyQualifiedDomainName":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm.e6076e7d5e5b.database.windows.net","administratorLogin":"admin123","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Network/virtualNetworks/vnet-managed-instance-v2/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"Serbian_Cyrillic_100_CS_AS","dnsZone":"e6076e7d5e5b","publicDataEndpointEnabled":true,"proxyOverride":"Proxy","timezoneId":"UTC","maintenanceConfigurationId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default","privateEndpointConnections":[],"minimalTlsVersion":"None","currentBackupStorageRedundancy":"Geo","requestedBackupStorageRedundancy":"Geo","zoneRedundant":false},"location":"westcentralus","tags":{"do-not-delete":"true","cli-test":"true"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","name":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","type":"Microsoft.Sql/managedInstances"}' + headers: + cache-control: + - no-cache + content-length: + - '1418' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:30:53 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi stop + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/stop?api-version=2022-11-01-preview + response: + body: + string: '{"operation":"StopManagedServer","startTime":"2023-07-25T07:30:55.367Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/stopManagedInstanceAzureAsyncOperation/89b1ef2f-6855-4f96-b92c-c391c0aa7537?api-version=2022-11-01-preview + cache-control: + - no-cache + content-length: + - '72' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:30:54 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/stopManagedInstanceOperationResults/89b1ef2f-6855-4f96-b92c-c391c0aa7537?api-version=2022-11-01-preview + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi stop + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/stopManagedInstanceAzureAsyncOperation/89b1ef2f-6855-4f96-b92c-c391c0aa7537?api-version=2022-11-01-preview + response: + body: + string: '{"name":"89b1ef2f-6855-4f96-b92c-c391c0aa7537","status":"InProgress","startTime":"2023-07-25T07:30:55.367Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:30:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi stop + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/stopManagedInstanceAzureAsyncOperation/89b1ef2f-6855-4f96-b92c-c391c0aa7537?api-version=2022-11-01-preview + response: + body: + string: '{"name":"89b1ef2f-6855-4f96-b92c-c391c0aa7537","status":"Succeeded","startTime":"2023-07-25T07:30:55.367Z"}' + headers: + cache-control: + - no-cache + content-length: + - '107' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:10 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi stop + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/stopManagedInstanceOperationResults/89b1ef2f-6855-4f96-b92c-c391c0aa7537?api-version=2022-11-01-preview + response: + body: + string: '{"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"provisioningState":"Succeeded","fullyQualifiedDomainName":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm.e6076e7d5e5b.database.windows.net","administratorLogin":"admin123","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Network/virtualNetworks/vnet-managed-instance-v2/subnets/ManagedInstance","state":"Stopped","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"Serbian_Cyrillic_100_CS_AS","dnsZone":"e6076e7d5e5b","publicDataEndpointEnabled":true,"proxyOverride":"Proxy","timezoneId":"UTC","privateEndpointConnections":[],"currentBackupStorageRedundancy":"Geo","requestedBackupStorageRedundancy":"Geo","zoneRedundant":false},"location":"westcentralus","tags":{"do-not-delete":"true","cli-test":"true"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","name":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","type":"Microsoft.Sql/managedInstances"}' + headers: + cache-control: + - no-cache + content-length: + - '1234' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:10 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm/start?api-version=2022-11-01-preview + response: + body: + string: '{"operation":"StartManagedServer","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + cache-control: + - no-cache + content-length: + - '73' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:12 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceOperationResults/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:43 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:31:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:32:13 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:32:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:32:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:32:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:33:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:33:30 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:33:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:34:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:34:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:34:30 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:34:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:35:01 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:35:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:35:31 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:35:46 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:36:01 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:36:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:36:32 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:36:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:37:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"InProgress","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:37:18 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceAzureAsyncOperation/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"name":"66b39a71-745f-44f1-b6be-8f030cd0a05c","status":"Succeeded","startTime":"2023-07-25T07:31:13.007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '107' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:37:33 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - sql mi start + Connection: + - keep-alive + ParameterSetName: + - -g --mi + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/locations/westcentralus/startManagedInstanceOperationResults/66b39a71-745f-44f1-b6be-8f030cd0a05c?api-version=2022-11-01-preview + response: + body: + string: '{"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"provisioningState":"Succeeded","fullyQualifiedDomainName":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm.e6076e7d5e5b.database.windows.net","administratorLogin":"admin123","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Network/virtualNetworks/vnet-managed-instance-v2/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"Serbian_Cyrillic_100_CS_AS","dnsZone":"e6076e7d5e5b","publicDataEndpointEnabled":true,"proxyOverride":"Proxy","timezoneId":"UTC","privateEndpointConnections":[],"currentBackupStorageRedundancy":"Geo","requestedBackupStorageRedundancy":"Geo","zoneRedundant":false},"location":"westcentralus","tags":{"do-not-delete":"true","cli-test":"true"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CustomerExperienceTeam_RG/providers/Microsoft.Sql/managedInstances/clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","name":"clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm","type":"Microsoft.Sql/managedInstances"}' + headers: + cache-control: + - no-cache + content-length: + - '1232' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 25 Jul 2023 07:37:33 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 33facbeab77..462d1e31412 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -5260,6 +5260,102 @@ def test_sql_managed_instance_mgmt(self, mi, rg): # test list sql managed_instance in the subscription should be at least 1 self.cmd('sql mi list', checks=[JMESPathCheckGreaterThan('length(@)', 0)]) +class SqlManagedInstanceStartStopMgmtScenarioTest(ScenarioTest): + @AllowLargeResponse() + def test_sql_mi_startstop_mgmt(self): + rg = 'CustomerExperienceTeam_RG' + mi = 'clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm' + self.kwargs.update({ + 'rg': rg, + 'mi': mi, + }) + # check managed instance + self.cmd('sql mi show -g {rg} -n {mi}', + checks=[ + JMESPathCheck('name', mi), + JMESPathCheck('resourceGroup', rg)]) + + # test the manual stop command + self.cmd('sql mi stop -g {rg} --mi {mi}', + checks=[ + JMESPathCheck('name', mi), + JMESPathCheck('state', 'Stopped')]) + + # test the manual start command + self.cmd('sql mi start -g {rg} --mi {mi}', + checks=[ + JMESPathCheck('name', mi), + JMESPathCheck('state', 'Ready')]) + + @AllowLargeResponse() + def test_sql_mi_scheduledstartstop_mgmt(self): + rg = 'CustomerExperienceTeam_RG' + mi = 'clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm' + schedule = "[{'startDay':'Friday','startTime':'10:00 AM','stopDay':'Friday','stopTime':'11:10 AM'}]" + schedule_item = "{'startDay':'Monday','startTime':'10:00 AM','stopDay':'Monday','stopTime':'11:10 AM'}" + description = "test description" + self.kwargs.update({ + 'rg': rg, + 'mi': mi, + 'schedule': schedule, + 'desc': description, + 'schedule_item': schedule_item, + }) + # check if test MI got created + self.cmd('sql mi show -g {rg} -n {mi}', + checks=[ + JMESPathCheck('name', mi), + JMESPathCheck('resourceGroup', rg)]) + + # test the create schedule + self.cmd('az sql mi start-stop-schedule create -g {rg} --mi {mi} --schedule-list \"{schedule}\" --description \"{desc}\"', + checks=[ + JMESPathCheck('name', 'default'), + JMESPathCheck('description', description), + JMESPathCheck('scheduleList[0].startDay', 'Friday'), + JMESPathCheck('scheduleList[0].startTime', '10:00'), + JMESPathCheck('scheduleList[0].stopDay', 'Friday'), + JMESPathCheck('scheduleList[0].stopTime', '11:10'), + JMESPathCheck('timeZoneId', 'UTC')]) + + # test the update schedule - add item + self.cmd('az sql mi start-stop-schedule update -g {rg} --mi {mi} --add schedule_list \"{schedule_item}\"', + checks=[ + JMESPathCheck('description', description), + JMESPathCheck('scheduleList[1].startDay', 'Monday'), + JMESPathCheck('scheduleList[1].startTime', '10:00'), + JMESPathCheck('scheduleList[1].stopDay', 'Monday'), + JMESPathCheck('scheduleList[1].stopTime', '11:10')]) + + # test the update schedule - overwrite schedule + self.cmd('az sql mi start-stop-schedule update -g {rg} --mi {mi} --schedule-list \"{schedule}\"', + checks=[ + JMESPathCheck('scheduleList[0].startDay', 'Friday'), + JMESPathCheck('scheduleList[0].startTime', '10:00'), + JMESPathCheck('scheduleList[0].stopDay', 'Friday'), + JMESPathCheck('scheduleList[0].stopTime', '11:10')]) + + # test the show schedule + self.cmd('az sql mi start-stop-schedule show -g {rg} --mi {mi}', + checks=[ + JMESPathCheck('description', description), + JMESPathCheck('scheduleList[0].startDay', 'Friday'), + JMESPathCheck('scheduleList[0].startTime', '10:00'), + JMESPathCheck('scheduleList[0].stopDay', 'Friday'), + JMESPathCheck('scheduleList[0].stopTime', '11:10')]) + + # test the list schedule + self.cmd('az sql mi start-stop-schedule list -g {rg} --mi {mi}', + checks=[ + JMESPathCheck('[0].description', description), + JMESPathCheck('[0].scheduleList[0].startDay', 'Friday'), + JMESPathCheck('[0].scheduleList[0].startTime', '10:00'), + JMESPathCheck('[0].scheduleList[0].stopDay', 'Friday'), + JMESPathCheck('[0].scheduleList[0].stopTime', '11:10')]) + + # test the delete schedule + self.cmd('az sql mi start-stop-schedule delete -g {rg} --mi {mi} --yes') + class SqlManagedInstanceBackupStorageRedundancyTest(ScenarioTest): bsr_geo = "Geo"