{-# 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.QuickSight.Types.AmazonElasticsearchParameters
-- 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.QuickSight.Types.AmazonElasticsearchParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The parameters for OpenSearch.
--
-- /See:/ 'newAmazonElasticsearchParameters' smart constructor.
data AmazonElasticsearchParameters = AmazonElasticsearchParameters'
  { -- | The OpenSearch domain.
    AmazonElasticsearchParameters -> Text
domain :: Prelude.Text
  }
  deriving (AmazonElasticsearchParameters
-> AmazonElasticsearchParameters -> Bool
(AmazonElasticsearchParameters
 -> AmazonElasticsearchParameters -> Bool)
-> (AmazonElasticsearchParameters
    -> AmazonElasticsearchParameters -> Bool)
-> Eq AmazonElasticsearchParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AmazonElasticsearchParameters
-> AmazonElasticsearchParameters -> Bool
$c/= :: AmazonElasticsearchParameters
-> AmazonElasticsearchParameters -> Bool
== :: AmazonElasticsearchParameters
-> AmazonElasticsearchParameters -> Bool
$c== :: AmazonElasticsearchParameters
-> AmazonElasticsearchParameters -> Bool
Prelude.Eq, ReadPrec [AmazonElasticsearchParameters]
ReadPrec AmazonElasticsearchParameters
Int -> ReadS AmazonElasticsearchParameters
ReadS [AmazonElasticsearchParameters]
(Int -> ReadS AmazonElasticsearchParameters)
-> ReadS [AmazonElasticsearchParameters]
-> ReadPrec AmazonElasticsearchParameters
-> ReadPrec [AmazonElasticsearchParameters]
-> Read AmazonElasticsearchParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AmazonElasticsearchParameters]
$creadListPrec :: ReadPrec [AmazonElasticsearchParameters]
readPrec :: ReadPrec AmazonElasticsearchParameters
$creadPrec :: ReadPrec AmazonElasticsearchParameters
readList :: ReadS [AmazonElasticsearchParameters]
$creadList :: ReadS [AmazonElasticsearchParameters]
readsPrec :: Int -> ReadS AmazonElasticsearchParameters
$creadsPrec :: Int -> ReadS AmazonElasticsearchParameters
Prelude.Read, Int -> AmazonElasticsearchParameters -> ShowS
[AmazonElasticsearchParameters] -> ShowS
AmazonElasticsearchParameters -> String
(Int -> AmazonElasticsearchParameters -> ShowS)
-> (AmazonElasticsearchParameters -> String)
-> ([AmazonElasticsearchParameters] -> ShowS)
-> Show AmazonElasticsearchParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AmazonElasticsearchParameters] -> ShowS
$cshowList :: [AmazonElasticsearchParameters] -> ShowS
show :: AmazonElasticsearchParameters -> String
$cshow :: AmazonElasticsearchParameters -> String
showsPrec :: Int -> AmazonElasticsearchParameters -> ShowS
$cshowsPrec :: Int -> AmazonElasticsearchParameters -> ShowS
Prelude.Show, (forall x.
 AmazonElasticsearchParameters
 -> Rep AmazonElasticsearchParameters x)
-> (forall x.
    Rep AmazonElasticsearchParameters x
    -> AmazonElasticsearchParameters)
-> Generic AmazonElasticsearchParameters
forall x.
Rep AmazonElasticsearchParameters x
-> AmazonElasticsearchParameters
forall x.
AmazonElasticsearchParameters
-> Rep AmazonElasticsearchParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AmazonElasticsearchParameters x
-> AmazonElasticsearchParameters
$cfrom :: forall x.
AmazonElasticsearchParameters
-> Rep AmazonElasticsearchParameters x
Prelude.Generic)

-- |
-- Create a value of 'AmazonElasticsearchParameters' 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:
--
-- 'domain', 'amazonElasticsearchParameters_domain' - The OpenSearch domain.
newAmazonElasticsearchParameters ::
  -- | 'domain'
  Prelude.Text ->
  AmazonElasticsearchParameters
newAmazonElasticsearchParameters :: Text -> AmazonElasticsearchParameters
newAmazonElasticsearchParameters Text
pDomain_ =
  AmazonElasticsearchParameters' :: Text -> AmazonElasticsearchParameters
AmazonElasticsearchParameters' {$sel:domain:AmazonElasticsearchParameters' :: Text
domain = Text
pDomain_}

-- | The OpenSearch domain.
amazonElasticsearchParameters_domain :: Lens.Lens' AmazonElasticsearchParameters Prelude.Text
amazonElasticsearchParameters_domain :: (Text -> f Text)
-> AmazonElasticsearchParameters -> f AmazonElasticsearchParameters
amazonElasticsearchParameters_domain = (AmazonElasticsearchParameters -> Text)
-> (AmazonElasticsearchParameters
    -> Text -> AmazonElasticsearchParameters)
-> Lens
     AmazonElasticsearchParameters
     AmazonElasticsearchParameters
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AmazonElasticsearchParameters' {Text
domain :: Text
$sel:domain:AmazonElasticsearchParameters' :: AmazonElasticsearchParameters -> Text
domain} -> Text
domain) (\s :: AmazonElasticsearchParameters
s@AmazonElasticsearchParameters' {} Text
a -> AmazonElasticsearchParameters
s {$sel:domain:AmazonElasticsearchParameters' :: Text
domain = Text
a} :: AmazonElasticsearchParameters)

instance Core.FromJSON AmazonElasticsearchParameters where
  parseJSON :: Value -> Parser AmazonElasticsearchParameters
parseJSON =
    String
-> (Object -> Parser AmazonElasticsearchParameters)
-> Value
-> Parser AmazonElasticsearchParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AmazonElasticsearchParameters"
      ( \Object
x ->
          Text -> AmazonElasticsearchParameters
AmazonElasticsearchParameters'
            (Text -> AmazonElasticsearchParameters)
-> Parser Text -> Parser AmazonElasticsearchParameters
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Domain")
      )

instance
  Prelude.Hashable
    AmazonElasticsearchParameters

instance Prelude.NFData AmazonElasticsearchParameters

instance Core.ToJSON AmazonElasticsearchParameters where
  toJSON :: AmazonElasticsearchParameters -> Value
toJSON AmazonElasticsearchParameters' {Text
domain :: Text
$sel:domain:AmazonElasticsearchParameters' :: AmazonElasticsearchParameters -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain)]
      )