{-# 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.OpsWorks.Types.DataSource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data DataSource = DataSource'
{
DataSource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
DataSource -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
DataSource -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
}
deriving (DataSource -> DataSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSource -> DataSource -> Bool
$c/= :: DataSource -> DataSource -> Bool
== :: DataSource -> DataSource -> Bool
$c== :: DataSource -> DataSource -> Bool
Prelude.Eq, ReadPrec [DataSource]
ReadPrec DataSource
Int -> ReadS DataSource
ReadS [DataSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSource]
$creadListPrec :: ReadPrec [DataSource]
readPrec :: ReadPrec DataSource
$creadPrec :: ReadPrec DataSource
readList :: ReadS [DataSource]
$creadList :: ReadS [DataSource]
readsPrec :: Int -> ReadS DataSource
$creadsPrec :: Int -> ReadS DataSource
Prelude.Read, Int -> DataSource -> ShowS
[DataSource] -> ShowS
DataSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSource] -> ShowS
$cshowList :: [DataSource] -> ShowS
show :: DataSource -> String
$cshow :: DataSource -> String
showsPrec :: Int -> DataSource -> ShowS
$cshowsPrec :: Int -> DataSource -> ShowS
Prelude.Show, forall x. Rep DataSource x -> DataSource
forall x. DataSource -> Rep DataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSource x -> DataSource
$cfrom :: forall x. DataSource -> Rep DataSource x
Prelude.Generic)
newDataSource ::
DataSource
newDataSource :: DataSource
newDataSource =
DataSource'
{ $sel:arn:DataSource' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:DataSource' :: Maybe Text
databaseName = forall a. Maybe a
Prelude.Nothing,
$sel:type':DataSource' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
}
dataSource_arn :: Lens.Lens' DataSource (Prelude.Maybe Prelude.Text)
dataSource_arn :: Lens' DataSource (Maybe Text)
dataSource_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSource' {Maybe Text
arn :: Maybe Text
$sel:arn:DataSource' :: DataSource -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DataSource
s@DataSource' {} Maybe Text
a -> DataSource
s {$sel:arn:DataSource' :: Maybe Text
arn = Maybe Text
a} :: DataSource)
dataSource_databaseName :: Lens.Lens' DataSource (Prelude.Maybe Prelude.Text)
dataSource_databaseName :: Lens' DataSource (Maybe Text)
dataSource_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSource' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:DataSource' :: DataSource -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: DataSource
s@DataSource' {} Maybe Text
a -> DataSource
s {$sel:databaseName:DataSource' :: Maybe Text
databaseName = Maybe Text
a} :: DataSource)
dataSource_type :: Lens.Lens' DataSource (Prelude.Maybe Prelude.Text)
dataSource_type :: Lens' DataSource (Maybe Text)
dataSource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSource' {Maybe Text
type' :: Maybe Text
$sel:type':DataSource' :: DataSource -> Maybe Text
type'} -> Maybe Text
type') (\s :: DataSource
s@DataSource' {} Maybe Text
a -> DataSource
s {$sel:type':DataSource' :: Maybe Text
type' = Maybe Text
a} :: DataSource)
instance Data.FromJSON DataSource where
parseJSON :: Value -> Parser DataSource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DataSource"
( \Object
x ->
Maybe Text -> Maybe Text -> Maybe Text -> DataSource
DataSource'
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
"Arn")
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
"DatabaseName")
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")
)
instance Prelude.Hashable DataSource where
hashWithSalt :: Int -> DataSource -> Int
hashWithSalt Int
_salt DataSource' {Maybe Text
type' :: Maybe Text
databaseName :: Maybe Text
arn :: Maybe Text
$sel:type':DataSource' :: DataSource -> Maybe Text
$sel:databaseName:DataSource' :: DataSource -> Maybe Text
$sel:arn:DataSource' :: DataSource -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
instance Prelude.NFData DataSource where
rnf :: DataSource -> ()
rnf DataSource' {Maybe Text
type' :: Maybe Text
databaseName :: Maybe Text
arn :: Maybe Text
$sel:type':DataSource' :: DataSource -> Maybe Text
$sel:databaseName:DataSource' :: DataSource -> Maybe Text
$sel:arn:DataSource' :: DataSource -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'
instance Data.ToJSON DataSource where
toJSON :: DataSource -> Value
toJSON DataSource' {Maybe Text
type' :: Maybe Text
databaseName :: Maybe Text
arn :: Maybe Text
$sel:type':DataSource' :: DataSource -> Maybe Text
$sel:databaseName:DataSource' :: DataSource -> Maybe Text
$sel:arn:DataSource' :: DataSource -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Arn" 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
arn,
(Key
"DatabaseName" 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
databaseName,
(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 Text
type'
]
)