# coding=utf-8
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.azurearcdata.aio import AzureArcDataManagementClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async

AZURE_LOCATION = "eastus"


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestAzureArcDataManagementSqlManagedInstancesOperationsAsync(AzureMgmtRecordedTestCase):
    def setup_method(self, method):
        self.client = self.create_mgmt_client(AzureArcDataManagementClient, is_async=True)

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_sql_managed_instances_list(self, resource_group):
        response = self.client.sql_managed_instances.list(
            api_version="2022-03-01-preview",
        )
        result = [r async for r in response]
        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_sql_managed_instances_list_by_resource_group(self, resource_group):
        response = self.client.sql_managed_instances.list_by_resource_group(
            resource_group_name=resource_group.name,
            api_version="2022-03-01-preview",
        )
        result = [r async for r in response]
        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_sql_managed_instances_get(self, resource_group):
        response = await self.client.sql_managed_instances.get(
            resource_group_name=resource_group.name,
            sql_managed_instance_name="str",
            api_version="2022-03-01-preview",
        )

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_sql_managed_instances_begin_create(self, resource_group):
        response = await (
            await self.client.sql_managed_instances.begin_create(
                resource_group_name=resource_group.name,
                sql_managed_instance_name="str",
                sql_managed_instance={
                    "location": "str",
                    "properties": {
                        "activeDirectoryInformation": {"keytabInformation": {"keytab": "str"}},
                        "admin": "str",
                        "basicLoginInformation": {"password": "str", "username": "str"},
                        "clusterId": "str",
                        "dataControllerId": "str",
                        "endTime": "str",
                        "extensionId": "str",
                        "k8sRaw": {
                            "spec": {
                                "replicas": 0,
                                "scheduling": {
                                    "default": {"resources": {"limits": {"str": "str"}, "requests": {"str": "str"}}}
                                },
                            }
                        },
                        "lastUploadedDate": "2020-02-20 00:00:00",
                        "licenseType": "BasePrice",
                        "provisioningState": "str",
                        "startTime": "str",
                    },
                    "extendedLocation": {"name": "str", "type": "str"},
                    "id": "str",
                    "name": "str",
                    "sku": {
                        "name": "vCore",
                        "capacity": 0,
                        "dev": True,
                        "family": "str",
                        "size": "str",
                        "tier": "GeneralPurpose",
                    },
                    "systemData": {
                        "createdAt": "2020-02-20 00:00:00",
                        "createdBy": "str",
                        "createdByType": "str",
                        "lastModifiedAt": "2020-02-20 00:00:00",
                        "lastModifiedBy": "str",
                        "lastModifiedByType": "str",
                    },
                    "tags": {"str": "str"},
                    "type": "str",
                },
                api_version="2022-03-01-preview",
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_sql_managed_instances_begin_delete(self, resource_group):
        response = await (
            await self.client.sql_managed_instances.begin_delete(
                resource_group_name=resource_group.name,
                sql_managed_instance_name="str",
                api_version="2022-03-01-preview",
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_sql_managed_instances_update(self, resource_group):
        response = await self.client.sql_managed_instances.update(
            resource_group_name=resource_group.name,
            sql_managed_instance_name="str",
            parameters={"tags": {"str": "str"}},
            api_version="2022-03-01-preview",
        )

        # please add some check logic here by yourself
        # ...
