Пример #1
0
func (self *Version) List(zoneId int64) {
	versions, err := self.version.List(zoneId)
	if err != nil {
		fmt.Println(err)
		return
	}

	columns := make([]map[string]string, 0)
	order := []string{"Id", "Date Created"}
	for _, version := range versions {
		columns = append(columns, map[string]string{
			"Id":           util.Itoa64(version.Id),
			"Date Created": util.TimeToLocal(version.DateCreated),
		})
	}

	util.PrintColumns(columns, order, 4)
}
Пример #2
0
func (self *Domain) List() {
	domains, err := self.domain.List()
	if err != nil {
		fmt.Println(err)
		return
	}

	columns := make([]map[string]string, 0)
	order := []string{"Name", "Created", "Expires", "Status"}
	for _, domain := range domains {
		columns = append(columns, map[string]string{
			"Name":    domain.Fqdn,
			"Created": util.TimeToLocal(domain.DateCreated),
			"Expires": util.TimeToLocal(domain.DateRegistryEnd),
			"Status":  strings.Join(domain.Status, ", "),
		})
	}

	util.PrintColumns(columns, order, 4)
}
Пример #3
0
func (self *Record) List(zoneId, version int64) {
	records, err := self.record.List(zoneId, version)
	if err != nil {
		fmt.Println(err)
		return
	}

	columns := make([]map[string]string, 0)
	order := []string{"Id", "Name", "TTL", "Type", "Value"}
	for _, record := range records {
		columns = append(columns, map[string]string{
			"Id":    util.Itoa64(record.Id),
			"Name":  record.Name,
			"TTL":   util.Itoa64(record.Ttl),
			"Type":  record.Type,
			"Value": record.Value,
		})
	}

	util.PrintColumns(columns, order, 4)
}
Пример #4
0
func (self *Zone) List() {
	zones, err := self.zone.List()
	if err != nil {
		fmt.Println(err)
		return
	}

	columns := make([]map[string]string, 0)
	order := []string{"Id", "Name", "Version", "Public", "Updated"}
	for _, zone := range zones {
		columns = append(columns, map[string]string{
			"Id":      util.Itoa64(zone.Id),
			"Name":    zone.Name,
			"Version": util.Itoa64(zone.Version),
			"Public":  util.FormatBool(zone.Public),
			"Updated": util.TimeToLocal(zone.DateUpdated),
		})
	}

	util.PrintColumns(columns, order, 4)
}