{-# 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.Route53AutoNaming.CreatePrivateDnsNamespace
-- 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 private namespace based on DNS, which is visible only inside a
-- specified Amazon VPC. The namespace defines your service naming scheme.
-- For example, if you name your namespace @example.com@ and name your
-- service @backend@, the resulting DNS name for the service is
-- @backend.example.com@. Service instances that are registered using a
-- private DNS namespace can be discovered using either a
-- @DiscoverInstances@ request or using DNS. For the current quota on the
-- number of namespaces that you can create using the same account, see
-- <https://docs.aws.amazon.com/cloud-map/latest/dg/cloud-map-limits.html Cloud Map quotas>
-- in the /Cloud Map Developer Guide/.
module Amazonka.Route53AutoNaming.CreatePrivateDnsNamespace
  ( -- * Creating a Request
    CreatePrivateDnsNamespace (..),
    newCreatePrivateDnsNamespace,

    -- * Request Lenses
    createPrivateDnsNamespace_creatorRequestId,
    createPrivateDnsNamespace_description,
    createPrivateDnsNamespace_tags,
    createPrivateDnsNamespace_properties,
    createPrivateDnsNamespace_name,
    createPrivateDnsNamespace_vpc,

    -- * Destructuring the Response
    CreatePrivateDnsNamespaceResponse (..),
    newCreatePrivateDnsNamespaceResponse,

    -- * Response Lenses
    createPrivateDnsNamespaceResponse_operationId,
    createPrivateDnsNamespaceResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreatePrivateDnsNamespace' smart constructor.
data CreatePrivateDnsNamespace = CreatePrivateDnsNamespace'
  { -- | A unique string that identifies the request and that allows failed
    -- @CreatePrivateDnsNamespace@ requests to be retried without the risk of
    -- running the operation twice. @CreatorRequestId@ can be any unique string
    -- (for example, a date\/timestamp).
    CreatePrivateDnsNamespace -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
    -- | A description for the namespace.
    CreatePrivateDnsNamespace -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags to add to the namespace. Each tag consists of a key and an
    -- optional value that you define. Tags keys can be up to 128 characters in
    -- length, and tag values can be up to 256 characters in length.
    CreatePrivateDnsNamespace -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Properties for the private DNS namespace.
    CreatePrivateDnsNamespace -> Maybe PrivateDnsNamespaceProperties
properties :: Prelude.Maybe PrivateDnsNamespaceProperties,
    -- | The name that you want to assign to this namespace. When you create a
    -- private DNS namespace, Cloud Map automatically creates an Amazon Route
    -- 53 private hosted zone that has the same name as the namespace.
    CreatePrivateDnsNamespace -> Text
name :: Prelude.Text,
    -- | The ID of the Amazon VPC that you want to associate the namespace with.
    CreatePrivateDnsNamespace -> Text
vpc :: Prelude.Text
  }
  deriving (CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool
(CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool)
-> (CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool)
-> Eq CreatePrivateDnsNamespace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool
$c/= :: CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool
== :: CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool
$c== :: CreatePrivateDnsNamespace -> CreatePrivateDnsNamespace -> Bool
Prelude.Eq, ReadPrec [CreatePrivateDnsNamespace]
ReadPrec CreatePrivateDnsNamespace
Int -> ReadS CreatePrivateDnsNamespace
ReadS [CreatePrivateDnsNamespace]
(Int -> ReadS CreatePrivateDnsNamespace)
-> ReadS [CreatePrivateDnsNamespace]
-> ReadPrec CreatePrivateDnsNamespace
-> ReadPrec [CreatePrivateDnsNamespace]
-> Read CreatePrivateDnsNamespace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePrivateDnsNamespace]
$creadListPrec :: ReadPrec [CreatePrivateDnsNamespace]
readPrec :: ReadPrec CreatePrivateDnsNamespace
$creadPrec :: ReadPrec CreatePrivateDnsNamespace
readList :: ReadS [CreatePrivateDnsNamespace]
$creadList :: ReadS [CreatePrivateDnsNamespace]
readsPrec :: Int -> ReadS CreatePrivateDnsNamespace
$creadsPrec :: Int -> ReadS CreatePrivateDnsNamespace
Prelude.Read, Int -> CreatePrivateDnsNamespace -> ShowS
[CreatePrivateDnsNamespace] -> ShowS
CreatePrivateDnsNamespace -> String
(Int -> CreatePrivateDnsNamespace -> ShowS)
-> (CreatePrivateDnsNamespace -> String)
-> ([CreatePrivateDnsNamespace] -> ShowS)
-> Show CreatePrivateDnsNamespace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePrivateDnsNamespace] -> ShowS
$cshowList :: [CreatePrivateDnsNamespace] -> ShowS
show :: CreatePrivateDnsNamespace -> String
$cshow :: CreatePrivateDnsNamespace -> String
showsPrec :: Int -> CreatePrivateDnsNamespace -> ShowS
$cshowsPrec :: Int -> CreatePrivateDnsNamespace -> ShowS
Prelude.Show, (forall x.
 CreatePrivateDnsNamespace -> Rep CreatePrivateDnsNamespace x)
-> (forall x.
    Rep CreatePrivateDnsNamespace x -> CreatePrivateDnsNamespace)
-> Generic CreatePrivateDnsNamespace
forall x.
Rep CreatePrivateDnsNamespace x -> CreatePrivateDnsNamespace
forall x.
CreatePrivateDnsNamespace -> Rep CreatePrivateDnsNamespace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePrivateDnsNamespace x -> CreatePrivateDnsNamespace
$cfrom :: forall x.
CreatePrivateDnsNamespace -> Rep CreatePrivateDnsNamespace x
Prelude.Generic)

-- |
-- Create a value of 'CreatePrivateDnsNamespace' 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:
--
-- 'creatorRequestId', 'createPrivateDnsNamespace_creatorRequestId' - A unique string that identifies the request and that allows failed
-- @CreatePrivateDnsNamespace@ requests to be retried without the risk of
-- running the operation twice. @CreatorRequestId@ can be any unique string
-- (for example, a date\/timestamp).
--
-- 'description', 'createPrivateDnsNamespace_description' - A description for the namespace.
--
-- 'tags', 'createPrivateDnsNamespace_tags' - The tags to add to the namespace. Each tag consists of a key and an
-- optional value that you define. Tags keys can be up to 128 characters in
-- length, and tag values can be up to 256 characters in length.
--
-- 'properties', 'createPrivateDnsNamespace_properties' - Properties for the private DNS namespace.
--
-- 'name', 'createPrivateDnsNamespace_name' - The name that you want to assign to this namespace. When you create a
-- private DNS namespace, Cloud Map automatically creates an Amazon Route
-- 53 private hosted zone that has the same name as the namespace.
--
-- 'vpc', 'createPrivateDnsNamespace_vpc' - The ID of the Amazon VPC that you want to associate the namespace with.
newCreatePrivateDnsNamespace ::
  -- | 'name'
  Prelude.Text ->
  -- | 'vpc'
  Prelude.Text ->
  CreatePrivateDnsNamespace
newCreatePrivateDnsNamespace :: Text -> Text -> CreatePrivateDnsNamespace
newCreatePrivateDnsNamespace Text
pName_ Text
pVpc_ =
  CreatePrivateDnsNamespace' :: Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Maybe PrivateDnsNamespaceProperties
-> Text
-> Text
-> CreatePrivateDnsNamespace
CreatePrivateDnsNamespace'
    { $sel:creatorRequestId:CreatePrivateDnsNamespace' :: Maybe Text
creatorRequestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreatePrivateDnsNamespace' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreatePrivateDnsNamespace' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:properties:CreatePrivateDnsNamespace' :: Maybe PrivateDnsNamespaceProperties
properties = Maybe PrivateDnsNamespaceProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreatePrivateDnsNamespace' :: Text
name = Text
pName_,
      $sel:vpc:CreatePrivateDnsNamespace' :: Text
vpc = Text
pVpc_
    }

-- | A unique string that identifies the request and that allows failed
-- @CreatePrivateDnsNamespace@ requests to be retried without the risk of
-- running the operation twice. @CreatorRequestId@ can be any unique string
-- (for example, a date\/timestamp).
createPrivateDnsNamespace_creatorRequestId :: Lens.Lens' CreatePrivateDnsNamespace (Prelude.Maybe Prelude.Text)
createPrivateDnsNamespace_creatorRequestId :: (Maybe Text -> f (Maybe Text))
-> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace
createPrivateDnsNamespace_creatorRequestId = (CreatePrivateDnsNamespace -> Maybe Text)
-> (CreatePrivateDnsNamespace
    -> Maybe Text -> CreatePrivateDnsNamespace)
-> Lens
     CreatePrivateDnsNamespace
     CreatePrivateDnsNamespace
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespace' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: CreatePrivateDnsNamespace
s@CreatePrivateDnsNamespace' {} Maybe Text
a -> CreatePrivateDnsNamespace
s {$sel:creatorRequestId:CreatePrivateDnsNamespace' :: Maybe Text
creatorRequestId = Maybe Text
a} :: CreatePrivateDnsNamespace)

-- | A description for the namespace.
createPrivateDnsNamespace_description :: Lens.Lens' CreatePrivateDnsNamespace (Prelude.Maybe Prelude.Text)
createPrivateDnsNamespace_description :: (Maybe Text -> f (Maybe Text))
-> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace
createPrivateDnsNamespace_description = (CreatePrivateDnsNamespace -> Maybe Text)
-> (CreatePrivateDnsNamespace
    -> Maybe Text -> CreatePrivateDnsNamespace)
-> Lens
     CreatePrivateDnsNamespace
     CreatePrivateDnsNamespace
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespace' {Maybe Text
description :: Maybe Text
$sel:description:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe Text
description} -> Maybe Text
description) (\s :: CreatePrivateDnsNamespace
s@CreatePrivateDnsNamespace' {} Maybe Text
a -> CreatePrivateDnsNamespace
s {$sel:description:CreatePrivateDnsNamespace' :: Maybe Text
description = Maybe Text
a} :: CreatePrivateDnsNamespace)

-- | The tags to add to the namespace. Each tag consists of a key and an
-- optional value that you define. Tags keys can be up to 128 characters in
-- length, and tag values can be up to 256 characters in length.
createPrivateDnsNamespace_tags :: Lens.Lens' CreatePrivateDnsNamespace (Prelude.Maybe [Tag])
createPrivateDnsNamespace_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace
createPrivateDnsNamespace_tags = (CreatePrivateDnsNamespace -> Maybe [Tag])
-> (CreatePrivateDnsNamespace
    -> Maybe [Tag] -> CreatePrivateDnsNamespace)
-> Lens
     CreatePrivateDnsNamespace
     CreatePrivateDnsNamespace
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespace' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreatePrivateDnsNamespace
s@CreatePrivateDnsNamespace' {} Maybe [Tag]
a -> CreatePrivateDnsNamespace
s {$sel:tags:CreatePrivateDnsNamespace' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreatePrivateDnsNamespace) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePrivateDnsNamespace
-> f CreatePrivateDnsNamespace
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

-- | Properties for the private DNS namespace.
createPrivateDnsNamespace_properties :: Lens.Lens' CreatePrivateDnsNamespace (Prelude.Maybe PrivateDnsNamespaceProperties)
createPrivateDnsNamespace_properties :: (Maybe PrivateDnsNamespaceProperties
 -> f (Maybe PrivateDnsNamespaceProperties))
-> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace
createPrivateDnsNamespace_properties = (CreatePrivateDnsNamespace -> Maybe PrivateDnsNamespaceProperties)
-> (CreatePrivateDnsNamespace
    -> Maybe PrivateDnsNamespaceProperties
    -> CreatePrivateDnsNamespace)
-> Lens
     CreatePrivateDnsNamespace
     CreatePrivateDnsNamespace
     (Maybe PrivateDnsNamespaceProperties)
     (Maybe PrivateDnsNamespaceProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespace' {Maybe PrivateDnsNamespaceProperties
properties :: Maybe PrivateDnsNamespaceProperties
$sel:properties:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe PrivateDnsNamespaceProperties
properties} -> Maybe PrivateDnsNamespaceProperties
properties) (\s :: CreatePrivateDnsNamespace
s@CreatePrivateDnsNamespace' {} Maybe PrivateDnsNamespaceProperties
a -> CreatePrivateDnsNamespace
s {$sel:properties:CreatePrivateDnsNamespace' :: Maybe PrivateDnsNamespaceProperties
properties = Maybe PrivateDnsNamespaceProperties
a} :: CreatePrivateDnsNamespace)

-- | The name that you want to assign to this namespace. When you create a
-- private DNS namespace, Cloud Map automatically creates an Amazon Route
-- 53 private hosted zone that has the same name as the namespace.
createPrivateDnsNamespace_name :: Lens.Lens' CreatePrivateDnsNamespace Prelude.Text
createPrivateDnsNamespace_name :: (Text -> f Text)
-> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace
createPrivateDnsNamespace_name = (CreatePrivateDnsNamespace -> Text)
-> (CreatePrivateDnsNamespace -> Text -> CreatePrivateDnsNamespace)
-> Lens
     CreatePrivateDnsNamespace CreatePrivateDnsNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespace' {Text
name :: Text
$sel:name:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Text
name} -> Text
name) (\s :: CreatePrivateDnsNamespace
s@CreatePrivateDnsNamespace' {} Text
a -> CreatePrivateDnsNamespace
s {$sel:name:CreatePrivateDnsNamespace' :: Text
name = Text
a} :: CreatePrivateDnsNamespace)

-- | The ID of the Amazon VPC that you want to associate the namespace with.
createPrivateDnsNamespace_vpc :: Lens.Lens' CreatePrivateDnsNamespace Prelude.Text
createPrivateDnsNamespace_vpc :: (Text -> f Text)
-> CreatePrivateDnsNamespace -> f CreatePrivateDnsNamespace
createPrivateDnsNamespace_vpc = (CreatePrivateDnsNamespace -> Text)
-> (CreatePrivateDnsNamespace -> Text -> CreatePrivateDnsNamespace)
-> Lens
     CreatePrivateDnsNamespace CreatePrivateDnsNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespace' {Text
vpc :: Text
$sel:vpc:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Text
vpc} -> Text
vpc) (\s :: CreatePrivateDnsNamespace
s@CreatePrivateDnsNamespace' {} Text
a -> CreatePrivateDnsNamespace
s {$sel:vpc:CreatePrivateDnsNamespace' :: Text
vpc = Text
a} :: CreatePrivateDnsNamespace)

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

instance Prelude.NFData CreatePrivateDnsNamespace

instance Core.ToHeaders CreatePrivateDnsNamespace where
  toHeaders :: CreatePrivateDnsNamespace -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreatePrivateDnsNamespace -> 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
"Route53AutoNaming_v20170314.CreatePrivateDnsNamespace" ::
                          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 CreatePrivateDnsNamespace where
  toJSON :: CreatePrivateDnsNamespace -> Value
toJSON CreatePrivateDnsNamespace' {Maybe [Tag]
Maybe Text
Maybe PrivateDnsNamespaceProperties
Text
vpc :: Text
name :: Text
properties :: Maybe PrivateDnsNamespaceProperties
tags :: Maybe [Tag]
description :: Maybe Text
creatorRequestId :: Maybe Text
$sel:vpc:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Text
$sel:name:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Text
$sel:properties:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe PrivateDnsNamespaceProperties
$sel:tags:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe [Tag]
$sel:description:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe Text
$sel:creatorRequestId:CreatePrivateDnsNamespace' :: CreatePrivateDnsNamespace -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CreatorRequestId" 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
creatorRequestId,
            (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,
            (Text
"Properties" Text -> PrivateDnsNamespaceProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PrivateDnsNamespaceProperties -> Pair)
-> Maybe PrivateDnsNamespaceProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PrivateDnsNamespaceProperties
properties,
            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
"Vpc" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpc)
          ]
      )

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

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

-- | /See:/ 'newCreatePrivateDnsNamespaceResponse' smart constructor.
data CreatePrivateDnsNamespaceResponse = CreatePrivateDnsNamespaceResponse'
  { -- | A value that you can use to determine whether the request completed
    -- successfully. To get the status of the operation, see
    -- <https://docs.aws.amazon.com/cloud-map/latest/api/API_GetOperation.html GetOperation>.
    CreatePrivateDnsNamespaceResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreatePrivateDnsNamespaceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreatePrivateDnsNamespaceResponse
-> CreatePrivateDnsNamespaceResponse -> Bool
(CreatePrivateDnsNamespaceResponse
 -> CreatePrivateDnsNamespaceResponse -> Bool)
-> (CreatePrivateDnsNamespaceResponse
    -> CreatePrivateDnsNamespaceResponse -> Bool)
-> Eq CreatePrivateDnsNamespaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePrivateDnsNamespaceResponse
-> CreatePrivateDnsNamespaceResponse -> Bool
$c/= :: CreatePrivateDnsNamespaceResponse
-> CreatePrivateDnsNamespaceResponse -> Bool
== :: CreatePrivateDnsNamespaceResponse
-> CreatePrivateDnsNamespaceResponse -> Bool
$c== :: CreatePrivateDnsNamespaceResponse
-> CreatePrivateDnsNamespaceResponse -> Bool
Prelude.Eq, ReadPrec [CreatePrivateDnsNamespaceResponse]
ReadPrec CreatePrivateDnsNamespaceResponse
Int -> ReadS CreatePrivateDnsNamespaceResponse
ReadS [CreatePrivateDnsNamespaceResponse]
(Int -> ReadS CreatePrivateDnsNamespaceResponse)
-> ReadS [CreatePrivateDnsNamespaceResponse]
-> ReadPrec CreatePrivateDnsNamespaceResponse
-> ReadPrec [CreatePrivateDnsNamespaceResponse]
-> Read CreatePrivateDnsNamespaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePrivateDnsNamespaceResponse]
$creadListPrec :: ReadPrec [CreatePrivateDnsNamespaceResponse]
readPrec :: ReadPrec CreatePrivateDnsNamespaceResponse
$creadPrec :: ReadPrec CreatePrivateDnsNamespaceResponse
readList :: ReadS [CreatePrivateDnsNamespaceResponse]
$creadList :: ReadS [CreatePrivateDnsNamespaceResponse]
readsPrec :: Int -> ReadS CreatePrivateDnsNamespaceResponse
$creadsPrec :: Int -> ReadS CreatePrivateDnsNamespaceResponse
Prelude.Read, Int -> CreatePrivateDnsNamespaceResponse -> ShowS
[CreatePrivateDnsNamespaceResponse] -> ShowS
CreatePrivateDnsNamespaceResponse -> String
(Int -> CreatePrivateDnsNamespaceResponse -> ShowS)
-> (CreatePrivateDnsNamespaceResponse -> String)
-> ([CreatePrivateDnsNamespaceResponse] -> ShowS)
-> Show CreatePrivateDnsNamespaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePrivateDnsNamespaceResponse] -> ShowS
$cshowList :: [CreatePrivateDnsNamespaceResponse] -> ShowS
show :: CreatePrivateDnsNamespaceResponse -> String
$cshow :: CreatePrivateDnsNamespaceResponse -> String
showsPrec :: Int -> CreatePrivateDnsNamespaceResponse -> ShowS
$cshowsPrec :: Int -> CreatePrivateDnsNamespaceResponse -> ShowS
Prelude.Show, (forall x.
 CreatePrivateDnsNamespaceResponse
 -> Rep CreatePrivateDnsNamespaceResponse x)
-> (forall x.
    Rep CreatePrivateDnsNamespaceResponse x
    -> CreatePrivateDnsNamespaceResponse)
-> Generic CreatePrivateDnsNamespaceResponse
forall x.
Rep CreatePrivateDnsNamespaceResponse x
-> CreatePrivateDnsNamespaceResponse
forall x.
CreatePrivateDnsNamespaceResponse
-> Rep CreatePrivateDnsNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePrivateDnsNamespaceResponse x
-> CreatePrivateDnsNamespaceResponse
$cfrom :: forall x.
CreatePrivateDnsNamespaceResponse
-> Rep CreatePrivateDnsNamespaceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePrivateDnsNamespaceResponse' 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:
--
-- 'operationId', 'createPrivateDnsNamespaceResponse_operationId' - A value that you can use to determine whether the request completed
-- successfully. To get the status of the operation, see
-- <https://docs.aws.amazon.com/cloud-map/latest/api/API_GetOperation.html GetOperation>.
--
-- 'httpStatus', 'createPrivateDnsNamespaceResponse_httpStatus' - The response's http status code.
newCreatePrivateDnsNamespaceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreatePrivateDnsNamespaceResponse
newCreatePrivateDnsNamespaceResponse :: Int -> CreatePrivateDnsNamespaceResponse
newCreatePrivateDnsNamespaceResponse Int
pHttpStatus_ =
  CreatePrivateDnsNamespaceResponse' :: Maybe Text -> Int -> CreatePrivateDnsNamespaceResponse
CreatePrivateDnsNamespaceResponse'
    { $sel:operationId:CreatePrivateDnsNamespaceResponse' :: Maybe Text
operationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreatePrivateDnsNamespaceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A value that you can use to determine whether the request completed
-- successfully. To get the status of the operation, see
-- <https://docs.aws.amazon.com/cloud-map/latest/api/API_GetOperation.html GetOperation>.
createPrivateDnsNamespaceResponse_operationId :: Lens.Lens' CreatePrivateDnsNamespaceResponse (Prelude.Maybe Prelude.Text)
createPrivateDnsNamespaceResponse_operationId :: (Maybe Text -> f (Maybe Text))
-> CreatePrivateDnsNamespaceResponse
-> f CreatePrivateDnsNamespaceResponse
createPrivateDnsNamespaceResponse_operationId = (CreatePrivateDnsNamespaceResponse -> Maybe Text)
-> (CreatePrivateDnsNamespaceResponse
    -> Maybe Text -> CreatePrivateDnsNamespaceResponse)
-> Lens
     CreatePrivateDnsNamespaceResponse
     CreatePrivateDnsNamespaceResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateDnsNamespaceResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:CreatePrivateDnsNamespaceResponse' :: CreatePrivateDnsNamespaceResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: CreatePrivateDnsNamespaceResponse
s@CreatePrivateDnsNamespaceResponse' {} Maybe Text
a -> CreatePrivateDnsNamespaceResponse
s {$sel:operationId:CreatePrivateDnsNamespaceResponse' :: Maybe Text
operationId = Maybe Text
a} :: CreatePrivateDnsNamespaceResponse)

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

instance
  Prelude.NFData
    CreatePrivateDnsNamespaceResponse