id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
22,900
xo/xo
examples/django/postgres/djangocontenttype.xo.go
Update
func (dct *DjangoContentType) Update(db XODB) error { var err error // if doesn't exist, bail if !dct._exists { return errors.New("update failed: does not exist") } // if deleted, bail if dct._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE public....
go
func (dct *DjangoContentType) Update(db XODB) error { var err error // if doesn't exist, bail if !dct._exists { return errors.New("update failed: does not exist") } // if deleted, bail if dct._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE public....
[ "func", "(", "dct", "*", "DjangoContentType", ")", "Update", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "dct", ".", "_exists", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", ...
// Update updates the DjangoContentType in the database.
[ "Update", "updates", "the", "DjangoContentType", "in", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/djangocontenttype.xo.go#L60-L84
22,901
xo/xo
examples/django/postgres/djangocontenttype.xo.go
Delete
func (dct *DjangoContentType) Delete(db XODB) error { var err error // if doesn't exist, bail if !dct._exists { return nil } // if deleted, bail if dct._deleted { return nil } // sql query const sqlstr = `DELETE FROM public.django_content_type WHERE id = $1` // run query XOLog(sqlstr, dct.ID) _, err...
go
func (dct *DjangoContentType) Delete(db XODB) error { var err error // if doesn't exist, bail if !dct._exists { return nil } // if deleted, bail if dct._deleted { return nil } // sql query const sqlstr = `DELETE FROM public.django_content_type WHERE id = $1` // run query XOLog(sqlstr, dct.ID) _, err...
[ "func", "(", "dct", "*", "DjangoContentType", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "dct", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, bail", ...
// Delete deletes the DjangoContentType from the database.
[ "Delete", "deletes", "the", "DjangoContentType", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/djangocontenttype.xo.go#L131-L158
22,902
xo/xo
examples/django/oracle/authgrouppermission.xo.go
AuthGroupPermissionByGroupIDPermissionID
func AuthGroupPermissionByGroupIDPermissionID(db XODB, groupID float64, permissionID float64) (*AuthGroupPermission, error) { var err error // sql query const sqlstr = `SELECT ` + `id, group_id, permission_id ` + `FROM django.auth_group_permissions ` + `WHERE group_id = :1 AND permission_id = :2` // run que...
go
func AuthGroupPermissionByGroupIDPermissionID(db XODB, groupID float64, permissionID float64) (*AuthGroupPermission, error) { var err error // sql query const sqlstr = `SELECT ` + `id, group_id, permission_id ` + `FROM django.auth_group_permissions ` + `WHERE group_id = :1 AND permission_id = :2` // run que...
[ "func", "AuthGroupPermissionByGroupIDPermissionID", "(", "db", "XODB", ",", "groupID", "float64", ",", "permissionID", "float64", ")", "(", "*", "AuthGroupPermission", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", ...
// AuthGroupPermissionByGroupIDPermissionID retrieves a row from 'django.auth_group_permissions' as a AuthGroupPermission. // // Generated from index 'auth_gr_group_id_0cd325b0_uniq'.
[ "AuthGroupPermissionByGroupIDPermissionID", "retrieves", "a", "row", "from", "django", ".", "auth_group_permissions", "as", "a", "AuthGroupPermission", ".", "Generated", "from", "index", "auth_gr_group_id_0cd325b0_uniq", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/authgrouppermission.xo.go#L145-L166
22,903
xo/xo
models/procparam.xo.go
PgProcParams
func PgProcParams(db XODB, schema string, proc string) ([]*ProcParam, error) { var err error // sql query const sqlstr = `SELECT ` + `UNNEST(STRING_TO_ARRAY(oidvectortypes(p.proargtypes), ', ')) ` + // ::varchar AS param_type `FROM pg_proc p ` + `JOIN ONLY pg_namespace n ON p.pronamespace = n.oid ` + `WHERE...
go
func PgProcParams(db XODB, schema string, proc string) ([]*ProcParam, error) { var err error // sql query const sqlstr = `SELECT ` + `UNNEST(STRING_TO_ARRAY(oidvectortypes(p.proargtypes), ', ')) ` + // ::varchar AS param_type `FROM pg_proc p ` + `JOIN ONLY pg_namespace n ON p.pronamespace = n.oid ` + `WHERE...
[ "func", "PgProcParams", "(", "db", "XODB", ",", "schema", "string", ",", "proc", "string", ")", "(", "[", "]", "*", "ProcParam", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`UNNEST(STR...
// PgProcParams runs a custom query, returning results as ProcParam.
[ "PgProcParams", "runs", "a", "custom", "query", "returning", "results", "as", "ProcParam", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/models/procparam.xo.go#L12-L45
22,904
xo/xo
examples/django/mysql/authusergroup.xo.go
AuthUserGroupsByGroupID
func AuthUserGroupsByGroupID(db XODB, groupID int) ([]*AuthUserGroup, error) { var err error // sql query const sqlstr = `SELECT ` + `id, user_id, group_id ` + `FROM django.auth_user_groups ` + `WHERE group_id = ?` // run query XOLog(sqlstr, groupID) q, err := db.Query(sqlstr, groupID) if err != nil { ...
go
func AuthUserGroupsByGroupID(db XODB, groupID int) ([]*AuthUserGroup, error) { var err error // sql query const sqlstr = `SELECT ` + `id, user_id, group_id ` + `FROM django.auth_user_groups ` + `WHERE group_id = ?` // run query XOLog(sqlstr, groupID) q, err := db.Query(sqlstr, groupID) if err != nil { ...
[ "func", "AuthUserGroupsByGroupID", "(", "db", "XODB", ",", "groupID", "int", ")", "(", "[", "]", "*", "AuthUserGroup", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`id, user_id, group_id `", ...
// AuthUserGroupsByGroupID retrieves a row from 'django.auth_user_groups' as a AuthUserGroup. // // Generated from index 'auth_user_groups_group_id_97559544_fk_auth_group_id'.
[ "AuthUserGroupsByGroupID", "retrieves", "a", "row", "from", "django", ".", "auth_user_groups", "as", "a", "AuthUserGroup", ".", "Generated", "from", "index", "auth_user_groups_group_id_97559544_fk_auth_group_id", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/mysql/authusergroup.xo.go#L147-L181
22,905
xo/xo
examples/django/mysql/authusergroup.xo.go
AuthUserGroupByID
func AuthUserGroupByID(db XODB, id int) (*AuthUserGroup, error) { var err error // sql query const sqlstr = `SELECT ` + `id, user_id, group_id ` + `FROM django.auth_user_groups ` + `WHERE id = ?` // run query XOLog(sqlstr, id) aug := AuthUserGroup{ _exists: true, } err = db.QueryRow(sqlstr, id).Scan(...
go
func AuthUserGroupByID(db XODB, id int) (*AuthUserGroup, error) { var err error // sql query const sqlstr = `SELECT ` + `id, user_id, group_id ` + `FROM django.auth_user_groups ` + `WHERE id = ?` // run query XOLog(sqlstr, id) aug := AuthUserGroup{ _exists: true, } err = db.QueryRow(sqlstr, id).Scan(...
[ "func", "AuthUserGroupByID", "(", "db", "XODB", ",", "id", "int", ")", "(", "*", "AuthUserGroup", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`id, user_id, group_id `", "+", "`FROM django.au...
// AuthUserGroupByID retrieves a row from 'django.auth_user_groups' as a AuthUserGroup. // // Generated from index 'auth_user_groups_id_pkey'.
[ "AuthUserGroupByID", "retrieves", "a", "row", "from", "django", ".", "auth_user_groups", "as", "a", "AuthUserGroup", ".", "Generated", "from", "index", "auth_user_groups_id_pkey", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/mysql/authusergroup.xo.go#L186-L207
22,906
xo/xo
loaders/mssql.go
MsParseType
func MsParseType(args *internal.ArgType, dt string, nullable bool) (int, string, string) { precision := 0 nilVal := "nil" // extract precision dt, precision, _ = args.ParsePrecision(dt) var typ string switch dt { case "tinyint", "bit": nilVal = "false" typ = "bool" if nullable { nilVal = "sql.NullBool...
go
func MsParseType(args *internal.ArgType, dt string, nullable bool) (int, string, string) { precision := 0 nilVal := "nil" // extract precision dt, precision, _ = args.ParsePrecision(dt) var typ string switch dt { case "tinyint", "bit": nilVal = "false" typ = "bool" if nullable { nilVal = "sql.NullBool...
[ "func", "MsParseType", "(", "args", "*", "internal", ".", "ArgType", ",", "dt", "string", ",", "nullable", "bool", ")", "(", "int", ",", "string", ",", "string", ")", "{", "precision", ":=", "0", "\n", "nilVal", ":=", "\"", "\"", "\n\n", "// extract pr...
// MsParseType parse a mssql type into a Go type based on the column // definition.
[ "MsParseType", "parse", "a", "mssql", "type", "into", "a", "Go", "type", "based", "on", "the", "column", "definition", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/loaders/mssql.go#L68-L182
22,907
xo/xo
loaders/mssql.go
MsQueryColumns
func MsQueryColumns(args *internal.ArgType, inspect []string) ([]*models.Column, error) { var err error // process inspect -- cannot have 'order by' in a CREATE VIEW ins := []string{} for _, l := range inspect { if !strings.HasPrefix(strings.ToUpper(l), "ORDER BY ") { ins = append(ins, l) } } // create t...
go
func MsQueryColumns(args *internal.ArgType, inspect []string) ([]*models.Column, error) { var err error // process inspect -- cannot have 'order by' in a CREATE VIEW ins := []string{} for _, l := range inspect { if !strings.HasPrefix(strings.ToUpper(l), "ORDER BY ") { ins = append(ins, l) } } // create t...
[ "func", "MsQueryColumns", "(", "args", "*", "internal", ".", "ArgType", ",", "inspect", "[", "]", "string", ")", "(", "[", "]", "*", "models", ".", "Column", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// process inspect -- cannot have 'order by'...
// MsQueryColumns parses the query and generates a type for it.
[ "MsQueryColumns", "parses", "the", "query", "and", "generates", "a", "type", "for", "it", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/loaders/mssql.go#L185-L215
22,908
xo/xo
loaders/mssql.go
MsTables
func MsTables(db models.XODB, schema string, relkind string) ([]*models.Table, error) { var err error // get the tables rows, err := models.MsTables(db, schema, relkind) if err != nil { return nil, err } // get the tables that have Identity included identities, err := models.MsIdentities(db, schema) if err ...
go
func MsTables(db models.XODB, schema string, relkind string) ([]*models.Table, error) { var err error // get the tables rows, err := models.MsTables(db, schema, relkind) if err != nil { return nil, err } // get the tables that have Identity included identities, err := models.MsIdentities(db, schema) if err ...
[ "func", "MsTables", "(", "db", "models", ".", "XODB", ",", "schema", "string", ",", "relkind", "string", ")", "(", "[", "]", "*", "models", ".", "Table", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// get the tables", "rows", ",", "err", ...
// MsTables returns the MsSQL tables with the manual PK information added. // ManualPk is true when the table's primary key is not an identity.
[ "MsTables", "returns", "the", "MsSQL", "tables", "with", "the", "manual", "PK", "information", "added", ".", "ManualPk", "is", "true", "when", "the", "table", "s", "primary", "key", "is", "not", "an", "identity", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/loaders/mssql.go#L219-L253
22,909
xo/xo
examples/django/mysql/djangoadminlog.xo.go
Delete
func (dal *DjangoAdminLog) Delete(db XODB) error { var err error // if doesn't exist, bail if !dal._exists { return nil } // if deleted, bail if dal._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.django_admin_log WHERE id = ?` // run query XOLog(sqlstr, dal.ID) _, err = db.E...
go
func (dal *DjangoAdminLog) Delete(db XODB) error { var err error // if doesn't exist, bail if !dal._exists { return nil } // if deleted, bail if dal._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.django_admin_log WHERE id = ?` // run query XOLog(sqlstr, dal.ID) _, err = db.E...
[ "func", "(", "dal", "*", "DjangoAdminLog", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "dal", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, bail", "i...
// Delete deletes the DjangoAdminLog from the database.
[ "Delete", "deletes", "the", "DjangoAdminLog", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/mysql/djangoadminlog.xo.go#L108-L135
22,910
xo/xo
examples/django/mysql/djangosession.xo.go
DjangoSessionsByExpireDate
func DjangoSessionsByExpireDate(db XODB, expireDate *time.Time) ([]*DjangoSession, error) { var err error // sql query const sqlstr = `SELECT ` + `session_key, session_data, expire_date ` + `FROM django.django_session ` + `WHERE expire_date = ?` // run query XOLog(sqlstr, expireDate) q, err := db.Query(sq...
go
func DjangoSessionsByExpireDate(db XODB, expireDate *time.Time) ([]*DjangoSession, error) { var err error // sql query const sqlstr = `SELECT ` + `session_key, session_data, expire_date ` + `FROM django.django_session ` + `WHERE expire_date = ?` // run query XOLog(sqlstr, expireDate) q, err := db.Query(sq...
[ "func", "DjangoSessionsByExpireDate", "(", "db", "XODB", ",", "expireDate", "*", "time", ".", "Time", ")", "(", "[", "]", "*", "DjangoSession", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+",...
// DjangoSessionsByExpireDate retrieves a row from 'django.django_session' as a DjangoSession. // // Generated from index 'django_session_de54fa62'.
[ "DjangoSessionsByExpireDate", "retrieves", "a", "row", "from", "django", ".", "django_session", "as", "a", "DjangoSession", ".", "Generated", "from", "index", "django_session_de54fa62", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/mysql/djangosession.xo.go#L127-L161
22,911
xo/xo
examples/django/mysql/djangosession.xo.go
DjangoSessionBySessionKey
func DjangoSessionBySessionKey(db XODB, sessionKey string) (*DjangoSession, error) { var err error // sql query const sqlstr = `SELECT ` + `session_key, session_data, expire_date ` + `FROM django.django_session ` + `WHERE session_key = ?` // run query XOLog(sqlstr, sessionKey) ds := DjangoSession{ _exis...
go
func DjangoSessionBySessionKey(db XODB, sessionKey string) (*DjangoSession, error) { var err error // sql query const sqlstr = `SELECT ` + `session_key, session_data, expire_date ` + `FROM django.django_session ` + `WHERE session_key = ?` // run query XOLog(sqlstr, sessionKey) ds := DjangoSession{ _exis...
[ "func", "DjangoSessionBySessionKey", "(", "db", "XODB", ",", "sessionKey", "string", ")", "(", "*", "DjangoSession", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`session_key, session_data, expir...
// DjangoSessionBySessionKey retrieves a row from 'django.django_session' as a DjangoSession. // // Generated from index 'django_session_session_key_pkey'.
[ "DjangoSessionBySessionKey", "retrieves", "a", "row", "from", "django", ".", "django_session", "as", "a", "DjangoSession", ".", "Generated", "from", "index", "django_session_session_key_pkey", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/mysql/djangosession.xo.go#L166-L187
22,912
xo/xo
examples/django/mysql/authuseruserpermission.xo.go
Update
func (auup *AuthUserUserPermission) Update(db XODB) error { var err error // if doesn't exist, bail if !auup._exists { return errors.New("update failed: does not exist") } // if deleted, bail if auup._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE...
go
func (auup *AuthUserUserPermission) Update(db XODB) error { var err error // if doesn't exist, bail if !auup._exists { return errors.New("update failed: does not exist") } // if deleted, bail if auup._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE...
[ "func", "(", "auup", "*", "AuthUserUserPermission", ")", "Update", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "auup", ".", "_exists", "{", "return", "errors", ".", "New", "(", "\"", "\"", ...
// Update updates the AuthUserUserPermission in the database.
[ "Update", "updates", "the", "AuthUserUserPermission", "in", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/mysql/authuseruserpermission.xo.go#L67-L89
22,913
xo/xo
examples/django/oracle/djangomigration.xo.go
Update
func (dm *DjangoMigration) Update(db XODB) error { var err error // if doesn't exist, bail if !dm._exists { return errors.New("update failed: does not exist") } // if deleted, bail if dm._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE django.djang...
go
func (dm *DjangoMigration) Update(db XODB) error { var err error // if doesn't exist, bail if !dm._exists { return errors.New("update failed: does not exist") } // if deleted, bail if dm._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE django.djang...
[ "func", "(", "dm", "*", "DjangoMigration", ")", "Update", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "dm", ".", "_exists", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n"...
// Update updates the DjangoMigration in the database.
[ "Update", "updates", "the", "DjangoMigration", "in", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/djangomigration.xo.go#L70-L92
22,914
xo/xo
examples/django/oracle/djangomigration.xo.go
Delete
func (dm *DjangoMigration) Delete(db XODB) error { var err error // if doesn't exist, bail if !dm._exists { return nil } // if deleted, bail if dm._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.django_migrations WHERE id = :1` // run query XOLog(sqlstr, dm.ID) _, err = db.Ex...
go
func (dm *DjangoMigration) Delete(db XODB) error { var err error // if doesn't exist, bail if !dm._exists { return nil } // if deleted, bail if dm._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.django_migrations WHERE id = :1` // run query XOLog(sqlstr, dm.ID) _, err = db.Ex...
[ "func", "(", "dm", "*", "DjangoMigration", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "dm", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, bail", "if...
// Delete deletes the DjangoMigration from the database.
[ "Delete", "deletes", "the", "DjangoMigration", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/djangomigration.xo.go#L104-L131
22,915
xo/xo
examples/django/oracle/djangomigration.xo.go
DjangoMigrationByID
func DjangoMigrationByID(db XODB, id float64) (*DjangoMigration, error) { var err error // sql query const sqlstr = `SELECT ` + `id, app, name, applied ` + `FROM django.django_migrations ` + `WHERE id = :1` // run query XOLog(sqlstr, id) dm := DjangoMigration{ _exists: true, } err = db.QueryRow(sqlst...
go
func DjangoMigrationByID(db XODB, id float64) (*DjangoMigration, error) { var err error // sql query const sqlstr = `SELECT ` + `id, app, name, applied ` + `FROM django.django_migrations ` + `WHERE id = :1` // run query XOLog(sqlstr, id) dm := DjangoMigration{ _exists: true, } err = db.QueryRow(sqlst...
[ "func", "DjangoMigrationByID", "(", "db", "XODB", ",", "id", "float64", ")", "(", "*", "DjangoMigration", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`id, app, name, applied `", "+", "`FROM ...
// DjangoMigrationByID retrieves a row from 'django.django_migrations' as a DjangoMigration. // // Generated from index 'sys_c004953'.
[ "DjangoMigrationByID", "retrieves", "a", "row", "from", "django", ".", "django_migrations", "as", "a", "DjangoMigration", ".", "Generated", "from", "index", "sys_c004953", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/djangomigration.xo.go#L136-L157
22,916
xo/xo
examples/django/sqlite3/djangocontenttype.xo.go
DjangoContentTypeByID
func DjangoContentTypeByID(db XODB, id int) (*DjangoContentType, error) { var err error // sql query const sqlstr = `SELECT ` + `id, app_label, model ` + `FROM django_content_type ` + `WHERE id = ?` // run query XOLog(sqlstr, id) dct := DjangoContentType{ _exists: true, } err = db.QueryRow(sqlstr, id...
go
func DjangoContentTypeByID(db XODB, id int) (*DjangoContentType, error) { var err error // sql query const sqlstr = `SELECT ` + `id, app_label, model ` + `FROM django_content_type ` + `WHERE id = ?` // run query XOLog(sqlstr, id) dct := DjangoContentType{ _exists: true, } err = db.QueryRow(sqlstr, id...
[ "func", "DjangoContentTypeByID", "(", "db", "XODB", ",", "id", "int", ")", "(", "*", "DjangoContentType", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`id, app_label, model `", "+", "`FROM dj...
// DjangoContentTypeByID retrieves a row from 'django_content_type' as a DjangoContentType. // // Generated from index 'django_content_type_id_pkey'.
[ "DjangoContentTypeByID", "retrieves", "a", "row", "from", "django_content_type", "as", "a", "DjangoContentType", ".", "Generated", "from", "index", "django_content_type_id_pkey", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/sqlite3/djangocontenttype.xo.go#L159-L180
22,917
xo/xo
examples/django/postgres/djangoadminlog.xo.go
Update
func (dal *DjangoAdminLog) Update(db XODB) error { var err error // if doesn't exist, bail if !dal._exists { return errors.New("update failed: does not exist") } // if deleted, bail if dal._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE public.dja...
go
func (dal *DjangoAdminLog) Update(db XODB) error { var err error // if doesn't exist, bail if !dal._exists { return errors.New("update failed: does not exist") } // if deleted, bail if dal._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE public.dja...
[ "func", "(", "dal", "*", "DjangoAdminLog", ")", "Update", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "dal", ".", "_exists", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n...
// Update updates the DjangoAdminLog in the database.
[ "Update", "updates", "the", "DjangoAdminLog", "in", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/djangoadminlog.xo.go#L67-L91
22,918
xo/xo
examples/django/postgres/djangoadminlog.xo.go
DjangoAdminLogsByContentTypeID
func DjangoAdminLogsByContentTypeID(db XODB, contentTypeID sql.NullInt64) ([]*DjangoAdminLog, error) { var err error // sql query const sqlstr = `SELECT ` + `id, action_time, object_id, object_repr, action_flag, change_message, content_type_id, user_id ` + `FROM public.django_admin_log ` + `WHERE content_type...
go
func DjangoAdminLogsByContentTypeID(db XODB, contentTypeID sql.NullInt64) ([]*DjangoAdminLog, error) { var err error // sql query const sqlstr = `SELECT ` + `id, action_time, object_id, object_repr, action_flag, change_message, content_type_id, user_id ` + `FROM public.django_admin_log ` + `WHERE content_type...
[ "func", "DjangoAdminLogsByContentTypeID", "(", "db", "XODB", ",", "contentTypeID", "sql", ".", "NullInt64", ")", "(", "[", "]", "*", "DjangoAdminLog", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", ...
// DjangoAdminLogsByContentTypeID retrieves a row from 'public.django_admin_log' as a DjangoAdminLog. // // Generated from index 'django_admin_log_417f1b1c'.
[ "DjangoAdminLogsByContentTypeID", "retrieves", "a", "row", "from", "public", ".", "django_admin_log", "as", "a", "DjangoAdminLog", ".", "Generated", "from", "index", "django_admin_log_417f1b1c", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/djangoadminlog.xo.go#L184-L218
22,919
xo/xo
models/proc.xo.go
PgProcs
func PgProcs(db XODB, schema string) ([]*Proc, error) { var err error // sql query const sqlstr = `SELECT ` + `p.proname, ` + // ::varchar AS proc_name `pg_get_function_result(p.oid) ` + // ::varchar AS return_type `FROM pg_proc p ` + `JOIN ONLY pg_namespace n ON p.pronamespace = n.oid ` + `WHERE n.nspnam...
go
func PgProcs(db XODB, schema string) ([]*Proc, error) { var err error // sql query const sqlstr = `SELECT ` + `p.proname, ` + // ::varchar AS proc_name `pg_get_function_result(p.oid) ` + // ::varchar AS return_type `FROM pg_proc p ` + `JOIN ONLY pg_namespace n ON p.pronamespace = n.oid ` + `WHERE n.nspnam...
[ "func", "PgProcs", "(", "db", "XODB", ",", "schema", "string", ")", "(", "[", "]", "*", "Proc", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`p.proname, `", "+", "// ::varchar AS proc_nam...
// PgProcs runs a custom query, returning results as Proc.
[ "PgProcs", "runs", "a", "custom", "query", "returning", "results", "as", "Proc", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/models/proc.xo.go#L13-L47
22,920
xo/xo
examples/django/oracle/authgroup.xo.go
Delete
func (ag *AuthGroup) Delete(db XODB) error { var err error // if doesn't exist, bail if !ag._exists { return nil } // if deleted, bail if ag._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.auth_group WHERE id = :1` // run query XOLog(sqlstr, ag.ID) _, err = db.Exec(sqlstr, ag...
go
func (ag *AuthGroup) Delete(db XODB) error { var err error // if doesn't exist, bail if !ag._exists { return nil } // if deleted, bail if ag._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.auth_group WHERE id = :1` // run query XOLog(sqlstr, ag.ID) _, err = db.Exec(sqlstr, ag...
[ "func", "(", "ag", "*", "AuthGroup", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "ag", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, bail", "if", "...
// Delete deletes the AuthGroup from the database.
[ "Delete", "deletes", "the", "AuthGroup", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/authgroup.xo.go#L101-L128
22,921
xo/xo
examples/django/sqlite3/authgroup.xo.go
Update
func (ag *AuthGroup) Update(db XODB) error { var err error // if doesn't exist, bail if !ag._exists { return errors.New("update failed: does not exist") } // if deleted, bail if ag._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE auth_group SET ` +...
go
func (ag *AuthGroup) Update(db XODB) error { var err error // if doesn't exist, bail if !ag._exists { return errors.New("update failed: does not exist") } // if deleted, bail if ag._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE auth_group SET ` +...
[ "func", "(", "ag", "*", "AuthGroup", ")", "Update", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "ag", ".", "_exists", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}...
// Update updates the AuthGroup in the database.
[ "Update", "updates", "the", "AuthGroup", "in", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/sqlite3/authgroup.xo.go#L66-L88
22,922
xo/xo
examples/django/oracle/authuser.xo.go
Delete
func (au *AuthUser) Delete(db XODB) error { var err error // if doesn't exist, bail if !au._exists { return nil } // if deleted, bail if au._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.auth_user WHERE id = :1` // run query XOLog(sqlstr, au.ID) _, err = db.Exec(sqlstr, au.I...
go
func (au *AuthUser) Delete(db XODB) error { var err error // if doesn't exist, bail if !au._exists { return nil } // if deleted, bail if au._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.auth_user WHERE id = :1` // run query XOLog(sqlstr, au.ID) _, err = db.Exec(sqlstr, au.I...
[ "func", "(", "au", "*", "AuthUser", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "au", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, bail", "if", "a...
// Delete deletes the AuthUser from the database.
[ "Delete", "deletes", "the", "AuthUser", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/authuser.xo.go#L111-L138
22,923
xo/xo
examples/django/oracle/authuser.xo.go
AuthUserByUsername
func AuthUserByUsername(db XODB, username sql.NullString) (*AuthUser, error) { var err error // sql query const sqlstr = `SELECT ` + `id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined ` + `FROM django.auth_user ` + `WHERE username = :1` // run q...
go
func AuthUserByUsername(db XODB, username sql.NullString) (*AuthUser, error) { var err error // sql query const sqlstr = `SELECT ` + `id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined ` + `FROM django.auth_user ` + `WHERE username = :1` // run q...
[ "func", "AuthUserByUsername", "(", "db", "XODB", ",", "username", "sql", ".", "NullString", ")", "(", "*", "AuthUser", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`id, password, last_login, ...
// AuthUserByUsername retrieves a row from 'django.auth_user' as a AuthUser. // // Generated from index 'sys_c004977'.
[ "AuthUserByUsername", "retrieves", "a", "row", "from", "django", ".", "auth_user", "as", "a", "AuthUser", ".", "Generated", "from", "index", "sys_c004977", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/authuser.xo.go#L169-L190
22,924
xo/xo
internal/fkmode.go
UnmarshalText
func (f *FkMode) UnmarshalText(text []byte) error { switch strings.ToLower(string(text)) { case "smart", "default": *f = FkModeSmart case "parent": *f = FkModeParent case "field": *f = FkModeField case "key": *f = FkModeKey default: return errors.New("invalid FkMode") } return nil }
go
func (f *FkMode) UnmarshalText(text []byte) error { switch strings.ToLower(string(text)) { case "smart", "default": *f = FkModeSmart case "parent": *f = FkModeParent case "field": *f = FkModeField case "key": *f = FkModeKey default: return errors.New("invalid FkMode") } return nil }
[ "func", "(", "f", "*", "FkMode", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "switch", "strings", ".", "ToLower", "(", "string", "(", "text", ")", ")", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "*", "f", "=", "F...
// UnmarshalText unmarshals FkMode from text.
[ "UnmarshalText", "unmarshals", "FkMode", "from", "text", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/internal/fkmode.go#L44-L60
22,925
xo/xo
internal/fkmode.go
fkName
func fkName(mode FkMode, fkMap map[string]*ForeignKey, fk *ForeignKey) string { switch mode { case FkModeParent: return fk.RefType.Name case FkModeField: return fk.RefType.Name + "By" + fk.Field.Name case FkModeKey: return fk.RefType.Name + "By" + snaker.SnakeToCamelIdentifier(fk.ForeignKey.ForeignKeyName) }...
go
func fkName(mode FkMode, fkMap map[string]*ForeignKey, fk *ForeignKey) string { switch mode { case FkModeParent: return fk.RefType.Name case FkModeField: return fk.RefType.Name + "By" + fk.Field.Name case FkModeKey: return fk.RefType.Name + "By" + snaker.SnakeToCamelIdentifier(fk.ForeignKey.ForeignKeyName) }...
[ "func", "fkName", "(", "mode", "FkMode", ",", "fkMap", "map", "[", "string", "]", "*", "ForeignKey", ",", "fk", "*", "ForeignKey", ")", "string", "{", "switch", "mode", "{", "case", "FkModeParent", ":", "return", "fk", ".", "RefType", ".", "Name", "\n"...
// fkName returns the name for the foreign key.
[ "fkName", "returns", "the", "name", "for", "the", "foreign", "key", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/internal/fkmode.go#L79-L99
22,926
xo/xo
internal/fkmode.go
ForeignKeyName
func (a *ArgType) ForeignKeyName(fkMap map[string]*ForeignKey, fk *ForeignKey) string { return fkName(*a.ForeignKeyMode, fkMap, fk) }
go
func (a *ArgType) ForeignKeyName(fkMap map[string]*ForeignKey, fk *ForeignKey) string { return fkName(*a.ForeignKeyMode, fkMap, fk) }
[ "func", "(", "a", "*", "ArgType", ")", "ForeignKeyName", "(", "fkMap", "map", "[", "string", "]", "*", "ForeignKey", ",", "fk", "*", "ForeignKey", ")", "string", "{", "return", "fkName", "(", "*", "a", ".", "ForeignKeyMode", ",", "fkMap", ",", "fk", ...
// ForeignKeyName returns the foreign key name for the passed type.
[ "ForeignKeyName", "returns", "the", "foreign", "key", "name", "for", "the", "passed", "type", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/internal/fkmode.go#L102-L104
22,927
xo/xo
examples/django/postgres/authuseruserpermission.xo.go
Delete
func (auup *AuthUserUserPermission) Delete(db XODB) error { var err error // if doesn't exist, bail if !auup._exists { return nil } // if deleted, bail if auup._deleted { return nil } // sql query const sqlstr = `DELETE FROM public.auth_user_user_permissions WHERE id = $1` // run query XOLog(sqlstr, ...
go
func (auup *AuthUserUserPermission) Delete(db XODB) error { var err error // if doesn't exist, bail if !auup._exists { return nil } // if deleted, bail if auup._deleted { return nil } // sql query const sqlstr = `DELETE FROM public.auth_user_user_permissions WHERE id = $1` // run query XOLog(sqlstr, ...
[ "func", "(", "auup", "*", "AuthUserUserPermission", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "auup", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, b...
// Delete deletes the AuthUserUserPermission from the database.
[ "Delete", "deletes", "the", "AuthUserUserPermission", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/authuseruserpermission.xo.go#L131-L158
22,928
xo/xo
examples/django/postgres/authuseruserpermission.xo.go
AuthUserUserPermissionByID
func AuthUserUserPermissionByID(db XODB, id int) (*AuthUserUserPermission, error) { var err error // sql query const sqlstr = `SELECT ` + `id, user_id, permission_id ` + `FROM public.auth_user_user_permissions ` + `WHERE id = $1` // run query XOLog(sqlstr, id) auup := AuthUserUserPermission{ _exists: tr...
go
func AuthUserUserPermissionByID(db XODB, id int) (*AuthUserUserPermission, error) { var err error // sql query const sqlstr = `SELECT ` + `id, user_id, permission_id ` + `FROM public.auth_user_user_permissions ` + `WHERE id = $1` // run query XOLog(sqlstr, id) auup := AuthUserUserPermission{ _exists: tr...
[ "func", "AuthUserUserPermissionByID", "(", "db", "XODB", ",", "id", "int", ")", "(", "*", "AuthUserUserPermission", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`id, user_id, permission_id `", ...
// AuthUserUserPermissionByID retrieves a row from 'public.auth_user_user_permissions' as a AuthUserUserPermission. // // Generated from index 'auth_user_user_permissions_pkey'.
[ "AuthUserUserPermissionByID", "retrieves", "a", "row", "from", "public", ".", "auth_user_user_permissions", "as", "a", "AuthUserUserPermission", ".", "Generated", "from", "index", "auth_user_user_permissions_pkey", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/authuseruserpermission.xo.go#L255-L276
22,929
xo/xo
examples/django/oracle/authusergroup.xo.go
Delete
func (aug *AuthUserGroup) Delete(db XODB) error { var err error // if doesn't exist, bail if !aug._exists { return nil } // if deleted, bail if aug._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.auth_user_groups WHERE id = :1` // run query XOLog(sqlstr, aug.ID) _, err = db.E...
go
func (aug *AuthUserGroup) Delete(db XODB) error { var err error // if doesn't exist, bail if !aug._exists { return nil } // if deleted, bail if aug._deleted { return nil } // sql query const sqlstr = `DELETE FROM django.auth_user_groups WHERE id = :1` // run query XOLog(sqlstr, aug.ID) _, err = db.E...
[ "func", "(", "aug", "*", "AuthUserGroup", ")", "Delete", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "aug", ".", "_exists", "{", "return", "nil", "\n", "}", "\n\n", "// if deleted, bail", "if...
// Delete deletes the AuthUserGroup from the database.
[ "Delete", "deletes", "the", "AuthUserGroup", "from", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/oracle/authusergroup.xo.go#L99-L126
22,930
xo/xo
models/myenumvalue.xo.go
MyEnumValues
func MyEnumValues(db XODB, schema string, enum string) (*MyEnumValue, error) { var err error // sql query const sqlstr = `SELECT ` + `SUBSTRING(column_type, 6, CHAR_LENGTH(column_type) - 6) AS enum_values ` + `FROM information_schema.columns ` + `WHERE data_type = 'enum' AND table_schema = ? AND column_name =...
go
func MyEnumValues(db XODB, schema string, enum string) (*MyEnumValue, error) { var err error // sql query const sqlstr = `SELECT ` + `SUBSTRING(column_type, 6, CHAR_LENGTH(column_type) - 6) AS enum_values ` + `FROM information_schema.columns ` + `WHERE data_type = 'enum' AND table_schema = ? AND column_name =...
[ "func", "MyEnumValues", "(", "db", "XODB", ",", "schema", "string", ",", "enum", "string", ")", "(", "*", "MyEnumValue", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`SUBSTRING(column_type,...
// MyEnumValues runs a custom query, returning results as MyEnumValue.
[ "MyEnumValues", "runs", "a", "custom", "query", "returning", "results", "as", "MyEnumValue", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/models/myenumvalue.xo.go#L12-L30
22,931
xo/xo
examples/django/postgres/authusergroup.xo.go
Update
func (aug *AuthUserGroup) Update(db XODB) error { var err error // if doesn't exist, bail if !aug._exists { return errors.New("update failed: does not exist") } // if deleted, bail if aug._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE public.auth...
go
func (aug *AuthUserGroup) Update(db XODB) error { var err error // if doesn't exist, bail if !aug._exists { return errors.New("update failed: does not exist") } // if deleted, bail if aug._deleted { return errors.New("update failed: marked for deletion") } // sql query const sqlstr = `UPDATE public.auth...
[ "func", "(", "aug", "*", "AuthUserGroup", ")", "Update", "(", "db", "XODB", ")", "error", "{", "var", "err", "error", "\n\n", "// if doesn't exist, bail", "if", "!", "aug", ".", "_exists", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n"...
// Update updates the AuthUserGroup in the database.
[ "Update", "updates", "the", "AuthUserGroup", "in", "the", "database", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/django/postgres/authusergroup.xo.go#L60-L84
22,932
xo/xo
models/column.xo.go
MyTableColumns
func MyTableColumns(db XODB, schema string, table string) ([]*Column, error) { var err error // sql query const sqlstr = `SELECT ` + `ordinal_position AS field_ordinal, ` + `column_name, ` + `IF(data_type = 'enum', column_name, column_type) AS data_type, ` + `IF(is_nullable = 'YES', false, true) AS not_null...
go
func MyTableColumns(db XODB, schema string, table string) ([]*Column, error) { var err error // sql query const sqlstr = `SELECT ` + `ordinal_position AS field_ordinal, ` + `column_name, ` + `IF(data_type = 'enum', column_name, column_type) AS data_type, ` + `IF(is_nullable = 'YES', false, true) AS not_null...
[ "func", "MyTableColumns", "(", "db", "XODB", ",", "schema", "string", ",", "table", "string", ")", "(", "[", "]", "*", "Column", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// sql query", "const", "sqlstr", "=", "`SELECT `", "+", "`ordinal_po...
// MyTableColumns runs a custom query, returning results as Column.
[ "MyTableColumns", "runs", "a", "custom", "query", "returning", "results", "as", "Column", "." ]
1a94fa516029cb306cce6d379d086e4d5b5bb232
https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/models/column.xo.go#L66-L104
22,933
gravitational/teleport
lib/auth/methods.go
AuthenticateUser
func (s *AuthServer) AuthenticateUser(req AuthenticateUserRequest) error { err := s.authenticateUser(req) if err != nil { s.EmitAuditEvent(events.UserLocalLoginFailure, events.EventFields{ events.EventUser: req.Username, events.LoginMethod: events.LoginMethodLocal, events.AuthAttemptSuccess...
go
func (s *AuthServer) AuthenticateUser(req AuthenticateUserRequest) error { err := s.authenticateUser(req) if err != nil { s.EmitAuditEvent(events.UserLocalLoginFailure, events.EventFields{ events.EventUser: req.Username, events.LoginMethod: events.LoginMethodLocal, events.AuthAttemptSuccess...
[ "func", "(", "s", "*", "AuthServer", ")", "AuthenticateUser", "(", "req", "AuthenticateUserRequest", ")", "error", "{", "err", ":=", "s", ".", "authenticateUser", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "EmitAuditEvent", "(", "eve...
// AuthenticateUser authenticates user based on the request type
[ "AuthenticateUser", "authenticates", "user", "based", "on", "the", "request", "type" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/methods.go#L85-L102
22,934
gravitational/teleport
lib/auth/methods.go
AuthenticateWebUser
func (s *AuthServer) AuthenticateWebUser(req AuthenticateUserRequest) (services.WebSession, error) { if req.Session != nil { session, err := s.GetWebSession(req.Username, req.Session.ID) if err != nil { return nil, trace.AccessDenied("session is invalid or has expired") } return session, nil } if err := s...
go
func (s *AuthServer) AuthenticateWebUser(req AuthenticateUserRequest) (services.WebSession, error) { if req.Session != nil { session, err := s.GetWebSession(req.Username, req.Session.ID) if err != nil { return nil, trace.AccessDenied("session is invalid or has expired") } return session, nil } if err := s...
[ "func", "(", "s", "*", "AuthServer", ")", "AuthenticateWebUser", "(", "req", "AuthenticateUserRequest", ")", "(", "services", ".", "WebSession", ",", "error", ")", "{", "if", "req", ".", "Session", "!=", "nil", "{", "session", ",", "err", ":=", "s", ".",...
// AuthenticateWebUser authenticates web user, creates and returns web session // in case if authentication is successful. In case if existing session id // is used to authenticate, returns session associated with the existing session id // instead of creating the new one
[ "AuthenticateWebUser", "authenticates", "web", "user", "creates", "and", "returns", "web", "session", "in", "case", "if", "authentication", "is", "successful", ".", "In", "case", "if", "existing", "session", "id", "is", "used", "to", "authenticate", "returns", "...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/methods.go#L165-L188
22,935
gravitational/teleport
lib/auth/methods.go
CheckAndSetDefaults
func (a *AuthenticateSSHRequest) CheckAndSetDefaults() error { if err := a.AuthenticateUserRequest.CheckAndSetDefaults(); err != nil { return trace.Wrap(err) } if len(a.PublicKey) == 0 { return trace.BadParameter("missing parameter 'public_key'") } certificateFormat, err := utils.CheckCertificateFormatFlag(a.C...
go
func (a *AuthenticateSSHRequest) CheckAndSetDefaults() error { if err := a.AuthenticateUserRequest.CheckAndSetDefaults(); err != nil { return trace.Wrap(err) } if len(a.PublicKey) == 0 { return trace.BadParameter("missing parameter 'public_key'") } certificateFormat, err := utils.CheckCertificateFormatFlag(a.C...
[ "func", "(", "a", "*", "AuthenticateSSHRequest", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "err", ":=", "a", ".", "AuthenticateUserRequest", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", ...
// CheckAndSetDefaults checks and sets default certificate values
[ "CheckAndSetDefaults", "checks", "and", "sets", "default", "certificate", "values" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/methods.go#L203-L216
22,936
gravitational/teleport
lib/auth/methods.go
SSHCertPublicKeys
func (c *TrustedCerts) SSHCertPublicKeys() ([]ssh.PublicKey, error) { out := make([]ssh.PublicKey, 0, len(c.HostCertificates)) for _, keyBytes := range c.HostCertificates { publicKey, _, _, _, err := ssh.ParseAuthorizedKey(keyBytes) if err != nil { return nil, trace.Wrap(err) } out = append(out, publicKey)...
go
func (c *TrustedCerts) SSHCertPublicKeys() ([]ssh.PublicKey, error) { out := make([]ssh.PublicKey, 0, len(c.HostCertificates)) for _, keyBytes := range c.HostCertificates { publicKey, _, _, _, err := ssh.ParseAuthorizedKey(keyBytes) if err != nil { return nil, trace.Wrap(err) } out = append(out, publicKey)...
[ "func", "(", "c", "*", "TrustedCerts", ")", "SSHCertPublicKeys", "(", ")", "(", "[", "]", "ssh", ".", "PublicKey", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "ssh", ".", "PublicKey", ",", "0", ",", "len", "(", "c", ".", "HostCert...
// SSHCertPublicKeys returns a list of trusted host SSH certificate authority public keys
[ "SSHCertPublicKeys", "returns", "a", "list", "of", "trusted", "host", "SSH", "certificate", "authority", "public", "keys" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/methods.go#L247-L257
22,937
gravitational/teleport
lib/auth/methods.go
AuthoritiesToTrustedCerts
func AuthoritiesToTrustedCerts(authorities []services.CertAuthority) []TrustedCerts { out := make([]TrustedCerts, len(authorities)) for i, ca := range authorities { out[i] = TrustedCerts{ ClusterName: ca.GetClusterName(), HostCertificates: ca.GetCheckingKeys(), TLSCertificates: services.TLSCerts(ca),...
go
func AuthoritiesToTrustedCerts(authorities []services.CertAuthority) []TrustedCerts { out := make([]TrustedCerts, len(authorities)) for i, ca := range authorities { out[i] = TrustedCerts{ ClusterName: ca.GetClusterName(), HostCertificates: ca.GetCheckingKeys(), TLSCertificates: services.TLSCerts(ca),...
[ "func", "AuthoritiesToTrustedCerts", "(", "authorities", "[", "]", "services", ".", "CertAuthority", ")", "[", "]", "TrustedCerts", "{", "out", ":=", "make", "(", "[", "]", "TrustedCerts", ",", "len", "(", "authorities", ")", ")", "\n", "for", "i", ",", ...
// AuthoritiesToTrustedCerts serializes authorities to TrustedCerts data structure
[ "AuthoritiesToTrustedCerts", "serializes", "authorities", "to", "TrustedCerts", "data", "structure" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/methods.go#L260-L270
22,938
gravitational/teleport
lib/auth/methods.go
AuthenticateSSHUser
func (s *AuthServer) AuthenticateSSHUser(req AuthenticateSSHRequest) (*SSHLoginResponse, error) { clusterName, err := s.GetClusterName() if err != nil { return nil, trace.Wrap(err) } if err := s.AuthenticateUser(req.AuthenticateUserRequest); err != nil { return nil, trace.Wrap(err) } user, err := s.GetUser(r...
go
func (s *AuthServer) AuthenticateSSHUser(req AuthenticateSSHRequest) (*SSHLoginResponse, error) { clusterName, err := s.GetClusterName() if err != nil { return nil, trace.Wrap(err) } if err := s.AuthenticateUser(req.AuthenticateUserRequest); err != nil { return nil, trace.Wrap(err) } user, err := s.GetUser(r...
[ "func", "(", "s", "*", "AuthServer", ")", "AuthenticateSSHUser", "(", "req", "AuthenticateSSHRequest", ")", "(", "*", "SSHLoginResponse", ",", "error", ")", "{", "clusterName", ",", "err", ":=", "s", ".", "GetClusterName", "(", ")", "\n", "if", "err", "!="...
// AuthenticateSSHUser authenticates web user, creates and returns web session // in case if authentication is successful
[ "AuthenticateSSHUser", "authenticates", "web", "user", "creates", "and", "returns", "web", "session", "in", "case", "if", "authentication", "is", "successful" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/methods.go#L274-L320
22,939
gravitational/teleport
lib/pam/pam.go
unregisterHandler
func unregisterHandler(handlerIndex int) { handlerMu.Lock() defer handlerMu.Unlock() delete(handlers, handlerIndex) }
go
func unregisterHandler(handlerIndex int) { handlerMu.Lock() defer handlerMu.Unlock() delete(handlers, handlerIndex) }
[ "func", "unregisterHandler", "(", "handlerIndex", "int", ")", "{", "handlerMu", ".", "Lock", "(", ")", "\n", "defer", "handlerMu", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "handlers", ",", "handlerIndex", ")", "\n", "}" ]
// unregisterHandler will remove the PAM handle from the package level map // once no more C callbacks can come back.
[ "unregisterHandler", "will", "remove", "the", "PAM", "handle", "from", "the", "package", "level", "map", "once", "no", "more", "C", "callbacks", "can", "come", "back", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/pam/pam.go#L140-L145
22,940
gravitational/teleport
lib/pam/pam.go
lookupHandler
func lookupHandler(handlerIndex int) (handler, error) { handlerMu.Lock() defer handlerMu.Unlock() handle, ok := handlers[handlerIndex] if !ok { return nil, trace.BadParameter("handler with index %v not registered", handlerIndex) } return handle, nil }
go
func lookupHandler(handlerIndex int) (handler, error) { handlerMu.Lock() defer handlerMu.Unlock() handle, ok := handlers[handlerIndex] if !ok { return nil, trace.BadParameter("handler with index %v not registered", handlerIndex) } return handle, nil }
[ "func", "lookupHandler", "(", "handlerIndex", "int", ")", "(", "handler", ",", "error", ")", "{", "handlerMu", ".", "Lock", "(", ")", "\n", "defer", "handlerMu", ".", "Unlock", "(", ")", "\n\n", "handle", ",", "ok", ":=", "handlers", "[", "handlerIndex",...
// lookupHandler returns a particular handler from the package level map.
[ "lookupHandler", "returns", "a", "particular", "handler", "from", "the", "package", "level", "map", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/pam/pam.go#L148-L158
22,941
gravitational/teleport
lib/pam/pam.go
Open
func Open(config *Config) (*PAM, error) { if config == nil { return nil, trace.BadParameter("PAM configuration is required.") } err := config.CheckDefaults() if err != nil { return nil, trace.Wrap(err) } p := &PAM{ pamh: nil, stdin: config.Stdin, stdout: config.Stdout, stderr: config.Stderr, } ...
go
func Open(config *Config) (*PAM, error) { if config == nil { return nil, trace.BadParameter("PAM configuration is required.") } err := config.CheckDefaults() if err != nil { return nil, trace.Wrap(err) } p := &PAM{ pamh: nil, stdin: config.Stdin, stdout: config.Stdout, stderr: config.Stderr, } ...
[ "func", "Open", "(", "config", "*", "Config", ")", "(", "*", "PAM", ",", "error", ")", "{", "if", "config", "==", "nil", "{", "return", "nil", ",", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "err", ":=", "config", ".", ...
// Open creates a PAM context and initiates a PAM transaction to check the // account and then opens a session.
[ "Open", "creates", "a", "PAM", "context", "and", "initiates", "a", "PAM", "transaction", "to", "check", "the", "account", "and", "then", "opens", "a", "session", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/pam/pam.go#L215-L271
22,942
gravitational/teleport
lib/pam/pam.go
Close
func (p *PAM) Close() error { // Close the PAM session. Closing a session can entail anything from // unmounting a home directory and updating auth.log. p.retval = C._pam_close_session(pamHandle, p.pamh, 0) if p.retval != C.PAM_SUCCESS { return p.codeToError(p.retval) } // Terminate the PAM transaction. retva...
go
func (p *PAM) Close() error { // Close the PAM session. Closing a session can entail anything from // unmounting a home directory and updating auth.log. p.retval = C._pam_close_session(pamHandle, p.pamh, 0) if p.retval != C.PAM_SUCCESS { return p.codeToError(p.retval) } // Terminate the PAM transaction. retva...
[ "func", "(", "p", "*", "PAM", ")", "Close", "(", ")", "error", "{", "// Close the PAM session. Closing a session can entail anything from", "// unmounting a home directory and updating auth.log.", "p", ".", "retval", "=", "C", ".", "_pam_close_session", "(", "pamHandle", ...
// Close will close the session, the PAM context, and release any allocated // memory.
[ "Close", "will", "close", "the", "session", "the", "PAM", "context", "and", "release", "any", "allocated", "memory", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/pam/pam.go#L275-L300
22,943
gravitational/teleport
lib/pam/pam.go
codeToError
func (p *PAM) codeToError(returnValue C.int) error { // Error strings are not allocated on the heap, so memory does not need // released. err := C._pam_strerror(pamHandle, p.pamh, returnValue) if err != nil { return trace.BadParameter(C.GoString(err)) } return nil }
go
func (p *PAM) codeToError(returnValue C.int) error { // Error strings are not allocated on the heap, so memory does not need // released. err := C._pam_strerror(pamHandle, p.pamh, returnValue) if err != nil { return trace.BadParameter(C.GoString(err)) } return nil }
[ "func", "(", "p", "*", "PAM", ")", "codeToError", "(", "returnValue", "C", ".", "int", ")", "error", "{", "// Error strings are not allocated on the heap, so memory does not need", "// released.", "err", ":=", "C", ".", "_pam_strerror", "(", "pamHandle", ",", "p", ...
// codeToError returns a human readable string from the PAM error.
[ "codeToError", "returns", "a", "human", "readable", "string", "from", "the", "PAM", "error", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/pam/pam.go#L334-L343
22,944
gravitational/teleport
lib/utils/fakeconn.go
DualPipeNetConn
func DualPipeNetConn(srcAddr net.Addr, dstAddr net.Addr) (*PipeNetConn, *PipeNetConn) { server, client := net.Pipe() serverConn := NewPipeNetConn(server, server, server, dstAddr, srcAddr) clientConn := NewPipeNetConn(client, client, client, srcAddr, dstAddr) return serverConn, clientConn }
go
func DualPipeNetConn(srcAddr net.Addr, dstAddr net.Addr) (*PipeNetConn, *PipeNetConn) { server, client := net.Pipe() serverConn := NewPipeNetConn(server, server, server, dstAddr, srcAddr) clientConn := NewPipeNetConn(client, client, client, srcAddr, dstAddr) return serverConn, clientConn }
[ "func", "DualPipeNetConn", "(", "srcAddr", "net", ".", "Addr", ",", "dstAddr", "net", ".", "Addr", ")", "(", "*", "PipeNetConn", ",", "*", "PipeNetConn", ")", "{", "server", ",", "client", ":=", "net", ".", "Pipe", "(", ")", "\n\n", "serverConn", ":=",...
// DualPipeAddrConn creates a net.Pipe to connect a client and a server. The // two net.Conn instances are wrapped in an addrConn which holds the source and // destination addresses.
[ "DualPipeAddrConn", "creates", "a", "net", ".", "Pipe", "to", "connect", "a", "client", "and", "a", "server", ".", "The", "two", "net", ".", "Conn", "instances", "are", "wrapped", "in", "an", "addrConn", "which", "holds", "the", "source", "and", "destinati...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/fakeconn.go#L89-L96
22,945
gravitational/teleport
lib/services/clustername.go
NewClusterName
func NewClusterName(spec ClusterNameSpecV2) (ClusterName, error) { cn := ClusterNameV2{ Kind: KindClusterName, Version: V2, Metadata: Metadata{ Name: MetaNameClusterName, Namespace: defaults.Namespace, }, Spec: spec, } if err := cn.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(...
go
func NewClusterName(spec ClusterNameSpecV2) (ClusterName, error) { cn := ClusterNameV2{ Kind: KindClusterName, Version: V2, Metadata: Metadata{ Name: MetaNameClusterName, Namespace: defaults.Namespace, }, Spec: spec, } if err := cn.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(...
[ "func", "NewClusterName", "(", "spec", "ClusterNameSpecV2", ")", "(", "ClusterName", ",", "error", ")", "{", "cn", ":=", "ClusterNameV2", "{", "Kind", ":", "KindClusterName", ",", "Version", ":", "V2", ",", "Metadata", ":", "Metadata", "{", "Name", ":", "M...
// NewClusterName is a convenience wrapper to create a ClusterName resource.
[ "NewClusterName", "is", "a", "convenience", "wrapper", "to", "create", "a", "ClusterName", "resource", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clustername.go#L46-L61
22,946
gravitational/teleport
lib/services/clustername.go
GetClusterNameSchema
func GetClusterNameSchema(extensionSchema string) string { var clusterNameSchema string if clusterNameSchema == "" { clusterNameSchema = fmt.Sprintf(ClusterNameSpecSchemaTemplate, "") } else { clusterNameSchema = fmt.Sprintf(ClusterNameSpecSchemaTemplate, ","+extensionSchema) } return fmt.Sprintf(V2SchemaTempl...
go
func GetClusterNameSchema(extensionSchema string) string { var clusterNameSchema string if clusterNameSchema == "" { clusterNameSchema = fmt.Sprintf(ClusterNameSpecSchemaTemplate, "") } else { clusterNameSchema = fmt.Sprintf(ClusterNameSpecSchemaTemplate, ","+extensionSchema) } return fmt.Sprintf(V2SchemaTempl...
[ "func", "GetClusterNameSchema", "(", "extensionSchema", "string", ")", "string", "{", "var", "clusterNameSchema", "string", "\n", "if", "clusterNameSchema", "==", "\"", "\"", "{", "clusterNameSchema", "=", "fmt", ".", "Sprintf", "(", "ClusterNameSpecSchemaTemplate", ...
// GetClusterNameSchema returns the schema with optionally injected // schema for extensions.
[ "GetClusterNameSchema", "returns", "the", "schema", "with", "optionally", "injected", "schema", "for", "extensions", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clustername.go#L166-L174
22,947
gravitational/teleport
lib/services/clustername.go
Unmarshal
func (t *TeleportClusterNameMarshaler) Unmarshal(bytes []byte, opts ...MarshalOption) (ClusterName, error) { var clusterName ClusterNameV2 if len(bytes) == 0 { return nil, trace.BadParameter("missing resource data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } if cfg.Sk...
go
func (t *TeleportClusterNameMarshaler) Unmarshal(bytes []byte, opts ...MarshalOption) (ClusterName, error) { var clusterName ClusterNameV2 if len(bytes) == 0 { return nil, trace.BadParameter("missing resource data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } if cfg.Sk...
[ "func", "(", "t", "*", "TeleportClusterNameMarshaler", ")", "Unmarshal", "(", "bytes", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "ClusterName", ",", "error", ")", "{", "var", "clusterName", "ClusterNameV2", "\n\n", "if", "len", "(", ...
// Unmarshal unmarshals ClusterName from JSON.
[ "Unmarshal", "unmarshals", "ClusterName", "from", "JSON", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clustername.go#L203-L239
22,948
gravitational/teleport
lib/services/clustername.go
Marshal
func (t *TeleportClusterNameMarshaler) Marshal(c ClusterName, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := c.(type) { case *ClusterNameV2: if !cfg.PreserveResourceID { // avoid modifying the original object // t...
go
func (t *TeleportClusterNameMarshaler) Marshal(c ClusterName, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := c.(type) { case *ClusterNameV2: if !cfg.PreserveResourceID { // avoid modifying the original object // t...
[ "func", "(", "t", "*", "TeleportClusterNameMarshaler", ")", "Marshal", "(", "c", "ClusterName", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", "\n", ...
// Marshal marshals ClusterName to JSON.
[ "Marshal", "marshals", "ClusterName", "to", "JSON", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clustername.go#L242-L260
22,949
gravitational/teleport
lib/services/trust.go
Check
func (c CertAuthType) Check() error { if c != HostCA && c != UserCA { return trace.BadParameter("'%v' authority type is not supported", c) } return nil }
go
func (c CertAuthType) Check() error { if c != HostCA && c != UserCA { return trace.BadParameter("'%v' authority type is not supported", c) } return nil }
[ "func", "(", "c", "CertAuthType", ")", "Check", "(", ")", "error", "{", "if", "c", "!=", "HostCA", "&&", "c", "!=", "UserCA", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ",", "c", ")", "\n", "}", "\n", "return", "nil", "\n", "}"...
// Check checks if certificate authority type value is correct
[ "Check", "checks", "if", "certificate", "authority", "type", "value", "is", "correct" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trust.go#L81-L86
22,950
gravitational/teleport
lib/services/trust.go
Check
func (c *CertAuthID) Check() error { if err := c.Type.Check(); err != nil { return trace.Wrap(err) } if strings.TrimSpace(c.DomainName) == "" { return trace.BadParameter("identity validation error: empty domain name") } return nil }
go
func (c *CertAuthID) Check() error { if err := c.Type.Check(); err != nil { return trace.Wrap(err) } if strings.TrimSpace(c.DomainName) == "" { return trace.BadParameter("identity validation error: empty domain name") } return nil }
[ "func", "(", "c", "*", "CertAuthID", ")", "Check", "(", ")", "error", "{", "if", "err", ":=", "c", ".", "Type", ".", "Check", "(", ")", ";", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", "err", ")", "\n", "}", "\n", "if", "str...
// Check returns error if any of the id parameters are bad, nil otherwise
[ "Check", "returns", "error", "if", "any", "of", "the", "id", "parameters", "are", "bad", "nil", "otherwise" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trust.go#L99-L107
22,951
gravitational/teleport
lib/services/tunnel.go
NewReverseTunnel
func NewReverseTunnel(clusterName string, dialAddrs []string) ReverseTunnel { return &ReverseTunnelV2{ Kind: KindReverseTunnel, Version: V2, Metadata: Metadata{ Name: clusterName, Namespace: defaults.Namespace, }, Spec: ReverseTunnelSpecV2{ ClusterName: clusterName, DialAddrs: dialAddrs...
go
func NewReverseTunnel(clusterName string, dialAddrs []string) ReverseTunnel { return &ReverseTunnelV2{ Kind: KindReverseTunnel, Version: V2, Metadata: Metadata{ Name: clusterName, Namespace: defaults.Namespace, }, Spec: ReverseTunnelSpecV2{ ClusterName: clusterName, DialAddrs: dialAddrs...
[ "func", "NewReverseTunnel", "(", "clusterName", "string", ",", "dialAddrs", "[", "]", "string", ")", "ReverseTunnel", "{", "return", "&", "ReverseTunnelV2", "{", "Kind", ":", "KindReverseTunnel", ",", "Version", ":", "V2", ",", "Metadata", ":", "Metadata", "{"...
// NewReverseTunnel returns new version of reverse tunnel
[ "NewReverseTunnel", "returns", "new", "version", "of", "reverse", "tunnel" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnel.go#L55-L68
22,952
gravitational/teleport
lib/services/tunnel.go
V2
func (r *ReverseTunnelV1) V2() *ReverseTunnelV2 { return &ReverseTunnelV2{ Kind: KindReverseTunnel, Version: V2, Metadata: Metadata{ Name: r.DomainName, Namespace: defaults.Namespace, }, Spec: ReverseTunnelSpecV2{ ClusterName: r.DomainName, Type: ProxyTunnel, DialAddrs: r.Dial...
go
func (r *ReverseTunnelV1) V2() *ReverseTunnelV2 { return &ReverseTunnelV2{ Kind: KindReverseTunnel, Version: V2, Metadata: Metadata{ Name: r.DomainName, Namespace: defaults.Namespace, }, Spec: ReverseTunnelSpecV2{ ClusterName: r.DomainName, Type: ProxyTunnel, DialAddrs: r.Dial...
[ "func", "(", "r", "*", "ReverseTunnelV1", ")", "V2", "(", ")", "*", "ReverseTunnelV2", "{", "return", "&", "ReverseTunnelV2", "{", "Kind", ":", "KindReverseTunnel", ",", "Version", ":", "V2", ",", "Metadata", ":", "Metadata", "{", "Name", ":", "r", ".", ...
// V2 returns V2 version of reverse tunnel
[ "V2", "returns", "V2", "version", "of", "reverse", "tunnel" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnel.go#L240-L254
22,953
gravitational/teleport
lib/services/tunnel.go
UnmarshalReverseTunnel
func UnmarshalReverseTunnel(data []byte, opts ...MarshalOption) (ReverseTunnel, error) { if len(data) == 0 { return nil, trace.BadParameter("missing tunnel data") } var h ResourceHeader err := json.Unmarshal(data, &h) if err != nil { return nil, trace.Wrap(err) } cfg, err := collectOptions(opts) if err != n...
go
func UnmarshalReverseTunnel(data []byte, opts ...MarshalOption) (ReverseTunnel, error) { if len(data) == 0 { return nil, trace.BadParameter("missing tunnel data") } var h ResourceHeader err := json.Unmarshal(data, &h) if err != nil { return nil, trace.Wrap(err) } cfg, err := collectOptions(opts) if err != n...
[ "func", "UnmarshalReverseTunnel", "(", "data", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "ReverseTunnel", ",", "error", ")", "{", "if", "len", "(", "data", ")", "==", "0", "{", "return", "nil", ",", "trace", ".", "BadParameter", ...
// UnmarshalReverseTunnel unmarshals reverse tunnel from JSON or YAML, // sets defaults and checks the schema
[ "UnmarshalReverseTunnel", "unmarshals", "reverse", "tunnel", "from", "JSON", "or", "YAML", "sets", "defaults", "and", "checks", "the", "schema" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnel.go#L264-L313
22,954
gravitational/teleport
lib/services/tunnel.go
UnmarshalReverseTunnel
func (*TeleportTunnelMarshaler) UnmarshalReverseTunnel(bytes []byte, opts ...MarshalOption) (ReverseTunnel, error) { return UnmarshalReverseTunnel(bytes, opts...) }
go
func (*TeleportTunnelMarshaler) UnmarshalReverseTunnel(bytes []byte, opts ...MarshalOption) (ReverseTunnel, error) { return UnmarshalReverseTunnel(bytes, opts...) }
[ "func", "(", "*", "TeleportTunnelMarshaler", ")", "UnmarshalReverseTunnel", "(", "bytes", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "ReverseTunnel", ",", "error", ")", "{", "return", "UnmarshalReverseTunnel", "(", "bytes", ",", "opts", "...
// UnmarshalReverseTunnel unmarshals reverse tunnel from JSON or YAML
[ "UnmarshalReverseTunnel", "unmarshals", "reverse", "tunnel", "from", "JSON", "or", "YAML" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnel.go#L340-L342
22,955
gravitational/teleport
lib/services/tunnel.go
MarshalReverseTunnel
func (*TeleportTunnelMarshaler) MarshalReverseTunnel(rt ReverseTunnel, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type tunv1 interface { V1() *ReverseTunnelV1 } type tunv2 interface { V2() *ReverseTunnelV2 } version := cfg.GetVer...
go
func (*TeleportTunnelMarshaler) MarshalReverseTunnel(rt ReverseTunnel, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type tunv1 interface { V1() *ReverseTunnelV1 } type tunv2 interface { V2() *ReverseTunnelV2 } version := cfg.GetVer...
[ "func", "(", "*", "TeleportTunnelMarshaler", ")", "MarshalReverseTunnel", "(", "rt", "ReverseTunnel", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", "\n"...
// MarshalRole marshalls role into JSON
[ "MarshalRole", "marshalls", "role", "into", "JSON" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnel.go#L345-L381
22,956
gravitational/teleport
lib/utils/syslog.go
SwitchLoggingtoSyslog
func SwitchLoggingtoSyslog() error { log.StandardLogger().SetHooks(make(log.LevelHooks)) hook, err := logrusSyslog.NewSyslogHook("", "", syslog.LOG_WARNING, "") if err != nil { // syslog is not available log.SetOutput(os.Stderr) return trace.Wrap(err) } log.AddHook(hook) // ... and disable stderr: log.SetO...
go
func SwitchLoggingtoSyslog() error { log.StandardLogger().SetHooks(make(log.LevelHooks)) hook, err := logrusSyslog.NewSyslogHook("", "", syslog.LOG_WARNING, "") if err != nil { // syslog is not available log.SetOutput(os.Stderr) return trace.Wrap(err) } log.AddHook(hook) // ... and disable stderr: log.SetO...
[ "func", "SwitchLoggingtoSyslog", "(", ")", "error", "{", "log", ".", "StandardLogger", "(", ")", ".", "SetHooks", "(", "make", "(", "log", ".", "LevelHooks", ")", ")", "\n", "hook", ",", "err", ":=", "logrusSyslog", ".", "NewSyslogHook", "(", "\"", "\"",...
// SwitchLoggingtoSyslog tells the logger to send the output to syslog. This // code is behind a build flag because Windows does not support syslog.
[ "SwitchLoggingtoSyslog", "tells", "the", "logger", "to", "send", "the", "output", "to", "syslog", ".", "This", "code", "is", "behind", "a", "build", "flag", "because", "Windows", "does", "not", "support", "syslog", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/syslog.go#L33-L45
22,957
gravitational/teleport
lib/auth/rotate.go
Types
func (r *RotateRequest) Types() []services.CertAuthType { switch r.Type { case "": return []services.CertAuthType{services.HostCA, services.UserCA} case services.HostCA: return []services.CertAuthType{services.HostCA} case services.UserCA: return []services.CertAuthType{services.UserCA} } return nil }
go
func (r *RotateRequest) Types() []services.CertAuthType { switch r.Type { case "": return []services.CertAuthType{services.HostCA, services.UserCA} case services.HostCA: return []services.CertAuthType{services.HostCA} case services.UserCA: return []services.CertAuthType{services.UserCA} } return nil }
[ "func", "(", "r", "*", "RotateRequest", ")", "Types", "(", ")", "[", "]", "services", ".", "CertAuthType", "{", "switch", "r", ".", "Type", "{", "case", "\"", "\"", ":", "return", "[", "]", "services", ".", "CertAuthType", "{", "services", ".", "Host...
// Types returns cert authority types requested to be rotated.
[ "Types", "returns", "cert", "authority", "types", "requested", "to", "be", "rotated", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L61-L71
22,958
gravitational/teleport
lib/auth/rotate.go
CheckAndSetDefaults
func (r *RotateRequest) CheckAndSetDefaults(clock clockwork.Clock) error { if r.TargetPhase == "" { // if phase if not set, imply that the first meaningful phase // is set as a target phase r.TargetPhase = services.RotationPhaseInit } // if mode is not set, default to manual (as it's safer) if r.Mode == "" { ...
go
func (r *RotateRequest) CheckAndSetDefaults(clock clockwork.Clock) error { if r.TargetPhase == "" { // if phase if not set, imply that the first meaningful phase // is set as a target phase r.TargetPhase = services.RotationPhaseInit } // if mode is not set, default to manual (as it's safer) if r.Mode == "" { ...
[ "func", "(", "r", "*", "RotateRequest", ")", "CheckAndSetDefaults", "(", "clock", "clockwork", ".", "Clock", ")", "error", "{", "if", "r", ".", "TargetPhase", "==", "\"", "\"", "{", "// if phase if not set, imply that the first meaningful phase", "// is set as a targe...
// CheckAndSetDefaults checks and sets default values.
[ "CheckAndSetDefaults", "checks", "and", "sets", "default", "values", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L74-L105
22,959
gravitational/teleport
lib/auth/rotate.go
RotateExternalCertAuthority
func (a *AuthServer) RotateExternalCertAuthority(ca services.CertAuthority) error { if ca == nil { return trace.BadParameter("missing certificate authority") } clusterName, err := a.GetClusterName() if err != nil { return trace.Wrap(err) } // this is just an extra precaution against local admins, // because...
go
func (a *AuthServer) RotateExternalCertAuthority(ca services.CertAuthority) error { if ca == nil { return trace.BadParameter("missing certificate authority") } clusterName, err := a.GetClusterName() if err != nil { return trace.Wrap(err) } // this is just an extra precaution against local admins, // because...
[ "func", "(", "a", "*", "AuthServer", ")", "RotateExternalCertAuthority", "(", "ca", "services", ".", "CertAuthority", ")", "error", "{", "if", "ca", "==", "nil", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "cluster...
// RotateExternalCertAuthority rotates external certificate authority, // this method is called by remote trusted cluster and is used to update // only public keys and certificates of the certificate authority.
[ "RotateExternalCertAuthority", "rotates", "external", "certificate", "authority", "this", "method", "is", "called", "by", "remote", "trusted", "cluster", "and", "is", "used", "to", "update", "only", "public", "keys", "and", "certificates", "of", "the", "certificate"...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L245-L280
22,960
gravitational/teleport
lib/auth/rotate.go
autoRotateCertAuthorities
func (a *AuthServer) autoRotateCertAuthorities() error { clusterName, err := a.GetClusterName() if err != nil { return trace.Wrap(err) } for _, caType := range []services.CertAuthType{services.HostCA, services.UserCA} { ca, err := a.Trust.GetCertAuthority(services.CertAuthID{ Type: caType, DomainNam...
go
func (a *AuthServer) autoRotateCertAuthorities() error { clusterName, err := a.GetClusterName() if err != nil { return trace.Wrap(err) } for _, caType := range []services.CertAuthType{services.HostCA, services.UserCA} { ca, err := a.Trust.GetCertAuthority(services.CertAuthID{ Type: caType, DomainNam...
[ "func", "(", "a", "*", "AuthServer", ")", "autoRotateCertAuthorities", "(", ")", "error", "{", "clusterName", ",", "err", ":=", "a", ".", "GetClusterName", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", "err", ")", ...
// autoRotateCertAuthorities automatically rotates cert authorities, // does nothing if no rotation parameters were set up // or it is too early to rotate per schedule
[ "autoRotateCertAuthorities", "automatically", "rotates", "cert", "authorities", "does", "nothing", "if", "no", "rotation", "parameters", "were", "set", "up", "or", "it", "is", "too", "early", "to", "rotate", "per", "schedule" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L285-L303
22,961
gravitational/teleport
lib/auth/rotate.go
processRotationRequest
func processRotationRequest(req rotationReq) (services.CertAuthority, error) { rotation := req.ca.GetRotation() ca := req.ca.Clone() switch req.targetPhase { case services.RotationPhaseInit: // This is the first stage of the rotation - new certificate authorities // are being generated, but no components are u...
go
func processRotationRequest(req rotationReq) (services.CertAuthority, error) { rotation := req.ca.GetRotation() ca := req.ca.Clone() switch req.targetPhase { case services.RotationPhaseInit: // This is the first stage of the rotation - new certificate authorities // are being generated, but no components are u...
[ "func", "processRotationRequest", "(", "req", "rotationReq", ")", "(", "services", ".", "CertAuthority", ",", "error", ")", "{", "rotation", ":=", "req", ".", "ca", ".", "GetRotation", "(", ")", "\n", "ca", ":=", "req", ".", "ca", ".", "Clone", "(", ")...
// processRotationRequest processes rotation request based on the target and // current phase and state.
[ "processRotationRequest", "processes", "rotation", "request", "based", "on", "the", "target", "and", "current", "phase", "and", "state", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L371-L450
22,962
gravitational/teleport
lib/auth/rotate.go
startRollingBackRotation
func startRollingBackRotation(ca services.CertAuthority) error { rotation := ca.GetRotation() // Rollback always sets rotation to manual mode. rotation.Mode = services.RotationModeManual signingKeys := ca.GetSigningKeys() checkingKeys := ca.GetCheckingKeys() keyPairs := ca.GetTLSKeyPairs() // Rotation sets th...
go
func startRollingBackRotation(ca services.CertAuthority) error { rotation := ca.GetRotation() // Rollback always sets rotation to manual mode. rotation.Mode = services.RotationModeManual signingKeys := ca.GetSigningKeys() checkingKeys := ca.GetCheckingKeys() keyPairs := ca.GetTLSKeyPairs() // Rotation sets th...
[ "func", "startRollingBackRotation", "(", "ca", "services", ".", "CertAuthority", ")", "error", "{", "rotation", ":=", "ca", ".", "GetRotation", "(", ")", "\n\n", "// Rollback always sets rotation to manual mode.", "rotation", ".", "Mode", "=", "services", ".", "Rota...
// startRollingBackRotation starts roll back to the original state.
[ "startRollingBackRotation", "starts", "roll", "back", "to", "the", "original", "state", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L575-L601
22,963
gravitational/teleport
lib/auth/rotate.go
completeRollingBackRotation
func completeRollingBackRotation(clock clockwork.Clock, ca services.CertAuthority) error { rotation := ca.GetRotation() // clean up the state rotation.Started = time.Time{} rotation.State = services.RotationStateStandby rotation.Phase = services.RotationPhaseStandby rotation.Mode = "" rotation.Schedule = servic...
go
func completeRollingBackRotation(clock clockwork.Clock, ca services.CertAuthority) error { rotation := ca.GetRotation() // clean up the state rotation.Started = time.Time{} rotation.State = services.RotationStateStandby rotation.Phase = services.RotationPhaseStandby rotation.Mode = "" rotation.Schedule = servic...
[ "func", "completeRollingBackRotation", "(", "clock", "clockwork", ".", "Clock", ",", "ca", "services", ".", "CertAuthority", ")", "error", "{", "rotation", ":=", "ca", ".", "GetRotation", "(", ")", "\n\n", "// clean up the state", "rotation", ".", "Started", "="...
// completeRollingBackRotation completes rollback of the rotation and sets it to the standby state
[ "completeRollingBackRotation", "completes", "rollback", "of", "the", "rotation", "and", "sets", "it", "to", "the", "standby", "state" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L604-L622
22,964
gravitational/teleport
lib/auth/rotate.go
completeRotation
func completeRotation(clock clockwork.Clock, ca services.CertAuthority) error { rotation := ca.GetRotation() signingKeys := ca.GetSigningKeys() checkingKeys := ca.GetCheckingKeys() keyPairs := ca.GetTLSKeyPairs() signingKeys = signingKeys[:1] checkingKeys = checkingKeys[:1] keyPairs = keyPairs[:1] rotation.St...
go
func completeRotation(clock clockwork.Clock, ca services.CertAuthority) error { rotation := ca.GetRotation() signingKeys := ca.GetSigningKeys() checkingKeys := ca.GetCheckingKeys() keyPairs := ca.GetTLSKeyPairs() signingKeys = signingKeys[:1] checkingKeys = checkingKeys[:1] keyPairs = keyPairs[:1] rotation.St...
[ "func", "completeRotation", "(", "clock", "clockwork", ".", "Clock", ",", "ca", "services", ".", "CertAuthority", ")", "error", "{", "rotation", ":=", "ca", ".", "GetRotation", "(", ")", "\n", "signingKeys", ":=", "ca", ".", "GetSigningKeys", "(", ")", "\n...
// completeRotation completes the certificate authority rotation.
[ "completeRotation", "completes", "the", "certificate", "authority", "rotation", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/rotate.go#L625-L647
22,965
gravitational/teleport
lib/utils/unpack.go
Extract
func Extract(r io.Reader, dir string) error { tarball := tar.NewReader(r) for { header, err := tarball.Next() if err == io.EOF { break } else if err != nil { return trace.Wrap(err) } if err := extractFile(tarball, header, dir); err != nil { return trace.Wrap(err) } } return nil }
go
func Extract(r io.Reader, dir string) error { tarball := tar.NewReader(r) for { header, err := tarball.Next() if err == io.EOF { break } else if err != nil { return trace.Wrap(err) } if err := extractFile(tarball, header, dir); err != nil { return trace.Wrap(err) } } return nil }
[ "func", "Extract", "(", "r", "io", ".", "Reader", ",", "dir", "string", ")", "error", "{", "tarball", ":=", "tar", ".", "NewReader", "(", "r", ")", "\n\n", "for", "{", "header", ",", "err", ":=", "tarball", ".", "Next", "(", ")", "\n", "if", "err...
// Extract extracts the contents of the specified tarball under dir. // The resulting files and directories are created using the current user context.
[ "Extract", "extracts", "the", "contents", "of", "the", "specified", "tarball", "under", "dir", ".", "The", "resulting", "files", "and", "directories", "are", "created", "using", "the", "current", "user", "context", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/unpack.go#L33-L49
22,966
gravitational/teleport
lib/utils/rand.go
CryptoRandomHex
func CryptoRandomHex(len int) (string, error) { randomBytes := make([]byte, len) if _, err := rand.Reader.Read(randomBytes); err != nil { return "", trace.Wrap(err) } return hex.EncodeToString(randomBytes), nil }
go
func CryptoRandomHex(len int) (string, error) { randomBytes := make([]byte, len) if _, err := rand.Reader.Read(randomBytes); err != nil { return "", trace.Wrap(err) } return hex.EncodeToString(randomBytes), nil }
[ "func", "CryptoRandomHex", "(", "len", "int", ")", "(", "string", ",", "error", ")", "{", "randomBytes", ":=", "make", "(", "[", "]", "byte", ",", "len", ")", "\n", "if", "_", ",", "err", ":=", "rand", ".", "Reader", ".", "Read", "(", "randomBytes"...
// CryptoRandomHex returns hex encoded random string generated with crypto-strong // pseudo random generator of the given bytes
[ "CryptoRandomHex", "returns", "hex", "encoded", "random", "string", "generated", "with", "crypto", "-", "strong", "pseudo", "random", "generator", "of", "the", "given", "bytes" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/rand.go#L30-L36
22,967
gravitational/teleport
lib/utils/rand.go
RandomDuration
func RandomDuration(max time.Duration) time.Duration { randomVal, err := rand.Int(rand.Reader, big.NewInt(int64(max))) if err != nil { return max / 2 } return time.Duration(randomVal.Int64()) }
go
func RandomDuration(max time.Duration) time.Duration { randomVal, err := rand.Int(rand.Reader, big.NewInt(int64(max))) if err != nil { return max / 2 } return time.Duration(randomVal.Int64()) }
[ "func", "RandomDuration", "(", "max", "time", ".", "Duration", ")", "time", ".", "Duration", "{", "randomVal", ",", "err", ":=", "rand", ".", "Int", "(", "rand", ".", "Reader", ",", "big", ".", "NewInt", "(", "int64", "(", "max", ")", ")", ")", "\n...
// RandomDuration returns a duration in a range [0, max)
[ "RandomDuration", "returns", "a", "duration", "in", "a", "range", "[", "0", "max", ")" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/rand.go#L39-L45
22,968
gravitational/teleport
lib/services/suite/suite.go
NewServer
func NewServer(kind, name, addr, namespace string) *services.ServerV2 { return &services.ServerV2{ Kind: kind, Version: services.V2, Metadata: services.Metadata{ Name: name, Namespace: namespace, }, Spec: services.ServerSpecV2{ Addr: addr, PublicAddr: addr, }, } }
go
func NewServer(kind, name, addr, namespace string) *services.ServerV2 { return &services.ServerV2{ Kind: kind, Version: services.V2, Metadata: services.Metadata{ Name: name, Namespace: namespace, }, Spec: services.ServerSpecV2{ Addr: addr, PublicAddr: addr, }, } }
[ "func", "NewServer", "(", "kind", ",", "name", ",", "addr", ",", "namespace", "string", ")", "*", "services", ".", "ServerV2", "{", "return", "&", "services", ".", "ServerV2", "{", "Kind", ":", "kind", ",", "Version", ":", "services", ".", "V2", ",", ...
// NewServer creates a new server resource
[ "NewServer", "creates", "a", "new", "server", "resource" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/suite/suite.go#L302-L315
22,969
gravitational/teleport
lib/services/suite/suite.go
AuthPreference
func (s *ServicesTestSuite) AuthPreference(c *check.C) { ap, err := services.NewAuthPreference(services.AuthPreferenceSpecV2{ Type: "local", SecondFactor: "otp", }) c.Assert(err, check.IsNil) err = s.ConfigS.SetAuthPreference(ap) c.Assert(err, check.IsNil) gotAP, err := s.ConfigS.GetAuthPreference()...
go
func (s *ServicesTestSuite) AuthPreference(c *check.C) { ap, err := services.NewAuthPreference(services.AuthPreferenceSpecV2{ Type: "local", SecondFactor: "otp", }) c.Assert(err, check.IsNil) err = s.ConfigS.SetAuthPreference(ap) c.Assert(err, check.IsNil) gotAP, err := s.ConfigS.GetAuthPreference()...
[ "func", "(", "s", "*", "ServicesTestSuite", ")", "AuthPreference", "(", "c", "*", "check", ".", "C", ")", "{", "ap", ",", "err", ":=", "services", ".", "NewAuthPreference", "(", "services", ".", "AuthPreferenceSpecV2", "{", "Type", ":", "\"", "\"", ",", ...
// AuthPreference tests authentication preference service
[ "AuthPreference", "tests", "authentication", "preference", "service" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/suite/suite.go#L890-L905
22,970
gravitational/teleport
lib/services/suite/suite.go
CollectOptions
func CollectOptions(opts ...SuiteOption) SuiteOptions { var suiteOpts SuiteOptions for _, o := range opts { o(&suiteOpts) } return suiteOpts }
go
func CollectOptions(opts ...SuiteOption) SuiteOptions { var suiteOpts SuiteOptions for _, o := range opts { o(&suiteOpts) } return suiteOpts }
[ "func", "CollectOptions", "(", "opts", "...", "SuiteOption", ")", "SuiteOptions", "{", "var", "suiteOpts", "SuiteOptions", "\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "o", "(", "&", "suiteOpts", ")", "\n", "}", "\n", "return", "suiteOpts", "\...
// CollectOptions collects suite options
[ "CollectOptions", "collects", "suite", "options" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/suite/suite.go#L953-L959
22,971
gravitational/teleport
lib/services/suite/suite.go
ClusterConfig
func (s *ServicesTestSuite) ClusterConfig(c *check.C, opts ...SuiteOption) { config, err := services.NewClusterConfig(services.ClusterConfigSpecV3{ ClientIdleTimeout: services.NewDuration(17 * time.Second), DisconnectExpiredCert: services.NewBool(true), ClusterID: "27", SessionRecording: s...
go
func (s *ServicesTestSuite) ClusterConfig(c *check.C, opts ...SuiteOption) { config, err := services.NewClusterConfig(services.ClusterConfigSpecV3{ ClientIdleTimeout: services.NewDuration(17 * time.Second), DisconnectExpiredCert: services.NewBool(true), ClusterID: "27", SessionRecording: s...
[ "func", "(", "s", "*", "ServicesTestSuite", ")", "ClusterConfig", "(", "c", "*", "check", ".", "C", ",", "opts", "...", "SuiteOption", ")", "{", "config", ",", "err", ":=", "services", ".", "NewClusterConfig", "(", "services", ".", "ClusterConfigSpecV3", "...
// ClusterConfig tests cluster configuration
[ "ClusterConfig", "tests", "cluster", "configuration" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/suite/suite.go#L962-L1023
22,972
gravitational/teleport
lib/services/suite/suite.go
EventsClusterConfig
func (s *ServicesTestSuite) EventsClusterConfig(c *check.C) { testCases := []eventTest{ { name: "Cluster config", kind: services.WatchKind{ Kind: services.KindClusterConfig, }, crud: func() services.Resource { config, err := services.NewClusterConfig(services.ClusterConfigSpecV3{}) c.Assert(e...
go
func (s *ServicesTestSuite) EventsClusterConfig(c *check.C) { testCases := []eventTest{ { name: "Cluster config", kind: services.WatchKind{ Kind: services.KindClusterConfig, }, crud: func() services.Resource { config, err := services.NewClusterConfig(services.ClusterConfigSpecV3{}) c.Assert(e...
[ "func", "(", "s", "*", "ServicesTestSuite", ")", "EventsClusterConfig", "(", "c", "*", "check", ".", "C", ")", "{", "testCases", ":=", "[", "]", "eventTest", "{", "{", "name", ":", "\"", "\"", ",", "kind", ":", "services", ".", "WatchKind", "{", "Kin...
// EventsClusterConfig tests cluster config resource events
[ "EventsClusterConfig", "tests", "cluster", "config", "resource", "events" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/suite/suite.go#L1310-L1357
22,973
gravitational/teleport
lib/services/tunnelconn.go
TunnelConnectionStatus
func TunnelConnectionStatus(clock clockwork.Clock, conn TunnelConnection) string { diff := clock.Now().Sub(conn.GetLastHeartbeat()) if diff < defaults.ReverseTunnelOfflineThreshold { return teleport.RemoteClusterStatusOnline } return teleport.RemoteClusterStatusOffline }
go
func TunnelConnectionStatus(clock clockwork.Clock, conn TunnelConnection) string { diff := clock.Now().Sub(conn.GetLastHeartbeat()) if diff < defaults.ReverseTunnelOfflineThreshold { return teleport.RemoteClusterStatusOnline } return teleport.RemoteClusterStatusOffline }
[ "func", "TunnelConnectionStatus", "(", "clock", "clockwork", ".", "Clock", ",", "conn", "TunnelConnection", ")", "string", "{", "diff", ":=", "clock", ".", "Now", "(", ")", ".", "Sub", "(", "conn", ".", "GetLastHeartbeat", "(", ")", ")", "\n", "if", "dif...
// IsTunnelConnectionStatus returns tunnel connection status based on the last // heartbeat time recorded for a connection
[ "IsTunnelConnectionStatus", "returns", "tunnel", "connection", "status", "based", "on", "the", "last", "heartbeat", "time", "recorded", "for", "a", "connection" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L78-L84
22,974
gravitational/teleport
lib/services/tunnelconn.go
MustCreateTunnelConnection
func MustCreateTunnelConnection(name string, spec TunnelConnectionSpecV2) TunnelConnection { conn, err := NewTunnelConnection(name, spec) if err != nil { panic(err) } return conn }
go
func MustCreateTunnelConnection(name string, spec TunnelConnectionSpecV2) TunnelConnection { conn, err := NewTunnelConnection(name, spec) if err != nil { panic(err) } return conn }
[ "func", "MustCreateTunnelConnection", "(", "name", "string", ",", "spec", "TunnelConnectionSpecV2", ")", "TunnelConnection", "{", "conn", ",", "err", ":=", "NewTunnelConnection", "(", "name", ",", "spec", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(",...
// MustCreateTunnelConnection returns new connection from V2 spec or panics if // parameters are incorrect
[ "MustCreateTunnelConnection", "returns", "new", "connection", "from", "V2", "spec", "or", "panics", "if", "parameters", "are", "incorrect" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L88-L94
22,975
gravitational/teleport
lib/services/tunnelconn.go
NewTunnelConnection
func NewTunnelConnection(name string, spec TunnelConnectionSpecV2) (TunnelConnection, error) { conn := &TunnelConnectionV2{ Kind: KindTunnelConnection, SubKind: spec.ClusterName, Version: V2, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, } if err := conn.Chec...
go
func NewTunnelConnection(name string, spec TunnelConnectionSpecV2) (TunnelConnection, error) { conn := &TunnelConnectionV2{ Kind: KindTunnelConnection, SubKind: spec.ClusterName, Version: V2, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, } if err := conn.Chec...
[ "func", "NewTunnelConnection", "(", "name", "string", ",", "spec", "TunnelConnectionSpecV2", ")", "(", "TunnelConnection", ",", "error", ")", "{", "conn", ":=", "&", "TunnelConnectionV2", "{", "Kind", ":", "KindTunnelConnection", ",", "SubKind", ":", "spec", "."...
// NewTunnelConnection returns new connection from V2 spec
[ "NewTunnelConnection", "returns", "new", "connection", "from", "V2", "spec" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L97-L112
22,976
gravitational/teleport
lib/services/tunnelconn.go
String
func (r *TunnelConnectionV2) String() string { return fmt.Sprintf("TunnelConnection(name=%v, type=%v, cluster=%v, proxy=%v)", r.Metadata.Name, r.Spec.Type, r.Spec.ClusterName, r.Spec.ProxyName) }
go
func (r *TunnelConnectionV2) String() string { return fmt.Sprintf("TunnelConnection(name=%v, type=%v, cluster=%v, proxy=%v)", r.Metadata.Name, r.Spec.Type, r.Spec.ClusterName, r.Spec.ProxyName) }
[ "func", "(", "r", "*", "TunnelConnectionV2", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "Metadata", ".", "Name", ",", "r", ".", "Spec", ".", "Type", ",", "r", ".", "Spec", ".", "Cluste...
// String returns user-friendly description of this connection
[ "String", "returns", "user", "-", "friendly", "description", "of", "this", "connection" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L151-L154
22,977
gravitational/teleport
lib/services/tunnelconn.go
SetLastHeartbeat
func (r *TunnelConnectionV2) SetLastHeartbeat(tm time.Time) { r.Spec.LastHeartbeat = tm }
go
func (r *TunnelConnectionV2) SetLastHeartbeat(tm time.Time) { r.Spec.LastHeartbeat = tm }
[ "func", "(", "r", "*", "TunnelConnectionV2", ")", "SetLastHeartbeat", "(", "tm", "time", ".", "Time", ")", "{", "r", ".", "Spec", ".", "LastHeartbeat", "=", "tm", "\n", "}" ]
// SetLastHeartbeat sets last heartbeat time
[ "SetLastHeartbeat", "sets", "last", "heartbeat", "time" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L221-L223
22,978
gravitational/teleport
lib/services/tunnelconn.go
UnmarshalTunnelConnection
func UnmarshalTunnelConnection(data []byte, opts ...MarshalOption) (TunnelConnection, error) { if len(data) == 0 { return nil, trace.BadParameter("missing tunnel connection data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(d...
go
func UnmarshalTunnelConnection(data []byte, opts ...MarshalOption) (TunnelConnection, error) { if len(data) == 0 { return nil, trace.BadParameter("missing tunnel connection data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(d...
[ "func", "UnmarshalTunnelConnection", "(", "data", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "TunnelConnection", ",", "error", ")", "{", "if", "len", "(", "data", ")", "==", "0", "{", "return", "nil", ",", "trace", ".", "BadParamete...
// UnmarshalTunnelConnection unmarshals reverse tunnel from JSON or YAML, // sets defaults and checks the schema
[ "UnmarshalTunnelConnection", "unmarshals", "reverse", "tunnel", "from", "JSON", "or", "YAML", "sets", "defaults", "and", "checks", "the", "schema" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L275-L314
22,979
gravitational/teleport
lib/services/tunnelconn.go
MarshalTunnelConnection
func MarshalTunnelConnection(rt TunnelConnection, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := rt.(type) { case *TunnelConnectionV2: if !cfg.PreserveResourceID { // avoid modifying the original object // to prev...
go
func MarshalTunnelConnection(rt TunnelConnection, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := rt.(type) { case *TunnelConnectionV2: if !cfg.PreserveResourceID { // avoid modifying the original object // to prev...
[ "func", "MarshalTunnelConnection", "(", "rt", "TunnelConnection", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", "\n", "if", "err", "!=", "nil", "{", ...
// MarshalTunnelConnection marshals tunnel connection
[ "MarshalTunnelConnection", "marshals", "tunnel", "connection" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/tunnelconn.go#L317-L335
22,980
gravitational/teleport
tool/tctl/common/status_command.go
Initialize
func (c *StatusCommand) Initialize(app *kingpin.Application, config *service.Config) { c.config = config c.status = app.Command("status", "Report cluster status") }
go
func (c *StatusCommand) Initialize(app *kingpin.Application, config *service.Config) { c.config = config c.status = app.Command("status", "Report cluster status") }
[ "func", "(", "c", "*", "StatusCommand", ")", "Initialize", "(", "app", "*", "kingpin", ".", "Application", ",", "config", "*", "service", ".", "Config", ")", "{", "c", ".", "config", "=", "config", "\n", "c", ".", "status", "=", "app", ".", "Command"...
// Initialize allows StatusCommand to plug itself into the CLI parser.
[ "Initialize", "allows", "StatusCommand", "to", "plug", "itself", "into", "the", "CLI", "parser", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/status_command.go#L41-L44
22,981
gravitational/teleport
tool/tctl/common/status_command.go
Status
func (c *StatusCommand) Status(client auth.ClientI) error { clusterNameResource, err := client.GetClusterName() if err != nil { return trace.Wrap(err) } clusterName := clusterNameResource.GetClusterName() hostCAs, err := client.GetCertAuthorities(services.HostCA, false) if err != nil { return trace.Wrap(err)...
go
func (c *StatusCommand) Status(client auth.ClientI) error { clusterNameResource, err := client.GetClusterName() if err != nil { return trace.Wrap(err) } clusterName := clusterNameResource.GetClusterName() hostCAs, err := client.GetCertAuthorities(services.HostCA, false) if err != nil { return trace.Wrap(err)...
[ "func", "(", "c", "*", "StatusCommand", ")", "Status", "(", "client", "auth", ".", "ClientI", ")", "error", "{", "clusterNameResource", ",", "err", ":=", "client", ".", "GetClusterName", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ...
// Status is called to execute "status" CLI command.
[ "Status", "is", "called", "to", "execute", "status", "CLI", "command", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/status_command.go#L58-L126
22,982
gravitational/teleport
lib/auth/trustedcluster.go
DeleteTrustedCluster
func (a *AuthServer) DeleteTrustedCluster(name string) error { err := a.DeleteCertAuthority(services.CertAuthID{Type: services.HostCA, DomainName: name}) if err != nil { if !trace.IsNotFound(err) { return trace.Wrap(err) } } err = a.DeleteCertAuthority(services.CertAuthID{Type: services.UserCA, DomainName: ...
go
func (a *AuthServer) DeleteTrustedCluster(name string) error { err := a.DeleteCertAuthority(services.CertAuthID{Type: services.HostCA, DomainName: name}) if err != nil { if !trace.IsNotFound(err) { return trace.Wrap(err) } } err = a.DeleteCertAuthority(services.CertAuthID{Type: services.UserCA, DomainName: ...
[ "func", "(", "a", "*", "AuthServer", ")", "DeleteTrustedCluster", "(", "name", "string", ")", "error", "{", "err", ":=", "a", ".", "DeleteCertAuthority", "(", "services", ".", "CertAuthID", "{", "Type", ":", "services", ".", "HostCA", ",", "DomainName", ":...
// DeleteTrustedCluster removes services.CertAuthority, services.ReverseTunnel, // and services.TrustedCluster resources.
[ "DeleteTrustedCluster", "removes", "services", ".", "CertAuthority", "services", ".", "ReverseTunnel", "and", "services", ".", "TrustedCluster", "resources", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/trustedcluster.go#L171-L199
22,983
gravitational/teleport
lib/auth/trustedcluster.go
DeleteRemoteCluster
func (a *AuthServer) DeleteRemoteCluster(clusterName string) error { // To make sure remote cluster exists - to protect against random // clusterName requests (e.g. when clusterName is set to local cluster name) _, err := a.Presence.GetRemoteCluster(clusterName) if err != nil { return trace.Wrap(err) } // delet...
go
func (a *AuthServer) DeleteRemoteCluster(clusterName string) error { // To make sure remote cluster exists - to protect against random // clusterName requests (e.g. when clusterName is set to local cluster name) _, err := a.Presence.GetRemoteCluster(clusterName) if err != nil { return trace.Wrap(err) } // delet...
[ "func", "(", "a", "*", "AuthServer", ")", "DeleteRemoteCluster", "(", "clusterName", "string", ")", "error", "{", "// To make sure remote cluster exists - to protect against random", "// clusterName requests (e.g. when clusterName is set to local cluster name)", "_", ",", "err", ...
// DeleteRemoteCluster deletes remote cluster resource, all certificate authorities // associated with it
[ "DeleteRemoteCluster", "deletes", "remote", "cluster", "resource", "all", "certificate", "authorities", "associated", "with", "it" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/trustedcluster.go#L293-L325
22,984
gravitational/teleport
lib/auth/trustedcluster.go
GetRemoteCluster
func (a *AuthServer) GetRemoteCluster(clusterName string) (services.RemoteCluster, error) { // To make sure remote cluster exists - to protect against random // clusterName requests (e.g. when clusterName is set to local cluster name) remoteCluster, err := a.Presence.GetRemoteCluster(clusterName) if err != nil { ...
go
func (a *AuthServer) GetRemoteCluster(clusterName string) (services.RemoteCluster, error) { // To make sure remote cluster exists - to protect against random // clusterName requests (e.g. when clusterName is set to local cluster name) remoteCluster, err := a.Presence.GetRemoteCluster(clusterName) if err != nil { ...
[ "func", "(", "a", "*", "AuthServer", ")", "GetRemoteCluster", "(", "clusterName", "string", ")", "(", "services", ".", "RemoteCluster", ",", "error", ")", "{", "// To make sure remote cluster exists - to protect against random", "// clusterName requests (e.g. when clusterName...
// GetRemoteCluster returns remote cluster by name
[ "GetRemoteCluster", "returns", "remote", "cluster", "by", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/trustedcluster.go#L328-L339
22,985
gravitational/teleport
lib/auth/trustedcluster.go
GetRemoteClusters
func (a *AuthServer) GetRemoteClusters(opts ...services.MarshalOption) ([]services.RemoteCluster, error) { // To make sure remote cluster exists - to protect against random // clusterName requests (e.g. when clusterName is set to local cluster name) remoteClusters, err := a.Presence.GetRemoteClusters(opts...) if er...
go
func (a *AuthServer) GetRemoteClusters(opts ...services.MarshalOption) ([]services.RemoteCluster, error) { // To make sure remote cluster exists - to protect against random // clusterName requests (e.g. when clusterName is set to local cluster name) remoteClusters, err := a.Presence.GetRemoteClusters(opts...) if er...
[ "func", "(", "a", "*", "AuthServer", ")", "GetRemoteClusters", "(", "opts", "...", "services", ".", "MarshalOption", ")", "(", "[", "]", "services", ".", "RemoteCluster", ",", "error", ")", "{", "// To make sure remote cluster exists - to protect against random", "/...
// GetRemoteClusters returns remote clusters with updated statuses
[ "GetRemoteClusters", "returns", "remote", "clusters", "with", "updated", "statuses" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/trustedcluster.go#L357-L370
22,986
gravitational/teleport
lib/auth/trustedcluster.go
activateCertAuthority
func (a *AuthServer) activateCertAuthority(t services.TrustedCluster) error { err := a.ActivateCertAuthority(services.CertAuthID{Type: services.UserCA, DomainName: t.GetName()}) if err != nil { return trace.Wrap(err) } return trace.Wrap(a.ActivateCertAuthority(services.CertAuthID{Type: services.HostCA, DomainNam...
go
func (a *AuthServer) activateCertAuthority(t services.TrustedCluster) error { err := a.ActivateCertAuthority(services.CertAuthID{Type: services.UserCA, DomainName: t.GetName()}) if err != nil { return trace.Wrap(err) } return trace.Wrap(a.ActivateCertAuthority(services.CertAuthID{Type: services.HostCA, DomainNam...
[ "func", "(", "a", "*", "AuthServer", ")", "activateCertAuthority", "(", "t", "services", ".", "TrustedCluster", ")", "error", "{", "err", ":=", "a", ".", "ActivateCertAuthority", "(", "services", ".", "CertAuthID", "{", "Type", ":", "services", ".", "UserCA"...
// activateCertAuthority will activate both the user and host certificate // authority given in the services.TrustedCluster resource.
[ "activateCertAuthority", "will", "activate", "both", "the", "user", "and", "host", "certificate", "authority", "given", "in", "the", "services", ".", "TrustedCluster", "resource", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/trustedcluster.go#L599-L606
22,987
gravitational/teleport
lib/auth/trustedcluster.go
createReverseTunnel
func (a *AuthServer) createReverseTunnel(t services.TrustedCluster) error { reverseTunnel := services.NewReverseTunnel( t.GetName(), []string{t.GetReverseTunnelAddress()}, ) return trace.Wrap(a.UpsertReverseTunnel(reverseTunnel)) }
go
func (a *AuthServer) createReverseTunnel(t services.TrustedCluster) error { reverseTunnel := services.NewReverseTunnel( t.GetName(), []string{t.GetReverseTunnelAddress()}, ) return trace.Wrap(a.UpsertReverseTunnel(reverseTunnel)) }
[ "func", "(", "a", "*", "AuthServer", ")", "createReverseTunnel", "(", "t", "services", ".", "TrustedCluster", ")", "error", "{", "reverseTunnel", ":=", "services", ".", "NewReverseTunnel", "(", "t", ".", "GetName", "(", ")", ",", "[", "]", "string", "{", ...
// createReverseTunnel will create a services.ReverseTunnel givenin the // services.TrustedCluster resource.
[ "createReverseTunnel", "will", "create", "a", "services", ".", "ReverseTunnel", "givenin", "the", "services", ".", "TrustedCluster", "resource", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/trustedcluster.go#L621-L627
22,988
gravitational/teleport
lib/services/local/configuration.go
DeleteClusterName
func (s *ClusterConfigurationService) DeleteClusterName() error { err := s.Delete(context.TODO(), backend.Key(clusterConfigPrefix, namePrefix)) if err != nil { if trace.IsNotFound(err) { return trace.NotFound("cluster configuration not found") } return trace.Wrap(err) } return nil }
go
func (s *ClusterConfigurationService) DeleteClusterName() error { err := s.Delete(context.TODO(), backend.Key(clusterConfigPrefix, namePrefix)) if err != nil { if trace.IsNotFound(err) { return trace.NotFound("cluster configuration not found") } return trace.Wrap(err) } return nil }
[ "func", "(", "s", "*", "ClusterConfigurationService", ")", "DeleteClusterName", "(", ")", "error", "{", "err", ":=", "s", ".", "Delete", "(", "context", ".", "TODO", "(", ")", ",", "backend", ".", "Key", "(", "clusterConfigPrefix", ",", "namePrefix", ")", ...
// DeleteClusterName deletes services.ClusterName from the backend.
[ "DeleteClusterName", "deletes", "services", ".", "ClusterName", "from", "the", "backend", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/configuration.go#L54-L63
22,989
gravitational/teleport
lib/services/local/configuration.go
SetClusterName
func (s *ClusterConfigurationService) SetClusterName(c services.ClusterName) error { value, err := services.GetClusterNameMarshaler().Marshal(c) if err != nil { return trace.Wrap(err) } _, err = s.Create(context.TODO(), backend.Item{ Key: backend.Key(clusterConfigPrefix, namePrefix), Value: value, Ex...
go
func (s *ClusterConfigurationService) SetClusterName(c services.ClusterName) error { value, err := services.GetClusterNameMarshaler().Marshal(c) if err != nil { return trace.Wrap(err) } _, err = s.Create(context.TODO(), backend.Item{ Key: backend.Key(clusterConfigPrefix, namePrefix), Value: value, Ex...
[ "func", "(", "s", "*", "ClusterConfigurationService", ")", "SetClusterName", "(", "c", "services", ".", "ClusterName", ")", "error", "{", "value", ",", "err", ":=", "services", ".", "GetClusterNameMarshaler", "(", ")", ".", "Marshal", "(", "c", ")", "\n", ...
// SetClusterName sets the name of the cluster in the backend. SetClusterName // can only be called once on a cluster after which it will return trace.AlreadyExists.
[ "SetClusterName", "sets", "the", "name", "of", "the", "cluster", "in", "the", "backend", ".", "SetClusterName", "can", "only", "be", "called", "once", "on", "a", "cluster", "after", "which", "it", "will", "return", "trace", ".", "AlreadyExists", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/configuration.go#L67-L83
22,990
gravitational/teleport
lib/services/local/configuration.go
GetAuthPreference
func (s *ClusterConfigurationService) GetAuthPreference() (services.AuthPreference, error) { item, err := s.Get(context.TODO(), backend.Key(authPrefix, preferencePrefix, generalPrefix)) if err != nil { if trace.IsNotFound(err) { return nil, trace.NotFound("authentication preference not found") } return nil, ...
go
func (s *ClusterConfigurationService) GetAuthPreference() (services.AuthPreference, error) { item, err := s.Get(context.TODO(), backend.Key(authPrefix, preferencePrefix, generalPrefix)) if err != nil { if trace.IsNotFound(err) { return nil, trace.NotFound("authentication preference not found") } return nil, ...
[ "func", "(", "s", "*", "ClusterConfigurationService", ")", "GetAuthPreference", "(", ")", "(", "services", ".", "AuthPreference", ",", "error", ")", "{", "item", ",", "err", ":=", "s", ".", "Get", "(", "context", ".", "TODO", "(", ")", ",", "backend", ...
// GetAuthPreference fetches the cluster authentication preferences // from the backend and return them.
[ "GetAuthPreference", "fetches", "the", "cluster", "authentication", "preferences", "from", "the", "backend", "and", "return", "them", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/configuration.go#L151-L161
22,991
gravitational/teleport
lib/services/local/configuration.go
SetAuthPreference
func (s *ClusterConfigurationService) SetAuthPreference(preferences services.AuthPreference) error { value, err := services.GetAuthPreferenceMarshaler().Marshal(preferences) if err != nil { return trace.Wrap(err) } item := backend.Item{ Key: backend.Key(authPrefix, preferencePrefix, generalPrefix), Value: ...
go
func (s *ClusterConfigurationService) SetAuthPreference(preferences services.AuthPreference) error { value, err := services.GetAuthPreferenceMarshaler().Marshal(preferences) if err != nil { return trace.Wrap(err) } item := backend.Item{ Key: backend.Key(authPrefix, preferencePrefix, generalPrefix), Value: ...
[ "func", "(", "s", "*", "ClusterConfigurationService", ")", "SetAuthPreference", "(", "preferences", "services", ".", "AuthPreference", ")", "error", "{", "value", ",", "err", ":=", "services", ".", "GetAuthPreferenceMarshaler", "(", ")", ".", "Marshal", "(", "pr...
// SetAuthPreference sets the cluster authentication preferences // on the backend.
[ "SetAuthPreference", "sets", "the", "cluster", "authentication", "preferences", "on", "the", "backend", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/configuration.go#L165-L183
22,992
gravitational/teleport
lib/services/local/configuration.go
DeleteClusterConfig
func (s *ClusterConfigurationService) DeleteClusterConfig() error { err := s.Delete(context.TODO(), backend.Key(clusterConfigPrefix, generalPrefix)) if err != nil { if trace.IsNotFound(err) { return trace.NotFound("cluster configuration not found") } return trace.Wrap(err) } return nil }
go
func (s *ClusterConfigurationService) DeleteClusterConfig() error { err := s.Delete(context.TODO(), backend.Key(clusterConfigPrefix, generalPrefix)) if err != nil { if trace.IsNotFound(err) { return trace.NotFound("cluster configuration not found") } return trace.Wrap(err) } return nil }
[ "func", "(", "s", "*", "ClusterConfigurationService", ")", "DeleteClusterConfig", "(", ")", "error", "{", "err", ":=", "s", ".", "Delete", "(", "context", ".", "TODO", "(", ")", ",", "backend", ".", "Key", "(", "clusterConfigPrefix", ",", "generalPrefix", ...
// DeleteClusterConfig deletes services.ClusterConfig from the backend.
[ "DeleteClusterConfig", "deletes", "services", ".", "ClusterConfig", "from", "the", "backend", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/configuration.go#L200-L209
22,993
gravitational/teleport
lib/services/local/configuration.go
SetClusterConfig
func (s *ClusterConfigurationService) SetClusterConfig(c services.ClusterConfig) error { value, err := services.GetClusterConfigMarshaler().Marshal(c) if err != nil { return trace.Wrap(err) } item := backend.Item{ Key: backend.Key(clusterConfigPrefix, generalPrefix), Value: value, ID: c.GetResourceID(...
go
func (s *ClusterConfigurationService) SetClusterConfig(c services.ClusterConfig) error { value, err := services.GetClusterConfigMarshaler().Marshal(c) if err != nil { return trace.Wrap(err) } item := backend.Item{ Key: backend.Key(clusterConfigPrefix, generalPrefix), Value: value, ID: c.GetResourceID(...
[ "func", "(", "s", "*", "ClusterConfigurationService", ")", "SetClusterConfig", "(", "c", "services", ".", "ClusterConfig", ")", "error", "{", "value", ",", "err", ":=", "services", ".", "GetClusterConfigMarshaler", "(", ")", ".", "Marshal", "(", "c", ")", "\...
// SetClusterConfig sets services.ClusterConfig on the backend.
[ "SetClusterConfig", "sets", "services", ".", "ClusterConfig", "on", "the", "backend", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/configuration.go#L212-L230
22,994
gravitational/teleport
lib/httplib/httpheaders.go
SetNoCacheHeaders
func SetNoCacheHeaders(h http.Header) { h.Set("Cache-Control", "no-cache, no-store, must-revalidate") h.Set("Pragma", "no-cache") h.Set("Expires", "0") }
go
func SetNoCacheHeaders(h http.Header) { h.Set("Cache-Control", "no-cache, no-store, must-revalidate") h.Set("Pragma", "no-cache") h.Set("Expires", "0") }
[ "func", "SetNoCacheHeaders", "(", "h", "http", ".", "Header", ")", "{", "h", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "h", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "h", ".", "Set", "(", "\"", "\"", ",", "\"",...
// SetNoCacheHeaders tells proxies and browsers do not cache the content
[ "SetNoCacheHeaders", "tells", "proxies", "and", "browsers", "do", "not", "cache", "the", "content" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/httpheaders.go#L27-L31
22,995
gravitational/teleport
lib/httplib/httpheaders.go
SetIndexHTMLHeaders
func SetIndexHTMLHeaders(h http.Header) { SetNoCacheHeaders(h) SetSameOriginIFrame(h) SetNoSniff(h) // X-Frame-Options indicates that the page can only be displayed in iframe on the same origin as the page itself h.Set("X-Frame-Options", "SAMEORIGIN") // X-XSS-Protection is a feature of Internet Explorer, Chrom...
go
func SetIndexHTMLHeaders(h http.Header) { SetNoCacheHeaders(h) SetSameOriginIFrame(h) SetNoSniff(h) // X-Frame-Options indicates that the page can only be displayed in iframe on the same origin as the page itself h.Set("X-Frame-Options", "SAMEORIGIN") // X-XSS-Protection is a feature of Internet Explorer, Chrom...
[ "func", "SetIndexHTMLHeaders", "(", "h", "http", ".", "Header", ")", "{", "SetNoCacheHeaders", "(", "h", ")", "\n", "SetSameOriginIFrame", "(", "h", ")", "\n", "SetNoSniff", "(", "h", ")", "\n\n", "// X-Frame-Options indicates that the page can only be displayed in if...
// SetIndexHTMLHeaders sets security header flags for main index.html page
[ "SetIndexHTMLHeaders", "sets", "security", "header", "flags", "for", "main", "index", ".", "html", "page" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/httpheaders.go#L40-L70
22,996
gravitational/teleport
lib/kube/proxy/roundtrip.go
NewSpdyRoundTripperWithDialer
func NewSpdyRoundTripperWithDialer(cfg roundTripperConfig) *SpdyRoundTripper { return &SpdyRoundTripper{tlsConfig: cfg.tlsConfig, followRedirects: cfg.followRedirects, dialWithContext: cfg.dial, ctx: cfg.ctx, authCtx: cfg.authCtx, bearerToken: cfg.bearerToken} }
go
func NewSpdyRoundTripperWithDialer(cfg roundTripperConfig) *SpdyRoundTripper { return &SpdyRoundTripper{tlsConfig: cfg.tlsConfig, followRedirects: cfg.followRedirects, dialWithContext: cfg.dial, ctx: cfg.ctx, authCtx: cfg.authCtx, bearerToken: cfg.bearerToken} }
[ "func", "NewSpdyRoundTripperWithDialer", "(", "cfg", "roundTripperConfig", ")", "*", "SpdyRoundTripper", "{", "return", "&", "SpdyRoundTripper", "{", "tlsConfig", ":", "cfg", ".", "tlsConfig", ",", "followRedirects", ":", "cfg", ".", "followRedirects", ",", "dialWit...
// NewSpdyRoundTripperWithDialer creates a new SpdyRoundTripper that will use // the specified tlsConfig. This function is mostly meant for unit tests.
[ "NewSpdyRoundTripperWithDialer", "creates", "a", "new", "SpdyRoundTripper", "that", "will", "use", "the", "specified", "tlsConfig", ".", "This", "function", "is", "mostly", "meant", "for", "unit", "tests", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/roundtrip.go#L99-L101
22,997
gravitational/teleport
lib/kube/proxy/roundtrip.go
dial
func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) { return s.dialWithoutProxy(req.URL) }
go
func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) { return s.dialWithoutProxy(req.URL) }
[ "func", "(", "s", "*", "SpdyRoundTripper", ")", "dial", "(", "req", "*", "http", ".", "Request", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "return", "s", ".", "dialWithoutProxy", "(", "req", ".", "URL", ")", "\n", "}" ]
// dial dials the host specified by req
[ "dial", "dials", "the", "host", "specified", "by", "req" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/roundtrip.go#L125-L127
22,998
gravitational/teleport
lib/srv/authhandlers.go
CreateIdentityContext
func (h *AuthHandlers) CreateIdentityContext(sconn *ssh.ServerConn) (IdentityContext, error) { identity := IdentityContext{ TeleportUser: sconn.Permissions.Extensions[utils.CertTeleportUser], Certificate: []byte(sconn.Permissions.Extensions[utils.CertTeleportUserCertificate]), Login: sconn.User(), } c...
go
func (h *AuthHandlers) CreateIdentityContext(sconn *ssh.ServerConn) (IdentityContext, error) { identity := IdentityContext{ TeleportUser: sconn.Permissions.Extensions[utils.CertTeleportUser], Certificate: []byte(sconn.Permissions.Extensions[utils.CertTeleportUserCertificate]), Login: sconn.User(), } c...
[ "func", "(", "h", "*", "AuthHandlers", ")", "CreateIdentityContext", "(", "sconn", "*", "ssh", ".", "ServerConn", ")", "(", "IdentityContext", ",", "error", ")", "{", "identity", ":=", "IdentityContext", "{", "TeleportUser", ":", "sconn", ".", "Permissions", ...
// BuildIdentityContext returns an IdentityContext populated with information // about the logged in user on the connection.
[ "BuildIdentityContext", "returns", "an", "IdentityContext", "populated", "with", "information", "about", "the", "logged", "in", "user", "on", "the", "connection", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/authhandlers.go#L59-L92
22,999
gravitational/teleport
lib/srv/authhandlers.go
CheckAgentForward
func (h *AuthHandlers) CheckAgentForward(ctx *ServerContext) error { if err := ctx.Identity.RoleSet.CheckAgentForward(ctx.Identity.Login); err != nil { return trace.Wrap(err) } return nil }
go
func (h *AuthHandlers) CheckAgentForward(ctx *ServerContext) error { if err := ctx.Identity.RoleSet.CheckAgentForward(ctx.Identity.Login); err != nil { return trace.Wrap(err) } return nil }
[ "func", "(", "h", "*", "AuthHandlers", ")", "CheckAgentForward", "(", "ctx", "*", "ServerContext", ")", "error", "{", "if", "err", ":=", "ctx", ".", "Identity", ".", "RoleSet", ".", "CheckAgentForward", "(", "ctx", ".", "Identity", ".", "Login", ")", ";"...
// CheckAgentForward checks if agent forwarding is allowed for the users RoleSet.
[ "CheckAgentForward", "checks", "if", "agent", "forwarding", "is", "allowed", "for", "the", "users", "RoleSet", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/authhandlers.go#L95-L101