Skip to content

Commit dec8a11

Browse files
authored
{RDBMS} CLI code updates for new GA Api version for PostgreSQL using new SDK package (#24997)
* Update cli code for the new sdk package and update tests by rerecording * Revert change to test-rdbms_flexible_commands.py file for retention days and keep it as 90 * Update Python SDK package to recently released version 10.2.0b6 * Fix byok test and add test for aad only auth * Update help text for aad auth related commands for creating or updating PG flexible server * remove unittest unused import from test_rdbms_flexible_commands file * Record skipped tests, refactor for new aad test and fix small bug for failover (restart) to check for samezone ha * Fix name and text for the new sample commands added for aad, also update the record test for backups as the corresponding RP changes are deployed * Fix aad test for MySQL * Fix the failing test after merge
1 parent 3bc954c commit dec8a11

28 files changed

Lines changed: 24946 additions & 24176 deletions

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@
126126
127127
az postgres flexible-server create -g testGroup -n testServer --location testLocation \\
128128
--key $keyIdentifier --identity testIdentity
129+
- name: >
130+
Create a PostgreSQL flexible server with active directory auth as well as password auth.
131+
text: >
132+
# create flexible server with aad auth and password auth enabled
133+
134+
az postgres flexible-server create -g testGroup -n testServer --location testLocation \\
135+
--active-directory-auth Enabled
136+
- name: >
137+
Create a PostgreSQL flexible server with active directory auth only.
138+
text: >
139+
# create flexible server with aad only auth and password auth disabled
140+
141+
az postgres flexible-server create -g testGroup -n testServer --location testLocation \\
142+
--active-directory-auth Enabled --password-auth Disabled
129143
"""
130144

131145
helps['postgres flexible-server show'] = """
@@ -158,6 +172,8 @@
158172
text: az postgres flexible-server update --resource-group testGroup --name testserver --tags "k1=v1" "k2=v2"
159173
- name: Reset password
160174
text: az postgres flexible-server update --resource-group testGroup --name testserver -p password123
175+
- name: Update a flexible server to enable active directory auth for password auth enabled server
176+
text: az postgres flexible-server update --resource-group testGroup --name testserver --active-directory-auth Enabled
161177
- name: Change key/identity for data encryption. Data encryption cannot be enabled post server creation, this will only update the key/identity.
162178
text: >
163179
# get key identifier of the existing key

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def flexible_server_create(cmd, client,
108108
byok_identity=byok_identity,
109109
byok_key=byok_key)
110110

111-
auth_config = postgresql_flexibleservers.models.AuthConfig(active_directory_auth_enabled=(active_directory_auth == 'Enabled'),
112-
password_auth_enabled=(password_auth == 'Enabled'))
111+
auth_config = postgresql_flexibleservers.models.AuthConfig(active_directory_auth=active_directory_auth,
112+
password_auth=password_auth)
113113

114114
# Create postgresql
115115
# Note : passing public_access has no effect as the accepted values are 'Enabled' and 'Disabled'. So the value ends up being ignored.
@@ -305,9 +305,9 @@ def flexible_server_update_custom_func(cmd, client, instance,
305305

306306
auth_config = instance.auth_config
307307
if active_directory_auth:
308-
auth_config.active_directory_auth_enabled = active_directory_auth == 'Enabled'
308+
auth_config.active_directory_auth = active_directory_auth
309309
if password_auth:
310-
auth_config.password_auth_enabled = password_auth == 'Enabled'
310+
auth_config.password_auth = password_auth
311311

312312
params = ServerForUpdate(sku=instance.sku,
313313
storage=instance.storage,
@@ -336,8 +336,8 @@ def flexible_server_update_custom_func(cmd, client, instance,
336336

337337
def flexible_server_restart(cmd, client, resource_group_name, server_name, fail_over=None):
338338
instance = client.get(resource_group_name, server_name)
339-
if fail_over is not None and instance.high_availability.mode != "ZoneRedundant":
340-
raise ArgumentUsageError("Failing over can only be triggered for zone redundant servers.")
339+
if fail_over is not None and instance.high_availability.mode not in ("ZoneRedundant", "SameZone"):
340+
raise ArgumentUsageError("Failing over can only be triggered for zone redundant or same zone servers.")
341341

342342
if fail_over is not None:
343343
if fail_over.lower() not in ['planned', 'forced']:

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_flexible_server_vnet_mgmt_validator.yaml

Lines changed: 1480 additions & 240 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_mysql_flexible_server_identity_aad_admin_mgmt.yaml

Lines changed: 908 additions & 641 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_postgres_flexible_server_backups_mgmt.yaml

Lines changed: 117 additions & 208 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_postgres_flexible_server_byok_mgmt.yaml

Lines changed: 502 additions & 944 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_postgres_flexible_server_existing_private_dns_zone.yaml

Lines changed: 738 additions & 644 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_postgres_flexible_server_georestore_mgmt.yaml

Lines changed: 1344 additions & 11319 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_postgres_flexible_server_mgmt.yaml

Lines changed: 952 additions & 778 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/rdbms/tests/latest/recordings/test_postgres_flexible_server_mgmt_create_validator.yaml

Lines changed: 140 additions & 140 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)