{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticSearch.Types.DomainInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.EngineType
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
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]
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
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. 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'
    { $sel:domainName:DomainInfo' :: Maybe Text
domainName = forall a. Maybe a
Prelude.Nothing,
      $sel:engineType:DomainInfo' :: Maybe EngineType
engineType = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the @DomainName@.
domainInfo_domainName :: Lens.Lens' DomainInfo (Prelude.Maybe Prelude.Text)
domainInfo_domainName :: Lens' DomainInfo (Maybe Text)
domainInfo_domainName = 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 :: Lens' DomainInfo (Maybe EngineType)
domainInfo_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 Data.FromJSON DomainInfo where
  parseJSON :: Value -> Parser DomainInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DomainInfo"
      ( \Object
x ->
          Maybe Text -> Maybe EngineType -> DomainInfo
DomainInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DomainName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EngineType")
      )

instance Prelude.Hashable DomainInfo where
  hashWithSalt :: Int -> DomainInfo -> Int
hashWithSalt Int
_salt DomainInfo' {Maybe Text
Maybe EngineType
engineType :: Maybe EngineType
domainName :: Maybe Text
$sel:engineType:DomainInfo' :: DomainInfo -> Maybe EngineType
$sel:domainName:DomainInfo' :: DomainInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EngineType
engineType

instance Prelude.NFData DomainInfo where
  rnf :: DomainInfo -> ()
rnf DomainInfo' {Maybe Text
Maybe EngineType
engineType :: Maybe EngineType
domainName :: Maybe Text
$sel:engineType:DomainInfo' :: DomainInfo -> Maybe EngineType
$sel:domainName:DomainInfo' :: DomainInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EngineType
engineType