{-# 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.DeviceFarm.GetDeviceInstance
(
GetDeviceInstance (..),
newGetDeviceInstance,
getDeviceInstance_arn,
GetDeviceInstanceResponse (..),
newGetDeviceInstanceResponse,
getDeviceInstanceResponse_deviceInstance,
getDeviceInstanceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDeviceInstance = GetDeviceInstance'
{
GetDeviceInstance -> Text
arn :: Prelude.Text
}
deriving (GetDeviceInstance -> GetDeviceInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeviceInstance -> GetDeviceInstance -> Bool
$c/= :: GetDeviceInstance -> GetDeviceInstance -> Bool
== :: GetDeviceInstance -> GetDeviceInstance -> Bool
$c== :: GetDeviceInstance -> GetDeviceInstance -> Bool
Prelude.Eq, ReadPrec [GetDeviceInstance]
ReadPrec GetDeviceInstance
Int -> ReadS GetDeviceInstance
ReadS [GetDeviceInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeviceInstance]
$creadListPrec :: ReadPrec [GetDeviceInstance]
readPrec :: ReadPrec GetDeviceInstance
$creadPrec :: ReadPrec GetDeviceInstance
readList :: ReadS [GetDeviceInstance]
$creadList :: ReadS [GetDeviceInstance]
readsPrec :: Int -> ReadS GetDeviceInstance
$creadsPrec :: Int -> ReadS GetDeviceInstance
Prelude.Read, Int -> GetDeviceInstance -> ShowS
[GetDeviceInstance] -> ShowS
GetDeviceInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeviceInstance] -> ShowS
$cshowList :: [GetDeviceInstance] -> ShowS
show :: GetDeviceInstance -> String
$cshow :: GetDeviceInstance -> String
showsPrec :: Int -> GetDeviceInstance -> ShowS
$cshowsPrec :: Int -> GetDeviceInstance -> ShowS
Prelude.Show, forall x. Rep GetDeviceInstance x -> GetDeviceInstance
forall x. GetDeviceInstance -> Rep GetDeviceInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeviceInstance x -> GetDeviceInstance
$cfrom :: forall x. GetDeviceInstance -> Rep GetDeviceInstance x
Prelude.Generic)
newGetDeviceInstance ::
Prelude.Text ->
GetDeviceInstance
newGetDeviceInstance :: Text -> GetDeviceInstance
newGetDeviceInstance Text
pArn_ =
GetDeviceInstance' {$sel:arn:GetDeviceInstance' :: Text
arn = Text
pArn_}
getDeviceInstance_arn :: Lens.Lens' GetDeviceInstance Prelude.Text
getDeviceInstance_arn :: Lens' GetDeviceInstance Text
getDeviceInstance_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceInstance' {Text
arn :: Text
$sel:arn:GetDeviceInstance' :: GetDeviceInstance -> Text
arn} -> Text
arn) (\s :: GetDeviceInstance
s@GetDeviceInstance' {} Text
a -> GetDeviceInstance
s {$sel:arn:GetDeviceInstance' :: Text
arn = Text
a} :: GetDeviceInstance)
instance Core.AWSRequest GetDeviceInstance where
type
AWSResponse GetDeviceInstance =
GetDeviceInstanceResponse
request :: (Service -> Service)
-> GetDeviceInstance -> Request GetDeviceInstance
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDeviceInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDeviceInstance)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DeviceInstance -> Int -> GetDeviceInstanceResponse
GetDeviceInstanceResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"deviceInstance")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetDeviceInstance where
hashWithSalt :: Int -> GetDeviceInstance -> Int
hashWithSalt Int
_salt GetDeviceInstance' {Text
arn :: Text
$sel:arn:GetDeviceInstance' :: GetDeviceInstance -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
instance Prelude.NFData GetDeviceInstance where
rnf :: GetDeviceInstance -> ()
rnf GetDeviceInstance' {Text
arn :: Text
$sel:arn:GetDeviceInstance' :: GetDeviceInstance -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
arn
instance Data.ToHeaders GetDeviceInstance where
toHeaders :: GetDeviceInstance -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"DeviceFarm_20150623.GetDeviceInstance" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetDeviceInstance where
toJSON :: GetDeviceInstance -> Value
toJSON GetDeviceInstance' {Text
arn :: Text
$sel:arn:GetDeviceInstance' :: GetDeviceInstance -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
)
instance Data.ToPath GetDeviceInstance where
toPath :: GetDeviceInstance -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetDeviceInstance where
toQuery :: GetDeviceInstance -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetDeviceInstanceResponse = GetDeviceInstanceResponse'
{
GetDeviceInstanceResponse -> Maybe DeviceInstance
deviceInstance :: Prelude.Maybe DeviceInstance,
GetDeviceInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDeviceInstanceResponse -> GetDeviceInstanceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeviceInstanceResponse -> GetDeviceInstanceResponse -> Bool
$c/= :: GetDeviceInstanceResponse -> GetDeviceInstanceResponse -> Bool
== :: GetDeviceInstanceResponse -> GetDeviceInstanceResponse -> Bool
$c== :: GetDeviceInstanceResponse -> GetDeviceInstanceResponse -> Bool
Prelude.Eq, ReadPrec [GetDeviceInstanceResponse]
ReadPrec GetDeviceInstanceResponse
Int -> ReadS GetDeviceInstanceResponse
ReadS [GetDeviceInstanceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeviceInstanceResponse]
$creadListPrec :: ReadPrec [GetDeviceInstanceResponse]
readPrec :: ReadPrec GetDeviceInstanceResponse
$creadPrec :: ReadPrec GetDeviceInstanceResponse
readList :: ReadS [GetDeviceInstanceResponse]
$creadList :: ReadS [GetDeviceInstanceResponse]
readsPrec :: Int -> ReadS GetDeviceInstanceResponse
$creadsPrec :: Int -> ReadS GetDeviceInstanceResponse
Prelude.Read, Int -> GetDeviceInstanceResponse -> ShowS
[GetDeviceInstanceResponse] -> ShowS
GetDeviceInstanceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeviceInstanceResponse] -> ShowS
$cshowList :: [GetDeviceInstanceResponse] -> ShowS
show :: GetDeviceInstanceResponse -> String
$cshow :: GetDeviceInstanceResponse -> String
showsPrec :: Int -> GetDeviceInstanceResponse -> ShowS
$cshowsPrec :: Int -> GetDeviceInstanceResponse -> ShowS
Prelude.Show, forall x.
Rep GetDeviceInstanceResponse x -> GetDeviceInstanceResponse
forall x.
GetDeviceInstanceResponse -> Rep GetDeviceInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDeviceInstanceResponse x -> GetDeviceInstanceResponse
$cfrom :: forall x.
GetDeviceInstanceResponse -> Rep GetDeviceInstanceResponse x
Prelude.Generic)
newGetDeviceInstanceResponse ::
Prelude.Int ->
GetDeviceInstanceResponse
newGetDeviceInstanceResponse :: Int -> GetDeviceInstanceResponse
newGetDeviceInstanceResponse Int
pHttpStatus_ =
GetDeviceInstanceResponse'
{ $sel:deviceInstance:GetDeviceInstanceResponse' :: Maybe DeviceInstance
deviceInstance =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDeviceInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDeviceInstanceResponse_deviceInstance :: Lens.Lens' GetDeviceInstanceResponse (Prelude.Maybe DeviceInstance)
getDeviceInstanceResponse_deviceInstance :: Lens' GetDeviceInstanceResponse (Maybe DeviceInstance)
getDeviceInstanceResponse_deviceInstance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceInstanceResponse' {Maybe DeviceInstance
deviceInstance :: Maybe DeviceInstance
$sel:deviceInstance:GetDeviceInstanceResponse' :: GetDeviceInstanceResponse -> Maybe DeviceInstance
deviceInstance} -> Maybe DeviceInstance
deviceInstance) (\s :: GetDeviceInstanceResponse
s@GetDeviceInstanceResponse' {} Maybe DeviceInstance
a -> GetDeviceInstanceResponse
s {$sel:deviceInstance:GetDeviceInstanceResponse' :: Maybe DeviceInstance
deviceInstance = Maybe DeviceInstance
a} :: GetDeviceInstanceResponse)
getDeviceInstanceResponse_httpStatus :: Lens.Lens' GetDeviceInstanceResponse Prelude.Int
getDeviceInstanceResponse_httpStatus :: Lens' GetDeviceInstanceResponse Int
getDeviceInstanceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDeviceInstanceResponse' :: GetDeviceInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDeviceInstanceResponse
s@GetDeviceInstanceResponse' {} Int
a -> GetDeviceInstanceResponse
s {$sel:httpStatus:GetDeviceInstanceResponse' :: Int
httpStatus = Int
a} :: GetDeviceInstanceResponse)
instance Prelude.NFData GetDeviceInstanceResponse where
rnf :: GetDeviceInstanceResponse -> ()
rnf GetDeviceInstanceResponse' {Int
Maybe DeviceInstance
httpStatus :: Int
deviceInstance :: Maybe DeviceInstance
$sel:httpStatus:GetDeviceInstanceResponse' :: GetDeviceInstanceResponse -> Int
$sel:deviceInstance:GetDeviceInstanceResponse' :: GetDeviceInstanceResponse -> Maybe DeviceInstance
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DeviceInstance
deviceInstance
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus