{-# 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.GameLift.UpdateFleetAttributes
-- 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 a fleet\'s mutable attributes, including game session protection
-- and resource creation limits.
--
-- To update fleet attributes, specify the fleet ID and the property values
-- that you want to change.
--
-- If successful, an updated @FleetAttributes@ object is returned.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-intro.html Setting up GameLift fleets>
--
-- __Related actions__
--
-- CreateFleetLocations | UpdateFleetAttributes | UpdateFleetCapacity |
-- UpdateFleetPortSettings | UpdateRuntimeConfiguration | StopFleetActions
-- | StartFleetActions | PutScalingPolicy | DeleteFleet |
-- DeleteFleetLocations | DeleteScalingPolicy |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
module Amazonka.GameLift.UpdateFleetAttributes
  ( -- * Creating a Request
    UpdateFleetAttributes (..),
    newUpdateFleetAttributes,

    -- * Request Lenses
    updateFleetAttributes_newGameSessionProtectionPolicy,
    updateFleetAttributes_name,
    updateFleetAttributes_metricGroups,
    updateFleetAttributes_description,
    updateFleetAttributes_resourceCreationLimitPolicy,
    updateFleetAttributes_fleetId,

    -- * Destructuring the Response
    UpdateFleetAttributesResponse (..),
    newUpdateFleetAttributesResponse,

    -- * Response Lenses
    updateFleetAttributesResponse_fleetId,
    updateFleetAttributesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types
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 for a request operation.
--
-- /See:/ 'newUpdateFleetAttributes' smart constructor.
data UpdateFleetAttributes = UpdateFleetAttributes'
  { -- | The game session protection policy to apply to all new instances created
    -- in this fleet. Instances that already exist are not affected. You can
    -- set protection for individual instances using UpdateGameSession.
    --
    -- -   __NoProtection__ -- The game session can be terminated during a
    --     scale-down event.
    --
    -- -   __FullProtection__ -- If the game session is in an @ACTIVE@ status,
    --     it cannot be terminated during a scale-down event.
    UpdateFleetAttributes -> Maybe ProtectionPolicy
newGameSessionProtectionPolicy' :: Prelude.Maybe ProtectionPolicy,
    -- | A descriptive label that is associated with a fleet. Fleet names do not
    -- need to be unique.
    UpdateFleetAttributes -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The name of a metric group to add this fleet to. Use a metric group in
    -- Amazon CloudWatch to aggregate the metrics from multiple fleets. Provide
    -- an existing metric group name, or create a new metric group by providing
    -- a new name. A fleet can only be in one metric group at a time.
    UpdateFleetAttributes -> Maybe [Text]
metricGroups :: Prelude.Maybe [Prelude.Text],
    -- | A human-readable description of a fleet.
    UpdateFleetAttributes -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Policy settings that limit the number of game sessions an individual
    -- player can create over a span of time.
    UpdateFleetAttributes -> Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy :: Prelude.Maybe ResourceCreationLimitPolicy,
    -- | A unique identifier for the fleet to update attribute metadata for. You
    -- can use either the fleet ID or ARN value.
    UpdateFleetAttributes -> Text
fleetId :: Prelude.Text
  }
  deriving (UpdateFleetAttributes -> UpdateFleetAttributes -> Bool
(UpdateFleetAttributes -> UpdateFleetAttributes -> Bool)
-> (UpdateFleetAttributes -> UpdateFleetAttributes -> Bool)
-> Eq UpdateFleetAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFleetAttributes -> UpdateFleetAttributes -> Bool
$c/= :: UpdateFleetAttributes -> UpdateFleetAttributes -> Bool
== :: UpdateFleetAttributes -> UpdateFleetAttributes -> Bool
$c== :: UpdateFleetAttributes -> UpdateFleetAttributes -> Bool
Prelude.Eq, ReadPrec [UpdateFleetAttributes]
ReadPrec UpdateFleetAttributes
Int -> ReadS UpdateFleetAttributes
ReadS [UpdateFleetAttributes]
(Int -> ReadS UpdateFleetAttributes)
-> ReadS [UpdateFleetAttributes]
-> ReadPrec UpdateFleetAttributes
-> ReadPrec [UpdateFleetAttributes]
-> Read UpdateFleetAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFleetAttributes]
$creadListPrec :: ReadPrec [UpdateFleetAttributes]
readPrec :: ReadPrec UpdateFleetAttributes
$creadPrec :: ReadPrec UpdateFleetAttributes
readList :: ReadS [UpdateFleetAttributes]
$creadList :: ReadS [UpdateFleetAttributes]
readsPrec :: Int -> ReadS UpdateFleetAttributes
$creadsPrec :: Int -> ReadS UpdateFleetAttributes
Prelude.Read, Int -> UpdateFleetAttributes -> ShowS
[UpdateFleetAttributes] -> ShowS
UpdateFleetAttributes -> String
(Int -> UpdateFleetAttributes -> ShowS)
-> (UpdateFleetAttributes -> String)
-> ([UpdateFleetAttributes] -> ShowS)
-> Show UpdateFleetAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFleetAttributes] -> ShowS
$cshowList :: [UpdateFleetAttributes] -> ShowS
show :: UpdateFleetAttributes -> String
$cshow :: UpdateFleetAttributes -> String
showsPrec :: Int -> UpdateFleetAttributes -> ShowS
$cshowsPrec :: Int -> UpdateFleetAttributes -> ShowS
Prelude.Show, (forall x. UpdateFleetAttributes -> Rep UpdateFleetAttributes x)
-> (forall x. Rep UpdateFleetAttributes x -> UpdateFleetAttributes)
-> Generic UpdateFleetAttributes
forall x. Rep UpdateFleetAttributes x -> UpdateFleetAttributes
forall x. UpdateFleetAttributes -> Rep UpdateFleetAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFleetAttributes x -> UpdateFleetAttributes
$cfrom :: forall x. UpdateFleetAttributes -> Rep UpdateFleetAttributes x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFleetAttributes' 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:
--
-- 'newGameSessionProtectionPolicy'', 'updateFleetAttributes_newGameSessionProtectionPolicy' - The game session protection policy to apply to all new instances created
-- in this fleet. Instances that already exist are not affected. You can
-- set protection for individual instances using UpdateGameSession.
--
-- -   __NoProtection__ -- The game session can be terminated during a
--     scale-down event.
--
-- -   __FullProtection__ -- If the game session is in an @ACTIVE@ status,
--     it cannot be terminated during a scale-down event.
--
-- 'name', 'updateFleetAttributes_name' - A descriptive label that is associated with a fleet. Fleet names do not
-- need to be unique.
--
-- 'metricGroups', 'updateFleetAttributes_metricGroups' - The name of a metric group to add this fleet to. Use a metric group in
-- Amazon CloudWatch to aggregate the metrics from multiple fleets. Provide
-- an existing metric group name, or create a new metric group by providing
-- a new name. A fleet can only be in one metric group at a time.
--
-- 'description', 'updateFleetAttributes_description' - A human-readable description of a fleet.
--
-- 'resourceCreationLimitPolicy', 'updateFleetAttributes_resourceCreationLimitPolicy' - Policy settings that limit the number of game sessions an individual
-- player can create over a span of time.
--
-- 'fleetId', 'updateFleetAttributes_fleetId' - A unique identifier for the fleet to update attribute metadata for. You
-- can use either the fleet ID or ARN value.
newUpdateFleetAttributes ::
  -- | 'fleetId'
  Prelude.Text ->
  UpdateFleetAttributes
newUpdateFleetAttributes :: Text -> UpdateFleetAttributes
newUpdateFleetAttributes Text
pFleetId_ =
  UpdateFleetAttributes' :: Maybe ProtectionPolicy
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe ResourceCreationLimitPolicy
-> Text
-> UpdateFleetAttributes
UpdateFleetAttributes'
    { $sel:newGameSessionProtectionPolicy':UpdateFleetAttributes' :: Maybe ProtectionPolicy
newGameSessionProtectionPolicy' =
        Maybe ProtectionPolicy
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateFleetAttributes' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metricGroups:UpdateFleetAttributes' :: Maybe [Text]
metricGroups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateFleetAttributes' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceCreationLimitPolicy:UpdateFleetAttributes' :: Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy = Maybe ResourceCreationLimitPolicy
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:UpdateFleetAttributes' :: Text
fleetId = Text
pFleetId_
    }

-- | The game session protection policy to apply to all new instances created
-- in this fleet. Instances that already exist are not affected. You can
-- set protection for individual instances using UpdateGameSession.
--
-- -   __NoProtection__ -- The game session can be terminated during a
--     scale-down event.
--
-- -   __FullProtection__ -- If the game session is in an @ACTIVE@ status,
--     it cannot be terminated during a scale-down event.
updateFleetAttributes_newGameSessionProtectionPolicy :: Lens.Lens' UpdateFleetAttributes (Prelude.Maybe ProtectionPolicy)
updateFleetAttributes_newGameSessionProtectionPolicy :: (Maybe ProtectionPolicy -> f (Maybe ProtectionPolicy))
-> UpdateFleetAttributes -> f UpdateFleetAttributes
updateFleetAttributes_newGameSessionProtectionPolicy = (UpdateFleetAttributes -> Maybe ProtectionPolicy)
-> (UpdateFleetAttributes
    -> Maybe ProtectionPolicy -> UpdateFleetAttributes)
-> Lens
     UpdateFleetAttributes
     UpdateFleetAttributes
     (Maybe ProtectionPolicy)
     (Maybe ProtectionPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributes' {Maybe ProtectionPolicy
newGameSessionProtectionPolicy' :: Maybe ProtectionPolicy
$sel:newGameSessionProtectionPolicy':UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe ProtectionPolicy
newGameSessionProtectionPolicy'} -> Maybe ProtectionPolicy
newGameSessionProtectionPolicy') (\s :: UpdateFleetAttributes
s@UpdateFleetAttributes' {} Maybe ProtectionPolicy
a -> UpdateFleetAttributes
s {$sel:newGameSessionProtectionPolicy':UpdateFleetAttributes' :: Maybe ProtectionPolicy
newGameSessionProtectionPolicy' = Maybe ProtectionPolicy
a} :: UpdateFleetAttributes)

-- | A descriptive label that is associated with a fleet. Fleet names do not
-- need to be unique.
updateFleetAttributes_name :: Lens.Lens' UpdateFleetAttributes (Prelude.Maybe Prelude.Text)
updateFleetAttributes_name :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetAttributes -> f UpdateFleetAttributes
updateFleetAttributes_name = (UpdateFleetAttributes -> Maybe Text)
-> (UpdateFleetAttributes -> Maybe Text -> UpdateFleetAttributes)
-> Lens
     UpdateFleetAttributes
     UpdateFleetAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributes' {Maybe Text
name :: Maybe Text
$sel:name:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateFleetAttributes
s@UpdateFleetAttributes' {} Maybe Text
a -> UpdateFleetAttributes
s {$sel:name:UpdateFleetAttributes' :: Maybe Text
name = Maybe Text
a} :: UpdateFleetAttributes)

