internal

package
v1.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIPv4Url = "http://ipv4.icanhazip.com"
)

Variables

View Source
var (
	// ErrInvalidParams is an error type to use when passed arguments are invalid.
	ErrInvalidParams = errors.New("[err] invalid params")
	// ErrUnknown is an error type to use when error reason doesn't know.
	ErrUnknown = errors.New("[err] unknown")
)

Functions

func AddDataLimitAccessKey

func AddDataLimitAccessKey(region string, id int, limit int) error

func AskCreateDefaultSubnet

func AskCreateDefaultSubnet() (string, error)

It receives input from the user whether or not to create a default subnet.

func AskCreateDefaultVpc

func AskCreateDefaultVpc() (string, error)

func AskDeleteTagSubnet

func AskDeleteTagSubnet() (string, error)

Get a response from the user asking if they want to delete the govpn-subnet.

func AskDeleteTagVpc

func AskDeleteTagVpc() (string, error)

func AskNewTfVars

func AskNewTfVars(region, az, instanceType, ami string) (string, error)

func AskPrompt

func AskPrompt(Message, AnswerOne, AnswerTwo string) (string, error)

func AskPromptOptionList

func AskPromptOptionList(Message string, Options []string, size int) (string, error)

func AskTerraformExecution

func AskTerraformExecution(Message string) (string, error)

func CallProcess

func CallProcess(process string, args ...string) error

func CheckOutlineConnect

func CheckOutlineConnect(instance *EC2) (bool, error)

func CreateKeyDotTf

func CreateKeyDotTf(workSpacePath string) error

func CreateMainDotTf

func CreateMainDotTf(workSpacePath string, region, ami, instanceType, az string) error

func CreateOutputDotTf

func CreateOutputDotTf(workSpacePath string) error

func CreateProviderDotTf

func CreateProviderDotTf(workSpacePath string, region string) error

func CreateStartSession

func CreateStartSession(ctx context.Context, cfg aws.Config, input *ssm.StartSessionInput) (*ssm.StartSessionOutput, error)

func CreateTags

func CreateTags(ctx context.Context, cfg aws.Config, id *string, tagName string) error

func CreateTf

func CreateTf(workSpacePath string, region, ami, instanceType, az string) error

func CreateWorkspace

func CreateWorkspace(ctx context.Context, execPath, _defaultTerraformPath, regionName string) error

func DeleteAccessKey

func DeleteAccessKey(region string, id string) error

func DeleteDataLimitAccessKey

func DeleteDataLimitAccessKey(region string, id int) error

func DeleteIgws

func DeleteIgws(ctx context.Context, cfg aws.Config, vpcId string) (bool, error)

func DeleteKeyPair

func DeleteKeyPair() error

func DeleteSubnets

func DeleteSubnets(ctx context.Context, cfg aws.Config, vpcId string) (bool, error)

func DeleteTagSubnet

func DeleteTagSubnet(ctx context.Context, cfg aws.Config, subnetId string) (bool, error)

Delete the tagged subnet.

func DeleteTagVpc

func DeleteTagVpc(ctx context.Context, cfg aws.Config, vpcId string) (bool, error)

func ExistsKeyPair

func ExistsKeyPair() bool

func FindTagInstance

func FindTagInstance(ctx context.Context, cfg aws.Config) ([]string, error)

func GetApiURL

func GetApiURL(region string) (string, error)

func GetAsset

func GetAsset(filename string) ([]byte, error)

func GetCertSha256

func GetCertSha256(region string) (string, error)

func GetPublicIP added in v1.0.16

func GetPublicIP() (string, error)

func GetSSMPlugin

func GetSSMPlugin() ([]byte, error)

func GetSSMPluginName

func GetSSMPluginName() string

func GetWorkspaceList added in v1.0.18

func GetWorkspaceList(ctx context.Context, execPath, _defaultTerraformPath string) ([]string, error)

func NewConfig

func NewConfig(ctx context.Context, key, secret, session, region, roleArn string) (aws.Config, error)

func NewSharedConfig

func NewSharedConfig(ctx context.Context, profile string, sharedConfigFiles, sharedCredentialsFiles []string) (aws.Config, error)

func PrintProvisioning

func PrintProvisioning(cmd, title, content string)

func PrintReady

func PrintReady(cmd, region, title, content string)

func RenameAccessKey

func RenameAccessKey(region string, id int, name string) error

func ReturnTerraformPath added in v1.0.21

func ReturnTerraformPath(region string) string

func SaveTerraformVariable

func SaveTerraformVariable(jsonData map[string]interface{}, jsonFilePath string) (string, error)

func SetRoot

func SetRoot(execPath, terraformPath string) (*tfexec.Terraform, error)

func TerraformReady

func TerraformReady(ctx context.Context, ver string) (string, error)

func ValidateOutlineJson added in v1.0.18

func ValidateOutlineJson(ctx context.Context, terraformVersion, _defaultTerraformPath string) ([]string, error)

func WrapArgsError added in v1.0.18

func WrapArgsError(argFn cobra.PositionalArgs) cobra.PositionalArgs

func WrapError

func WrapError(err error) error

WrapError wraps error.

Types

type AccessKey

type AccessKey struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Password  string `json:"password"`
	Port      int    `json:"port"`
	Method    string `json:"method"`
	DataLimit DataLimit
	AccessURL string `json:"accessUrl"`
}

func CreateAccessKey

func CreateAccessKey(region string) (*AccessKey, error)

type AccessKeys

type AccessKeys struct {
	Keys []AccessKey `json:"accessKeys"`
}

func GetAccessKeys

func GetAccessKeys(region string) (*AccessKeys, error)

func (*AccessKeys) GetAccessUrlList

func (l *AccessKeys) GetAccessUrlList() []string

type Ami

type Ami struct {
	Name          string
	ImageLocation string
}

func AskAmi

func AskAmi(ctx context.Context, cfg aws.Config) (*Ami, error)

type AvailabilityZone

type AvailabilityZone struct {
	Name string
}

func AskAvailabilityZone

func AskAvailabilityZone(ctx context.Context, cfg aws.Config) (*AvailabilityZone, error)

type DataLimit

type DataLimit struct {
	Bytes int `json:"bytes"`
}

type DefaultSubnet

type DefaultSubnet struct {
	New       bool   // Indicates whether to create a new subnet.
	Existence bool   // Indicates whether a default subnet exists.
	ID        string // Save the id value of the default subnet.
}

A struct with information about the default subnet.

func CreateDefaultSubnet

func CreateDefaultSubnet(ctx context.Context, cfg aws.Config, az string) (*DefaultSubnet, error)

Create a default subnet.

func ExistsDefaultSubnet

func ExistsDefaultSubnet(ctx context.Context, cfg aws.Config, az string) (*DefaultSubnet, error)

Make sure the default subnet exists.

func ExistsTagSubnet

func ExistsTagSubnet(ctx context.Context, cfg aws.Config) (*DefaultSubnet, error)

Verify that tagged subnets exist.

type DefaultVpc

type DefaultVpc struct {
	New       bool
	Existence bool
	Id        string
}

func CreateDefaultVpc

func CreateDefaultVpc(ctx context.Context, cfg aws.Config) (*DefaultVpc, error)

func ExistsDefaultVpc

func ExistsDefaultVpc(ctx context.Context, cfg aws.Config) (*DefaultVpc, error)

func ExistsTagVpc

func ExistsTagVpc(ctx context.Context, cfg aws.Config) (*DefaultVpc, error)

type DetectVariable

type DetectVariable struct {
	Region           string
	AvailabilityZone string
	InstanceType     string
	Ami              string
}

type EC2

type EC2 struct {
	Existence     bool
	Id            string
	PublicIP      string
	LaunchTime    time.Time
	InstanceType  string
	Region        string
	PublicDomain  string
	PrivateDomain string
}

func FindSpecificTagInstance

func FindSpecificTagInstance(ctx context.Context, cfg aws.Config, region string) (*EC2, error)

func (*EC2) GetID

func (ec2 *EC2) GetID() string

func (*EC2) GetInstanceType

func (ec2 *EC2) GetInstanceType() string

func (*EC2) GetLaunchTime

func (ec2 *EC2) GetLaunchTime() string

func (*EC2) GetPrivateDomain

func (ec2 *EC2) GetPrivateDomain() string

func (*EC2) GetPublicDomain

func (ec2 *EC2) GetPublicDomain() string

func (*EC2) GetPublicIP

func (ec2 *EC2) GetPublicIP() string

func (*EC2) GetRegion

func (ec2 *EC2) GetRegion() string

type InstanceType

type InstanceType struct {
	Name string
}

func AskInstanceType

func AskInstanceType(ctx context.Context, cfg aws.Config, az string) (*InstanceType, error)

type OutlineInfo

type OutlineInfo struct {
	ManagementUdpPort int    `json:"ManagementUdpPort"`
	VpnTcpUdpPort     int    `json:"VpnTcpUdpPort"`
	ApiURL            string `json:"ApiUrl"`
	CertSha256        string `json:"CertSha256"`
}

type Region

type Region struct {
	Name string
}

func AskRegion

func AskRegion(ctx context.Context, cfg aws.Config) (*Region, error)

type Target

type Target struct {
	Name          string
	PublicDomain  string
	PrivateDomain string
}

type Workspace

type Workspace struct {
	Now       string
	List      []string
	Session   bool
	Existence bool
	Path      string
}

func ExistsWorkspace

func ExistsWorkspace(ctx context.Context, execPath, _defaultTerraformPath, regionName string) (*Workspace, error)

func SelectWorkspace

func SelectWorkspace(ctx context.Context, execPath, _defaultTerraformPath, regionName string, workspace *Workspace) (*Workspace, error)

Jump to

Keyboard shortcuts

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