{-# 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 #-}
module Amazonka.OpenSearch.DescribeDomains
(
DescribeDomains (..),
newDescribeDomains,
describeDomains_domainNames,
DescribeDomainsResponse (..),
newDescribeDomainsResponse,
describeDomainsResponse_httpStatus,
describeDomainsResponse_domainStatusList,
)
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
data DescribeDomains = DescribeDomains'
{
DescribeDomains -> [Text]
domainNames :: [Prelude.Text]
}
deriving (DescribeDomains -> DescribeDomains -> Bool
(DescribeDomains -> DescribeDomains -> Bool)
-> (DescribeDomains -> DescribeDomains -> Bool)
-> Eq DescribeDomains
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDomains -> DescribeDomains -> Bool
$c/= :: DescribeDomains -> DescribeDomains -> Bool
== :: DescribeDomains -> DescribeDomains -> Bool
$c== :: DescribeDomains -> DescribeDomains -> Bool
Prelude.Eq, ReadPrec [DescribeDomains]
ReadPrec DescribeDomains
Int -> ReadS DescribeDomains
ReadS [DescribeDomains]
(Int -> ReadS DescribeDomains)
-> ReadS [DescribeDomains]
-> ReadPrec DescribeDomains
-> ReadPrec [DescribeDomains]
-> Read DescribeDomains
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDomains]
$creadListPrec :: ReadPrec [DescribeDomains]
readPrec :: ReadPrec DescribeDomains
$creadPrec :: ReadPrec DescribeDomains
readList :: ReadS [DescribeDomains]
$creadList :: ReadS [DescribeDomains]
readsPrec :: Int -> ReadS DescribeDomains
$creadsPrec :: Int -> ReadS DescribeDomains
Prelude.Read, Int -> DescribeDomains -> ShowS
[DescribeDomains] -> ShowS
DescribeDomains -> String
(Int -> DescribeDomains -> ShowS)
-> (DescribeDomains -> String)
-> ([DescribeDomains] -> ShowS)
-> Show DescribeDomains
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDomains] -> ShowS
$cshowList :: [DescribeDomains] -> ShowS
show :: DescribeDomains -> String
$cshow :: DescribeDomains -> String
showsPrec :: Int -> DescribeDomains -> ShowS
$cshowsPrec :: Int -> DescribeDomains -> ShowS
Prelude.Show, (forall x. DescribeDomains -> Rep DescribeDomains x)
-> (forall x. Rep DescribeDomains x -> DescribeDomains)
-> Generic DescribeDomains
forall x. Rep DescribeDomains x -> DescribeDomains
forall x. DescribeDomains -> Rep DescribeDomains x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDomains x -> DescribeDomains
$cfrom :: forall x. DescribeDomains -> Rep DescribeDomains x
Prelude.Generic)
newDescribeDomains ::
DescribeDomains
newDescribeDomains :: DescribeDomains
newDescribeDomains =
DescribeDomains' :: [Text] -> DescribeDomains
DescribeDomains' {$sel:domainNames:DescribeDomains' :: [Text]
domainNames = [Text]
forall a. Monoid a => a
Prelude.mempty}
describeDomains_domainNames :: Lens.Lens' DescribeDomains [Prelude.Text]
describeDomains_domainNames :: ([Text] -> f [Text]) -> DescribeDomains -> f DescribeDomains
describeDomains_domainNames = (DescribeDomains -> [Text])
-> (DescribeDomains -> [Text] -> DescribeDomains)
-> Lens DescribeDomains DescribeDomains [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDomains' {[Text]
domainNames :: [Text]
$sel:domainNames:DescribeDomains' :: DescribeDomains -> [Text]
domainNames} -> [Text]
domainNames) (\s :: DescribeDomains
s@DescribeDomains' {} [Text]
a -> DescribeDomains
s {$sel:domainNames:DescribeDomains' :: [Text]
domainNames = [Text]
a} :: DescribeDomains) (([Text] -> f [Text]) -> DescribeDomains -> f DescribeDomains)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DescribeDomains
-> f DescribeDomains
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeDomains where
type
AWSResponse DescribeDomains =
DescribeDomainsResponse
request :: DescribeDomains -> Request DescribeDomains
request = Service -> DescribeDomains -> Request DescribeDomains
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeDomains
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDomains)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeDomains))
-> Logger
-> Service
-> Proxy DescribeDomains
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDomains)))
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 -> [DomainStatus] -> DescribeDomainsResponse
DescribeDomainsResponse'
(Int -> [DomainStatus] -> DescribeDomainsResponse)
-> Either String Int
-> Either String ([DomainStatus] -> DescribeDomainsResponse)
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 ([DomainStatus] -> DescribeDomainsResponse)
-> Either String [DomainStatus]
-> Either String DescribeDomainsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [DomainStatus])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DomainStatusList"
Either String (Maybe [DomainStatus])
-> [DomainStatus] -> Either String [DomainStatus]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [DomainStatus]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable DescribeDomains
instance Prelude.NFData DescribeDomains
instance Core.ToHeaders DescribeDomains where
toHeaders :: DescribeDomains -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeDomains -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON DescribeDomains where
toJSON :: DescribeDomains -> Value
toJSON DescribeDomains' {[Text]
domainNames :: [Text]
$sel:domainNames:DescribeDomains' :: DescribeDomains -> [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
"DomainNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
domainNames)]
)
instance Core.ToPath DescribeDomains where
toPath :: DescribeDomains -> ByteString
toPath =
ByteString -> DescribeDomains -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2021-01-01/opensearch/domain-info"
instance Core.ToQuery DescribeDomains where
toQuery :: DescribeDomains -> QueryString
toQuery = QueryString -> DescribeDomains -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeDomainsResponse = DescribeDomainsResponse'
{
DescribeDomainsResponse -> Int
httpStatus :: Prelude.Int,
DescribeDomainsResponse -> [DomainStatus]
domainStatusList :: [DomainStatus]
}
deriving (DescribeDomainsResponse -> DescribeDomainsResponse -> Bool
(DescribeDomainsResponse -> DescribeDomainsResponse -> Bool)
-> (DescribeDomainsResponse -> DescribeDomainsResponse -> Bool)
-> Eq DescribeDomainsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDomainsResponse -> DescribeDomainsResponse -> Bool
$c/= :: DescribeDomainsResponse -> DescribeDomainsResponse -> Bool
== :: DescribeDomainsResponse -> DescribeDomainsResponse -> Bool
$c== :: DescribeDomainsResponse -> DescribeDomainsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDomainsResponse]
ReadPrec DescribeDomainsResponse
Int -> ReadS DescribeDomainsResponse
ReadS [DescribeDomainsResponse]
(Int -> ReadS DescribeDomainsResponse)
-> ReadS [DescribeDomainsResponse]
-> ReadPrec DescribeDomainsResponse
-> ReadPrec [DescribeDomainsResponse]
-> Read DescribeDomainsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDomainsResponse]
$creadListPrec :: ReadPrec [DescribeDomainsResponse]
readPrec :: ReadPrec DescribeDomainsResponse
$creadPrec :: ReadPrec DescribeDomainsResponse
readList :: ReadS [DescribeDomainsResponse]
$creadList :: ReadS [DescribeDomainsResponse]
readsPrec :: Int -> ReadS DescribeDomainsResponse
$creadsPrec :: Int -> ReadS DescribeDomainsResponse
Prelude.Read, Int -> DescribeDomainsResponse -> ShowS
[DescribeDomainsResponse] -> ShowS
DescribeDomainsResponse -> String
(Int -> DescribeDomainsResponse -> ShowS)
-> (DescribeDomainsResponse -> String)
-> ([DescribeDomainsResponse] -> ShowS)
-> Show DescribeDomainsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDomainsResponse] -> ShowS
$cshowList :: [DescribeDomainsResponse] -> ShowS
show :: DescribeDomainsResponse -> String
$cshow :: DescribeDomainsResponse -> String
showsPrec :: Int -> DescribeDomainsResponse -> ShowS
$cshowsPrec :: Int -> DescribeDomainsResponse -> ShowS
Prelude.Show, (forall x.
DescribeDomainsResponse -> Rep DescribeDomainsResponse x)
-> (forall x.
Rep DescribeDomainsResponse x -> DescribeDomainsResponse)
-> Generic DescribeDomainsResponse
forall x. Rep DescribeDomainsResponse x -> DescribeDomainsResponse
forall x. DescribeDomainsResponse -> Rep DescribeDomainsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDomainsResponse x -> DescribeDomainsResponse
$cfrom :: forall x. DescribeDomainsResponse -> Rep DescribeDomainsResponse x
Prelude.Generic)
newDescribeDomainsResponse ::
Prelude.Int ->
DescribeDomainsResponse
newDescribeDomainsResponse :: Int -> DescribeDomainsResponse
newDescribeDomainsResponse Int
pHttpStatus_ =
DescribeDomainsResponse' :: Int -> [DomainStatus] -> DescribeDomainsResponse
DescribeDomainsResponse'
{ $sel:httpStatus:DescribeDomainsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:domainStatusList:DescribeDomainsResponse' :: [DomainStatus]
domainStatusList = [DomainStatus]
forall a. Monoid a => a
Prelude.mempty
}
describeDomainsResponse_httpStatus :: Lens.Lens' DescribeDomainsResponse Prelude.Int
describeDomainsResponse_httpStatus :: (Int -> f Int)
-> DescribeDomainsResponse -> f DescribeDomainsResponse
describeDomainsResponse_httpStatus = (DescribeDomainsResponse -> Int)
-> (DescribeDomainsResponse -> Int -> DescribeDomainsResponse)
-> Lens DescribeDomainsResponse DescribeDomainsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDomainsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeDomainsResponse' :: DescribeDomainsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeDomainsResponse
s@DescribeDomainsResponse' {} Int
a -> DescribeDomainsResponse
s {$sel:httpStatus:DescribeDomainsResponse' :: Int
httpStatus = Int
a} :: DescribeDomainsResponse)
describeDomainsResponse_domainStatusList :: Lens.Lens' DescribeDomainsResponse [DomainStatus]
describeDomainsResponse_domainStatusList :: ([DomainStatus] -> f [DomainStatus])
-> DescribeDomainsResponse -> f DescribeDomainsResponse
describeDomainsResponse_domainStatusList = (DescribeDomainsResponse -> [DomainStatus])
-> (DescribeDomainsResponse
-> [DomainStatus] -> DescribeDomainsResponse)
-> Lens
DescribeDomainsResponse
DescribeDomainsResponse
[DomainStatus]
[DomainStatus]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDomainsResponse' {[DomainStatus]
domainStatusList :: [DomainStatus]
$sel:domainStatusList:DescribeDomainsResponse' :: DescribeDomainsResponse -> [DomainStatus]
domainStatusList} -> [DomainStatus]
domainStatusList) (\s :: DescribeDomainsResponse
s@DescribeDomainsResponse' {} [DomainStatus]
a -> DescribeDomainsResponse
s {$sel:domainStatusList:DescribeDomainsResponse' :: [DomainStatus]
domainStatusList = [DomainStatus]
a} :: DescribeDomainsResponse) (([DomainStatus] -> f [DomainStatus])
-> DescribeDomainsResponse -> f DescribeDomainsResponse)
-> (([DomainStatus] -> f [DomainStatus])
-> [DomainStatus] -> f [DomainStatus])
-> ([DomainStatus] -> f [DomainStatus])
-> DescribeDomainsResponse
-> f DescribeDomainsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DomainStatus] -> f [DomainStatus])
-> [DomainStatus] -> f [DomainStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData DescribeDomainsResponse