{-# 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.DeleteStack
-- 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)
--
-- Deletes the specified stack. After the stack is deleted, the application
-- streaming environment provided by the stack is no longer available to
-- users. Also, any reservations made for application streaming sessions
-- for the stack are released.
module Amazonka.AppStream.DeleteStack
  ( -- * Creating a Request
    DeleteStack (..),
    newDeleteStack,

    -- * Request Lenses
    deleteStack_name,

    -- * Destructuring the Response
    DeleteStackResponse (..),
    newDeleteStackResponse,

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

-- |
-- Create a value of 'DeleteStack' 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', 'deleteStack_name' - The name of the stack.
newDeleteStack ::
  -- | 'name'
  Prelude.Text ->
  DeleteStack
newDeleteStack :: Text -> DeleteStack
newDeleteStack Text
pName_ = DeleteStack' :: Text -> DeleteStack
DeleteStack' {$sel:name:DeleteStack' :: Text
name = Text
pName_}

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

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

instance Prelude.NFData DeleteStack

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

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

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

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

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

instance Prelude.NFData DeleteStackResponse