{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types.KeyValuePair
import Amazonka.ECS.Types.ProxyConfigurationType
import qualified Amazonka.Prelude as Prelude
data ProxyConfiguration = ProxyConfiguration'
{
ProxyConfiguration -> Maybe [KeyValuePair]
properties :: Prelude.Maybe [KeyValuePair],
ProxyConfiguration -> Maybe ProxyConfigurationType
type' :: Prelude.Maybe ProxyConfigurationType,
ProxyConfiguration -> Text
containerName :: Prelude.Text
}
deriving (ProxyConfiguration -> ProxyConfiguration -> Bool
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]
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
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. 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'
{ $sel:properties:ProxyConfiguration' :: Maybe [KeyValuePair]
properties = forall a. Maybe a
Prelude.Nothing,
$sel:type':ProxyConfiguration' :: Maybe ProxyConfigurationType
type' = forall a. Maybe a
Prelude.Nothing,
$sel:containerName:ProxyConfiguration' :: Text
containerName = Text
pContainerName_
}
proxyConfiguration_properties :: Lens.Lens' ProxyConfiguration (Prelude.Maybe [KeyValuePair])
proxyConfiguration_properties :: Lens' ProxyConfiguration (Maybe [KeyValuePair])
proxyConfiguration_properties = 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) 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
proxyConfiguration_type :: Lens.Lens' ProxyConfiguration (Prelude.Maybe ProxyConfigurationType)
proxyConfiguration_type :: Lens' ProxyConfiguration (Maybe ProxyConfigurationType)
proxyConfiguration_type = 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_containerName :: Lens.Lens' ProxyConfiguration Prelude.Text
proxyConfiguration_containerName :: Lens' ProxyConfiguration Text
proxyConfiguration_containerName = 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 Data.FromJSON ProxyConfiguration where
parseJSON :: Value -> Parser ProxyConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ProxyConfiguration"
( \Object
x ->
Maybe [KeyValuePair]
-> Maybe ProxyConfigurationType -> Text -> ProxyConfiguration
ProxyConfiguration'
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
"properties" 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
"type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"containerName")
)
instance Prelude.Hashable ProxyConfiguration where
hashWithSalt :: Int -> ProxyConfiguration -> Int
hashWithSalt Int
_salt ProxyConfiguration' {Maybe [KeyValuePair]
Maybe ProxyConfigurationType
Text
containerName :: Text
type' :: Maybe ProxyConfigurationType
properties :: Maybe [KeyValuePair]
$sel:containerName:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:type':ProxyConfiguration' :: ProxyConfiguration -> Maybe ProxyConfigurationType
$sel:properties:ProxyConfiguration' :: ProxyConfiguration -> Maybe [KeyValuePair]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [KeyValuePair]
properties
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProxyConfigurationType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerName
instance Prelude.NFData ProxyConfiguration where
rnf :: ProxyConfiguration -> ()
rnf ProxyConfiguration' {Maybe [KeyValuePair]
Maybe ProxyConfigurationType
Text
containerName :: Text
type' :: Maybe ProxyConfigurationType
properties :: Maybe [KeyValuePair]
$sel:containerName:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:type':ProxyConfiguration' :: ProxyConfiguration -> Maybe ProxyConfigurationType
$sel:properties:ProxyConfiguration' :: ProxyConfiguration -> Maybe [KeyValuePair]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [KeyValuePair]
properties
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProxyConfigurationType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
containerName
instance Data.ToJSON ProxyConfiguration where
toJSON :: ProxyConfiguration -> Value
toJSON ProxyConfiguration' {Maybe [KeyValuePair]
Maybe ProxyConfigurationType
Text
containerName :: Text
type' :: Maybe ProxyConfigurationType
properties :: Maybe [KeyValuePair]
$sel:containerName:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:type':ProxyConfiguration' :: ProxyConfiguration -> Maybe ProxyConfigurationType
$sel:properties:ProxyConfiguration' :: ProxyConfiguration -> Maybe [KeyValuePair]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"properties" 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 [KeyValuePair]
properties,
(Key
"type" 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 ProxyConfigurationType
type',
forall a. a -> Maybe a
Prelude.Just
(Key
"containerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerName)
]
)