{-# 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 #-}
module Network.AWS.ELBv2.CreateTargetGroup
(
createTargetGroup
, CreateTargetGroup
, ctgMatcher
, ctgHealthCheckPath
, ctgUnhealthyThresholdCount
, ctgHealthCheckIntervalSeconds
, ctgHealthyThresholdCount
, ctgHealthCheckProtocol
, ctgHealthCheckTimeoutSeconds
, ctgHealthCheckPort
, ctgName
, ctgProtocol
, ctgPort
, ctgVPCId
, createTargetGroupResponse
, CreateTargetGroupResponse
, ctgrsTargetGroups
, ctgrsResponseStatus
) where
import Network.AWS.ELBv2.Types
import Network.AWS.ELBv2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateTargetGroup = CreateTargetGroup'
{ _ctgMatcher :: !(Maybe Matcher)
, _ctgHealthCheckPath :: !(Maybe Text)
, _ctgUnhealthyThresholdCount :: !(Maybe Nat)
, _ctgHealthCheckIntervalSeconds :: !(Maybe Nat)
, _ctgHealthyThresholdCount :: !(Maybe Nat)
, _ctgHealthCheckProtocol :: !(Maybe ProtocolEnum)
, _ctgHealthCheckTimeoutSeconds :: !(Maybe Nat)
, _ctgHealthCheckPort :: !(Maybe Text)
, _ctgName :: !Text
, _ctgProtocol :: !ProtocolEnum
, _ctgPort :: !Nat
, _ctgVPCId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTargetGroup
:: Text
-> ProtocolEnum
-> Natural
-> Text
-> CreateTargetGroup
createTargetGroup pName_ pProtocol_ pPort_ pVPCId_ =
CreateTargetGroup'
{ _ctgMatcher = Nothing
, _ctgHealthCheckPath = Nothing
, _ctgUnhealthyThresholdCount = Nothing
, _ctgHealthCheckIntervalSeconds = Nothing
, _ctgHealthyThresholdCount = Nothing
, _ctgHealthCheckProtocol = Nothing
, _ctgHealthCheckTimeoutSeconds = Nothing
, _ctgHealthCheckPort = Nothing
, _ctgName = pName_
, _ctgProtocol = pProtocol_
, _ctgPort = _Nat # pPort_
, _ctgVPCId = pVPCId_
}
ctgMatcher :: Lens' CreateTargetGroup (Maybe Matcher)
ctgMatcher = lens _ctgMatcher (\ s a -> s{_ctgMatcher = a});
ctgHealthCheckPath :: Lens' CreateTargetGroup (Maybe Text)
ctgHealthCheckPath = lens _ctgHealthCheckPath (\ s a -> s{_ctgHealthCheckPath = a});
ctgUnhealthyThresholdCount :: Lens' CreateTargetGroup (Maybe Natural)
ctgUnhealthyThresholdCount = lens _ctgUnhealthyThresholdCount (\ s a -> s{_ctgUnhealthyThresholdCount = a}) . mapping _Nat;
ctgHealthCheckIntervalSeconds :: Lens' CreateTargetGroup (Maybe Natural)
ctgHealthCheckIntervalSeconds = lens _ctgHealthCheckIntervalSeconds (\ s a -> s{_ctgHealthCheckIntervalSeconds = a}) . mapping _Nat;
ctgHealthyThresholdCount :: Lens' CreateTargetGroup (Maybe Natural)
ctgHealthyThresholdCount = lens _ctgHealthyThresholdCount (\ s a -> s{_ctgHealthyThresholdCount = a}) . mapping _Nat;
ctgHealthCheckProtocol :: Lens' CreateTargetGroup (Maybe ProtocolEnum)
ctgHealthCheckProtocol = lens _ctgHealthCheckProtocol (\ s a -> s{_ctgHealthCheckProtocol = a});
ctgHealthCheckTimeoutSeconds :: Lens' CreateTargetGroup (Maybe Natural)
ctgHealthCheckTimeoutSeconds = lens _ctgHealthCheckTimeoutSeconds (\ s a -> s{_ctgHealthCheckTimeoutSeconds = a}) . mapping _Nat;
ctgHealthCheckPort :: Lens' CreateTargetGroup (Maybe Text)
ctgHealthCheckPort = lens _ctgHealthCheckPort (\ s a -> s{_ctgHealthCheckPort = a});
ctgName :: Lens' CreateTargetGroup Text
ctgName = lens _ctgName (\ s a -> s{_ctgName = a});
ctgProtocol :: Lens' CreateTargetGroup ProtocolEnum
ctgProtocol = lens _ctgProtocol (\ s a -> s{_ctgProtocol = a});
ctgPort :: Lens' CreateTargetGroup Natural
ctgPort = lens _ctgPort (\ s a -> s{_ctgPort = a}) . _Nat;
ctgVPCId :: Lens' CreateTargetGroup Text
ctgVPCId = lens _ctgVPCId (\ s a -> s{_ctgVPCId = a});
instance AWSRequest CreateTargetGroup where
type Rs CreateTargetGroup = CreateTargetGroupResponse
request = postQuery eLBv2
response
= receiveXMLWrapper "CreateTargetGroupResult"
(\ s h x ->
CreateTargetGroupResponse' <$>
(x .@? "TargetGroups" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance Hashable CreateTargetGroup
instance NFData CreateTargetGroup
instance ToHeaders CreateTargetGroup where
toHeaders = const mempty
instance ToPath CreateTargetGroup where
toPath = const "/"
instance ToQuery CreateTargetGroup where
toQuery CreateTargetGroup'{..}
= mconcat
["Action" =: ("CreateTargetGroup" :: ByteString),
"Version" =: ("2015-12-01" :: ByteString),
"Matcher" =: _ctgMatcher,
"HealthCheckPath" =: _ctgHealthCheckPath,
"UnhealthyThresholdCount" =:
_ctgUnhealthyThresholdCount,
"HealthCheckIntervalSeconds" =:
_ctgHealthCheckIntervalSeconds,
"HealthyThresholdCount" =: _ctgHealthyThresholdCount,
"HealthCheckProtocol" =: _ctgHealthCheckProtocol,
"HealthCheckTimeoutSeconds" =:
_ctgHealthCheckTimeoutSeconds,
"HealthCheckPort" =: _ctgHealthCheckPort,
"Name" =: _ctgName, "Protocol" =: _ctgProtocol,
"Port" =: _ctgPort, "VpcId" =: _ctgVPCId]
data CreateTargetGroupResponse = CreateTargetGroupResponse'
{ _ctgrsTargetGroups :: !(Maybe [TargetGroup])
, _ctgrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTargetGroupResponse
:: Int
-> CreateTargetGroupResponse
createTargetGroupResponse pResponseStatus_ =
CreateTargetGroupResponse'
{ _ctgrsTargetGroups = Nothing
, _ctgrsResponseStatus = pResponseStatus_
}
ctgrsTargetGroups :: Lens' CreateTargetGroupResponse [TargetGroup]
ctgrsTargetGroups = lens _ctgrsTargetGroups (\ s a -> s{_ctgrsTargetGroups = a}) . _Default . _Coerce;
ctgrsResponseStatus :: Lens' CreateTargetGroupResponse Int
ctgrsResponseStatus = lens _ctgrsResponseStatus (\ s a -> s{_ctgrsResponseStatus = a});
instance NFData CreateTargetGroupResponse