{-# 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.M2.UpdateApplication
(
UpdateApplication (..),
newUpdateApplication,
updateApplication_definition,
updateApplication_description,
updateApplication_applicationId,
updateApplication_currentApplicationVersion,
UpdateApplicationResponse (..),
newUpdateApplicationResponse,
updateApplicationResponse_httpStatus,
updateApplicationResponse_applicationVersion,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateApplication = UpdateApplication'
{
UpdateApplication -> Maybe Definition
definition :: Prelude.Maybe Definition,
UpdateApplication -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateApplication -> Text
applicationId :: Prelude.Text,
UpdateApplication -> Natural
currentApplicationVersion :: Prelude.Natural
}
deriving (UpdateApplication -> UpdateApplication -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateApplication -> UpdateApplication -> Bool
$c/= :: UpdateApplication -> UpdateApplication -> Bool
== :: UpdateApplication -> UpdateApplication -> Bool
$c== :: UpdateApplication -> UpdateApplication -> Bool
Prelude.Eq, ReadPrec [UpdateApplication]
ReadPrec UpdateApplication
Int -> ReadS UpdateApplication
ReadS [UpdateApplication]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateApplication]
$creadListPrec :: ReadPrec [UpdateApplication]
readPrec :: ReadPrec UpdateApplication
$creadPrec :: ReadPrec UpdateApplication
readList :: ReadS [UpdateApplication]
$creadList :: ReadS [UpdateApplication]
readsPrec :: Int -> ReadS UpdateApplication
$creadsPrec :: Int -> ReadS UpdateApplication
Prelude.Read, Int -> UpdateApplication -> ShowS
[UpdateApplication] -> ShowS
UpdateApplication -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateApplication] -> ShowS
$cshowList :: [UpdateApplication] -> ShowS
show :: UpdateApplication -> String
$cshow :: UpdateApplication -> String
showsPrec :: Int -> UpdateApplication -> ShowS
$cshowsPrec :: Int -> UpdateApplication -> ShowS
Prelude.Show, forall x. Rep UpdateApplication x -> UpdateApplication
forall x. UpdateApplication -> Rep UpdateApplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateApplication x -> UpdateApplication
$cfrom :: forall x. UpdateApplication -> Rep UpdateApplication x
Prelude.Generic)
newUpdateApplication ::
Prelude.Text ->
Prelude.Natural ->
UpdateApplication
newUpdateApplication :: Text -> Natural -> UpdateApplication
newUpdateApplication
Text
pApplicationId_
Natural
pCurrentApplicationVersion_ =
UpdateApplication'
{ $sel:definition:UpdateApplication' :: Maybe Definition
definition = forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateApplication' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:applicationId:UpdateApplication' :: Text
applicationId = Text
pApplicationId_,
$sel:currentApplicationVersion:UpdateApplication' :: Natural
currentApplicationVersion =
Natural
pCurrentApplicationVersion_
}
updateApplication_definition :: Lens.Lens' UpdateApplication (Prelude.Maybe Definition)
updateApplication_definition :: Lens' UpdateApplication (Maybe Definition)
updateApplication_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe Definition
definition :: Maybe Definition
$sel:definition:UpdateApplication' :: UpdateApplication -> Maybe Definition
definition} -> Maybe Definition
definition) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe Definition
a -> UpdateApplication
s {$sel:definition:UpdateApplication' :: Maybe Definition
definition = Maybe Definition
a} :: UpdateApplication)
updateApplication_description :: Lens.Lens' UpdateApplication (Prelude.Maybe Prelude.Text)
updateApplication_description :: Lens' UpdateApplication (Maybe Text)
updateApplication_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe Text
description :: Maybe Text
$sel:description:UpdateApplication' :: UpdateApplication -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe Text
a -> UpdateApplication
s {$sel:description:UpdateApplication' :: Maybe Text
description = Maybe Text
a} :: UpdateApplication)
updateApplication_applicationId :: Lens.Lens' UpdateApplication Prelude.Text
updateApplication_applicationId :: Lens' UpdateApplication Text
updateApplication_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Text
applicationId :: Text
$sel:applicationId:UpdateApplication' :: UpdateApplication -> Text
applicationId} -> Text
applicationId) (\s :: UpdateApplication
s@UpdateApplication' {} Text
a -> UpdateApplication
s {$sel:applicationId:UpdateApplication' :: Text
applicationId = Text
a} :: UpdateApplication)
updateApplication_currentApplicationVersion :: Lens.Lens' UpdateApplication Prelude.Natural
updateApplication_currentApplicationVersion :: Lens' UpdateApplication Natural
updateApplication_currentApplicationVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Natural
currentApplicationVersion :: Natural
$sel:currentApplicationVersion:UpdateApplication' :: UpdateApplication -> Natural
currentApplicationVersion} -> Natural
currentApplicationVersion) (\s :: UpdateApplication
s@UpdateApplication' {} Natural
a -> UpdateApplication
s {$sel:currentApplicationVersion:UpdateApplication' :: Natural
currentApplicationVersion = Natural
a} :: UpdateApplication)
instance Core.AWSRequest UpdateApplication where
type
AWSResponse UpdateApplication =
UpdateApplicationResponse
request :: (Service -> Service)
-> UpdateApplication -> Request UpdateApplication
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateApplication)))
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 ->
Int -> Natural -> UpdateApplicationResponse
UpdateApplicationResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"applicationVersion")
)
instance Prelude.Hashable UpdateApplication where
hashWithSalt :: Int -> UpdateApplication -> Int
hashWithSalt Int
_salt UpdateApplication' {Natural
Maybe Text
Maybe Definition
Text
currentApplicationVersion :: Natural
applicationId :: Text
description :: Maybe Text
definition :: Maybe Definition
$sel:currentApplicationVersion:UpdateApplication' :: UpdateApplication -> Natural
$sel:applicationId:UpdateApplication' :: UpdateApplication -> Text
$sel:description:UpdateApplication' :: UpdateApplication -> Maybe Text
$sel:definition:UpdateApplication' :: UpdateApplication -> Maybe Definition
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Definition
definition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
currentApplicationVersion
instance Prelude.NFData UpdateApplication where
rnf :: UpdateApplication -> ()
rnf UpdateApplication' {Natural
Maybe Text
Maybe Definition
Text
currentApplicationVersion :: Natural
applicationId :: Text
description :: Maybe Text
definition :: Maybe Definition
$sel:currentApplicationVersion:UpdateApplication' :: UpdateApplication -> Natural
$sel:applicationId:UpdateApplication' :: UpdateApplication -> Text
$sel:description:UpdateApplication' :: UpdateApplication -> Maybe Text
$sel:definition:UpdateApplication' :: UpdateApplication -> Maybe Definition
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Definition
definition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
currentApplicationVersion
instance Data.ToHeaders UpdateApplication where
toHeaders :: UpdateApplication -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateApplication where
toJSON :: UpdateApplication -> Value
toJSON UpdateApplication' {Natural
Maybe Text
Maybe Definition
Text
currentApplicationVersion :: Natural
applicationId :: Text
description :: Maybe Text
definition :: Maybe Definition
$sel:currentApplicationVersion:UpdateApplication' :: UpdateApplication -> Natural
$sel:applicationId:UpdateApplication' :: UpdateApplication -> Text
$sel:description:UpdateApplication' :: UpdateApplication -> Maybe Text
$sel:definition:UpdateApplication' :: UpdateApplication -> Maybe Definition
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"definition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Definition
definition,
(Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
forall a. a -> Maybe a
Prelude.Just
( Key
"currentApplicationVersion"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
currentApplicationVersion
)
]
)
instance Data.ToPath UpdateApplication where
toPath :: UpdateApplication -> ByteString
toPath UpdateApplication' {Natural
Maybe Text
Maybe Definition
Text
currentApplicationVersion :: Natural
applicationId :: Text
description :: Maybe Text
definition :: Maybe Definition
$sel:currentApplicationVersion:UpdateApplication' :: UpdateApplication -> Natural
$sel:applicationId:UpdateApplication' :: UpdateApplication -> Text
$sel:description:UpdateApplication' :: UpdateApplication -> Maybe Text
$sel:definition:UpdateApplication' :: UpdateApplication -> Maybe Definition
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/applications/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId]
instance Data.ToQuery UpdateApplication where
toQuery :: UpdateApplication -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateApplicationResponse = UpdateApplicationResponse'
{
UpdateApplicationResponse -> Int
httpStatus :: Prelude.Int,
UpdateApplicationResponse -> Natural
applicationVersion :: Prelude.Natural
}
deriving (UpdateApplicationResponse -> UpdateApplicationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateApplicationResponse -> UpdateApplicationResponse -> Bool
$c/= :: UpdateApplicationResponse -> UpdateApplicationResponse -> Bool
== :: UpdateApplicationResponse -> UpdateApplicationResponse -> Bool
$c== :: UpdateApplicationResponse -> UpdateApplicationResponse -> Bool
Prelude.Eq, ReadPrec [UpdateApplicationResponse]
ReadPrec UpdateApplicationResponse
Int -> ReadS UpdateApplicationResponse
ReadS [UpdateApplicationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateApplicationResponse]
$creadListPrec :: ReadPrec [UpdateApplicationResponse]
readPrec :: ReadPrec UpdateApplicationResponse
$creadPrec :: ReadPrec UpdateApplicationResponse
readList :: ReadS [UpdateApplicationResponse]
$creadList :: ReadS [UpdateApplicationResponse]
readsPrec :: Int -> ReadS UpdateApplicationResponse
$creadsPrec :: Int -> ReadS UpdateApplicationResponse
Prelude.Read, Int -> UpdateApplicationResponse -> ShowS
[UpdateApplicationResponse] -> ShowS
UpdateApplicationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateApplicationResponse] -> ShowS
$cshowList :: [UpdateApplicationResponse] -> ShowS
show :: UpdateApplicationResponse -> String
$cshow :: UpdateApplicationResponse -> String
showsPrec :: Int -> UpdateApplicationResponse -> ShowS
$cshowsPrec :: Int -> UpdateApplicationResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateApplicationResponse x -> UpdateApplicationResponse
forall x.
UpdateApplicationResponse -> Rep UpdateApplicationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateApplicationResponse x -> UpdateApplicationResponse
$cfrom :: forall x.
UpdateApplicationResponse -> Rep UpdateApplicationResponse x
Prelude.Generic)
newUpdateApplicationResponse ::
Prelude.Int ->
Prelude.Natural ->
UpdateApplicationResponse
newUpdateApplicationResponse :: Int -> Natural -> UpdateApplicationResponse
newUpdateApplicationResponse
Int
pHttpStatus_
Natural
pApplicationVersion_ =
UpdateApplicationResponse'
{ $sel:httpStatus:UpdateApplicationResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:applicationVersion:UpdateApplicationResponse' :: Natural
applicationVersion = Natural
pApplicationVersion_
}
updateApplicationResponse_httpStatus :: Lens.Lens' UpdateApplicationResponse Prelude.Int
updateApplicationResponse_httpStatus :: Lens' UpdateApplicationResponse Int
updateApplicationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplicationResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateApplicationResponse' :: UpdateApplicationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateApplicationResponse
s@UpdateApplicationResponse' {} Int
a -> UpdateApplicationResponse
s {$sel:httpStatus:UpdateApplicationResponse' :: Int
httpStatus = Int
a} :: UpdateApplicationResponse)
updateApplicationResponse_applicationVersion :: Lens.Lens' UpdateApplicationResponse Prelude.Natural
updateApplicationResponse_applicationVersion :: Lens' UpdateApplicationResponse Natural
updateApplicationResponse_applicationVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplicationResponse' {Natural
applicationVersion :: Natural
$sel:applicationVersion:UpdateApplicationResponse' :: UpdateApplicationResponse -> Natural
applicationVersion} -> Natural
applicationVersion) (\s :: UpdateApplicationResponse
s@UpdateApplicationResponse' {} Natural
a -> UpdateApplicationResponse
s {$sel:applicationVersion:UpdateApplicationResponse' :: Natural
applicationVersion = Natural
a} :: UpdateApplicationResponse)
instance Prelude.NFData UpdateApplicationResponse where
rnf :: UpdateApplicationResponse -> ()
rnf UpdateApplicationResponse' {Int
Natural
applicationVersion :: Natural
httpStatus :: Int
$sel:applicationVersion:UpdateApplicationResponse' :: UpdateApplicationResponse -> Natural
$sel:httpStatus:UpdateApplicationResponse' :: UpdateApplicationResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
applicationVersion