{-# 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.WorkMail.CreateImpersonationRole
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an impersonation role for the given WorkMail organization.
--
-- /Idempotency/ ensures that an API request completes no more than one
-- time. With an idempotent request, if the original request completes
-- successfully, any subsequent retries also complete successfully without
-- performing any further actions.
module Amazonka.WorkMail.CreateImpersonationRole
  ( -- * Creating a Request
    CreateImpersonationRole (..),
    newCreateImpersonationRole,

    -- * Request Lenses
    createImpersonationRole_clientToken,
    createImpersonationRole_description,
    createImpersonationRole_organizationId,
    createImpersonationRole_name,
    createImpersonationRole_type,
    createImpersonationRole_rules,

    -- * Destructuring the Response
    CreateImpersonationRoleResponse (..),
    newCreateImpersonationRoleResponse,

    -- * Response Lenses
    createImpersonationRoleResponse_impersonationRoleId,
    createImpersonationRoleResponse_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.WorkMail.Types

-- | /See:/ 'newCreateImpersonationRole' smart constructor.
data CreateImpersonationRole = CreateImpersonationRole'
  { -- | The idempotency token for the client request.
    CreateImpersonationRole -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The description of the new impersonation role.
    CreateImpersonationRole -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The WorkMail organization to create the new impersonation role within.
    CreateImpersonationRole -> Text
organizationId :: Prelude.Text,
    -- | The name of the new impersonation role.
    CreateImpersonationRole -> Text
name :: Prelude.Text,
    -- | The impersonation role\'s type. The available impersonation role types
    -- are @READ_ONLY@ or @FULL_ACCESS@.
    CreateImpersonationRole -> ImpersonationRoleType
type' :: ImpersonationRoleType,
    -- | The list of rules for the impersonation role.
    CreateImpersonationRole -> [ImpersonationRule]
rules :: [ImpersonationRule]
  }
  deriving (CreateImpersonationRole -> CreateImpersonationRole -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateImpersonationRole -> CreateImpersonationRole -> Bool
$c/= :: CreateImpersonationRole -> CreateImpersonationRole -> Bool
== :: CreateImpersonationRole -> CreateImpersonationRole -> Bool
$c== :: CreateImpersonationRole -> CreateImpersonationRole -> Bool
Prelude.Eq, ReadPrec [CreateImpersonationRole]
ReadPrec CreateImpersonationRole
Int -> ReadS CreateImpersonationRole
ReadS [CreateImpersonationRole]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateImpersonationRole]
$creadListPrec :: ReadPrec [CreateImpersonationRole]
readPrec :: ReadPrec CreateImpersonationRole
$creadPrec :: ReadPrec CreateImpersonationRole
readList :: ReadS [CreateImpersonationRole]
$creadList :: ReadS [CreateImpersonationRole]
readsPrec :: Int -> ReadS CreateImpersonationRole
$creadsPrec :: Int -> ReadS CreateImpersonationRole
Prelude.Read, Int -> CreateImpersonationRole -> ShowS
[CreateImpersonationRole] -> ShowS
CreateImpersonationRole -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateImpersonationRole] -> ShowS
$cshowList :: [CreateImpersonationRole] -> ShowS
show :: CreateImpersonationRole -> String
$cshow :: CreateImpersonationRole -> String
showsPrec :: Int -> CreateImpersonationRole -> ShowS
$cshowsPrec :: Int -> CreateImpersonationRole -> ShowS
Prelude.Show, forall x. Rep CreateImpersonationRole x -> CreateImpersonationRole
forall x. CreateImpersonationRole -> Rep CreateImpersonationRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateImpersonationRole x -> CreateImpersonationRole
$cfrom :: forall x. CreateImpersonationRole -> Rep CreateImpersonationRole x
Prelude.Generic)

-- |
-- Create a value of 'CreateImpersonationRole' 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:
--
-- 'clientToken', 'createImpersonationRole_clientToken' - The idempotency token for the client request.
--
-- 'description', 'createImpersonationRole_description' - The description of the new impersonation role.
--
-- 'organizationId', 'createImpersonationRole_organizationId' - The WorkMail organization to create the new impersonation role within.
--
-- 'name', 'createImpersonationRole_name' - The name of the new impersonation role.
--
-- 'type'', 'createImpersonationRole_type' - The impersonation role\'s type. The available impersonation role types
-- are @READ_ONLY@ or @FULL_ACCESS@.
--
-- 'rules', 'createImpersonationRole_rules' - The list of rules for the impersonation role.
newCreateImpersonationRole ::
  -- | 'organizationId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  ImpersonationRoleType ->
  CreateImpersonationRole
newCreateImpersonationRole :: Text -> Text -> ImpersonationRoleType -> CreateImpersonationRole
newCreateImpersonationRole
  Text
pOrganizationId_
  Text
pName_
  ImpersonationRoleType
