model

package
v0.0.0-...-8ce0de3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnvironmentForRepository

func AddEnvironmentForRepository(environment types.EnvironmentPost, name string) (types.Environment, error)

AddEnvironmentForRepository adds a new Environment for the repository given in the parameters, the values for the new Environment are in the EnvironmentPost struct. If some values are unset, they will be set with the defaults from the repository. After successfully adding the new Environment to DynamoDB, the Builder Lambda gets invoked to add the Schedules and the CodeBuild Job. If an error occurs the error gets logged and then returned. If no error occurs the newly created Environment gets returned.

func AddRepository

func AddRepository(repository *types.Repository, stage string) error

AddRepository adds a new Repository to the DynamoDB Table, the values are received from the Repository struct given in the parameters. Some values are overwritten with the global defaults if they were not set, therefore the API Stage is also required since AddRepository calls GetGlobalRepositoryConfiguration internaly. To check the stored values, all values in the Repository struct are overwritten with the response of the AWS SDK command (call by reference). If an error occurs the error gets logged and then returned.

func CheckIfEnvironmentsForRepositoryExist

func CheckIfEnvironmentsForRepositoryExist(name string) (bool, error)

CheckIfEnvironmentsForRepositoryExist checks if Environments in DynamoDB exist where repository equals name from the parameters. If Environments were found then true gets returned, otherwise false. If an error occurs the error gets logged and then returned.

func DeleteSingleEnvironment

func DeleteSingleEnvironment(name string, branch string) error

DeleteSingleEnvironment invokes the Builder Lambda to delete the schedules and the CodeBuild Job with the infrastructure. If an error occurs the error gets logged and then returned.

func DeleteSingleRepository

func DeleteSingleRepository(repository *types.Repository, name string) error

DeleteSingleRepository deletes an existing Repository in DynamoDB where repository matches the given name from the parameters. To check the deleted repository, all values in the Repository struct are overwritten with the response of the AWS SDK command (call by reference). If an error occurs the error gets logged and then returned.

func GetAllEnvironmentsForRepository

func GetAllEnvironmentsForRepository(environments *[]types.Environment, name string) error

GetAllEnvironmentsForRepository gets all Environments where the repository matches name (parameter) from DynamoDB, the received Environments are unmarshaled into the array of Environments given in the parameters (call by reference). If an error occurs the error gets logged and then returned.

func GetAllEnvironmentsStatusInformation

func GetAllEnvironmentsStatusInformation(status *[]types.EnvironmentStatus) error

GetAllEnvironmentsStatusInformation reads the repository, branch and status columns from all rows of the environments DynamoDB Table and writes them to the Array of EnvironmentStatus structs given in the parameters (call by reference). If an error occurs the error gets logged and then returned.

func GetAllRepositories

func GetAllRepositories(repositories *[]types.Repository) error

GetAllRepositories reads all Repositories from the DynamoDB Table and unmarshals them into the array of Repository structs from the parameters (call by reference). If an error occurs the error gets logged and then returned.

func GetBuilderVersion

func GetBuilderVersion(componentVersion *types.SingleComponentVersion) error

func GetConfiguration

func GetConfiguration(configuration *types.TowerConfiguration) error

GetConfiguration gets the current LogLevel from the env vars and writes the value to the TowerConfiguration struct from the parameters (call by reference). If an error occurs the error gets logged and then returned.

func GetGlobalRepositoryConfiguration

func GetGlobalRepositoryConfiguration(configuration *types.GeneralConfig, stage string) error

GetGlobalRepositoryConfiguration reads the current global repository configuration from the DynamoDB Table and unmarshals it to the GeneralConfig struct from the parameters (call by reference). Next to the GeneralConfig struct, the stage parameter which is used as Key in DynamoDB and contains the API stage is required. If an error occurs the error gets logged and then returned.

func GetSchedulerVersion

func GetSchedulerVersion(componentVersion *types.SingleComponentVersion) error

func GetSingleEnvironmentForRepository

func GetSingleEnvironmentForRepository(environment *types.Environment, name string, branch string) error

GetSingleEnvironmentForRepository gets the Environment where repository equals name and branch equals branch from DynamoDB, the received Environment gets unmarshaled into the Environment struct given in the parameters (call by reference). If an error occurs the error gets logged and then returned.

func GetSingleEnvironmentStatusInformation

func GetSingleEnvironmentStatusInformation(status *types.EnvironmentStatus, name string, branch string) error

GetSingleEnvironmentStatusInformation reads the repository, branch and status columns from the row of the environments DynamoDB Table where repository and branch match the values given in the parameters. The result is written to the EnvironmentStatus struct from the parameters (call by reference). If an error occurs the error gets logged and then returned.

func GetSingleRepository

func GetSingleRepository(repository *types.Repository, name string) error

GetSingleRepository reads a single Repository entry from the DynamoDB Table where repository matches the namen given in the parameters. The response gets unmarshaled into the Repository struct from the parameters (call by reference). If an error occurs the error gets logged and then returned.

func TriggerSchedulerLambdaForEnvironment

func TriggerSchedulerLambdaForEnvironment(repository, branch, action string) (string, error)

TriggerSchedulerLambdaForEnvironment invokes the Scheduler Lambda Function with the repository, branch and action given in the parameters, action can be start or stop. If invoking the Scheduler fails the error gets logged and then returned. Otherwise the response message of the Scheduler gets unquoted and returned.

func UpdateConfiguration

func UpdateConfiguration(configuration *types.TowerConfiguration) error

UpdateConfiguration updates the LogLevel environment variable with the value stored in the TowerConfiguration struct, after calling the AWS update command the LogLevel value returned by the command gets stored in the TowerConfiguration struct (overwrites value used in update) from the parameter (call by reference). The two values (before and after update) should match. If an error occurs the error gets logged and then returned.

func UpdateEnvironment

func UpdateEnvironment(environment *types.EnvironmentPut, name string, branch string) (types.Environment, error)

UpdateEnvironment updates an existing Environment in DynamoDB where repository equals name and branch equals branch, the updated values for the Environment are in the EnvironmentPut struct. After successfully updating the Environment in DynamoDB, the Builder Lambda gets invoked to update the Schedules and the CodeBuild Job. If an error occurs the error gets logged and then returned. If no error occurs the updated Environment gets returned.

func UpdateGlobalRepositoryConfiguration

func UpdateGlobalRepositoryConfiguration(configuration *types.GeneralConfig, stage string) error

UpdateGlobalRepositoryConfiguration updates the global repository configuration in DynamoDB by using the AWS SDK with the values from the GeneralConfig struct in the parameters, after the update all values in the GeneralConfig struct are overwritten with the AWS command results. Next to the GeneralConfig struct, the stage parameter which is used as Key in DynamoDB and contains the API stage is required. If an error occurs the error gets logged and then returned.

func UpdateSingleRepository

func UpdateSingleRepository(repository *types.Repository, name string) error

UpdateSingleRepository updates an existing Repository in DynamoDB where repository matches the given name with the values from the Repository struct in the parameters. To check the updated values, all values in the Repository struct are overwritten with the response of the AWS SDK command (call by reference). If an error occurs the error gets logged and then returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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