{-# 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.DeleteFleet
-- 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)
--
-- Deletes all resources and information related a fleet. Any current fleet
-- instances, including those in remote locations, are shut down. You
-- don\'t need to call @DeleteFleetLocations@ separately.
--
-- If the fleet being deleted has a VPC peering connection, you first need
-- to get a valid authorization (good for 24 hours) by calling
-- CreateVpcPeeringAuthorization. You do not need to explicitly delete the
-- VPC peering connection--this is done as part of the delete fleet
-- process.
--
-- To delete a fleet, specify the fleet ID to be terminated. During the
-- deletion process the fleet status is changed to @DELETING@. When
-- completed, the status switches to @TERMINATED@ and the fleet event
-- @FLEET_DELETED@ is sent.
--
-- __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.DeleteFleet
  ( -- * Creating a Request
    DeleteFleet (..),
    newDeleteFleet,

    -- * Request Lenses
    deleteFleet_fleetId,

    -- * Destructuring the Response
    DeleteFleetResponse (..),
    newDeleteFleetResponse,
  )
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:/ 'newDeleteFleet' smart constructor.
data DeleteFleet = DeleteFleet'
  { -- | A unique identifier for the fleet to be deleted. You can use either the
    -- fleet ID or ARN value.
    DeleteFleet -> Text
fleetId :: Prelude.Text
  }
  deriving (DeleteFleet -> DeleteFleet -> Bool
(DeleteFleet -> DeleteFleet -> Bool)
-> (DeleteFleet -> DeleteFleet -> Bool) -> Eq DeleteFleet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFleet -> DeleteFleet -> Bool
$c/= :: DeleteFleet -> DeleteFleet -> Bool
== :: DeleteFleet -> DeleteFleet -> Bool
$c== :: DeleteFleet -> DeleteFleet -> Bool
Prelude.Eq, ReadPrec [DeleteFleet]
ReadPrec DeleteFleet
Int -> ReadS DeleteFleet
ReadS [DeleteFleet]
(Int -> ReadS DeleteFleet)
-> ReadS [DeleteFleet]
-> ReadPrec DeleteFleet
-> ReadPrec [DeleteFleet]
-> Read DeleteFleet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFleet]
$creadListPrec :: ReadPrec [DeleteFleet]
readPrec :: ReadPrec DeleteFleet
$creadPrec :: ReadPrec DeleteFleet
readList :: ReadS [DeleteFleet]
$creadList :: ReadS [DeleteFleet]
readsPrec :: Int -> ReadS DeleteFleet
$creadsPrec :: Int -> ReadS DeleteFleet
Prelude.Read, Int -> DeleteFleet -> ShowS
[DeleteFleet] -> ShowS
DeleteFleet -> String
(Int -> DeleteFleet -> ShowS)
-> (DeleteFleet -> String)
-> ([DeleteFleet] -> ShowS)
-> Show DeleteFleet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFleet] -> ShowS
$cshowList :: [DeleteFleet] -> ShowS
show :: DeleteFleet -> String
$cshow :: DeleteFleet -> String
showsPrec :: Int -> DeleteFleet -> ShowS
$cshowsPrec :: Int -> DeleteFleet -> ShowS
Prelude.Show, (forall x. DeleteFleet -> Rep DeleteFleet x)
-> (forall x. Rep DeleteFleet x -> DeleteFleet)
-> Generic DeleteFleet
forall x. Rep DeleteFleet x -> DeleteFleet
forall x. DeleteFleet -> Rep DeleteFleet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFleet x -> DeleteFleet
$cfrom :: forall x. DeleteFleet -> Rep DeleteFleet x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFleet' 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', 'deleteFleet_fleetId' - A unique identifier for the fleet to be deleted. You can use either the
-- fleet ID or ARN value.
newDeleteFleet ::
  -- | 'fleetId'
  Prelude.Text ->
  DeleteFleet
newDeleteFleet :: Text -> DeleteFleet
newDeleteFleet Text
pFleetId_ =
  DeleteFleet' :: Text -> DeleteFleet
DeleteFleet' {$sel:fleetId:DeleteFleet' :: Text
fleetId = Text
pFleetId_}

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

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

instance Prelude.Hashable DeleteFleet

instance Prelude.NFData DeleteFleet

instance Core.ToHeaders DeleteFleet where
  toHeaders :: DeleteFleet -> [Header]
toHeaders =
    [Header] -> DeleteFleet -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"GameLift.DeleteFleet" :: Prelude.ByteString),
            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 DeleteFleet where
  toJSON :: DeleteFleet -> Value
toJSON DeleteFleet' {Text
fleetId :: Text
$sel:fleetId:DeleteFleet' :: DeleteFleet -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [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 DeleteFleet where
  toPath :: DeleteFleet -> ByteString
toPath = ByteString -> DeleteFleet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

instance Prelude.NFData DeleteFleetResponse