{-# 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-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)
--
-- 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.Lens as Lens
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
(StopFleet -> StopFleet -> Bool)
-> (StopFleet -> StopFleet -> Bool) -> Eq StopFleet
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]
(Int -> ReadS StopFleet)
-> ReadS [StopFleet]
-> ReadPrec StopFleet
-> ReadPrec [StopFleet]
-> Read 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
(Int -> StopFleet -> ShowS)
-> (StopFleet -> String)
-> ([StopFleet] -> ShowS)
-> Show StopFleet
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. StopFleet -> Rep StopFleet x)
-> (forall x. Rep StopFleet x -> StopFleet) -> Generic StopFleet
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' :: Text -> StopFleet
StopFleet' {$sel:name:StopFleet' :: Text
name = Text
pName_}

-- | The name of the fleet.
stopFleet_name :: Lens.Lens' StopFleet Prelude.Text
stopFleet_name :: (Text -> f Text) -> StopFleet -> f StopFleet
stopFleet_name = (StopFleet -> Text)
-> (StopFleet -> Text -> StopFleet)
-> Lens StopFleet StopFleet Text Text
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 :: StopFleet -> Request StopFleet
request = Service -> StopFleet -> Request StopFleet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopFleet)))
response =
    (Int
 -> ResponseHeaders -> () -> Either String (AWSResponse StopFleet))
-> Logger
-> Service
-> Proxy StopFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopFleet)))
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 -> StopFleetResponse
StopFleetResponse'
            (Int -> StopFleetResponse)
-> Either String Int -> Either String StopFleetResponse
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 StopFleet

instance Prelude.NFData StopFleet

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

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

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

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