compute

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Google Cloud Compute Engine Service

This service is google.golang.org/api/compute/v1/compute.Service proxy

To check all supported method run

     endly -s='gcp/compute'

To check method contract run endly -s="gc/compute" -a=methodName

    endly -s="gc/compute" -a='instancesGet'

References:

Usage:
Starting instance
endly -r=start

@start.yaml

init:
  instanceId: 11230632249892XXXXX
pipeline:
  start:
    info:
      action: gcp/compute:instancesGet
      logging: false
      credentials: gc
      zone: us-central1-f
      instance: $instanceId

    print:
      action: print
      message: Instance $instanceId is  $info.Status

    check:
      when: $info.Status = 'RUNNING'
      action: exit

    instanceUp:
      when: $info.Status = 'TERMINATED'
      action: gcp/compute:instancesStart
      logging: false
      zone: us-central1-f
      instance: $instanceId

    waitForStart:
      action: nop
      logging: false
      sleepTimeMs: 5000

    gotoStart:
      action: goto
      task: start
Stoping instance
init:
  instanceId: 11230632249892XXXXX
stop:
    info:
      action: gcp/compute:instancesGet
      logging: false
      credentials: gc
      zone: us-central1-f
      instance: $instanceId

    print:
      action: print
      message: Instance $instanceId is $info.Status

    check:
      when: $info.Status = 'TERMINATED'
      action: exit

    instanceDown:
      when: $info.Status = 'RUNNING'
      action:  gc/compute:instancesStop
      credentials: gc
      zone: us-central1-f
      instance: $instanceId
        
    waitForStop:
      action: nop
      logging: false
      sleepTimeMs: 5000

    gotoStop:
      action: goto
      task: stop

Documentation

Index

Constants

View Source
const (
	//ServiceID Google Cloud Compute Service ID.
	ServiceID = "gcp/compute"
)

Variables

This section is empty.

Functions

func InitRequest

func InitRequest(context *endly.Context, rawRequest map[string]interface{}) error

func New

func New() endly.Service

New creates a new Compute service.

Types

type CtxClient

type CtxClient struct {
	*gcp.AbstractClient
	// contains filtered or unexported fields
}

CtxClient represents context client

func GetClient

func GetClient(context *endly.Context) (*CtxClient, error)

func (*CtxClient) Service

func (s *CtxClient) Service() interface{}

func (*CtxClient) SetService

func (s *CtxClient) SetService(service interface{}) error

Jump to

Keyboard shortcuts

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