forms

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChangeRecordForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "created_at",
			Validators: []forms.Validator{
				forms.IsString{},
				forms.IsTime{
					Format: "rfc3339",
				},
			},
		},
		{
			Name: "section",
			Validators: []forms.Validator{
				forms.IsString{},
				forms.IsIn{
					Choices: []interface{}{"channels", "certificates", "services", "preferences", "settings", "groups"},
				},
			},
		},
		{
			Name: "data",
			Validators: []forms.Validator{
				forms.Switch{
					Key: "section",
					Cases: map[string][]forms.Validator{
						"channels": []forms.Validator{
							forms.IsList{
								Validators: []forms.Validator{
									forms.IsStringMap{
										Form: &OperatorChannelForm,
									},
								},
							},
						},
						"groups": []forms.Validator{
							forms.IsList{
								Validators: []forms.Validator{
									forms.IsString{},
								},
							},
						},
						"settings": []forms.Validator{
							forms.IsList{
								Validators: []forms.Validator{
									forms.IsStringMap{
										Form: &OperatorSettingsForm,
									},
								},
							},
						},
						"preferences": []forms.Validator{
							forms.IsList{
								Validators: []forms.Validator{
									forms.IsStringMap{
										Form: &OperatorPreferencesForm,
									},
								},
							},
						},
						"services": []forms.Validator{
							forms.IsList{
								Validators: []forms.Validator{
									forms.IsStringMap{
										Form: &OperatorServiceForm,
									},
								},
							},
						},
						"certificates": []forms.Validator{
							forms.IsList{
								Validators: []forms.Validator{
									forms.IsStringMap{
										Form: &OperatorCertificateForm,
									},
								},
							},
						},
					},
				},
			},
		},
	},
}
View Source
var ChannelForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "type",
			Validators: []forms.Validator{
				forms.IsString{},
				IsValidChannelType{},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsStringMap{},
				AreValidChannelSettings{},
			},
		},
	},
}
View Source
var ClientInfoForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "entry",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &DirectoryEntryForm,
				},
			},
		},
	},
}
View Source
var ConnectionRequestForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "channel",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "endpoint",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "token",
			Validators: []forms.Validator{
				forms.IsBytes{Encoding: "base64"},
			},
		},
		{
			Name: "client",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &ClientInfoForm,
				},
			},
		},
	},
}
View Source
var DatastoreForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "type",
			Validators: []forms.Validator{
				forms.IsString{},
				IsValidDatastoreType{},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsStringMap{},
				AreValidDatastoreSettings{},
			},
		},
	},
}
View Source
var DirectoryEntryForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "channels",
			Validators: []forms.Validator{
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &OperatorChannelForm,
						},
					},
				},
			},
		},
		{
			Name: "services",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &OperatorServiceForm,
						},
					},
				},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &OperatorSettingsForm,
						},
					},
				},
			},
		},
		{
			Name: "preferences",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &OperatorPreferencesForm,
						},
					},
				},
			},
		},
		{
			Name: "certificates",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &OperatorCertificateForm,
						},
					},
				},
			},
		},
	},
}
View Source
var DirectorySettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "type",
			Validators: []forms.Validator{
				forms.IsString{},
				IsValidDirectoryType{},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsStringMap{},
				AreValidDirectorySettings{},
			},
		},
	},
}
View Source
var MethodParameterForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "validators",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &ServiceValidatorForm,
						},
					},
				},
			},
		},
	},
}
View Source
var MetricsSettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "bind_address",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
	},
}
View Source
var OperatorCertificateForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "fingerprint",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "key_usage",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
	},
}
View Source
var OperatorChannelForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "type",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsStringMap{},
			},
		},
	},
}
View Source
var OperatorPreferencesForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "operator",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
		{
			Name: "service",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
		{
			Name: "environment",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsStringMap{},
			},
		},
	},
}
View Source
var OperatorServiceForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "permissions",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &PermissionForm,
						},
					},
				},
			},
		},
		{
			Name: "methods",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &ServiceMethodForm,
						},
					},
				},
			},
		},
	},
}
View Source
var OperatorSettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "operator",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
		{
			Name: "service",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
		{
			Name: "environment",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
		{
			Name: "settings",
			Validators: []forms.Validator{
				forms.IsStringMap{},
			},
		},
	},
}
View Source
var PermissionForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "group",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "rights",
			Validators: []forms.Validator{
				forms.IsStringList{
					Validators: []forms.Validator{
						forms.IsIn{Choices: []interface{}{"call"}},
					},
				},
				IsValidRightsList{},
			},
		},
	},
}
View Source
var RequestForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "method",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "id",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "params",
			Validators: []forms.Validator{
				forms.IsStringMap{},
			},
		},
	},
}
View Source
var ServiceMethodForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "permissions",
			Validators: []forms.Validator{
				forms.IsOptional{Default: []interface{}{}},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &PermissionForm,
						},
					},
				},
			},
		},
		{
			Name: "parameters",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &MethodParameterForm,
						},
					},
				},
			},
		},
	},
}
View Source
var ServiceValidatorForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "type",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "parameters",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsStringMap{},
			},
		},
	},
}
View Source
var SettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "directory",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &DirectorySettingsForm,
				},
			},
		},
		{
			Name: "metrics",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsStringMap{
					Form: &MetricsSettingsForm,
				},
			},
		},
		{
			Name: "signing",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsStringMap{
					Form: &SigningSettingsForm,
				},
			},
		},
		{
			Name: "channels",
			Validators: []forms.Validator{
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &ChannelForm,
						},
					},
				},
			},
		},
	},
}
View Source
var SignatureForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "r",
			Validators: []forms.Validator{
				forms.IsString{},
				forms.MatchesRegex{
					Regexp: regexp.MustCompile(`^\d{10,100}$`),
				},
			},
		},
		{
			Name: "s",
			Validators: []forms.Validator{
				forms.IsString{},
				forms.MatchesRegex{
					Regexp: regexp.MustCompile(`^\d{10,100}$`),
				},
			},
		},
		{
			Name: "c",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
	},
}
View Source
var SignedChangeRecordForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "hash",
			Validators: []forms.Validator{
				forms.IsHex{
					Strict:    true,
					MinLength: 32,
					MaxLength: 32,
				},
			},
		},
		{
			Name: "parent_hash",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
				forms.MatchesRegex{
					Regexp: regexp.MustCompile(`^([a-f0-9]{64}|)$`),
				},
			},
		},
		{
			Name: "signature",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &SignatureForm,
				},
			},
		},
		{
			Name: "record",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &ChangeRecordForm,
				},
			},
		},
	},
}
View Source
var SignedDataForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "signature",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &SignatureForm,
				},
			},
		},
		{
			Name:       "data",
			Validators: []forms.Validator{},
		},
	},
}
View Source
var SigningSettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "ca_certificate_file",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsString{},
			},
		},
		{
			Name: "ca_intermediate_certificate_files",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsString{},
					},
				},
			},
		},
		{
			Name: "certificate_file",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsString{},
			},
		},
		{
			Name: "key_file",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsString{},
			},
		},
		{
			Name: "name",
			Validators: []forms.Validator{
				forms.IsOptional{},
				forms.IsString{},
			},
		},
	},
}

Functions

This section is empty.

Types

type AreValidChannelSettings

type AreValidChannelSettings struct {
}

func (AreValidChannelSettings) Validate

func (f AreValidChannelSettings) Validate(input interface{}, inputs map[string]interface{}) (interface{}, error)

func (AreValidChannelSettings) ValidateWithContext

func (f AreValidChannelSettings) ValidateWithContext(input interface{}, inputs map[string]interface{}, context map[string]interface{}) (interface{}, error)

type AreValidDatastoreSettings

type AreValidDatastoreSettings struct {
}

func (AreValidDatastoreSettings) Validate

func (f AreValidDatastoreSettings) Validate(input interface{}, inputs map[string]interface{}) (interface{}, error)

func (AreValidDatastoreSettings) ValidateWithContext

func (f AreValidDatastoreSettings) ValidateWithContext(input interface{}, inputs map[string]interface{}, context map[string]interface{}) (interface{}, error)

type AreValidDirectorySettings

type AreValidDirectorySettings struct {
}

func (AreValidDirectorySettings) Validate

func (f AreValidDirectorySettings) Validate(input interface{}, inputs map[string]interface{}) (interface{}, error)

func (AreValidDirectorySettings) ValidateWithContext

func (f AreValidDirectorySettings) ValidateWithContext(input interface{}, inputs map[string]interface{}, context map[string]interface{}) (interface{}, error)

type IsValidChannelType

type IsValidChannelType struct {
}

func (IsValidChannelType) Validate

func (f IsValidChannelType) Validate(input interface{}, inputs map[string]interface{}) (interface{}, error)

func (IsValidChannelType) ValidateWithContext

func (f IsValidChannelType) ValidateWithContext(input interface{}, inputs map[string]interface{}, context map[string]interface{}) (interface{}, error)

type IsValidDatastoreType

type IsValidDatastoreType struct {
}

func (IsValidDatastoreType) Validate

func (f IsValidDatastoreType) Validate(input interface{}, inputs map[string]interface{}) (interface{}, error)

func (IsValidDatastoreType) ValidateWithContext

func (f IsValidDatastoreType) ValidateWithContext(input interface{}, inputs map[string]interface{}, context map[string]interface{}) (interface{}, error)

type IsValidDirectoryType

type IsValidDirectoryType struct {
}

func (IsValidDirectoryType) Validate

func (f IsValidDirectoryType) Validate(input interface{}, inputs map[string]interface{}) (interface{}, error)

func (IsValidDirectoryType) ValidateWithContext

func (f IsValidDirectoryType) ValidateWithContext(input interface{}, inputs map[string]interface{}, context map[string]interface{}) (interface{}, error)

type IsValidRightsList

type IsValidRightsList struct{}

func (IsValidRightsList) Validate

func (f IsValidRightsList) Validate(value interface{}, values map[string]interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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