{-# 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.UpdateUpload
(
UpdateUpload (..),
newUpdateUpload,
updateUpload_editContent,
updateUpload_name,
updateUpload_contentType,
updateUpload_arn,
UpdateUploadResponse (..),
newUpdateUploadResponse,
updateUploadResponse_upload,
updateUploadResponse_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 UpdateUpload = UpdateUpload'
{
UpdateUpload -> Maybe Bool
editContent :: Prelude.Maybe Prelude.Bool,
UpdateUpload -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateUpload -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
UpdateUpload -> Text
arn :: Prelude.Text
}
deriving (UpdateUpload -> UpdateUpload -> Bool
(UpdateUpload -> UpdateUpload -> Bool)
-> (UpdateUpload -> UpdateUpload -> Bool) -> Eq UpdateUpload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUpload -> UpdateUpload -> Bool
$c/= :: UpdateUpload -> UpdateUpload -> Bool
== :: UpdateUpload -> UpdateUpload -> Bool
$c== :: UpdateUpload -> UpdateUpload -> Bool
Prelude.Eq, ReadPrec [UpdateUpload]
ReadPrec UpdateUpload
Int -> ReadS UpdateUpload
ReadS [UpdateUpload]
(Int -> ReadS UpdateUpload)
-> ReadS [UpdateUpload]
-> ReadPrec UpdateUpload
-> ReadPrec [UpdateUpload]
-> Read UpdateUpload
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUpload]
$creadListPrec :: ReadPrec [UpdateUpload]
readPrec :: ReadPrec UpdateUpload
$creadPrec :: ReadPrec UpdateUpload
readList :: ReadS [UpdateUpload]
$creadList :: ReadS [UpdateUpload]
readsPrec :: Int -> ReadS UpdateUpload
$creadsPrec :: Int -> ReadS UpdateUpload
Prelude.Read, Int -> UpdateUpload -> ShowS
[UpdateUpload] -> ShowS
UpdateUpload -> String
(Int -> UpdateUpload -> ShowS)
-> (UpdateUpload -> String)
-> ([UpdateUpload] -> ShowS)
-> Show UpdateUpload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUpload] -> ShowS
$cshowList :: [UpdateUpload] -> ShowS
show :: UpdateUpload -> String
$cshow :: UpdateUpload -> String
showsPrec :: Int -> UpdateUpload -> ShowS
$cshowsPrec :: Int -> UpdateUpload -> ShowS
Prelude.Show, (forall x. UpdateUpload -> Rep UpdateUpload x)
-> (forall x. Rep UpdateUpload x -> UpdateUpload)
-> Generic UpdateUpload
forall x. Rep UpdateUpload x -> UpdateUpload
forall x. UpdateUpload -> Rep UpdateUpload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUpload x -> UpdateUpload
$cfrom :: forall x. UpdateUpload -> Rep UpdateUpload x
Prelude.Generic)
newUpdateUpload ::
Prelude.Text ->
UpdateUpload
newUpdateUpload :: Text -> UpdateUpload
newUpdateUpload Text
pArn_ =
UpdateUpload' :: Maybe Bool -> Maybe Text -> Maybe Text -> Text -> UpdateUpload
UpdateUpload'
{ $sel:editContent:UpdateUpload' :: Maybe Bool
editContent = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateUpload' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contentType:UpdateUpload' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:arn:UpdateUpload' :: Text
arn = Text
pArn_
}
updateUpload_editContent :: Lens.Lens' UpdateUpload (Prelude.Maybe Prelude.Bool)
updateUpload_editContent :: (Maybe Bool -> f (Maybe Bool)) -> UpdateUpload -> f UpdateUpload
updateUpload_editContent = (UpdateUpload -> Maybe Bool)
-> (UpdateUpload -> Maybe Bool -> UpdateUpload)
-> Lens UpdateUpload UpdateUpload (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUpload' {Maybe Bool
editContent :: Maybe Bool
$sel:editContent:UpdateUpload' :: UpdateUpload -> Maybe Bool
editContent} -> Maybe Bool
editContent) (\s :: UpdateUpload
s@UpdateUpload' {} Maybe Bool
a -> UpdateUpload
s {$sel:editContent:UpdateUpload' :: Maybe Bool
editContent = Maybe Bool
a} :: UpdateUpload)
updateUpload_name :: Lens.Lens' UpdateUpload (Prelude.Maybe Prelude.Text)
updateUpload_name :: (Maybe Text -> f (Maybe Text)) -> UpdateUpload -> f UpdateUpload
updateUpload_name = (UpdateUpload -> Maybe Text)
-> (UpdateUpload -> Maybe Text -> UpdateUpload)
-> Lens UpdateUpload UpdateUpload (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUpload' {Maybe Text
name :: Maybe Text
$sel:name:UpdateUpload' :: UpdateUpload -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateUpload
s@UpdateUpload' {} Maybe Text
a -> UpdateUpload
s {$sel:name:UpdateUpload' :: Maybe Text
name = Maybe Text
a} :: UpdateUpload)
updateUpload_contentType :: Lens.Lens' UpdateUpload (Prelude.Maybe Prelude.Text)
updateUpload_contentType :: (Maybe Text -> f (Maybe Text)) -> UpdateUpload -> f UpdateUpload
updateUpload_contentType = (UpdateUpload -> Maybe Text)
-> (UpdateUpload -> Maybe Text -> UpdateUpload)
-> Lens UpdateUpload UpdateUpload (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUpload' {Maybe Text
contentType :: Maybe Text
$sel:contentType:UpdateUpload' :: UpdateUpload -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: UpdateUpload
s@UpdateUpload' {} Maybe Text
a -> UpdateUpload
s {$sel:contentType:UpdateUpload' :: Maybe Text
contentType = Maybe Text
a} :: UpdateUpload)
updateUpload_arn :: Lens.Lens' UpdateUpload Prelude.Text
updateUpload_arn :: (Text -> f Text) -> UpdateUpload -> f UpdateUpload
updateUpload_arn = (UpdateUpload -> Text)
-> (UpdateUpload -> Text -> UpdateUpload)
-> Lens UpdateUpload UpdateUpload Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUpload' {Text
arn :: Text
$sel:arn:UpdateUpload' :: UpdateUpload -> Text
arn} -> Text
arn) (\s :: UpdateUpload
s@UpdateUpload' {} Text
a -> UpdateUpload
s {$sel:arn:UpdateUpload' :: Text
arn = Text
a} :: UpdateUpload)
instance Core.AWSRequest UpdateUpload where
type AWSResponse UpdateUpload = UpdateUploadResponse
request :: UpdateUpload -> Request UpdateUpload
request = Service -> UpdateUpload -> Request UpdateUpload
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateUpload
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUpload)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateUpload))
-> Logger
-> Service
-> Proxy UpdateUpload
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUpload)))
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 Upload -> Int -> UpdateUploadResponse
UpdateUploadResponse'
(Maybe Upload -> Int -> UpdateUploadResponse)
-> Either String (Maybe Upload)
-> Either String (Int -> UpdateUploadResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Upload)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"upload")
Either String (Int -> UpdateUploadResponse)
-> Either String Int -> Either String UpdateUploadResponse
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 UpdateUpload
instance Prelude.NFData UpdateUpload
instance Core.ToHeaders UpdateUpload where
toHeaders :: UpdateUpload -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateUpload -> 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.UpdateUpload" ::
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 UpdateUpload where
toJSON :: UpdateUpload -> Value
toJSON UpdateUpload' {Maybe Bool
Maybe Text
Text
arn :: Text
contentType :: Maybe Text
name :: Maybe Text
editContent :: Maybe Bool
$sel:arn:UpdateUpload' :: UpdateUpload -> Text
$sel:contentType:UpdateUpload' :: UpdateUpload -> Maybe Text
$sel:name:UpdateUpload' :: UpdateUpload -> Maybe Text
$sel:editContent:UpdateUpload' :: UpdateUpload -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"editContent" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
editContent,
(Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Text
"contentType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
contentType,
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 UpdateUpload where
toPath :: UpdateUpload -> ByteString
toPath = ByteString -> UpdateUpload -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateUpload where
toQuery :: UpdateUpload -> QueryString
toQuery = QueryString -> UpdateUpload -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateUploadResponse = UpdateUploadResponse'
{
UpdateUploadResponse -> Maybe Upload
upload :: Prelude.Maybe Upload,
UpdateUploadResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateUploadResponse -> UpdateUploadResponse -> Bool
(UpdateUploadResponse -> UpdateUploadResponse -> Bool)
-> (UpdateUploadResponse -> UpdateUploadResponse -> Bool)
-> Eq UpdateUploadResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUploadResponse -> UpdateUploadResponse -> Bool
$c/= :: UpdateUploadResponse -> UpdateUploadResponse -> Bool
== :: UpdateUploadResponse -> UpdateUploadResponse -> Bool
$c== :: UpdateUploadResponse -> UpdateUploadResponse -> Bool
Prelude.Eq, Int -> UpdateUploadResponse -> ShowS
[UpdateUploadResponse] -> ShowS
UpdateUploadResponse -> String
(Int -> UpdateUploadResponse -> ShowS)
-> (UpdateUploadResponse -> String)
-> ([UpdateUploadResponse] -> ShowS)
-> Show UpdateUploadResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUploadResponse] -> ShowS
$cshowList :: [UpdateUploadResponse] -> ShowS
show :: UpdateUploadResponse -> String
$cshow :: UpdateUploadResponse -> String
showsPrec :: Int -> UpdateUploadResponse -> ShowS
$cshowsPrec :: Int -> UpdateUploadResponse -> ShowS
Prelude.Show, (forall x. UpdateUploadResponse -> Rep UpdateUploadResponse x)
-> (forall x. Rep UpdateUploadResponse x -> UpdateUploadResponse)
-> Generic UpdateUploadResponse
forall x. Rep UpdateUploadResponse x -> UpdateUploadResponse
forall x. UpdateUploadResponse -> Rep UpdateUploadResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUploadResponse x -> UpdateUploadResponse
$cfrom :: forall x. UpdateUploadResponse -> Rep UpdateUploadResponse x
Prelude.Generic)
newUpdateUploadResponse ::
Prelude.Int ->
UpdateUploadResponse
newUpdateUploadResponse :: Int -> UpdateUploadResponse
newUpdateUploadResponse Int
pHttpStatus_ =
UpdateUploadResponse' :: Maybe Upload -> Int -> UpdateUploadResponse
UpdateUploadResponse'
{ $sel:upload:UpdateUploadResponse' :: Maybe Upload
upload = Maybe Upload
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateUploadResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateUploadResponse_upload :: Lens.Lens' UpdateUploadResponse (Prelude.Maybe Upload)
updateUploadResponse_upload :: (Maybe Upload -> f (Maybe Upload))
-> UpdateUploadResponse -> f UpdateUploadResponse
updateUploadResponse_upload = (UpdateUploadResponse -> Maybe Upload)
-> (UpdateUploadResponse -> Maybe Upload -> UpdateUploadResponse)
-> Lens
UpdateUploadResponse
UpdateUploadResponse
(Maybe Upload)
(Maybe Upload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUploadResponse' {Maybe Upload
upload :: Maybe Upload
$sel:upload:UpdateUploadResponse' :: UpdateUploadResponse -> Maybe Upload
upload} -> Maybe Upload
upload) (\s :: UpdateUploadResponse
s@UpdateUploadResponse' {} Maybe Upload
a -> UpdateUploadResponse
s {$sel:upload:UpdateUploadResponse' :: Maybe Upload
upload = Maybe Upload
a} :: UpdateUploadResponse)
updateUploadResponse_httpStatus :: Lens.Lens' UpdateUploadResponse Prelude.Int
updateUploadResponse_httpStatus :: (Int -> f Int) -> UpdateUploadResponse -> f UpdateUploadResponse
updateUploadResponse_httpStatus = (UpdateUploadResponse -> Int)
-> (UpdateUploadResponse -> Int -> UpdateUploadResponse)
-> Lens UpdateUploadResponse UpdateUploadResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUploadResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateUploadResponse' :: UpdateUploadResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateUploadResponse
s@UpdateUploadResponse' {} Int
a -> UpdateUploadResponse
s {$sel:httpStatus:UpdateUploadResponse' :: Int
httpStatus = Int
a} :: UpdateUploadResponse)
instance Prelude.NFData UpdateUploadResponse