awsinstance

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package awsinstance will help one in creating/deleting/updating/fetching instances in aws. But this is tailor made for this application if one needs customized result, he/she has to write one similar to this for them by calling the (master) interface. This package is capable of returining both custom response and raw from cloud depending on what you pass.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonComputeInput

type CommonComputeInput struct {
	InstanceIds []string
	VpcId       string
	GetRaw      bool
}

CommonComputeInput implements methods to perform common actions against instances.

func (*CommonComputeInput) GetInstanceFromVpc

GetInstanceFromVpc will help in fetching the information about the instance from the vpc selected.

func (*CommonComputeInput) SearchInstance

func (des *CommonComputeInput) SearchInstance(con aws.EstablishConnectionInput) (bool, error)

SearchInstance will help in finding the existence of the selected instance/vm.

type CommonComputeResponse

type CommonComputeResponse struct {
	InstanceIds []string                     `json:"InstanceIds,omitempty"`
	GetInstRaw  *ec2.DescribeInstancesOutput `json:"DescribeInstRaw,omitempty"`
}

CommonComputeResponse contains the filtered/unfiletred output of instances from aws.

type CreateServerInput

type CreateServerInput struct {
	InstanceName string
	ImageId      string
	InstanceType string
	KeyName      string
	MaxCount     int64
	MinCount     int64
	SubnetId     string
	SecGroupId   string
	UserData     string
	AssignPubIp  bool
	GetRaw       bool
}

CreateServerInput will implement the methods for creating instances and holds the value for the same.

func (*CreateServerInput) CreateServer

func (csrv *CreateServerInput) CreateServer(con aws.EstablishConnectionInput) ([]ServerResponse, error)

CreateServer will help in creating instances/vms with the configuration passed.

type DeleteServerInput

type DeleteServerInput struct {
	VpcId       string
	InstanceIds []string
	GetRaw      bool
}

DeleteServerInput will implement the methods to delete servers/vm and other related activities.

func (*DeleteServerInput) DeleteServer

DeleteServer will delete the server who's Id was selected.

func (*DeleteServerInput) DeleteServerFromVpc

func (d *DeleteServerInput) DeleteServerFromVpc(con aws.EstablishConnectionInput) ([]ServerResponse, error)

DeleteServerFromVpc deletes every single instances from the vpc selected.

type DescribeInstanceInput

type DescribeInstanceInput struct {
	InstanceIds []string
	VpcIds      []string
	SubnetIds   []string
	Filters     Filters
	GetRaw      bool
}

DescribeInstanceInput implements various methods such as GetServersFromNetwork, GetServersFromSubnet, GetAllServers and GetServersDetails.

func (*DescribeInstanceInput) GetAllServers

GetAllServers will fetch information of all the servers from a particular region.

func (*DescribeInstanceInput) GetServersDetails

GetServersDetails will fetch the details of the random servers selected.

func (*DescribeInstanceInput) GetServersFromNetwork

func (d *DescribeInstanceInput) GetServersFromNetwork(con aws.EstablishConnectionInput) ([]ServerResponse, error)

GetServersFromNetwork is tailored to fectch the servers from network, to fetch the data one has to pass either subnet-id else vpc-id to filters to make the life easy.

func (*DescribeInstanceInput) GetServersFromSubnet

func (d *DescribeInstanceInput) GetServersFromSubnet(con aws.EstablishConnectionInput) ([]ServerResponse, error)

GetServersFromSubnet will help in fetching the details of the server from the particular subnetwork paseed/selected.

type Filters

type Filters struct {
	Name  string
	Value []string
}

Filters holds the value for the filter to be applied on the servers.

type ServerResponse

type ServerResponse struct {
	InstanceName        string                        `json:"InstanceName,omitempty"`
	InstanceId          string                        `json:"InstanceId,omitempty"`
	SubnetId            string                        `json:"SubnetId,omitempty"`
	PrivateIpAddress    string                        `json:"IpAddress,omitempty"`
	PublicIpAddress     string                        `json:"PublicIpAddress,omitempty"`
	PrivateDnsName      string                        `json:"PrivateDnsName,omitempty"`
	CreatedOn           string                        `json:"CreatedOn,omitempty"`
	State               string                        `json:"State,omitempty"`
	InstanceDeleteState string                        `json:"InstanceDeleteState,omitempty"`
	InstanceType        string                        `json:"InstanceType,omitempty"`
	Cloud               string                        `json:"Cloud,omitempty"`
	Region              string                        `json:"Region,omitempty"`
	PreviousState       string                        `json:"PreviousState,omitempty"`
	CurrentState        string                        `json:"CurrentState,omitempty"`
	DefaultResponse     interface{}                   `json:"DefaultResponse,omitempty"`
	Error               error                         `json:"Error,omitempty"`
	CreateInstRaw       *ec2.DescribeInstancesOutput  `json:"CreateInstRaw,omitempty"`
	GetInstRaw          *ec2.DescribeInstancesOutput  `json:"DescribeInstRaw,omitempty"`
	DeleteInstRaw       *ec2.TerminateInstancesOutput `json:"DeleteInstRaw,omitempty"`
	StartInstRaw        *ec2.StartInstancesOutput     `json:"StartInstRaw,omitempty"`
	StopInstRaw         *ec2.StopInstancesOutput      `json:"StopInstRaw,omitempty"`
	CreateImgRaw        *ec2.CreateImageOutput        `json:"CreateImgRaw,omitempty"`
	DescribeImg         *ec2.DescribeImagesOutput     `json:"DescribeImg,omitempty"`
}

ServerResponse holds the filtered/unfiltered output of CreateServer from aws.

type UpdateServerInput

type UpdateServerInput struct {
	InstanceIds []string `json:"InstanceIds,omitempty"`
	Action      string
	GetRaw      bool
}

UpdateServerInput implements UpdateServer and other related activities, it holds all necessary details to update server.

func (*UpdateServerInput) UpdateServer

UpdateServer updates the server (start/stop and other operations).

Jump to

Keyboard shortcuts

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