utils

package
v0.0.0-...-ff81de2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSourceDefinition

func BuildSourceDefinition(ctx context.Context, client *functions.FunctionClient, fileUtil FileUtil, opts config.DeployOptions) (*functionspb.Source, error)

BuildSourceDefinition creates a new Source object for a cloud function based on the provided DeployOptions.

Types

type FileUtil

type FileUtil interface {
	ArchiveDirectoryContentIntoZip(dir string) (string, error)
	UploadFileToSignedURL(ctx context.Context, uploadURL, file string) error
	CleanUp(zipFile string) error
}

type MockFileUtil

type MockFileUtil struct {
	ZipFileName      string
	ZipCreationError error
	UploadError      error
}

func (MockFileUtil) ArchiveDirectoryContentIntoZip

func (fileUtil MockFileUtil) ArchiveDirectoryContentIntoZip(_ string) (string, error)

func (MockFileUtil) CleanUp

func (fileUtil MockFileUtil) CleanUp(_ string) error

func (MockFileUtil) UploadFileToSignedURL

func (fileUtil MockFileUtil) UploadFileToSignedURL(_ context.Context, _, _ string) error

type OsFileUtil

type OsFileUtil struct{}

func (OsFileUtil) ArchiveDirectoryContentIntoZip

func (fileUtil OsFileUtil) ArchiveDirectoryContentIntoZip(dir string) (string, error)

ArchiveDirectoryContentIntoZip validates the directory, archives its contect and returns the file name of the created zip.

func (OsFileUtil) CleanUp

func (fileUtil OsFileUtil) CleanUp(zipFile string) error

CleanUp removes the directory of the zip provided with all its contect.

func (OsFileUtil) UploadFileToSignedURL

func (fileUtil OsFileUtil) UploadFileToSignedURL(ctx context.Context, uploadURL, file string) error

UploadFileToSignedURL uploads the file from the specified path to the provided URL.

Jump to

Keyboard shortcuts

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