{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.KinesisAnalyticsV2.UpdateApplication
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates an existing Kinesis Data Analytics application. Using this
-- operation, you can update application code, input configuration, and
-- output configuration.
--
-- Kinesis Data Analytics updates the @ApplicationVersionId@ each time you
-- update your application.
--
-- You cannot update the @RuntimeEnvironment@ of an existing application.
-- If you need to update an application\'s @RuntimeEnvironment@, you must
-- delete the application and create it again.
module Amazonka.KinesisAnalyticsV2.UpdateApplication
  ( -- * Creating a Request
    UpdateApplication (..),
    newUpdateApplication,

    -- * Request Lenses
    updateApplication_currentApplicationVersionId,
    updateApplication_serviceExecutionRoleUpdate,
    updateApplication_cloudWatchLoggingOptionUpdates,
    updateApplication_conditionalToken,
    updateApplication_applicationConfigurationUpdate,
    updateApplication_runConfigurationUpdate,
    updateApplication_applicationName,

    -- * Destructuring the Response
    UpdateApplicationResponse (..),
    newUpdateApplicationResponse,

    -- * Response Lenses
    updateApplicationResponse_httpStatus,
    updateApplicationResponse_applicationDetail,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.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

-- | /See:/ 'newUpdateApplication' smart constructor.
data UpdateApplication = UpdateApplication'
  { -- | The current application version ID. You must provide the
    -- @CurrentApplicationVersionId@ or the @ConditionalToken@.You can retrieve
    -- the application version ID using DescribeApplication. For better
    -- concurrency support, use the @ConditionalToken@ parameter instead of
    -- @CurrentApplicationVersionId@.
    UpdateApplication -> Maybe Natural
currentApplicationVersionId :: Prelude.Maybe Prelude.Natural,
    -- | Describes updates to the service execution role.
    UpdateApplication -> Maybe Text
serviceExecutionRoleUpdate :: Prelude.Maybe Prelude.Text,
    -- | Describes application Amazon CloudWatch logging option updates. You can
    -- only update existing CloudWatch logging options with this action. To add
    -- a new CloudWatch logging option, use
    -- AddApplicationCloudWatchLoggingOption.
    UpdateApplication -> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates :: Prelude.Maybe [CloudWatchLoggingOptionUpdate],
    -- | A value you use to implement strong concurrency for application updates.
    -- You must provide the @CurrentApplicationVersionId@ or the
    -- @ConditionalToken@. You get the application\'s current
    -- @ConditionalToken@ using DescribeApplication. For better concurrency
    -- support, use the @ConditionalToken@ parameter instead of
    -- @CurrentApplicationVersionId@.
    UpdateApplication -> Maybe Text
conditionalToken :: Prelude.Maybe Prelude.Text,
    -- | Describes application configuration updates.
    UpdateApplication -> Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate :: Prelude.Maybe ApplicationConfigurationUpdate,
    -- | Describes updates to the application\'s starting parameters.
    UpdateApplication -> Maybe RunConfigurationUpdate
runConfigurationUpdate :: Prelude.Maybe RunConfigurationUpdate,
    -- | The name of the application to update.
    UpdateApplication -> Text
applicationName :: Prelude.Text
  }
  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)

-- |
-- Create a value of 'UpdateApplication' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'currentApplicationVersionId', 'updateApplication_currentApplicationVersionId' - The current application version ID. You must provide the
-- @CurrentApplicationVersionId@ or the @ConditionalToken@.You can retrieve
-- the application version ID using DescribeApplication. For better
-- concurrency support, use the @ConditionalToken@ parameter instead of
-- @CurrentApplicationVersionId@.
--
-- 'serviceExecutionRoleUpdate', 'updateApplication_serviceExecutionRoleUpdate' - Describes updates to the service execution role.
--
-- 'cloudWatchLoggingOptionUpdates', 'updateApplication_cloudWatchLoggingOptionUpdates' - Describes application Amazon CloudWatch logging option updates. You can
-- only update existing CloudWatch logging options with this action. To add
-- a new CloudWatch logging option, use
-- AddApplicationCloudWatchLoggingOption.
--
-- 'conditionalToken', 'updateApplication_conditionalToken' - A value you use to implement strong concurrency for application updates.
-- You must provide the @CurrentApplicationVersionId@ or the
-- @ConditionalToken@. You get the application\'s current
-- @ConditionalToken@ using DescribeApplication. For better concurrency
-- support, use the @ConditionalToken@ parameter instead of
-- @CurrentApplicationVersionId@.
--
-- 'applicationConfigurationUpdate', 'updateApplication_applicationConfigurationUpdate' - Describes application configuration updates.
--
-- 'runConfigurationUpdate', 'updateApplication_runConfigurationUpdate' - Describes updates to the application\'s starting parameters.
--
-- 'applicationName', 'updateApplication_applicationName' - The name of the application to update.
newUpdateApplication ::
  -- | 'applicationName'
  Prelude.Text ->
  UpdateApplication
newUpdateApplication :: Text -> UpdateApplication
newUpdateApplication Text
pApplicationName_ =
  UpdateApplication' :: Maybe Natural
-> Maybe Text
-> Maybe [CloudWatchLoggingOptionUpdate]
-> Maybe Text
-> Maybe ApplicationConfigurationUpdate
-> Maybe RunConfigurationUpdate
-> Text
-> UpdateApplication
UpdateApplication'
    { $sel:currentApplicationVersionId:UpdateApplication' :: Maybe Natural
currentApplicationVersionId =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceExecutionRoleUpdate:UpdateApplication' :: Maybe Text
serviceExecutionRoleUpdate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLoggingOptionUpdates:UpdateApplication' :: Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates = Maybe [CloudWatchLoggingOptionUpdate]
forall a. Maybe a
Prelude.Nothing,
      $sel:conditionalToken:UpdateApplication' :: Maybe Text
conditionalToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationConfigurationUpdate:UpdateApplication' :: Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate = Maybe ApplicationConfigurationUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:runConfigurationUpdate:UpdateApplication' :: Maybe RunConfigurationUpdate
runConfigurationUpdate = Maybe RunConfigurationUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:UpdateApplication' :: Text
applicationName = Text
pApplicationName_
    }

-- | The current application version ID. You must provide the
-- @CurrentApplicationVersionId@ or the @ConditionalToken@.You can retrieve
-- the application version ID using DescribeApplication. For better
-- concurrency support, use the @ConditionalToken@ parameter instead of
-- @CurrentApplicationVersionId@.
updateApplication_currentApplicationVersionId :: Lens.Lens' UpdateApplication (Prelude.Maybe Prelude.Natural)
updateApplication_currentApplicationVersionId :: (Maybe Natural -> f (Maybe Natural))
-> UpdateApplication -> f UpdateApplication
updateApplication_currentApplicationVersionId = (UpdateApplication -> Maybe Natural)
-> (UpdateApplication -> Maybe Natural -> UpdateApplication)
-> Lens
     UpdateApplication UpdateApplication (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe Natural
currentApplicationVersionId :: Maybe Natural
$sel:currentApplicationVersionId:UpdateApplication' :: UpdateApplication -> Maybe Natural
currentApplicationVersionId} -> Maybe Natural
currentApplicationVersionId) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe Natural
a -> UpdateApplication
s {$sel:currentApplicationVersionId:UpdateApplication' :: Maybe Natural
currentApplicationVersionId = Maybe Natural
a} :: UpdateApplication)

