{-# 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.DLM.CreateLifecyclePolicy
-- 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)
--
-- Creates a policy to manage the lifecycle of the specified Amazon Web
-- Services resources. You can create up to 100 lifecycle policies.
module Amazonka.DLM.CreateLifecyclePolicy
  ( -- * Creating a Request
    CreateLifecyclePolicy (..),
    newCreateLifecyclePolicy,

    -- * Request Lenses
    createLifecyclePolicy_tags,
    createLifecyclePolicy_executionRoleArn,
    createLifecyclePolicy_description,
    createLifecyclePolicy_state,
    createLifecyclePolicy_policyDetails,

    -- * Destructuring the Response
    CreateLifecyclePolicyResponse (..),
    newCreateLifecyclePolicyResponse,

    -- * Response Lenses
    createLifecyclePolicyResponse_policyId,
    createLifecyclePolicyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DLM.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

-- | /See:/ 'newCreateLifecyclePolicy' smart constructor.
data CreateLifecyclePolicy = CreateLifecyclePolicy'
  { -- | The tags to apply to the lifecycle policy during creation.
    CreateLifecyclePolicy -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Resource Name (ARN) of the IAM role used to run the
    -- operations specified by the lifecycle policy.
    CreateLifecyclePolicy -> Text
executionRoleArn :: Prelude.Text,
    -- | A description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$
    -- are supported.
    CreateLifecyclePolicy -> Text
description :: Prelude.Text,
    -- | The desired activation state of the lifecycle policy after creation.
    CreateLifecyclePolicy -> SettablePolicyStateValues
state :: SettablePolicyStateValues,
    -- | The configuration details of the lifecycle policy.
    CreateLifecyclePolicy -> PolicyDetails
policyDetails :: PolicyDetails
  }
  deriving (CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool
(CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool)
-> (CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool)
-> Eq CreateLifecyclePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool
$c/= :: CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool
== :: CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool
$c== :: CreateLifecyclePolicy -> CreateLifecyclePolicy -> Bool
Prelude.Eq, ReadPrec [CreateLifecyclePolicy]
ReadPrec CreateLifecyclePolicy
Int -> ReadS CreateLifecyclePolicy
ReadS [CreateLifecyclePolicy]
(Int -> ReadS CreateLifecyclePolicy)
-> ReadS [CreateLifecyclePolicy]
-> ReadPrec CreateLifecyclePolicy
-> ReadPrec [CreateLifecyclePolicy]
-> Read CreateLifecyclePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLifecyclePolicy]
$creadListPrec :: ReadPrec [CreateLifecyclePolicy]
readPrec :: ReadPrec CreateLifecyclePolicy
$creadPrec :: ReadPrec CreateLifecyclePolicy
readList :: ReadS [CreateLifecyclePolicy]
$creadList :: ReadS [CreateLifecyclePolicy]
readsPrec :: Int -> ReadS CreateLifecyclePolicy
$creadsPrec :: Int -> ReadS CreateLifecyclePolicy
Prelude.Read, Int -> CreateLifecyclePolicy -> ShowS
[CreateLifecyclePolicy] -> ShowS
CreateLifecyclePolicy -> String
(Int -> CreateLifecyclePolicy -> ShowS)
-> (CreateLifecyclePolicy -> String)
-> ([CreateLifecyclePolicy] -> ShowS)
-> Show CreateLifecyclePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLifecyclePolicy] -> ShowS
$cshowList :: [CreateLifecyclePolicy] -> ShowS
show :: CreateLifecyclePolicy -> String
$cshow :: CreateLifecyclePolicy -> String
showsPrec :: Int -> CreateLifecyclePolicy -> ShowS
$cshowsPrec :: Int -> CreateLifecyclePolicy -> ShowS
Prelude.Show, (forall x. CreateLifecyclePolicy -> Rep CreateLifecyclePolicy x)
-> (forall x. Rep CreateLifecyclePolicy x -> CreateLifecyclePolicy)
-> Generic CreateLifecyclePolicy
forall x. Rep CreateLifecyclePolicy x -> CreateLifecyclePolicy
forall x. CreateLifecyclePolicy -> Rep CreateLifecyclePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLifecyclePolicy x -> CreateLifecyclePolicy
$cfrom :: forall x. CreateLifecyclePolicy -> Rep CreateLifecyclePolicy x
Prelude.Generic)

-- |
-- Create a value of 'CreateLifecyclePolicy' 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:
--
-- 'tags', 'createLifecyclePolicy_tags' - The tags to apply to the lifecycle policy during creation.
--
-- 'executionRoleArn', 'createLifecyclePolicy_executionRoleArn' - The Amazon Resource Name (ARN) of the IAM role used to run the
-- operations specified by the lifecycle policy.
--
-- 'description', 'createLifecyclePolicy_description' - A description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$
-- are supported.
--
-- 'state', 'createLifecyclePolicy_state' - The desired activation state of the lifecycle policy after creation.
--
-- 'policyDetails', 'createLifecyclePolicy_policyDetails' - The configuration details of the lifecycle policy.
newCreateLifecyclePolicy ::
  -- | 'executionRoleArn'
  Prelude.Text ->
  -- | 'description'
  Prelude.Text ->
  -- | 'state'
  SettablePolicyStateValues ->
  -- | 'policyDetails'
  PolicyDetails ->
  CreateLifecyclePolicy
newCreateLifecyclePolicy :: Text
-> Text
-> SettablePolicyStateValues
-> PolicyDetails
-> CreateLifecyclePolicy
newCreateLifecyclePolicy
  Text
pExecutionRoleArn_
  Text
pDescription_
  SettablePolicyStateValues
pState_
  PolicyDetails
pPolicyDetails_ =
    CreateLifecyclePolicy' :: Maybe (HashMap Text Text)
-> Text
-> Text
-> SettablePolicyStateValues
-> PolicyDetails
-> CreateLifecyclePolicy
CreateLifecyclePolicy'
      { $sel:tags:CreateLifecyclePolicy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:executionRoleArn:CreateLifecyclePolicy' :: Text
executionRoleArn = Text
pExecutionRoleArn_,
        $sel:description:CreateLifecyclePolicy' :: Text
description = Text
pDescription_,
        $sel:state:CreateLifecyclePolicy' :: SettablePolicyStateValues
state = SettablePolicyStateValues
pState_,
        $sel:policyDetails:CreateLifecyclePolicy' :: PolicyDetails
policyDetails = PolicyDetails
pPolicyDetails_
      }

-- | The tags to apply to the lifecycle policy during creation.
createLifecyclePolicy_tags :: Lens.Lens' CreateLifecyclePolicy (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createLifecyclePolicy_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLifecyclePolicy -> f CreateLifecyclePolicy
createLifecyclePolicy_tags = (CreateLifecyclePolicy -> Maybe (HashMap Text Text))
-> (CreateLifecyclePolicy
    -> Maybe (HashMap Text Text) -> CreateLifecyclePolicy)
-> Lens
     CreateLifecyclePolicy
     CreateLifecyclePolicy
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLifecyclePolicy' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateLifecyclePolicy
s@CreateLifecyclePolicy' {} Maybe (HashMap Text Text)
a -> CreateLifecyclePolicy
s {$sel:tags:CreateLifecyclePolicy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateLifecyclePolicy) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateLifecyclePolicy -> f CreateLifecyclePolicy)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLifecyclePolicy
-> f CreateLifecyclePolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the IAM role used to run the
-- operations specified by the lifecycle policy.
createLifecyclePolicy_executionRoleArn :: Lens.Lens' CreateLifecyclePolicy Prelude.Text
createLifecyclePolicy_executionRoleArn :: (Text -> f Text)
-> CreateLifecyclePolicy -> f CreateLifecyclePolicy
createLifecyclePolicy_executionRoleArn = (CreateLifecyclePolicy -> Text)
-> (CreateLifecyclePolicy -> Text -> CreateLifecyclePolicy)
-> Lens CreateLifecyclePolicy CreateLifecyclePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLifecyclePolicy' {Text
executionRoleArn :: Text
$sel:executionRoleArn:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> Text
executionRoleArn} -> Text
executionRoleArn) (\s :: CreateLifecyclePolicy
s@CreateLifecyclePolicy' {} Text
a -> CreateLifecyclePolicy
s {$sel:executionRoleArn:CreateLifecyclePolicy' :: Text
executionRoleArn = Text
a} :: CreateLifecyclePolicy)

-- | A description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$
-- are supported.
createLifecyclePolicy_description :: Lens.Lens' CreateLifecyclePolicy Prelude.Text
createLifecyclePolicy_description :: (Text -> f Text)
-> CreateLifecyclePolicy -> f CreateLifecyclePolicy
createLifecyclePolicy_description = (CreateLifecyclePolicy -> Text)
-> (CreateLifecyclePolicy -> Text -> CreateLifecyclePolicy)
-> Lens CreateLifecyclePolicy CreateLifecyclePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLifecyclePolicy' {Text
description :: Text
$sel:description:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> Text
description} -> Text
description) (\s :: CreateLifecyclePolicy
s@CreateLifecyclePolicy' {} Text
a -> CreateLifecyclePolicy
s {$sel:description:CreateLifecyclePolicy' :: Text
description = Text
a} :: CreateLifecyclePolicy)

-- | The desired activation state of the lifecycle policy after creation.
createLifecyclePolicy_state :: Lens.Lens' CreateLifecyclePolicy SettablePolicyStateValues
createLifecyclePolicy_state :: (SettablePolicyStateValues -> f SettablePolicyStateValues)
-> CreateLifecyclePolicy -> f CreateLifecyclePolicy
createLifecyclePolicy_state = (CreateLifecyclePolicy -> SettablePolicyStateValues)
-> (CreateLifecyclePolicy
    -> SettablePolicyStateValues -> CreateLifecyclePolicy)
-> Lens
     CreateLifecyclePolicy
     CreateLifecyclePolicy
     SettablePolicyStateValues
     SettablePolicyStateValues
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLifecyclePolicy' {SettablePolicyStateValues
state :: SettablePolicyStateValues
$sel:state:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> SettablePolicyStateValues
state} -> SettablePolicyStateValues
state) (\s :: CreateLifecyclePolicy
s@CreateLifecyclePolicy' {} SettablePolicyStateValues
a -> CreateLifecyclePolicy
s {$sel:state:CreateLifecyclePolicy' :: SettablePolicyStateValues
state = SettablePolicyStateValues
a} :: CreateLifecyclePolicy)

-- | The configuration details of the lifecycle policy.
createLifecyclePolicy_policyDetails :: Lens.Lens' CreateLifecyclePolicy PolicyDetails
createLifecyclePolicy_policyDetails :: (PolicyDetails -> f PolicyDetails)
-> CreateLifecyclePolicy -> f CreateLifecyclePolicy
createLifecyclePolicy_policyDetails = (CreateLifecyclePolicy -> PolicyDetails)
-> (CreateLifecyclePolicy
    -> PolicyDetails -> CreateLifecyclePolicy)
-> Lens
     CreateLifecyclePolicy
     CreateLifecyclePolicy
     PolicyDetails
     PolicyDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLifecyclePolicy' {PolicyDetails
policyDetails :: PolicyDetails
$sel:policyDetails:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> PolicyDetails
policyDetails} -> PolicyDetails
policyDetails) (\s :: CreateLifecyclePolicy
s@CreateLifecyclePolicy' {} PolicyDetails
a -> CreateLifecyclePolicy
s {$sel:policyDetails:CreateLifecyclePolicy' :: PolicyDetails
policyDetails = PolicyDetails
a} :: CreateLifecyclePolicy)

instance Core.AWSRequest CreateLifecyclePolicy where
  type
    AWSResponse CreateLifecyclePolicy =
      CreateLifecyclePolicyResponse
  request :: CreateLifecyclePolicy -> Request CreateLifecyclePolicy
request = Service -> CreateLifecyclePolicy -> Request CreateLifecyclePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLifecyclePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLifecyclePolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLifecyclePolicy))
-> Logger
-> Service
-> Proxy CreateLifecyclePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLifecyclePolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateLifecyclePolicyResponse
CreateLifecyclePolicyResponse'
            (Maybe Text -> Int -> CreateLifecyclePolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLifecyclePolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PolicyId")
            Either String (Int -> CreateLifecyclePolicyResponse)
-> Either String Int -> Either String CreateLifecyclePolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateLifecyclePolicy

instance Prelude.NFData CreateLifecyclePolicy

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

instance Core.ToJSON CreateLifecyclePolicy where
  toJSON :: CreateLifecyclePolicy -> Value
toJSON CreateLifecyclePolicy' {Maybe (HashMap Text Text)
Text
SettablePolicyStateValues
PolicyDetails
policyDetails :: PolicyDetails
state :: SettablePolicyStateValues
description :: Text
executionRoleArn :: Text
tags :: Maybe (HashMap Text Text)
$sel:policyDetails:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> PolicyDetails
$sel:state:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> SettablePolicyStateValues
$sel:description:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> Text
$sel:executionRoleArn:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> Text
$sel:tags:CreateLifecyclePolicy' :: CreateLifecyclePolicy -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ExecutionRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
description),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"State" Text -> SettablePolicyStateValues -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SettablePolicyStateValues
state),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PolicyDetails" Text -> PolicyDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PolicyDetails
policyDetails)
          ]
      )

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

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

-- | /See:/ 'newCreateLifecyclePolicyResponse' smart constructor.
data CreateLifecyclePolicyResponse = CreateLifecyclePolicyResponse'
  { -- | The identifier of the lifecycle policy.
    CreateLifecyclePolicyResponse -> Maybe Text
policyId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateLifecyclePolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLifecyclePolicyResponse
-> CreateLifecyclePolicyResponse -> Bool
(CreateLifecyclePolicyResponse
 -> CreateLifecyclePolicyResponse -> Bool)
-> (CreateLifecyclePolicyResponse
    -> CreateLifecyclePolicyResponse -> Bool)
-> Eq CreateLifecyclePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLifecyclePolicyResponse
-> CreateLifecyclePolicyResponse -> Bool
$c/= :: CreateLifecyclePolicyResponse
-> CreateLifecyclePolicyResponse -> Bool
== :: CreateLifecyclePolicyResponse
-> CreateLifecyclePolicyResponse -> Bool
$c== :: CreateLifecyclePolicyResponse
-> CreateLifecyclePolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateLifecyclePolicyResponse]
ReadPrec CreateLifecyclePolicyResponse
Int -> ReadS CreateLifecyclePolicyResponse
ReadS [CreateLifecyclePolicyResponse]
(Int -> ReadS CreateLifecyclePolicyResponse)
-> ReadS [CreateLifecyclePolicyResponse]
-> ReadPrec CreateLifecyclePolicyResponse
-> ReadPrec [CreateLifecyclePolicyResponse]
-> Read CreateLifecyclePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLifecyclePolicyResponse]
$creadListPrec :: ReadPrec [CreateLifecyclePolicyResponse]
readPrec :: ReadPrec CreateLifecyclePolicyResponse
$creadPrec :: ReadPrec CreateLifecyclePolicyResponse
readList :: ReadS [CreateLifecyclePolicyResponse]
$creadList :: ReadS [CreateLifecyclePolicyResponse]
readsPrec :: Int -> ReadS CreateLifecyclePolicyResponse
$creadsPrec :: Int -> ReadS CreateLifecyclePolicyResponse
Prelude.Read, Int -> CreateLifecyclePolicyResponse -> ShowS
[CreateLifecyclePolicyResponse] -> ShowS
CreateLifecyclePolicyResponse -> String
(Int -> CreateLifecyclePolicyResponse -> ShowS)
-> (CreateLifecyclePolicyResponse -> String)
-> ([CreateLifecyclePolicyResponse] -> ShowS)
-> Show CreateLifecyclePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLifecyclePolicyResponse] -> ShowS
$cshowList :: [CreateLifecyclePolicyResponse] -> ShowS
show :: CreateLifecyclePolicyResponse -> String
$cshow :: CreateLifecyclePolicyResponse -> String
showsPrec :: Int -> CreateLifecyclePolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateLifecyclePolicyResponse -> ShowS
Prelude.Show, (forall x.
 CreateLifecyclePolicyResponse
 -> Rep CreateLifecyclePolicyResponse x)
-> (forall x.
    Rep CreateLifecyclePolicyResponse x
    -> CreateLifecyclePolicyResponse)
-> Generic CreateLifecyclePolicyResponse
forall x.
Rep CreateLifecyclePolicyResponse x
-> CreateLifecyclePolicyResponse
forall x.
CreateLifecyclePolicyResponse
-> Rep CreateLifecyclePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLifecyclePolicyResponse x
-> CreateLifecyclePolicyResponse
$cfrom :: forall x.
CreateLifecyclePolicyResponse
-> Rep CreateLifecyclePolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLifecyclePolicyResponse' 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:
--
-- 'policyId', 'createLifecyclePolicyResponse_policyId' - The identifier of the lifecycle policy.
--
-- 'httpStatus', 'createLifecyclePolicyResponse_httpStatus' - The response's http status code.
newCreateLifecyclePolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLifecyclePolicyResponse
newCreateLifecyclePolicyResponse :: Int -> CreateLifecyclePolicyResponse
newCreateLifecyclePolicyResponse Int
pHttpStatus_ =
  CreateLifecyclePolicyResponse' :: Maybe Text -> Int -> CreateLifecyclePolicyResponse
CreateLifecyclePolicyResponse'
    { $sel:policyId:CreateLifecyclePolicyResponse' :: Maybe Text
policyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLifecyclePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the lifecycle policy.
createLifecyclePolicyResponse_policyId :: Lens.Lens' CreateLifecyclePolicyResponse (Prelude.Maybe Prelude.Text)
createLifecyclePolicyResponse_policyId :: (Maybe Text -> f (Maybe Text))
-> CreateLifecyclePolicyResponse -> f CreateLifecyclePolicyResponse
createLifecyclePolicyResponse_policyId = (CreateLifecyclePolicyResponse -> Maybe Text)
-> (CreateLifecyclePolicyResponse
    -> Maybe Text -> CreateLifecyclePolicyResponse)
-> Lens
     CreateLifecyclePolicyResponse
     CreateLifecyclePolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLifecyclePolicyResponse' {Maybe Text
policyId :: Maybe Text
$sel:policyId:CreateLifecyclePolicyResponse' :: CreateLifecyclePolicyResponse -> Maybe Text
policyId} -> Maybe Text
policyId) (\s :: CreateLifecyclePolicyResponse
s@CreateLifecyclePolicyResponse' {} Maybe Text
a -> CreateLifecyclePolicyResponse
s {$sel:policyId:CreateLifecyclePolicyResponse' :: Maybe Text
policyId = Maybe Text
a} :: CreateLifecyclePolicyResponse)

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

instance Prelude.NFData CreateLifecyclePolicyResponse