예제 #1
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-operation v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and operation instances
	api := api.New(client)
	operation := cli.New(api)

	switch opts.Verbs {
	case "count":
		operation.Count()

	case "list":
		operation.List()

	case "info":
		operation.Info(opts.Info.Operation)

	case "cancel":
		operation.Cancel(opts.Cancel.Operation)

	default:
		goptions.PrintHelp()
	}
}
예제 #2
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-contact v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and cli instances
	api := api.New(client)
	contact := cli.New(api)

	switch opts.Verbs {
	case "balance":
		contact.Balance()

	case "info":
		contact.Info(opts.Info.Contact)

	case "create":
		contact.Create(opts.Create)

	case "delete":
		contact.Delete(opts.Delete.Contact)

	default:
		goptions.PrintHelp()
	}
}
예제 #3
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain-zone-record v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and zone instances
	api := api.New(client)
	record := cli.New(api)

	switch opts.Verbs {
	case "count":
		record.Count(opts.Count.Zone, opts.Count.Version)

	case "list":
		record.List(opts.List.Zone, opts.List.Version)

	case "add":
		record.Add(opts.Add)

	case "delete":
		args := opts.Delete
		record.Delete(args.Zone, args.Version, args.Record)

	default:
		goptions.PrintHelp()
	}
}
예제 #4
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain-zone v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and zone instances
	api := api.New(client)
	zone := cli.New(api)

	switch opts.Verbs {
	case "count":
		zone.Count()

	case "list":
		zone.List()

	case "info":
		zone.Info(opts.Info.Zone)

	case "create":
		zone.Create(opts.Create.Name)

	case "delete":
		zone.Delete(opts.Delete.Zone)

	case "set":
		zone.Set(opts.Set.Domain, opts.Set.Zone)

	default:
		goptions.PrintHelp()
	}
}
예제 #5
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and cli instances
	api := api.New(client)
	domain := cli.New(api)

	switch opts.Verbs {
	case "count":
		domain.Count()

	case "list":
		domain.List()

	case "info":
		domain.Info(opts.Info.Domain)

	case "available":
		domain.Available(opts.Available.Domain)

	case "create":
		args := opts.Create
		domain.Create(args.Domain, args.Contact, args.Years)

	default:
		goptions.PrintHelp()
	}
}
예제 #6
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain-zone-version v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and zone instances
	api := api.New(client)
	version := cli.New(api)

	switch opts.Verbs {
	case "count":
		version.Count(opts.Count.Zone)

	case "list":
		version.List(opts.List.Zone)

	case "new":
		version.New(opts.New.Zone, opts.New.Version)

	case "delete":
		version.Delete(opts.Delete.Zone, opts.Delete.Version)

	case "set":
		version.Set(opts.Set.Zone, opts.Set.Version)

	default:
		goptions.PrintHelp()
	}
}