示例#1
0
文件: push.go 项目: 99designs/iamy
func PushCommand(ui Ui, input PushCommandInput) {
	yaml := iamy.YamlLoadDumper{
		Dir: input.Dir,
	}
	aws := iamy.AwsFetcher{}

	allDataFromYaml, err := yaml.Load()
	if err != nil {
		ui.Fatal(err)
		return
	}

	dataFromAws, err := aws.Fetch()
	if err != nil {
		ui.Fatal(err)
		return
	}

	for _, dataFromYaml := range allDataFromYaml {
		if dataFromYaml.Account.Id == dataFromAws.Account.Id {
			sync(dataFromYaml, dataFromAws, ui)
			return
		}
	}

	ui.Println("No files found for AWS Account ID " + dataFromAws.Account.Id)
}
示例#2
0
文件: pull.go 项目: 99designs/iamy
func PullCommand(ui Ui, input PullCommandInput) {
	aws := iamy.AwsFetcher{}
	data, err := aws.Fetch()
	if err != nil {
		ui.Error.Fatal(fmt.Printf("%s", err))
	}

	yaml := iamy.YamlLoadDumper{
		Dir: input.Dir,
	}
	err = yaml.Dump(data, input.CanDelete)
	if err != nil {
		ui.Error.Fatal(err)
	}
}