{-# 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.Organizations.EnableAWSServiceAccess
(
EnableAWSServiceAccess (..),
newEnableAWSServiceAccess,
enableAWSServiceAccess_servicePrincipal,
EnableAWSServiceAccessResponse (..),
newEnableAWSServiceAccessResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data EnableAWSServiceAccess = EnableAWSServiceAccess'
{
EnableAWSServiceAccess -> Text
servicePrincipal :: Prelude.Text
}
deriving (EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool
(EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool)
-> (EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool)
-> Eq EnableAWSServiceAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool
$c/= :: EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool
== :: EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool
$c== :: EnableAWSServiceAccess -> EnableAWSServiceAccess -> Bool
Prelude.Eq, ReadPrec [EnableAWSServiceAccess]
ReadPrec EnableAWSServiceAccess
Int -> ReadS EnableAWSServiceAccess
ReadS [EnableAWSServiceAccess]
(Int -> ReadS EnableAWSServiceAccess)
-> ReadS [EnableAWSServiceAccess]
-> ReadPrec EnableAWSServiceAccess
-> ReadPrec [EnableAWSServiceAccess]
-> Read EnableAWSServiceAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAWSServiceAccess]
$creadListPrec :: ReadPrec [EnableAWSServiceAccess]
readPrec :: ReadPrec EnableAWSServiceAccess
$creadPrec :: ReadPrec EnableAWSServiceAccess
readList :: ReadS [EnableAWSServiceAccess]
$creadList :: ReadS [EnableAWSServiceAccess]
readsPrec :: Int -> ReadS EnableAWSServiceAccess
$creadsPrec :: Int -> ReadS EnableAWSServiceAccess
Prelude.Read, Int -> EnableAWSServiceAccess -> ShowS
[EnableAWSServiceAccess] -> ShowS
EnableAWSServiceAccess -> String
(Int -> EnableAWSServiceAccess -> ShowS)
-> (EnableAWSServiceAccess -> String)
-> ([EnableAWSServiceAccess] -> ShowS)
-> Show EnableAWSServiceAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAWSServiceAccess] -> ShowS
$cshowList :: [EnableAWSServiceAccess] -> ShowS
show :: EnableAWSServiceAccess -> String
$cshow :: EnableAWSServiceAccess -> String
showsPrec :: Int -> EnableAWSServiceAccess -> ShowS
$cshowsPrec :: Int -> EnableAWSServiceAccess -> ShowS
Prelude.Show, (forall x. EnableAWSServiceAccess -> Rep EnableAWSServiceAccess x)
-> (forall x.
Rep EnableAWSServiceAccess x -> EnableAWSServiceAccess)
-> Generic EnableAWSServiceAccess
forall x. Rep EnableAWSServiceAccess x -> EnableAWSServiceAccess
forall x. EnableAWSServiceAccess -> Rep EnableAWSServiceAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableAWSServiceAccess x -> EnableAWSServiceAccess
$cfrom :: forall x. EnableAWSServiceAccess -> Rep EnableAWSServiceAccess x
Prelude.Generic)
newEnableAWSServiceAccess ::
Prelude.Text ->
EnableAWSServiceAccess
newEnableAWSServiceAccess :: Text -> EnableAWSServiceAccess
newEnableAWSServiceAccess Text
pServicePrincipal_ =
EnableAWSServiceAccess' :: Text -> EnableAWSServiceAccess
EnableAWSServiceAccess'
{ $sel:servicePrincipal:EnableAWSServiceAccess' :: Text
servicePrincipal =
Text
pServicePrincipal_
}
enableAWSServiceAccess_servicePrincipal :: Lens.Lens' EnableAWSServiceAccess Prelude.Text
enableAWSServiceAccess_servicePrincipal :: (Text -> f Text)
-> EnableAWSServiceAccess -> f EnableAWSServiceAccess
enableAWSServiceAccess_servicePrincipal = (EnableAWSServiceAccess -> Text)
-> (EnableAWSServiceAccess -> Text -> EnableAWSServiceAccess)
-> Lens EnableAWSServiceAccess EnableAWSServiceAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAWSServiceAccess' {Text
servicePrincipal :: Text
$sel:servicePrincipal:EnableAWSServiceAccess' :: EnableAWSServiceAccess -> Text
servicePrincipal} -> Text
servicePrincipal) (\s :: EnableAWSServiceAccess
s@EnableAWSServiceAccess' {} Text
a -> EnableAWSServiceAccess
s {$sel:servicePrincipal:EnableAWSServiceAccess' :: Text
servicePrincipal = Text
a} :: EnableAWSServiceAccess)
instance Core.AWSRequest EnableAWSServiceAccess where
type
AWSResponse EnableAWSServiceAccess =
EnableAWSServiceAccessResponse
request :: EnableAWSServiceAccess -> Request EnableAWSServiceAccess
request = Service -> EnableAWSServiceAccess -> Request EnableAWSServiceAccess
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EnableAWSServiceAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse EnableAWSServiceAccess)))
response =
AWSResponse EnableAWSServiceAccess
-> Logger
-> Service
-> Proxy EnableAWSServiceAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse EnableAWSServiceAccess)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
AWSResponse EnableAWSServiceAccess
EnableAWSServiceAccessResponse
EnableAWSServiceAccessResponse'
instance Prelude.Hashable EnableAWSServiceAccess
instance Prelude.NFData EnableAWSServiceAccess
instance Core.ToHeaders EnableAWSServiceAccess where
toHeaders :: EnableAWSServiceAccess -> [Header]
toHeaders =
[Header] -> EnableAWSServiceAccess -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"AWSOrganizationsV20161128.EnableAWSServiceAccess" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON EnableAWSServiceAccess where
toJSON :: EnableAWSServiceAccess -> Value
toJSON EnableAWSServiceAccess' {Text
servicePrincipal :: Text
$sel:servicePrincipal:EnableAWSServiceAccess' :: EnableAWSServiceAccess -> 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
"ServicePrincipal" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
servicePrincipal)
]
)
instance Core.ToPath EnableAWSServiceAccess where
toPath :: EnableAWSServiceAccess -> ByteString
toPath = ByteString -> EnableAWSServiceAccess -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery EnableAWSServiceAccess where
toQuery :: EnableAWSServiceAccess -> QueryString
toQuery = QueryString -> EnableAWSServiceAccess -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data EnableAWSServiceAccessResponse = EnableAWSServiceAccessResponse'
{
}
deriving (EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool
(EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool)
-> (EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool)
-> Eq EnableAWSServiceAccessResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool
$c/= :: EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool
== :: EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool
$c== :: EnableAWSServiceAccessResponse
-> EnableAWSServiceAccessResponse -> Bool
Prelude.Eq, ReadPrec [EnableAWSServiceAccessResponse]
ReadPrec EnableAWSServiceAccessResponse
Int -> ReadS EnableAWSServiceAccessResponse
ReadS [EnableAWSServiceAccessResponse]
(Int -> ReadS EnableAWSServiceAccessResponse)
-> ReadS [EnableAWSServiceAccessResponse]
-> ReadPrec EnableAWSServiceAccessResponse
-> ReadPrec [EnableAWSServiceAccessResponse]
-> Read EnableAWSServiceAccessResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAWSServiceAccessResponse]
$creadListPrec :: ReadPrec [EnableAWSServiceAccessResponse]
readPrec :: ReadPrec EnableAWSServiceAccessResponse
$creadPrec :: ReadPrec EnableAWSServiceAccessResponse
readList :: ReadS [EnableAWSServiceAccessResponse]
$creadList :: ReadS [EnableAWSServiceAccessResponse]
readsPrec :: Int -> ReadS EnableAWSServiceAccessResponse
$creadsPrec :: Int -> ReadS EnableAWSServiceAccessResponse
Prelude.Read, Int -> EnableAWSServiceAccessResponse -> ShowS
[EnableAWSServiceAccessResponse] -> ShowS
EnableAWSServiceAccessResponse -> String
(Int -> EnableAWSServiceAccessResponse -> ShowS)
-> (EnableAWSServiceAccessResponse -> String)
-> ([EnableAWSServiceAccessResponse] -> ShowS)
-> Show EnableAWSServiceAccessResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAWSServiceAccessResponse] -> ShowS
$cshowList :: [EnableAWSServiceAccessResponse] -> ShowS
show :: EnableAWSServiceAccessResponse -> String
$cshow :: EnableAWSServiceAccessResponse -> String
showsPrec :: Int -> EnableAWSServiceAccessResponse -> ShowS
$cshowsPrec :: Int -> EnableAWSServiceAccessResponse -> ShowS
Prelude.Show, (forall x.
EnableAWSServiceAccessResponse
-> Rep EnableAWSServiceAccessResponse x)
-> (forall x.
Rep EnableAWSServiceAccessResponse x
-> EnableAWSServiceAccessResponse)
-> Generic EnableAWSServiceAccessResponse
forall x.
Rep EnableAWSServiceAccessResponse x
-> EnableAWSServiceAccessResponse
forall x.
EnableAWSServiceAccessResponse
-> Rep EnableAWSServiceAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableAWSServiceAccessResponse x
-> EnableAWSServiceAccessResponse
$cfrom :: forall x.
EnableAWSServiceAccessResponse
-> Rep EnableAWSServiceAccessResponse x
Prelude.Generic)
newEnableAWSServiceAccessResponse ::
EnableAWSServiceAccessResponse
newEnableAWSServiceAccessResponse :: EnableAWSServiceAccessResponse
newEnableAWSServiceAccessResponse =
EnableAWSServiceAccessResponse
EnableAWSServiceAccessResponse'
instance
Prelude.NFData
EnableAWSServiceAccessResponse