{-# 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.RobOMaker.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 a fleet.
module Amazonka.RobOMaker.DeleteFleet
  ( -- * Creating a Request
    DeleteFleet (..),
    newDeleteFleet,

    -- * Request Lenses
    deleteFleet_fleet,

    -- * Destructuring the Response
    DeleteFleetResponse (..),
    newDeleteFleetResponse,

    -- * Response Lenses
    deleteFleetResponse_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.RobOMaker.Types

-- | /See:/ 'newDeleteFleet' smart constructor.
data DeleteFleet = DeleteFleet'
  { -- | The Amazon Resource Name (ARN) of the fleet.
    DeleteFleet -> Text
fleet :: 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:
--
-- 'fleet', 'deleteFleet_fleet' - The Amazon Resource Name (ARN) of the fleet.
newDeleteFleet ::
  -- | 'fleet'
  Prelude.Text ->
  DeleteFleet
newDeleteFleet :: Text -> DeleteFleet
newDeleteFleet Text
pFleet_ =
  DeleteFleet' :: Text -> DeleteFleet
DeleteFleet' {$sel:fleet:DeleteFleet' :: Text
fleet = Text
pFleet_}

-- | The Amazon Resource Name (ARN) of the fleet.
deleteFleet_fleet :: Lens.Lens' DeleteFleet Prelude.Text
deleteFleet_fleet :: (Text -> f Text) -> DeleteFleet -> f DeleteFleet
deleteFleet_fleet = (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
fleet :: Text
$sel:fleet:DeleteFleet' :: DeleteFleet -> Text
fleet} -> Text
fleet) (\s :: DeleteFleet
s@DeleteFleet' {} Text
a -> DeleteFleet
s {$sel:fleet:DeleteFleet' :: Text
fleet = 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 =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteFleet))
-> Logger
-> Service
-> Proxy DeleteFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFleet)))
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 -> DeleteFleetResponse
DeleteFleetResponse'
            (Int -> DeleteFleetResponse)
-> Either String Int -> Either String DeleteFleetResponse
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 DeleteFleet

instance Prelude.NFData DeleteFleet

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

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

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'
  { -- | The response's http status code.
    DeleteFleetResponse -> Int
httpStatus :: Prelude.Int
  }
  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.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'deleteFleetResponse_httpStatus' - The response's http status code.
newDeleteFleetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteFleetResponse
newDeleteFleetResponse :: Int -> DeleteFleetResponse
newDeleteFleetResponse Int
pHttpStatus_ =
  DeleteFleetResponse' :: Int -> DeleteFleetResponse
DeleteFleetResponse' {$sel:httpStatus:DeleteFleetResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteFleetResponse