{-# 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.UpdateHub
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Update a hub.
module Amazonka.SageMaker.UpdateHub
  ( -- * Creating a Request
    UpdateHub (..),
    newUpdateHub,

    -- * Request Lenses
    updateHub_hubDescription,
    updateHub_hubDisplayName,
    updateHub_hubSearchKeywords,
    updateHub_hubName,

    -- * Destructuring the Response
    UpdateHubResponse (..),
    newUpdateHubResponse,

    -- * Response Lenses
    updateHubResponse_httpStatus,
    updateHubResponse_hubArn,
  )
where

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

-- | /See:/ 'newUpdateHub' smart constructor.
data UpdateHub = UpdateHub'
  { -- | A description of the updated hub.
    UpdateHub -> Maybe Text
hubDescription :: Prelude.Maybe Prelude.Text,
    -- | The display name of the hub.
    UpdateHub -> Maybe Text
hubDisplayName :: Prelude.Maybe Prelude.Text,
    -- | The searchable keywords for the hub.
    UpdateHub -> Maybe [Text]
hubSearchKeywords :: Prelude.Maybe [Prelude.Text],
    -- | The name of the hub to update.
    UpdateHub -> Text
hubName :: Prelude.Text
  }
  deriving (UpdateHub -> UpdateHub -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateHub -> UpdateHub -> Bool
$c/= :: UpdateHub -> UpdateHub -> Bool
== :: UpdateHub -> UpdateHub -> Bool
$c== :: UpdateHub -> UpdateHub -> Bool
Prelude.Eq, ReadPrec [UpdateHub]
ReadPrec UpdateHub
Int -> ReadS UpdateHub
ReadS [UpdateHub]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateHub]
$creadListPrec :: ReadPrec [UpdateHub]
readPrec :: ReadPrec UpdateHub
$creadPrec :: ReadPrec UpdateHub
readList :: ReadS [UpdateHub]
$creadList :: ReadS [UpdateHub]
readsPrec :: Int -> ReadS UpdateHub
$creadsPrec :: Int -> ReadS UpdateHub
Prelude.Read, Int -> UpdateHub -> ShowS
[UpdateHub] -> ShowS
UpdateHub -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateHub] -> ShowS
$cshowList :: [UpdateHub] -> ShowS
show :: UpdateHub -> String
$cshow :: UpdateHub -> String
showsPrec :: Int -> UpdateHub -> ShowS
$cshowsPrec :: Int -> UpdateHub -> ShowS
Prelude.Show, forall x. Rep UpdateHub x -> UpdateHub
forall x. UpdateHub -> Rep UpdateHub x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateHub x -> UpdateHub
$cfrom :: forall x. UpdateHub -> Rep UpdateHub x
Prelude.Generic)

-- |
-- Create a value of 'UpdateHub' 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:
--
-- 'hubDescription', 'updateHub_hubDescription' - A description of the updated hub.
--
-- 'hubDisplayName', 'updateHub_hubDisplayName' - The display name of the hub.
--
-- 'hubSearchKeywords', 'updateHub_hubSearchKeywords' - The searchable keywords for the hub.
--
-- 'hubName', 'updateHub_hubName' - The name of the hub to update.
newUpdateHub ::
  -- | 'hubName'
  Prelude.Text ->
  UpdateHub
newUpdateHub :: Text -> UpdateHub
newUpdateHub Text
pHubName_ =
  UpdateHub'
    { $sel:hubDescription:UpdateHub' :: Maybe Text
hubDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:hubDisplayName:UpdateHub' :: Maybe Text
hubDisplayName = forall a. Maybe a
Prelude.Nothing,
      $sel:hubSearchKeywords:UpdateHub' :: Maybe [Text]
hubSearchKeywords = forall a. Maybe a
Prelude.Nothing,
      $sel:hubName:UpdateHub' :: Text
hubName = Text
pHubName_
    }

-- | A description of the updated hub.
updateHub_hubDescription :: Lens.Lens' UpdateHub (Prelude.Maybe Prelude.Text)
updateHub_hubDescription :: Lens' UpdateHub (Maybe Text)
updateHub_hubDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHub' {Maybe Text
hubDescription :: Maybe Text
$sel:hubDescription:UpdateHub' :: UpdateHub -> Maybe Text
hubDescription} -> Maybe Text
hubDescription) (\s :: UpdateHub
s@UpdateHub' {} Maybe Text
a -> UpdateHub
s {$sel:hubDescription:UpdateHub' :: Maybe Text
hubDescription = Maybe Text
a} :: UpdateHub)

-- | The display name of the hub.
updateHub_hubDisplayName :: Lens.Lens' UpdateHub (Prelude.Maybe Prelude.Text)
updateHub_hubDisplayName :: Lens' UpdateHub (Maybe Text)
updateHub_hubDisplayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHub' {Maybe Text
hubDisplayName :: Maybe Text
$sel:hubDisplayName:UpdateHub' :: UpdateHub -> Maybe Text
hubDisplayName} -> Maybe Text
hubDisplayName) (\s :: UpdateHub
s@UpdateHub' {} Maybe Text
a -> UpdateHub
s {$sel:hubDisplayName:UpdateHub' :: Maybe Text
hubDisplayName = Maybe Text
a} :: UpdateHub)

-- | The searchable keywords for the hub.
updateHub_hubSearchKeywords :: Lens.Lens' UpdateHub (Prelude.Maybe [Prelude.Text])
updateHub_hubSearchKeywords :: Lens' UpdateHub (Maybe [Text])
updateHub_hubSearchKeywords = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHub' {Maybe [Text]
hubSearchKeywords :: Maybe [Text]
$sel:hubSearchKeywords:UpdateHub' :: UpdateHub -> Maybe [Text]
hubSearchKeywords} -> Maybe [Text]
hubSearchKeywords) (\s :: UpdateHub
s@UpdateHub' {} Maybe [Text]
a -> UpdateHub
s {$sel:hubSearchKeywords:UpdateHub' :: Maybe [Text]
hubSearchKeywords = Maybe [Text]
a} :: UpdateHub) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the hub to update.
updateHub_hubName :: Lens.Lens' UpdateHub Prelude.Text
updateHub_hubName :: Lens' UpdateHub Text
updateHub_hubName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHub' {Text
hubName :: Text
$sel:hubName:UpdateHub' :: UpdateHub -> Text
hubName} -> Text
hubName) (\s :: UpdateHub
s@UpdateHub' {} Text
a -> UpdateHub
s {$sel:hubName:UpdateHub' :: Text
hubName = Text
a} :: UpdateHub)

instance Core.AWSRequest UpdateHub where
  type AWSResponse UpdateHub = UpdateHubResponse
  request :: (Service -> Service) -> UpdateHub -> Request UpdateHub
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateHub
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateHub)))
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 -> Text -> UpdateHubResponse
UpdateHubResponse'
            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
"HubArn")
      )

instance Prelude.Hashable UpdateHub where
  hashWithSalt :: Int -> UpdateHub -> Int
hashWithSalt Int
_salt UpdateHub' {Maybe [Text]
Maybe Text
Text
hubName :: Text
hubSearchKeywords :: Maybe [Text]
hubDisplayName :: Maybe Text
hubDescription :: Maybe Text
$sel:hubName:UpdateHub' :: UpdateHub -> Text
$sel:hubSearchKeywords:UpdateHub' :: UpdateHub -> Maybe [Text]
$sel:hubDisplayName:UpdateHub' :: UpdateHub -> Maybe Text
$sel:hubDescription:UpdateHub' :: UpdateHub -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hubDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hubDisplayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
hubSearchKeywords
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
hubName

instance Prelude.NFData UpdateHub where
  rnf :: UpdateHub -> ()
rnf UpdateHub' {Maybe [Text]
Maybe Text
Text
hubName :: Text
hubSearchKeywords :: Maybe [Text]
hubDisplayName :: Maybe Text
hubDescription :: Maybe Text
$sel:hubName:UpdateHub' :: UpdateHub -> Text
$sel:hubSearchKeywords:UpdateHub' :: UpdateHub -> Maybe [Text]
$sel:hubDisplayName:UpdateHub' :: UpdateHub -> Maybe Text
$sel:hubDescription:UpdateHub' :: UpdateHub -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hubDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hubDisplayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
hubSearchKeywords
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
hubName

instance Data.ToHeaders UpdateHub where
  toHeaders :: UpdateHub -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"SageMaker.UpdateHub" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateHub where
  toJSON :: UpdateHub -> Value
toJSON UpdateHub' {Maybe [Text]
Maybe Text
Text
hubName :: Text
hubSearchKeywords :: Maybe [Text]
hubDisplayName :: Maybe Text
hubDescription :: Maybe Text
$sel:hubName:UpdateHub' :: UpdateHub -> Text
$sel:hubSearchKeywords:UpdateHub' :: UpdateHub -> Maybe [Text]
$sel:hubDisplayName:UpdateHub' :: UpdateHub -> Maybe Text
$sel:hubDescription:UpdateHub' :: UpdateHub -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"HubDescription" 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
hubDescription,
            (Key
"HubDisplayName" 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
hubDisplayName,
            (Key
"HubSearchKeywords" 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]
hubSearchKeywords,
            forall a. a -> Maybe a
Prelude.Just (Key
"HubName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
hubName)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateHubResponse' 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', 'updateHubResponse_httpStatus' - The response's http status code.
--
-- 'hubArn', 'updateHubResponse_hubArn' - The Amazon Resource Name (ARN) of the updated hub.
newUpdateHubResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'hubArn'
  Prelude.Text ->
  UpdateHubResponse
newUpdateHubResponse :: Int -> Text -> UpdateHubResponse
newUpdateHubResponse Int
pHttpStatus_ Text
pHubArn_ =
  UpdateHubResponse'
    { $sel:httpStatus:UpdateHubResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:hubArn:UpdateHubResponse' :: Text
hubArn = Text
pHubArn_
    }

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

-- | The Amazon Resource Name (ARN) of the updated hub.
updateHubResponse_hubArn :: Lens.Lens' UpdateHubResponse Prelude.Text
updateHubResponse_hubArn :: Lens' UpdateHubResponse Text
updateHubResponse_hubArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHubResponse' {Text
hubArn :: Text
$sel:hubArn:UpdateHubResponse' :: UpdateHubResponse -> Text
hubArn} -> Text
hubArn) (\s :: UpdateHubResponse
s@UpdateHubResponse' {} Text
a -> UpdateHubResponse
s {$sel:hubArn:UpdateHubResponse' :: Text
hubArn = Text
a} :: UpdateHubResponse)

instance Prelude.NFData UpdateHubResponse where
  rnf :: UpdateHubResponse -> ()
rnf UpdateHubResponse' {Int
Text
hubArn :: Text
httpStatus :: Int
$sel:hubArn:UpdateHubResponse' :: UpdateHubResponse -> Text
$sel:httpStatus:UpdateHubResponse' :: UpdateHubResponse -> 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 Text
hubArn