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

gce

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

Endly Google Compute Engine Service

Provides ability to call operations on *compute.Service client

Usage


var request = &gce.CallRequest{
             			Credentials: "gce",
             			Service:     "Instances",
             			Method:      "Get",
             			Parameters:  []interface{}{"myproject", "us-west1-b", "instance-1"},
             		}
var response = &gce.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='gce' -a=call

Endly inline workflow

endly -r=start

@start.yaml

pipeline:
  gce-up:
    credentials: gce
    action: gce:call
    service: Instances
    method: Get
    parameters:
      - myproject
      - us-west1-b
      - instance-1
Service Id Action Description Request Response
gce call run gce operation CallRequest CallResponse

'call' action's service, method and paramters are proxied to GCE client

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

@start.yaml

pipeline:
  gce-up:
    workflow: cloud/gce
    tasks: start
    gceCredential: gce
    gceProject: abstractmeta-p1
    gceZone: us-west1-b
    gceInstance: instance-1

Documentation

Index

Constants

View Source
const (
	//ServiceID represents cce service id.
	ServiceID = "gce"
)

Variables

This section is empty.

Functions

func GetComputeService

func GetComputeService(client *compute.Service, service string) (interface{}, error)

GetComputeService returns specialised compute service for provided service name.

func New

func New() endly.Service

New creates a new NoOperation service.

func NewComputeService

func NewComputeService(credConfig *cred.Config) (*compute.Service, netcontext.Context, error)

NewComputeService creates a new compute service.

Types

type CallRequest

type CallRequest struct {
	Credentials string `required:"true" description:"path to secret json file"` //path to secret json file.
	Service     string ``                                                       //field representing service on *compute.Service, for instance Instance field points to  *compute.InstancesService
	/* 142-byte string literal not displayed */
	Method     string        `required:"true" description:"method on cloud service, for instance, Get, Start"` //method on cloud service, for instance, Get, Start
	Parameters []interface{} `required:"true" description:"actual method parameters"`                          //actual method parameters
}

CallRequest represents GCE call request, it operates on *cloud.Service client (https://cloud.google.com/compute/docs/reference/latest/)

func (*CallRequest) Validate

func (r *CallRequest) Validate() error

Validate checks if request is valid

type CallResponse

type CallResponse interface{}

CallResponse represents GCE call response

Jump to

Keyboard shortcuts

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