{-# 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.RBin.UpdateRule
-- 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 an existing Recycle Bin retention rule. You can update a
-- retention rule\'s description, resource tags, and retention period at
-- any time after creation. You can\'t update a retention rule\'s resource
-- type after creation. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule Update Recycle Bin retention rules>
-- in the /Amazon Elastic Compute Cloud User Guide/.
module Amazonka.RBin.UpdateRule
  ( -- * Creating a Request
    UpdateRule (..),
    newUpdateRule,

    -- * Request Lenses
    updateRule_description,
    updateRule_resourceTags,
    updateRule_resourceType,
    updateRule_retentionPeriod,
    updateRule_identifier,

    -- * Destructuring the Response
    UpdateRuleResponse (..),
    newUpdateRuleResponse,

    -- * Response Lenses
    updateRuleResponse_description,
    updateRuleResponse_identifier,
    updateRuleResponse_lockEndTime,
    updateRuleResponse_lockState,
    updateRuleResponse_resourceTags,
    updateRuleResponse_resourceType,
    updateRuleResponse_retentionPeriod,
    updateRuleResponse_status,
    updateRuleResponse_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 Amazonka.RBin.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateRule' smart constructor.
data UpdateRule = UpdateRule'
  { -- | The retention rule description.
    UpdateRule -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Specifies the resource tags to use to identify resources that are to be
    -- retained by a tag-level retention rule. For tag-level retention rules,
    -- only deleted resources, of the specified resource type, that have one or
    -- more of the specified tag key and value pairs are retained. If a
    -- resource is deleted, but it does not have any of the specified tag key
    -- and value pairs, it is immediately deleted without being retained by the
    -- retention rule.
    --
    -- You can add the same tag key and value pair to a maximum or five
    -- retention rules.
    --
    -- To create a Region-level retention rule, omit this parameter. A
    -- Region-level retention rule does not have any resource tags specified.
    -- It retains all deleted resources of the specified resource type in the
    -- Region in which the rule is created, even if the resources are not
    -- tagged.
    UpdateRule -> Maybe [ResourceTag]
resourceTags :: Prelude.Maybe [ResourceTag],
    -- | This parameter is currently not supported. You can\'t update a retention
    -- rule\'s resource type after creation.
    UpdateRule -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | Information about the retention period for which the retention rule is
    -- to retain resources.
    UpdateRule -> Maybe RetentionPeriod
retentionPeriod :: Prelude.Maybe RetentionPeriod,
    -- | The unique ID of the retention rule.
    UpdateRule -> Text
identifier :: Prelude.Text
  }
  deriving (UpdateRule -> UpdateRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRule -> UpdateRule -> Bool
$c/= :: UpdateRule -> UpdateRule -> Bool
== :: UpdateRule -> UpdateRule -> Bool
$c== :: UpdateRule -> UpdateRule -> Bool
Prelude.Eq, ReadPrec [UpdateRule]
ReadPrec UpdateRule
Int -> ReadS UpdateRule
ReadS [UpdateRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRule]
$creadListPrec :: ReadPrec [UpdateRule]
readPrec :: ReadPrec UpdateRule
$creadPrec :: ReadPrec UpdateRule
readList :: ReadS [UpdateRule]
$creadList :: ReadS [UpdateRule]
readsPrec :: Int -> ReadS UpdateRule
$creadsPrec :: Int -> ReadS UpdateRule
Prelude.Read, Int -> UpdateRule -> ShowS
[UpdateRule] -> ShowS
UpdateRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRule] -> ShowS
$cshowList :: [UpdateRule] -> ShowS
show :: UpdateRule -> String
$cshow :: UpdateRule -> String
showsPrec :: Int -> UpdateRule -> ShowS
$cshowsPrec :: Int -> UpdateRule -> ShowS
Prelude.Show, forall x. Rep UpdateRule x -> UpdateRule
forall x. UpdateRule -> Rep UpdateRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRule x -> UpdateRule
$cfrom :: forall x. UpdateRule -> Rep UpdateRule x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRule' 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:
--
-- 'description', 'updateRule_description' - The retention rule description.
--
-- 'resourceTags', 'updateRule_resourceTags' - Specifies the resource tags to use to identify resources that are to be
-- retained by a tag-level retention rule. For tag-level retention rules,
-- only deleted resources, of the specified resource type, that have one or
-- more of the specified tag key and value pairs are retained. If a
-- resource is deleted, but it does not have any of the specified tag key
-- and value pairs, it is immediately deleted without being retained by the
-- retention rule.
--
-- You can add the same tag key and value pair to a maximum or five
-- retention rules.
--
-- To create a Region-level retention rule, omit this parameter. A
-- Region-level retention rule does not have any resource tags specified.
-- It retains all deleted resources of the specified resource type in the
-- Region in which the rule is created, even if the resources are not
-- tagged.
--
-- 'resourceType', 'updateRule_resourceType' - This parameter is currently not supported. You can\'t update a retention
-- rule\'s resource type after creation.
--
-- 'retentionPeriod', 'updateRule_retentionPeriod' - Information about the retention period for which the retention rule is
-- to retain resources.
--
-- 'identifier', 'updateRule_identifier' - The unique ID of the retention rule.
newUpdateRule ::
  -- | 'identifier'
  Prelude.Text ->
  UpdateRule
newUpdateRule :: Text -> UpdateRule
newUpdateRule Text
pIdentifier_ =
  UpdateRule'
    { $sel:description:UpdateRule' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTags:UpdateRule' :: Maybe [ResourceTag]
resourceTags = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:UpdateRule' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:retentionPeriod:UpdateRule' :: Maybe RetentionPeriod
retentionPeriod = forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:UpdateRule' :: Text
identifier = Text
pIdentifier_
    }

-- | The retention rule description.
updateRule_description :: Lens.Lens' UpdateRule (Prelude.Maybe Prelude.Text)
updateRule_description :: Lens' UpdateRule (Maybe Text)
updateRule_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRule' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRule' :: UpdateRule -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRule
s@UpdateRule' {} Maybe Text
a -> UpdateRule
s {$sel:description:UpdateRule' :: Maybe Text
description = Maybe Text
a} :: UpdateRule)

-- | Specifies the resource tags to use to identify resources that are to be
-- retained by a tag-level retention rule. For tag-level retention rules,
-- only deleted resources, of the specified resource type, that have one or
-- more of the specified tag key and value pairs are retained. If a
-- resource is deleted, but it does not have any of the specified tag key
-- and value pairs, it is immediately deleted without being retained by the
-- retention rule.
--
-- You can add the same tag key and value pair to a maximum or five
-- retention rules.
--
-- To create a Region-level retention rule, omit this parameter. A
-- Region-level retention rule does not have any resource tags specified.
-- It retains all deleted resources of the specified resource type in the
-- Region in which the rule is created, even if the resources are not
-- tagged.
updateRule_resourceTags :: Lens.Lens' UpdateRule (Prelude.Maybe [ResourceTag])
updateRule_resourceTags :: Lens' UpdateRule (Maybe [ResourceTag])
updateRule_resourceTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRule' {Maybe [ResourceTag]
resourceTags :: Maybe [ResourceTag]
$sel:resourceTags:UpdateRule' :: UpdateRule -> Maybe [ResourceTag]
resourceTags} -> Maybe [ResourceTag]
resourceTags) (\s :: UpdateRule
s@UpdateRule' {} Maybe [ResourceTag]
a -> UpdateRule
s {$sel:resourceTags:UpdateRule' :: Maybe [ResourceTag]
resourceTags = Maybe [ResourceTag]
a} :: UpdateRule) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | This parameter is currently not supported. You can\'t update a retention
-- rule\'s resource type after creation.
updateRule_resourceType :: Lens.Lens' UpdateRule (Prelude.Maybe ResourceType)
updateRule_resourceType :: Lens' UpdateRule (Maybe ResourceType)
updateRule_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRule' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:UpdateRule' :: UpdateRule -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: UpdateRule
s@UpdateRule' {} Maybe ResourceType
a -> UpdateRule
s {$sel:resourceType:UpdateRule' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: UpdateRule)

-- | Information about the retention period for which the retention rule is
-- to retain resources.
updateRule_retentionPeriod :: Lens.Lens' UpdateRule (Prelude.Maybe RetentionPeriod)
updateRule_retentionPeriod :: Lens' UpdateRule (Maybe RetentionPeriod)
updateRule_retentionPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRule' {Maybe RetentionPeriod
retentionPeriod :: Maybe RetentionPeriod
$sel:retentionPeriod:UpdateRule' :: UpdateRule -> Maybe RetentionPeriod
retentionPeriod} -> Maybe RetentionPeriod
retentionPeriod) (\s :: UpdateRule
s@UpdateRule' {} Maybe RetentionPeriod
a -> UpdateRule
s {$sel:retentionPeriod:UpdateRule' :: Maybe RetentionPeriod
retentionPeriod = Maybe RetentionPeriod
a} :: UpdateRule)

-- | The unique ID of the retention rule.
updateRule_identifier :: Lens.Lens' UpdateRule Prelude.Text
updateRule_identifier :: Lens' UpdateRule Text
updateRule_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRule' {Text
identifier :: Text
$sel:identifier:UpdateRule' :: UpdateRule -> Text
identifier} -> Text
identifier) (\s :: UpdateRule
s@UpdateRule' {} Text
a -> UpdateRule
s {$sel:identifier:UpdateRule' :: Text
identifier = Text
a} :: UpdateRule)

instance Core.AWSRequest UpdateRule where
  type AWSResponse UpdateRule = UpdateRuleResponse
  request :: (Service -> Service) -> UpdateRule -> Request UpdateRule
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRule)))
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 Text
-> Maybe POSIX
-> Maybe LockState
-> Maybe [ResourceTag]
-> Maybe ResourceType
-> Maybe RetentionPeriod
-> Maybe RuleStatus
-> Int
-> UpdateRuleResponse
UpdateRuleResponse'
            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
"Description")
            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
"Identifier")
            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
"LockEndTime")
            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
"LockState")
            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
"ResourceTags" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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
"ResourceType")
            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
"RetentionPeriod")
            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
"Status")
            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 UpdateRule where
  hashWithSalt :: Int -> UpdateRule -> Int
hashWithSalt Int
_salt UpdateRule' {Maybe [ResourceTag]
Maybe Text
Maybe ResourceType
Maybe RetentionPeriod
Text
identifier :: Text
retentionPeriod :: Maybe RetentionPeriod
resourceType :: Maybe ResourceType
resourceTags :: Maybe [ResourceTag]
description :: Maybe Text
$sel:identifier:UpdateRule' :: UpdateRule -> Text
$sel:retentionPeriod:UpdateRule' :: UpdateRule -> Maybe RetentionPeriod
$sel:resourceType:UpdateRule' :: UpdateRule -> Maybe ResourceType
$sel:resourceTags:UpdateRule' :: UpdateRule -> Maybe [ResourceTag]
$sel:description:UpdateRule' :: UpdateRule -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ResourceTag]
resourceTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RetentionPeriod
retentionPeriod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identifier

instance Prelude.NFData UpdateRule where
  rnf :: UpdateRule -> ()
rnf UpdateRule' {Maybe [ResourceTag]
Maybe Text
Maybe ResourceType
Maybe RetentionPeriod
Text
identifier :: Text
retentionPeriod :: Maybe RetentionPeriod
resourceType :: Maybe ResourceType
resourceTags :: Maybe [ResourceTag]
description :: Maybe Text
$sel:identifier:UpdateRule' :: UpdateRule -> Text
$sel:retentionPeriod:UpdateRule' :: UpdateRule -> Maybe RetentionPeriod
$sel:resourceType:UpdateRule' :: UpdateRule -> Maybe ResourceType
$sel:resourceTags:UpdateRule' :: UpdateRule -> Maybe [ResourceTag]
$sel:description:UpdateRule' :: UpdateRule -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResourceTag]
resourceTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RetentionPeriod
retentionPeriod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identifier

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

instance Data.ToJSON UpdateRule where
  toJSON :: UpdateRule -> Value
toJSON UpdateRule' {Maybe [ResourceTag]
Maybe Text
Maybe ResourceType
Maybe RetentionPeriod
Text
identifier :: Text
retentionPeriod :: Maybe RetentionPeriod
resourceType :: Maybe ResourceType
resourceTags :: Maybe [ResourceTag]
description :: Maybe Text
$sel:identifier:UpdateRule' :: UpdateRule -> Text
$sel:retentionPeriod:UpdateRule' :: UpdateRule -> Maybe RetentionPeriod
$sel:resourceType:UpdateRule' :: UpdateRule -> Maybe ResourceType
$sel:resourceTags:UpdateRule' :: UpdateRule -> Maybe [ResourceTag]
$sel:description:UpdateRule' :: UpdateRule -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"ResourceTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ResourceTag]
resourceTags,
            (Key
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceType
resourceType,
            (Key
"RetentionPeriod" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RetentionPeriod
retentionPeriod
          ]
      )

instance Data.ToPath UpdateRule where
  toPath :: UpdateRule -> ByteString
toPath UpdateRule' {Maybe [ResourceTag]
Maybe Text
Maybe ResourceType
Maybe RetentionPeriod
Text
identifier :: Text
retentionPeriod :: Maybe RetentionPeriod
resourceType :: Maybe ResourceType
resourceTags :: Maybe [ResourceTag]
description :: Maybe Text
$sel:identifier:UpdateRule' :: UpdateRule -> Text
$sel:retentionPeriod:UpdateRule' :: UpdateRule -> Maybe RetentionPeriod
$sel:resourceType:UpdateRule' :: UpdateRule -> Maybe ResourceType
$sel:resourceTags:UpdateRule' :: UpdateRule -> Maybe [ResourceTag]
$sel:description:UpdateRule' :: UpdateRule -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/rules/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
identifier]

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

-- | /See:/ 'newUpdateRuleResponse' smart constructor.
data UpdateRuleResponse = UpdateRuleResponse'
  { -- | The retention rule description.
    UpdateRuleResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of the retention rule.
    UpdateRuleResponse -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | The date and time at which the unlock delay is set to expire. Only
    -- returned for retention rules that have been unlocked and that are still
    -- within the unlock delay period.
    UpdateRuleResponse -> Maybe POSIX
lockEndTime :: Prelude.Maybe Data.POSIX,
    -- | The lock state for the retention rule.
    --
    -- -   @locked@ - The retention rule is locked and can\'t be modified or
    --     deleted.
    --
    -- -   @pending_unlock@ - The retention rule has been unlocked but it is
    --     still within the unlock delay period. The retention rule can be
    --     modified or deleted only after the unlock delay period has expired.
    --
    -- -   @unlocked@ - The retention rule is unlocked and it can be modified
    --     or deleted by any user with the required permissions.
    --
    -- -   @null@ - The retention rule has never been locked. Once a retention
    --     rule has been locked, it can transition between the @locked@ and
    --     @unlocked@ states only; it can never transition back to @null@.
    UpdateRuleResponse -> Maybe LockState
lockState :: Prelude.Maybe LockState,
    -- | Information about the resource tags used to identify resources that are
    -- retained by the retention rule.
    UpdateRuleResponse -> Maybe [ResourceTag]
resourceTags :: Prelude.Maybe [ResourceTag],
    -- | The resource type retained by the retention rule.
    UpdateRuleResponse -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    UpdateRuleResponse -> Maybe RetentionPeriod
retentionPeriod :: Prelude.Maybe RetentionPeriod,
    -- | The state of the retention rule. Only retention rules that are in the
    -- @available@ state retain resources.
    UpdateRuleResponse -> Maybe RuleStatus
status :: Prelude.Maybe RuleStatus,
    -- | The response's http status code.
    UpdateRuleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateRuleResponse -> UpdateRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRuleResponse -> UpdateRuleResponse -> Bool
$c/= :: UpdateRuleResponse -> UpdateRuleResponse -> Bool
== :: UpdateRuleResponse -> UpdateRuleResponse -> Bool
$c== :: UpdateRuleResponse -> UpdateRuleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRuleResponse]
ReadPrec UpdateRuleResponse
Int -> ReadS UpdateRuleResponse
ReadS [UpdateRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRuleResponse]
$creadListPrec :: ReadPrec [UpdateRuleResponse]
readPrec :: ReadPrec UpdateRuleResponse
$creadPrec :: ReadPrec UpdateRuleResponse
readList :: ReadS [UpdateRuleResponse]
$creadList :: ReadS [UpdateRuleResponse]
readsPrec :: Int -> ReadS UpdateRuleResponse
$creadsPrec :: Int -> ReadS UpdateRuleResponse
Prelude.Read, Int -> UpdateRuleResponse -> ShowS
[UpdateRuleResponse] -> ShowS
UpdateRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRuleResponse] -> ShowS
$cshowList :: [UpdateRuleResponse] -> ShowS
show :: UpdateRuleResponse -> String
$cshow :: UpdateRuleResponse -> String
showsPrec :: Int -> UpdateRuleResponse -> ShowS
$cshowsPrec :: Int -> UpdateRuleResponse -> ShowS
Prelude.Show, forall x. Rep UpdateRuleResponse x -> UpdateRuleResponse
forall x. UpdateRuleResponse -> Rep UpdateRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRuleResponse x -> UpdateRuleResponse
$cfrom :: forall x. UpdateRuleResponse -> Rep UpdateRuleResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRuleResponse' 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:
--
-- 'description', 'updateRuleResponse_description' - The retention rule description.
--
-- 'identifier', 'updateRuleResponse_identifier' - The unique ID of the retention rule.
--
-- 'lockEndTime', 'updateRuleResponse_lockEndTime' - The date and time at which the unlock delay is set to expire. Only
-- returned for retention rules that have been unlocked and that are still
-- within the unlock delay period.
--
-- 'lockState', 'updateRuleResponse_lockState' - The lock state for the retention rule.
--
-- -   @locked@ - The retention rule is locked and can\'t be modified or
--     deleted.
--
-- -   @pending_unlock@ - The retention rule has been unlocked but it is
--     still within the unlock delay period. The retention rule can be
--     modified or deleted only after the unlock delay period has expired.
--
-- -   @unlocked@ - The retention rule is unlocked and it can be modified
--     or deleted by any user with the required permissions.
--
-- -   @null@ - The retention rule has never been locked. Once a retention
--     rule has been locked, it can transition between the @locked@ and
--     @unlocked@ states only; it can never transition back to @null@.
--
-- 'resourceTags', 'updateRuleResponse_resourceTags' - Information about the resource tags used to identify resources that are
-- retained by the retention rule.
--
-- 'resourceType', 'updateRuleResponse_resourceType' - The resource type retained by the retention rule.
--
-- 'retentionPeriod', 'updateRuleResponse_retentionPeriod' - Undocumented member.
--
-- 'status', 'updateRuleResponse_status' - The state of the retention rule. Only retention rules that are in the
-- @available@ state retain resources.
--
-- 'httpStatus', 'updateRuleResponse_httpStatus' - The response's http status code.
newUpdateRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateRuleResponse
newUpdateRuleResponse :: Int -> UpdateRuleResponse
newUpdateRuleResponse Int
pHttpStatus_ =
  UpdateRuleResponse'
    { $sel:description:UpdateRuleResponse' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:UpdateRuleResponse' :: Maybe Text
identifier = forall a. Maybe a
Prelude.Nothing,
      $sel:lockEndTime:UpdateRuleResponse' :: Maybe POSIX
lockEndTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lockState:UpdateRuleResponse' :: Maybe LockState
lockState = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTags:UpdateRuleResponse' :: Maybe [ResourceTag]
resourceTags = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:UpdateRuleResponse' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:retentionPeriod:UpdateRuleResponse' :: Maybe RetentionPeriod
retentionPeriod = forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateRuleResponse' :: Maybe RuleStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The retention rule description.
updateRuleResponse_description :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe Prelude.Text)
updateRuleResponse_description :: Lens' UpdateRuleResponse (Maybe Text)
updateRuleResponse_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe Text
a -> UpdateRuleResponse
s {$sel:description:UpdateRuleResponse' :: Maybe Text
description = Maybe Text
a} :: UpdateRuleResponse)

-- | The unique ID of the retention rule.
updateRuleResponse_identifier :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe Prelude.Text)
updateRuleResponse_identifier :: Lens' UpdateRuleResponse (Maybe Text)
updateRuleResponse_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe Text
identifier :: Maybe Text
$sel:identifier:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe Text
a -> UpdateRuleResponse
s {$sel:identifier:UpdateRuleResponse' :: Maybe Text
identifier = Maybe Text
a} :: UpdateRuleResponse)

-- | The date and time at which the unlock delay is set to expire. Only
-- returned for retention rules that have been unlocked and that are still
-- within the unlock delay period.
updateRuleResponse_lockEndTime :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe Prelude.UTCTime)
updateRuleResponse_lockEndTime :: Lens' UpdateRuleResponse (Maybe UTCTime)
updateRuleResponse_lockEndTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe POSIX
lockEndTime :: Maybe POSIX
$sel:lockEndTime:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe POSIX
lockEndTime} -> Maybe POSIX
lockEndTime) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe POSIX
a -> UpdateRuleResponse
s {$sel:lockEndTime:UpdateRuleResponse' :: Maybe POSIX
lockEndTime = Maybe POSIX
a} :: UpdateRuleResponse) 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

-- | The lock state for the retention rule.
--
-- -   @locked@ - The retention rule is locked and can\'t be modified or
--     deleted.
--
-- -   @pending_unlock@ - The retention rule has been unlocked but it is
--     still within the unlock delay period. The retention rule can be
--     modified or deleted only after the unlock delay period has expired.
--
-- -   @unlocked@ - The retention rule is unlocked and it can be modified
--     or deleted by any user with the required permissions.
--
-- -   @null@ - The retention rule has never been locked. Once a retention
--     rule has been locked, it can transition between the @locked@ and
--     @unlocked@ states only; it can never transition back to @null@.
updateRuleResponse_lockState :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe LockState)
updateRuleResponse_lockState :: Lens' UpdateRuleResponse (Maybe LockState)
updateRuleResponse_lockState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe LockState
lockState :: Maybe LockState
$sel:lockState:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe LockState
lockState} -> Maybe LockState
lockState) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe LockState
a -> UpdateRuleResponse
s {$sel:lockState:UpdateRuleResponse' :: Maybe LockState
lockState = Maybe LockState
a} :: UpdateRuleResponse)

-- | Information about the resource tags used to identify resources that are
-- retained by the retention rule.
updateRuleResponse_resourceTags :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe [ResourceTag])
updateRuleResponse_resourceTags :: Lens' UpdateRuleResponse (Maybe [ResourceTag])
updateRuleResponse_resourceTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe [ResourceTag]
resourceTags :: Maybe [ResourceTag]
$sel:resourceTags:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe [ResourceTag]
resourceTags} -> Maybe [ResourceTag]
resourceTags) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe [ResourceTag]
a -> UpdateRuleResponse
s {$sel:resourceTags:UpdateRuleResponse' :: Maybe [ResourceTag]
resourceTags = Maybe [ResourceTag]
a} :: UpdateRuleResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The resource type retained by the retention rule.
updateRuleResponse_resourceType :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe ResourceType)
updateRuleResponse_resourceType :: Lens' UpdateRuleResponse (Maybe ResourceType)
updateRuleResponse_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe ResourceType
a -> UpdateRuleResponse
s {$sel:resourceType:UpdateRuleResponse' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: UpdateRuleResponse)

-- | Undocumented member.
updateRuleResponse_retentionPeriod :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe RetentionPeriod)
updateRuleResponse_retentionPeriod :: Lens' UpdateRuleResponse (Maybe RetentionPeriod)
updateRuleResponse_retentionPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe RetentionPeriod
retentionPeriod :: Maybe RetentionPeriod
$sel:retentionPeriod:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe RetentionPeriod
retentionPeriod} -> Maybe RetentionPeriod
retentionPeriod) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe RetentionPeriod
a -> UpdateRuleResponse
s {$sel:retentionPeriod:UpdateRuleResponse' :: Maybe RetentionPeriod
retentionPeriod = Maybe RetentionPeriod
a} :: UpdateRuleResponse)

-- | The state of the retention rule. Only retention rules that are in the
-- @available@ state retain resources.
updateRuleResponse_status :: Lens.Lens' UpdateRuleResponse (Prelude.Maybe RuleStatus)
updateRuleResponse_status :: Lens' UpdateRuleResponse (Maybe RuleStatus)
updateRuleResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRuleResponse' {Maybe RuleStatus
status :: Maybe RuleStatus
$sel:status:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe RuleStatus
status} -> Maybe RuleStatus
status) (\s :: UpdateRuleResponse
s@UpdateRuleResponse' {} Maybe RuleStatus
a -> UpdateRuleResponse
s {$sel:status:UpdateRuleResponse' :: Maybe RuleStatus
status = Maybe RuleStatus
a} :: UpdateRuleResponse)

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

instance Prelude.NFData UpdateRuleResponse where
  rnf :: UpdateRuleResponse -> ()
rnf UpdateRuleResponse' {Int
Maybe [ResourceTag]
Maybe Text
Maybe POSIX
Maybe LockState
Maybe ResourceType
Maybe RetentionPeriod
Maybe RuleStatus
httpStatus :: Int
status :: Maybe RuleStatus
retentionPeriod :: Maybe RetentionPeriod
resourceType :: Maybe ResourceType
resourceTags :: Maybe [ResourceTag]
lockState :: Maybe LockState
lockEndTime :: Maybe POSIX
identifier :: Maybe Text
description :: Maybe Text
$sel:httpStatus:UpdateRuleResponse' :: UpdateRuleResponse -> Int
$sel:status:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe RuleStatus
$sel:retentionPeriod:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe RetentionPeriod
$sel:resourceType:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe ResourceType
$sel:resourceTags:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe [ResourceTag]
$sel:lockState:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe LockState
$sel:lockEndTime:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe POSIX
$sel:identifier:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe Text
$sel:description:UpdateRuleResponse' :: UpdateRuleResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lockEndTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LockState
lockState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResourceTag]
resourceTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RetentionPeriod
retentionPeriod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RuleStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus