Documentation ¶
Index ¶
- Constants
- type Service
- func (service *Service) CreateDirectoryInStore(name string) error
- func (service *Service) DeleteTLSFile(folder string, fileType baasapi.TLSFileType) error
- func (service *Service) DeleteTLSFiles(folder string) error
- func (service *Service) ExtractExtensionArchive(data []byte) error
- func (service *Service) FileExists(filePath string) (bool, error)
- func (service *Service) GetBinaryFolder() string
- func (service *Service) GetFileContent(filePath string) ([]byte, error)
- func (service *Service) GetPathForTLSFile(folder string, fileType baasapi.TLSFileType) (string, error)
- func (service *Service) GetScheduleFolder(identifier string) string
- func (service *Service) GetStackProjectPath(stackIdentifier string) string
- func (service *Service) KeyPairFilesExist() (bool, error)
- func (service *Service) LoadKeyPair() ([]byte, []byte, error)
- func (service *Service) RemoveDirectory(directoryPath string) error
- func (service *Service) Rename(oldPath, newPath string) error
- func (service *Service) StoreKeyPair(private, public []byte, privatePEMHeader, publicPEMHeader string) error
- func (service *Service) StoreKubeconfigFileFromBytes(folder string, fileType baasapi.TLSFileType, data []byte) (string, error)
- func (service *Service) StoreRegistryManagementFileFromBytes(folder, fileName string, data []byte) (string, error)
- func (service *Service) StoreScheduledJobFileFromBytes(identifier string, data []byte) (string, error)
- func (service *Service) StoreStackFileFromBytes(stackIdentifier, fileName string, data []byte) (string, error)
- func (service *Service) StoreTLSFileFromBytes(folder string, fileType baasapi.TLSFileType, data []byte) (string, error)
- func (service *Service) StoreYamlFileFromJSON(stackIdentifier, fileName string, content interface{}, creator string) (string, error)
- func (service *Service) WriteJSONToFile(path string, content interface{}) error
Constants ¶
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 ¶
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 ¶
CreateDirectoryInStore creates a new directory in the file store
func (*Service) DeleteTLSFile ¶
DeleteTLSFile deletes a specific TLS file from a folder.
func (*Service) DeleteTLSFiles ¶
DeleteTLSFiles deletes a folder in the TLS store path.
func (*Service) ExtractExtensionArchive ¶
ExtractExtensionArchive extracts the content of an extension archive specified as raw data into the binary store on the filesystem
func (*Service) FileExists ¶
FileExists checks for the existence of the specified file.
func (*Service) GetBinaryFolder ¶
GetBinaryFolder returns the full path to the binary store on the filesystem
func (*Service) GetFileContent ¶
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 ¶
GetScheduleFolder returns the absolute path on the filesystem for a schedule based on its identifier.
func (*Service) GetStackProjectPath ¶
GetStackProjectPath returns the absolute path on the FS for a stack based on its identifier.
func (*Service) KeyPairFilesExist ¶
KeyPairFilesExist checks for the existence of the key files.
func (*Service) LoadKeyPair ¶
LoadKeyPair retrieve the content of both key files on disk.
func (*Service) RemoveDirectory ¶
RemoveDirectory removes a directory on the filesystem.
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 ¶
WriteJSONToFile writes JSON to the specified file.