{-# 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.GetDevicePool
(
GetDevicePool (..),
newGetDevicePool,
getDevicePool_arn,
GetDevicePoolResponse (..),
newGetDevicePoolResponse,
getDevicePoolResponse_devicePool,
getDevicePoolResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.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 GetDevicePool = GetDevicePool'
{
GetDevicePool -> Text
arn :: Prelude.Text
}
deriving (GetDevicePool -> GetDevicePool -> Bool
(GetDevicePool -> GetDevicePool -> Bool)
-> (GetDevicePool -> GetDevicePool -> Bool) -> Eq GetDevicePool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevicePool -> GetDevicePool -> Bool
$c/= :: GetDevicePool -> GetDevicePool -> Bool
== :: GetDevicePool -> GetDevicePool -> Bool
$c== :: GetDevicePool -> GetDevicePool -> Bool
Prelude.Eq, ReadPrec [GetDevicePool]
ReadPrec GetDevicePool
Int -> ReadS GetDevicePool
ReadS [GetDevicePool]
(Int -> ReadS GetDevicePool)
-> ReadS [GetDevicePool]
-> ReadPrec GetDevicePool
-> ReadPrec [GetDevicePool]
-> Read GetDevicePool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDevicePool]
$creadListPrec :: ReadPrec [GetDevicePool]
readPrec :: ReadPrec GetDevicePool
$creadPrec :: ReadPrec GetDevicePool
readList :: ReadS [GetDevicePool]
$creadList :: ReadS [GetDevicePool]
readsPrec :: Int -> ReadS GetDevicePool
$creadsPrec :: Int -> ReadS GetDevicePool
Prelude.Read, Int -> GetDevicePool -> ShowS
[GetDevicePool] -> ShowS
GetDevicePool -> String
(Int -> GetDevicePool -> ShowS)
-> (GetDevicePool -> String)
-> ([GetDevicePool] -> ShowS)
-> Show GetDevicePool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevicePool] -> ShowS
$cshowList :: [GetDevicePool] -> ShowS
show :: GetDevicePool -> String
$cshow :: GetDevicePool -> String
showsPrec :: Int -> GetDevicePool -> ShowS
$cshowsPrec :: Int -> GetDevicePool -> ShowS
Prelude.Show, (forall x. GetDevicePool -> Rep GetDevicePool x)
-> (forall x. Rep GetDevicePool x -> GetDevicePool)
-> Generic GetDevicePool
forall x. Rep GetDevicePool x -> GetDevicePool
forall x. GetDevicePool -> Rep GetDevicePool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevicePool x -> GetDevicePool
$cfrom :: forall x. GetDevicePool -> Rep GetDevicePool x
Prelude.Generic)
newGetDevicePool ::
Prelude.Text ->
GetDevicePool
newGetDevicePool :: Text -> GetDevicePool
newGetDevicePool Text
pArn_ = GetDevicePool' :: Text -> GetDevicePool
GetDevicePool' {$sel:arn:GetDevicePool' :: Text
arn = Text
pArn_}
getDevicePool_arn :: Lens.Lens' GetDevicePool Prelude.Text
getDevicePool_arn :: (Text -> f Text) -> GetDevicePool -> f GetDevicePool
getDevicePool_arn = (GetDevicePool -> Text)
-> (GetDevicePool -> Text -> GetDevicePool)
-> Lens GetDevicePool GetDevicePool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicePool' {Text
arn :: Text
$sel:arn:GetDevicePool' :: GetDevicePool -> Text
arn} -> Text
arn) (\s :: GetDevicePool
s@GetDevicePool' {} Text
a -> GetDevicePool
s {$sel:arn:GetDevicePool' :: Text
arn = Text
a} :: GetDevicePool)
instance Core.AWSRequest GetDevicePool where
type
AWSResponse GetDevicePool =
GetDevicePoolResponse
request :: GetDevicePool -> Request GetDevicePool
request = Service -> GetDevicePool -> Request GetDevicePool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDevicePool)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDevicePool))
-> Logger
-> Service
-> Proxy GetDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDevicePool)))
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 DevicePool -> Int -> GetDevicePoolResponse
GetDevicePoolResponse'
(Maybe DevicePool -> Int -> GetDevicePoolResponse)
-> Either String (Maybe DevicePool)
-> Either String (Int -> GetDevicePoolResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DevicePool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"devicePool")
Either String (Int -> GetDevicePoolResponse)
-> Either String Int -> Either String GetDevicePoolResponse
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 GetDevicePool
instance Prelude.NFData GetDevicePool
instance Core.ToHeaders GetDevicePool where
toHeaders :: GetDevicePool -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDevicePool -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DeviceFarm_20150623.GetDevicePool" ::
Prelude.ByteString
),
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.ToJSON GetDevicePool where
toJSON :: GetDevicePool -> Value
toJSON GetDevicePool' {Text
arn :: Text
$sel:arn:GetDevicePool' :: GetDevicePool -> 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
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
)
instance Core.ToPath GetDevicePool where
toPath :: GetDevicePool -> ByteString
toPath = ByteString -> GetDevicePool -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetDevicePool where
toQuery :: GetDevicePool -> QueryString
toQuery = QueryString -> GetDevicePool -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDevicePoolResponse = GetDevicePoolResponse'
{
GetDevicePoolResponse -> Maybe DevicePool
devicePool :: Prelude.Maybe DevicePool,
GetDevicePoolResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDevicePoolResponse -> GetDevicePoolResponse -> Bool
(GetDevicePoolResponse -> GetDevicePoolResponse -> Bool)
-> (GetDevicePoolResponse -> GetDevicePoolResponse -> Bool)
-> Eq GetDevicePoolResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevicePoolResponse -> GetDevicePoolResponse -> Bool
$c/= :: GetDevicePoolResponse -> GetDevicePoolResponse -> Bool
== :: GetDevicePoolResponse -> GetDevicePoolResponse -> Bool
$c== :: GetDevicePoolResponse -> GetDevicePoolResponse -> Bool
Prelude.Eq, ReadPrec [GetDevicePoolResponse]
ReadPrec GetDevicePoolResponse
Int -> ReadS GetDevicePoolResponse
ReadS [GetDevicePoolResponse]
(Int -> ReadS GetDevicePoolResponse)
-> ReadS [GetDevicePoolResponse]
-> ReadPrec GetDevicePoolResponse
-> ReadPrec [GetDevicePoolResponse]
-> Read GetDevicePoolResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDevicePoolResponse]
$creadListPrec :: ReadPrec [GetDevicePoolResponse]
readPrec :: ReadPrec GetDevicePoolResponse
$creadPrec :: ReadPrec GetDevicePoolResponse
readList :: ReadS [GetDevicePoolResponse]
$creadList :: ReadS [GetDevicePoolResponse]
readsPrec :: Int -> ReadS GetDevicePoolResponse
$creadsPrec :: Int -> ReadS GetDevicePoolResponse
Prelude.Read, Int -> GetDevicePoolResponse -> ShowS
[GetDevicePoolResponse] -> ShowS
GetDevicePoolResponse -> String
(Int -> GetDevicePoolResponse -> ShowS)
-> (GetDevicePoolResponse -> String)
-> ([GetDevicePoolResponse] -> ShowS)
-> Show GetDevicePoolResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevicePoolResponse] -> ShowS
$cshowList :: [GetDevicePoolResponse] -> ShowS
show :: GetDevicePoolResponse -> String
$cshow :: GetDevicePoolResponse -> String
showsPrec :: Int -> GetDevicePoolResponse -> ShowS
$cshowsPrec :: Int -> GetDevicePoolResponse -> ShowS
Prelude.Show, (forall x. GetDevicePoolResponse -> Rep GetDevicePoolResponse x)
-> (forall x. Rep GetDevicePoolResponse x -> GetDevicePoolResponse)
-> Generic GetDevicePoolResponse
forall x. Rep GetDevicePoolResponse x -> GetDevicePoolResponse
forall x. GetDevicePoolResponse -> Rep GetDevicePoolResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevicePoolResponse x -> GetDevicePoolResponse
$cfrom :: forall x. GetDevicePoolResponse -> Rep GetDevicePoolResponse x
Prelude.Generic)
newGetDevicePoolResponse ::
Prelude.Int ->
GetDevicePoolResponse
newGetDevicePoolResponse :: Int -> GetDevicePoolResponse
newGetDevicePoolResponse Int
pHttpStatus_ =
GetDevicePoolResponse' :: Maybe DevicePool -> Int -> GetDevicePoolResponse
GetDevicePoolResponse'
{ $sel:devicePool:GetDevicePoolResponse' :: Maybe DevicePool
devicePool =
Maybe DevicePool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDevicePoolResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDevicePoolResponse_devicePool :: Lens.Lens' GetDevicePoolResponse (Prelude.Maybe DevicePool)
getDevicePoolResponse_devicePool :: (Maybe DevicePool -> f (Maybe DevicePool))
-> GetDevicePoolResponse -> f GetDevicePoolResponse
getDevicePoolResponse_devicePool = (GetDevicePoolResponse -> Maybe DevicePool)
-> (GetDevicePoolResponse
-> Maybe DevicePool -> GetDevicePoolResponse)
-> Lens
GetDevicePoolResponse
GetDevicePoolResponse
(Maybe DevicePool)
(Maybe DevicePool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicePoolResponse' {Maybe DevicePool
devicePool :: Maybe DevicePool
$sel:devicePool:GetDevicePoolResponse' :: GetDevicePoolResponse -> Maybe DevicePool
devicePool} -> Maybe DevicePool
devicePool) (\s :: GetDevicePoolResponse
s@GetDevicePoolResponse' {} Maybe DevicePool
a -> GetDevicePoolResponse
s {$sel:devicePool:GetDevicePoolResponse' :: Maybe DevicePool
devicePool = Maybe DevicePool
a} :: GetDevicePoolResponse)
getDevicePoolResponse_httpStatus :: Lens.Lens' GetDevicePoolResponse Prelude.Int
getDevicePoolResponse_httpStatus :: (Int -> f Int) -> GetDevicePoolResponse -> f GetDevicePoolResponse
getDevicePoolResponse_httpStatus = (GetDevicePoolResponse -> Int)
-> (GetDevicePoolResponse -> Int -> GetDevicePoolResponse)
-> Lens GetDevicePoolResponse GetDevicePoolResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicePoolResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDevicePoolResponse' :: GetDevicePoolResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDevicePoolResponse
s@GetDevicePoolResponse' {} Int
a -> GetDevicePoolResponse
s {$sel:httpStatus:GetDevicePoolResponse' :: Int
httpStatus = Int
a} :: GetDevicePoolResponse)
instance Prelude.NFData GetDevicePoolResponse