gcf

package
v0.0.18-rc8 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gcf helps to deploy cloud functions

Index

Constants

View Source
const BackgroundPubSubFunctionGo = `` /* 1145-byte string literal not displayed */

BackgroundPubSubFunctionGo function.go code skeleton, replace <serviceName> by serviceName

View Source
const GoMod = `
// generated code %v

module example.com/cloudfunction

go %s

require github.com/BrunoReboul/ram %s
`

GoMod go.mod skeleton, replace first %s goVersion, second by ramVersion

Variables

This section is empty.

Functions

func GetRunTime

func GetRunTime(goVersion string) (runTime string, err error)

GetRunTime returns the GCF runtime string for a given Go version. Error is version not supported

func MakeFunctionGoContent

func MakeFunctionGoContent(gcfType, serviceName string) (functionGoContent string, err error)

MakeFunctionGoContent craft the content of a cloud function function.go file for a RAM microservice instance

func MakeGoModContent

func MakeGoModContent(goVersion, ramVersion string) (goModContent string)

MakeGoModContent craft the content of a cloud function go.mod file for a RAM microservice instance

Types

type GoGCFArtifacts

type GoGCFArtifacts struct {
	Ctx                               context.Context `yaml:"-"`
	CloudFunction                     cloudfunctions.CloudFunction
	CloudFunctionZipFullPath          string
	CloudresourcemanagerService       *cloudresourcemanager.Service `yaml:"-"`
	Dump                              bool
	EnvironmentName                   string
	GoVersion                         string
	IAMService                        *iam.Service `yaml:"-"`
	InstanceName                      string
	OperationsService                 *cloudfunctions.OperationsService                 `yaml:"-"`
	ProjectsLocationsFunctionsService *cloudfunctions.ProjectsLocationsFunctionsService `yaml:"-"`
	ProjectID                         string
	RAMVersion                        string
	Region                            string
	RepositoryPath                    string
	ServiceName                       string
	ZipFiles                          map[string]string
}

GoGCFArtifacts struct to deploy a Go CloudFunction

func (*GoGCFArtifacts) CreateGCFServiceAccount

func (goGCFArtifacts *GoGCFArtifacts) CreateGCFServiceAccount() (err error)

CreateGCFServiceAccount creates the service account to be used by a cloud function

func (*GoGCFArtifacts) CreatePatchCloudFunction

func (goGCFArtifacts *GoGCFArtifacts) CreatePatchCloudFunction() (err error)

CreatePatchCloudFunction looks for and existing cloud function

func (*GoGCFArtifacts) GetUploadURL

func (goGCFArtifacts *GoGCFArtifacts) GetUploadURL(projectID, region string) (err error)

GetUploadURL returns the URL where to upload the cloud function source Zip

func (*GoGCFArtifacts) UpdateProjectIAMPolicy

func (goGCFArtifacts *GoGCFArtifacts) UpdateProjectIAMPolicy() (err error)

UpdateProjectIAMPolicy creates the service account to be used by a cloud function

func (*GoGCFArtifacts) UploadZipUsingSignedURL

func (goGCFArtifacts *GoGCFArtifacts) UploadZipUsingSignedURL() (response *http.Response, err error)

UploadZipUsingSignedURL upload the rile content using a signed URL

Jump to

Keyboard shortcuts

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