{-# 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.CreateCustomActionType
-- 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)
--
-- Creates a new custom action that can be used in all pipelines associated
-- with the AWS account. Only used for custom actions.
module Amazonka.CodePipeline.CreateCustomActionType
  ( -- * Creating a Request
    CreateCustomActionType (..),
    newCreateCustomActionType,

    -- * Request Lenses
    createCustomActionType_settings,
    createCustomActionType_configurationProperties,
    createCustomActionType_tags,
    createCustomActionType_category,
    createCustomActionType_provider,
    createCustomActionType_version,
    createCustomActionType_inputArtifactDetails,
    createCustomActionType_outputArtifactDetails,

    -- * Destructuring the Response
    CreateCustomActionTypeResponse (..),
    newCreateCustomActionTypeResponse,

    -- * Response Lenses
    createCustomActionTypeResponse_tags,
    createCustomActionTypeResponse_httpStatus,
    createCustomActionTypeResponse_actionType,
  )
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 CreateCustomActionType operation.
--
-- /See:/ 'newCreateCustomActionType' smart constructor.
data CreateCustomActionType = CreateCustomActionType'
  { -- | URLs that provide users information about this custom action.
    CreateCustomActionType -> Maybe ActionTypeSettings
settings :: Prelude.Maybe ActionTypeSettings,
    -- | The configuration properties for the custom action.
    --
    -- You can refer to a name in the configuration properties of the custom
    -- action within the URL templates by following the format of
    -- {Config:name}, as long as the configuration property is both required
    -- and not secret. For more information, see
    -- <https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-create-custom-action.html Create a Custom Action for a Pipeline>.
    CreateCustomActionType -> Maybe [ActionConfigurationProperty]
configurationProperties :: Prelude.Maybe [ActionConfigurationProperty],
    -- | The tags for the custom action.
    CreateCustomActionType -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The category of the custom action, such as a build action or a test
    -- action.
    CreateCustomActionType -> ActionCategory
category :: ActionCategory,
    -- | The provider of the service used in the custom action, such as AWS
    -- CodeDeploy.
    CreateCustomActionType -> Text
provider :: Prelude.Text,
    -- | The version identifier of the custom action.
    CreateCustomActionType -> Text
version :: Prelude.Text,
    -- | The details of the input artifact for the action, such as its commit ID.
    CreateCustomActionType -> ArtifactDetails
inputArtifactDetails :: ArtifactDetails,
    -- | The details of the output artifact of the action, such as its commit ID.
    CreateCustomActionType -> ArtifactDetails
outputArtifactDetails :: ArtifactDetails
  }
  deriving (CreateCustomActionType -> CreateCustomActionType -> Bool
(CreateCustomActionType -> CreateCustomActionType -> Bool)
-> (CreateCustomActionType -> CreateCustomActionType -> Bool)
-> Eq CreateCustomActionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomActionType -> CreateCustomActionType -> Bool
$c/= :: CreateCustomActionType -> CreateCustomActionType -> Bool
== :: CreateCustomActionType -> CreateCustomActionType -> Bool
$c== :: CreateCustomActionType -> CreateCustomActionType -> Bool
Prelude.Eq, ReadPrec [CreateCustomActionType]
ReadPrec CreateCustomActionType
Int -> ReadS CreateCustomActionType
ReadS [CreateCustomActionType]
(Int -> ReadS CreateCustomActionType)
-> ReadS [CreateCustomActionType]
-> ReadPrec CreateCustomActionType
-> ReadPrec [CreateCustomActionType]
-> Read CreateCustomActionType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomActionType]
$creadListPrec :: ReadPrec [CreateCustomActionType]
readPrec :: ReadPrec CreateCustomActionType
$creadPrec :: ReadPrec CreateCustomActionType
readList :: ReadS [CreateCustomActionType]
$creadList :: ReadS [CreateCustomActionType]
readsPrec :: Int -> ReadS CreateCustomActionType
$creadsPrec :: Int -> ReadS CreateCustomActionType
Prelude.Read, Int -> CreateCustomActionType -> ShowS
[CreateCustomActionType] -> ShowS
CreateCustomActionType -> String
(Int -> CreateCustomActionType -> ShowS)
-> (CreateCustomActionType -> String)
-> ([CreateCustomActionType] -> ShowS)
-> Show CreateCustomActionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomActionType] -> ShowS
$cshowList :: [CreateCustomActionType] -> ShowS
show :: CreateCustomActionType -> String
$cshow :: CreateCustomActionType -> String
showsPrec :: Int -> CreateCustomActionType -> ShowS
$cshowsPrec :: Int -> CreateCustomActionType -> ShowS
Prelude.Show, (forall x. CreateCustomActionType -> Rep CreateCustomActionType x)
-> (forall x.
    Rep CreateCustomActionType x -> CreateCustomActionType)
