{-# 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.StartFleet
-- 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)
--
-- Starts the specified fleet.
module Amazonka.AppStream.StartFleet
  ( -- * Creating a Request
    StartFleet (..),
    newStartFleet,

    -- * Request Lenses
    startFleet_name,

    -- * Destructuring the Response
    StartFleetResponse (..),
    newStartFleetResponse,

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

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

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

instance Core.AWSRequest StartFleet where
  type AWSResponse StartFleet = StartFleetResponse
  request :: StartFleet -> Request StartFleet
request = Service -> StartFleet -> Request StartFleet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartFleet)))
response =
    (Int
 -> ResponseHeaders -> () -> Either String (AWSResponse StartFleet))
-> Logger
-> Service
-> Proxy StartFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartFleet)))
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 -> StartFleetResponse
StartFleetResponse'
            (Int -> StartFleetResponse)
-> Either String Int -> Either String StartFleetResponse
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 StartFleet

instance Prelude.NFData StartFleet

instance Core.ToHeaders StartFleet where
  toHeaders :: StartFleet -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartFleet -> 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.StartFleet" ::
                          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 StartFleet where
  toJSON :: StartFleet -> Value
toJSON StartFleet' {Text
name :: Text
$sel:name:StartFleet' :: StartFleet -> 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 StartFleet where
  toPath :: StartFleet -> ByteString
toPath = ByteString -> StartFleet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData StartFleetResponse