{-# 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.DescribeOrganizationalUnit
(
DescribeOrganizationalUnit (..),
newDescribeOrganizationalUnit,
describeOrganizationalUnit_organizationalUnitId,
DescribeOrganizationalUnitResponse (..),
newDescribeOrganizationalUnitResponse,
describeOrganizationalUnitResponse_organizationalUnit,
describeOrganizationalUnitResponse_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 DescribeOrganizationalUnit = DescribeOrganizationalUnit'
{
DescribeOrganizationalUnit -> Text
organizationalUnitId :: Prelude.Text
}
deriving (DescribeOrganizationalUnit -> DescribeOrganizationalUnit -> Bool
(DescribeOrganizationalUnit -> DescribeOrganizationalUnit -> Bool)
-> (DescribeOrganizationalUnit
-> DescribeOrganizationalUnit -> Bool)
-> Eq DescribeOrganizationalUnit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeOrganizationalUnit -> DescribeOrganizationalUnit -> Bool
$c/= :: DescribeOrganizationalUnit -> DescribeOrganizationalUnit -> Bool
== :: DescribeOrganizationalUnit -> DescribeOrganizationalUnit -> Bool
$c== :: DescribeOrganizationalUnit -> DescribeOrganizationalUnit -> Bool
Prelude.Eq, ReadPrec [DescribeOrganizationalUnit]
ReadPrec DescribeOrganizationalUnit
Int -> ReadS DescribeOrganizationalUnit
ReadS [DescribeOrganizationalUnit]
(Int -> ReadS DescribeOrganizationalUnit)
-> ReadS [DescribeOrganizationalUnit]
-> ReadPrec DescribeOrganizationalUnit
-> ReadPrec [DescribeOrganizationalUnit]
-> Read DescribeOrganizationalUnit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeOrganizationalUnit]
$creadListPrec :: ReadPrec [DescribeOrganizationalUnit]
readPrec :: ReadPrec DescribeOrganizationalUnit
$creadPrec :: ReadPrec DescribeOrganizationalUnit
readList :: ReadS [DescribeOrganizationalUnit]
$creadList :: ReadS [DescribeOrganizationalUnit]
readsPrec :: Int -> ReadS DescribeOrganizationalUnit
$creadsPrec :: Int -> ReadS DescribeOrganizationalUnit
Prelude.Read, Int -> DescribeOrganizationalUnit -> ShowS
[DescribeOrganizationalUnit] -> ShowS
DescribeOrganizationalUnit -> String
(Int -> DescribeOrganizationalUnit -> ShowS)
-> (DescribeOrganizationalUnit -> String)
-> ([DescribeOrganizationalUnit] -> ShowS)
-> Show DescribeOrganizationalUnit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeOrganizationalUnit] -> ShowS
$cshowList :: [DescribeOrganizationalUnit] -> ShowS
show :: DescribeOrganizationalUnit -> String
$cshow :: DescribeOrganizationalUnit -> String
showsPrec :: Int -> DescribeOrganizationalUnit -> ShowS
$cshowsPrec :: Int -> DescribeOrganizationalUnit -> ShowS
Prelude.Show, (forall x.
DescribeOrganizationalUnit -> Rep DescribeOrganizationalUnit x)
-> (forall x.
Rep DescribeOrganizationalUnit x -> DescribeOrganizationalUnit)
-> Generic DescribeOrganizationalUnit
forall x.
Rep DescribeOrganizationalUnit x -> DescribeOrganizationalUnit
forall x.
DescribeOrganizationalUnit -> Rep DescribeOrganizationalUnit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeOrganizationalUnit x -> DescribeOrganizationalUnit
$cfrom :: forall x.
DescribeOrganizationalUnit -> Rep DescribeOrganizationalUnit x
Prelude.Generic)
newDescribeOrganizationalUnit ::
Prelude.Text ->
DescribeOrganizationalUnit
newDescribeOrganizationalUnit :: Text -> DescribeOrganizationalUnit
newDescribeOrganizationalUnit Text
pOrganizationalUnitId_ =
DescribeOrganizationalUnit' :: Text -> DescribeOrganizationalUnit
DescribeOrganizationalUnit'
{ $sel:organizationalUnitId:DescribeOrganizationalUnit' :: Text
organizationalUnitId =
Text
pOrganizationalUnitId_
}
describeOrganizationalUnit_organizationalUnitId :: Lens.Lens' DescribeOrganizationalUnit Prelude.Text
describeOrganizationalUnit_organizationalUnitId :: (Text -> f Text)
-> DescribeOrganizationalUnit -> f DescribeOrganizationalUnit
describeOrganizationalUnit_organizationalUnitId = (DescribeOrganizationalUnit -> Text)
-> (DescribeOrganizationalUnit
-> Text -> DescribeOrganizationalUnit)
-> Lens
DescribeOrganizationalUnit DescribeOrganizationalUnit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationalUnit' {Text
organizationalUnitId :: Text
$sel:organizationalUnitId:DescribeOrganizationalUnit' :: DescribeOrganizationalUnit -> Text
organizationalUnitId} -> Text
organizationalUnitId) (\s :: DescribeOrganizationalUnit
s@DescribeOrganizationalUnit' {} Text
a -> DescribeOrganizationalUnit
s {$sel:organizationalUnitId:DescribeOrganizationalUnit' :: Text
organizationalUnitId = Text
a} :: DescribeOrganizationalUnit)
instance Core.AWSRequest DescribeOrganizationalUnit where
type
AWSResponse DescribeOrganizationalUnit =
DescribeOrganizationalUnitResponse
request :: DescribeOrganizationalUnit -> Request DescribeOrganizationalUnit
request = Service
-> DescribeOrganizationalUnit -> Request DescribeOrganizationalUnit
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeOrganizationalUnit
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeOrganizationalUnit)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeOrganizationalUnit))
-> Logger
-> Service
-> Proxy DescribeOrganizationalUnit
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeOrganizationalUnit)))
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 OrganizationalUnit
-> Int -> DescribeOrganizationalUnitResponse
DescribeOrganizationalUnitResponse'
(Maybe OrganizationalUnit
-> Int -> DescribeOrganizationalUnitResponse)
-> Either String (Maybe OrganizationalUnit)
-> Either String (Int -> DescribeOrganizationalUnitResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe OrganizationalUnit)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OrganizationalUnit")
Either String (Int -> DescribeOrganizationalUnitResponse)
-> Either String Int
-> Either String DescribeOrganizationalUnitResponse
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 DescribeOrganizationalUnit
instance Prelude.NFData DescribeOrganizationalUnit
instance Core.ToHeaders DescribeOrganizationalUnit where
toHeaders :: DescribeOrganizationalUnit -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeOrganizationalUnit -> 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.DescribeOrganizationalUnit" ::
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 DescribeOrganizationalUnit where
toJSON :: DescribeOrganizationalUnit -> Value
toJSON DescribeOrganizationalUnit' {Text
organizationalUnitId :: Text
$sel:organizationalUnitId:DescribeOrganizationalUnit' :: DescribeOrganizationalUnit -> 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
"OrganizationalUnitId"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationalUnitId
)
]
)
instance Core.ToPath DescribeOrganizationalUnit where
toPath :: DescribeOrganizationalUnit -> ByteString
toPath = ByteString -> DescribeOrganizationalUnit -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeOrganizationalUnit where
toQuery :: DescribeOrganizationalUnit -> QueryString
toQuery = QueryString -> DescribeOrganizationalUnit -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeOrganizationalUnitResponse = DescribeOrganizationalUnitResponse'
{
DescribeOrganizationalUnitResponse -> Maybe OrganizationalUnit
organizationalUnit :: Prelude.Maybe OrganizationalUnit,
DescribeOrganizationalUnitResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool
(DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool)
-> (DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool)
-> Eq DescribeOrganizationalUnitResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool
$c/= :: DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool
== :: DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool
$c== :: DescribeOrganizationalUnitResponse
-> DescribeOrganizationalUnitResponse -> Bool
Prelude.Eq, ReadPrec [DescribeOrganizationalUnitResponse]
ReadPrec DescribeOrganizationalUnitResponse
Int -> ReadS DescribeOrganizationalUnitResponse
ReadS [DescribeOrganizationalUnitResponse]
(Int -> ReadS DescribeOrganizationalUnitResponse)
-> ReadS [DescribeOrganizationalUnitResponse]
-> ReadPrec DescribeOrganizationalUnitResponse
-> ReadPrec [DescribeOrganizationalUnitResponse]
-> Read DescribeOrganizationalUnitResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeOrganizationalUnitResponse]
$creadListPrec :: ReadPrec [DescribeOrganizationalUnitResponse]
readPrec :: ReadPrec DescribeOrganizationalUnitResponse
$creadPrec :: ReadPrec DescribeOrganizationalUnitResponse
readList :: ReadS [DescribeOrganizationalUnitResponse]
$creadList :: ReadS [DescribeOrganizationalUnitResponse]
readsPrec :: Int -> ReadS DescribeOrganizationalUnitResponse
$creadsPrec :: Int -> ReadS DescribeOrganizationalUnitResponse
Prelude.Read, Int -> DescribeOrganizationalUnitResponse -> ShowS
[DescribeOrganizationalUnitResponse] -> ShowS
DescribeOrganizationalUnitResponse -> String
(Int -> DescribeOrganizationalUnitResponse -> ShowS)
-> (DescribeOrganizationalUnitResponse -> String)
-> ([DescribeOrganizationalUnitResponse] -> ShowS)
-> Show DescribeOrganizationalUnitResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeOrganizationalUnitResponse] -> ShowS
$cshowList :: [DescribeOrganizationalUnitResponse] -> ShowS
show :: DescribeOrganizationalUnitResponse -> String
$cshow :: DescribeOrganizationalUnitResponse -> String
showsPrec :: Int -> DescribeOrganizationalUnitResponse -> ShowS
$cshowsPrec :: Int -> DescribeOrganizationalUnitResponse -> ShowS
Prelude.Show, (forall x.
DescribeOrganizationalUnitResponse
-> Rep DescribeOrganizationalUnitResponse x)
-> (forall x.
Rep DescribeOrganizationalUnitResponse x
-> DescribeOrganizationalUnitResponse)
-> Generic DescribeOrganizationalUnitResponse
forall x.
Rep DescribeOrganizationalUnitResponse x
-> DescribeOrganizationalUnitResponse
forall x.
DescribeOrganizationalUnitResponse
-> Rep DescribeOrganizationalUnitResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeOrganizationalUnitResponse x
-> DescribeOrganizationalUnitResponse
$cfrom :: forall x.
DescribeOrganizationalUnitResponse
-> Rep DescribeOrganizationalUnitResponse x
Prelude.Generic)
newDescribeOrganizationalUnitResponse ::
Prelude.Int ->
DescribeOrganizationalUnitResponse
newDescribeOrganizationalUnitResponse :: Int -> DescribeOrganizationalUnitResponse
newDescribeOrganizationalUnitResponse Int
pHttpStatus_ =
DescribeOrganizationalUnitResponse' :: Maybe OrganizationalUnit
-> Int -> DescribeOrganizationalUnitResponse
DescribeOrganizationalUnitResponse'
{ $sel:organizationalUnit:DescribeOrganizationalUnitResponse' :: Maybe OrganizationalUnit
organizationalUnit =
Maybe OrganizationalUnit
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeOrganizationalUnitResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeOrganizationalUnitResponse_organizationalUnit :: Lens.Lens' DescribeOrganizationalUnitResponse (Prelude.Maybe OrganizationalUnit)
describeOrganizationalUnitResponse_organizationalUnit :: (Maybe OrganizationalUnit -> f (Maybe OrganizationalUnit))
-> DescribeOrganizationalUnitResponse
-> f DescribeOrganizationalUnitResponse
describeOrganizationalUnitResponse_organizationalUnit = (DescribeOrganizationalUnitResponse -> Maybe OrganizationalUnit)
-> (DescribeOrganizationalUnitResponse
-> Maybe OrganizationalUnit -> DescribeOrganizationalUnitResponse)
-> Lens
DescribeOrganizationalUnitResponse
DescribeOrganizationalUnitResponse
(Maybe OrganizationalUnit)
(Maybe OrganizationalUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationalUnitResponse' {Maybe OrganizationalUnit
organizationalUnit :: Maybe OrganizationalUnit
$sel:organizationalUnit:DescribeOrganizationalUnitResponse' :: DescribeOrganizationalUnitResponse -> Maybe OrganizationalUnit
organizationalUnit} -> Maybe OrganizationalUnit
organizationalUnit) (\s :: DescribeOrganizationalUnitResponse
s@DescribeOrganizationalUnitResponse' {} Maybe OrganizationalUnit
a -> DescribeOrganizationalUnitResponse
s {$sel:organizationalUnit:DescribeOrganizationalUnitResponse' :: Maybe OrganizationalUnit
organizationalUnit = Maybe OrganizationalUnit
a} :: DescribeOrganizationalUnitResponse)
describeOrganizationalUnitResponse_httpStatus :: Lens.Lens' DescribeOrganizationalUnitResponse Prelude.Int
describeOrganizationalUnitResponse_httpStatus :: (Int -> f Int)
-> DescribeOrganizationalUnitResponse
-> f DescribeOrganizationalUnitResponse
describeOrganizationalUnitResponse_httpStatus = (DescribeOrganizationalUnitResponse -> Int)
-> (DescribeOrganizationalUnitResponse
-> Int -> DescribeOrganizationalUnitResponse)
-> Lens
DescribeOrganizationalUnitResponse
DescribeOrganizationalUnitResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationalUnitResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeOrganizationalUnitResponse' :: DescribeOrganizationalUnitResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeOrganizationalUnitResponse
s@DescribeOrganizationalUnitResponse' {} Int
a -> DescribeOrganizationalUnitResponse
s {$sel:httpStatus:DescribeOrganizationalUnitResponse' :: Int
httpStatus = Int
a} :: DescribeOrganizationalUnitResponse)
instance
Prelude.NFData
DescribeOrganizationalUnitResponse