{-# 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.AMP.UpdateWorkspaceAlias
-- 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 AMP workspace alias.
module Amazonka.AMP.UpdateWorkspaceAlias
  ( -- * Creating a Request
    UpdateWorkspaceAlias (..),
    newUpdateWorkspaceAlias,

    -- * Request Lenses
    updateWorkspaceAlias_clientToken,
    updateWorkspaceAlias_alias,
    updateWorkspaceAlias_workspaceId,

    -- * Destructuring the Response
    UpdateWorkspaceAliasResponse (..),
    newUpdateWorkspaceAliasResponse,
  )
where

import Amazonka.AMP.Types
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

-- | Represents the input of an UpdateWorkspaceAlias operation.
--
-- /See:/ 'newUpdateWorkspaceAlias' smart constructor.
data UpdateWorkspaceAlias = UpdateWorkspaceAlias'
  { -- | Optional, unique, case-sensitive, user-provided identifier to ensure the
    -- idempotency of the request.
    UpdateWorkspaceAlias -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The new alias of the workspace.
    UpdateWorkspaceAlias -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
    -- | The ID of the workspace being updated.
    UpdateWorkspaceAlias -> Text
workspaceId :: Prelude.Text
  }
  deriving (UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool
(UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool)
-> (UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool)
-> Eq UpdateWorkspaceAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool
$c/= :: UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool
== :: UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool
$c== :: UpdateWorkspaceAlias -> UpdateWorkspaceAlias -> Bool
Prelude.Eq, ReadPrec [UpdateWorkspaceAlias]
ReadPrec UpdateWorkspaceAlias
Int -> ReadS UpdateWorkspaceAlias
ReadS [UpdateWorkspaceAlias]
(Int -> ReadS UpdateWorkspaceAlias)
-> ReadS [UpdateWorkspaceAlias]
-> ReadPrec UpdateWorkspaceAlias
-> ReadPrec [UpdateWorkspaceAlias]
-> Read UpdateWorkspaceAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkspaceAlias]
$creadListPrec :: ReadPrec [UpdateWorkspaceAlias]
readPrec :: ReadPrec UpdateWorkspaceAlias
$creadPrec :: ReadPrec UpdateWorkspaceAlias
readList :: ReadS [UpdateWorkspaceAlias]
$creadList :: ReadS [UpdateWorkspaceAlias]
readsPrec :: Int -> ReadS UpdateWorkspaceAlias
$creadsPrec :: Int -> ReadS UpdateWorkspaceAlias
Prelude.Read, Int -> UpdateWorkspaceAlias -> ShowS
[UpdateWorkspaceAlias] -> ShowS
UpdateWorkspaceAlias -> String
(Int -> UpdateWorkspaceAlias -> ShowS)
-> (UpdateWorkspaceAlias -> String)
-> ([UpdateWorkspaceAlias] -> ShowS)
-> Show UpdateWorkspaceAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkspaceAlias] -> ShowS
$cshowList :: [UpdateWorkspaceAlias] -> ShowS
show :: UpdateWorkspaceAlias -> String
$cshow :: UpdateWorkspaceAlias -> String
showsPrec :: Int -> UpdateWorkspaceAlias -> ShowS
$cshowsPrec :: Int -> UpdateWorkspaceAlias -> ShowS
Prelude.Show, (forall x. UpdateWorkspaceAlias -> Rep UpdateWorkspaceAlias x)
-> (forall x. Rep UpdateWorkspaceAlias x -> UpdateWorkspaceAlias)
-> Generic UpdateWorkspaceAlias
forall x. Rep UpdateWorkspaceAlias x -> UpdateWorkspaceAlias
forall x. UpdateWorkspaceAlias -> Rep UpdateWorkspaceAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkspaceAlias x -> UpdateWorkspaceAlias
$cfrom :: forall x. UpdateWorkspaceAlias -> Rep UpdateWorkspaceAlias x
Prelude.Generic)

-- |
-- Create a value of 'UpdateWorkspaceAlias' 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:
--
-- 'clientToken', 'updateWorkspaceAlias_clientToken' - Optional, unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
--
-- 'alias', 'updateWorkspaceAlias_alias' - The new alias of the workspace.
--
-- 'workspaceId', 'updateWorkspaceAlias_workspaceId' - The ID of the workspace being updated.
newUpdateWorkspaceAlias ::
  -- | 'workspaceId'
  Prelude.Text ->
  UpdateWorkspaceAlias
newUpdateWorkspaceAlias :: Text -> UpdateWorkspaceAlias
newUpdateWorkspaceAlias Text
pWorkspaceId_ =
  UpdateWorkspaceAlias' :: Maybe Text -> Maybe Text -> Text -> UpdateWorkspaceAlias
UpdateWorkspaceAlias'
    { $sel:clientToken:UpdateWorkspaceAlias' :: Maybe Text
clientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alias:UpdateWorkspaceAlias' :: Maybe Text
alias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:workspaceId:UpdateWorkspaceAlias' :: Text
workspaceId = Text
pWorkspaceId_
    }

-- | Optional, unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
updateWorkspaceAlias_clientToken :: Lens.Lens' UpdateWorkspaceAlias (Prelude.Maybe Prelude.Text)
updateWorkspaceAlias_clientToken :: (Maybe Text -> f (Maybe Text))
-> UpdateWorkspaceAlias -> f UpdateWorkspaceAlias
updateWorkspaceAlias_clientToken = (UpdateWorkspaceAlias -> Maybe Text)
-> (UpdateWorkspaceAlias -> Maybe Text -> UpdateWorkspaceAlias)
-> Lens
     UpdateWorkspaceAlias UpdateWorkspaceAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkspaceAlias' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateWorkspaceAlias
s@UpdateWorkspaceAlias' {} Maybe Text
a -> UpdateWorkspaceAlias
s {$sel:clientToken:UpdateWorkspaceAlias' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateWorkspaceAlias)

-- | The new alias of the workspace.
updateWorkspaceAlias_alias :: Lens.Lens' UpdateWorkspaceAlias (Prelude.Maybe Prelude.Text)
updateWorkspaceAlias_alias :: (Maybe Text -> f (Maybe Text))
-> UpdateWorkspaceAlias -> f UpdateWorkspaceAlias
updateWorkspaceAlias_alias = (UpdateWorkspaceAlias -> Maybe Text)
-> (UpdateWorkspaceAlias -> Maybe Text -> UpdateWorkspaceAlias)
-> Lens
     UpdateWorkspaceAlias UpdateWorkspaceAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkspaceAlias' {Maybe Text
alias :: Maybe Text
$sel:alias:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Maybe Text
alias} -> Maybe Text
alias) (\s :: UpdateWorkspaceAlias
s@UpdateWorkspaceAlias' {} Maybe Text
a -> UpdateWorkspaceAlias
s {$sel:alias:UpdateWorkspaceAlias' :: Maybe Text
alias = Maybe Text
a} :: UpdateWorkspaceAlias)

-- | The ID of the workspace being updated.
updateWorkspaceAlias_workspaceId :: Lens.Lens' UpdateWorkspaceAlias Prelude.Text
updateWorkspaceAlias_workspaceId :: (Text -> f Text) -> UpdateWorkspaceAlias -> f UpdateWorkspaceAlias
updateWorkspaceAlias_workspaceId = (UpdateWorkspaceAlias -> Text)
-> (UpdateWorkspaceAlias -> Text -> UpdateWorkspaceAlias)
-> Lens UpdateWorkspaceAlias UpdateWorkspaceAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkspaceAlias' {Text
workspaceId :: Text
$sel:workspaceId:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Text
workspaceId} -> Text
workspaceId) (\s :: UpdateWorkspaceAlias
s@UpdateWorkspaceAlias' {} Text
a -> UpdateWorkspaceAlias
s {$sel:workspaceId:UpdateWorkspaceAlias' :: Text
workspaceId = Text
a} :: UpdateWorkspaceAlias)

instance Core.AWSRequest UpdateWorkspaceAlias where
  type
    AWSResponse UpdateWorkspaceAlias =
      UpdateWorkspaceAliasResponse
  request :: UpdateWorkspaceAlias -> Request UpdateWorkspaceAlias
request = Service -> UpdateWorkspaceAlias -> Request UpdateWorkspaceAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateWorkspaceAlias
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateWorkspaceAlias)))
response =
    AWSResponse UpdateWorkspaceAlias
-> Logger
-> Service
-> Proxy UpdateWorkspaceAlias
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateWorkspaceAlias)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse UpdateWorkspaceAlias
UpdateWorkspaceAliasResponse
UpdateWorkspaceAliasResponse'

instance Prelude.Hashable UpdateWorkspaceAlias

instance Prelude.NFData UpdateWorkspaceAlias

instance Core.ToHeaders UpdateWorkspaceAlias where
  toHeaders :: UpdateWorkspaceAlias -> [Header]
toHeaders =
    [Header] -> UpdateWorkspaceAlias -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateWorkspaceAlias where
  toJSON :: UpdateWorkspaceAlias -> Value
toJSON UpdateWorkspaceAlias' {Maybe Text
Text
workspaceId :: Text
alias :: Maybe Text
clientToken :: Maybe Text
$sel:workspaceId:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Text
$sel:alias:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Maybe Text
$sel:clientToken:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" 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
clientToken,
            (Text
"alias" 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
alias
          ]
      )

instance Core.ToPath UpdateWorkspaceAlias where
  toPath :: UpdateWorkspaceAlias -> ByteString
toPath UpdateWorkspaceAlias' {Maybe Text
Text
workspaceId :: Text
alias :: Maybe Text
clientToken :: Maybe Text
$sel:workspaceId:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Text
$sel:alias:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Maybe Text
$sel:clientToken:UpdateWorkspaceAlias' :: UpdateWorkspaceAlias -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/workspaces/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId, ByteString
"/alias"]

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

-- | /See:/ 'newUpdateWorkspaceAliasResponse' smart constructor.
data UpdateWorkspaceAliasResponse = UpdateWorkspaceAliasResponse'
  {
  }
  deriving (UpdateWorkspaceAliasResponse
-> UpdateWorkspaceAliasResponse -> Bool
(UpdateWorkspaceAliasResponse
 -> UpdateWorkspaceAliasResponse -> Bool)
-> (UpdateWorkspaceAliasResponse
    -> UpdateWorkspaceAliasResponse -> Bool)
-> Eq UpdateWorkspaceAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkspaceAliasResponse
-> UpdateWorkspaceAliasResponse -> Bool
$c/= :: UpdateWorkspaceAliasResponse
-> UpdateWorkspaceAliasResponse -> Bool
== :: UpdateWorkspaceAliasResponse
-> UpdateWorkspaceAliasResponse -> Bool
$c== :: UpdateWorkspaceAliasResponse
-> UpdateWorkspaceAliasResponse -> Bool
Prelude.Eq, ReadPrec [UpdateWorkspaceAliasResponse]
ReadPrec UpdateWorkspaceAliasResponse
Int -> ReadS UpdateWorkspaceAliasResponse
ReadS [UpdateWorkspaceAliasResponse]
(Int -> ReadS UpdateWorkspaceAliasResponse)
-> ReadS [UpdateWorkspaceAliasResponse]
-> ReadPrec UpdateWorkspaceAliasResponse
-> ReadPrec [UpdateWorkspaceAliasResponse]
-> Read UpdateWorkspaceAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkspaceAliasResponse]
$creadListPrec :: ReadPrec [UpdateWorkspaceAliasResponse]
readPrec :: ReadPrec UpdateWorkspaceAliasResponse
$creadPrec :: ReadPrec UpdateWorkspaceAliasResponse
readList :: ReadS [UpdateWorkspaceAliasResponse]
$creadList :: ReadS [UpdateWorkspaceAliasResponse]
readsPrec :: Int -> ReadS UpdateWorkspaceAliasResponse
$creadsPrec :: Int -> ReadS UpdateWorkspaceAliasResponse
Prelude.Read, Int -> UpdateWorkspaceAliasResponse -> ShowS
[UpdateWorkspaceAliasResponse] -> ShowS
UpdateWorkspaceAliasResponse -> String
(Int -> UpdateWorkspaceAliasResponse -> ShowS)
-> (UpdateWorkspaceAliasResponse -> String)
-> ([UpdateWorkspaceAliasResponse] -> ShowS)
-> Show UpdateWorkspaceAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkspaceAliasResponse] -> ShowS
$cshowList :: [UpdateWorkspaceAliasResponse] -> ShowS
show :: UpdateWorkspaceAliasResponse -> String
$cshow :: UpdateWorkspaceAliasResponse -> String
showsPrec :: Int -> UpdateWorkspaceAliasResponse -> ShowS
$cshowsPrec :: Int -> UpdateWorkspaceAliasResponse -> ShowS
Prelude.Show, (forall x.
 UpdateWorkspaceAliasResponse -> Rep UpdateWorkspaceAliasResponse x)
-> (forall x.
    Rep UpdateWorkspaceAliasResponse x -> UpdateWorkspaceAliasResponse)
-> Generic UpdateWorkspaceAliasResponse
forall x.
Rep UpdateWorkspaceAliasResponse x -> UpdateWorkspaceAliasResponse
forall x.
UpdateWorkspaceAliasResponse -> Rep UpdateWorkspaceAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateWorkspaceAliasResponse x -> UpdateWorkspaceAliasResponse
$cfrom :: forall x.
UpdateWorkspaceAliasResponse -> Rep UpdateWorkspaceAliasResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateWorkspaceAliasResponse' 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.
newUpdateWorkspaceAliasResponse ::
  UpdateWorkspaceAliasResponse
newUpdateWorkspaceAliasResponse :: UpdateWorkspaceAliasResponse
newUpdateWorkspaceAliasResponse =
  UpdateWorkspaceAliasResponse
UpdateWorkspaceAliasResponse'

instance Prelude.NFData UpdateWorkspaceAliasResponse