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

    -- * Request Lenses
    updateFleetMetadata_optimizeForEndUserLocation,
    updateFleetMetadata_displayName,
    updateFleetMetadata_fleetArn,

    -- * Destructuring the Response
    UpdateFleetMetadataResponse (..),
    newUpdateFleetMetadataResponse,

    -- * Response Lenses
    updateFleetMetadataResponse_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:/ 'newUpdateFleetMetadata' smart constructor.
data UpdateFleetMetadata = UpdateFleetMetadata'
  { -- | The option to optimize for better performance by routing traffic through
    -- the closest AWS Region to users, which may be outside of your home
    -- Region.
    UpdateFleetMetadata -> Maybe Bool
optimizeForEndUserLocation :: Prelude.Maybe Prelude.Bool,
    -- | The fleet name to display. The existing DisplayName is unset if null is
    -- passed.
    UpdateFleetMetadata -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the fleet.
    UpdateFleetMetadata -> Text
fleetArn :: Prelude.Text
  }
  deriving (UpdateFleetMetadata -> UpdateFleetMetadata -> Bool
(UpdateFleetMetadata -> UpdateFleetMetadata -> Bool)
-> (UpdateFleetMetadata -> UpdateFleetMetadata -> Bool)
-> Eq UpdateFleetMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFleetMetadata -> UpdateFleetMetadata -> Bool
$c/= :: UpdateFleetMetadata -> UpdateFleetMetadata -> Bool
== :: UpdateFleetMetadata -> UpdateFleetMetadata -> Bool
$c== :: UpdateFleetMetadata -> UpdateFleetMetadata -> Bool
Prelude.Eq, ReadPrec [UpdateFleetMetadata]
ReadPrec UpdateFleetMetadata
Int -> ReadS UpdateFleetMetadata
ReadS [UpdateFleetMetadata]
(Int -> ReadS UpdateFleetMetadata)
-> ReadS [UpdateFleetMetadata]
-> ReadPrec UpdateFleetMetadata
-> ReadPrec [UpdateFleetMetadata]
-> Read UpdateFleetMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFleetMetadata]
$creadListPrec :: ReadPrec [UpdateFleetMetadata]
readPrec :: ReadPrec UpdateFleetMetadata
$creadPrec :: ReadPrec UpdateFleetMetadata
readList :: ReadS [UpdateFleetMetadata]
$creadList :: ReadS [UpdateFleetMetadata]
readsPrec :: Int -> ReadS UpdateFleetMetadata
$creadsPrec :: Int -> ReadS UpdateFleetMetadata
Prelude.Read, Int -> UpdateFleetMetadata -> ShowS
[UpdateFleetMetadata] -> ShowS
UpdateFleetMetadata -> String
(Int -> UpdateFleetMetadata -> ShowS)
-> (UpdateFleetMetadata -> String)
-> ([UpdateFleetMetadata] -> ShowS)
-> Show UpdateFleetMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFleetMetadata] -> ShowS
$cshowList :: [UpdateFleetMetadata] -> ShowS
show :: UpdateFleetMetadata -> String
$cshow :: UpdateFleetMetadata -> String
showsPrec :: Int -> UpdateFleetMetadata -> ShowS
$cshowsPrec :: Int -> UpdateFleetMetadata -> ShowS
Prelude.Show, (forall x. UpdateFleetMetadata -> Rep UpdateFleetMetadata x)
-> (forall x. Rep UpdateFleetMetadata x -> UpdateFleetMetadata)
-> Generic UpdateFleetMetadata
forall x. Rep UpdateFleetMetadata x -> UpdateFleetMetadata
forall x. UpdateFleetMetadata -> Rep UpdateFleetMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFleetMetadata x -> UpdateFleetMetadata
$cfrom :: forall x. UpdateFleetMetadata -> Rep UpdateFleetMetadata x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFleetMetadata' 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:
--
-- 'optimizeForEndUserLocation', 'updateFleetMetadata_optimizeForEndUserLocation' - The option to optimize for better performance by routing traffic through
-- the closest AWS Region to users, which may be outside of your home
-- Region.
--
-- 'displayName', 'updateFleetMetadata_displayName' - The fleet name to display. The existing DisplayName is unset if null is
-- passed.
--
-- 'fleetArn', 'updateFleetMetadata_fleetArn' - The ARN of the fleet.
newUpdateFleetMetadata ::
  -- | 'fleetArn'
  Prelude.Text ->
  UpdateFleetMetadata
newUpdateFleetMetadata :: Text -> UpdateFleetMetadata
newUpdateFleetMetadata Text
pFleetArn_ =
  UpdateFleetMetadata' :: Maybe Bool -> Maybe Text -> Text -> UpdateFleetMetadata
UpdateFleetMetadata'
    { $sel:optimizeForEndUserLocation:UpdateFleetMetadata' :: Maybe Bool
optimizeForEndUserLocation =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:UpdateFleetMetadata' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:UpdateFleetMetadata' :: Text
fleetArn = Text
pFleetArn_
    }

-- | The option to optimize for better performance by routing traffic through
-- the closest AWS Region to users, which may be outside of your home
-- Region.
updateFleetMetadata_optimizeForEndUserLocation :: Lens.Lens' UpdateFleetMetadata (Prelude.Maybe Prelude.Bool)
updateFleetMetadata_optimizeForEndUserLocation :: (Maybe Bool -> f (Maybe Bool))
-> UpdateFleetMetadata -> f UpdateFleetMetadata
updateFleetMetadata_optimizeForEndUserLocation = (UpdateFleetMetadata -> Maybe Bool)
-> (UpdateFleetMetadata -> Maybe Bool -> UpdateFleetMetadata)
-> Lens
     UpdateFleetMetadata UpdateFleetMetadata (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetadata' {Maybe Bool
optimizeForEndUserLocation :: Maybe Bool
$sel:optimizeForEndUserLocation:UpdateFleetMetadata' :: UpdateFleetMetadata -> Maybe Bool
optimizeForEndUserLocation} -> Maybe Bool
optimizeForEndUserLocation) (\s :: UpdateFleetMetadata
s@UpdateFleetMetadata' {} Maybe Bool
a -> UpdateFleetMetadata
s {$sel:optimizeForEndUserLocation:UpdateFleetMetadata' :: Maybe Bool
optimizeForEndUserLocation = Maybe Bool
a} :: UpdateFleetMetadata)

-- | The fleet name to display. The existing DisplayName is unset if null is
-- passed.
updateFleetMetadata_displayName :: Lens.Lens' UpdateFleetMetadata (Prelude.Maybe Prelude.Text)
updateFleetMetadata_displayName :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetMetadata -> f UpdateFleetMetadata
updateFleetMetadata_displayName = (UpdateFleetMetadata -> Maybe Text)
-> (UpdateFleetMetadata -> Maybe Text -> UpdateFleetMetadata)
-> Lens
     UpdateFleetMetadata UpdateFleetMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetadata' {Maybe Text
displayName :: Maybe Text
$sel:displayName:UpdateFleetMetadata' :: UpdateFleetMetadata -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: UpdateFleetMetadata
s@UpdateFleetMetadata' {} Maybe Text
a -> UpdateFleetMetadata
s {$sel:displayName:UpdateFleetMetadata' :: Maybe Text
displayName = Maybe Text
a} :: UpdateFleetMetadata)

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

instance Core.AWSRequest UpdateFleetMetadata where
  type
    AWSResponse UpdateFleetMetadata =
      UpdateFleetMetadataResponse
  request :: UpdateFleetMetadata -> Request UpdateFleetMetadata
request = Service -> UpdateFleetMetadata -> Request UpdateFleetMetadata
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFleetMetadata
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFleetMetadata)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateFleetMetadata))
-> Logger
-> Service
-> Proxy UpdateFleetMetadata
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFleetMetadata)))
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 -> UpdateFleetMetadataResponse
UpdateFleetMetadataResponse'
            (Int -> UpdateFleetMetadataResponse)
-> Either String Int -> Either String UpdateFleetMetadataResponse
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 UpdateFleetMetadata

instance Prelude.NFData UpdateFleetMetadata

instance Core.ToHeaders UpdateFleetMetadata where
  toHeaders :: UpdateFleetMetadata -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateFleetMetadata -> 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 UpdateFleetMetadata where
  toJSON :: UpdateFleetMetadata -> Value
toJSON UpdateFleetMetadata' {Maybe Bool
Maybe Text
Text
fleetArn :: Text
displayName :: Maybe Text
optimizeForEndUserLocation :: Maybe Bool
$sel:fleetArn:UpdateFleetMetadata' :: UpdateFleetMetadata -> Text
$sel:displayName:UpdateFleetMetadata' :: UpdateFleetMetadata -> Maybe Text
$sel:optimizeForEndUserLocation:UpdateFleetMetadata' :: UpdateFleetMetadata -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OptimizeForEndUserLocation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
optimizeForEndUserLocation,
            (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)
          ]
      )

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

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

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

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

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

instance Prelude.NFData UpdateFleetMetadataResponse