{-# 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.CodePipeline.DeleteCustomActionType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Marks a custom action as deleted. @PollForJobs@ for the custom action
-- fails after the action is marked for deletion. Used for custom actions
-- only.
--
-- To re-create a custom action after it has been deleted you must use a
-- string in the version field that has never been used before. This string
-- can be an incremented version number, for example. To restore a deleted
-- custom action, use a JSON file that is identical to the deleted action,
-- including the original string in the version field.
module Amazonka.CodePipeline.DeleteCustomActionType
  ( -- * Creating a Request
    DeleteCustomActionType (..),
    newDeleteCustomActionType,

    -- * Request Lenses
    deleteCustomActionType_category,
    deleteCustomActionType_provider,
    deleteCustomActionType_version,

    -- * Destructuring the Response
    DeleteCustomActionTypeResponse (..),
    newDeleteCustomActionTypeResponse,
  )
where

import Amazonka.CodePipeline.Types
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

-- | Represents the input of a @DeleteCustomActionType@ operation. The custom
-- action will be marked as deleted.
--
-- /See:/ 'newDeleteCustomActionType' smart constructor.
data DeleteCustomActionType = DeleteCustomActionType'
  { -- | The category of the custom action that you want to delete, such as
    -- source or deploy.
    DeleteCustomActionType -> ActionCategory
category :: ActionCategory,
    -- | The provider of the service used in the custom action, such as AWS
    -- CodeDeploy.
    DeleteCustomActionType -> Text
provider :: Prelude.Text,
    -- | The version of the custom action to delete.
    DeleteCustomActionType -> Text
version :: Prelude.Text
  }
  deriving (DeleteCustomActionType -> DeleteCustomActionType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCustomActionType -> DeleteCustomActionType -> Bool
$c/= :: DeleteCustomActionType -> DeleteCustomActionType -> Bool
== :: DeleteCustomActionType -> DeleteCustomActionType -> Bool
$c== :: DeleteCustomActionType -> DeleteCustomActionType -> Bool
Prelude.Eq, ReadPrec [DeleteCustomActionType]
ReadPrec DeleteCustomActionType
Int -> ReadS DeleteCustomActionType
ReadS [DeleteCustomActionType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCustomActionType]
$creadListPrec :: ReadPrec [DeleteCustomActionType]
readPrec :: ReadPrec DeleteCustomActionType
$creadPrec :: ReadPrec DeleteCustomActionType
readList :: ReadS [DeleteCustomActionType]
$creadList :: ReadS [DeleteCustomActionType]
readsPrec :: Int -> ReadS DeleteCustomActionType
$creadsPrec :: Int -> ReadS DeleteCustomActionType
Prelude.Read, Int -> DeleteCustomActionType -> ShowS
[DeleteCustomActionType] -> ShowS
DeleteCustomActionType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCustomActionType] -> ShowS
$cshowList :: [DeleteCustomActionType] -> ShowS
show :: DeleteCustomActionType -> String
$cshow :: DeleteCustomActionType -> String
showsPrec :: Int -> DeleteCustomActionType -> ShowS
$cshowsPrec :: Int -> DeleteCustomActionType -> ShowS
Prelude.Show, forall x. Rep DeleteCustomActionType x -> DeleteCustomActionType
forall x. DeleteCustomActionType -> Rep DeleteCustomActionType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteCustomActionType x -> DeleteCustomActionType
$cfrom :: forall x. DeleteCustomActionType -> Rep DeleteCustomActionType x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCustomActionType' 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:
--
-- 'category', 'deleteCustomActionType_category' - The category of the custom action that you want to delete, such as
-- source or deploy.
--
-- 'provider', 'deleteCustomActionType_provider' - The provider of the service used in the custom action, such as AWS
-- CodeDeploy.
--
-- 'version', 'deleteCustomActionType_version' - The version of the custom action to delete.
newDeleteCustomActionType ::
  -- | 'category'
  ActionCategory ->
  -- | 'provider'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  DeleteCustomActionType
newDeleteCustomActionType :: ActionCategory -> Text -> Text -> DeleteCustomActionType
newDeleteCustomActionType
  ActionCategory
pCategory_
  Text
pProvider_
  Text
pVersion_ =
    DeleteCustomActionType'
      { $sel:category:DeleteCustomActionType' :: ActionCategory
category = ActionCategory
pCategory_,
        $sel:provider:DeleteCustomActionType' :: Text
provider = Text
pProvider_,
        $sel:version:DeleteCustomActionType' :: Text
version = Text
pVersion_
      }

-- | The category of the custom action that you want to delete, such as
-- source or deploy.
deleteCustomActionType_category :: Lens.Lens' DeleteCustomActionType ActionCategory
deleteCustomActionType_category :: Lens' DeleteCustomActionType ActionCategory
deleteCustomActionType_category = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomActionType' {ActionCategory
category :: ActionCategory
$sel:category:DeleteCustomActionType' :: DeleteCustomActionType -> ActionCategory
category} -> ActionCategory
category) (\s :: DeleteCustomActionType
s@DeleteCustomActionType' {} ActionCategory
a -> DeleteCustomActionType
s {$sel:category:DeleteCustomActionType' :: ActionCategory
category = ActionCategory
a} :: DeleteCustomActionType)

-- | The provider of the service used in the custom action, such as AWS
-- CodeDeploy.
deleteCustomActionType_provider :: Lens.Lens' DeleteCustomActionType Prelude.Text
deleteCustomActionType_provider :: Lens' DeleteCustomActionType Text
deleteCustomActionType_provider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomActionType' {Text
provider :: Text
$sel:provider:DeleteCustomActionType' :: DeleteCustomActionType -> Text
provider} -> Text
provider) (\s :: DeleteCustomActionType
s@DeleteCustomActionType' {} Text
a -> DeleteCustomActionType
s {$sel:provider:DeleteCustomActionType' :: Text
provider = Text
a} :: DeleteCustomActionType)

-- | The version of the custom action to delete.
deleteCustomActionType_version :: Lens.Lens' DeleteCustomActionType Prelude.Text
deleteCustomActionType_version :: Lens' DeleteCustomActionType Text
deleteCustomActionType_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomActionType' {Text
version :: Text
$sel:version:DeleteCustomActionType' :: DeleteCustomActionType -> Text
version} -> Text
version) (\s :: DeleteCustomActionType
s@DeleteCustomActionType' {} Text
a -> DeleteCustomActionType
s {$sel:version:DeleteCustomActionType' :: Text
version = Text
a} :: DeleteCustomActionType)

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

instance Prelude.Hashable DeleteCustomActionType where
  hashWithSalt :: Int -> DeleteCustomActionType -> Int
hashWithSalt Int
_salt DeleteCustomActionType' {Text
ActionCategory
version :: Text
provider :: Text
category :: ActionCategory
$sel:version:DeleteCustomActionType' :: DeleteCustomActionType -> Text
$sel:provider:DeleteCustomActionType' :: DeleteCustomActionType -> Text
$sel:category:DeleteCustomActionType' :: DeleteCustomActionType -> ActionCategory
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ActionCategory
category
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
provider
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
version

instance Prelude.NFData DeleteCustomActionType where
  rnf :: DeleteCustomActionType -> ()
rnf DeleteCustomActionType' {Text
ActionCategory
version :: Text
provider :: Text
category :: ActionCategory
$sel:version:DeleteCustomActionType' :: DeleteCustomActionType -> Text
$sel:provider:DeleteCustomActionType' :: DeleteCustomActionType -> Text
$sel:category:DeleteCustomActionType' :: DeleteCustomActionType -> ActionCategory
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ActionCategory
category
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
provider
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
version

instance Data.ToHeaders DeleteCustomActionType where
  toHeaders :: DeleteCustomActionType -> [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
"CodePipeline_20150709.DeleteCustomActionType" ::
                          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 DeleteCustomActionType where
  toJSON :: DeleteCustomActionType -> Value
toJSON DeleteCustomActionType' {Text
ActionCategory
version :: Text
provider :: Text
category :: ActionCategory
$sel:version:DeleteCustomActionType' :: DeleteCustomActionType -> Text
$sel:provider:DeleteCustomActionType' :: DeleteCustomActionType -> Text
$sel:category:DeleteCustomActionType' :: DeleteCustomActionType -> ActionCategory
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"category" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ActionCategory
category),
            forall a. a -> Maybe a
Prelude.Just (Key
"provider" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
provider),
            forall a. a -> Maybe a
Prelude.Just (Key
"version" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
version)
          ]
      )

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

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

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

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

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