filesystem

package
v0.0.0-...-b1a156a Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Zlib Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TLSStorePath represents the subfolder where TLS files are stored in the file store folder.
	TLSStorePath = "tls"
	// LDAPStorePath represents the subfolder where LDAP TLS files are stored in the TLSStorePath.
	LDAPStorePath = "ldap"
	// TLSCACertFile represents the name on disk for a TLS CA file.
	TLSCACertFile = "ca.pem"
	// TLSCertFile represents the name on disk for a TLS certificate file.
	TLSCertFile = "cert.pem"
	// TLSKeyFile represents the name on disk for a TLS key file.
	TLSKeyFile = "key.pem"
	// ComposeStorePath represents the subfolder where compose files are stored in the file store folder.
	ComposeStorePath = "compose"
	// ComposeFileDefaultName represents the default name of a compose file.
	ComposeFileDefaultName = "docker-compose.yml"
	// PrivateKeyFile represents the name on disk of the file containing the private key.
	PrivateKeyFile = "baasapi.key"
	// PublicKeyFile represents the name on disk of the file containing the public key.
	PublicKeyFile = "baasapi.pub"
	// BinaryStorePath represents the subfolder where binaries are stored in the file store folder.
	BinaryStorePath = "bin"
	// ScheduleStorePath represents the subfolder where schedule files are stored.
	ScheduleStorePath = "schedules"
	// ExtensionRegistryManagementStorePath represents the subfolder where files related to the
	// registry management extension are stored.
	ExtensionRegistryManagementStorePath = "extensions"
	// Baas deployment files
	BaaSDeploymentPath = "k8s/ansible/vars/namespaces"
	// Baas config file
	BaaSConfigPath = "k8s/ansible"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service represents a service for managing files and directories.

func NewService

func NewService(dataStorePath, fileStorePath string) (*Service, error)

NewService initializes a new service. It creates a data directory and a directory to store files inside this directory if they don't exist.

func (*Service) CreateDirectoryInStore

func (service *Service) CreateDirectoryInStore(name string) error

CreateDirectoryInStore creates a new directory in the file store

func (*Service) DeleteTLSFile

func (service *Service) DeleteTLSFile(folder string, fileType baasapi.TLSFileType) error

DeleteTLSFile deletes a specific TLS file from a folder.

func (*Service) DeleteTLSFiles

func (service *Service) DeleteTLSFiles(folder string) error

DeleteTLSFiles deletes a folder in the TLS store path.

func (*Service) ExtractExtensionArchive

func (service *Service) ExtractExtensionArchive(data []byte) error

ExtractExtensionArchive extracts the content of an extension archive specified as raw data into the binary store on the filesystem

func (*Service) FileExists

func (service *Service) FileExists(filePath string) (bool, error)

FileExists checks for the existence of the specified file.

func (*Service) GetBinaryFolder

func (service *Service) GetBinaryFolder() string

GetBinaryFolder returns the full path to the binary store on the filesystem

func (*Service) GetFileContent

func (service *Service) GetFileContent(filePath string) ([]byte, error)

GetFileContent returns the content of a file as bytes.

func (*Service) GetPathForTLSFile

func (service *Service) GetPathForTLSFile(folder string, fileType baasapi.TLSFileType) (string, error)

GetPathForTLSFile returns the absolute path to a specific TLS file for an baask8s.

func (*Service) GetScheduleFolder

func (service *Service) GetScheduleFolder(identifier string) string

GetScheduleFolder returns the absolute path on the filesystem for a schedule based on its identifier.

func (*Service) GetStackProjectPath

func (service *Service) GetStackProjectPath(stackIdentifier string) string

GetStackProjectPath returns the absolute path on the FS for a stack based on its identifier.

func (*Service) KeyPairFilesExist

func (service *Service) KeyPairFilesExist() (bool, error)

KeyPairFilesExist checks for the existence of the key files.

func (*Service) LoadKeyPair

func (service *Service) LoadKeyPair() ([]byte, []byte, error)

LoadKeyPair retrieve the content of both key files on disk.

func (*Service) RemoveDirectory

func (service *Service) RemoveDirectory(directoryPath string) error

RemoveDirectory removes a directory on the filesystem.

func (*Service) Rename

func (service *Service) Rename(oldPath, newPath string) error

Rename renames a file or directory

func (*Service) StoreKeyPair

func (service *Service) StoreKeyPair(private, public []byte, privatePEMHeader, publicPEMHeader string) error

StoreKeyPair store the specified keys content as PEM files on disk.

func (*Service) StoreKubeconfigFileFromBytes

func (service *Service) StoreKubeconfigFileFromBytes(folder string, fileType baasapi.TLSFileType, data []byte) (string, error)

StoreKubeconfigFileFromBytes creates a folder in the TLSStorePath and stores a new file from bytes. It returns the path to the newly created file.

func (*Service) StoreRegistryManagementFileFromBytes

func (service *Service) StoreRegistryManagementFileFromBytes(folder, fileName string, data []byte) (string, error)

StoreRegistryManagementFileFromBytes creates a subfolder in the ExtensionRegistryManagementStorePath and stores a new file from bytes. It returns the path to the folder where the file is stored.

func (*Service) StoreScheduledJobFileFromBytes

func (service *Service) StoreScheduledJobFileFromBytes(identifier string, data []byte) (string, error)

StoreScheduledJobFileFromBytes creates a subfolder in the ScheduleStorePath and stores a new file from bytes. It returns the path to the folder where the file is stored.

func (*Service) StoreStackFileFromBytes

func (service *Service) StoreStackFileFromBytes(stackIdentifier, fileName string, data []byte) (string, error)

StoreStackFileFromBytes creates a subfolder in the ComposeStorePath and stores a new file from bytes. It returns the path to the folder where the file is stored.

func (*Service) StoreTLSFileFromBytes

func (service *Service) StoreTLSFileFromBytes(folder string, fileType baasapi.TLSFileType, data []byte) (string, error)

StoreTLSFileFromBytes creates a folder in the TLSStorePath and stores a new file from bytes. It returns the path to the newly created file.

func (*Service) StoreYamlFileFromJSON

func (service *Service) StoreYamlFileFromJSON(stackIdentifier, fileName string, content interface{}, creator string) (string, error)

StoreStackFileFromBytes creates a subfolder in the ComposeStorePath and stores a new file from bytes. It returns the path to the folder where the file is stored.

func (*Service) WriteJSONToFile

func (service *Service) WriteJSONToFile(path string, content interface{}) error

WriteJSONToFile writes JSON to the specified file.

Jump to

Keyboard shortcuts

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