{-# 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.ServiceRegistry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ServiceRegistry = ServiceRegistry'
{
ServiceRegistry -> Maybe Text
registryArn :: Prelude.Maybe Prelude.Text,
ServiceRegistry -> Maybe Text
containerName :: Prelude.Maybe Prelude.Text,
ServiceRegistry -> Maybe Int
containerPort :: Prelude.Maybe Prelude.Int,
ServiceRegistry -> Maybe Int
port :: Prelude.Maybe Prelude.Int
}
deriving (ServiceRegistry -> ServiceRegistry -> Bool
(ServiceRegistry -> ServiceRegistry -> Bool)
-> (ServiceRegistry -> ServiceRegistry -> Bool)
-> Eq ServiceRegistry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceRegistry -> ServiceRegistry -> Bool
$c/= :: ServiceRegistry -> ServiceRegistry -> Bool
== :: ServiceRegistry -> ServiceRegistry -> Bool
$c== :: ServiceRegistry -> ServiceRegistry -> Bool
Prelude.Eq, ReadPrec [ServiceRegistry]
ReadPrec ServiceRegistry
Int -> ReadS ServiceRegistry
ReadS [ServiceRegistry]
(Int -> ReadS ServiceRegistry)
-> ReadS [ServiceRegistry]
-> ReadPrec ServiceRegistry
-> ReadPrec [ServiceRegistry]
-> Read ServiceRegistry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceRegistry]
$creadListPrec :: ReadPrec [ServiceRegistry]
readPrec :: ReadPrec ServiceRegistry
$creadPrec :: ReadPrec ServiceRegistry
readList :: ReadS [ServiceRegistry]
$creadList :: ReadS [ServiceRegistry]
readsPrec :: Int -> ReadS ServiceRegistry
$creadsPrec :: Int -> ReadS ServiceRegistry
Prelude.Read, Int -> ServiceRegistry -> ShowS
[ServiceRegistry] -> ShowS
ServiceRegistry -> String
(Int -> ServiceRegistry -> ShowS)
-> (ServiceRegistry -> String)
-> ([ServiceRegistry] -> ShowS)
-> Show ServiceRegistry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceRegistry] -> ShowS
$cshowList :: [ServiceRegistry] -> ShowS
show :: ServiceRegistry -> String
$cshow :: ServiceRegistry -> String
showsPrec :: Int -> ServiceRegistry -> ShowS
$cshowsPrec :: Int -> ServiceRegistry -> ShowS
Prelude.Show, (forall x. ServiceRegistry -> Rep ServiceRegistry x)
-> (forall x. Rep ServiceRegistry x -> ServiceRegistry)
-> Generic ServiceRegistry
forall x. Rep ServiceRegistry x -> ServiceRegistry
forall x. ServiceRegistry -> Rep ServiceRegistry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceRegistry x -> ServiceRegistry
$cfrom :: forall x. ServiceRegistry -> Rep ServiceRegistry x
Prelude.Generic)
newServiceRegistry ::
ServiceRegistry
newServiceRegistry :: ServiceRegistry
newServiceRegistry =
ServiceRegistry' :: Maybe Text
-> Maybe Text -> Maybe Int -> Maybe Int -> ServiceRegistry
ServiceRegistry'
{ $sel:registryArn:ServiceRegistry' :: Maybe Text
registryArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerName:ServiceRegistry' :: Maybe Text
containerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerPort:ServiceRegistry' :: Maybe Int
containerPort = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:port:ServiceRegistry' :: Maybe Int
port = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
serviceRegistry_registryArn :: Lens.Lens' ServiceRegistry (Prelude.Maybe Prelude.Text)
serviceRegistry_registryArn :: (Maybe Text -> f (Maybe Text))
-> ServiceRegistry -> f ServiceRegistry
serviceRegistry_registryArn = (ServiceRegistry -> Maybe Text)
-> (ServiceRegistry -> Maybe Text -> ServiceRegistry)
-> Lens ServiceRegistry ServiceRegistry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceRegistry' {Maybe Text
registryArn :: Maybe Text
$sel:registryArn:ServiceRegistry' :: ServiceRegistry -> Maybe Text
registryArn} -> Maybe Text
registryArn) (\s :: ServiceRegistry
s@ServiceRegistry' {} Maybe Text
a -> ServiceRegistry
s {$sel:registryArn:ServiceRegistry' :: Maybe Text
registryArn = Maybe Text
a} :: ServiceRegistry)
serviceRegistry_containerName :: Lens.Lens' ServiceRegistry (Prelude.Maybe Prelude.Text)
serviceRegistry_containerName :: (Maybe Text -> f (Maybe Text))
-> ServiceRegistry -> f ServiceRegistry
serviceRegistry_containerName = (ServiceRegistry -> Maybe Text)
-> (ServiceRegistry -> Maybe Text -> ServiceRegistry)
-> Lens ServiceRegistry ServiceRegistry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceRegistry' {Maybe Text
containerName :: Maybe Text
$sel:containerName:ServiceRegistry' :: ServiceRegistry -> Maybe Text
containerName} -> Maybe Text
containerName) (\s :: ServiceRegistry
s@ServiceRegistry' {} Maybe Text
a -> ServiceRegistry
s {$sel:containerName:ServiceRegistry' :: Maybe Text
containerName = Maybe Text
a} :: ServiceRegistry)
serviceRegistry_containerPort :: Lens.Lens' ServiceRegistry (Prelude.Maybe Prelude.Int)
serviceRegistry_containerPort :: (Maybe Int -> f (Maybe Int))
-> ServiceRegistry -> f ServiceRegistry
serviceRegistry_containerPort = (ServiceRegistry -> Maybe Int)
-> (ServiceRegistry -> Maybe Int -> ServiceRegistry)
-> Lens ServiceRegistry ServiceRegistry (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceRegistry' {Maybe Int
containerPort :: Maybe Int
$sel:containerPort:ServiceRegistry' :: ServiceRegistry -> Maybe Int
containerPort} -> Maybe Int
containerPort) (\s :: ServiceRegistry
s@ServiceRegistry' {} Maybe Int
a -> ServiceRegistry
s {$sel:containerPort:ServiceRegistry' :: Maybe Int
containerPort = Maybe Int
a} :: ServiceRegistry)
serviceRegistry_port :: Lens.Lens' ServiceRegistry (Prelude.Maybe Prelude.Int)
serviceRegistry_port :: (Maybe Int -> f (Maybe Int))
-> ServiceRegistry -> f ServiceRegistry
serviceRegistry_port = (ServiceRegistry -> Maybe Int)
-> (ServiceRegistry -> Maybe Int -> ServiceRegistry)
-> Lens ServiceRegistry ServiceRegistry (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceRegistry' {Maybe Int
port :: Maybe Int
$sel:port:ServiceRegistry' :: ServiceRegistry -> Maybe Int
port} -> Maybe Int
port) (\s :: ServiceRegistry
s@ServiceRegistry' {} Maybe Int
a -> ServiceRegistry
s {$sel:port:ServiceRegistry' :: Maybe Int
port = Maybe Int
a} :: ServiceRegistry)
instance Core.FromJSON ServiceRegistry where
parseJSON :: Value -> Parser ServiceRegistry
parseJSON =
String
-> (Object -> Parser ServiceRegistry)
-> Value
-> Parser ServiceRegistry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ServiceRegistry"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Int -> Maybe Int -> ServiceRegistry
ServiceRegistry'
(Maybe Text
-> Maybe Text -> Maybe Int -> Maybe Int -> ServiceRegistry)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Int -> Maybe Int -> ServiceRegistry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"registryArn")
Parser (Maybe Text -> Maybe Int -> Maybe Int -> ServiceRegistry)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Int -> ServiceRegistry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerName")
Parser (Maybe Int -> Maybe Int -> ServiceRegistry)
-> Parser (Maybe Int) -> Parser (Maybe Int -> ServiceRegistry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containerPort")
Parser (Maybe Int -> ServiceRegistry)
-> Parser (Maybe Int) -> Parser ServiceRegistry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"port")
)
instance Prelude.Hashable ServiceRegistry
instance Prelude.NFData ServiceRegistry
instance Core.ToJSON ServiceRegistry where
toJSON :: ServiceRegistry -> Value
toJSON ServiceRegistry' {Maybe Int
Maybe Text
port :: Maybe Int
containerPort :: Maybe Int
containerName :: Maybe Text
registryArn :: Maybe Text
$sel:port:ServiceRegistry' :: ServiceRegistry -> Maybe Int
$sel:containerPort:ServiceRegistry' :: ServiceRegistry -> Maybe Int
$sel:containerName:ServiceRegistry' :: ServiceRegistry -> Maybe Text
$sel:registryArn:ServiceRegistry' :: ServiceRegistry -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"registryArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryArn,
(Text
"containerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
containerName,
(Text
"containerPort" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
containerPort,
(Text
"port" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
port
]
)