{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.Kinesis.IncreaseStreamRetentionPeriod
-- 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)
--
-- Increases the Kinesis data stream\'s retention period, which is the
-- length of time data records are accessible after they are added to the
-- stream. The maximum value of a stream\'s retention period is 168 hours
-- (7 days).
--
-- If you choose a longer stream retention period, this operation increases
-- the time period during which records that have not yet expired are
-- accessible. However, it does not make previous, expired data (older than
-- the stream\'s previous retention period) accessible after the operation
-- has been called. For example, if a stream\'s retention period is set to
-- 24 hours and is increased to 168 hours, any data that is older than 24
-- hours remains inaccessible to consumer applications.
module Amazonka.Kinesis.IncreaseStreamRetentionPeriod
  ( -- * Creating a Request
    IncreaseStreamRetentionPeriod (..),
    newIncreaseStreamRetentionPeriod,

    -- * Request Lenses
    increaseStreamRetentionPeriod_streamName,
    increaseStreamRetentionPeriod_retentionPeriodHours,

    -- * Destructuring the Response
    IncreaseStreamRetentionPeriodResponse (..),
    newIncreaseStreamRetentionPeriodResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Kinesis.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input for IncreaseStreamRetentionPeriod.
--
-- /See:/ 'newIncreaseStreamRetentionPeriod' smart constructor.
data IncreaseStreamRetentionPeriod = IncreaseStreamRetentionPeriod'
  { -- | The name of the stream to modify.
    IncreaseStreamRetentionPeriod -> Text
streamName :: Prelude.Text,
    -- | The new retention period of the stream, in hours. Must be more than the
    -- current retention period.
    IncreaseStreamRetentionPeriod -> Int
retentionPeriodHours :: Prelude.Int
  }
  deriving (IncreaseStreamRetentionPeriod
-> IncreaseStreamRetentionPeriod -> Bool
(IncreaseStreamRetentionPeriod
 -> IncreaseStreamRetentionPeriod -> Bool)
-> (IncreaseStreamRetentionPeriod
    -> IncreaseStreamRetentionPeriod -> Bool)
-> Eq IncreaseStreamRetentionPeriod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IncreaseStreamRetentionPeriod
-> IncreaseStreamRetentionPeriod -> Bool
$c/= :: IncreaseStreamRetentionPeriod
-> IncreaseStreamRetentionPeriod -> Bool
== :: IncreaseStreamRetentionPeriod
-> IncreaseStreamRetentionPeriod -> Bool
$c== :: IncreaseStreamRetentionPeriod
-> IncreaseStreamRetentionPeriod -> Bool
Prelude.Eq, ReadPrec [IncreaseStreamRetentionPeriod]
ReadPrec IncreaseStreamRetentionPeriod
Int -> ReadS IncreaseStreamRetentionPeriod
ReadS [IncreaseStreamRetentionPeriod]
(Int -> ReadS IncreaseStreamRetentionPeriod)
-> ReadS [IncreaseStreamRetentionPeriod]
-> ReadPrec IncreaseStreamRetentionPeriod
-> ReadPrec [IncreaseStreamRetentionPeriod]
-> Read IncreaseStreamRetentionPeriod
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IncreaseStreamRetentionPeriod]
$creadListPrec :: ReadPrec [IncreaseStreamRetentionPeriod]
readPrec :: ReadPrec IncreaseStreamRetentionPeriod
$creadPrec :: ReadPrec IncreaseStreamRetentionPeriod
readList :: ReadS [IncreaseStreamRetentionPeriod]
$creadList :: ReadS [IncreaseStreamRetentionPeriod]
readsPrec :: Int -> ReadS IncreaseStreamRetentionPeriod
$creadsPrec :: Int -> ReadS IncreaseStreamRetentionPeriod
Prelude.Read, Int -> IncreaseStreamRetentionPeriod -> ShowS
[IncreaseStreamRetentionPeriod] -> ShowS
IncreaseStreamRetentionPeriod -> String
(Int -> IncreaseStreamRetentionPeriod -> ShowS)
-> (IncreaseStreamRetentionPeriod -> String)
-> ([IncreaseStreamRetentionPeriod] -> ShowS)
-> Show IncreaseStreamRetentionPeriod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IncreaseStreamRetentionPeriod] -> ShowS
$cshowList :: [IncreaseStreamRetentionPeriod] -> ShowS
show :: IncreaseStreamRetentionPeriod -> String
$cshow :: IncreaseStreamRetentionPeriod -> String
showsPrec :: Int -> IncreaseStreamRetentionPeriod -> ShowS
$cshowsPrec :: Int -> IncreaseStreamRetentionPeriod -> ShowS
Prelude.Show, (forall x.
 IncreaseStreamRetentionPeriod
 -> Rep IncreaseStreamRetentionPeriod x)
-> (forall x.
    Rep IncreaseStreamRetentionPeriod x
    -> IncreaseStreamRetentionPeriod)
-> Generic IncreaseStreamRetentionPeriod
forall x.
Rep IncreaseStreamRetentionPeriod x
-> IncreaseStreamRetentionPeriod
forall x.
IncreaseStreamRetentionPeriod
-> Rep IncreaseStreamRetentionPeriod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IncreaseStreamRetentionPeriod x
-> IncreaseStreamRetentionPeriod
$cfrom :: forall x.
IncreaseStreamRetentionPeriod
-> Rep IncreaseStreamRetentionPeriod x
Prelude.Generic)

-- |
-- Create a value of 'IncreaseStreamRetentionPeriod' 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:
--
-- 'streamName', 'increaseStreamRetentionPeriod_streamName' - The name of the stream to modify.
--
-- 'retentionPeriodHours', 'increaseStreamRetentionPeriod_retentionPeriodHours' - The new retention period of the stream, in hours. Must be more than the
-- current retention period.
newIncreaseStreamRetentionPeriod ::
  -- | 'streamName'
  Prelude.Text ->
  -- | 'retentionPeriodHours'
  Prelude.Int ->
  IncreaseStreamRetentionPeriod
newIncreaseStreamRetentionPeriod :: Text -> Int -> IncreaseStreamRetentionPeriod
newIncreaseStreamRetentionPeriod
  Text
pStreamName_
  Int
pRetentionPeriodHours_ =
    IncreaseStreamRetentionPeriod' :: Text -> Int -> IncreaseStreamRetentionPeriod
IncreaseStreamRetentionPeriod'
      { $sel:streamName:IncreaseStreamRetentionPeriod' :: Text
streamName =
          Text
pStreamName_,
        $sel:retentionPeriodHours:IncreaseStreamRetentionPeriod' :: Int
retentionPeriodHours =
          Int
pRetentionPeriodHours_
      }

-- | The name of the stream to modify.
increaseStreamRetentionPeriod_streamName :: Lens.Lens' IncreaseStreamRetentionPeriod Prelude.Text
increaseStreamRetentionPeriod_streamName :: (Text -> f Text)
-> IncreaseStreamRetentionPeriod -> f IncreaseStreamRetentionPeriod
increaseStreamRetentionPeriod_streamName = (IncreaseStreamRetentionPeriod -> Text)
-> (IncreaseStreamRetentionPeriod
    -> Text -> IncreaseStreamRetentionPeriod)
-> Lens
     IncreaseStreamRetentionPeriod
     IncreaseStreamRetentionPeriod
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseStreamRetentionPeriod' {Text
streamName :: Text
$sel:streamName:IncreaseStreamRetentionPeriod' :: IncreaseStreamRetentionPeriod -> Text
streamName} -> Text
streamName) (\s :: IncreaseStreamRetentionPeriod
s@IncreaseStreamRetentionPeriod' {} Text
a -> IncreaseStreamRetentionPeriod
s {$sel:streamName:IncreaseStreamRetentionPeriod' :: Text
streamName = Text
a} :: IncreaseStreamRetentionPeriod)

-- | The new retention period of the stream, in hours. Must be more than the
-- current retention period.
increaseStreamRetentionPeriod_retentionPeriodHours :: Lens.Lens' IncreaseStreamRetentionPeriod Prelude.Int
increaseStreamRetentionPeriod_retentionPeriodHours :: (Int -> f Int)
-> IncreaseStreamRetentionPeriod -> f IncreaseStreamRetentionPeriod
increaseStreamRetentionPeriod_retentionPeriodHours = (IncreaseStreamRetentionPeriod -> Int)
-> (IncreaseStreamRetentionPeriod
    -> Int -> IncreaseStreamRetentionPeriod)
