{-# 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.RevisionDestinationEntry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RevisionDestinationEntry = RevisionDestinationEntry'
{
RevisionDestinationEntry -> Maybe Text
keyPattern :: Prelude.Maybe Prelude.Text,
RevisionDestinationEntry -> Text
bucket :: Prelude.Text,
RevisionDestinationEntry -> Text
revisionId :: Prelude.Text
}
deriving (RevisionDestinationEntry -> RevisionDestinationEntry -> Bool
(RevisionDestinationEntry -> RevisionDestinationEntry -> Bool)
-> (RevisionDestinationEntry -> RevisionDestinationEntry -> Bool)
-> Eq RevisionDestinationEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevisionDestinationEntry -> RevisionDestinationEntry -> Bool
$c/= :: RevisionDestinationEntry -> RevisionDestinationEntry -> Bool
== :: RevisionDestinationEntry -> RevisionDestinationEntry -> Bool
$c== :: RevisionDestinationEntry -> RevisionDestinationEntry -> Bool
Prelude.Eq, ReadPrec [RevisionDestinationEntry]
ReadPrec RevisionDestinationEntry
Int -> ReadS RevisionDestinationEntry
ReadS [RevisionDestinationEntry]
(Int -> ReadS RevisionDestinationEntry)
-> ReadS [RevisionDestinationEntry]
-> ReadPrec RevisionDestinationEntry
-> ReadPrec [RevisionDestinationEntry]
-> Read RevisionDestinationEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevisionDestinationEntry]
$creadListPrec :: ReadPrec [RevisionDestinationEntry]
readPrec :: ReadPrec RevisionDestinationEntry
$creadPrec :: ReadPrec RevisionDestinationEntry
readList :: ReadS [RevisionDestinationEntry]
$creadList :: ReadS [RevisionDestinationEntry]
readsPrec :: Int -> ReadS RevisionDestinationEntry
$creadsPrec :: Int -> ReadS RevisionDestinationEntry
Prelude.Read, Int -> RevisionDestinationEntry -> ShowS
[RevisionDestinationEntry] -> ShowS
RevisionDestinationEntry -> String
(Int -> RevisionDestinationEntry -> ShowS)
-> (RevisionDestinationEntry -> String)
-> ([RevisionDestinationEntry] -> ShowS)
-> Show RevisionDestinationEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevisionDestinationEntry] -> ShowS
$cshowList :: [RevisionDestinationEntry] -> ShowS
show :: RevisionDestinationEntry -> String
$cshow :: RevisionDestinationEntry -> String
showsPrec :: Int -> RevisionDestinationEntry -> ShowS
$cshowsPrec :: Int -> RevisionDestinationEntry -> ShowS
Prelude.Show, (forall x.
RevisionDestinationEntry -> Rep RevisionDestinationEntry x)
-> (forall x.
Rep RevisionDestinationEntry x -> RevisionDestinationEntry)
-> Generic RevisionDestinationEntry
forall x.
Rep RevisionDestinationEntry x -> RevisionDestinationEntry
forall x.
RevisionDestinationEntry -> Rep RevisionDestinationEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RevisionDestinationEntry x -> RevisionDestinationEntry
$cfrom :: forall x.
RevisionDestinationEntry -> Rep RevisionDestinationEntry x
Prelude.Generic)
newRevisionDestinationEntry ::
Prelude.Text ->
Prelude.Text ->
RevisionDestinationEntry
newRevisionDestinationEntry :: Text -> Text -> RevisionDestinationEntry
newRevisionDestinationEntry Text
pBucket_ Text
pRevisionId_ =
RevisionDestinationEntry' :: Maybe Text -> Text -> Text -> RevisionDestinationEntry
RevisionDestinationEntry'
{ $sel:keyPattern:RevisionDestinationEntry' :: Maybe Text
keyPattern =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:RevisionDestinationEntry' :: Text
bucket = Text
pBucket_,
$sel:revisionId:RevisionDestinationEntry' :: Text
revisionId = Text
pRevisionId_
}
revisionDestinationEntry_keyPattern :: Lens.Lens' RevisionDestinationEntry (Prelude.Maybe Prelude.Text)
revisionDestinationEntry_keyPattern :: (Maybe Text -> f (Maybe Text))
-> RevisionDestinationEntry -> f RevisionDestinationEntry
revisionDestinationEntry_keyPattern = (RevisionDestinationEntry -> Maybe Text)
-> (RevisionDestinationEntry
-> Maybe Text -> RevisionDestinationEntry)
-> Lens
RevisionDestinationEntry
RevisionDestinationEntry
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionDestinationEntry' {Maybe Text
keyPattern :: Maybe Text
$sel:keyPattern:RevisionDestinationEntry' :: RevisionDestinationEntry -> Maybe Text
keyPattern} -> Maybe Text
keyPattern) (\s :: RevisionDestinationEntry
s@RevisionDestinationEntry' {} Maybe Text
a -> RevisionDestinationEntry
s {$sel:keyPattern:RevisionDestinationEntry' :: Maybe Text
keyPattern = Maybe Text
a} :: RevisionDestinationEntry)
revisionDestinationEntry_bucket :: Lens.Lens' RevisionDestinationEntry Prelude.Text
revisionDestinationEntry_bucket :: (Text -> f Text)
-> RevisionDestinationEntry -> f RevisionDestinationEntry
revisionDestinationEntry_bucket = (RevisionDestinationEntry -> Text)
-> (RevisionDestinationEntry -> Text -> RevisionDestinationEntry)
-> Lens RevisionDestinationEntry RevisionDestinationEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionDestinationEntry' {Text
bucket :: Text
$sel:bucket:RevisionDestinationEntry' :: RevisionDestinationEntry -> Text
bucket} -> Text
bucket) (\s :: RevisionDestinationEntry
s@RevisionDestinationEntry' {} Text
a -> RevisionDestinationEntry
s {$sel:bucket:RevisionDestinationEntry' :: Text
bucket = Text
a} :: RevisionDestinationEntry)
revisionDestinationEntry_revisionId :: Lens.Lens' RevisionDestinationEntry Prelude.Text
revisionDestinationEntry_revisionId :: (Text -> f Text)
-> RevisionDestinationEntry -> f RevisionDestinationEntry
revisionDestinationEntry_revisionId = (RevisionDestinationEntry -> Text)
-> (RevisionDestinationEntry -> Text -> RevisionDestinationEntry)
-> Lens RevisionDestinationEntry RevisionDestinationEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionDestinationEntry' {Text
revisionId :: Text
$sel:revisionId:RevisionDestinationEntry' :: RevisionDestinationEntry -> Text
revisionId} -> Text
revisionId) (\s :: RevisionDestinationEntry
s@RevisionDestinationEntry' {} Text
a -> RevisionDestinationEntry
s {$sel:revisionId:RevisionDestinationEntry' :: Text
revisionId = Text
a} :: RevisionDestinationEntry)
instance Core.FromJSON RevisionDestinationEntry where
parseJSON :: Value -> Parser RevisionDestinationEntry
parseJSON =
String
-> (Object -> Parser RevisionDestinationEntry)
-> Value
-> Parser RevisionDestinationEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RevisionDestinationEntry"
( \Object
x ->
Maybe Text -> Text -> Text -> RevisionDestinationEntry
RevisionDestinationEntry'
(Maybe Text -> Text -> Text -> RevisionDestinationEntry)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> RevisionDestinationEntry)
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
"KeyPattern")
Parser (Text -> Text -> RevisionDestinationEntry)
-> Parser Text -> Parser (Text -> RevisionDestinationEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Bucket")
Parser (Text -> RevisionDestinationEntry)
-> Parser Text -> Parser RevisionDestinationEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RevisionId")
)
instance Prelude.Hashable RevisionDestinationEntry
instance Prelude.NFData RevisionDestinationEntry
instance Core.ToJSON RevisionDestinationEntry where
toJSON :: RevisionDestinationEntry -> Value
toJSON RevisionDestinationEntry' {Maybe Text
Text
revisionId :: Text
bucket :: Text
keyPattern :: Maybe Text
$sel:revisionId:RevisionDestinationEntry' :: RevisionDestinationEntry -> Text
$sel:bucket:RevisionDestinationEntry' :: RevisionDestinationEntry -> Text
$sel:keyPattern:RevisionDestinationEntry' :: RevisionDestinationEntry -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"KeyPattern" 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
keyPattern,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucket),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RevisionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
revisionId)
]
)