{-# 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.Outposts.UpdateOutpost
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates an Outpost.
module Amazonka.Outposts.UpdateOutpost
  ( -- * Creating a Request
    UpdateOutpost (..),
    newUpdateOutpost,

    -- * Request Lenses
    updateOutpost_description,
    updateOutpost_name,
    updateOutpost_supportedHardwareType,
    updateOutpost_outpostId,

    -- * Destructuring the Response
    UpdateOutpostResponse (..),
    newUpdateOutpostResponse,

    -- * Response Lenses
    updateOutpostResponse_outpost,
    updateOutpostResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateOutpost' smart constructor.
data UpdateOutpost = UpdateOutpost'
  { UpdateOutpost -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    UpdateOutpost -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The type of hardware for this Outpost.
    UpdateOutpost -> Maybe SupportedHardwareType
supportedHardwareType :: Prelude.Maybe SupportedHardwareType,
    -- | The ID or the Amazon Resource Name (ARN) of the Outpost.
    UpdateOutpost -> Text
outpostId :: Prelude.Text
  }
  deriving (UpdateOutpost -> UpdateOutpost -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateOutpost -> UpdateOutpost -> Bool
$c/= :: UpdateOutpost -> UpdateOutpost -> Bool
== :: UpdateOutpost -> UpdateOutpost -> Bool
$c== :: UpdateOutpost -> UpdateOutpost -> Bool
Prelude.Eq, ReadPrec [UpdateOutpost]
ReadPrec UpdateOutpost
Int -> ReadS UpdateOutpost
ReadS [UpdateOutpost]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateOutpost]
$creadListPrec :: ReadPrec [UpdateOutpost]
readPrec :: ReadPrec UpdateOutpost
$creadPrec :: ReadPrec UpdateOutpost
readList :: ReadS [UpdateOutpost]
$creadList :: ReadS [UpdateOutpost]
readsPrec :: Int -> ReadS UpdateOutpost
$creadsPrec :: Int -> ReadS UpdateOutpost
Prelude.Read, Int -> UpdateOutpost -> ShowS
[UpdateOutpost] -> ShowS
UpdateOutpost -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateOutpost] -> ShowS
$cshowList :: [UpdateOutpost] -> ShowS
show :: UpdateOutpost -> String
$cshow :: UpdateOutpost -> String
showsPrec :: Int -> UpdateOutpost -> ShowS
$cshowsPrec :: Int -> UpdateOutpost -> ShowS
Prelude.Show, forall x. Rep UpdateOutpost x -> UpdateOutpost
forall x. UpdateOutpost -> Rep UpdateOutpost x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateOutpost x -> UpdateOutpost
$cfrom :: forall x. UpdateOutpost -> Rep UpdateOutpost x
Prelude.Generic)

-- |
-- Create a value of 'UpdateOutpost' 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:
--
-- 'description', 'updateOutpost_description' - Undocumented member.
--
-- 'name', 'updateOutpost_name' - Undocumented member.
--
-- 'supportedHardwareType', 'updateOutpost_supportedHardwareType' - The type of hardware for this Outpost.
--
-- 'outpostId', 'updateOutpost_outpostId' - The ID or the Amazon Resource Name (ARN) of the Outpost.
newUpdateOutpost ::
  -- | 'outpostId'
  Prelude.Text ->
  UpdateOutpost
newUpdateOutpost :: Text -> UpdateOutpost
newUpdateOutpost Text
pOutpostId_ =
  UpdateOutpost'
    { $sel:description:UpdateOutpost' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateOutpost' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:supportedHardwareType:UpdateOutpost' :: Maybe SupportedHardwareType
supportedHardwareType = forall a. Maybe a
Prelude.Nothing,
      $sel:outpostId:UpdateOutpost' :: Text
outpostId = Text
pOutpostId_
    }

