amazonka-lambda-1.3.4: gen/Network/AWS/Lambda/UpdateAlias.hs
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.Lambda.UpdateAlias
-- Copyright : (c) 2013-2015 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Using this API you can update function version to which the alias points
-- to and alias description. For more information, see
-- <http://docs.aws.amazon.com/lambda/latest/dg/versioning-v2-intro-aliases.html Introduction to AWS Lambda Aliases>
--
-- This requires permission for the lambda:UpdateAlias action.
--
-- /See:/ <http://docs.aws.amazon.com/lambda/latest/dg/API_UpdateAlias.html AWS API Reference> for UpdateAlias.
module Network.AWS.Lambda.UpdateAlias
(
-- * Creating a Request
updateAlias
, UpdateAlias
-- * Request Lenses
, uaFunctionVersion
, uaDescription
, uaFunctionName
, uaName
-- * Destructuring the Response
, aliasConfiguration
, AliasConfiguration
-- * Response Lenses
, acName
, acFunctionVersion
, acAliasARN
, acDescription
) where
import Network.AWS.Lambda.Types
import Network.AWS.Lambda.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
-- | /See:/ 'updateAlias' smart constructor.
data UpdateAlias = UpdateAlias'
{ _uaFunctionVersion :: !(Maybe Text)
, _uaDescription :: !(Maybe Text)
, _uaFunctionName :: !Text
, _uaName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'UpdateAlias' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'uaFunctionVersion'
--
-- * 'uaDescription'
--
-- * 'uaFunctionName'
--
-- * 'uaName'
updateAlias
:: Text -- ^ 'uaFunctionName'
-> Text -- ^ 'uaName'
-> UpdateAlias
updateAlias pFunctionName_ pName_ =
UpdateAlias'
{ _uaFunctionVersion = Nothing
, _uaDescription = Nothing
, _uaFunctionName = pFunctionName_
, _uaName = pName_
}
-- | Using this parameter you can optionally change the Lambda function
-- version to which the alias to points to.
uaFunctionVersion :: Lens' UpdateAlias (Maybe Text)
uaFunctionVersion = lens _uaFunctionVersion (\ s a -> s{_uaFunctionVersion = a});
-- | You can optionally change the description of the alias using this
-- parameter.
uaDescription :: Lens' UpdateAlias (Maybe Text)
uaDescription = lens _uaDescription (\ s a -> s{_uaDescription = a});
-- | The function name for which the alias is created.
uaFunctionName :: Lens' UpdateAlias Text
uaFunctionName = lens _uaFunctionName (\ s a -> s{_uaFunctionName = a});
-- | The alias name.
uaName :: Lens' UpdateAlias Text
uaName = lens _uaName (\ s a -> s{_uaName = a});
instance AWSRequest UpdateAlias where
type Rs UpdateAlias = AliasConfiguration
request = putJSON lambda
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance ToHeaders UpdateAlias where
toHeaders = const mempty
instance ToJSON UpdateAlias where
toJSON UpdateAlias'{..}
= object
(catMaybes
[("FunctionVersion" .=) <$> _uaFunctionVersion,
("Description" .=) <$> _uaDescription])
instance ToPath UpdateAlias where
toPath UpdateAlias'{..}
= mconcat
["/2015-03-31/functions/", toBS _uaFunctionName,
"/aliases/", toBS _uaName]
instance ToQuery UpdateAlias where
toQuery = const mempty