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

    -- * Request Lenses
    stopFleet_name,

    -- * Destructuring the Response
    StopFleetResponse (..),
    newStopFleetResponse,

    -- * Response Lenses
    stopFleetResponse_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:/ 'newStopFleet' smart constructor.
data StopFleet = StopFleet'
  { -- | The name of the fleet.
    StopFleet -> Text
name :: Prelude.Text
  }
  deriving (StopFleet -> StopFleet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopFleet -> StopFleet -> Bool
$c/= :: StopFleet -> StopFleet -> Bool
== :: StopFleet -> StopFleet -> Bool
$c== :: StopFleet -> StopFleet -> Bool
Prelude.Eq, ReadPrec [StopFleet]
ReadPrec StopFleet
Int -> ReadS StopFleet
ReadS [StopFleet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopFleet]
$creadListPrec :: ReadPrec [StopFleet]
readPrec :: ReadPrec StopFleet
$creadPrec :: ReadPrec StopFleet
readList :: ReadS [StopFleet]
$creadList :: ReadS [StopFleet]
readsPrec :: Int -> ReadS StopFleet
$creadsPrec :: Int -> ReadS StopFleet
Prelude.Read, Int -> StopFleet -> ShowS
[StopFleet] -> ShowS
StopFleet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopFleet] -> ShowS
$cshowList :: [StopFleet] -> ShowS
show :: StopFleet -> String
$cshow :: StopFleet -> String
showsPrec :: Int -> StopFleet -> ShowS
$cshowsPrec :: Int -> StopFleet -> ShowS
Prelude.Show, forall x. Rep StopFleet x -> StopFleet
forall x. StopFleet -> Rep StopFleet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopFleet x -> StopFleet
$cfrom :: forall x. StopFleet -> Rep StopFleet x
Prelude.Generic)

-- |
-- Create a value of 'StopFleet' 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:
--
-- 'name', 'stopFleet_name' - The name of the fleet.
newStopFleet ::
  -- | 'name'
  Prelude.Text ->
  StopFleet
newStopFleet :: Text -> StopFleet
newStopFleet Text
pName_ = StopFleet' {$sel:name:StopFleet' :: Text
name = Text
pName_}

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

instance Core.AWSRequest StopFleet where
  type AWSResponse StopFleet = StopFleetResponse
  request :: (Service -> Service) -> StopFleet -> Request StopFleet
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 StopFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopFleet)))
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 -> StopFleetResponse
StopFleetResponse'
            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 StopFleet where
  hashWithSalt :: Int -> StopFleet -> Int
hashWithSalt Int
_salt StopFleet' {Text
name :: Text
$sel:name:StopFleet' :: StopFleet -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

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

instance Data.ToHeaders StopFleet where
  toHeaders :: StopFleet -> 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.StopFleet" ::
                          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 StopFleet where
  toJSON :: StopFleet -> Value
toJSON StopFleet' {Text
name :: Text
$sel:name:StopFleet' :: StopFleet -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

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

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

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

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

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

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