{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeElasticsearchDomainConfig
-- 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)
--
-- Provides cluster configuration information about the specified
-- Elasticsearch domain, such as the state, creation date, update version,
-- and update date for cluster options.
module Amazonka.ElasticSearch.DescribeElasticsearchDomainConfig
  ( -- * Creating a Request
    DescribeElasticsearchDomainConfig (..),
    newDescribeElasticsearchDomainConfig,

    -- * Request Lenses
    describeElasticsearchDomainConfig_domainName,

    -- * Destructuring the Response
    DescribeElasticsearchDomainConfigResponse (..),
    newDescribeElasticsearchDomainConfigResponse,

    -- * Response Lenses
    describeElasticsearchDomainConfigResponse_httpStatus,
    describeElasticsearchDomainConfigResponse_domainConfig,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Container for the parameters to the @DescribeElasticsearchDomainConfig@
-- operation. Specifies the domain name for which you want configuration
-- information.
--
-- /See:/ 'newDescribeElasticsearchDomainConfig' smart constructor.
data DescribeElasticsearchDomainConfig = DescribeElasticsearchDomainConfig'
  { -- | The Elasticsearch domain that you want to get information about.
    DescribeElasticsearchDomainConfig -> Text
domainName :: Prelude.Text
  }
  deriving (DescribeElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfig -> Bool
(DescribeElasticsearchDomainConfig
 -> DescribeElasticsearchDomainConfig -> Bool)
-> (DescribeElasticsearchDomainConfig
    -> DescribeElasticsearchDomainConfig -> Bool)
-> Eq DescribeElasticsearchDomainConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfig -> Bool
$c/= :: DescribeElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfig -> Bool
== :: DescribeElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfig -> Bool
$c== :: DescribeElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfig -> Bool
Prelude.Eq, ReadPrec [DescribeElasticsearchDomainConfig]
ReadPrec DescribeElasticsearchDomainConfig
Int -> ReadS DescribeElasticsearchDomainConfig
ReadS [DescribeElasticsearchDomainConfig]
(Int -> ReadS DescribeElasticsearchDomainConfig)
-> ReadS [DescribeElasticsearchDomainConfig]
-> ReadPrec DescribeElasticsearchDomainConfig
-> ReadPrec [DescribeElasticsearchDomainConfig]
-> Read DescribeElasticsearchDomainConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeElasticsearchDomainConfig]
$creadListPrec :: ReadPrec [DescribeElasticsearchDomainConfig]
readPrec :: ReadPrec DescribeElasticsearchDomainConfig
$creadPrec :: ReadPrec DescribeElasticsearchDomainConfig
readList :: ReadS [DescribeElasticsearchDomainConfig]
$creadList :: ReadS [DescribeElasticsearchDomainConfig]
readsPrec :: Int -> ReadS DescribeElasticsearchDomainConfig
$creadsPrec :: Int -> ReadS DescribeElasticsearchDomainConfig
Prelude.Read, Int -> DescribeElasticsearchDomainConfig -> ShowS
[DescribeElasticsearchDomainConfig] -> ShowS
DescribeElasticsearchDomainConfig -> String
(Int -> DescribeElasticsearchDomainConfig -> ShowS)
-> (DescribeElasticsearchDomainConfig -> String)
-> ([DescribeElasticsearchDomainConfig] -> ShowS)
-> Show DescribeElasticsearchDomainConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeElasticsearchDomainConfig] -> ShowS
$cshowList :: [DescribeElasticsearchDomainConfig] -> ShowS
show :: DescribeElasticsearchDomainConfig -> String
$cshow :: DescribeElasticsearchDomainConfig -> String
showsPrec :: Int -> DescribeElasticsearchDomainConfig -> ShowS
$cshowsPrec :: Int -> DescribeElasticsearchDomainConfig -> ShowS
Prelude.Show, (forall x.
 DescribeElasticsearchDomainConfig
 -> Rep DescribeElasticsearchDomainConfig x)
-> (forall x.
    Rep DescribeElasticsearchDomainConfig x
    -> DescribeElasticsearchDomainConfig)
-> Generic DescribeElasticsearchDomainConfig
forall x.
Rep DescribeElasticsearchDomainConfig x
-> DescribeElasticsearchDomainConfig
forall x.
DescribeElasticsearchDomainConfig
-> Rep DescribeElasticsearchDomainConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeElasticsearchDomainConfig x
-> DescribeElasticsearchDomainConfig
$cfrom :: forall x.
DescribeElasticsearchDomainConfig
-> Rep DescribeElasticsearchDomainConfig x
Prelude.Generic)

-- |
-- Create a value of 'DescribeElasticsearchDomainConfig' 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', 'describeElasticsearchDomainConfig_domainName' - The Elasticsearch domain that you want to get information about.
newDescribeElasticsearchDomainConfig ::
  -- | 'domainName'
  Prelude.Text ->
  DescribeElasticsearchDomainConfig
newDescribeElasticsearchDomainConfig :: Text -> DescribeElasticsearchDomainConfig
newDescribeElasticsearchDomainConfig Text
pDomainName_ =
  DescribeElasticsearchDomainConfig' :: Text -> DescribeElasticsearchDomainConfig
DescribeElasticsearchDomainConfig'
    { $sel:domainName:DescribeElasticsearchDomainConfig' :: Text
domainName =
        Text
pDomainName_
    }

-- | The Elasticsearch domain that you want to get information about.
describeElasticsearchDomainConfig_domainName :: Lens.Lens' DescribeElasticsearchDomainConfig Prelude.Text
describeElasticsearchDomainConfig_domainName :: (Text -> f Text)
-> DescribeElasticsearchDomainConfig
-> f DescribeElasticsearchDomainConfig
describeElasticsearchDomainConfig_domainName = (DescribeElasticsearchDomainConfig -> Text)
-> (DescribeElasticsearchDomainConfig
    -> Text -> DescribeElasticsearchDomainConfig)
-> Lens
     DescribeElasticsearchDomainConfig
     DescribeElasticsearchDomainConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticsearchDomainConfig' {Text
domainName :: Text
$sel:domainName:DescribeElasticsearchDomainConfig' :: DescribeElasticsearchDomainConfig -> Text
domainName} -> Text
domainName) (\s :: DescribeElasticsearchDomainConfig
s@DescribeElasticsearchDomainConfig' {} Text
a -> DescribeElasticsearchDomainConfig
s {$sel:domainName:DescribeElasticsearchDomainConfig' :: Text
domainName = Text
a} :: DescribeElasticsearchDomainConfig)

instance
  Core.AWSRequest
    DescribeElasticsearchDomainConfig
  where
  type
    AWSResponse DescribeElasticsearchDomainConfig =
      DescribeElasticsearchDomainConfigResponse
  request :: DescribeElasticsearchDomainConfig
-> Request DescribeElasticsearchDomainConfig
request = Service
-> DescribeElasticsearchDomainConfig
-> Request DescribeElasticsearchDomainConfig
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeElasticsearchDomainConfig
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeElasticsearchDomainConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeElasticsearchDomainConfig))
-> Logger
-> Service
-> Proxy DescribeElasticsearchDomainConfig
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeElasticsearchDomainConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> ElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfigResponse
DescribeElasticsearchDomainConfigResponse'
            (Int
 -> ElasticsearchDomainConfig
 -> DescribeElasticsearchDomainConfigResponse)
-> Either String Int
-> Either
     String
     (ElasticsearchDomainConfig
      -> DescribeElasticsearchDomainConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
              Either
  String
  (ElasticsearchDomainConfig
   -> DescribeElasticsearchDomainConfigResponse)
-> Either String ElasticsearchDomainConfig
-> Either String DescribeElasticsearchDomainConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ElasticsearchDomainConfig
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"DomainConfig")
      )

instance
  Prelude.Hashable
    DescribeElasticsearchDomainConfig

instance
  Prelude.NFData
    DescribeElasticsearchDomainConfig

instance
  Core.ToHeaders
    DescribeElasticsearchDomainConfig
  where
  toHeaders :: DescribeElasticsearchDomainConfig -> ResponseHeaders
toHeaders = ResponseHeaders
-> DescribeElasticsearchDomainConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance
  Core.ToPath
    DescribeElasticsearchDomainConfig
  where
  toPath :: DescribeElasticsearchDomainConfig -> ByteString
toPath DescribeElasticsearchDomainConfig' {Text
domainName :: Text
$sel:domainName:DescribeElasticsearchDomainConfig' :: DescribeElasticsearchDomainConfig -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2015-01-01/es/domain/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName,
        ByteString
"/config"
      ]

instance
  Core.ToQuery
    DescribeElasticsearchDomainConfig
  where
  toQuery :: DescribeElasticsearchDomainConfig -> QueryString
toQuery = QueryString -> DescribeElasticsearchDomainConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | The result of a @DescribeElasticsearchDomainConfig@ request. Contains
-- the configuration information of the requested domain.
--
-- /See:/ 'newDescribeElasticsearchDomainConfigResponse' smart constructor.
data DescribeElasticsearchDomainConfigResponse = DescribeElasticsearchDomainConfigResponse'
  { -- | The response's http status code.
    DescribeElasticsearchDomainConfigResponse -> Int
httpStatus :: Prelude.Int,
    -- | The configuration information of the domain requested in the
    -- @DescribeElasticsearchDomainConfig@ request.
    DescribeElasticsearchDomainConfigResponse
-> ElasticsearchDomainConfig
domainConfig :: ElasticsearchDomainConfig
  }
  deriving (DescribeElasticsearchDomainConfigResponse
-> DescribeElasticsearchDomainConfigResponse -> Bool
(DescribeElasticsearchDomainConfigResponse
 -> DescribeElasticsearchDomainConfigResponse -> Bool)
-> (DescribeElasticsearchDomainConfigResponse
    -> DescribeElasticsearchDomainConfigResponse -> Bool)
-> Eq DescribeElasticsearchDomainConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeElasticsearchDomainConfigResponse
-> DescribeElasticsearchDomainConfigResponse -> Bool
$c/= :: DescribeElasticsearchDomainConfigResponse
-> DescribeElasticsearchDomainConfigResponse -> Bool
== :: DescribeElasticsearchDomainConfigResponse
-> DescribeElasticsearchDomainConfigResponse -> Bool
$c== :: DescribeElasticsearchDomainConfigResponse
-> DescribeElasticsearchDomainConfigResponse -> Bool
Prelude.Eq, ReadPrec [DescribeElasticsearchDomainConfigResponse]
ReadPrec DescribeElasticsearchDomainConfigResponse
Int -> ReadS DescribeElasticsearchDomainConfigResponse
ReadS [DescribeElasticsearchDomainConfigResponse]
(Int -> ReadS DescribeElasticsearchDomainConfigResponse)
-> ReadS [DescribeElasticsearchDomainConfigResponse]
-> ReadPrec DescribeElasticsearchDomainConfigResponse
-> ReadPrec [DescribeElasticsearchDomainConfigResponse]
-> Read DescribeElasticsearchDomainConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeElasticsearchDomainConfigResponse]
$creadListPrec :: ReadPrec [DescribeElasticsearchDomainConfigResponse]
readPrec :: ReadPrec DescribeElasticsearchDomainConfigResponse
$creadPrec :: ReadPrec DescribeElasticsearchDomainConfigResponse
readList :: ReadS [DescribeElasticsearchDomainConfigResponse]
$creadList :: ReadS [DescribeElasticsearchDomainConfigResponse]
readsPrec :: Int -> ReadS DescribeElasticsearchDomainConfigResponse
$creadsPrec :: Int -> ReadS DescribeElasticsearchDomainConfigResponse
Prelude.Read, Int -> DescribeElasticsearchDomainConfigResponse -> ShowS
[DescribeElasticsearchDomainConfigResponse] -> ShowS
DescribeElasticsearchDomainConfigResponse -> String
(Int -> DescribeElasticsearchDomainConfigResponse -> ShowS)
-> (DescribeElasticsearchDomainConfigResponse -> String)
-> ([DescribeElasticsearchDomainConfigResponse] -> ShowS)
-> Show DescribeElasticsearchDomainConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeElasticsearchDomainConfigResponse] -> ShowS
$cshowList :: [DescribeElasticsearchDomainConfigResponse] -> ShowS
show :: DescribeElasticsearchDomainConfigResponse -> String
$cshow :: DescribeElasticsearchDomainConfigResponse -> String
showsPrec :: Int -> DescribeElasticsearchDomainConfigResponse -> ShowS
$cshowsPrec :: Int -> DescribeElasticsearchDomainConfigResponse -> ShowS
Prelude.Show, (forall x.
 DescribeElasticsearchDomainConfigResponse
 -> Rep DescribeElasticsearchDomainConfigResponse x)
-> (forall x.
    Rep DescribeElasticsearchDomainConfigResponse x
    -> DescribeElasticsearchDomainConfigResponse)
-> Generic DescribeElasticsearchDomainConfigResponse
forall x.
Rep DescribeElasticsearchDomainConfigResponse x
-> DescribeElasticsearchDomainConfigResponse
forall x.
DescribeElasticsearchDomainConfigResponse
-> Rep DescribeElasticsearchDomainConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeElasticsearchDomainConfigResponse x
-> DescribeElasticsearchDomainConfigResponse
$cfrom :: forall x.
DescribeElasticsearchDomainConfigResponse
-> Rep DescribeElasticsearchDomainConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeElasticsearchDomainConfigResponse' 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:
--
-- 'httpStatus', 'describeElasticsearchDomainConfigResponse_httpStatus' - The response's http status code.
--
-- 'domainConfig', 'describeElasticsearchDomainConfigResponse_domainConfig' - The configuration information of the domain requested in the
-- @DescribeElasticsearchDomainConfig@ request.
newDescribeElasticsearchDomainConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'domainConfig'
  ElasticsearchDomainConfig ->
  DescribeElasticsearchDomainConfigResponse
newDescribeElasticsearchDomainConfigResponse :: Int
-> ElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfigResponse
newDescribeElasticsearchDomainConfigResponse
  Int
pHttpStatus_
  ElasticsearchDomainConfig
pDomainConfig_ =
    DescribeElasticsearchDomainConfigResponse' :: Int
-> ElasticsearchDomainConfig
-> DescribeElasticsearchDomainConfigResponse
DescribeElasticsearchDomainConfigResponse'
      { $sel:httpStatus:DescribeElasticsearchDomainConfigResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:domainConfig:DescribeElasticsearchDomainConfigResponse' :: ElasticsearchDomainConfig
domainConfig = ElasticsearchDomainConfig
pDomainConfig_
      }

-- | The response's http status code.
describeElasticsearchDomainConfigResponse_httpStatus :: Lens.Lens' DescribeElasticsearchDomainConfigResponse Prelude.Int
describeElasticsearchDomainConfigResponse_httpStatus :: (Int -> f Int)
-> DescribeElasticsearchDomainConfigResponse
-> f DescribeElasticsearchDomainConfigResponse
describeElasticsearchDomainConfigResponse_httpStatus = (DescribeElasticsearchDomainConfigResponse -> Int)
-> (DescribeElasticsearchDomainConfigResponse
    -> Int -> DescribeElasticsearchDomainConfigResponse)
-> Lens
     DescribeElasticsearchDomainConfigResponse
     DescribeElasticsearchDomainConfigResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticsearchDomainConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeElasticsearchDomainConfigResponse' :: DescribeElasticsearchDomainConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeElasticsearchDomainConfigResponse
s@DescribeElasticsearchDomainConfigResponse' {} Int
a -> DescribeElasticsearchDomainConfigResponse
s {$sel:httpStatus:DescribeElasticsearchDomainConfigResponse' :: Int
httpStatus = Int
a} :: DescribeElasticsearchDomainConfigResponse)

-- | The configuration information of the domain requested in the
-- @DescribeElasticsearchDomainConfig@ request.
describeElasticsearchDomainConfigResponse_domainConfig :: Lens.Lens' DescribeElasticsearchDomainConfigResponse ElasticsearchDomainConfig
describeElasticsearchDomainConfigResponse_domainConfig :: (ElasticsearchDomainConfig -> f ElasticsearchDomainConfig)
-> DescribeElasticsearchDomainConfigResponse
-> f DescribeElasticsearchDomainConfigResponse
describeElasticsearchDomainConfigResponse_domainConfig = (DescribeElasticsearchDomainConfigResponse
 -> ElasticsearchDomainConfig)
-> (DescribeElasticsearchDomainConfigResponse
    -> ElasticsearchDomainConfig
    -> DescribeElasticsearchDomainConfigResponse)
-> Lens
     DescribeElasticsearchDomainConfigResponse
     DescribeElasticsearchDomainConfigResponse
     ElasticsearchDomainConfig
     ElasticsearchDomainConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticsearchDomainConfigResponse' {ElasticsearchDomainConfig
domainConfig :: ElasticsearchDomainConfig
$sel:domainConfig:DescribeElasticsearchDomainConfigResponse' :: DescribeElasticsearchDomainConfigResponse
-> ElasticsearchDomainConfig
domainConfig} -> ElasticsearchDomainConfig
domainConfig) (\s :: DescribeElasticsearchDomainConfigResponse
s@DescribeElasticsearchDomainConfigResponse' {} ElasticsearchDomainConfig
a -> DescribeElasticsearchDomainConfigResponse
s {$sel:domainConfig:DescribeElasticsearchDomainConfigResponse' :: ElasticsearchDomainConfig
domainConfig = ElasticsearchDomainConfig
a} :: DescribeElasticsearchDomainConfigResponse)

instance
  Prelude.NFData
    DescribeElasticsearchDomainConfigResponse