gcp

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

README

Google Cloud services

The set of google cloud services provice procy of various google.golang.org/api APIs

Global variables
  • $gcp.projectID: expands with project ID
Usage:

To check all supported method run

     endly -s='gcp/GOOGLE COULD SERVICE'

i.e

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

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

@test.yaml

pipeline:
  start:
    info:
      action: gcp/compute:instancesGet
      logging: false
      credentials: gcp
      zone: us-central1-f
      instance: $instanceId
      project: myProject
      scopes:
        - https://www.googleapis.com/auth/compute
        - https://www.googleapis.com/auth/devstorage.full_control
      urlParams:
        filter: project:* 

The first action for given service has to define service account credentials i.e (~/.secret/gcp.json) Project and scopes are set by default from secrets file, so they can be skipped

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRoutes

func BuildRoutes(service interface{}, nameTransformer func(name string) string, clientProvider func(context *endly.Context) (CtxClient, error)) ([]*endly.Route, error)

func GetClient

func GetClient(eContext *endly.Context, provider, key interface{}, target interface{}, defaultScopes ...string) error

GetClient creates a new google cloud client.

func InitCredentials

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

InitCredentials get or creates aws credential config

func UpdateActionRequest

func UpdateActionRequest(rawRequest map[string]interface{}, config *gcpCredConfig, client CtxClient)

UpdateActionRequest updates raw request with project, service

func Upload

func Upload(httpClient *http.Client, uploadURL string, reader io.Reader) error

Types

type AbstractClient

type AbstractClient struct {
	CredConfig *cred.Config
	HttpClinet *http.Client
	// contains filtered or unexported fields
}

AbstractClient represents an abstract client

func (*AbstractClient) Context

func (c *AbstractClient) Context() context.Context

func (*AbstractClient) SetContext

func (c *AbstractClient) SetContext(ctx context.Context)

func (*AbstractClient) SetCredConfig

func (c *AbstractClient) SetCredConfig(config *cred.Config)

func (*AbstractClient) SetHttpClient

func (c *AbstractClient) SetHttpClient(client *http.Client)

type CtxClient

type CtxClient interface {
	SetContext(ctx context.Context)
	Context() context.Context
	SetService(client interface{}) error
	Service() interface{}
	SetCredConfig(config *cred.Config)
	SetHttpClient(client *http.Client)
}

CtxClient represents generic google cloud service client

type EmptyOutput

type EmptyOutput struct{}

type OutputEvent

type OutputEvent struct {
	Message string
	Tag     string
	Value   interface{}
}

func NewOutputEvent

func NewOutputEvent(message string, tag string, value interface{}) *OutputEvent

func (*OutputEvent) Messages

func (e *OutputEvent) Messages() []*msg.Message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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