{-# 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-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 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.Lens as Lens
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
(DeleteServiceAction -> DeleteServiceAction -> Bool)
-> (DeleteServiceAction -> DeleteServiceAction -> Bool)
-> Eq DeleteServiceAction
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]
(Int -> ReadS DeleteServiceAction)
-> ReadS [DeleteServiceAction]
-> ReadPrec DeleteServiceAction
-> ReadPrec [DeleteServiceAction]
-> Read 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
(Int -> DeleteServiceAction -> ShowS)
-> (DeleteServiceAction -> String)
-> ([DeleteServiceAction] -> ShowS)
-> Show DeleteServiceAction
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. DeleteServiceAction -> Rep DeleteServiceAction x)
-> (forall x. Rep DeleteServiceAction x -> DeleteServiceAction)
-> Generic DeleteServiceAction
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' :: Maybe Text -> Text -> DeleteServiceAction
DeleteServiceAction'
    { $sel:acceptLanguage:DeleteServiceAction' :: Maybe Text
acceptLanguage =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteServiceAction -> f DeleteServiceAction
deleteServiceAction_acceptLanguage = (DeleteServiceAction -> Maybe Text)
-> (DeleteServiceAction -> Maybe Text -> DeleteServiceAction)
-> Lens
     DeleteServiceAction DeleteServiceAction (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> DeleteServiceAction -> f DeleteServiceAction
deleteServiceAction_id = (DeleteServiceAction -> Text)
-> (DeleteServiceAction -> Text -> DeleteServiceAction)
-> Lens DeleteServiceAction DeleteServiceAction Text Text
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 :: DeleteServiceAction -> Request DeleteServiceAction
request = Service -> DeleteServiceAction -> Request DeleteServiceAction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteServiceAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteServiceAction)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteServiceAction))
-> Logger
-> Service
-> Proxy DeleteServiceAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteServiceAction)))
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 -> DeleteServiceActionResponse
DeleteServiceActionResponse'
            (Int -> DeleteServiceActionResponse)
-> Either String Int -> Either String DeleteServiceActionResponse
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 DeleteServiceAction

instance Prelude.NFData DeleteServiceAction

instance Core.ToHeaders DeleteServiceAction where
  toHeaders :: DeleteServiceAction -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteServiceAction -> 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
"AWS242ServiceCatalogService.DeleteServiceAction" ::
                          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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AcceptLanguage" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
          ]
      )

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

instance Core.ToQuery DeleteServiceAction where
  toQuery :: DeleteServiceAction -> QueryString
toQuery = QueryString -> DeleteServiceAction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteServiceActionResponse
 -> DeleteServiceActionResponse -> Bool)
-> (DeleteServiceActionResponse
    -> DeleteServiceActionResponse -> Bool)
-> Eq DeleteServiceActionResponse
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]
(Int -> ReadS DeleteServiceActionResponse)
-> ReadS [DeleteServiceActionResponse]
-> ReadPrec DeleteServiceActionResponse
-> ReadPrec [DeleteServiceActionResponse]
-> Read 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
(Int -> DeleteServiceActionResponse -> ShowS)
-> (DeleteServiceActionResponse -> String)
-> ([DeleteServiceActionResponse] -> ShowS)
-> Show DeleteServiceActionResponse
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.
 DeleteServiceActionResponse -> Rep DeleteServiceActionResponse x)
-> (forall x.
    Rep DeleteServiceActionResponse x -> DeleteServiceActionResponse)
-> Generic DeleteServiceActionResponse
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' :: Int -> DeleteServiceActionResponse
DeleteServiceActionResponse'
    { $sel:httpStatus:DeleteServiceActionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteServiceActionResponse_httpStatus :: Lens.Lens' DeleteServiceActionResponse Prelude.Int
deleteServiceActionResponse_httpStatus :: (Int -> f Int)
-> DeleteServiceActionResponse -> f DeleteServiceActionResponse
deleteServiceActionResponse_httpStatus = (DeleteServiceActionResponse -> Int)
-> (DeleteServiceActionResponse
    -> Int -> DeleteServiceActionResponse)
-> Lens
     DeleteServiceActionResponse DeleteServiceActionResponse Int Int
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