{-# 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-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)
--
-- 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.Lens as Lens
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
(DisassociateFleet -> DisassociateFleet -> Bool)
-> (DisassociateFleet -> DisassociateFleet -> Bool)
-> Eq DisassociateFleet
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]
(Int -> ReadS DisassociateFleet)
-> ReadS [DisassociateFleet]
-> ReadPrec DisassociateFleet
-> ReadPrec [DisassociateFleet]
-> Read 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
(Int -> DisassociateFleet -> ShowS)
-> (DisassociateFleet -> String)
-> ([DisassociateFleet] -> ShowS)
-> Show DisassociateFleet
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. DisassociateFleet -> Rep DisassociateFleet x)
-> (forall x. Rep DisassociateFleet x -> DisassociateFleet)
-> Generic DisassociateFleet
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' :: Text -> Text -> DisassociateFleet
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 :: (Text -> f Text) -> DisassociateFleet -> f DisassociateFleet
disassociateFleet_fleetName = (DisassociateFleet -> Text)
-> (DisassociateFleet -> Text -> DisassociateFleet)
-> Lens DisassociateFleet DisassociateFleet Text Text
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 :: (Text -> f Text) -> DisassociateFleet -> f DisassociateFleet
disassociateFleet_stackName = (DisassociateFleet -> Text)
-> (DisassociateFleet -> Text -> DisassociateFleet)
-> Lens DisassociateFleet DisassociateFleet Text Text
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 :: DisassociateFleet -> Request DisassociateFleet
request = Service -> DisassociateFleet -> Request DisassociateFleet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateFleet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateFleet)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateFleet))
-> Logger
-> Service
-> Proxy DisassociateFleet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateFleet)))
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 -> DisassociateFleetResponse
DisassociateFleetResponse'
            (Int -> DisassociateFleetResponse)
-> Either String Int -> Either String DisassociateFleetResponse
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 DisassociateFleet

instance Prelude.NFData DisassociateFleet

instance Core.ToHeaders DisassociateFleet where
  toHeaders :: DisassociateFleet -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisassociateFleet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"PhotonAdminProxyService.DisassociateFleet" ::
                          Prelude.ByteString
                      ),
            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 DisassociateFleet where
  toJSON :: DisassociateFleet -> Value
toJSON DisassociateFleet' {Text
stackName :: Text
fleetName :: Text
$sel:stackName:DisassociateFleet' :: DisassociateFleet -> Text
$sel:fleetName:DisassociateFleet' :: DisassociateFleet -> 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
"FleetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StackName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stackName)
          ]
      )

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

instance Core.ToQuery DisassociateFleet where
  toQuery :: DisassociateFleet -> QueryString
toQuery = QueryString -> DisassociateFleet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DisassociateFleetResponse -> DisassociateFleetResponse -> Bool)
-> (DisassociateFleetResponse -> DisassociateFleetResponse -> Bool)
-> Eq DisassociateFleetResponse
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]
(Int -> ReadS DisassociateFleetResponse)
-> ReadS [DisassociateFleetResponse]
-> ReadPrec DisassociateFleetResponse
-> ReadPrec [DisassociateFleetResponse]
-> Read 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
(Int -> DisassociateFleetResponse -> ShowS)
-> (DisassociateFleetResponse -> String)
-> ([DisassociateFleetResponse] -> ShowS)
-> Show DisassociateFleetResponse
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.
 DisassociateFleetResponse -> Rep DisassociateFleetResponse x)
-> (forall x.
    Rep DisassociateFleetResponse x -> DisassociateFleetResponse)
-> Generic DisassociateFleetResponse
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' :: Int -> DisassociateFleetResponse
DisassociateFleetResponse'
    { $sel:httpStatus:DisassociateFleetResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
disassociateFleetResponse_httpStatus :: Lens.Lens' DisassociateFleetResponse Prelude.Int
disassociateFleetResponse_httpStatus :: (Int -> f Int)
-> DisassociateFleetResponse -> f DisassociateFleetResponse
disassociateFleetResponse_httpStatus = (DisassociateFleetResponse -> Int)
-> (DisassociateFleetResponse -> Int -> DisassociateFleetResponse)
-> Lens DisassociateFleetResponse DisassociateFleetResponse Int Int
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