-- | The name of a metric group to add this fleet to. Use a metric group in
-- Amazon CloudWatch to aggregate the metrics from multiple fleets. Provide
-- an existing metric group name, or create a new metric group by providing
-- a new name. A fleet can only be in one metric group at a time.
updateFleetAttributes_metricGroups :: Lens.Lens' UpdateFleetAttributes (Prelude.Maybe [Prelude.Text])
updateFleetAttributes_metricGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateFleetAttributes -> f UpdateFleetAttributes
updateFleetAttributes_metricGroups = (UpdateFleetAttributes -> Maybe [Text])
-> (UpdateFleetAttributes -> Maybe [Text] -> UpdateFleetAttributes)
-> Lens
     UpdateFleetAttributes
     UpdateFleetAttributes
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributes' {Maybe [Text]
metricGroups :: Maybe [Text]
$sel:metricGroups:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe [Text]
metricGroups} -> Maybe [Text]
metricGroups) (\s :: UpdateFleetAttributes
s@UpdateFleetAttributes' {} Maybe [Text]
a -> UpdateFleetAttributes
s {$sel:metricGroups:UpdateFleetAttributes' :: Maybe [Text]
metricGroups = Maybe [Text]
a} :: UpdateFleetAttributes) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateFleetAttributes -> f UpdateFleetAttributes)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateFleetAttributes
-> f UpdateFleetAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A human-readable description of a fleet.
updateFleetAttributes_description :: Lens.Lens' UpdateFleetAttributes (Prelude.Maybe Prelude.Text)
updateFleetAttributes_description :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetAttributes -> f UpdateFleetAttributes
updateFleetAttributes_description = (UpdateFleetAttributes -> Maybe Text)
-> (UpdateFleetAttributes -> Maybe Text -> UpdateFleetAttributes)
-> Lens
     UpdateFleetAttributes
     UpdateFleetAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributes' {Maybe Text
description :: Maybe Text
$sel:description:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateFleetAttributes
s@UpdateFleetAttributes' {} Maybe Text
a -> UpdateFleetAttributes
s {$sel:description:UpdateFleetAttributes' :: Maybe Text
description = Maybe Text
a} :: UpdateFleetAttributes)

-- | Policy settings that limit the number of game sessions an individual
-- player can create over a span of time.
updateFleetAttributes_resourceCreationLimitPolicy :: Lens.Lens' UpdateFleetAttributes (Prelude.Maybe ResourceCreationLimitPolicy)
updateFleetAttributes_resourceCreationLimitPolicy :: (Maybe ResourceCreationLimitPolicy
 -> f (Maybe ResourceCreationLimitPolicy))
-> UpdateFleetAttributes -> f UpdateFleetAttributes
updateFleetAttributes_resourceCreationLimitPolicy = (UpdateFleetAttributes -> Maybe ResourceCreationLimitPolicy)
-> (UpdateFleetAttributes
    -> Maybe ResourceCreationLimitPolicy -> UpdateFleetAttributes)
-> Lens
     UpdateFleetAttributes
     UpdateFleetAttributes
     (Maybe ResourceCreationLimitPolicy)
     (Maybe ResourceCreationLimitPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributes' {Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy :: Maybe ResourceCreationLimitPolicy
$sel:resourceCreationLimitPolicy:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy} -> Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy) (\s :: UpdateFleetAttributes
s@UpdateFleetAttributes' {} Maybe ResourceCreationLimitPolicy
a -> UpdateFleetAttributes
s {$sel:resourceCreationLimitPolicy:UpdateFleetAttributes' :: Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy = Maybe ResourceCreationLimitPolicy
a} :: UpdateFleetAttributes)

-- | A unique identifier for the fleet to update attribute metadata for. You
-- can use either the fleet ID or ARN value.
updateFleetAttributes_fleetId :: Lens.Lens' UpdateFleetAttributes Prelude.Text
updateFleetAttributes_fleetId :: (Text -> f Text)
-> UpdateFleetAttributes -> f UpdateFleetAttributes
updateFleetAttributes_fleetId = (UpdateFleetAttributes -> Text)
-> (UpdateFleetAttributes -> Text -> UpdateFleetAttributes)
-> Lens UpdateFleetAttributes UpdateFleetAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributes' {Text
fleetId :: Text
$sel:fleetId:UpdateFleetAttributes' :: UpdateFleetAttributes -> Text
fleetId} -> Text
fleetId) (\s :: UpdateFleetAttributes
s@UpdateFleetAttributes' {} Text
a -> UpdateFleetAttributes
s {$sel:fleetId:UpdateFleetAttributes' :: Text
fleetId = Text
a} :: UpdateFleetAttributes)

instance Core.AWSRequest UpdateFleetAttributes where
  type
    AWSResponse UpdateFleetAttributes =
      UpdateFleetAttributesResponse
  request :: UpdateFleetAttributes -> Request UpdateFleetAttributes
request = Service -> UpdateFleetAttributes -> Request UpdateFleetAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFleetAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFleetAttributes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateFleetAttributes))
-> Logger
-> Service
-> Proxy UpdateFleetAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFleetAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> UpdateFleetAttributesResponse
UpdateFleetAttributesResponse'
            (Maybe Text -> Int -> UpdateFleetAttributesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateFleetAttributesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FleetId")
            Either String (Int -> UpdateFleetAttributesResponse)
-> Either String Int -> Either String UpdateFleetAttributesResponse
forall (f :: * -> *) a b. Applicative f => 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 UpdateFleetAttributes

instance Prelude.NFData UpdateFleetAttributes

instance Core.ToHeaders UpdateFleetAttributes where
  toHeaders :: UpdateFleetAttributes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateFleetAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"GameLift.UpdateFleetAttributes" ::
                          Prelude.ByteString
                      ),
            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 UpdateFleetAttributes where
  toJSON :: UpdateFleetAttributes -> Value
