{-# 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.ElasticSearch.Types.DomainInfo
-- 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.ElasticSearch.Types.DomainInfo where

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types.EngineType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newDomainInfo' smart constructor.
data DomainInfo = DomainInfo'
  { -- | Specifies the @DomainName@.
    DomainInfo -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the @EngineType@ of the domain.
    DomainInfo -> Maybe EngineType
engineType :: Prelude.Maybe EngineType
  }
  deriving (DomainInfo -> DomainInfo -> Bool
(DomainInfo -> DomainInfo -> Bool)
-> (DomainInfo -> DomainInfo -> Bool) -> Eq DomainInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainInfo -> DomainInfo -> Bool
$c/= :: DomainInfo -> DomainInfo -> Bool
== :: DomainInfo -> DomainInfo -> Bool
$c== :: DomainInfo -> DomainInfo -> Bool
Prelude.Eq, ReadPrec [DomainInfo]
ReadPrec DomainInfo
Int -> ReadS DomainInfo
ReadS [DomainInfo]
(Int -> ReadS DomainInfo)
-> ReadS [DomainInfo]
-> ReadPrec DomainInfo
-> ReadPrec [DomainInfo]
-> Read DomainInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainInfo]
$creadListPrec :: ReadPrec [DomainInfo]
readPrec :: ReadPrec DomainInfo
$creadPrec :: ReadPrec DomainInfo
readList :: ReadS [DomainInfo]
$creadList :: ReadS [DomainInfo]
readsPrec :: Int -> ReadS DomainInfo
$creadsPrec :: Int -> ReadS DomainInfo
Prelude.Read, Int -> DomainInfo -> ShowS
[DomainInfo] -> ShowS
DomainInfo -> String
(Int -> DomainInfo -> ShowS)
-> (DomainInfo -> String)
-> ([DomainInfo] -> ShowS)
-> Show DomainInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainInfo] -> ShowS
$cshowList :: [DomainInfo] -> ShowS
show :: DomainInfo -> String
$cshow :: DomainInfo -> String
showsPrec :: Int -> DomainInfo -> ShowS
$cshowsPrec :: Int -> DomainInfo -> ShowS
Prelude.Show, (forall x. DomainInfo -> Rep DomainInfo x)
-> (forall x. Rep DomainInfo x -> DomainInfo) -> Generic DomainInfo
forall x. Rep DomainInfo x -> DomainInfo
forall x. DomainInfo -> Rep DomainInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainInfo x -> DomainInfo
$cfrom :: forall x. DomainInfo -> Rep DomainInfo x
Prelude.Generic)

-- |
-- Create a value of 'DomainInfo' 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:
--
-- 'domainName', 'domainInfo_domainName' - Specifies the @DomainName@.
--
-- 'engineType', 'domainInfo_engineType' - Specifies the @EngineType@ of the domain.
newDomainInfo ::
  DomainInfo
newDomainInfo :: DomainInfo
newDomainInfo =
  DomainInfo' :: Maybe Text -> Maybe EngineType -> DomainInfo
DomainInfo'
    { $sel:domainName:DomainInfo' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:engineType:DomainInfo' :: Maybe EngineType
engineType = Maybe EngineType
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the @DomainName@.
domainInfo_domainName :: Lens.Lens' DomainInfo (Prelude.Maybe Prelude.Text)
domainInfo_domainName :: (Maybe Text -> f (Maybe Text)) -> DomainInfo -> f DomainInfo
domainInfo_domainName = (DomainInfo -> Maybe Text)
-> (DomainInfo -> Maybe Text -> DomainInfo)
-> Lens DomainInfo DomainInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInfo' {Maybe Text
domainName :: Maybe Text
$sel:domainName:DomainInfo' :: DomainInfo -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: DomainInfo
s@DomainInfo' {} Maybe Text
a -> DomainInfo
s {$sel:domainName:DomainInfo' :: Maybe Text
domainName = Maybe Text
a} :: DomainInfo)

-- | Specifies the @EngineType@ of the domain.
domainInfo_engineType :: Lens.Lens' DomainInfo (Prelude.Maybe EngineType)
domainInfo_engineType :: (Maybe EngineType -> f (Maybe EngineType))
-> DomainInfo -> f DomainInfo
domainInfo_engineType = (DomainInfo -> Maybe EngineType)
-> (DomainInfo -> Maybe EngineType -> DomainInfo)
-> Lens DomainInfo DomainInfo (Maybe EngineType) (Maybe EngineType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInfo' {Maybe EngineType
engineType :: Maybe EngineType
$sel:engineType:DomainInfo' :: DomainInfo -> Maybe EngineType
engineType} -> Maybe EngineType
engineType) (\s :: DomainInfo
s@DomainInfo' {} Maybe EngineType
a -> DomainInfo
s {$sel:engineType:DomainInfo' :: Maybe EngineType
engineType = Maybe EngineType
a} :: DomainInfo)

instance Core.FromJSON DomainInfo where
  parseJSON :: Value -> Parser DomainInfo
parseJSON =
    String
-> (Object -> Parser DomainInfo) -> Value -> Parser DomainInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainInfo"
      ( \Object
x ->
          Maybe Text -> Maybe EngineType -> DomainInfo
DomainInfo'
            (Maybe Text -> Maybe EngineType -> DomainInfo)
-> Parser (Maybe Text) -> Parser (Maybe EngineType -> DomainInfo)
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
"DomainName")
            Parser (Maybe EngineType -> DomainInfo)
-> Parser (Maybe EngineType) -> Parser DomainInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EngineType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EngineType")
      )

instance Prelude.Hashable DomainInfo

instance Prelude.NFData DomainInfo