Skip to content

Commit 2b7ff12

Browse files
Lionel-Wilsoncursoragent
authored andcommitted
Create Azure adapter: NetworkPrivateLinkService (#4538)
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Summary This PR adds a new Azure adapter for Private Link Services (`NetworkPrivateLinkService`). The adapter discovers Azure Private Link Service resources and creates linked item queries to related resources. ## Changes ### New Files - `sources/azure/clients/private-link-services-client.go` - Client interface for Azure Private Link Services - `sources/azure/shared/mocks/mock_private_link_services_client.go` - Generated mock for testing - `sources/azure/manual/network-private-link-service.go` - Adapter implementation - `sources/azure/manual/network-private-link-service_test.go` - Unit tests - `sources/azure/integration-tests/network-private-link-service_test.go` - Integration tests ### Modified Files - `sources/azure/manual/adapters.go` - Registration of the new adapter ## Linked Items The adapter creates linked item queries to the following resource types: | Linked Resource Type | Source Field | Method | | --- | --- | --- | | NetworkSubnet | IPConfigurations[].Properties.Subnet | GET | | NetworkVirtualNetwork | (parent of subnet) | GET | | NetworkLoadBalancerFrontendIPConfiguration | LoadBalancerFrontendIPConfigurations | GET | | NetworkLoadBalancer | (parent of frontend IP config) | GET | | NetworkNetworkInterface | NetworkInterfaces | GET | | NetworkPrivateEndpoint | PrivateEndpointConnections[].PrivateEndpoint | GET | | ExtendedLocationCustomLocation | ExtendedLocation.Name (when customLocations) | GET | | stdlib.NetworkIP | IPConfigurations[].Properties.PrivateIPAddress, DestinationIPAddress | GET | | stdlib.NetworkDNS | Fqdns, Alias | SEARCH | ## Health Status Mapping Maps `ProvisioningState` to SDP health: - `Succeeded` → HEALTH_OK - `Creating`, `Updating`, `Deleting` → HEALTH_PENDING - `Failed`, `Canceled` → HEALTH_ERROR - Default → HEALTH_UNKNOWN ## Self-Review Checklist - [x] **IAMPermissions**: Present, references `Microsoft.Network/privateLinkServices/read` - [x] **PredefinedRole**: Present, uses `Network Contributor` - [x] **LinkedItemQueries**: 9 link types verified (Subnet, VirtualNetwork, LoadBalancerFrontendIPConfiguration, LoadBalancer, NetworkInterface, PrivateEndpoint, ExtendedLocationCustomLocation, IP, DNS). DNS includes both Fqdns and Alias fields. - [x] **PotentialLinks**: 9 types listed, matches LinkedItemQueries - [x] **Unit tests**: All passing (Get, List, ListStream, StaticTests, ErrorHandling, Get_EmptyName, List_WithNilName, PotentialLinks) - [x] **Integration test**: All sub-tests passing (Setup, Run, Teardown) against live Azure APIs All checklist items passed. Ready for review. ## Related Issue ENG-3552 <!-- CURSOR_AGENT_PR_BODY_END --> Linear Issue: [ENG-3552](https://linear.app/overmind/issue/ENG-3552/create-azure-adapter-networkprivatelinkservice) <div><a href="https://cursor.com/agents/bc-48fc0407-80ce-4546-a7d7-135b42dfe4ba"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-48fc0407-80ce-4546-a7d7-135b42dfe4ba"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Lionel Wilson <Lionel-Wilson@users.noreply.github.com> GitOrigin-RevId: 62a0ffaa26a4afd7fa103668d183fb68148d129c
1 parent df6c780 commit 2b7ff12

6 files changed

Lines changed: 1497 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package clients
2+
3+
import (
4+
"context"
5+
6+
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9"
7+
)
8+
9+
//go:generate mockgen -destination=../shared/mocks/mock_private_link_services_client.go -package=mocks -source=private-link-services-client.go
10+
11+
// PrivateLinkServicesPager is a type alias for the generic Pager interface with private link service response type.
12+
type PrivateLinkServicesPager = Pager[armnetwork.PrivateLinkServicesClientListResponse]
13+
14+
// PrivateLinkServicesClient is an interface for interacting with Azure private link services.
15+
type PrivateLinkServicesClient interface {
16+
Get(ctx context.Context, resourceGroupName string, serviceName string) (armnetwork.PrivateLinkServicesClientGetResponse, error)
17+
List(resourceGroupName string) PrivateLinkServicesPager
18+
}
19+
20+
type privateLinkServicesClient struct {
21+
client *armnetwork.PrivateLinkServicesClient
22+
}
23+
24+
func (c *privateLinkServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (armnetwork.PrivateLinkServicesClientGetResponse, error) {
25+
return c.client.Get(ctx, resourceGroupName, serviceName, nil)
26+
}
27+
28+
func (c *privateLinkServicesClient) List(resourceGroupName string) PrivateLinkServicesPager {
29+
return c.client.NewListPager(resourceGroupName, nil)
30+
}
31+
32+
// NewPrivateLinkServicesClient creates a new PrivateLinkServicesClient from the Azure SDK client.
33+
func NewPrivateLinkServicesClient(client *armnetwork.PrivateLinkServicesClient) PrivateLinkServicesClient {
34+
return &privateLinkServicesClient{client: client}
35+
}

0 commit comments

Comments
 (0)