{-# 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-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 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>
--
-- __Related actions__
--
-- CreateBuild | ListBuilds | DescribeBuild | UpdateBuild | DeleteBuild |
-- <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 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:/ '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
(DeleteBuild -> DeleteBuild -> Bool)
-> (DeleteBuild -> DeleteBuild -> Bool) -> Eq DeleteBuild
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]
(Int -> ReadS DeleteBuild)
-> ReadS [DeleteBuild]
-> ReadPrec DeleteBuild
-> ReadPrec [DeleteBuild]
-> Read 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
(Int -> DeleteBuild -> ShowS)
-> (DeleteBuild -> String)
-> ([DeleteBuild] -> ShowS)
-> Show DeleteBuild
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. DeleteBuild -> Rep DeleteBuild x)
-> (forall x. Rep DeleteBuild x -> DeleteBuild)
-> Generic DeleteBuild
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' :: Text -> DeleteBuild
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 :: (Text -> f Text) -> DeleteBuild -> f DeleteBuild
deleteBuild_buildId = (DeleteBuild -> Text)
-> (DeleteBuild -> Text -> DeleteBuild)
-> Lens DeleteBuild DeleteBuild Text Text
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 :: DeleteBuild -> Request DeleteBuild
request = Service -> DeleteBuild -> Request DeleteBuild
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBuild)))
response = AWSResponse DeleteBuild
-> Logger
-> Service
-> Proxy DeleteBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBuild)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteBuild
DeleteBuildResponse
DeleteBuildResponse'

instance Prelude.Hashable DeleteBuild

instance Prelude.NFData DeleteBuild

instance Core.ToHeaders DeleteBuild where
  toHeaders :: DeleteBuild -> [Header]
toHeaders =
    [Header] -> DeleteBuild -> [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.DeleteBuild" :: 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 DeleteBuild where
  toJSON :: DeleteBuild -> Value
toJSON DeleteBuild' {Text
buildId :: Text
$sel:buildId:DeleteBuild' :: DeleteBuild -> 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
"BuildId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
buildId)]
      )

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

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

-- | /See:/ 'newDeleteBuildResponse' smart constructor.
data DeleteBuildResponse = DeleteBuildResponse'
  {
  }
  deriving (DeleteBuildResponse -> DeleteBuildResponse -> Bool
(DeleteBuildResponse -> DeleteBuildResponse -> Bool)
-> (DeleteBuildResponse -> DeleteBuildResponse -> Bool)
-> Eq DeleteBuildResponse
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]
(Int -> ReadS DeleteBuildResponse)
-> ReadS [DeleteBuildResponse]
-> ReadPrec DeleteBuildResponse
-> ReadPrec [DeleteBuildResponse]
-> Read 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
(Int -> DeleteBuildResponse -> ShowS)
-> (DeleteBuildResponse -> String)
-> ([DeleteBuildResponse] -> ShowS)
-> Show DeleteBuildResponse
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. DeleteBuildResponse -> Rep DeleteBuildResponse x)
-> (forall x. Rep DeleteBuildResponse x -> DeleteBuildResponse)
-> Generic DeleteBuildResponse
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