{-# 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.IoT.CreatePolicyVersion
-- 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 new version of the specified IoT policy. To update a policy,
-- create a new policy version. A managed policy can have up to five
-- versions. If the policy has five versions, you must use
-- DeletePolicyVersion to delete an existing version before you create a
-- new one.
--
-- Optionally, you can set the new version as the policy\'s default
-- version. The default version is the operative version (that is, the
-- version that is in effect for the certificates to which the policy is
-- attached).
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreatePolicyVersion>
-- action.
module Amazonka.IoT.CreatePolicyVersion
  ( -- * Creating a Request
    CreatePolicyVersion (..),
    newCreatePolicyVersion,

    -- * Request Lenses
    createPolicyVersion_setAsDefault,
    createPolicyVersion_policyName,
    createPolicyVersion_policyDocument,

    -- * Destructuring the Response
    CreatePolicyVersionResponse (..),
    newCreatePolicyVersionResponse,

    -- * Response Lenses
    createPolicyVersionResponse_policyDocument,
    createPolicyVersionResponse_policyVersionId,
    createPolicyVersionResponse_policyArn,
    createPolicyVersionResponse_isDefaultVersion,
    createPolicyVersionResponse_httpStatus,
  )
where

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

-- | The input for the CreatePolicyVersion operation.
--
-- /See:/ 'newCreatePolicyVersion' smart constructor.
data CreatePolicyVersion = CreatePolicyVersion'
  { -- | Specifies whether the policy version is set as the default. When this
    -- parameter is true, the new policy version becomes the operative version
    -- (that is, the version that is in effect for the certificates to which
    -- the policy is attached).
    CreatePolicyVersion -> Maybe Bool
setAsDefault :: Prelude.Maybe Prelude.Bool,
    -- | The policy name.
    CreatePolicyVersion -> Text
policyName :: Prelude.Text,
    -- | The JSON document that describes the policy. Minimum length of 1.
    -- Maximum length of 2048, excluding whitespace.
    CreatePolicyVersion -> Text
policyDocument :: Prelude.Text
  }
  deriving (CreatePolicyVersion -> CreatePolicyVersion -> Bool
(CreatePolicyVersion -> CreatePolicyVersion -> Bool)
-> (CreatePolicyVersion -> CreatePolicyVersion -> Bool)
-> Eq CreatePolicyVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePolicyVersion -> CreatePolicyVersion -> Bool
$c/= :: CreatePolicyVersion -> CreatePolicyVersion -> Bool
== :: CreatePolicyVersion -> CreatePolicyVersion -> Bool
$c== :: CreatePolicyVersion -> CreatePolicyVersion -> Bool
Prelude.Eq, ReadPrec [CreatePolicyVersion]
ReadPrec CreatePolicyVersion
Int -> ReadS CreatePolicyVersion
ReadS [CreatePolicyVersion]
(Int -> ReadS CreatePolicyVersion)
-> ReadS [CreatePolicyVersion]
-> ReadPrec CreatePolicyVersion
-> ReadPrec [CreatePolicyVersion]
-> Read CreatePolicyVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePolicyVersion]
$creadListPrec :: ReadPrec [CreatePolicyVersion]
readPrec :: ReadPrec CreatePolicyVersion
$creadPrec :: ReadPrec CreatePolicyVersion
readList :: ReadS [CreatePolicyVersion]
$creadList :: ReadS [CreatePolicyVersion]
readsPrec :: Int -> ReadS CreatePolicyVersion
$creadsPrec :: Int -> ReadS CreatePolicyVersion
Prelude.Read, Int -> CreatePolicyVersion -> ShowS
[CreatePolicyVersion] -> ShowS
CreatePolicyVersion -> String
(Int -> CreatePolicyVersion -> ShowS)
-> (CreatePolicyVersion -> String)
-> ([CreatePolicyVersion] -> ShowS)
-> Show CreatePolicyVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePolicyVersion] -> ShowS
$cshowList :: [CreatePolicyVersion] -> ShowS
show :: CreatePolicyVersion -> String
$cshow :: CreatePolicyVersion -> String
showsPrec :: Int -> CreatePolicyVersion -> ShowS
$cshowsPrec :: Int -> CreatePolicyVersion -> ShowS
Prelude.Show, (forall x. CreatePolicyVersion -> Rep CreatePolicyVersion x)
-> (forall x. Rep CreatePolicyVersion x -> CreatePolicyVersion)
-> Generic CreatePolicyVersion
forall x. Rep CreatePolicyVersion x -> CreatePolicyVersion
forall x. CreatePolicyVersion -> Rep CreatePolicyVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePolicyVersion x -> CreatePolicyVersion
$cfrom :: forall x. CreatePolicyVersion -> Rep CreatePolicyVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreatePolicyVersion' 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:
--
-- 'setAsDefault', 'createPolicyVersion_setAsDefault' - Specifies whether the policy version is set as the default. When this
-- parameter is true, the new policy version becomes the operative version
-- (that is, the version that is in effect for the certificates to which
-- the policy is attached).
--
-- 'policyName', 'createPolicyVersion_policyName' - The policy name.
--
-- 'policyDocument', 'createPolicyVersion_policyDocument' - The JSON document that describes the policy. Minimum length of 1.
-- Maximum length of 2048, excluding whitespace.
newCreatePolicyVersion ::
  -- | 'policyName'
  Prelude.Text ->
  -- | 'policyDocument'
  Prelude.Text ->
  CreatePolicyVersion
newCreatePolicyVersion :: Text -> Text -> CreatePolicyVersion
newCreatePolicyVersion Text
pPolicyName_ Text
pPolicyDocument_ =
  CreatePolicyVersion' :: Maybe Bool -> Text -> Text -> CreatePolicyVersion
CreatePolicyVersion'
    { $sel:setAsDefault:CreatePolicyVersion' :: Maybe Bool
setAsDefault =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:policyName:CreatePolicyVersion' :: Text
policyName = Text
pPolicyName_,
      $sel:policyDocument:CreatePolicyVersion' :: Text
policyDocument = Text
pPolicyDocument_
    }

-- | Specifies whether the policy version is set as the default. When this
-- parameter is true, the new policy version becomes the operative version
-- (that is, the version that is in effect for the certificates to which
-- the policy is attached).
createPolicyVersion_setAsDefault :: Lens.Lens' CreatePolicyVersion (Prelude.Maybe Prelude.Bool)
createPolicyVersion_setAsDefault :: (Maybe Bool -> f (Maybe Bool))
-> CreatePolicyVersion -> f CreatePolicyVersion
createPolicyVersion_setAsDefault = (CreatePolicyVersion -> Maybe Bool)
-> (CreatePolicyVersion -> Maybe Bool -> CreatePolicyVersion)
-> Lens
     CreatePolicyVersion CreatePolicyVersion (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersion' {Maybe Bool
setAsDefault :: Maybe Bool
$sel:setAsDefault:CreatePolicyVersion' :: CreatePolicyVersion -> Maybe Bool
setAsDefault} -> Maybe Bool
setAsDefault) (\s :: CreatePolicyVersion
s@CreatePolicyVersion' {} Maybe Bool
a -> CreatePolicyVersion
s {$sel:setAsDefault:CreatePolicyVersion' :: Maybe Bool
setAsDefault = Maybe Bool
a} :: CreatePolicyVersion)

-- | The policy name.
createPolicyVersion_policyName :: Lens.Lens' CreatePolicyVersion Prelude.Text
createPolicyVersion_policyName :: (Text -> f Text) -> CreatePolicyVersion -> f CreatePolicyVersion
createPolicyVersion_policyName = (CreatePolicyVersion -> Text)
-> (CreatePolicyVersion -> Text -> CreatePolicyVersion)
-> Lens CreatePolicyVersion CreatePolicyVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersion' {Text
policyName :: Text
$sel:policyName:CreatePolicyVersion' :: CreatePolicyVersion -> Text
policyName} -> Text
policyName) (\s :: CreatePolicyVersion
s@CreatePolicyVersion' {} Text
a -> CreatePolicyVersion
s {$sel:policyName:CreatePolicyVersion' :: Text
policyName = Text
a} :: CreatePolicyVersion)

-- | The JSON document that describes the policy. Minimum length of 1.
-- Maximum length of 2048, excluding whitespace.
createPolicyVersion_policyDocument :: Lens.Lens' CreatePolicyVersion Prelude.Text
createPolicyVersion_policyDocument :: (Text -> f Text) -> CreatePolicyVersion -> f CreatePolicyVersion
createPolicyVersion_policyDocument = (CreatePolicyVersion -> Text)
-> (CreatePolicyVersion -> Text -> CreatePolicyVersion)
-> Lens CreatePolicyVersion CreatePolicyVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersion' {Text
policyDocument :: Text
$sel:policyDocument:CreatePolicyVersion' :: CreatePolicyVersion -> Text
policyDocument} -> Text
policyDocument) (\s :: CreatePolicyVersion
s@CreatePolicyVersion' {} Text
a -> CreatePolicyVersion
s {$sel:policyDocument:CreatePolicyVersion' :: Text
policyDocument = Text
a} :: CreatePolicyVersion)

