{-# 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.WorkMail.AssociateDelegateToResource
(
AssociateDelegateToResource (..),
newAssociateDelegateToResource,
associateDelegateToResource_organizationId,
associateDelegateToResource_resourceId,
associateDelegateToResource_entityId,
AssociateDelegateToResourceResponse (..),
newAssociateDelegateToResourceResponse,
associateDelegateToResourceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkMail.Types
data AssociateDelegateToResource = AssociateDelegateToResource'
{
AssociateDelegateToResource -> Text
organizationId :: Prelude.Text,
AssociateDelegateToResource -> Text
resourceId :: Prelude.Text,
AssociateDelegateToResource -> Text
entityId :: Prelude.Text
}
deriving (AssociateDelegateToResource -> AssociateDelegateToResource -> Bool
(AssociateDelegateToResource
-> AssociateDelegateToResource -> Bool)
-> (AssociateDelegateToResource
-> AssociateDelegateToResource -> Bool)
-> Eq AssociateDelegateToResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDelegateToResource -> AssociateDelegateToResource -> Bool
$c/= :: AssociateDelegateToResource -> AssociateDelegateToResource -> Bool
== :: AssociateDelegateToResource -> AssociateDelegateToResource -> Bool
$c== :: AssociateDelegateToResource -> AssociateDelegateToResource -> Bool
Prelude.Eq, ReadPrec [AssociateDelegateToResource]
ReadPrec AssociateDelegateToResource
Int -> ReadS AssociateDelegateToResource
ReadS [AssociateDelegateToResource]
(Int -> ReadS AssociateDelegateToResource)
-> ReadS [AssociateDelegateToResource]
-> ReadPrec AssociateDelegateToResource
-> ReadPrec [AssociateDelegateToResource]
-> Read AssociateDelegateToResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDelegateToResource]
$creadListPrec :: ReadPrec [AssociateDelegateToResource]
readPrec :: ReadPrec AssociateDelegateToResource
$creadPrec :: ReadPrec AssociateDelegateToResource
readList :: ReadS [AssociateDelegateToResource]
$creadList :: ReadS [AssociateDelegateToResource]
readsPrec :: Int -> ReadS AssociateDelegateToResource
$creadsPrec :: Int -> ReadS AssociateDelegateToResource
Prelude.Read, Int -> AssociateDelegateToResource -> ShowS
[AssociateDelegateToResource] -> ShowS
AssociateDelegateToResource -> String
(Int -> AssociateDelegateToResource -> ShowS)
-> (AssociateDelegateToResource -> String)
-> ([AssociateDelegateToResource] -> ShowS)
-> Show AssociateDelegateToResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDelegateToResource] -> ShowS
$cshowList :: [AssociateDelegateToResource] -> ShowS
show :: AssociateDelegateToResource -> String
$cshow :: AssociateDelegateToResource -> String
showsPrec :: Int -> AssociateDelegateToResource -> ShowS
$cshowsPrec :: Int -> AssociateDelegateToResource -> ShowS
Prelude.Show, (forall x.
AssociateDelegateToResource -> Rep AssociateDelegateToResource x)
-> (forall x.
Rep AssociateDelegateToResource x -> AssociateDelegateToResource)
-> Generic AssociateDelegateToResource
forall x.
Rep AssociateDelegateToResource x -> AssociateDelegateToResource
forall x.
AssociateDelegateToResource -> Rep AssociateDelegateToResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDelegateToResource x -> AssociateDelegateToResource
$cfrom :: forall x.
AssociateDelegateToResource -> Rep AssociateDelegateToResource x
Prelude.Generic)
newAssociateDelegateToResource ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AssociateDelegateToResource
newAssociateDelegateToResource :: Text -> Text -> Text -> AssociateDelegateToResource
newAssociateDelegateToResource
Text
pOrganizationId_
Text
pResourceId_
Text
pEntityId_ =
AssociateDelegateToResource' :: Text -> Text -> Text -> AssociateDelegateToResource
AssociateDelegateToResource'
{ $sel:organizationId:AssociateDelegateToResource' :: Text
organizationId =
Text
pOrganizationId_,
$sel:resourceId:AssociateDelegateToResource' :: Text
resourceId = Text
pResourceId_,
$sel:entityId:AssociateDelegateToResource' :: Text
entityId = Text
pEntityId_
}
associateDelegateToResource_organizationId :: Lens.Lens' AssociateDelegateToResource Prelude.Text
associateDelegateToResource_organizationId :: (Text -> f Text)
-> AssociateDelegateToResource -> f AssociateDelegateToResource
associateDelegateToResource_organizationId = (AssociateDelegateToResource -> Text)
-> (AssociateDelegateToResource
-> Text -> AssociateDelegateToResource)
-> Lens
AssociateDelegateToResource AssociateDelegateToResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDelegateToResource' {Text
organizationId :: Text
$sel:organizationId:AssociateDelegateToResource' :: AssociateDelegateToResource -> Text
organizationId} -> Text
organizationId) (\s :: AssociateDelegateToResource
s@AssociateDelegateToResource' {} Text
a -> AssociateDelegateToResource
s {$sel:organizationId:AssociateDelegateToResource' :: Text
organizationId = Text
a} :: AssociateDelegateToResource)
associateDelegateToResource_resourceId :: Lens.Lens' AssociateDelegateToResource Prelude.Text
associateDelegateToResource_resourceId :: (Text -> f Text)
-> AssociateDelegateToResource -> f AssociateDelegateToResource
associateDelegateToResource_resourceId = (AssociateDelegateToResource -> Text)
-> (AssociateDelegateToResource
-> Text -> AssociateDelegateToResource)
-> Lens
AssociateDelegateToResource AssociateDelegateToResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDelegateToResource' {Text
resourceId :: Text
$sel:resourceId:AssociateDelegateToResource' :: AssociateDelegateToResource -> Text
resourceId} -> Text
resourceId) (\s :: AssociateDelegateToResource
s@AssociateDelegateToResource' {} Text
a -> AssociateDelegateToResource
s {$sel:resourceId:AssociateDelegateToResource' :: Text
resourceId = Text
a} :: AssociateDelegateToResource)
associateDelegateToResource_entityId :: Lens.Lens' AssociateDelegateToResource Prelude.Text
associateDelegateToResource_entityId :: (Text -> f Text)
-> AssociateDelegateToResource -> f AssociateDelegateToResource
associateDelegateToResource_entityId = (AssociateDelegateToResource -> Text)
-> (AssociateDelegateToResource
-> Text -> AssociateDelegateToResource)
-> Lens
AssociateDelegateToResource AssociateDelegateToResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDelegateToResource' {Text
entityId :: Text
$sel:entityId:AssociateDelegateToResource' :: AssociateDelegateToResource -> Text
entityId} -> Text
entityId) (\s :: AssociateDelegateToResource
s@AssociateDelegateToResource' {} Text
a -> AssociateDelegateToResource
s {$sel:entityId:AssociateDelegateToResource' :: Text
entityId = Text
a} :: AssociateDelegateToResource)
instance Core.AWSRequest AssociateDelegateToResource where
type
AWSResponse AssociateDelegateToResource =
AssociateDelegateToResourceResponse
request :: AssociateDelegateToResource -> Request AssociateDelegateToResource
request = Service
-> AssociateDelegateToResource
-> Request AssociateDelegateToResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateDelegateToResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDelegateToResource)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateDelegateToResource))
-> Logger
-> Service
-> Proxy AssociateDelegateToResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDelegateToResource)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AssociateDelegateToResourceResponse
AssociateDelegateToResourceResponse'
(Int -> AssociateDelegateToResourceResponse)
-> Either String Int
-> Either String AssociateDelegateToResourceResponse
forall (f :: * -> *) a b. Functor 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 AssociateDelegateToResource
instance Prelude.NFData AssociateDelegateToResource
instance Core.ToHeaders AssociateDelegateToResource where
toHeaders :: AssociateDelegateToResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateDelegateToResource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkMailService.AssociateDelegateToResource" ::
Prelude.ByteString
),
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 AssociateDelegateToResource where
toJSON :: AssociateDelegateToResource -> Value
toJSON AssociateDelegateToResource' {Text
entityId :: Text
resourceId :: Text
organizationId :: Text
$sel:entityId:AssociateDelegateToResource' :: AssociateDelegateToResource -> Text
$sel:resourceId:AssociateDelegateToResource' :: AssociateDelegateToResource -> Text
$sel:organizationId:AssociateDelegateToResource' :: AssociateDelegateToResource -> Text
..} =
[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
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EntityId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
entityId)
]
)
instance Core.ToPath AssociateDelegateToResource where
toPath :: AssociateDelegateToResource -> ByteString
toPath = ByteString -> AssociateDelegateToResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateDelegateToResource where
toQuery :: AssociateDelegateToResource -> QueryString
toQuery = QueryString -> AssociateDelegateToResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateDelegateToResourceResponse = AssociateDelegateToResourceResponse'
{
AssociateDelegateToResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool
(AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool)
-> (AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool)
-> Eq AssociateDelegateToResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool
$c/= :: AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool
== :: AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool
$c== :: AssociateDelegateToResourceResponse
-> AssociateDelegateToResourceResponse -> Bool
Prelude.Eq, ReadPrec [AssociateDelegateToResourceResponse]
ReadPrec AssociateDelegateToResourceResponse
Int -> ReadS AssociateDelegateToResourceResponse
ReadS [AssociateDelegateToResourceResponse]
(Int -> ReadS AssociateDelegateToResourceResponse)
-> ReadS [AssociateDelegateToResourceResponse]
-> ReadPrec AssociateDelegateToResourceResponse
-> ReadPrec [AssociateDelegateToResourceResponse]
-> Read AssociateDelegateToResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDelegateToResourceResponse]
$creadListPrec :: ReadPrec [AssociateDelegateToResourceResponse]
readPrec :: ReadPrec AssociateDelegateToResourceResponse
$creadPrec :: ReadPrec AssociateDelegateToResourceResponse
readList :: ReadS [AssociateDelegateToResourceResponse]
$creadList :: ReadS [AssociateDelegateToResourceResponse]
readsPrec :: Int -> ReadS AssociateDelegateToResourceResponse
$creadsPrec :: Int -> ReadS AssociateDelegateToResourceResponse
Prelude.Read, Int -> AssociateDelegateToResourceResponse -> ShowS
[AssociateDelegateToResourceResponse] -> ShowS
AssociateDelegateToResourceResponse -> String
(Int -> AssociateDelegateToResourceResponse -> ShowS)
-> (AssociateDelegateToResourceResponse -> String)
-> ([AssociateDelegateToResourceResponse] -> ShowS)
-> Show AssociateDelegateToResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDelegateToResourceResponse] -> ShowS
$cshowList :: [AssociateDelegateToResourceResponse] -> ShowS
show :: AssociateDelegateToResourceResponse -> String
$cshow :: AssociateDelegateToResourceResponse -> String
showsPrec :: Int -> AssociateDelegateToResourceResponse -> ShowS
$cshowsPrec :: Int -> AssociateDelegateToResourceResponse -> ShowS
Prelude.Show, (forall x.
AssociateDelegateToResourceResponse
-> Rep AssociateDelegateToResourceResponse x)
-> (forall x.
Rep AssociateDelegateToResourceResponse x
-> AssociateDelegateToResourceResponse)
-> Generic AssociateDelegateToResourceResponse
forall x.
Rep AssociateDelegateToResourceResponse x
-> AssociateDelegateToResourceResponse
forall x.
AssociateDelegateToResourceResponse
-> Rep AssociateDelegateToResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDelegateToResourceResponse x
-> AssociateDelegateToResourceResponse
$cfrom :: forall x.
AssociateDelegateToResourceResponse
-> Rep AssociateDelegateToResourceResponse x
Prelude.Generic)
newAssociateDelegateToResourceResponse ::
Prelude.Int ->
AssociateDelegateToResourceResponse
newAssociateDelegateToResourceResponse :: Int -> AssociateDelegateToResourceResponse
newAssociateDelegateToResourceResponse Int
pHttpStatus_ =
AssociateDelegateToResourceResponse' :: Int -> AssociateDelegateToResourceResponse
AssociateDelegateToResourceResponse'
{ $sel:httpStatus:AssociateDelegateToResourceResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateDelegateToResourceResponse_httpStatus :: Lens.Lens' AssociateDelegateToResourceResponse Prelude.Int
associateDelegateToResourceResponse_httpStatus :: (Int -> f Int)
-> AssociateDelegateToResourceResponse
-> f AssociateDelegateToResourceResponse
associateDelegateToResourceResponse_httpStatus = (AssociateDelegateToResourceResponse -> Int)
-> (AssociateDelegateToResourceResponse
-> Int -> AssociateDelegateToResourceResponse)
-> Lens
AssociateDelegateToResourceResponse
AssociateDelegateToResourceResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDelegateToResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateDelegateToResourceResponse' :: AssociateDelegateToResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateDelegateToResourceResponse
s@AssociateDelegateToResourceResponse' {} Int
a -> AssociateDelegateToResourceResponse
s {$sel:httpStatus:AssociateDelegateToResourceResponse' :: Int
httpStatus = Int
a} :: AssociateDelegateToResourceResponse)
instance
Prelude.NFData
AssociateDelegateToResourceResponse