{-# 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.EnablePolicyType
(
EnablePolicyType (..),
newEnablePolicyType,
enablePolicyType_rootId,
enablePolicyType_policyType,
EnablePolicyTypeResponse (..),
newEnablePolicyTypeResponse,
enablePolicyTypeResponse_root,
enablePolicyTypeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Organizations.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data EnablePolicyType = EnablePolicyType'
{
EnablePolicyType -> Text
rootId :: Prelude.Text,
EnablePolicyType -> PolicyType
policyType :: PolicyType
}
deriving (EnablePolicyType -> EnablePolicyType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnablePolicyType -> EnablePolicyType -> Bool
$c/= :: EnablePolicyType -> EnablePolicyType -> Bool
== :: EnablePolicyType -> EnablePolicyType -> Bool
$c== :: EnablePolicyType -> EnablePolicyType -> Bool
Prelude.Eq, ReadPrec [EnablePolicyType]
ReadPrec EnablePolicyType
Int -> ReadS EnablePolicyType
ReadS [EnablePolicyType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnablePolicyType]
$creadListPrec :: ReadPrec [EnablePolicyType]
readPrec :: ReadPrec EnablePolicyType
$creadPrec :: ReadPrec EnablePolicyType
readList :: ReadS [EnablePolicyType]
$creadList :: ReadS [EnablePolicyType]
readsPrec :: Int -> ReadS EnablePolicyType
$creadsPrec :: Int -> ReadS EnablePolicyType
Prelude.Read, Int -> EnablePolicyType -> ShowS
[EnablePolicyType] -> ShowS
EnablePolicyType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnablePolicyType] -> ShowS
$cshowList :: [EnablePolicyType] -> ShowS
show :: EnablePolicyType -> String
$cshow :: EnablePolicyType -> String
showsPrec :: Int -> EnablePolicyType -> ShowS
$cshowsPrec :: Int -> EnablePolicyType -> ShowS
Prelude.Show, forall x. Rep EnablePolicyType x -> EnablePolicyType
forall x. EnablePolicyType -> Rep EnablePolicyType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnablePolicyType x -> EnablePolicyType
$cfrom :: forall x. EnablePolicyType -> Rep EnablePolicyType x
Prelude.Generic)
newEnablePolicyType ::
Prelude.Text ->
PolicyType ->
EnablePolicyType
newEnablePolicyType :: Text -> PolicyType -> EnablePolicyType
newEnablePolicyType Text
pRootId_ PolicyType
pPolicyType_ =
EnablePolicyType'
{ $sel:rootId:EnablePolicyType' :: Text
rootId = Text
pRootId_,
$sel:policyType:EnablePolicyType' :: PolicyType
policyType = PolicyType
pPolicyType_
}
enablePolicyType_rootId :: Lens.Lens' EnablePolicyType Prelude.Text
enablePolicyType_rootId :: Lens' EnablePolicyType Text
enablePolicyType_rootId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnablePolicyType' {Text
rootId :: Text
$sel:rootId:EnablePolicyType' :: EnablePolicyType -> Text
rootId} -> Text
rootId) (\s :: EnablePolicyType
s@EnablePolicyType' {} Text
a -> EnablePolicyType
s {$sel:rootId:EnablePolicyType' :: Text
rootId = Text
a} :: EnablePolicyType)
enablePolicyType_policyType :: Lens.Lens' EnablePolicyType PolicyType
enablePolicyType_policyType :: Lens' EnablePolicyType PolicyType
enablePolicyType_policyType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnablePolicyType' {PolicyType
policyType :: PolicyType
$sel:policyType:EnablePolicyType' :: EnablePolicyType -> PolicyType
policyType} -> PolicyType
policyType) (\s :: EnablePolicyType
s@EnablePolicyType' {} PolicyType
a -> EnablePolicyType
s {$sel:policyType:EnablePolicyType' :: PolicyType
policyType = PolicyType
a} :: EnablePolicyType)
instance Core.AWSRequest EnablePolicyType where
type
AWSResponse EnablePolicyType =
EnablePolicyTypeResponse
request :: (Service -> Service)
-> EnablePolicyType -> Request EnablePolicyType
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 EnablePolicyType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnablePolicyType)))
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 Root -> Int -> EnablePolicyTypeResponse
EnablePolicyTypeResponse'
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
"Root")
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 EnablePolicyType where
hashWithSalt :: Int -> EnablePolicyType -> Int
hashWithSalt Int
_salt EnablePolicyType' {Text
PolicyType
policyType :: PolicyType
rootId :: Text
$sel:policyType:EnablePolicyType' :: EnablePolicyType -> PolicyType
$sel:rootId:EnablePolicyType' :: EnablePolicyType -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
rootId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PolicyType
policyType
instance Prelude.NFData EnablePolicyType where
rnf :: EnablePolicyType -> ()
rnf EnablePolicyType' {Text
PolicyType
policyType :: PolicyType
rootId :: Text
$sel:policyType:EnablePolicyType' :: EnablePolicyType -> PolicyType
$sel:rootId:EnablePolicyType' :: EnablePolicyType -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
rootId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PolicyType
policyType
instance Data.ToHeaders EnablePolicyType where
toHeaders :: EnablePolicyType -> 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
"AWSOrganizationsV20161128.EnablePolicyType" ::
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 EnablePolicyType where
toJSON :: EnablePolicyType -> Value
toJSON EnablePolicyType' {Text
PolicyType
policyType :: PolicyType
rootId :: Text
$sel:policyType:EnablePolicyType' :: EnablePolicyType -> PolicyType
$sel:rootId:EnablePolicyType' :: EnablePolicyType -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"RootId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
rootId),
forall a. a -> Maybe a
Prelude.Just (Key
"PolicyType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PolicyType
policyType)
]
)
instance Data.ToPath EnablePolicyType where
toPath :: EnablePolicyType -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery EnablePolicyType where
toQuery :: EnablePolicyType -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data EnablePolicyTypeResponse = EnablePolicyTypeResponse'
{
EnablePolicyTypeResponse -> Maybe Root
root :: Prelude.Maybe Root,
EnablePolicyTypeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (EnablePolicyTypeResponse -> EnablePolicyTypeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnablePolicyTypeResponse -> EnablePolicyTypeResponse -> Bool
$c/= :: EnablePolicyTypeResponse -> EnablePolicyTypeResponse -> Bool
== :: EnablePolicyTypeResponse -> EnablePolicyTypeResponse -> Bool
$c== :: EnablePolicyTypeResponse -> EnablePolicyTypeResponse -> Bool
Prelude.Eq, ReadPrec [EnablePolicyTypeResponse]
ReadPrec EnablePolicyTypeResponse
Int -> ReadS EnablePolicyTypeResponse
ReadS [EnablePolicyTypeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnablePolicyTypeResponse]
$creadListPrec :: ReadPrec [EnablePolicyTypeResponse]
readPrec :: ReadPrec EnablePolicyTypeResponse
$creadPrec :: ReadPrec EnablePolicyTypeResponse
readList :: ReadS [EnablePolicyTypeResponse]
$creadList :: ReadS [EnablePolicyTypeResponse]
readsPrec :: Int -> ReadS EnablePolicyTypeResponse
$creadsPrec :: Int -> ReadS EnablePolicyTypeResponse
Prelude.Read, Int -> EnablePolicyTypeResponse -> ShowS
[EnablePolicyTypeResponse] -> ShowS
EnablePolicyTypeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnablePolicyTypeResponse] -> ShowS
$cshowList :: [EnablePolicyTypeResponse] -> ShowS
show :: EnablePolicyTypeResponse -> String
$cshow :: EnablePolicyTypeResponse -> String
showsPrec :: Int -> EnablePolicyTypeResponse -> ShowS
$cshowsPrec :: Int -> EnablePolicyTypeResponse -> ShowS
Prelude.Show, forall x.
Rep EnablePolicyTypeResponse x -> EnablePolicyTypeResponse
forall x.
EnablePolicyTypeResponse -> Rep EnablePolicyTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnablePolicyTypeResponse x -> EnablePolicyTypeResponse
$cfrom :: forall x.
EnablePolicyTypeResponse -> Rep EnablePolicyTypeResponse x
Prelude.Generic)
newEnablePolicyTypeResponse ::
Prelude.Int ->
EnablePolicyTypeResponse
newEnablePolicyTypeResponse :: Int -> EnablePolicyTypeResponse
newEnablePolicyTypeResponse Int
pHttpStatus_ =
EnablePolicyTypeResponse'
{ $sel:root:EnablePolicyTypeResponse' :: Maybe Root
root = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:EnablePolicyTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
enablePolicyTypeResponse_root :: Lens.Lens' EnablePolicyTypeResponse (Prelude.Maybe Root)
enablePolicyTypeResponse_root :: Lens' EnablePolicyTypeResponse (Maybe Root)
enablePolicyTypeResponse_root = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnablePolicyTypeResponse' {Maybe Root
root :: Maybe Root
$sel:root:EnablePolicyTypeResponse' :: EnablePolicyTypeResponse -> Maybe Root
root} -> Maybe Root
root) (\s :: EnablePolicyTypeResponse
s@EnablePolicyTypeResponse' {} Maybe Root
a -> EnablePolicyTypeResponse
s {$sel:root:EnablePolicyTypeResponse' :: Maybe Root
root = Maybe Root
a} :: EnablePolicyTypeResponse)
enablePolicyTypeResponse_httpStatus :: Lens.Lens' EnablePolicyTypeResponse Prelude.Int
enablePolicyTypeResponse_httpStatus :: Lens' EnablePolicyTypeResponse Int
enablePolicyTypeResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnablePolicyTypeResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnablePolicyTypeResponse' :: EnablePolicyTypeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EnablePolicyTypeResponse
s@EnablePolicyTypeResponse' {} Int
a -> EnablePolicyTypeResponse
s {$sel:httpStatus:EnablePolicyTypeResponse' :: Int
httpStatus = Int
a} :: EnablePolicyTypeResponse)
instance Prelude.NFData EnablePolicyTypeResponse where
rnf :: EnablePolicyTypeResponse -> ()
rnf EnablePolicyTypeResponse' {Int
Maybe Root
httpStatus :: Int
root :: Maybe Root
$sel:httpStatus:EnablePolicyTypeResponse' :: EnablePolicyTypeResponse -> Int
$sel:root:EnablePolicyTypeResponse' :: EnablePolicyTypeResponse -> Maybe Root
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Root
root
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus