{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteCustomActionType -> DeleteCustomActionType -> Bool)
-> (DeleteCustomActionType -> DeleteCustomActionType -> Bool)
-> Eq DeleteCustomActionType
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]
(Int -> ReadS DeleteCustomActionType)
-> ReadS [DeleteCustomActionType]
-> ReadPrec DeleteCustomActionType
-> ReadPrec [DeleteCustomActionType]
-> Read 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
(Int -> DeleteCustomActionType -> ShowS)
-> (DeleteCustomActionType -> String)
-> ([DeleteCustomActionType] -> ShowS)
-> Show DeleteCustomActionType
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. DeleteCustomActionType -> Rep DeleteCustomActionType x)
-> (forall x.
    Rep DeleteCustomActionType x -> DeleteCustomActionType)
-> Generic DeleteCustomActionType
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' :: ActionCategory -> Text -> Text -> DeleteCustomActionType
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 :: (ActionCategory -> f ActionCategory)
-> DeleteCustomActionType -> f DeleteCustomActionType
deleteCustomActionType_category = (DeleteCustomActionType -> ActionCategory)
-> (DeleteCustomActionType
    -> ActionCategory -> DeleteCustomActionType)
-> Lens
     DeleteCustomActionType
     DeleteCustomActionType
     ActionCategory
     ActionCategory
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 :: (Text -> f Text)
-> DeleteCustomActionType -> f DeleteCustomActionType
deleteCustomActionType_provider = (DeleteCustomActionType -> Text)
-> (DeleteCustomActionType -> Text -> DeleteCustomActionType)
-> Lens DeleteCustomActionType DeleteCustomActionType Text Text
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 :: (Text -> f Text)
-> DeleteCustomActionType -> f DeleteCustomActionType
deleteCustomActionType_version = (DeleteCustomActionType -> Text)
-> (DeleteCustomActionType -> Text -> DeleteCustomActionType)
-> Lens DeleteCustomActionType DeleteCustomActionType Text Text
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 :: DeleteCustomActionType -> Request DeleteCustomActionType
request = Service -> DeleteCustomActionType -> Request DeleteCustomActionType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCustomActionType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCustomActionType)))
response =
    AWSResponse DeleteCustomActionType
-> Logger
-> Service
-> Proxy DeleteCustomActionType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCustomActionType)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteCustomActionType
DeleteCustomActionTypeResponse
DeleteCustomActionTypeResponse'

instance Prelude.Hashable DeleteCustomActionType

instance Prelude.NFData DeleteCustomActionType

instance Core.ToHeaders DeleteCustomActionType where
  toHeaders :: DeleteCustomActionType -> [Header]
toHeaders =
    [Header] -> DeleteCustomActionType -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"CodePipeline_20150709.DeleteCustomActionType" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"category" Text -> ActionCategory -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionCategory
category),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"provider" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
provider),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
version)
          ]
      )

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

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

-- | /See:/ 'newDeleteCustomActionTypeResponse' smart constructor.
data DeleteCustomActionTypeResponse = DeleteCustomActionTypeResponse'
  {
  }
  deriving (DeleteCustomActionTypeResponse
-> DeleteCustomActionTypeResponse -> Bool
(DeleteCustomActionTypeResponse
 -> DeleteCustomActionTypeResponse -> Bool)
-> (DeleteCustomActionTypeResponse
    -> DeleteCustomActionTypeResponse -> Bool)
-> Eq DeleteCustomActionTypeResponse
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]
(Int -> ReadS DeleteCustomActionTypeResponse)
-> ReadS [DeleteCustomActionTypeResponse]
-> ReadPrec DeleteCustomActionTypeResponse
-> ReadPrec [DeleteCustomActionTypeResponse]
-> Read 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
(Int -> DeleteCustomActionTypeResponse -> ShowS)
-> (DeleteCustomActionTypeResponse -> String)
-> ([DeleteCustomActionTypeResponse] -> ShowS)
-> Show DeleteCustomActionTypeResponse
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.
 DeleteCustomActionTypeResponse
 -> Rep DeleteCustomActionTypeResponse x)
-> (forall x.
    Rep DeleteCustomActionTypeResponse x
    -> DeleteCustomActionTypeResponse)
-> Generic DeleteCustomActionTypeResponse
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