-- | Describes updates to the service execution role.
updateApplication_serviceExecutionRoleUpdate :: Lens.Lens' UpdateApplication (Prelude.Maybe Prelude.Text)
updateApplication_serviceExecutionRoleUpdate :: (Maybe Text -> f (Maybe Text))
-> UpdateApplication -> f UpdateApplication
updateApplication_serviceExecutionRoleUpdate = (UpdateApplication -> Maybe Text)
-> (UpdateApplication -> Maybe Text -> UpdateApplication)
-> Lens
     UpdateApplication UpdateApplication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe Text
serviceExecutionRoleUpdate :: Maybe Text
$sel:serviceExecutionRoleUpdate:UpdateApplication' :: UpdateApplication -> Maybe Text
serviceExecutionRoleUpdate} -> Maybe Text
serviceExecutionRoleUpdate) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe Text
a -> UpdateApplication
s {$sel:serviceExecutionRoleUpdate:UpdateApplication' :: Maybe Text
serviceExecutionRoleUpdate = Maybe Text
a} :: UpdateApplication)

-- | Describes application Amazon CloudWatch logging option updates. You can
-- only update existing CloudWatch logging options with this action. To add
-- a new CloudWatch logging option, use
-- AddApplicationCloudWatchLoggingOption.
updateApplication_cloudWatchLoggingOptionUpdates :: Lens.Lens' UpdateApplication (Prelude.Maybe [CloudWatchLoggingOptionUpdate])
updateApplication_cloudWatchLoggingOptionUpdates :: (Maybe [CloudWatchLoggingOptionUpdate]
 -> f (Maybe [CloudWatchLoggingOptionUpdate]))
