{-# 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.StopStack
-- 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 a specified stack.
--
-- __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.StopStack
  ( -- * Creating a Request
    StopStack (..),
    newStopStack,

    -- * Request Lenses
    stopStack_stackId,

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

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

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

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

instance Prelude.Hashable StopStack

instance Prelude.NFData StopStack

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

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

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

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

instance Prelude.NFData StopStackResponse