Copyright | (C) 2016 Awake Networks |
---|---|
License | Apache-2.0 |
Maintainer | Awake Networks <opensource@awakenetworks.com> |
Stability | stable |
Safe Haskell | None |
Language | Haskell2010 |
- die :: MonadIO io => Text -> io a
- exitProgFail :: String -> IO a
- writeOrPrint :: Maybe FilePath -> ByteString -> IO ()
- mkOutImage :: ImageName -> FilePath -> FilePath
- mkOutConfig :: ImageName -> ImageTag -> FilePath -> FilePath
- mkOutManifest :: ImageName -> ImageTag -> FilePath -> FilePath
- joinURIPath :: [String] -> RegistryURI -> RegistryURI
- opts :: Maybe Auth -> Options
- sha256 :: ByteString -> Digest SHA256
- stripHashId :: Text -> Text
- encodeCanonical :: ToJSON a => a -> ByteString
- requirePath :: MonadError HockerException m => Maybe FilePath -> m FilePath
- getConfigDigest :: MonadError HockerException m => ByteString -> m (Digest SHA256)
- splitRepository :: ImageName -> (RepoNamePart, ImageNamePart)
- renderNixExpr :: NExpr -> SimpleDoc
- pprintNixExpr :: NExpr -> IO ()
- findExec :: (MonadIO m, MonadError HockerException m) => String -> m FilePath
Documentation
die :: MonadIO io => Text -> io a Source #
Throw a userError
, exiting the program with the supplied
message.
exitProgFail :: String -> IO a Source #
Print an error message to stderr and return a non-zero exit code, the message is prefixed with the name of the program.
writeOrPrint :: Maybe FilePath -> ByteString -> IO () Source #
Print the bytestring to stdout if the first argument is
Nothing
, otherwise write the bytestring to the provided
filesystem path and print the path to stdout.
Combine an image name and a base path producing an output path.
Combine an image name, an image tag, and a base path producing an
output path with a -config.json
suffix.
Combine an image name, an image tag, and a base path producing an
output path with a -manifest.json
suffix.
:: [String] | Extra path segments to add |
-> RegistryURI | Base URI to add path segments to |
-> RegistryURI |
Join a list of strings and the path part of a RegistryURI
to
produce a new RegistryURI
with a path root of /v2
.
stripHashId :: Text -> Text Source #
Strip the sha256:
identifier prefix from a hash digest.
encodeCanonical :: ToJSON a => a -> ByteString Source #
Encode, following Docker's canonical JSON rules, any ToJSON
data type.
The canonicalization rules enable consistent hashing of encoded JSON, a process relied upon heavily by docker for content addressability and unique identification of resources within a docker registry. Notably, an image's config JSON file and layers.
NB: Docker's canonical JSON spec intentionally *does not* follow the OLPC's Canonical JSON format even though it was inspired by it.
requirePath :: MonadError HockerException m => Maybe FilePath -> m FilePath Source #
Throw an error if the first argument is Nothing
, otherwise
return the FilePath
unwrapped.
getConfigDigest :: MonadError HockerException m => ByteString -> m (Digest SHA256) Source #
Pluck out the digest value for the config JSON given a docker
registry image manifest. Attempting to parse and return the digest
value as a SHA256
, otherwise throw an error.
splitRepository :: ImageName -> (RepoNamePart, ImageNamePart) Source #
Split a docker image's name on the forward slash separator so we get the distinct repo name and image name.
renderNixExpr :: NExpr -> SimpleDoc Source #
Given a nix expression AST, produce a pretty printer document.
pprintNixExpr :: NExpr -> IO () Source #
Print a nix expression AST using the renderNixExpr
pretty
printing renderer.
findExec :: (MonadIO m, MonadError HockerException m) => String -> m FilePath Source #
Given an executable's name, try to find it in the PATH.