gcp

package
v0.77.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 27 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
  • $gcp.serviceAccount: expands with service account
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

View Source
const DefaultRegion = "us-central1"

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 ExpandMeta

func ExpandMeta(context *endly.Context, text string) string

ExpandMeta expand meta data

func GetClient

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

GetClient creates a new google cloud client.

func GetProject

func GetProject(ctx *endly.Context) (*cloudresourcemanager.Project, error)

GetProject returns project info

func HasTestCredentials

func HasTestCredentials() bool

HasTestCredentialSetup returns true if e2e test credentials are set

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{}, credConfig *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.Generic
	HttpClinet *http.Client
	// contains filtered or unexported fields
}

AbstractClient represents an abstract client

func (*AbstractClient) Context

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

func (*AbstractClient) Service

func (c *AbstractClient) Service() interface{}

func (*AbstractClient) SetContext

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

func (*AbstractClient) SetCredConfig

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

func (*AbstractClient) SetHttpClient

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

func (*AbstractClient) SetService

func (c *AbstractClient) SetService(service interface{}) error

type CtxClient

type CtxClient interface {
	SetContext(ctx context.Context)
	Context() context.Context
	SetService(client interface{}) error
	Service() interface{}
	SetCredConfig(config *cred.Generic)
	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

type URLParams

type URLParams map[string][]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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