Skip to content

Commit 45089a4

Browse files
authored
{RDBMS} az postgres flexible-server firewall-rule: Update validations and message for fire wall rule commands (#30780)
* Update firewall validations * Lint fix
1 parent a4ab5c8 commit 45089a4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def firewall_rule_create_func(cmd, client, resource_group_name, server_name, fir
8686
end_ip_address = start_ip_address
8787
elif start_ip_address is None and end_ip_address is not None:
8888
start_ip_address = end_ip_address
89+
elif start_ip_address is None and end_ip_address is None:
90+
raise CLIError("Incorrect Usage : Need to pass in value for either \'--start-ip-address\' or \'--end-ip-address\'.")
8991

9092
if firewall_rule_name is None:
9193
now = datetime.now()

src/azure-cli/azure/cli/command_modules/rdbms/validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,8 @@ def validate_public_access_server(cmd, client, resource_group_name, server_name)
841841

842842
server = server_operations_client.get(resource_group_name, server_name)
843843
if server.network.public_network_access == 'Disabled':
844-
raise ValidationError("Firewall rule operations cannot be requested for a private access enabled server.")
844+
raise ValidationError("Firewall rule operations cannot be requested for "
845+
"a server that doesn't have public access enabled.")
845846

846847

847848
def _validate_identity(cmd, namespace, identity):

0 commit comments

Comments
 (0)