Documentation ¶
Overview ¶
Package gcf helps to deploy cloud functions
Index ¶
- Constants
- func GetRunTime(goVersion string) (runTime string, err error)
- func MakeFunctionGoContent(gcfType, serviceName string) (functionGoContent string, err error)
- func MakeGoModContent(goVersion, ramVersion string) (goModContent string)
- type GoGCFArtifacts
- func (goGCFArtifacts *GoGCFArtifacts) CreateGCFServiceAccount() (err error)
- func (goGCFArtifacts *GoGCFArtifacts) CreatePatchCloudFunction() (err error)
- func (goGCFArtifacts *GoGCFArtifacts) GetUploadURL(projectID, region string) (err error)
- func (goGCFArtifacts *GoGCFArtifacts) UpdateProjectIAMPolicy() (err error)
- func (goGCFArtifacts *GoGCFArtifacts) UploadZipUsingSignedURL() (response *http.Response, err error)
Constants ¶
const BackgroundPubSubFunctionGo = `` /* 1145-byte string literal not displayed */
BackgroundPubSubFunctionGo function.go code skeleton, replace <serviceName> by serviceName
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 ¶
GetRunTime returns the GCF runtime string for a given Go version. Error is version not supported
func MakeFunctionGoContent ¶
MakeFunctionGoContent craft the content of a cloud function function.go file for a RAM microservice instance
func MakeGoModContent ¶
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