{-# 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.Route53.GetHostedZone
(
getHostedZone
, GetHostedZone
, ghzId
, getHostedZoneResponse
, GetHostedZoneResponse
, ghzrsVPCs
, ghzrsDelegationSet
, ghzrsResponseStatus
, ghzrsHostedZone
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Route53.Types
import Network.AWS.Route53.Types.Product
newtype GetHostedZone = GetHostedZone'
{ _ghzId :: ResourceId
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getHostedZone
:: ResourceId
-> GetHostedZone
getHostedZone pId_ = GetHostedZone' {_ghzId = pId_}
ghzId :: Lens' GetHostedZone ResourceId
ghzId = lens _ghzId (\ s a -> s{_ghzId = a})
instance AWSRequest GetHostedZone where
type Rs GetHostedZone = GetHostedZoneResponse
request = get route53
response
= receiveXML
(\ s h x ->
GetHostedZoneResponse' <$>
(x .@? "VPCs" .!@ mempty >>=
may (parseXMLList1 "VPC"))
<*> (x .@? "DelegationSet")
<*> (pure (fromEnum s))
<*> (x .@ "HostedZone"))
instance Hashable GetHostedZone where
instance NFData GetHostedZone where
instance ToHeaders GetHostedZone where
toHeaders = const mempty
instance ToPath GetHostedZone where
toPath GetHostedZone'{..}
= mconcat ["/2013-04-01/hostedzone/", toBS _ghzId]
instance ToQuery GetHostedZone where
toQuery = const mempty
data GetHostedZoneResponse = GetHostedZoneResponse'
{ _ghzrsVPCs :: !(Maybe (List1 VPC))
, _ghzrsDelegationSet :: !(Maybe DelegationSet)
, _ghzrsResponseStatus :: !Int
, _ghzrsHostedZone :: !HostedZone
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getHostedZoneResponse
:: Int
-> HostedZone
-> GetHostedZoneResponse
getHostedZoneResponse pResponseStatus_ pHostedZone_ =
GetHostedZoneResponse'
{ _ghzrsVPCs = Nothing
, _ghzrsDelegationSet = Nothing
, _ghzrsResponseStatus = pResponseStatus_
, _ghzrsHostedZone = pHostedZone_
}
ghzrsVPCs :: Lens' GetHostedZoneResponse (Maybe (NonEmpty VPC))
ghzrsVPCs = lens _ghzrsVPCs (\ s a -> s{_ghzrsVPCs = a}) . mapping _List1
ghzrsDelegationSet :: Lens' GetHostedZoneResponse (Maybe DelegationSet)
ghzrsDelegationSet = lens _ghzrsDelegationSet (\ s a -> s{_ghzrsDelegationSet = a})
ghzrsResponseStatus :: Lens' GetHostedZoneResponse Int
ghzrsResponseStatus = lens _ghzrsResponseStatus (\ s a -> s{_ghzrsResponseStatus = a})
ghzrsHostedZone :: Lens' GetHostedZoneResponse HostedZone
ghzrsHostedZone = lens _ghzrsHostedZone (\ s a -> s{_ghzrsHostedZone = a})
instance NFData GetHostedZoneResponse where