# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.imagebuilder.aio import ImageBuilderClient

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 TestImageBuilderVirtualMachineImageTemplatesOperationsAsync(AzureMgmtRecordedTestCase):
    def setup_method(self, method):
        self.client = self.create_mgmt_client(ImageBuilderClient, is_async=True)

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_virtual_machine_image_templates_get(self, resource_group):
        response = await self.client.virtual_machine_image_templates.get(
            resource_group_name=resource_group.name,
            image_template_name="str",
        )

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

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_virtual_machine_image_templates_begin_create_or_update(self, resource_group):
        response = await (
            await self.client.virtual_machine_image_templates.begin_create_or_update(
                resource_group_name=resource_group.name,
                image_template_name="str",
                parameters={
                    "identity": {
                        "type": "str",
                        "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
                    },
                    "location": "str",
                    "id": "str",
                    "name": "str",
                    "properties": {
                        "distribute": ["image_template_distributor"],
                        "source": "image_template_source",
                        "additionalDataDisks": [{"sizeGB": 0}],
                        "autoRun": {"state": "str"},
                        "buildTimeoutInMinutes": 0,
                        "customize": ["image_template_customizer"],
                        "errorHandling": {"onCustomizerError": "str", "onValidationError": "str"},
                        "exactStagingResourceGroup": "str",
                        "lastRunStatus": {
                            "endTime": "2020-02-20 00:00:00",
                            "message": "str",
                            "runState": "str",
                            "runSubState": "str",
                            "startTime": "2020-02-20 00:00:00",
                        },
                        "managedResourceTags": {"str": "str"},
                        "optimize": {
                            "vmBoot": {"state": "str"},
                            "workload": {"scriptUri": "str", "sha256Checksum": "str", "state": "str"},
                        },
                        "provisioningError": {"message": "str", "provisioningErrorCode": "str"},
                        "provisioningState": "str",
                        "stagingResourceGroup": "str",
                        "validate": {
                            "continueDistributeOnFailure": bool,
                            "inVMValidations": ["image_template_in_vm_validator"],
                            "sourceValidationOnly": bool,
                        },
                        "vmProfile": {
                            "osDiskSizeGB": 0,
                            "userAssignedIdentities": ["str"],
                            "vmSize": "str",
                            "vnetConfig": {"containerInstanceSubnetId": "str", "proxyVmSize": "str", "subnetId": "str"},
                        },
                    },
                    "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",
                },
            )
        ).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_virtual_machine_image_templates_begin_update(self, resource_group):
        response = await (
            await self.client.virtual_machine_image_templates.begin_update(
                resource_group_name=resource_group.name,
                image_template_name="str",
                parameters={
                    "identity": {
                        "type": "str",
                        "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
                    },
                    "properties": {
                        "distribute": ["image_template_distributor"],
                        "vmProfile": {
                            "osDiskSizeGB": 0,
                            "userAssignedIdentities": ["str"],
                            "vmSize": "str",
                            "vnetConfig": {"containerInstanceSubnetId": "str", "proxyVmSize": "str", "subnetId": "str"},
                        },
                    },
                    "tags": {"str": "str"},
                },
            )
        ).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_virtual_machine_image_templates_begin_delete(self, resource_group):
        response = await (
            await self.client.virtual_machine_image_templates.begin_delete(
                resource_group_name=resource_group.name,
                image_template_name="str",
            )
        ).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_virtual_machine_image_templates_list_by_resource_group(self, resource_group):
        response = self.client.virtual_machine_image_templates.list_by_resource_group(
            resource_group_name=resource_group.name,
        )
        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_virtual_machine_image_templates_list(self, resource_group):
        response = self.client.virtual_machine_image_templates.list()
        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_virtual_machine_image_templates_begin_run(self, resource_group):
        response = await (
            await self.client.virtual_machine_image_templates.begin_run(
                resource_group_name=resource_group.name,
                image_template_name="str",
            )
        ).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_virtual_machine_image_templates_begin_cancel(self, resource_group):
        response = await (
            await self.client.virtual_machine_image_templates.begin_cancel(
                resource_group_name=resource_group.name,
                image_template_name="str",
            )
        ).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_virtual_machine_image_templates_get_run_output(self, resource_group):
        response = await self.client.virtual_machine_image_templates.get_run_output(
            resource_group_name=resource_group.name,
            image_template_name="str",
            run_output_name="str",
        )

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

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_virtual_machine_image_templates_list_run_outputs(self, resource_group):
        response = self.client.virtual_machine_image_templates.list_run_outputs(
            resource_group_name=resource_group.name,
            image_template_name="str",
        )
        result = [r async for r in response]
        # please add some check logic here by yourself
        # ...
