{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoT.Types.AwsJobPresignedUrlConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.AwsJobPresignedUrlConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration information for pre-signed URLs. Valid when @protocols@
-- contains HTTP.
--
-- /See:/ 'newAwsJobPresignedUrlConfig' smart constructor.
data AwsJobPresignedUrlConfig = AwsJobPresignedUrlConfig'
  { -- | How long (in seconds) pre-signed URLs are valid. Valid values are 60 -
    -- 3600, the default value is 1800 seconds. Pre-signed URLs are generated
    -- when a request for the job document is received.
    AwsJobPresignedUrlConfig -> Maybe Integer
expiresInSec :: Prelude.Maybe Prelude.Integer
  }
  deriving (AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool
(AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool)
-> (AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool)
-> Eq AwsJobPresignedUrlConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool
$c/= :: AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool
== :: AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool
$c== :: AwsJobPresignedUrlConfig -> AwsJobPresignedUrlConfig -> Bool
Prelude.Eq, ReadPrec [AwsJobPresignedUrlConfig]
ReadPrec AwsJobPresignedUrlConfig
Int -> ReadS AwsJobPresignedUrlConfig
ReadS [AwsJobPresignedUrlConfig]
(Int -> ReadS AwsJobPresignedUrlConfig)
-> ReadS [AwsJobPresignedUrlConfig]
-> ReadPrec AwsJobPresignedUrlConfig
-> ReadPrec [AwsJobPresignedUrlConfig]
-> Read AwsJobPresignedUrlConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsJobPresignedUrlConfig]
$creadListPrec :: ReadPrec [AwsJobPresignedUrlConfig]
readPrec :: ReadPrec AwsJobPresignedUrlConfig
$creadPrec :: ReadPrec AwsJobPresignedUrlConfig
readList :: ReadS [AwsJobPresignedUrlConfig]
$creadList :: ReadS [AwsJobPresignedUrlConfig]
readsPrec :: Int -> ReadS AwsJobPresignedUrlConfig
$creadsPrec :: Int -> ReadS AwsJobPresignedUrlConfig
Prelude.Read, Int -> AwsJobPresignedUrlConfig -> ShowS
[AwsJobPresignedUrlConfig] -> ShowS
AwsJobPresignedUrlConfig -> String
(Int -> AwsJobPresignedUrlConfig -> ShowS)
-> (AwsJobPresignedUrlConfig -> String)
-> ([AwsJobPresignedUrlConfig] -> ShowS)
-> Show AwsJobPresignedUrlConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsJobPresignedUrlConfig] -> ShowS
$cshowList :: [AwsJobPresignedUrlConfig] -> ShowS
show :: AwsJobPresignedUrlConfig -> String
$cshow :: AwsJobPresignedUrlConfig -> String
showsPrec :: Int -> AwsJobPresignedUrlConfig -> ShowS
$cshowsPrec :: Int -> AwsJobPresignedUrlConfig -> ShowS
Prelude.Show, (forall x.
 AwsJobPresignedUrlConfig -> Rep AwsJobPresignedUrlConfig x)
-> (forall x.
    Rep AwsJobPresignedUrlConfig x -> AwsJobPresignedUrlConfig)
-> Generic AwsJobPresignedUrlConfig
forall x.
Rep AwsJobPresignedUrlConfig x -> AwsJobPresignedUrlConfig
forall x.
AwsJobPresignedUrlConfig -> Rep AwsJobPresignedUrlConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsJobPresignedUrlConfig x -> AwsJobPresignedUrlConfig
$cfrom :: forall x.
AwsJobPresignedUrlConfig -> Rep AwsJobPresignedUrlConfig x
Prelude.Generic)

-- |
-- Create a value of 'AwsJobPresignedUrlConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'expiresInSec', 'awsJobPresignedUrlConfig_expiresInSec' - How long (in seconds) pre-signed URLs are valid. Valid values are 60 -
-- 3600, the default value is 1800 seconds. Pre-signed URLs are generated
-- when a request for the job document is received.
newAwsJobPresignedUrlConfig ::
  AwsJobPresignedUrlConfig
newAwsJobPresignedUrlConfig :: AwsJobPresignedUrlConfig
newAwsJobPresignedUrlConfig =
  AwsJobPresignedUrlConfig' :: Maybe Integer -> AwsJobPresignedUrlConfig
AwsJobPresignedUrlConfig'
    { $sel:expiresInSec:AwsJobPresignedUrlConfig' :: Maybe Integer
expiresInSec =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | How long (in seconds) pre-signed URLs are valid. Valid values are 60 -
-- 3600, the default value is 1800 seconds. Pre-signed URLs are generated
-- when a request for the job document is received.
awsJobPresignedUrlConfig_expiresInSec :: Lens.Lens' AwsJobPresignedUrlConfig (Prelude.Maybe Prelude.Integer)
awsJobPresignedUrlConfig_expiresInSec :: (Maybe Integer -> f (Maybe Integer))
-> AwsJobPresignedUrlConfig -> f AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig_expiresInSec = (AwsJobPresignedUrlConfig -> Maybe Integer)
-> (AwsJobPresignedUrlConfig
    -> Maybe Integer -> AwsJobPresignedUrlConfig)
-> Lens
     AwsJobPresignedUrlConfig
     AwsJobPresignedUrlConfig
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsJobPresignedUrlConfig' {Maybe Integer
expiresInSec :: Maybe Integer
$sel:expiresInSec:AwsJobPresignedUrlConfig' :: AwsJobPresignedUrlConfig -> Maybe Integer
expiresInSec} -> Maybe Integer
expiresInSec) (\s :: AwsJobPresignedUrlConfig
s@AwsJobPresignedUrlConfig' {} Maybe Integer
a -> AwsJobPresignedUrlConfig
s {$sel:expiresInSec:AwsJobPresignedUrlConfig' :: Maybe Integer
expiresInSec = Maybe Integer
a} :: AwsJobPresignedUrlConfig)

instance Core.FromJSON AwsJobPresignedUrlConfig where
  parseJSON :: Value -> Parser AwsJobPresignedUrlConfig
parseJSON =
    String
-> (Object -> Parser AwsJobPresignedUrlConfig)
-> Value
-> Parser AwsJobPresignedUrlConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsJobPresignedUrlConfig"
      ( \Object
x ->
          Maybe Integer -> AwsJobPresignedUrlConfig
AwsJobPresignedUrlConfig'
            (Maybe Integer -> AwsJobPresignedUrlConfig)
-> Parser (Maybe Integer) -> Parser AwsJobPresignedUrlConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"expiresInSec")
      )

instance Prelude.Hashable AwsJobPresignedUrlConfig

instance Prelude.NFData AwsJobPresignedUrlConfig

instance Core.ToJSON AwsJobPresignedUrlConfig where
  toJSON :: AwsJobPresignedUrlConfig -> Value
toJSON AwsJobPresignedUrlConfig' {Maybe Integer
expiresInSec :: Maybe Integer
$sel:expiresInSec:AwsJobPresignedUrlConfig' :: AwsJobPresignedUrlConfig -> Maybe Integer
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"expiresInSec" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
expiresInSec]
      )