-> UpdateApplication -> f UpdateApplication
updateApplication_cloudWatchLoggingOptionUpdates = (UpdateApplication -> Maybe [CloudWatchLoggingOptionUpdate])
-> (UpdateApplication
    -> Maybe [CloudWatchLoggingOptionUpdate] -> UpdateApplication)
-> Lens
     UpdateApplication
     UpdateApplication
     (Maybe [CloudWatchLoggingOptionUpdate])
     (Maybe [CloudWatchLoggingOptionUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates :: Maybe [CloudWatchLoggingOptionUpdate]
$sel:cloudWatchLoggingOptionUpdates:UpdateApplication' :: UpdateApplication -> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates} -> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe [CloudWatchLoggingOptionUpdate]
a -> UpdateApplication
s {$sel:cloudWatchLoggingOptionUpdates:UpdateApplication' :: Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates = Maybe [CloudWatchLoggingOptionUpdate]
a} :: UpdateApplication) ((Maybe [CloudWatchLoggingOptionUpdate]
  -> f (Maybe [CloudWatchLoggingOptionUpdate]))
 -> UpdateApplication -> f UpdateApplication)
-> ((Maybe [CloudWatchLoggingOptionUpdate]
     -> f (Maybe [CloudWatchLoggingOptionUpdate]))
    -> Maybe [CloudWatchLoggingOptionUpdate]
    -> f (Maybe [CloudWatchLoggingOptionUpdate]))
-> (Maybe [CloudWatchLoggingOptionUpdate]
    -> f (Maybe [CloudWatchLoggingOptionUpdate]))
-> UpdateApplication
-> f UpdateApplication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CloudWatchLoggingOptionUpdate]
  [CloudWatchLoggingOptionUpdate]
  [CloudWatchLoggingOptionUpdate]
  [CloudWatchLoggingOptionUpdate]
-> Iso
     (Maybe [CloudWatchLoggingOptionUpdate])
     (Maybe [CloudWatchLoggingOptionUpdate])
     (Maybe [CloudWatchLoggingOptionUpdate])
     (Maybe [CloudWatchLoggingOptionUpdate])
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
  [CloudWatchLoggingOptionUpdate]
  [CloudWatchLoggingOptionUpdate]
  [CloudWatchLoggingOptionUpdate]
  [CloudWatchLoggingOptionUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A value you use to implement strong concurrency for application updates.
-- You must provide the @CurrentApplicationVersionId@ or the
-- @ConditionalToken@. You get the application\'s current
-- @ConditionalToken@ using DescribeApplication. For better concurrency
-- support, use the @ConditionalToken@ parameter instead of
-- @CurrentApplicationVersionId@.
updateApplication_conditionalToken :: Lens.Lens' UpdateApplication (Prelude.Maybe Prelude.Text)
updateApplication_conditionalToken :: (Maybe Text -> f (Maybe Text))
-> UpdateApplication -> f UpdateApplication
updateApplication_conditionalToken = (UpdateApplication -> Maybe Text)
-> (UpdateApplication -> Maybe Text -> UpdateApplication)
-> Lens
     UpdateApplication UpdateApplication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe Text
conditionalToken :: Maybe Text
$sel:conditionalToken:UpdateApplication' :: UpdateApplication -> Maybe Text
conditionalToken} -> Maybe Text
conditionalToken) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe Text
a -> UpdateApplication
s {$sel:conditionalToken:UpdateApplication' :: Maybe Text
conditionalToken = Maybe Text
a} :: UpdateApplication)

