{-# 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 #-}
module Amazonka.LexV2Models.CreateResourcePolicy
(
CreateResourcePolicy (..),
newCreateResourcePolicy,
createResourcePolicy_resourceArn,
createResourcePolicy_policy,
CreateResourcePolicyResponse (..),
newCreateResourcePolicyResponse,
createResourcePolicyResponse_resourceArn,
createResourcePolicyResponse_revisionId,
createResourcePolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateResourcePolicy = CreateResourcePolicy'
{
CreateResourcePolicy -> Text
resourceArn :: Prelude.Text,
CreateResourcePolicy -> Text
policy :: Prelude.Text
}
deriving (CreateResourcePolicy -> CreateResourcePolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResourcePolicy -> CreateResourcePolicy -> Bool
$c/= :: CreateResourcePolicy -> CreateResourcePolicy -> Bool
== :: CreateResourcePolicy -> CreateResourcePolicy -> Bool
$c== :: CreateResourcePolicy -> CreateResourcePolicy -> Bool
Prelude.Eq, ReadPrec [CreateResourcePolicy]
ReadPrec CreateResourcePolicy
Int -> ReadS CreateResourcePolicy
ReadS [CreateResourcePolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateResourcePolicy]
$creadListPrec :: ReadPrec [CreateResourcePolicy]
readPrec :: ReadPrec CreateResourcePolicy
$creadPrec :: ReadPrec CreateResourcePolicy
readList :: ReadS [CreateResourcePolicy]
$creadList :: ReadS [CreateResourcePolicy]
readsPrec :: Int -> ReadS CreateResourcePolicy
$creadsPrec :: Int -> ReadS CreateResourcePolicy
Prelude.Read, Int -> CreateResourcePolicy -> ShowS
[CreateResourcePolicy] -> ShowS
CreateResourcePolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResourcePolicy] -> ShowS
$cshowList :: [CreateResourcePolicy] -> ShowS
show :: CreateResourcePolicy -> String
$cshow :: CreateResourcePolicy -> String
showsPrec :: Int -> CreateResourcePolicy -> ShowS
$cshowsPrec :: Int -> CreateResourcePolicy -> ShowS
Prelude.Show, forall x. Rep CreateResourcePolicy x -> CreateResourcePolicy
forall x. CreateResourcePolicy -> Rep CreateResourcePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateResourcePolicy x -> CreateResourcePolicy
$cfrom :: forall x. CreateResourcePolicy -> Rep CreateResourcePolicy x
Prelude.Generic)
newCreateResourcePolicy ::
Prelude.Text ->
Prelude.Text ->
CreateResourcePolicy
newCreateResourcePolicy :: Text -> Text -> CreateResourcePolicy
newCreateResourcePolicy Text
pResourceArn_ Text
pPolicy_ =
CreateResourcePolicy'
{ $sel:resourceArn:CreateResourcePolicy' :: Text
resourceArn = Text
pResourceArn_,
$sel:policy:CreateResourcePolicy' :: Text
policy = Text
pPolicy_
}
createResourcePolicy_resourceArn :: Lens.Lens' CreateResourcePolicy Prelude.Text
createResourcePolicy_resourceArn :: Lens' CreateResourcePolicy Text
createResourcePolicy_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResourcePolicy' {Text
resourceArn :: Text
$sel:resourceArn:CreateResourcePolicy' :: CreateResourcePolicy -> Text
resourceArn} -> Text
resourceArn) (\s :: CreateResourcePolicy
s@CreateResourcePolicy' {} Text
a -> CreateResourcePolicy
s {$sel:resourceArn:CreateResourcePolicy' :: Text
resourceArn = Text
a} :: CreateResourcePolicy)
createResourcePolicy_policy :: Lens.Lens' CreateResourcePolicy Prelude.Text
createResourcePolicy_policy :: Lens' CreateResourcePolicy Text
createResourcePolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResourcePolicy' {Text
policy :: Text
$sel:policy:CreateResourcePolicy' :: CreateResourcePolicy -> Text
policy} -> Text
policy) (\s :: CreateResourcePolicy
s@CreateResourcePolicy' {} Text
a -> CreateResourcePolicy
s {$sel:policy:CreateResourcePolicy' :: Text
policy = Text
a} :: CreateResourcePolicy)
instance Core.AWSRequest CreateResourcePolicy where
type
AWSResponse CreateResourcePolicy =
CreateResourcePolicyResponse
request :: (Service -> Service)
-> CreateResourcePolicy -> Request CreateResourcePolicy
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 CreateResourcePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateResourcePolicy)))
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 -> Int -> CreateResourcePolicyResponse
CreateResourcePolicyResponse'
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
"resourceArn")
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
"revisionId")
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 CreateResourcePolicy where
hashWithSalt :: Int -> CreateResourcePolicy -> Int
hashWithSalt Int
_salt CreateResourcePolicy' {Text
policy :: Text
resourceArn :: Text
$sel:policy:CreateResourcePolicy' :: CreateResourcePolicy -> Text
$sel:resourceArn:CreateResourcePolicy' :: CreateResourcePolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData CreateResourcePolicy where
rnf :: CreateResourcePolicy -> ()
rnf CreateResourcePolicy' {Text
policy :: Text
resourceArn :: Text
$sel:policy:CreateResourcePolicy' :: CreateResourcePolicy -> Text
$sel:resourceArn:CreateResourcePolicy' :: CreateResourcePolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders CreateResourcePolicy where
toHeaders :: CreateResourcePolicy -> 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 CreateResourcePolicy where
toJSON :: CreateResourcePolicy -> Value
toJSON CreateResourcePolicy' {Text
policy :: Text
resourceArn :: Text
$sel:policy:CreateResourcePolicy' :: CreateResourcePolicy -> Text
$sel:resourceArn:CreateResourcePolicy' :: CreateResourcePolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policy)]
)
instance Data.ToPath CreateResourcePolicy where
toPath :: CreateResourcePolicy -> ByteString
toPath CreateResourcePolicy' {Text
policy :: Text
resourceArn :: Text
$sel:policy:CreateResourcePolicy' :: CreateResourcePolicy -> Text
$sel:resourceArn:CreateResourcePolicy' :: CreateResourcePolicy -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/policy/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceArn, ByteString
"/"]
instance Data.ToQuery CreateResourcePolicy where
toQuery :: CreateResourcePolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateResourcePolicyResponse = CreateResourcePolicyResponse'
{
CreateResourcePolicyResponse -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
CreateResourcePolicyResponse -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
CreateResourcePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateResourcePolicyResponse
-> CreateResourcePolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResourcePolicyResponse
-> CreateResourcePolicyResponse -> Bool
$c/= :: CreateResourcePolicyResponse
-> CreateResourcePolicyResponse -> Bool
== :: CreateResourcePolicyResponse
-> CreateResourcePolicyResponse -> Bool
$c== :: CreateResourcePolicyResponse
-> CreateResourcePolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateResourcePolicyResponse]
ReadPrec CreateResourcePolicyResponse
Int -> ReadS CreateResourcePolicyResponse
ReadS [CreateResourcePolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateResourcePolicyResponse]
$creadListPrec :: ReadPrec [CreateResourcePolicyResponse]
readPrec :: ReadPrec CreateResourcePolicyResponse
$creadPrec :: ReadPrec CreateResourcePolicyResponse
readList :: ReadS [CreateResourcePolicyResponse]
$creadList :: ReadS [CreateResourcePolicyResponse]
readsPrec :: Int -> ReadS CreateResourcePolicyResponse
$creadsPrec :: Int -> ReadS CreateResourcePolicyResponse
Prelude.Read, Int -> CreateResourcePolicyResponse -> ShowS
[CreateResourcePolicyResponse] -> ShowS
CreateResourcePolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResourcePolicyResponse] -> ShowS
$cshowList :: [CreateResourcePolicyResponse] -> ShowS
show :: CreateResourcePolicyResponse -> String
$cshow :: CreateResourcePolicyResponse -> String
showsPrec :: Int -> CreateResourcePolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateResourcePolicyResponse -> ShowS
Prelude.Show, forall x.
Rep CreateResourcePolicyResponse x -> CreateResourcePolicyResponse
forall x.
CreateResourcePolicyResponse -> Rep CreateResourcePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateResourcePolicyResponse x -> CreateResourcePolicyResponse
$cfrom :: forall x.
CreateResourcePolicyResponse -> Rep CreateResourcePolicyResponse x
Prelude.Generic)
newCreateResourcePolicyResponse ::
Prelude.Int ->
CreateResourcePolicyResponse
newCreateResourcePolicyResponse :: Int -> CreateResourcePolicyResponse
newCreateResourcePolicyResponse Int
pHttpStatus_ =
CreateResourcePolicyResponse'
{ $sel:resourceArn:CreateResourcePolicyResponse' :: Maybe Text
resourceArn =
forall a. Maybe a
Prelude.Nothing,
$sel:revisionId:CreateResourcePolicyResponse' :: Maybe Text
revisionId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateResourcePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createResourcePolicyResponse_resourceArn :: Lens.Lens' CreateResourcePolicyResponse (Prelude.Maybe Prelude.Text)
createResourcePolicyResponse_resourceArn :: Lens' CreateResourcePolicyResponse (Maybe Text)
createResourcePolicyResponse_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResourcePolicyResponse' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:CreateResourcePolicyResponse' :: CreateResourcePolicyResponse -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: CreateResourcePolicyResponse
s@CreateResourcePolicyResponse' {} Maybe Text
a -> CreateResourcePolicyResponse
s {$sel:resourceArn:CreateResourcePolicyResponse' :: Maybe Text
resourceArn = Maybe Text
a} :: CreateResourcePolicyResponse)
createResourcePolicyResponse_revisionId :: Lens.Lens' CreateResourcePolicyResponse (Prelude.Maybe Prelude.Text)
createResourcePolicyResponse_revisionId :: Lens' CreateResourcePolicyResponse (Maybe Text)
createResourcePolicyResponse_revisionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResourcePolicyResponse' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:CreateResourcePolicyResponse' :: CreateResourcePolicyResponse -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: CreateResourcePolicyResponse
s@CreateResourcePolicyResponse' {} Maybe Text
a -> CreateResourcePolicyResponse
s {$sel:revisionId:CreateResourcePolicyResponse' :: Maybe Text
revisionId = Maybe Text
a} :: CreateResourcePolicyResponse)
createResourcePolicyResponse_httpStatus :: Lens.Lens' CreateResourcePolicyResponse Prelude.Int
createResourcePolicyResponse_httpStatus :: Lens' CreateResourcePolicyResponse Int
createResourcePolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResourcePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateResourcePolicyResponse' :: CreateResourcePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateResourcePolicyResponse
s@CreateResourcePolicyResponse' {} Int
a -> CreateResourcePolicyResponse
s {$sel:httpStatus:CreateResourcePolicyResponse' :: Int
httpStatus = Int
a} :: CreateResourcePolicyResponse)
instance Prelude.NFData CreateResourcePolicyResponse where
rnf :: CreateResourcePolicyResponse -> ()
rnf CreateResourcePolicyResponse' {Int
Maybe Text
httpStatus :: Int
revisionId :: Maybe Text
resourceArn :: Maybe Text
$sel:httpStatus:CreateResourcePolicyResponse' :: CreateResourcePolicyResponse -> Int
$sel:revisionId:CreateResourcePolicyResponse' :: CreateResourcePolicyResponse -> Maybe Text
$sel:resourceArn:CreateResourcePolicyResponse' :: CreateResourcePolicyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus