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

instance Prelude.Hashable StartServer

instance Prelude.NFData StartServer

instance Core.ToHeaders StartServer where
  toHeaders :: StartServer -> [Header]
toHeaders =
    [Header] -> StartServer -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"TransferService.StartServer" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StartServer where
  toJSON :: StartServer -> Value
toJSON StartServer' {Text
serverId :: Text
$sel:serverId:StartServer' :: StartServer -> 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
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId)]
      )

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

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

-- | /See:/ 'newStartServerResponse' smart constructor.
data StartServerResponse = StartServerResponse'
  {
  }
  deriving (StartServerResponse -> StartServerResponse -> Bool
(StartServerResponse -> StartServerResponse -> Bool)
-> (StartServerResponse -> StartServerResponse -> Bool)
-> Eq StartServerResponse
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]
(Int -> ReadS StartServerResponse)
-> ReadS [StartServerResponse]
-> ReadPrec StartServerResponse
-> ReadPrec [StartServerResponse]
-> Read 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
(Int -> StartServerResponse -> ShowS)
-> (StartServerResponse -> String)
-> ([StartServerResponse] -> ShowS)
-> Show StartServerResponse
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. StartServerResponse -> Rep StartServerResponse x)
-> (forall x. Rep StartServerResponse x -> StartServerResponse)
-> Generic StartServerResponse
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