{-# 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.Inspector2.Types.Destination 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 Destination = Destination'
{
Destination -> Maybe Text
keyPrefix :: Prelude.Maybe Prelude.Text,
Destination -> Text
bucketName :: Prelude.Text,
Destination -> Text
kmsKeyArn :: Prelude.Text
}
deriving (Destination -> Destination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Destination -> Destination -> Bool
$c/= :: Destination -> Destination -> Bool
== :: Destination -> Destination -> Bool
$c== :: Destination -> Destination -> Bool
Prelude.Eq, ReadPrec [Destination]
ReadPrec Destination
Int -> ReadS Destination
ReadS [Destination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Destination]
$creadListPrec :: ReadPrec [Destination]
readPrec :: ReadPrec Destination
$creadPrec :: ReadPrec Destination
readList :: ReadS [Destination]
$creadList :: ReadS [Destination]
readsPrec :: Int -> ReadS Destination
$creadsPrec :: Int -> ReadS Destination
Prelude.Read, Int -> Destination -> ShowS
[Destination] -> ShowS
Destination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Destination] -> ShowS
$cshowList :: [Destination] -> ShowS
show :: Destination -> String
$cshow :: Destination -> String
showsPrec :: Int -> Destination -> ShowS
$cshowsPrec :: Int -> Destination -> ShowS
Prelude.Show, forall x. Rep Destination x -> Destination
forall x. Destination -> Rep Destination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Destination x -> Destination
$cfrom :: forall x. Destination -> Rep Destination x
Prelude.Generic)
newDestination ::
Prelude.Text ->
Prelude.Text ->
Destination
newDestination :: Text -> Text -> Destination
newDestination Text
pBucketName_ Text
pKmsKeyArn_ =
Destination'
{ $sel:keyPrefix:Destination' :: Maybe Text
keyPrefix = forall a. Maybe a
Prelude.Nothing,
$sel:bucketName:Destination' :: Text
bucketName = Text
pBucketName_,
$sel:kmsKeyArn:Destination' :: Text
kmsKeyArn = Text
pKmsKeyArn_
}
destination_keyPrefix :: Lens.Lens' Destination (Prelude.Maybe Prelude.Text)
destination_keyPrefix :: Lens' Destination (Maybe Text)
destination_keyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe Text
keyPrefix :: Maybe Text
$sel:keyPrefix:Destination' :: Destination -> Maybe Text
keyPrefix} -> Maybe Text
keyPrefix) (\s :: Destination
s@Destination' {} Maybe Text
a -> Destination
s {$sel:keyPrefix:Destination' :: Maybe Text
keyPrefix = Maybe Text
a} :: Destination)
destination_bucketName :: Lens.Lens' Destination Prelude.Text
destination_bucketName :: Lens' Destination Text
destination_bucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Text
bucketName :: Text
$sel:bucketName:Destination' :: Destination -> Text
bucketName} -> Text
bucketName) (\s :: Destination
s@Destination' {} Text
a -> Destination
s {$sel:bucketName:Destination' :: Text
bucketName = Text
a} :: Destination)
destination_kmsKeyArn :: Lens.Lens' Destination Prelude.Text
destination_kmsKeyArn :: Lens' Destination Text
destination_kmsKeyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Text
kmsKeyArn :: Text
$sel:kmsKeyArn:Destination' :: Destination -> Text
kmsKeyArn} -> Text
kmsKeyArn) (\s :: Destination
s@Destination' {} Text
a -> Destination
s {$sel:kmsKeyArn:Destination' :: Text
kmsKeyArn = Text
a} :: Destination)
instance Data.FromJSON Destination where
parseJSON :: Value -> Parser Destination
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Destination"
( \Object
x ->
Maybe Text -> Text -> Text -> Destination
Destination'
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
"keyPrefix")
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
"bucketName")
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
"kmsKeyArn")
)
instance Prelude.Hashable Destination where
hashWithSalt :: Int -> Destination -> Int
hashWithSalt Int
_salt Destination' {Maybe Text
Text
kmsKeyArn :: Text
bucketName :: Text
keyPrefix :: Maybe Text
$sel:kmsKeyArn:Destination' :: Destination -> Text
$sel:bucketName:Destination' :: Destination -> Text
$sel:keyPrefix:Destination' :: Destination -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyPrefix
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucketName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
kmsKeyArn
instance Prelude.NFData Destination where
rnf :: Destination -> ()
rnf Destination' {Maybe Text
Text
kmsKeyArn :: Text
bucketName :: Text
keyPrefix :: Maybe Text
$sel:kmsKeyArn:Destination' :: Destination -> Text
$sel:bucketName:Destination' :: Destination -> Text
$sel:keyPrefix:Destination' :: Destination -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyPrefix
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bucketName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
kmsKeyArn
instance Data.ToJSON Destination where
toJSON :: Destination -> Value
toJSON Destination' {Maybe Text
Text
kmsKeyArn :: Text
bucketName :: Text
keyPrefix :: Maybe Text
$sel:kmsKeyArn:Destination' :: Destination -> Text
$sel:bucketName:Destination' :: Destination -> Text
$sel:keyPrefix:Destination' :: Destination -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"keyPrefix" 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
keyPrefix,
forall a. a -> Maybe a
Prelude.Just (Key
"bucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucketName),
forall a. a -> Maybe a
Prelude.Just (Key
"kmsKeyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
kmsKeyArn)
]
)