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