{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Organizations.CreateOrganizationalUnit
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an organizational unit (OU) within a root or parent OU. An OU is
-- a container for accounts that enables you to organize your accounts to
-- apply policies according to your business requirements. The number of
-- levels deep that you can nest OUs is dependent upon the policy types
-- enabled for that root. For service control policies, the limit is five.
--
-- For more information about OUs, see
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_ous.html Managing Organizational Units>
-- in the /AWS Organizations User Guide./
--
-- If the request includes tags, then the requester must have the
-- @organizations:TagResource@ permission.
--
-- This operation can be called only from the organization\'s management
-- account.
module Amazonka.Organizations.CreateOrganizationalUnit
  ( -- * Creating a Request
    CreateOrganizationalUnit (..),
    newCreateOrganizationalUnit,

    -- * Request Lenses
    createOrganizationalUnit_tags,
    createOrganizationalUnit_parentId,
    createOrganizationalUnit_name,

    -- * Destructuring the Response
    CreateOrganizationalUnitResponse (..),
    newCreateOrganizationalUnitResponse,

    -- * Response Lenses
    createOrganizationalUnitResponse_organizationalUnit,
    createOrganizationalUnitResponse_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

-- | /See:/ 'newCreateOrganizationalUnit' smart constructor.
data CreateOrganizationalUnit = CreateOrganizationalUnit'
  { -- | A list of tags that you want to attach to the newly created OU. For each
    -- tag in the list, you must specify both a tag key and a value. You can
    -- set the value to an empty string, but you can\'t set it to @null@. For
    -- more information about tagging, see
    -- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_tagging.html Tagging AWS Organizations resources>
    -- in the AWS Organizations User Guide.
    --
    -- If any one of the tags is invalid or if you exceed the allowed number of
    -- tags for an OU, then the entire request fails and the OU is not created.
    CreateOrganizationalUnit -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The unique identifier (ID) of the parent root or OU that you want to
    -- create the new OU in.
    --
    -- The <http://wikipedia.org/wiki/regex regex pattern> for a parent ID
    -- string requires one of the following:
    --
    -- -   __Root__ - A string that begins with \"r-\" followed by from 4 to 32
    --     lowercase letters or digits.
    --
    -- -   __Organizational unit (OU)__ - A string that begins with \"ou-\"
    --     followed by from 4 to 32 lowercase letters or digits (the ID of the
    --     root that the OU is in). This string is followed by a second \"-\"
    --     dash and from 8 to 32 additional lowercase letters or digits.
    CreateOrganizationalUnit -> Text
parentId :: Prelude.Text,
    -- | The friendly name to assign to the new OU.
    CreateOrganizationalUnit -> Text
name :: Prelude.Text
  }
  deriving (CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool
(CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool)
-> (CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool)
-> Eq CreateOrganizationalUnit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool
$c/= :: CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool
== :: CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool
$c== :: CreateOrganizationalUnit -> CreateOrganizationalUnit -> Bool
Prelude.Eq, ReadPrec [CreateOrganizationalUnit]
ReadPrec CreateOrganizationalUnit
Int -> ReadS CreateOrganizationalUnit
ReadS [CreateOrganizationalUnit]
(Int -> ReadS CreateOrganizationalUnit)
-> ReadS [CreateOrganizationalUnit]
-> ReadPrec CreateOrganizationalUnit
-> ReadPrec [CreateOrganizationalUnit]
-> Read CreateOrganizationalUnit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOrganizationalUnit]
$creadListPrec :: ReadPrec [CreateOrganizationalUnit]
readPrec :: ReadPrec CreateOrganizationalUnit
$creadPrec :: ReadPrec CreateOrganizationalUnit
readList :: ReadS [CreateOrganizationalUnit]
$creadList :: ReadS [CreateOrganizationalUnit]
readsPrec :: Int -> ReadS CreateOrganizationalUnit
$creadsPrec :: Int -> ReadS CreateOrganizationalUnit
Prelude.Read, Int -> CreateOrganizationalUnit -> ShowS
[CreateOrganizationalUnit] -> ShowS
CreateOrganizationalUnit -> String
(Int -> CreateOrganizationalUnit -> ShowS)
-> (CreateOrganizationalUnit -> String)
-> ([CreateOrganizationalUnit] -> ShowS)
-> Show CreateOrganizationalUnit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOrganizationalUnit] -> ShowS
$cshowList :: [CreateOrganizationalUnit] -> ShowS
show :: CreateOrganizationalUnit -> String
$cshow :: CreateOrganizationalUnit -> String
showsPrec :: Int -> CreateOrganizationalUnit -> ShowS
$cshowsPrec :: Int -> CreateOrganizationalUnit -> ShowS
Prelude.Show, (forall x.
 CreateOrganizationalUnit -> Rep CreateOrganizationalUnit x)
-> (forall x.
    Rep CreateOrganizationalUnit x -> CreateOrganizationalUnit)
-> Generic CreateOrganizationalUnit
forall x.
Rep CreateOrganizationalUnit x -> CreateOrganizationalUnit
forall x.
CreateOrganizationalUnit -> Rep CreateOrganizationalUnit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateOrganizationalUnit x -> CreateOrganizationalUnit
$cfrom :: forall x.
CreateOrganizationalUnit -> Rep CreateOrganizationalUnit x
Prelude.Generic)

-- |
-- Create a value of 'CreateOrganizationalUnit' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'tags', 'createOrganizationalUnit_tags' - A list of tags that you want to attach to the newly created OU. For each
-- tag in the list, you must specify both a tag key and a value. You can
-- set the value to an empty string, but you can\'t set it to @null@. For
-- more information about tagging, see
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_tagging.html Tagging AWS Organizations resources>
-- in the AWS Organizations User Guide.
--
-- If any one of the tags is invalid or if you exceed the allowed number of
-- tags for an OU, then the entire request fails and the OU is not created.
--
-- 'parentId', 'createOrganizationalUnit_parentId' - The unique identifier (ID) of the parent root or OU that you want to
-- create the new OU in.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> for a parent ID
-- string requires one of the following:
--
-- -   __Root__ - A string that begins with \"r-\" followed by from 4 to 32
--     lowercase letters or digits.
--
-- -   __Organizational unit (OU)__ - A string that begins with \"ou-\"
--     followed by from 4 to 32 lowercase letters or digits (the ID of the
--     root that the OU is in). This string is followed by a second \"-\"
--     dash and from 8 to 32 additional lowercase letters or digits.
--
-- 'name', 'createOrganizationalUnit_name' - The friendly name to assign to the new OU.
newCreateOrganizationalUnit ::
  -- | 'parentId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  CreateOrganizationalUnit
newCreateOrganizationalUnit :: Text -> Text -> CreateOrganizationalUnit
newCreateOrganizationalUnit Text
pParentId_ Text
pName_ =
  CreateOrganizationalUnit' :: Maybe [Tag] -> Text -> Text -> CreateOrganizationalUnit
CreateOrganizationalUnit'
    { $sel:tags:CreateOrganizationalUnit' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:parentId:CreateOrganizationalUnit' :: Text
parentId = Text
pParentId_,
      $sel:name:CreateOrganizationalUnit' :: Text
name = Text
pName_
    }

-- | A list of tags that you want to attach to the newly created OU. For each
-- tag in the list, you must specify both a tag key and a value. You can
-- set the value to an empty string, but you can\'t set it to @null@. For
-- more information about tagging, see
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_tagging.html Tagging AWS Organizations resources>
-- in the AWS Organizations User Guide.
--
-- If any one of the tags is invalid or if you exceed the allowed number of
-- tags for an OU, then the entire request fails and the OU is not created.
createOrganizationalUnit_tags :: Lens.Lens' CreateOrganizationalUnit (Prelude.Maybe [Tag])
createOrganizationalUnit_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOrganizationalUnit -> f CreateOrganizationalUnit
createOrganizationalUnit_tags = (CreateOrganizationalUnit -> Maybe [Tag])
-> (CreateOrganizationalUnit
    -> Maybe [Tag] -> CreateOrganizationalUnit)
-> Lens
     CreateOrganizationalUnit
     CreateOrganizationalUnit
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationalUnit' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateOrganizationalUnit' :: CreateOrganizationalUnit -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateOrganizationalUnit
s@CreateOrganizationalUnit' {} Maybe [Tag]
a -> CreateOrganizationalUnit
s {$sel:tags:CreateOrganizationalUnit' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateOrganizationalUnit) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateOrganizationalUnit -> f CreateOrganizationalUnit)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOrganizationalUnit
-> f CreateOrganizationalUnit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique identifier (ID) of the parent root or OU that you want to
-- create the new OU in.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> for a parent ID
-- string requires one of the following:
--
-- -   __Root__ - A string that begins with \"r-\" followed by from 4 to 32
--     lowercase letters or digits.
--
-- -   __Organizational unit (OU)__ - A string that begins with \"ou-\"
--     followed by from 4 to 32 lowercase letters or digits (the ID of the
--     root that the OU is in). This string is followed by a second \"-\"
--     dash and from 8 to 32 additional lowercase letters or digits.
createOrganizationalUnit_parentId :: Lens.Lens' CreateOrganizationalUnit Prelude.Text
createOrganizationalUnit_parentId :: (Text -> f Text)
-> CreateOrganizationalUnit -> f CreateOrganizationalUnit
createOrganizationalUnit_parentId = (CreateOrganizationalUnit -> Text)
-> (CreateOrganizationalUnit -> Text -> CreateOrganizationalUnit)
-> Lens CreateOrganizationalUnit CreateOrganizationalUnit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationalUnit' {Text
parentId :: Text
$sel:parentId:CreateOrganizationalUnit' :: CreateOrganizationalUnit -> Text
parentId} -> Text
parentId) (\s :: CreateOrganizationalUnit
s@CreateOrganizationalUnit' {} Text
a -> CreateOrganizationalUnit
s {$sel:parentId:CreateOrganizationalUnit' :: Text
parentId = Text
a} :: CreateOrganizationalUnit)

-- | The friendly name to assign to the new OU.
createOrganizationalUnit_name :: Lens.Lens' CreateOrganizationalUnit Prelude.Text
createOrganizationalUnit_name :: (Text -> f Text)
-> CreateOrganizationalUnit -> f CreateOrganizationalUnit
createOrganizationalUnit_name = (CreateOrganizationalUnit -> Text)
-> (CreateOrganizationalUnit -> Text -> CreateOrganizationalUnit)
-> Lens CreateOrganizationalUnit CreateOrganizationalUnit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationalUnit' {Text
name :: Text
$sel:name:CreateOrganizationalUnit' :: CreateOrganizationalUnit -> Text
name} -> Text
name) (\s :: CreateOrganizationalUnit
s@CreateOrganizationalUnit' {} Text
a -> CreateOrganizationalUnit
s {$sel:name:CreateOrganizationalUnit' :: Text
name = Text
a} :: CreateOrganizationalUnit)

instance Core.AWSRequest CreateOrganizationalUnit where
  type
    AWSResponse CreateOrganizationalUnit =
      CreateOrganizationalUnitResponse
  request :: CreateOrganizationalUnit -> Request CreateOrganizationalUnit
request = Service
-> CreateOrganizationalUnit -> Request CreateOrganizationalUnit
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateOrganizationalUnit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateOrganizationalUnit)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateOrganizationalUnit))
-> Logger
-> Service
-> Proxy CreateOrganizationalUnit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateOrganizationalUnit)))
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 -> CreateOrganizationalUnitResponse
CreateOrganizationalUnitResponse'
            (Maybe OrganizationalUnit
 -> Int -> CreateOrganizationalUnitResponse)
-> Either String (Maybe OrganizationalUnit)
-> Either String (Int -> CreateOrganizationalUnitResponse)
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 -> CreateOrganizationalUnitResponse)
-> Either String Int
-> Either String CreateOrganizationalUnitResponse
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 CreateOrganizationalUnit

instance Prelude.NFData CreateOrganizationalUnit

instance Core.ToHeaders CreateOrganizationalUnit where
  toHeaders :: CreateOrganizationalUnit -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateOrganizationalUnit -> 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.CreateOrganizationalUnit" ::
                          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 CreateOrganizationalUnit where
  toJSON :: CreateOrganizationalUnit -> Value
toJSON CreateOrganizationalUnit' {Maybe [Tag]
Text
name :: Text
parentId :: Text
tags :: Maybe [Tag]
$sel:name:CreateOrganizationalUnit' :: CreateOrganizationalUnit -> Text
$sel:parentId:CreateOrganizationalUnit' :: CreateOrganizationalUnit -> Text
$sel:tags:CreateOrganizationalUnit' :: CreateOrganizationalUnit -> Maybe [Tag]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ParentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parentId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

instance Core.ToPath CreateOrganizationalUnit where
  toPath :: CreateOrganizationalUnit -> ByteString
toPath = ByteString -> CreateOrganizationalUnit -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateOrganizationalUnit where
  toQuery :: CreateOrganizationalUnit -> QueryString
toQuery = QueryString -> CreateOrganizationalUnit -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateOrganizationalUnitResponse' smart constructor.
data CreateOrganizationalUnitResponse = CreateOrganizationalUnitResponse'
  { -- | A structure that contains details about the newly created OU.
    CreateOrganizationalUnitResponse -> Maybe OrganizationalUnit
organizationalUnit :: Prelude.Maybe OrganizationalUnit,
    -- | The response's http status code.
    CreateOrganizationalUnitResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateOrganizationalUnitResponse
-> CreateOrganizationalUnitResponse -> Bool
(CreateOrganizationalUnitResponse
 -> CreateOrganizationalUnitResponse -> Bool)
-> (CreateOrganizationalUnitResponse
    -> CreateOrganizationalUnitResponse -> Bool)
-> Eq CreateOrganizationalUnitResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOrganizationalUnitResponse
-> CreateOrganizationalUnitResponse -> Bool
$c/= :: CreateOrganizationalUnitResponse
-> CreateOrganizationalUnitResponse -> Bool
== :: CreateOrganizationalUnitResponse
-> CreateOrganizationalUnitResponse -> Bool
$c== :: CreateOrganizationalUnitResponse
-> CreateOrganizationalUnitResponse -> Bool
Prelude.Eq, ReadPrec [CreateOrganizationalUnitResponse]
ReadPrec CreateOrganizationalUnitResponse
Int -> ReadS CreateOrganizationalUnitResponse
ReadS [CreateOrganizationalUnitResponse]
(Int -> ReadS CreateOrganizationalUnitResponse)
-> ReadS [CreateOrganizationalUnitResponse]
-> ReadPrec CreateOrganizationalUnitResponse
-> ReadPrec [CreateOrganizationalUnitResponse]
-> Read CreateOrganizationalUnitResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOrganizationalUnitResponse]
$creadListPrec :: ReadPrec [CreateOrganizationalUnitResponse]
readPrec :: ReadPrec CreateOrganizationalUnitResponse
$creadPrec :: ReadPrec CreateOrganizationalUnitResponse
readList :: ReadS [CreateOrganizationalUnitResponse]
$creadList :: ReadS [CreateOrganizationalUnitResponse]
readsPrec :: Int -> ReadS CreateOrganizationalUnitResponse
$creadsPrec :: Int -> ReadS CreateOrganizationalUnitResponse
Prelude.Read, Int -> CreateOrganizationalUnitResponse -> ShowS
[CreateOrganizationalUnitResponse] -> ShowS
CreateOrganizationalUnitResponse -> String
(Int -> CreateOrganizationalUnitResponse -> ShowS)
-> (CreateOrganizationalUnitResponse -> String)
-> ([CreateOrganizationalUnitResponse] -> ShowS)
-> Show CreateOrganizationalUnitResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOrganizationalUnitResponse] -> ShowS
$cshowList :: [CreateOrganizationalUnitResponse] -> ShowS
show :: CreateOrganizationalUnitResponse -> String
$cshow :: CreateOrganizationalUnitResponse -> String
showsPrec :: Int -> CreateOrganizationalUnitResponse -> ShowS
$cshowsPrec :: Int -> CreateOrganizationalUnitResponse -> ShowS
Prelude.Show, (forall x.
 CreateOrganizationalUnitResponse
 -> Rep CreateOrganizationalUnitResponse x)
-> (forall x.
    Rep CreateOrganizationalUnitResponse x
    -> CreateOrganizationalUnitResponse)
-> Generic CreateOrganizationalUnitResponse
forall x.
Rep CreateOrganizationalUnitResponse x
-> CreateOrganizationalUnitResponse
forall x.
CreateOrganizationalUnitResponse
-> Rep CreateOrganizationalUnitResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateOrganizationalUnitResponse x
-> CreateOrganizationalUnitResponse
$cfrom :: forall x.
CreateOrganizationalUnitResponse
-> Rep CreateOrganizationalUnitResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateOrganizationalUnitResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'organizationalUnit', 'createOrganizationalUnitResponse_organizationalUnit' - A structure that contains details about the newly created OU.
--
-- 'httpStatus', 'createOrganizationalUnitResponse_httpStatus' - The response's http status code.
newCreateOrganizationalUnitResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateOrganizationalUnitResponse
newCreateOrganizationalUnitResponse :: Int -> CreateOrganizationalUnitResponse
newCreateOrganizationalUnitResponse Int
pHttpStatus_ =
  CreateOrganizationalUnitResponse' :: Maybe OrganizationalUnit -> Int -> CreateOrganizationalUnitResponse
CreateOrganizationalUnitResponse'
    { $sel:organizationalUnit:CreateOrganizationalUnitResponse' :: Maybe OrganizationalUnit
organizationalUnit =
        Maybe OrganizationalUnit
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateOrganizationalUnitResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A structure that contains details about the newly created OU.
createOrganizationalUnitResponse_organizationalUnit :: Lens.Lens' CreateOrganizationalUnitResponse (Prelude.Maybe OrganizationalUnit)
createOrganizationalUnitResponse_organizationalUnit :: (Maybe OrganizationalUnit -> f (Maybe OrganizationalUnit))
-> CreateOrganizationalUnitResponse
-> f CreateOrganizationalUnitResponse
createOrganizationalUnitResponse_organizationalUnit = (CreateOrganizationalUnitResponse -> Maybe OrganizationalUnit)
-> (CreateOrganizationalUnitResponse
    -> Maybe OrganizationalUnit -> CreateOrganizationalUnitResponse)
-> Lens
     CreateOrganizationalUnitResponse
     CreateOrganizationalUnitResponse
     (Maybe OrganizationalUnit)
     (Maybe OrganizationalUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationalUnitResponse' {Maybe OrganizationalUnit
organizationalUnit :: Maybe OrganizationalUnit
$sel:organizationalUnit:CreateOrganizationalUnitResponse' :: CreateOrganizationalUnitResponse -> Maybe OrganizationalUnit
organizationalUnit} -> Maybe OrganizationalUnit
organizationalUnit) (\s :: CreateOrganizationalUnitResponse
s@CreateOrganizationalUnitResponse' {} Maybe OrganizationalUnit
a -> CreateOrganizationalUnitResponse
s {$sel:organizationalUnit:CreateOrganizationalUnitResponse' :: Maybe OrganizationalUnit
organizationalUnit = Maybe OrganizationalUnit
a} :: CreateOrganizationalUnitResponse)

-- | The response's http status code.
createOrganizationalUnitResponse_httpStatus :: Lens.Lens' CreateOrganizationalUnitResponse Prelude.Int
createOrganizationalUnitResponse_httpStatus :: (Int -> f Int)
-> CreateOrganizationalUnitResponse
-> f CreateOrganizationalUnitResponse
createOrganizationalUnitResponse_httpStatus = (CreateOrganizationalUnitResponse -> Int)
-> (CreateOrganizationalUnitResponse
    -> Int -> CreateOrganizationalUnitResponse)
-> Lens
     CreateOrganizationalUnitResponse
     CreateOrganizationalUnitResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationalUnitResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateOrganizationalUnitResponse' :: CreateOrganizationalUnitResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateOrganizationalUnitResponse
s@CreateOrganizationalUnitResponse' {} Int
a -> CreateOrganizationalUnitResponse
s {$sel:httpStatus:CreateOrganizationalUnitResponse' :: Int
httpStatus = Int
a} :: CreateOrganizationalUnitResponse)

instance
  Prelude.NFData
    CreateOrganizationalUnitResponse