{-# 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.DataExchange.Types.AssetDestinationEntry 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 AssetDestinationEntry = AssetDestinationEntry'
{
AssetDestinationEntry -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
AssetDestinationEntry -> Text
assetId :: Prelude.Text,
AssetDestinationEntry -> Text
bucket :: Prelude.Text
}
deriving (AssetDestinationEntry -> AssetDestinationEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetDestinationEntry -> AssetDestinationEntry -> Bool
$c/= :: AssetDestinationEntry -> AssetDestinationEntry -> Bool
== :: AssetDestinationEntry -> AssetDestinationEntry -> Bool
$c== :: AssetDestinationEntry -> AssetDestinationEntry -> Bool
Prelude.Eq, ReadPrec [AssetDestinationEntry]
ReadPrec AssetDestinationEntry
Int -> ReadS AssetDestinationEntry
ReadS [AssetDestinationEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetDestinationEntry]
$creadListPrec :: ReadPrec [AssetDestinationEntry]
readPrec :: ReadPrec AssetDestinationEntry
$creadPrec :: ReadPrec AssetDestinationEntry
readList :: ReadS [AssetDestinationEntry]
$creadList :: ReadS [AssetDestinationEntry]
readsPrec :: Int -> ReadS AssetDestinationEntry
$creadsPrec :: Int -> ReadS AssetDestinationEntry
Prelude.Read, Int -> AssetDestinationEntry -> ShowS
[AssetDestinationEntry] -> ShowS
AssetDestinationEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetDestinationEntry] -> ShowS
$cshowList :: [AssetDestinationEntry] -> ShowS
show :: AssetDestinationEntry -> String
$cshow :: AssetDestinationEntry -> String
showsPrec :: Int -> AssetDestinationEntry -> ShowS
$cshowsPrec :: Int -> AssetDestinationEntry -> ShowS
Prelude.Show, forall x. Rep AssetDestinationEntry x -> AssetDestinationEntry
forall x. AssetDestinationEntry -> Rep AssetDestinationEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetDestinationEntry x -> AssetDestinationEntry
$cfrom :: forall x. AssetDestinationEntry -> Rep AssetDestinationEntry x
Prelude.Generic)
newAssetDestinationEntry ::
Prelude.Text ->
Prelude.Text ->
AssetDestinationEntry
newAssetDestinationEntry :: Text -> Text -> AssetDestinationEntry
newAssetDestinationEntry Text
pAssetId_ Text
pBucket_ =
AssetDestinationEntry'
{ $sel:key:AssetDestinationEntry' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
$sel:assetId:AssetDestinationEntry' :: Text
assetId = Text
pAssetId_,
$sel:bucket:AssetDestinationEntry' :: Text
bucket = Text
pBucket_
}
assetDestinationEntry_key :: Lens.Lens' AssetDestinationEntry (Prelude.Maybe Prelude.Text)
assetDestinationEntry_key :: Lens' AssetDestinationEntry (Maybe Text)
assetDestinationEntry_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetDestinationEntry' {Maybe Text
key :: Maybe Text
$sel:key:AssetDestinationEntry' :: AssetDestinationEntry -> Maybe Text
key} -> Maybe Text
key) (\s :: AssetDestinationEntry
s@AssetDestinationEntry' {} Maybe Text
a -> AssetDestinationEntry
s {$sel:key:AssetDestinationEntry' :: Maybe Text
key = Maybe Text
a} :: AssetDestinationEntry)
assetDestinationEntry_assetId :: Lens.Lens' AssetDestinationEntry Prelude.Text
assetDestinationEntry_assetId :: Lens' AssetDestinationEntry Text
assetDestinationEntry_assetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetDestinationEntry' {Text
assetId :: Text
$sel:assetId:AssetDestinationEntry' :: AssetDestinationEntry -> Text
assetId} -> Text
assetId) (\s :: AssetDestinationEntry
s@AssetDestinationEntry' {} Text
a -> AssetDestinationEntry
s {$sel:assetId:AssetDestinationEntry' :: Text
assetId = Text
a} :: AssetDestinationEntry)
assetDestinationEntry_bucket :: Lens.Lens' AssetDestinationEntry Prelude.Text
assetDestinationEntry_bucket :: Lens' AssetDestinationEntry Text
assetDestinationEntry_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetDestinationEntry' {Text
bucket :: Text
$sel:bucket:AssetDestinationEntry' :: AssetDestinationEntry -> Text
bucket} -> Text
bucket) (\s :: AssetDestinationEntry
s@AssetDestinationEntry' {} Text
a -> AssetDestinationEntry
s {$sel:bucket:AssetDestinationEntry' :: Text
bucket = Text
a} :: AssetDestinationEntry)
instance Data.FromJSON AssetDestinationEntry where
parseJSON :: Value -> Parser AssetDestinationEntry
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AssetDestinationEntry"
( \Object
x ->
Maybe Text -> Text -> Text -> AssetDestinationEntry
AssetDestinationEntry'
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
"Key")
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
"AssetId")
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
"Bucket")
)
instance Prelude.Hashable AssetDestinationEntry where
hashWithSalt :: Int -> AssetDestinationEntry -> Int
hashWithSalt Int
_salt AssetDestinationEntry' {Maybe Text
Text
bucket :: Text
assetId :: Text
key :: Maybe Text
$sel:bucket:AssetDestinationEntry' :: AssetDestinationEntry -> Text
$sel:assetId:AssetDestinationEntry' :: AssetDestinationEntry -> Text
$sel:key:AssetDestinationEntry' :: AssetDestinationEntry -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
assetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucket
instance Prelude.NFData AssetDestinationEntry where
rnf :: AssetDestinationEntry -> ()
rnf AssetDestinationEntry' {Maybe Text
Text
bucket :: Text
assetId :: Text
key :: Maybe Text
$sel:bucket:AssetDestinationEntry' :: AssetDestinationEntry -> Text
$sel:assetId:AssetDestinationEntry' :: AssetDestinationEntry -> Text
$sel:key:AssetDestinationEntry' :: AssetDestinationEntry -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
assetId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bucket
instance Data.ToJSON AssetDestinationEntry where
toJSON :: AssetDestinationEntry -> Value
toJSON AssetDestinationEntry' {Maybe Text
Text
bucket :: Text
assetId :: Text
key :: Maybe Text
$sel:bucket:AssetDestinationEntry' :: AssetDestinationEntry -> Text
$sel:assetId:AssetDestinationEntry' :: AssetDestinationEntry -> Text
$sel:key:AssetDestinationEntry' :: AssetDestinationEntry -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Key" 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
key,
forall a. a -> Maybe a
Prelude.Just (Key
"AssetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
assetId),
forall a. a -> Maybe a
Prelude.Just (Key
"Bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucket)
]
)