{-# 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.IoT.Types.S3Action where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.CannedAccessControlList
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3Action = S3Action'
{
S3Action -> Maybe CannedAccessControlList
cannedAcl :: Prelude.Maybe CannedAccessControlList,
S3Action -> Text
roleArn :: Prelude.Text,
S3Action -> Text
bucketName :: Prelude.Text,
S3Action -> Text
key :: Prelude.Text
}
deriving (S3Action -> S3Action -> Bool
(S3Action -> S3Action -> Bool)
-> (S3Action -> S3Action -> Bool) -> Eq S3Action
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Action -> S3Action -> Bool
$c/= :: S3Action -> S3Action -> Bool
== :: S3Action -> S3Action -> Bool
$c== :: S3Action -> S3Action -> Bool
Prelude.Eq, ReadPrec [S3Action]
ReadPrec S3Action
Int -> ReadS S3Action
ReadS [S3Action]
(Int -> ReadS S3Action)
-> ReadS [S3Action]
-> ReadPrec S3Action
-> ReadPrec [S3Action]
-> Read S3Action
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Action]
$creadListPrec :: ReadPrec [S3Action]
readPrec :: ReadPrec S3Action
$creadPrec :: ReadPrec S3Action
readList :: ReadS [S3Action]
$creadList :: ReadS [S3Action]
readsPrec :: Int -> ReadS S3Action
$creadsPrec :: Int -> ReadS S3Action
Prelude.Read, Int -> S3Action -> ShowS
[S3Action] -> ShowS
S3Action -> String
(Int -> S3Action -> ShowS)
-> (S3Action -> String) -> ([S3Action] -> ShowS) -> Show S3Action
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Action] -> ShowS
$cshowList :: [S3Action] -> ShowS
show :: S3Action -> String
$cshow :: S3Action -> String
showsPrec :: Int -> S3Action -> ShowS
$cshowsPrec :: Int -> S3Action -> ShowS
Prelude.Show, (forall x. S3Action -> Rep S3Action x)
-> (forall x. Rep S3Action x -> S3Action) -> Generic S3Action
forall x. Rep S3Action x -> S3Action
forall x. S3Action -> Rep S3Action x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Action x -> S3Action
$cfrom :: forall x. S3Action -> Rep S3Action x
Prelude.Generic)
newS3Action ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
S3Action
newS3Action :: Text -> Text -> Text -> S3Action
newS3Action Text
pRoleArn_ Text
pBucketName_ Text
pKey_ =
S3Action' :: Maybe CannedAccessControlList -> Text -> Text -> Text -> S3Action
S3Action'
{ $sel:cannedAcl:S3Action' :: Maybe CannedAccessControlList
cannedAcl = Maybe CannedAccessControlList
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:S3Action' :: Text
roleArn = Text
pRoleArn_,
$sel:bucketName:S3Action' :: Text
bucketName = Text
pBucketName_,
$sel:key:S3Action' :: Text
key = Text
pKey_
}
s3Action_cannedAcl :: Lens.Lens' S3Action (Prelude.Maybe CannedAccessControlList)
s3Action_cannedAcl :: (Maybe CannedAccessControlList
-> f (Maybe CannedAccessControlList))
-> S3Action -> f S3Action
s3Action_cannedAcl = (S3Action -> Maybe CannedAccessControlList)
-> (S3Action -> Maybe CannedAccessControlList -> S3Action)
-> Lens
S3Action
S3Action
(Maybe CannedAccessControlList)
(Maybe CannedAccessControlList)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Action' {Maybe CannedAccessControlList
cannedAcl :: Maybe CannedAccessControlList
$sel:cannedAcl:S3Action' :: S3Action -> Maybe CannedAccessControlList
cannedAcl} -> Maybe CannedAccessControlList
cannedAcl) (\s :: S3Action
s@S3Action' {} Maybe CannedAccessControlList
a -> S3Action
s {$sel:cannedAcl:S3Action' :: Maybe CannedAccessControlList
cannedAcl = Maybe CannedAccessControlList
a} :: S3Action)
s3Action_roleArn :: Lens.Lens' S3Action Prelude.Text
s3Action_roleArn :: (Text -> f Text) -> S3Action -> f S3Action
s3Action_roleArn = (S3Action -> Text)
-> (S3Action -> Text -> S3Action)
-> Lens S3Action S3Action Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Action' {Text
roleArn :: Text
$sel:roleArn:S3Action' :: S3Action -> Text
roleArn} -> Text
roleArn) (\s :: S3Action
s@S3Action' {} Text
a -> S3Action
s {$sel:roleArn:S3Action' :: Text
roleArn = Text
a} :: S3Action)
s3Action_bucketName :: Lens.Lens' S3Action Prelude.Text
s3Action_bucketName :: (Text -> f Text) -> S3Action -> f S3Action
s3Action_bucketName = (S3Action -> Text)
-> (S3Action -> Text -> S3Action)
-> Lens S3Action S3Action Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Action' {Text
bucketName :: Text
$sel:bucketName:S3Action' :: S3Action -> Text
bucketName} -> Text
bucketName) (\s :: S3Action
s@S3Action' {} Text
a -> S3Action
s {$sel:bucketName:S3Action' :: Text
bucketName = Text
a} :: S3Action)
s3Action_key :: Lens.Lens' S3Action Prelude.Text
s3Action_key :: (Text -> f Text) -> S3Action -> f S3Action
s3Action_key = (S3Action -> Text)
-> (S3Action -> Text -> S3Action)
-> Lens S3Action S3Action Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Action' {Text
key :: Text
$sel:key:S3Action' :: S3Action -> Text
key} -> Text
key) (\s :: S3Action
s@S3Action' {} Text
a -> S3Action
s {$sel:key:S3Action' :: Text
key = Text
a} :: S3Action)
instance Core.FromJSON S3Action where
parseJSON :: Value -> Parser S3Action
parseJSON =
String -> (Object -> Parser S3Action) -> Value -> Parser S3Action
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3Action"
( \Object
x ->
Maybe CannedAccessControlList -> Text -> Text -> Text -> S3Action
S3Action'
(Maybe CannedAccessControlList -> Text -> Text -> Text -> S3Action)
-> Parser (Maybe CannedAccessControlList)
-> Parser (Text -> Text -> Text -> S3Action)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CannedAccessControlList)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cannedAcl")
Parser (Text -> Text -> Text -> S3Action)
-> Parser Text -> Parser (Text -> Text -> S3Action)
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
"roleArn")
Parser (Text -> Text -> S3Action)
-> Parser Text -> Parser (Text -> S3Action)
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
"bucketName")
Parser (Text -> S3Action) -> Parser Text -> Parser S3Action
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
"key")
)
instance Prelude.Hashable S3Action
instance Prelude.NFData S3Action
instance Core.ToJSON S3Action where
toJSON :: S3Action -> Value
toJSON S3Action' {Maybe CannedAccessControlList
Text
key :: Text
bucketName :: Text
roleArn :: Text
cannedAcl :: Maybe CannedAccessControlList
$sel:key:S3Action' :: S3Action -> Text
$sel:bucketName:S3Action' :: S3Action -> Text
$sel:roleArn:S3Action' :: S3Action -> Text
$sel:cannedAcl:S3Action' :: S3Action -> Maybe CannedAccessControlList
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"cannedAcl" Text -> CannedAccessControlList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CannedAccessControlList -> Pair)
-> Maybe CannedAccessControlList -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CannedAccessControlList
cannedAcl,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key)
]
)