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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gravitational/teleport | lib/utils/utils.go | Deduplicate | func Deduplicate(in []string) []string {
if len(in) == 0 {
return in
}
out := make([]string, 0, len(in))
seen := make(map[string]bool, len(in))
for _, val := range in {
if _, ok := seen[val]; !ok {
out = append(out, val)
seen[val] = true
}
}
return out
} | go | func Deduplicate(in []string) []string {
if len(in) == 0 {
return in
}
out := make([]string, 0, len(in))
seen := make(map[string]bool, len(in))
for _, val := range in {
if _, ok := seen[val]; !ok {
out = append(out, val)
seen[val] = true
}
}
return out
} | [
"func",
"Deduplicate",
"(",
"in",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"in",
")",
"==",
"0",
"{",
"return",
"in",
"\n",
"}",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"in",
... | // Deduplicate deduplicates list of strings | [
"Deduplicate",
"deduplicates",
"list",
"of",
"strings"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/utils.go#L394-L407 | train |
gravitational/teleport | lib/utils/utils.go | SliceContainsStr | func SliceContainsStr(slice []string, value string) bool {
for i := range slice {
if slice[i] == value {
return true
}
}
return false
} | go | func SliceContainsStr(slice []string, value string) bool {
for i := range slice {
if slice[i] == value {
return true
}
}
return false
} | [
"func",
"SliceContainsStr",
"(",
"slice",
"[",
"]",
"string",
",",
"value",
"string",
")",
"bool",
"{",
"for",
"i",
":=",
"range",
"slice",
"{",
"if",
"slice",
"[",
"i",
"]",
"==",
"value",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return... | // SliceContainsStr returns 'true' if the slice contains the given value | [
"SliceContainsStr",
"returns",
"true",
"if",
"the",
"slice",
"contains",
"the",
"given",
"value"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/utils.go#L410-L417 | train |
gravitational/teleport | lib/utils/utils.go | RemoveFromSlice | func RemoveFromSlice(slice []string, values ...string) []string {
output := make([]string, 0, len(slice))
remove := make(map[string]bool)
for _, value := range values {
remove[value] = true
}
for _, s := range slice {
_, ok := remove[s]
if ok {
continue
}
output = append(output, s)
}
return outpu... | go | func RemoveFromSlice(slice []string, values ...string) []string {
output := make([]string, 0, len(slice))
remove := make(map[string]bool)
for _, value := range values {
remove[value] = true
}
for _, s := range slice {
_, ok := remove[s]
if ok {
continue
}
output = append(output, s)
}
return outpu... | [
"func",
"RemoveFromSlice",
"(",
"slice",
"[",
"]",
"string",
",",
"values",
"...",
"string",
")",
"[",
"]",
"string",
"{",
"output",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"slice",
")",
")",
"\n\n",
"remove",
":=",
"make"... | // RemoveFromSlice makes a copy of the slice and removes the passed in values from the copy. | [
"RemoveFromSlice",
"makes",
"a",
"copy",
"of",
"the",
"slice",
"and",
"removes",
"the",
"passed",
"in",
"values",
"from",
"the",
"copy",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/utils.go#L420-L437 | train |
gravitational/teleport | lib/utils/utils.go | CheckCertificateFormatFlag | func CheckCertificateFormatFlag(s string) (string, error) {
switch s {
case teleport.CertificateFormatStandard, teleport.CertificateFormatOldSSH, teleport.CertificateFormatUnspecified:
return s, nil
default:
return "", trace.BadParameter("invalid certificate format parameter: %q", s)
}
} | go | func CheckCertificateFormatFlag(s string) (string, error) {
switch s {
case teleport.CertificateFormatStandard, teleport.CertificateFormatOldSSH, teleport.CertificateFormatUnspecified:
return s, nil
default:
return "", trace.BadParameter("invalid certificate format parameter: %q", s)
}
} | [
"func",
"CheckCertificateFormatFlag",
"(",
"s",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"switch",
"s",
"{",
"case",
"teleport",
".",
"CertificateFormatStandard",
",",
"teleport",
".",
"CertificateFormatOldSSH",
",",
"teleport",
".",
"CertificateForma... | // CheckCertificateFormatFlag checks if the certificate format is valid. | [
"CheckCertificateFormatFlag",
"checks",
"if",
"the",
"certificate",
"format",
"is",
"valid",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/utils.go#L440-L447 | train |
gravitational/teleport | lib/utils/utils.go | Addrs | func (s Strings) Addrs(defaultPort int) ([]NetAddr, error) {
addrs := make([]NetAddr, len(s))
for i, val := range s {
addr, err := ParseHostPortAddr(val, defaultPort)
if err != nil {
return nil, trace.Wrap(err)
}
addrs[i] = *addr
}
return addrs, nil
} | go | func (s Strings) Addrs(defaultPort int) ([]NetAddr, error) {
addrs := make([]NetAddr, len(s))
for i, val := range s {
addr, err := ParseHostPortAddr(val, defaultPort)
if err != nil {
return nil, trace.Wrap(err)
}
addrs[i] = *addr
}
return addrs, nil
} | [
"func",
"(",
"s",
"Strings",
")",
"Addrs",
"(",
"defaultPort",
"int",
")",
"(",
"[",
"]",
"NetAddr",
",",
"error",
")",
"{",
"addrs",
":=",
"make",
"(",
"[",
"]",
"NetAddr",
",",
"len",
"(",
"s",
")",
")",
"\n",
"for",
"i",
",",
"val",
":=",
... | // Addrs returns strings list converted to address list | [
"Addrs",
"returns",
"strings",
"list",
"converted",
"to",
"address",
"list"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/utils.go#L514-L524 | train |
gravitational/teleport | tool/tctl/common/tctl.go | connectToAuthService | func connectToAuthService(cfg *service.Config) (client auth.ClientI, err error) {
// connect to the local auth server by default:
cfg.Auth.Enabled = true
if len(cfg.AuthServers) == 0 {
cfg.AuthServers = []utils.NetAddr{
*defaults.AuthConnectAddr(),
}
}
// read the host SSH keys and use them to open an SSH c... | go | func connectToAuthService(cfg *service.Config) (client auth.ClientI, err error) {
// connect to the local auth server by default:
cfg.Auth.Enabled = true
if len(cfg.AuthServers) == 0 {
cfg.AuthServers = []utils.NetAddr{
*defaults.AuthConnectAddr(),
}
}
// read the host SSH keys and use them to open an SSH c... | [
"func",
"connectToAuthService",
"(",
"cfg",
"*",
"service",
".",
"Config",
")",
"(",
"client",
"auth",
".",
"ClientI",
",",
"err",
"error",
")",
"{",
"// connect to the local auth server by default:",
"cfg",
".",
"Auth",
".",
"Enabled",
"=",
"true",
"\n",
"if"... | // connectToAuthService creates a valid client connection to the auth service | [
"connectToAuthService",
"creates",
"a",
"valid",
"client",
"connection",
"to",
"the",
"auth",
"service"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/tctl.go#L128-L163 | train |
gravitational/teleport | tool/tctl/common/tctl.go | applyConfig | func applyConfig(ccf *GlobalCLIFlags, cfg *service.Config) error {
// load /etc/teleport.yaml and apply it's values:
fileConf, err := config.ReadConfigFile(ccf.ConfigFile)
if err != nil {
return trace.Wrap(err)
}
// if configuration is passed as an environment variable,
// try to decode it and override the conf... | go | func applyConfig(ccf *GlobalCLIFlags, cfg *service.Config) error {
// load /etc/teleport.yaml and apply it's values:
fileConf, err := config.ReadConfigFile(ccf.ConfigFile)
if err != nil {
return trace.Wrap(err)
}
// if configuration is passed as an environment variable,
// try to decode it and override the conf... | [
"func",
"applyConfig",
"(",
"ccf",
"*",
"GlobalCLIFlags",
",",
"cfg",
"*",
"service",
".",
"Config",
")",
"error",
"{",
"// load /etc/teleport.yaml and apply it's values:",
"fileConf",
",",
"err",
":=",
"config",
".",
"ReadConfigFile",
"(",
"ccf",
".",
"ConfigFile... | // applyConfig takes configuration values from the config file and applies
// them to 'service.Config' object | [
"applyConfig",
"takes",
"configuration",
"values",
"from",
"the",
"config",
"file",
"and",
"applies",
"them",
"to",
"service",
".",
"Config",
"object"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/tctl.go#L167-L197 | train |
gravitational/teleport | lib/limiter/limiter.go | SetEnv | func (l *LimiterConfig) SetEnv(v string) error {
if err := json.Unmarshal([]byte(v), l); err != nil {
return trace.Wrap(err, "expected JSON encoded remote certificate")
}
return nil
} | go | func (l *LimiterConfig) SetEnv(v string) error {
if err := json.Unmarshal([]byte(v), l); err != nil {
return trace.Wrap(err, "expected JSON encoded remote certificate")
}
return nil
} | [
"func",
"(",
"l",
"*",
"LimiterConfig",
")",
"SetEnv",
"(",
"v",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"v",
")",
",",
"l",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace",
"."... | // SetEnv reads LimiterConfig from JSON string | [
"SetEnv",
"reads",
"LimiterConfig",
"from",
"JSON",
"string"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/limiter.go#L49-L54 | train |
gravitational/teleport | lib/limiter/limiter.go | NewLimiter | func NewLimiter(config LimiterConfig) (*Limiter, error) {
var err error
limiter := Limiter{}
limiter.ConnectionsLimiter, err = NewConnectionsLimiter(config)
if err != nil {
return nil, trace.Wrap(err)
}
limiter.rateLimiter, err = NewRateLimiter(config)
if err != nil {
return nil, trace.Wrap(err)
}
retur... | go | func NewLimiter(config LimiterConfig) (*Limiter, error) {
var err error
limiter := Limiter{}
limiter.ConnectionsLimiter, err = NewConnectionsLimiter(config)
if err != nil {
return nil, trace.Wrap(err)
}
limiter.rateLimiter, err = NewRateLimiter(config)
if err != nil {
return nil, trace.Wrap(err)
}
retur... | [
"func",
"NewLimiter",
"(",
"config",
"LimiterConfig",
")",
"(",
"*",
"Limiter",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"limiter",
":=",
"Limiter",
"{",
"}",
"\n\n",
"limiter",
".",
"ConnectionsLimiter",
",",
"err",
"=",
"NewConnectionsLimiter",... | // NewLimiter returns new rate and connection limiter | [
"NewLimiter",
"returns",
"new",
"rate",
"and",
"connection",
"limiter"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/limiter.go#L57-L72 | train |
gravitational/teleport | lib/limiter/limiter.go | WrapHandle | func (l *Limiter) WrapHandle(h http.Handler) {
l.rateLimiter.Wrap(h)
l.ConnLimiter.Wrap(l.rateLimiter)
} | go | func (l *Limiter) WrapHandle(h http.Handler) {
l.rateLimiter.Wrap(h)
l.ConnLimiter.Wrap(l.rateLimiter)
} | [
"func",
"(",
"l",
"*",
"Limiter",
")",
"WrapHandle",
"(",
"h",
"http",
".",
"Handler",
")",
"{",
"l",
".",
"rateLimiter",
".",
"Wrap",
"(",
"h",
")",
"\n",
"l",
".",
"ConnLimiter",
".",
"Wrap",
"(",
"l",
".",
"rateLimiter",
")",
"\n",
"}"
] | // Add limiter to the handle | [
"Add",
"limiter",
"to",
"the",
"handle"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/limiter.go#L79-L82 | train |
gravitational/teleport | lib/web/apiserver.go | SetSessionStreamPollPeriod | func SetSessionStreamPollPeriod(period time.Duration) HandlerOption {
return func(h *Handler) error {
if period < 0 {
return trace.BadParameter("period should be non zero")
}
h.sessionStreamPollPeriod = period
return nil
}
} | go | func SetSessionStreamPollPeriod(period time.Duration) HandlerOption {
return func(h *Handler) error {
if period < 0 {
return trace.BadParameter("period should be non zero")
}
h.sessionStreamPollPeriod = period
return nil
}
} | [
"func",
"SetSessionStreamPollPeriod",
"(",
"period",
"time",
".",
"Duration",
")",
"HandlerOption",
"{",
"return",
"func",
"(",
"h",
"*",
"Handler",
")",
"error",
"{",
"if",
"period",
"<",
"0",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
... | // SetSessionStreamPollPeriod sets polling period for session streams | [
"SetSessionStreamPollPeriod",
"sets",
"polling",
"period",
"for",
"session",
"streams"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L79-L87 | train |
gravitational/teleport | lib/web/apiserver.go | getWebConfig | func (h *Handler) getWebConfig(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
httplib.SetWebConfigHeaders(w.Header())
authProviders := []ui.WebConfigAuthProvider{}
secondFactor := teleport.OFF
// get all OIDC connectors
oidcConnectors, err := h.cfg.ProxyClient.GetOIDCConnecto... | go | func (h *Handler) getWebConfig(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
httplib.SetWebConfigHeaders(w.Header())
authProviders := []ui.WebConfigAuthProvider{}
secondFactor := teleport.OFF
// get all OIDC connectors
oidcConnectors, err := h.cfg.ProxyClient.GetOIDCConnecto... | [
"func",
"(",
"h",
"*",
"Handler",
")",
"getWebConfig",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"p",
"httprouter",
".",
"Params",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"httplib",
".",
"... | // getWebConfig returns configuration for the web application. | [
"getWebConfig",
"returns",
"configuration",
"for",
"the",
"web",
"application",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L577-L659 | train |
gravitational/teleport | lib/web/apiserver.go | ConstructSSHResponse | func ConstructSSHResponse(response AuthParams) (*url.URL, error) {
u, err := url.Parse(response.ClientRedirectURL)
if err != nil {
return nil, trace.Wrap(err)
}
consoleResponse := auth.SSHLoginResponse{
Username: response.Username,
Cert: response.Cert,
TLSCert: response.TLSCert,
HostSigners:... | go | func ConstructSSHResponse(response AuthParams) (*url.URL, error) {
u, err := url.Parse(response.ClientRedirectURL)
if err != nil {
return nil, trace.Wrap(err)
}
consoleResponse := auth.SSHLoginResponse{
Username: response.Username,
Cert: response.Cert,
TLSCert: response.TLSCert,
HostSigners:... | [
"func",
"ConstructSSHResponse",
"(",
"response",
"AuthParams",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"response",
".",
"ClientRedirectURL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // ConstructSSHResponse creates a special SSH response for SSH login method
// that encodes everything using the client's secret key | [
"ConstructSSHResponse",
"creates",
"a",
"special",
"SSH",
"response",
"for",
"SSH",
"login",
"method",
"that",
"encodes",
"everything",
"using",
"the",
"client",
"s",
"secret",
"key"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L901-L967 | train |
gravitational/teleport | lib/web/apiserver.go | queryTime | func queryTime(query url.Values, name string, def time.Time) (time.Time, error) {
str := query.Get(name)
if str == "" {
return def, nil
}
parsed, err := time.Parse(time.RFC3339, str)
if err != nil {
return time.Time{}, trace.BadParameter("failed to parse %v as RFC3339 time: %v", name, str)
}
return parsed, n... | go | func queryTime(query url.Values, name string, def time.Time) (time.Time, error) {
str := query.Get(name)
if str == "" {
return def, nil
}
parsed, err := time.Parse(time.RFC3339, str)
if err != nil {
return time.Time{}, trace.BadParameter("failed to parse %v as RFC3339 time: %v", name, str)
}
return parsed, n... | [
"func",
"queryTime",
"(",
"query",
"url",
".",
"Values",
",",
"name",
"string",
",",
"def",
"time",
".",
"Time",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"str",
":=",
"query",
".",
"Get",
"(",
"name",
")",
"\n",
"if",
"str",
"==",
... | // queryTime parses the query string parameter with the specified name as a
// RFC3339 time and returns it.
//
// If there's no such parameter, specified default value is returned. | [
"queryTime",
"parses",
"the",
"query",
"string",
"parameter",
"with",
"the",
"specified",
"name",
"as",
"a",
"RFC3339",
"time",
"and",
"returns",
"it",
".",
"If",
"there",
"s",
"no",
"such",
"parameter",
"specified",
"default",
"value",
"is",
"returned",
"."... | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L1643-L1653 | train |
gravitational/teleport | lib/web/apiserver.go | queryLimit | func queryLimit(query url.Values, name string, def int) (int, error) {
str := query.Get(name)
if str == "" {
return def, nil
}
limit, err := strconv.Atoi(str)
if err != nil {
return 0, trace.BadParameter("failed to parse %v as limit: %v", name, str)
}
return limit, nil
} | go | func queryLimit(query url.Values, name string, def int) (int, error) {
str := query.Get(name)
if str == "" {
return def, nil
}
limit, err := strconv.Atoi(str)
if err != nil {
return 0, trace.BadParameter("failed to parse %v as limit: %v", name, str)
}
return limit, nil
} | [
"func",
"queryLimit",
"(",
"query",
"url",
".",
"Values",
",",
"name",
"string",
",",
"def",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"str",
":=",
"query",
".",
"Get",
"(",
"name",
")",
"\n",
"if",
"str",
"==",
"\"",
"\"",
"{",
"return",
... | // queryLimit returns the limit parameter with the specified name from the
// query string.
//
// If there's no such parameter, specified default limit is returned. | [
"queryLimit",
"returns",
"the",
"limit",
"parameter",
"with",
"the",
"specified",
"name",
"from",
"the",
"query",
"string",
".",
"If",
"there",
"s",
"no",
"such",
"parameter",
"specified",
"default",
"limit",
"is",
"returned",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L1659-L1669 | train |
gravitational/teleport | lib/web/apiserver.go | hostCredentials | func (h *Handler) hostCredentials(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
var req auth.RegisterUsingTokenRequest
if err := httplib.ReadJSON(r, &req); err != nil {
return nil, trace.Wrap(err)
}
authClient := h.cfg.ProxyClient
packedKeys, err := authClient.RegisterUsing... | go | func (h *Handler) hostCredentials(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
var req auth.RegisterUsingTokenRequest
if err := httplib.ReadJSON(r, &req); err != nil {
return nil, trace.Wrap(err)
}
authClient := h.cfg.ProxyClient
packedKeys, err := authClient.RegisterUsing... | [
"func",
"(",
"h",
"*",
"Handler",
")",
"hostCredentials",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"p",
"httprouter",
".",
"Params",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"req",
... | // hostCredentials sends a registration token and metadata to the Auth Server
// and gets back SSH and TLS certificates. | [
"hostCredentials",
"sends",
"a",
"registration",
"token",
"and",
"metadata",
"to",
"the",
"Auth",
"Server",
"and",
"gets",
"back",
"SSH",
"and",
"TLS",
"certificates",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L1832-L1845 | train |
gravitational/teleport | lib/web/apiserver.go | WithClusterAuth | func (h *Handler) WithClusterAuth(fn ClusterHandler) httprouter.Handle {
return httplib.MakeHandler(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
ctx, err := h.AuthenticateRequest(w, r, true)
if err != nil {
log.Info(err)
// clear session just in case if the authent... | go | func (h *Handler) WithClusterAuth(fn ClusterHandler) httprouter.Handle {
return httplib.MakeHandler(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
ctx, err := h.AuthenticateRequest(w, r, true)
if err != nil {
log.Info(err)
// clear session just in case if the authent... | [
"func",
"(",
"h",
"*",
"Handler",
")",
"WithClusterAuth",
"(",
"fn",
"ClusterHandler",
")",
"httprouter",
".",
"Handle",
"{",
"return",
"httplib",
".",
"MakeHandler",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Requ... | // WithClusterAuth ensures that request is authenticated and is issued for existing cluster | [
"WithClusterAuth",
"ensures",
"that",
"request",
"is",
"authenticated",
"and",
"is",
"issued",
"for",
"existing",
"cluster"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L1976-L2003 | train |
gravitational/teleport | lib/web/apiserver.go | WithAuth | func (h *Handler) WithAuth(fn ContextHandler) httprouter.Handle {
return httplib.MakeHandler(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
ctx, err := h.AuthenticateRequest(w, r, true)
if err != nil {
return nil, trace.Wrap(err)
}
return fn(w, r, p, ctx)
})
} | go | func (h *Handler) WithAuth(fn ContextHandler) httprouter.Handle {
return httplib.MakeHandler(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {
ctx, err := h.AuthenticateRequest(w, r, true)
if err != nil {
return nil, trace.Wrap(err)
}
return fn(w, r, p, ctx)
})
} | [
"func",
"(",
"h",
"*",
"Handler",
")",
"WithAuth",
"(",
"fn",
"ContextHandler",
")",
"httprouter",
".",
"Handle",
"{",
"return",
"httplib",
".",
"MakeHandler",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
... | // WithAuth ensures that request is authenticated | [
"WithAuth",
"ensures",
"that",
"request",
"is",
"authenticated"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L2006-L2014 | train |
gravitational/teleport | lib/web/apiserver.go | AuthenticateRequest | func (h *Handler) AuthenticateRequest(w http.ResponseWriter, r *http.Request, checkBearerToken bool) (*SessionContext, error) {
const missingCookieMsg = "missing session cookie"
logger := log.WithFields(log.Fields{
"request": fmt.Sprintf("%v %v", r.Method, r.URL.Path),
})
cookie, err := r.Cookie("session")
if er... | go | func (h *Handler) AuthenticateRequest(w http.ResponseWriter, r *http.Request, checkBearerToken bool) (*SessionContext, error) {
const missingCookieMsg = "missing session cookie"
logger := log.WithFields(log.Fields{
"request": fmt.Sprintf("%v %v", r.Method, r.URL.Path),
})
cookie, err := r.Cookie("session")
if er... | [
"func",
"(",
"h",
"*",
"Handler",
")",
"AuthenticateRequest",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"checkBearerToken",
"bool",
")",
"(",
"*",
"SessionContext",
",",
"error",
")",
"{",
"const",
"missingCookieM... | // AuthenticateRequest authenticates request using combination of a session cookie
// and bearer token | [
"AuthenticateRequest",
"authenticates",
"request",
"using",
"combination",
"of",
"a",
"session",
"cookie",
"and",
"bearer",
"token"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L2018-L2054 | train |
gravitational/teleport | lib/web/apiserver.go | CreateSignupLink | func CreateSignupLink(client auth.ClientI, token string) (string, string) {
proxyHost := "<proxyhost>:3080"
proxies, err := client.GetProxies()
if err != nil {
log.Errorf("Unable to retrieve proxy list: %v", err)
}
if len(proxies) > 0 {
proxyHost = proxies[0].GetPublicAddr()
if proxyHost == "" {
proxyHo... | go | func CreateSignupLink(client auth.ClientI, token string) (string, string) {
proxyHost := "<proxyhost>:3080"
proxies, err := client.GetProxies()
if err != nil {
log.Errorf("Unable to retrieve proxy list: %v", err)
}
if len(proxies) > 0 {
proxyHost = proxies[0].GetPublicAddr()
if proxyHost == "" {
proxyHo... | [
"func",
"CreateSignupLink",
"(",
"client",
"auth",
".",
"ClientI",
",",
"token",
"string",
")",
"(",
"string",
",",
"string",
")",
"{",
"proxyHost",
":=",
"\"",
"\"",
"\n\n",
"proxies",
",",
"err",
":=",
"client",
".",
"GetProxies",
"(",
")",
"\n",
"if... | // CreateSignupLink generates and returns a URL which is given to a new
// user to complete registration with Teleport via Web UI | [
"CreateSignupLink",
"generates",
"and",
"returns",
"a",
"URL",
"which",
"is",
"given",
"to",
"a",
"new",
"user",
"to",
"complete",
"registration",
"with",
"Teleport",
"via",
"Web",
"UI"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L2080-L2102 | train |
gravitational/teleport | lib/web/apiserver.go | makeTeleportClientConfig | func makeTeleportClientConfig(ctx *SessionContext) (*client.Config, error) {
agent, cert, err := ctx.GetAgent()
if err != nil {
return nil, trace.BadParameter("failed to get user credentials: %v", err)
}
signers, err := agent.Signers()
if err != nil {
return nil, trace.BadParameter("failed to get user credent... | go | func makeTeleportClientConfig(ctx *SessionContext) (*client.Config, error) {
agent, cert, err := ctx.GetAgent()
if err != nil {
return nil, trace.BadParameter("failed to get user credentials: %v", err)
}
signers, err := agent.Signers()
if err != nil {
return nil, trace.BadParameter("failed to get user credent... | [
"func",
"makeTeleportClientConfig",
"(",
"ctx",
"*",
"SessionContext",
")",
"(",
"*",
"client",
".",
"Config",
",",
"error",
")",
"{",
"agent",
",",
"cert",
",",
"err",
":=",
"ctx",
".",
"GetAgent",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ret... | // makeTeleportClientConfig creates default teleport client configuration
// that is used to initiate an SSH terminal session or SCP file transfer | [
"makeTeleportClientConfig",
"creates",
"default",
"teleport",
"client",
"configuration",
"that",
"is",
"used",
"to",
"initiate",
"an",
"SSH",
"terminal",
"session",
"or",
"SCP",
"file",
"transfer"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/apiserver.go#L2114-L2141 | train |
gravitational/teleport | lib/client/keyagent.go | LoadKey | func (a *LocalKeyAgent) LoadKey(key Key) (*agent.AddedKey, error) {
agents := []agent.Agent{a.Agent}
if a.sshAgent != nil {
agents = append(agents, a.sshAgent)
}
// convert keys into a format understood by the ssh agent
agentKeys, err := key.AsAgentKeys()
if err != nil {
return nil, trace.Wrap(err)
}
// r... | go | func (a *LocalKeyAgent) LoadKey(key Key) (*agent.AddedKey, error) {
agents := []agent.Agent{a.Agent}
if a.sshAgent != nil {
agents = append(agents, a.sshAgent)
}
// convert keys into a format understood by the ssh agent
agentKeys, err := key.AsAgentKeys()
if err != nil {
return nil, trace.Wrap(err)
}
// r... | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"LoadKey",
"(",
"key",
"Key",
")",
"(",
"*",
"agent",
".",
"AddedKey",
",",
"error",
")",
"{",
"agents",
":=",
"[",
"]",
"agent",
".",
"Agent",
"{",
"a",
".",
"Agent",
"}",
"\n",
"if",
"a",
".",
"ssh... | // LoadKey adds a key into the Teleport ssh agent as well as the system ssh
// agent. | [
"LoadKey",
"adds",
"a",
"key",
"into",
"the",
"Teleport",
"ssh",
"agent",
"as",
"well",
"as",
"the",
"system",
"ssh",
"agent",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L123-L154 | train |
gravitational/teleport | lib/client/keyagent.go | UnloadKey | func (a *LocalKeyAgent) UnloadKey() error {
agents := []agent.Agent{a.Agent}
if a.sshAgent != nil {
agents = append(agents, a.sshAgent)
}
// iterate over all agents we have and unload keys for this user
for i, _ := range agents {
// get a list of all keys in the agent
keyList, err := agents[i].List()
if e... | go | func (a *LocalKeyAgent) UnloadKey() error {
agents := []agent.Agent{a.Agent}
if a.sshAgent != nil {
agents = append(agents, a.sshAgent)
}
// iterate over all agents we have and unload keys for this user
for i, _ := range agents {
// get a list of all keys in the agent
keyList, err := agents[i].List()
if e... | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"UnloadKey",
"(",
")",
"error",
"{",
"agents",
":=",
"[",
"]",
"agent",
".",
"Agent",
"{",
"a",
".",
"Agent",
"}",
"\n",
"if",
"a",
".",
"sshAgent",
"!=",
"nil",
"{",
"agents",
"=",
"append",
"(",
"age... | // UnloadKey will unload key for user from the teleport ssh agent as well as
// the system agent. | [
"UnloadKey",
"will",
"unload",
"key",
"for",
"user",
"from",
"the",
"teleport",
"ssh",
"agent",
"as",
"well",
"as",
"the",
"system",
"agent",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L158-L184 | train |
gravitational/teleport | lib/client/keyagent.go | UnloadKeys | func (a *LocalKeyAgent) UnloadKeys() error {
agents := []agent.Agent{a.Agent}
if a.sshAgent != nil {
agents = append(agents, a.sshAgent)
}
// iterate over all agents we have
for i, _ := range agents {
// get a list of all keys in the agent
keyList, err := agents[i].List()
if err != nil {
a.log.Warnf("U... | go | func (a *LocalKeyAgent) UnloadKeys() error {
agents := []agent.Agent{a.Agent}
if a.sshAgent != nil {
agents = append(agents, a.sshAgent)
}
// iterate over all agents we have
for i, _ := range agents {
// get a list of all keys in the agent
keyList, err := agents[i].List()
if err != nil {
a.log.Warnf("U... | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"UnloadKeys",
"(",
")",
"error",
"{",
"agents",
":=",
"[",
"]",
"agent",
".",
"Agent",
"{",
"a",
".",
"Agent",
"}",
"\n",
"if",
"a",
".",
"sshAgent",
"!=",
"nil",
"{",
"agents",
"=",
"append",
"(",
"ag... | // UnloadKeys will unload all Teleport keys from the teleport agent as well as
// the system agent. | [
"UnloadKeys",
"will",
"unload",
"all",
"Teleport",
"keys",
"from",
"the",
"teleport",
"agent",
"as",
"well",
"as",
"the",
"system",
"agent",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L188-L214 | train |
gravitational/teleport | lib/client/keyagent.go | AddHostSignersToCache | func (a *LocalKeyAgent) AddHostSignersToCache(certAuthorities []auth.TrustedCerts) error {
for _, ca := range certAuthorities {
publicKeys, err := ca.SSHCertPublicKeys()
if err != nil {
a.log.Error(err)
return trace.Wrap(err)
}
a.log.Debugf("Adding CA key for %s", ca.ClusterName)
err = a.keyStore.AddKn... | go | func (a *LocalKeyAgent) AddHostSignersToCache(certAuthorities []auth.TrustedCerts) error {
for _, ca := range certAuthorities {
publicKeys, err := ca.SSHCertPublicKeys()
if err != nil {
a.log.Error(err)
return trace.Wrap(err)
}
a.log.Debugf("Adding CA key for %s", ca.ClusterName)
err = a.keyStore.AddKn... | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"AddHostSignersToCache",
"(",
"certAuthorities",
"[",
"]",
"auth",
".",
"TrustedCerts",
")",
"error",
"{",
"for",
"_",
",",
"ca",
":=",
"range",
"certAuthorities",
"{",
"publicKeys",
",",
"err",
":=",
"ca",
".",... | // AddHostSignersToCache takes a list of CAs whom we trust. This list is added to a database
// of "seen" CAs.
//
// Every time we connect to a new host, we'll request its certificaate to be signed by one
// of these trusted CAs.
//
// Why do we trust these CAs? Because we received them from a trusted Teleport Proxy.
/... | [
"AddHostSignersToCache",
"takes",
"a",
"list",
"of",
"CAs",
"whom",
"we",
"trust",
".",
"This",
"list",
"is",
"added",
"to",
"a",
"database",
"of",
"seen",
"CAs",
".",
"Every",
"time",
"we",
"connect",
"to",
"a",
"new",
"host",
"we",
"ll",
"request",
"... | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L230-L244 | train |
gravitational/teleport | lib/client/keyagent.go | AddKey | func (a *LocalKeyAgent) AddKey(key *Key) (*agent.AddedKey, error) {
// save it to disk (usually into ~/.tsh)
err := a.keyStore.AddKey(a.proxyHost, a.username, key)
if err != nil {
return nil, trace.Wrap(err)
}
// load key into the teleport agent and system agent
return a.LoadKey(*key)
} | go | func (a *LocalKeyAgent) AddKey(key *Key) (*agent.AddedKey, error) {
// save it to disk (usually into ~/.tsh)
err := a.keyStore.AddKey(a.proxyHost, a.username, key)
if err != nil {
return nil, trace.Wrap(err)
}
// load key into the teleport agent and system agent
return a.LoadKey(*key)
} | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"AddKey",
"(",
"key",
"*",
"Key",
")",
"(",
"*",
"agent",
".",
"AddedKey",
",",
"error",
")",
"{",
"// save it to disk (usually into ~/.tsh)",
"err",
":=",
"a",
".",
"keyStore",
".",
"AddKey",
"(",
"a",
".",
... | // AddKey activates a new signed session key by adding it into the keystore and also
// by loading it into the SSH agent | [
"AddKey",
"activates",
"a",
"new",
"signed",
"session",
"key",
"by",
"adding",
"it",
"into",
"the",
"keystore",
"and",
"also",
"by",
"loading",
"it",
"into",
"the",
"SSH",
"agent"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L370-L379 | train |
gravitational/teleport | lib/client/keyagent.go | DeleteKey | func (a *LocalKeyAgent) DeleteKey() error {
// remove key from key store
err := a.keyStore.DeleteKey(a.proxyHost, a.username)
if err != nil {
return trace.Wrap(err)
}
// remove any keys that are loaded for this user from the teleport and
// system agents
err = a.UnloadKey()
if err != nil {
return trace.Wra... | go | func (a *LocalKeyAgent) DeleteKey() error {
// remove key from key store
err := a.keyStore.DeleteKey(a.proxyHost, a.username)
if err != nil {
return trace.Wrap(err)
}
// remove any keys that are loaded for this user from the teleport and
// system agents
err = a.UnloadKey()
if err != nil {
return trace.Wra... | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"DeleteKey",
"(",
")",
"error",
"{",
"// remove key from key store",
"err",
":=",
"a",
".",
"keyStore",
".",
"DeleteKey",
"(",
"a",
".",
"proxyHost",
",",
"a",
".",
"username",
")",
"\n",
"if",
"err",
"!=",
... | // DeleteKey removes the key from the key store as well as unloading the key
// from the agent. | [
"DeleteKey",
"removes",
"the",
"key",
"from",
"the",
"key",
"store",
"as",
"well",
"as",
"unloading",
"the",
"key",
"from",
"the",
"agent",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L383-L398 | train |
gravitational/teleport | lib/client/keyagent.go | DeleteKeys | func (a *LocalKeyAgent) DeleteKeys() error {
// Remove keys from the filesystem.
err := a.keyStore.DeleteKeys()
if err != nil {
return trace.Wrap(err)
}
// Remove all keys from the Teleport and system agents.
err = a.UnloadKeys()
if err != nil {
return trace.Wrap(err)
}
return nil
} | go | func (a *LocalKeyAgent) DeleteKeys() error {
// Remove keys from the filesystem.
err := a.keyStore.DeleteKeys()
if err != nil {
return trace.Wrap(err)
}
// Remove all keys from the Teleport and system agents.
err = a.UnloadKeys()
if err != nil {
return trace.Wrap(err)
}
return nil
} | [
"func",
"(",
"a",
"*",
"LocalKeyAgent",
")",
"DeleteKeys",
"(",
")",
"error",
"{",
"// Remove keys from the filesystem.",
"err",
":=",
"a",
".",
"keyStore",
".",
"DeleteKeys",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wrap",
... | // DeleteKeys removes all keys from the keystore as well as unloads keys
// from the agent. | [
"DeleteKeys",
"removes",
"all",
"keys",
"from",
"the",
"keystore",
"as",
"well",
"as",
"unloads",
"keys",
"from",
"the",
"agent",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/keyagent.go#L402-L416 | train |
gravitational/teleport | lib/utils/fs_unix.go | FSWriteLock | func FSWriteLock(f *os.File) error {
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil {
return trace.ConvertSystemError(err)
}
return nil
} | go | func FSWriteLock(f *os.File) error {
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil {
return trace.ConvertSystemError(err)
}
return nil
} | [
"func",
"FSWriteLock",
"(",
"f",
"*",
"os",
".",
"File",
")",
"error",
"{",
"if",
"err",
":=",
"syscall",
".",
"Flock",
"(",
"int",
"(",
"f",
".",
"Fd",
"(",
")",
")",
",",
"syscall",
".",
"LOCK_EX",
")",
";",
"err",
"!=",
"nil",
"{",
"return",... | // FSWriteLock grabs Flock-style filesystem lock on an open file
// in exclusive mode. | [
"FSWriteLock",
"grabs",
"Flock",
"-",
"style",
"filesystem",
"lock",
"on",
"an",
"open",
"file",
"in",
"exclusive",
"mode",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/fs_unix.go#L30-L35 | train |
gravitational/teleport | lib/utils/fs_unix.go | FSTryWriteLock | func FSTryWriteLock(f *os.File) error {
err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
if err != nil {
if err == syscall.EWOULDBLOCK {
return trace.CompareFailed("lock %v is acquired by another process", f.Name())
}
return trace.ConvertSystemError(err)
}
return nil
} | go | func FSTryWriteLock(f *os.File) error {
err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
if err != nil {
if err == syscall.EWOULDBLOCK {
return trace.CompareFailed("lock %v is acquired by another process", f.Name())
}
return trace.ConvertSystemError(err)
}
return nil
} | [
"func",
"FSTryWriteLock",
"(",
"f",
"*",
"os",
".",
"File",
")",
"error",
"{",
"err",
":=",
"syscall",
".",
"Flock",
"(",
"int",
"(",
"f",
".",
"Fd",
"(",
")",
")",
",",
"syscall",
".",
"LOCK_EX",
"|",
"syscall",
".",
"LOCK_NB",
")",
"\n",
"if",
... | // FSTryWriteLock tries to grab write lock, returns CompareFailed
// if lock is already grabbed | [
"FSTryWriteLock",
"tries",
"to",
"grab",
"write",
"lock",
"returns",
"CompareFailed",
"if",
"lock",
"is",
"already",
"grabbed"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/fs_unix.go#L39-L48 | train |
gravitational/teleport | lib/utils/fs_unix.go | FSUnlock | func FSUnlock(f *os.File) error {
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_UN); err != nil {
return trace.ConvertSystemError(err)
}
return nil
} | go | func FSUnlock(f *os.File) error {
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_UN); err != nil {
return trace.ConvertSystemError(err)
}
return nil
} | [
"func",
"FSUnlock",
"(",
"f",
"*",
"os",
".",
"File",
")",
"error",
"{",
"if",
"err",
":=",
"syscall",
".",
"Flock",
"(",
"int",
"(",
"f",
".",
"Fd",
"(",
")",
")",
",",
"syscall",
".",
"LOCK_UN",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
... | // FSUnlock unlcocks Flock-style filesystem lock | [
"FSUnlock",
"unlcocks",
"Flock",
"-",
"style",
"filesystem",
"lock"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/fs_unix.go#L60-L65 | train |
gravitational/teleport | lib/limiter/ratelimiter.go | NewRateLimiter | func NewRateLimiter(config LimiterConfig) (*RateLimiter, error) {
limiter := RateLimiter{
Mutex: &sync.Mutex{},
}
ipExtractor, err := utils.NewExtractor("client.ip")
if err != nil {
return nil, trace.Wrap(err)
}
limiter.rates = ratelimit.NewRateSet()
for _, rate := range config.Rates {
err := limiter.rat... | go | func NewRateLimiter(config LimiterConfig) (*RateLimiter, error) {
limiter := RateLimiter{
Mutex: &sync.Mutex{},
}
ipExtractor, err := utils.NewExtractor("client.ip")
if err != nil {
return nil, trace.Wrap(err)
}
limiter.rates = ratelimit.NewRateSet()
for _, rate := range config.Rates {
err := limiter.rat... | [
"func",
"NewRateLimiter",
"(",
"config",
"LimiterConfig",
")",
"(",
"*",
"RateLimiter",
",",
"error",
")",
"{",
"limiter",
":=",
"RateLimiter",
"{",
"Mutex",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"}",
"\n\n",
"ipExtractor",
",",
"err",
":=",
"... | // NewRateLimiter returns new request rate controller | [
"NewRateLimiter",
"returns",
"new",
"request",
"rate",
"controller"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/ratelimiter.go#L50-L96 | train |
gravitational/teleport | lib/limiter/ratelimiter.go | RegisterRequest | func (l *RateLimiter) RegisterRequest(token string) error {
l.Lock()
defer l.Unlock()
bucketSetI, exists := l.rateLimits.Get(token)
var bucketSet *ratelimit.TokenBucketSet
if exists {
bucketSet = bucketSetI.(*ratelimit.TokenBucketSet)
bucketSet.Update(l.rates)
} else {
bucketSet = ratelimit.NewTokenBucket... | go | func (l *RateLimiter) RegisterRequest(token string) error {
l.Lock()
defer l.Unlock()
bucketSetI, exists := l.rateLimits.Get(token)
var bucketSet *ratelimit.TokenBucketSet
if exists {
bucketSet = bucketSetI.(*ratelimit.TokenBucketSet)
bucketSet.Update(l.rates)
} else {
bucketSet = ratelimit.NewTokenBucket... | [
"func",
"(",
"l",
"*",
"RateLimiter",
")",
"RegisterRequest",
"(",
"token",
"string",
")",
"error",
"{",
"l",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"Unlock",
"(",
")",
"\n\n",
"bucketSetI",
",",
"exists",
":=",
"l",
".",
"rateLimits",
".",
... | // RegisterRequest increases number of requests for the provided token
// Returns error if there are too many requests with the provided token | [
"RegisterRequest",
"increases",
"number",
"of",
"requests",
"for",
"the",
"provided",
"token",
"Returns",
"error",
"if",
"there",
"are",
"too",
"many",
"requests",
"with",
"the",
"provided",
"token"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/ratelimiter.go#L100-L127 | train |
gravitational/teleport | lib/limiter/ratelimiter.go | WrapHandle | func (l *RateLimiter) WrapHandle(h http.Handler) {
l.TokenLimiter.Wrap(h)
} | go | func (l *RateLimiter) WrapHandle(h http.Handler) {
l.TokenLimiter.Wrap(h)
} | [
"func",
"(",
"l",
"*",
"RateLimiter",
")",
"WrapHandle",
"(",
"h",
"http",
".",
"Handler",
")",
"{",
"l",
".",
"TokenLimiter",
".",
"Wrap",
"(",
"h",
")",
"\n",
"}"
] | // Add rate limiter to the handle | [
"Add",
"rate",
"limiter",
"to",
"the",
"handle"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/ratelimiter.go#L130-L132 | train |
gravitational/teleport | lib/auth/clt.go | EncodeClusterName | func EncodeClusterName(clusterName string) string {
// hex is used to hide "." that will prevent wildcard *. entry to match
return fmt.Sprintf("%v.%v", hex.EncodeToString([]byte(clusterName)), teleport.APIDomain)
} | go | func EncodeClusterName(clusterName string) string {
// hex is used to hide "." that will prevent wildcard *. entry to match
return fmt.Sprintf("%v.%v", hex.EncodeToString([]byte(clusterName)), teleport.APIDomain)
} | [
"func",
"EncodeClusterName",
"(",
"clusterName",
"string",
")",
"string",
"{",
"// hex is used to hide \".\" that will prevent wildcard *. entry to match",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hex",
".",
"EncodeToString",
"(",
"[",
"]",
"byte",
"(",... | // EncodeClusterName encodes cluster name in the SNI hostname | [
"EncodeClusterName",
"encodes",
"cluster",
"name",
"in",
"the",
"SNI",
"hostname"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L97-L100 | train |
gravitational/teleport | lib/auth/clt.go | NewAddrDialer | func NewAddrDialer(addrs []utils.NetAddr) DialContext {
dialer := net.Dialer{
Timeout: defaults.DefaultDialTimeout,
KeepAlive: defaults.ReverseTunnelAgentHeartbeatPeriod,
}
return func(in context.Context, network, _ string) (net.Conn, error) {
var err error
var conn net.Conn
for _, addr := range addrs {
... | go | func NewAddrDialer(addrs []utils.NetAddr) DialContext {
dialer := net.Dialer{
Timeout: defaults.DefaultDialTimeout,
KeepAlive: defaults.ReverseTunnelAgentHeartbeatPeriod,
}
return func(in context.Context, network, _ string) (net.Conn, error) {
var err error
var conn net.Conn
for _, addr := range addrs {
... | [
"func",
"NewAddrDialer",
"(",
"addrs",
"[",
"]",
"utils",
".",
"NetAddr",
")",
"DialContext",
"{",
"dialer",
":=",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"defaults",
".",
"DefaultDialTimeout",
",",
"KeepAlive",
":",
"defaults",
".",
"ReverseTunnelAgentHear... | // NewAddrDialer returns new dialer from a list of addresses | [
"NewAddrDialer",
"returns",
"new",
"dialer",
"from",
"a",
"list",
"of",
"addresses"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L124-L142 | train |
gravitational/teleport | lib/auth/clt.go | ClientTimeout | func ClientTimeout(timeout time.Duration) roundtrip.ClientParam {
return func(c *roundtrip.Client) error {
transport, ok := (c.HTTPClient().Transport).(*http.Transport)
if !ok {
return nil
}
transport.IdleConnTimeout = timeout
transport.ResponseHeaderTimeout = timeout
return nil
}
} | go | func ClientTimeout(timeout time.Duration) roundtrip.ClientParam {
return func(c *roundtrip.Client) error {
transport, ok := (c.HTTPClient().Transport).(*http.Transport)
if !ok {
return nil
}
transport.IdleConnTimeout = timeout
transport.ResponseHeaderTimeout = timeout
return nil
}
} | [
"func",
"ClientTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"roundtrip",
".",
"ClientParam",
"{",
"return",
"func",
"(",
"c",
"*",
"roundtrip",
".",
"Client",
")",
"error",
"{",
"transport",
",",
"ok",
":=",
"(",
"c",
".",
"HTTPClient",
"(",
... | // ClientTimeout sets idle and dial timeouts of the HTTP transport
// used by the client. | [
"ClientTimeout",
"sets",
"idle",
"and",
"dial",
"timeouts",
"of",
"the",
"HTTP",
"transport",
"used",
"by",
"the",
"client",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L146-L156 | train |
gravitational/teleport | lib/auth/clt.go | CheckAndSetDefaults | func (c *ClientConfig) CheckAndSetDefaults() error {
if len(c.Addrs) == 0 && c.DialContext == nil {
return trace.BadParameter("set parameter Addrs or DialContext")
}
if c.TLS == nil {
return trace.BadParameter("missing parameter TLS")
}
if c.KeepAlivePeriod == 0 {
c.KeepAlivePeriod = defaults.ServerKeepAlive... | go | func (c *ClientConfig) CheckAndSetDefaults() error {
if len(c.Addrs) == 0 && c.DialContext == nil {
return trace.BadParameter("set parameter Addrs or DialContext")
}
if c.TLS == nil {
return trace.BadParameter("missing parameter TLS")
}
if c.KeepAlivePeriod == 0 {
c.KeepAlivePeriod = defaults.ServerKeepAlive... | [
"func",
"(",
"c",
"*",
"ClientConfig",
")",
"CheckAndSetDefaults",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"Addrs",
")",
"==",
"0",
"&&",
"c",
".",
"DialContext",
"==",
"nil",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
... | // CheckAndSetDefaults checks and sets default config values | [
"CheckAndSetDefaults",
"checks",
"and",
"sets",
"default",
"config",
"values"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L175-L206 | train |
gravitational/teleport | lib/auth/clt.go | NewTLSClient | func NewTLSClient(cfg ClientConfig, params ...roundtrip.ClientParam) (*Client, error) {
if err := cfg.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
transport := &http.Transport{
// notice that below roundtrip.Client is passed
// teleport.APIEndpoint as an address for the API server, this is... | go | func NewTLSClient(cfg ClientConfig, params ...roundtrip.ClientParam) (*Client, error) {
if err := cfg.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
transport := &http.Transport{
// notice that below roundtrip.Client is passed
// teleport.APIEndpoint as an address for the API server, this is... | [
"func",
"NewTLSClient",
"(",
"cfg",
"ClientConfig",
",",
"params",
"...",
"roundtrip",
".",
"ClientParam",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"err",
":=",
"cfg",
".",
"CheckAndSetDefaults",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"r... | // NewTLSClient returns a new TLS client that uses mutual TLS authentication
// and dials the remote server using dialer | [
"NewTLSClient",
"returns",
"a",
"new",
"TLS",
"client",
"that",
"uses",
"mutual",
"TLS",
"authentication",
"and",
"dials",
"the",
"remote",
"server",
"using",
"dialer"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L210-L252 | train |
gravitational/teleport | lib/auth/clt.go | grpc | func (c *Client) grpc() (proto.AuthServiceClient, error) {
// it's ok to lock here, because Dial below is not locking
c.Lock()
defer c.Unlock()
if c.grpcClient != nil {
return c.grpcClient, nil
}
dialer := grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
if c.isClosed() {
retur... | go | func (c *Client) grpc() (proto.AuthServiceClient, error) {
// it's ok to lock here, because Dial below is not locking
c.Lock()
defer c.Unlock()
if c.grpcClient != nil {
return c.grpcClient, nil
}
dialer := grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
if c.isClosed() {
retur... | [
"func",
"(",
"c",
"*",
"Client",
")",
"grpc",
"(",
")",
"(",
"proto",
".",
"AuthServiceClient",
",",
"error",
")",
"{",
"// it's ok to lock here, because Dial below is not locking",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"... | // grpc returns grpc client | [
"grpc",
"returns",
"grpc",
"client"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L263-L299 | train |
gravitational/teleport | lib/auth/clt.go | PutJSON | func (c *Client) PutJSON(
endpoint string, val interface{}) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.PutJSON(context.TODO(), endpoint, val))
} | go | func (c *Client) PutJSON(
endpoint string, val interface{}) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.PutJSON(context.TODO(), endpoint, val))
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PutJSON",
"(",
"endpoint",
"string",
",",
"val",
"interface",
"{",
"}",
")",
"(",
"*",
"roundtrip",
".",
"Response",
",",
"error",
")",
"{",
"return",
"httplib",
".",
"ConvertResponse",
"(",
"c",
".",
"Client",
... | // PutJSON is a generic method that issues http PUT request to the server | [
"PutJSON",
"is",
"a",
"generic",
"method",
"that",
"issues",
"http",
"PUT",
"request",
"to",
"the",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L312-L315 | train |
gravitational/teleport | lib/auth/clt.go | PostForm | func (c *Client) PostForm(
endpoint string,
vals url.Values,
files ...roundtrip.File) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.PostForm(context.TODO(), endpoint, vals, files...))
} | go | func (c *Client) PostForm(
endpoint string,
vals url.Values,
files ...roundtrip.File) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.PostForm(context.TODO(), endpoint, vals, files...))
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PostForm",
"(",
"endpoint",
"string",
",",
"vals",
"url",
".",
"Values",
",",
"files",
"...",
"roundtrip",
".",
"File",
")",
"(",
"*",
"roundtrip",
".",
"Response",
",",
"error",
")",
"{",
"return",
"httplib",
"... | // PostForm is a generic method that issues http POST request to the server | [
"PostForm",
"is",
"a",
"generic",
"method",
"that",
"issues",
"http",
"POST",
"request",
"to",
"the",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L318-L323 | train |
gravitational/teleport | lib/auth/clt.go | Get | func (c *Client) Get(u string, params url.Values) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.Get(context.TODO(), u, params))
} | go | func (c *Client) Get(u string, params url.Values) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.Get(context.TODO(), u, params))
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Get",
"(",
"u",
"string",
",",
"params",
"url",
".",
"Values",
")",
"(",
"*",
"roundtrip",
".",
"Response",
",",
"error",
")",
"{",
"return",
"httplib",
".",
"ConvertResponse",
"(",
"c",
".",
"Client",
".",
"G... | // Get issues http GET request to the server | [
"Get",
"issues",
"http",
"GET",
"request",
"to",
"the",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L326-L328 | train |
gravitational/teleport | lib/auth/clt.go | Delete | func (c *Client) Delete(u string) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.Delete(context.TODO(), u))
} | go | func (c *Client) Delete(u string) (*roundtrip.Response, error) {
return httplib.ConvertResponse(c.Client.Delete(context.TODO(), u))
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Delete",
"(",
"u",
"string",
")",
"(",
"*",
"roundtrip",
".",
"Response",
",",
"error",
")",
"{",
"return",
"httplib",
".",
"ConvertResponse",
"(",
"c",
".",
"Client",
".",
"Delete",
"(",
"context",
".",
"TODO",... | // Delete issues http Delete Request to the server | [
"Delete",
"issues",
"http",
"Delete",
"Request",
"to",
"the",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L331-L333 | train |
gravitational/teleport | lib/auth/clt.go | GetSessions | func (c *Client) GetSessions(namespace string) ([]session.Session, error) {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
out, err := c.Get(c.Endpoint("namespaces", namespace, "sessions"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var sessions []session.Session... | go | func (c *Client) GetSessions(namespace string) ([]session.Session, error) {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
out, err := c.Get(c.Endpoint("namespaces", namespace, "sessions"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var sessions []session.Session... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSessions",
"(",
"namespace",
"string",
")",
"(",
"[",
"]",
"session",
".",
"Session",
",",
"error",
")",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"BadParameter",
"(",... | // GetSessions returns a list of active sessions in the cluster
// as reported by auth server | [
"GetSessions",
"returns",
"a",
"list",
"of",
"active",
"sessions",
"in",
"the",
"cluster",
"as",
"reported",
"by",
"auth",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L354-L367 | train |
gravitational/teleport | lib/auth/clt.go | GetSession | func (c *Client) GetSession(namespace string, id session.ID) (*session.Session, error) {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
// saving extra round-trip
if err := id.Check(); err != nil {
return nil, trace.Wrap(err)
}
out, err := c.Get(c.Endpoint("namespaces", namespace... | go | func (c *Client) GetSession(namespace string, id session.ID) (*session.Session, error) {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
// saving extra round-trip
if err := id.Check(); err != nil {
return nil, trace.Wrap(err)
}
out, err := c.Get(c.Endpoint("namespaces", namespace... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSession",
"(",
"namespace",
"string",
",",
"id",
"session",
".",
"ID",
")",
"(",
"*",
"session",
".",
"Session",
",",
"error",
")",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trac... | // GetSession returns a session by ID | [
"GetSession",
"returns",
"a",
"session",
"by",
"ID"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L370-L387 | train |
gravitational/teleport | lib/auth/clt.go | DeleteSession | func (c *Client) DeleteSession(namespace, id string) error {
if namespace == "" {
return trace.BadParameter(MissingNamespaceError)
}
_, err := c.Delete(c.Endpoint("namespaces", namespace, "sessions", id))
return trace.Wrap(err)
} | go | func (c *Client) DeleteSession(namespace, id string) error {
if namespace == "" {
return trace.BadParameter(MissingNamespaceError)
}
_, err := c.Delete(c.Endpoint("namespaces", namespace, "sessions", id))
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteSession",
"(",
"namespace",
",",
"id",
"string",
")",
"error",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"MissingNamespaceError",
")",
"\n",
"}",
"\n",
"_",
... | // DeleteSession deletes a session by ID | [
"DeleteSession",
"deletes",
"a",
"session",
"by",
"ID"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L390-L396 | train |
gravitational/teleport | lib/auth/clt.go | CreateSession | func (c *Client) CreateSession(sess session.Session) error {
if sess.Namespace == "" {
return trace.BadParameter(MissingNamespaceError)
}
_, err := c.PostJSON(c.Endpoint("namespaces", sess.Namespace, "sessions"), createSessionReq{Session: sess})
return trace.Wrap(err)
} | go | func (c *Client) CreateSession(sess session.Session) error {
if sess.Namespace == "" {
return trace.BadParameter(MissingNamespaceError)
}
_, err := c.PostJSON(c.Endpoint("namespaces", sess.Namespace, "sessions"), createSessionReq{Session: sess})
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateSession",
"(",
"sess",
"session",
".",
"Session",
")",
"error",
"{",
"if",
"sess",
".",
"Namespace",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"MissingNamespaceError",
")",
"\n",
"}",... | // CreateSession creates new session | [
"CreateSession",
"creates",
"new",
"session"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L399-L405 | train |
gravitational/teleport | lib/auth/clt.go | UpdateSession | func (c *Client) UpdateSession(req session.UpdateRequest) error {
if err := req.Check(); err != nil {
return trace.Wrap(err)
}
_, err := c.PutJSON(c.Endpoint("namespaces", req.Namespace, "sessions", string(req.ID)), updateSessionReq{Update: req})
return trace.Wrap(err)
} | go | func (c *Client) UpdateSession(req session.UpdateRequest) error {
if err := req.Check(); err != nil {
return trace.Wrap(err)
}
_, err := c.PutJSON(c.Endpoint("namespaces", req.Namespace, "sessions", string(req.ID)), updateSessionReq{Update: req})
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateSession",
"(",
"req",
"session",
".",
"UpdateRequest",
")",
"error",
"{",
"if",
"err",
":=",
"req",
".",
"Check",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wrap",
"(",
"err",
")",
... | // UpdateSession updates existing session | [
"UpdateSession",
"updates",
"existing",
"session"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L408-L414 | train |
gravitational/teleport | lib/auth/clt.go | GetDomainName | func (c *Client) GetDomainName() (string, error) {
out, err := c.Get(c.Endpoint("domain"), url.Values{})
if err != nil {
return "", trace.Wrap(err)
}
var domain string
if err := json.Unmarshal(out.Bytes(), &domain); err != nil {
return "", trace.Wrap(err)
}
return domain, nil
} | go | func (c *Client) GetDomainName() (string, error) {
out, err := c.Get(c.Endpoint("domain"), url.Values{})
if err != nil {
return "", trace.Wrap(err)
}
var domain string
if err := json.Unmarshal(out.Bytes(), &domain); err != nil {
return "", trace.Wrap(err)
}
return domain, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDomainName",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
")",
",",
"url",
".",
"Values",
"{",
"}",
")",
"\n",... | // GetDomainName returns local auth domain of the current auth server | [
"GetDomainName",
"returns",
"local",
"auth",
"domain",
"of",
"the",
"current",
"auth",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L417-L427 | train |
gravitational/teleport | lib/auth/clt.go | RotateExternalCertAuthority | func (c *Client) RotateExternalCertAuthority(ca services.CertAuthority) error {
if err := ca.Check(); err != nil {
return trace.Wrap(err)
}
data, err := services.GetCertAuthorityMarshaler().MarshalCertAuthority(ca)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("authorities", string(c... | go | func (c *Client) RotateExternalCertAuthority(ca services.CertAuthority) error {
if err := ca.Check(); err != nil {
return trace.Wrap(err)
}
data, err := services.GetCertAuthorityMarshaler().MarshalCertAuthority(ca)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("authorities", string(c... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RotateExternalCertAuthority",
"(",
"ca",
"services",
".",
"CertAuthority",
")",
"error",
"{",
"if",
"err",
":=",
"ca",
".",
"Check",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wrap",
"(",
"... | // RotateExternalCertAuthority rotates external certificate authority,
// this method is used to update only public keys and certificates of the
// the certificate authorities of trusted clusters. | [
"RotateExternalCertAuthority",
"rotates",
"external",
"certificate",
"authority",
"this",
"method",
"is",
"used",
"to",
"update",
"only",
"public",
"keys",
"and",
"certificates",
"of",
"the",
"the",
"certificate",
"authorities",
"of",
"trusted",
"clusters",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L479-L490 | train |
gravitational/teleport | lib/auth/clt.go | GetCertAuthorities | func (c *Client) GetCertAuthorities(caType services.CertAuthType, loadKeys bool, opts ...services.MarshalOption) ([]services.CertAuthority, error) {
if err := caType.Check(); err != nil {
return nil, trace.Wrap(err)
}
out, err := c.Get(c.Endpoint("authorities", string(caType)), url.Values{
"load_keys": []string{... | go | func (c *Client) GetCertAuthorities(caType services.CertAuthType, loadKeys bool, opts ...services.MarshalOption) ([]services.CertAuthority, error) {
if err := caType.Check(); err != nil {
return nil, trace.Wrap(err)
}
out, err := c.Get(c.Endpoint("authorities", string(caType)), url.Values{
"load_keys": []string{... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetCertAuthorities",
"(",
"caType",
"services",
".",
"CertAuthType",
",",
"loadKeys",
"bool",
",",
"opts",
"...",
"services",
".",
"MarshalOption",
")",
"(",
"[",
"]",
"services",
".",
"CertAuthority",
",",
"error",
"... | // GetCertAuthorities returns a list of certificate authorities | [
"GetCertAuthorities",
"returns",
"a",
"list",
"of",
"certificate",
"authorities"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L513-L536 | train |
gravitational/teleport | lib/auth/clt.go | DeleteCertAuthority | func (c *Client) DeleteCertAuthority(id services.CertAuthID) error {
if err := id.Check(); err != nil {
return trace.Wrap(err)
}
_, err := c.Delete(c.Endpoint("authorities", string(id.Type), id.DomainName))
return trace.Wrap(err)
} | go | func (c *Client) DeleteCertAuthority(id services.CertAuthID) error {
if err := id.Check(); err != nil {
return trace.Wrap(err)
}
_, err := c.Delete(c.Endpoint("authorities", string(id.Type), id.DomainName))
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteCertAuthority",
"(",
"id",
"services",
".",
"CertAuthID",
")",
"error",
"{",
"if",
"err",
":=",
"id",
".",
"Check",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wrap",
"(",
"err",
")"... | // DeleteCertAuthority deletes cert authority by ID | [
"DeleteCertAuthority",
"deletes",
"cert",
"authority",
"by",
"ID"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L555-L561 | train |
gravitational/teleport | lib/auth/clt.go | GenerateToken | func (c *Client) GenerateToken(req GenerateTokenRequest) (string, error) {
out, err := c.PostJSON(c.Endpoint("tokens"), req)
if err != nil {
return "", trace.Wrap(err)
}
var token string
if err := json.Unmarshal(out.Bytes(), &token); err != nil {
return "", trace.Wrap(err)
}
return token, nil
} | go | func (c *Client) GenerateToken(req GenerateTokenRequest) (string, error) {
out, err := c.PostJSON(c.Endpoint("tokens"), req)
if err != nil {
return "", trace.Wrap(err)
}
var token string
if err := json.Unmarshal(out.Bytes(), &token); err != nil {
return "", trace.Wrap(err)
}
return token, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GenerateToken",
"(",
"req",
"GenerateTokenRequest",
")",
"(",
"string",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
")",
",",
"req",
")",
... | // GenerateToken creates a special provisioning token for a new SSH server
// that is valid for ttl period seconds.
//
// This token is used by SSH server to authenticate with Auth server
// and get signed certificate and private key from the auth server.
//
// If token is not supplied, it will be auto generated and re... | [
"GenerateToken",
"creates",
"a",
"special",
"provisioning",
"token",
"for",
"a",
"new",
"SSH",
"server",
"that",
"is",
"valid",
"for",
"ttl",
"period",
"seconds",
".",
"This",
"token",
"is",
"used",
"by",
"SSH",
"server",
"to",
"authenticate",
"with",
"Auth"... | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L583-L593 | train |
gravitational/teleport | lib/auth/clt.go | RegisterUsingToken | func (c *Client) RegisterUsingToken(req RegisterUsingTokenRequest) (*PackedKeys, error) {
if err := req.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
out, err := c.PostJSON(c.Endpoint("tokens", "register"), req)
if err != nil {
return nil, trace.Wrap(err)
}
var keys PackedKeys
if err := j... | go | func (c *Client) RegisterUsingToken(req RegisterUsingTokenRequest) (*PackedKeys, error) {
if err := req.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
out, err := c.PostJSON(c.Endpoint("tokens", "register"), req)
if err != nil {
return nil, trace.Wrap(err)
}
var keys PackedKeys
if err := j... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RegisterUsingToken",
"(",
"req",
"RegisterUsingTokenRequest",
")",
"(",
"*",
"PackedKeys",
",",
"error",
")",
"{",
"if",
"err",
":=",
"req",
".",
"CheckAndSetDefaults",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"retur... | // RegisterUsingToken calls the auth service API to register a new node using a registration token
// which was previously issued via GenerateToken. | [
"RegisterUsingToken",
"calls",
"the",
"auth",
"service",
"API",
"to",
"register",
"a",
"new",
"node",
"using",
"a",
"registration",
"token",
"which",
"was",
"previously",
"issued",
"via",
"GenerateToken",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L597-L610 | train |
gravitational/teleport | lib/auth/clt.go | GetTokens | func (c *Client) GetTokens(opts ...services.MarshalOption) ([]services.ProvisionToken, error) {
out, err := c.Get(c.Endpoint("tokens"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var tokens []services.ProvisionTokenV1
if err := json.Unmarshal(out.Bytes(), &tokens); err != nil {
return nil, tra... | go | func (c *Client) GetTokens(opts ...services.MarshalOption) ([]services.ProvisionToken, error) {
out, err := c.Get(c.Endpoint("tokens"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var tokens []services.ProvisionTokenV1
if err := json.Unmarshal(out.Bytes(), &tokens); err != nil {
return nil, tra... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetTokens",
"(",
"opts",
"...",
"services",
".",
"MarshalOption",
")",
"(",
"[",
"]",
"services",
".",
"ProvisionToken",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoi... | // GetTokens returns a list of active invitation tokens for nodes and users | [
"GetTokens",
"returns",
"a",
"list",
"of",
"active",
"invitation",
"tokens",
"for",
"nodes",
"and",
"users"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L644-L654 | train |
gravitational/teleport | lib/auth/clt.go | GetToken | func (c *Client) GetToken(token string) (services.ProvisionToken, error) {
out, err := c.Get(c.Endpoint("tokens", token), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
return services.UnmarshalProvisionToken(out.Bytes(), services.SkipValidation())
} | go | func (c *Client) GetToken(token string) (services.ProvisionToken, error) {
out, err := c.Get(c.Endpoint("tokens", token), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
return services.UnmarshalProvisionToken(out.Bytes(), services.SkipValidation())
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetToken",
"(",
"token",
"string",
")",
"(",
"services",
".",
"ProvisionToken",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"token",
")"... | // GetToken returns provisioning token | [
"GetToken",
"returns",
"provisioning",
"token"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L657-L663 | train |
gravitational/teleport | lib/auth/clt.go | RegisterNewAuthServer | func (c *Client) RegisterNewAuthServer(token string) error {
_, err := c.PostJSON(c.Endpoint("tokens", "register", "auth"), registerNewAuthServerReq{
Token: token,
})
return trace.Wrap(err)
} | go | func (c *Client) RegisterNewAuthServer(token string) error {
_, err := c.PostJSON(c.Endpoint("tokens", "register", "auth"), registerNewAuthServerReq{
Token: token,
})
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RegisterNewAuthServer",
"(",
"token",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"regist... | // RegisterNewAuthServer is used to register new auth server with token | [
"RegisterNewAuthServer",
"is",
"used",
"to",
"register",
"new",
"auth",
"server",
"with",
"token"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L673-L678 | train |
gravitational/teleport | lib/auth/clt.go | UpsertNode | func (c *Client) UpsertNode(s services.Server) (*services.KeepAlive, error) {
if s.GetNamespace() == "" {
return nil, trace.BadParameter("missing node namespace")
}
protoServer, ok := s.(*services.ServerV2)
if !ok {
return nil, trace.BadParameter("unsupported client")
}
clt, err := c.grpc()
if err != nil {
... | go | func (c *Client) UpsertNode(s services.Server) (*services.KeepAlive, error) {
if s.GetNamespace() == "" {
return nil, trace.BadParameter("missing node namespace")
}
protoServer, ok := s.(*services.ServerV2)
if !ok {
return nil, trace.BadParameter("unsupported client")
}
clt, err := c.grpc()
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertNode",
"(",
"s",
"services",
".",
"Server",
")",
"(",
"*",
"services",
".",
"KeepAlive",
",",
"error",
")",
"{",
"if",
"s",
".",
"GetNamespace",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"... | // UpsertNode is used by SSH servers to reprt their presence
// to the auth servers in form of hearbeat expiring after ttl period. | [
"UpsertNode",
"is",
"used",
"by",
"SSH",
"servers",
"to",
"reprt",
"their",
"presence",
"to",
"the",
"auth",
"servers",
"in",
"form",
"of",
"hearbeat",
"expiring",
"after",
"ttl",
"period",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L682-L699 | train |
gravitational/teleport | lib/auth/clt.go | KeepAliveNode | func (c *Client) KeepAliveNode(ctx context.Context, keepAlive services.KeepAlive) error {
return trace.BadParameter("not implemented, use StreamKeepAlives instead")
} | go | func (c *Client) KeepAliveNode(ctx context.Context, keepAlive services.KeepAlive) error {
return trace.BadParameter("not implemented, use StreamKeepAlives instead")
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"KeepAliveNode",
"(",
"ctx",
"context",
".",
"Context",
",",
"keepAlive",
"services",
".",
"KeepAlive",
")",
"error",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // KeepAliveNode updates node keep alive information | [
"KeepAliveNode",
"updates",
"node",
"keep",
"alive",
"information"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L702-L704 | train |
gravitational/teleport | lib/auth/clt.go | recv | func (k *streamKeepAliver) recv() {
err := k.stream.RecvMsg(&empty.Empty{})
k.closeWithError(trail.FromGRPC(err))
} | go | func (k *streamKeepAliver) recv() {
err := k.stream.RecvMsg(&empty.Empty{})
k.closeWithError(trail.FromGRPC(err))
} | [
"func",
"(",
"k",
"*",
"streamKeepAliver",
")",
"recv",
"(",
")",
"{",
"err",
":=",
"k",
".",
"stream",
".",
"RecvMsg",
"(",
"&",
"empty",
".",
"Empty",
"{",
"}",
")",
"\n",
"k",
".",
"closeWithError",
"(",
"trail",
".",
"FromGRPC",
"(",
"err",
"... | // recv is necessary to receive errors from the
// server, otherwise no errors will be propagated | [
"recv",
"is",
"necessary",
"to",
"receive",
"errors",
"from",
"the",
"server",
"otherwise",
"no",
"errors",
"will",
"be",
"propagated"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L769-L772 | train |
gravitational/teleport | lib/auth/clt.go | UpsertNodes | func (c *Client) UpsertNodes(namespace string, servers []services.Server) error {
if namespace == "" {
return trace.BadParameter("missing node namespace")
}
bytes, err := services.GetServerMarshaler().MarshalServers(servers)
if err != nil {
return trace.Wrap(err)
}
args := &upsertNodesReq{
Namespace: names... | go | func (c *Client) UpsertNodes(namespace string, servers []services.Server) error {
if namespace == "" {
return trace.BadParameter("missing node namespace")
}
bytes, err := services.GetServerMarshaler().MarshalServers(servers)
if err != nil {
return trace.Wrap(err)
}
args := &upsertNodesReq{
Namespace: names... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertNodes",
"(",
"namespace",
"string",
",",
"servers",
"[",
"]",
"services",
".",
"Server",
")",
"error",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
... | // UpsertNodes bulk inserts nodes. | [
"UpsertNodes",
"bulk",
"inserts",
"nodes",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L873-L888 | train |
gravitational/teleport | lib/auth/clt.go | DeleteNode | func (c *Client) DeleteNode(namespace string, name string) error {
if namespace == "" {
return trace.BadParameter("missing parameter namespace")
}
if name == "" {
return trace.BadParameter("missing parameter name")
}
_, err := c.Delete(c.Endpoint("namespaces", namespace, "nodes", name))
if err != nil {
retu... | go | func (c *Client) DeleteNode(namespace string, name string) error {
if namespace == "" {
return trace.BadParameter("missing parameter namespace")
}
if name == "" {
return trace.BadParameter("missing parameter name")
}
_, err := c.Delete(c.Endpoint("namespaces", namespace, "nodes", name))
if err != nil {
retu... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteNode",
"(",
"namespace",
"string",
",",
"name",
"string",
")",
"error",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
... | // DeleteNode deletes node in the namespace by name | [
"DeleteNode",
"deletes",
"node",
"in",
"the",
"namespace",
"by",
"name"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L900-L912 | train |
gravitational/teleport | lib/auth/clt.go | GetNodes | func (c *Client) GetNodes(namespace string, opts ...services.MarshalOption) ([]services.Server, error) {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
cfg, err := services.CollectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
out, err := c.Get(c.Endpoint("namespace... | go | func (c *Client) GetNodes(namespace string, opts ...services.MarshalOption) ([]services.Server, error) {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
cfg, err := services.CollectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
out, err := c.Get(c.Endpoint("namespace... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetNodes",
"(",
"namespace",
"string",
",",
"opts",
"...",
"services",
".",
"MarshalOption",
")",
"(",
"[",
"]",
"services",
".",
"Server",
",",
"error",
")",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"retu... | // GetNodes returns the list of servers registered in the cluster. | [
"GetNodes",
"returns",
"the",
"list",
"of",
"servers",
"registered",
"in",
"the",
"cluster",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L915-L948 | train |
gravitational/teleport | lib/auth/clt.go | UpsertReverseTunnel | func (c *Client) UpsertReverseTunnel(tunnel services.ReverseTunnel) error {
data, err := services.GetReverseTunnelMarshaler().MarshalReverseTunnel(tunnel)
if err != nil {
return trace.Wrap(err)
}
args := &upsertReverseTunnelRawReq{
ReverseTunnel: data,
}
_, err = c.PostJSON(c.Endpoint("reversetunnels"), args)... | go | func (c *Client) UpsertReverseTunnel(tunnel services.ReverseTunnel) error {
data, err := services.GetReverseTunnelMarshaler().MarshalReverseTunnel(tunnel)
if err != nil {
return trace.Wrap(err)
}
args := &upsertReverseTunnelRawReq{
ReverseTunnel: data,
}
_, err = c.PostJSON(c.Endpoint("reversetunnels"), args)... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertReverseTunnel",
"(",
"tunnel",
"services",
".",
"ReverseTunnel",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetReverseTunnelMarshaler",
"(",
")",
".",
"MarshalReverseTunnel",
"(",
"tunnel",
")",
... | // UpsertReverseTunnel is used by admins to create a new reverse tunnel
// to the remote proxy to bypass firewall restrictions | [
"UpsertReverseTunnel",
"is",
"used",
"by",
"admins",
"to",
"create",
"a",
"new",
"reverse",
"tunnel",
"to",
"the",
"remote",
"proxy",
"to",
"bypass",
"firewall",
"restrictions"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L952-L962 | train |
gravitational/teleport | lib/auth/clt.go | GetReverseTunnels | func (c *Client) GetReverseTunnels(opts ...services.MarshalOption) ([]services.ReverseTunnel, error) {
out, err := c.Get(c.Endpoint("reversetunnels"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, ... | go | func (c *Client) GetReverseTunnels(opts ...services.MarshalOption) ([]services.ReverseTunnel, error) {
out, err := c.Get(c.Endpoint("reversetunnels"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetReverseTunnels",
"(",
"opts",
"...",
"services",
".",
"MarshalOption",
")",
"(",
"[",
"]",
"services",
".",
"ReverseTunnel",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
... | // GetReverseTunnels returns the list of created reverse tunnels | [
"GetReverseTunnels",
"returns",
"the",
"list",
"of",
"created",
"reverse",
"tunnels"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L970-L988 | train |
gravitational/teleport | lib/auth/clt.go | DeleteReverseTunnel | func (c *Client) DeleteReverseTunnel(domainName string) error {
// this is to avoid confusing error in case if domain empty for example
// HTTP route will fail producing generic not found error
// instead we catch the error here
if strings.TrimSpace(domainName) == "" {
return trace.BadParameter("empty domain name... | go | func (c *Client) DeleteReverseTunnel(domainName string) error {
// this is to avoid confusing error in case if domain empty for example
// HTTP route will fail producing generic not found error
// instead we catch the error here
if strings.TrimSpace(domainName) == "" {
return trace.BadParameter("empty domain name... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteReverseTunnel",
"(",
"domainName",
"string",
")",
"error",
"{",
"// this is to avoid confusing error in case if domain empty for example",
"// HTTP route will fail producing generic not found error",
"// instead we catch the error here",
"... | // DeleteReverseTunnel deletes reverse tunnel by domain name | [
"DeleteReverseTunnel",
"deletes",
"reverse",
"tunnel",
"by",
"domain",
"name"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L991-L1000 | train |
gravitational/teleport | lib/auth/clt.go | UpsertTunnelConnection | func (c *Client) UpsertTunnelConnection(conn services.TunnelConnection) error {
data, err := services.MarshalTunnelConnection(conn)
if err != nil {
return trace.Wrap(err)
}
args := &upsertTunnelConnectionRawReq{
TunnelConnection: data,
}
_, err = c.PostJSON(c.Endpoint("tunnelconnections"), args)
return trace... | go | func (c *Client) UpsertTunnelConnection(conn services.TunnelConnection) error {
data, err := services.MarshalTunnelConnection(conn)
if err != nil {
return trace.Wrap(err)
}
args := &upsertTunnelConnectionRawReq{
TunnelConnection: data,
}
_, err = c.PostJSON(c.Endpoint("tunnelconnections"), args)
return trace... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertTunnelConnection",
"(",
"conn",
"services",
".",
"TunnelConnection",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"MarshalTunnelConnection",
"(",
"conn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // UpsertTunnelConnection upserts tunnel connection | [
"UpsertTunnelConnection",
"upserts",
"tunnel",
"connection"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1003-L1013 | train |
gravitational/teleport | lib/auth/clt.go | CreateRemoteCluster | func (c *Client) CreateRemoteCluster(rc services.RemoteCluster) error {
data, err := services.MarshalRemoteCluster(rc)
if err != nil {
return trace.Wrap(err)
}
args := &createRemoteClusterRawReq{
RemoteCluster: data,
}
_, err = c.PostJSON(c.Endpoint("remoteclusters"), args)
return trace.Wrap(err)
} | go | func (c *Client) CreateRemoteCluster(rc services.RemoteCluster) error {
data, err := services.MarshalRemoteCluster(rc)
if err != nil {
return trace.Wrap(err)
}
args := &createRemoteClusterRawReq{
RemoteCluster: data,
}
_, err = c.PostJSON(c.Endpoint("remoteclusters"), args)
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateRemoteCluster",
"(",
"rc",
"services",
".",
"RemoteCluster",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"MarshalRemoteCluster",
"(",
"rc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",... | // CreateRemoteCluster creates remote cluster resource | [
"CreateRemoteCluster",
"creates",
"remote",
"cluster",
"resource"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1151-L1161 | train |
gravitational/teleport | lib/auth/clt.go | GetAuthServers | func (c *Client) GetAuthServers() ([]services.Server, error) {
out, err := c.Get(c.Endpoint("authservers"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
re := make([]services.S... | go | func (c *Client) GetAuthServers() ([]services.Server, error) {
out, err := c.Get(c.Endpoint("authservers"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
re := make([]services.S... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAuthServers",
"(",
")",
"(",
"[",
"]",
"services",
".",
"Server",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
")",
",",
"url",
".",
"V... | // GetAuthServers returns the list of auth servers registered in the cluster. | [
"GetAuthServers",
"returns",
"the",
"list",
"of",
"auth",
"servers",
"registered",
"in",
"the",
"cluster",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1178-L1196 | train |
gravitational/teleport | lib/auth/clt.go | UpsertProxy | func (c *Client) UpsertProxy(s services.Server) error {
data, err := services.GetServerMarshaler().MarshalServer(s)
if err != nil {
return trace.Wrap(err)
}
args := &upsertServerRawReq{
Server: data,
}
_, err = c.PostJSON(c.Endpoint("proxies"), args)
return trace.Wrap(err)
} | go | func (c *Client) UpsertProxy(s services.Server) error {
data, err := services.GetServerMarshaler().MarshalServer(s)
if err != nil {
return trace.Wrap(err)
}
args := &upsertServerRawReq{
Server: data,
}
_, err = c.PostJSON(c.Endpoint("proxies"), args)
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertProxy",
"(",
"s",
"services",
".",
"Server",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetServerMarshaler",
"(",
")",
".",
"MarshalServer",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil... | // UpsertProxy is used by proxies to report their presence
// to other auth servers in form of hearbeat expiring after ttl period. | [
"UpsertProxy",
"is",
"used",
"by",
"proxies",
"to",
"report",
"their",
"presence",
"to",
"other",
"auth",
"servers",
"in",
"form",
"of",
"hearbeat",
"expiring",
"after",
"ttl",
"period",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1210-L1220 | train |
gravitational/teleport | lib/auth/clt.go | UpsertPassword | func (c *Client) UpsertPassword(user string, password []byte) error {
_, err := c.PostJSON(
c.Endpoint("users", user, "web", "password"),
upsertPasswordReq{
Password: string(password),
})
if err != nil {
return trace.Wrap(err)
}
return nil
} | go | func (c *Client) UpsertPassword(user string, password []byte) error {
_, err := c.PostJSON(
c.Endpoint("users", user, "web", "password"),
upsertPasswordReq{
Password: string(password),
})
if err != nil {
return trace.Wrap(err)
}
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertPassword",
"(",
"user",
"string",
",",
"password",
"[",
"]",
"byte",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"user",
",",
"\"",
... | // UpsertPassword updates web access password for the user | [
"UpsertPassword",
"updates",
"web",
"access",
"password",
"for",
"the",
"user"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1278-L1289 | train |
gravitational/teleport | lib/auth/clt.go | UpsertUser | func (c *Client) UpsertUser(user services.User) error {
data, err := services.GetUserMarshaler().MarshalUser(user)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("users"), &upsertUserRawReq{User: data})
return trace.Wrap(err)
} | go | func (c *Client) UpsertUser(user services.User) error {
data, err := services.GetUserMarshaler().MarshalUser(user)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("users"), &upsertUserRawReq{User: data})
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertUser",
"(",
"user",
"services",
".",
"User",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetUserMarshaler",
"(",
")",
".",
"MarshalUser",
"(",
"user",
")",
"\n",
"if",
"err",
"!=",
"nil"... | // UpsertUser user updates or inserts user entry | [
"UpsertUser",
"user",
"updates",
"or",
"inserts",
"user",
"entry"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1292-L1299 | train |
gravitational/teleport | lib/auth/clt.go | ChangePassword | func (c *Client) ChangePassword(req services.ChangePasswordReq) error {
_, err := c.PutJSON(c.Endpoint("users", req.User, "web", "password"), req)
return trace.Wrap(err)
} | go | func (c *Client) ChangePassword(req services.ChangePasswordReq) error {
_, err := c.PutJSON(c.Endpoint("users", req.User, "web", "password"), req)
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ChangePassword",
"(",
"req",
"services",
".",
"ChangePasswordReq",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PutJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"req",
".",
"User",
",",
"\"",... | // ChangePassword changes user password | [
"ChangePassword",
"changes",
"user",
"password"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1302-L1305 | train |
gravitational/teleport | lib/auth/clt.go | CheckPassword | func (c *Client) CheckPassword(user string, password []byte, otpToken string) error {
_, err := c.PostJSON(
c.Endpoint("users", user, "web", "password", "check"),
checkPasswordReq{
Password: string(password),
OTPToken: otpToken,
})
return trace.Wrap(err)
} | go | func (c *Client) CheckPassword(user string, password []byte, otpToken string) error {
_, err := c.PostJSON(
c.Endpoint("users", user, "web", "password", "check"),
checkPasswordReq{
Password: string(password),
OTPToken: otpToken,
})
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CheckPassword",
"(",
"user",
"string",
",",
"password",
"[",
"]",
"byte",
",",
"otpToken",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
... | // CheckPassword checks if the suplied web access password is valid. | [
"CheckPassword",
"checks",
"if",
"the",
"suplied",
"web",
"access",
"password",
"is",
"valid",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1308-L1316 | train |
gravitational/teleport | lib/auth/clt.go | GetU2FSignRequest | func (c *Client) GetU2FSignRequest(user string, password []byte) (*u2f.SignRequest, error) {
out, err := c.PostJSON(
c.Endpoint("u2f", "users", user, "sign"),
signInReq{
Password: string(password),
},
)
if err != nil {
return nil, trace.Wrap(err)
}
var signRequest *u2f.SignRequest
if err := json.Unmars... | go | func (c *Client) GetU2FSignRequest(user string, password []byte) (*u2f.SignRequest, error) {
out, err := c.PostJSON(
c.Endpoint("u2f", "users", user, "sign"),
signInReq{
Password: string(password),
},
)
if err != nil {
return nil, trace.Wrap(err)
}
var signRequest *u2f.SignRequest
if err := json.Unmars... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetU2FSignRequest",
"(",
"user",
"string",
",",
"password",
"[",
"]",
"byte",
")",
"(",
"*",
"u2f",
".",
"SignRequest",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"... | // GetU2FSignRequest generates request for user trying to authenticate with U2F token | [
"GetU2FSignRequest",
"generates",
"request",
"for",
"user",
"trying",
"to",
"authenticate",
"with",
"U2F",
"token"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1319-L1334 | train |
gravitational/teleport | lib/auth/clt.go | ExtendWebSession | func (c *Client) ExtendWebSession(user string, prevSessionID string) (services.WebSession, error) {
out, err := c.PostJSON(
c.Endpoint("users", user, "web", "sessions"),
createWebSessionReq{
PrevSessionID: prevSessionID,
},
)
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMar... | go | func (c *Client) ExtendWebSession(user string, prevSessionID string) (services.WebSession, error) {
out, err := c.PostJSON(
c.Endpoint("users", user, "web", "sessions"),
createWebSessionReq{
PrevSessionID: prevSessionID,
},
)
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMar... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ExtendWebSession",
"(",
"user",
"string",
",",
"prevSessionID",
"string",
")",
"(",
"services",
".",
"WebSession",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
... | // ExtendWebSession creates a new web session for a user based on another
// valid web session | [
"ExtendWebSession",
"creates",
"a",
"new",
"web",
"session",
"for",
"a",
"user",
"based",
"on",
"another",
"valid",
"web",
"session"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1338-L1349 | train |
gravitational/teleport | lib/auth/clt.go | GetWebSessionInfo | func (c *Client) GetWebSessionInfo(user string, sid string) (services.WebSession, error) {
out, err := c.Get(
c.Endpoint("users", user, "web", "sessions", sid), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} | go | func (c *Client) GetWebSessionInfo(user string, sid string) (services.WebSession, error) {
out, err := c.Get(
c.Endpoint("users", user, "web", "sessions", sid), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetWebSessionInfo",
"(",
"user",
"string",
",",
"sid",
"string",
")",
"(",
"services",
".",
"WebSession",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",... | // GetWebSessionInfo checks if a web sesion is valid, returns session id in case if
// it is valid, or error otherwise. | [
"GetWebSessionInfo",
"checks",
"if",
"a",
"web",
"sesion",
"is",
"valid",
"returns",
"session",
"id",
"in",
"case",
"if",
"it",
"is",
"valid",
"or",
"error",
"otherwise",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1395-L1402 | train |
gravitational/teleport | lib/auth/clt.go | DeleteWebSession | func (c *Client) DeleteWebSession(user string, sid string) error {
_, err := c.Delete(c.Endpoint("users", user, "web", "sessions", sid))
return trace.Wrap(err)
} | go | func (c *Client) DeleteWebSession(user string, sid string) error {
_, err := c.Delete(c.Endpoint("users", user, "web", "sessions", sid))
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteWebSession",
"(",
"user",
"string",
",",
"sid",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Delete",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"user",
",",
"\"",
"\"",
",",
... | // DeleteWebSession deletes a web session for this user by id | [
"DeleteWebSession",
"deletes",
"a",
"web",
"session",
"for",
"this",
"user",
"by",
"id"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1405-L1408 | train |
gravitational/teleport | lib/auth/clt.go | GetUser | func (c *Client) GetUser(name string) (services.User, error) {
if name == "" {
return nil, trace.BadParameter("missing username")
}
out, err := c.Get(c.Endpoint("users", name), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
user, err := services.GetUserMarshaler().UnmarshalUser(out.Bytes(), servi... | go | func (c *Client) GetUser(name string) (services.User, error) {
if name == "" {
return nil, trace.BadParameter("missing username")
}
out, err := c.Get(c.Endpoint("users", name), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
user, err := services.GetUserMarshaler().UnmarshalUser(out.Bytes(), servi... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetUser",
"(",
"name",
"string",
")",
"(",
"services",
".",
"User",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n"... | // GetUser returns a list of usernames registered in the system | [
"GetUser",
"returns",
"a",
"list",
"of",
"usernames",
"registered",
"in",
"the",
"system"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1411-L1424 | train |
gravitational/teleport | lib/auth/clt.go | GetUsers | func (c *Client) GetUsers() ([]services.User, error) {
out, err := c.Get(c.Endpoint("users"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
users := make([]services.User, len(it... | go | func (c *Client) GetUsers() ([]services.User, error) {
out, err := c.Get(c.Endpoint("users"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
users := make([]services.User, len(it... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetUsers",
"(",
")",
"(",
"[",
"]",
"services",
".",
"User",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
")",
",",
"url",
".",
"Values",
... | // GetUsers returns a list of usernames registered in the system | [
"GetUsers",
"returns",
"a",
"list",
"of",
"usernames",
"registered",
"in",
"the",
"system"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1427-L1445 | train |
gravitational/teleport | lib/auth/clt.go | DeleteUser | func (c *Client) DeleteUser(user string) error {
_, err := c.Delete(c.Endpoint("users", user))
return trace.Wrap(err)
} | go | func (c *Client) DeleteUser(user string) error {
_, err := c.Delete(c.Endpoint("users", user))
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteUser",
"(",
"user",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Delete",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"user",
")",
")",
"\n",
"return",
"trace",
".",
"Wrap",
"(... | // DeleteUser deletes a user by username | [
"DeleteUser",
"deletes",
"a",
"user",
"by",
"username"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1448-L1451 | train |
gravitational/teleport | lib/auth/clt.go | GenerateHostCert | func (c *Client) GenerateHostCert(
key []byte, hostID, nodeName string, principals []string, clusterName string, roles teleport.Roles, ttl time.Duration) ([]byte, error) {
out, err := c.PostJSON(c.Endpoint("ca", "host", "certs"),
generateHostCertReq{
Key: key,
HostID: hostID,
NodeName: nod... | go | func (c *Client) GenerateHostCert(
key []byte, hostID, nodeName string, principals []string, clusterName string, roles teleport.Roles, ttl time.Duration) ([]byte, error) {
out, err := c.PostJSON(c.Endpoint("ca", "host", "certs"),
generateHostCertReq{
Key: key,
HostID: hostID,
NodeName: nod... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GenerateHostCert",
"(",
"key",
"[",
"]",
"byte",
",",
"hostID",
",",
"nodeName",
"string",
",",
"principals",
"[",
"]",
"string",
",",
"clusterName",
"string",
",",
"roles",
"teleport",
".",
"Roles",
",",
"ttl",
"... | // GenerateHostCert takes the public key in the Open SSH ``authorized_keys``
// plain text format, signs it using Host Certificate Authority private key and returns the
// resulting certificate. | [
"GenerateHostCert",
"takes",
"the",
"public",
"key",
"in",
"the",
"Open",
"SSH",
"authorized_keys",
"plain",
"text",
"format",
"signs",
"it",
"using",
"Host",
"Certificate",
"Authority",
"private",
"key",
"and",
"returns",
"the",
"resulting",
"certificate",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1471-L1494 | train |
gravitational/teleport | lib/auth/clt.go | GetSignupTokenData | func (c *Client) GetSignupTokenData(token string) (user string, otpQRCode []byte, e error) {
out, err := c.Get(c.Endpoint("signuptokens", token), url.Values{})
if err != nil {
return "", nil, err
}
var tokenData getSignupTokenDataResponse
if err := json.Unmarshal(out.Bytes(), &tokenData); err != nil {
return ... | go | func (c *Client) GetSignupTokenData(token string) (user string, otpQRCode []byte, e error) {
out, err := c.Get(c.Endpoint("signuptokens", token), url.Values{})
if err != nil {
return "", nil, err
}
var tokenData getSignupTokenDataResponse
if err := json.Unmarshal(out.Bytes(), &tokenData); err != nil {
return ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSignupTokenData",
"(",
"token",
"string",
")",
"(",
"user",
"string",
",",
"otpQRCode",
"[",
"]",
"byte",
",",
"e",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
... | // GetSignupTokenData returns token data for a valid token | [
"GetSignupTokenData",
"returns",
"token",
"data",
"for",
"a",
"valid",
"token"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1517-L1529 | train |
gravitational/teleport | lib/auth/clt.go | GenerateUserCert | func (c *Client) GenerateUserCert(key []byte, user string, ttl time.Duration, compatibility string) ([]byte, error) {
out, err := c.PostJSON(c.Endpoint("ca", "user", "certs"),
generateUserCertReq{
Key: key,
User: user,
TTL: ttl,
Compatibility: compatibility,
})
if err != n... | go | func (c *Client) GenerateUserCert(key []byte, user string, ttl time.Duration, compatibility string) ([]byte, error) {
out, err := c.PostJSON(c.Endpoint("ca", "user", "certs"),
generateUserCertReq{
Key: key,
User: user,
TTL: ttl,
Compatibility: compatibility,
})
if err != n... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GenerateUserCert",
"(",
"key",
"[",
"]",
"byte",
",",
"user",
"string",
",",
"ttl",
"time",
".",
"Duration",
",",
"compatibility",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"out",
",",
"err... | // GenerateUserCert takes the public key in the OpenSSH `authorized_keys` plain
// text format, signs it using User Certificate Authority signing key and
// returns the resulting certificate. | [
"GenerateUserCert",
"takes",
"the",
"public",
"key",
"in",
"the",
"OpenSSH",
"authorized_keys",
"plain",
"text",
"format",
"signs",
"it",
"using",
"User",
"Certificate",
"Authority",
"signing",
"key",
"and",
"returns",
"the",
"resulting",
"certificate",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1534-L1550 | train |
gravitational/teleport | lib/auth/clt.go | GetSignupU2FRegisterRequest | func (c *Client) GetSignupU2FRegisterRequest(token string) (u2fRegisterRequest *u2f.RegisterRequest, e error) {
out, err := c.Get(c.Endpoint("u2f", "signuptokens", token), url.Values{})
if err != nil {
return nil, err
}
var u2fRegReq u2f.RegisterRequest
if err := json.Unmarshal(out.Bytes(), &u2fRegReq); err != n... | go | func (c *Client) GetSignupU2FRegisterRequest(token string) (u2fRegisterRequest *u2f.RegisterRequest, e error) {
out, err := c.Get(c.Endpoint("u2f", "signuptokens", token), url.Values{})
if err != nil {
return nil, err
}
var u2fRegReq u2f.RegisterRequest
if err := json.Unmarshal(out.Bytes(), &u2fRegReq); err != n... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSignupU2FRegisterRequest",
"(",
"token",
"string",
")",
"(",
"u2fRegisterRequest",
"*",
"u2f",
".",
"RegisterRequest",
",",
"e",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endp... | // GetSignupU2FRegisterRequest generates sign request for user trying to sign up with invite tokenx | [
"GetSignupU2FRegisterRequest",
"generates",
"sign",
"request",
"for",
"user",
"trying",
"to",
"sign",
"up",
"with",
"invite",
"tokenx"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1553-L1563 | train |
gravitational/teleport | lib/auth/clt.go | CreateUserWithOTP | func (c *Client) CreateUserWithOTP(token, password, otpToken string) (services.WebSession, error) {
out, err := c.PostJSON(c.Endpoint("signuptokens", "users"), createUserWithTokenReq{
Token: token,
Password: password,
OTPToken: otpToken,
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.G... | go | func (c *Client) CreateUserWithOTP(token, password, otpToken string) (services.WebSession, error) {
out, err := c.PostJSON(c.Endpoint("signuptokens", "users"), createUserWithTokenReq{
Token: token,
Password: password,
OTPToken: otpToken,
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.G... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateUserWithOTP",
"(",
"token",
",",
"password",
",",
"otpToken",
"string",
")",
"(",
"services",
".",
"WebSession",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpo... | // CreateUserWithOTP creates account with provided token and password.
// Account username and OTP key are taken from token data.
// Deletes token after account creation. | [
"CreateUserWithOTP",
"creates",
"account",
"with",
"provided",
"token",
"and",
"password",
".",
"Account",
"username",
"and",
"OTP",
"key",
"are",
"taken",
"from",
"token",
"data",
".",
"Deletes",
"token",
"after",
"account",
"creation",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1568-L1578 | train |
gravitational/teleport | lib/auth/clt.go | CreateUserWithU2FToken | func (c *Client) CreateUserWithU2FToken(token string, password string, u2fRegisterResponse u2f.RegisterResponse) (services.WebSession, error) {
out, err := c.PostJSON(c.Endpoint("u2f", "users"), createUserWithU2FTokenReq{
Token: token,
Password: password,
U2FRegisterResponse: u2fRegister... | go | func (c *Client) CreateUserWithU2FToken(token string, password string, u2fRegisterResponse u2f.RegisterResponse) (services.WebSession, error) {
out, err := c.PostJSON(c.Endpoint("u2f", "users"), createUserWithU2FTokenReq{
Token: token,
Password: password,
U2FRegisterResponse: u2fRegister... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateUserWithU2FToken",
"(",
"token",
"string",
",",
"password",
"string",
",",
"u2fRegisterResponse",
"u2f",
".",
"RegisterResponse",
")",
"(",
"services",
".",
"WebSession",
",",
"error",
")",
"{",
"out",
",",
"err",... | // CreateUserWithU2FToken creates user account with provided token and U2F sign response | [
"CreateUserWithU2FToken",
"creates",
"user",
"account",
"with",
"provided",
"token",
"and",
"U2F",
"sign",
"response"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1594-L1604 | train |
gravitational/teleport | lib/auth/clt.go | UpsertOIDCConnector | func (c *Client) UpsertOIDCConnector(connector services.OIDCConnector) error {
data, err := services.GetOIDCConnectorMarshaler().MarshalOIDCConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("oidc", "connectors"), &upsertOIDCConnectorRawReq{
Connector: data,
})
if err... | go | func (c *Client) UpsertOIDCConnector(connector services.OIDCConnector) error {
data, err := services.GetOIDCConnectorMarshaler().MarshalOIDCConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("oidc", "connectors"), &upsertOIDCConnectorRawReq{
Connector: data,
})
if err... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertOIDCConnector",
"(",
"connector",
"services",
".",
"OIDCConnector",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetOIDCConnectorMarshaler",
"(",
")",
".",
"MarshalOIDCConnector",
"(",
"connector",
... | // UpsertOIDCConnector updates or creates OIDC connector | [
"UpsertOIDCConnector",
"updates",
"or",
"creates",
"OIDC",
"connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1607-L1619 | train |
gravitational/teleport | lib/auth/clt.go | GetOIDCConnector | func (c *Client) GetOIDCConnector(id string, withSecrets bool) (services.OIDCConnector, error) {
if id == "" {
return nil, trace.BadParameter("missing connector id")
}
out, err := c.Get(c.Endpoint("oidc", "connectors", id),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
... | go | func (c *Client) GetOIDCConnector(id string, withSecrets bool) (services.OIDCConnector, error) {
if id == "" {
return nil, trace.BadParameter("missing connector id")
}
out, err := c.Get(c.Endpoint("oidc", "connectors", id),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetOIDCConnector",
"(",
"id",
"string",
",",
"withSecrets",
"bool",
")",
"(",
"services",
".",
"OIDCConnector",
",",
"error",
")",
"{",
"if",
"id",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"Bad... | // GetOIDCConnector returns OIDC connector information by id | [
"GetOIDCConnector",
"returns",
"OIDC",
"connector",
"information",
"by",
"id"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1622-L1632 | train |
gravitational/teleport | lib/auth/clt.go | GetOIDCConnectors | func (c *Client) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error) {
out, err := c.Get(c.Endpoint("oidc", "connectors"),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), ... | go | func (c *Client) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error) {
out, err := c.Get(c.Endpoint("oidc", "connectors"),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetOIDCConnectors",
"(",
"withSecrets",
"bool",
")",
"(",
"[",
"]",
"services",
".",
"OIDCConnector",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"... | // GetOIDCConnector gets OIDC connectors list | [
"GetOIDCConnector",
"gets",
"OIDC",
"connectors",
"list"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1635-L1654 | train |
gravitational/teleport | lib/auth/clt.go | CreateOIDCAuthRequest | func (c *Client) CreateOIDCAuthRequest(req services.OIDCAuthRequest) (*services.OIDCAuthRequest, error) {
out, err := c.PostJSON(c.Endpoint("oidc", "requests", "create"), createOIDCAuthRequestReq{
Req: req,
})
if err != nil {
return nil, trace.Wrap(err)
}
var response *services.OIDCAuthRequest
if err := json.... | go | func (c *Client) CreateOIDCAuthRequest(req services.OIDCAuthRequest) (*services.OIDCAuthRequest, error) {
out, err := c.PostJSON(c.Endpoint("oidc", "requests", "create"), createOIDCAuthRequestReq{
Req: req,
})
if err != nil {
return nil, trace.Wrap(err)
}
var response *services.OIDCAuthRequest
if err := json.... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateOIDCAuthRequest",
"(",
"req",
"services",
".",
"OIDCAuthRequest",
")",
"(",
"*",
"services",
".",
"OIDCAuthRequest",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"End... | // CreateOIDCAuthRequest creates OIDCAuthRequest | [
"CreateOIDCAuthRequest",
"creates",
"OIDCAuthRequest"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1666-L1678 | train |
gravitational/teleport | lib/auth/clt.go | CreateSAMLConnector | func (c *Client) CreateSAMLConnector(connector services.SAMLConnector) error {
data, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("saml", "connectors"), &createSAMLConnectorRawReq{
Connector: data,
})
if err... | go | func (c *Client) CreateSAMLConnector(connector services.SAMLConnector) error {
data, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("saml", "connectors"), &createSAMLConnectorRawReq{
Connector: data,
})
if err... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateSAMLConnector",
"(",
"connector",
"services",
".",
"SAMLConnector",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetSAMLConnectorMarshaler",
"(",
")",
".",
"MarshalSAMLConnector",
"(",
"connector",
... | // CreateOIDCConnector creates SAML connector | [
"CreateOIDCConnector",
"creates",
"SAML",
"connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1718-L1730 | train |
gravitational/teleport | lib/auth/clt.go | UpsertSAMLConnector | func (c *Client) UpsertSAMLConnector(connector services.SAMLConnector) error {
data, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PutJSON(c.Endpoint("saml", "connectors"), &upsertSAMLConnectorRawReq{
Connector: data,
})
if err ... | go | func (c *Client) UpsertSAMLConnector(connector services.SAMLConnector) error {
data, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PutJSON(c.Endpoint("saml", "connectors"), &upsertSAMLConnectorRawReq{
Connector: data,
})
if err ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertSAMLConnector",
"(",
"connector",
"services",
".",
"SAMLConnector",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetSAMLConnectorMarshaler",
"(",
")",
".",
"MarshalSAMLConnector",
"(",
"connector",
... | // UpsertSAMLConnector updates or creates OIDC connector | [
"UpsertSAMLConnector",
"updates",
"or",
"creates",
"OIDC",
"connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1733-L1745 | train |
gravitational/teleport | lib/auth/clt.go | GetSAMLConnector | func (c *Client) GetSAMLConnector(id string, withSecrets bool) (services.SAMLConnector, error) {
if id == "" {
return nil, trace.BadParameter("missing connector id")
}
out, err := c.Get(c.Endpoint("saml", "connectors", id),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
... | go | func (c *Client) GetSAMLConnector(id string, withSecrets bool) (services.SAMLConnector, error) {
if id == "" {
return nil, trace.BadParameter("missing connector id")
}
out, err := c.Get(c.Endpoint("saml", "connectors", id),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSAMLConnector",
"(",
"id",
"string",
",",
"withSecrets",
"bool",
")",
"(",
"services",
".",
"SAMLConnector",
",",
"error",
")",
"{",
"if",
"id",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"Bad... | // GetOIDCConnector returns SAML connector information by id | [
"GetOIDCConnector",
"returns",
"SAML",
"connector",
"information",
"by",
"id"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1748-L1758 | train |
gravitational/teleport | lib/auth/clt.go | GetSAMLConnectors | func (c *Client) GetSAMLConnectors(withSecrets bool) ([]services.SAMLConnector, error) {
out, err := c.Get(c.Endpoint("saml", "connectors"),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), ... | go | func (c *Client) GetSAMLConnectors(withSecrets bool) ([]services.SAMLConnector, error) {
out, err := c.Get(c.Endpoint("saml", "connectors"),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSAMLConnectors",
"(",
"withSecrets",
"bool",
")",
"(",
"[",
"]",
"services",
".",
"SAMLConnector",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"... | // GetSAMLConnectors gets SAML connectors list | [
"GetSAMLConnectors",
"gets",
"SAML",
"connectors",
"list"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1761-L1780 | train |
gravitational/teleport | lib/auth/clt.go | DeleteSAMLConnector | func (c *Client) DeleteSAMLConnector(connectorID string) error {
if connectorID == "" {
return trace.BadParameter("missing connector id")
}
_, err := c.Delete(c.Endpoint("saml", "connectors", connectorID))
return trace.Wrap(err)
} | go | func (c *Client) DeleteSAMLConnector(connectorID string) error {
if connectorID == "" {
return trace.BadParameter("missing connector id")
}
_, err := c.Delete(c.Endpoint("saml", "connectors", connectorID))
return trace.Wrap(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteSAMLConnector",
"(",
"connectorID",
"string",
")",
"error",
"{",
"if",
"connectorID",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
... | // DeleteSAMLConnector deletes SAML connector by ID | [
"DeleteSAMLConnector",
"deletes",
"SAML",
"connector",
"by",
"ID"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1783-L1789 | train |
gravitational/teleport | lib/auth/clt.go | CreateSAMLAuthRequest | func (c *Client) CreateSAMLAuthRequest(req services.SAMLAuthRequest) (*services.SAMLAuthRequest, error) {
out, err := c.PostJSON(c.Endpoint("saml", "requests", "create"), createSAMLAuthRequestReq{
Req: req,
})
if err != nil {
return nil, trace.Wrap(err)
}
var response *services.SAMLAuthRequest
if err := json.... | go | func (c *Client) CreateSAMLAuthRequest(req services.SAMLAuthRequest) (*services.SAMLAuthRequest, error) {
out, err := c.PostJSON(c.Endpoint("saml", "requests", "create"), createSAMLAuthRequestReq{
Req: req,
})
if err != nil {
return nil, trace.Wrap(err)
}
var response *services.SAMLAuthRequest
if err := json.... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateSAMLAuthRequest",
"(",
"req",
"services",
".",
"SAMLAuthRequest",
")",
"(",
"*",
"services",
".",
"SAMLAuthRequest",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"End... | // CreateSAMLAuthRequest creates SAML AuthnRequest | [
"CreateSAMLAuthRequest",
"creates",
"SAML",
"AuthnRequest"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1792-L1804 | train |
gravitational/teleport | lib/auth/clt.go | ValidateSAMLResponse | func (c *Client) ValidateSAMLResponse(re string) (*SAMLAuthResponse, error) {
out, err := c.PostJSON(c.Endpoint("saml", "requests", "validate"), validateSAMLResponseReq{
Response: re,
})
if err != nil {
return nil, trace.Wrap(err)
}
var rawResponse *samlAuthRawResponse
if err := json.Unmarshal(out.Bytes(), &r... | go | func (c *Client) ValidateSAMLResponse(re string) (*SAMLAuthResponse, error) {
out, err := c.PostJSON(c.Endpoint("saml", "requests", "validate"), validateSAMLResponseReq{
Response: re,
})
if err != nil {
return nil, trace.Wrap(err)
}
var rawResponse *samlAuthRawResponse
if err := json.Unmarshal(out.Bytes(), &r... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ValidateSAMLResponse",
"(",
"re",
"string",
")",
"(",
"*",
"SAMLAuthResponse",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"\"",
"\""... | // ValidateSAMLResponse validates response returned by SAML identity provider | [
"ValidateSAMLResponse",
"validates",
"response",
"returned",
"by",
"SAML",
"identity",
"provider"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1807-L1841 | train |
gravitational/teleport | lib/auth/clt.go | UpsertGithubConnector | func (c *Client) UpsertGithubConnector(connector services.GithubConnector) error {
bytes, err := services.GetGithubConnectorMarshaler().Marshal(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PutJSON(c.Endpoint("github", "connectors"), &upsertGithubConnectorRawReq{
Connector: bytes,
})
if err !... | go | func (c *Client) UpsertGithubConnector(connector services.GithubConnector) error {
bytes, err := services.GetGithubConnectorMarshaler().Marshal(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PutJSON(c.Endpoint("github", "connectors"), &upsertGithubConnectorRawReq{
Connector: bytes,
})
if err !... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpsertGithubConnector",
"(",
"connector",
"services",
".",
"GithubConnector",
")",
"error",
"{",
"bytes",
",",
"err",
":=",
"services",
".",
"GetGithubConnectorMarshaler",
"(",
")",
".",
"Marshal",
"(",
"connector",
")",
... | // UpsertGithubConnector creates or updates a Github connector | [
"UpsertGithubConnector",
"creates",
"or",
"updates",
"a",
"Github",
"connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1859-L1871 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.