Esempio n. 1
0
func create() {

	if *xpF == "" {
		cli.Fatal(
			"you must specify an experiment name with the -xp flag, " +
				"use the -help flag for details")
	}

	if *srcF == "" {
		cli.Fatal(
			"you must specify a TopDL source file with the -src flag, " +
				"use the -help flag for details")
	}

	cli.PreRun()

	src, err := ioutil.ReadFile(*srcF)
	if err != nil {
		cli.Fatal(fmt.Sprintf("Failed to read source file '%s'", *srcF))
	}

	rsp, err := spi.CreateExperiment(*xpF, cli.User, string(src), false)
	if err != nil {
		cli.Fatal("create experiment failed")
	}

	if rsp.Return != true {
		cli.Fatal("create experiment returned false")
	}

}
Esempio n. 2
0
func view() {

	cli.PreRun()

	rsp, err := spi.ViewRealizations(cli.User, ".*")
	if err != nil {
		cli.Fatal(fmt.Sprintf("view realizations failed: %v", err))
	}
	for _, x := range rsp.Return {
		fmt.Printf("%s : %s\n", x.Name, x.Status)
	}

}
Esempio n. 3
0
func view() {

	cli.PreRun()

	rsp, err := spi.ViewExperiments(cli.User, ".*", !*verboseF)
	if err != nil {
		cli.Fatal(fmt.Sprintf("view experiments failed: %v", err))
	}
	for _, x := range rsp.Return {
		fmt.Println(x)
	}

}
Esempio n. 4
0
func remove() {

	if *rzF == "" {
		cli.Fatal(
			"you must specify a realization name with the -rz flag, " +
				"use the -help flag for details")
	}

	cli.PreRun()

	rsp, err := spi.RemoveRealization(*rzF)
	if err != nil {
		cli.Fatal(fmt.Sprintf("remove realization failed: %v", err))
	}

	if rsp.Return != true {
		cli.Fatal("Removal of the realization failed")
	}

}
Esempio n. 5
0
func remove() {

	cli.PreRun()

	if *xpF == "" {
		cli.Fatal(
			"you must specify an experiment name with the -xp flag, " +
				"use the -help flag for details")
	}

	rsp, err := spi.RemoveExperiment(*xpF)
	if err != nil {
		cli.Fatal(fmt.Sprintf("remove experiment failed: %v", err))
	}

	if rsp.Return != true {
		cli.Fatal("Removal of the experiment failed")
	}

}
Esempio n. 6
0
func changeProfile() {

	if *xpF == "" {
		cli.Fatal(
			"you must specify an experiment name with the -xp flag, " +
				"use the -help flag for details")
	}
	if *nameF == "" {
		cli.Fatal(
			"you must specify an argument name with the -name flag, " +
				"use the -help flag for details")
	}
	if *valueF == "" {
		cli.Fatal(
			"you must specify an argument value with the -value flag, " +
				"use the -help flag for details")
	}

	cli.PreRun()

	attr := spi.ChangeAttribute{}
	attr.Name = *nameF
	attr.Value = *valueF
	attr.Delete = *deleteF

	attrs := []spi.ChangeAttribute{attr}

	rsp, err := spi.ChangeExperimentProfile(*xpF, attrs)

	if err != nil {
		cli.Fatal(fmt.Sprintf("change profile failed: %v", err))
	}
	for _, x := range rsp.Return {
		fmt.Println(x)
	}

}
Esempio n. 7
0
func create() {

	if *rzF == "" {
		cli.Fatal(
			"you must specify a realization name with the -rz flag, " +
				"use the -help flag for details")
	}

	if *circF == "" {
		cli.Fatal(
			"you must specify a circle name with the -circle flag, " +
				"use the -help flag for details")
	}

	cli.PreRun()

	rsp, err := spi.RealizeExperiment(*rzF, *circF, cli.User)
	if err != nil {
		cli.Fatal("create realization failed")
	}

	fmt.Println(rsp)

}
Esempio n. 8
0
func changeACL() {

	if *xpF == "" {
		cli.Fatal(
			"you must specify an experiment name with the -xp flag, " +
				"use the -help flag for details")
	}

	if *circF == "" {
		cli.Fatal(
			"you must specify a circle name with the -circle flag, " +
				"use the -help flag for details")
	}

	if *permF == "" {
		cli.Fatal(
			"you must specify a permission name with the -perm flag, " +
				"use the -help flag for details")
	}

	cli.PreRun()

	acm := spi.AccessMember{}
	acm.CircleId = *circF
	acm.Permissions = []string{*permF}

	rsp, err := spi.ChangeExperimentACL(*xpF, []spi.AccessMember{acm})

	if err != nil {
		cli.Fatal(fmt.Sprintf("change acl failed: %v", err))
	}
	for _, x := range rsp.Return {
		fmt.Println(x)
	}

}