driver

package
v1.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package driver defines the interface for networking service implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElasticIP added in v1.3.2

type ElasticIP struct {
	AllocationID  string
	PublicIP      string
	AssociationID string
	InstanceID    string
	Tags          map[string]string
}

ElasticIP represents an elastic IP address.

type ElasticIPConfig added in v1.3.2

type ElasticIPConfig struct {
	Tags map[string]string
}

ElasticIPConfig configures an elastic IP allocation.

type FlowLog added in v1.2.0

type FlowLog struct {
	ID           string
	ResourceID   string
	ResourceType string // "VPC", "Subnet", "NetworkInterface"
	TrafficType  string // "ACCEPT", "REJECT", "ALL"
	Status       string // "ACTIVE", "INACTIVE"
	CreatedAt    string
	Tags         map[string]string
}

FlowLog represents a VPC flow log configuration.

type FlowLogConfig added in v1.2.0

type FlowLogConfig struct {
	ResourceID   string
	ResourceType string
	TrafficType  string
	Tags         map[string]string
}

FlowLogConfig configures a flow log.

type FlowLogRecord added in v1.2.0

type FlowLogRecord struct {
	Timestamp  string
	SourceIP   string
	DestIP     string
	SourcePort int
	DestPort   int
	Protocol   string
	Packets    int
	Bytes      int
	Action     string // "ACCEPT" or "REJECT"
	FlowLogID  string
}

FlowLogRecord represents a single flow log entry.

type InternetGateway added in v1.3.2

type InternetGateway struct {
	ID    string
	VpcID string
	State string // "detached", "attached"
	Tags  map[string]string
}

InternetGateway represents an internet gateway.

type InternetGatewayConfig added in v1.3.2

type InternetGatewayConfig struct {
	Tags map[string]string
}

InternetGatewayConfig configures an internet gateway.

type NATGateway added in v1.2.0

type NATGateway struct {
	ID        string
	SubnetID  string
	VPCID     string
	PublicIP  string
	State     string // "pending", "available", "deleting", "deleted", "failed"
	CreatedAt string
	Tags      map[string]string
}

NATGateway represents a NAT gateway.

type NATGatewayConfig added in v1.2.0

type NATGatewayConfig struct {
	SubnetID string
	Tags     map[string]string
}

NATGatewayConfig configures a NAT gateway.

type NetworkACL added in v1.2.0

type NetworkACL struct {
	ID        string
	VPCID     string
	Rules     []NetworkACLRule
	Tags      map[string]string
	IsDefault bool
}

NetworkACL represents a network ACL.

type NetworkACLRule added in v1.2.0

type NetworkACLRule struct {
	RuleNumber int
	Protocol   string
	Action     string // "allow" or "deny"
	CIDR       string
	FromPort   int
	ToPort     int
	Egress     bool
}

NetworkACLRule represents a rule in a network ACL.

type Networking

type Networking interface {
	CreateVPC(ctx context.Context, config VPCConfig) (*VPCInfo, error)
	DeleteVPC(ctx context.Context, id string) error
	DescribeVPCs(ctx context.Context, ids []string) ([]VPCInfo, error)

	CreateSubnet(ctx context.Context, config SubnetConfig) (*SubnetInfo, error)
	DeleteSubnet(ctx context.Context, id string) error
	DescribeSubnets(ctx context.Context, ids []string) ([]SubnetInfo, error)

	CreateSecurityGroup(ctx context.Context, config SecurityGroupConfig) (*SecurityGroupInfo, error)
	DeleteSecurityGroup(ctx context.Context, id string) error
	DescribeSecurityGroups(ctx context.Context, ids []string) ([]SecurityGroupInfo, error)

	AddIngressRule(ctx context.Context, groupID string, rule SecurityRule) error
	AddEgressRule(ctx context.Context, groupID string, rule SecurityRule) error
	RemoveIngressRule(ctx context.Context, groupID string, rule SecurityRule) error
	RemoveEgressRule(ctx context.Context, groupID string, rule SecurityRule) error

	// VPC Peering
	CreatePeeringConnection(ctx context.Context, config PeeringConfig) (*PeeringConnection, error)
	AcceptPeeringConnection(ctx context.Context, peeringID string) error
	RejectPeeringConnection(ctx context.Context, peeringID string) error
	DeletePeeringConnection(ctx context.Context, peeringID string) error
	DescribePeeringConnections(ctx context.Context, ids []string) ([]PeeringConnection, error)

	// NAT Gateways
	CreateNATGateway(ctx context.Context, config NATGatewayConfig) (*NATGateway, error)
	DeleteNATGateway(ctx context.Context, id string) error
	DescribeNATGateways(ctx context.Context, ids []string) ([]NATGateway, error)

	// Flow Logs
	CreateFlowLog(ctx context.Context, config FlowLogConfig) (*FlowLog, error)
	DeleteFlowLog(ctx context.Context, id string) error
	DescribeFlowLogs(ctx context.Context, ids []string) ([]FlowLog, error)
	GetFlowLogRecords(ctx context.Context, flowLogID string, limit int) ([]FlowLogRecord, error)

	// Route Tables
	CreateRouteTable(ctx context.Context, config RouteTableConfig) (*RouteTable, error)
	DeleteRouteTable(ctx context.Context, id string) error
	DescribeRouteTables(ctx context.Context, ids []string) ([]RouteTable, error)
	CreateRoute(ctx context.Context, routeTableID, destinationCIDR, targetID, targetType string) error
	DeleteRoute(ctx context.Context, routeTableID, destinationCIDR string) error

	// Network ACLs
	CreateNetworkACL(ctx context.Context, vpcID string, tags map[string]string) (*NetworkACL, error)
	DeleteNetworkACL(ctx context.Context, id string) error
	DescribeNetworkACLs(ctx context.Context, ids []string) ([]NetworkACL, error)
	AddNetworkACLRule(ctx context.Context, aclID string, rule *NetworkACLRule) error
	RemoveNetworkACLRule(ctx context.Context, aclID string, ruleNumber int, egress bool) error

	// Internet Gateways
	CreateInternetGateway(ctx context.Context, cfg InternetGatewayConfig) (*InternetGateway, error)
	DeleteInternetGateway(ctx context.Context, id string) error
	DescribeInternetGateways(ctx context.Context, ids []string) ([]InternetGateway, error)
	AttachInternetGateway(ctx context.Context, igwID, vpcID string) error
	DetachInternetGateway(ctx context.Context, igwID, vpcID string) error

	// Elastic IPs
	AllocateAddress(ctx context.Context, cfg ElasticIPConfig) (*ElasticIP, error)
	ReleaseAddress(ctx context.Context, allocationID string) error
	DescribeAddresses(ctx context.Context, ids []string) ([]ElasticIP, error)
	AssociateAddress(ctx context.Context, allocationID, instanceID string) (string, error)
	DisassociateAddress(ctx context.Context, associationID string) error

	// Route Table Associations
	AssociateRouteTable(ctx context.Context, routeTableID, subnetID string) (*RouteTableAssociation, error)
	DisassociateRouteTable(ctx context.Context, associationID string) error

	// VPC Endpoints
	CreateVPCEndpoint(ctx context.Context, config VPCEndpointConfig) (*VPCEndpoint, error)
	DeleteVPCEndpoint(ctx context.Context, id string) error
	DescribeVPCEndpoints(ctx context.Context, ids []string) ([]VPCEndpoint, error)
	ModifyVPCEndpoint(ctx context.Context, id string, config VPCEndpointConfig) (*VPCEndpoint, error)

	// Tag mutation. Update* merges keys into the resource's existing Tags
	// (overlapping keys overwritten, others preserved); Remove* deletes the
	// listed keys. Required by the Resource Groups Tagging API surface.
	UpdateVPCTags(ctx context.Context, id string, tags map[string]string) error
	RemoveVPCTags(ctx context.Context, id string, keys []string) error
	UpdateSubnetTags(ctx context.Context, id string, tags map[string]string) error
	RemoveSubnetTags(ctx context.Context, id string, keys []string) error
	UpdateSecurityGroupTags(ctx context.Context, id string, tags map[string]string) error
	RemoveSecurityGroupTags(ctx context.Context, id string, keys []string) error
}