-> Lens
     IncreaseStreamRetentionPeriod IncreaseStreamRetentionPeriod Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseStreamRetentionPeriod' {Int
retentionPeriodHours :: Int
$sel:retentionPeriodHours:IncreaseStreamRetentionPeriod' :: IncreaseStreamRetentionPeriod -> Int
retentionPeriodHours} -> Int
retentionPeriodHours) (\s :: IncreaseStreamRetentionPeriod
s@IncreaseStreamRetentionPeriod' {} Int
a -> IncreaseStreamRetentionPeriod
s {$sel:retentionPeriodHours:IncreaseStreamRetentionPeriod' :: Int
retentionPeriodHours = Int
a} :: IncreaseStreamRetentionPeriod)

instance
  Core.AWSRequest
    IncreaseStreamRetentionPeriod
  where
  type
    AWSResponse IncreaseStreamRetentionPeriod =
      IncreaseStreamRetentionPeriodResponse
  request :: IncreaseStreamRetentionPeriod
-> Request IncreaseStreamRetentionPeriod
request = Service
-> IncreaseStreamRetentionPeriod
-> Request IncreaseStreamRetentionPeriod
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy IncreaseStreamRetentionPeriod
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse IncreaseStreamRetentionPeriod)))
response =
    AWSResponse IncreaseStreamRetentionPeriod
-> Logger
-> Service
-> Proxy IncreaseStreamRetentionPeriod
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse IncreaseStreamRetentionPeriod)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse IncreaseStreamRetentionPeriod
IncreaseStreamRetentionPeriodResponse
IncreaseStreamRetentionPeriodResponse'

instance
  Prelude.Hashable
    IncreaseStreamRetentionPeriod

instance Prelude.NFData IncreaseStreamRetentionPeriod

instance Core.ToHeaders IncreaseStreamRetentionPeriod where
  toHeaders :: IncreaseStreamRetentionPeriod -> [Header]
toHeaders =
    [Header] -> IncreaseStreamRetentionPeriod -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"Kinesis_20131202.IncreaseStreamRetentionPeriod" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON IncreaseStreamRetentionPeriod where
  toJSON :: IncreaseStreamRetentionPeriod -> Value
toJSON IncreaseStreamRetentionPeriod' {Int
Text
retentionPeriodHours :: Int
streamName :: Text
$sel:retentionPeriodHours:IncreaseStreamRetentionPeriod' :: IncreaseStreamRetentionPeriod -> Int
$sel:streamName:IncreaseStreamRetentionPeriod' :: IncreaseStreamRetentionPeriod -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
streamName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"RetentionPeriodHours"
                  Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
retentionPeriodHours
              )
          ]
      )

instance Core.ToPath IncreaseStreamRetentionPeriod where
  toPath :: IncreaseStreamRetentionPeriod -> ByteString
toPath = ByteString -> IncreaseStreamRetentionPeriod -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery IncreaseStreamRetentionPeriod where
  toQuery :: IncreaseStreamRetentionPeriod -> QueryString
toQuery = QueryString -> IncreaseStreamRetentionPeriod -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newIncreaseStreamRetentionPeriodResponse' smart constructor.
data IncreaseStreamRetentionPeriodResponse = IncreaseStreamRetentionPeriodResponse'
  {
  }
  deriving (IncreaseStreamRetentionPeriodResponse
-> IncreaseStreamRetentionPeriodResponse -> Bool
(IncreaseStreamRetentionPeriodResponse
 -> IncreaseStreamRetentionPeriodResponse -> Bool)
-> (IncreaseStreamRetentionPeriodResponse
    -> IncreaseStreamRetentionPeriodResponse -> Bool)
-> Eq IncreaseStreamRetentionPeriodResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IncreaseStreamRetentionPeriodResponse
-> IncreaseStreamRetentionPeriodResponse -> Bool
$c/= :: IncreaseStreamRetentionPeriodResponse
-> IncreaseStreamRetentionPeriodResponse -> Bool
== :: IncreaseStreamRetentionPeriodResponse
-> IncreaseStreamRetentionPeriodResponse -> Bool
$c== :: IncreaseStreamRetentionPeriodResponse
-> IncreaseStreamRetentionPeriodResponse -> Bool
Prelude.Eq, ReadPrec [IncreaseStreamRetentionPeriodResponse]
ReadPrec IncreaseStreamRetentionPeriodResponse
Int -> ReadS IncreaseStreamRetentionPeriodResponse
ReadS [IncreaseStreamRetentionPeriodResponse]
(Int -> ReadS IncreaseStreamRetentionPeriodResponse)
-> ReadS [IncreaseStreamRetentionPeriodResponse]
-> ReadPrec IncreaseStreamRetentionPeriodResponse
-> ReadPrec [IncreaseStreamRetentionPeriodResponse]
-> Read IncreaseStreamRetentionPeriodResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IncreaseStreamRetentionPeriodResponse]
$creadListPrec :: ReadPrec [IncreaseStreamRetentionPeriodResponse]
readPrec :: ReadPrec IncreaseStreamRetentionPeriodResponse
$creadPrec :: ReadPrec IncreaseStreamRetentionPeriodResponse
readList :: ReadS [IncreaseStreamRetentionPeriodResponse]
$creadList :: ReadS [IncreaseStreamRetentionPeriodResponse]
readsPrec :: Int -> ReadS IncreaseStreamRetentionPeriodResponse
$creadsPrec :: Int -> ReadS IncreaseStreamRetentionPeriodResponse
Prelude.Read, Int -> IncreaseStreamRetentionPeriodResponse -> ShowS
[IncreaseStreamRetentionPeriodResponse] -> ShowS
IncreaseStreamRetentionPeriodResponse -> String
(Int -> IncreaseStreamRetentionPeriodResponse -> ShowS)
-> (IncreaseStreamRetentionPeriodResponse -> String)
-> ([IncreaseStreamRetentionPeriodResponse] -> ShowS)
-> Show IncreaseStreamRetentionPeriodResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IncreaseStreamRetentionPeriodResponse] -> ShowS
$cshowList :: [IncreaseStreamRetentionPeriodResponse] -> ShowS
show :: IncreaseStreamRetentionPeriodResponse -> String
$cshow :: IncreaseStreamRetentionPeriodResponse -> String
showsPrec :: Int -> IncreaseStreamRetentionPeriodResponse -> ShowS
$cshowsPrec :: Int -> IncreaseStreamRetentionPeriodResponse -> ShowS
Prelude.Show, (forall x.
 IncreaseStreamRetentionPeriodResponse
 -> Rep IncreaseStreamRetentionPeriodResponse x)
-> (forall x.
    Rep IncreaseStreamRetentionPeriodResponse x
    -> IncreaseStreamRetentionPeriodResponse)
-> Generic IncreaseStreamRetentionPeriodResponse
forall x.
Rep IncreaseStreamRetentionPeriodResponse x
-> IncreaseStreamRetentionPeriodResponse
forall x.
IncreaseStreamRetentionPeriodResponse
-> Rep IncreaseStreamRetentionPeriodResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IncreaseStreamRetentionPeriodResponse x
-> IncreaseStreamRetentionPeriodResponse
$cfrom :: forall x.
IncreaseStreamRetentionPeriodResponse
-> Rep IncreaseStreamRetentionPeriodResponse x
Prelude.Generic)

-- |
-- Create a value of 'IncreaseStreamRetentionPeriodResponse' 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.
newIncreaseStreamRetentionPeriodResponse ::
  IncreaseStreamRetentionPeriodResponse
newIncreaseStreamRetentionPeriodResponse :: IncreaseStreamRetentionPeriodResponse
newIncreaseStreamRetentionPeriodResponse =
  IncreaseStreamRetentionPeriodResponse
IncreaseStreamRetentionPeriodResponse'

instance
  Prelude.NFData
    IncreaseStreamRetentionPeriodResponse