{-# 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.OpenSearch.DescribeDomainConfig
-- 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 domain,
-- such as the state, creation date, update version, and update date for
-- cluster options.
module Amazonka.OpenSearch.DescribeDomainConfig
  ( -- * Creating a Request
    DescribeDomainConfig (..),
    newDescribeDomainConfig,

    -- * Request Lenses
    describeDomainConfig_domainName,

    -- * Destructuring the Response
    DescribeDomainConfigResponse (..),
    newDescribeDomainConfigResponse,

    -- * Response Lenses
    describeDomainConfigResponse_httpStatus,
    describeDomainConfigResponse_domainConfig,
  )
where

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

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

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

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

instance Core.AWSRequest DescribeDomainConfig where
  type
    AWSResponse DescribeDomainConfig =
      DescribeDomainConfigResponse
  request :: DescribeDomainConfig -> Request DescribeDomainConfig
request = Service -> DescribeDomainConfig -> Request DescribeDomainConfig
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDomainConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDomainConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDomainConfig))
-> Logger
-> Service
-> Proxy DescribeDomainConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDomainConfig)))
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 -> DomainConfig -> DescribeDomainConfigResponse
DescribeDomainConfigResponse'
            (Int -> DomainConfig -> DescribeDomainConfigResponse)
-> Either String Int
-> Either String (DomainConfig -> DescribeDomainConfigResponse)
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 (DomainConfig -> DescribeDomainConfigResponse)
-> Either String DomainConfig
-> Either String DescribeDomainConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DomainConfig
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"DomainConfig")
      )

instance Prelude.Hashable DescribeDomainConfig

instance Prelude.NFData DescribeDomainConfig

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

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

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

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

-- |
-- Create a value of 'DescribeDomainConfigResponse' 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', 'describeDomainConfigResponse_httpStatus' - The response's http status code.
--
-- 'domainConfig', 'describeDomainConfigResponse_domainConfig' - The configuration information of the domain requested in the
-- @DescribeDomainConfig@ request.
newDescribeDomainConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'domainConfig'
  DomainConfig ->
  DescribeDomainConfigResponse
newDescribeDomainConfigResponse :: Int -> DomainConfig -> DescribeDomainConfigResponse
newDescribeDomainConfigResponse
  Int
pHttpStatus_
  DomainConfig
pDomainConfig_ =
    DescribeDomainConfigResponse' :: Int -> DomainConfig -> DescribeDomainConfigResponse
DescribeDomainConfigResponse'
      { $sel:httpStatus:DescribeDomainConfigResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:domainConfig:DescribeDomainConfigResponse' :: DomainConfig
domainConfig = DomainConfig
pDomainConfig_
      }

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

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

instance Prelude.NFData DescribeDomainConfigResponse