Networking is the interface that networking provider implementations must satisfy.

type PeeringConfig added in v1.2.0

type PeeringConfig struct {
	RequesterVPC string
	AccepterVPC  string
	Tags         map[string]string
}

PeeringConfig configures a peering connection.

type PeeringConnection added in v1.2.0

type PeeringConnection struct {
	ID           string
	RequesterVPC string
	AccepterVPC  string
	Status       string // "pending-acceptance", "active", "rejected", "deleted"
	CreatedAt    string
	Tags         map[string]string
}

PeeringConnection represents a VPC peering connection.

type Route added in v1.2.0

type Route struct {
	DestinationCIDR string
	TargetID        string // gateway ID, NAT gateway ID, peering connection ID, etc.
	TargetType      string // "gateway", "nat-gateway", "peering", "local"
	State           string // "active", "blackhole"
}

Route represents a route in a route table.

type RouteTable added in v1.2.0

type RouteTable struct {
	ID     string
	VPCID  string
	Routes []Route
	Tags   map[string]string
}

RouteTable represents a route table.

type RouteTableAssociation added in v1.3.2

type RouteTableAssociation struct {
	ID           string
	RouteTableID string
	SubnetID     string
}

RouteTableAssociation represents an association between a route table and a subnet.

type RouteTableConfig added in v1.2.0

type RouteTableConfig struct {
	VPCID string
	Tags  map[string]string
}

RouteTableConfig configures a route table.

type SecurityGroupConfig

type SecurityGroupConfig struct {
	Name        string
	Description string
	VPCID       string
	Tags        map[string]string
}

SecurityGroupConfig describes a security group to create.

type SecurityGroupInfo

type SecurityGroupInfo struct {
	ID           string
	Name         string
	Description  string
	VPCID        string
	IngressRules []SecurityRule
	EgressRules  []SecurityRule
	Tags         map[string]string
}

SecurityGroupInfo describes a security group.

type SecurityRule

type SecurityRule struct {
	Protocol string // "tcp", "udp", "icmp", "-1" (all)
	FromPort int
	ToPort   int
	CIDR     string
}

SecurityRule describes a security group rule.

type SubnetConfig

type SubnetConfig struct {
	VPCID            string
	CIDRBlock        string
	AvailabilityZone string
	Tags             map[string]string
}

SubnetConfig describes a subnet to create.

type SubnetInfo

type SubnetInfo struct {
	ID               string
	VPCID            string
	CIDRBlock        string
	AvailabilityZone string
	State            string
	Tags             map[string]string
}

SubnetInfo describes a subnet.

type VPCConfig

type VPCConfig struct {
	CIDRBlock string
	Tags      map[string]string
}

VPCConfig describes a VPC to create.

type VPCEndpoint added in v1.4.0

type VPCEndpoint struct {
	ID               string
	VPCID            string
	ServiceName      string
	EndpointType     string
	State            string // "available", "pending", "deleting"
	SubnetIDs        []string
	SecurityGroupIDs []string
	RouteTableIDs    []string
	Tags             map[string]string
	CreatedAt        string
}

VPCEndpoint describes a VPC endpoint.

type VPCEndpointConfig added in v1.4.0

type VPCEndpointConfig struct {
	VPCID            string
	ServiceName      string
	EndpointType     string // "Gateway" or "Interface"
	SubnetIDs        []string
	SecurityGroupIDs []string
	RouteTableIDs    []string
	Tags             map[string]string
}

VPCEndpointConfig describes a VPC endpoint to create.

type VPCInfo

type VPCInfo struct {
	ID        string
	CIDRBlock string
	State     string
	Tags      map[string]string
}

VPCInfo describes a VPC.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL