{-# 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.WAFV2.UpdateManagedRuleSetVersionExpiryDate
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the expiration information for your managed rule set. Use this
-- to initiate the expiration of a managed rule group version. After you
-- initiate expiration for a version, WAF excludes it from the response to
-- ListAvailableManagedRuleGroupVersions for the managed rule group.
--
-- This is intended for use only by vendors of managed rule sets. Vendors
-- are Amazon Web Services and Amazon Web Services Marketplace sellers.
--
-- Vendors, you can use the managed rule set APIs to provide controlled
-- rollout of your versioned managed rule group offerings for your
-- customers. The APIs are @ListManagedRuleSets@, @GetManagedRuleSet@,
-- @PutManagedRuleSetVersions@, and
-- @UpdateManagedRuleSetVersionExpiryDate@.
module Amazonka.WAFV2.UpdateManagedRuleSetVersionExpiryDate
  ( -- * Creating a Request
    UpdateManagedRuleSetVersionExpiryDate (..),
    newUpdateManagedRuleSetVersionExpiryDate,

    -- * Request Lenses
    updateManagedRuleSetVersionExpiryDate_name,
    updateManagedRuleSetVersionExpiryDate_scope,
    updateManagedRuleSetVersionExpiryDate_id,
    updateManagedRuleSetVersionExpiryDate_lockToken,
    updateManagedRuleSetVersionExpiryDate_versionToExpire,
    updateManagedRuleSetVersionExpiryDate_expiryTimestamp,

    -- * Destructuring the Response
    UpdateManagedRuleSetVersionExpiryDateResponse (..),
    newUpdateManagedRuleSetVersionExpiryDateResponse,

    -- * Response Lenses
    updateManagedRuleSetVersionExpiryDateResponse_expiringVersion,
    updateManagedRuleSetVersionExpiryDateResponse_expiryTimestamp,
    updateManagedRuleSetVersionExpiryDateResponse_nextLockToken,
    updateManagedRuleSetVersionExpiryDateResponse_httpStatus,
  )
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAFV2.Types

-- | /See:/ 'newUpdateManagedRuleSetVersionExpiryDate' smart constructor.
data UpdateManagedRuleSetVersionExpiryDate = UpdateManagedRuleSetVersionExpiryDate'
  { -- | The name of the managed rule set. You use this, along with the rule set
    -- ID, to identify the rule set.
    --
    -- This name is assigned to the corresponding managed rule group, which
    -- your customers can access and use.
    UpdateManagedRuleSetVersionExpiryDate -> Text
name :: Prelude.Text,
    -- | Specifies whether this is for an Amazon CloudFront distribution or for a
    -- regional application. A regional application can be an Application Load
    -- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API,
    -- or an Amazon Cognito user pool.
    --
    -- To work with CloudFront, you must also specify the Region US East (N.
    -- Virginia) as follows:
    --
    -- -   CLI - Specify the Region when you use the CloudFront scope:
    --     @--scope=CLOUDFRONT --region=us-east-1@.
    --
    -- -   API and SDKs - For all calls, use the Region endpoint us-east-1.
    UpdateManagedRuleSetVersionExpiryDate -> Scope
scope :: Scope,
    -- | A unique identifier for the managed rule set. The ID is returned in the
    -- responses to commands like @list@. You provide it to operations like
    -- @get@ and @update@.
    UpdateManagedRuleSetVersionExpiryDate -> Text
id :: Prelude.Text,
    -- | A token used for optimistic locking. WAF returns a token to your @get@
    -- and @list@ requests, to mark the state of the entity at the time of the
    -- request. To make changes to the entity associated with the token, you
    -- provide the token to operations like @update@ and @delete@. WAF uses the
    -- token to ensure that no changes have been made to the entity since you
    -- last retrieved it. If a change has been made, the update fails with a
    -- @WAFOptimisticLockException@. If this happens, perform another @get@,
    -- and use the new token returned by that operation.
    UpdateManagedRuleSetVersionExpiryDate -> Text
lockToken :: Prelude.Text,
    -- | The version that you want to remove from your list of offerings for the
    -- named managed rule group.
    UpdateManagedRuleSetVersionExpiryDate -> Text
versionToExpire :: Prelude.Text,
    -- | The time that you want the version to expire.
    --
    -- Times are in Coordinated Universal Time (UTC) format. UTC format
    -- includes the special designator, Z. For example, \"2016-09-27T14:50Z\".
    UpdateManagedRuleSetVersionExpiryDate -> POSIX
expiryTimestamp :: Data.POSIX
  }
  deriving (UpdateManagedRuleSetVersionExpiryDate
-> UpdateManagedRuleSetVersionExpiryDate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateManagedRuleSetVersionExpiryDate
-> UpdateManagedRuleSetVersionExpiryDate -> Bool
$c/= :: UpdateManagedRuleSetVersionExpiryDate
-> UpdateManagedRuleSetVersionExpiryDate -> Bool
== :: UpdateManagedRuleSetVersionExpiryDate
-> UpdateManagedRuleSetVersionExpiryDate -> Bool
$c== :: UpdateManagedRuleSetVersionExpiryDate
-> UpdateManagedRuleSetVersionExpiryDate -> Bool
Prelude.Eq, ReadPrec [UpdateManagedRuleSetVersionExpiryDate]
ReadPrec UpdateManagedRuleSetVersionExpiryDate
Int -> ReadS UpdateManagedRuleSetVersionExpiryDate
ReadS [UpdateManagedRuleSetVersionExpiryDate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateManagedRuleSetVersionExpiryDate]
$creadListPrec :: ReadPrec [UpdateManagedRuleSetVersionExpiryDate]
readPrec :: ReadPrec UpdateManagedRuleSetVersionExpiryDate
$creadPrec :: ReadPrec UpdateManagedRuleSetVersionExpiryDate
readList :: ReadS [UpdateManagedRuleSetVersionExpiryDate]
$creadList :: ReadS [UpdateManagedRuleSetVersionExpiryDate]
readsPrec :: Int -> ReadS UpdateManagedRuleSetVersionExpiryDate
$creadsPrec :: Int -> ReadS UpdateManagedRuleSetVersionExpiryDate
Prelude.Read, Int -> UpdateManagedRuleSetVersionExpiryDate -> ShowS
[UpdateManagedRuleSetVersionExpiryDate] -> ShowS
UpdateManagedRuleSetVersionExpiryDate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateManagedRuleSetVersionExpiryDate] -> ShowS
$cshowList :: [UpdateManagedRuleSetVersionExpiryDate] -> ShowS
show :: UpdateManagedRuleSetVersionExpiryDate -> String
$cshow :: UpdateManagedRuleSetVersionExpiryDate -> String
showsPrec :: Int -> UpdateManagedRuleSetVersionExpiryDate -> ShowS
$cshowsPrec :: Int -> UpdateManagedRuleSetVersionExpiryDate -> ShowS
Prelude.Show, forall x.
Rep UpdateManagedRuleSetVersionExpiryDate x
-> UpdateManagedRuleSetVersionExpiryDate
forall x.
UpdateManagedRuleSetVersionExpiryDate
-> Rep UpdateManagedRuleSetVersionExpiryDate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateManagedRuleSetVersionExpiryDate x
-> UpdateManagedRuleSetVersionExpiryDate
$cfrom :: forall x.
UpdateManagedRuleSetVersionExpiryDate
-> Rep UpdateManagedRuleSetVersionExpiryDate x
Prelude.Generic)

-- |
-- Create a value of 'UpdateManagedRuleSetVersionExpiryDate' 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:
--
-- 'name', 'updateManagedRuleSetVersionExpiryDate_name' - The name of the managed rule set. You use this, along with the rule set
-- ID, to identify the rule set.
--
-- This name is assigned to the corresponding managed rule group, which
-- your customers can access and use.
--
-- 'scope', 'updateManagedRuleSetVersionExpiryDate_scope' - Specifies whether this is for an Amazon CloudFront distribution or for a
-- regional application. A regional application can be an Application Load
-- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API,
-- or an Amazon Cognito user pool.
--
-- To work with CloudFront, you must also specify the Region US East (N.
-- Virginia) as follows:
--
-- -   CLI - Specify the Region when you use the CloudFront scope:
--     @--scope=CLOUDFRONT --region=us-east-1@.
--
-- -   API and SDKs - For all calls, use the Region endpoint us-east-1.
--
-- 'id', 'updateManagedRuleSetVersionExpiryDate_id' - A unique identifier for the managed rule set. The ID is returned in the
-- responses to commands like @list@. You provide it to operations like
-- @get@ and @update@.
--
-- 'lockToken', 'updateManagedRuleSetVersionExpiryDate_lockToken' - A token used for optimistic locking. WAF returns a token to your @get@
-- and @list@ requests, to mark the state of the entity at the time of the
-- request. To make changes to the entity associated with the token, you
-- provide the token to operations like @update@ and @delete@. WAF uses the
-- token to ensure that no changes have been made to the entity since you
-- last retrieved it. If a change has been made, the update fails with a
-- @WAFOptimisticLockException@. If this happens, perform another @get@,
-- and use the new token returned by that operation.
--
-- 'versionToExpire', 'updateManagedRuleSetVersionExpiryDate_versionToExpire' - The version that you want to remove from your list of offerings for the
-- named managed rule group.
--
-- 'expiryTimestamp', 'updateManagedRuleSetVersionExpiryDate_expiryTimestamp' - The time that you want the version to expire.
--
-- Times are in Coordinated Universal Time (UTC) format. UTC format
-- includes the special designator, Z. For example, \"2016-09-27T14:50Z\".
newUpdateManagedRuleSetVersionExpiryDate ::
  -- | 'name'
  Prelude.Text ->
  -- | 'scope'
  Scope ->
  -- | 'id'
  Prelude.Text ->
  -- | 'lockToken'
  Prelude.Text ->
  -- | 'versionToExpire'
  Prelude.Text ->
  -- | 'expiryTimestamp'
  Prelude.UTCTime ->
  UpdateManagedRuleSetVersionExpiryDate
newUpdateManagedRuleSetVersionExpiryDate :: Text
-> Scope
-> Text
-> Text
-> Text
-> UTCTime
-> UpdateManagedRuleSetVersionExpiryDate
newUpdateManagedRuleSetVersionExpiryDate
  Text
pName_
  Scope
pScope_
  Text
pId_
  Text
pLockToken_
  Text
pVersionToExpire_
  UTCTime
pExpiryTimestamp_ =
    UpdateManagedRuleSetVersionExpiryDate'
      { $sel:name:UpdateManagedRuleSetVersionExpiryDate' :: Text
name =
          Text
pName_,
        $sel:scope:UpdateManagedRuleSetVersionExpiryDate' :: Scope
scope = Scope
pScope_,
        $sel:id:UpdateManagedRuleSetVersionExpiryDate' :: Text
id = Text
pId_,
        $sel:lockToken:UpdateManagedRuleSetVersionExpiryDate' :: Text
lockToken = Text
pLockToken_,
        $sel:versionToExpire:UpdateManagedRuleSetVersionExpiryDate' :: Text
versionToExpire = Text
pVersionToExpire_,
        $sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDate' :: POSIX
expiryTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
            forall t b. AReview t b -> b -> t
Lens.# UTCTime
pExpiryTimestamp_
      }

-- | The name of the managed rule set. You use this, along with the rule set
-- ID, to identify the rule set.
--
-- This name is assigned to the corresponding managed rule group, which
-- your customers can access and use.
updateManagedRuleSetVersionExpiryDate_name :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDate Prelude.Text
updateManagedRuleSetVersionExpiryDate_name :: Lens' UpdateManagedRuleSetVersionExpiryDate Text
updateManagedRuleSetVersionExpiryDate_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDate' {Text
name :: Text
$sel:name:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
name} -> Text
name) (\s :: UpdateManagedRuleSetVersionExpiryDate
s@UpdateManagedRuleSetVersionExpiryDate' {} Text
a -> UpdateManagedRuleSetVersionExpiryDate
s {$sel:name:UpdateManagedRuleSetVersionExpiryDate' :: Text
name = Text
a} :: UpdateManagedRuleSetVersionExpiryDate)

-- | Specifies whether this is for an Amazon CloudFront distribution or for a
-- regional application. A regional application can be an Application Load
-- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API,
-- or an Amazon Cognito user pool.
--
-- To work with CloudFront, you must also specify the Region US East (N.
-- Virginia) as follows:
--
-- -   CLI - Specify the Region when you use the CloudFront scope:
--     @--scope=CLOUDFRONT --region=us-east-1@.
--
-- -   API and SDKs - For all calls, use the Region endpoint us-east-1.
updateManagedRuleSetVersionExpiryDate_scope :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDate Scope
updateManagedRuleSetVersionExpiryDate_scope :: Lens' UpdateManagedRuleSetVersionExpiryDate Scope
updateManagedRuleSetVersionExpiryDate_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDate' {Scope
scope :: Scope
$sel:scope:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Scope
scope} -> Scope
scope) (\s :: UpdateManagedRuleSetVersionExpiryDate
s@UpdateManagedRuleSetVersionExpiryDate' {} Scope
a -> UpdateManagedRuleSetVersionExpiryDate
s {$sel:scope:UpdateManagedRuleSetVersionExpiryDate' :: Scope
scope = Scope
a} :: UpdateManagedRuleSetVersionExpiryDate)

-- | A unique identifier for the managed rule set. The ID is returned in the
-- responses to commands like @list@. You provide it to operations like
-- @get@ and @update@.
updateManagedRuleSetVersionExpiryDate_id :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDate Prelude.Text
updateManagedRuleSetVersionExpiryDate_id :: Lens' UpdateManagedRuleSetVersionExpiryDate Text
updateManagedRuleSetVersionExpiryDate_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDate' {Text
id :: Text
$sel:id:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
id} -> Text
id) (\s :: UpdateManagedRuleSetVersionExpiryDate
s@UpdateManagedRuleSetVersionExpiryDate' {} Text
a -> UpdateManagedRuleSetVersionExpiryDate
s {$sel:id:UpdateManagedRuleSetVersionExpiryDate' :: Text
id = Text
a} :: UpdateManagedRuleSetVersionExpiryDate)

-- | A token used for optimistic locking. WAF returns a token to your @get@
-- and @list@ requests, to mark the state of the entity at the time of the
-- request. To make changes to the entity associated with the token, you
-- provide the token to operations like @update@ and @delete@. WAF uses the
-- token to ensure that no changes have been made to the entity since you
-- last retrieved it. If a change has been made, the update fails with a
-- @WAFOptimisticLockException@. If this happens, perform another @get@,
-- and use the new token returned by that operation.
updateManagedRuleSetVersionExpiryDate_lockToken :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDate Prelude.Text
updateManagedRuleSetVersionExpiryDate_lockToken :: Lens' UpdateManagedRuleSetVersionExpiryDate Text
updateManagedRuleSetVersionExpiryDate_lockToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDate' {Text
lockToken :: Text
$sel:lockToken:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
lockToken} -> Text
lockToken) (\s :: UpdateManagedRuleSetVersionExpiryDate
s@UpdateManagedRuleSetVersionExpiryDate' {} Text
a -> UpdateManagedRuleSetVersionExpiryDate
s {$sel:lockToken:UpdateManagedRuleSetVersionExpiryDate' :: Text
lockToken = Text
a} :: UpdateManagedRuleSetVersionExpiryDate)

-- | The version that you want to remove from your list of offerings for the
-- named managed rule group.
updateManagedRuleSetVersionExpiryDate_versionToExpire :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDate Prelude.Text
updateManagedRuleSetVersionExpiryDate_versionToExpire :: Lens' UpdateManagedRuleSetVersionExpiryDate Text
updateManagedRuleSetVersionExpiryDate_versionToExpire = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDate' {Text
versionToExpire :: Text
$sel:versionToExpire:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
versionToExpire} -> Text
versionToExpire) (\s :: UpdateManagedRuleSetVersionExpiryDate
s@UpdateManagedRuleSetVersionExpiryDate' {} Text
a -> UpdateManagedRuleSetVersionExpiryDate
s {$sel:versionToExpire:UpdateManagedRuleSetVersionExpiryDate' :: Text
versionToExpire = Text
a} :: UpdateManagedRuleSetVersionExpiryDate)

-- | The time that you want the version to expire.
--
-- Times are in Coordinated Universal Time (UTC) format. UTC format
-- includes the special designator, Z. For example, \"2016-09-27T14:50Z\".
updateManagedRuleSetVersionExpiryDate_expiryTimestamp :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDate Prelude.UTCTime
updateManagedRuleSetVersionExpiryDate_expiryTimestamp :: Lens' UpdateManagedRuleSetVersionExpiryDate UTCTime
updateManagedRuleSetVersionExpiryDate_expiryTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDate' {POSIX
expiryTimestamp :: POSIX
$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> POSIX
expiryTimestamp} -> POSIX
expiryTimestamp) (\s :: UpdateManagedRuleSetVersionExpiryDate
s@UpdateManagedRuleSetVersionExpiryDate' {} POSIX
a -> UpdateManagedRuleSetVersionExpiryDate
s {$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDate' :: POSIX
expiryTimestamp = POSIX
a} :: UpdateManagedRuleSetVersionExpiryDate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance
  Core.AWSRequest
    UpdateManagedRuleSetVersionExpiryDate
  where
  type
    AWSResponse
      UpdateManagedRuleSetVersionExpiryDate =
      UpdateManagedRuleSetVersionExpiryDateResponse
  request :: (Service -> Service)
-> UpdateManagedRuleSetVersionExpiryDate
-> Request UpdateManagedRuleSetVersionExpiryDate
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateManagedRuleSetVersionExpiryDate
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse UpdateManagedRuleSetVersionExpiryDate)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Int
-> UpdateManagedRuleSetVersionExpiryDateResponse
UpdateManagedRuleSetVersionExpiryDateResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ExpiringVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ExpiryTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextLockToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    UpdateManagedRuleSetVersionExpiryDate
  where
  hashWithSalt :: Int -> UpdateManagedRuleSetVersionExpiryDate -> Int
hashWithSalt
    Int
_salt
    UpdateManagedRuleSetVersionExpiryDate' {Text
POSIX
Scope
expiryTimestamp :: POSIX
versionToExpire :: Text
lockToken :: Text
id :: Text
scope :: Scope
name :: Text
$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> POSIX
$sel:versionToExpire:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:lockToken:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:id:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:scope:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Scope
$sel:name:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Scope
scope
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
lockToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
versionToExpire
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
expiryTimestamp

instance
  Prelude.NFData
    UpdateManagedRuleSetVersionExpiryDate
  where
  rnf :: UpdateManagedRuleSetVersionExpiryDate -> ()
rnf UpdateManagedRuleSetVersionExpiryDate' {Text
POSIX
Scope
expiryTimestamp :: POSIX
versionToExpire :: Text
lockToken :: Text
id :: Text
scope :: Scope
name :: Text
$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> POSIX
$sel:versionToExpire:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:lockToken:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:id:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:scope:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Scope
$sel:name:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Scope
scope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
lockToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
versionToExpire
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
expiryTimestamp

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

instance
  Data.ToJSON
    UpdateManagedRuleSetVersionExpiryDate
  where
  toJSON :: UpdateManagedRuleSetVersionExpiryDate -> Value
toJSON UpdateManagedRuleSetVersionExpiryDate' {Text
POSIX
Scope
expiryTimestamp :: POSIX
versionToExpire :: Text
lockToken :: Text
id :: Text
scope :: Scope
name :: Text
$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> POSIX
$sel:versionToExpire:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:lockToken:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:id:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
$sel:scope:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Scope
$sel:name:UpdateManagedRuleSetVersionExpiryDate' :: UpdateManagedRuleSetVersionExpiryDate -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Scope" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Scope
scope),
            forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id),
            forall a. a -> Maybe a
Prelude.Just (Key
"LockToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
lockToken),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"VersionToExpire" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
versionToExpire),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ExpiryTimestamp" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
expiryTimestamp)
          ]
      )

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

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

-- | /See:/ 'newUpdateManagedRuleSetVersionExpiryDateResponse' smart constructor.
data UpdateManagedRuleSetVersionExpiryDateResponse = UpdateManagedRuleSetVersionExpiryDateResponse'
  { -- | The version that is set to expire.
    UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe Text
expiringVersion :: Prelude.Maybe Prelude.Text,
    -- | The time that the version will expire.
    --
    -- Times are in Coordinated Universal Time (UTC) format. UTC format
    -- includes the special designator, Z. For example, \"2016-09-27T14:50Z\".
    UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe POSIX
expiryTimestamp :: Prelude.Maybe Data.POSIX,
    -- | A token used for optimistic locking. WAF returns a token to your @get@
    -- and @list@ requests, to mark the state of the entity at the time of the
    -- request. To make changes to the entity associated with the token, you
    -- provide the token to operations like @update@ and @delete@. WAF uses the
    -- token to ensure that no changes have been made to the entity since you
    -- last retrieved it. If a change has been made, the update fails with a
    -- @WAFOptimisticLockException@. If this happens, perform another @get@,
    -- and use the new token returned by that operation.
    UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe Text
nextLockToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateManagedRuleSetVersionExpiryDateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateManagedRuleSetVersionExpiryDateResponse
-> UpdateManagedRuleSetVersionExpiryDateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateManagedRuleSetVersionExpiryDateResponse
-> UpdateManagedRuleSetVersionExpiryDateResponse -> Bool
$c/= :: UpdateManagedRuleSetVersionExpiryDateResponse
-> UpdateManagedRuleSetVersionExpiryDateResponse -> Bool
== :: UpdateManagedRuleSetVersionExpiryDateResponse
-> UpdateManagedRuleSetVersionExpiryDateResponse -> Bool
$c== :: UpdateManagedRuleSetVersionExpiryDateResponse
-> UpdateManagedRuleSetVersionExpiryDateResponse -> Bool
Prelude.Eq, ReadPrec [UpdateManagedRuleSetVersionExpiryDateResponse]
ReadPrec UpdateManagedRuleSetVersionExpiryDateResponse
Int -> ReadS UpdateManagedRuleSetVersionExpiryDateResponse
ReadS [UpdateManagedRuleSetVersionExpiryDateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateManagedRuleSetVersionExpiryDateResponse]
$creadListPrec :: ReadPrec [UpdateManagedRuleSetVersionExpiryDateResponse]
readPrec :: ReadPrec UpdateManagedRuleSetVersionExpiryDateResponse
$creadPrec :: ReadPrec UpdateManagedRuleSetVersionExpiryDateResponse
readList :: ReadS [UpdateManagedRuleSetVersionExpiryDateResponse]
$creadList :: ReadS [UpdateManagedRuleSetVersionExpiryDateResponse]
readsPrec :: Int -> ReadS UpdateManagedRuleSetVersionExpiryDateResponse
$creadsPrec :: Int -> ReadS UpdateManagedRuleSetVersionExpiryDateResponse
Prelude.Read, Int -> UpdateManagedRuleSetVersionExpiryDateResponse -> ShowS
[UpdateManagedRuleSetVersionExpiryDateResponse] -> ShowS
UpdateManagedRuleSetVersionExpiryDateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateManagedRuleSetVersionExpiryDateResponse] -> ShowS
$cshowList :: [UpdateManagedRuleSetVersionExpiryDateResponse] -> ShowS
show :: UpdateManagedRuleSetVersionExpiryDateResponse -> String
$cshow :: UpdateManagedRuleSetVersionExpiryDateResponse -> String
showsPrec :: Int -> UpdateManagedRuleSetVersionExpiryDateResponse -> ShowS
$cshowsPrec :: Int -> UpdateManagedRuleSetVersionExpiryDateResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateManagedRuleSetVersionExpiryDateResponse x
-> UpdateManagedRuleSetVersionExpiryDateResponse
forall x.
UpdateManagedRuleSetVersionExpiryDateResponse
-> Rep UpdateManagedRuleSetVersionExpiryDateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateManagedRuleSetVersionExpiryDateResponse x
-> UpdateManagedRuleSetVersionExpiryDateResponse
$cfrom :: forall x.
UpdateManagedRuleSetVersionExpiryDateResponse
-> Rep UpdateManagedRuleSetVersionExpiryDateResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateManagedRuleSetVersionExpiryDateResponse' 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:
--
-- 'expiringVersion', 'updateManagedRuleSetVersionExpiryDateResponse_expiringVersion' - The version that is set to expire.
--
-- 'expiryTimestamp', 'updateManagedRuleSetVersionExpiryDateResponse_expiryTimestamp' - The time that the version will expire.
--
-- Times are in Coordinated Universal Time (UTC) format. UTC format
-- includes the special designator, Z. For example, \"2016-09-27T14:50Z\".
--
-- 'nextLockToken', 'updateManagedRuleSetVersionExpiryDateResponse_nextLockToken' - A token used for optimistic locking. WAF returns a token to your @get@
-- and @list@ requests, to mark the state of the entity at the time of the
-- request. To make changes to the entity associated with the token, you
-- provide the token to operations like @update@ and @delete@. WAF uses the
-- token to ensure that no changes have been made to the entity since you
-- last retrieved it. If a change has been made, the update fails with a
-- @WAFOptimisticLockException@. If this happens, perform another @get@,
-- and use the new token returned by that operation.
--
-- 'httpStatus', 'updateManagedRuleSetVersionExpiryDateResponse_httpStatus' - The response's http status code.
newUpdateManagedRuleSetVersionExpiryDateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateManagedRuleSetVersionExpiryDateResponse
newUpdateManagedRuleSetVersionExpiryDateResponse :: Int -> UpdateManagedRuleSetVersionExpiryDateResponse
newUpdateManagedRuleSetVersionExpiryDateResponse
  Int
