{-# 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.Transfer.StartServer
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Changes the state of a file transfer protocol-enabled server from
-- @OFFLINE@ to @ONLINE@. It has no impact on a server that is already
-- @ONLINE@. An @ONLINE@ server can accept and process file transfer jobs.
--
-- The state of @STARTING@ indicates that the server is in an intermediate
-- state, either not fully able to respond, or not fully online. The values
-- of @START_FAILED@ can indicate an error condition.
--
-- No response is returned from this call.
module Amazonka.Transfer.StartServer
  ( -- * Creating a Request
    StartServer (..),
    newStartServer,

    -- * Request Lenses
    startServer_serverId,

    -- * Destructuring the Response
    StartServerResponse (..),
    newStartServerResponse,
  )
where

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
import Amazonka.Transfer.Types

-- | /See:/ 'newStartServer' smart constructor.
data StartServer = StartServer'
  { -- | A system-assigned unique identifier for a server that you start.
    StartServer -> Text
serverId :: Prelude.Text
  }
  deriving (StartServer -> StartServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartServer -> StartServer -> Bool
$c/= :: StartServer -> StartServer -> Bool
== :: StartServer -> StartServer -> Bool
$c== :: StartServer -> StartServer -> Bool
Prelude.Eq, ReadPrec [StartServer]
ReadPrec StartServer
Int -> ReadS StartServer
ReadS [StartServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartServer]
$creadListPrec :: ReadPrec [StartServer]
readPrec :: ReadPrec StartServer
$creadPrec :: ReadPrec StartServer
readList :: ReadS [StartServer]
$creadList :: ReadS [StartServer]
readsPrec :: Int -> ReadS StartServer
$creadsPrec :: Int -> ReadS StartServer
Prelude.Read, Int -> StartServer -> ShowS
[StartServer] -> ShowS
StartServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartServer] -> ShowS
$cshowList :: [StartServer] -> ShowS
show :: StartServer -> String
$cshow :: StartServer -> String
showsPrec :: Int -> StartServer -> ShowS
$cshowsPrec :: Int -> StartServer -> ShowS
Prelude.Show, forall x. Rep StartServer x -> StartServer
forall x. StartServer -> Rep StartServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartServer x -> StartServer
$cfrom :: forall x. StartServer -> Rep StartServer x
Prelude.Generic)

-- |
-- Create a value of 'StartServer' 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:
--
-- 'serverId', 'startServer_serverId' - A system-assigned unique identifier for a server that you start.
newStartServer ::
  -- | 'serverId'
  Prelude.Text ->
  StartServer
newStartServer :: Text -> StartServer
newStartServer Text
pServerId_ =
  StartServer' {$sel:serverId:StartServer' :: Text
serverId = Text
pServerId_}

-- | A system-assigned unique identifier for a server that you start.
startServer_serverId :: Lens.Lens' StartServer Prelude.Text
startServer_serverId :: Lens' StartServer Text
startServer_serverId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartServer' {Text
serverId :: Text
$sel:serverId:StartServer' :: StartServer -> Text
serverId} -> Text
serverId) (\s :: StartServer
s@StartServer' {} Text
a -> StartServer
s {$sel:serverId:StartServer' :: Text
serverId = Text
a} :: StartServer)

instance Core.AWSRequest StartServer where
  type AWSResponse StartServer = StartServerResponse
  request :: (Service -> Service) -> StartServer -> Request StartServer
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 StartServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartServer)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull StartServerResponse
StartServerResponse'

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

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

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

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

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

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

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

-- |
-- Create a value of 'StartServerResponse' 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.
newStartServerResponse ::
  StartServerResponse
newStartServerResponse :: StartServerResponse
newStartServerResponse = StartServerResponse
StartServerResponse'

instance Prelude.NFData StartServerResponse where
  rnf :: StartServerResponse -> ()
rnf StartServerResponse
_ = ()