Help us shape the future of Go! Take the 2026 Go Developer Survey

ec2

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

Amazon Elastic Compute Cloud Service

Provides ability to call operations on EC2 client

Usage


var request = &ec2.CallRequest{
              		Credentials: "endly-aws-east",
              		Method:      "DescribeInstances",
              		Input: map[string]interface{}{
              			"InstanceIds": []interface{}{
              				"i-0139209d5358e60**",
              			},
              		},
              	}
var response = &ec2.CallResponse{}    
var manager = endly.New()
var context = manager.NewContext(nil)
var err := endly.Run(context, request, response)
if err != nil {
	log.Fatal(err)
}
fmt.Sprintf("%v\n", response);


Endly workflow service action

Run the following command for aws/ec2 service operation details:

endly -s='aws/ec2' -a=call

Endly inline workflow

endly -r=run

@run.yaml

pipeline:
  ec2-up:
    action: aws/ec2:run
    credentials: endly-aws-east
    method: StartInstances
    input:
      instanceIds:
        - i-0139209d5358e60**
    
Service Id Action Description Request Response
aws/ec2 call run ec2 operation CallRequest CallResponse

'call' action's method and input are proxied to EC2 client

Shared/global workflow
 endly -w='cloud/ec2'  -t='?'
  • Run workflow
endly -r=start

@start.yaml

pipeline:
  ec2-up:
    workflow: cloud/ec2
    tasks: start
    ec2InstanceId: i-0139209d5358e60a4
    awsCredential: endly-aws-west

@stop.yaml

pipeline:
  ec2-down:
    workflow: cloud/ec2
    tasks: stop
    ec2InstanceId: i-0139209d5358e60a4
    awsCredential: endly-aws-west

@restart.yaml


defaults:
  ec2InstanceId: i-0139209d5358e60a4
  awsCredential: endly-aws-west
pipeline:
  ec2-restart:
    down:
      workflow: cloud/ec2
      tasks: stop
    up:
      workflow: cloud/ec2
      tasks: start
      

Documentation

Index

Constants

View Source
const (
	//ServiceID represents nop service id.
	ServiceID = "aws/ec2"
)

Variables

This section is empty.

Functions

func GetAWSCredentialConfig

func GetAWSCredentialConfig(config *cred.Config) (*aws.Config, error)

GetAWSCredentialConfig returns *aws.Config for provided credential

func GetEc2Client

func GetEc2Client(credConfig *cred.Config) (*ec2.EC2, error)

GetEc2Client creates ec2 client for passed in credential file

func New

func New() endly.Service

New creates a new AWS Ec2 service.

Types

type Call

type Call struct {
	Method     string        `required:"true" description:"ec2 client method name"`
	Parameters []interface{} `required:"true" description:"ec2 client method parameters"`
}

Call represents ec2 call.

type CallRequest

type CallRequest struct {
	Credentials string      `required:"true" description:"ec2 credentials file see more at: github.com/viant/toolbox/cred/config.go"`
	Method      string      `required:"true" description:"ec2 client method name"`
	Input       interface{} `required:"true" description:"ec2 client method input/request"`
}

CallRequest represents a aws EC2 run request to execute method on ec2 client with provided input.

func (*CallRequest) AsCall

func (r *CallRequest) AsCall() *Call

AsCall converts request as Ec2 call

func (*CallRequest) Init added in v0.7.8

func (r *CallRequest) Init() error

Init initialise request

func (*CallRequest) Validate added in v0.7.8

func (r *CallRequest) Validate() error

Init initialise request

type CallResponse

type CallResponse interface{}

CallResponse represents EC2 run response

Jump to

Keyboard shortcuts

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