pHttpStatus_ =
    UpdateManagedRuleSetVersionExpiryDateResponse'
      { $sel:expiringVersion:UpdateManagedRuleSetVersionExpiryDateResponse' :: Maybe Text
expiringVersion =
          forall a. Maybe a
Prelude.Nothing,
        $sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDateResponse' :: Maybe POSIX
expiryTimestamp =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextLockToken:UpdateManagedRuleSetVersionExpiryDateResponse' :: Maybe Text
nextLockToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:UpdateManagedRuleSetVersionExpiryDateResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The version that is set to expire.
updateManagedRuleSetVersionExpiryDateResponse_expiringVersion :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDateResponse (Prelude.Maybe Prelude.Text)
updateManagedRuleSetVersionExpiryDateResponse_expiringVersion :: Lens' UpdateManagedRuleSetVersionExpiryDateResponse (Maybe Text)
updateManagedRuleSetVersionExpiryDateResponse_expiringVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDateResponse' {Maybe Text
expiringVersion :: Maybe Text
$sel:expiringVersion:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe Text
expiringVersion} -> Maybe Text
expiringVersion) (\s :: UpdateManagedRuleSetVersionExpiryDateResponse
s@UpdateManagedRuleSetVersionExpiryDateResponse' {} Maybe Text
a -> UpdateManagedRuleSetVersionExpiryDateResponse
s {$sel:expiringVersion:UpdateManagedRuleSetVersionExpiryDateResponse' :: Maybe Text
expiringVersion = Maybe Text
a} :: UpdateManagedRuleSetVersionExpiryDateResponse)

-- | The time that the version will expire.
--
-- Times are in Coordinated Universal Time (UTC) format. UTC format
-- includes the special designator, Z. For example, \"2016-09-27T14:50Z\".
updateManagedRuleSetVersionExpiryDateResponse_expiryTimestamp :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDateResponse (Prelude.Maybe Prelude.UTCTime)
updateManagedRuleSetVersionExpiryDateResponse_expiryTimestamp :: Lens' UpdateManagedRuleSetVersionExpiryDateResponse (Maybe UTCTime)
updateManagedRuleSetVersionExpiryDateResponse_expiryTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDateResponse' {Maybe POSIX
expiryTimestamp :: Maybe POSIX
$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe POSIX
expiryTimestamp} -> Maybe POSIX
expiryTimestamp) (\s :: UpdateManagedRuleSetVersionExpiryDateResponse
s@UpdateManagedRuleSetVersionExpiryDateResponse' {} Maybe POSIX
a -> UpdateManagedRuleSetVersionExpiryDateResponse
s {$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDateResponse' :: Maybe POSIX
expiryTimestamp = Maybe POSIX
a} :: UpdateManagedRuleSetVersionExpiryDateResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A token used for optimistic locking. WAF returns a token to your @get@
-- and @list@ requests, to mark the state of the entity at the time of the
-- request. To make changes to the entity associated with the token, you
-- provide the token to operations like @update@ and @delete@. WAF uses the
-- token to ensure that no changes have been made to the entity since you
-- last retrieved it. If a change has been made, the update fails with a
-- @WAFOptimisticLockException@. If this happens, perform another @get@,
-- and use the new token returned by that operation.
updateManagedRuleSetVersionExpiryDateResponse_nextLockToken :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDateResponse (Prelude.Maybe Prelude.Text)
updateManagedRuleSetVersionExpiryDateResponse_nextLockToken :: Lens' UpdateManagedRuleSetVersionExpiryDateResponse (Maybe Text)
updateManagedRuleSetVersionExpiryDateResponse_nextLockToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDateResponse' {Maybe Text
nextLockToken :: Maybe Text
$sel:nextLockToken:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe Text
nextLockToken} -> Maybe Text
nextLockToken) (\s :: UpdateManagedRuleSetVersionExpiryDateResponse
s@UpdateManagedRuleSetVersionExpiryDateResponse' {} Maybe Text
a -> UpdateManagedRuleSetVersionExpiryDateResponse
s {$sel:nextLockToken:UpdateManagedRuleSetVersionExpiryDateResponse' :: Maybe Text
nextLockToken = Maybe Text
a} :: UpdateManagedRuleSetVersionExpiryDateResponse)

-- | The response's http status code.
updateManagedRuleSetVersionExpiryDateResponse_httpStatus :: Lens.Lens' UpdateManagedRuleSetVersionExpiryDateResponse Prelude.Int
updateManagedRuleSetVersionExpiryDateResponse_httpStatus :: Lens' UpdateManagedRuleSetVersionExpiryDateResponse Int
updateManagedRuleSetVersionExpiryDateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateManagedRuleSetVersionExpiryDateResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateManagedRuleSetVersionExpiryDateResponse
s@UpdateManagedRuleSetVersionExpiryDateResponse' {} Int
a -> UpdateManagedRuleSetVersionExpiryDateResponse
s {$sel:httpStatus:UpdateManagedRuleSetVersionExpiryDateResponse' :: Int
httpStatus = Int
a} :: UpdateManagedRuleSetVersionExpiryDateResponse)

instance
  Prelude.NFData
    UpdateManagedRuleSetVersionExpiryDateResponse
  where
  rnf :: UpdateManagedRuleSetVersionExpiryDateResponse -> ()
rnf
    UpdateManagedRuleSetVersionExpiryDateResponse' {Int
Maybe Text
Maybe POSIX
httpStatus :: Int
nextLockToken :: Maybe Text
expiryTimestamp :: Maybe POSIX
expiringVersion :: Maybe Text
$sel:httpStatus:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Int
$sel:nextLockToken:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe Text
$sel:expiryTimestamp:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe POSIX
$sel:expiringVersion:UpdateManagedRuleSetVersionExpiryDateResponse' :: UpdateManagedRuleSetVersionExpiryDateResponse -> Maybe Text
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expiringVersion
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expiryTimestamp
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextLockToken
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus