nodegroup

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyEksctlVersion = "eksctl_version"
)

Variables

View Source
var Bool = Tpe{
	Type: schema.TypeBool,
	Args: func(key, flag string, def interface{}, d api.Getter) (args []string) {
		if v, ok := d.Get(key).(bool); ok {
			if def != nil {
				if def.(bool) != v {
					args = append(args, "--"+flag)
				}
			} else if v {
				args = append(args, "--"+flag)
			}
		}
		return
	},
}
View Source
var Int = Tpe{
	Type: schema.TypeInt,
	Args: func(key, flag string, def interface{}, d api.Getter) (args []string) {
		if v, ok := d.Get(key).(int); ok {
			if def != nil {
				if def.(int) != v {
					args = append(args, "--"+flag)
				}
			} else if v > 0 {
				args = append(args, "--"+flag, fmt.Sprintf("%d", v))
			}
		}
		return
	},
}
View Source
var String = Tpe{
	Type: schema.TypeString,
	Args: func(key, flag string, def interface{}, d api.Getter) (args []string) {
		if v, ok := d.Get(key).(string); ok && v != "" {
			args = append(args, "--"+flag, v)
		}
		return
	},
}
View Source
var StringMap = Tpe{
	Type: schema.TypeMap,
	Elem: &schema.Schema{
		Type: schema.TypeString,
	},
	Args: func(key, flag string, def interface{}, d api.Getter) (args []string) {
		if m, ok := d.Get(key).(map[string]interface{}); ok && len(m) > 0 {
			var vs []string

			for k, v := range m {
				vs = append(vs, fmt.Sprintf("%s=%v", k, v))
			}

			args = append(args, "--"+flag, strings.Join(vs, ","))
		}
		return
	},
}
View Source
var Strings = Tpe{
	Type: schema.TypeList,
	Elem: &schema.Schema{
		Type: schema.TypeString,
	},
	Args: func(key, flag string, def interface{}, d api.Getter) (args []string) {
		if vs, ok := d.Get(key).([]interface{}); ok && len(vs) > 0 {
			var ss []string

			for _, v := range vs {
				ss = append(ss, fmt.Sprintf("%v", v))
			}

			args = append(args, "--"+flag, strings.Join(ss, ","))
		}
		return
	},
}

Functions

func Default

func Default(v interface{}) func(sc *schema.Schema)

func Required

func Required() func(sc *schema.Schema)

func Resource

func Resource() *schema.Resource

Types

type Attr

type Attr struct {
	Key    string
	Schema *schema.Schema
	Args   func(d api.Getter) []string
	Ops    Op
}

func NewAttr

func NewAttr(name string, tpe Tpe, ops Op, opts ...SchemaOption) Attr

type Op

type Op uint8
const (
	Create Op = 1 << iota
	Delete
)

type SchemaOption

type SchemaOption func(*schema.Schema)

type Tpe

type Tpe struct {
	Type schema.ValueType
	Elem *schema.Schema
	Args func(key, flag string, def interface{}, d api.Getter) (args []string)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL