{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Lightsail.Types.Container where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.ContainerServiceProtocol
import qualified Amazonka.Prelude as Prelude
data Container = Container'
{
Container -> Maybe [Text]
command :: Prelude.Maybe [Prelude.Text],
Container -> Maybe (HashMap Text Text)
environment :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Container -> Maybe Text
image :: Prelude.Maybe Prelude.Text,
Container -> Maybe (HashMap Text ContainerServiceProtocol)
ports :: Prelude.Maybe (Prelude.HashMap Prelude.Text ContainerServiceProtocol)
}
deriving (Container -> Container -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Container -> Container -> Bool
$c/= :: Container -> Container -> Bool
== :: Container -> Container -> Bool
$c== :: Container -> Container -> Bool
Prelude.Eq, ReadPrec [Container]
ReadPrec Container
Int -> ReadS Container
ReadS [Container]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Container]
$creadListPrec :: ReadPrec [Container]
readPrec :: ReadPrec Container
$creadPrec :: ReadPrec Container
readList :: ReadS [Container]
$creadList :: ReadS [Container]
readsPrec :: Int -> ReadS Container
$creadsPrec :: Int -> ReadS Container
Prelude.Read, Int -> Container -> ShowS
[Container] -> ShowS
Container -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Container] -> ShowS
$cshowList :: [Container] -> ShowS
show :: Container -> String
$cshow :: Container -> String
showsPrec :: Int -> Container -> ShowS
$cshowsPrec :: Int -> Container -> ShowS
Prelude.Show, forall x. Rep Container x -> Container
forall x. Container -> Rep Container x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Container x -> Container
$cfrom :: forall x. Container -> Rep Container x
Prelude.Generic)
newContainer ::
Container
newContainer :: Container
newContainer =
Container'
{ $sel:command:Container' :: Maybe [Text]
command = forall a. Maybe a
Prelude.Nothing,
$sel:environment:Container' :: Maybe (HashMap Text Text)
environment = forall a. Maybe a
Prelude.Nothing,
$sel:image:Container' :: Maybe Text
image = forall a. Maybe a
Prelude.Nothing,
$sel:ports:Container' :: Maybe (HashMap Text ContainerServiceProtocol)
ports = forall a. Maybe a
Prelude.Nothing
}
container_command :: Lens.Lens' Container (Prelude.Maybe [Prelude.Text])
container_command :: Lens' Container (Maybe [Text])
container_command = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe [Text]
command :: Maybe [Text]
$sel:command:Container' :: Container -> Maybe [Text]
command} -> Maybe [Text]
command) (\s :: Container
s@Container' {} Maybe [Text]
a -> Container
s {$sel:command:Container' :: Maybe [Text]
command = Maybe [Text]
a} :: Container) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
container_environment :: Lens.Lens' Container (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
container_environment :: Lens' Container (Maybe (HashMap Text Text))
container_environment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe (HashMap Text Text)
environment :: Maybe (HashMap Text Text)
$sel:environment:Container' :: Container -> Maybe (HashMap Text Text)
environment} -> Maybe (HashMap Text Text)
environment) (\s :: Container
s@Container' {} Maybe (HashMap Text Text)
a -> Container
s {$sel:environment:Container' :: Maybe (HashMap Text Text)
environment = Maybe (HashMap Text Text)
a} :: Container) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
container_image :: Lens.Lens' Container (Prelude.Maybe Prelude.Text)
container_image :: Lens' Container (Maybe Text)
container_image = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe Text
image :: Maybe Text
$sel:image:Container' :: Container -> Maybe Text
image} -> Maybe Text
image) (\s :: Container
s@Container' {} Maybe Text
a -> Container
s {$sel:image:Container' :: Maybe Text
image = Maybe Text
a} :: Container)
container_ports :: Lens.Lens' Container (Prelude.Maybe (Prelude.HashMap Prelude.Text ContainerServiceProtocol))
container_ports :: Lens' Container (Maybe (HashMap Text ContainerServiceProtocol))
container_ports = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Container' {Maybe (HashMap Text ContainerServiceProtocol)
ports :: Maybe (HashMap Text ContainerServiceProtocol)
$sel:ports:Container' :: Container -> Maybe (HashMap Text ContainerServiceProtocol)
ports} -> Maybe (HashMap Text ContainerServiceProtocol)
ports) (\s :: Container
s@Container' {} Maybe (HashMap Text ContainerServiceProtocol)
a -> Container
s {$sel:ports:Container' :: Maybe (HashMap Text ContainerServiceProtocol)
ports = Maybe (HashMap Text ContainerServiceProtocol)
a} :: Container) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Container where
parseJSON :: Value -> Parser Container
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Container"
( \Object
x ->
Maybe [Text]
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text ContainerServiceProtocol)
-> Container
Container'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"command" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"environment" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"image")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ports" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Container where
hashWithSalt :: Int -> Container -> Int
hashWithSalt Int
_salt Container' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ContainerServiceProtocol)
ports :: Maybe (HashMap Text ContainerServiceProtocol)
image :: Maybe Text
environment :: Maybe (HashMap Text Text)
command :: Maybe [Text]
$sel:ports:Container' :: Container -> Maybe (HashMap Text ContainerServiceProtocol)
$sel:image:Container' :: Container -> Maybe Text
$sel:environment:Container' :: Container -> Maybe (HashMap Text Text)
$sel:command:Container' :: Container -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
command
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
environment
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
image
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ContainerServiceProtocol)
ports
instance Prelude.NFData Container where
rnf :: Container -> ()
rnf Container' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ContainerServiceProtocol)
ports :: Maybe (HashMap Text ContainerServiceProtocol)
image :: Maybe Text
environment :: Maybe (HashMap Text Text)
command :: Maybe [Text]
$sel:ports:Container' :: Container -> Maybe (HashMap Text ContainerServiceProtocol)
$sel:image:Container' :: Container -> Maybe Text
$sel:environment:Container' :: Container -> Maybe (HashMap Text Text)
$sel:command:Container' :: Container -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
command
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
environment
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
image
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ContainerServiceProtocol)
ports
instance Data.ToJSON Container where
toJSON :: Container -> Value
toJSON Container' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ContainerServiceProtocol)
ports :: Maybe (HashMap Text ContainerServiceProtocol)
image :: Maybe Text
environment :: Maybe (HashMap Text Text)
command :: Maybe [Text]
$sel:ports:Container' :: Container -> Maybe (HashMap Text ContainerServiceProtocol)
$sel:image:Container' :: Container -> Maybe Text
$sel:environment:Container' :: Container -> Maybe (HashMap Text Text)
$sel:command:Container' :: Container -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"command" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
command,
(Key
"environment" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
environment,
(Key
"image" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
image,
(Key
"ports" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text ContainerServiceProtocol)
ports
]
)