{-# 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.OpsWorks.StartStack
-- 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 a stack\'s instances.
--
-- __Required Permissions__: To use this action, an IAM user must have a
-- Manage permissions level for the stack, or an attached policy that
-- explicitly grants permissions. For more information on user permissions,
-- see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html Managing User Permissions>.
module Amazonka.OpsWorks.StartStack
  ( -- * Creating a Request
    StartStack (..),
    newStartStack,

    -- * Request Lenses
    startStack_stackId,

    -- * Destructuring the Response
    StartStackResponse (..),
    newStartStackResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'StartStack' 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:
--
-- 'stackId', 'startStack_stackId' - The stack ID.
newStartStack ::
  -- | 'stackId'
  Prelude.Text ->
  StartStack
newStartStack :: Text -> StartStack
newStartStack Text
pStackId_ =
  StartStack' :: Text -> StartStack
StartStack' {$sel:stackId:StartStack' :: Text
stackId = Text
pStackId_}

-- | The stack ID.
startStack_stackId :: Lens.Lens' StartStack Prelude.Text
startStack_stackId :: (Text -> f Text) -> StartStack -> f StartStack
startStack_stackId = (StartStack -> Text)
-> (StartStack -> Text -> StartStack)
-> Lens StartStack StartStack Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartStack' {Text
stackId :: Text
$sel:stackId:StartStack' :: StartStack -> Text
stackId} -> Text
stackId) (\s :: StartStack
s@StartStack' {} Text
a -> StartStack
s {$sel:stackId:StartStack' :: Text
stackId = Text
a} :: StartStack)

instance Core.AWSRequest StartStack where
  type AWSResponse StartStack = StartStackResponse
  request :: StartStack -> Request StartStack
request = Service -> StartStack -> Request StartStack
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartStack
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartStack)))
response = AWSResponse StartStack
-> Logger
-> Service
-> Proxy StartStack
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartStack)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse StartStack
StartStackResponse
StartStackResponse'

instance Prelude.Hashable StartStack

instance Prelude.NFData StartStack

instance Core.ToHeaders StartStack where
  toHeaders :: StartStack -> [Header]
toHeaders =
    [Header] -> StartStack -> [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
"OpsWorks_20130218.StartStack" ::
                          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 StartStack where
  toJSON :: StartStack -> Value
toJSON StartStack' {Text
stackId :: Text
$sel:stackId:StartStack' :: StartStack -> 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
"StackId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stackId)]
      )

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

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

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

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

instance Prelude.NFData StartStackResponse