{-# 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.UpdateActionType
-- 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)
--
-- Updates an action type that was created with any supported integration
-- model, where the action type is to be used by customers of the action
-- type provider. Use a JSON file with the action definition and
-- @UpdateActionType@ to provide the full structure.
module Amazonka.CodePipeline.UpdateActionType
  ( -- * Creating a Request
    UpdateActionType (..),
    newUpdateActionType,

    -- * Request Lenses
    updateActionType_actionType,

    -- * Destructuring the Response
    UpdateActionTypeResponse (..),
    newUpdateActionTypeResponse,
  )
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

-- | /See:/ 'newUpdateActionType' smart constructor.
data UpdateActionType = UpdateActionType'
  { -- | The action type definition for the action type to be updated.
    UpdateActionType -> ActionTypeDeclaration
actionType :: ActionTypeDeclaration
  }
  deriving (UpdateActionType -> UpdateActionType -> Bool
(UpdateActionType -> UpdateActionType -> Bool)
-> (UpdateActionType -> UpdateActionType -> Bool)
-> Eq UpdateActionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateActionType -> UpdateActionType -> Bool
$c/= :: UpdateActionType -> UpdateActionType -> Bool
== :: UpdateActionType -> UpdateActionType -> Bool
$c== :: UpdateActionType -> UpdateActionType -> Bool
Prelude.Eq, ReadPrec [UpdateActionType]
ReadPrec UpdateActionType
Int -> ReadS UpdateActionType
ReadS [UpdateActionType]
(Int -> ReadS UpdateActionType)
-> ReadS [UpdateActionType]
-> ReadPrec UpdateActionType
-> ReadPrec [UpdateActionType]
-> Read UpdateActionType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateActionType]
$creadListPrec :: ReadPrec [UpdateActionType]
readPrec :: ReadPrec UpdateActionType
$creadPrec :: ReadPrec UpdateActionType
readList :: ReadS [UpdateActionType]
$creadList :: ReadS [UpdateActionType]
readsPrec :: Int -> ReadS UpdateActionType
$creadsPrec :: Int -> ReadS UpdateActionType
Prelude.Read, Int -> UpdateActionType -> ShowS
[UpdateActionType] -> ShowS
UpdateActionType -> String
(Int -> UpdateActionType -> ShowS)
-> (UpdateActionType -> String)
-> ([UpdateActionType] -> ShowS)
-> Show UpdateActionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateActionType] -> ShowS
$cshowList :: [UpdateActionType] -> ShowS
show :: UpdateActionType -> String
$cshow :: UpdateActionType -> String
showsPrec :: Int -> UpdateActionType -> ShowS
$cshowsPrec :: Int -> UpdateActionType -> ShowS
Prelude.Show, (forall x. UpdateActionType -> Rep UpdateActionType x)
-> (forall x. Rep UpdateActionType x -> UpdateActionType)
-> Generic UpdateActionType
forall x. Rep UpdateActionType x -> UpdateActionType
forall x. UpdateActionType -> Rep UpdateActionType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateActionType x -> UpdateActionType
$cfrom :: forall x. UpdateActionType -> Rep UpdateActionType x
Prelude.Generic)

-- |
-- Create a value of 'UpdateActionType' 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:
--
-- 'actionType', 'updateActionType_actionType' - The action type definition for the action type to be updated.
newUpdateActionType ::
  -- | 'actionType'
  ActionTypeDeclaration ->
  UpdateActionType
newUpdateActionType :: ActionTypeDeclaration -> UpdateActionType
newUpdateActionType ActionTypeDeclaration
pActionType_ =
  UpdateActionType' :: ActionTypeDeclaration -> UpdateActionType
UpdateActionType' {$sel:actionType:UpdateActionType' :: ActionTypeDeclaration
actionType = ActionTypeDeclaration
pActionType_}

-- | The action type definition for the action type to be updated.
updateActionType_actionType :: Lens.Lens' UpdateActionType ActionTypeDeclaration
updateActionType_actionType :: (ActionTypeDeclaration -> f ActionTypeDeclaration)
-> UpdateActionType -> f UpdateActionType
updateActionType_actionType = (UpdateActionType -> ActionTypeDeclaration)
-> (UpdateActionType -> ActionTypeDeclaration -> UpdateActionType)
-> Lens
     UpdateActionType
     UpdateActionType
     ActionTypeDeclaration
     ActionTypeDeclaration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateActionType' {ActionTypeDeclaration
actionType :: ActionTypeDeclaration
$sel:actionType:UpdateActionType' :: UpdateActionType -> ActionTypeDeclaration
actionType} -> ActionTypeDeclaration
actionType) (\s :: UpdateActionType
s@UpdateActionType' {} ActionTypeDeclaration
a -> UpdateActionType
s {$sel:actionType:UpdateActionType' :: ActionTypeDeclaration
actionType = ActionTypeDeclaration
a} :: UpdateActionType)

instance Core.AWSRequest UpdateActionType where
  type
    AWSResponse UpdateActionType =
      UpdateActionTypeResponse
  request :: UpdateActionType -> Request UpdateActionType
request = Service -> UpdateActionType -> Request UpdateActionType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateActionType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateActionType)))
response =
    AWSResponse UpdateActionType
-> Logger
-> Service
-> Proxy UpdateActionType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateActionType)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse UpdateActionType
UpdateActionTypeResponse
UpdateActionTypeResponse'

instance Prelude.Hashable UpdateActionType

instance Prelude.NFData UpdateActionType

instance Core.ToHeaders UpdateActionType where
  toHeaders :: UpdateActionType -> [Header]
toHeaders =
    [Header] -> UpdateActionType -> [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.UpdateActionType" ::
                          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 UpdateActionType where
  toJSON :: UpdateActionType -> Value
toJSON UpdateActionType' {ActionTypeDeclaration
actionType :: ActionTypeDeclaration
$sel:actionType:UpdateActionType' :: UpdateActionType -> ActionTypeDeclaration
..} =
    [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
"actionType" Text -> ActionTypeDeclaration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionTypeDeclaration
actionType)]
      )

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

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

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

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

instance Prelude.NFData UpdateActionTypeResponse