{-# 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.SMS.Types.Source 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
import Amazonka.SMS.Types.S3Location
data Source = Source'
{ Source -> Maybe S3Location
s3Location :: Prelude.Maybe S3Location
}
deriving (Source -> Source -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Source -> Source -> Bool
$c/= :: Source -> Source -> Bool
== :: Source -> Source -> Bool
$c== :: Source -> Source -> Bool
Prelude.Eq, ReadPrec [Source]
ReadPrec Source
Int -> ReadS Source
ReadS [Source]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Source]
$creadListPrec :: ReadPrec [Source]
readPrec :: ReadPrec Source
$creadPrec :: ReadPrec Source
readList :: ReadS [Source]
$creadList :: ReadS [Source]
readsPrec :: Int -> ReadS Source
$creadsPrec :: Int -> ReadS Source
Prelude.Read, Int -> Source -> ShowS
[Source] -> ShowS
Source -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Source] -> ShowS
$cshowList :: [Source] -> ShowS
show :: Source -> String
$cshow :: Source -> String
showsPrec :: Int -> Source -> ShowS
$cshowsPrec :: Int -> Source -> ShowS
Prelude.Show, forall x. Rep Source x -> Source
forall x. Source -> Rep Source x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Source x -> Source
$cfrom :: forall x. Source -> Rep Source x
Prelude.Generic)
newSource ::
Source
newSource :: Source
newSource = Source' {$sel:s3Location:Source' :: Maybe S3Location
s3Location = forall a. Maybe a
Prelude.Nothing}
source_s3Location :: Lens.Lens' Source (Prelude.Maybe S3Location)
source_s3Location :: Lens' Source (Maybe S3Location)
source_s3Location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe S3Location
s3Location :: Maybe S3Location
$sel:s3Location:Source' :: Source -> Maybe S3Location
s3Location} -> Maybe S3Location
s3Location) (\s :: Source
s@Source' {} Maybe S3Location
a -> Source
s {$sel:s3Location:Source' :: Maybe S3Location
s3Location = Maybe S3Location
a} :: Source)
instance Data.FromJSON Source where
parseJSON :: Value -> Parser Source
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Source"
( \Object
x ->
Maybe S3Location -> Source
Source' 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
"s3Location")
)
instance Prelude.Hashable Source where
hashWithSalt :: Int -> Source -> Int
hashWithSalt Int
_salt Source' {Maybe S3Location
s3Location :: Maybe S3Location
$sel:s3Location:Source' :: Source -> Maybe S3Location
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Location
s3Location
instance Prelude.NFData Source where
rnf :: Source -> ()
rnf Source' {Maybe S3Location
s3Location :: Maybe S3Location
$sel:s3Location:Source' :: Source -> Maybe S3Location
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Location
s3Location
instance Data.ToJSON Source where
toJSON :: Source -> Value
toJSON Source' {Maybe S3Location
s3Location :: Maybe S3Location
$sel:s3Location:Source' :: Source -> Maybe S3Location
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"s3Location" 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 S3Location
s3Location]
)