cloudy-0.1.0.1: CLI tool to easily spin up and control compute instances in various cloud environments
Safe HaskellSafe-Inferred
LanguageHaskell98

Cloudy.Db

Synopsis

Documentation

data OnlyOne r Source #

Constructors

OnlyOne r 
MultipleExist 
NoneExist 

Instances

Instances details
Functor OnlyOne Source # 
Instance details

Defined in Cloudy.Db

Methods

fmap :: (a -> b) -> OnlyOne a -> OnlyOne b #

(<$) :: a -> OnlyOne b -> OnlyOne a #

Show r => Show (OnlyOne r) Source # 
Instance details

Defined in Cloudy.Db

Methods

showsPrec :: Int -> OnlyOne r -> ShowS #

show :: OnlyOne r -> String #

showList :: [OnlyOne r] -> ShowS #

queryUnique :: (ToRow a, FromRow r) => Connection -> Query -> a -> IO (Maybe r) Source #

Query on a column with a UNIQUE constraint. Throws an exception if multiple values are returned.

newtype DbInstanceSetup Source #

newtype to hold the FromField instance for InstanceSetup, for use in the FromRow instance for CloudyInstance.

The instance_setup column in the cloudy_instance table holds a JSON-encoded InstanceSetup value.

Instances

Instances details
FromField DbInstanceSetup Source # 
Instance details

Defined in Cloudy.Db

ToField DbInstanceSetup Source # 
Instance details

Defined in Cloudy.Db

findCloudyInstanceByNameWithDeleted :: Connection -> Text -> IO (Maybe CloudyInstance) Source #

Return a cloudy instance matching the given name. This will return an instance even if it has already been deleted.

newScalewayInstance Source #

Arguments

:: Connection 
-> UTCTime 
-> CloudyInstanceId 
-> Maybe InstanceSetup 
-> Text

Scaleway Zone

-> Text

Scaleway Instance Id

-> Text

Scaleway IP Id

-> Text

Scaleway IP Address

-> IO () 

findOnlyOneInstanceId :: Connection -> IO (OnlyOne CloudyInstanceId) Source #

Return a single CloudyInstanceId if there is exactly one in the database that is not already deleted.

invariantEveryCloudyInstHasExactlyOneProviderInst :: Connection -> IO [DbInvariantErr] Source #

There needs to be EXACTLY ONE corresponding cloud provider instance for each cloudy instance.

invariantCloudyInstCorectDates :: Connection -> IO [DbInvariantErr] Source #

Cloudy instances should always have a created_at value that is non-null.

The only time a Cloudy instance can have a created_at value that is null is within the Create CLI command. Although this invariant should hold both before and after the Create CLI command.