common

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MassdriverURL             = "https://api.massdriver.cloud/"
	MassdriverYamlFilename    = "massdriver.yaml"
	ArtifactsSchemaFilename   = "schema-artifacts.json"
	ConnectionsSchemaFilename = "schema-connections.json"
	ParamsSchemaFilename      = "schema-params.json"
	UISchemaFilename          = "schema-ui.json"
	DevParamsFilename         = "_params.auto.tfvars.json"
	MaxBundleSizeMB           = 10
	MaxFileSizeMB             = 1
)
View Source
const (
	Read       = 04
	Write      = 02
	Execute    = 01
	UserShift  = 6
	GroupShift = 3
	OtherShift = 0

	UserRead    = Read << UserShift
	UserWrite   = Write << UserShift
	UserExecute = Execute << UserShift
	UserRW      = UserRead | UserWrite
	UserRWX     = UserRW | UserExecute

	GroupRead    = Read << GroupShift
	GroupWrite   = Write << GroupShift
	GroupExecute = Execute << GroupShift
	GroupRW      = GroupRead | GroupWrite
	GroupRWX     = GroupRW | GroupExecute

	OtherRead    = Read << OtherShift
	OtherWrite   = Write << OtherShift
	OtherExecute = Execute << OtherShift
	OtherRW      = OtherRead | OtherWrite
	OtherRWX     = OtherRW | OtherExecute

	AllRead    = UserRead | GroupRead | OtherRead
	AllWrite   = UserWrite | GroupWrite | OtherWrite
	AllExecute = UserExecute | GroupExecute | OtherExecute
	AllRX      = AllRead | AllExecute
	AllRW      = AllRead | AllWrite
	AllRWX     = AllRW | AllExecute
)

named constants for common unix file permissions logic adapted from https://stackoverflow.com/questions/28969455/how-to-properly-instantiate-os-filemode/42718395#42718395

Variables

View Source
var FileIgnores = []string{
	".terraform",
	".tfstate",
	".tfvars",
	".md",
	".git",
	".DS_Store",
}
View Source
var MassdriverArtifactDefinitions = []string{
	"massdriver/aws-dynamodb-table",
	"massdriver/aws-efs-file-system",
	"massdriver/aws-eventbridge",
	"massdriver/aws-iam-role",
	"massdriver/aws-s3-bucket",
	"massdriver/aws-sns-topic",
	"massdriver/aws-sqs-queue",
	"massdriver/aws-vpc",
	"massdriver/azure-communication-service",
	"massdriver/azure-data-lake-storage",
	"massdriver/azure-databricks-workspace",
	"massdriver/azure-fhir-service",
	"massdriver/azure-service-principal",
	"massdriver/azure-storage-account",
	"massdriver/azure-virtual-network",
	"massdriver/cosmosdb-sql-authentication",

	"massdriver/elasticsearch-authentication",

	"massdriver/gcp-bucket-https",
	"massdriver/gcp-cloud-function",
	"massdriver/gcp-firebase-authentication",
	"massdriver/gcp-global-network",
	"massdriver/gcp-pubsub-subscription",
	"massdriver/gcp-pubsub-topic",
	"massdriver/gcp-service-account",
	"massdriver/gcp-subnetwork",
	"massdriver/kafka-authentication",
	"massdriver/kubernetes-cluster",
	"massdriver/mongo-authentication",
	"massdriver/mysql-authentication",
	"massdriver/postgresql-authentication",
	"massdriver/redis-authentication",
	"massdriver/sftp-authentication",
}

Functions

func Contains added in v0.2.1

func Contains(s []string, str string) bool

func FileSizeMB added in v0.3.0

func FileSizeMB(bytes int64) float64

func ListMassdriverArtifactDefinitions added in v0.3.0

func ListMassdriverArtifactDefinitions() ([]string, error)

func RemoveDuplicateValues added in v0.3.0

func RemoveDuplicateValues(stringSlice []string) []string

func WriteFile added in v0.3.0

func WriteFile(filePath string, data []byte, errToBytes error) error

Types

type CopyConfig added in v0.3.0

type CopyConfig struct {
	Allows  []string
	Ignores []string
}

type CopyStats added in v0.3.0

type CopyStats struct {
	FolderSize int64
}

func CopyFolder added in v0.3.0

func CopyFolder(src, dstDir string, config *CopyConfig) (CopyStats, error)

Jump to

Keyboard shortcuts

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