types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

func Int

func Int(i int) *int

func String

func String(s string) *string

func ToBool

func ToBool(b *bool) bool

func ToInt

func ToInt(i *int) int

func ToString

func ToString(s *string) string

Types

type DynamoUUID

type DynamoUUID struct {
	uuid.UUID
}

func NewUUID

func NewUUID() *DynamoUUID

func (*DynamoUUID) MarshalDynamoDBAttributeValue

func (u *DynamoUUID) MarshalDynamoDBAttributeValue() (dynatypes.AttributeValue, error)

func (*DynamoUUID) UnmarshalDynamoDBAttributeValue

func (u *DynamoUUID) UnmarshalDynamoDBAttributeValue(av types.AttributeValue) error

type ErrorResponse

type ErrorResponse struct {
	Errors map[string]string `json:"errors"`
}

func NewSingleErrorResponse

func NewSingleErrorResponse(message string) *ErrorResponse

type EventType

type EventType string
const (
	CreateNetwork EventType = "create_network"
	CheckNework   EventType = "check_network"
	DeleteNetwork EventType = "delete_network"
	QueryNetwork  EventType = "query_network"
)

type Network

type Network struct {
	ID          *DynamoUUID `json:"id" dynamodbav:"id"`
	Provider    string      `json:"provider" dynamodbav:"provider"`
	Region      string      `json:"region" dynamodbav:"region"`
	Account     string      `json:"account" dynamodbav:"account"`
	Environment string      `json:"environment" dynamodbav:"environment"`
	CIDR        string      `json:"cidr" dynamodbav:"cidr"`

	VpcID string `json:"vpcID" dynamodbav:"vpcID"`
	Info  string `json:"info" dynamodbav:"info"`

	AttachTGW     bool `json:"attachTGW,omitempty" dynamodbav:"attachTGW"`
	PrivateSubnet bool `json:"privateSubnet,omitempty" dynamodbav:"privateSubnet"`
	PublicSubnet  bool `json:"publicSubnet,omitempty" dynamodbav:"publicSubnet"`
	Legacy        bool `json:"legacy,omitempty" dynamodbav:"legacy"`
	Reserved      bool `json:"reserved,omitempty" dynamodbav:"reserved"`
}

SortKey: Provider#[Region]#[Account]#[Environment]#[CIDR]

func (Network) IPPrefix

func (n Network) IPPrefix() netaddr.IPPrefix

func (Network) Network

func (n Network) Network() net.IPNet

func (Network) String

func (n Network) String() string

type NetworkListResponse

type NetworkListResponse struct {
	Items []*Network `json:"items"`
}

type NetworkRequest

type NetworkRequest struct {
	Account     string `json:"account" validate:"required"`
	PoolID      string `json:"poolID" validate:"required"`
	Provider    string `json:"provider" validate:"required"`
	Environment string `json:"environment" validate:"required"`

	Info string `json:"info,omitempty" validate:"omitempty"`

	SubnetSize int `json:"subnetSize" validate:"required_without_all=Reserved Legacy,omitempty,max=24,min=16"`

	AttachTGW     *bool `json:"attachTGW,omitempty" validate:"required"`
	PrivateSubnet *bool `json:"privateSubnet,omitempty" validate:"required"`
	PublicSubnet  *bool `json:"publicSubnet,omitempty" validate:"required"`
	Legacy        *bool `json:"legacy,omitempty" validate:"omitempty"`

	Reserved *bool  `json:"reserved,omitempty" validate:"omitempty"`
	CIDR     string `json:"cidr,omitempty" validate:"excluded_without_all=Reserved Legacy,omitempty,cidr"`
}

type NetworkResponse

type NetworkResponse struct {
	Network *Network                 `json:"network"`
	Webhook *ProviderWebhookResponse `json:"webhook,omitempty"`
}

type NetworkUpdateRequest

type NetworkUpdateRequest struct {
	VpcID *string `json:"vpcID,omitempty"`
	Info  *string `json:"info,omitempty"`
}

type Pool

type Pool struct {
	ID          *DynamoUUID `json:"id" dynamodbav:"id"`
	Name        string      `json:"name" dynamodbav:"name"`
	Region      string      `json:"region" dynamodbav:"region"`
	SubnetIP    string      `json:"subnetIP" dynamodbav:"cidr"`
	SubnetMask  *int        `json:"subnetMask,omitempty" dynamodbav:"subnetMask"`
	SubnetMaxIP *string     `json:"subnetMaxIP,omitempty" dynamodbav:"subnetMaxIP"`
}

func (Pool) Network

func (p Pool) Network() netaddr.IP

func (Pool) Range

func (p Pool) Range() netaddr.IPRange

type PoolListResponse

type PoolListResponse struct {
	Items []*Pool `json:"items"`
}

type PoolRequest

type PoolRequest struct {
	Name        string  `json:"name" validate:"required"`
	Region      string  `json:"region" validate:"required"`
	SubnetIP    string  `json:"subnetIP" validate:"required,ip"`
	SubnetMask  *int    `json:"subnetMask,omitempty" validate:"omitempty,max=24,min=8"`
	SubnetMaxIP *string `json:"subnetMaxIP,omitempty" validate:"required_without=SubnetMask,excluded_with=SubnetMask,omitempty,ip"`
}

type Provider

type Provider struct {
	ID         *DynamoUUID `json:"id" dynamodbav:"id"`
	Name       string      `json:"name" dynamodbav:"name"`
	WebhookURL string      `json:"webhookURL" dynamodbav:"webhookURL"`
	APIToken   string      `json:"apiToken" dynamodbav:"apiToken"`
}

type ProviderListResponse

type ProviderListResponse struct {
	Items []*Provider `json:"items"`
}

type ProviderRequest

type ProviderRequest struct {
	Name       string `json:"name" validate:"required"`
	WebhookURL string `json:"webhookURL" validate:"required"`
	APIToken   string `json:"apiToken" validate:"required"`
}

type ProviderUpdateRequest

type ProviderUpdateRequest struct {
	WebhookURL *string `json:"vpcID,omitempty"`
	APIToken   *string `json:"info,omitempty"`
}

type ProviderWebhook

type ProviderWebhook struct {
	Event       EventType `json:"event"`
	NetworkID   string    `json:"networkID" validate:"required"`
	Account     string    `json:"account" validate:"required"`
	Region      string    `json:"region" validate:"required"`
	Environment string    `json:"environment" validate:"required"`
	CIDR        string    `json:"cidr" validate:"required_if=Event create_network,omitempty,cidr"`
	Subnets     []*Subnet `json:"subnets,omitempty" validate:"required_if=Event create_network,omitempty"`
}

type ProviderWebhookResponse

type ProviderWebhookResponse struct {
	StatusCode int    `json:"statusCode"`
	ID         string `json:"id"`
}

type Subnet

type Subnet struct {
	Name string     `json:"name"`
	Type SubnetType `json:"type"`
	CIDR string     `json:"cidr"`
}

type SubnetResponse

type SubnetResponse struct {
	Subnets []*Subnet `json:"subnets"`
}

type SubnetType

type SubnetType string
const (
	Private        SubnetType = "private"
	Public         SubnetType = "public"
	TransitGateway SubnetType = "transitGateway"
)

type Version

type Version struct {
	Name      string `json:"name"`
	Version   string `json:"version"`
	CommitID  string `json:"commitID"`
	BuildTime string `json:"buildTime"`
}

Jump to

Keyboard shortcuts

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