{-# 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.ServiceCatalog.DeleteServiceAction
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a self-service action.
module Amazonka.ServiceCatalog.DeleteServiceAction
  ( -- * Creating a Request
    DeleteServiceAction (..),
    newDeleteServiceAction,

    -- * Request Lenses
    deleteServiceAction_acceptLanguage,
    deleteServiceAction_id,

    -- * Destructuring the Response
    DeleteServiceActionResponse (..),
    newDeleteServiceActionResponse,

    -- * Response Lenses
    deleteServiceActionResponse_httpStatus,
  )
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.ServiceCatalog.Types

-- | /See:/ 'newDeleteServiceAction' smart constructor.
data DeleteServiceAction = DeleteServiceAction'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    DeleteServiceAction -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The self-service action identifier. For example, @act-fs7abcd89wxyz@.
    DeleteServiceAction -> Text
id :: Prelude.Text
  }
  deriving (DeleteServiceAction -> DeleteServiceAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteServiceAction -> DeleteServiceAction -> Bool
$c/= :: DeleteServiceAction -> DeleteServiceAction -> Bool
== :: DeleteServiceAction -> DeleteServiceAction -> Bool
$c== :: DeleteServiceAction -> DeleteServiceAction -> Bool
Prelude.Eq, ReadPrec [DeleteServiceAction]
ReadPrec DeleteServiceAction
Int -> ReadS DeleteServiceAction
ReadS [DeleteServiceAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteServiceAction]
$creadListPrec :: ReadPrec [DeleteServiceAction]
readPrec :: ReadPrec DeleteServiceAction
$creadPrec :: ReadPrec DeleteServiceAction
readList :: ReadS [DeleteServiceAction]
$creadList :: ReadS [DeleteServiceAction]
readsPrec :: Int -> ReadS DeleteServiceAction
$creadsPrec :: Int -> ReadS DeleteServiceAction
Prelude.Read, Int -> DeleteServiceAction -> ShowS
[DeleteServiceAction] -> ShowS
DeleteServiceAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteServiceAction] -> ShowS
$cshowList :: [DeleteServiceAction] -> ShowS
show :: DeleteServiceAction -> String
$cshow :: DeleteServiceAction -> String
showsPrec :: Int -> DeleteServiceAction -> ShowS
$cshowsPrec :: Int -> DeleteServiceAction -> ShowS
Prelude.Show, forall x. Rep DeleteServiceAction x -> DeleteServiceAction
forall x. DeleteServiceAction -> Rep DeleteServiceAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteServiceAction x -> DeleteServiceAction
$cfrom :: forall x. DeleteServiceAction -> Rep DeleteServiceAction x
Prelude.Generic)

-- |
-- Create a value of 'DeleteServiceAction' 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:
--
-- 'acceptLanguage', 'deleteServiceAction_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'id', 'deleteServiceAction_id' - The self-service action identifier. For example, @act-fs7abcd89wxyz@.
newDeleteServiceAction ::
  -- | 'id'
  Prelude.Text ->
  DeleteServiceAction
newDeleteServiceAction :: Text -> DeleteServiceAction
newDeleteServiceAction Text
pId_ =
  DeleteServiceAction'
    { $sel:acceptLanguage:DeleteServiceAction' :: Maybe Text
acceptLanguage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:id:DeleteServiceAction' :: Text
id = Text
pId_
    }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
deleteServiceAction_acceptLanguage :: Lens.Lens' DeleteServiceAction (Prelude.Maybe Prelude.Text)
deleteServiceAction_acceptLanguage :: Lens' DeleteServiceAction (Maybe Text)
deleteServiceAction_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServiceAction' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:DeleteServiceAction' :: DeleteServiceAction -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: DeleteServiceAction
s@DeleteServiceAction' {} Maybe Text
a -> DeleteServiceAction
s {$sel:acceptLanguage:DeleteServiceAction' :: Maybe Text
acceptLanguage = Maybe Text
a} :: DeleteServiceAction)

-- | The self-service action identifier. For example, @act-fs7abcd89wxyz@.
deleteServiceAction_id :: Lens.Lens' DeleteServiceAction Prelude.Text
deleteServiceAction_id :: Lens' DeleteServiceAction Text
deleteServiceAction_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServiceAction' {Text
id :: Text
$sel:id:DeleteServiceAction' :: DeleteServiceAction -> Text
id} -> Text
id) (\s :: DeleteServiceAction
s@DeleteServiceAction' {} Text
a -> DeleteServiceAction
s {$sel:id:DeleteServiceAction' :: Text
id = Text
a} :: DeleteServiceAction)

instance Core.AWSRequest DeleteServiceAction where
  type
    AWSResponse DeleteServiceAction =
      DeleteServiceActionResponse
  request :: (Service -> Service)
-> DeleteServiceAction -> Request DeleteServiceAction
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 DeleteServiceAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteServiceAction)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteServiceActionResponse
DeleteServiceActionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteServiceAction where
  hashWithSalt :: Int -> DeleteServiceAction -> Int
hashWithSalt Int
_salt DeleteServiceAction' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteServiceAction' :: DeleteServiceAction -> Text
$sel:acceptLanguage:DeleteServiceAction' :: DeleteServiceAction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DeleteServiceAction where
  rnf :: DeleteServiceAction -> ()
rnf DeleteServiceAction' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteServiceAction' :: DeleteServiceAction -> Text
$sel:acceptLanguage:DeleteServiceAction' :: DeleteServiceAction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance Data.ToHeaders DeleteServiceAction where
  toHeaders :: DeleteServiceAction -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"AWS242ServiceCatalogService.DeleteServiceAction" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteServiceAction where
  toJSON :: DeleteServiceAction -> Value
toJSON DeleteServiceAction' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteServiceAction' :: DeleteServiceAction -> Text
$sel:acceptLanguage:DeleteServiceAction' :: DeleteServiceAction -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteServiceActionResponse where
  rnf :: DeleteServiceActionResponse -> ()
rnf DeleteServiceActionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteServiceActionResponse' :: DeleteServiceActionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus