{-# 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.WorkMail.DescribeResource
(
describeResource
, DescribeResource
, drOrganizationId
, drResourceId
, describeResourceResponse
, DescribeResourceResponse
, drrsEmail
, drrsState
, drrsResourceId
, drrsDisabledDate
, drrsName
, drrsType
, drrsEnabledDate
, drrsBookingOptions
, drrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkMail.Types
import Network.AWS.WorkMail.Types.Product
data DescribeResource = DescribeResource'
{ _drOrganizationId :: !Text
, _drResourceId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeResource
:: Text
-> Text
-> DescribeResource
describeResource pOrganizationId_ pResourceId_ =
DescribeResource'
{_drOrganizationId = pOrganizationId_, _drResourceId = pResourceId_}
drOrganizationId :: Lens' DescribeResource Text
drOrganizationId = lens _drOrganizationId (\ s a -> s{_drOrganizationId = a})
drResourceId :: Lens' DescribeResource Text
drResourceId = lens _drResourceId (\ s a -> s{_drResourceId = a})
instance AWSRequest DescribeResource where
type Rs DescribeResource = DescribeResourceResponse
request = postJSON workMail
response
= receiveJSON
(\ s h x ->
DescribeResourceResponse' <$>
(x .?> "Email") <*> (x .?> "State") <*>
(x .?> "ResourceId")
<*> (x .?> "DisabledDate")
<*> (x .?> "Name")
<*> (x .?> "Type")
<*> (x .?> "EnabledDate")
<*> (x .?> "BookingOptions")
<*> (pure (fromEnum s)))
instance Hashable DescribeResource where
instance NFData DescribeResource where
instance ToHeaders DescribeResource where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("WorkMailService.DescribeResource" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeResource where
toJSON DescribeResource'{..}
= object
(catMaybes
[Just ("OrganizationId" .= _drOrganizationId),
Just ("ResourceId" .= _drResourceId)])
instance ToPath DescribeResource where
toPath = const "/"
instance ToQuery DescribeResource where
toQuery = const mempty
data DescribeResourceResponse = DescribeResourceResponse'
{ _drrsEmail :: !(Maybe Text)
, _drrsState :: !(Maybe EntityState)
, _drrsResourceId :: !(Maybe Text)
, _drrsDisabledDate :: !(Maybe POSIX)
, _drrsName :: !(Maybe Text)
, _drrsType :: !(Maybe ResourceType)
, _drrsEnabledDate :: !(Maybe POSIX)
, _drrsBookingOptions :: !(Maybe BookingOptions)
, _drrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeResourceResponse
:: Int
-> DescribeResourceResponse
describeResourceResponse pResponseStatus_ =
DescribeResourceResponse'
{ _drrsEmail = Nothing
, _drrsState = Nothing
, _drrsResourceId = Nothing
, _drrsDisabledDate = Nothing
, _drrsName = Nothing
, _drrsType = Nothing
, _drrsEnabledDate = Nothing
, _drrsBookingOptions = Nothing
, _drrsResponseStatus = pResponseStatus_
}
drrsEmail :: Lens' DescribeResourceResponse (Maybe Text)
drrsEmail = lens _drrsEmail (\ s a -> s{_drrsEmail = a})
drrsState :: Lens' DescribeResourceResponse (Maybe EntityState)
drrsState = lens _drrsState (\ s a -> s{_drrsState = a})
drrsResourceId :: Lens' DescribeResourceResponse (Maybe Text)
drrsResourceId = lens _drrsResourceId (\ s a -> s{_drrsResourceId = a})
drrsDisabledDate :: Lens' DescribeResourceResponse (Maybe UTCTime)
drrsDisabledDate = lens _drrsDisabledDate (\ s a -> s{_drrsDisabledDate = a}) . mapping _Time
drrsName :: Lens' DescribeResourceResponse (Maybe Text)
drrsName = lens _drrsName (\ s a -> s{_drrsName = a})
drrsType :: Lens' DescribeResourceResponse (Maybe ResourceType)
drrsType = lens _drrsType (\ s a -> s{_drrsType = a})
drrsEnabledDate :: Lens' DescribeResourceResponse (Maybe UTCTime)
drrsEnabledDate = lens _drrsEnabledDate (\ s a -> s{_drrsEnabledDate = a}) . mapping _Time
drrsBookingOptions :: Lens' DescribeResourceResponse (Maybe BookingOptions)
drrsBookingOptions = lens _drrsBookingOptions (\ s a -> s{_drrsBookingOptions = a})
drrsResponseStatus :: Lens' DescribeResourceResponse Int
drrsResponseStatus = lens _drrsResponseStatus (\ s a -> s{_drrsResponseStatus = a})
instance NFData DescribeResourceResponse where