{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.NamespaceProperties
-- 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)
module Amazonka.Route53AutoNaming.Types.NamespaceProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53AutoNaming.Types.DnsProperties
import Amazonka.Route53AutoNaming.Types.HttpProperties

-- | A complex type that contains information that\'s specific to the
-- namespace type.
--
-- /See:/ 'newNamespaceProperties' smart constructor.
data NamespaceProperties = NamespaceProperties'
  { -- | A complex type that contains the ID for the Route 53 hosted zone that
    -- Cloud Map creates when you create a namespace.
    NamespaceProperties -> Maybe DnsProperties
dnsProperties :: Prelude.Maybe DnsProperties,
    -- | A complex type that contains the name of an HTTP namespace.
    NamespaceProperties -> Maybe HttpProperties
httpProperties :: Prelude.Maybe HttpProperties
  }
  deriving (NamespaceProperties -> NamespaceProperties -> Bool
(NamespaceProperties -> NamespaceProperties -> Bool)
-> (NamespaceProperties -> NamespaceProperties -> Bool)
-> Eq NamespaceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NamespaceProperties -> NamespaceProperties -> Bool
$c/= :: NamespaceProperties -> NamespaceProperties -> Bool
== :: NamespaceProperties -> NamespaceProperties -> Bool
$c== :: NamespaceProperties -> NamespaceProperties -> Bool
Prelude.Eq, ReadPrec [NamespaceProperties]
ReadPrec NamespaceProperties
Int -> ReadS NamespaceProperties
ReadS [NamespaceProperties]
(Int -> ReadS NamespaceProperties)
-> ReadS [NamespaceProperties]
-> ReadPrec NamespaceProperties
-> ReadPrec [NamespaceProperties]
-> Read NamespaceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NamespaceProperties]
$creadListPrec :: ReadPrec [NamespaceProperties]
readPrec :: ReadPrec NamespaceProperties
$creadPrec :: ReadPrec NamespaceProperties
readList :: ReadS [NamespaceProperties]
$creadList :: ReadS [NamespaceProperties]
readsPrec :: Int -> ReadS NamespaceProperties
$creadsPrec :: Int -> ReadS NamespaceProperties
Prelude.Read, Int -> NamespaceProperties -> ShowS
[NamespaceProperties] -> ShowS
NamespaceProperties -> String
(Int -> NamespaceProperties -> ShowS)
-> (NamespaceProperties -> String)
-> ([NamespaceProperties] -> ShowS)
-> Show NamespaceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NamespaceProperties] -> ShowS
$cshowList :: [NamespaceProperties] -> ShowS
show :: NamespaceProperties -> String
$cshow :: NamespaceProperties -> String
showsPrec :: Int -> NamespaceProperties -> ShowS
$cshowsPrec :: Int -> NamespaceProperties -> ShowS
Prelude.Show, (forall x. NamespaceProperties -> Rep NamespaceProperties x)
-> (forall x. Rep NamespaceProperties x -> NamespaceProperties)
-> Generic NamespaceProperties
forall x. Rep NamespaceProperties x -> NamespaceProperties
forall x. NamespaceProperties -> Rep NamespaceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NamespaceProperties x -> NamespaceProperties
$cfrom :: forall x. NamespaceProperties -> Rep NamespaceProperties x
Prelude.Generic)

-- |
-- Create a value of 'NamespaceProperties' 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:
--
-- 'dnsProperties', 'namespaceProperties_dnsProperties' - A complex type that contains the ID for the Route 53 hosted zone that
-- Cloud Map creates when you create a namespace.
--
-- 'httpProperties', 'namespaceProperties_httpProperties' - A complex type that contains the name of an HTTP namespace.
newNamespaceProperties ::
  NamespaceProperties
newNamespaceProperties :: NamespaceProperties
newNamespaceProperties =
  NamespaceProperties' :: Maybe DnsProperties -> Maybe HttpProperties -> NamespaceProperties
NamespaceProperties'
    { $sel:dnsProperties:NamespaceProperties' :: Maybe DnsProperties
dnsProperties =
        Maybe DnsProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:httpProperties:NamespaceProperties' :: Maybe HttpProperties
httpProperties = Maybe HttpProperties
forall a. Maybe a
Prelude.Nothing
    }

-- | A complex type that contains the ID for the Route 53 hosted zone that
-- Cloud Map creates when you create a namespace.
namespaceProperties_dnsProperties :: Lens.Lens' NamespaceProperties (Prelude.Maybe DnsProperties)
namespaceProperties_dnsProperties :: (Maybe DnsProperties -> f (Maybe DnsProperties))
-> NamespaceProperties -> f NamespaceProperties
namespaceProperties_dnsProperties = (NamespaceProperties -> Maybe DnsProperties)
-> (NamespaceProperties
    -> Maybe DnsProperties -> NamespaceProperties)
-> Lens
     NamespaceProperties
     NamespaceProperties
     (Maybe DnsProperties)
     (Maybe DnsProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceProperties' {Maybe DnsProperties
dnsProperties :: Maybe DnsProperties
$sel:dnsProperties:NamespaceProperties' :: NamespaceProperties -> Maybe DnsProperties
dnsProperties} -> Maybe DnsProperties
dnsProperties) (\s :: NamespaceProperties
s@NamespaceProperties' {} Maybe DnsProperties
a -> NamespaceProperties
s {$sel:dnsProperties:NamespaceProperties' :: Maybe DnsProperties
dnsProperties = Maybe DnsProperties
a} :: NamespaceProperties)

-- | A complex type that contains the name of an HTTP namespace.
namespaceProperties_httpProperties :: Lens.Lens' NamespaceProperties (Prelude.Maybe HttpProperties)
namespaceProperties_httpProperties :: (Maybe HttpProperties -> f (Maybe HttpProperties))
-> NamespaceProperties -> f NamespaceProperties
namespaceProperties_httpProperties = (NamespaceProperties -> Maybe HttpProperties)
-> (NamespaceProperties
    -> Maybe HttpProperties -> NamespaceProperties)
-> Lens
     NamespaceProperties
     NamespaceProperties
     (Maybe HttpProperties)
     (Maybe HttpProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceProperties' {Maybe HttpProperties
httpProperties :: Maybe HttpProperties
$sel:httpProperties:NamespaceProperties' :: NamespaceProperties -> Maybe HttpProperties
httpProperties} -> Maybe HttpProperties
httpProperties) (\s :: NamespaceProperties
s@NamespaceProperties' {} Maybe HttpProperties
a -> NamespaceProperties
s {$sel:httpProperties:NamespaceProperties' :: Maybe HttpProperties
httpProperties = Maybe HttpProperties
a} :: NamespaceProperties)

instance Core.FromJSON NamespaceProperties where
  parseJSON :: Value -> Parser NamespaceProperties
parseJSON =
    String
-> (Object -> Parser NamespaceProperties)
-> Value
-> Parser NamespaceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NamespaceProperties"
      ( \Object
x ->
          Maybe DnsProperties -> Maybe HttpProperties -> NamespaceProperties
NamespaceProperties'
            (Maybe DnsProperties
 -> Maybe HttpProperties -> NamespaceProperties)
-> Parser (Maybe DnsProperties)
-> Parser (Maybe HttpProperties -> NamespaceProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DnsProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DnsProperties")
            Parser (Maybe HttpProperties -> NamespaceProperties)
-> Parser (Maybe HttpProperties) -> Parser NamespaceProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HttpProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HttpProperties")
      )

instance Prelude.Hashable NamespaceProperties

instance Prelude.NFData NamespaceProperties