{-# 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.DeleteBuild
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a build. This operation permanently deletes the build resource
-- and any uploaded build files. Deleting a build does not affect the
-- status of any active fleets using the build, but you can no longer
-- create new fleets with the deleted build.
--
-- To delete a build, specify the build ID.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-intro.html Upload a Custom Server Build>
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
module Amazonka.GameLift.DeleteBuild
  ( -- * Creating a Request
    DeleteBuild (..),
    newDeleteBuild,

    -- * Request Lenses
    deleteBuild_buildId,

    -- * Destructuring the Response
    DeleteBuildResponse (..),
    newDeleteBuildResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteBuild' smart constructor.
data DeleteBuild = DeleteBuild'
  { -- | A unique identifier for the build to delete. You can use either the
    -- build ID or ARN value.
    DeleteBuild -> Text
buildId :: Prelude.Text
  }
  deriving (DeleteBuild -> DeleteBuild -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBuild -> DeleteBuild -> Bool
$c/= :: DeleteBuild -> DeleteBuild -> Bool
== :: DeleteBuild -> DeleteBuild -> Bool
$c== :: DeleteBuild -> DeleteBuild -> Bool
Prelude.Eq, ReadPrec [DeleteBuild]
ReadPrec DeleteBuild
Int -> ReadS DeleteBuild
ReadS [DeleteBuild]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBuild]
$creadListPrec :: ReadPrec [DeleteBuild]
readPrec :: ReadPrec DeleteBuild
$creadPrec :: ReadPrec DeleteBuild
readList :: ReadS [DeleteBuild]
$creadList :: ReadS [DeleteBuild]
readsPrec :: Int -> ReadS DeleteBuild
$creadsPrec :: Int -> ReadS DeleteBuild
Prelude.Read, Int -> DeleteBuild -> ShowS
[DeleteBuild] -> ShowS
DeleteBuild -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBuild] -> ShowS
$cshowList :: [DeleteBuild] -> ShowS
show :: DeleteBuild -> String
$cshow :: DeleteBuild -> String
showsPrec :: Int -> DeleteBuild -> ShowS
$cshowsPrec :: Int -> DeleteBuild -> ShowS
Prelude.Show, forall x. Rep DeleteBuild x -> DeleteBuild
forall x. DeleteBuild -> Rep DeleteBuild x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBuild x -> DeleteBuild
$cfrom :: forall x. DeleteBuild -> Rep DeleteBuild x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBuild' 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:
--
-- 'buildId', 'deleteBuild_buildId' - A unique identifier for the build to delete. You can use either the
-- build ID or ARN value.
newDeleteBuild ::
  -- | 'buildId'
  Prelude.Text ->
  DeleteBuild
newDeleteBuild :: Text -> DeleteBuild
newDeleteBuild Text
pBuildId_ =
  DeleteBuild' {$sel:buildId:DeleteBuild' :: Text
buildId = Text
pBuildId_}

-- | A unique identifier for the build to delete. You can use either the
-- build ID or ARN value.
deleteBuild_buildId :: Lens.Lens' DeleteBuild Prelude.Text
deleteBuild_buildId :: Lens' DeleteBuild Text
deleteBuild_buildId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBuild' {Text
buildId :: Text
$sel:buildId:DeleteBuild' :: DeleteBuild -> Text
buildId} -> Text
buildId) (\s :: DeleteBuild
s@DeleteBuild' {} Text
a -> DeleteBuild
s {$sel:buildId:DeleteBuild' :: Text
buildId = Text
a} :: DeleteBuild)

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

instance Prelude.Hashable DeleteBuild where
  hashWithSalt :: Int -> DeleteBuild -> Int
hashWithSalt Int
_salt DeleteBuild' {Text
buildId :: Text
$sel:buildId:DeleteBuild' :: DeleteBuild -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
buildId

instance Prelude.NFData DeleteBuild where
  rnf :: DeleteBuild -> ()
rnf DeleteBuild' {Text
buildId :: Text
$sel:buildId:DeleteBuild' :: DeleteBuild -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
buildId

instance Data.ToHeaders DeleteBuild where
  toHeaders :: DeleteBuild -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# (ByteString
"GameLift.DeleteBuild" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteBuild where
  toJSON :: DeleteBuild -> Value
toJSON DeleteBuild' {Text
buildId :: Text
$sel:buildId:DeleteBuild' :: DeleteBuild -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"BuildId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
buildId)]
      )

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

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

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

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

instance Prelude.NFData DeleteBuildResponse where
  rnf :: DeleteBuildResponse -> ()
rnf DeleteBuildResponse
_ = ()