{-# 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.SageMaker.UpdateAppImageConfig
-- 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 the properties of an AppImageConfig.
module Amazonka.SageMaker.UpdateAppImageConfig
  ( -- * Creating a Request
    UpdateAppImageConfig (..),
    newUpdateAppImageConfig,

    -- * Request Lenses
    updateAppImageConfig_kernelGatewayImageConfig,
    updateAppImageConfig_appImageConfigName,

    -- * Destructuring the Response
    UpdateAppImageConfigResponse (..),
    newUpdateAppImageConfigResponse,

    -- * Response Lenses
    updateAppImageConfigResponse_appImageConfigArn,
    updateAppImageConfigResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMaker.Types

-- | /See:/ 'newUpdateAppImageConfig' smart constructor.
data UpdateAppImageConfig = UpdateAppImageConfig'
  { -- | The new KernelGateway app to run on the image.
    UpdateAppImageConfig -> Maybe KernelGatewayImageConfig
kernelGatewayImageConfig :: Prelude.Maybe KernelGatewayImageConfig,
    -- | The name of the AppImageConfig to update.
    UpdateAppImageConfig -> Text
appImageConfigName :: Prelude.Text
  }
  deriving (UpdateAppImageConfig -> UpdateAppImageConfig -> Bool
(UpdateAppImageConfig -> UpdateAppImageConfig -> Bool)
-> (UpdateAppImageConfig -> UpdateAppImageConfig -> Bool)
-> Eq UpdateAppImageConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAppImageConfig -> UpdateAppImageConfig -> Bool
$c/= :: UpdateAppImageConfig -> UpdateAppImageConfig -> Bool
== :: UpdateAppImageConfig -> UpdateAppImageConfig -> Bool
$c== :: UpdateAppImageConfig -> UpdateAppImageConfig -> Bool
Prelude.Eq, ReadPrec [UpdateAppImageConfig]
ReadPrec UpdateAppImageConfig
Int -> ReadS UpdateAppImageConfig
ReadS [UpdateAppImageConfig]
(Int -> ReadS UpdateAppImageConfig)
-> ReadS [UpdateAppImageConfig]
-> ReadPrec UpdateAppImageConfig
-> ReadPrec [UpdateAppImageConfig]
-> Read UpdateAppImageConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAppImageConfig]
$creadListPrec :: ReadPrec [UpdateAppImageConfig]
readPrec :: ReadPrec UpdateAppImageConfig
$creadPrec :: ReadPrec UpdateAppImageConfig
readList :: ReadS [UpdateAppImageConfig]
$creadList :: ReadS [UpdateAppImageConfig]
readsPrec :: Int -> ReadS UpdateAppImageConfig
$creadsPrec :: Int -> ReadS UpdateAppImageConfig
Prelude.Read, Int -> UpdateAppImageConfig -> ShowS
[UpdateAppImageConfig] -> ShowS
UpdateAppImageConfig -> String
(Int -> UpdateAppImageConfig -> ShowS)
-> (UpdateAppImageConfig -> String)
-> ([UpdateAppImageConfig] -> ShowS)
-> Show UpdateAppImageConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAppImageConfig] -> ShowS
$cshowList :: [UpdateAppImageConfig] -> ShowS
show :: UpdateAppImageConfig -> String
$cshow :: UpdateAppImageConfig -> String
showsPrec :: Int -> UpdateAppImageConfig -> ShowS
$cshowsPrec :: Int -> UpdateAppImageConfig -> ShowS
Prelude.Show, (forall x. UpdateAppImageConfig -> Rep UpdateAppImageConfig x)
-> (forall x. Rep UpdateAppImageConfig x -> UpdateAppImageConfig)
-> Generic UpdateAppImageConfig
forall x. Rep UpdateAppImageConfig x -> UpdateAppImageConfig
forall x. UpdateAppImageConfig -> Rep UpdateAppImageConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAppImageConfig x -> UpdateAppImageConfig
$cfrom :: forall x. UpdateAppImageConfig -> Rep UpdateAppImageConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAppImageConfig' 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:
--
-- 'kernelGatewayImageConfig', 'updateAppImageConfig_kernelGatewayImageConfig' - The new KernelGateway app to run on the image.
--
-- 'appImageConfigName', 'updateAppImageConfig_appImageConfigName' - The name of the AppImageConfig to update.
newUpdateAppImageConfig ::
  -- | 'appImageConfigName'
  Prelude.Text ->
  UpdateAppImageConfig
newUpdateAppImageConfig :: Text -> UpdateAppImageConfig
newUpdateAppImageConfig Text
pAppImageConfigName_ =
  UpdateAppImageConfig' :: Maybe KernelGatewayImageConfig -> Text -> UpdateAppImageConfig
UpdateAppImageConfig'
    { $sel:kernelGatewayImageConfig:UpdateAppImageConfig' :: Maybe KernelGatewayImageConfig
kernelGatewayImageConfig =
        Maybe KernelGatewayImageConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:appImageConfigName:UpdateAppImageConfig' :: Text
appImageConfigName = Text
pAppImageConfigName_
    }

-- | The new KernelGateway app to run on the image.
updateAppImageConfig_kernelGatewayImageConfig :: Lens.Lens' UpdateAppImageConfig (Prelude.Maybe KernelGatewayImageConfig)
updateAppImageConfig_kernelGatewayImageConfig :: (Maybe KernelGatewayImageConfig
 -> f (Maybe KernelGatewayImageConfig))
-> UpdateAppImageConfig -> f UpdateAppImageConfig
updateAppImageConfig_kernelGatewayImageConfig = (UpdateAppImageConfig -> Maybe KernelGatewayImageConfig)
-> (UpdateAppImageConfig
    -> Maybe KernelGatewayImageConfig -> UpdateAppImageConfig)
-> Lens
     UpdateAppImageConfig
     UpdateAppImageConfig
     (Maybe KernelGatewayImageConfig)
     (Maybe KernelGatewayImageConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppImageConfig' {Maybe KernelGatewayImageConfig
kernelGatewayImageConfig :: Maybe KernelGatewayImageConfig
$sel:kernelGatewayImageConfig:UpdateAppImageConfig' :: UpdateAppImageConfig -> Maybe KernelGatewayImageConfig
kernelGatewayImageConfig} -> Maybe KernelGatewayImageConfig
kernelGatewayImageConfig) (\s :: UpdateAppImageConfig
s@UpdateAppImageConfig' {} Maybe KernelGatewayImageConfig
a -> UpdateAppImageConfig
s {$sel:kernelGatewayImageConfig:UpdateAppImageConfig' :: Maybe KernelGatewayImageConfig
kernelGatewayImageConfig = Maybe KernelGatewayImageConfig
a} :: UpdateAppImageConfig)

-- | The name of the AppImageConfig to update.
updateAppImageConfig_appImageConfigName :: Lens.Lens' UpdateAppImageConfig Prelude.Text
updateAppImageConfig_appImageConfigName :: (Text -> f Text) -> UpdateAppImageConfig -> f UpdateAppImageConfig
updateAppImageConfig_appImageConfigName = (UpdateAppImageConfig -> Text)
-> (UpdateAppImageConfig -> Text -> UpdateAppImageConfig)
-> Lens UpdateAppImageConfig UpdateAppImageConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppImageConfig' {Text
appImageConfigName :: Text
$sel:appImageConfigName:UpdateAppImageConfig' :: UpdateAppImageConfig -> Text
appImageConfigName} -> Text
appImageConfigName) (\s :: UpdateAppImageConfig
s@UpdateAppImageConfig' {} Text
a -> UpdateAppImageConfig
s {$sel:appImageConfigName:UpdateAppImageConfig' :: Text
appImageConfigName = Text
a} :: UpdateAppImageConfig)

instance Core.AWSRequest UpdateAppImageConfig where
  type
    AWSResponse UpdateAppImageConfig =
      UpdateAppImageConfigResponse
  request :: UpdateAppImageConfig -> Request UpdateAppImageConfig
request = Service -> UpdateAppImageConfig -> Request UpdateAppImageConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAppImageConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAppImageConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateAppImageConfig))
-> Logger
-> Service
-> Proxy UpdateAppImageConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAppImageConfig)))
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 Text -> Int -> UpdateAppImageConfigResponse
UpdateAppImageConfigResponse'
            (Maybe Text -> Int -> UpdateAppImageConfigResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateAppImageConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AppImageConfigArn")
            Either String (Int -> UpdateAppImageConfigResponse)
-> Either String Int -> Either String UpdateAppImageConfigResponse
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 UpdateAppImageConfig

instance Prelude.NFData UpdateAppImageConfig

instance Core.ToHeaders UpdateAppImageConfig where
  toHeaders :: UpdateAppImageConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateAppImageConfig -> 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
"SageMaker.UpdateAppImageConfig" ::
                          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 UpdateAppImageConfig where
  toJSON :: UpdateAppImageConfig -> Value
toJSON UpdateAppImageConfig' {Maybe KernelGatewayImageConfig
Text
appImageConfigName :: Text
kernelGatewayImageConfig :: Maybe KernelGatewayImageConfig
$sel:appImageConfigName:UpdateAppImageConfig' :: UpdateAppImageConfig -> Text
$sel:kernelGatewayImageConfig:UpdateAppImageConfig' :: UpdateAppImageConfig -> Maybe KernelGatewayImageConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KernelGatewayImageConfig" Text -> KernelGatewayImageConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (KernelGatewayImageConfig -> Pair)
-> Maybe KernelGatewayImageConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KernelGatewayImageConfig
kernelGatewayImageConfig,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AppImageConfigName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appImageConfigName)
          ]
      )

instance Core.ToPath UpdateAppImageConfig where
  toPath :: UpdateAppImageConfig -> ByteString
toPath = ByteString -> UpdateAppImageConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery UpdateAppImageConfig where
  toQuery :: UpdateAppImageConfig -> QueryString
toQuery = QueryString -> UpdateAppImageConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateAppImageConfigResponse' smart constructor.
data UpdateAppImageConfigResponse = UpdateAppImageConfigResponse'
  { -- | The Amazon Resource Name (ARN) for the AppImageConfig.
    UpdateAppImageConfigResponse -> Maybe Text
appImageConfigArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateAppImageConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateAppImageConfigResponse
-> UpdateAppImageConfigResponse -> Bool
(UpdateAppImageConfigResponse
 -> UpdateAppImageConfigResponse -> Bool)
-> (UpdateAppImageConfigResponse
    -> UpdateAppImageConfigResponse -> Bool)
-> Eq UpdateAppImageConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAppImageConfigResponse
-> UpdateAppImageConfigResponse -> Bool
$c/= :: UpdateAppImageConfigResponse
-> UpdateAppImageConfigResponse -> Bool
== :: UpdateAppImageConfigResponse
-> UpdateAppImageConfigResponse -> Bool
$c== :: UpdateAppImageConfigResponse
-> UpdateAppImageConfigResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAppImageConfigResponse]
ReadPrec UpdateAppImageConfigResponse
Int -> ReadS UpdateAppImageConfigResponse
ReadS [UpdateAppImageConfigResponse]
(Int -> ReadS UpdateAppImageConfigResponse)
-> ReadS [UpdateAppImageConfigResponse]
-> ReadPrec UpdateAppImageConfigResponse
-> ReadPrec [UpdateAppImageConfigResponse]
-> Read UpdateAppImageConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAppImageConfigResponse]
$creadListPrec :: ReadPrec [UpdateAppImageConfigResponse]
readPrec :: ReadPrec UpdateAppImageConfigResponse
$creadPrec :: ReadPrec UpdateAppImageConfigResponse
readList :: ReadS [UpdateAppImageConfigResponse]
$creadList :: ReadS [UpdateAppImageConfigResponse]
readsPrec :: Int -> ReadS UpdateAppImageConfigResponse
$creadsPrec :: Int -> ReadS UpdateAppImageConfigResponse
Prelude.Read, Int -> UpdateAppImageConfigResponse -> ShowS
[UpdateAppImageConfigResponse] -> ShowS
UpdateAppImageConfigResponse -> String
(Int -> UpdateAppImageConfigResponse -> ShowS)
-> (UpdateAppImageConfigResponse -> String)
-> ([UpdateAppImageConfigResponse] -> ShowS)
-> Show UpdateAppImageConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAppImageConfigResponse] -> ShowS
$cshowList :: [UpdateAppImageConfigResponse] -> ShowS
show :: UpdateAppImageConfigResponse -> String
$cshow :: UpdateAppImageConfigResponse -> String
showsPrec :: Int -> UpdateAppImageConfigResponse -> ShowS
$cshowsPrec :: Int -> UpdateAppImageConfigResponse -> ShowS
Prelude.Show, (forall x.
 UpdateAppImageConfigResponse -> Rep UpdateAppImageConfigResponse x)
