{-# 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.SageMaker.DeleteEdgeDeploymentStage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete a stage in an edge deployment plan if (and only if) the stage is
-- inactive.
module Amazonka.SageMaker.DeleteEdgeDeploymentStage
  ( -- * Creating a Request
    DeleteEdgeDeploymentStage (..),
    newDeleteEdgeDeploymentStage,

    -- * Request Lenses
    deleteEdgeDeploymentStage_edgeDeploymentPlanName,
    deleteEdgeDeploymentStage_stageName,

    -- * Destructuring the Response
    DeleteEdgeDeploymentStageResponse (..),
    newDeleteEdgeDeploymentStageResponse,
  )
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.SageMaker.Types

-- | /See:/ 'newDeleteEdgeDeploymentStage' smart constructor.
data DeleteEdgeDeploymentStage = DeleteEdgeDeploymentStage'
  { -- | The name of the edge deployment plan from which the stage will be
    -- deleted.
    DeleteEdgeDeploymentStage -> Text
edgeDeploymentPlanName :: Prelude.Text,
    -- | The name of the stage.
    DeleteEdgeDeploymentStage -> Text
stageName :: Prelude.Text
  }
  deriving (DeleteEdgeDeploymentStage -> DeleteEdgeDeploymentStage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEdgeDeploymentStage -> DeleteEdgeDeploymentStage -> Bool
$c/= :: DeleteEdgeDeploymentStage -> DeleteEdgeDeploymentStage -> Bool
== :: DeleteEdgeDeploymentStage -> DeleteEdgeDeploymentStage -> Bool
$c== :: DeleteEdgeDeploymentStage -> DeleteEdgeDeploymentStage -> Bool
Prelude.Eq, ReadPrec [DeleteEdgeDeploymentStage]
ReadPrec DeleteEdgeDeploymentStage
Int -> ReadS DeleteEdgeDeploymentStage
ReadS [DeleteEdgeDeploymentStage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEdgeDeploymentStage]
$creadListPrec :: ReadPrec [DeleteEdgeDeploymentStage]
readPrec :: ReadPrec DeleteEdgeDeploymentStage
$creadPrec :: ReadPrec DeleteEdgeDeploymentStage
readList :: ReadS [DeleteEdgeDeploymentStage]
$creadList :: ReadS [DeleteEdgeDeploymentStage]
readsPrec :: Int -> ReadS DeleteEdgeDeploymentStage
$creadsPrec :: Int -> ReadS DeleteEdgeDeploymentStage
Prelude.Read, Int -> DeleteEdgeDeploymentStage -> ShowS
[DeleteEdgeDeploymentStage] -> ShowS
DeleteEdgeDeploymentStage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEdgeDeploymentStage] -> ShowS
$cshowList :: [DeleteEdgeDeploymentStage] -> ShowS
show :: DeleteEdgeDeploymentStage -> String
$cshow :: DeleteEdgeDeploymentStage -> String
showsPrec :: Int -> DeleteEdgeDeploymentStage -> ShowS
$cshowsPrec :: Int -> DeleteEdgeDeploymentStage -> ShowS
Prelude.Show, forall x.
Rep DeleteEdgeDeploymentStage x -> DeleteEdgeDeploymentStage
forall x.
DeleteEdgeDeploymentStage -> Rep DeleteEdgeDeploymentStage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEdgeDeploymentStage x -> DeleteEdgeDeploymentStage
$cfrom :: forall x.
DeleteEdgeDeploymentStage -> Rep DeleteEdgeDeploymentStage x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEdgeDeploymentStage' 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:
--
-- 'edgeDeploymentPlanName', 'deleteEdgeDeploymentStage_edgeDeploymentPlanName' - The name of the edge deployment plan from which the stage will be
-- deleted.
--
-- 'stageName', 'deleteEdgeDeploymentStage_stageName' - The name of the stage.
newDeleteEdgeDeploymentStage ::
  -- | 'edgeDeploymentPlanName'
  Prelude.Text ->
  -- | 'stageName'
  Prelude.Text ->
  DeleteEdgeDeploymentStage
newDeleteEdgeDeploymentStage :: Text -> Text -> DeleteEdgeDeploymentStage
newDeleteEdgeDeploymentStage
  Text
pEdgeDeploymentPlanName_
  Text
pStageName_ =
    DeleteEdgeDeploymentStage'
      { $sel:edgeDeploymentPlanName:DeleteEdgeDeploymentStage' :: Text
edgeDeploymentPlanName =
          Text
pEdgeDeploymentPlanName_,
        $sel:stageName:DeleteEdgeDeploymentStage' :: Text
stageName = Text
pStageName_
      }

-- | The name of the edge deployment plan from which the stage will be
-- deleted.
deleteEdgeDeploymentStage_edgeDeploymentPlanName :: Lens.Lens' DeleteEdgeDeploymentStage Prelude.Text
deleteEdgeDeploymentStage_edgeDeploymentPlanName :: Lens' DeleteEdgeDeploymentStage Text
deleteEdgeDeploymentStage_edgeDeploymentPlanName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEdgeDeploymentStage' {Text
edgeDeploymentPlanName :: Text
$sel:edgeDeploymentPlanName:DeleteEdgeDeploymentStage' :: DeleteEdgeDeploymentStage -> Text
edgeDeploymentPlanName} -> Text
edgeDeploymentPlanName) (\s :: DeleteEdgeDeploymentStage
s@DeleteEdgeDeploymentStage' {} Text
a -> DeleteEdgeDeploymentStage
s {$sel:edgeDeploymentPlanName:DeleteEdgeDeploymentStage' :: Text
edgeDeploymentPlanName = Text
a} :: DeleteEdgeDeploymentStage)

-- | The name of the stage.
deleteEdgeDeploymentStage_stageName :: Lens.Lens' DeleteEdgeDeploymentStage Prelude.Text
deleteEdgeDeploymentStage_stageName :: Lens' DeleteEdgeDeploymentStage Text
deleteEdgeDeploymentStage_stageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEdgeDeploymentStage' {Text
stageName :: Text
$sel:stageName:DeleteEdgeDeploymentStage' :: DeleteEdgeDeploymentStage -> Text
stageName} -> Text
stageName) (\s :: DeleteEdgeDeploymentStage
s@DeleteEdgeDeploymentStage' {} Text
a -> DeleteEdgeDeploymentStage
s {$sel:stageName:DeleteEdgeDeploymentStage' :: Text
stageName = Text
a} :: DeleteEdgeDeploymentStage)

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

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

instance Prelude.NFData DeleteEdgeDeploymentStage where
  rnf :: DeleteEdgeDeploymentStage -> ()
rnf DeleteEdgeDeploymentStage' {Text
stageName :: Text
edgeDeploymentPlanName :: Text
$sel:stageName:DeleteEdgeDeploymentStage' :: DeleteEdgeDeploymentStage -> Text
$sel:edgeDeploymentPlanName:DeleteEdgeDeploymentStage' :: DeleteEdgeDeploymentStage -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
edgeDeploymentPlanName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stageName

instance Data.ToHeaders DeleteEdgeDeploymentStage where
  toHeaders :: DeleteEdgeDeploymentStage -> [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
"SageMaker.DeleteEdgeDeploymentStage" ::
                          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 DeleteEdgeDeploymentStage where
  toJSON :: DeleteEdgeDeploymentStage -> Value
toJSON DeleteEdgeDeploymentStage' {Text
stageName :: Text
edgeDeploymentPlanName :: Text
$sel:stageName:DeleteEdgeDeploymentStage' :: DeleteEdgeDeploymentStage -> Text
$sel:edgeDeploymentPlanName:DeleteEdgeDeploymentStage' :: DeleteEdgeDeploymentStage -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"EdgeDeploymentPlanName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
edgeDeploymentPlanName
              ),
            forall a. a -> Maybe a
Prelude.Just (Key
"StageName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stageName)
          ]
      )

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

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

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

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

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