Documentation
¶
Index ¶
- Constants
- func GetAndCheckResourceState(ctx context.Context, handler *AzureSDKHandler, resourceID string, ...) (*resourceNetworkInfo, error)
- func GetAzureSubscriptionId() string
- func GetLastSegment(ID string) (string, error)
- func GetNetworkInfoFromResource(ctx context.Context, handler *AzureSDKHandler, resourceID string) (*resourceNetworkInfo, error)
- func GetResourceInfoFromResourceDesc(ctx context.Context, resource *paragliderpb.CreateResourceRequest) (*resourceInfo, error)
- func GetTestVmParameters(location string) armcompute.VirtualMachine
- func GetVmIpAddress(vmId string) (string, error)
- func InitializeServer(orchestratorAddr string) *azurePluginServer
- func ReadAndProvisionResource(ctx context.Context, resource *paragliderpb.CreateResourceRequest, ...) (string, error)
- func RunPingConnectivityCheck(sourceVmResourceID string, destinationIPAddress string) (bool, error)
- func Setup(port int, orchestratorServerAddr string) *azurePluginServer
- func SetupAzureTesting(subscriptionId string, testName string) string
- func SetupFakeAzureServer(t *testing.T, fakeServerState *fakeServerState) (fakeServer *httptest.Server, ctx context.Context)
- func Teardown(fakeServer *httptest.Server)
- func TeardownAzureTesting(subscriptionId string, resourceGroupName string)
- type AzureCredentialGetter
- type AzureResourceHandler
- type AzureSDKHandler
- func (h *AzureSDKHandler) AddSubnetToParagliderVnet(ctx context.Context, namespace string, vnetName string, subnetName string, ...) (*armnetwork.Subnet, error)
- func (h *AzureSDKHandler) AssociateNSGWithSubnet(ctx context.Context, subnetID string, nsgID string) error
- func (h *AzureSDKHandler) CreateAKSCluster(ctx context.Context, parameters armcontainerservice.ManagedCluster, ...) (*armcontainerservice.ManagedCluster, error)
- func (h *AzureSDKHandler) CreateLocalNetworkGateway(ctx context.Context, name string, parameters armnetwork.LocalNetworkGateway) (*armnetwork.LocalNetworkGateway, error)
- func (h *AzureSDKHandler) CreateNetworkInterface(ctx context.Context, subnetID string, location string, nicName string) (*armnetwork.Interface, error)
- func (h *AzureSDKHandler) CreateOrUpdateVirtualNetworkGateway(ctx context.Context, name string, parameters armnetwork.VirtualNetworkGateway) (*armnetwork.VirtualNetworkGateway, error)
- func (h *AzureSDKHandler) CreateOrUpdateVirtualNetworkPeering(ctx context.Context, virtualNetworkName string, ...) (*armnetwork.VirtualNetworkPeering, error)
- func (h *AzureSDKHandler) CreateOrUpdateVnetPeeringRemoteGateway(ctx context.Context, vnetName string, gatewayVnetName string, ...) error
- func (h *AzureSDKHandler) CreateParagliderVirtualNetwork(ctx context.Context, location string, vnetName string, addressSpace string) (*armnetwork.VirtualNetwork, error)
- func (h *AzureSDKHandler) CreatePublicIPAddress(ctx context.Context, name string, parameters armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error)
- func (h *AzureSDKHandler) CreateSecurityGroup(ctx context.Context, resourceName string, location string, ...) (*armnetwork.SecurityGroup, error)
- func (h *AzureSDKHandler) CreateSecurityRule(ctx context.Context, rule *paragliderpb.PermitListRule, nsgName string, ...) (*armnetwork.SecurityRule, error)
- func (h *AzureSDKHandler) CreateSubnet(ctx context.Context, virtualNetworkName string, subnetName string, ...) (*armnetwork.Subnet, error)
- func (h *AzureSDKHandler) CreateVirtualMachine(ctx context.Context, parameters armcompute.VirtualMachine, vmName string) (*armcompute.VirtualMachine, error)
- func (h *AzureSDKHandler) CreateVirtualNetwork(ctx context.Context, name string, parameters armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error)
- func (h *AzureSDKHandler) CreateVirtualNetworkGatewayConnection(ctx context.Context, name string, ...) (*armnetwork.VirtualNetworkGatewayConnection, error)
- func (h *AzureSDKHandler) CreateVnetPeering(ctx context.Context, vnet1Name string, vnet2Name string) error
- func (h *AzureSDKHandler) CreateVnetPeeringOneWay(ctx context.Context, vnet1Name string, vnet2Name string, ...) error
- func (h *AzureSDKHandler) DeleteSecurityRule(ctx context.Context, nsgName string, ruleName string) error
- func (h *AzureSDKHandler) GetLocalNetworkGateway(ctx context.Context, name string) (*armnetwork.LocalNetworkGateway, error)
- func (h *AzureSDKHandler) GetNetworkInterface(ctx context.Context, nicName string) (*armnetwork.Interface, error)
- func (h *AzureSDKHandler) GetParagliderVnet(ctx context.Context, vnetName string, location string, namespace string, ...) (*armnetwork.VirtualNetwork, error)
- func (h *AzureSDKHandler) GetPermitListRuleFromNSGRule(rule *armnetwork.SecurityRule) (*paragliderpb.PermitListRule, error)
- func (h *AzureSDKHandler) GetPublicIPAddress(ctx context.Context, name string) (*armnetwork.PublicIPAddress, error)
- func (h *AzureSDKHandler) GetResource(ctx context.Context, resourceID string) (*armresources.GenericResource, error)
- func (h *AzureSDKHandler) GetSecurityGroup(ctx context.Context, nsgName string) (*armnetwork.SecurityGroup, error)
- func (h *AzureSDKHandler) GetSubnet(ctx context.Context, virtualNetworkName string, subnetName string) (*armnetwork.Subnet, error)
- func (h *AzureSDKHandler) GetSubnetByID(ctx context.Context, subnetID string) (*armnetwork.Subnet, error)
- func (h *AzureSDKHandler) GetVNet(ctx context.Context, vnetName string) (*armnetwork.VirtualNetwork, error)
- func (h *AzureSDKHandler) GetVNetsAddressSpaces(ctx context.Context, prefix string) (map[string][]string, error)
- func (h *AzureSDKHandler) GetVirtualNetwork(ctx context.Context, name string) (*armnetwork.VirtualNetwork, error)
- func (h *AzureSDKHandler) GetVirtualNetworkGateway(ctx context.Context, name string) (*armnetwork.VirtualNetworkGateway, error)
- func (h *AzureSDKHandler) GetVirtualNetworkGatewayConnection(ctx context.Context, name string) (*armnetwork.VirtualNetworkGatewayConnection, error)
- func (h *AzureSDKHandler) GetVirtualNetworkPeering(ctx context.Context, virtualNetworkName string, ...) (*armnetwork.VirtualNetworkPeering, error)
- func (h *AzureSDKHandler) InitializeClients(cred azcore.TokenCredential) error
- func (h *AzureSDKHandler) ListVirtualNetworkPeerings(ctx context.Context, virtualNetworkName string) ([]*armnetwork.VirtualNetworkPeering, error)
- func (h *AzureSDKHandler) SetSubIdAndResourceGroup(subid string, resourceGroupName string)
- type IAzureCredentialGetter
- type ResourceIDInfo
Constants ¶
const (
VirtualMachineResourceType = "Microsoft.Compute/virtualMachines"
)
Variables ¶
This section is empty.
Functions ¶
func GetAndCheckResourceState ¶
func GetAndCheckResourceState(ctx context.Context, handler *AzureSDKHandler, resourceID string, namespace string) (*resourceNetworkInfo, error)
Gets the resource and returns relevant networking state. Also checks that the resource is in the correct namespace.
func GetAzureSubscriptionId ¶
func GetAzureSubscriptionId() string
Gets subscription ID defined in environment variable
func GetLastSegment ¶
getLastSegment returns the last segment of a resource ID.
func GetNetworkInfoFromResource ¶
func GetNetworkInfoFromResource(ctx context.Context, handler *AzureSDKHandler, resourceID string) (*resourceNetworkInfo, error)
Gets the resource and returns relevant networking state
func GetResourceInfoFromResourceDesc ¶
func GetResourceInfoFromResourceDesc(ctx context.Context, resource *paragliderpb.CreateResourceRequest) (*resourceInfo, error)
Gets basic resource information from the description Returns the resource name, ID, location, and whether the resource will require its own subnet in a struct
func GetTestVmParameters ¶
func GetTestVmParameters(location string) armcompute.VirtualMachine
func GetVmIpAddress ¶
TODO @seankimkdy: figure out how to merge this with Azure SDK handler
func InitializeServer ¶
func InitializeServer(orchestratorAddr string) *azurePluginServer
func ReadAndProvisionResource ¶
func ReadAndProvisionResource(ctx context.Context, resource *paragliderpb.CreateResourceRequest, subnet *armnetwork.Subnet, resourceInfo *ResourceIDInfo, sdkHandler *AzureSDKHandler, additionalAddressSpaces []string) (string, error)
Reads the resource description and provisions the resource with the given subnet
func SetupAzureTesting ¶
func SetupFakeAzureServer ¶
func SetupFakeAzureServer(t *testing.T, fakeServerState *fakeServerState) (fakeServer *httptest.Server, ctx context.Context)
Sets up fake http server
func TeardownAzureTesting ¶
Types ¶
type AzureCredentialGetter ¶
type AzureCredentialGetter struct {
IAzureCredentialGetter
}
func (*AzureCredentialGetter) GetAzureCredentials ¶
func (g *AzureCredentialGetter) GetAzureCredentials() (azcore.TokenCredential, error)
GetAzureCredentials returns an Azure credential. it uses the azidentity.NewDefaultAzureCredential() function to create a new Azure credential.
type AzureResourceHandler ¶
type AzureResourceHandler interface {
// contains filtered or unexported methods
}
Interface that must be implemented for a resource to be supported
type AzureSDKHandler ¶
type AzureSDKHandler struct {
// contains filtered or unexported fields
}
func (*AzureSDKHandler) AddSubnetToParagliderVnet ¶
func (h *AzureSDKHandler) AddSubnetToParagliderVnet(ctx context.Context, namespace string, vnetName string, subnetName string, orchestratorAddr string) (*armnetwork.Subnet, error)
AddSubnetToParagliderVnet adds a subnet to an paraglider vnet
func (*AzureSDKHandler) AssociateNSGWithSubnet ¶
func (*AzureSDKHandler) CreateAKSCluster ¶
func (h *AzureSDKHandler) CreateAKSCluster(ctx context.Context, parameters armcontainerservice.ManagedCluster, clusterName string) (*armcontainerservice.ManagedCluster, error)
CreateAKSCluster creates a new AKS cluster with the given parameters and name
func (*AzureSDKHandler) CreateLocalNetworkGateway ¶
func (h *AzureSDKHandler) CreateLocalNetworkGateway(ctx context.Context, name string, parameters armnetwork.LocalNetworkGateway) (*armnetwork.LocalNetworkGateway, error)
func (*AzureSDKHandler) CreateNetworkInterface ¶
func (h *AzureSDKHandler) CreateNetworkInterface(ctx context.Context, subnetID string, location string, nicName string) (*armnetwork.Interface, error)
CreateNetworkInterface creates a new network interface with a dynamic private IP address
func (*AzureSDKHandler) CreateOrUpdateVirtualNetworkGateway ¶
func (h *AzureSDKHandler) CreateOrUpdateVirtualNetworkGateway(ctx context.Context, name string, parameters armnetwork.VirtualNetworkGateway) (*armnetwork.VirtualNetworkGateway, error)
func (*AzureSDKHandler) CreateOrUpdateVirtualNetworkPeering ¶
func (*AzureSDKHandler) CreateOrUpdateVnetPeeringRemoteGateway ¶
func (h *AzureSDKHandler) CreateOrUpdateVnetPeeringRemoteGateway(ctx context.Context, vnetName string, gatewayVnetName string, vnetToGatewayVnetPeering *armnetwork.VirtualNetworkPeering, gatewayVnetToVnetPeering *armnetwork.VirtualNetworkPeering) error
Creates (if not exists) or updates vnet peering to use remote gateway
func (*AzureSDKHandler) CreateParagliderVirtualNetwork ¶
func (h *AzureSDKHandler) CreateParagliderVirtualNetwork(ctx context.Context, location string, vnetName string, addressSpace string) (*armnetwork.VirtualNetwork, error)
CreateParagliderVirtualNetwork creates a new paraglider virtual network with a default subnet with the same address space as the vnet
func (*AzureSDKHandler) CreatePublicIPAddress ¶
func (h *AzureSDKHandler) CreatePublicIPAddress(ctx context.Context, name string, parameters armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error)
func (*AzureSDKHandler) CreateSecurityGroup ¶
func (*AzureSDKHandler) CreateSecurityRule ¶
func (h *AzureSDKHandler) CreateSecurityRule(ctx context.Context, rule *paragliderpb.PermitListRule, nsgName string, ruleName string, resourceIpAddress string, priority int32) (*armnetwork.SecurityRule, error)
GetPermitListRuleFromNSGRulecurityRule creates a new security rule in a network security group (NSG).
func (*AzureSDKHandler) CreateSubnet ¶
func (*AzureSDKHandler) CreateVirtualMachine ¶
func (h *AzureSDKHandler) CreateVirtualMachine(ctx context.Context, parameters armcompute.VirtualMachine, vmName string) (*armcompute.VirtualMachine, error)
CreateVirtualMachine creates a new virtual machine with the given parameters and name
func (*AzureSDKHandler) CreateVirtualNetwork ¶
func (h *AzureSDKHandler) CreateVirtualNetwork(ctx context.Context, name string, parameters armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error)
func (*AzureSDKHandler) CreateVirtualNetworkGatewayConnection ¶
func (h *AzureSDKHandler) CreateVirtualNetworkGatewayConnection(ctx context.Context, name string, parameters armnetwork.VirtualNetworkGatewayConnection) (*armnetwork.VirtualNetworkGatewayConnection, error)
func (*AzureSDKHandler) CreateVnetPeering ¶
func (h *AzureSDKHandler) CreateVnetPeering(ctx context.Context, vnet1Name string, vnet2Name string) error
Create Vnet Peering between two VNets, this is important in the case of a multi-region deployment For peering to work, two peering links must be created. By selecting remote virtual network, Azure will create both peering links.
func (*AzureSDKHandler) CreateVnetPeeringOneWay ¶
func (h *AzureSDKHandler) CreateVnetPeeringOneWay(ctx context.Context, vnet1Name string, vnet2Name string, vnet2SubscriptionID string, vnet2ResourceGroupName string) error
Temporarily needed method to deal with the mess of AzureSDKHandlers TODO @seankimkdy: remove once AzureSDKHandler is no longer a mess
func (*AzureSDKHandler) DeleteSecurityRule ¶
func (h *AzureSDKHandler) DeleteSecurityRule(ctx context.Context, nsgName string, ruleName string) error
DeleteSecurityRule deletes a security rule from a network security group (NSG).
func (*AzureSDKHandler) GetLocalNetworkGateway ¶
func (h *AzureSDKHandler) GetLocalNetworkGateway(ctx context.Context, name string) (*armnetwork.LocalNetworkGateway, error)
func (*AzureSDKHandler) GetNetworkInterface ¶
func (h *AzureSDKHandler) GetNetworkInterface(ctx context.Context, nicName string) (*armnetwork.Interface, error)
func (*AzureSDKHandler) GetParagliderVnet ¶
func (h *AzureSDKHandler) GetParagliderVnet(ctx context.Context, vnetName string, location string, namespace string, orchestratorAddr string) (*armnetwork.VirtualNetwork, error)
GetParagliderVnet returns a valid paraglider vnet, a paraglider vnet is a vnet with a default subnet with the same address space as the vnet and there is only one vnet per location
func (*AzureSDKHandler) GetPermitListRuleFromNSGRule ¶
func (h *AzureSDKHandler) GetPermitListRuleFromNSGRule(rule *armnetwork.SecurityRule) (*paragliderpb.PermitListRule, error)
GetPermitListRuleFromNSGRule returns a permit list rule from a network security group (NSG) rule.
func (*AzureSDKHandler) GetPublicIPAddress ¶
func (h *AzureSDKHandler) GetPublicIPAddress(ctx context.Context, name string) (*armnetwork.PublicIPAddress, error)
func (*AzureSDKHandler) GetResource ¶
func (h *AzureSDKHandler) GetResource(ctx context.Context, resourceID string) (*armresources.GenericResource, error)
func (*AzureSDKHandler) GetSecurityGroup ¶
func (h *AzureSDKHandler) GetSecurityGroup(ctx context.Context, nsgName string) (*armnetwork.SecurityGroup, error)
GetSecurityGroup reutrns the network security group object given the nsg name
func (*AzureSDKHandler) GetSubnetByID ¶
func (h *AzureSDKHandler) GetSubnetByID(ctx context.Context, subnetID string) (*armnetwork.Subnet, error)
func (*AzureSDKHandler) GetVNet ¶
func (h *AzureSDKHandler) GetVNet(ctx context.Context, vnetName string) (*armnetwork.VirtualNetwork, error)
GetVNet returns the virtual network with the given name
func (*AzureSDKHandler) GetVNetsAddressSpaces ¶
func (h *AzureSDKHandler) GetVNetsAddressSpaces(ctx context.Context, prefix string) (map[string][]string, error)
GetVnetAddressSpaces returns a map of location to address space for all virtual networks (VNets) with a given prefix.
func (*AzureSDKHandler) GetVirtualNetwork ¶
func (h *AzureSDKHandler) GetVirtualNetwork(ctx context.Context, name string) (*armnetwork.VirtualNetwork, error)
func (*AzureSDKHandler) GetVirtualNetworkGateway ¶
func (h *AzureSDKHandler) GetVirtualNetworkGateway(ctx context.Context, name string) (*armnetwork.VirtualNetworkGateway, error)
func (*AzureSDKHandler) GetVirtualNetworkGatewayConnection ¶
func (h *AzureSDKHandler) GetVirtualNetworkGatewayConnection(ctx context.Context, name string) (*armnetwork.VirtualNetworkGatewayConnection, error)
func (*AzureSDKHandler) GetVirtualNetworkPeering ¶
func (*AzureSDKHandler) InitializeClients ¶
func (h *AzureSDKHandler) InitializeClients(cred azcore.TokenCredential) error
InitializeClients initializes the necessary azure clients for the necessary operations
func (*AzureSDKHandler) ListVirtualNetworkPeerings ¶
func (h *AzureSDKHandler) ListVirtualNetworkPeerings(ctx context.Context, virtualNetworkName string) ([]*armnetwork.VirtualNetworkPeering, error)
func (*AzureSDKHandler) SetSubIdAndResourceGroup ¶
func (h *AzureSDKHandler) SetSubIdAndResourceGroup(subid string, resourceGroupName string)
type IAzureCredentialGetter ¶
type IAzureCredentialGetter interface {
GetAzureCredentials() (azcore.TokenCredential, error)
}