cloudfunctions

package
v0.73.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

README

Google Cloud Functions Service

This service is google.golang.org/api/cloudfunctions/v1beta2.Service proxy

To check all supported method run

     endly -s='gcp/cloudfunctions'

To check method contract run endly -s='gcp/cloudfunctions' -a=methodName

    endly -s='gcp/cloudfunctions' -a='operationsList'

References:

Example
Testing
endly -r=test

@test.yaml

defaults:
  credentials: am
pipeline:
  deploy:
    action: gcp/cloudfunctions:deploy
    '@name': HelloWorld
    entryPoint: HelloWorldFn
    runtime: go111
    source:
      URL: test/
  test:
    action: gcp/cloudfunctions:call
    logging: false
    '@name': HelloWorld
    data:
      from: Endly
  info:
    action: print
    message: $test.Result
  assert:
    action: validator:assert
    expect: /Endly/
    actual: $test.Result
  undeploy:
    action: gcp/cloudfunctions:delete
    '@name': HelloWorld
    

Deploying function
  1. Deploying http trigger function with archive
    endly -r=deploy
    
    @deploy.yaml
    pipeline:
      deploy:
        action: gcp/cloudfunctions:deploy
        '@name': HelloWorld
        runtime: go111
        source:
          URL: test/hello.zip
    
    
  2. Deploying http trigger function with source path (use .gcloudignore to control upload) @deploy.yaml
    pipeline:
      deploy:
        action: gcp/cloudfunctions:deploy
        '@name': HelloWorldFn
        entryPoint Hello
        runtime: go111
        source:
          URL: test/
    
  3. Deploying with eventTrigger @deploy_with_trigger
    pipeline:
      deploy:
        action: gcp/cloudfunctions:deploy
        '@name': MyFunction
        entryPoint: MyFunctionFN
        runtime: go111
        eventTrigger:
          eventType: google.storage.object.finalize
          resource: projects/_/buckets/myBucket
        source:
          URL: test/
    
    
Calling function
  1. Calling from workflow
    endly -r=call
    
    @call.yaml
    pipeline:
      call:
        action: gcp/cloudfunctions:call
        logging: false
       '@name': HelloWorld
        data:
          from: Endly
    
  2. Calling from cli
    endly -run='gcp/cloudfunctions:call' name=HelloWorld data.from=Endly
    
Getting function info
    endly -run='gcp/cloudfunctions:get' name=HelloWorld 
Listing functions
    endly -run='gcp/cloudfunctions:list'  

Documentation

Index

Constants

View Source
const (
	//ServiceID Google Cloud Function Service Id
	ServiceID = "gcp/cloudfunctions"
)

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 Dataflow service

Types

type CallRequest

type CallRequest struct {
	Name   string
	Region string
	Data   interface{}
}

CallRequest represents a call request

func (*CallRequest) Init

func (r *CallRequest) Init() error

Init initializes request

func (*CallRequest) Validate

func (r *CallRequest) Validate() error

Validate checks if request was valid

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

type DeleteRequest

type DeleteRequest struct {
	Name   string
	Region string
}

DeleteRequest represents delete function requests

func (*DeleteRequest) Init

func (r *DeleteRequest) Init() error

Init initializes request

func (*DeleteRequest) Validate

func (r *DeleteRequest) Validate() error

Validate checks if request was valid

type DeleteResponse

type DeleteResponse struct {
	Operation string
	Meta      interface{}
}

DeleteResponse represents delete response

type DeployRequest

type DeployRequest struct {
	cloudfunctions.CloudFunction `yaml:",inline" json:",inline"`
	Source                       *location.Resource
	Public                       bool     `description:"set this flag to make function public"`
	Members                      []string `description:"members with roles/cloudfunctions.invoker role"`
	Region                       string
	Retry                        bool
}

DeployRequest represents deploy request

func (*DeployRequest) Init

func (r *DeployRequest) Init() error

Init initializes request

func (*DeployRequest) Validate

func (r *DeployRequest) Validate() error

Validate checks if request was valid

type DeployResponse

type DeployResponse struct {
	Operation string
	Meta      interface{}
	Function  *cloudfunctions.CloudFunction
}

DeployResponse represents deploy response

type GetRequest

type GetRequest struct {
	Name   string
	Region string
}

GetRequest represents get function requests

func (*GetRequest) Init

func (r *GetRequest) Init() error

Init initializes request

func (*GetRequest) Validate

func (r *GetRequest) Validate() error

Validate checks if request was valid

type ListRequest

type ListRequest struct {
	Region string
}

GetRequest represents list function requests

func (*ListRequest) Init

func (r *ListRequest) Init() error

Init initializes request

type ListResponse

type ListResponse struct {
	Function []*cloudfunctions.CloudFunction
}

GetRequest represents list function response

Jump to

Keyboard shortcuts

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