Documentation ¶
Overview ¶
Copyright © 2022 Scott Hawkins <scott@echoboomer.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package configmanage instantiates functions to manage configuration
Index ¶
- func CreateStateFileIfNotExists()
- func DeleteFile(credentials Credentials, file FileSpecification)
- func DeleteFromState(data map[string]ManagedResource) ([]map[string]ManagedResource, error)
- func Deploy()
- func InstallPackage(credentials Credentials, pkg PackageSpecification)
- func Propose()
- func ReadFromState() []map[string]ManagedResource
- func ReadOneFromState(resource string) map[string]ManagedResource
- func RemovePackage(credentials Credentials, pkg PackageSpecification)
- func RunOnRemoteHost(credentials Credentials, command string) (string, error)
- func UpdateFileMode(credentials Credentials, file FileSpecification)
- func UploadFileViaSFTP(credentials Credentials, file FileSpecification) error
- func Validate()
- func WriteToState(data map[string]ManagedResource)
- type Credentials
- type FileResourceDiff
- type FileSpecification
- type ManagedResource
- type PackageResourceDiff
- type PackageSpecification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateStateFileIfNotExists ¶
func CreateStateFileIfNotExists()
CreateStateFileIfNotExists populates an empty state file when one does not exist
func DeleteFile ¶
func DeleteFile(credentials Credentials, file FileSpecification)
DeleteFile removes a file from a managed resource
func DeleteFromState ¶
func DeleteFromState(data map[string]ManagedResource) ([]map[string]ManagedResource, error)
DeleteFromState removes a resource from the state file
func InstallPackage ¶
func InstallPackage(credentials Credentials, pkg PackageSpecification)
InstallPackage installs a package on a managed resource
func Propose ¶
func Propose()
Propose determines what changes need to be made and clearly describes them
func ReadFromState ¶
func ReadFromState() []map[string]ManagedResource
ReadFromState parses objects stored in the state file
func ReadOneFromState ¶
func ReadOneFromState(resource string) map[string]ManagedResource
ReadOneFromState parses a single object stored in the state file
func RemovePackage ¶
func RemovePackage(credentials Credentials, pkg PackageSpecification)
RemovePackage removes a package from a managed resource
func RunOnRemoteHost ¶
func RunOnRemoteHost(credentials Credentials, command string) (string, error)
RunOnRemoteHost allows execution of a command on a host via an ssh shell - useful for managing resources on remote hosts
func UpdateFileMode ¶
func UpdateFileMode(credentials Credentials, file FileSpecification)
UpdateFileMode updates a file's permissions
func UploadFileViaSFTP ¶
func UploadFileViaSFTP(credentials Credentials, file FileSpecification) error
UploadFileViaSFTP leverages sftp to place a file onto a host
func Validate ¶
func Validate()
Validate parses fields in a configuration file and returns whether or not the file structure is valid
func WriteToState ¶
func WriteToState(data map[string]ManagedResource)
WriteToState formats a resource to be written to state on creation, update, or removal
Types ¶
type Credentials ¶
type FileResourceDiff ¶
type FileResourceDiff struct { Operation string Target string UpdateValue interface{} FileResource FileSpecification }
func GetFileDiffs ¶
func GetFileDiffs(credentials Credentials, files []FileSpecification, fromState ManagedResource) []FileResourceDiff
GetFileDiffs processes a slice of FileSpecification and determines changes for resources that already have state entries
type FileSpecification ¶
type ManagedResource ¶
type ManagedResource struct { Host string `yaml:"host" json:"host"` Password string `yaml:"password" json:"password"` Files []FileSpecification `yaml:"files" json:"files"` Packages []PackageSpecification `yaml:"packages" json:"packages"` Command []string `yaml:"command" json:"command"` }
type PackageResourceDiff ¶
type PackageResourceDiff struct { Operation string PackageResource PackageSpecification }
func GetPackageDiffs ¶
func GetPackageDiffs(credentials Credentials, pkgs []PackageSpecification, fromState ManagedResource) []PackageResourceDiff
GetPackageDiffs iterates through requested packages on a managed resource and shows and returns any diffs