From 16e1e3a053971cecbb67487836e51b071a788ace Mon Sep 17 00:00:00 2001 From: "NORTHAMERICA\\tianzhu" Date: Mon, 12 May 2025 17:32:57 -0700 Subject: [PATCH 1/4] Add the fluidrelay to private link --- .../private_link_resource_and_endpoint_connections/custom.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/azure-cli/azure/cli/command_modules/network/private_link_resource_and_endpoint_connections/custom.py b/src/azure-cli/azure/cli/command_modules/network/private_link_resource_and_endpoint_connections/custom.py index b66b2f164ab..bafde5a4ab3 100644 --- a/src/azure-cli/azure/cli/command_modules/network/private_link_resource_and_endpoint_connections/custom.py +++ b/src/azure-cli/azure/cli/command_modules/network/private_link_resource_and_endpoint_connections/custom.py @@ -84,6 +84,7 @@ def register_providers(): _register_one_provider("Microsoft.DocumentDB/mongoClusters", '2023-03-01-preview', True) _register_one_provider('Microsoft.DBforPostgreSQL/flexibleServers', '2023-06-01-preview', False) _register_one_provider('Microsoft.App/managedEnvironments', '2024-02-02-preview', True) + _register_one_provider('Microsoft.FluidRelay/fluidRelayServers', '2025-03-10-preview', True) def _register_one_provider(provider, api_version, support_list_or_not, resource_get_api_version=None, support_connection_operation=True): # pylint: disable=line-too-long From 70265cc70363d0da974443da81282f48f13174ca Mon Sep 17 00:00:00 2001 From: Joel Zhu <66701969+tianzhu007@users.noreply.github.com> Date: Fri, 16 May 2025 16:41:41 -0700 Subject: [PATCH 2/4] Add the test files --- ...est_private_link_resource_fluid_relay.yaml | 48 +++++++++++++++++++ .../latest/test_private_endpoint_commands.py | 9 ++++ 2 files changed, 57 insertions(+) create mode 100644 src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml new file mode 100644 index 00000000000..19c61c32da7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml @@ -0,0 +1,48 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - network private-link-resource list + Connection: + - keep-alive + ParameterSetName: + - --name -g --type + User-Agent: + - python/3.8.3 (Windows-10-10.0.18362-SP0) AZURECLI/2.29.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_sa_plr000001/providers/Microsoft.FluidRelay/fluidRelayServers/saplr000002/privateLinkResources?api-version=2025-03-10-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_sa_plr000001/providers/Microsoft.FluidRelay/fluidRelayServers/saplr000002/privateLinkResources/FluidRelayServers","name":"FluidRelayServers","type":"Microsoft.FluidRelay/fluidRelayServers/privateLinkResources","properties":{"groupId":"FluidRelayServers","requiredMembers":["test-alfred","test-nexus","test-historian"],"requiredZoneNames":["privatelink.fluidrelay.azure.com"]}}]}' + headers: + cache-control: + - no-cache + content-length: + - '2663' + content-type: + - application/json + date: + - Mon, 16 May 2025 14:06:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py index 797988635d7..b11ba84d172 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py @@ -270,6 +270,15 @@ def test_hsm_private_endpoint_connection2(self, resource_group, managed_hsm): self.cmd('network private-endpoint delete -g {rg} -n {pe}') +class NetworkPrivateLinkFluidRelayScenarioTest(ScenarioTest): + @ResourceGroupPreparer(name_prefix='cli_test_sa_plr000001') + def test_private_link_resource_fluid_relay(self): + self.kwargs.update({ + 'fluidrelay': 'saplr000002' + }) + self.cmd('network private-link-resource list --name {sa} -g {rg} --type Microsoft.FluidRelay/fluidRelayServers', checks=[ + self.check('length(@)', 6)]) + class NetworkPrivateLinkStorageAccountScenarioTest(ScenarioTest): @ResourceGroupPreparer(name_prefix='cli_test_sa_plr') @StorageAccountPreparer(name_prefix='saplr', kind='StorageV2', sku='Standard_LRS') From 9953375ff46fa75731333b43dd0f3469f75406fa Mon Sep 17 00:00:00 2001 From: "NORTHAMERICA\\tianzhu" Date: Mon, 19 May 2025 16:59:08 -0700 Subject: [PATCH 3/4] Add unit tests --- ...ivate_endpoint_connection_fluid_relay.yaml | 48 +++++++++++++++++++ ...est_private_link_resource_fluid_relay.yaml | 4 +- .../latest/test_private_endpoint_commands.py | 18 +++++-- 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml new file mode 100644 index 00000000000..d950dd0a6d8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml @@ -0,0 +1,48 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - network private-link-resource list + Connection: + - keep-alive + ParameterSetName: + - --name -g --type + User-Agent: + - python/3.8.3 (Windows-10-10.0.18362-SP0) AZURECLI/2.29.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002?api-version=2025-03-10-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002/privateEndpointConnections/frpec000001", "name": "frpec000002", "type": "Microsoft.FluidRelay/fluidRelayServers/privateEndpointConnections", "properties": { "provisioningState": "Succeeded", "privateEndpoint": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plr000001000001/providers/Microsoft.Network/privateEndpoints/frpec000002" }, "privateLinkServiceConnectionState": { "status": "Approved", "description": "Auto-Approved", "actionsRequired": "None" } } }, {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002/privateEndpointConnections/frpec000002", "name": "frpec000002", "type": "Microsoft.FluidRelay/fluidRelayServers/privateEndpointConnections", "properties": { "provisioningState": "Succeeded", "privateEndpoint": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plr000001000001/providers/Microsoft.Network/privateEndpoints/frpec000002" }, "privateLinkServiceConnectionState": { "status": "Approved", "description": "Auto-Approved", "actionsRequired": "None" } } }' + headers: + cache-control: + - no-cache + content-length: + - '2663' + content-type: + - application/json + date: + - Mon, 16 May 2025 14:06:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml index 19c61c32da7..280853da45f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_fluid_relay.yaml @@ -15,10 +15,10 @@ interactions: User-Agent: - python/3.8.3 (Windows-10-10.0.18362-SP0) AZURECLI/2.29.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_sa_plr000001/providers/Microsoft.FluidRelay/fluidRelayServers/saplr000002/privateLinkResources?api-version=2025-03-10-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plr000001000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000001/privateLinkResources?api-version=2025-03-10-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_sa_plr000001/providers/Microsoft.FluidRelay/fluidRelayServers/saplr000002/privateLinkResources/FluidRelayServers","name":"FluidRelayServers","type":"Microsoft.FluidRelay/fluidRelayServers/privateLinkResources","properties":{"groupId":"FluidRelayServers","requiredMembers":["test-alfred","test-nexus","test-historian"],"requiredZoneNames":["privatelink.fluidrelay.azure.com"]}}]}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plr000001000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000001/privateLinkResources/FluidRelayServers","name":"FluidRelayServers","type":"Microsoft.FluidRelay/fluidRelayServers/privateLinkResources","properties":{"groupId":"FluidRelayServers","requiredMembers":["test-alfred","test-nexus","test-historian"],"requiredZoneNames":["privatelink.fluidrelay.azure.com"]}}]}' headers: cache-control: - no-cache diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py index b11ba84d172..6b388643c51 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py @@ -271,13 +271,23 @@ def test_hsm_private_endpoint_connection2(self, resource_group, managed_hsm): class NetworkPrivateLinkFluidRelayScenarioTest(ScenarioTest): - @ResourceGroupPreparer(name_prefix='cli_test_sa_plr000001') + @ResourceGroupPreparer(name_prefix='cli_test_fr_plr000001') def test_private_link_resource_fluid_relay(self): self.kwargs.update({ - 'fluidrelay': 'saplr000002' + 'fluidrelay': 'frplr000001' }) - self.cmd('network private-link-resource list --name {sa} -g {rg} --type Microsoft.FluidRelay/fluidRelayServers', checks=[ - self.check('length(@)', 6)]) + self.cmd('network private-link-resource list --name {fluidrelay} -g {rg} --type Microsoft.FluidRelay/fluidRelayServers', checks=[ + self.check('length(@)', 1), + ]) + + @ResourceGroupPreparer(name_prefix='cli_test_fr_plc000002') + def test_private_link_connection_fluid_relay(self): + self.kwargs.update({ + 'fluidrelay': 'frplr000002' + }) + self.cmd('network private-endpoint-connection list --name {fluidrelay} -g {rg} --type Microsoft.FluidRelay/fluidRelayServers', checks=[ + self.check('length(@)', 2), + ]) class NetworkPrivateLinkStorageAccountScenarioTest(ScenarioTest): @ResourceGroupPreparer(name_prefix='cli_test_sa_plr') From 2056edac44dc0e153b6ee0a40e21ae9e33afe332 Mon Sep 17 00:00:00 2001 From: "NORTHAMERICA\\tianzhu" Date: Mon, 19 May 2025 21:10:40 -0700 Subject: [PATCH 4/4] Add the unit test fix --- .../test_private_endpoint_connection_fluid_relay.yaml | 6 +++--- .../network/tests/latest/test_private_endpoint_commands.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml index d950dd0a6d8..e7171d7bc29 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_fluid_relay.yaml @@ -15,10 +15,10 @@ interactions: User-Agent: - python/3.8.3 (Windows-10-10.0.18362-SP0) AZURECLI/2.29.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002?api-version=2025-03-10-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002/privateEndpointConnections?api-version=2025-03-10-preview response: body: - string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002/privateEndpointConnections/frpec000001", "name": "frpec000002", "type": "Microsoft.FluidRelay/fluidRelayServers/privateEndpointConnections", "properties": { "provisioningState": "Succeeded", "privateEndpoint": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plr000001000001/providers/Microsoft.Network/privateEndpoints/frpec000002" }, "privateLinkServiceConnectionState": { "status": "Approved", "description": "Auto-Approved", "actionsRequired": "None" } } }, {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plc000002000001/providers/Microsoft.FluidRelay/fluidRelayServers/frplr000002/privateEndpointConnections/frpec000002", "name": "frpec000002", "type": "Microsoft.FluidRelay/fluidRelayServers/privateEndpointConnections", "properties": { "provisioningState": "Succeeded", "privateEndpoint": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_fr_plr000001000001/providers/Microsoft.Network/privateEndpoints/frpec000002" }, "privateLinkServiceConnectionState": { "status": "Approved", "description": "Auto-Approved", "actionsRequired": "None" } } }' + string: '{"value": [{"id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.FluidRelay/fluidRelayServers/myFluidRelayServer/privateEndpointConnections/myPrivateEndpointConnection1", "name": "myPrivateEndpointConnection1", "type": "Microsoft.FluidRelay/fluidRelayServers/privateEndpointConnections", "properties": {"provisioningState": "Succeeded", "privateEndpoint": {"id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/privateEndpoint1"}, "privateLinkServiceConnectionState": {"status": "Approved", "description": "Auto-Approved", "actionsRequired": "None"}}}, {"id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.FluidRelay/fluidRelayServers/myFluidRelayServer/privateEndpointConnections/myPrivateEndpointConnection2", "name": "myPrivateEndpointConnection2", "type": "Microsoft.FluidRelay/fluidRelayServers/privateEndpointConnections", "properties": {"provisioningState": "Succeeded", "privateEndpoint": {"id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/privateEndpoint2"}, "privateLinkServiceConnectionState": {"status": "Approved", "description": "Auto-Approved", "actionsRequired": "None"}}}]}' headers: cache-control: - no-cache @@ -45,4 +45,4 @@ interactions: status: code: 200 message: OK -version: 1 +version: 1 \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py index 6b388643c51..223789c14d0 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_private_endpoint_commands.py @@ -281,7 +281,7 @@ def test_private_link_resource_fluid_relay(self): ]) @ResourceGroupPreparer(name_prefix='cli_test_fr_plc000002') - def test_private_link_connection_fluid_relay(self): + def test_private_endpoint_connection_fluid_relay(self): self.kwargs.update({ 'fluidrelay': 'frplr000002' })