pType_ =
    CreateImpersonationRole'
      { $sel:clientToken:CreateImpersonationRole' :: Maybe Text
clientToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateImpersonationRole' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:organizationId:CreateImpersonationRole' :: Text
organizationId = Text
pOrganizationId_,
        $sel:name:CreateImpersonationRole' :: Text
name = Text
pName_,
        $sel:type':CreateImpersonationRole' :: ImpersonationRoleType
type' = ImpersonationRoleType
pType_,
        $sel:rules:CreateImpersonationRole' :: [ImpersonationRule]
rules = forall a. Monoid a => a
Prelude.mempty
      }

-- | The idempotency token for the client request.
createImpersonationRole_clientToken :: Lens.Lens' CreateImpersonationRole (Prelude.Maybe Prelude.Text)
createImpersonationRole_clientToken :: Lens' CreateImpersonationRole (Maybe Text)
createImpersonationRole_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRole' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateImpersonationRole
s@CreateImpersonationRole' {} Maybe Text
a -> CreateImpersonationRole
s {$sel:clientToken:CreateImpersonationRole' :: Maybe Text
clientToken = Maybe Text
a} :: CreateImpersonationRole)

-- | The description of the new impersonation role.
createImpersonationRole_description :: Lens.Lens' CreateImpersonationRole (Prelude.Maybe Prelude.Text)
createImpersonationRole_description :: Lens' CreateImpersonationRole (Maybe Text)
createImpersonationRole_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRole' {Maybe Text
description :: Maybe Text
$sel:description:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateImpersonationRole
s@CreateImpersonationRole' {} Maybe Text
a -> CreateImpersonationRole
s {$sel:description:CreateImpersonationRole' :: Maybe Text
description = Maybe Text
a} :: CreateImpersonationRole)

-- | The WorkMail organization to create the new impersonation role within.
createImpersonationRole_organizationId :: Lens.Lens' CreateImpersonationRole Prelude.Text
createImpersonationRole_organizationId :: Lens' CreateImpersonationRole Text
createImpersonationRole_organizationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRole' {Text
organizationId :: Text
$sel:organizationId:CreateImpersonationRole' :: CreateImpersonationRole -> Text
organizationId} -> Text
organizationId) (\s :: CreateImpersonationRole
s@CreateImpersonationRole' {} Text
a -> CreateImpersonationRole
s {$sel:organizationId:CreateImpersonationRole' :: Text
organizationId = Text
a} :: CreateImpersonationRole)

-- | The name of the new impersonation role.
createImpersonationRole_name :: Lens.Lens' CreateImpersonationRole Prelude.Text
createImpersonationRole_name :: Lens' CreateImpersonationRole Text
createImpersonationRole_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRole' {Text
name :: Text
$sel:name:CreateImpersonationRole' :: CreateImpersonationRole -> Text
name} -> Text
name) (\s :: CreateImpersonationRole
s@CreateImpersonationRole' {} Text
a -> CreateImpersonationRole
s {$sel:name:CreateImpersonationRole' :: Text
name = Text
a} :: CreateImpersonationRole)

-- | The impersonation role\'s type. The available impersonation role types
-- are @READ_ONLY@ or @FULL_ACCESS@.
createImpersonationRole_type :: Lens.Lens' CreateImpersonationRole ImpersonationRoleType
createImpersonationRole_type :: Lens' CreateImpersonationRole ImpersonationRoleType
createImpersonationRole_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRole' {ImpersonationRoleType
type' :: ImpersonationRoleType
$sel:type':CreateImpersonationRole' :: CreateImpersonationRole -> ImpersonationRoleType
type'} -> ImpersonationRoleType
type') (\s :: CreateImpersonationRole
s@CreateImpersonationRole' {} ImpersonationRoleType
a -> CreateImpersonationRole
s {$sel:type':CreateImpersonationRole' :: ImpersonationRoleType
type' = ImpersonationRoleType
a} :: CreateImpersonationRole)

-- | The list of rules for the impersonation role.
createImpersonationRole_rules :: Lens.Lens' CreateImpersonationRole [ImpersonationRule]
createImpersonationRole_rules :: Lens' CreateImpersonationRole [ImpersonationRule]
createImpersonationRole_rules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRole' {[ImpersonationRule]
rules :: [ImpersonationRule]
$sel:rules:CreateImpersonationRole' :: CreateImpersonationRole -> [ImpersonationRule]
rules} -> [ImpersonationRule]
rules) (\s :: CreateImpersonationRole
s@CreateImpersonationRole' {} [ImpersonationRule]
a -> CreateImpersonationRole
s {$sel:rules:CreateImpersonationRole' :: [ImpersonationRule]
rules = [ImpersonationRule]
a} :: CreateImpersonationRole) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateImpersonationRole where
  type
    AWSResponse CreateImpersonationRole =
      CreateImpersonationRoleResponse
  request :: (Service -> Service)
-> CreateImpersonationRole -> Request CreateImpersonationRole
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 CreateImpersonationRole
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateImpersonationRole)))
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 -> Int -> CreateImpersonationRoleResponse
CreateImpersonationRoleResponse'
            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
"ImpersonationRoleId")
            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 CreateImpersonationRole where
  hashWithSalt :: Int -> CreateImpersonationRole -> Int
hashWithSalt Int
_salt CreateImpersonationRole' {[ImpersonationRule]
Maybe Text
Text
ImpersonationRoleType
rules :: [ImpersonationRule]
type' :: ImpersonationRoleType
name :: Text
organizationId :: Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:rules:CreateImpersonationRole' :: CreateImpersonationRole -> [ImpersonationRule]
$sel:type':CreateImpersonationRole' :: CreateImpersonationRole -> ImpersonationRoleType
$sel:name:CreateImpersonationRole' :: CreateImpersonationRole -> Text
$sel:organizationId:CreateImpersonationRole' :: CreateImpersonationRole -> Text
$sel:description:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
$sel:clientToken:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ImpersonationRoleType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ImpersonationRule]
rules

instance Prelude.NFData CreateImpersonationRole where
  rnf :: CreateImpersonationRole -> ()
rnf CreateImpersonationRole' {[ImpersonationRule]
Maybe Text
Text
ImpersonationRoleType
rules :: [ImpersonationRule]
type' :: ImpersonationRoleType
name :: Text
organizationId :: Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:rules:CreateImpersonationRole' :: CreateImpersonationRole -> [ImpersonationRule]
$sel:type':CreateImpersonationRole' :: CreateImpersonationRole -> ImpersonationRoleType
$sel:name:CreateImpersonationRole' :: CreateImpersonationRole -> Text
$sel:organizationId:CreateImpersonationRole' :: CreateImpersonationRole -> Text
$sel:description:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
$sel:clientToken:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
organizationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ImpersonationRoleType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ImpersonationRule]
rules

instance Data.ToHeaders CreateImpersonationRole where
  toHeaders :: CreateImpersonationRole -> 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
"WorkMailService.CreateImpersonationRole" ::
                          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 CreateImpersonationRole where
  toJSON :: CreateImpersonationRole -> Value
toJSON CreateImpersonationRole' {[ImpersonationRule]
Maybe Text
Text
ImpersonationRoleType
rules :: [ImpersonationRule]
type' :: ImpersonationRoleType
name :: Text
organizationId :: Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:rules:CreateImpersonationRole' :: CreateImpersonationRole -> [ImpersonationRule]
$sel:type':CreateImpersonationRole' :: CreateImpersonationRole -> ImpersonationRoleType
$sel:name:CreateImpersonationRole' :: CreateImpersonationRole -> Text
$sel:organizationId:CreateImpersonationRole' :: CreateImpersonationRole -> Text
$sel:description:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
$sel:clientToken:CreateImpersonationRole' :: CreateImpersonationRole -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientToken" 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
clientToken,
            (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,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"OrganizationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
organizationId),
            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
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ImpersonationRoleType
type'),
            forall a. a -> Maybe a
Prelude.Just (Key
"Rules" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [ImpersonationRule]
rules)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateImpersonationRoleResponse' 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:
--
-- 'impersonationRoleId', 'createImpersonationRoleResponse_impersonationRoleId' - The new impersonation role ID.
--
-- 'httpStatus', 'createImpersonationRoleResponse_httpStatus' - The response's http status code.
newCreateImpersonationRoleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateImpersonationRoleResponse
newCreateImpersonationRoleResponse :: Int -> CreateImpersonationRoleResponse
newCreateImpersonationRoleResponse Int
pHttpStatus_ =
  CreateImpersonationRoleResponse'
    { $sel:impersonationRoleId:CreateImpersonationRoleResponse' :: Maybe Text
impersonationRoleId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateImpersonationRoleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The new impersonation role ID.
createImpersonationRoleResponse_impersonationRoleId :: Lens.Lens' CreateImpersonationRoleResponse (Prelude.Maybe Prelude.Text)
createImpersonationRoleResponse_impersonationRoleId :: Lens' CreateImpersonationRoleResponse (Maybe Text)
createImpersonationRoleResponse_impersonationRoleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImpersonationRoleResponse' {Maybe Text
impersonationRoleId :: Maybe Text
$sel:impersonationRoleId:CreateImpersonationRoleResponse' :: CreateImpersonationRoleResponse -> Maybe Text
impersonationRoleId} -> Maybe Text
impersonationRoleId) (\s :: CreateImpersonationRoleResponse
s@CreateImpersonationRoleResponse' {} Maybe Text
a -> CreateImpersonationRoleResponse
s {$sel:impersonationRoleId:CreateImpersonationRoleResponse' :: Maybe Text
impersonationRoleId = Maybe Text
a} :: CreateImpersonationRoleResponse)

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

instance
  Prelude.NFData
    CreateImpersonationRoleResponse
  where
  rnf :: CreateImpersonationRoleResponse -> ()
rnf CreateImpersonationRoleResponse' {Int
Maybe Text
httpStatus :: Int
impersonationRoleId :: Maybe Text
$sel:httpStatus:CreateImpersonationRoleResponse' :: CreateImpersonationRoleResponse -> Int
$sel:impersonationRoleId:CreateImpersonationRoleResponse' :: CreateImpersonationRoleResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
impersonationRoleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus