-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
44 lines (36 loc) · 1.07 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"rsg/core"
"rsg/outputs"
"rsg/awsutils"
"rsg/utils"
"rsg/options"
)
const version = "0.0.1-SNAPSHOT"
var date string
func main() {
outputs.InitDefaultOutputs()
options := options.ParseOptions()
if options.Version {
outputs.Printfln(outputs.Info, "Version %v (%v)", version, date)
return
}
core.DisplayInfoAboutCosts(options)
awsutils.LoadAccountSession(options.AwsId, options.AwsSecret)
region, vaultName := core.SelectRegionVault(options.Region, options.Vault)
restorationContext := core.CreateRestorationContext(region, vaultName, options)
if options.ListJobs {
core.ListJobs(restorationContext)
} else {
awsutils.LoadJobIdsAtStartup(restorationContext.GlacierClient, restorationContext.MappingVault, restorationContext.Vault)
core.DownloadMappingArchive(restorationContext)
core.QueryFiltersIfNecessary(restorationContext)
if options.List {
core.ListArchives(restorationContext)
} else {
err := core.CheckDestinationDirectory(restorationContext)
utils.ExitIfError(err)
core.DownloadArchives(restorationContext)
}
}
}