Documentation
¶
Index ¶
- func Apply(m Manager, change *AttachmentChange) error
- func ApplyAll(m Manager, changes []*AttachmentChange) error
- func VerifyNoOverlap(subnets []*CIDR) error
- type Allocation
- type Attachment
- type AttachmentChange
- type AttachmentID
- type CIDR
- type ChangeAction
- type Config
- func (c *Config) Allocations() (allocations []*Allocation)
- func (c *Config) ListSubnets() (subnets []*CIDR)
- func (c *Config) ListSubnetsByRegion() map[string][]*CIDR
- func (c *Config) ListSupernets() (supernets []*CIDR)
- func (c *Config) ListSupernetsByRegion() map[string][]*CIDR
- func (c *Config) Validate() error
- type EC2API
- type Gateway
- type Manager
- type Route
- type Supernet
- type Team
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAll ¶
func ApplyAll(m Manager, changes []*AttachmentChange) error
ApplyAll performs an Apply for all the provided changes.
func VerifyNoOverlap ¶
VerifyNoOverlap takes a list of subnets and verifies that none of them are overlapping. Adapted from: https://github.com/apparentlymart/go-cidr/blob/master/cidr/cidr.go#L126
Types ¶
type Allocation ¶
type Allocation struct {
Name string `yaml:"name"`
Owner string `yaml:"id"`
CIDRs map[string][]*CIDR `yaml:"cidrs"`
}
Allocation represents a cloud connect CIDR allocation.
type Attachment ¶
type Attachment struct {
// ID is the AttachmentID for the attachment.
ID AttachmentID
// Owner is the account ID of the owning account.
Owner string
// Type of attachment, e.g. VPC or direct-connect.
Type string
// State of the attachment. E.g. pendingApproval, or available.
State string
// Created time for the attachment.
Created time.Time
// Tags contains a map of the tags for the attachment.
Tags map[string]string
}
Attachment represents an attachment in transit gateway.
type AttachmentChange ¶
type AttachmentChange struct {
// Action denotes the change that is being made.
Action ChangeAction
// Reason contains additional information about the reason for the change.
Reason string
// Allocation holds a pointer to an allocation if it exists, as such
// a nil check should be performed before using this value.
Allocation *Allocation
// Attachment is an embedded pointer to the attachment subject to change.
*Attachment
}
AttachmentChange represents a planned change for a transit gateway attachment.
func Plan ¶
func Plan(m Manager, a *Attachment, allocations []*Allocation, region string) (*AttachmentChange, error)
Plan changes for a single attachment based on the supplied allocations.
func PlanAll ¶
func PlanAll(m Manager, attachments []*Attachment, allocations []*Allocation, region string) ([]*AttachmentChange, error)
PlanAll generates a plan for all the given attachments.
type CIDR ¶
CIDR is a wrapper around net.IPNet that supports YAML (un)marshalling.
func (*CIDR) AddressCount ¶
AddressCount returns the number of IP addresses in the CIDR block.
type ChangeAction ¶
type ChangeAction string
const ( ApproveAttachment ChangeAction = "APPROVE" RejectAttachment ChangeAction = "REJECT" DeleteAttachment ChangeAction = "DELETE" TagAttachment ChangeAction = "TAG" NoOp ChangeAction = "NONE" )
type Config ¶
type Config struct {
Gateways map[string]*Gateway `yaml:"gateways"`
Supernets []*Supernet `yaml:"supernets"`
Teams []*Team `yaml:"teams"`
}
Config represents the configuration for a cloud connect environment. Including which network ranges are approved, and CIDR allocations for teams and their accounts.
func (*Config) Allocations ¶
func (c *Config) Allocations() (allocations []*Allocation)
Allocations returns the allocations as a list.
func (*Config) ListSubnets ¶
ListSubnets returns a list of the reserved subnets.
func (*Config) ListSubnetsByRegion ¶
ListSubnetsByRegion returns a map of the reserved subnets per region.
func (*Config) ListSupernets ¶
ListSupernets returns a list of the configured supernets.
func (*Config) ListSupernetsByRegion ¶
ListSupernetsByRegion returns a map of the configured supernets per region.
type EC2API ¶
type EC2API interface {
CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error)
SearchTransitGatewayRoutes(*ec2.SearchTransitGatewayRoutesInput) (*ec2.SearchTransitGatewayRoutesOutput, error)
DescribeTransitGatewayAttachments(*ec2.DescribeTransitGatewayAttachmentsInput) (*ec2.DescribeTransitGatewayAttachmentsOutput, error)
AcceptTransitGatewayVpcAttachment(*ec2.AcceptTransitGatewayVpcAttachmentInput) (*ec2.AcceptTransitGatewayVpcAttachmentOutput, error)
RejectTransitGatewayVpcAttachment(*ec2.RejectTransitGatewayVpcAttachmentInput) (*ec2.RejectTransitGatewayVpcAttachmentOutput, error)
DeleteTransitGatewayVpcAttachment(*ec2.DeleteTransitGatewayVpcAttachmentInput) (*ec2.DeleteTransitGatewayVpcAttachmentOutput, error)
}
EC2API wraps the interface for the API and provides a mocked implementation.
type Gateway ¶
type Gateway struct {
ID string `yaml:"transit_gateway_id"`
RouteTableID string `yaml:"route_table_id"`
}
Gateway ...
type Manager ¶
type Manager interface {
ListAttachments() ([]*Attachment, error)
ListAttachmentRoutes(a *Attachment) ([]*Route, error)
SetAttachmentTags(a *Attachment, tags map[string]string) error
ApprovePendingAttachment(a *Attachment) error
RejectPendingAttachment(a *Attachment) error
DeleteAttachment(a *Attachment) error
}
Manager provides an easy API for managing transit gateway.
type Route ¶
type Route struct {
// CIDR represents the destination for the route.
CIDR *CIDR
// Type of route, e.g. static or propagated.
Type string
// State of the route.
State string
// Attachment is the embedded attachment that the route points to.
*Attachment
}
Route represents a route in a transit gateway.
type Supernet ¶
type Supernet struct {
Description string `yaml:"description,omitempty"`
CIDRs map[string][]*CIDR `yaml:"cidrs"`
}
Supernet ...
type Team ¶
type Team struct {
Team string `yaml:"team"`
Accounts []*Allocation `yaml:"accounts"`
}
Team ...
Directories
¶
| Path | Synopsis |
|---|---|
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
cmd
|
|
|
autoapprover
command
|
|
|
cloud-connect
command
|
|
|
internal
|
|
|
autoapprover/autoapproverfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |