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/auth/clt.go | GetGithubConnector | func (c *Client) GetGithubConnector(id string, withSecrets bool) (services.GithubConnector, error) {
out, err := c.Get(c.Endpoint("github", "connectors", id), url.Values{
"with_secrets": []string{strconv.FormatBool(withSecrets)},
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetGithubConnect... | go | func (c *Client) GetGithubConnector(id string, withSecrets bool) (services.GithubConnector, error) {
out, err := c.Get(c.Endpoint("github", "connectors", id), url.Values{
"with_secrets": []string{strconv.FormatBool(withSecrets)},
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetGithubConnect... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetGithubConnector",
"(",
"id",
"string",
",",
"withSecrets",
"bool",
")",
"(",
"services",
".",
"GithubConnector",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(... | // GetGithubConnector returns the specified Github connector | [
"GetGithubConnector",
"returns",
"the",
"specified",
"Github",
"connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1897-L1905 | train |
gravitational/teleport | lib/auth/clt.go | DeleteGithubConnector | func (c *Client) DeleteGithubConnector(id string) error {
_, err := c.Delete(c.Endpoint("github", "connectors", id))
if err != nil {
return trace.Wrap(err)
}
return nil
} | go | func (c *Client) DeleteGithubConnector(id string) error {
_, err := c.Delete(c.Endpoint("github", "connectors", id))
if err != nil {
return trace.Wrap(err)
}
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteGithubConnector",
"(",
"id",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Delete",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"id",
")",
")",
"\n",
"if",
"err... | // DeleteGithubConnector deletes the specified Github connector | [
"DeleteGithubConnector",
"deletes",
"the",
"specified",
"Github",
"connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1908-L1914 | train |
gravitational/teleport | lib/auth/clt.go | ValidateGithubAuthCallback | func (c *Client) ValidateGithubAuthCallback(q url.Values) (*GithubAuthResponse, error) {
out, err := c.PostJSON(c.Endpoint("github", "requests", "validate"),
validateGithubAuthCallbackReq{Query: q})
if err != nil {
return nil, trace.Wrap(err)
}
var rawResponse githubAuthRawResponse
if err := json.Unmarshal(out... | go | func (c *Client) ValidateGithubAuthCallback(q url.Values) (*GithubAuthResponse, error) {
out, err := c.PostJSON(c.Endpoint("github", "requests", "validate"),
validateGithubAuthCallbackReq{Query: q})
if err != nil {
return nil, trace.Wrap(err)
}
var rawResponse githubAuthRawResponse
if err := json.Unmarshal(out... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ValidateGithubAuthCallback",
"(",
"q",
"url",
".",
"Values",
")",
"(",
"*",
"GithubAuthResponse",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\""... | // ValidateGithubAuthCallback validates Github auth callback returned from redirect | [
"ValidateGithubAuthCallback",
"validates",
"Github",
"auth",
"callback",
"returned",
"from",
"redirect"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1931-L1965 | train |
gravitational/teleport | lib/auth/clt.go | SearchEvents | func (c *Client) SearchEvents(from, to time.Time, query string, limit int) ([]events.EventFields, error) {
q, err := url.ParseQuery(query)
if err != nil {
return nil, trace.BadParameter("query")
}
q.Set("from", from.Format(time.RFC3339))
q.Set("to", to.Format(time.RFC3339))
q.Set("limit", fmt.Sprintf("%v", limi... | go | func (c *Client) SearchEvents(from, to time.Time, query string, limit int) ([]events.EventFields, error) {
q, err := url.ParseQuery(query)
if err != nil {
return nil, trace.BadParameter("query")
}
q.Set("from", from.Format(time.RFC3339))
q.Set("to", to.Format(time.RFC3339))
q.Set("limit", fmt.Sprintf("%v", limi... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SearchEvents",
"(",
"from",
",",
"to",
"time",
".",
"Time",
",",
"query",
"string",
",",
"limit",
"int",
")",
"(",
"[",
"]",
"events",
".",
"EventFields",
",",
"error",
")",
"{",
"q",
",",
"err",
":=",
"url"... | // SearchEvents returns events that fit the criteria | [
"SearchEvents",
"returns",
"events",
"that",
"fit",
"the",
"criteria"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2075-L2092 | train |
gravitational/teleport | lib/auth/clt.go | GetClusterConfig | func (c *Client) GetClusterConfig(opts ...services.MarshalOption) (services.ClusterConfig, error) {
out, err := c.Get(c.Endpoint("configuration"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
cc, err := services.GetClusterConfigMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err ... | go | func (c *Client) GetClusterConfig(opts ...services.MarshalOption) (services.ClusterConfig, error) {
out, err := c.Get(c.Endpoint("configuration"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
cc, err := services.GetClusterConfigMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetClusterConfig",
"(",
"opts",
"...",
"services",
".",
"MarshalOption",
")",
"(",
"services",
".",
"ClusterConfig",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"... | // GetClusterConfig returns cluster level configuration information. | [
"GetClusterConfig",
"returns",
"cluster",
"level",
"configuration",
"information",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2211-L2223 | train |
gravitational/teleport | lib/auth/clt.go | SetClusterConfig | func (c *Client) SetClusterConfig(cc services.ClusterConfig) error {
data, err := services.GetClusterConfigMarshaler().Marshal(cc)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration"), &setClusterConfigReq{ClusterConfig: data})
if err != nil {
return trace.Wrap(err)
}
re... | go | func (c *Client) SetClusterConfig(cc services.ClusterConfig) error {
data, err := services.GetClusterConfigMarshaler().Marshal(cc)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration"), &setClusterConfigReq{ClusterConfig: data})
if err != nil {
return trace.Wrap(err)
}
re... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetClusterConfig",
"(",
"cc",
"services",
".",
"ClusterConfig",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetClusterConfigMarshaler",
"(",
")",
".",
"Marshal",
"(",
"cc",
")",
"\n",
"if",
"err",... | // SetClusterConfig sets cluster level configuration information. | [
"SetClusterConfig",
"sets",
"cluster",
"level",
"configuration",
"information",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2226-L2238 | train |
gravitational/teleport | lib/auth/clt.go | GetClusterName | func (c *Client) GetClusterName(opts ...services.MarshalOption) (services.ClusterName, error) {
out, err := c.Get(c.Endpoint("configuration", "name"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
cn, err := services.GetClusterNameMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if er... | go | func (c *Client) GetClusterName(opts ...services.MarshalOption) (services.ClusterName, error) {
out, err := c.Get(c.Endpoint("configuration", "name"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
cn, err := services.GetClusterNameMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if er... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetClusterName",
"(",
"opts",
"...",
"services",
".",
"MarshalOption",
")",
"(",
"services",
".",
"ClusterName",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
... | // GetClusterName returns a cluster name | [
"GetClusterName",
"returns",
"a",
"cluster",
"name"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2241-L2253 | train |
gravitational/teleport | lib/auth/clt.go | SetClusterName | func (c *Client) SetClusterName(cn services.ClusterName) error {
data, err := services.GetClusterNameMarshaler().Marshal(cn)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration", "name"), &setClusterNameReq{ClusterName: data})
if err != nil {
return trace.Wrap(err)
}
retu... | go | func (c *Client) SetClusterName(cn services.ClusterName) error {
data, err := services.GetClusterNameMarshaler().Marshal(cn)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration", "name"), &setClusterNameReq{ClusterName: data})
if err != nil {
return trace.Wrap(err)
}
retu... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetClusterName",
"(",
"cn",
"services",
".",
"ClusterName",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetClusterNameMarshaler",
"(",
")",
".",
"Marshal",
"(",
"cn",
")",
"\n",
"if",
"err",
"!=... | // SetClusterName sets cluster name once, will
// return Already Exists error if the name is already set | [
"SetClusterName",
"sets",
"cluster",
"name",
"once",
"will",
"return",
"Already",
"Exists",
"error",
"if",
"the",
"name",
"is",
"already",
"set"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2257-L2269 | train |
gravitational/teleport | lib/auth/clt.go | GetStaticTokens | func (c *Client) GetStaticTokens() (services.StaticTokens, error) {
out, err := c.Get(c.Endpoint("configuration", "static_tokens"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
st, err := services.GetStaticTokensMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err != nil {
retur... | go | func (c *Client) GetStaticTokens() (services.StaticTokens, error) {
out, err := c.Get(c.Endpoint("configuration", "static_tokens"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
st, err := services.GetStaticTokensMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err != nil {
retur... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetStaticTokens",
"(",
")",
"(",
"services",
".",
"StaticTokens",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"c",
".",
"Endpoint",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"u... | // GetStaticTokens returns a list of static register tokens | [
"GetStaticTokens",
"returns",
"a",
"list",
"of",
"static",
"register",
"tokens"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2283-L2295 | train |
gravitational/teleport | lib/auth/clt.go | SetStaticTokens | func (c *Client) SetStaticTokens(st services.StaticTokens) error {
data, err := services.GetStaticTokensMarshaler().Marshal(st)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration", "static_tokens"), &setStaticTokensReq{StaticTokens: data})
if err != nil {
return trace.Wrap(... | go | func (c *Client) SetStaticTokens(st services.StaticTokens) error {
data, err := services.GetStaticTokensMarshaler().Marshal(st)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration", "static_tokens"), &setStaticTokensReq{StaticTokens: data})
if err != nil {
return trace.Wrap(... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetStaticTokens",
"(",
"st",
"services",
".",
"StaticTokens",
")",
"error",
"{",
"data",
",",
"err",
":=",
"services",
".",
"GetStaticTokensMarshaler",
"(",
")",
".",
"Marshal",
"(",
"st",
")",
"\n",
"if",
"err",
... | // SetStaticTokens sets a list of static register tokens | [
"SetStaticTokens",
"sets",
"a",
"list",
"of",
"static",
"register",
"tokens"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2298-L2310 | train |
gravitational/teleport | lib/srv/forward/subsystem.go | Start | func (r *remoteSubsystem) Start(channel ssh.Channel) error {
session := r.serverContext.RemoteSession
stdout, err := session.StdoutPipe()
if err != nil {
return trace.Wrap(err)
}
stderr, err := session.StderrPipe()
if err != nil {
return trace.Wrap(err)
}
stdin, err := session.StdinPipe()
if err != nil {
... | go | func (r *remoteSubsystem) Start(channel ssh.Channel) error {
session := r.serverContext.RemoteSession
stdout, err := session.StdoutPipe()
if err != nil {
return trace.Wrap(err)
}
stderr, err := session.StderrPipe()
if err != nil {
return trace.Wrap(err)
}
stdin, err := session.StdinPipe()
if err != nil {
... | [
"func",
"(",
"r",
"*",
"remoteSubsystem",
")",
"Start",
"(",
"channel",
"ssh",
".",
"Channel",
")",
"error",
"{",
"session",
":=",
"r",
".",
"serverContext",
".",
"RemoteSession",
"\n\n",
"stdout",
",",
"err",
":=",
"session",
".",
"StdoutPipe",
"(",
")"... | // Start will begin execution of the remote subsytem on the passed in channel. | [
"Start",
"will",
"begin",
"execution",
"of",
"the",
"remote",
"subsytem",
"on",
"the",
"passed",
"in",
"channel",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/forward/subsystem.go#L61-L108 | train |
gravitational/teleport | lib/srv/forward/subsystem.go | Wait | func (r *remoteSubsystem) Wait() error {
var lastErr error
for i := 0; i < 3; i++ {
select {
case err := <-r.errorCh:
if err != nil && err != io.EOF {
r.log.Warnf("Connection problem: %v %T", trace.DebugReport(err), err)
lastErr = err
}
case <-r.ctx.Done():
lastErr = trace.ConnectionProblem(ni... | go | func (r *remoteSubsystem) Wait() error {
var lastErr error
for i := 0; i < 3; i++ {
select {
case err := <-r.errorCh:
if err != nil && err != io.EOF {
r.log.Warnf("Connection problem: %v %T", trace.DebugReport(err), err)
lastErr = err
}
case <-r.ctx.Done():
lastErr = trace.ConnectionProblem(ni... | [
"func",
"(",
"r",
"*",
"remoteSubsystem",
")",
"Wait",
"(",
")",
"error",
"{",
"var",
"lastErr",
"error",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
"{",
"select",
"{",
"case",
"err",
":=",
"<-",
"r",
".",
"errorCh",
":"... | // Wait until the remote subsystem has finished execution and then return the last error. | [
"Wait",
"until",
"the",
"remote",
"subsystem",
"has",
"finished",
"execution",
"and",
"then",
"return",
"the",
"last",
"error",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/forward/subsystem.go#L111-L130 | train |
gravitational/teleport | lib/services/session.go | NewWebSession | func NewWebSession(name string, spec WebSessionSpecV2) WebSession {
return &WebSessionV2{
Kind: KindWebSession,
Version: V2,
Metadata: Metadata{
Name: name,
Namespace: defaults.Namespace,
},
Spec: spec,
}
} | go | func NewWebSession(name string, spec WebSessionSpecV2) WebSession {
return &WebSessionV2{
Kind: KindWebSession,
Version: V2,
Metadata: Metadata{
Name: name,
Namespace: defaults.Namespace,
},
Spec: spec,
}
} | [
"func",
"NewWebSession",
"(",
"name",
"string",
",",
"spec",
"WebSessionSpecV2",
")",
"WebSession",
"{",
"return",
"&",
"WebSessionV2",
"{",
"Kind",
":",
"KindWebSession",
",",
"Version",
":",
"V2",
",",
"Metadata",
":",
"Metadata",
"{",
"Name",
":",
"name",... | // NewWebSession returns new instance of the web session based on the V2 spec | [
"NewWebSession",
"returns",
"new",
"instance",
"of",
"the",
"web",
"session",
"based",
"on",
"the",
"V2",
"spec"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L74-L84 | train |
gravitational/teleport | lib/services/session.go | WithoutSecrets | func (ws *WebSessionV2) WithoutSecrets() WebSession {
v2 := ws.V2()
v2.Spec.Priv = nil
return v2
} | go | func (ws *WebSessionV2) WithoutSecrets() WebSession {
v2 := ws.V2()
v2.Spec.Priv = nil
return v2
} | [
"func",
"(",
"ws",
"*",
"WebSessionV2",
")",
"WithoutSecrets",
"(",
")",
"WebSession",
"{",
"v2",
":=",
"ws",
".",
"V2",
"(",
")",
"\n",
"v2",
".",
"Spec",
".",
"Priv",
"=",
"nil",
"\n",
"return",
"v2",
"\n",
"}"
] | // WithoutSecrets returns copy of the object but without secrets | [
"WithoutSecrets",
"returns",
"copy",
"of",
"the",
"object",
"but",
"without",
"secrets"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L123-L127 | train |
gravitational/teleport | lib/services/session.go | GetShortName | func (ws *WebSessionV2) GetShortName() string {
if len(ws.Metadata.Name) < 4 {
return "<undefined>"
}
return ws.Metadata.Name[:4]
} | go | func (ws *WebSessionV2) GetShortName() string {
if len(ws.Metadata.Name) < 4 {
return "<undefined>"
}
return ws.Metadata.Name[:4]
} | [
"func",
"(",
"ws",
"*",
"WebSessionV2",
")",
"GetShortName",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"ws",
".",
"Metadata",
".",
"Name",
")",
"<",
"4",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"ws",
".",
"Metadata",
".",
"Name",
"... | // GetShortName returns visible short name used in logging | [
"GetShortName",
"returns",
"visible",
"short",
"name",
"used",
"in",
"logging"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L155-L160 | train |
gravitational/teleport | lib/services/session.go | SetBearerTokenExpiryTime | func (ws *WebSessionV2) SetBearerTokenExpiryTime(tm time.Time) {
ws.Spec.BearerTokenExpires = tm
} | go | func (ws *WebSessionV2) SetBearerTokenExpiryTime(tm time.Time) {
ws.Spec.BearerTokenExpires = tm
} | [
"func",
"(",
"ws",
"*",
"WebSessionV2",
")",
"SetBearerTokenExpiryTime",
"(",
"tm",
"time",
".",
"Time",
")",
"{",
"ws",
".",
"Spec",
".",
"BearerTokenExpires",
"=",
"tm",
"\n",
"}"
] | // SetBearerTokenExpiryTime sets bearer token expiry time | [
"SetBearerTokenExpiryTime",
"sets",
"bearer",
"token",
"expiry",
"time"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L194-L196 | train |
gravitational/teleport | lib/services/session.go | SetExpiryTime | func (ws *WebSessionV2) SetExpiryTime(tm time.Time) {
ws.Spec.Expires = tm
} | go | func (ws *WebSessionV2) SetExpiryTime(tm time.Time) {
ws.Spec.Expires = tm
} | [
"func",
"(",
"ws",
"*",
"WebSessionV2",
")",
"SetExpiryTime",
"(",
"tm",
"time",
".",
"Time",
")",
"{",
"ws",
".",
"Spec",
".",
"Expires",
"=",
"tm",
"\n",
"}"
] | // SetExpiryTime sets session expiry time | [
"SetExpiryTime",
"sets",
"session",
"expiry",
"time"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L199-L201 | train |
gravitational/teleport | lib/services/session.go | GetWebSessionSchemaWithExtensions | func GetWebSessionSchemaWithExtensions(extension string) string {
return fmt.Sprintf(V2SchemaTemplate, MetadataSchema, fmt.Sprintf(WebSessionSpecV2Schema, extension), DefaultDefinitions)
} | go | func GetWebSessionSchemaWithExtensions(extension string) string {
return fmt.Sprintf(V2SchemaTemplate, MetadataSchema, fmt.Sprintf(WebSessionSpecV2Schema, extension), DefaultDefinitions)
} | [
"func",
"GetWebSessionSchemaWithExtensions",
"(",
"extension",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"V2SchemaTemplate",
",",
"MetadataSchema",
",",
"fmt",
".",
"Sprintf",
"(",
"WebSessionSpecV2Schema",
",",
"extension",
")",
",",
"De... | // GetWebSessionSchemaWithExtensions returns JSON Schema for web session with user-supplied extensions | [
"GetWebSessionSchemaWithExtensions",
"returns",
"JSON",
"Schema",
"for",
"web",
"session",
"with",
"user",
"-",
"supplied",
"extensions"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L395-L397 | train |
gravitational/teleport | lib/services/session.go | UnmarshalWebSession | func (*TeleportWebSessionMarshaler) UnmarshalWebSession(bytes []byte) (WebSession, error) {
var h ResourceHeader
err := json.Unmarshal(bytes, &h)
if err != nil {
return nil, trace.Wrap(err)
}
switch h.Version {
case "":
var ws WebSessionV1
err := json.Unmarshal(bytes, &ws)
if err != nil {
return nil, t... | go | func (*TeleportWebSessionMarshaler) UnmarshalWebSession(bytes []byte) (WebSession, error) {
var h ResourceHeader
err := json.Unmarshal(bytes, &h)
if err != nil {
return nil, trace.Wrap(err)
}
switch h.Version {
case "":
var ws WebSessionV1
err := json.Unmarshal(bytes, &ws)
if err != nil {
return nil, t... | [
"func",
"(",
"*",
"TeleportWebSessionMarshaler",
")",
"UnmarshalWebSession",
"(",
"bytes",
"[",
"]",
"byte",
")",
"(",
"WebSession",
",",
"error",
")",
"{",
"var",
"h",
"ResourceHeader",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"bytes",
",",
"&",
... | // UnmarshalWebSession unmarshals web session from on-disk byte format | [
"UnmarshalWebSession",
"unmarshals",
"web",
"session",
"from",
"on",
"-",
"disk",
"byte",
"format"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L414-L445 | train |
gravitational/teleport | lib/services/session.go | MarshalWebSession | func (*TeleportWebSessionMarshaler) MarshalWebSession(ws WebSession, opts ...MarshalOption) ([]byte, error) {
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
type ws1 interface {
V1() *WebSessionV1
}
type ws2 interface {
V2() *WebSessionV2
}
version := cfg.GetVersion()
swit... | go | func (*TeleportWebSessionMarshaler) MarshalWebSession(ws WebSession, opts ...MarshalOption) ([]byte, error) {
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
type ws1 interface {
V1() *WebSessionV1
}
type ws2 interface {
V2() *WebSessionV2
}
version := cfg.GetVersion()
swit... | [
"func",
"(",
"*",
"TeleportWebSessionMarshaler",
")",
"MarshalWebSession",
"(",
"ws",
"WebSession",
",",
"opts",
"...",
"MarshalOption",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"cfg",
",",
"err",
":=",
"collectOptions",
"(",
"opts",
")",
"\n",
... | // MarshalWebSession marshals web session into on-disk representation | [
"MarshalWebSession",
"marshals",
"web",
"session",
"into",
"on",
"-",
"disk",
"representation"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L448-L484 | train |
gravitational/teleport | lib/srv/sess.go | emitSessionJoinEvent | func (s *SessionRegistry) emitSessionJoinEvent(ctx *ServerContext) {
sessionJoinEvent := events.EventFields{
events.EventType: events.SessionJoinEvent,
events.SessionEventID: string(ctx.session.id),
events.EventNamespace: s.srv.GetNamespace(),
events.EventLogin: ctx.Identity.Login,
events.EventU... | go | func (s *SessionRegistry) emitSessionJoinEvent(ctx *ServerContext) {
sessionJoinEvent := events.EventFields{
events.EventType: events.SessionJoinEvent,
events.SessionEventID: string(ctx.session.id),
events.EventNamespace: s.srv.GetNamespace(),
events.EventLogin: ctx.Identity.Login,
events.EventU... | [
"func",
"(",
"s",
"*",
"SessionRegistry",
")",
"emitSessionJoinEvent",
"(",
"ctx",
"*",
"ServerContext",
")",
"{",
"sessionJoinEvent",
":=",
"events",
".",
"EventFields",
"{",
"events",
".",
"EventType",
":",
"events",
".",
"SessionJoinEvent",
",",
"events",
"... | // emitSessionJoinEvent emits a session join event to both the Audit Log as
// well as sending a "x-teleport-event" global request on the SSH connection. | [
"emitSessionJoinEvent",
"emits",
"a",
"session",
"join",
"event",
"to",
"both",
"the",
"Audit",
"Log",
"as",
"well",
"as",
"sending",
"a",
"x",
"-",
"teleport",
"-",
"event",
"global",
"request",
"on",
"the",
"SSH",
"connection",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L115-L145 | train |
gravitational/teleport | lib/srv/sess.go | OpenSession | func (s *SessionRegistry) OpenSession(ch ssh.Channel, req *ssh.Request, ctx *ServerContext) error {
if ctx.session != nil {
ctx.Infof("Joining existing session %v.", ctx.session.id)
// Update the in-memory data structure that a party member has joined.
_, err := ctx.session.join(ch, req, ctx)
if err != nil {
... | go | func (s *SessionRegistry) OpenSession(ch ssh.Channel, req *ssh.Request, ctx *ServerContext) error {
if ctx.session != nil {
ctx.Infof("Joining existing session %v.", ctx.session.id)
// Update the in-memory data structure that a party member has joined.
_, err := ctx.session.join(ch, req, ctx)
if err != nil {
... | [
"func",
"(",
"s",
"*",
"SessionRegistry",
")",
"OpenSession",
"(",
"ch",
"ssh",
".",
"Channel",
",",
"req",
"*",
"ssh",
".",
"Request",
",",
"ctx",
"*",
"ServerContext",
")",
"error",
"{",
"if",
"ctx",
".",
"session",
"!=",
"nil",
"{",
"ctx",
".",
... | // OpenSession either joins an existing session or starts a new session. | [
"OpenSession",
"either",
"joins",
"an",
"existing",
"session",
"or",
"starts",
"a",
"new",
"session",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L148-L185 | train |
gravitational/teleport | lib/srv/sess.go | emitSessionLeaveEvent | func (s *SessionRegistry) emitSessionLeaveEvent(party *party) {
sessionLeaveEvent := events.EventFields{
events.EventType: events.SessionLeaveEvent,
events.SessionEventID: party.id.String(),
events.EventUser: party.user,
events.SessionServerID: party.serverID,
events.EventNamespace: s.srv.GetNa... | go | func (s *SessionRegistry) emitSessionLeaveEvent(party *party) {
sessionLeaveEvent := events.EventFields{
events.EventType: events.SessionLeaveEvent,
events.SessionEventID: party.id.String(),
events.EventUser: party.user,
events.SessionServerID: party.serverID,
events.EventNamespace: s.srv.GetNa... | [
"func",
"(",
"s",
"*",
"SessionRegistry",
")",
"emitSessionLeaveEvent",
"(",
"party",
"*",
"party",
")",
"{",
"sessionLeaveEvent",
":=",
"events",
".",
"EventFields",
"{",
"events",
".",
"EventType",
":",
"events",
".",
"SessionLeaveEvent",
",",
"events",
".",... | // emitSessionLeaveEvent emits a session leave event to both the Audit Log as
// well as sending a "x-teleport-event" global request on the SSH connection. | [
"emitSessionLeaveEvent",
"emits",
"a",
"session",
"leave",
"event",
"to",
"both",
"the",
"Audit",
"Log",
"as",
"well",
"as",
"sending",
"a",
"x",
"-",
"teleport",
"-",
"event",
"global",
"request",
"on",
"the",
"SSH",
"connection",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L189-L216 | train |
gravitational/teleport | lib/srv/sess.go | leaveSession | func (s *SessionRegistry) leaveSession(party *party) error {
sess := party.s
s.Lock()
defer s.Unlock()
// Emit session leave event to both the Audit Log as well as over the
// "x-teleport-event" channel in the SSH connection.
s.emitSessionLeaveEvent(party)
// Remove member from in-members representation of par... | go | func (s *SessionRegistry) leaveSession(party *party) error {
sess := party.s
s.Lock()
defer s.Unlock()
// Emit session leave event to both the Audit Log as well as over the
// "x-teleport-event" channel in the SSH connection.
s.emitSessionLeaveEvent(party)
// Remove member from in-members representation of par... | [
"func",
"(",
"s",
"*",
"SessionRegistry",
")",
"leaveSession",
"(",
"party",
"*",
"party",
")",
"error",
"{",
"sess",
":=",
"party",
".",
"s",
"\n",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"// Emit session lea... | // leaveSession removes the given party from this session. | [
"leaveSession",
"removes",
"the",
"given",
"party",
"from",
"this",
"session",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L219-L281 | train |
gravitational/teleport | lib/srv/sess.go | NotifyWinChange | func (s *SessionRegistry) NotifyWinChange(params rsession.TerminalParams, ctx *ServerContext) error {
if ctx.session == nil {
s.log.Debugf("Unable to update window size, no session found in context.")
return nil
}
sid := ctx.session.id
// Build the resize event.
resizeEvent := events.EventFields{
events.Eve... | go | func (s *SessionRegistry) NotifyWinChange(params rsession.TerminalParams, ctx *ServerContext) error {
if ctx.session == nil {
s.log.Debugf("Unable to update window size, no session found in context.")
return nil
}
sid := ctx.session.id
// Build the resize event.
resizeEvent := events.EventFields{
events.Eve... | [
"func",
"(",
"s",
"*",
"SessionRegistry",
")",
"NotifyWinChange",
"(",
"params",
"rsession",
".",
"TerminalParams",
",",
"ctx",
"*",
"ServerContext",
")",
"error",
"{",
"if",
"ctx",
".",
"session",
"==",
"nil",
"{",
"s",
".",
"log",
".",
"Debugf",
"(",
... | // NotifyWinChange is called to notify all members in the party that the PTY
// size has changed. The notification is sent as a global SSH request and it
// is the responsibility of the client to update it's window size upon receipt. | [
"NotifyWinChange",
"is",
"called",
"to",
"notify",
"all",
"members",
"in",
"the",
"party",
"that",
"the",
"PTY",
"size",
"has",
"changed",
".",
"The",
"notification",
"is",
"sent",
"as",
"a",
"global",
"SSH",
"request",
"and",
"it",
"is",
"the",
"responsib... | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L305-L364 | train |
gravitational/teleport | lib/srv/sess.go | newSession | func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) {
serverSessions.Inc()
rsess := rsession.Session{
ID: id,
TerminalParams: rsession.TerminalParams{
W: teleport.DefaultTerminalWidth,
H: teleport.DefaultTerminalHeight,
},
Login: ctx.Identity.Login,
Created: ... | go | func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) {
serverSessions.Inc()
rsess := rsession.Session{
ID: id,
TerminalParams: rsession.TerminalParams{
W: teleport.DefaultTerminalWidth,
H: teleport.DefaultTerminalHeight,
},
Login: ctx.Identity.Login,
Created: ... | [
"func",
"newSession",
"(",
"id",
"rsession",
".",
"ID",
",",
"r",
"*",
"SessionRegistry",
",",
"ctx",
"*",
"ServerContext",
")",
"(",
"*",
"session",
",",
"error",
")",
"{",
"serverSessions",
".",
"Inc",
"(",
")",
"\n",
"rsess",
":=",
"rsession",
".",
... | // newSession creates a new session with a given ID within a given context. | [
"newSession",
"creates",
"a",
"new",
"session",
"with",
"a",
"given",
"ID",
"within",
"a",
"given",
"context",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L428-L491 | train |
gravitational/teleport | lib/srv/sess.go | isLingering | func (s *session) isLingering() bool {
s.Lock()
defer s.Unlock()
return len(s.parties) == 0
} | go | func (s *session) isLingering() bool {
s.Lock()
defer s.Unlock()
return len(s.parties) == 0
} | [
"func",
"(",
"s",
"*",
"session",
")",
"isLingering",
"(",
")",
"bool",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"len",
"(",
"s",
".",
"parties",
")",
"==",
"0",
"\n",
"}"
] | // isLingering returns true if every party has left this session. Occurs
// under a lock. | [
"isLingering",
"returns",
"true",
"if",
"every",
"party",
"has",
"left",
"this",
"session",
".",
"Occurs",
"under",
"a",
"lock",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L495-L500 | train |
gravitational/teleport | lib/srv/sess.go | Close | func (s *session) Close() error {
serverSessions.Dec()
s.closeOnce.Do(func() {
// closing needs to happen asynchronously because the last client
// (session writer) will try to close this session, causing a deadlock
// because of closeOnce
go func() {
s.log.Infof("Closing session %v", s.id)
if s.term !=... | go | func (s *session) Close() error {
serverSessions.Dec()
s.closeOnce.Do(func() {
// closing needs to happen asynchronously because the last client
// (session writer) will try to close this session, causing a deadlock
// because of closeOnce
go func() {
s.log.Infof("Closing session %v", s.id)
if s.term !=... | [
"func",
"(",
"s",
"*",
"session",
")",
"Close",
"(",
")",
"error",
"{",
"serverSessions",
".",
"Dec",
"(",
")",
"\n",
"s",
".",
"closeOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"// closing needs to happen asynchronously because the last client",
"// (sessio... | // Close ends the active session forcing all clients to disconnect and freeing all resources | [
"Close",
"ends",
"the",
"active",
"session",
"forcing",
"all",
"clients",
"to",
"disconnect",
"and",
"freeing",
"all",
"resources"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L503-L529 | train |
gravitational/teleport | lib/srv/sess.go | removePartyMember | func (s *session) removePartyMember(party *party) {
s.Lock()
defer s.Unlock()
delete(s.parties, party.id)
} | go | func (s *session) removePartyMember(party *party) {
s.Lock()
defer s.Unlock()
delete(s.parties, party.id)
} | [
"func",
"(",
"s",
"*",
"session",
")",
"removePartyMember",
"(",
"party",
"*",
"party",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"delete",
"(",
"s",
".",
"parties",
",",
"party",
".",
"id",
")",
... | // removePartyMember removes participant from in-memory representation of
// party members. Occurs under a lock. | [
"removePartyMember",
"removes",
"participant",
"from",
"in",
"-",
"memory",
"representation",
"of",
"party",
"members",
".",
"Occurs",
"under",
"a",
"lock",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L712-L717 | train |
gravitational/teleport | lib/srv/sess.go | removeParty | func (s *session) removeParty(p *party) error {
p.ctx.Infof("Removing party %v from session %v", p, s.id)
// Removes participant from in-memory map of party members.
s.removePartyMember(p)
s.writer.deleteWriter(string(p.id))
return nil
} | go | func (s *session) removeParty(p *party) error {
p.ctx.Infof("Removing party %v from session %v", p, s.id)
// Removes participant from in-memory map of party members.
s.removePartyMember(p)
s.writer.deleteWriter(string(p.id))
return nil
} | [
"func",
"(",
"s",
"*",
"session",
")",
"removeParty",
"(",
"p",
"*",
"party",
")",
"error",
"{",
"p",
".",
"ctx",
".",
"Infof",
"(",
"\"",
"\"",
",",
"p",
",",
"s",
".",
"id",
")",
"\n\n",
"// Removes participant from in-memory map of party members.",
"s... | // removeParty removes the party from the in-memory map that holds all party
// members. | [
"removeParty",
"removes",
"the",
"party",
"from",
"the",
"in",
"-",
"memory",
"map",
"that",
"holds",
"all",
"party",
"members",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L721-L730 | train |
gravitational/teleport | lib/srv/sess.go | exportPartyMembers | func (s *session) exportPartyMembers() []rsession.Party {
s.Lock()
defer s.Unlock()
var partyList []rsession.Party
for _, p := range s.parties {
partyList = append(partyList, rsession.Party{
ID: p.id,
User: p.user,
ServerID: p.serverID,
RemoteAddr: p.site,
LastActive: p.getLastActi... | go | func (s *session) exportPartyMembers() []rsession.Party {
s.Lock()
defer s.Unlock()
var partyList []rsession.Party
for _, p := range s.parties {
partyList = append(partyList, rsession.Party{
ID: p.id,
User: p.user,
ServerID: p.serverID,
RemoteAddr: p.site,
LastActive: p.getLastActi... | [
"func",
"(",
"s",
"*",
"session",
")",
"exportPartyMembers",
"(",
")",
"[",
"]",
"rsession",
".",
"Party",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"var",
"partyList",
"[",
"]",
"rsession",
".",
"Party",... | // exportPartyMembers exports participants in the in-memory map of party
// members. Occurs under a lock. | [
"exportPartyMembers",
"exports",
"participants",
"in",
"the",
"in",
"-",
"memory",
"map",
"of",
"party",
"members",
".",
"Occurs",
"under",
"a",
"lock",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L750-L766 | train |
gravitational/teleport | lib/srv/sess.go | heartbeat | func (s *session) heartbeat(ctx *ServerContext) {
// If sessions are being recorded at the proxy, an identical version of this
// goroutine is running in the proxy, which means it does not need to run here.
if ctx.ClusterConfig.GetSessionRecording() == services.RecordAtProxy &&
s.registry.srv.Component() == telepo... | go | func (s *session) heartbeat(ctx *ServerContext) {
// If sessions are being recorded at the proxy, an identical version of this
// goroutine is running in the proxy, which means it does not need to run here.
if ctx.ClusterConfig.GetSessionRecording() == services.RecordAtProxy &&
s.registry.srv.Component() == telepo... | [
"func",
"(",
"s",
"*",
"session",
")",
"heartbeat",
"(",
"ctx",
"*",
"ServerContext",
")",
"{",
"// If sessions are being recorded at the proxy, an identical version of this",
"// goroutine is running in the proxy, which means it does not need to run here.",
"if",
"ctx",
".",
"Cl... | // heartbeat will loop as long as the session is not closed and mark it as
// active and update the list of party members. If the session are recorded at
// the proxy, then this function does nothing as it's counterpart
// in the proxy will do this work. | [
"heartbeat",
"will",
"loop",
"as",
"long",
"as",
"the",
"session",
"is",
"not",
"closed",
"and",
"mark",
"it",
"as",
"active",
"and",
"update",
"the",
"list",
"of",
"party",
"members",
".",
"If",
"the",
"session",
"are",
"recorded",
"at",
"the",
"proxy",... | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L772-L813 | train |
gravitational/teleport | lib/srv/sess.go | addPartyMember | func (s *session) addPartyMember(p *party) {
s.Lock()
defer s.Unlock()
s.parties[p.id] = p
} | go | func (s *session) addPartyMember(p *party) {
s.Lock()
defer s.Unlock()
s.parties[p.id] = p
} | [
"func",
"(",
"s",
"*",
"session",
")",
"addPartyMember",
"(",
"p",
"*",
"party",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
".",
"parties",
"[",
"p",
".",
"id",
"]",
"=",
"p",
"\n",
"}"
] | // addPartyMember adds participant to in-memory map of party members. Occurs
// under a lock. | [
"addPartyMember",
"adds",
"participant",
"to",
"in",
"-",
"memory",
"map",
"of",
"party",
"members",
".",
"Occurs",
"under",
"a",
"lock",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L817-L822 | train |
gravitational/teleport | lib/srv/sess.go | addParty | func (s *session) addParty(p *party) error {
if s.login != p.login {
return trace.AccessDenied(
"can't switch users from %v to %v for session %v",
s.login, p.login, s.id)
}
// Adds participant to in-memory map of party members.
s.addPartyMember(p)
// Write last chunk (so the newly joined parties won't st... | go | func (s *session) addParty(p *party) error {
if s.login != p.login {
return trace.AccessDenied(
"can't switch users from %v to %v for session %v",
s.login, p.login, s.id)
}
// Adds participant to in-memory map of party members.
s.addPartyMember(p)
// Write last chunk (so the newly joined parties won't st... | [
"func",
"(",
"s",
"*",
"session",
")",
"addParty",
"(",
"p",
"*",
"party",
")",
"error",
"{",
"if",
"s",
".",
"login",
"!=",
"p",
".",
"login",
"{",
"return",
"trace",
".",
"AccessDenied",
"(",
"\"",
"\"",
",",
"s",
".",
"login",
",",
"p",
".",... | // addParty is called when a new party joins the session. | [
"addParty",
"is",
"called",
"when",
"a",
"new",
"party",
"joins",
"the",
"session",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L825-L865 | train |
gravitational/teleport | lib/srv/sess.go | Write | func (m *multiWriter) Write(p []byte) (n int, err error) {
// lock and make a local copy of available writers:
getWriters := func() (writers []writerWrapper) {
m.RLock()
defer m.RUnlock()
writers = make([]writerWrapper, 0, len(m.writers))
for _, w := range m.writers {
writers = append(writers, w)
}
//... | go | func (m *multiWriter) Write(p []byte) (n int, err error) {
// lock and make a local copy of available writers:
getWriters := func() (writers []writerWrapper) {
m.RLock()
defer m.RUnlock()
writers = make([]writerWrapper, 0, len(m.writers))
for _, w := range m.writers {
writers = append(writers, w)
}
//... | [
"func",
"(",
"m",
"*",
"multiWriter",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"// lock and make a local copy of available writers:",
"getWriters",
":=",
"func",
"(",
")",
"(",
"writers",
"[",
"]",
"w... | // Write multiplexes the input to multiple sub-writers. The entire point
// of multiWriter is to do this | [
"Write",
"multiplexes",
"the",
"input",
"to",
"multiple",
"sub",
"-",
"writers",
".",
"The",
"entire",
"point",
"of",
"multiWriter",
"is",
"to",
"do",
"this"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L915-L946 | train |
gravitational/teleport | lib/service/supervisor.go | String | func (e EventMapping) String() string {
return fmt.Sprintf("EventMapping(in=%v, out=%v)", e.In, e.Out)
} | go | func (e EventMapping) String() string {
return fmt.Sprintf("EventMapping(in=%v, out=%v)", e.In, e.Out)
} | [
"func",
"(",
"e",
"EventMapping",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"In",
",",
"e",
".",
"Out",
")",
"\n",
"}"
] | // String returns user-friendly representation of the mapping. | [
"String",
"returns",
"user",
"-",
"friendly",
"representation",
"of",
"the",
"mapping",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L96-L98 | train |
gravitational/teleport | lib/service/supervisor.go | NewSupervisor | func NewSupervisor(id string) Supervisor {
closeContext, cancel := context.WithCancel(context.TODO())
exitContext, signalExit := context.WithCancel(context.TODO())
reloadContext, signalReload := context.WithCancel(context.TODO())
srv := &LocalSupervisor{
id: id,
services: []Service{},
wg: ... | go | func NewSupervisor(id string) Supervisor {
closeContext, cancel := context.WithCancel(context.TODO())
exitContext, signalExit := context.WithCancel(context.TODO())
reloadContext, signalReload := context.WithCancel(context.TODO())
srv := &LocalSupervisor{
id: id,
services: []Service{},
wg: ... | [
"func",
"NewSupervisor",
"(",
"id",
"string",
")",
"Supervisor",
"{",
"closeContext",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n\n",
"exitContext",
",",
"signalExit",
":=",
"context",
".",
"WithCancel",... | // NewSupervisor returns new instance of initialized supervisor | [
"NewSupervisor",
"returns",
"new",
"instance",
"of",
"initialized",
"supervisor"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L142-L166 | train |
gravitational/teleport | lib/service/supervisor.go | ServiceCount | func (s *LocalSupervisor) ServiceCount() int {
s.Lock()
defer s.Unlock()
return len(s.services)
} | go | func (s *LocalSupervisor) ServiceCount() int {
s.Lock()
defer s.Unlock()
return len(s.services)
} | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"ServiceCount",
"(",
")",
"int",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"return",
"len",
"(",
"s",
".",
"services",
")",
"\n",
"}"
] | // ServiceCount returns the number of registered and actively running services | [
"ServiceCount",
"returns",
"the",
"number",
"of",
"registered",
"and",
"actively",
"running",
"services"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L191-L195 | train |
gravitational/teleport | lib/service/supervisor.go | RegisterFunc | func (s *LocalSupervisor) RegisterFunc(name string, fn ServiceFunc) {
s.Register(&LocalService{Function: fn, ServiceName: name})
} | go | func (s *LocalSupervisor) RegisterFunc(name string, fn ServiceFunc) {
s.Register(&LocalService{Function: fn, ServiceName: name})
} | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"RegisterFunc",
"(",
"name",
"string",
",",
"fn",
"ServiceFunc",
")",
"{",
"s",
".",
"Register",
"(",
"&",
"LocalService",
"{",
"Function",
":",
"fn",
",",
"ServiceName",
":",
"name",
"}",
")",
"\n",
"}"
] | // RegisterFunc creates a service from function spec and registers
// it within the system | [
"RegisterFunc",
"creates",
"a",
"service",
"from",
"function",
"spec",
"and",
"registers",
"it",
"within",
"the",
"system"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L199-L201 | train |
gravitational/teleport | lib/service/supervisor.go | RegisterCriticalFunc | func (s *LocalSupervisor) RegisterCriticalFunc(name string, fn ServiceFunc) {
s.Register(&LocalService{Function: fn, ServiceName: name, Critical: true})
} | go | func (s *LocalSupervisor) RegisterCriticalFunc(name string, fn ServiceFunc) {
s.Register(&LocalService{Function: fn, ServiceName: name, Critical: true})
} | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"RegisterCriticalFunc",
"(",
"name",
"string",
",",
"fn",
"ServiceFunc",
")",
"{",
"s",
".",
"Register",
"(",
"&",
"LocalService",
"{",
"Function",
":",
"fn",
",",
"ServiceName",
":",
"name",
",",
"Critical",
... | // RegisterCriticalFunc creates a critical service from function spec and registers
// it within the system, if this service exits with error,
// the process shuts down. | [
"RegisterCriticalFunc",
"creates",
"a",
"critical",
"service",
"from",
"function",
"spec",
"and",
"registers",
"it",
"within",
"the",
"system",
"if",
"this",
"service",
"exits",
"with",
"error",
"the",
"process",
"shuts",
"down",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L206-L208 | train |
gravitational/teleport | lib/service/supervisor.go | RemoveService | func (s *LocalSupervisor) RemoveService(srv Service) error {
l := logrus.WithFields(logrus.Fields{"service": srv.Name(), trace.Component: teleport.Component(teleport.ComponentProcess, s.id)})
s.Lock()
defer s.Unlock()
for i, el := range s.services {
if el == srv {
s.services = append(s.services[:i], s.services... | go | func (s *LocalSupervisor) RemoveService(srv Service) error {
l := logrus.WithFields(logrus.Fields{"service": srv.Name(), trace.Component: teleport.Component(teleport.ComponentProcess, s.id)})
s.Lock()
defer s.Unlock()
for i, el := range s.services {
if el == srv {
s.services = append(s.services[:i], s.services... | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"RemoveService",
"(",
"srv",
"Service",
")",
"error",
"{",
"l",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"srv",
".",
"Name",
"(",
")",
",",
"trace",
".",
"... | // RemoveService removes service from supervisor tracking list | [
"RemoveService",
"removes",
"service",
"from",
"supervisor",
"tracking",
"list"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L211-L224 | train |
gravitational/teleport | lib/service/supervisor.go | BroadcastEvent | func (s *LocalSupervisor) BroadcastEvent(event Event) {
s.Lock()
defer s.Unlock()
switch event.Name {
case TeleportExitEvent:
s.signalExit()
case TeleportReloadEvent:
s.signalReload()
}
s.events[event.Name] = event
// Log all events other than recovered events to prevent the logs from
// being flooded.
... | go | func (s *LocalSupervisor) BroadcastEvent(event Event) {
s.Lock()
defer s.Unlock()
switch event.Name {
case TeleportExitEvent:
s.signalExit()
case TeleportReloadEvent:
s.signalReload()
}
s.events[event.Name] = event
// Log all events other than recovered events to prevent the logs from
// being flooded.
... | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"BroadcastEvent",
"(",
"event",
"Event",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"switch",
"event",
".",
"Name",
"{",
"case",
"TeleportExitEvent",
":",
... | // BroadcastEvent generates event and broadcasts it to all
// subscribed parties. | [
"BroadcastEvent",
"generates",
"event",
"and",
"broadcasts",
"it",
"to",
"all",
"subscribed",
"parties",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L313-L354 | train |
gravitational/teleport | lib/service/supervisor.go | RegisterEventMapping | func (s *LocalSupervisor) RegisterEventMapping(m EventMapping) {
s.Lock()
defer s.Unlock()
s.eventMappings = append(s.eventMappings, m)
} | go | func (s *LocalSupervisor) RegisterEventMapping(m EventMapping) {
s.Lock()
defer s.Unlock()
s.eventMappings = append(s.eventMappings, m)
} | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"RegisterEventMapping",
"(",
"m",
"EventMapping",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
".",
"eventMappings",
"=",
"append",
"(",
"s",
".",
"even... | // RegisterEventMapping registers event mapping -
// when the sequence in the event mapping triggers, the
// outbound event will be generated. | [
"RegisterEventMapping",
"registers",
"event",
"mapping",
"-",
"when",
"the",
"sequence",
"in",
"the",
"event",
"mapping",
"triggers",
"the",
"outbound",
"event",
"will",
"be",
"generated",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L359-L364 | train |
gravitational/teleport | lib/service/supervisor.go | WaitForEvent | func (s *LocalSupervisor) WaitForEvent(ctx context.Context, name string, eventC chan Event) {
s.Lock()
defer s.Unlock()
waiter := &waiter{eventC: eventC, context: ctx}
event, ok := s.events[name]
if ok {
go s.notifyWaiter(waiter, event)
return
}
s.eventWaiters[name] = append(s.eventWaiters[name], waiter)
} | go | func (s *LocalSupervisor) WaitForEvent(ctx context.Context, name string, eventC chan Event) {
s.Lock()
defer s.Unlock()
waiter := &waiter{eventC: eventC, context: ctx}
event, ok := s.events[name]
if ok {
go s.notifyWaiter(waiter, event)
return
}
s.eventWaiters[name] = append(s.eventWaiters[name], waiter)
} | [
"func",
"(",
"s",
"*",
"LocalSupervisor",
")",
"WaitForEvent",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"eventC",
"chan",
"Event",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
... | // WaitForEvent waits for event to be broadcasted, if the event
// was already broadcasted, eventC will receive current event immediately. | [
"WaitForEvent",
"waits",
"for",
"event",
"to",
"be",
"broadcasted",
"if",
"the",
"event",
"was",
"already",
"broadcasted",
"eventC",
"will",
"receive",
"current",
"event",
"immediately",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L368-L379 | train |
gravitational/teleport | tool/tsh/tsh.go | onPlay | func onPlay(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
if err := tc.Play(context.TODO(), cf.Namespace, cf.SessionID); err != nil {
utils.FatalError(err)
}
} | go | func onPlay(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
if err := tc.Play(context.TODO(), cf.Namespace, cf.SessionID); err != nil {
utils.FatalError(err)
}
} | [
"func",
"onPlay",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"tc"... | // onPlay replays a session with a given ID | [
"onPlay",
"replays",
"a",
"session",
"with",
"a",
"given",
"ID"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L351-L359 | train |
gravitational/teleport | tool/tsh/tsh.go | onLogin | func onLogin(cf *CLIConf) {
var (
err error
tc *client.TeleportClient
key *client.Key
)
if cf.IdentityFileIn != "" {
utils.FatalError(trace.BadParameter("-i flag cannot be used here"))
}
if cf.IdentityFormat != client.IdentityFormatOpenSSH && cf.IdentityFormat != client.IdentityFormatFile {
utils.Fata... | go | func onLogin(cf *CLIConf) {
var (
err error
tc *client.TeleportClient
key *client.Key
)
if cf.IdentityFileIn != "" {
utils.FatalError(trace.BadParameter("-i flag cannot be used here"))
}
if cf.IdentityFormat != client.IdentityFormatOpenSSH && cf.IdentityFormat != client.IdentityFormatFile {
utils.Fata... | [
"func",
"onLogin",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"var",
"(",
"err",
"error",
"\n",
"tc",
"*",
"client",
".",
"TeleportClient",
"\n",
"key",
"*",
"client",
".",
"Key",
"\n",
")",
"\n\n",
"if",
"cf",
".",
"IdentityFileIn",
"!=",
"\"",
"\"",
"{... | // onLogin logs in with remote proxy and gets signed certificates | [
"onLogin",
"logs",
"in",
"with",
"remote",
"proxy",
"and",
"gets",
"signed",
"certificates"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L362-L460 | train |
gravitational/teleport | tool/tsh/tsh.go | setupNoninteractiveClient | func setupNoninteractiveClient(tc *client.TeleportClient, key *client.Key) error {
certUsername, err := key.CertUsername()
if err != nil {
return trace.Wrap(err)
}
tc.Username = certUsername
// Extract and set the HostLogin to be the first principal. It doesn't
// matter what the value is, but some valid princ... | go | func setupNoninteractiveClient(tc *client.TeleportClient, key *client.Key) error {
certUsername, err := key.CertUsername()
if err != nil {
return trace.Wrap(err)
}
tc.Username = certUsername
// Extract and set the HostLogin to be the first principal. It doesn't
// matter what the value is, but some valid princ... | [
"func",
"setupNoninteractiveClient",
"(",
"tc",
"*",
"client",
".",
"TeleportClient",
",",
"key",
"*",
"client",
".",
"Key",
")",
"error",
"{",
"certUsername",
",",
"err",
":=",
"key",
".",
"CertUsername",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // setupNoninteractiveClient sets up existing client to use
// non-interactive authentication methods | [
"setupNoninteractiveClient",
"sets",
"up",
"existing",
"client",
"to",
"use",
"non",
"-",
"interactive",
"authentication",
"methods"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L464-L495 | train |
gravitational/teleport | tool/tsh/tsh.go | onListNodes | func onListNodes(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
// Get list of all nodes in backend and sort by "Node Name".
var nodes []services.Server
err = client.RetryWithRelogin(cf.Context, tc, func() error {
nodes, err = tc.ListNodes(cf.Context)
return err
})
... | go | func onListNodes(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
// Get list of all nodes in backend and sort by "Node Name".
var nodes []services.Server
err = client.RetryWithRelogin(cf.Context, tc, func() error {
nodes, err = tc.ListNodes(cf.Context)
return err
})
... | [
"func",
"onListNodes",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Get list of all no... | // onListNodes executes 'tsh ls' command. | [
"onListNodes",
"executes",
"tsh",
"ls",
"command",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L589-L637 | train |
gravitational/teleport | tool/tsh/tsh.go | chunkLabels | func chunkLabels(labels map[string]string, chunkSize int) [][]string {
// First sort labels so they always occur in the same order.
sorted := make([]string, 0, len(labels))
for k, v := range labels {
sorted = append(sorted, fmt.Sprintf("%v=%v", k, v))
}
sort.Slice(sorted, func(i, j int) bool { return sorted[i] <... | go | func chunkLabels(labels map[string]string, chunkSize int) [][]string {
// First sort labels so they always occur in the same order.
sorted := make([]string, 0, len(labels))
for k, v := range labels {
sorted = append(sorted, fmt.Sprintf("%v=%v", k, v))
}
sort.Slice(sorted, func(i, j int) bool { return sorted[i] <... | [
"func",
"chunkLabels",
"(",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
"chunkSize",
"int",
")",
"[",
"]",
"[",
"]",
"string",
"{",
"// First sort labels so they always occur in the same order.",
"sorted",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0... | // chunkLabels breaks labels into sized chunks. Used to improve readability
// of "tsh ls". | [
"chunkLabels",
"breaks",
"labels",
"into",
"sized",
"chunks",
".",
"Used",
"to",
"improve",
"readability",
"of",
"tsh",
"ls",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L641-L657 | train |
gravitational/teleport | tool/tsh/tsh.go | onListClusters | func onListClusters(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
proxyClient, err := tc.ConnectToProxy(cf.Context)
if err != nil {
utils.FatalError(err)
}
defer proxyClient.Close()
var sites []services.Site
err = client.RetryWithRelogin(cf.Context, tc, func() erro... | go | func onListClusters(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
proxyClient, err := tc.ConnectToProxy(cf.Context)
if err != nil {
utils.FatalError(err)
}
defer proxyClient.Close()
var sites []services.Site
err = client.RetryWithRelogin(cf.Context, tc, func() erro... | [
"func",
"onListClusters",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"proxyClient",
",",... | // onListClusters executes 'tsh clusters' command | [
"onListClusters",
"executes",
"tsh",
"clusters",
"command"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L660-L692 | train |
gravitational/teleport | tool/tsh/tsh.go | onSSH | func onSSH(cf *CLIConf) {
tc, err := makeClient(cf, false)
if err != nil {
utils.FatalError(err)
}
tc.Stdin = os.Stdin
err = client.RetryWithRelogin(cf.Context, tc, func() error {
return tc.SSH(cf.Context, cf.RemoteCommand, cf.LocalExec)
})
if err != nil {
// exit with the same exit status as the failed c... | go | func onSSH(cf *CLIConf) {
tc, err := makeClient(cf, false)
if err != nil {
utils.FatalError(err)
}
tc.Stdin = os.Stdin
err = client.RetryWithRelogin(cf.Context, tc, func() error {
return tc.SSH(cf.Context, cf.RemoteCommand, cf.LocalExec)
})
if err != nil {
// exit with the same exit status as the failed c... | [
"func",
"onSSH",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"tc",
".",
"Stdin",
"... | // onSSH executes 'tsh ssh' command | [
"onSSH",
"executes",
"tsh",
"ssh",
"command"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L695-L714 | train |
gravitational/teleport | tool/tsh/tsh.go | onBenchmark | func onBenchmark(cf *CLIConf) {
tc, err := makeClient(cf, false)
if err != nil {
utils.FatalError(err)
}
result, err := tc.Benchmark(cf.Context, client.Benchmark{
Command: cf.RemoteCommand,
Threads: cf.BenchThreads,
Duration: cf.BenchDuration,
Rate: cf.BenchRate,
})
if err != nil {
fmt.Fprintln(... | go | func onBenchmark(cf *CLIConf) {
tc, err := makeClient(cf, false)
if err != nil {
utils.FatalError(err)
}
result, err := tc.Benchmark(cf.Context, client.Benchmark{
Command: cf.RemoteCommand,
Threads: cf.BenchThreads,
Duration: cf.BenchDuration,
Rate: cf.BenchRate,
})
if err != nil {
fmt.Fprintln(... | [
"func",
"onBenchmark",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"result",
",",
"err... | // onBenchmark executes benchmark | [
"onBenchmark",
"executes",
"benchmark"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L717-L747 | train |
gravitational/teleport | tool/tsh/tsh.go | onJoin | func onJoin(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
sid, err := session.ParseID(cf.SessionID)
if err != nil {
utils.FatalError(fmt.Errorf("'%v' is not a valid session ID (must be GUID)", cf.SessionID))
}
err = client.RetryWithRelogin(cf.Context, tc, func() error... | go | func onJoin(cf *CLIConf) {
tc, err := makeClient(cf, true)
if err != nil {
utils.FatalError(err)
}
sid, err := session.ParseID(cf.SessionID)
if err != nil {
utils.FatalError(fmt.Errorf("'%v' is not a valid session ID (must be GUID)", cf.SessionID))
}
err = client.RetryWithRelogin(cf.Context, tc, func() error... | [
"func",
"onJoin",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"sid",
",",
"err",
":="... | // onJoin executes 'ssh join' command | [
"onJoin",
"executes",
"ssh",
"join",
"command"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L750-L765 | train |
gravitational/teleport | tool/tsh/tsh.go | onSCP | func onSCP(cf *CLIConf) {
tc, err := makeClient(cf, false)
if err != nil {
utils.FatalError(err)
}
err = client.RetryWithRelogin(cf.Context, tc, func() error {
return tc.SCP(context.TODO(), cf.CopySpec, int(cf.NodePort), cf.RecursiveCopy, cf.Quiet)
})
if err != nil {
// exit with the same exit status as the... | go | func onSCP(cf *CLIConf) {
tc, err := makeClient(cf, false)
if err != nil {
utils.FatalError(err)
}
err = client.RetryWithRelogin(cf.Context, tc, func() error {
return tc.SCP(context.TODO(), cf.CopySpec, int(cf.NodePort), cf.RecursiveCopy, cf.Quiet)
})
if err != nil {
// exit with the same exit status as the... | [
"func",
"onSCP",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"tc",
",",
"err",
":=",
"makeClient",
"(",
"cf",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"utils",
".",
"FatalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"err",
"=",
"client",
"... | // onSCP executes 'tsh scp' command | [
"onSCP",
"executes",
"tsh",
"scp",
"command"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L768-L785 | train |
gravitational/teleport | tool/tsh/tsh.go | authFromIdentity | func authFromIdentity(k *client.Key) (ssh.AuthMethod, error) {
signer, err := sshutils.NewSigner(k.Priv, k.Cert)
if err != nil {
return nil, trace.Wrap(err)
}
return client.NewAuthMethodForCert(signer), nil
} | go | func authFromIdentity(k *client.Key) (ssh.AuthMethod, error) {
signer, err := sshutils.NewSigner(k.Priv, k.Cert)
if err != nil {
return nil, trace.Wrap(err)
}
return client.NewAuthMethodForCert(signer), nil
} | [
"func",
"authFromIdentity",
"(",
"k",
"*",
"client",
".",
"Key",
")",
"(",
"ssh",
".",
"AuthMethod",
",",
"error",
")",
"{",
"signer",
",",
"err",
":=",
"sshutils",
".",
"NewSigner",
"(",
"k",
".",
"Priv",
",",
"k",
".",
"Cert",
")",
"\n",
"if",
... | // authFromIdentity returns a standard ssh.Authmethod for a given identity file | [
"authFromIdentity",
"returns",
"a",
"standard",
"ssh",
".",
"Authmethod",
"for",
"a",
"given",
"identity",
"file"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L1091-L1097 | train |
gravitational/teleport | tool/tsh/tsh.go | printStatus | func printStatus(p *client.ProfileStatus, isActive bool) {
var prefix string
if isActive {
prefix = "> "
} else {
prefix = " "
}
duration := p.ValidUntil.Sub(time.Now())
humanDuration := "EXPIRED"
if duration.Nanoseconds() > 0 {
humanDuration = fmt.Sprintf("valid for %v", duration.Round(time.Minute))
}
... | go | func printStatus(p *client.ProfileStatus, isActive bool) {
var prefix string
if isActive {
prefix = "> "
} else {
prefix = " "
}
duration := p.ValidUntil.Sub(time.Now())
humanDuration := "EXPIRED"
if duration.Nanoseconds() > 0 {
humanDuration = fmt.Sprintf("valid for %v", duration.Round(time.Minute))
}
... | [
"func",
"printStatus",
"(",
"p",
"*",
"client",
".",
"ProfileStatus",
",",
"isActive",
"bool",
")",
"{",
"var",
"prefix",
"string",
"\n",
"if",
"isActive",
"{",
"prefix",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"prefix",
"=",
"\"",
"\"",
"\n",
"}",
... | // printStatus prints the status of the profile. | [
"printStatus",
"prints",
"the",
"status",
"of",
"the",
"profile",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L1127-L1149 | train |
gravitational/teleport | tool/tsh/tsh.go | onStatus | func onStatus(cf *CLIConf) {
// Get the status of the active profile ~/.tsh/profile as well as the status
// of any other proxies the user is logged into.
profile, profiles, err := client.Status("", cf.Proxy)
if err != nil {
if trace.IsNotFound(err) {
fmt.Printf("Not logged in.\n")
return
}
utils.FatalE... | go | func onStatus(cf *CLIConf) {
// Get the status of the active profile ~/.tsh/profile as well as the status
// of any other proxies the user is logged into.
profile, profiles, err := client.Status("", cf.Proxy)
if err != nil {
if trace.IsNotFound(err) {
fmt.Printf("Not logged in.\n")
return
}
utils.FatalE... | [
"func",
"onStatus",
"(",
"cf",
"*",
"CLIConf",
")",
"{",
"// Get the status of the active profile ~/.tsh/profile as well as the status",
"// of any other proxies the user is logged into.",
"profile",
",",
"profiles",
",",
"err",
":=",
"client",
".",
"Status",
"(",
"\"",
"\"... | // onStatus command shows which proxy the user is logged into and metadata
// about the certificate. | [
"onStatus",
"command",
"shows",
"which",
"proxy",
"the",
"user",
"is",
"logged",
"into",
"and",
"metadata",
"about",
"the",
"certificate",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tsh/tsh.go#L1153-L1165 | train |
gravitational/teleport | lib/services/user.go | NewUser | func NewUser(name string) (User, error) {
u := &UserV2{
Kind: KindUser,
Version: V2,
Metadata: Metadata{
Name: name,
Namespace: defaults.Namespace,
},
}
if err := u.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
return u, nil
} | go | func NewUser(name string) (User, error) {
u := &UserV2{
Kind: KindUser,
Version: V2,
Metadata: Metadata{
Name: name,
Namespace: defaults.Namespace,
},
}
if err := u.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
return u, nil
} | [
"func",
"NewUser",
"(",
"name",
"string",
")",
"(",
"User",
",",
"error",
")",
"{",
"u",
":=",
"&",
"UserV2",
"{",
"Kind",
":",
"KindUser",
",",
"Version",
":",
"V2",
",",
"Metadata",
":",
"Metadata",
"{",
"Name",
":",
"name",
",",
"Namespace",
":"... | // NewUser creates new empty user | [
"NewUser",
"creates",
"new",
"empty",
"user"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L74-L87 | train |
gravitational/teleport | lib/services/user.go | String | func (c CreatedBy) String() string {
if c.User.Name == "" {
return "system"
}
if c.Connector != nil {
return fmt.Sprintf("%v connector %v for user %v at %v",
c.Connector.Type, c.Connector.ID, c.Connector.Identity, utils.HumanTimeFormat(c.Time))
}
return fmt.Sprintf("%v at %v", c.User.Name, c.Time)
} | go | func (c CreatedBy) String() string {
if c.User.Name == "" {
return "system"
}
if c.Connector != nil {
return fmt.Sprintf("%v connector %v for user %v at %v",
c.Connector.Type, c.Connector.ID, c.Connector.Identity, utils.HumanTimeFormat(c.Time))
}
return fmt.Sprintf("%v at %v", c.User.Name, c.Time)
} | [
"func",
"(",
"c",
"CreatedBy",
")",
"String",
"(",
")",
"string",
"{",
"if",
"c",
".",
"User",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"c",
".",
"Connector",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Spri... | // String returns human readable information about the user | [
"String",
"returns",
"human",
"readable",
"information",
"about",
"the",
"user"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L123-L132 | train |
gravitational/teleport | lib/services/user.go | Check | func (la *LoginAttempt) Check() error {
if la.Time.IsZero() {
return trace.BadParameter("missing parameter time")
}
return nil
} | go | func (la *LoginAttempt) Check() error {
if la.Time.IsZero() {
return trace.BadParameter("missing parameter time")
}
return nil
} | [
"func",
"(",
"la",
"*",
"LoginAttempt",
")",
"Check",
"(",
")",
"error",
"{",
"if",
"la",
".",
"Time",
".",
"IsZero",
"(",
")",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // Check checks parameters | [
"Check",
"checks",
"parameters"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L154-L159 | train |
gravitational/teleport | lib/services/user.go | WebSessionInfo | func (u *UserV2) WebSessionInfo(allowedLogins []string) interface{} {
out := u.V1()
out.AllowedLogins = allowedLogins
return *out
} | go | func (u *UserV2) WebSessionInfo(allowedLogins []string) interface{} {
out := u.V1()
out.AllowedLogins = allowedLogins
return *out
} | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"WebSessionInfo",
"(",
"allowedLogins",
"[",
"]",
"string",
")",
"interface",
"{",
"}",
"{",
"out",
":=",
"u",
".",
"V1",
"(",
")",
"\n",
"out",
".",
"AllowedLogins",
"=",
"allowedLogins",
"\n",
"return",
"*",
"o... | // WebSessionInfo returns web session information about user | [
"WebSessionInfo",
"returns",
"web",
"session",
"information",
"about",
"user"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L217-L221 | train |
gravitational/teleport | lib/services/user.go | SetTraits | func (u *UserV2) SetTraits(traits map[string][]string) {
u.Spec.Traits = traits
} | go | func (u *UserV2) SetTraits(traits map[string][]string) {
u.Spec.Traits = traits
} | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"SetTraits",
"(",
"traits",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"{",
"u",
".",
"Spec",
".",
"Traits",
"=",
"traits",
"\n",
"}"
] | // SetTraits sets the trait map for this user used to populate role variables. | [
"SetTraits",
"sets",
"the",
"trait",
"map",
"for",
"this",
"user",
"used",
"to",
"populate",
"role",
"variables",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L229-L231 | train |
gravitational/teleport | lib/services/user.go | V1 | func (u *UserV2) V1() *UserV1 {
return &UserV1{
Name: u.Metadata.Name,
OIDCIdentities: u.Spec.OIDCIdentities,
Status: u.Spec.Status,
Expires: u.Spec.Expires,
CreatedBy: u.Spec.CreatedBy,
}
} | go | func (u *UserV2) V1() *UserV1 {
return &UserV1{
Name: u.Metadata.Name,
OIDCIdentities: u.Spec.OIDCIdentities,
Status: u.Spec.Status,
Expires: u.Spec.Expires,
CreatedBy: u.Spec.CreatedBy,
}
} | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"V1",
"(",
")",
"*",
"UserV1",
"{",
"return",
"&",
"UserV1",
"{",
"Name",
":",
"u",
".",
"Metadata",
".",
"Name",
",",
"OIDCIdentities",
":",
"u",
".",
"Spec",
".",
"OIDCIdentities",
",",
"Status",
":",
"u",
... | // V1 converts UserV2 to UserV1 format | [
"V1",
"converts",
"UserV2",
"to",
"UserV1",
"format"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L249-L257 | train |
gravitational/teleport | lib/services/user.go | Equals | func (u *UserV2) Equals(other User) bool {
if u.Metadata.Name != other.GetName() {
return false
}
otherIdentities := other.GetOIDCIdentities()
if len(u.Spec.OIDCIdentities) != len(otherIdentities) {
return false
}
for i := range u.Spec.OIDCIdentities {
if !u.Spec.OIDCIdentities[i].Equals(&otherIdentities[i]... | go | func (u *UserV2) Equals(other User) bool {
if u.Metadata.Name != other.GetName() {
return false
}
otherIdentities := other.GetOIDCIdentities()
if len(u.Spec.OIDCIdentities) != len(otherIdentities) {
return false
}
for i := range u.Spec.OIDCIdentities {
if !u.Spec.OIDCIdentities[i].Equals(&otherIdentities[i]... | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"Equals",
"(",
"other",
"User",
")",
"bool",
"{",
"if",
"u",
".",
"Metadata",
".",
"Name",
"!=",
"other",
".",
"GetName",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"otherIdentities",
":=",
"other",
"."... | // Equals checks if user equals to another | [
"Equals",
"checks",
"if",
"user",
"equals",
"to",
"another"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L316-L348 | train |
gravitational/teleport | lib/services/user.go | Expiry | func (u *UserV2) Expiry() time.Time {
if u.Metadata.Expires != nil && !u.Metadata.Expires.IsZero() {
return *u.Metadata.Expires
}
return u.Spec.Expires
} | go | func (u *UserV2) Expiry() time.Time {
if u.Metadata.Expires != nil && !u.Metadata.Expires.IsZero() {
return *u.Metadata.Expires
}
return u.Spec.Expires
} | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"Expiry",
"(",
")",
"time",
".",
"Time",
"{",
"if",
"u",
".",
"Metadata",
".",
"Expires",
"!=",
"nil",
"&&",
"!",
"u",
".",
"Metadata",
".",
"Expires",
".",
"IsZero",
"(",
")",
"{",
"return",
"*",
"u",
".",... | // Expiry returns expiry time for temporary users. Prefer expires from
// metadata, if it does not exist, fall back to expires in spec. | [
"Expiry",
"returns",
"expiry",
"time",
"for",
"temporary",
"users",
".",
"Prefer",
"expires",
"from",
"metadata",
"if",
"it",
"does",
"not",
"exist",
"fall",
"back",
"to",
"expires",
"in",
"spec",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L352-L357 | train |
gravitational/teleport | lib/services/user.go | SetRoles | func (u *UserV2) SetRoles(roles []string) {
u.Spec.Roles = utils.Deduplicate(roles)
} | go | func (u *UserV2) SetRoles(roles []string) {
u.Spec.Roles = utils.Deduplicate(roles)
} | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"SetRoles",
"(",
"roles",
"[",
"]",
"string",
")",
"{",
"u",
".",
"Spec",
".",
"Roles",
"=",
"utils",
".",
"Deduplicate",
"(",
"roles",
")",
"\n",
"}"
] | // SetRoles sets a list of roles for user | [
"SetRoles",
"sets",
"a",
"list",
"of",
"roles",
"for",
"user"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L360-L362 | train |
gravitational/teleport | lib/services/user.go | AddRole | func (u *UserV2) AddRole(name string) {
for _, r := range u.Spec.Roles {
if r == name {
return
}
}
u.Spec.Roles = append(u.Spec.Roles, name)
} | go | func (u *UserV2) AddRole(name string) {
for _, r := range u.Spec.Roles {
if r == name {
return
}
}
u.Spec.Roles = append(u.Spec.Roles, name)
} | [
"func",
"(",
"u",
"*",
"UserV2",
")",
"AddRole",
"(",
"name",
"string",
")",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"u",
".",
"Spec",
".",
"Roles",
"{",
"if",
"r",
"==",
"name",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"u",
".",
"Spec",
... | // AddRole adds a role to user's role list | [
"AddRole",
"adds",
"a",
"role",
"to",
"user",
"s",
"role",
"list"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L390-L397 | train |
gravitational/teleport | lib/services/user.go | V2 | func (u *UserV1) V2() *UserV2 {
return &UserV2{
Kind: KindUser,
Version: V2,
Metadata: Metadata{
Name: u.Name,
Namespace: defaults.Namespace,
},
Spec: UserSpecV2{
OIDCIdentities: u.OIDCIdentities,
Status: u.Status,
Expires: u.Expires,
CreatedBy: u.CreatedBy,
R... | go | func (u *UserV1) V2() *UserV2 {
return &UserV2{
Kind: KindUser,
Version: V2,
Metadata: Metadata{
Name: u.Name,
Namespace: defaults.Namespace,
},
Spec: UserSpecV2{
OIDCIdentities: u.OIDCIdentities,
Status: u.Status,
Expires: u.Expires,
CreatedBy: u.CreatedBy,
R... | [
"func",
"(",
"u",
"*",
"UserV1",
")",
"V2",
"(",
")",
"*",
"UserV2",
"{",
"return",
"&",
"UserV2",
"{",
"Kind",
":",
"KindUser",
",",
"Version",
":",
"V2",
",",
"Metadata",
":",
"Metadata",
"{",
"Name",
":",
"u",
".",
"Name",
",",
"Namespace",
":... | //V2 converts UserV1 to UserV2 format | [
"V2",
"converts",
"UserV1",
"to",
"UserV2",
"format"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L483-L503 | train |
gravitational/teleport | lib/services/user.go | GetUserSchema | func GetUserSchema(extensionSchema string) string {
var userSchema string
if extensionSchema == "" {
userSchema = fmt.Sprintf(UserSpecV2SchemaTemplate, ExternalIdentitySchema, ExternalIdentitySchema, ExternalIdentitySchema, LoginStatusSchema, CreatedBySchema, ``)
} else {
userSchema = fmt.Sprintf(UserSpecV2Schem... | go | func GetUserSchema(extensionSchema string) string {
var userSchema string
if extensionSchema == "" {
userSchema = fmt.Sprintf(UserSpecV2SchemaTemplate, ExternalIdentitySchema, ExternalIdentitySchema, ExternalIdentitySchema, LoginStatusSchema, CreatedBySchema, ``)
} else {
userSchema = fmt.Sprintf(UserSpecV2Schem... | [
"func",
"GetUserSchema",
"(",
"extensionSchema",
"string",
")",
"string",
"{",
"var",
"userSchema",
"string",
"\n",
"if",
"extensionSchema",
"==",
"\"",
"\"",
"{",
"userSchema",
"=",
"fmt",
".",
"Sprintf",
"(",
"UserSpecV2SchemaTemplate",
",",
"ExternalIdentitySch... | // GetRoleSchema returns role schema with optionally injected
// schema for extensions | [
"GetRoleSchema",
"returns",
"role",
"schema",
"with",
"optionally",
"injected",
"schema",
"for",
"extensions"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L536-L544 | train |
gravitational/teleport | lib/services/user.go | UnmarshalUser | func (*TeleportUserMarshaler) UnmarshalUser(bytes []byte, opts ...MarshalOption) (User, error) {
var h ResourceHeader
err := json.Unmarshal(bytes, &h)
if err != nil {
return nil, trace.Wrap(err)
}
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
switch h.Version {
case "":
... | go | func (*TeleportUserMarshaler) UnmarshalUser(bytes []byte, opts ...MarshalOption) (User, error) {
var h ResourceHeader
err := json.Unmarshal(bytes, &h)
if err != nil {
return nil, trace.Wrap(err)
}
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
switch h.Version {
case "":
... | [
"func",
"(",
"*",
"TeleportUserMarshaler",
")",
"UnmarshalUser",
"(",
"bytes",
"[",
"]",
"byte",
",",
"opts",
"...",
"MarshalOption",
")",
"(",
"User",
",",
"error",
")",
"{",
"var",
"h",
"ResourceHeader",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"("... | // UnmarshalUser unmarshals user from JSON | [
"UnmarshalUser",
"unmarshals",
"user",
"from",
"JSON"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L549-L595 | train |
gravitational/teleport | lib/services/user.go | MarshalUser | func (*TeleportUserMarshaler) MarshalUser(u User, opts ...MarshalOption) ([]byte, error) {
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
type userv1 interface {
V1() *UserV1
}
type userv2 interface {
V2() *UserV2
}
version := cfg.GetVersion()
switch version {
case V1:
... | go | func (*TeleportUserMarshaler) MarshalUser(u User, opts ...MarshalOption) ([]byte, error) {
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
type userv1 interface {
V1() *UserV1
}
type userv2 interface {
V2() *UserV2
}
version := cfg.GetVersion()
switch version {
case V1:
... | [
"func",
"(",
"*",
"TeleportUserMarshaler",
")",
"MarshalUser",
"(",
"u",
"User",
",",
"opts",
"...",
"MarshalOption",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"cfg",
",",
"err",
":=",
"collectOptions",
"(",
"opts",
")",
"\n",
"if",
"err",
... | // MarshalUser marshalls user into JSON | [
"MarshalUser",
"marshalls",
"user",
"into",
"JSON"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/user.go#L603-L640 | train |
gravitational/teleport | lib/backend/wrap.go | GetReadError | func (s *Wrapper) GetReadError() error {
s.RLock()
defer s.RUnlock()
return s.readErr
} | go | func (s *Wrapper) GetReadError() error {
s.RLock()
defer s.RUnlock()
return s.readErr
} | [
"func",
"(",
"s",
"*",
"Wrapper",
")",
"GetReadError",
"(",
")",
"error",
"{",
"s",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
".",
"readErr",
"\n",
"}"
] | // GetReadError returns error to be returned by
// read backend operations | [
"GetReadError",
"returns",
"error",
"to",
"be",
"returned",
"by",
"read",
"backend",
"operations"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/wrap.go#L47-L51 | train |
gravitational/teleport | lib/backend/wrap.go | SetReadError | func (s *Wrapper) SetReadError(err error) {
s.Lock()
defer s.Unlock()
s.readErr = err
} | go | func (s *Wrapper) SetReadError(err error) {
s.Lock()
defer s.Unlock()
s.readErr = err
} | [
"func",
"(",
"s",
"*",
"Wrapper",
")",
"SetReadError",
"(",
"err",
"error",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"readErr",
"=",
"err",
"\n",
"}"
] | // SetReadError sets error to be returned by read backend operations | [
"SetReadError",
"sets",
"error",
"to",
"be",
"returned",
"by",
"read",
"backend",
"operations"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/wrap.go#L54-L58 | train |
gravitational/teleport | lib/services/local/users.go | DeleteAllUsers | func (s *IdentityService) DeleteAllUsers() error {
startKey := backend.Key(webPrefix, usersPrefix)
return s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
} | go | func (s *IdentityService) DeleteAllUsers() error {
startKey := backend.Key(webPrefix, usersPrefix)
return s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
} | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteAllUsers",
"(",
")",
"error",
"{",
"startKey",
":=",
"backend",
".",
"Key",
"(",
"webPrefix",
",",
"usersPrefix",
")",
"\n",
"return",
"s",
".",
"DeleteRange",
"(",
"context",
".",
"TODO",
"(",
")",
... | // DeleteAllUsers deletes all users | [
"DeleteAllUsers",
"deletes",
"all",
"users"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L54-L57 | train |
gravitational/teleport | lib/services/local/users.go | GetUsers | func (s *IdentityService) GetUsers() ([]services.User, error) {
startKey := backend.Key(webPrefix, usersPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wrap(err)
}
var out []services.User
for _, item := range result.Items... | go | func (s *IdentityService) GetUsers() ([]services.User, error) {
startKey := backend.Key(webPrefix, usersPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wrap(err)
}
var out []services.User
for _, item := range result.Items... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetUsers",
"(",
")",
"(",
"[",
"]",
"services",
".",
"User",
",",
"error",
")",
"{",
"startKey",
":=",
"backend",
".",
"Key",
"(",
"webPrefix",
",",
"usersPrefix",
")",
"\n",
"result",
",",
"err",
":=",... | // GetUsers returns a list of users registered with the local auth server | [
"GetUsers",
"returns",
"a",
"list",
"of",
"users",
"registered",
"with",
"the",
"local",
"auth",
"server"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L60-L79 | train |
gravitational/teleport | lib/services/local/users.go | CreateUser | func (s *IdentityService) CreateUser(user services.User) error {
if err := user.Check(); err != nil {
return trace.Wrap(err)
}
value, err := services.GetUserMarshaler().MarshalUser(user)
if err != nil {
return trace.Wrap(err)
}
item := backend.Item{
Key: backend.Key(webPrefix, usersPrefix, user.GetName(... | go | func (s *IdentityService) CreateUser(user services.User) error {
if err := user.Check(); err != nil {
return trace.Wrap(err)
}
value, err := services.GetUserMarshaler().MarshalUser(user)
if err != nil {
return trace.Wrap(err)
}
item := backend.Item{
Key: backend.Key(webPrefix, usersPrefix, user.GetName(... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"CreateUser",
"(",
"user",
"services",
".",
"User",
")",
"error",
"{",
"if",
"err",
":=",
"user",
".",
"Check",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wrap",
"(",
"err",
")",
... | // CreateUser creates user if it does not exist | [
"CreateUser",
"creates",
"user",
"if",
"it",
"does",
"not",
"exist"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L82-L100 | train |
gravitational/teleport | lib/services/local/users.go | GetUser | func (s *IdentityService) GetUser(user string) (services.User, error) {
if user == "" {
return nil, trace.BadParameter("missing user name")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, usersPrefix, user, paramsPrefix))
if err != nil {
return nil, trace.NotFound("user %q is not found", user)
}
u... | go | func (s *IdentityService) GetUser(user string) (services.User, error) {
if user == "" {
return nil, trace.BadParameter("missing user name")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, usersPrefix, user, paramsPrefix))
if err != nil {
return nil, trace.NotFound("user %q is not found", user)
}
u... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetUser",
"(",
"user",
"string",
")",
"(",
"services",
".",
"User",
",",
"error",
")",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")... | // GetUser returns a user by name | [
"GetUser",
"returns",
"a",
"user",
"by",
"name"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L125-L139 | train |
gravitational/teleport | lib/services/local/users.go | GetUserByOIDCIdentity | func (s *IdentityService) GetUserByOIDCIdentity(id services.ExternalIdentity) (services.User, error) {
users, err := s.GetUsers()
if err != nil {
return nil, trace.Wrap(err)
}
for _, u := range users {
for _, uid := range u.GetOIDCIdentities() {
if uid.Equals(&id) {
return u, nil
}
}
}
return nil,... | go | func (s *IdentityService) GetUserByOIDCIdentity(id services.ExternalIdentity) (services.User, error) {
users, err := s.GetUsers()
if err != nil {
return nil, trace.Wrap(err)
}
for _, u := range users {
for _, uid := range u.GetOIDCIdentities() {
if uid.Equals(&id) {
return u, nil
}
}
}
return nil,... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetUserByOIDCIdentity",
"(",
"id",
"services",
".",
"ExternalIdentity",
")",
"(",
"services",
".",
"User",
",",
"error",
")",
"{",
"users",
",",
"err",
":=",
"s",
".",
"GetUsers",
"(",
")",
"\n",
"if",
"e... | // GetUserByOIDCIdentity returns a user by it's specified OIDC Identity, returns first
// user specified with this identity | [
"GetUserByOIDCIdentity",
"returns",
"a",
"user",
"by",
"it",
"s",
"specified",
"OIDC",
"Identity",
"returns",
"first",
"user",
"specified",
"with",
"this",
"identity"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L143-L156 | train |
gravitational/teleport | lib/services/local/users.go | DeleteUser | func (s *IdentityService) DeleteUser(user string) error {
_, err := s.GetUser(user)
if err != nil {
return trace.Wrap(err)
}
startKey := backend.Key(webPrefix, usersPrefix, user)
err = s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
return trace.Wrap(err)
} | go | func (s *IdentityService) DeleteUser(user string) error {
_, err := s.GetUser(user)
if err != nil {
return trace.Wrap(err)
}
startKey := backend.Key(webPrefix, usersPrefix, user)
err = s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
return trace.Wrap(err)
} | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteUser",
"(",
"user",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"s",
".",
"GetUser",
"(",
"user",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wrap",
"(",
"err",
... | // DeleteUser deletes a user with all the keys from the backend | [
"DeleteUser",
"deletes",
"a",
"user",
"with",
"all",
"the",
"keys",
"from",
"the",
"backend"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L192-L200 | train |
gravitational/teleport | lib/services/local/users.go | UpsertPasswordHash | func (s *IdentityService) UpsertPasswordHash(username string, hash []byte) error {
userPrototype, err := services.NewUser(username)
if err != nil {
return trace.Wrap(err)
}
user, err := services.GetUserMarshaler().GenerateUser(userPrototype)
if err != nil {
return trace.Wrap(err)
}
err = s.CreateUser(user)
... | go | func (s *IdentityService) UpsertPasswordHash(username string, hash []byte) error {
userPrototype, err := services.NewUser(username)
if err != nil {
return trace.Wrap(err)
}
user, err := services.GetUserMarshaler().GenerateUser(userPrototype)
if err != nil {
return trace.Wrap(err)
}
err = s.CreateUser(user)
... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertPasswordHash",
"(",
"username",
"string",
",",
"hash",
"[",
"]",
"byte",
")",
"error",
"{",
"userPrototype",
",",
"err",
":=",
"services",
".",
"NewUser",
"(",
"username",
")",
"\n",
"if",
"err",
"!="... | // UpsertPasswordHash upserts user password hash | [
"UpsertPasswordHash",
"upserts",
"user",
"password",
"hash"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L203-L227 | train |
gravitational/teleport | lib/services/local/users.go | UpsertTOTP | func (s *IdentityService) UpsertTOTP(user string, secretKey string) error {
if user == "" {
return trace.BadParameter("missing user name")
}
item := backend.Item{
Key: backend.Key(webPrefix, usersPrefix, user, totpPrefix),
Value: []byte(secretKey),
}
_, err := s.Put(context.TODO(), item)
if err != nil {... | go | func (s *IdentityService) UpsertTOTP(user string, secretKey string) error {
if user == "" {
return trace.BadParameter("missing user name")
}
item := backend.Item{
Key: backend.Key(webPrefix, usersPrefix, user, totpPrefix),
Value: []byte(secretKey),
}
_, err := s.Put(context.TODO(), item)
if err != nil {... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertTOTP",
"(",
"user",
"string",
",",
"secretKey",
"string",
")",
"error",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"... | // UpsertTOTP upserts TOTP secret key for a user that can be used to generate and validate tokens. | [
"UpsertTOTP",
"upserts",
"TOTP",
"secret",
"key",
"for",
"a",
"user",
"that",
"can",
"be",
"used",
"to",
"generate",
"and",
"validate",
"tokens",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L292-L308 | train |
gravitational/teleport | lib/services/local/users.go | GetTOTP | func (s *IdentityService) GetTOTP(user string) (string, error) {
if user == "" {
return "", trace.BadParameter("missing user name")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, usersPrefix, user, totpPrefix))
if err != nil {
if trace.IsNotFound(err) {
return "", trace.NotFound("user %q is not... | go | func (s *IdentityService) GetTOTP(user string) (string, error) {
if user == "" {
return "", trace.BadParameter("missing user name")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, usersPrefix, user, totpPrefix))
if err != nil {
if trace.IsNotFound(err) {
return "", trace.NotFound("user %q is not... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetTOTP",
"(",
"user",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
... | // GetTOTP returns the secret key used by the TOTP algorithm to validate tokens | [
"GetTOTP",
"returns",
"the",
"secret",
"key",
"used",
"by",
"the",
"TOTP",
"algorithm",
"to",
"validate",
"tokens"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L311-L325 | train |
gravitational/teleport | lib/services/local/users.go | UpsertUsedTOTPToken | func (s *IdentityService) UpsertUsedTOTPToken(user string, otpToken string) error {
if user == "" {
return trace.BadParameter("missing user name")
}
item := backend.Item{
Key: backend.Key(webPrefix, usersPrefix, user, usedTOTPPrefix),
Value: []byte(otpToken),
Expires: s.Clock().Now().UTC().Add(usedTOTP... | go | func (s *IdentityService) UpsertUsedTOTPToken(user string, otpToken string) error {
if user == "" {
return trace.BadParameter("missing user name")
}
item := backend.Item{
Key: backend.Key(webPrefix, usersPrefix, user, usedTOTPPrefix),
Value: []byte(otpToken),
Expires: s.Clock().Now().UTC().Add(usedTOTP... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertUsedTOTPToken",
"(",
"user",
"string",
",",
"otpToken",
"string",
")",
"error",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n... | // UpsertUsedTOTPToken upserts a TOTP token to the backend so it can't be used again
// during the 30 second window it's valid. | [
"UpsertUsedTOTPToken",
"upserts",
"a",
"TOTP",
"token",
"to",
"the",
"backend",
"so",
"it",
"can",
"t",
"be",
"used",
"again",
"during",
"the",
"30",
"second",
"window",
"it",
"s",
"valid",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L329-L343 | train |
gravitational/teleport | lib/services/local/users.go | DeleteUsedTOTPToken | func (s *IdentityService) DeleteUsedTOTPToken(user string) error {
if user == "" {
return trace.BadParameter("missing user name")
}
return s.Delete(context.TODO(), backend.Key(webPrefix, usersPrefix, user, usedTOTPPrefix))
} | go | func (s *IdentityService) DeleteUsedTOTPToken(user string) error {
if user == "" {
return trace.BadParameter("missing user name")
}
return s.Delete(context.TODO(), backend.Key(webPrefix, usersPrefix, user, usedTOTPPrefix))
} | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteUsedTOTPToken",
"(",
"user",
"string",
")",
"error",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"D... | // DeleteUsedTOTPToken removes the used token from the backend. This should only
// be used during tests. | [
"DeleteUsedTOTPToken",
"removes",
"the",
"used",
"token",
"from",
"the",
"backend",
".",
"This",
"should",
"only",
"be",
"used",
"during",
"tests",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L363-L368 | train |
gravitational/teleport | lib/services/local/users.go | UpsertWebSession | func (s *IdentityService) UpsertWebSession(user, sid string, session services.WebSession) error {
session.SetUser(user)
session.SetName(sid)
value, err := services.GetWebSessionMarshaler().MarshalWebSession(session)
if err != nil {
return trace.Wrap(err)
}
sessionMetadata := session.GetMetadata()
item := backe... | go | func (s *IdentityService) UpsertWebSession(user, sid string, session services.WebSession) error {
session.SetUser(user)
session.SetName(sid)
value, err := services.GetWebSessionMarshaler().MarshalWebSession(session)
if err != nil {
return trace.Wrap(err)
}
sessionMetadata := session.GetMetadata()
item := backe... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertWebSession",
"(",
"user",
",",
"sid",
"string",
",",
"session",
"services",
".",
"WebSession",
")",
"error",
"{",
"session",
".",
"SetUser",
"(",
"user",
")",
"\n",
"session",
".",
"SetName",
"(",
"si... | // UpsertWebSession updates or inserts a web session for a user and session id
// the session will be created with bearer token expiry time TTL, because
// it is expected to be extended by the client before then | [
"UpsertWebSession",
"updates",
"or",
"inserts",
"a",
"web",
"session",
"for",
"a",
"user",
"and",
"session",
"id",
"the",
"session",
"will",
"be",
"created",
"with",
"bearer",
"token",
"expiry",
"time",
"TTL",
"because",
"it",
"is",
"expected",
"to",
"be",
... | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L373-L388 | train |
gravitational/teleport | lib/services/local/users.go | GetUserLoginAttempts | func (s *IdentityService) GetUserLoginAttempts(user string) ([]services.LoginAttempt, error) {
startKey := backend.Key(webPrefix, usersPrefix, user, attemptsPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wrap(err)
}
out :... | go | func (s *IdentityService) GetUserLoginAttempts(user string) ([]services.LoginAttempt, error) {
startKey := backend.Key(webPrefix, usersPrefix, user, attemptsPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wrap(err)
}
out :... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetUserLoginAttempts",
"(",
"user",
"string",
")",
"(",
"[",
"]",
"services",
".",
"LoginAttempt",
",",
"error",
")",
"{",
"startKey",
":=",
"backend",
".",
"Key",
"(",
"webPrefix",
",",
"usersPrefix",
",",
... | // GetUserLoginAttempts returns user login attempts | [
"GetUserLoginAttempts",
"returns",
"user",
"login",
"attempts"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L409-L425 | train |
gravitational/teleport | lib/services/local/users.go | DeleteUserLoginAttempts | func (s *IdentityService) DeleteUserLoginAttempts(user string) error {
if user == "" {
return trace.BadParameter("missing username")
}
startKey := backend.Key(webPrefix, usersPrefix, user, attemptsPrefix)
err := s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
if err != nil {
return trace.Wr... | go | func (s *IdentityService) DeleteUserLoginAttempts(user string) error {
if user == "" {
return trace.BadParameter("missing username")
}
startKey := backend.Key(webPrefix, usersPrefix, user, attemptsPrefix)
err := s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
if err != nil {
return trace.Wr... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteUserLoginAttempts",
"(",
"user",
"string",
")",
"error",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"startKey",
":=",
"b... | // DeleteUserLoginAttempts removes all login attempts of a user. Should be
// called after successful login. | [
"DeleteUserLoginAttempts",
"removes",
"all",
"login",
"attempts",
"of",
"a",
"user",
".",
"Should",
"be",
"called",
"after",
"successful",
"login",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L429-L439 | train |
gravitational/teleport | lib/services/local/users.go | GetWebSession | func (s *IdentityService) GetWebSession(user, sid string) (services.WebSession, error) {
if user == "" {
return nil, trace.BadParameter("missing username")
}
if sid == "" {
return nil, trace.BadParameter("missing session id")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, usersPrefix, user, sessio... | go | func (s *IdentityService) GetWebSession(user, sid string) (services.WebSession, error) {
if user == "" {
return nil, trace.BadParameter("missing username")
}
if sid == "" {
return nil, trace.BadParameter("missing session id")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, usersPrefix, user, sessio... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetWebSession",
"(",
"user",
",",
"sid",
"string",
")",
"(",
"services",
".",
"WebSession",
",",
"error",
")",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"BadParameter",... | // GetWebSession returns a web session state for a given user and session id | [
"GetWebSession",
"returns",
"a",
"web",
"session",
"state",
"for",
"a",
"given",
"user",
"and",
"session",
"id"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L442-L462 | train |
gravitational/teleport | lib/services/local/users.go | DeleteWebSession | func (s *IdentityService) DeleteWebSession(user, sid string) error {
if user == "" {
return trace.BadParameter("missing username")
}
if sid == "" {
return trace.BadParameter("missing session id")
}
err := s.Delete(context.TODO(), backend.Key(webPrefix, usersPrefix, user, sessionsPrefix, sid))
return trace.Wra... | go | func (s *IdentityService) DeleteWebSession(user, sid string) error {
if user == "" {
return trace.BadParameter("missing username")
}
if sid == "" {
return trace.BadParameter("missing session id")
}
err := s.Delete(context.TODO(), backend.Key(webPrefix, usersPrefix, user, sessionsPrefix, sid))
return trace.Wra... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteWebSession",
"(",
"user",
",",
"sid",
"string",
")",
"error",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"sid",
... | // DeleteWebSession deletes web session from the storage | [
"DeleteWebSession",
"deletes",
"web",
"session",
"from",
"the",
"storage"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L465-L474 | train |
gravitational/teleport | lib/services/local/users.go | UpsertPassword | func (s *IdentityService) UpsertPassword(user string, password []byte) error {
if user == "" {
return trace.BadParameter("missing username")
}
err := services.VerifyPassword(password)
if err != nil {
return trace.Wrap(err)
}
hash, err := bcrypt.GenerateFromPassword(password, bcrypt.DefaultCost)
if err != nil... | go | func (s *IdentityService) UpsertPassword(user string, password []byte) error {
if user == "" {
return trace.BadParameter("missing username")
}
err := services.VerifyPassword(password)
if err != nil {
return trace.Wrap(err)
}
hash, err := bcrypt.GenerateFromPassword(password, bcrypt.DefaultCost)
if err != nil... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertPassword",
"(",
"user",
"string",
",",
"password",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"user",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}"... | // UpsertPassword upserts new password hash into a backend. | [
"UpsertPassword",
"upserts",
"new",
"password",
"hash",
"into",
"a",
"backend",
"."
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L477-L496 | train |
gravitational/teleport | lib/services/local/users.go | UpsertSignupToken | func (s *IdentityService) UpsertSignupToken(token string, tokenData services.SignupToken, ttl time.Duration) error {
if ttl < time.Second || ttl > defaults.MaxSignupTokenTTL {
ttl = defaults.MaxSignupTokenTTL
}
tokenData.Expires = time.Now().UTC().Add(ttl)
value, err := json.Marshal(tokenData)
if err != nil {
... | go | func (s *IdentityService) UpsertSignupToken(token string, tokenData services.SignupToken, ttl time.Duration) error {
if ttl < time.Second || ttl > defaults.MaxSignupTokenTTL {
ttl = defaults.MaxSignupTokenTTL
}
tokenData.Expires = time.Now().UTC().Add(ttl)
value, err := json.Marshal(tokenData)
if err != nil {
... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertSignupToken",
"(",
"token",
"string",
",",
"tokenData",
"services",
".",
"SignupToken",
",",
"ttl",
"time",
".",
"Duration",
")",
"error",
"{",
"if",
"ttl",
"<",
"time",
".",
"Second",
"||",
"ttl",
">... | // UpsertSignupToken upserts signup token - one time token that lets user to create a user account | [
"UpsertSignupToken",
"upserts",
"signup",
"token",
"-",
"one",
"time",
"token",
"that",
"lets",
"user",
"to",
"create",
"a",
"user",
"account"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L499-L519 | train |
gravitational/teleport | lib/services/local/users.go | GetSignupToken | func (s *IdentityService) GetSignupToken(token string) (*services.SignupToken, error) {
if token == "" {
return nil, trace.BadParameter("missing token")
}
item, err := s.Get(context.TODO(), backend.Key(userTokensPrefix, token))
if err != nil {
return nil, trace.Wrap(err)
}
var signupToken services.SignupToken... | go | func (s *IdentityService) GetSignupToken(token string) (*services.SignupToken, error) {
if token == "" {
return nil, trace.BadParameter("missing token")
}
item, err := s.Get(context.TODO(), backend.Key(userTokensPrefix, token))
if err != nil {
return nil, trace.Wrap(err)
}
var signupToken services.SignupToken... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetSignupToken",
"(",
"token",
"string",
")",
"(",
"*",
"services",
".",
"SignupToken",
",",
"error",
")",
"{",
"if",
"token",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
".",
"BadParameter",
"(... | // GetSignupToken returns signup token data | [
"GetSignupToken",
"returns",
"signup",
"token",
"data"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L522-L536 | train |
gravitational/teleport | lib/services/local/users.go | GetSignupTokens | func (s *IdentityService) GetSignupTokens() ([]services.SignupToken, error) {
startKey := backend.Key(userTokensPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wrap(err)
}
tokens := make([]services.SignupToken, len(result.... | go | func (s *IdentityService) GetSignupTokens() ([]services.SignupToken, error) {
startKey := backend.Key(userTokensPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wrap(err)
}
tokens := make([]services.SignupToken, len(result.... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetSignupTokens",
"(",
")",
"(",
"[",
"]",
"services",
".",
"SignupToken",
",",
"error",
")",
"{",
"startKey",
":=",
"backend",
".",
"Key",
"(",
"userTokensPrefix",
")",
"\n",
"result",
",",
"err",
":=",
... | // GetSignupTokens returns all non-expired user tokens | [
"GetSignupTokens",
"returns",
"all",
"non",
"-",
"expired",
"user",
"tokens"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L539-L555 | train |
gravitational/teleport | lib/services/local/users.go | DeleteSignupToken | func (s *IdentityService) DeleteSignupToken(token string) error {
if token == "" {
return trace.BadParameter("missing parameter token")
}
err := s.Delete(context.TODO(), backend.Key(userTokensPrefix, token))
return trace.Wrap(err)
} | go | func (s *IdentityService) DeleteSignupToken(token string) error {
if token == "" {
return trace.BadParameter("missing parameter token")
}
err := s.Delete(context.TODO(), backend.Key(userTokensPrefix, token))
return trace.Wrap(err)
} | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteSignupToken",
"(",
"token",
"string",
")",
"error",
"{",
"if",
"token",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"err",
":=",
"s",
".",... | // DeleteSignupToken deletes signup token from the storage | [
"DeleteSignupToken",
"deletes",
"signup",
"token",
"from",
"the",
"storage"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L558-L564 | train |
gravitational/teleport | lib/services/local/users.go | UpsertOIDCConnector | func (s *IdentityService) UpsertOIDCConnector(connector services.OIDCConnector) error {
if err := connector.Check(); err != nil {
return trace.Wrap(err)
}
value, err := services.GetOIDCConnectorMarshaler().MarshalOIDCConnector(connector)
if err != nil {
return trace.Wrap(err)
}
item := backend.Item{
Key: ... | go | func (s *IdentityService) UpsertOIDCConnector(connector services.OIDCConnector) error {
if err := connector.Check(); err != nil {
return trace.Wrap(err)
}
value, err := services.GetOIDCConnectorMarshaler().MarshalOIDCConnector(connector)
if err != nil {
return trace.Wrap(err)
}
item := backend.Item{
Key: ... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"UpsertOIDCConnector",
"(",
"connector",
"services",
".",
"OIDCConnector",
")",
"error",
"{",
"if",
"err",
":=",
"connector",
".",
"Check",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace",
".",
"Wr... | // UpsertOIDCConnector upserts OIDC Connector | [
"UpsertOIDCConnector",
"upserts",
"OIDC",
"Connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L746-L765 | train |
gravitational/teleport | lib/services/local/users.go | GetOIDCConnector | func (s *IdentityService) GetOIDCConnector(name string, withSecrets bool) (services.OIDCConnector, error) {
if name == "" {
return nil, trace.BadParameter("missing parameter name")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, connectorsPrefix, oidcPrefix, connectorsPrefix, name))
if err != nil {
... | go | func (s *IdentityService) GetOIDCConnector(name string, withSecrets bool) (services.OIDCConnector, error) {
if name == "" {
return nil, trace.BadParameter("missing parameter name")
}
item, err := s.Get(context.TODO(), backend.Key(webPrefix, connectorsPrefix, oidcPrefix, connectorsPrefix, name))
if err != nil {
... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetOIDCConnector",
"(",
"name",
"string",
",",
"withSecrets",
"bool",
")",
"(",
"services",
".",
"OIDCConnector",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"trace",
... | // GetOIDCConnector returns OIDC connector data, parameter 'withSecrets'
// includes or excludes client secret from return results | [
"GetOIDCConnector",
"returns",
"OIDC",
"connector",
"data",
"parameter",
"withSecrets",
"includes",
"or",
"excludes",
"client",
"secret",
"from",
"return",
"results"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L778-L798 | train |
gravitational/teleport | lib/services/local/users.go | GetOIDCConnectors | func (s *IdentityService) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error) {
startKey := backend.Key(webPrefix, connectorsPrefix, oidcPrefix, connectorsPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wra... | go | func (s *IdentityService) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error) {
startKey := backend.Key(webPrefix, connectorsPrefix, oidcPrefix, connectorsPrefix)
result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
if err != nil {
return nil, trace.Wra... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"GetOIDCConnectors",
"(",
"withSecrets",
"bool",
")",
"(",
"[",
"]",
"services",
".",
"OIDCConnector",
",",
"error",
")",
"{",
"startKey",
":=",
"backend",
".",
"Key",
"(",
"webPrefix",
",",
"connectorsPrefix",
... | // GetOIDCConnectors returns registered connectors, withSecrets adds or removes client secret from return results | [
"GetOIDCConnectors",
"returns",
"registered",
"connectors",
"withSecrets",
"adds",
"or",
"removes",
"client",
"secret",
"from",
"return",
"results"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L801-L820 | train |
gravitational/teleport | lib/services/local/users.go | CreateOIDCAuthRequest | func (s *IdentityService) CreateOIDCAuthRequest(req services.OIDCAuthRequest, ttl time.Duration) error {
if err := req.Check(); err != nil {
return trace.Wrap(err)
}
value, err := json.Marshal(req)
if err != nil {
return trace.Wrap(err)
}
item := backend.Item{
Key: backend.Key(webPrefix, connectorsPrefi... | go | func (s *IdentityService) CreateOIDCAuthRequest(req services.OIDCAuthRequest, ttl time.Duration) error {
if err := req.Check(); err != nil {
return trace.Wrap(err)
}
value, err := json.Marshal(req)
if err != nil {
return trace.Wrap(err)
}
item := backend.Item{
Key: backend.Key(webPrefix, connectorsPrefi... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"CreateOIDCAuthRequest",
"(",
"req",
"services",
".",
"OIDCAuthRequest",
",",
"ttl",
"time",
".",
"Duration",
")",
"error",
"{",
"if",
"err",
":=",
"req",
".",
"Check",
"(",
")",
";",
"err",
"!=",
"nil",
"... | // CreateOIDCAuthRequest creates new auth request | [
"CreateOIDCAuthRequest",
"creates",
"new",
"auth",
"request"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L823-L841 | train |
gravitational/teleport | lib/services/local/users.go | CreateSAMLConnector | func (s *IdentityService) CreateSAMLConnector(connector services.SAMLConnector) error {
if err := connector.CheckAndSetDefaults(); err != nil {
return trace.Wrap(err)
}
value, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
item := backend.I... | go | func (s *IdentityService) CreateSAMLConnector(connector services.SAMLConnector) error {
if err := connector.CheckAndSetDefaults(); err != nil {
return trace.Wrap(err)
}
value, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
item := backend.I... | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"CreateSAMLConnector",
"(",
"connector",
"services",
".",
"SAMLConnector",
")",
"error",
"{",
"if",
"err",
":=",
"connector",
".",
"CheckAndSetDefaults",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"trace"... | // CreateSAMLConnector creates SAML Connector | [
"CreateSAMLConnector",
"creates",
"SAML",
"Connector"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L860-L878 | train |
gravitational/teleport | lib/services/local/users.go | DeleteSAMLConnector | func (s *IdentityService) DeleteSAMLConnector(name string) error {
if name == "" {
return trace.BadParameter("missing parameter name")
}
err := s.Delete(context.TODO(), backend.Key(webPrefix, connectorsPrefix, samlPrefix, connectorsPrefix, name))
return trace.Wrap(err)
} | go | func (s *IdentityService) DeleteSAMLConnector(name string) error {
if name == "" {
return trace.BadParameter("missing parameter name")
}
err := s.Delete(context.TODO(), backend.Key(webPrefix, connectorsPrefix, samlPrefix, connectorsPrefix, name))
return trace.Wrap(err)
} | [
"func",
"(",
"s",
"*",
"IdentityService",
")",
"DeleteSAMLConnector",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"trace",
".",
"BadParameter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"err",
":=",
"s",
".",... | // DeleteSAMLConnector deletes SAML Connector by name | [
"DeleteSAMLConnector",
"deletes",
"SAML",
"Connector",
"by",
"name"
] | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/users.go#L902-L908 | 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.