Exemplo n.º 1
0
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)
}
Exemplo n.º 2
0
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)
	}
}