{-# 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.ECS.Types.ProxyConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.KeyValuePair
import Amazonka.ECS.Types.ProxyConfigurationType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ProxyConfiguration = ProxyConfiguration'
{
ProxyConfiguration -> Maybe ProxyConfigurationType
type' :: Prelude.Maybe ProxyConfigurationType,
ProxyConfiguration -> Maybe [KeyValuePair]
properties :: Prelude.Maybe [KeyValuePair],
ProxyConfiguration -> Text
containerName :: Prelude.Text
}
deriving (ProxyConfiguration -> ProxyConfiguration -> Bool
(ProxyConfiguration -> ProxyConfiguration -> Bool)
-> (ProxyConfiguration -> ProxyConfiguration -> Bool)
-> Eq ProxyConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProxyConfiguration -> ProxyConfiguration -> Bool
$c/= :: ProxyConfiguration -> ProxyConfiguration -> Bool
== :: ProxyConfiguration -> ProxyConfiguration -> Bool
$c== :: ProxyConfiguration -> ProxyConfiguration -> Bool
Prelude.Eq, ReadPrec [ProxyConfiguration]
ReadPrec ProxyConfiguration
Int -> ReadS ProxyConfiguration
ReadS [ProxyConfiguration]
(Int -> ReadS ProxyConfiguration)
-> ReadS [ProxyConfiguration]
-> ReadPrec ProxyConfiguration
-> ReadPrec [ProxyConfiguration]
-> Read ProxyConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProxyConfiguration]
$creadListPrec :: ReadPrec [ProxyConfiguration]
readPrec :: ReadPrec ProxyConfiguration
$creadPrec :: ReadPrec ProxyConfiguration
readList :: ReadS [ProxyConfiguration]
$creadList :: ReadS [ProxyConfiguration]
readsPrec :: Int -> ReadS ProxyConfiguration
$creadsPrec :: Int -> ReadS ProxyConfiguration
Prelude.Read, Int -> ProxyConfiguration -> ShowS
[ProxyConfiguration] -> ShowS
ProxyConfiguration -> String
(Int -> ProxyConfiguration -> ShowS)
-> (ProxyConfiguration -> String)
-> ([ProxyConfiguration] -> ShowS)
-> Show ProxyConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProxyConfiguration] -> ShowS
$cshowList :: [ProxyConfiguration] -> ShowS
show :: ProxyConfiguration -> String
$cshow :: ProxyConfiguration -> String
showsPrec :: Int -> ProxyConfiguration -> ShowS
$cshowsPrec :: Int -> ProxyConfiguration -> ShowS
Prelude.Show, (forall x. ProxyConfiguration -> Rep ProxyConfiguration x)
-> (forall x. Rep ProxyConfiguration x -> ProxyConfiguration)
-> Generic ProxyConfiguration
forall x. Rep ProxyConfiguration x -> ProxyConfiguration
forall x. ProxyConfiguration -> Rep ProxyConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProxyConfiguration x -> ProxyConfiguration
$cfrom :: forall x. ProxyConfiguration -> Rep ProxyConfiguration x
Prelude.Generic)
newProxyConfiguration ::
Prelude.Text ->
ProxyConfiguration
newProxyConfiguration :: Text -> ProxyConfiguration
newProxyConfiguration Text
pContainerName_ =
ProxyConfiguration' :: Maybe ProxyConfigurationType
-> Maybe [KeyValuePair] -> Text -> ProxyConfiguration
ProxyConfiguration'
{ $sel:type':ProxyConfiguration' :: Maybe ProxyConfigurationType
type' = Maybe ProxyConfigurationType
forall a. Maybe a
Prelude.Nothing,
$sel:properties:ProxyConfiguration' :: Maybe [KeyValuePair]
properties = Maybe [KeyValuePair]
forall a. Maybe a
Prelude.Nothing,
$sel:containerName:ProxyConfiguration' :: Text
containerName = Text
pContainerName_
}
proxyConfiguration_type :: Lens.Lens' ProxyConfiguration (Prelude.Maybe ProxyConfigurationType)
proxyConfiguration_type :: (Maybe ProxyConfigurationType -> f (Maybe ProxyConfigurationType))
-> ProxyConfiguration -> f ProxyConfiguration
proxyConfiguration_type = (ProxyConfiguration -> Maybe ProxyConfigurationType)
-> (ProxyConfiguration
-> Maybe ProxyConfigurationType -> ProxyConfiguration)
-> Lens
ProxyConfiguration
ProxyConfiguration
(Maybe ProxyConfigurationType)
(Maybe ProxyConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProxyConfiguration' {Maybe ProxyConfigurationType
type' :: Maybe ProxyConfigurationType
$sel:type':ProxyConfiguration' :: ProxyConfiguration -> Maybe ProxyConfigurationType
type'} -> Maybe ProxyConfigurationType
type') (\s :: ProxyConfiguration
s@ProxyConfiguration' {} Maybe ProxyConfigurationType
a -> ProxyConfiguration
s {$sel:type':ProxyConfiguration' :: Maybe ProxyConfigurationType
type' = Maybe ProxyConfigurationType
a} :: ProxyConfiguration)
proxyConfiguration_properties :: Lens.Lens' ProxyConfiguration (Prelude.Maybe [KeyValuePair])
proxyConfiguration_properties :: (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ProxyConfiguration -> f ProxyConfiguration
proxyConfiguration_properties = (ProxyConfiguration -> Maybe [KeyValuePair])
-> (ProxyConfiguration
-> Maybe [KeyValuePair] -> ProxyConfiguration)
-> Lens
ProxyConfiguration
ProxyConfiguration
(Maybe [KeyValuePair])
(Maybe [KeyValuePair])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProxyConfiguration' {Maybe [KeyValuePair]
properties :: Maybe [KeyValuePair]
$sel:properties:ProxyConfiguration' :: ProxyConfiguration -> Maybe [KeyValuePair]
properties} -> Maybe [KeyValuePair]
properties) (\s :: ProxyConfiguration
s@ProxyConfiguration' {} Maybe [KeyValuePair]
a -> ProxyConfiguration
s {$sel:properties:ProxyConfiguration' :: Maybe [KeyValuePair]
properties = Maybe [KeyValuePair]
a} :: ProxyConfiguration) ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ProxyConfiguration -> f ProxyConfiguration)
-> ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> ProxyConfiguration
-> f ProxyConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [KeyValuePair] [KeyValuePair] [KeyValuePair] [KeyValuePair]
-> Iso
(Maybe [KeyValuePair])
(Maybe [KeyValuePair])
(Maybe [KeyValuePair])
(Maybe [KeyValuePair])
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 AnIso [KeyValuePair] [KeyValuePair] [KeyValuePair] [KeyValuePair]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
proxyConfiguration_containerName :: Lens.Lens' ProxyConfiguration Prelude.Text
proxyConfiguration_containerName :: (Text -> f Text) -> ProxyConfiguration -> f ProxyConfiguration
proxyConfiguration_containerName = (ProxyConfiguration -> Text)
-> (ProxyConfiguration -> Text -> ProxyConfiguration)
-> Lens ProxyConfiguration ProxyConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProxyConfiguration' {Text
containerName :: Text
$sel:containerName:ProxyConfiguration' :: ProxyConfiguration -> Text
containerName} -> Text
containerName) (\s :: ProxyConfiguration
s@ProxyConfiguration' {} Text
a -> ProxyConfiguration
s {$sel:containerName:ProxyConfiguration' :: Text
containerName = Text
a} :: ProxyConfiguration)
instance Core.FromJSON ProxyConfiguration where
parseJSON :: Value -> Parser ProxyConfiguration
parseJSON =
String
-> (Object -> Parser ProxyConfiguration)
-> Value
-> Parser ProxyConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProxyConfiguration"
( \Object
x ->
Maybe ProxyConfigurationType
-> Maybe [KeyValuePair] -> Text -> ProxyConfiguration
ProxyConfiguration'
(Maybe ProxyConfigurationType
-> Maybe [KeyValuePair] -> Text -> ProxyConfiguration)
-> Parser (Maybe ProxyConfigurationType)
-> Parser (Maybe [KeyValuePair] -> Text -> ProxyConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ProxyConfigurationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
Parser (Maybe [KeyValuePair] -> Text -> ProxyConfiguration)
-> Parser (Maybe [KeyValuePair])
-> Parser (Text -> ProxyConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [KeyValuePair]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"properties" Parser (Maybe (Maybe [KeyValuePair]))
-> Maybe [KeyValuePair] -> Parser (Maybe [KeyValuePair])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [KeyValuePair]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> ProxyConfiguration)
-> Parser Text -> Parser ProxyConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"containerName")
)
instance Prelude.Hashable ProxyConfiguration
instance Prelude.NFData ProxyConfiguration
instance Core.ToJSON ProxyConfiguration where
toJSON :: ProxyConfiguration -> Value
toJSON ProxyConfiguration' {Maybe [KeyValuePair]
Maybe ProxyConfigurationType
Text
containerName :: Text
properties :: Maybe [KeyValuePair]
type' :: Maybe ProxyConfigurationType
$sel:containerName:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:properties:ProxyConfiguration' :: ProxyConfiguration -> Maybe [KeyValuePair]
$sel:type':ProxyConfiguration' :: ProxyConfiguration -> Maybe ProxyConfigurationType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"type" Text -> ProxyConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProxyConfigurationType -> Pair)
-> Maybe ProxyConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProxyConfigurationType
type',
(Text
"properties" Text -> [KeyValuePair] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([KeyValuePair] -> Pair) -> Maybe [KeyValuePair] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [KeyValuePair]
properties,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"containerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerName)
]
)