toJSON UpdateFleetAttributes' {Maybe [Text]
Maybe Text
Maybe ProtectionPolicy
Maybe ResourceCreationLimitPolicy
Text
fleetId :: Text
resourceCreationLimitPolicy :: Maybe ResourceCreationLimitPolicy
description :: Maybe Text
metricGroups :: Maybe [Text]
name :: Maybe Text
newGameSessionProtectionPolicy' :: Maybe ProtectionPolicy
$sel:fleetId:UpdateFleetAttributes' :: UpdateFleetAttributes -> Text
$sel:resourceCreationLimitPolicy:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe ResourceCreationLimitPolicy
$sel:description:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe Text
$sel:metricGroups:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe [Text]
$sel:name:UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe Text
$sel:newGameSessionProtectionPolicy':UpdateFleetAttributes' :: UpdateFleetAttributes -> Maybe ProtectionPolicy
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NewGameSessionProtectionPolicy" Text -> ProtectionPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ProtectionPolicy -> Pair) -> Maybe ProtectionPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProtectionPolicy
newGameSessionProtectionPolicy',
            (Text
"Name" 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
name,
            (Text
"MetricGroups" 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]
metricGroups,
            (Text
"Description" 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
description,
            (Text
"ResourceCreationLimitPolicy" Text -> ResourceCreationLimitPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ResourceCreationLimitPolicy -> Pair)
-> Maybe ResourceCreationLimitPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceCreationLimitPolicy
resourceCreationLimitPolicy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FleetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetId)
          ]
      )

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

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

