{-# 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.NamespaceSummary
-- 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.NamespaceSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53AutoNaming.Types.NamespaceProperties
import Amazonka.Route53AutoNaming.Types.NamespaceType

-- | A complex type that contains information about a namespace.
--
-- /See:/ 'newNamespaceSummary' smart constructor.
data NamespaceSummary = NamespaceSummary'
  { -- | The Amazon Resource Name (ARN) that Cloud Map assigns to the namespace
    -- when you create it.
    NamespaceSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the namespace was created.
    NamespaceSummary -> Maybe POSIX
createDate :: Prelude.Maybe Core.POSIX,
    -- | The number of services that were created using the namespace.
    NamespaceSummary -> Maybe Int
serviceCount :: Prelude.Maybe Prelude.Int,
    -- | The name of the namespace. When you create a namespace, Cloud Map
    -- automatically creates a Route 53 hosted zone that has the same name as
    -- the namespace.
    NamespaceSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the namespace.
    NamespaceSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The type of the namespace, either public or private.
    NamespaceSummary -> Maybe NamespaceType
type' :: Prelude.Maybe NamespaceType,
    -- | A description for the namespace.
    NamespaceSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The properties of the namespace.
    NamespaceSummary -> Maybe NamespaceProperties
properties :: Prelude.Maybe NamespaceProperties
  }
  deriving (NamespaceSummary -> NamespaceSummary -> Bool
(NamespaceSummary -> NamespaceSummary -> Bool)
-> (NamespaceSummary -> NamespaceSummary -> Bool)
-> Eq NamespaceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NamespaceSummary -> NamespaceSummary -> Bool
$c/= :: NamespaceSummary -> NamespaceSummary -> Bool
== :: NamespaceSummary -> NamespaceSummary -> Bool
$c== :: NamespaceSummary -> NamespaceSummary -> Bool
Prelude.Eq, ReadPrec [NamespaceSummary]
ReadPrec NamespaceSummary
Int -> ReadS NamespaceSummary
ReadS [NamespaceSummary]
(Int -> ReadS NamespaceSummary)
-> ReadS [NamespaceSummary]
-> ReadPrec NamespaceSummary
-> ReadPrec [NamespaceSummary]
-> Read NamespaceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NamespaceSummary]
$creadListPrec :: ReadPrec [NamespaceSummary]
readPrec :: ReadPrec NamespaceSummary
$creadPrec :: ReadPrec NamespaceSummary
readList :: ReadS [NamespaceSummary]
$creadList :: ReadS [NamespaceSummary]
readsPrec :: Int -> ReadS NamespaceSummary
$creadsPrec :: Int -> ReadS NamespaceSummary
Prelude.Read, Int -> NamespaceSummary -> ShowS
[NamespaceSummary] -> ShowS
NamespaceSummary -> String
(Int -> NamespaceSummary -> ShowS)
-> (NamespaceSummary -> String)
-> ([NamespaceSummary] -> ShowS)
-> Show NamespaceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NamespaceSummary] -> ShowS
$cshowList :: [NamespaceSummary] -> ShowS
show :: NamespaceSummary -> String
$cshow :: NamespaceSummary -> String
showsPrec :: Int -> NamespaceSummary -> ShowS
$cshowsPrec :: Int -> NamespaceSummary -> ShowS
Prelude.Show, (forall x. NamespaceSummary -> Rep NamespaceSummary x)
-> (forall x. Rep NamespaceSummary x -> NamespaceSummary)
-> Generic NamespaceSummary
forall x. Rep NamespaceSummary x -> NamespaceSummary
forall x. NamespaceSummary -> Rep NamespaceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NamespaceSummary x -> NamespaceSummary
$cfrom :: forall x. NamespaceSummary -> Rep NamespaceSummary x
Prelude.Generic)

-- |
-- Create a value of 'NamespaceSummary' 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:
--
-- 'arn', 'namespaceSummary_arn' - The Amazon Resource Name (ARN) that Cloud Map assigns to the namespace
-- when you create it.
--
-- 'createDate', 'namespaceSummary_createDate' - The date and time that the namespace was created.
--
-- 'serviceCount', 'namespaceSummary_serviceCount' - The number of services that were created using the namespace.
--
-- 'name', 'namespaceSummary_name' - The name of the namespace. When you create a namespace, Cloud Map
-- automatically creates a Route 53 hosted zone that has the same name as
-- the namespace.
--
-- 'id', 'namespaceSummary_id' - The ID of the namespace.
--
-- 'type'', 'namespaceSummary_type' - The type of the namespace, either public or private.
--
-- 'description', 'namespaceSummary_description' - A description for the namespace.
--
-- 'properties', 'namespaceSummary_properties' - The properties of the namespace.
newNamespaceSummary ::
  NamespaceSummary
newNamespaceSummary :: NamespaceSummary
newNamespaceSummary =
  NamespaceSummary' :: Maybe Text
-> Maybe POSIX
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe NamespaceType
-> Maybe Text
-> Maybe NamespaceProperties
-> NamespaceSummary
NamespaceSummary'
    { $sel:arn:NamespaceSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createDate:NamespaceSummary' :: Maybe POSIX
createDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceCount:NamespaceSummary' :: Maybe Int
serviceCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:NamespaceSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:NamespaceSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':NamespaceSummary' :: Maybe NamespaceType
type' = Maybe NamespaceType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:NamespaceSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:properties:NamespaceSummary' :: Maybe NamespaceProperties
properties = Maybe NamespaceProperties
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) that Cloud Map assigns to the namespace
-- when you create it.
namespaceSummary_arn :: Lens.Lens' NamespaceSummary (Prelude.Maybe Prelude.Text)
namespaceSummary_arn :: (Maybe Text -> f (Maybe Text))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_arn = (NamespaceSummary -> Maybe Text)
-> (NamespaceSummary -> Maybe Text -> NamespaceSummary)
-> Lens NamespaceSummary NamespaceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:NamespaceSummary' :: NamespaceSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe Text
a -> NamespaceSummary
s {$sel:arn:NamespaceSummary' :: Maybe Text
arn = Maybe Text
a} :: NamespaceSummary)

-- | The date and time that the namespace was created.
namespaceSummary_createDate :: Lens.Lens' NamespaceSummary (Prelude.Maybe Prelude.UTCTime)
namespaceSummary_createDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_createDate = (NamespaceSummary -> Maybe POSIX)
-> (NamespaceSummary -> Maybe POSIX -> NamespaceSummary)
-> Lens
     NamespaceSummary NamespaceSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe POSIX
createDate :: Maybe POSIX
$sel:createDate:NamespaceSummary' :: NamespaceSummary -> Maybe POSIX
createDate} -> Maybe POSIX
createDate) (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe POSIX
a -> NamespaceSummary
s {$sel:createDate:NamespaceSummary' :: Maybe POSIX
createDate = Maybe POSIX
a} :: NamespaceSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> NamespaceSummary -> f NamespaceSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> NamespaceSummary
-> f NamespaceSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of services that were created using the namespace.
namespaceSummary_serviceCount :: Lens.Lens' NamespaceSummary (Prelude.Maybe Prelude.Int)
namespaceSummary_serviceCount :: (Maybe Int -> f (Maybe Int))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_serviceCount = (NamespaceSummary -> Maybe Int)
-> (NamespaceSummary -> Maybe Int -> NamespaceSummary)
-> Lens NamespaceSummary NamespaceSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe Int
serviceCount :: Maybe Int
$sel:serviceCount:NamespaceSummary' :: NamespaceSummary -> Maybe Int
serviceCount} -> Maybe Int
serviceCount) (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe Int
a -> NamespaceSummary
s {$sel:serviceCount:NamespaceSummary' :: Maybe Int
serviceCount = Maybe Int
a} :: NamespaceSummary)

-- | The name of the namespace. When you create a namespace, Cloud Map
-- automatically creates a Route 53 hosted zone that has the same name as
-- the namespace.
namespaceSummary_name :: Lens.Lens' NamespaceSummary (Prelude.Maybe Prelude.Text)
namespaceSummary_name :: (Maybe Text -> f (Maybe Text))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_name = (NamespaceSummary -> Maybe Text)
-> (NamespaceSummary -> Maybe Text -> NamespaceSummary)
-> Lens NamespaceSummary NamespaceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe Text
name :: Maybe Text
$sel:name:NamespaceSummary' :: NamespaceSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe Text
a -> NamespaceSummary
s {$sel:name:NamespaceSummary' :: Maybe Text
name = Maybe Text
a} :: NamespaceSummary)

-- | The ID of the namespace.
namespaceSummary_id :: Lens.Lens' NamespaceSummary (Prelude.Maybe Prelude.Text)
namespaceSummary_id :: (Maybe Text -> f (Maybe Text))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_id = (NamespaceSummary -> Maybe Text)
-> (NamespaceSummary -> Maybe Text -> NamespaceSummary)
-> Lens NamespaceSummary NamespaceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe Text
id :: Maybe Text
$sel:id:NamespaceSummary' :: NamespaceSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe Text
a -> NamespaceSummary
s {$sel:id:NamespaceSummary' :: Maybe Text
id = Maybe Text
a} :: NamespaceSummary)

-- | The type of the namespace, either public or private.
namespaceSummary_type :: Lens.Lens' NamespaceSummary (Prelude.Maybe NamespaceType)
namespaceSummary_type :: (Maybe NamespaceType -> f (Maybe NamespaceType))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_type = (NamespaceSummary -> Maybe NamespaceType)
-> (NamespaceSummary -> Maybe NamespaceType -> NamespaceSummary)
-> Lens
     NamespaceSummary
     NamespaceSummary
     (Maybe NamespaceType)
     (Maybe NamespaceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe NamespaceType
type' :: Maybe NamespaceType
$sel:type':NamespaceSummary' :: NamespaceSummary -> Maybe NamespaceType
type'} -> Maybe NamespaceType
type') (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe NamespaceType
a -> NamespaceSummary
s {$sel:type':NamespaceSummary' :: Maybe NamespaceType
type' = Maybe NamespaceType
a} :: NamespaceSummary)

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

-- | The properties of the namespace.
namespaceSummary_properties :: Lens.Lens' NamespaceSummary (Prelude.Maybe NamespaceProperties)
namespaceSummary_properties :: (Maybe NamespaceProperties -> f (Maybe NamespaceProperties))
-> NamespaceSummary -> f NamespaceSummary
namespaceSummary_properties = (NamespaceSummary -> Maybe NamespaceProperties)
-> (NamespaceSummary
    -> Maybe NamespaceProperties -> NamespaceSummary)
-> Lens
     NamespaceSummary
     NamespaceSummary
     (Maybe NamespaceProperties)
     (Maybe NamespaceProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamespaceSummary' {Maybe NamespaceProperties
properties :: Maybe NamespaceProperties
$sel:properties:NamespaceSummary' :: NamespaceSummary -> Maybe NamespaceProperties
properties} -> Maybe NamespaceProperties
properties) (\s :: NamespaceSummary
s@NamespaceSummary' {} Maybe NamespaceProperties
a -> NamespaceSummary
s {$sel:properties:NamespaceSummary' :: Maybe NamespaceProperties
properties = Maybe NamespaceProperties
a} :: NamespaceSummary)

instance Core.FromJSON NamespaceSummary where
  parseJSON :: Value -> Parser NamespaceSummary
parseJSON =
    String
-> (Object -> Parser NamespaceSummary)
-> Value
-> Parser NamespaceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NamespaceSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe NamespaceType
-> Maybe Text
-> Maybe NamespaceProperties
-> NamespaceSummary
NamespaceSummary'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe NamespaceType
 -> Maybe Text
 -> Maybe NamespaceProperties
 -> NamespaceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe NamespaceType
      -> Maybe Text
      -> Maybe NamespaceProperties
      -> NamespaceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arn")
            Parser
  (Maybe POSIX
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe NamespaceType
   -> Maybe Text
   -> Maybe NamespaceProperties
   -> NamespaceSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe NamespaceType
      -> Maybe Text
      -> Maybe NamespaceProperties
      -> NamespaceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateDate")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe NamespaceType
   -> Maybe Text
   -> Maybe NamespaceProperties
   -> NamespaceSummary)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe NamespaceType
      -> Maybe Text
      -> Maybe NamespaceProperties
      -> NamespaceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ServiceCount")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe NamespaceType
   -> Maybe Text
   -> Maybe NamespaceProperties
   -> NamespaceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe NamespaceType
      -> Maybe Text
      -> Maybe NamespaceProperties
      -> NamespaceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser
  (Maybe Text
   -> Maybe NamespaceType
   -> Maybe Text
   -> Maybe NamespaceProperties
   -> NamespaceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe NamespaceType
      -> Maybe Text -> Maybe NamespaceProperties -> NamespaceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser
  (Maybe NamespaceType
   -> Maybe Text -> Maybe NamespaceProperties -> NamespaceSummary)
-> Parser (Maybe NamespaceType)
-> Parser
     (Maybe Text -> Maybe NamespaceProperties -> NamespaceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NamespaceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser
  (Maybe Text -> Maybe NamespaceProperties -> NamespaceSummary)
-> Parser (Maybe Text)
-> Parser (Maybe NamespaceProperties -> NamespaceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
            Parser (Maybe NamespaceProperties -> NamespaceSummary)
-> Parser (Maybe NamespaceProperties) -> Parser NamespaceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NamespaceProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Properties")
      )

instance Prelude.Hashable NamespaceSummary

instance Prelude.NFData NamespaceSummary