-> Generic CreateCustomActionType
forall x. Rep CreateCustomActionType x -> CreateCustomActionType
forall x. CreateCustomActionType -> Rep CreateCustomActionType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCustomActionType x -> CreateCustomActionType
$cfrom :: forall x. CreateCustomActionType -> Rep CreateCustomActionType x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomActionType' 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:
--
-- 'settings', 'createCustomActionType_settings' - URLs that provide users information about this custom action.
--
-- 'configurationProperties', 'createCustomActionType_configurationProperties' - The configuration properties for the custom action.
--
-- You can refer to a name in the configuration properties of the custom
-- action within the URL templates by following the format of
-- {Config:name}, as long as the configuration property is both required
-- and not secret. For more information, see
-- <https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-create-custom-action.html Create a Custom Action for a Pipeline>.
--
-- 'tags', 'createCustomActionType_tags' - The tags for the custom action.
--
-- 'category', 'createCustomActionType_category' - The category of the custom action, such as a build action or a test
-- action.
--
-- 'provider', 'createCustomActionType_provider' - The provider of the service used in the custom action, such as AWS
-- CodeDeploy.
--
-- 'version', 'createCustomActionType_version' - The version identifier of the custom action.
--
-- 'inputArtifactDetails', 'createCustomActionType_inputArtifactDetails' - The details of the input artifact for the action, such as its commit ID.
--
-- 'outputArtifactDetails', 'createCustomActionType_outputArtifactDetails' - The details of the output artifact of the action, such as its commit ID.
newCreateCustomActionType ::
  -- | 'category'
  ActionCategory ->
  -- | 'provider'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  -- | 'inputArtifactDetails'
  ArtifactDetails ->
  -- | 'outputArtifactDetails'
  ArtifactDetails ->
  CreateCustomActionType
newCreateCustomActionType :: ActionCategory
-> Text
-> Text
-> ArtifactDetails
-> ArtifactDetails
-> CreateCustomActionType
newCreateCustomActionType
  ActionCategory
pCategory_
  Text
pProvider_
  Text
pVersion_
  ArtifactDetails
pInputArtifactDetails_
  ArtifactDetails
pOutputArtifactDetails_ =
    CreateCustomActionType' :: Maybe ActionTypeSettings
-> Maybe [ActionConfigurationProperty]
-> Maybe [Tag]
-> ActionCategory
-> Text
-> Text
-> ArtifactDetails
-> ArtifactDetails
-> CreateCustomActionType
CreateCustomActionType'
      { $sel:settings:CreateCustomActionType' :: Maybe ActionTypeSettings
settings = Maybe ActionTypeSettings
forall a. Maybe a
Prelude.Nothing,
        $sel:configurationProperties:CreateCustomActionType' :: Maybe [ActionConfigurationProperty]
configurationProperties = Maybe [ActionConfigurationProperty]
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateCustomActionType' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:category:CreateCustomActionType' :: ActionCategory
category = ActionCategory
pCategory_,
        $sel:provider:CreateCustomActionType' :: Text
provider = Text
pProvider_,
        $sel:version:CreateCustomActionType' :: Text
version = Text
pVersion_,
        $sel:inputArtifactDetails:CreateCustomActionType' :: ArtifactDetails
inputArtifactDetails = ArtifactDetails
pInputArtifactDetails_,
        $sel:outputArtifactDetails:CreateCustomActionType' :: ArtifactDetails
outputArtifactDetails = ArtifactDetails
pOutputArtifactDetails_
      }

-- | URLs that provide users information about this custom action.
createCustomActionType_settings :: Lens.Lens' CreateCustomActionType (Prelude.Maybe ActionTypeSettings)
createCustomActionType_settings :: (Maybe ActionTypeSettings -> f (Maybe ActionTypeSettings))
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_settings = (CreateCustomActionType -> Maybe ActionTypeSettings)
-> (CreateCustomActionType
    -> Maybe ActionTypeSettings -> CreateCustomActionType)
-> Lens
     CreateCustomActionType
     CreateCustomActionType
     (Maybe ActionTypeSettings)
     (Maybe ActionTypeSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {Maybe ActionTypeSettings
settings :: Maybe ActionTypeSettings
$sel:settings:CreateCustomActionType' :: CreateCustomActionType -> Maybe ActionTypeSettings
settings} -> Maybe ActionTypeSettings
settings) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} Maybe ActionTypeSettings
a -> CreateCustomActionType
s {$sel:settings:CreateCustomActionType' :: Maybe ActionTypeSettings
settings = Maybe ActionTypeSettings
a} :: CreateCustomActionType)

-- | The configuration properties for the custom action.
--
-- You can refer to a name in the configuration properties of the custom
-- action within the URL templates by following the format of
-- {Config:name}, as long as the configuration property is both required
-- and not secret. For more information, see
-- <https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-create-custom-action.html Create a Custom Action for a Pipeline>.
createCustomActionType_configurationProperties :: Lens.Lens' CreateCustomActionType (Prelude.Maybe [ActionConfigurationProperty])
createCustomActionType_configurationProperties :: (Maybe [ActionConfigurationProperty]
 -> f (Maybe [ActionConfigurationProperty]))
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_configurationProperties = (CreateCustomActionType -> Maybe [ActionConfigurationProperty])
-> (CreateCustomActionType
    -> Maybe [ActionConfigurationProperty] -> CreateCustomActionType)
-> Lens
     CreateCustomActionType
     CreateCustomActionType
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {Maybe [ActionConfigurationProperty]
configurationProperties :: Maybe [ActionConfigurationProperty]
$sel:configurationProperties:CreateCustomActionType' :: CreateCustomActionType -> Maybe [ActionConfigurationProperty]
configurationProperties} -> Maybe [ActionConfigurationProperty]
configurationProperties) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} Maybe [ActionConfigurationProperty]
a -> CreateCustomActionType
s {$sel:configurationProperties:CreateCustomActionType' :: Maybe [ActionConfigurationProperty]
configurationProperties = Maybe [ActionConfigurationProperty]
a} :: CreateCustomActionType) ((Maybe [ActionConfigurationProperty]
  -> f (Maybe [ActionConfigurationProperty]))
 -> CreateCustomActionType -> f CreateCustomActionType)
-> ((Maybe [ActionConfigurationProperty]
     -> f (Maybe [ActionConfigurationProperty]))
    -> Maybe [ActionConfigurationProperty]
    -> f (Maybe [ActionConfigurationProperty]))
-> (Maybe [ActionConfigurationProperty]
    -> f (Maybe [ActionConfigurationProperty]))
-> CreateCustomActionType
-> f CreateCustomActionType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
-> Iso
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The tags for the custom action.
createCustomActionType_tags :: Lens.Lens' CreateCustomActionType (Prelude.Maybe [Tag])
createCustomActionType_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_tags = (CreateCustomActionType -> Maybe [Tag])
-> (CreateCustomActionType
    -> Maybe [Tag] -> CreateCustomActionType)
-> Lens
     CreateCustomActionType
     CreateCustomActionType
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCustomActionType' :: CreateCustomActionType -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} Maybe [Tag]
a -> CreateCustomActionType
s {$sel:tags:CreateCustomActionType' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCustomActionType) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateCustomActionType -> f CreateCustomActionType)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomActionType
-> f CreateCustomActionType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The category of the custom action, such as a build action or a test
-- action.
createCustomActionType_category :: Lens.Lens' CreateCustomActionType ActionCategory
createCustomActionType_category :: (ActionCategory -> f ActionCategory)
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_category = (CreateCustomActionType -> ActionCategory)
-> (CreateCustomActionType
    -> ActionCategory -> CreateCustomActionType)
-> Lens
     CreateCustomActionType
     CreateCustomActionType
     ActionCategory
     ActionCategory
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {ActionCategory
category :: ActionCategory
$sel:category:CreateCustomActionType' :: CreateCustomActionType -> ActionCategory
category} -> ActionCategory
category) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} ActionCategory
a -> CreateCustomActionType
s {$sel:category:CreateCustomActionType' :: ActionCategory
category = ActionCategory
a} :: CreateCustomActionType)

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

-- | The version identifier of the custom action.
createCustomActionType_version :: Lens.Lens' CreateCustomActionType Prelude.Text
createCustomActionType_version :: (Text -> f Text)
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_version = (CreateCustomActionType -> Text)
-> (CreateCustomActionType -> Text -> CreateCustomActionType)
-> Lens CreateCustomActionType CreateCustomActionType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {Text
version :: Text
$sel:version:CreateCustomActionType' :: CreateCustomActionType -> Text
version} -> Text
version) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} Text
a -> CreateCustomActionType
s {$sel:version:CreateCustomActionType' :: Text
version = Text
a} :: CreateCustomActionType)

-- | The details of the input artifact for the action, such as its commit ID.
createCustomActionType_inputArtifactDetails :: Lens.Lens' CreateCustomActionType ArtifactDetails
createCustomActionType_inputArtifactDetails :: (ArtifactDetails -> f ArtifactDetails)
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_inputArtifactDetails = (CreateCustomActionType -> ArtifactDetails)
-> (CreateCustomActionType
    -> ArtifactDetails -> CreateCustomActionType)
-> Lens
     CreateCustomActionType
     CreateCustomActionType
     ArtifactDetails
     ArtifactDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {ArtifactDetails
inputArtifactDetails :: ArtifactDetails
$sel:inputArtifactDetails:CreateCustomActionType' :: CreateCustomActionType -> ArtifactDetails
inputArtifactDetails} -> ArtifactDetails
inputArtifactDetails) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} ArtifactDetails
a -> CreateCustomActionType
s {$sel:inputArtifactDetails:CreateCustomActionType' :: ArtifactDetails
inputArtifactDetails = ArtifactDetails
a} :: CreateCustomActionType)

-- | The details of the output artifact of the action, such as its commit ID.
createCustomActionType_outputArtifactDetails :: Lens.Lens' CreateCustomActionType ArtifactDetails
createCustomActionType_outputArtifactDetails :: (ArtifactDetails -> f ArtifactDetails)
-> CreateCustomActionType -> f CreateCustomActionType
createCustomActionType_outputArtifactDetails = (CreateCustomActionType -> ArtifactDetails)
-> (CreateCustomActionType
    -> ArtifactDetails -> CreateCustomActionType)
-> Lens
     CreateCustomActionType
     CreateCustomActionType
     ArtifactDetails
     ArtifactDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionType' {ArtifactDetails
outputArtifactDetails :: ArtifactDetails
$sel:outputArtifactDetails:CreateCustomActionType' :: CreateCustomActionType -> ArtifactDetails
outputArtifactDetails} -> ArtifactDetails
outputArtifactDetails) (\s :: CreateCustomActionType
s@CreateCustomActionType' {} ArtifactDetails
a -> CreateCustomActionType
s {$sel:outputArtifactDetails:CreateCustomActionType' :: ArtifactDetails
outputArtifactDetails = ArtifactDetails
a} :: CreateCustomActionType)

instance Core.AWSRequest CreateCustomActionType where
  type
    AWSResponse CreateCustomActionType =
      CreateCustomActionTypeResponse
  request :: CreateCustomActionType -> Request CreateCustomActionType
request = Service -> CreateCustomActionType -> Request CreateCustomActionType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCustomActionType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCustomActionType)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCustomActionType))
-> Logger
-> Service
-> Proxy CreateCustomActionType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCustomActionType)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Tag] -> Int -> ActionType -> CreateCustomActionTypeResponse
CreateCustomActionTypeResponse'
            (Maybe [Tag]
 -> Int -> ActionType -> CreateCustomActionTypeResponse)
-> Either String (Maybe [Tag])
-> Either
     String (Int -> ActionType -> CreateCustomActionTypeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe [Tag]))
-> Maybe [Tag] -> Either String (Maybe [Tag])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ActionType -> CreateCustomActionTypeResponse)
-> Either String Int
-> Either String (ActionType -> CreateCustomActionTypeResponse)
forall (f :: * -> *) a b. Applicative f => 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))
            Either String (ActionType -> CreateCustomActionTypeResponse)
-> Either String ActionType
-> Either String CreateCustomActionTypeResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ActionType
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"actionType")
      )

instance Prelude.Hashable CreateCustomActionType

instance Prelude.NFData CreateCustomActionType

instance Core.ToHeaders CreateCustomActionType where
  toHeaders :: CreateCustomActionType -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateCustomActionType -> 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
"CodePipeline_20150709.CreateCustomActionType" ::
                          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 CreateCustomActionType where
  toJSON :: CreateCustomActionType -> Value
toJSON CreateCustomActionType' {Maybe [ActionConfigurationProperty]
Maybe [Tag]
Maybe ActionTypeSettings
Text
ActionCategory
ArtifactDetails
outputArtifactDetails :: ArtifactDetails
inputArtifactDetails :: ArtifactDetails
version :: Text
provider :: Text
category :: ActionCategory
tags :: Maybe [Tag]
configurationProperties :: Maybe [ActionConfigurationProperty]
settings :: Maybe ActionTypeSettings
$sel:outputArtifactDetails:CreateCustomActionType' :: CreateCustomActionType -> ArtifactDetails
$sel:inputArtifactDetails:CreateCustomActionType' :: CreateCustomActionType -> ArtifactDetails
$sel:version:CreateCustomActionType' :: CreateCustomActionType -> Text
$sel:provider:CreateCustomActionType' :: CreateCustomActionType -> Text
$sel:category:CreateCustomActionType' :: CreateCustomActionType -> ActionCategory
$sel:tags:CreateCustomActionType' :: CreateCustomActionType -> Maybe [Tag]
$sel:configurationProperties:CreateCustomActionType' :: CreateCustomActionType -> Maybe [ActionConfigurationProperty]
$sel:settings:CreateCustomActionType' :: CreateCustomActionType -> Maybe ActionTypeSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"settings" Text -> ActionTypeSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ActionTypeSettings -> Pair)
-> Maybe ActionTypeSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ActionTypeSettings
settings,
            (Text
"configurationProperties" Text -> [ActionConfigurationProperty] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ActionConfigurationProperty] -> Pair)
-> Maybe [ActionConfigurationProperty] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ActionConfigurationProperty]
configurationProperties,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"inputArtifactDetails"
                  Text -> ArtifactDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ArtifactDetails
inputArtifactDetails
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"outputArtifactDetails"
                  Text -> ArtifactDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ArtifactDetails
outputArtifactDetails
              )
          ]
      )

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

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

-- | Represents the output of a @CreateCustomActionType@ operation.
--
-- /See:/ 'newCreateCustomActionTypeResponse' smart constructor.
data CreateCustomActionTypeResponse = CreateCustomActionTypeResponse'
  { -- | Specifies the tags applied to the custom action.
    CreateCustomActionTypeResponse -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The response's http status code.
    CreateCustomActionTypeResponse -> Int
httpStatus :: Prelude.Int,
    -- | Returns information about the details of an action type.
    CreateCustomActionTypeResponse -> ActionType
actionType :: ActionType
  }
  deriving (CreateCustomActionTypeResponse
-> CreateCustomActionTypeResponse -> Bool
(CreateCustomActionTypeResponse
 -> CreateCustomActionTypeResponse -> Bool)
-> (CreateCustomActionTypeResponse
    -> CreateCustomActionTypeResponse -> Bool)
-> Eq CreateCustomActionTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomActionTypeResponse
-> CreateCustomActionTypeResponse -> Bool
$c/= :: CreateCustomActionTypeResponse
-> CreateCustomActionTypeResponse -> Bool
== :: CreateCustomActionTypeResponse
-> CreateCustomActionTypeResponse -> Bool
$c== :: CreateCustomActionTypeResponse
-> CreateCustomActionTypeResponse -> Bool
Prelude.Eq, ReadPrec [CreateCustomActionTypeResponse]
ReadPrec CreateCustomActionTypeResponse
Int -> ReadS CreateCustomActionTypeResponse
ReadS [CreateCustomActionTypeResponse]
(Int -> ReadS CreateCustomActionTypeResponse)
-> ReadS [CreateCustomActionTypeResponse]
-> ReadPrec CreateCustomActionTypeResponse
-> ReadPrec [CreateCustomActionTypeResponse]
-> Read CreateCustomActionTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomActionTypeResponse]
$creadListPrec :: ReadPrec [CreateCustomActionTypeResponse]
readPrec :: ReadPrec CreateCustomActionTypeResponse
$creadPrec :: ReadPrec CreateCustomActionTypeResponse
readList :: ReadS [CreateCustomActionTypeResponse]
$creadList :: ReadS [CreateCustomActionTypeResponse]
readsPrec :: Int -> ReadS CreateCustomActionTypeResponse
$creadsPrec :: Int -> ReadS CreateCustomActionTypeResponse
Prelude.Read, Int -> CreateCustomActionTypeResponse -> ShowS
[CreateCustomActionTypeResponse] -> ShowS
CreateCustomActionTypeResponse -> String
(Int -> CreateCustomActionTypeResponse -> ShowS)
-> (CreateCustomActionTypeResponse -> String)
-> ([CreateCustomActionTypeResponse] -> ShowS)
-> Show CreateCustomActionTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomActionTypeResponse] -> ShowS
$cshowList :: [CreateCustomActionTypeResponse] -> ShowS
show :: CreateCustomActionTypeResponse -> String
$cshow :: CreateCustomActionTypeResponse -> String
showsPrec :: Int -> CreateCustomActionTypeResponse -> ShowS
$cshowsPrec :: Int -> CreateCustomActionTypeResponse -> ShowS
Prelude.Show, (forall x.
 CreateCustomActionTypeResponse
 -> Rep CreateCustomActionTypeResponse x)
-> (forall x.
    Rep CreateCustomActionTypeResponse x
    -> CreateCustomActionTypeResponse)
-> Generic CreateCustomActionTypeResponse
forall x.
Rep CreateCustomActionTypeResponse x
-> CreateCustomActionTypeResponse
forall x.
CreateCustomActionTypeResponse
-> Rep CreateCustomActionTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomActionTypeResponse x
-> CreateCustomActionTypeResponse
$cfrom :: forall x.
CreateCustomActionTypeResponse
-> Rep CreateCustomActionTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomActionTypeResponse' 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:
--
-- 'tags', 'createCustomActionTypeResponse_tags' - Specifies the tags applied to the custom action.
--
-- 'httpStatus', 'createCustomActionTypeResponse_httpStatus' - The response's http status code.
--
-- 'actionType', 'createCustomActionTypeResponse_actionType' - Returns information about the details of an action type.
newCreateCustomActionTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'actionType'
  ActionType ->
  CreateCustomActionTypeResponse
newCreateCustomActionTypeResponse :: Int -> ActionType -> CreateCustomActionTypeResponse
newCreateCustomActionTypeResponse
  Int
pHttpStatus_
  ActionType
pActionType_ =
    CreateCustomActionTypeResponse' :: Maybe [Tag] -> Int -> ActionType -> CreateCustomActionTypeResponse
CreateCustomActionTypeResponse'
      { $sel:tags:CreateCustomActionTypeResponse' :: Maybe [Tag]
tags =
          Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateCustomActionTypeResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:actionType:CreateCustomActionTypeResponse' :: ActionType
actionType = ActionType
pActionType_
      }

-- | Specifies the tags applied to the custom action.
createCustomActionTypeResponse_tags :: Lens.Lens' CreateCustomActionTypeResponse (Prelude.Maybe [Tag])
createCustomActionTypeResponse_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomActionTypeResponse
-> f CreateCustomActionTypeResponse
createCustomActionTypeResponse_tags = (CreateCustomActionTypeResponse -> Maybe [Tag])
-> (CreateCustomActionTypeResponse
    -> Maybe [Tag] -> CreateCustomActionTypeResponse)
-> Lens
     CreateCustomActionTypeResponse
     CreateCustomActionTypeResponse
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionTypeResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCustomActionTypeResponse' :: CreateCustomActionTypeResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCustomActionTypeResponse
s@CreateCustomActionTypeResponse' {} Maybe [Tag]
a -> CreateCustomActionTypeResponse
s {$sel:tags:CreateCustomActionTypeResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCustomActionTypeResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateCustomActionTypeResponse
 -> f CreateCustomActionTypeResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomActionTypeResponse
-> f CreateCustomActionTypeResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | Returns information about the details of an action type.
createCustomActionTypeResponse_actionType :: Lens.Lens' CreateCustomActionTypeResponse ActionType
createCustomActionTypeResponse_actionType :: (ActionType -> f ActionType)
-> CreateCustomActionTypeResponse
-> f CreateCustomActionTypeResponse
createCustomActionTypeResponse_actionType = (CreateCustomActionTypeResponse -> ActionType)
-> (CreateCustomActionTypeResponse
    -> ActionType -> CreateCustomActionTypeResponse)
-> Lens
     CreateCustomActionTypeResponse
     CreateCustomActionTypeResponse
     ActionType
     ActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomActionTypeResponse' {ActionType
actionType :: ActionType
$sel:actionType:CreateCustomActionTypeResponse' :: CreateCustomActionTypeResponse -> ActionType
actionType} -> ActionType
actionType) (\s :: CreateCustomActionTypeResponse
s@CreateCustomActionTypeResponse' {} ActionType
a -> CreateCustomActionTypeResponse
s {$sel:actionType:CreateCustomActionTypeResponse' :: ActionType
actionType = ActionType
a} :: CreateCustomActionTypeResponse)

instance
  Prelude.NFData
    CreateCustomActionTypeResponse