instance Core.AWSRequest CreatePolicyVersion where
  type
    AWSResponse CreatePolicyVersion =
      CreatePolicyVersionResponse
  request :: CreatePolicyVersion -> Request CreatePolicyVersion
request = Service -> CreatePolicyVersion -> Request CreatePolicyVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreatePolicyVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePolicyVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreatePolicyVersion))
-> Logger
-> Service
-> Proxy CreatePolicyVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePolicyVersion)))
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
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Int
-> CreatePolicyVersionResponse
CreatePolicyVersionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Int
 -> CreatePolicyVersionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Int -> CreatePolicyVersionResponse)
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
"policyDocument")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Bool -> Int -> CreatePolicyVersionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Bool -> Int -> CreatePolicyVersionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"policyVersionId")
            Either
  String
  (Maybe Text -> Maybe Bool -> Int -> CreatePolicyVersionResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Int -> CreatePolicyVersionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"policyArn")
            Either String (Maybe Bool -> Int -> CreatePolicyVersionResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> CreatePolicyVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"isDefaultVersion")
            Either String (Int -> CreatePolicyVersionResponse)
-> Either String Int -> Either String CreatePolicyVersionResponse
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 CreatePolicyVersion

instance Prelude.NFData CreatePolicyVersion

instance Core.ToHeaders CreatePolicyVersion where
  toHeaders :: CreatePolicyVersion -> ResponseHeaders
toHeaders = ResponseHeaders -> CreatePolicyVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreatePolicyVersion where
  toJSON :: CreatePolicyVersion -> Value
toJSON CreatePolicyVersion' {Maybe Bool
Text
policyDocument :: Text
policyName :: Text
setAsDefault :: Maybe Bool
$sel:policyDocument:CreatePolicyVersion' :: CreatePolicyVersion -> Text
$sel:policyName:CreatePolicyVersion' :: CreatePolicyVersion -> Text
$sel:setAsDefault:CreatePolicyVersion' :: CreatePolicyVersion -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"policyDocument" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyDocument)
          ]
      )

instance Core.ToPath CreatePolicyVersion where
  toPath :: CreatePolicyVersion -> ByteString
toPath CreatePolicyVersion' {Maybe Bool
Text
policyDocument :: Text
policyName :: Text
setAsDefault :: Maybe Bool
$sel:policyDocument:CreatePolicyVersion' :: CreatePolicyVersion -> Text
$sel:policyName:CreatePolicyVersion' :: CreatePolicyVersion -> Text
$sel:setAsDefault:CreatePolicyVersion' :: CreatePolicyVersion -> Maybe Bool
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/policies/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
policyName, ByteString
"/version"]

instance Core.ToQuery CreatePolicyVersion where
  toQuery :: CreatePolicyVersion -> QueryString
toQuery CreatePolicyVersion' {Maybe Bool
Text
policyDocument :: Text
policyName :: Text
setAsDefault :: Maybe Bool
$sel:policyDocument:CreatePolicyVersion' :: CreatePolicyVersion -> Text
$sel:policyName:CreatePolicyVersion' :: CreatePolicyVersion -> Text
$sel:setAsDefault:CreatePolicyVersion' :: CreatePolicyVersion -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"setAsDefault" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
setAsDefault]

