# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


from .. import try_manual


# EXAMPLE: /Machines/get/Get Machine
@try_manual
def step_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine show '
             '--name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /Machines/get/List Machines by resource group
@try_manual
def step_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine list '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /connectedmachine/post/Upgrade Machine Extensions
@try_manual
def step_upgrade_extension(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine upgrade-extension '
             '--extension-targets "{{\\"Microsoft.Azure.Monitoring\\":{{\\"targetVersion\\":\\"2.0\\"}},\\"Microsoft.Co'
             'mpute.CustomScriptExtension\\":{{\\"targetVersion\\":\\"1.10\\"}}}}" '
             '--machine-name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /MachineExtensions/put/Create or Update a Machine Extension
@try_manual
def step_extension_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine extension create '
             '--name "CustomScriptExtension" '
             '--location "eastus2euap" '
             '--type "CustomScriptExtension" '
             '--publisher "Microsoft.Compute" '
             '--settings "{{\\"commandToExecute\\":\\"powershell.exe -c \\\\\\"Get-Process | Where-Object {{{{ $_.CPU '
             '-gt 10000 }}}}\\\\\\"\\"}}" '
             '--type-handler-version "1.10" '
             '--machine-name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /MachineExtensions/get/GET all Machine Extensions
@try_manual
def step_extension_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine extension list '
             '--machine-name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /MachineExtensions/get/GET Machine Extension
@try_manual
def step_extension_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine extension show '
             '--name "CustomScriptExtension" '
             '--machine-name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /MachineExtensions/patch/Create or Update a Machine Extension
@try_manual
def step_extension_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine extension update '
             '--name "CustomScriptExtension" '
             '--type "CustomScriptExtension" '
             '--publisher "Microsoft.Compute" '
             '--settings "{{\\"commandToExecute\\":\\"powershell.exe -c \\\\\\"Get-Process | Where-Object {{{{ $_.CPU '
             '-lt 100 }}}}\\\\\\"\\"}}" '
             '--type-handler-version "1.10" '
             '--machine-name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /MachineExtensions/delete/Delete a Machine Extension
@try_manual
def step_extension_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine extension delete -y '
             '--name "MMA" '
             '--machine-name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /Machines/delete/Delete a Machine
@try_manual
def step_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine delete -y '
             '--name "{myMachine}" '
             '--resource-group "{rg}"',
             checks=checks)


# EXAMPLE: /PrivateEndpointConnections/put/Approve or reject a private endpoint connection with a given name.
@try_manual
def step_private_endpoint_connection_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-endpoint-connection update '
             '--connection-state description="Approved by johndoe@contoso.com" status="Approved" '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}" '
             '--scope-name "myPrivateLinkScope"',
             checks=[])
    test.cmd('az connectedmachine private-endpoint-connection wait --created '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}" '
             '--scope-name "myPrivateLinkScope"',
             checks=checks)


# EXAMPLE: /PrivateEndpointConnections/get/Gets list of private endpoint connections on a private link scope.
@try_manual
def step_private_endpoint_connection_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-endpoint-connection list '
             '--resource-group "{rg}" '
             '--scope-name "myPrivateLinkScope"',
             checks=checks)


# EXAMPLE: /PrivateEndpointConnections/get/Gets private endpoint connection.
@try_manual
def step_private_endpoint_connection_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-endpoint-connection show '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}" '
             '--scope-name "myPrivateLinkScope"',
             checks=checks)


# EXAMPLE: /PrivateEndpointConnections/delete/Deletes a private endpoint connection with a given name.
@try_manual
def step_private_endpoint_connection_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-endpoint-connection delete -y '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}" '
             '--scope-name "myPrivateLinkScope"',
             checks=checks)


# EXAMPLE: /PrivateLinkResources/get/Gets private endpoint connection.
@try_manual
def step_private_link_resource_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-resource list '
             '--resource-group "{rg}" '
             '--scope-name "myPrivateLinkScope"',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/put/PrivateLinkScopeCreate
@try_manual
def step_private_link_scope_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope create '
             '--location "westus" '
             '--resource-group "{rg_2}" '
             '--scope-name "my-privatelinkscope"',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/put/PrivateLinkScopeUpdate
@try_manual
def step_private_link_scope_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope update '
             '--location "westus" '
             '--tags Tag1="Value1" '
             '--resource-group "{rg_2}" '
             '--scope-name "my-privatelinkscope"',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/get/PrivateLinkScopeGet
@try_manual
def step_private_link_scope_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope show '
             '--resource-group "{rg_2}" '
             '--scope-name "my-privatelinkscope"',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/get/PrivateLinkScopeListByResourceGroup
@try_manual
def step_private_link_scope_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope list '
             '--resource-group "{rg_2}"',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/get/PrivateLinkScopesList.json
@try_manual
def step_private_link_scope_list2(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope list '
             '-g ""',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/patch/PrivateLinkScopeUpdateTagsOnly
@try_manual
def step_private_link_scope_update_tag(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope update-tag '
             '--tags Tag1="Value1" Tag2="Value2" '
             '--resource-group "{rg_2}" '
             '--scope-name "my-privatelinkscope"',
             checks=checks)


# EXAMPLE: /PrivateLinkScopes/delete/PrivateLinkScopesDelete
@try_manual
def step_private_link_scope_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az connectedmachine private-link-scope delete -y '
             '--resource-group "{rg_2}" '
             '--scope-name "my-privatelinkscope"',
             checks=checks)
