{-# 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.DirectoryService.CreateMicrosoftAD
-- 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 a Microsoft AD directory in the Amazon Web Services Cloud. For
-- more information, see
-- <https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html Managed Microsoft AD>
-- in the /Directory Service Admin Guide/.
--
-- Before you call /CreateMicrosoftAD/, ensure that all of the required
-- permissions have been explicitly granted through a policy. For details
-- about what permissions are required to run the /CreateMicrosoftAD/
-- operation, see
-- <http://docs.aws.amazon.com/directoryservice/latest/admin-guide/UsingWithDS_IAM_ResourcePermissions.html Directory Service API Permissions: Actions, Resources, and Conditions Reference>.
module Amazonka.DirectoryService.CreateMicrosoftAD
  ( -- * Creating a Request
    CreateMicrosoftAD (..),
    newCreateMicrosoftAD,

    -- * Request Lenses
    createMicrosoftAD_edition,
    createMicrosoftAD_shortName,
    createMicrosoftAD_description,
    createMicrosoftAD_tags,
    createMicrosoftAD_name,
    createMicrosoftAD_password,
    createMicrosoftAD_vpcSettings,

    -- * Destructuring the Response
    CreateMicrosoftADResponse (..),
    newCreateMicrosoftADResponse,

    -- * Response Lenses
    createMicrosoftADResponse_directoryId,
    createMicrosoftADResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Creates an Managed Microsoft AD directory.
--
-- /See:/ 'newCreateMicrosoftAD' smart constructor.
data CreateMicrosoftAD = CreateMicrosoftAD'
  { -- | Managed Microsoft AD is available in two editions: @Standard@ and
    -- @Enterprise@. @Enterprise@ is the default.
    CreateMicrosoftAD -> Maybe DirectoryEdition
edition :: Prelude.Maybe DirectoryEdition,
    -- | The NetBIOS name for your domain, such as @CORP@. If you don\'t specify
    -- a NetBIOS name, it will default to the first part of your directory DNS.
    -- For example, @CORP@ for the directory DNS @corp.example.com@.
    CreateMicrosoftAD -> Maybe Text
shortName :: Prelude.Maybe Prelude.Text,
    -- | A description for the directory. This label will appear on the Amazon
    -- Web Services console @Directory Details@ page after the directory is
    -- created.
    CreateMicrosoftAD -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags to be assigned to the Managed Microsoft AD directory.
    CreateMicrosoftAD -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The fully qualified domain name for the Managed Microsoft AD directory,
    -- such as @corp.example.com@. This name will resolve inside your VPC only.
    -- It does not need to be publicly resolvable.
    CreateMicrosoftAD -> Text
name :: Prelude.Text,
    -- | The password for the default administrative user named @Admin@.
    --
    -- If you need to change the password for the administrator account, you
    -- can use the ResetUserPassword API call.
    CreateMicrosoftAD -> Sensitive Text
password :: Core.Sensitive Prelude.Text,
    -- | Contains VPC information for the CreateDirectory or CreateMicrosoftAD
    -- operation.
    CreateMicrosoftAD -> DirectoryVpcSettings
vpcSettings :: DirectoryVpcSettings
  }
  deriving (CreateMicrosoftAD -> CreateMicrosoftAD -> Bool
(CreateMicrosoftAD -> CreateMicrosoftAD -> Bool)
-> (CreateMicrosoftAD -> CreateMicrosoftAD -> Bool)
-> Eq CreateMicrosoftAD
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMicrosoftAD -> CreateMicrosoftAD -> Bool
$c/= :: CreateMicrosoftAD -> CreateMicrosoftAD -> Bool
== :: CreateMicrosoftAD -> CreateMicrosoftAD -> Bool
$c== :: CreateMicrosoftAD -> CreateMicrosoftAD -> Bool
Prelude.Eq, Int -> CreateMicrosoftAD -> ShowS
[CreateMicrosoftAD] -> ShowS
CreateMicrosoftAD -> String
(Int -> CreateMicrosoftAD -> ShowS)
-> (CreateMicrosoftAD -> String)
-> ([CreateMicrosoftAD] -> ShowS)
-> Show CreateMicrosoftAD
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMicrosoftAD] -> ShowS
$cshowList :: [CreateMicrosoftAD] -> ShowS
show :: CreateMicrosoftAD -> String
$cshow :: CreateMicrosoftAD -> String
showsPrec :: Int -> CreateMicrosoftAD -> ShowS
$cshowsPrec :: Int -> CreateMicrosoftAD -> ShowS
Prelude.Show, (forall x. CreateMicrosoftAD -> Rep CreateMicrosoftAD x)
-> (forall x. Rep CreateMicrosoftAD x -> CreateMicrosoftAD)
-> Generic CreateMicrosoftAD
forall x. Rep CreateMicrosoftAD x -> CreateMicrosoftAD
forall x. CreateMicrosoftAD -> Rep CreateMicrosoftAD x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMicrosoftAD x -> CreateMicrosoftAD
$cfrom :: forall x. CreateMicrosoftAD -> Rep CreateMicrosoftAD x
Prelude.Generic)

-- |
-- Create a value of 'CreateMicrosoftAD' 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:
--
-- 'edition', 'createMicrosoftAD_edition' - Managed Microsoft AD is available in two editions: @Standard@ and
-- @Enterprise@. @Enterprise@ is the default.
--
-- 'shortName', 'createMicrosoftAD_shortName' - The NetBIOS name for your domain, such as @CORP@. If you don\'t specify
-- a NetBIOS name, it will default to the first part of your directory DNS.
-- For example, @CORP@ for the directory DNS @corp.example.com@.
--
-- 'description', 'createMicrosoftAD_description' - A description for the directory. This label will appear on the Amazon
-- Web Services console @Directory Details@ page after the directory is
-- created.
--
-- 'tags', 'createMicrosoftAD_tags' - The tags to be assigned to the Managed Microsoft AD directory.
--
-- 'name', 'createMicrosoftAD_name' - The fully qualified domain name for the Managed Microsoft AD directory,
-- such as @corp.example.com@. This name will resolve inside your VPC only.
-- It does not need to be publicly resolvable.
--
-- 'password', 'createMicrosoftAD_password' - The password for the default administrative user named @Admin@.
--
-- If you need to change the password for the administrator account, you
-- can use the ResetUserPassword API call.
--
-- 'vpcSettings', 'createMicrosoftAD_vpcSettings' - Contains VPC information for the CreateDirectory or CreateMicrosoftAD
-- operation.
newCreateMicrosoftAD ::
  -- | 'name'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  -- | 'vpcSettings'
  DirectoryVpcSettings ->
  CreateMicrosoftAD
newCreateMicrosoftAD :: Text -> Text -> DirectoryVpcSettings -> CreateMicrosoftAD
newCreateMicrosoftAD Text
pName_ Text
pPassword_ DirectoryVpcSettings
pVpcSettings_ =
  CreateMicrosoftAD' :: Maybe DirectoryEdition
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Sensitive Text
-> DirectoryVpcSettings
-> CreateMicrosoftAD
CreateMicrosoftAD'
    { $sel:edition:CreateMicrosoftAD' :: Maybe DirectoryEdition
edition = Maybe DirectoryEdition
forall a. Maybe a
Prelude.Nothing,
      $sel:shortName:CreateMicrosoftAD' :: Maybe Text
shortName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateMicrosoftAD' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateMicrosoftAD' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateMicrosoftAD' :: Text
name = Text
pName_,
      $sel:password:CreateMicrosoftAD' :: Sensitive Text
password = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_,
      $sel:vpcSettings:CreateMicrosoftAD' :: DirectoryVpcSettings
vpcSettings = DirectoryVpcSettings
pVpcSettings_
    }

-- | Managed Microsoft AD is available in two editions: @Standard@ and
-- @Enterprise@. @Enterprise@ is the default.
createMicrosoftAD_edition :: Lens.Lens' CreateMicrosoftAD (Prelude.Maybe DirectoryEdition)
createMicrosoftAD_edition :: (Maybe DirectoryEdition -> f (Maybe DirectoryEdition))
-> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_edition = (CreateMicrosoftAD -> Maybe DirectoryEdition)
-> (CreateMicrosoftAD
    -> Maybe DirectoryEdition -> CreateMicrosoftAD)
-> Lens
     CreateMicrosoftAD
     CreateMicrosoftAD
     (Maybe DirectoryEdition)
     (Maybe DirectoryEdition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {Maybe DirectoryEdition
edition :: Maybe DirectoryEdition
$sel:edition:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe DirectoryEdition
edition} -> Maybe DirectoryEdition
edition) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} Maybe DirectoryEdition
a -> CreateMicrosoftAD
s {$sel:edition:CreateMicrosoftAD' :: Maybe DirectoryEdition
edition = Maybe DirectoryEdition
a} :: CreateMicrosoftAD)

-- | The NetBIOS name for your domain, such as @CORP@. If you don\'t specify
-- a NetBIOS name, it will default to the first part of your directory DNS.
-- For example, @CORP@ for the directory DNS @corp.example.com@.
createMicrosoftAD_shortName :: Lens.Lens' CreateMicrosoftAD (Prelude.Maybe Prelude.Text)
createMicrosoftAD_shortName :: (Maybe Text -> f (Maybe Text))
-> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_shortName = (CreateMicrosoftAD -> Maybe Text)
-> (CreateMicrosoftAD -> Maybe Text -> CreateMicrosoftAD)
-> Lens
     CreateMicrosoftAD CreateMicrosoftAD (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {Maybe Text
shortName :: Maybe Text
$sel:shortName:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe Text
shortName} -> Maybe Text
shortName) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} Maybe Text
a -> CreateMicrosoftAD
s {$sel:shortName:CreateMicrosoftAD' :: Maybe Text
shortName = Maybe Text
a} :: CreateMicrosoftAD)

-- | A description for the directory. This label will appear on the Amazon
-- Web Services console @Directory Details@ page after the directory is
-- created.
createMicrosoftAD_description :: Lens.Lens' CreateMicrosoftAD (Prelude.Maybe Prelude.Text)
createMicrosoftAD_description :: (Maybe Text -> f (Maybe Text))
-> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_description = (CreateMicrosoftAD -> Maybe Text)
-> (CreateMicrosoftAD -> Maybe Text -> CreateMicrosoftAD)
-> Lens
     CreateMicrosoftAD CreateMicrosoftAD (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {Maybe Text
description :: Maybe Text
$sel:description:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} Maybe Text
a -> CreateMicrosoftAD
s {$sel:description:CreateMicrosoftAD' :: Maybe Text
description = Maybe Text
a} :: CreateMicrosoftAD)

-- | The tags to be assigned to the Managed Microsoft AD directory.
createMicrosoftAD_tags :: Lens.Lens' CreateMicrosoftAD (Prelude.Maybe [Tag])
createMicrosoftAD_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_tags = (CreateMicrosoftAD -> Maybe [Tag])
-> (CreateMicrosoftAD -> Maybe [Tag] -> CreateMicrosoftAD)
-> Lens
     CreateMicrosoftAD CreateMicrosoftAD (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} Maybe [Tag]
a -> CreateMicrosoftAD
s {$sel:tags:CreateMicrosoftAD' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateMicrosoftAD) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateMicrosoftAD -> f CreateMicrosoftAD)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateMicrosoftAD
-> f CreateMicrosoftAD
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 fully qualified domain name for the Managed Microsoft AD directory,
-- such as @corp.example.com@. This name will resolve inside your VPC only.
-- It does not need to be publicly resolvable.
createMicrosoftAD_name :: Lens.Lens' CreateMicrosoftAD Prelude.Text
createMicrosoftAD_name :: (Text -> f Text) -> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_name = (CreateMicrosoftAD -> Text)
-> (CreateMicrosoftAD -> Text -> CreateMicrosoftAD)
-> Lens CreateMicrosoftAD CreateMicrosoftAD Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {Text
name :: Text
$sel:name:CreateMicrosoftAD' :: CreateMicrosoftAD -> Text
name} -> Text
name) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} Text
a -> CreateMicrosoftAD
s {$sel:name:CreateMicrosoftAD' :: Text
name = Text
a} :: CreateMicrosoftAD)

-- | The password for the default administrative user named @Admin@.
--
-- If you need to change the password for the administrator account, you
-- can use the ResetUserPassword API call.
createMicrosoftAD_password :: Lens.Lens' CreateMicrosoftAD Prelude.Text
createMicrosoftAD_password :: (Text -> f Text) -> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_password = (CreateMicrosoftAD -> Sensitive Text)
-> (CreateMicrosoftAD -> Sensitive Text -> CreateMicrosoftAD)
-> Lens
     CreateMicrosoftAD
     CreateMicrosoftAD
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {Sensitive Text
password :: Sensitive Text
$sel:password:CreateMicrosoftAD' :: CreateMicrosoftAD -> Sensitive Text
password} -> Sensitive Text
password) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} Sensitive Text
a -> CreateMicrosoftAD
s {$sel:password:CreateMicrosoftAD' :: Sensitive Text
password = Sensitive Text
a} :: CreateMicrosoftAD) ((Sensitive Text -> f (Sensitive Text))
 -> CreateMicrosoftAD -> f CreateMicrosoftAD)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateMicrosoftAD
-> f CreateMicrosoftAD
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Contains VPC information for the CreateDirectory or CreateMicrosoftAD
-- operation.
createMicrosoftAD_vpcSettings :: Lens.Lens' CreateMicrosoftAD DirectoryVpcSettings
createMicrosoftAD_vpcSettings :: (DirectoryVpcSettings -> f DirectoryVpcSettings)
-> CreateMicrosoftAD -> f CreateMicrosoftAD
createMicrosoftAD_vpcSettings = (CreateMicrosoftAD -> DirectoryVpcSettings)
-> (CreateMicrosoftAD -> DirectoryVpcSettings -> CreateMicrosoftAD)
-> Lens
     CreateMicrosoftAD
     CreateMicrosoftAD
     DirectoryVpcSettings
     DirectoryVpcSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftAD' {DirectoryVpcSettings
vpcSettings :: DirectoryVpcSettings
$sel:vpcSettings:CreateMicrosoftAD' :: CreateMicrosoftAD -> DirectoryVpcSettings
vpcSettings} -> DirectoryVpcSettings
vpcSettings) (\s :: CreateMicrosoftAD
s@CreateMicrosoftAD' {} DirectoryVpcSettings
a -> CreateMicrosoftAD
s {$sel:vpcSettings:CreateMicrosoftAD' :: DirectoryVpcSettings
vpcSettings = DirectoryVpcSettings
a} :: CreateMicrosoftAD)

instance Core.AWSRequest CreateMicrosoftAD where
  type
    AWSResponse CreateMicrosoftAD =
      CreateMicrosoftADResponse
  request :: CreateMicrosoftAD -> Request CreateMicrosoftAD
request = Service -> CreateMicrosoftAD -> Request CreateMicrosoftAD
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateMicrosoftAD
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateMicrosoftAD)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateMicrosoftAD))
-> Logger
-> Service
-> Proxy CreateMicrosoftAD
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateMicrosoftAD)))
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 Text -> Int -> CreateMicrosoftADResponse
CreateMicrosoftADResponse'
            (Maybe Text -> Int -> CreateMicrosoftADResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateMicrosoftADResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DirectoryId")
            Either String (Int -> CreateMicrosoftADResponse)
-> Either String Int -> Either String CreateMicrosoftADResponse
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 CreateMicrosoftAD

instance Prelude.NFData CreateMicrosoftAD

instance Core.ToHeaders CreateMicrosoftAD where
  toHeaders :: CreateMicrosoftAD -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateMicrosoftAD -> 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
"DirectoryService_20150416.CreateMicrosoftAD" ::
                          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 CreateMicrosoftAD where
  toJSON :: CreateMicrosoftAD -> Value
toJSON CreateMicrosoftAD' {Maybe [Tag]
Maybe Text
Maybe DirectoryEdition
Text
Sensitive Text
DirectoryVpcSettings
vpcSettings :: DirectoryVpcSettings
password :: Sensitive Text
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
shortName :: Maybe Text
edition :: Maybe DirectoryEdition
$sel:vpcSettings:CreateMicrosoftAD' :: CreateMicrosoftAD -> DirectoryVpcSettings
$sel:password:CreateMicrosoftAD' :: CreateMicrosoftAD -> Sensitive Text
$sel:name:CreateMicrosoftAD' :: CreateMicrosoftAD -> Text
$sel:tags:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe [Tag]
$sel:description:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe Text
$sel:shortName:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe Text
$sel:edition:CreateMicrosoftAD' :: CreateMicrosoftAD -> Maybe DirectoryEdition
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Edition" Text -> DirectoryEdition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DirectoryEdition -> Pair) -> Maybe DirectoryEdition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DirectoryEdition
edition,
            (Text
"ShortName" 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
shortName,
            (Text
"Description" 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
description,
            (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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VpcSettings" Text -> DirectoryVpcSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DirectoryVpcSettings
vpcSettings)
          ]
      )

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

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

-- | Result of a CreateMicrosoftAD request.
--
-- /See:/ 'newCreateMicrosoftADResponse' smart constructor.
data CreateMicrosoftADResponse = CreateMicrosoftADResponse'
  { -- | The identifier of the directory that was created.
    CreateMicrosoftADResponse -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateMicrosoftADResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool
(CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool)
-> (CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool)
-> Eq CreateMicrosoftADResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool
$c/= :: CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool
== :: CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool
$c== :: CreateMicrosoftADResponse -> CreateMicrosoftADResponse -> Bool
Prelude.Eq, ReadPrec [CreateMicrosoftADResponse]
ReadPrec CreateMicrosoftADResponse
Int -> ReadS CreateMicrosoftADResponse
ReadS [CreateMicrosoftADResponse]
(Int -> ReadS CreateMicrosoftADResponse)
-> ReadS [CreateMicrosoftADResponse]
-> ReadPrec CreateMicrosoftADResponse
-> ReadPrec [CreateMicrosoftADResponse]
-> Read CreateMicrosoftADResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMicrosoftADResponse]
$creadListPrec :: ReadPrec [CreateMicrosoftADResponse]
readPrec :: ReadPrec CreateMicrosoftADResponse
$creadPrec :: ReadPrec CreateMicrosoftADResponse
readList :: ReadS [CreateMicrosoftADResponse]
$creadList :: ReadS [CreateMicrosoftADResponse]
readsPrec :: Int -> ReadS CreateMicrosoftADResponse
$creadsPrec :: Int -> ReadS CreateMicrosoftADResponse
Prelude.Read, Int -> CreateMicrosoftADResponse -> ShowS
[CreateMicrosoftADResponse] -> ShowS
CreateMicrosoftADResponse -> String
(Int -> CreateMicrosoftADResponse -> ShowS)
-> (CreateMicrosoftADResponse -> String)
-> ([CreateMicrosoftADResponse] -> ShowS)
-> Show CreateMicrosoftADResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMicrosoftADResponse] -> ShowS
$cshowList :: [CreateMicrosoftADResponse] -> ShowS
show :: CreateMicrosoftADResponse -> String
$cshow :: CreateMicrosoftADResponse -> String
showsPrec :: Int -> CreateMicrosoftADResponse -> ShowS
$cshowsPrec :: Int -> CreateMicrosoftADResponse -> ShowS
Prelude.Show, (forall x.
 CreateMicrosoftADResponse -> Rep CreateMicrosoftADResponse x)
-> (forall x.
    Rep CreateMicrosoftADResponse x -> CreateMicrosoftADResponse)
-> Generic CreateMicrosoftADResponse
forall x.
Rep CreateMicrosoftADResponse x -> CreateMicrosoftADResponse
forall x.
CreateMicrosoftADResponse -> Rep CreateMicrosoftADResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMicrosoftADResponse x -> CreateMicrosoftADResponse
$cfrom :: forall x.
CreateMicrosoftADResponse -> Rep CreateMicrosoftADResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateMicrosoftADResponse' 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:
--
-- 'directoryId', 'createMicrosoftADResponse_directoryId' - The identifier of the directory that was created.
--
-- 'httpStatus', 'createMicrosoftADResponse_httpStatus' - The response's http status code.
newCreateMicrosoftADResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateMicrosoftADResponse
newCreateMicrosoftADResponse :: Int -> CreateMicrosoftADResponse
newCreateMicrosoftADResponse Int
pHttpStatus_ =
  CreateMicrosoftADResponse' :: Maybe Text -> Int -> CreateMicrosoftADResponse
CreateMicrosoftADResponse'
    { $sel:directoryId:CreateMicrosoftADResponse' :: Maybe Text
directoryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateMicrosoftADResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the directory that was created.
createMicrosoftADResponse_directoryId :: Lens.Lens' CreateMicrosoftADResponse (Prelude.Maybe Prelude.Text)
createMicrosoftADResponse_directoryId :: (Maybe Text -> f (Maybe Text))
-> CreateMicrosoftADResponse -> f CreateMicrosoftADResponse
createMicrosoftADResponse_directoryId = (CreateMicrosoftADResponse -> Maybe Text)
-> (CreateMicrosoftADResponse
    -> Maybe Text -> CreateMicrosoftADResponse)
-> Lens
     CreateMicrosoftADResponse
     CreateMicrosoftADResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMicrosoftADResponse' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:CreateMicrosoftADResponse' :: CreateMicrosoftADResponse -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: CreateMicrosoftADResponse
s@CreateMicrosoftADResponse' {} Maybe Text
a -> CreateMicrosoftADResponse
s {$sel:directoryId:CreateMicrosoftADResponse' :: Maybe Text
directoryId = Maybe Text
a} :: CreateMicrosoftADResponse)

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

instance Prelude.NFData CreateMicrosoftADResponse