service

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	// Name is the name of the instance type
	Name string
	// CPU is the number of cores this instance type has
	CPU int
	// MemoryMiB is the amount of RAM this instance type has
	MemoryMiB int
}

Instance defines an AWS instance type

type KeyPair

type KeyPair struct {
	// Name identifies the key pair
	Name string `json:"name"`
}

KeyPair defines an AWS key pair reference

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func New

func New(accessKey, secretKey, sessionToken string) *Provider

New returns a new instance of the AWS provider

func (*Provider) FindVPCByTag

func (r *Provider) FindVPCByTag(region, key, value string) (*VPC, error)

FindVPCByTag returns the first VPC in region matching the provided tag

func (*Provider) GetAvailabilityZones

func (r *Provider) GetAvailabilityZones(region string) ([]string, error)

GetAvailabilityZones returns a list of available availability zones for the specified region

func (*Provider) GetCIDRBlocks

func (r *Provider) GetCIDRBlocks(region, vpcID string) (vpcBlock string, subnetBlocks []string, err error)

GetCIDRBlocks returns CIDR blocks for the specified VPC and all its subnets

func (*Provider) GetInternetGatewayID

func (r *Provider) GetInternetGatewayID(region, vpcID string) (string, error)

GetInternetGatewayID returns ID of the internet gateway attached to the specified VPC

func (*Provider) GetSubnets

func (r *Provider) GetSubnets(region, vpcID string) ([]Subnet, error)

GetSubnets returns a list of all subnets found in the specified VPC

func (*Provider) Validate

func (r *Provider) Validate(ctx context.Context, probes validation.Probes, policyVersion string) (*ValidateOutput, error)

Validate runs permission validation against the given set of actions (resources) and obtains basic cloud provider metadata.

type Region

type Region struct {
	// Name specifies the region by name
	Name string `json:"name"`
	// Endpoints defines the endpoint for this region
	Endpoint string `json:"endpoint"`
	// VPCs lists the VPCs in this region
	VPCs []VPC `json:"vpcs"`
	// KeyPairs lists the key pairs defined in this region
	KeyPairs []KeyPair `json:"key_pairs"`
}

Region defines an AWS EC2 region

type Subnet

type Subnet struct {
	// ID is the subnet ID
	ID string `json:"subnet_id"`
	// VPCID is the ID of the VPC the subnet is in
	VPCID string `json:"vpc_id"`
	// CIDR is the subnet CIDR block
	CIDR string `json:"cidr_block"`
	// Tags is the subnet tags
	Tags map[string]string `json:"tags"`
}

Subnet is our representation of AWS subnet

type VPC

type VPC struct {
	// ID defines a VPC ID
	ID string `json:"vpc_id"`
	// CIDR defines the cidr address block for this VPC
	CIDR string `json:"cidr_block"`
	// Default defines if this VPC is a default one
	Default bool `json:"is_default"`
	// State describes the VPC state: available or pending
	State string `json:"state"`
	// Tags is the tags attached to this VPC
	Tags map[string]string `json:"tags"`
}

VPC defines an AWS VPC

type ValidateOutput

type ValidateOutput struct {
	// VerificationError defines the result of a failing API key verification.
	// It contains a policy document detailing missing permissions in the format
	// acceptable by AWS APIs
	*VerificationError `json:"verify"`
	// Regions lists all available AWS regions
	Regions []*Region `json:"regions"`
}

ValidateOutput defines the result of running provider validation

func (*ValidateOutput) FilterRegions

func (v *ValidateOutput) FilterRegions(regions []string)

FilterRegions removes the regions which are not a part of the provided list from this validation result

type VerificationError

type VerificationError struct {
	// Actions is a list of missing permissions
	Actions []validation.Action `json:"actions"`
}

VerificationError defines the result of running a permission check to a set of AWS resources for the specified credentials

func (VerificationError) Error

func (e VerificationError) Error() string

Error formats this error as a string so the type implements "error" interface

Jump to

Keyboard shortcuts

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