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