-> (forall x.
    Rep UpdateAppImageConfigResponse x -> UpdateAppImageConfigResponse)
-> Generic UpdateAppImageConfigResponse
forall x.
Rep UpdateAppImageConfigResponse x -> UpdateAppImageConfigResponse
forall x.
UpdateAppImageConfigResponse -> Rep UpdateAppImageConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAppImageConfigResponse x -> UpdateAppImageConfigResponse
$cfrom :: forall x.
UpdateAppImageConfigResponse -> Rep UpdateAppImageConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAppImageConfigResponse' 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:
--
-- 'appImageConfigArn', 'updateAppImageConfigResponse_appImageConfigArn' - The Amazon Resource Name (ARN) for the AppImageConfig.
--
-- 'httpStatus', 'updateAppImageConfigResponse_httpStatus' - The response's http status code.
newUpdateAppImageConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAppImageConfigResponse
newUpdateAppImageConfigResponse :: Int -> UpdateAppImageConfigResponse
newUpdateAppImageConfigResponse Int
pHttpStatus_ =
  UpdateAppImageConfigResponse' :: Maybe Text -> Int -> UpdateAppImageConfigResponse
UpdateAppImageConfigResponse'
    { $sel:appImageConfigArn:UpdateAppImageConfigResponse' :: Maybe Text
appImageConfigArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateAppImageConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) for the AppImageConfig.
updateAppImageConfigResponse_appImageConfigArn :: Lens.Lens' UpdateAppImageConfigResponse (Prelude.Maybe Prelude.Text)
updateAppImageConfigResponse_appImageConfigArn :: (Maybe Text -> f (Maybe Text))
-> UpdateAppImageConfigResponse -> f UpdateAppImageConfigResponse
updateAppImageConfigResponse_appImageConfigArn = (UpdateAppImageConfigResponse -> Maybe Text)
-> (UpdateAppImageConfigResponse
    -> Maybe Text -> UpdateAppImageConfigResponse)
-> Lens
     UpdateAppImageConfigResponse
     UpdateAppImageConfigResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppImageConfigResponse' {Maybe Text
appImageConfigArn :: Maybe Text
$sel:appImageConfigArn:UpdateAppImageConfigResponse' :: UpdateAppImageConfigResponse -> Maybe Text
appImageConfigArn} -> Maybe Text
appImageConfigArn) (\s :: UpdateAppImageConfigResponse
s@UpdateAppImageConfigResponse' {} Maybe Text
a -> UpdateAppImageConfigResponse
s {$sel:appImageConfigArn:UpdateAppImageConfigResponse' :: Maybe Text
appImageConfigArn = Maybe Text
a} :: UpdateAppImageConfigResponse)

-- | The response's http status code.
updateAppImageConfigResponse_httpStatus :: Lens.Lens' UpdateAppImageConfigResponse Prelude.Int
updateAppImageConfigResponse_httpStatus :: (Int -> f Int)
-> UpdateAppImageConfigResponse -> f UpdateAppImageConfigResponse
updateAppImageConfigResponse_httpStatus = (UpdateAppImageConfigResponse -> Int)
-> (UpdateAppImageConfigResponse
    -> Int -> UpdateAppImageConfigResponse)
-> Lens
     UpdateAppImageConfigResponse UpdateAppImageConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppImageConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateAppImageConfigResponse' :: UpdateAppImageConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateAppImageConfigResponse
s@UpdateAppImageConfigResponse' {} Int
a -> UpdateAppImageConfigResponse
s {$sel:httpStatus:UpdateAppImageConfigResponse' :: Int
httpStatus = Int
a} :: UpdateAppImageConfigResponse)

instance Prelude.NFData UpdateAppImageConfigResponse