{-# 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.DisablePolicyType
(
DisablePolicyType (..),
newDisablePolicyType,
disablePolicyType_rootId,
disablePolicyType_policyType,
DisablePolicyTypeResponse (..),
newDisablePolicyTypeResponse,
disablePolicyTypeResponse_root,
disablePolicyTypeResponse_httpStatus,
)
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 DisablePolicyType = DisablePolicyType'
{
DisablePolicyType -> Text
rootId :: Prelude.Text,
DisablePolicyType -> PolicyType
policyType :: PolicyType
}
deriving (DisablePolicyType -> DisablePolicyType -> Bool
(DisablePolicyType -> DisablePolicyType -> Bool)
-> (DisablePolicyType -> DisablePolicyType -> Bool)
-> Eq DisablePolicyType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisablePolicyType -> DisablePolicyType -> Bool
$c/= :: DisablePolicyType -> DisablePolicyType -> Bool
== :: DisablePolicyType -> DisablePolicyType -> Bool
$c== :: DisablePolicyType -> DisablePolicyType -> Bool
Prelude.Eq, ReadPrec [DisablePolicyType]
ReadPrec DisablePolicyType
Int -> ReadS DisablePolicyType
ReadS [DisablePolicyType]
(Int -> ReadS DisablePolicyType)
-> ReadS [DisablePolicyType]
-> ReadPrec DisablePolicyType
-> ReadPrec [DisablePolicyType]
-> Read DisablePolicyType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisablePolicyType]
$creadListPrec :: ReadPrec [DisablePolicyType]
readPrec :: ReadPrec DisablePolicyType
$creadPrec :: ReadPrec DisablePolicyType
readList :: ReadS [DisablePolicyType]
$creadList :: ReadS [DisablePolicyType]
readsPrec :: Int -> ReadS DisablePolicyType
$creadsPrec :: Int -> ReadS DisablePolicyType
Prelude.Read, Int -> DisablePolicyType -> ShowS
[DisablePolicyType] -> ShowS
DisablePolicyType -> String
(Int -> DisablePolicyType -> ShowS)
-> (DisablePolicyType -> String)
-> ([DisablePolicyType] -> ShowS)
-> Show DisablePolicyType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisablePolicyType] -> ShowS
$cshowList :: [DisablePolicyType] -> ShowS
show :: DisablePolicyType -> String
$cshow :: DisablePolicyType -> String
showsPrec :: Int -> DisablePolicyType -> ShowS
$cshowsPrec :: Int -> DisablePolicyType -> ShowS
Prelude.Show, (forall x. DisablePolicyType -> Rep DisablePolicyType x)
-> (forall x. Rep DisablePolicyType x -> DisablePolicyType)
-> Generic DisablePolicyType
forall x. Rep DisablePolicyType x -> DisablePolicyType
forall x. DisablePolicyType -> Rep DisablePolicyType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisablePolicyType x -> DisablePolicyType
$cfrom :: forall x. DisablePolicyType -> Rep DisablePolicyType x
Prelude.Generic)
newDisablePolicyType ::
Prelude.Text ->
PolicyType ->
DisablePolicyType
newDisablePolicyType :: Text -> PolicyType -> DisablePolicyType
newDisablePolicyType Text
pRootId_ PolicyType
pPolicyType_ =
DisablePolicyType' :: Text -> PolicyType -> DisablePolicyType
DisablePolicyType'
{ $sel:rootId:DisablePolicyType' :: Text
rootId = Text
pRootId_,
$sel:policyType:DisablePolicyType' :: PolicyType
policyType = PolicyType
pPolicyType_
}
disablePolicyType_rootId :: Lens.Lens' DisablePolicyType Prelude.Text
disablePolicyType_rootId :: (Text -> f Text) -> DisablePolicyType -> f DisablePolicyType
disablePolicyType_rootId = (DisablePolicyType -> Text)
-> (DisablePolicyType -> Text -> DisablePolicyType)
-> Lens DisablePolicyType DisablePolicyType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisablePolicyType' {Text
rootId :: Text
$sel:rootId:DisablePolicyType' :: DisablePolicyType -> Text
rootId} -> Text
rootId) (\s :: DisablePolicyType
s@DisablePolicyType' {} Text
a -> DisablePolicyType
s {$sel:rootId:DisablePolicyType' :: Text
rootId = Text
a} :: DisablePolicyType)
disablePolicyType_policyType :: Lens.Lens' DisablePolicyType PolicyType
disablePolicyType_policyType :: (PolicyType -> f PolicyType)
-> DisablePolicyType -> f DisablePolicyType
disablePolicyType_policyType = (DisablePolicyType -> PolicyType)
-> (DisablePolicyType -> PolicyType -> DisablePolicyType)
-> Lens DisablePolicyType DisablePolicyType PolicyType PolicyType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisablePolicyType' {PolicyType
policyType :: PolicyType
$sel:policyType:DisablePolicyType' :: DisablePolicyType -> PolicyType
policyType} -> PolicyType
policyType) (\s :: DisablePolicyType
s@DisablePolicyType' {} PolicyType
a -> DisablePolicyType
s {$sel:policyType:DisablePolicyType' :: PolicyType
policyType = PolicyType
a} :: DisablePolicyType)
instance Core.AWSRequest DisablePolicyType where
type
AWSResponse DisablePolicyType =
DisablePolicyTypeResponse
request :: DisablePolicyType -> Request DisablePolicyType
request = Service -> DisablePolicyType -> Request DisablePolicyType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DisablePolicyType
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisablePolicyType)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DisablePolicyType))
-> Logger
-> Service
-> Proxy DisablePolicyType
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisablePolicyType)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Root -> Int -> DisablePolicyTypeResponse
DisablePolicyTypeResponse'
(Maybe Root -> Int -> DisablePolicyTypeResponse)
-> Either String (Maybe Root)
-> Either String (Int -> DisablePolicyTypeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Root)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Root")
Either String (Int -> DisablePolicyTypeResponse)
-> Either String Int -> Either String DisablePolicyTypeResponse
forall (f :: * -> *) a b. Applicative f => 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 DisablePolicyType
instance Prelude.NFData DisablePolicyType
instance Core.ToHeaders DisablePolicyType where
toHeaders :: DisablePolicyType -> ResponseHeaders
toHeaders =
ResponseHeaders -> DisablePolicyType -> 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
"AWSOrganizationsV20161128.DisablePolicyType" ::
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 DisablePolicyType where
toJSON :: DisablePolicyType -> Value
toJSON DisablePolicyType' {Text
PolicyType
policyType :: PolicyType
rootId :: Text
$sel:policyType:DisablePolicyType' :: DisablePolicyType -> PolicyType
$sel:rootId:DisablePolicyType' :: DisablePolicyType -> 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
"RootId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
rootId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PolicyType" Text -> PolicyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PolicyType
policyType)
]
)
instance Core.ToPath DisablePolicyType where
toPath :: DisablePolicyType -> ByteString
toPath = ByteString -> DisablePolicyType -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DisablePolicyType where
toQuery :: DisablePolicyType -> QueryString
toQuery = QueryString -> DisablePolicyType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DisablePolicyTypeResponse = DisablePolicyTypeResponse'
{
DisablePolicyTypeResponse -> Maybe Root
root :: Prelude.Maybe Root,
DisablePolicyTypeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool
(DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool)
-> (DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool)
-> Eq DisablePolicyTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool
$c/= :: DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool
== :: DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool
$c== :: DisablePolicyTypeResponse -> DisablePolicyTypeResponse -> Bool
Prelude.Eq, ReadPrec [DisablePolicyTypeResponse]
ReadPrec DisablePolicyTypeResponse
Int -> ReadS DisablePolicyTypeResponse
ReadS [DisablePolicyTypeResponse]
(Int -> ReadS DisablePolicyTypeResponse)
-> ReadS [DisablePolicyTypeResponse]
-> ReadPrec DisablePolicyTypeResponse
-> ReadPrec [DisablePolicyTypeResponse]
-> Read DisablePolicyTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisablePolicyTypeResponse]
$creadListPrec :: ReadPrec [DisablePolicyTypeResponse]
readPrec :: ReadPrec DisablePolicyTypeResponse
$creadPrec :: ReadPrec DisablePolicyTypeResponse
readList :: ReadS [DisablePolicyTypeResponse]
$creadList :: ReadS [DisablePolicyTypeResponse]
readsPrec :: Int -> ReadS DisablePolicyTypeResponse
$creadsPrec :: Int -> ReadS DisablePolicyTypeResponse
Prelude.Read, Int -> DisablePolicyTypeResponse -> ShowS
[DisablePolicyTypeResponse] -> ShowS
DisablePolicyTypeResponse -> String
(Int -> DisablePolicyTypeResponse -> ShowS)
-> (DisablePolicyTypeResponse -> String)
-> ([DisablePolicyTypeResponse] -> ShowS)
-> Show DisablePolicyTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisablePolicyTypeResponse] -> ShowS
$cshowList :: [DisablePolicyTypeResponse] -> ShowS
show :: DisablePolicyTypeResponse -> String
$cshow :: DisablePolicyTypeResponse -> String
showsPrec :: Int -> DisablePolicyTypeResponse -> ShowS
$cshowsPrec :: Int -> DisablePolicyTypeResponse -> ShowS
Prelude.Show, (forall x.
DisablePolicyTypeResponse -> Rep DisablePolicyTypeResponse x)
-> (forall x.
Rep DisablePolicyTypeResponse x -> DisablePolicyTypeResponse)
-> Generic DisablePolicyTypeResponse
forall x.
Rep DisablePolicyTypeResponse x -> DisablePolicyTypeResponse
forall x.
DisablePolicyTypeResponse -> Rep DisablePolicyTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisablePolicyTypeResponse x -> DisablePolicyTypeResponse
$cfrom :: forall x.
DisablePolicyTypeResponse -> Rep DisablePolicyTypeResponse x
Prelude.Generic)
newDisablePolicyTypeResponse ::
Prelude.Int ->
DisablePolicyTypeResponse
newDisablePolicyTypeResponse :: Int -> DisablePolicyTypeResponse
newDisablePolicyTypeResponse Int
pHttpStatus_ =
DisablePolicyTypeResponse' :: Maybe Root -> Int -> DisablePolicyTypeResponse
DisablePolicyTypeResponse'
{ $sel:root:DisablePolicyTypeResponse' :: Maybe Root
root = Maybe Root
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DisablePolicyTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
disablePolicyTypeResponse_root :: Lens.Lens' DisablePolicyTypeResponse (Prelude.Maybe Root)
disablePolicyTypeResponse_root :: (Maybe Root -> f (Maybe Root))
-> DisablePolicyTypeResponse -> f DisablePolicyTypeResponse
disablePolicyTypeResponse_root = (DisablePolicyTypeResponse -> Maybe Root)
-> (DisablePolicyTypeResponse
-> Maybe Root -> DisablePolicyTypeResponse)
-> Lens
DisablePolicyTypeResponse
DisablePolicyTypeResponse
(Maybe Root)
(Maybe Root)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisablePolicyTypeResponse' {Maybe Root
root :: Maybe Root
$sel:root:DisablePolicyTypeResponse' :: DisablePolicyTypeResponse -> Maybe Root
root} -> Maybe Root
root) (\s :: DisablePolicyTypeResponse
s@DisablePolicyTypeResponse' {} Maybe Root
a -> DisablePolicyTypeResponse
s {$sel:root:DisablePolicyTypeResponse' :: Maybe Root
root = Maybe Root
a} :: DisablePolicyTypeResponse)
disablePolicyTypeResponse_httpStatus :: Lens.Lens' DisablePolicyTypeResponse Prelude.Int
disablePolicyTypeResponse_httpStatus :: (Int -> f Int)
-> DisablePolicyTypeResponse -> f DisablePolicyTypeResponse
disablePolicyTypeResponse_httpStatus = (DisablePolicyTypeResponse -> Int)
-> (DisablePolicyTypeResponse -> Int -> DisablePolicyTypeResponse)
-> Lens DisablePolicyTypeResponse DisablePolicyTypeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisablePolicyTypeResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisablePolicyTypeResponse' :: DisablePolicyTypeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisablePolicyTypeResponse
s@DisablePolicyTypeResponse' {} Int
a -> DisablePolicyTypeResponse
s {$sel:httpStatus:DisablePolicyTypeResponse' :: Int
httpStatus = Int
a} :: DisablePolicyTypeResponse)
instance Prelude.NFData DisablePolicyTypeResponse