-- | Represents the returned data in response to a request operation.
--
-- /See:/ 'newUpdateFleetAttributesResponse' smart constructor.
data UpdateFleetAttributesResponse = UpdateFleetAttributesResponse'
  { -- | A unique identifier for the fleet that was updated.
    UpdateFleetAttributesResponse -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateFleetAttributesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateFleetAttributesResponse
-> UpdateFleetAttributesResponse -> Bool
(UpdateFleetAttributesResponse
 -> UpdateFleetAttributesResponse -> Bool)
-> (UpdateFleetAttributesResponse
    -> UpdateFleetAttributesResponse -> Bool)
-> Eq UpdateFleetAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFleetAttributesResponse
-> UpdateFleetAttributesResponse -> Bool
$c/= :: UpdateFleetAttributesResponse
-> UpdateFleetAttributesResponse -> Bool
== :: UpdateFleetAttributesResponse
-> UpdateFleetAttributesResponse -> Bool
$c== :: UpdateFleetAttributesResponse
-> UpdateFleetAttributesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFleetAttributesResponse]
ReadPrec UpdateFleetAttributesResponse
Int -> ReadS UpdateFleetAttributesResponse
ReadS [UpdateFleetAttributesResponse]
(Int -> ReadS UpdateFleetAttributesResponse)
-> ReadS [UpdateFleetAttributesResponse]
-> ReadPrec UpdateFleetAttributesResponse
-> ReadPrec [UpdateFleetAttributesResponse]
-> Read UpdateFleetAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFleetAttributesResponse]
$creadListPrec :: ReadPrec [UpdateFleetAttributesResponse]
readPrec :: ReadPrec UpdateFleetAttributesResponse
$creadPrec :: ReadPrec UpdateFleetAttributesResponse
readList :: ReadS [UpdateFleetAttributesResponse]
$creadList :: ReadS [UpdateFleetAttributesResponse]
readsPrec :: Int -> ReadS UpdateFleetAttributesResponse
$creadsPrec :: Int -> ReadS UpdateFleetAttributesResponse
Prelude.Read, Int -> UpdateFleetAttributesResponse -> ShowS
[UpdateFleetAttributesResponse] -> ShowS
UpdateFleetAttributesResponse -> String
(Int -> UpdateFleetAttributesResponse -> ShowS)
-> (UpdateFleetAttributesResponse -> String)
-> ([UpdateFleetAttributesResponse] -> ShowS)
-> Show UpdateFleetAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFleetAttributesResponse] -> ShowS
$cshowList :: [UpdateFleetAttributesResponse] -> ShowS
show :: UpdateFleetAttributesResponse -> String
$cshow :: UpdateFleetAttributesResponse -> String
showsPrec :: Int -> UpdateFleetAttributesResponse -> ShowS
$cshowsPrec :: Int -> UpdateFleetAttributesResponse -> ShowS
Prelude.Show, (forall x.
 UpdateFleetAttributesResponse
 -> Rep UpdateFleetAttributesResponse x)
-> (forall x.
    Rep UpdateFleetAttributesResponse x
    -> UpdateFleetAttributesResponse)
-> Generic UpdateFleetAttributesResponse
forall x.
Rep UpdateFleetAttributesResponse x
-> UpdateFleetAttributesResponse
forall x.
UpdateFleetAttributesResponse
-> Rep UpdateFleetAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFleetAttributesResponse x
-> UpdateFleetAttributesResponse
$cfrom :: forall x.
UpdateFleetAttributesResponse
-> Rep UpdateFleetAttributesResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFleetAttributesResponse' 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:
--
-- 'fleetId', 'updateFleetAttributesResponse_fleetId' - A unique identifier for the fleet that was updated.
--
-- 'httpStatus', 'updateFleetAttributesResponse_httpStatus' - The response's http status code.
newUpdateFleetAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateFleetAttributesResponse
newUpdateFleetAttributesResponse :: Int -> UpdateFleetAttributesResponse
newUpdateFleetAttributesResponse Int
pHttpStatus_ =
  UpdateFleetAttributesResponse' :: Maybe Text -> Int -> UpdateFleetAttributesResponse
UpdateFleetAttributesResponse'
    { $sel:fleetId:UpdateFleetAttributesResponse' :: Maybe Text
fleetId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateFleetAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A unique identifier for the fleet that was updated.
updateFleetAttributesResponse_fleetId :: Lens.Lens' UpdateFleetAttributesResponse (Prelude.Maybe Prelude.Text)
updateFleetAttributesResponse_fleetId :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetAttributesResponse -> f UpdateFleetAttributesResponse
updateFleetAttributesResponse_fleetId = (UpdateFleetAttributesResponse -> Maybe Text)
-> (UpdateFleetAttributesResponse
    -> Maybe Text -> UpdateFleetAttributesResponse)
-> Lens
     UpdateFleetAttributesResponse
     UpdateFleetAttributesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetAttributesResponse' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:UpdateFleetAttributesResponse' :: UpdateFleetAttributesResponse -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: UpdateFleetAttributesResponse
s@UpdateFleetAttributesResponse' {} Maybe Text
a -> UpdateFleetAttributesResponse
s {$sel:fleetId:UpdateFleetAttributesResponse' :: Maybe Text
fleetId = Maybe Text
a} :: UpdateFleetAttributesResponse)

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

instance Prelude.NFData UpdateFleetAttributesResponse