{-# 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.WorkLink.UpdateDomainMetadata
-- 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 domain metadata, such as DisplayName.
module Amazonka.WorkLink.UpdateDomainMetadata
  ( -- * Creating a Request
    UpdateDomainMetadata (..),
    newUpdateDomainMetadata,

    -- * Request Lenses
    updateDomainMetadata_displayName,
    updateDomainMetadata_fleetArn,
    updateDomainMetadata_domainName,

    -- * Destructuring the Response
    UpdateDomainMetadataResponse (..),
    newUpdateDomainMetadataResponse,

    -- * Response Lenses
    updateDomainMetadataResponse_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.WorkLink.Types

-- | /See:/ 'newUpdateDomainMetadata' smart constructor.
data UpdateDomainMetadata = UpdateDomainMetadata'
  { -- | The name to display.
    UpdateDomainMetadata -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the fleet.
    UpdateDomainMetadata -> Text
fleetArn :: Prelude.Text,
    -- | The name of the domain.
    UpdateDomainMetadata -> Text
domainName :: Prelude.Text
  }
  deriving (UpdateDomainMetadata -> UpdateDomainMetadata -> Bool
(UpdateDomainMetadata -> UpdateDomainMetadata -> Bool)
-> (UpdateDomainMetadata -> UpdateDomainMetadata -> Bool)
-> Eq UpdateDomainMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDomainMetadata -> UpdateDomainMetadata -> Bool
$c/= :: UpdateDomainMetadata -> UpdateDomainMetadata -> Bool
== :: UpdateDomainMetadata -> UpdateDomainMetadata -> Bool
$c== :: UpdateDomainMetadata -> UpdateDomainMetadata -> Bool
Prelude.Eq, ReadPrec [UpdateDomainMetadata]
ReadPrec UpdateDomainMetadata
Int -> ReadS UpdateDomainMetadata
ReadS [UpdateDomainMetadata]
(Int -> ReadS UpdateDomainMetadata)
-> ReadS [UpdateDomainMetadata]
-> ReadPrec UpdateDomainMetadata
-> ReadPrec [UpdateDomainMetadata]
-> Read UpdateDomainMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDomainMetadata]
$creadListPrec :: ReadPrec [UpdateDomainMetadata]
readPrec :: ReadPrec UpdateDomainMetadata
$creadPrec :: ReadPrec UpdateDomainMetadata
readList :: ReadS [UpdateDomainMetadata]
$creadList :: ReadS [UpdateDomainMetadata]
readsPrec :: Int -> ReadS UpdateDomainMetadata
$creadsPrec :: Int -> ReadS UpdateDomainMetadata
Prelude.Read, Int -> UpdateDomainMetadata -> ShowS
[UpdateDomainMetadata] -> ShowS
UpdateDomainMetadata -> String
(Int -> UpdateDomainMetadata -> ShowS)
-> (UpdateDomainMetadata -> String)
-> ([UpdateDomainMetadata] -> ShowS)
-> Show UpdateDomainMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDomainMetadata] -> ShowS
$cshowList :: [UpdateDomainMetadata] -> ShowS
show :: UpdateDomainMetadata -> String
$cshow :: UpdateDomainMetadata -> String
showsPrec :: Int -> UpdateDomainMetadata -> ShowS
$cshowsPrec :: Int -> UpdateDomainMetadata -> ShowS
Prelude.Show, (forall x. UpdateDomainMetadata -> Rep UpdateDomainMetadata x)
-> (forall x. Rep UpdateDomainMetadata x -> UpdateDomainMetadata)
-> Generic UpdateDomainMetadata
forall x. Rep UpdateDomainMetadata x -> UpdateDomainMetadata
forall x. UpdateDomainMetadata -> Rep UpdateDomainMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDomainMetadata x -> UpdateDomainMetadata
$cfrom :: forall x. UpdateDomainMetadata -> Rep UpdateDomainMetadata x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDomainMetadata' 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:
--
-- 'displayName', 'updateDomainMetadata_displayName' - The name to display.
--
-- 'fleetArn', 'updateDomainMetadata_fleetArn' - The ARN of the fleet.
--
-- 'domainName', 'updateDomainMetadata_domainName' - The name of the domain.
newUpdateDomainMetadata ::
  -- | 'fleetArn'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  UpdateDomainMetadata
newUpdateDomainMetadata :: Text -> Text -> UpdateDomainMetadata
newUpdateDomainMetadata Text
pFleetArn_ Text
pDomainName_ =
  UpdateDomainMetadata' :: Maybe Text -> Text -> Text -> UpdateDomainMetadata
UpdateDomainMetadata'
    { $sel:displayName:UpdateDomainMetadata' :: Maybe Text
displayName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:UpdateDomainMetadata' :: Text
fleetArn = Text
pFleetArn_,
      $sel:domainName:UpdateDomainMetadata' :: Text
domainName = Text
pDomainName_
    }

-- | The name to display.
updateDomainMetadata_displayName :: Lens.Lens' UpdateDomainMetadata (Prelude.Maybe Prelude.Text)
updateDomainMetadata_displayName :: (Maybe Text -> f (Maybe Text))
-> UpdateDomainMetadata -> f UpdateDomainMetadata
updateDomainMetadata_displayName = (UpdateDomainMetadata -> Maybe Text)
-> (UpdateDomainMetadata -> Maybe Text -> UpdateDomainMetadata)
-> Lens
     UpdateDomainMetadata UpdateDomainMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainMetadata' {Maybe Text
displayName :: Maybe Text
$sel:displayName:UpdateDomainMetadata' :: UpdateDomainMetadata -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: UpdateDomainMetadata
s@UpdateDomainMetadata' {} Maybe Text
a -> UpdateDomainMetadata
s {$sel:displayName:UpdateDomainMetadata' :: Maybe Text
displayName = Maybe Text
a} :: UpdateDomainMetadata)

-- | The ARN of the fleet.
updateDomainMetadata_fleetArn :: Lens.Lens' UpdateDomainMetadata Prelude.Text
updateDomainMetadata_fleetArn :: (Text -> f Text) -> UpdateDomainMetadata -> f UpdateDomainMetadata
updateDomainMetadata_fleetArn = (UpdateDomainMetadata -> Text)
-> (UpdateDomainMetadata -> Text -> UpdateDomainMetadata)
-> Lens UpdateDomainMetadata UpdateDomainMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainMetadata' {Text
fleetArn :: Text
$sel:fleetArn:UpdateDomainMetadata' :: UpdateDomainMetadata -> Text
fleetArn} -> Text
fleetArn) (\s :: UpdateDomainMetadata
s@UpdateDomainMetadata' {} Text
a -> UpdateDomainMetadata
s {$sel:fleetArn:UpdateDomainMetadata' :: Text
fleetArn = Text
a} :: UpdateDomainMetadata)

-- | The name of the domain.
updateDomainMetadata_domainName :: Lens.Lens' UpdateDomainMetadata Prelude.Text
updateDomainMetadata_domainName :: (Text -> f Text) -> UpdateDomainMetadata -> f UpdateDomainMetadata
updateDomainMetadata_domainName = (UpdateDomainMetadata -> Text)
-> (UpdateDomainMetadata -> Text -> UpdateDomainMetadata)
-> Lens UpdateDomainMetadata UpdateDomainMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainMetadata' {Text
domainName :: Text
$sel:domainName:UpdateDomainMetadata' :: UpdateDomainMetadata -> Text
domainName} -> Text
domainName) (\s :: UpdateDomainMetadata
s@UpdateDomainMetadata' {} Text
a -> UpdateDomainMetadata
s {$sel:domainName:UpdateDomainMetadata' :: Text
domainName = Text
a} :: UpdateDomainMetadata)

instance Core.AWSRequest UpdateDomainMetadata where
  type
    AWSResponse UpdateDomainMetadata =
      UpdateDomainMetadataResponse
  request :: UpdateDomainMetadata -> Request UpdateDomainMetadata
request = Service -> UpdateDomainMetadata -> Request UpdateDomainMetadata
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateDomainMetadata
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDomainMetadata)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateDomainMetadata))
-> Logger
-> Service
-> Proxy UpdateDomainMetadata
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDomainMetadata)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateDomainMetadataResponse
UpdateDomainMetadataResponse'
            (Int -> UpdateDomainMetadataResponse)
-> Either String Int -> Either String UpdateDomainMetadataResponse
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))
      )

instance Prelude.Hashable UpdateDomainMetadata

instance Prelude.NFData UpdateDomainMetadata

instance Core.ToHeaders UpdateDomainMetadata where
  toHeaders :: UpdateDomainMetadata -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateDomainMetadata -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 UpdateDomainMetadata where
  toJSON :: UpdateDomainMetadata -> Value
toJSON UpdateDomainMetadata' {Maybe Text
Text
domainName :: Text
fleetArn :: Text
displayName :: Maybe Text
$sel:domainName:UpdateDomainMetadata' :: UpdateDomainMetadata -> Text
$sel:fleetArn:UpdateDomainMetadata' :: UpdateDomainMetadata -> Text
$sel:displayName:UpdateDomainMetadata' :: UpdateDomainMetadata -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DisplayName" 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
displayName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FleetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateDomainMetadataResponse' 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', 'updateDomainMetadataResponse_httpStatus' - The response's http status code.
newUpdateDomainMetadataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateDomainMetadataResponse
newUpdateDomainMetadataResponse :: Int -> UpdateDomainMetadataResponse
newUpdateDomainMetadataResponse Int
pHttpStatus_ =
  UpdateDomainMetadataResponse' :: Int -> UpdateDomainMetadataResponse
UpdateDomainMetadataResponse'
    { $sel:httpStatus:UpdateDomainMetadataResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UpdateDomainMetadataResponse