{-# 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.AppStream.DisassociateFleet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disassociates the specified fleet from the specified stack.
module Amazonka.AppStream.DisassociateFleet
  ( -- * Creating a Request
    DisassociateFleet (..),
    newDisassociateFleet,

    -- * Request Lenses
    disassociateFleet_fleetName,
    disassociateFleet_stackName,

    -- * Destructuring the Response
    DisassociateFleetResponse (..),
    newDisassociateFleetResponse,

    -- * Response Lenses
    disassociateFleetResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DisassociateFleet' 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:
--
-- 'fleetName', 'disassociateFleet_fleetName' - The name of the fleet.
--
-- 'stackName', 'disassociateFleet_stackName' - The name of the stack.
newDisassociateFleet ::
  -- | 'fleetName'
  Prelude.Text ->
  -- | 'stackName'
  Prelude.Text ->
  DisassociateFleet
newDisassociateFleet :: Text -> Text -> DisassociateFleet
newDisassociateFleet Text
pFleetName_ Text
pStackName_ =
  DisassociateFleet'
    { $sel:fleetName:DisassociateFleet' :: Text
fleetName = Text
pFleetName_,
      $sel:stackName:DisassociateFleet' :: Text
stackName = Text
pStackName_
    }

-- | The name of the fleet.
disassociateFleet_fleetName :: Lens.Lens' DisassociateFleet Prelude.Text
disassociateFleet_fleetName :: Lens' DisassociateFleet Text
disassociateFleet_fleetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateFleet' {Text
fleetName :: Text
$sel:fleetName:DisassociateFleet' :: DisassociateFleet -> Text
fleetName} -> Text
fleetName) (\s :: DisassociateFleet
s@DisassociateFleet' {} Text
a -> DisassociateFleet
s {$sel:fleetName:DisassociateFleet' :: Text
fleetName = Text
a} :: DisassociateFleet)

-- | The name of the stack.
disassociateFleet_stackName :: Lens.Lens' DisassociateFleet Prelude.Text
disassociateFleet_stackName :: Lens' DisassociateFleet Text
disassociateFleet_stackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateFleet' {Text
stackName :: Text
$sel:stackName:DisassociateFleet' :: DisassociateFleet -> Text
stackName} -> Text
stackName) (\s :: DisassociateFleet
s@DisassociateFleet' {} Text
a -> DisassociateFleet
s {$sel:stackName:DisassociateFleet' :: Text
stackName = Text
a} :: DisassociateFleet)

instance Core.AWSRequest DisassociateFleet where
  type
    AWSResponse DisassociateFleet =
      DisassociateFleetResponse
  request :: (Service -> Service)
-> DisassociateFleet -> Request DisassociateFleet
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 DisassociateFleet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateFleet)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateFleetResponse
DisassociateFleetResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

instance Prelude.NFData DisassociateFleet where
  rnf :: DisassociateFleet -> ()
rnf DisassociateFleet' {Text
stackName :: Text
fleetName :: Text
$sel:stackName:DisassociateFleet' :: DisassociateFleet -> Text
$sel:fleetName:DisassociateFleet' :: DisassociateFleet -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
fleetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackName

instance Data.ToHeaders DisassociateFleet where
  toHeaders :: DisassociateFleet -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"PhotonAdminProxyService.DisassociateFleet" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

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

-- |
-- Create a value of 'DisassociateFleetResponse' 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', 'disassociateFleetResponse_httpStatus' - The response's http status code.
newDisassociateFleetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateFleetResponse
newDisassociateFleetResponse :: Int -> DisassociateFleetResponse
newDisassociateFleetResponse Int
pHttpStatus_ =
  DisassociateFleetResponse'
    { $sel:httpStatus:DisassociateFleetResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DisassociateFleetResponse where
  rnf :: DisassociateFleetResponse -> ()
rnf DisassociateFleetResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateFleetResponse' :: DisassociateFleetResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus