module Network.AWS.Glacier.Types
(
Glacier
, JSONError
, ArchiveCreationOutput
, archiveCreationOutput
, acoArchiveId
, acoChecksum
, acoLocation
, UploadListElement
, uploadListElement
, uleArchiveDescription
, uleCreationDate
, uleMultipartUploadId
, ulePartSizeInBytes
, uleVaultARN
, InventoryRetrievalJobDescription
, inventoryRetrievalJobDescription
, irjdEndDate
, irjdFormat
, irjdLimit
, irjdMarker
, irjdStartDate
, JobParameters
, jobParameters
, jpArchiveId
, jpDescription
, jpFormat
, jpInventoryRetrievalParameters
, jpRetrievalByteRange
, jpSNSTopic
, jpType
, DescribeVaultOutput
, describeVaultOutput
, dvoCreationDate
, dvoLastInventoryDate
, dvoNumberOfArchives
, dvoSizeInBytes
, dvoVaultARN
, dvoVaultName
, DataRetrievalRule
, dataRetrievalRule
, drrBytesPerHour
, drrStrategy
, ActionCode (..)
, VaultNotificationConfig
, vaultNotificationConfig
, vncEvents
, vncSNSTopic
, InventoryRetrievalJobInput
, inventoryRetrievalJobInput
, irjiEndDate
, irjiLimit
, irjiMarker
, irjiStartDate
, PartListElement
, partListElement
, pleRangeInBytes
, pleSHA256TreeHash
, DataRetrievalPolicy
, dataRetrievalPolicy
, drpRules
, GlacierJobDescription
, glacierJobDescription
, gjdAction
, gjdArchiveId
, gjdArchiveSHA256TreeHash
, gjdArchiveSizeInBytes
, gjdCompleted
, gjdCompletionDate
, gjdCreationDate
, gjdInventoryRetrievalParameters
, gjdInventorySizeInBytes
, gjdJobDescription
, gjdJobId
, gjdRetrievalByteRange
, gjdSHA256TreeHash
, gjdSNSTopic
, gjdStatusCode
, gjdStatusMessage
, gjdVaultARN
, StatusCode (..)
) where
import Network.AWS.Prelude
import Network.AWS.Signing
import qualified GHC.Exts
data Glacier
instance AWSService Glacier where
type Sg Glacier = V4
type Er Glacier = JSONError
service = service'
where
service' :: Service Glacier
service' = Service
{ _svcAbbrev = "Glacier"
, _svcPrefix = "glacier"
, _svcVersion = "2012-06-01"
, _svcTargetPrefix = Nothing
, _svcJSONVersion = Nothing
, _svcHandle = handle
, _svcRetry = retry
}
handle :: Status
-> Maybe (LazyByteString -> ServiceError JSONError)
handle = jsonError statusSuccess service'
retry :: Retry Glacier
retry = Exponential
{ _retryBase = 0.05
, _retryGrowth = 2
, _retryAttempts = 5
, _retryCheck = check
}
check :: Status
-> JSONError
-> Bool
check (statusCode -> s) (awsErrorCode -> e)
| s == 400 && "ThrottlingException" == e = True
| s == 500 = True
| s == 509 = True
| s == 503 = True
| otherwise = False
data ArchiveCreationOutput = ArchiveCreationOutput
{ _acoArchiveId :: Maybe Text
, _acoChecksum :: Maybe Text
, _acoLocation :: Maybe Text
} deriving (Eq, Ord, Read, Show)
archiveCreationOutput :: ArchiveCreationOutput
archiveCreationOutput = ArchiveCreationOutput
{ _acoLocation = Nothing
, _acoChecksum = Nothing
, _acoArchiveId = Nothing
}
acoArchiveId :: Lens' ArchiveCreationOutput (Maybe Text)
acoArchiveId = lens _acoArchiveId (\s a -> s { _acoArchiveId = a })
acoChecksum :: Lens' ArchiveCreationOutput (Maybe Text)
acoChecksum = lens _acoChecksum (\s a -> s { _acoChecksum = a })
acoLocation :: Lens' ArchiveCreationOutput (Maybe Text)
acoLocation = lens _acoLocation (\s a -> s { _acoLocation = a })
instance FromJSON ArchiveCreationOutput where
parseJSON = withObject "ArchiveCreationOutput" $ \o -> ArchiveCreationOutput
<$> o .:? "x-amz-archive-id"
<*> o .:? "x-amz-sha256-tree-hash"
<*> o .:? "Location"
instance ToJSON ArchiveCreationOutput where
toJSON = const (toJSON Empty)
data UploadListElement = UploadListElement
{ _uleArchiveDescription :: Maybe Text
, _uleCreationDate :: Maybe Text
, _uleMultipartUploadId :: Maybe Text
, _ulePartSizeInBytes :: Maybe Integer
, _uleVaultARN :: Maybe Text
} deriving (Eq, Ord, Read, Show)
uploadListElement :: UploadListElement
uploadListElement = UploadListElement
{ _uleMultipartUploadId = Nothing
, _uleVaultARN = Nothing
, _uleArchiveDescription = Nothing
, _ulePartSizeInBytes = Nothing
, _uleCreationDate = Nothing
}
uleArchiveDescription :: Lens' UploadListElement (Maybe Text)
uleArchiveDescription =
lens _uleArchiveDescription (\s a -> s { _uleArchiveDescription = a })
uleCreationDate :: Lens' UploadListElement (Maybe Text)
uleCreationDate = lens _uleCreationDate (\s a -> s { _uleCreationDate = a })
uleMultipartUploadId :: Lens' UploadListElement (Maybe Text)
uleMultipartUploadId =
lens _uleMultipartUploadId (\s a -> s { _uleMultipartUploadId = a })
ulePartSizeInBytes :: Lens' UploadListElement (Maybe Integer)
ulePartSizeInBytes =
lens _ulePartSizeInBytes (\s a -> s { _ulePartSizeInBytes = a })
uleVaultARN :: Lens' UploadListElement (Maybe Text)
uleVaultARN = lens _uleVaultARN (\s a -> s { _uleVaultARN = a })
instance FromJSON UploadListElement where
parseJSON = withObject "UploadListElement" $ \o -> UploadListElement
<$> o .:? "ArchiveDescription"
<*> o .:? "CreationDate"
<*> o .:? "MultipartUploadId"
<*> o .:? "PartSizeInBytes"
<*> o .:? "VaultARN"
instance ToJSON UploadListElement where
toJSON UploadListElement{..} = object
[ "MultipartUploadId" .= _uleMultipartUploadId
, "VaultARN" .= _uleVaultARN
, "ArchiveDescription" .= _uleArchiveDescription
, "PartSizeInBytes" .= _ulePartSizeInBytes
, "CreationDate" .= _uleCreationDate
]
data InventoryRetrievalJobDescription = InventoryRetrievalJobDescription
{ _irjdEndDate :: Maybe Text
, _irjdFormat :: Maybe Text
, _irjdLimit :: Maybe Text
, _irjdMarker :: Maybe Text
, _irjdStartDate :: Maybe Text
} deriving (Eq, Ord, Read, Show)
inventoryRetrievalJobDescription :: InventoryRetrievalJobDescription
inventoryRetrievalJobDescription = InventoryRetrievalJobDescription
{ _irjdFormat = Nothing
, _irjdStartDate = Nothing
, _irjdEndDate = Nothing
, _irjdLimit = Nothing
, _irjdMarker = Nothing
}
irjdEndDate :: Lens' InventoryRetrievalJobDescription (Maybe Text)
irjdEndDate = lens _irjdEndDate (\s a -> s { _irjdEndDate = a })
irjdFormat :: Lens' InventoryRetrievalJobDescription (Maybe Text)
irjdFormat = lens _irjdFormat (\s a -> s { _irjdFormat = a })
irjdLimit :: Lens' InventoryRetrievalJobDescription (Maybe Text)
irjdLimit = lens _irjdLimit (\s a -> s { _irjdLimit = a })
irjdMarker :: Lens' InventoryRetrievalJobDescription (Maybe Text)
irjdMarker = lens _irjdMarker (\s a -> s { _irjdMarker = a })
irjdStartDate :: Lens' InventoryRetrievalJobDescription (Maybe Text)
irjdStartDate = lens _irjdStartDate (\s a -> s { _irjdStartDate = a })
instance FromJSON InventoryRetrievalJobDescription where
parseJSON = withObject "InventoryRetrievalJobDescription" $ \o -> InventoryRetrievalJobDescription
<$> o .:? "EndDate"
<*> o .:? "Format"
<*> o .:? "Limit"
<*> o .:? "Marker"
<*> o .:? "StartDate"
instance ToJSON InventoryRetrievalJobDescription where
toJSON InventoryRetrievalJobDescription{..} = object
[ "Format" .= _irjdFormat
, "StartDate" .= _irjdStartDate
, "EndDate" .= _irjdEndDate
, "Limit" .= _irjdLimit
, "Marker" .= _irjdMarker
]
data JobParameters = JobParameters
{ _jpArchiveId :: Maybe Text
, _jpDescription :: Maybe Text
, _jpFormat :: Maybe Text
, _jpInventoryRetrievalParameters :: Maybe InventoryRetrievalJobInput
, _jpRetrievalByteRange :: Maybe Text
, _jpSNSTopic :: Maybe Text
, _jpType :: Maybe Text
} deriving (Eq, Read, Show)
jobParameters :: JobParameters
jobParameters = JobParameters
{ _jpFormat = Nothing
, _jpType = Nothing
, _jpArchiveId = Nothing
, _jpDescription = Nothing
, _jpSNSTopic = Nothing
, _jpRetrievalByteRange = Nothing
, _jpInventoryRetrievalParameters = Nothing
}
jpArchiveId :: Lens' JobParameters (Maybe Text)
jpArchiveId = lens _jpArchiveId (\s a -> s { _jpArchiveId = a })
jpDescription :: Lens' JobParameters (Maybe Text)
jpDescription = lens _jpDescription (\s a -> s { _jpDescription = a })
jpFormat :: Lens' JobParameters (Maybe Text)
jpFormat = lens _jpFormat (\s a -> s { _jpFormat = a })
jpInventoryRetrievalParameters :: Lens' JobParameters (Maybe InventoryRetrievalJobInput)
jpInventoryRetrievalParameters =
lens _jpInventoryRetrievalParameters
(\s a -> s { _jpInventoryRetrievalParameters = a })
jpRetrievalByteRange :: Lens' JobParameters (Maybe Text)
jpRetrievalByteRange =
lens _jpRetrievalByteRange (\s a -> s { _jpRetrievalByteRange = a })
jpSNSTopic :: Lens' JobParameters (Maybe Text)
jpSNSTopic = lens _jpSNSTopic (\s a -> s { _jpSNSTopic = a })
jpType :: Lens' JobParameters (Maybe Text)
jpType = lens _jpType (\s a -> s { _jpType = a })
instance FromJSON JobParameters where
parseJSON = withObject "JobParameters" $ \o -> JobParameters
<$> o .:? "ArchiveId"
<*> o .:? "Description"
<*> o .:? "Format"
<*> o .:? "InventoryRetrievalParameters"
<*> o .:? "RetrievalByteRange"
<*> o .:? "SNSTopic"
<*> o .:? "Type"
instance ToJSON JobParameters where
toJSON JobParameters{..} = object
[ "Format" .= _jpFormat
, "Type" .= _jpType
, "ArchiveId" .= _jpArchiveId
, "Description" .= _jpDescription
, "SNSTopic" .= _jpSNSTopic
, "RetrievalByteRange" .= _jpRetrievalByteRange
, "InventoryRetrievalParameters" .= _jpInventoryRetrievalParameters
]
data DescribeVaultOutput = DescribeVaultOutput
{ _dvoCreationDate :: Maybe Text
, _dvoLastInventoryDate :: Maybe Text
, _dvoNumberOfArchives :: Maybe Integer
, _dvoSizeInBytes :: Maybe Integer
, _dvoVaultARN :: Maybe Text
, _dvoVaultName :: Maybe Text
} deriving (Eq, Ord, Read, Show)
describeVaultOutput :: DescribeVaultOutput
describeVaultOutput = DescribeVaultOutput
{ _dvoVaultARN = Nothing
, _dvoVaultName = Nothing
, _dvoCreationDate = Nothing
, _dvoLastInventoryDate = Nothing
, _dvoNumberOfArchives = Nothing
, _dvoSizeInBytes = Nothing
}
dvoCreationDate :: Lens' DescribeVaultOutput (Maybe Text)
dvoCreationDate = lens _dvoCreationDate (\s a -> s { _dvoCreationDate = a })
dvoLastInventoryDate :: Lens' DescribeVaultOutput (Maybe Text)
dvoLastInventoryDate =
lens _dvoLastInventoryDate (\s a -> s { _dvoLastInventoryDate = a })
dvoNumberOfArchives :: Lens' DescribeVaultOutput (Maybe Integer)
dvoNumberOfArchives =
lens _dvoNumberOfArchives (\s a -> s { _dvoNumberOfArchives = a })
dvoSizeInBytes :: Lens' DescribeVaultOutput (Maybe Integer)
dvoSizeInBytes = lens _dvoSizeInBytes (\s a -> s { _dvoSizeInBytes = a })
dvoVaultARN :: Lens' DescribeVaultOutput (Maybe Text)
dvoVaultARN = lens _dvoVaultARN (\s a -> s { _dvoVaultARN = a })
dvoVaultName :: Lens' DescribeVaultOutput (Maybe Text)
dvoVaultName = lens _dvoVaultName (\s a -> s { _dvoVaultName = a })
instance FromJSON DescribeVaultOutput where
parseJSON = withObject "DescribeVaultOutput" $ \o -> DescribeVaultOutput
<$> o .:? "CreationDate"
<*> o .:? "LastInventoryDate"
<*> o .:? "NumberOfArchives"
<*> o .:? "SizeInBytes"
<*> o .:? "VaultARN"
<*> o .:? "VaultName"
instance ToJSON DescribeVaultOutput where
toJSON DescribeVaultOutput{..} = object
[ "VaultARN" .= _dvoVaultARN
, "VaultName" .= _dvoVaultName
, "CreationDate" .= _dvoCreationDate
, "LastInventoryDate" .= _dvoLastInventoryDate
, "NumberOfArchives" .= _dvoNumberOfArchives
, "SizeInBytes" .= _dvoSizeInBytes
]
data DataRetrievalRule = DataRetrievalRule
{ _drrBytesPerHour :: Maybe Integer
, _drrStrategy :: Maybe Text
} deriving (Eq, Ord, Read, Show)
dataRetrievalRule :: DataRetrievalRule
dataRetrievalRule = DataRetrievalRule
{ _drrStrategy = Nothing
, _drrBytesPerHour = Nothing
}
drrBytesPerHour :: Lens' DataRetrievalRule (Maybe Integer)
drrBytesPerHour = lens _drrBytesPerHour (\s a -> s { _drrBytesPerHour = a })
drrStrategy :: Lens' DataRetrievalRule (Maybe Text)
drrStrategy = lens _drrStrategy (\s a -> s { _drrStrategy = a })
instance FromJSON DataRetrievalRule where
parseJSON = withObject "DataRetrievalRule" $ \o -> DataRetrievalRule
<$> o .:? "BytesPerHour"
<*> o .:? "Strategy"
instance ToJSON DataRetrievalRule where
toJSON DataRetrievalRule{..} = object
[ "Strategy" .= _drrStrategy
, "BytesPerHour" .= _drrBytesPerHour
]
data ActionCode
= ArchiveRetrieval
| InventoryRetrieval
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable ActionCode
instance FromText ActionCode where
parser = takeLowerText >>= \case
"archiveretrieval" -> pure ArchiveRetrieval
"inventoryretrieval" -> pure InventoryRetrieval
e -> fail $
"Failure parsing ActionCode from " ++ show e
instance ToText ActionCode where
toText = \case
ArchiveRetrieval -> "ArchiveRetrieval"
InventoryRetrieval -> "InventoryRetrieval"
instance ToByteString ActionCode
instance ToHeader ActionCode
instance ToQuery ActionCode
instance FromJSON ActionCode where
parseJSON = parseJSONText "ActionCode"
instance ToJSON ActionCode where
toJSON = toJSONText
data VaultNotificationConfig = VaultNotificationConfig
{ _vncEvents :: List "Events" Text
, _vncSNSTopic :: Maybe Text
} deriving (Eq, Ord, Read, Show)
vaultNotificationConfig :: VaultNotificationConfig
vaultNotificationConfig = VaultNotificationConfig
{ _vncSNSTopic = Nothing
, _vncEvents = mempty
}
vncEvents :: Lens' VaultNotificationConfig [Text]
vncEvents = lens _vncEvents (\s a -> s { _vncEvents = a }) . _List
vncSNSTopic :: Lens' VaultNotificationConfig (Maybe Text)
vncSNSTopic = lens _vncSNSTopic (\s a -> s { _vncSNSTopic = a })
instance FromJSON VaultNotificationConfig where
parseJSON = withObject "VaultNotificationConfig" $ \o -> VaultNotificationConfig
<$> o .:? "Events" .!= mempty
<*> o .:? "SNSTopic"
instance ToJSON VaultNotificationConfig where
toJSON VaultNotificationConfig{..} = object
[ "SNSTopic" .= _vncSNSTopic
, "Events" .= _vncEvents
]
data InventoryRetrievalJobInput = InventoryRetrievalJobInput
{ _irjiEndDate :: Maybe Text
, _irjiLimit :: Maybe Text
, _irjiMarker :: Maybe Text
, _irjiStartDate :: Maybe Text
} deriving (Eq, Ord, Read, Show)
inventoryRetrievalJobInput :: InventoryRetrievalJobInput
inventoryRetrievalJobInput = InventoryRetrievalJobInput
{ _irjiStartDate = Nothing
, _irjiEndDate = Nothing
, _irjiLimit = Nothing
, _irjiMarker = Nothing
}
irjiEndDate :: Lens' InventoryRetrievalJobInput (Maybe Text)
irjiEndDate = lens _irjiEndDate (\s a -> s { _irjiEndDate = a })
irjiLimit :: Lens' InventoryRetrievalJobInput (Maybe Text)
irjiLimit = lens _irjiLimit (\s a -> s { _irjiLimit = a })
irjiMarker :: Lens' InventoryRetrievalJobInput (Maybe Text)
irjiMarker = lens _irjiMarker (\s a -> s { _irjiMarker = a })
irjiStartDate :: Lens' InventoryRetrievalJobInput (Maybe Text)
irjiStartDate = lens _irjiStartDate (\s a -> s { _irjiStartDate = a })
instance FromJSON InventoryRetrievalJobInput where
parseJSON = withObject "InventoryRetrievalJobInput" $ \o -> InventoryRetrievalJobInput
<$> o .:? "EndDate"
<*> o .:? "Limit"
<*> o .:? "Marker"
<*> o .:? "StartDate"
instance ToJSON InventoryRetrievalJobInput where
toJSON InventoryRetrievalJobInput{..} = object
[ "StartDate" .= _irjiStartDate
, "EndDate" .= _irjiEndDate
, "Limit" .= _irjiLimit
, "Marker" .= _irjiMarker
]
data PartListElement = PartListElement
{ _pleRangeInBytes :: Maybe Text
, _pleSHA256TreeHash :: Maybe Text
} deriving (Eq, Ord, Read, Show)
partListElement :: PartListElement
partListElement = PartListElement
{ _pleRangeInBytes = Nothing
, _pleSHA256TreeHash = Nothing
}
pleRangeInBytes :: Lens' PartListElement (Maybe Text)
pleRangeInBytes = lens _pleRangeInBytes (\s a -> s { _pleRangeInBytes = a })
pleSHA256TreeHash :: Lens' PartListElement (Maybe Text)
pleSHA256TreeHash =
lens _pleSHA256TreeHash (\s a -> s { _pleSHA256TreeHash = a })
instance FromJSON PartListElement where
parseJSON = withObject "PartListElement" $ \o -> PartListElement
<$> o .:? "RangeInBytes"
<*> o .:? "SHA256TreeHash"
instance ToJSON PartListElement where
toJSON PartListElement{..} = object
[ "RangeInBytes" .= _pleRangeInBytes
, "SHA256TreeHash" .= _pleSHA256TreeHash
]
newtype DataRetrievalPolicy = DataRetrievalPolicy
{ _drpRules :: List "Rules" DataRetrievalRule
} deriving (Eq, Read, Show, Monoid, Semigroup)
instance GHC.Exts.IsList DataRetrievalPolicy where
type Item DataRetrievalPolicy = DataRetrievalRule
fromList = DataRetrievalPolicy . GHC.Exts.fromList
toList = GHC.Exts.toList . _drpRules
dataRetrievalPolicy :: DataRetrievalPolicy
dataRetrievalPolicy = DataRetrievalPolicy
{ _drpRules = mempty
}
drpRules :: Lens' DataRetrievalPolicy [DataRetrievalRule]
drpRules = lens _drpRules (\s a -> s { _drpRules = a }) . _List
instance FromJSON DataRetrievalPolicy where
parseJSON = withObject "DataRetrievalPolicy" $ \o -> DataRetrievalPolicy
<$> o .:? "Rules" .!= mempty
instance ToJSON DataRetrievalPolicy where
toJSON DataRetrievalPolicy{..} = object
[ "Rules" .= _drpRules
]
data GlacierJobDescription = GlacierJobDescription
{ _gjdAction :: Maybe ActionCode
, _gjdArchiveId :: Maybe Text
, _gjdArchiveSHA256TreeHash :: Maybe Text
, _gjdArchiveSizeInBytes :: Maybe Integer
, _gjdCompleted :: Maybe Bool
, _gjdCompletionDate :: Maybe Text
, _gjdCreationDate :: Maybe Text
, _gjdInventoryRetrievalParameters :: Maybe InventoryRetrievalJobDescription
, _gjdInventorySizeInBytes :: Maybe Integer
, _gjdJobDescription :: Maybe Text
, _gjdJobId :: Maybe Text
, _gjdRetrievalByteRange :: Maybe Text
, _gjdSHA256TreeHash :: Maybe Text
, _gjdSNSTopic :: Maybe Text
, _gjdStatusCode :: Maybe StatusCode
, _gjdStatusMessage :: Maybe Text
, _gjdVaultARN :: Maybe Text
} deriving (Eq, Read, Show)
glacierJobDescription :: GlacierJobDescription
glacierJobDescription = GlacierJobDescription
{ _gjdJobId = Nothing
, _gjdJobDescription = Nothing
, _gjdAction = Nothing
, _gjdArchiveId = Nothing
, _gjdVaultARN = Nothing
, _gjdCreationDate = Nothing
, _gjdCompleted = Nothing
, _gjdStatusCode = Nothing
, _gjdStatusMessage = Nothing
, _gjdArchiveSizeInBytes = Nothing
, _gjdInventorySizeInBytes = Nothing
, _gjdSNSTopic = Nothing
, _gjdCompletionDate = Nothing
, _gjdSHA256TreeHash = Nothing
, _gjdArchiveSHA256TreeHash = Nothing
, _gjdRetrievalByteRange = Nothing
, _gjdInventoryRetrievalParameters = Nothing
}
gjdAction :: Lens' GlacierJobDescription (Maybe ActionCode)
gjdAction = lens _gjdAction (\s a -> s { _gjdAction = a })
gjdArchiveId :: Lens' GlacierJobDescription (Maybe Text)
gjdArchiveId = lens _gjdArchiveId (\s a -> s { _gjdArchiveId = a })
gjdArchiveSHA256TreeHash :: Lens' GlacierJobDescription (Maybe Text)
gjdArchiveSHA256TreeHash =
lens _gjdArchiveSHA256TreeHash
(\s a -> s { _gjdArchiveSHA256TreeHash = a })
gjdArchiveSizeInBytes :: Lens' GlacierJobDescription (Maybe Integer)
gjdArchiveSizeInBytes =
lens _gjdArchiveSizeInBytes (\s a -> s { _gjdArchiveSizeInBytes = a })
gjdCompleted :: Lens' GlacierJobDescription (Maybe Bool)
gjdCompleted = lens _gjdCompleted (\s a -> s { _gjdCompleted = a })
gjdCompletionDate :: Lens' GlacierJobDescription (Maybe Text)
gjdCompletionDate =
lens _gjdCompletionDate (\s a -> s { _gjdCompletionDate = a })
gjdCreationDate :: Lens' GlacierJobDescription (Maybe Text)
gjdCreationDate = lens _gjdCreationDate (\s a -> s { _gjdCreationDate = a })
gjdInventoryRetrievalParameters :: Lens' GlacierJobDescription (Maybe InventoryRetrievalJobDescription)
gjdInventoryRetrievalParameters =
lens _gjdInventoryRetrievalParameters
(\s a -> s { _gjdInventoryRetrievalParameters = a })
gjdInventorySizeInBytes :: Lens' GlacierJobDescription (Maybe Integer)
gjdInventorySizeInBytes =
lens _gjdInventorySizeInBytes (\s a -> s { _gjdInventorySizeInBytes = a })
gjdJobDescription :: Lens' GlacierJobDescription (Maybe Text)
gjdJobDescription =
lens _gjdJobDescription (\s a -> s { _gjdJobDescription = a })
gjdJobId :: Lens' GlacierJobDescription (Maybe Text)
gjdJobId = lens _gjdJobId (\s a -> s { _gjdJobId = a })
gjdRetrievalByteRange :: Lens' GlacierJobDescription (Maybe Text)
gjdRetrievalByteRange =
lens _gjdRetrievalByteRange (\s a -> s { _gjdRetrievalByteRange = a })
gjdSHA256TreeHash :: Lens' GlacierJobDescription (Maybe Text)
gjdSHA256TreeHash =
lens _gjdSHA256TreeHash (\s a -> s { _gjdSHA256TreeHash = a })
gjdSNSTopic :: Lens' GlacierJobDescription (Maybe Text)
gjdSNSTopic = lens _gjdSNSTopic (\s a -> s { _gjdSNSTopic = a })
gjdStatusCode :: Lens' GlacierJobDescription (Maybe StatusCode)
gjdStatusCode = lens _gjdStatusCode (\s a -> s { _gjdStatusCode = a })
gjdStatusMessage :: Lens' GlacierJobDescription (Maybe Text)
gjdStatusMessage = lens _gjdStatusMessage (\s a -> s { _gjdStatusMessage = a })
gjdVaultARN :: Lens' GlacierJobDescription (Maybe Text)
gjdVaultARN = lens _gjdVaultARN (\s a -> s { _gjdVaultARN = a })
instance FromJSON GlacierJobDescription where
parseJSON = withObject "GlacierJobDescription" $ \o -> GlacierJobDescription
<$> o .:? "Action"
<*> o .:? "ArchiveId"
<*> o .:? "ArchiveSHA256TreeHash"
<*> o .:? "ArchiveSizeInBytes"
<*> o .:? "Completed"
<*> o .:? "CompletionDate"
<*> o .:? "CreationDate"
<*> o .:? "InventoryRetrievalParameters"
<*> o .:? "InventorySizeInBytes"
<*> o .:? "JobDescription"
<*> o .:? "JobId"
<*> o .:? "RetrievalByteRange"
<*> o .:? "SHA256TreeHash"
<*> o .:? "SNSTopic"
<*> o .:? "StatusCode"
<*> o .:? "StatusMessage"
<*> o .:? "VaultARN"
instance ToJSON GlacierJobDescription where
toJSON GlacierJobDescription{..} = object
[ "JobId" .= _gjdJobId
, "JobDescription" .= _gjdJobDescription
, "Action" .= _gjdAction
, "ArchiveId" .= _gjdArchiveId
, "VaultARN" .= _gjdVaultARN
, "CreationDate" .= _gjdCreationDate
, "Completed" .= _gjdCompleted
, "StatusCode" .= _gjdStatusCode
, "StatusMessage" .= _gjdStatusMessage
, "ArchiveSizeInBytes" .= _gjdArchiveSizeInBytes
, "InventorySizeInBytes" .= _gjdInventorySizeInBytes
, "SNSTopic" .= _gjdSNSTopic
, "CompletionDate" .= _gjdCompletionDate
, "SHA256TreeHash" .= _gjdSHA256TreeHash
, "ArchiveSHA256TreeHash" .= _gjdArchiveSHA256TreeHash
, "RetrievalByteRange" .= _gjdRetrievalByteRange
, "InventoryRetrievalParameters" .= _gjdInventoryRetrievalParameters
]
data StatusCode
= Failed
| InProgress
| Succeeded
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable StatusCode
instance FromText StatusCode where
parser = takeLowerText >>= \case
"failed" -> pure Failed
"inprogress" -> pure InProgress
"succeeded" -> pure Succeeded
e -> fail $
"Failure parsing StatusCode from " ++ show e
instance ToText StatusCode where
toText = \case
Failed -> "Failed"
InProgress -> "InProgress"
Succeeded -> "Succeeded"
instance ToByteString StatusCode
instance ToHeader StatusCode
instance ToQuery StatusCode
instance FromJSON StatusCode where
parseJSON = parseJSONText "StatusCode"
instance ToJSON StatusCode where
toJSON = toJSONText