{-# 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.IoT.DescribeIndex
(
DescribeIndex (..),
newDescribeIndex,
describeIndex_indexName,
DescribeIndexResponse (..),
newDescribeIndexResponse,
describeIndexResponse_indexStatus,
describeIndexResponse_schema,
describeIndexResponse_indexName,
describeIndexResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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
data DescribeIndex = DescribeIndex'
{
DescribeIndex -> Text
indexName :: Prelude.Text
}
deriving (DescribeIndex -> DescribeIndex -> Bool
(DescribeIndex -> DescribeIndex -> Bool)
-> (DescribeIndex -> DescribeIndex -> Bool) -> Eq DescribeIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeIndex -> DescribeIndex -> Bool
$c/= :: DescribeIndex -> DescribeIndex -> Bool
== :: DescribeIndex -> DescribeIndex -> Bool
$c== :: DescribeIndex -> DescribeIndex -> Bool
Prelude.Eq, ReadPrec [DescribeIndex]
ReadPrec DescribeIndex
Int -> ReadS DescribeIndex
ReadS [DescribeIndex]
(Int -> ReadS DescribeIndex)
-> ReadS [DescribeIndex]
-> ReadPrec DescribeIndex
-> ReadPrec [DescribeIndex]
-> Read DescribeIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeIndex]
$creadListPrec :: ReadPrec [DescribeIndex]
readPrec :: ReadPrec DescribeIndex
$creadPrec :: ReadPrec DescribeIndex
readList :: ReadS [DescribeIndex]
$creadList :: ReadS [DescribeIndex]
readsPrec :: Int -> ReadS DescribeIndex
$creadsPrec :: Int -> ReadS DescribeIndex
Prelude.Read, Int -> DescribeIndex -> ShowS
[DescribeIndex] -> ShowS
DescribeIndex -> String
(Int -> DescribeIndex -> ShowS)
-> (DescribeIndex -> String)
-> ([DescribeIndex] -> ShowS)
-> Show DescribeIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeIndex] -> ShowS
$cshowList :: [DescribeIndex] -> ShowS
show :: DescribeIndex -> String
$cshow :: DescribeIndex -> String
showsPrec :: Int -> DescribeIndex -> ShowS
$cshowsPrec :: Int -> DescribeIndex -> ShowS
Prelude.Show, (forall x. DescribeIndex -> Rep DescribeIndex x)
-> (forall x. Rep DescribeIndex x -> DescribeIndex)
-> Generic DescribeIndex
forall x. Rep DescribeIndex x -> DescribeIndex
forall x. DescribeIndex -> Rep DescribeIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeIndex x -> DescribeIndex
$cfrom :: forall x. DescribeIndex -> Rep DescribeIndex x
Prelude.Generic)
newDescribeIndex ::
Prelude.Text ->
DescribeIndex
newDescribeIndex :: Text -> DescribeIndex
newDescribeIndex Text
pIndexName_ =
DescribeIndex' :: Text -> DescribeIndex
DescribeIndex' {$sel:indexName:DescribeIndex' :: Text
indexName = Text
pIndexName_}
describeIndex_indexName :: Lens.Lens' DescribeIndex Prelude.Text
describeIndex_indexName :: (Text -> f Text) -> DescribeIndex -> f DescribeIndex
describeIndex_indexName = (DescribeIndex -> Text)
-> (DescribeIndex -> Text -> DescribeIndex)
-> Lens DescribeIndex DescribeIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIndex' {Text
indexName :: Text
$sel:indexName:DescribeIndex' :: DescribeIndex -> Text
indexName} -> Text
indexName) (\s :: DescribeIndex
s@DescribeIndex' {} Text
a -> DescribeIndex
s {$sel:indexName:DescribeIndex' :: Text
indexName = Text
a} :: DescribeIndex)
instance Core.AWSRequest DescribeIndex where
type
AWSResponse DescribeIndex =
DescribeIndexResponse
request :: DescribeIndex -> Request DescribeIndex
request = Service -> DescribeIndex -> Request DescribeIndex
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeIndex)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeIndex))
-> Logger
-> Service
-> Proxy DescribeIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeIndex)))
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 ->
Maybe IndexStatus
-> Maybe Text -> Maybe Text -> Int -> DescribeIndexResponse
DescribeIndexResponse'
(Maybe IndexStatus
-> Maybe Text -> Maybe Text -> Int -> DescribeIndexResponse)
-> Either String (Maybe IndexStatus)
-> Either
String (Maybe Text -> Maybe Text -> Int -> DescribeIndexResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe IndexStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"indexStatus")
Either
String (Maybe Text -> Maybe Text -> Int -> DescribeIndexResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DescribeIndexResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"schema")
Either String (Maybe Text -> Int -> DescribeIndexResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeIndexResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"indexName")
Either String (Int -> DescribeIndexResponse)
-> Either String Int -> Either String DescribeIndexResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable DescribeIndex
instance Prelude.NFData DescribeIndex
instance Core.ToHeaders DescribeIndex where
toHeaders :: DescribeIndex -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeIndex -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeIndex where
toPath :: DescribeIndex -> ByteString
toPath DescribeIndex' {Text
indexName :: Text
$sel:indexName:DescribeIndex' :: DescribeIndex -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/indices/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
indexName]
instance Core.ToQuery DescribeIndex where
toQuery :: DescribeIndex -> QueryString
toQuery = QueryString -> DescribeIndex -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeIndexResponse = DescribeIndexResponse'
{
DescribeIndexResponse -> Maybe IndexStatus
indexStatus :: Prelude.Maybe IndexStatus,
DescribeIndexResponse -> Maybe Text
schema :: Prelude.Maybe Prelude.Text,
DescribeIndexResponse -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
DescribeIndexResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeIndexResponse -> DescribeIndexResponse -> Bool
(DescribeIndexResponse -> DescribeIndexResponse -> Bool)
-> (DescribeIndexResponse -> DescribeIndexResponse -> Bool)
-> Eq DescribeIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeIndexResponse -> DescribeIndexResponse -> Bool
$c/= :: DescribeIndexResponse -> DescribeIndexResponse -> Bool
== :: DescribeIndexResponse -> DescribeIndexResponse -> Bool
$c== :: DescribeIndexResponse -> DescribeIndexResponse -> Bool
Prelude.Eq, ReadPrec [DescribeIndexResponse]
ReadPrec DescribeIndexResponse
Int -> ReadS DescribeIndexResponse
ReadS [DescribeIndexResponse]
(Int -> ReadS DescribeIndexResponse)
-> ReadS [DescribeIndexResponse]
-> ReadPrec DescribeIndexResponse
-> ReadPrec [DescribeIndexResponse]
-> Read DescribeIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeIndexResponse]
$creadListPrec :: ReadPrec [DescribeIndexResponse]
readPrec :: ReadPrec DescribeIndexResponse
$creadPrec :: ReadPrec DescribeIndexResponse
readList :: ReadS [DescribeIndexResponse]
$creadList :: ReadS [DescribeIndexResponse]
readsPrec :: Int -> ReadS DescribeIndexResponse
$creadsPrec :: Int -> ReadS DescribeIndexResponse
Prelude.Read, Int -> DescribeIndexResponse -> ShowS
[DescribeIndexResponse] -> ShowS
DescribeIndexResponse -> String
(Int -> DescribeIndexResponse -> ShowS)
-> (DescribeIndexResponse -> String)
-> ([DescribeIndexResponse] -> ShowS)
-> Show DescribeIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeIndexResponse] -> ShowS
$cshowList :: [DescribeIndexResponse] -> ShowS
show :: DescribeIndexResponse -> String
$cshow :: DescribeIndexResponse -> String
showsPrec :: Int -> DescribeIndexResponse -> ShowS
$cshowsPrec :: Int -> DescribeIndexResponse -> ShowS
Prelude.Show, (forall x. DescribeIndexResponse -> Rep DescribeIndexResponse x)
-> (forall x. Rep DescribeIndexResponse x -> DescribeIndexResponse)
-> Generic DescribeIndexResponse
forall x. Rep DescribeIndexResponse x -> DescribeIndexResponse
forall x. DescribeIndexResponse -> Rep DescribeIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeIndexResponse x -> DescribeIndexResponse
$cfrom :: forall x. DescribeIndexResponse -> Rep DescribeIndexResponse x
Prelude.Generic)
newDescribeIndexResponse ::
Prelude.Int ->
DescribeIndexResponse
newDescribeIndexResponse :: Int -> DescribeIndexResponse
newDescribeIndexResponse Int
pHttpStatus_ =
DescribeIndexResponse' :: Maybe IndexStatus
-> Maybe Text -> Maybe Text -> Int -> DescribeIndexResponse
DescribeIndexResponse'
{ $sel:indexStatus:DescribeIndexResponse' :: Maybe IndexStatus
indexStatus =
Maybe IndexStatus
forall a. Maybe a
Prelude.Nothing,
$sel:schema:DescribeIndexResponse' :: Maybe Text
schema = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:indexName:DescribeIndexResponse' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeIndexResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeIndexResponse_indexStatus :: Lens.Lens' DescribeIndexResponse (Prelude.Maybe IndexStatus)
describeIndexResponse_indexStatus :: (Maybe IndexStatus -> f (Maybe IndexStatus))
-> DescribeIndexResponse -> f DescribeIndexResponse
describeIndexResponse_indexStatus = (DescribeIndexResponse -> Maybe IndexStatus)
-> (DescribeIndexResponse
-> Maybe IndexStatus -> DescribeIndexResponse)
-> Lens
DescribeIndexResponse
DescribeIndexResponse
(Maybe IndexStatus)
(Maybe IndexStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIndexResponse' {Maybe IndexStatus
indexStatus :: Maybe IndexStatus
$sel:indexStatus:DescribeIndexResponse' :: DescribeIndexResponse -> Maybe IndexStatus
indexStatus} -> Maybe IndexStatus
indexStatus) (\s :: DescribeIndexResponse
s@DescribeIndexResponse' {} Maybe IndexStatus
a -> DescribeIndexResponse
s {$sel:indexStatus:DescribeIndexResponse' :: Maybe IndexStatus
indexStatus = Maybe IndexStatus
a} :: DescribeIndexResponse)
describeIndexResponse_schema :: Lens.Lens' DescribeIndexResponse (Prelude.Maybe Prelude.Text)
describeIndexResponse_schema :: (Maybe Text -> f (Maybe Text))
-> DescribeIndexResponse -> f DescribeIndexResponse
describeIndexResponse_schema = (DescribeIndexResponse -> Maybe Text)
-> (DescribeIndexResponse -> Maybe Text -> DescribeIndexResponse)
-> Lens
DescribeIndexResponse
DescribeIndexResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIndexResponse' {Maybe Text
schema :: Maybe Text
$sel:schema:DescribeIndexResponse' :: DescribeIndexResponse -> Maybe Text
schema} -> Maybe Text
schema) (\s :: DescribeIndexResponse
s@DescribeIndexResponse' {} Maybe Text
a -> DescribeIndexResponse
s {$sel:schema:DescribeIndexResponse' :: Maybe Text
schema = Maybe Text
a} :: DescribeIndexResponse)
describeIndexResponse_indexName :: Lens.Lens' DescribeIndexResponse (Prelude.Maybe Prelude.Text)
describeIndexResponse_indexName :: (Maybe Text -> f (Maybe Text))
-> DescribeIndexResponse -> f DescribeIndexResponse
describeIndexResponse_indexName = (DescribeIndexResponse -> Maybe Text)
-> (DescribeIndexResponse -> Maybe Text -> DescribeIndexResponse)
-> Lens
DescribeIndexResponse
DescribeIndexResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIndexResponse' {Maybe Text
indexName :: Maybe Text
$sel:indexName:DescribeIndexResponse' :: DescribeIndexResponse -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: DescribeIndexResponse
s@DescribeIndexResponse' {} Maybe Text
a -> DescribeIndexResponse
s {$sel:indexName:DescribeIndexResponse' :: Maybe Text
indexName = Maybe Text
a} :: DescribeIndexResponse)
describeIndexResponse_httpStatus :: Lens.Lens' DescribeIndexResponse Prelude.Int
describeIndexResponse_httpStatus :: (Int -> f Int) -> DescribeIndexResponse -> f DescribeIndexResponse
describeIndexResponse_httpStatus = (DescribeIndexResponse -> Int)
-> (DescribeIndexResponse -> Int -> DescribeIndexResponse)
-> Lens DescribeIndexResponse DescribeIndexResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIndexResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeIndexResponse' :: DescribeIndexResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeIndexResponse
s@DescribeIndexResponse' {} Int
a -> DescribeIndexResponse
s {$sel:httpStatus:DescribeIndexResponse' :: Int
httpStatus = Int
a} :: DescribeIndexResponse)
instance Prelude.NFData DescribeIndexResponse