{-# 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.KinesisAnalytics.UpdateApplication
(
UpdateApplication (..),
newUpdateApplication,
updateApplication_applicationName,
updateApplication_currentApplicationVersionId,
updateApplication_applicationUpdate,
UpdateApplicationResponse (..),
newUpdateApplicationResponse,
updateApplicationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalytics.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 UpdateApplication = UpdateApplication'
{
UpdateApplication -> Text
applicationName :: Prelude.Text,
UpdateApplication -> Natural
currentApplicationVersionId :: Prelude.Natural,
UpdateApplication -> ApplicationUpdate
applicationUpdate :: ApplicationUpdate
}
deriving (UpdateApplication -> UpdateApplication -> Bool
(UpdateApplication -> UpdateApplication -> Bool)
-> (UpdateApplication -> UpdateApplication -> Bool)
-> Eq UpdateApplication
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]
(Int -> ReadS UpdateApplication)
-> ReadS [UpdateApplication]
-> ReadPrec UpdateApplication
-> ReadPrec [UpdateApplication]
-> Read 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
(Int -> UpdateApplication -> ShowS)
-> (UpdateApplication -> String)
-> ([UpdateApplication] -> ShowS)
-> Show UpdateApplication
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. UpdateApplication -> Rep UpdateApplication x)
-> (forall x. Rep UpdateApplication x -> UpdateApplication)
-> Generic UpdateApplication
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 ->
ApplicationUpdate ->
UpdateApplication
newUpdateApplication :: Text -> Natural -> ApplicationUpdate -> UpdateApplication
newUpdateApplication
Text
pApplicationName_
Natural
pCurrentApplicationVersionId_
ApplicationUpdate
pApplicationUpdate_ =
UpdateApplication' :: Text -> Natural -> ApplicationUpdate -> UpdateApplication
UpdateApplication'
{ $sel:applicationName:UpdateApplication' :: Text
applicationName =
Text
pApplicationName_,
$sel:currentApplicationVersionId:UpdateApplication' :: Natural
currentApplicationVersionId =
Natural
pCurrentApplicationVersionId_,
$sel:applicationUpdate:UpdateApplication' :: ApplicationUpdate
applicationUpdate = ApplicationUpdate
pApplicationUpdate_
}
updateApplication_applicationName :: Lens.Lens' UpdateApplication Prelude.Text
updateApplication_applicationName :: (Text -> f Text) -> UpdateApplication -> f UpdateApplication
updateApplication_applicationName = (UpdateApplication -> Text)
-> (UpdateApplication -> Text -> UpdateApplication)
-> Lens UpdateApplication UpdateApplication Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Text
applicationName :: Text
$sel:applicationName:UpdateApplication' :: UpdateApplication -> Text
applicationName} -> Text
applicationName) (\s :: UpdateApplication
s@UpdateApplication' {} Text
a -> UpdateApplication
s {$sel:applicationName:UpdateApplication' :: Text
applicationName = Text
a} :: UpdateApplication)
updateApplication_currentApplicationVersionId :: Lens.Lens' UpdateApplication Prelude.Natural
updateApplication_currentApplicationVersionId :: (Natural -> f Natural) -> UpdateApplication -> f UpdateApplication
updateApplication_currentApplicationVersionId = (UpdateApplication -> Natural)
-> (UpdateApplication -> Natural -> UpdateApplication)
-> Lens UpdateApplication UpdateApplication Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Natural
currentApplicationVersionId :: Natural
$sel:currentApplicationVersionId:UpdateApplication' :: UpdateApplication -> Natural
currentApplicationVersionId} -> Natural
currentApplicationVersionId) (\s :: UpdateApplication
s@UpdateApplication' {} Natural
a -> UpdateApplication
s {$sel:currentApplicationVersionId:UpdateApplication' :: Natural
currentApplicationVersionId = Natural
a} :: UpdateApplication)
updateApplication_applicationUpdate :: Lens.Lens' UpdateApplication ApplicationUpdate
updateApplication_applicationUpdate :: (ApplicationUpdate -> f ApplicationUpdate)
-> UpdateApplication -> f UpdateApplication
updateApplication_applicationUpdate = (UpdateApplication -> ApplicationUpdate)
-> (UpdateApplication -> ApplicationUpdate -> UpdateApplication)
-> Lens
UpdateApplication
UpdateApplication
ApplicationUpdate
ApplicationUpdate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {ApplicationUpdate
applicationUpdate :: ApplicationUpdate
$sel:applicationUpdate:UpdateApplication' :: UpdateApplication -> ApplicationUpdate
applicationUpdate} -> ApplicationUpdate
applicationUpdate) (\s :: UpdateApplication
s@UpdateApplication' {} ApplicationUpdate
a -> UpdateApplication
s {$sel:applicationUpdate:UpdateApplication' :: ApplicationUpdate
applicationUpdate = ApplicationUpdate
a} :: UpdateApplication)
instance Core.AWSRequest UpdateApplication where
type
AWSResponse UpdateApplication =
UpdateApplicationResponse
request :: UpdateApplication -> Request UpdateApplication
request = Service -> UpdateApplication -> Request UpdateApplication
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateApplication)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateApplication))
-> Logger
-> Service
-> Proxy UpdateApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateApplication)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateApplicationResponse
UpdateApplicationResponse'
(Int -> UpdateApplicationResponse)
-> Either String Int -> Either String UpdateApplicationResponse
forall (f :: * -> *) a b. Functor 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 UpdateApplication
instance Prelude.NFData UpdateApplication
instance Core.ToHeaders UpdateApplication where
toHeaders :: UpdateApplication -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateApplication -> 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
"KinesisAnalytics_20150814.UpdateApplication" ::
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 UpdateApplication where
toJSON :: UpdateApplication -> Value
toJSON UpdateApplication' {Natural
Text
ApplicationUpdate
applicationUpdate :: ApplicationUpdate
currentApplicationVersionId :: Natural
applicationName :: Text
$sel:applicationUpdate:UpdateApplication' :: UpdateApplication -> ApplicationUpdate
$sel:currentApplicationVersionId:UpdateApplication' :: UpdateApplication -> Natural
$sel:applicationName:UpdateApplication' :: UpdateApplication -> 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
"ApplicationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"CurrentApplicationVersionId"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
currentApplicationVersionId
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ApplicationUpdate" Text -> ApplicationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApplicationUpdate
applicationUpdate)
]
)
instance Core.ToPath UpdateApplication where
toPath :: UpdateApplication -> ByteString
toPath = ByteString -> UpdateApplication -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateApplication where
toQuery :: UpdateApplication -> QueryString
toQuery = QueryString -> UpdateApplication -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateApplicationResponse = UpdateApplicationResponse'
{
UpdateApplicationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateApplicationResponse -> UpdateApplicationResponse -> Bool
(UpdateApplicationResponse -> UpdateApplicationResponse -> Bool)
-> (UpdateApplicationResponse -> UpdateApplicationResponse -> Bool)
-> Eq UpdateApplicationResponse
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]
(Int -> ReadS UpdateApplicationResponse)
-> ReadS [UpdateApplicationResponse]
-> ReadPrec UpdateApplicationResponse
-> ReadPrec [UpdateApplicationResponse]
-> Read 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
(Int -> UpdateApplicationResponse -> ShowS)
-> (UpdateApplicationResponse -> String)
-> ([UpdateApplicationResponse] -> ShowS)
-> Show UpdateApplicationResponse
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.
UpdateApplicationResponse -> Rep UpdateApplicationResponse x)
-> (forall x.
Rep UpdateApplicationResponse x -> UpdateApplicationResponse)
-> Generic UpdateApplicationResponse
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 ->
UpdateApplicationResponse
newUpdateApplicationResponse :: Int -> UpdateApplicationResponse
newUpdateApplicationResponse Int
pHttpStatus_ =
UpdateApplicationResponse' :: Int -> UpdateApplicationResponse
UpdateApplicationResponse'
{ $sel:httpStatus:UpdateApplicationResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateApplicationResponse_httpStatus :: Lens.Lens' UpdateApplicationResponse Prelude.Int
updateApplicationResponse_httpStatus :: (Int -> f Int)
-> UpdateApplicationResponse -> f UpdateApplicationResponse
updateApplicationResponse_httpStatus = (UpdateApplicationResponse -> Int)
-> (UpdateApplicationResponse -> Int -> UpdateApplicationResponse)
-> Lens UpdateApplicationResponse UpdateApplicationResponse Int Int
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)
instance Prelude.NFData UpdateApplicationResponse