{-# 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.Connect.DescribeInstance
(
DescribeInstance (..),
newDescribeInstance,
describeInstance_instanceId,
DescribeInstanceResponse (..),
newDescribeInstanceResponse,
describeInstanceResponse_instance,
describeInstanceResponse_httpStatus,
)
where
import Amazonka.Connect.Types
import qualified Amazonka.Core as Core
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 DescribeInstance = DescribeInstance'
{
DescribeInstance -> Text
instanceId :: Prelude.Text
}
deriving (DescribeInstance -> DescribeInstance -> Bool
(DescribeInstance -> DescribeInstance -> Bool)
-> (DescribeInstance -> DescribeInstance -> Bool)
-> Eq DescribeInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstance -> DescribeInstance -> Bool
$c/= :: DescribeInstance -> DescribeInstance -> Bool
== :: DescribeInstance -> DescribeInstance -> Bool
$c== :: DescribeInstance -> DescribeInstance -> Bool
Prelude.Eq, ReadPrec [DescribeInstance]
ReadPrec DescribeInstance
Int -> ReadS DescribeInstance
ReadS [DescribeInstance]
(Int -> ReadS DescribeInstance)
-> ReadS [DescribeInstance]
-> ReadPrec DescribeInstance
-> ReadPrec [DescribeInstance]
-> Read DescribeInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstance]
$creadListPrec :: ReadPrec [DescribeInstance]
readPrec :: ReadPrec DescribeInstance
$creadPrec :: ReadPrec DescribeInstance
readList :: ReadS [DescribeInstance]
$creadList :: ReadS [DescribeInstance]
readsPrec :: Int -> ReadS DescribeInstance
$creadsPrec :: Int -> ReadS DescribeInstance
Prelude.Read, Int -> DescribeInstance -> ShowS
[DescribeInstance] -> ShowS
DescribeInstance -> String
(Int -> DescribeInstance -> ShowS)
-> (DescribeInstance -> String)
-> ([DescribeInstance] -> ShowS)
-> Show DescribeInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstance] -> ShowS
$cshowList :: [DescribeInstance] -> ShowS
show :: DescribeInstance -> String
$cshow :: DescribeInstance -> String
showsPrec :: Int -> DescribeInstance -> ShowS
$cshowsPrec :: Int -> DescribeInstance -> ShowS
Prelude.Show, (forall x. DescribeInstance -> Rep DescribeInstance x)
-> (forall x. Rep DescribeInstance x -> DescribeInstance)
-> Generic DescribeInstance
forall x. Rep DescribeInstance x -> DescribeInstance
forall x. DescribeInstance -> Rep DescribeInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeInstance x -> DescribeInstance
$cfrom :: forall x. DescribeInstance -> Rep DescribeInstance x
Prelude.Generic)
newDescribeInstance ::
Prelude.Text ->
DescribeInstance
newDescribeInstance :: Text -> DescribeInstance
newDescribeInstance Text
pInstanceId_ =
DescribeInstance' :: Text -> DescribeInstance
DescribeInstance' {$sel:instanceId:DescribeInstance' :: Text
instanceId = Text
pInstanceId_}
describeInstance_instanceId :: Lens.Lens' DescribeInstance Prelude.Text
describeInstance_instanceId :: (Text -> f Text) -> DescribeInstance -> f DescribeInstance
describeInstance_instanceId = (DescribeInstance -> Text)
-> (DescribeInstance -> Text -> DescribeInstance)
-> Lens DescribeInstance DescribeInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstance' {Text
instanceId :: Text
$sel:instanceId:DescribeInstance' :: DescribeInstance -> Text
instanceId} -> Text
instanceId) (\s :: DescribeInstance
s@DescribeInstance' {} Text
a -> DescribeInstance
s {$sel:instanceId:DescribeInstance' :: Text
instanceId = Text
a} :: DescribeInstance)
instance Core.AWSRequest DescribeInstance where
type
AWSResponse DescribeInstance =
DescribeInstanceResponse
request :: DescribeInstance -> Request DescribeInstance
request = Service -> DescribeInstance -> Request DescribeInstance
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeInstance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeInstance))
-> Logger
-> Service
-> Proxy DescribeInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeInstance)))
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 Instance -> Int -> DescribeInstanceResponse
DescribeInstanceResponse'
(Maybe Instance -> Int -> DescribeInstanceResponse)
-> Either String (Maybe Instance)
-> Either String (Int -> DescribeInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Instance)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Instance")
Either String (Int -> DescribeInstanceResponse)
-> Either String Int -> Either String DescribeInstanceResponse
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 DescribeInstance
instance Prelude.NFData DescribeInstance
instance Core.ToHeaders DescribeInstance where
toHeaders :: DescribeInstance -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeInstance -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath DescribeInstance where
toPath :: DescribeInstance -> ByteString
toPath DescribeInstance' {Text
instanceId :: Text
$sel:instanceId:DescribeInstance' :: DescribeInstance -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/instance/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId]
instance Core.ToQuery DescribeInstance where
toQuery :: DescribeInstance -> QueryString
toQuery = QueryString -> DescribeInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeInstanceResponse = DescribeInstanceResponse'
{
DescribeInstanceResponse -> Maybe Instance
instance' :: Prelude.Maybe Instance,
DescribeInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeInstanceResponse -> DescribeInstanceResponse -> Bool
(DescribeInstanceResponse -> DescribeInstanceResponse -> Bool)
-> (DescribeInstanceResponse -> DescribeInstanceResponse -> Bool)
-> Eq DescribeInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstanceResponse -> DescribeInstanceResponse -> Bool
$c/= :: DescribeInstanceResponse -> DescribeInstanceResponse -> Bool
== :: DescribeInstanceResponse -> DescribeInstanceResponse -> Bool
$c== :: DescribeInstanceResponse -> DescribeInstanceResponse -> Bool
Prelude.Eq, Int -> DescribeInstanceResponse -> ShowS
[DescribeInstanceResponse] -> ShowS
DescribeInstanceResponse -> String
(Int -> DescribeInstanceResponse -> ShowS)
-> (DescribeInstanceResponse -> String)
-> ([DescribeInstanceResponse] -> ShowS)
-> Show DescribeInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstanceResponse] -> ShowS
$cshowList :: [DescribeInstanceResponse] -> ShowS
show :: DescribeInstanceResponse -> String
$cshow :: DescribeInstanceResponse -> String
showsPrec :: Int -> DescribeInstanceResponse -> ShowS
$cshowsPrec :: Int -> DescribeInstanceResponse -> ShowS
Prelude.Show, (forall x.
DescribeInstanceResponse -> Rep DescribeInstanceResponse x)
-> (forall x.
Rep DescribeInstanceResponse x -> DescribeInstanceResponse)
-> Generic DescribeInstanceResponse
forall x.
Rep DescribeInstanceResponse x -> DescribeInstanceResponse
forall x.
DescribeInstanceResponse -> Rep DescribeInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeInstanceResponse x -> DescribeInstanceResponse
$cfrom :: forall x.
DescribeInstanceResponse -> Rep DescribeInstanceResponse x
Prelude.Generic)
newDescribeInstanceResponse ::
Prelude.Int ->
DescribeInstanceResponse
newDescribeInstanceResponse :: Int -> DescribeInstanceResponse
newDescribeInstanceResponse Int
pHttpStatus_ =
DescribeInstanceResponse' :: Maybe Instance -> Int -> DescribeInstanceResponse
DescribeInstanceResponse'
{ $sel:instance':DescribeInstanceResponse' :: Maybe Instance
instance' =
Maybe Instance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeInstanceResponse_instance :: Lens.Lens' DescribeInstanceResponse (Prelude.Maybe Instance)
describeInstanceResponse_instance :: (Maybe Instance -> f (Maybe Instance))
-> DescribeInstanceResponse -> f DescribeInstanceResponse
describeInstanceResponse_instance = (DescribeInstanceResponse -> Maybe Instance)
-> (DescribeInstanceResponse
-> Maybe Instance -> DescribeInstanceResponse)
-> Lens
DescribeInstanceResponse
DescribeInstanceResponse
(Maybe Instance)
(Maybe Instance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceResponse' {Maybe Instance
instance' :: Maybe Instance
$sel:instance':DescribeInstanceResponse' :: DescribeInstanceResponse -> Maybe Instance
instance'} -> Maybe Instance
instance') (\s :: DescribeInstanceResponse
s@DescribeInstanceResponse' {} Maybe Instance
a -> DescribeInstanceResponse
s {$sel:instance':DescribeInstanceResponse' :: Maybe Instance
instance' = Maybe Instance
a} :: DescribeInstanceResponse)
describeInstanceResponse_httpStatus :: Lens.Lens' DescribeInstanceResponse Prelude.Int
describeInstanceResponse_httpStatus :: (Int -> f Int)
-> DescribeInstanceResponse -> f DescribeInstanceResponse
describeInstanceResponse_httpStatus = (DescribeInstanceResponse -> Int)
-> (DescribeInstanceResponse -> Int -> DescribeInstanceResponse)
-> Lens DescribeInstanceResponse DescribeInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeInstanceResponse' :: DescribeInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeInstanceResponse
s@DescribeInstanceResponse' {} Int
a -> DescribeInstanceResponse
s {$sel:httpStatus:DescribeInstanceResponse' :: Int
httpStatus = Int
a} :: DescribeInstanceResponse)
instance Prelude.NFData DescribeInstanceResponse