|
35 | 35 | from azure.core.exceptions import HttpResponseError |
36 | 36 | from knack.log import get_logger |
37 | 37 | from ._utils import ( |
38 | | - run_cli_cmd |
| 38 | + get_resource_group |
39 | 39 | ) |
40 | 40 |
|
41 | 41 | logger = get_logger(__name__) |
@@ -946,20 +946,20 @@ def delete_security_automation(client, resource_group_name, resource_name): |
946 | 946 | return client.delete(resource_group_name, resource_name) |
947 | 947 |
|
948 | 948 |
|
949 | | -def create_or_update_security_automation(client, resource_group_name, resource_name, scopes, sources, actions, location=None, etag=None, tags=None, description=None, isEnabled=None): |
| 949 | +def create_or_update_security_automation(cmd, client, resource_group_name, resource_name, scopes, sources, actions, location=None, etag=None, tags=None, description=None, isEnabled=None): |
950 | 950 |
|
951 | 951 | if location is None: |
952 | | - resourceGroup = run_cli_cmd('az group show --name {}'.format(resource_group_name)) |
953 | | - location = resourceGroup['location'] |
| 952 | + resourceGroup = get_resource_group(cmd, resource_group_name) |
| 953 | + location = resourceGroup.location |
954 | 954 | automation = create_security_automation_object(location, scopes, sources, actions, etag, tags, description, isEnabled) |
955 | 955 | return client.create_or_update(resource_group_name, resource_name, automation) |
956 | 956 |
|
957 | 957 |
|
958 | | -def validate_security_automation(client, resource_group_name, resource_name, scopes, sources, actions, location=None, etag=None, tags=None, description=None, isEnabled=None): |
| 958 | +def validate_security_automation(cmd, client, resource_group_name, resource_name, scopes, sources, actions, location=None, etag=None, tags=None, description=None, isEnabled=None): |
959 | 959 |
|
960 | 960 | if location is None: |
961 | | - resourceGroup = run_cli_cmd('az group show --name {}'.format(resource_group_name)) |
962 | | - location = resourceGroup['location'] |
| 961 | + resourceGroup = get_resource_group(cmd, resource_group_name) |
| 962 | + location = resourceGroup.location |
963 | 963 | automation = create_security_automation_object(location, scopes, sources, actions, etag, tags, description, isEnabled) |
964 | 964 | return client.validate(resource_group_name, resource_name, automation) |
965 | 965 |
|
|
0 commit comments