Documentation ¶
Index ¶
- func GetAllBranchENIsByAccountRegion(ctx context.Context, tx *sql.Tx, accountID, region string) ([]string, error)
- func GetAndLockAssignmentByID(ctx context.Context, tx *sql.Tx, id int) (*data.Assignment, error)
- func GetAndLockAssignmentByTaskID(ctx context.Context, tx *sql.Tx, taskID string) (*data.Assignment, bool, error)
- func GetAssignedStaticIPAddressByTaskID(ctx context.Context, tx *sql.Tx, taskID string) (*data.StaticIPAddress, error)
- func GetAvailableElasticAddressByAllocationIDsAndLock(ctx context.Context, tx *sql.Tx, accountID string, borderGroup string, ...) (*api.ElasticAddress, error)
- func GetAvailableElasticAddressByGroupAndLock(ctx context.Context, tx *sql.Tx, accountID string, borderGroup string, ...) (*api.ElasticAddress, error)
- func GetBorderGroupByAzAndAccount(ctx context.Context, tx *sql.Tx, az string, accountID string) (string, error)
- func GetBranchENI(ctx context.Context, tx *sql.Tx, branchENI string) (*api.NetworkInterface, error)
- func GetCIDRBySubnet(ctx context.Context, tx *sql.Tx, subnetID string) (net.IP, *net.IPNet, error)
- func GetClassIDByAssignmentID(ctx context.Context, tx *sql.Tx, assignmentID int) (uint32, error)
- func GetElasticAddressByTaskID(ctx context.Context, tx *sql.Tx, taskID string) (*api.ElasticAddress, error)
- func GetElasticIPAttachmentByTaskID(ctx context.Context, tx *sql.Tx, taskID string) (*data.ElasticIPAttachment, error)
- func GetLeastUsedSubnet(ctx context.Context, tx *sql.Tx, az, accountID string, subnetIDs []string) (*data.Subnet, error)
- func GetOldestAvailableIPv4(ctx context.Context, tx *sql.Tx, ips []string, vpcID string) (string, error)
- func GetSecurityGroupsAndLockBranchENI(ctx context.Context, tx *sql.Tx, branchENI string) ([]string, error)
- func GetStaticAllocationByID(ctx context.Context, tx *sql.Tx, id string) (*data.StaticAllocation, error)
- func GetStaticAllocationByIDAndLock(ctx context.Context, tx *sql.Tx, id string) (*data.StaticAllocation, error)
- func GetStaticIPv4Addresses(ctx context.Context, tx *sql.Tx, ips []string, subnetID string) ([]string, error)
- func GetTrunkENI(ctx context.Context, tx *sql.Tx, trunkENI string) (*api.NetworkInterface, error)
- func GetUnassignedBranchENI(ctx context.Context, tx *sql.Tx, subnet, trunkENI string, random bool) (*data.BranchENI, error)
- func GetUsedIPv4AddressesByENIAssociation(ctx context.Context, tx *sql.Tx, branchENIAssociationID string) (sets.String, error)
- func GetVpcIDAndBranchENIByAssociationID(ctx context.Context, tx *sql.Tx, associationID string) (string, string, error)
- func Migrate(ctx context.Context, db *sql.DB) error
- func MigrateTo(ctx context.Context, db *sql.DB, to uint, check bool) error
- func NeedsMigration(ctx context.Context, db *sql.DB) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAndLockAssignmentByID ¶
Get the assignment and lock
func GetAndLockAssignmentByTaskID ¶
func GetAndLockAssignmentByTaskID(ctx context.Context, tx *sql.Tx, taskID string) (*data.Assignment, bool, error)
Returns (Assignment, completed, error) and lock the assignment row until the
func GetAssignedStaticIPAddressByTaskID ¶
func GetAssignedStaticIPAddressByTaskID(ctx context.Context, tx *sql.Tx, taskID string) (*data.StaticIPAddress, error)
Given a task ID, get the static IP assigned to the task
func GetAvailableElasticAddressByAllocationIDsAndLock ¶
func GetAvailableElasticAddressByAllocationIDsAndLock( ctx context.Context, tx *sql.Tx, accountID string, borderGroup string, allocationIDs []string) (*api.ElasticAddress, error)
Get one available elastic IP from the given allocationID list Also lock the IP until the end of given transaction.
func GetAvailableElasticAddressByGroupAndLock ¶
func GetAvailableElasticAddressByGroupAndLock( ctx context.Context, tx *sql.Tx, accountID string, borderGroup string, groupName string) (*api.ElasticAddress, error)
Get one available elastic IP from the given group Also lock the IP until the end of given transaction.
func GetBranchENI ¶
func GetCIDRBySubnet ¶
func GetLeastUsedSubnet ¶
func GetLeastUsedSubnet(ctx context.Context, tx *sql.Tx, az, accountID string, subnetIDs []string) (*data.Subnet, error)
Get the least used subnet (i.e. subnet with the least number of IPs) in the given subnetIDs. If the given subnetIDs is empty, then get the least used subnet by the given accountID
func GetOldestAvailableIPv4 ¶
func GetOldestAvailableIPv4(ctx context.Context, tx *sql.Tx, ips []string, vpcID string) (string, error)
For the given list of IPs, find an available one with the oldest last_seen value
func GetSecurityGroupsAndLockBranchENI ¶
func GetSecurityGroupsAndLockBranchENI(ctx context.Context, tx *sql.Tx, branchENI string) ([]string, error)
Get security groups of the given branch ENI and lock the row
func GetStaticAllocationByID ¶
func GetStaticAllocationByIDAndLock ¶
func GetStaticAllocationByIDAndLock(ctx context.Context, tx *sql.Tx, id string) (*data.StaticAllocation, error)
Get the static allocation by ID and lock the row until the end of the given transaction
func GetStaticIPv4Addresses ¶
func GetStaticIPv4Addresses( ctx context.Context, tx *sql.Tx, ips []string, subnetID string) ([]string, error)
For the given IPv4 addresses, find those are static IPs and return
func GetTrunkENI ¶
func GetUnassignedBranchENI ¶
func GetUnassignedBranchENI(ctx context.Context, tx *sql.Tx, subnet, trunkENI string, random bool) (*data.BranchENI, error)
Get one branch ENI that is not assigned to any container random: If true, select a random unassigned branch ENI. Otherwise, select the oldest one.
func GetUsedIPv4AddressesByENIAssociation ¶
func GetUsedIPv4AddressesByENIAssociation( ctx context.Context, tx *sql.Tx, branchENIAssociationID string) (sets.String, error)
Get all IPv4 addresses of the given ENI assocation that are already assigned to continers.
Types ¶
This section is empty.