-- | Describes application configuration updates.
updateApplication_applicationConfigurationUpdate :: Lens.Lens' UpdateApplication (Prelude.Maybe ApplicationConfigurationUpdate)
updateApplication_applicationConfigurationUpdate :: (Maybe ApplicationConfigurationUpdate
 -> f (Maybe ApplicationConfigurationUpdate))
-> UpdateApplication -> f UpdateApplication
updateApplication_applicationConfigurationUpdate = (UpdateApplication -> Maybe ApplicationConfigurationUpdate)
-> (UpdateApplication
    -> Maybe ApplicationConfigurationUpdate -> UpdateApplication)
-> Lens
     UpdateApplication
     UpdateApplication
     (Maybe ApplicationConfigurationUpdate)
     (Maybe ApplicationConfigurationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate :: Maybe ApplicationConfigurationUpdate
$sel:applicationConfigurationUpdate:UpdateApplication' :: UpdateApplication -> Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate} -> Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe ApplicationConfigurationUpdate
a -> UpdateApplication
s {$sel:applicationConfigurationUpdate:UpdateApplication' :: Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate = Maybe ApplicationConfigurationUpdate
a} :: UpdateApplication)

-- | Describes updates to the application\'s starting parameters.
updateApplication_runConfigurationUpdate :: Lens.Lens' UpdateApplication (Prelude.Maybe RunConfigurationUpdate)
updateApplication_runConfigurationUpdate :: (Maybe RunConfigurationUpdate -> f (Maybe RunConfigurationUpdate))
-> UpdateApplication -> f UpdateApplication
updateApplication_runConfigurationUpdate = (UpdateApplication -> Maybe RunConfigurationUpdate)
-> (UpdateApplication
    -> Maybe RunConfigurationUpdate -> UpdateApplication)
-> Lens
     UpdateApplication
     UpdateApplication
     (Maybe RunConfigurationUpdate)
     (Maybe RunConfigurationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplication' {Maybe RunConfigurationUpdate
runConfigurationUpdate :: Maybe RunConfigurationUpdate
$sel:runConfigurationUpdate:UpdateApplication' :: UpdateApplication -> Maybe RunConfigurationUpdate
runConfigurationUpdate} -> Maybe RunConfigurationUpdate
runConfigurationUpdate) (\s :: UpdateApplication
s@UpdateApplication' {} Maybe RunConfigurationUpdate
a -> UpdateApplication
s {$sel:runConfigurationUpdate:UpdateApplication' :: Maybe RunConfigurationUpdate
runConfigurationUpdate = Maybe RunConfigurationUpdate
a} :: UpdateApplication)

-- | The name of the application to update.
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)

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
 -> Object
 -> Either String (AWSResponse UpdateApplication))
-> Logger
-> Service
-> Proxy UpdateApplication
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateApplication)))
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 ->
          Int -> ApplicationDetail -> UpdateApplicationResponse
UpdateApplicationResponse'
            (Int -> ApplicationDetail -> UpdateApplicationResponse)
-> Either String Int
-> Either String (ApplicationDetail -> 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))
            Either String (ApplicationDetail -> UpdateApplicationResponse)
-> Either String ApplicationDetail
-> Either String UpdateApplicationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ApplicationDetail
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ApplicationDetail")
      )

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_20180523.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' {Maybe Natural
Maybe [CloudWatchLoggingOptionUpdate]
Maybe Text
Maybe RunConfigurationUpdate
Maybe ApplicationConfigurationUpdate
Text
applicationName :: Text
runConfigurationUpdate :: Maybe RunConfigurationUpdate
applicationConfigurationUpdate :: Maybe ApplicationConfigurationUpdate
conditionalToken :: Maybe Text
cloudWatchLoggingOptionUpdates :: Maybe [CloudWatchLoggingOptionUpdate]
serviceExecutionRoleUpdate :: Maybe Text
currentApplicationVersionId :: Maybe Natural
$sel:applicationName:UpdateApplication' :: UpdateApplication -> Text
$sel:runConfigurationUpdate:UpdateApplication' :: UpdateApplication -> Maybe RunConfigurationUpdate
$sel:applicationConfigurationUpdate:UpdateApplication' :: UpdateApplication -> Maybe ApplicationConfigurationUpdate
$sel:conditionalToken:UpdateApplication' :: UpdateApplication -> Maybe Text
$sel:cloudWatchLoggingOptionUpdates:UpdateApplication' :: UpdateApplication -> Maybe [CloudWatchLoggingOptionUpdate]
$sel:serviceExecutionRoleUpdate:UpdateApplication' :: UpdateApplication -> Maybe Text
$sel:currentApplicationVersionId:UpdateApplication' :: UpdateApplication -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CurrentApplicationVersionId" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
currentApplicationVersionId,
            (Text
"ServiceExecutionRoleUpdate" 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
serviceExecutionRoleUpdate,
            (Text
"CloudWatchLoggingOptionUpdates" Text -> [CloudWatchLoggingOptionUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([CloudWatchLoggingOptionUpdate] -> Pair)
-> Maybe [CloudWatchLoggingOptionUpdate] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates,
            (Text
"ConditionalToken" 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
conditionalToken,
            (Text
"ApplicationConfigurationUpdate" Text -> ApplicationConfigurationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ApplicationConfigurationUpdate -> Pair)
-> Maybe ApplicationConfigurationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ApplicationConfigurationUpdate
applicationConfigurationUpdate,
            (Text
"RunConfigurationUpdate" Text -> RunConfigurationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RunConfigurationUpdate -> Pair)
-> Maybe RunConfigurationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RunConfigurationUpdate
runConfigurationUpdate,
            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)
          ]
      )

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

-- | /See:/ 'newUpdateApplicationResponse' smart constructor.
data UpdateApplicationResponse = UpdateApplicationResponse'
  { -- | The response's http status code.
    UpdateApplicationResponse -> Int
httpStatus :: Prelude.Int,
    -- | Describes application updates.
    UpdateApplicationResponse -> ApplicationDetail
applicationDetail :: ApplicationDetail
  }
  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)

-- |
-- Create a value of 'UpdateApplicationResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'updateApplicationResponse_httpStatus' - The response's http status code.
--
-- 'applicationDetail', 'updateApplicationResponse_applicationDetail' - Describes application updates.
newUpdateApplicationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'applicationDetail'
  ApplicationDetail ->
  UpdateApplicationResponse
newUpdateApplicationResponse :: Int -> ApplicationDetail -> UpdateApplicationResponse
newUpdateApplicationResponse
  Int
pHttpStatus_
  ApplicationDetail
pApplicationDetail_ =
    UpdateApplicationResponse' :: Int -> ApplicationDetail -> UpdateApplicationResponse
UpdateApplicationResponse'
      { $sel:httpStatus:UpdateApplicationResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:applicationDetail:UpdateApplicationResponse' :: ApplicationDetail
applicationDetail = ApplicationDetail
pApplicationDetail_
      }

-- | The response's http status code.
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)

-- | Describes application updates.
updateApplicationResponse_applicationDetail :: Lens.Lens' UpdateApplicationResponse ApplicationDetail
updateApplicationResponse_applicationDetail :: (ApplicationDetail -> f ApplicationDetail)
-> UpdateApplicationResponse -> f UpdateApplicationResponse
updateApplicationResponse_applicationDetail = (UpdateApplicationResponse -> ApplicationDetail)
-> (UpdateApplicationResponse
    -> ApplicationDetail -> UpdateApplicationResponse)
-> Lens
     UpdateApplicationResponse
     UpdateApplicationResponse
     ApplicationDetail
     ApplicationDetail
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplicationResponse' {ApplicationDetail
applicationDetail :: ApplicationDetail
$sel:applicationDetail:UpdateApplicationResponse' :: UpdateApplicationResponse -> ApplicationDetail
applicationDetail} -> ApplicationDetail
applicationDetail) (\s :: UpdateApplicationResponse
s@UpdateApplicationResponse' {} ApplicationDetail
a -> UpdateApplicationResponse
s {$sel:applicationDetail:UpdateApplicationResponse' :: ApplicationDetail
applicationDetail = ApplicationDetail
a} :: UpdateApplicationResponse)

instance Prelude.NFData UpdateApplicationResponse