|
3 | 3 | # Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | # -------------------------------------------------------------------------------------------- |
5 | 5 |
|
6 | | -import json |
7 | | - |
8 | 6 | from azure.cli.core.azclierror import (ResourceNotFoundError, ArgumentUsageError, InvalidArgumentValueError, |
9 | 7 | MutuallyExclusiveArgumentError) |
10 | 8 | from azure.cli.core.commands import LongRunningOperation |
|
24 | 22 |
|
25 | 23 | def show_webapp_access_restrictions(cmd, resource_group_name, name, slot=None): |
26 | 24 | configs = get_site_configs(cmd, resource_group_name, name, slot) |
27 | | - access_restrictions = json.dumps(configs.ip_security_restrictions, default=lambda x: x.__dict__) |
28 | | - scm_access_restrictions = json.dumps(configs.scm_ip_security_restrictions, default=lambda x: x.__dict__) |
| 25 | + access_restrictions = [r.serialize() for r in (configs.ip_security_restrictions or [])] |
| 26 | + scm_access_restrictions = [r.serialize() for r in (configs.scm_ip_security_restrictions or [])] |
29 | 27 | access_rules = { |
30 | 28 | "scmIpSecurityRestrictionsUseMain": configs.scm_ip_security_restrictions_use_main, |
31 | 29 | "ipSecurityRestrictionsDefaultAction": configs.ip_security_restrictions_default_action, |
32 | 30 | "scmIpSecurityRestrictionsDefaultAction": configs.scm_ip_security_restrictions_default_action, |
33 | | - "ipSecurityRestrictions": json.loads(access_restrictions), |
34 | | - "scmIpSecurityRestrictions": json.loads(scm_access_restrictions) |
| 31 | + "ipSecurityRestrictions": access_restrictions, |
| 32 | + "scmIpSecurityRestrictions": scm_access_restrictions |
35 | 33 | } |
36 | 34 | return access_rules |
37 | 35 |
|
|
0 commit comments