{-# 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.UpdateDeviceInstance
(
UpdateDeviceInstance (..),
newUpdateDeviceInstance,
updateDeviceInstance_profileArn,
updateDeviceInstance_labels,
updateDeviceInstance_arn,
UpdateDeviceInstanceResponse (..),
newUpdateDeviceInstanceResponse,
updateDeviceInstanceResponse_deviceInstance,
updateDeviceInstanceResponse_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 UpdateDeviceInstance = UpdateDeviceInstance'
{
UpdateDeviceInstance -> Maybe Text
profileArn :: Prelude.Maybe Prelude.Text,
UpdateDeviceInstance -> Maybe [Text]
labels :: Prelude.Maybe [Prelude.Text],
UpdateDeviceInstance -> Text
arn :: Prelude.Text
}
deriving (UpdateDeviceInstance -> UpdateDeviceInstance -> Bool
(UpdateDeviceInstance -> UpdateDeviceInstance -> Bool)
-> (UpdateDeviceInstance -> UpdateDeviceInstance -> Bool)
-> Eq UpdateDeviceInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceInstance -> UpdateDeviceInstance -> Bool
$c/= :: UpdateDeviceInstance -> UpdateDeviceInstance -> Bool
== :: UpdateDeviceInstance -> UpdateDeviceInstance -> Bool
$c== :: UpdateDeviceInstance -> UpdateDeviceInstance -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceInstance]
ReadPrec UpdateDeviceInstance
Int -> ReadS UpdateDeviceInstance
ReadS [UpdateDeviceInstance]
(Int -> ReadS UpdateDeviceInstance)
-> ReadS [UpdateDeviceInstance]
-> ReadPrec UpdateDeviceInstance
-> ReadPrec [UpdateDeviceInstance]
-> Read UpdateDeviceInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceInstance]
$creadListPrec :: ReadPrec [UpdateDeviceInstance]
readPrec :: ReadPrec UpdateDeviceInstance
$creadPrec :: ReadPrec UpdateDeviceInstance
readList :: ReadS [UpdateDeviceInstance]
$creadList :: ReadS [UpdateDeviceInstance]
readsPrec :: Int -> ReadS UpdateDeviceInstance
$creadsPrec :: Int -> ReadS UpdateDeviceInstance
Prelude.Read, Int -> UpdateDeviceInstance -> ShowS
[UpdateDeviceInstance] -> ShowS
UpdateDeviceInstance -> String
(Int -> UpdateDeviceInstance -> ShowS)
-> (UpdateDeviceInstance -> String)
-> ([UpdateDeviceInstance] -> ShowS)
-> Show UpdateDeviceInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceInstance] -> ShowS
$cshowList :: [UpdateDeviceInstance] -> ShowS
show :: UpdateDeviceInstance -> String
$cshow :: UpdateDeviceInstance -> String
showsPrec :: Int -> UpdateDeviceInstance -> ShowS
$cshowsPrec :: Int -> UpdateDeviceInstance -> ShowS
Prelude.Show, (forall x. UpdateDeviceInstance -> Rep UpdateDeviceInstance x)
-> (forall x. Rep UpdateDeviceInstance x -> UpdateDeviceInstance)
-> Generic UpdateDeviceInstance
forall x. Rep UpdateDeviceInstance x -> UpdateDeviceInstance
forall x. UpdateDeviceInstance -> Rep UpdateDeviceInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDeviceInstance x -> UpdateDeviceInstance
$cfrom :: forall x. UpdateDeviceInstance -> Rep UpdateDeviceInstance x
Prelude.Generic)
newUpdateDeviceInstance ::
Prelude.Text ->
UpdateDeviceInstance
newUpdateDeviceInstance :: Text -> UpdateDeviceInstance
newUpdateDeviceInstance Text
pArn_ =
UpdateDeviceInstance' :: Maybe Text -> Maybe [Text] -> Text -> UpdateDeviceInstance
UpdateDeviceInstance'
{ $sel:profileArn:UpdateDeviceInstance' :: Maybe Text
profileArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:labels:UpdateDeviceInstance' :: Maybe [Text]
labels = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:arn:UpdateDeviceInstance' :: Text
arn = Text
pArn_
}
updateDeviceInstance_profileArn :: Lens.Lens' UpdateDeviceInstance (Prelude.Maybe Prelude.Text)
updateDeviceInstance_profileArn :: (Maybe Text -> f (Maybe Text))
-> UpdateDeviceInstance -> f UpdateDeviceInstance
updateDeviceInstance_profileArn = (UpdateDeviceInstance -> Maybe Text)
-> (UpdateDeviceInstance -> Maybe Text -> UpdateDeviceInstance)
-> Lens
UpdateDeviceInstance UpdateDeviceInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceInstance' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:UpdateDeviceInstance' :: UpdateDeviceInstance -> Maybe Text
profileArn} -> Maybe Text
profileArn) (\s :: UpdateDeviceInstance
s@UpdateDeviceInstance' {} Maybe Text
a -> UpdateDeviceInstance
s {$sel:profileArn:UpdateDeviceInstance' :: Maybe Text
profileArn = Maybe Text
a} :: UpdateDeviceInstance)
updateDeviceInstance_labels :: Lens.Lens' UpdateDeviceInstance (Prelude.Maybe [Prelude.Text])
updateDeviceInstance_labels :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateDeviceInstance -> f UpdateDeviceInstance
updateDeviceInstance_labels = (UpdateDeviceInstance -> Maybe [Text])
-> (UpdateDeviceInstance -> Maybe [Text] -> UpdateDeviceInstance)
-> Lens
UpdateDeviceInstance
UpdateDeviceInstance
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceInstance' {Maybe [Text]
labels :: Maybe [Text]
$sel:labels:UpdateDeviceInstance' :: UpdateDeviceInstance -> Maybe [Text]
labels} -> Maybe [Text]
labels) (\s :: UpdateDeviceInstance
s@UpdateDeviceInstance' {} Maybe [Text]
a -> UpdateDeviceInstance
s {$sel:labels:UpdateDeviceInstance' :: Maybe [Text]
labels = Maybe [Text]
a} :: UpdateDeviceInstance) ((Maybe [Text] -> f (Maybe [Text]))
-> UpdateDeviceInstance -> f UpdateDeviceInstance)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateDeviceInstance
-> f UpdateDeviceInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateDeviceInstance_arn :: Lens.Lens' UpdateDeviceInstance Prelude.Text
updateDeviceInstance_arn :: (Text -> f Text) -> UpdateDeviceInstance -> f UpdateDeviceInstance
updateDeviceInstance_arn = (UpdateDeviceInstance -> Text)
-> (UpdateDeviceInstance -> Text -> UpdateDeviceInstance)
-> Lens UpdateDeviceInstance UpdateDeviceInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceInstance' {Text
arn :: Text
$sel:arn:UpdateDeviceInstance' :: UpdateDeviceInstance -> Text
arn} -> Text
arn) (\s :: UpdateDeviceInstance
s@UpdateDeviceInstance' {} Text
a -> UpdateDeviceInstance
s {$sel:arn:UpdateDeviceInstance' :: Text
arn = Text
a} :: UpdateDeviceInstance)
instance Core.AWSRequest UpdateDeviceInstance where
type
AWSResponse UpdateDeviceInstance =
UpdateDeviceInstanceResponse
request :: UpdateDeviceInstance -> Request UpdateDeviceInstance
request = Service -> UpdateDeviceInstance -> Request UpdateDeviceInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDeviceInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceInstance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDeviceInstance))
-> Logger
-> Service
-> Proxy UpdateDeviceInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceInstance)))
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 DeviceInstance -> Int -> UpdateDeviceInstanceResponse
UpdateDeviceInstanceResponse'
(Maybe DeviceInstance -> Int -> UpdateDeviceInstanceResponse)
-> Either String (Maybe DeviceInstance)
-> Either String (Int -> UpdateDeviceInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DeviceInstance)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deviceInstance")
Either String (Int -> UpdateDeviceInstanceResponse)
-> Either String Int -> Either String UpdateDeviceInstanceResponse
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 UpdateDeviceInstance
instance Prelude.NFData UpdateDeviceInstance
instance Core.ToHeaders UpdateDeviceInstance where
toHeaders :: UpdateDeviceInstance -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDeviceInstance -> 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.UpdateDeviceInstance" ::
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 UpdateDeviceInstance where
toJSON :: UpdateDeviceInstance -> Value
toJSON UpdateDeviceInstance' {Maybe [Text]
Maybe Text
Text
arn :: Text
labels :: Maybe [Text]
profileArn :: Maybe Text
$sel:arn:UpdateDeviceInstance' :: UpdateDeviceInstance -> Text
$sel:labels:UpdateDeviceInstance' :: UpdateDeviceInstance -> Maybe [Text]
$sel:profileArn:UpdateDeviceInstance' :: UpdateDeviceInstance -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"profileArn" 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
profileArn,
(Text
"labels" 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]
labels,
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 UpdateDeviceInstance where
toPath :: UpdateDeviceInstance -> ByteString
toPath = ByteString -> UpdateDeviceInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateDeviceInstance where
toQuery :: UpdateDeviceInstance -> QueryString
toQuery = QueryString -> UpdateDeviceInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDeviceInstanceResponse = UpdateDeviceInstanceResponse'
{
UpdateDeviceInstanceResponse -> Maybe DeviceInstance
deviceInstance :: Prelude.Maybe DeviceInstance,
UpdateDeviceInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool
(UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool)
-> (UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool)
-> Eq UpdateDeviceInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool
$c/= :: UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool
== :: UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool
$c== :: UpdateDeviceInstanceResponse
-> UpdateDeviceInstanceResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceInstanceResponse]
ReadPrec UpdateDeviceInstanceResponse
Int -> ReadS UpdateDeviceInstanceResponse
ReadS [UpdateDeviceInstanceResponse]
(Int -> ReadS UpdateDeviceInstanceResponse)
-> ReadS [UpdateDeviceInstanceResponse]
-> ReadPrec UpdateDeviceInstanceResponse
-> ReadPrec [UpdateDeviceInstanceResponse]
-> Read UpdateDeviceInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceInstanceResponse]
$creadListPrec :: ReadPrec [UpdateDeviceInstanceResponse]
readPrec :: ReadPrec UpdateDeviceInstanceResponse
$creadPrec :: ReadPrec UpdateDeviceInstanceResponse
readList :: ReadS [UpdateDeviceInstanceResponse]
$creadList :: ReadS [UpdateDeviceInstanceResponse]
readsPrec :: Int -> ReadS UpdateDeviceInstanceResponse
$creadsPrec :: Int -> ReadS UpdateDeviceInstanceResponse
Prelude.Read, Int -> UpdateDeviceInstanceResponse -> ShowS
[UpdateDeviceInstanceResponse] -> ShowS
UpdateDeviceInstanceResponse -> String
(Int -> UpdateDeviceInstanceResponse -> ShowS)
-> (UpdateDeviceInstanceResponse -> String)
-> ([UpdateDeviceInstanceResponse] -> ShowS)
-> Show UpdateDeviceInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceInstanceResponse] -> ShowS
$cshowList :: [UpdateDeviceInstanceResponse] -> ShowS
show :: UpdateDeviceInstanceResponse -> String
$cshow :: UpdateDeviceInstanceResponse -> String
showsPrec :: Int -> UpdateDeviceInstanceResponse -> ShowS
$cshowsPrec :: Int -> UpdateDeviceInstanceResponse -> ShowS
Prelude.Show, (forall x.
UpdateDeviceInstanceResponse -> Rep UpdateDeviceInstanceResponse x)
-> (forall x.
Rep UpdateDeviceInstanceResponse x -> UpdateDeviceInstanceResponse)
-> Generic UpdateDeviceInstanceResponse
forall x.
Rep UpdateDeviceInstanceResponse x -> UpdateDeviceInstanceResponse
forall x.
UpdateDeviceInstanceResponse -> Rep UpdateDeviceInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDeviceInstanceResponse x -> UpdateDeviceInstanceResponse
$cfrom :: forall x.
UpdateDeviceInstanceResponse -> Rep UpdateDeviceInstanceResponse x
Prelude.Generic)
newUpdateDeviceInstanceResponse ::
Prelude.Int ->
UpdateDeviceInstanceResponse
newUpdateDeviceInstanceResponse :: Int -> UpdateDeviceInstanceResponse
newUpdateDeviceInstanceResponse Int
pHttpStatus_ =
UpdateDeviceInstanceResponse' :: Maybe DeviceInstance -> Int -> UpdateDeviceInstanceResponse
UpdateDeviceInstanceResponse'
{ $sel:deviceInstance:UpdateDeviceInstanceResponse' :: Maybe DeviceInstance
deviceInstance =
Maybe DeviceInstance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateDeviceInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateDeviceInstanceResponse_deviceInstance :: Lens.Lens' UpdateDeviceInstanceResponse (Prelude.Maybe DeviceInstance)
updateDeviceInstanceResponse_deviceInstance :: (Maybe DeviceInstance -> f (Maybe DeviceInstance))
-> UpdateDeviceInstanceResponse -> f UpdateDeviceInstanceResponse
updateDeviceInstanceResponse_deviceInstance = (UpdateDeviceInstanceResponse -> Maybe DeviceInstance)
-> (UpdateDeviceInstanceResponse
-> Maybe DeviceInstance -> UpdateDeviceInstanceResponse)
-> Lens
UpdateDeviceInstanceResponse
UpdateDeviceInstanceResponse
(Maybe DeviceInstance)
(Maybe DeviceInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceInstanceResponse' {Maybe DeviceInstance
deviceInstance :: Maybe DeviceInstance
$sel:deviceInstance:UpdateDeviceInstanceResponse' :: UpdateDeviceInstanceResponse -> Maybe DeviceInstance
deviceInstance} -> Maybe DeviceInstance
deviceInstance) (\s :: UpdateDeviceInstanceResponse
s@UpdateDeviceInstanceResponse' {} Maybe DeviceInstance
a -> UpdateDeviceInstanceResponse
s {$sel:deviceInstance:UpdateDeviceInstanceResponse' :: Maybe DeviceInstance
deviceInstance = Maybe DeviceInstance
a} :: UpdateDeviceInstanceResponse)
updateDeviceInstanceResponse_httpStatus :: Lens.Lens' UpdateDeviceInstanceResponse Prelude.Int
updateDeviceInstanceResponse_httpStatus :: (Int -> f Int)
-> UpdateDeviceInstanceResponse -> f UpdateDeviceInstanceResponse
updateDeviceInstanceResponse_httpStatus = (UpdateDeviceInstanceResponse -> Int)
-> (UpdateDeviceInstanceResponse
-> Int -> UpdateDeviceInstanceResponse)
-> Lens
UpdateDeviceInstanceResponse UpdateDeviceInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDeviceInstanceResponse' :: UpdateDeviceInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDeviceInstanceResponse
s@UpdateDeviceInstanceResponse' {} Int
a -> UpdateDeviceInstanceResponse
s {$sel:httpStatus:UpdateDeviceInstanceResponse' :: Int
httpStatus = Int
a} :: UpdateDeviceInstanceResponse)
instance Prelude.NFData UpdateDeviceInstanceResponse