-- | The output of the CreatePolicyVersion operation.
--
-- /See:/ 'newCreatePolicyVersionResponse' smart constructor.
data CreatePolicyVersionResponse = CreatePolicyVersionResponse'
  { -- | The JSON document that describes the policy.
    CreatePolicyVersionResponse -> Maybe Text
policyDocument :: Prelude.Maybe Prelude.Text,
    -- | The policy version ID.
    CreatePolicyVersionResponse -> Maybe Text
policyVersionId :: Prelude.Maybe Prelude.Text,
    -- | The policy ARN.
    CreatePolicyVersionResponse -> Maybe Text
policyArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the policy version is the default.
    CreatePolicyVersionResponse -> Maybe Bool
isDefaultVersion :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    CreatePolicyVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreatePolicyVersionResponse -> CreatePolicyVersionResponse -> Bool
(CreatePolicyVersionResponse
 -> CreatePolicyVersionResponse -> Bool)
-> (CreatePolicyVersionResponse
    -> CreatePolicyVersionResponse -> Bool)
-> Eq CreatePolicyVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePolicyVersionResponse -> CreatePolicyVersionResponse -> Bool
$c/= :: CreatePolicyVersionResponse -> CreatePolicyVersionResponse -> Bool
== :: CreatePolicyVersionResponse -> CreatePolicyVersionResponse -> Bool
$c== :: CreatePolicyVersionResponse -> CreatePolicyVersionResponse -> Bool
Prelude.Eq, ReadPrec [CreatePolicyVersionResponse]
ReadPrec CreatePolicyVersionResponse
Int -> ReadS CreatePolicyVersionResponse
ReadS [CreatePolicyVersionResponse]
(Int -> ReadS CreatePolicyVersionResponse)
-> ReadS [CreatePolicyVersionResponse]
-> ReadPrec CreatePolicyVersionResponse
-> ReadPrec [CreatePolicyVersionResponse]
-> Read CreatePolicyVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePolicyVersionResponse]
$creadListPrec :: ReadPrec [CreatePolicyVersionResponse]
readPrec :: ReadPrec CreatePolicyVersionResponse
$creadPrec :: ReadPrec CreatePolicyVersionResponse
readList :: ReadS [CreatePolicyVersionResponse]
$creadList :: ReadS [CreatePolicyVersionResponse]
readsPrec :: Int -> ReadS CreatePolicyVersionResponse
$creadsPrec :: Int -> ReadS CreatePolicyVersionResponse
Prelude.Read, Int -> CreatePolicyVersionResponse -> ShowS
[CreatePolicyVersionResponse] -> ShowS
CreatePolicyVersionResponse -> String
(Int -> CreatePolicyVersionResponse -> ShowS)
-> (CreatePolicyVersionResponse -> String)
-> ([CreatePolicyVersionResponse] -> ShowS)
-> Show CreatePolicyVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePolicyVersionResponse] -> ShowS
$cshowList :: [CreatePolicyVersionResponse] -> ShowS
show :: CreatePolicyVersionResponse -> String
$cshow :: CreatePolicyVersionResponse -> String
showsPrec :: Int -> CreatePolicyVersionResponse -> ShowS
$cshowsPrec :: Int -> CreatePolicyVersionResponse -> ShowS
Prelude.Show, (forall x.
 CreatePolicyVersionResponse -> Rep CreatePolicyVersionResponse x)
-> (forall x.
    Rep CreatePolicyVersionResponse x -> CreatePolicyVersionResponse)
-> Generic CreatePolicyVersionResponse
forall x.
Rep CreatePolicyVersionResponse x -> CreatePolicyVersionResponse
forall x.
CreatePolicyVersionResponse -> Rep CreatePolicyVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePolicyVersionResponse x -> CreatePolicyVersionResponse
$cfrom :: forall x.
CreatePolicyVersionResponse -> Rep CreatePolicyVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePolicyVersionResponse' 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:
--
-- 'policyDocument', 'createPolicyVersionResponse_policyDocument' - The JSON document that describes the policy.
--
-- 'policyVersionId', 'createPolicyVersionResponse_policyVersionId' - The policy version ID.
--
-- 'policyArn', 'createPolicyVersionResponse_policyArn' - The policy ARN.
--
-- 'isDefaultVersion', 'createPolicyVersionResponse_isDefaultVersion' - Specifies whether the policy version is the default.
--
-- 'httpStatus', 'createPolicyVersionResponse_httpStatus' - The response's http status code.
newCreatePolicyVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreatePolicyVersionResponse
newCreatePolicyVersionResponse :: Int -> CreatePolicyVersionResponse
newCreatePolicyVersionResponse Int
pHttpStatus_ =
  CreatePolicyVersionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Int
-> CreatePolicyVersionResponse
CreatePolicyVersionResponse'
    { $sel:policyDocument:CreatePolicyVersionResponse' :: Maybe Text
policyDocument =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyVersionId:CreatePolicyVersionResponse' :: Maybe Text
policyVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyArn:CreatePolicyVersionResponse' :: Maybe Text
policyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isDefaultVersion:CreatePolicyVersionResponse' :: Maybe Bool
isDefaultVersion = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreatePolicyVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The JSON document that describes the policy.
createPolicyVersionResponse_policyDocument :: Lens.Lens' CreatePolicyVersionResponse (Prelude.Maybe Prelude.Text)
createPolicyVersionResponse_policyDocument :: (Maybe Text -> f (Maybe Text))
-> CreatePolicyVersionResponse -> f CreatePolicyVersionResponse
createPolicyVersionResponse_policyDocument = (CreatePolicyVersionResponse -> Maybe Text)
-> (CreatePolicyVersionResponse
    -> Maybe Text -> CreatePolicyVersionResponse)
-> Lens
     CreatePolicyVersionResponse
     CreatePolicyVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersionResponse' {Maybe Text
policyDocument :: Maybe Text
$sel:policyDocument:CreatePolicyVersionResponse' :: CreatePolicyVersionResponse -> Maybe Text
policyDocument} -> Maybe Text
policyDocument) (\s :: CreatePolicyVersionResponse
s@CreatePolicyVersionResponse' {} Maybe Text
a -> CreatePolicyVersionResponse
s {$sel:policyDocument:CreatePolicyVersionResponse' :: Maybe Text
policyDocument = Maybe Text
a} :: CreatePolicyVersionResponse)

-- | The policy version ID.
createPolicyVersionResponse_policyVersionId :: Lens.Lens' CreatePolicyVersionResponse (Prelude.Maybe Prelude.Text)
createPolicyVersionResponse_policyVersionId :: (Maybe Text -> f (Maybe Text))
-> CreatePolicyVersionResponse -> f CreatePolicyVersionResponse
createPolicyVersionResponse_policyVersionId = (CreatePolicyVersionResponse -> Maybe Text)
-> (CreatePolicyVersionResponse
    -> Maybe Text -> CreatePolicyVersionResponse)
-> Lens
     CreatePolicyVersionResponse
     CreatePolicyVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersionResponse' {Maybe Text
policyVersionId :: Maybe Text
$sel:policyVersionId:CreatePolicyVersionResponse' :: CreatePolicyVersionResponse -> Maybe Text
policyVersionId} -> Maybe Text
policyVersionId) (\s :: CreatePolicyVersionResponse
s@CreatePolicyVersionResponse' {} Maybe Text
a -> CreatePolicyVersionResponse
s {$sel:policyVersionId:CreatePolicyVersionResponse' :: Maybe Text
policyVersionId = Maybe Text
a} :: CreatePolicyVersionResponse)

-- | The policy ARN.
createPolicyVersionResponse_policyArn :: Lens.Lens' CreatePolicyVersionResponse (Prelude.Maybe Prelude.Text)
createPolicyVersionResponse_policyArn :: (Maybe Text -> f (Maybe Text))
-> CreatePolicyVersionResponse -> f CreatePolicyVersionResponse
createPolicyVersionResponse_policyArn = (CreatePolicyVersionResponse -> Maybe Text)
-> (CreatePolicyVersionResponse
    -> Maybe Text -> CreatePolicyVersionResponse)
-> Lens
     CreatePolicyVersionResponse
     CreatePolicyVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersionResponse' {Maybe Text
policyArn :: Maybe Text
$sel:policyArn:CreatePolicyVersionResponse' :: CreatePolicyVersionResponse -> Maybe Text
policyArn} -> Maybe Text
policyArn) (\s :: CreatePolicyVersionResponse
s@CreatePolicyVersionResponse' {} Maybe Text
a -> CreatePolicyVersionResponse
s {$sel:policyArn:CreatePolicyVersionResponse' :: Maybe Text
policyArn = Maybe Text
a} :: CreatePolicyVersionResponse)

-- | Specifies whether the policy version is the default.
createPolicyVersionResponse_isDefaultVersion :: Lens.Lens' CreatePolicyVersionResponse (Prelude.Maybe Prelude.Bool)
createPolicyVersionResponse_isDefaultVersion :: (Maybe Bool -> f (Maybe Bool))
-> CreatePolicyVersionResponse -> f CreatePolicyVersionResponse
createPolicyVersionResponse_isDefaultVersion = (CreatePolicyVersionResponse -> Maybe Bool)
-> (CreatePolicyVersionResponse
    -> Maybe Bool -> CreatePolicyVersionResponse)
-> Lens
     CreatePolicyVersionResponse
     CreatePolicyVersionResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePolicyVersionResponse' {Maybe Bool
isDefaultVersion :: Maybe Bool
$sel:isDefaultVersion:CreatePolicyVersionResponse' :: CreatePolicyVersionResponse -> Maybe Bool
isDefaultVersion} -> Maybe Bool
isDefaultVersion) (\s :: CreatePolicyVersionResponse
s@CreatePolicyVersionResponse' {} Maybe Bool
a -> CreatePolicyVersionResponse
s {$sel:isDefaultVersion:CreatePolicyVersionResponse' :: Maybe Bool
isDefaultVersion = Maybe Bool
a} :: CreatePolicyVersionResponse)

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

instance Prelude.NFData CreatePolicyVersionResponse