{-# 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.GetUpload
(
GetUpload (..),
newGetUpload,
getUpload_arn,
GetUploadResponse (..),
newGetUploadResponse,
getUploadResponse_upload,
getUploadResponse_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 GetUpload = GetUpload'
{
GetUpload -> Text
arn :: Prelude.Text
}
deriving (GetUpload -> GetUpload -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUpload -> GetUpload -> Bool
$c/= :: GetUpload -> GetUpload -> Bool
== :: GetUpload -> GetUpload -> Bool
$c== :: GetUpload -> GetUpload -> Bool
Prelude.Eq, ReadPrec [GetUpload]
ReadPrec GetUpload
Int -> ReadS GetUpload
ReadS [GetUpload]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUpload]
$creadListPrec :: ReadPrec [GetUpload]
readPrec :: ReadPrec GetUpload
$creadPrec :: ReadPrec GetUpload
readList :: ReadS [GetUpload]
$creadList :: ReadS [GetUpload]
readsPrec :: Int -> ReadS GetUpload
$creadsPrec :: Int -> ReadS GetUpload
Prelude.Read, Int -> GetUpload -> ShowS
[GetUpload] -> ShowS
GetUpload -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUpload] -> ShowS
$cshowList :: [GetUpload] -> ShowS
show :: GetUpload -> String
$cshow :: GetUpload -> String
showsPrec :: Int -> GetUpload -> ShowS
$cshowsPrec :: Int -> GetUpload -> ShowS
Prelude.Show, forall x. Rep GetUpload x -> GetUpload
forall x. GetUpload -> Rep GetUpload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUpload x -> GetUpload
$cfrom :: forall x. GetUpload -> Rep GetUpload x
Prelude.Generic)
newGetUpload ::
Prelude.Text ->
GetUpload
newGetUpload :: Text -> GetUpload
newGetUpload Text
pArn_ = GetUpload' {$sel:arn:GetUpload' :: Text
arn = Text
pArn_}
getUpload_arn :: Lens.Lens' GetUpload Prelude.Text
getUpload_arn :: Lens' GetUpload Text
getUpload_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUpload' {Text
arn :: Text
$sel:arn:GetUpload' :: GetUpload -> Text
arn} -> Text
arn) (\s :: GetUpload
s@GetUpload' {} Text
a -> GetUpload
s {$sel:arn:GetUpload' :: Text
arn = Text
a} :: GetUpload)
instance Core.AWSRequest GetUpload where
type AWSResponse GetUpload = GetUploadResponse
request :: (Service -> Service) -> GetUpload -> Request GetUpload
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 GetUpload
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUpload)))
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 Upload -> Int -> GetUploadResponse
GetUploadResponse'
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
"upload")
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 GetUpload where
hashWithSalt :: Int -> GetUpload -> Int
hashWithSalt Int
_salt GetUpload' {Text
arn :: Text
$sel:arn:GetUpload' :: GetUpload -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
instance Prelude.NFData GetUpload where
rnf :: GetUpload -> ()
rnf GetUpload' {Text
arn :: Text
$sel:arn:GetUpload' :: GetUpload -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
arn
instance Data.ToHeaders GetUpload where
toHeaders :: GetUpload -> 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.GetUpload" ::
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 GetUpload where
toJSON :: GetUpload -> Value
toJSON GetUpload' {Text
arn :: Text
$sel:arn:GetUpload' :: GetUpload -> 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 GetUpload where
toPath :: GetUpload -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetUpload where
toQuery :: GetUpload -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetUploadResponse = GetUploadResponse'
{
GetUploadResponse -> Maybe Upload
upload :: Prelude.Maybe Upload,
GetUploadResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetUploadResponse -> GetUploadResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUploadResponse -> GetUploadResponse -> Bool
$c/= :: GetUploadResponse -> GetUploadResponse -> Bool
== :: GetUploadResponse -> GetUploadResponse -> Bool
$c== :: GetUploadResponse -> GetUploadResponse -> Bool
Prelude.Eq, Int -> GetUploadResponse -> ShowS
[GetUploadResponse] -> ShowS
GetUploadResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUploadResponse] -> ShowS
$cshowList :: [GetUploadResponse] -> ShowS
show :: GetUploadResponse -> String
$cshow :: GetUploadResponse -> String
showsPrec :: Int -> GetUploadResponse -> ShowS
$cshowsPrec :: Int -> GetUploadResponse -> ShowS
Prelude.Show, forall x. Rep GetUploadResponse x -> GetUploadResponse
forall x. GetUploadResponse -> Rep GetUploadResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUploadResponse x -> GetUploadResponse
$cfrom :: forall x. GetUploadResponse -> Rep GetUploadResponse x
Prelude.Generic)
newGetUploadResponse ::
Prelude.Int ->
GetUploadResponse
newGetUploadResponse :: Int -> GetUploadResponse
newGetUploadResponse Int
pHttpStatus_ =
GetUploadResponse'
{ $sel:upload:GetUploadResponse' :: Maybe Upload
upload = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUploadResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUploadResponse_upload :: Lens.Lens' GetUploadResponse (Prelude.Maybe Upload)
getUploadResponse_upload :: Lens' GetUploadResponse (Maybe Upload)
getUploadResponse_upload = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUploadResponse' {Maybe Upload
upload :: Maybe Upload
$sel:upload:GetUploadResponse' :: GetUploadResponse -> Maybe Upload
upload} -> Maybe Upload
upload) (\s :: GetUploadResponse
s@GetUploadResponse' {} Maybe Upload
a -> GetUploadResponse
s {$sel:upload:GetUploadResponse' :: Maybe Upload
upload = Maybe Upload
a} :: GetUploadResponse)
getUploadResponse_httpStatus :: Lens.Lens' GetUploadResponse Prelude.Int
getUploadResponse_httpStatus :: Lens' GetUploadResponse Int
getUploadResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUploadResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetUploadResponse' :: GetUploadResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetUploadResponse
s@GetUploadResponse' {} Int
a -> GetUploadResponse
s {$sel:httpStatus:GetUploadResponse' :: Int
httpStatus = Int
a} :: GetUploadResponse)
instance Prelude.NFData GetUploadResponse where
rnf :: GetUploadResponse -> ()
rnf GetUploadResponse' {Int
Maybe Upload
httpStatus :: Int
upload :: Maybe Upload
$sel:httpStatus:GetUploadResponse' :: GetUploadResponse -> Int
$sel:upload:GetUploadResponse' :: GetUploadResponse -> Maybe Upload
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Upload
upload
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus