{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.AccessApproval.Types.Product where
import Network.Google.AccessApproval.Types.Sum
import Network.Google.Prelude
data ListApprovalRequestsResponse =
ListApprovalRequestsResponse'
{ _larrNextPageToken :: !(Maybe Text)
, _larrApprovalRequests :: !(Maybe [ApprovalRequest])
}
deriving (Eq, Show, Data, Typeable, Generic)
listApprovalRequestsResponse
:: ListApprovalRequestsResponse
listApprovalRequestsResponse =
ListApprovalRequestsResponse'
{_larrNextPageToken = Nothing, _larrApprovalRequests = Nothing}
larrNextPageToken :: Lens' ListApprovalRequestsResponse (Maybe Text)
larrNextPageToken
= lens _larrNextPageToken
(\ s a -> s{_larrNextPageToken = a})
larrApprovalRequests :: Lens' ListApprovalRequestsResponse [ApprovalRequest]
larrApprovalRequests
= lens _larrApprovalRequests
(\ s a -> s{_larrApprovalRequests = a})
. _Default
. _Coerce
instance FromJSON ListApprovalRequestsResponse where
parseJSON
= withObject "ListApprovalRequestsResponse"
(\ o ->
ListApprovalRequestsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "approvalRequests" .!= mempty))
instance ToJSON ListApprovalRequestsResponse where
toJSON ListApprovalRequestsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _larrNextPageToken,
("approvalRequests" .=) <$> _larrApprovalRequests])
data ApproveDecision =
ApproveDecision'
{ _adApproveTime :: !(Maybe DateTime')
, _adExpireTime :: !(Maybe DateTime')
}
deriving (Eq, Show, Data, Typeable, Generic)
approveDecision
:: ApproveDecision
approveDecision =
ApproveDecision' {_adApproveTime = Nothing, _adExpireTime = Nothing}
adApproveTime :: Lens' ApproveDecision (Maybe UTCTime)
adApproveTime
= lens _adApproveTime
(\ s a -> s{_adApproveTime = a})
. mapping _DateTime
adExpireTime :: Lens' ApproveDecision (Maybe UTCTime)
adExpireTime
= lens _adExpireTime (\ s a -> s{_adExpireTime = a})
. mapping _DateTime
instance FromJSON ApproveDecision where
parseJSON
= withObject "ApproveDecision"
(\ o ->
ApproveDecision' <$>
(o .:? "approveTime") <*> (o .:? "expireTime"))
instance ToJSON ApproveDecision where
toJSON ApproveDecision'{..}
= object
(catMaybes
[("approveTime" .=) <$> _adApproveTime,
("expireTime" .=) <$> _adExpireTime])
data AccessLocations =
AccessLocations'
{ _alPrincipalOfficeCountry :: !(Maybe Text)
, _alPrincipalPhysicalLocationCountry :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
accessLocations
:: AccessLocations
accessLocations =
AccessLocations'
{ _alPrincipalOfficeCountry = Nothing
, _alPrincipalPhysicalLocationCountry = Nothing
}
alPrincipalOfficeCountry :: Lens' AccessLocations (Maybe Text)
alPrincipalOfficeCountry
= lens _alPrincipalOfficeCountry
(\ s a -> s{_alPrincipalOfficeCountry = a})
alPrincipalPhysicalLocationCountry :: Lens' AccessLocations (Maybe Text)
alPrincipalPhysicalLocationCountry
= lens _alPrincipalPhysicalLocationCountry
(\ s a -> s{_alPrincipalPhysicalLocationCountry = a})
instance FromJSON AccessLocations where
parseJSON
= withObject "AccessLocations"
(\ o ->
AccessLocations' <$>
(o .:? "principalOfficeCountry") <*>
(o .:? "principalPhysicalLocationCountry"))
instance ToJSON AccessLocations where
toJSON AccessLocations'{..}
= object
(catMaybes
[("principalOfficeCountry" .=) <$>
_alPrincipalOfficeCountry,
("principalPhysicalLocationCountry" .=) <$>
_alPrincipalPhysicalLocationCountry])
newtype DismissDecision =
DismissDecision'
{ _ddDismissTime :: Maybe DateTime'
}
deriving (Eq, Show, Data, Typeable, Generic)
dismissDecision
:: DismissDecision
dismissDecision = DismissDecision' {_ddDismissTime = Nothing}
ddDismissTime :: Lens' DismissDecision (Maybe UTCTime)
ddDismissTime
= lens _ddDismissTime
(\ s a -> s{_ddDismissTime = a})
. mapping _DateTime
instance FromJSON DismissDecision where
parseJSON
= withObject "DismissDecision"
(\ o -> DismissDecision' <$> (o .:? "dismissTime"))
instance ToJSON DismissDecision where
toJSON DismissDecision'{..}
= object
(catMaybes [("dismissTime" .=) <$> _ddDismissTime])
data AccessApprovalSettings =
AccessApprovalSettings'
{ _aasName :: !(Maybe Text)
, _aasNotificationEmails :: !(Maybe [Text])
}
deriving (Eq, Show, Data, Typeable, Generic)
accessApprovalSettings
:: AccessApprovalSettings
accessApprovalSettings =
AccessApprovalSettings' {_aasName = Nothing, _aasNotificationEmails = Nothing}
aasName :: Lens' AccessApprovalSettings (Maybe Text)
aasName = lens _aasName (\ s a -> s{_aasName = a})
aasNotificationEmails :: Lens' AccessApprovalSettings [Text]
aasNotificationEmails
= lens _aasNotificationEmails
(\ s a -> s{_aasNotificationEmails = a})
. _Default
. _Coerce
instance FromJSON AccessApprovalSettings where
parseJSON
= withObject "AccessApprovalSettings"
(\ o ->
AccessApprovalSettings' <$>
(o .:? "name") <*>
(o .:? "notificationEmails" .!= mempty))
instance ToJSON AccessApprovalSettings where
toJSON AccessApprovalSettings'{..}
= object
(catMaybes
[("name" .=) <$> _aasName,
("notificationEmails" .=) <$>
_aasNotificationEmails])
data ApprovalRequest =
ApprovalRequest'
{ _arRequestedResourceName :: !(Maybe Text)
, _arRequestedExpiration :: !(Maybe DateTime')
, _arRequestTime :: !(Maybe DateTime')
, _arRequestedReason :: !(Maybe AccessReason)
, _arName :: !(Maybe Text)
, _arApprove :: !(Maybe ApproveDecision)
, _arDismiss :: !(Maybe DismissDecision)
, _arRequestedLocations :: !(Maybe AccessLocations)
}
deriving (Eq, Show, Data, Typeable, Generic)
approvalRequest
:: ApprovalRequest
approvalRequest =
ApprovalRequest'
{ _arRequestedResourceName = Nothing
, _arRequestedExpiration = Nothing
, _arRequestTime = Nothing
, _arRequestedReason = Nothing
, _arName = Nothing
, _arApprove = Nothing
, _arDismiss = Nothing
, _arRequestedLocations = Nothing
}
arRequestedResourceName :: Lens' ApprovalRequest (Maybe Text)
arRequestedResourceName
= lens _arRequestedResourceName
(\ s a -> s{_arRequestedResourceName = a})
arRequestedExpiration :: Lens' ApprovalRequest (Maybe UTCTime)
arRequestedExpiration
= lens _arRequestedExpiration
(\ s a -> s{_arRequestedExpiration = a})
. mapping _DateTime
arRequestTime :: Lens' ApprovalRequest (Maybe UTCTime)
arRequestTime
= lens _arRequestTime
(\ s a -> s{_arRequestTime = a})
. mapping _DateTime
arRequestedReason :: Lens' ApprovalRequest (Maybe AccessReason)
arRequestedReason
= lens _arRequestedReason
(\ s a -> s{_arRequestedReason = a})
arName :: Lens' ApprovalRequest (Maybe Text)
arName = lens _arName (\ s a -> s{_arName = a})
arApprove :: Lens' ApprovalRequest (Maybe ApproveDecision)
arApprove
= lens _arApprove (\ s a -> s{_arApprove = a})
arDismiss :: Lens' ApprovalRequest (Maybe DismissDecision)
arDismiss
= lens _arDismiss (\ s a -> s{_arDismiss = a})
arRequestedLocations :: Lens' ApprovalRequest (Maybe AccessLocations)
arRequestedLocations
= lens _arRequestedLocations
(\ s a -> s{_arRequestedLocations = a})
instance FromJSON ApprovalRequest where
parseJSON
= withObject "ApprovalRequest"
(\ o ->
ApprovalRequest' <$>
(o .:? "requestedResourceName") <*>
(o .:? "requestedExpiration")
<*> (o .:? "requestTime")
<*> (o .:? "requestedReason")
<*> (o .:? "name")
<*> (o .:? "approve")
<*> (o .:? "dismiss")
<*> (o .:? "requestedLocations"))
instance ToJSON ApprovalRequest where
toJSON ApprovalRequest'{..}
= object
(catMaybes
[("requestedResourceName" .=) <$>
_arRequestedResourceName,
("requestedExpiration" .=) <$>
_arRequestedExpiration,
("requestTime" .=) <$> _arRequestTime,
("requestedReason" .=) <$> _arRequestedReason,
("name" .=) <$> _arName,
("approve" .=) <$> _arApprove,
("dismiss" .=) <$> _arDismiss,
("requestedLocations" .=) <$> _arRequestedLocations])
data DismissApprovalRequestMessage =
DismissApprovalRequestMessage'
deriving (Eq, Show, Data, Typeable, Generic)
dismissApprovalRequestMessage
:: DismissApprovalRequestMessage
dismissApprovalRequestMessage = DismissApprovalRequestMessage'
instance FromJSON DismissApprovalRequestMessage where
parseJSON
= withObject "DismissApprovalRequestMessage"
(\ o -> pure DismissApprovalRequestMessage')
instance ToJSON DismissApprovalRequestMessage where
toJSON = const emptyObject
newtype ApproveApprovalRequestMessage =
ApproveApprovalRequestMessage'
{ _aarmExpireTime :: Maybe DateTime'
}
deriving (Eq, Show, Data, Typeable, Generic)
approveApprovalRequestMessage
:: ApproveApprovalRequestMessage
approveApprovalRequestMessage =
ApproveApprovalRequestMessage' {_aarmExpireTime = Nothing}
aarmExpireTime :: Lens' ApproveApprovalRequestMessage (Maybe UTCTime)
aarmExpireTime
= lens _aarmExpireTime
(\ s a -> s{_aarmExpireTime = a})
. mapping _DateTime
instance FromJSON ApproveApprovalRequestMessage where
parseJSON
= withObject "ApproveApprovalRequestMessage"
(\ o ->
ApproveApprovalRequestMessage' <$>
(o .:? "expireTime"))
instance ToJSON ApproveApprovalRequestMessage where
toJSON ApproveApprovalRequestMessage'{..}
= object
(catMaybes [("expireTime" .=) <$> _aarmExpireTime])
data AccessReason =
AccessReason'
{ _arType :: !(Maybe AccessReasonType)
, _arDetail :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
accessReason
:: AccessReason
accessReason = AccessReason' {_arType = Nothing, _arDetail = Nothing}
arType :: Lens' AccessReason (Maybe AccessReasonType)
arType = lens _arType (\ s a -> s{_arType = a})
arDetail :: Lens' AccessReason (Maybe Text)
arDetail = lens _arDetail (\ s a -> s{_arDetail = a})
instance FromJSON AccessReason where
parseJSON
= withObject "AccessReason"
(\ o ->
AccessReason' <$>
(o .:? "type") <*> (o .:? "detail"))
instance ToJSON AccessReason where
toJSON AccessReason'{..}
= object
(catMaybes
[("type" .=) <$> _arType,
("detail" .=) <$> _arDetail])