-- | Undocumented member.
updateOutpost_description :: Lens.Lens' UpdateOutpost (Prelude.Maybe Prelude.Text)
updateOutpost_description :: Lens' UpdateOutpost (Maybe Text)
updateOutpost_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateOutpost' {Maybe Text
description :: Maybe Text
$sel:description:UpdateOutpost' :: UpdateOutpost -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateOutpost
s@UpdateOutpost' {} Maybe Text
a -> UpdateOutpost
s {$sel:description:UpdateOutpost' :: Maybe Text
description = Maybe Text
a} :: UpdateOutpost)

-- | Undocumented member.
updateOutpost_name :: Lens.Lens' UpdateOutpost (Prelude.Maybe Prelude.Text)
updateOutpost_name :: Lens' UpdateOutpost (Maybe Text)
updateOutpost_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateOutpost' {Maybe Text
name :: Maybe Text
$sel:name:UpdateOutpost' :: UpdateOutpost -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateOutpost
s@UpdateOutpost' {} Maybe Text
a -> UpdateOutpost
s {$sel:name:UpdateOutpost' :: Maybe Text
name = Maybe Text
a} :: UpdateOutpost)

-- | The type of hardware for this Outpost.
updateOutpost_supportedHardwareType :: Lens.Lens' UpdateOutpost (Prelude.Maybe SupportedHardwareType)
updateOutpost_supportedHardwareType :: Lens' UpdateOutpost (Maybe SupportedHardwareType)
updateOutpost_supportedHardwareType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateOutpost' {Maybe SupportedHardwareType
supportedHardwareType :: Maybe SupportedHardwareType
$sel:supportedHardwareType:UpdateOutpost' :: UpdateOutpost -> Maybe SupportedHardwareType
supportedHardwareType} -> Maybe SupportedHardwareType
supportedHardwareType) (\s :: UpdateOutpost
s@UpdateOutpost' {} Maybe SupportedHardwareType
a -> UpdateOutpost
s {$sel:supportedHardwareType:UpdateOutpost' :: Maybe SupportedHardwareType
supportedHardwareType = Maybe SupportedHardwareType
a} :: UpdateOutpost)

-- | The ID or the Amazon Resource Name (ARN) of the Outpost.
updateOutpost_outpostId :: Lens.Lens' UpdateOutpost Prelude.Text
updateOutpost_outpostId :: Lens' UpdateOutpost Text
updateOutpost_outpostId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateOutpost' {Text
outpostId :: Text
$sel:outpostId:UpdateOutpost' :: UpdateOutpost -> Text
outpostId} -> Text
outpostId) (\s :: UpdateOutpost
s@UpdateOutpost' {} Text
a -> UpdateOutpost
s {$sel:outpostId:UpdateOutpost' :: Text
outpostId = Text
a} :: UpdateOutpost)

instance Core.AWSRequest UpdateOutpost where
  type
    AWSResponse UpdateOutpost =
      UpdateOutpostResponse
  request :: (Service -> Service) -> UpdateOutpost -> Request UpdateOutpost
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 UpdateOutpost
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateOutpost)))
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 ->
          Maybe Outpost -> Int -> UpdateOutpostResponse
UpdateOutpostResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Outpost")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable UpdateOutpost where
  hashWithSalt :: Int -> UpdateOutpost -> Int
hashWithSalt Int
_salt UpdateOutpost' {Maybe Text
Maybe SupportedHardwareType
Text
outpostId :: Text
supportedHardwareType :: Maybe SupportedHardwareType
name :: Maybe Text
description :: Maybe Text
$sel:outpostId:UpdateOutpost' :: UpdateOutpost -> Text
$sel:supportedHardwareType:UpdateOutpost' :: UpdateOutpost -> Maybe SupportedHardwareType
$sel:name:UpdateOutpost' :: UpdateOutpost -> Maybe Text
$sel:description:UpdateOutpost' :: UpdateOutpost -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SupportedHardwareType
supportedHardwareType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
outpostId

instance Prelude.NFData UpdateOutpost where
  rnf :: UpdateOutpost -> ()
rnf UpdateOutpost' {Maybe Text
Maybe SupportedHardwareType
Text
outpostId :: Text
supportedHardwareType :: Maybe SupportedHardwareType
name :: Maybe Text
description :: Maybe Text
$sel:outpostId:UpdateOutpost' :: UpdateOutpost -> Text
$sel:supportedHardwareType:UpdateOutpost' :: UpdateOutpost -> Maybe SupportedHardwareType
$sel:name:UpdateOutpost' :: UpdateOutpost -> Maybe Text
$sel:description:UpdateOutpost' :: UpdateOutpost -> Maybe Text
..} =
    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 Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SupportedHardwareType
supportedHardwareType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
outpostId

instance Data.ToHeaders UpdateOutpost where
  toHeaders :: UpdateOutpost -> 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 UpdateOutpost where
  toJSON :: UpdateOutpost -> Value
toJSON UpdateOutpost' {Maybe Text
Maybe SupportedHardwareType
Text
outpostId :: Text
supportedHardwareType :: Maybe SupportedHardwareType
name :: Maybe Text
description :: Maybe Text
$sel:outpostId:UpdateOutpost' :: UpdateOutpost -> Text
$sel:supportedHardwareType:UpdateOutpost' :: UpdateOutpost -> Maybe SupportedHardwareType
$sel:name:UpdateOutpost' :: UpdateOutpost -> Maybe Text
$sel:description:UpdateOutpost' :: UpdateOutpost -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            (Key
"Name" 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
name,
            (Key
"SupportedHardwareType" 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 SupportedHardwareType
supportedHardwareType
          ]
      )

instance Data.ToPath UpdateOutpost where
  toPath :: UpdateOutpost -> ByteString
toPath UpdateOutpost' {Maybe Text
Maybe SupportedHardwareType
Text
outpostId :: Text
supportedHardwareType :: Maybe SupportedHardwareType
name :: Maybe Text
description :: Maybe Text
$sel:outpostId:UpdateOutpost' :: UpdateOutpost -> Text
$sel:supportedHardwareType:UpdateOutpost' :: UpdateOutpost -> Maybe SupportedHardwareType
$sel:name:UpdateOutpost' :: UpdateOutpost -> Maybe Text
$sel:description:UpdateOutpost' :: UpdateOutpost -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/outposts/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
outpostId]

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

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

-- |
-- Create a value of 'UpdateOutpostResponse' 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:
--
-- 'outpost', 'updateOutpostResponse_outpost' - Undocumented member.
--
-- 'httpStatus', 'updateOutpostResponse_httpStatus' - The response's http status code.
newUpdateOutpostResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateOutpostResponse
newUpdateOutpostResponse :: Int -> UpdateOutpostResponse
newUpdateOutpostResponse Int
pHttpStatus_ =
  UpdateOutpostResponse'
    { $sel:outpost:UpdateOutpostResponse' :: Maybe Outpost
outpost = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateOutpostResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
updateOutpostResponse_outpost :: Lens.Lens' UpdateOutpostResponse (Prelude.Maybe Outpost)
updateOutpostResponse_outpost :: Lens' UpdateOutpostResponse (Maybe Outpost)
updateOutpostResponse_outpost = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateOutpostResponse' {Maybe Outpost
outpost :: Maybe Outpost
$sel:outpost:UpdateOutpostResponse' :: UpdateOutpostResponse -> Maybe Outpost
outpost} -> Maybe Outpost
outpost) (\s :: UpdateOutpostResponse
s@UpdateOutpostResponse' {} Maybe Outpost
a -> UpdateOutpostResponse
s {$sel:outpost:UpdateOutpostResponse' :: Maybe Outpost
outpost = Maybe Outpost
a} :: UpdateOutpostResponse)

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

instance Prelude.NFData UpdateOutpostResponse where
  rnf :: UpdateOutpostResponse -> ()
rnf UpdateOutpostResponse' {Int
Maybe Outpost
httpStatus :: Int
outpost :: Maybe Outpost
$sel:httpStatus:UpdateOutpostResponse' :: UpdateOutpostResponse -> Int
$sel:outpost:UpdateOutpostResponse' :: UpdateOutpostResponse -> Maybe Outpost
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Outpost
outpost
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus