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