id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
123,700 | manifoldco/torus-cli | cmd/profile.go | profileView | func profileView(ctx *cli.Context) error {
cfg, err := config.LoadConfig()
if err != nil {
return err
}
client := api.NewClient(cfg)
c := context.Background()
session, err := client.Session.Who(c)
if err != nil {
return errs.NewErrorExitError("Error fetching user details", err)
}
printProfile(session)
... | go | func profileView(ctx *cli.Context) error {
cfg, err := config.LoadConfig()
if err != nil {
return err
}
client := api.NewClient(cfg)
c := context.Background()
session, err := client.Session.Who(c)
if err != nil {
return errs.NewErrorExitError("Error fetching user details", err)
}
printProfile(session)
... | [
"func",
"profileView",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"cfg",
",",
"err",
":=",
"config",
".",
"LoadConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"client",
":=",
"api",
".",
... | // profileView is used to view your account profile | [
"profileView",
"is",
"used",
"to",
"view",
"your",
"account",
"profile"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/cmd/profile.go#L45-L61 |
123,701 | manifoldco/torus-cli | validate/validate.go | Confirmer | func Confirmer(defaultYes bool) Func {
return func(input string) error {
if defaultYes {
if input == "" || input == "y" || input == "N" {
return nil
}
return NewValidationError("You must specify either 'y' for yes or 'N' for no.")
}
if input == "" || input == "Y" || input == "n" {
return nil
... | go | func Confirmer(defaultYes bool) Func {
return func(input string) error {
if defaultYes {
if input == "" || input == "y" || input == "N" {
return nil
}
return NewValidationError("You must specify either 'y' for yes or 'N' for no.")
}
if input == "" || input == "Y" || input == "n" {
return nil
... | [
"func",
"Confirmer",
"(",
"defaultYes",
"bool",
")",
"Func",
"{",
"return",
"func",
"(",
"input",
"string",
")",
"error",
"{",
"if",
"defaultYes",
"{",
"if",
"input",
"==",
"\"",
"\"",
"||",
"input",
"==",
"\"",
"\"",
"||",
"input",
"==",
"\"",
"\"",... | // Confirmer returns a confirmation validation function which validates the
// input depending on whether or not this prompt is default Yes or No. | [
"Confirmer",
"returns",
"a",
"confirmation",
"validation",
"function",
"which",
"validates",
"the",
"input",
"depending",
"on",
"whether",
"or",
"not",
"this",
"prompt",
"is",
"default",
"Yes",
"or",
"No",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L66-L82 |
123,702 | manifoldco/torus-cli | validate/validate.go | OneOf | func OneOf(choices []string) Func {
return func(input string) error {
for _, v := range choices {
if input == v {
return nil
}
}
return NewValidationError(fmt.Sprintf("%s is not a valid option.", input))
}
} | go | func OneOf(choices []string) Func {
return func(input string) error {
for _, v := range choices {
if input == v {
return nil
}
}
return NewValidationError(fmt.Sprintf("%s is not a valid option.", input))
}
} | [
"func",
"OneOf",
"(",
"choices",
"[",
"]",
"string",
")",
"Func",
"{",
"return",
"func",
"(",
"input",
"string",
")",
"error",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"choices",
"{",
"if",
"input",
"==",
"v",
"{",
"return",
"nil",
"\n",
"}",
"\... | // OneOf returns a validation function which validates whether or not the input
// matches one of the given options. | [
"OneOf",
"returns",
"a",
"validation",
"function",
"which",
"validates",
"whether",
"or",
"not",
"the",
"input",
"matches",
"one",
"of",
"the",
"given",
"options",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L86-L96 |
123,703 | manifoldco/torus-cli | validate/validate.go | SlugValidator | func SlugValidator(fieldName string) Func {
return func(input string) error {
if govalidator.StringMatches(input, slugPattern) {
return nil
}
return NewValidationError(fmt.Sprintf(slugErrorPattern, fieldName))
}
} | go | func SlugValidator(fieldName string) Func {
return func(input string) error {
if govalidator.StringMatches(input, slugPattern) {
return nil
}
return NewValidationError(fmt.Sprintf(slugErrorPattern, fieldName))
}
} | [
"func",
"SlugValidator",
"(",
"fieldName",
"string",
")",
"Func",
"{",
"return",
"func",
"(",
"input",
"string",
")",
"error",
"{",
"if",
"govalidator",
".",
"StringMatches",
"(",
"input",
",",
"slugPattern",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
... | // SlugValidator returns a validation function | [
"SlugValidator",
"returns",
"a",
"validation",
"function"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L99-L107 |
123,704 | manifoldco/torus-cli | validate/validate.go | InviteCode | func InviteCode(input string) error {
if govalidator.StringMatches(input, inviteCodePattern) {
return nil
}
return NewValidationError("Please enter a valid invite code. Make sure to copy the entire code from the email!")
} | go | func InviteCode(input string) error {
if govalidator.StringMatches(input, inviteCodePattern) {
return nil
}
return NewValidationError("Please enter a valid invite code. Make sure to copy the entire code from the email!")
} | [
"func",
"InviteCode",
"(",
"input",
"string",
")",
"error",
"{",
"if",
"govalidator",
".",
"StringMatches",
"(",
"input",
",",
"inviteCodePattern",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"NewValidationError",
"(",
"\"",
"\"",
")",
"\n",
"}... | // InviteCode validates whether the input meets the invite code requirements | [
"InviteCode",
"validates",
"whether",
"the",
"input",
"meets",
"the",
"invite",
"code",
"requirements"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L110-L116 |
123,705 | manifoldco/torus-cli | validate/validate.go | VerificationCode | func VerificationCode(input string) error {
if govalidator.StringMatches(input, verifyCodePattern) {
return nil
}
return NewValidationError("Please enter a valid verification code. Make sure to copy the entire code from the email!")
} | go | func VerificationCode(input string) error {
if govalidator.StringMatches(input, verifyCodePattern) {
return nil
}
return NewValidationError("Please enter a valid verification code. Make sure to copy the entire code from the email!")
} | [
"func",
"VerificationCode",
"(",
"input",
"string",
")",
"error",
"{",
"if",
"govalidator",
".",
"StringMatches",
"(",
"input",
",",
"verifyCodePattern",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"NewValidationError",
"(",
"\"",
"\"",
")",
"\n"... | // VerificationCode validates whether the input meets the verification code requirements | [
"VerificationCode",
"validates",
"whether",
"the",
"input",
"meets",
"the",
"verification",
"code",
"requirements"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L119-L125 |
123,706 | manifoldco/torus-cli | validate/validate.go | Description | func Description(input, fieldName string) error {
if len(input) <= 500 {
return nil
}
return NewValidationError(fieldName + " descriptions must be less than 500 characters")
} | go | func Description(input, fieldName string) error {
if len(input) <= 500 {
return nil
}
return NewValidationError(fieldName + " descriptions must be less than 500 characters")
} | [
"func",
"Description",
"(",
"input",
",",
"fieldName",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"input",
")",
"<=",
"500",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"NewValidationError",
"(",
"fieldName",
"+",
"\"",
"\"",
")",
"\n",
"}"
... | // Description validates whether the input meets the descriptin requirements | [
"Description",
"validates",
"whether",
"the",
"input",
"meets",
"the",
"descriptin",
"requirements"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L128-L134 |
123,707 | manifoldco/torus-cli | validate/validate.go | Name | func Name(input string) error {
if govalidator.StringMatches(input, namePattern) {
return nil
}
return NewValidationError(fmt.Sprintf(nameErrorPattern, "Names"))
} | go | func Name(input string) error {
if govalidator.StringMatches(input, namePattern) {
return nil
}
return NewValidationError(fmt.Sprintf(nameErrorPattern, "Names"))
} | [
"func",
"Name",
"(",
"input",
"string",
")",
"error",
"{",
"if",
"govalidator",
".",
"StringMatches",
"(",
"input",
",",
"namePattern",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"NewValidationError",
"(",
"fmt",
".",
"Sprintf",
"(",
"nameErro... | // Name validates whether the input meets first name last name requirements | [
"Name",
"validates",
"whether",
"the",
"input",
"meets",
"first",
"name",
"last",
"name",
"requirements"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L146-L152 |
123,708 | manifoldco/torus-cli | validate/validate.go | Password | func Password(input string) error {
length := len(input)
if length >= 8 {
return nil
}
if length > 0 {
return NewValidationError("Passwords must be at least 8 characters")
}
return NewValidationError("Please enter a password")
} | go | func Password(input string) error {
length := len(input)
if length >= 8 {
return nil
}
if length > 0 {
return NewValidationError("Passwords must be at least 8 characters")
}
return NewValidationError("Please enter a password")
} | [
"func",
"Password",
"(",
"input",
"string",
")",
"error",
"{",
"length",
":=",
"len",
"(",
"input",
")",
"\n",
"if",
"length",
">=",
"8",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"length",
">",
"0",
"{",
"return",
"NewValidationError",
"(",
"\"",... | // Password ensures the input meets password requirements | [
"Password",
"ensures",
"the",
"input",
"meets",
"password",
"requirements"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L155-L165 |
123,709 | manifoldco/torus-cli | validate/validate.go | ConfirmPassword | func ConfirmPassword(previous string) Func {
return func(input string) error {
err := Password(input)
if err != nil {
return err
}
if input != previous {
return NewValidationError("The password you provided does not match the previous password you provided!")
}
return nil
}
} | go | func ConfirmPassword(previous string) Func {
return func(input string) error {
err := Password(input)
if err != nil {
return err
}
if input != previous {
return NewValidationError("The password you provided does not match the previous password you provided!")
}
return nil
}
} | [
"func",
"ConfirmPassword",
"(",
"previous",
"string",
")",
"Func",
"{",
"return",
"func",
"(",
"input",
"string",
")",
"error",
"{",
"err",
":=",
"Password",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
... | // ConfirmPassword ensures the input meets the password requirements and
// matches the previously provided password | [
"ConfirmPassword",
"ensures",
"the",
"input",
"meets",
"the",
"password",
"requirements",
"and",
"matches",
"the",
"previously",
"provided",
"password"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/validate/validate.go#L169-L182 |
123,710 | manifoldco/torus-cli | pathexp/pathexp.go | GlobContains | func GlobContains(value, subject string) bool {
gl := glob(value)
return gl.Contains(subject)
} | go | func GlobContains(value, subject string) bool {
gl := glob(value)
return gl.Contains(subject)
} | [
"func",
"GlobContains",
"(",
"value",
",",
"subject",
"string",
")",
"bool",
"{",
"gl",
":=",
"glob",
"(",
"value",
")",
"\n",
"return",
"gl",
".",
"Contains",
"(",
"subject",
")",
"\n",
"}"
] | // GlobContains returns whether a glob, built from the value, contains the subject | [
"GlobContains",
"returns",
"whether",
"a",
"glob",
"built",
"from",
"the",
"value",
"contains",
"the",
"subject"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L92-L95 |
123,711 | manifoldco/torus-cli | pathexp/pathexp.go | compareSegmentType | func compareSegmentType(a, b segment) int {
segs := []segment{a, b}
ranks := make([]int, 2)
for i, seg := range segs {
switch seg.(type) {
case literal:
ranks[i] = 3
case glob:
ranks[i] = 2
case alternation:
ranks[i] = 1
case fullglob:
ranks[i] = 0
default:
panic("Bad type for segment!")
... | go | func compareSegmentType(a, b segment) int {
segs := []segment{a, b}
ranks := make([]int, 2)
for i, seg := range segs {
switch seg.(type) {
case literal:
ranks[i] = 3
case glob:
ranks[i] = 2
case alternation:
ranks[i] = 1
case fullglob:
ranks[i] = 0
default:
panic("Bad type for segment!")
... | [
"func",
"compareSegmentType",
"(",
"a",
",",
"b",
"segment",
")",
"int",
"{",
"segs",
":=",
"[",
"]",
"segment",
"{",
"a",
",",
"b",
"}",
"\n",
"ranks",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"2",
")",
"\n",
"for",
"i",
",",
"seg",
":=",
"r... | // compareSegmentType ranks the segments by their type specificity | [
"compareSegmentType",
"ranks",
"the",
"segments",
"by",
"their",
"type",
"specificity"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L136-L162 |
123,712 | manifoldco/torus-cli | pathexp/pathexp.go | New | func New(org, project string, envs, services, identities, instances []string) (*PathExp, error) {
return newPathexp(org, project, envs, services, identities, instances, true)
} | go | func New(org, project string, envs, services, identities, instances []string) (*PathExp, error) {
return newPathexp(org, project, envs, services, identities, instances, true)
} | [
"func",
"New",
"(",
"org",
",",
"project",
"string",
",",
"envs",
",",
"services",
",",
"identities",
",",
"instances",
"[",
"]",
"string",
")",
"(",
"*",
"PathExp",
",",
"error",
")",
"{",
"return",
"newPathexp",
"(",
"org",
",",
"project",
",",
"en... | // New creates a new path expression from the given path segments
// It returns an error if any of the values fail to validate
// and it must contain all relevant parts | [
"New",
"creates",
"a",
"new",
"path",
"expression",
"from",
"the",
"given",
"path",
"segments",
"It",
"returns",
"an",
"error",
"if",
"any",
"of",
"the",
"values",
"fail",
"to",
"validate",
"and",
"it",
"must",
"contain",
"all",
"relevant",
"parts"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L207-L209 |
123,713 | manifoldco/torus-cli | pathexp/pathexp.go | NewPartial | func NewPartial(org, project string, envs, services, identities, instances []string) (*PathExp, error) {
return newPathexp(org, project, envs, services, identities, instances, false)
} | go | func NewPartial(org, project string, envs, services, identities, instances []string) (*PathExp, error) {
return newPathexp(org, project, envs, services, identities, instances, false)
} | [
"func",
"NewPartial",
"(",
"org",
",",
"project",
"string",
",",
"envs",
",",
"services",
",",
"identities",
",",
"instances",
"[",
"]",
"string",
")",
"(",
"*",
"PathExp",
",",
"error",
")",
"{",
"return",
"newPathexp",
"(",
"org",
",",
"project",
","... | // NewPartial creates a new path expression from the given path segments
// It returns an error if any of the values fail to validate
// but does not require any segments | [
"NewPartial",
"creates",
"a",
"new",
"path",
"expression",
"from",
"the",
"given",
"path",
"segments",
"It",
"returns",
"an",
"error",
"if",
"any",
"of",
"the",
"values",
"fail",
"to",
"validate",
"but",
"does",
"not",
"require",
"any",
"segments"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L214-L216 |
123,714 | manifoldco/torus-cli | pathexp/pathexp.go | Split | func Split(name, segment string) ([]string, error) {
parts := []string{segment}
if len(segment) == 0 {
return parts, nil // let elsewhere handle the empty single segment
}
if segment[0] == '[' && segment[len(segment)-1] == ']' {
parts = strings.Split(segment[1:len(segment)-1], "|")
// zero length is checked... | go | func Split(name, segment string) ([]string, error) {
parts := []string{segment}
if len(segment) == 0 {
return parts, nil // let elsewhere handle the empty single segment
}
if segment[0] == '[' && segment[len(segment)-1] == ']' {
parts = strings.Split(segment[1:len(segment)-1], "|")
// zero length is checked... | [
"func",
"Split",
"(",
"name",
",",
"segment",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"parts",
":=",
"[",
"]",
"string",
"{",
"segment",
"}",
"\n\n",
"if",
"len",
"(",
"segment",
")",
"==",
"0",
"{",
"return",
"parts",
","... | // Split separates alternation | [
"Split",
"separates",
"alternation"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L435-L451 |
123,715 | manifoldco/torus-cli | pathexp/pathexp.go | Equal | func (pe *PathExp) Equal(other *PathExp) bool {
switch {
case pe.Org != other.Org:
return false
case pe.Project != other.Project:
return false
case !segmentsEqual(pe.Envs, other.Envs):
return false
case !segmentsEqual(pe.Services, other.Services):
return false
case !segmentsEqual(pe.Identities, other.Ide... | go | func (pe *PathExp) Equal(other *PathExp) bool {
switch {
case pe.Org != other.Org:
return false
case pe.Project != other.Project:
return false
case !segmentsEqual(pe.Envs, other.Envs):
return false
case !segmentsEqual(pe.Services, other.Services):
return false
case !segmentsEqual(pe.Identities, other.Ide... | [
"func",
"(",
"pe",
"*",
"PathExp",
")",
"Equal",
"(",
"other",
"*",
"PathExp",
")",
"bool",
"{",
"switch",
"{",
"case",
"pe",
".",
"Org",
"!=",
"other",
".",
"Org",
":",
"return",
"false",
"\n",
"case",
"pe",
".",
"Project",
"!=",
"other",
".",
"... | // Equal returns a bool indicating if the two PathExps are equivalent. | [
"Equal",
"returns",
"a",
"bool",
"indicating",
"if",
"the",
"two",
"PathExps",
"are",
"equivalent",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L497-L515 |
123,716 | manifoldco/torus-cli | pathexp/pathexp.go | Contains | func (pe *PathExp) Contains(other *PathExp) bool {
return pe.Org.Contains(other.Org.String()) &&
pe.Project.Contains(other.Project.String()) &&
pe.Envs.Contains(other.Envs.String()) &&
pe.Services.Contains(other.Services.String()) &&
pe.Identities.Contains(other.Identities.String()) &&
pe.Instances.Contains(... | go | func (pe *PathExp) Contains(other *PathExp) bool {
return pe.Org.Contains(other.Org.String()) &&
pe.Project.Contains(other.Project.String()) &&
pe.Envs.Contains(other.Envs.String()) &&
pe.Services.Contains(other.Services.String()) &&
pe.Identities.Contains(other.Identities.String()) &&
pe.Instances.Contains(... | [
"func",
"(",
"pe",
"*",
"PathExp",
")",
"Contains",
"(",
"other",
"*",
"PathExp",
")",
"bool",
"{",
"return",
"pe",
".",
"Org",
".",
"Contains",
"(",
"other",
".",
"Org",
".",
"String",
"(",
")",
")",
"&&",
"pe",
".",
"Project",
".",
"Contains",
... | // Contains returns whether this path contains the subject. A path Contains
// another if it resolves to the other or they are equal. | [
"Contains",
"returns",
"whether",
"this",
"path",
"contains",
"the",
"subject",
".",
"A",
"path",
"Contains",
"another",
"if",
"it",
"resolves",
"to",
"the",
"other",
"or",
"they",
"are",
"equal",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L548-L555 |
123,717 | manifoldco/torus-cli | pathexp/pathexp.go | UnmarshalText | func (pe *PathExp) UnmarshalText(b []byte) error {
o, err := Parse(string(b))
if err != nil {
return err
}
pe.Org = o.Org
pe.Project = o.Project
pe.Envs = o.Envs
pe.Services = o.Services
pe.Instances = o.Instances
pe.Identities = o.Identities
return nil
} | go | func (pe *PathExp) UnmarshalText(b []byte) error {
o, err := Parse(string(b))
if err != nil {
return err
}
pe.Org = o.Org
pe.Project = o.Project
pe.Envs = o.Envs
pe.Services = o.Services
pe.Instances = o.Instances
pe.Identities = o.Identities
return nil
} | [
"func",
"(",
"pe",
"*",
"PathExp",
")",
"UnmarshalText",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"o",
",",
"err",
":=",
"Parse",
"(",
"string",
"(",
"b",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
... | // UnmarshalText implements the encoding.TextUnmarshaler interface.
// This will be used in json decoding. | [
"UnmarshalText",
"implements",
"the",
"encoding",
".",
"TextUnmarshaler",
"interface",
".",
"This",
"will",
"be",
"used",
"in",
"json",
"decoding",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/pathexp/pathexp.go#L559-L573 |
123,718 | manifoldco/torus-cli | daemon/socket/proxy.go | Listen | func (p *AuthProxy) Listen() error {
mux := bone.New()
proxy := &httputil.ReverseProxy{
Transport: p.t,
Director: func(r *http.Request) {
r.URL.Scheme = p.u.Scheme
r.URL.Host = p.u.Host
r.Host = p.u.Host
r.URL.Path = r.URL.Path[6:]
if p.sess.HasToken() {
tok := string(p.sess.Token())
r.Hea... | go | func (p *AuthProxy) Listen() error {
mux := bone.New()
proxy := &httputil.ReverseProxy{
Transport: p.t,
Director: func(r *http.Request) {
r.URL.Scheme = p.u.Scheme
r.URL.Host = p.u.Host
r.Host = p.u.Host
r.URL.Path = r.URL.Path[6:]
if p.sess.HasToken() {
tok := string(p.sess.Token())
r.Hea... | [
"func",
"(",
"p",
"*",
"AuthProxy",
")",
"Listen",
"(",
")",
"error",
"{",
"mux",
":=",
"bone",
".",
"New",
"(",
")",
"\n",
"proxy",
":=",
"&",
"httputil",
".",
"ReverseProxy",
"{",
"Transport",
":",
"p",
".",
"t",
",",
"Director",
":",
"func",
"... | // Listen starts the main loop of the AuthProxy. It returns on error, or when
// the AuthProxy is closed. | [
"Listen",
"starts",
"the",
"main",
"loop",
"of",
"the",
"AuthProxy",
".",
"It",
"returns",
"on",
"error",
"or",
"when",
"the",
"AuthProxy",
"is",
"closed",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/socket/proxy.go#L78-L107 |
123,719 | manifoldco/torus-cli | daemon/socket/proxy.go | Close | func (p *AuthProxy) Close() error {
p.o.Stop()
return p.s.Stop()
} | go | func (p *AuthProxy) Close() error {
p.o.Stop()
return p.s.Stop()
} | [
"func",
"(",
"p",
"*",
"AuthProxy",
")",
"Close",
"(",
")",
"error",
"{",
"p",
".",
"o",
".",
"Stop",
"(",
")",
"\n",
"return",
"p",
".",
"s",
".",
"Stop",
"(",
")",
"\n",
"}"
] | // Close gracefully closes the socket, ensuring all requests are finished
// within the timeout. | [
"Close",
"gracefully",
"closes",
"the",
"socket",
"ensuring",
"all",
"requests",
"are",
"finished",
"within",
"the",
"timeout",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/socket/proxy.go#L111-L114 |
123,720 | manifoldco/torus-cli | daemon/socket/proxy.go | proxyCanceler | func proxyCanceler(proxy http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx, cancelFunc := context.WithTimeout(context.Background(), 60*time.Second)
defer cancelFunc()
cw := cancelingProxyResponseWriter{
redirect: false,
written: false,
rw: w,
}
r = r... | go | func proxyCanceler(proxy http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx, cancelFunc := context.WithTimeout(context.Background(), 60*time.Second)
defer cancelFunc()
cw := cancelingProxyResponseWriter{
redirect: false,
written: false,
rw: w,
}
r = r... | [
"func",
"proxyCanceler",
"(",
"proxy",
"http",
".",
"Handler",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
",",
"cancelFunc",
":=",
"context",
... | // proxyCanceler supports canceling proxied requests via a timeout, and
// returning a custom error response. | [
"proxyCanceler",
"supports",
"canceling",
"proxied",
"requests",
"via",
"a",
"timeout",
"and",
"returning",
"a",
"custom",
"error",
"response",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/socket/proxy.go#L144-L185 |
123,721 | manifoldco/torus-cli | cmd/credential_set.go | Add | func (c credentialSet) Add(cred apitypes.CredentialEnvelope) error {
if (*cred.Body).GetValue() == nil {
return errors.New("Cannot add an unset credential")
}
name := (*cred.Body).GetName()
if existing, ok := c[name]; ok {
// The new credential is either as specific, or less specific than
// the existing one... | go | func (c credentialSet) Add(cred apitypes.CredentialEnvelope) error {
if (*cred.Body).GetValue() == nil {
return errors.New("Cannot add an unset credential")
}
name := (*cred.Body).GetName()
if existing, ok := c[name]; ok {
// The new credential is either as specific, or less specific than
// the existing one... | [
"func",
"(",
"c",
"credentialSet",
")",
"Add",
"(",
"cred",
"apitypes",
".",
"CredentialEnvelope",
")",
"error",
"{",
"if",
"(",
"*",
"cred",
".",
"Body",
")",
".",
"GetValue",
"(",
")",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
... | // Add adds a credential to the credentialSet, replacing an existing credential
// of the same name, if the new credential is more specific.
//
// If the added credential is an unset value, it is ignored. | [
"Add",
"adds",
"a",
"credential",
"to",
"the",
"credentialSet",
"replacing",
"an",
"existing",
"credential",
"of",
"the",
"same",
"name",
"if",
"the",
"new",
"credential",
"is",
"more",
"specific",
".",
"If",
"the",
"added",
"credential",
"is",
"an",
"unset"... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/cmd/credential_set.go#L22-L39 |
123,722 | manifoldco/torus-cli | cmd/credential_set.go | ToSlice | func (c credentialSet) ToSlice() []apitypes.CredentialEnvelope {
creds := make([]apitypes.CredentialEnvelope, len(c))
i := 0
for _, cred := range c {
creds[i] = *cred
i++
}
sort.Sort(credSorter(creds))
return creds
} | go | func (c credentialSet) ToSlice() []apitypes.CredentialEnvelope {
creds := make([]apitypes.CredentialEnvelope, len(c))
i := 0
for _, cred := range c {
creds[i] = *cred
i++
}
sort.Sort(credSorter(creds))
return creds
} | [
"func",
"(",
"c",
"credentialSet",
")",
"ToSlice",
"(",
")",
"[",
"]",
"apitypes",
".",
"CredentialEnvelope",
"{",
"creds",
":=",
"make",
"(",
"[",
"]",
"apitypes",
".",
"CredentialEnvelope",
",",
"len",
"(",
"c",
")",
")",
"\n",
"i",
":=",
"0",
"\n"... | // ToSlice returns a slice of the credentials in the set, in lexicographically
// sorted order by name. | [
"ToSlice",
"returns",
"a",
"slice",
"of",
"the",
"credentials",
"in",
"the",
"set",
"in",
"lexicographically",
"sorted",
"order",
"by",
"name",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/cmd/credential_set.go#L43-L53 |
123,723 | manifoldco/torus-cli | hints/hints.go | Display | func Display(possible ...Cmd) {
hint := randHint(possible)
if hint != "" {
ui.Hint(hint, false, nil)
}
} | go | func Display(possible ...Cmd) {
hint := randHint(possible)
if hint != "" {
ui.Hint(hint, false, nil)
}
} | [
"func",
"Display",
"(",
"possible",
"...",
"Cmd",
")",
"{",
"hint",
":=",
"randHint",
"(",
"possible",
")",
"\n",
"if",
"hint",
"!=",
"\"",
"\"",
"{",
"ui",
".",
"Hint",
"(",
"hint",
",",
"false",
",",
"nil",
")",
"\n",
"}",
"\n",
"}"
] | // Display chooses a random hint from the allotted commands and displays it | [
"Display",
"chooses",
"a",
"random",
"hint",
"from",
"the",
"allotted",
"commands",
"and",
"displays",
"it"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/hints/hints.go#L137-L142 |
123,724 | manifoldco/torus-cli | hints/hints.go | randHint | func randHint(possible []Cmd) string {
l := len(possible)
if l == 0 {
return ""
}
// Seed random integer
r := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
i := r.Intn(l)
cmd := possible[i]
if hints, ok := commandHints[cmd]; ok {
item := r.Intn(len(hints))
if len(hints) > item {
return hints[i... | go | func randHint(possible []Cmd) string {
l := len(possible)
if l == 0 {
return ""
}
// Seed random integer
r := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
i := r.Intn(l)
cmd := possible[i]
if hints, ok := commandHints[cmd]; ok {
item := r.Intn(len(hints))
if len(hints) > item {
return hints[i... | [
"func",
"randHint",
"(",
"possible",
"[",
"]",
"Cmd",
")",
"string",
"{",
"l",
":=",
"len",
"(",
"possible",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// Seed random integer",
"r",
":=",
"rand",
".",
"New",
"("... | // randHint returns random hint from chosen command's list | [
"randHint",
"returns",
"random",
"hint",
"from",
"chosen",
"command",
"s",
"list"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/hints/hints.go#L145-L162 |
123,725 | manifoldco/torus-cli | api/credentials.go | Search | func (c *CredentialsClient) Search(ctx context.Context, pathexp string, teamIDs []identity.ID, p ProgressFunc) ([]apitypes.CredentialEnvelope, error) {
v := &url.Values{}
v.Set("pathexp", pathexp)
v.Set("skip-decryption", "true")
for _, id := range teamIDs {
v.Add("team_id", id.String())
}
return c.listWorker... | go | func (c *CredentialsClient) Search(ctx context.Context, pathexp string, teamIDs []identity.ID, p ProgressFunc) ([]apitypes.CredentialEnvelope, error) {
v := &url.Values{}
v.Set("pathexp", pathexp)
v.Set("skip-decryption", "true")
for _, id := range teamIDs {
v.Add("team_id", id.String())
}
return c.listWorker... | [
"func",
"(",
"c",
"*",
"CredentialsClient",
")",
"Search",
"(",
"ctx",
"context",
".",
"Context",
",",
"pathexp",
"string",
",",
"teamIDs",
"[",
"]",
"identity",
".",
"ID",
",",
"p",
"ProgressFunc",
")",
"(",
"[",
"]",
"apitypes",
".",
"CredentialEnvelop... | // Search returns all credentials at the given pathexp in an undecrypted state | [
"Search",
"returns",
"all",
"credentials",
"at",
"the",
"given",
"pathexp",
"in",
"an",
"undecrypted",
"state"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/credentials.go#L20-L30 |
123,726 | manifoldco/torus-cli | api/credentials.go | Get | func (c *CredentialsClient) Get(ctx context.Context, path string, p ProgressFunc) ([]apitypes.CredentialEnvelope, error) {
v := &url.Values{}
v.Set("path", path)
return c.listWorker(ctx, v, p)
} | go | func (c *CredentialsClient) Get(ctx context.Context, path string, p ProgressFunc) ([]apitypes.CredentialEnvelope, error) {
v := &url.Values{}
v.Set("path", path)
return c.listWorker(ctx, v, p)
} | [
"func",
"(",
"c",
"*",
"CredentialsClient",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
",",
"p",
"ProgressFunc",
")",
"(",
"[",
"]",
"apitypes",
".",
"CredentialEnvelope",
",",
"error",
")",
"{",
"v",
":=",
"&",
"url",
... | // Get returns all credentials at the given path. | [
"Get",
"returns",
"all",
"credentials",
"at",
"the",
"given",
"path",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/credentials.go#L33-L38 |
123,727 | manifoldco/torus-cli | api/credentials.go | Create | func (c *CredentialsClient) Create(ctx context.Context, creds []*apitypes.CredentialEnvelope,
progress ProgressFunc) ([]apitypes.CredentialEnvelope, error) {
resp := []apitypes.CredentialResp{}
err := c.client.DaemonRoundTrip(ctx, "POST", "/credentials", nil, creds, &resp, progress)
if err != nil {
return nil, e... | go | func (c *CredentialsClient) Create(ctx context.Context, creds []*apitypes.CredentialEnvelope,
progress ProgressFunc) ([]apitypes.CredentialEnvelope, error) {
resp := []apitypes.CredentialResp{}
err := c.client.DaemonRoundTrip(ctx, "POST", "/credentials", nil, creds, &resp, progress)
if err != nil {
return nil, e... | [
"func",
"(",
"c",
"*",
"CredentialsClient",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"creds",
"[",
"]",
"*",
"apitypes",
".",
"CredentialEnvelope",
",",
"progress",
"ProgressFunc",
")",
"(",
"[",
"]",
"apitypes",
".",
"CredentialEnvelope",
... | // Create creates the given credential | [
"Create",
"creates",
"the",
"given",
"credential"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/credentials.go#L51-L61 |
123,728 | manifoldco/torus-cli | identity/identity.go | NewMutable | func NewMutable(body Mutable) (ID, error) {
id := ID{idVersion, body.Type()}
_, err := rand.Read(id[2:])
if err != nil {
return ID{}, err
}
return id, nil
} | go | func NewMutable(body Mutable) (ID, error) {
id := ID{idVersion, body.Type()}
_, err := rand.Read(id[2:])
if err != nil {
return ID{}, err
}
return id, nil
} | [
"func",
"NewMutable",
"(",
"body",
"Mutable",
")",
"(",
"ID",
",",
"error",
")",
"{",
"id",
":=",
"ID",
"{",
"idVersion",
",",
"body",
".",
"Type",
"(",
")",
"}",
"\n",
"_",
",",
"err",
":=",
"rand",
".",
"Read",
"(",
"id",
"[",
"2",
":",
"]"... | // NewMutable returns a new ID for a mutable object. | [
"NewMutable",
"returns",
"a",
"new",
"ID",
"for",
"a",
"mutable",
"object",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/identity/identity.go#L49-L56 |
123,729 | manifoldco/torus-cli | identity/identity.go | DeriveMutable | func DeriveMutable(body Mutable, base *ID, derivableType byte) ID {
id := ID{idVersion, body.Type(), derivableType}
copy(id[3:], base[2:17])
return id
} | go | func DeriveMutable(body Mutable, base *ID, derivableType byte) ID {
id := ID{idVersion, body.Type(), derivableType}
copy(id[3:], base[2:17])
return id
} | [
"func",
"DeriveMutable",
"(",
"body",
"Mutable",
",",
"base",
"*",
"ID",
",",
"derivableType",
"byte",
")",
"ID",
"{",
"id",
":=",
"ID",
"{",
"idVersion",
",",
"body",
".",
"Type",
"(",
")",
",",
"derivableType",
"}",
"\n",
"copy",
"(",
"id",
"[",
... | // DeriveMutable returns a ID for a mutable object based on another ID. | [
"DeriveMutable",
"returns",
"a",
"ID",
"for",
"a",
"mutable",
"object",
"based",
"on",
"another",
"ID",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/identity/identity.go#L59-L64 |
123,730 | manifoldco/torus-cli | identity/identity.go | NewImmutable | func NewImmutable(body Immutable, sig interface{}) (ID, error) {
h, err := blake2b.New(&blake2b.Config{Size: 16})
if err != nil {
return ID{}, err
}
h.Write([]byte(strconv.Itoa(body.Version())))
b, err := json.Marshal(body)
if err != nil {
return ID{}, err
}
h.Write(b)
b, err = json.Marshal(sig)
if err... | go | func NewImmutable(body Immutable, sig interface{}) (ID, error) {
h, err := blake2b.New(&blake2b.Config{Size: 16})
if err != nil {
return ID{}, err
}
h.Write([]byte(strconv.Itoa(body.Version())))
b, err := json.Marshal(body)
if err != nil {
return ID{}, err
}
h.Write(b)
b, err = json.Marshal(sig)
if err... | [
"func",
"NewImmutable",
"(",
"body",
"Immutable",
",",
"sig",
"interface",
"{",
"}",
")",
"(",
"ID",
",",
"error",
")",
"{",
"h",
",",
"err",
":=",
"blake2b",
".",
"New",
"(",
"&",
"blake2b",
".",
"Config",
"{",
"Size",
":",
"16",
"}",
")",
"\n",... | // NewImmutable returns a new signed ID for an immutable object.
//
// sig should be a registry.Signature type | [
"NewImmutable",
"returns",
"a",
"new",
"signed",
"ID",
"for",
"an",
"immutable",
"object",
".",
"sig",
"should",
"be",
"a",
"registry",
".",
"Signature",
"type"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/identity/identity.go#L69-L94 |
123,731 | manifoldco/torus-cli | identity/identity.go | UnmarshalJSON | func (id *ID) UnmarshalJSON(b []byte) error {
if len(b) < 2 || b[0] != byte('"') || b[len(b)-1] != byte('"') {
return errors.New("value is not a string")
}
return id.fillID(b[1 : len(b)-1])
} | go | func (id *ID) UnmarshalJSON(b []byte) error {
if len(b) < 2 || b[0] != byte('"') || b[len(b)-1] != byte('"') {
return errors.New("value is not a string")
}
return id.fillID(b[1 : len(b)-1])
} | [
"func",
"(",
"id",
"*",
"ID",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"len",
"(",
"b",
")",
"<",
"2",
"||",
"b",
"[",
"0",
"]",
"!=",
"byte",
"(",
"'\"'",
")",
"||",
"b",
"[",
"len",
"(",
"b",
")",
"-",
... | // UnmarshalJSON implements the json.Unmarshaler interface for IDs. | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface",
"for",
"IDs",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/identity/identity.go#L125-L131 |
123,732 | manifoldco/torus-cli | gatekeeper/gatekeeper.go | New | func New(org, team, certpath, keypath string, cfg *config.Config) (g *http.Gatekeeper, err error) {
api := api.NewClient(cfg)
http, err := http.NewGatekeeper(org, team, certpath, keypath, cfg, api)
if err != nil {
return nil, err
}
return http, nil
} | go | func New(org, team, certpath, keypath string, cfg *config.Config) (g *http.Gatekeeper, err error) {
api := api.NewClient(cfg)
http, err := http.NewGatekeeper(org, team, certpath, keypath, cfg, api)
if err != nil {
return nil, err
}
return http, nil
} | [
"func",
"New",
"(",
"org",
",",
"team",
",",
"certpath",
",",
"keypath",
"string",
",",
"cfg",
"*",
"config",
".",
"Config",
")",
"(",
"g",
"*",
"http",
".",
"Gatekeeper",
",",
"err",
"error",
")",
"{",
"api",
":=",
"api",
".",
"NewClient",
"(",
... | // New returns a new Gatekeeper | [
"New",
"returns",
"a",
"new",
"Gatekeeper"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/gatekeeper/gatekeeper.go#L12-L20 |
123,733 | manifoldco/torus-cli | registry/policies.go | Create | func (p *PoliciesClient) Create(ctx context.Context, policy *primitive.Policy) (*envelope.Policy, error) {
ID, err := identity.NewMutable(policy)
if err != nil {
return nil, err
}
env := envelope.Policy{
ID: &ID,
Version: 1,
Body: policy,
}
res := envelope.Policy{}
err = p.client.RoundTrip(ctx... | go | func (p *PoliciesClient) Create(ctx context.Context, policy *primitive.Policy) (*envelope.Policy, error) {
ID, err := identity.NewMutable(policy)
if err != nil {
return nil, err
}
env := envelope.Policy{
ID: &ID,
Version: 1,
Body: policy,
}
res := envelope.Policy{}
err = p.client.RoundTrip(ctx... | [
"func",
"(",
"p",
"*",
"PoliciesClient",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"policy",
"*",
"primitive",
".",
"Policy",
")",
"(",
"*",
"envelope",
".",
"Policy",
",",
"error",
")",
"{",
"ID",
",",
"err",
":=",
"identity",
".",
... | // Create creates a new policy | [
"Create",
"creates",
"a",
"new",
"policy"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/policies.go#L18-L34 |
123,734 | manifoldco/torus-cli | registry/policies.go | Delete | func (p *PoliciesClient) Delete(ctx context.Context, policyID *identity.ID) error {
url := "/policies/" + policyID.String()
return p.client.RoundTrip(ctx, "DELETE", url, nil, nil, nil)
} | go | func (p *PoliciesClient) Delete(ctx context.Context, policyID *identity.ID) error {
url := "/policies/" + policyID.String()
return p.client.RoundTrip(ctx, "DELETE", url, nil, nil, nil)
} | [
"func",
"(",
"p",
"*",
"PoliciesClient",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"policyID",
"*",
"identity",
".",
"ID",
")",
"error",
"{",
"url",
":=",
"\"",
"\"",
"+",
"policyID",
".",
"String",
"(",
")",
"\n",
"return",
"p",
"... | // Delete destroys the policy for the given ID | [
"Delete",
"destroys",
"the",
"policy",
"for",
"the",
"given",
"ID"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/policies.go#L37-L40 |
123,735 | manifoldco/torus-cli | registry/policies.go | Attach | func (p *PoliciesClient) Attach(ctx context.Context, org, policy, team *identity.ID) error {
attachment := primitive.PolicyAttachment{
OrgID: org,
OwnerID: team,
PolicyID: policy,
}
ID, err := identity.NewMutable(&attachment)
if err != nil {
return err
}
env := envelope.PolicyAttachment{
ID: ... | go | func (p *PoliciesClient) Attach(ctx context.Context, org, policy, team *identity.ID) error {
attachment := primitive.PolicyAttachment{
OrgID: org,
OwnerID: team,
PolicyID: policy,
}
ID, err := identity.NewMutable(&attachment)
if err != nil {
return err
}
env := envelope.PolicyAttachment{
ID: ... | [
"func",
"(",
"p",
"*",
"PoliciesClient",
")",
"Attach",
"(",
"ctx",
"context",
".",
"Context",
",",
"org",
",",
"policy",
",",
"team",
"*",
"identity",
".",
"ID",
")",
"error",
"{",
"attachment",
":=",
"primitive",
".",
"PolicyAttachment",
"{",
"OrgID",
... | // Attach attaches a policy to a team | [
"Attach",
"attaches",
"a",
"policy",
"to",
"a",
"team"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/policies.go#L58-L77 |
123,736 | manifoldco/torus-cli | registry/policies.go | Detach | func (p *PoliciesClient) Detach(ctx context.Context, attachmentID *identity.ID) error {
return p.client.RoundTrip(ctx, "DELETE", "/policy-attachments/"+attachmentID.String(), nil, nil, nil)
} | go | func (p *PoliciesClient) Detach(ctx context.Context, attachmentID *identity.ID) error {
return p.client.RoundTrip(ctx, "DELETE", "/policy-attachments/"+attachmentID.String(), nil, nil, nil)
} | [
"func",
"(",
"p",
"*",
"PoliciesClient",
")",
"Detach",
"(",
"ctx",
"context",
".",
"Context",
",",
"attachmentID",
"*",
"identity",
".",
"ID",
")",
"error",
"{",
"return",
"p",
".",
"client",
".",
"RoundTrip",
"(",
"ctx",
",",
"\"",
"\"",
",",
"\"",... | // Detach deletes a specific attachment | [
"Detach",
"deletes",
"a",
"specific",
"attachment"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/policies.go#L80-L82 |
123,737 | manifoldco/torus-cli | registry/policies.go | AttachmentsList | func (p *PoliciesClient) AttachmentsList(ctx context.Context, orgID, ownerID, policyID *identity.ID) ([]envelope.PolicyAttachment, error) {
v := &url.Values{}
if orgID != nil {
v.Set("org_id", orgID.String())
}
if ownerID != nil {
v.Set("owner_id", ownerID.String())
}
if policyID != nil {
v.Set("policy_id",... | go | func (p *PoliciesClient) AttachmentsList(ctx context.Context, orgID, ownerID, policyID *identity.ID) ([]envelope.PolicyAttachment, error) {
v := &url.Values{}
if orgID != nil {
v.Set("org_id", orgID.String())
}
if ownerID != nil {
v.Set("owner_id", ownerID.String())
}
if policyID != nil {
v.Set("policy_id",... | [
"func",
"(",
"p",
"*",
"PoliciesClient",
")",
"AttachmentsList",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
",",
"ownerID",
",",
"policyID",
"*",
"identity",
".",
"ID",
")",
"(",
"[",
"]",
"envelope",
".",
"PolicyAttachment",
",",
"error",
")",... | // AttachmentsList retrieves all policy attachments for an org | [
"AttachmentsList",
"retrieves",
"all",
"policy",
"attachments",
"for",
"an",
"org"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/policies.go#L85-L100 |
123,738 | manifoldco/torus-cli | cmd/allow.go | parseRawPath | func parseRawPath(rawPath string) (*pathexp.PathExp, *string, error) {
idx := strings.LastIndex(rawPath, "/")
if idx == -1 {
return nil, nil, errs.NewExitError("resource path format is incorrect.")
}
secret := rawPath[idx+1:]
path := rawPath[:idx]
if secret == "**" {
path = rawPath
secret = "*"
}
// Ens... | go | func parseRawPath(rawPath string) (*pathexp.PathExp, *string, error) {
idx := strings.LastIndex(rawPath, "/")
if idx == -1 {
return nil, nil, errs.NewExitError("resource path format is incorrect.")
}
secret := rawPath[idx+1:]
path := rawPath[:idx]
if secret == "**" {
path = rawPath
secret = "*"
}
// Ens... | [
"func",
"parseRawPath",
"(",
"rawPath",
"string",
")",
"(",
"*",
"pathexp",
".",
"PathExp",
",",
"*",
"string",
",",
"error",
")",
"{",
"idx",
":=",
"strings",
".",
"LastIndex",
"(",
"rawPath",
",",
"\"",
"\"",
")",
"\n",
"if",
"idx",
"==",
"-",
"1... | // parseRawPath parses and validates a raw path, possibly including a secret.
// The secret portion is also validated. | [
"parseRawPath",
"parses",
"and",
"validates",
"a",
"raw",
"path",
"possibly",
"including",
"a",
"secret",
".",
"The",
"secret",
"portion",
"is",
"also",
"validated",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/cmd/allow.go#L166-L189 |
123,739 | manifoldco/torus-cli | api/keypairs.go | Revoke | func (k *KeyPairsClient) Revoke(ctx context.Context, orgID *identity.ID, output ProgressFunc) error {
return k.worker(ctx, "revoke", orgID, output)
} | go | func (k *KeyPairsClient) Revoke(ctx context.Context, orgID *identity.ID, output ProgressFunc) error {
return k.worker(ctx, "revoke", orgID, output)
} | [
"func",
"(",
"k",
"*",
"KeyPairsClient",
")",
"Revoke",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
",",
"output",
"ProgressFunc",
")",
"error",
"{",
"return",
"k",
".",
"worker",
"(",
"ctx",
",",
"\"",
"\"",
",",... | // Revoke revokes the existing keypairs for the user in the given org. | [
"Revoke",
"revokes",
"the",
"existing",
"keypairs",
"for",
"the",
"user",
"in",
"the",
"given",
"org",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/keypairs.go#L31-L33 |
123,740 | manifoldco/torus-cli | registry/tokens.go | PostLogin | func (t *TokensClient) PostLogin(ctx context.Context, creds apitypes.LoginCredential) (
*base64.Value, *envelope.Token, error) {
respBody := loginTokenResponse{}
var body interface{}
switch creds.Type() {
case apitypes.UserSession:
body = &loginTokenUserRequest{
Type: primitive.LoginToken,
Email: creds.I... | go | func (t *TokensClient) PostLogin(ctx context.Context, creds apitypes.LoginCredential) (
*base64.Value, *envelope.Token, error) {
respBody := loginTokenResponse{}
var body interface{}
switch creds.Type() {
case apitypes.UserSession:
body = &loginTokenUserRequest{
Type: primitive.LoginToken,
Email: creds.I... | [
"func",
"(",
"t",
"*",
"TokensClient",
")",
"PostLogin",
"(",
"ctx",
"context",
".",
"Context",
",",
"creds",
"apitypes",
".",
"LoginCredential",
")",
"(",
"*",
"base64",
".",
"Value",
",",
"*",
"envelope",
".",
"Token",
",",
"error",
")",
"{",
"respBo... | // PostLogin requests a login token from the registry for the provided email
// address. | [
"PostLogin",
"requests",
"a",
"login",
"token",
"from",
"the",
"registry",
"for",
"the",
"provided",
"email",
"address",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/tokens.go#L56-L80 |
123,741 | manifoldco/torus-cli | registry/tokens.go | PostEdDSAAuth | func (t *TokensClient) PostEdDSAAuth(ctx context.Context, token string,
sig *base64.Value) (*envelope.Token, error) {
authReq := authTokenEdDSARequest{Type: primitive.AuthToken, TokenSig: sig}
return t.postAuthWorker(ctx, token, &authReq)
} | go | func (t *TokensClient) PostEdDSAAuth(ctx context.Context, token string,
sig *base64.Value) (*envelope.Token, error) {
authReq := authTokenEdDSARequest{Type: primitive.AuthToken, TokenSig: sig}
return t.postAuthWorker(ctx, token, &authReq)
} | [
"func",
"(",
"t",
"*",
"TokensClient",
")",
"PostEdDSAAuth",
"(",
"ctx",
"context",
".",
"Context",
",",
"token",
"string",
",",
"sig",
"*",
"base64",
".",
"Value",
")",
"(",
"*",
"envelope",
".",
"Token",
",",
"error",
")",
"{",
"authReq",
":=",
"au... | // PostEdDSAAuth requests an auth token from the registry for the provided login
// token value, and it's signature. | [
"PostEdDSAAuth",
"requests",
"an",
"auth",
"token",
"from",
"the",
"registry",
"for",
"the",
"provided",
"login",
"token",
"value",
"and",
"it",
"s",
"signature",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/tokens.go#L84-L88 |
123,742 | manifoldco/torus-cli | registry/tokens.go | PostUpgradeEdDSAAuth | func (t *TokensClient) PostUpgradeEdDSAAuth(ctx context.Context, token, hmac string,
sig, publicKey *base64.Value) (*envelope.Token, error) {
authReq := authTokenUpgradeEdDSARequest{
Type: primitive.AuthToken,
TokenSig: sig,
PublicKey: publicKey,
TokenHMAC: hmac,
}
return t.postAuthWorker(ctx, token,... | go | func (t *TokensClient) PostUpgradeEdDSAAuth(ctx context.Context, token, hmac string,
sig, publicKey *base64.Value) (*envelope.Token, error) {
authReq := authTokenUpgradeEdDSARequest{
Type: primitive.AuthToken,
TokenSig: sig,
PublicKey: publicKey,
TokenHMAC: hmac,
}
return t.postAuthWorker(ctx, token,... | [
"func",
"(",
"t",
"*",
"TokensClient",
")",
"PostUpgradeEdDSAAuth",
"(",
"ctx",
"context",
".",
"Context",
",",
"token",
",",
"hmac",
"string",
",",
"sig",
",",
"publicKey",
"*",
"base64",
".",
"Value",
")",
"(",
"*",
"envelope",
".",
"Token",
",",
"er... | // PostUpgradeEdDSAAuth requests an auth token from the registry while
// upgrading the user from HMAC based authentication to EdDSA | [
"PostUpgradeEdDSAAuth",
"requests",
"an",
"auth",
"token",
"from",
"the",
"registry",
"while",
"upgrading",
"the",
"user",
"from",
"HMAC",
"based",
"authentication",
"to",
"EdDSA"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/tokens.go#L92-L102 |
123,743 | manifoldco/torus-cli | registry/tokens.go | Delete | func (t *TokensClient) Delete(ctx context.Context, token string) error {
return tokenRoundTrip(ctx, t.client, token, "DELETE", "/tokens/"+token, nil, nil, nil)
} | go | func (t *TokensClient) Delete(ctx context.Context, token string) error {
return tokenRoundTrip(ctx, t.client, token, "DELETE", "/tokens/"+token, nil, nil, nil)
} | [
"func",
"(",
"t",
"*",
"TokensClient",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"token",
"string",
")",
"error",
"{",
"return",
"tokenRoundTrip",
"(",
"ctx",
",",
"t",
".",
"client",
",",
"token",
",",
"\"",
"\"",
",",
"\"",
"\"",
... | // Delete deletes the token with the provided value from the registry. This
// effectively logs a user out. | [
"Delete",
"deletes",
"the",
"token",
"with",
"the",
"provided",
"value",
"from",
"the",
"registry",
".",
"This",
"effectively",
"logs",
"a",
"user",
"out",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/tokens.go#L117-L119 |
123,744 | manifoldco/torus-cli | daemon/db/db.go | NewDB | func NewDB(path string) (*DB, error) {
db := &DB{}
valid, err := db.initBolt(path)
if valid && err == nil {
return db, nil
}
if !valid {
log.Print("DB schema version is incorrect. Clearing db")
}
err = os.Remove(path)
if err != nil {
return nil, fmt.Errorf("Unable to remove db! Please manually remove %... | go | func NewDB(path string) (*DB, error) {
db := &DB{}
valid, err := db.initBolt(path)
if valid && err == nil {
return db, nil
}
if !valid {
log.Print("DB schema version is incorrect. Clearing db")
}
err = os.Remove(path)
if err != nil {
return nil, fmt.Errorf("Unable to remove db! Please manually remove %... | [
"func",
"NewDB",
"(",
"path",
"string",
")",
"(",
"*",
"DB",
",",
"error",
")",
"{",
"db",
":=",
"&",
"DB",
"{",
"}",
"\n\n",
"valid",
",",
"err",
":=",
"db",
".",
"initBolt",
"(",
"path",
")",
"\n",
"if",
"valid",
"&&",
"err",
"==",
"nil",
"... | // NewDB creates a new db or opens an existing db at the given path.
// If the db already exists but has a mismatched version, it will be cleared
// before being returned. | [
"NewDB",
"creates",
"a",
"new",
"db",
"or",
"opens",
"an",
"existing",
"db",
"at",
"the",
"given",
"path",
".",
"If",
"the",
"db",
"already",
"exists",
"but",
"has",
"a",
"mismatched",
"version",
"it",
"will",
"be",
"cleared",
"before",
"being",
"returne... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/db/db.go#L29-L57 |
123,745 | manifoldco/torus-cli | daemon/db/db.go | initBolt | func (db *DB) initBolt(path string) (bool, error) {
var err error
db.db, err = bolt.Open(path, 0600, nil)
if err != nil {
return false, err
}
return db.checkMeta()
} | go | func (db *DB) initBolt(path string) (bool, error) {
var err error
db.db, err = bolt.Open(path, 0600, nil)
if err != nil {
return false, err
}
return db.checkMeta()
} | [
"func",
"(",
"db",
"*",
"DB",
")",
"initBolt",
"(",
"path",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"db",
".",
"db",
",",
"err",
"=",
"bolt",
".",
"Open",
"(",
"path",
",",
"0600",
",",
"nil",
")",
"\n... | // initBolt initializes the backing bolt db, checking that the metadata schema
// version matches what we expect | [
"initBolt",
"initializes",
"the",
"backing",
"bolt",
"db",
"checking",
"that",
"the",
"metadata",
"schema",
"version",
"matches",
"what",
"we",
"expect"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/db/db.go#L66-L74 |
123,746 | manifoldco/torus-cli | daemon/db/db.go | checkMeta | func (db *DB) checkMeta() (bool, error) {
var version []byte
err := db.db.Update(func(tx *bolt.Tx) error {
meta, err := tx.CreateBucketIfNotExists([]byte("meta"))
if err != nil {
return err
}
version = meta.Get([]byte("version"))
if version != nil {
return nil
}
err = meta.Put([]byte("version"),... | go | func (db *DB) checkMeta() (bool, error) {
var version []byte
err := db.db.Update(func(tx *bolt.Tx) error {
meta, err := tx.CreateBucketIfNotExists([]byte("meta"))
if err != nil {
return err
}
version = meta.Get([]byte("version"))
if version != nil {
return nil
}
err = meta.Put([]byte("version"),... | [
"func",
"(",
"db",
"*",
"DB",
")",
"checkMeta",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"version",
"[",
"]",
"byte",
"\n",
"err",
":=",
"db",
".",
"db",
".",
"Update",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error"... | // checkMeta check's the db's metadata, ensuring the version of the db is
// correct, or setting it if it does not exist. | [
"checkMeta",
"check",
"s",
"the",
"db",
"s",
"metadata",
"ensuring",
"the",
"version",
"of",
"the",
"db",
"is",
"correct",
"or",
"setting",
"it",
"if",
"it",
"does",
"not",
"exist",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/db/db.go#L78-L100 |
123,747 | manifoldco/torus-cli | daemon/db/db.go | Set | func (db *DB) Set(envs ...envelope.Envelope) error {
return db.db.Update(func(tx *bolt.Tx) error {
for _, env := range envs {
id := env.GetID()
b, err := json.Marshal(env)
if err != nil {
return err
}
bucket, err := tx.CreateBucketIfNotExists([]byte{id.Type()})
if err != nil {
return err
... | go | func (db *DB) Set(envs ...envelope.Envelope) error {
return db.db.Update(func(tx *bolt.Tx) error {
for _, env := range envs {
id := env.GetID()
b, err := json.Marshal(env)
if err != nil {
return err
}
bucket, err := tx.CreateBucketIfNotExists([]byte{id.Type()})
if err != nil {
return err
... | [
"func",
"(",
"db",
"*",
"DB",
")",
"Set",
"(",
"envs",
"...",
"envelope",
".",
"Envelope",
")",
"error",
"{",
"return",
"db",
".",
"db",
".",
"Update",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"for",
"_",
",",
"env",
... | // Set stores the serialized value of env into the db, under key id.
// Stored values are grouped by their type. | [
"Set",
"stores",
"the",
"serialized",
"value",
"of",
"env",
"into",
"the",
"db",
"under",
"key",
"id",
".",
"Stored",
"values",
"are",
"grouped",
"by",
"their",
"type",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/db/db.go#L104-L126 |
123,748 | manifoldco/torus-cli | daemon/db/db.go | Get | func (db *DB) Get(id *identity.ID, env envelope.Envelope) error {
return db.db.View(func(tx *bolt.Tx) error {
bucket := tx.Bucket([]byte{id.Type()})
if bucket == nil {
return errors.New("ID not found")
}
b := bucket.Get(id[:])
if b == nil {
return errors.New("ID not found")
}
return json.Unmarsha... | go | func (db *DB) Get(id *identity.ID, env envelope.Envelope) error {
return db.db.View(func(tx *bolt.Tx) error {
bucket := tx.Bucket([]byte{id.Type()})
if bucket == nil {
return errors.New("ID not found")
}
b := bucket.Get(id[:])
if b == nil {
return errors.New("ID not found")
}
return json.Unmarsha... | [
"func",
"(",
"db",
"*",
"DB",
")",
"Get",
"(",
"id",
"*",
"identity",
".",
"ID",
",",
"env",
"envelope",
".",
"Envelope",
")",
"error",
"{",
"return",
"db",
".",
"db",
".",
"View",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
... | // Get returns the value of id in env. It returns an error if id does not exist. | [
"Get",
"returns",
"the",
"value",
"of",
"id",
"in",
"env",
".",
"It",
"returns",
"an",
"error",
"if",
"id",
"does",
"not",
"exist",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/db/db.go#L129-L143 |
123,749 | manifoldco/torus-cli | primitive/primitive.go | NewClaim | func NewClaim(orgID, ownerID, previous, pubKeyID *identity.ID, claimType ClaimType) *Claim {
return &Claim{
OrgID: orgID,
OwnerID: ownerID,
Previous: previous,
PublicKeyID: pubKeyID,
ClaimType: claimType,
Created: time.Now().UTC(),
}
} | go | func NewClaim(orgID, ownerID, previous, pubKeyID *identity.ID, claimType ClaimType) *Claim {
return &Claim{
OrgID: orgID,
OwnerID: ownerID,
Previous: previous,
PublicKeyID: pubKeyID,
ClaimType: claimType,
Created: time.Now().UTC(),
}
} | [
"func",
"NewClaim",
"(",
"orgID",
",",
"ownerID",
",",
"previous",
",",
"pubKeyID",
"*",
"identity",
".",
"ID",
",",
"claimType",
"ClaimType",
")",
"*",
"Claim",
"{",
"return",
"&",
"Claim",
"{",
"OrgID",
":",
"orgID",
",",
"OwnerID",
":",
"ownerID",
"... | // NewClaim returns a new Claim, with the created time set to now | [
"NewClaim",
"returns",
"a",
"new",
"Claim",
"with",
"the",
"created",
"time",
"set",
"to",
"now"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/primitive/primitive.go#L195-L204 |
123,750 | manifoldco/torus-cli | primitive/primitive.go | NewKeyring | func NewKeyring(orgID, projectID *identity.ID, pathExp *pathexp.PathExp) *Keyring {
return &Keyring{
BaseKeyring: BaseKeyring{
Created: time.Now().UTC(),
OrgID: orgID,
PathExp: pathExp,
ProjectID: projectID,
// This is the first instance of the keyring, so version is 1,
// and there is no ... | go | func NewKeyring(orgID, projectID *identity.ID, pathExp *pathexp.PathExp) *Keyring {
return &Keyring{
BaseKeyring: BaseKeyring{
Created: time.Now().UTC(),
OrgID: orgID,
PathExp: pathExp,
ProjectID: projectID,
// This is the first instance of the keyring, so version is 1,
// and there is no ... | [
"func",
"NewKeyring",
"(",
"orgID",
",",
"projectID",
"*",
"identity",
".",
"ID",
",",
"pathExp",
"*",
"pathexp",
".",
"PathExp",
")",
"*",
"Keyring",
"{",
"return",
"&",
"Keyring",
"{",
"BaseKeyring",
":",
"BaseKeyring",
"{",
"Created",
":",
"time",
"."... | // NewKeyring returns a new v2 Keyring, with the created time set to now | [
"NewKeyring",
"returns",
"a",
"new",
"v2",
"Keyring",
"with",
"the",
"created",
"time",
"set",
"to",
"now"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/primitive/primitive.go#L272-L286 |
123,751 | manifoldco/torus-cli | primitive/primitive.go | MarshalText | func (pe *PolicyEffect) MarshalText() ([]byte, error) {
if *pe {
return []byte("allow"), nil
}
return []byte("deny"), nil
} | go | func (pe *PolicyEffect) MarshalText() ([]byte, error) {
if *pe {
return []byte("allow"), nil
}
return []byte("deny"), nil
} | [
"func",
"(",
"pe",
"*",
"PolicyEffect",
")",
"MarshalText",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"*",
"pe",
"{",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"[",
"]",
"byt... | // MarshalText implements the encoding.TextMarshaler interface, used for JSON
// marshaling. | [
"MarshalText",
"implements",
"the",
"encoding",
".",
"TextMarshaler",
"interface",
"used",
"for",
"JSON",
"marshaling",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/primitive/primitive.go#L587-L592 |
123,752 | manifoldco/torus-cli | primitive/primitive.go | MarshalJSON | func (pa *PolicyAction) MarshalJSON() ([]byte, error) {
out := []string{}
for i, v := range policyActionStrings {
if (1<<uint(i))&byte(*pa) > 0 {
out = append(out, v)
}
}
if len(out) == 1 {
return json.Marshal(out[0])
}
return json.Marshal(out)
} | go | func (pa *PolicyAction) MarshalJSON() ([]byte, error) {
out := []string{}
for i, v := range policyActionStrings {
if (1<<uint(i))&byte(*pa) > 0 {
out = append(out, v)
}
}
if len(out) == 1 {
return json.Marshal(out[0])
}
return json.Marshal(out)
} | [
"func",
"(",
"pa",
"*",
"PolicyAction",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"out",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"i",
",",
"v",
":=",
"range",
"policyActionStrings",
"{",
"if",
"(",
"1... | // MarshalJSON implements the json.Marshaler interface. A PolicyAction is
// encoded in JSON either the string representations of its actions in a list,
// or a single string when there is only one action. | [
"MarshalJSON",
"implements",
"the",
"json",
".",
"Marshaler",
"interface",
".",
"A",
"PolicyAction",
"is",
"encoded",
"in",
"JSON",
"either",
"the",
"string",
"representations",
"of",
"its",
"actions",
"in",
"a",
"list",
"or",
"a",
"single",
"string",
"when",
... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/primitive/primitive.go#L630-L644 |
123,753 | manifoldco/torus-cli | primitive/primitive.go | ShortString | func (pa *PolicyAction) ShortString() string {
out := []byte{}
for i, v := range policyActionStrings {
if (1<<uint(i))&byte(*pa) > 0 {
out = append(out, v[0])
} else {
out = append(out, '-')
}
}
return string(out)
} | go | func (pa *PolicyAction) ShortString() string {
out := []byte{}
for i, v := range policyActionStrings {
if (1<<uint(i))&byte(*pa) > 0 {
out = append(out, v[0])
} else {
out = append(out, '-')
}
}
return string(out)
} | [
"func",
"(",
"pa",
"*",
"PolicyAction",
")",
"ShortString",
"(",
")",
"string",
"{",
"out",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n\n",
"for",
"i",
",",
"v",
":=",
"range",
"policyActionStrings",
"{",
"if",
"(",
"1",
"<<",
"uint",
"(",
"i",
")",
")... | // ShortString displays a single character representation of each of the
// policy's actions. | [
"ShortString",
"displays",
"a",
"single",
"character",
"representation",
"of",
"each",
"of",
"the",
"policy",
"s",
"actions",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/primitive/primitive.go#L687-L699 |
123,754 | manifoldco/torus-cli | api/org_invites.go | Approve | func (i *OrgInvitesClient) Approve(ctx context.Context, inviteID identity.ID, output ProgressFunc) error {
return i.client.DaemonRoundTrip(ctx, "POST", "/org-invites/"+inviteID.String()+"/approve", nil, nil, nil, output)
} | go | func (i *OrgInvitesClient) Approve(ctx context.Context, inviteID identity.ID, output ProgressFunc) error {
return i.client.DaemonRoundTrip(ctx, "POST", "/org-invites/"+inviteID.String()+"/approve", nil, nil, nil, output)
} | [
"func",
"(",
"i",
"*",
"OrgInvitesClient",
")",
"Approve",
"(",
"ctx",
"context",
".",
"Context",
",",
"inviteID",
"identity",
".",
"ID",
",",
"output",
"ProgressFunc",
")",
"error",
"{",
"return",
"i",
".",
"client",
".",
"DaemonRoundTrip",
"(",
"ctx",
... | // Approve executes the approve invite request | [
"Approve",
"executes",
"the",
"approve",
"invite",
"request"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/org_invites.go#L22-L24 |
123,755 | manifoldco/torus-cli | daemon/logic/worklog.go | List | func (w *Worklog) List(ctx context.Context, orgID *identity.ID,
itemType apitypes.WorklogType) ([]apitypes.WorklogItem, error) {
org, err := w.engine.client.Orgs.Get(ctx, orgID)
if err != nil {
return nil, err
}
var items []apitypes.WorklogItem
for t, h := range w.handlers {
if t&itemType == 0 {
continue... | go | func (w *Worklog) List(ctx context.Context, orgID *identity.ID,
itemType apitypes.WorklogType) ([]apitypes.WorklogItem, error) {
org, err := w.engine.client.Orgs.Get(ctx, orgID)
if err != nil {
return nil, err
}
var items []apitypes.WorklogItem
for t, h := range w.handlers {
if t&itemType == 0 {
continue... | [
"func",
"(",
"w",
"*",
"Worklog",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
",",
"itemType",
"apitypes",
".",
"WorklogType",
")",
"(",
"[",
"]",
"apitypes",
".",
"WorklogItem",
",",
"error",
")",
"{... | // List returns the list of all outstanding worklog items for the given org | [
"List",
"returns",
"the",
"list",
"of",
"all",
"outstanding",
"worklog",
"items",
"for",
"the",
"given",
"org"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/logic/worklog.go#L60-L82 |
123,756 | manifoldco/torus-cli | daemon/logic/worklog.go | Get | func (w *Worklog) Get(ctx context.Context, orgID *identity.ID,
ident *apitypes.WorklogID) (*apitypes.WorklogItem, error) {
items, err := w.List(ctx, orgID, ident.Type())
if err != nil {
return nil, err
}
for _, item := range items {
if *item.ID == *ident {
return &item, nil
}
}
return nil, nil
} | go | func (w *Worklog) Get(ctx context.Context, orgID *identity.ID,
ident *apitypes.WorklogID) (*apitypes.WorklogItem, error) {
items, err := w.List(ctx, orgID, ident.Type())
if err != nil {
return nil, err
}
for _, item := range items {
if *item.ID == *ident {
return &item, nil
}
}
return nil, nil
} | [
"func",
"(",
"w",
"*",
"Worklog",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
",",
"ident",
"*",
"apitypes",
".",
"WorklogID",
")",
"(",
"*",
"apitypes",
".",
"WorklogItem",
",",
"error",
")",
"{",
"... | // Get returns a single worklog item for the given org with the given ident. | [
"Get",
"returns",
"a",
"single",
"worklog",
"item",
"for",
"the",
"given",
"org",
"with",
"the",
"given",
"ident",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/logic/worklog.go#L85-L100 |
123,757 | manifoldco/torus-cli | daemon/logic/worklog.go | Resolve | func (w *Worklog) Resolve(ctx context.Context, n *observer.Notifier,
orgID *identity.ID, ident *apitypes.WorklogID) error {
item, err := w.Get(ctx, orgID, ident)
if err != nil {
return err
}
if item == nil {
return nil
}
for t, h := range w.handlers {
if t&item.Type() == 0 {
continue
}
return h.... | go | func (w *Worklog) Resolve(ctx context.Context, n *observer.Notifier,
orgID *identity.ID, ident *apitypes.WorklogID) error {
item, err := w.Get(ctx, orgID, ident)
if err != nil {
return err
}
if item == nil {
return nil
}
for t, h := range w.handlers {
if t&item.Type() == 0 {
continue
}
return h.... | [
"func",
"(",
"w",
"*",
"Worklog",
")",
"Resolve",
"(",
"ctx",
"context",
".",
"Context",
",",
"n",
"*",
"observer",
".",
"Notifier",
",",
"orgID",
"*",
"identity",
".",
"ID",
",",
"ident",
"*",
"apitypes",
".",
"WorklogID",
")",
"error",
"{",
"item",... | // Resolve attempts to resolve the worklog item in the given org with the given
// ident. | [
"Resolve",
"attempts",
"to",
"resolve",
"the",
"worklog",
"item",
"in",
"the",
"given",
"org",
"with",
"the",
"given",
"ident",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/logic/worklog.go#L104-L125 |
123,758 | manifoldco/torus-cli | registry/users.go | Create | func (u *UsersClient) Create(ctx context.Context, userObj *envelope.User,
signup apitypes.Signup) (envelope.UserInf, error) {
v := &url.Values{}
if signup.InviteCode != "" {
v.Set("code", signup.InviteCode)
}
if signup.OrgInvite && signup.OrgName != "" {
v.Set("org", signup.OrgName)
}
if signup.Email != "" ... | go | func (u *UsersClient) Create(ctx context.Context, userObj *envelope.User,
signup apitypes.Signup) (envelope.UserInf, error) {
v := &url.Values{}
if signup.InviteCode != "" {
v.Set("code", signup.InviteCode)
}
if signup.OrgInvite && signup.OrgName != "" {
v.Set("org", signup.OrgName)
}
if signup.Email != "" ... | [
"func",
"(",
"u",
"*",
"UsersClient",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"userObj",
"*",
"envelope",
".",
"User",
",",
"signup",
"apitypes",
".",
"Signup",
")",
"(",
"envelope",
".",
"UserInf",
",",
"error",
")",
"{",
"v",
":=... | // Create attempts to register a new user | [
"Create",
"attempts",
"to",
"register",
"a",
"new",
"user"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/users.go#L17-L38 |
123,759 | manifoldco/torus-cli | registry/users.go | VerifyEmail | func (u *UsersClient) VerifyEmail(ctx context.Context, verifyCode string) error {
verify := apitypes.VerifyEmail{
Code: verifyCode,
}
return u.client.RoundTrip(ctx, "POST", "/users/verify", nil, &verify, nil)
} | go | func (u *UsersClient) VerifyEmail(ctx context.Context, verifyCode string) error {
verify := apitypes.VerifyEmail{
Code: verifyCode,
}
return u.client.RoundTrip(ctx, "POST", "/users/verify", nil, &verify, nil)
} | [
"func",
"(",
"u",
"*",
"UsersClient",
")",
"VerifyEmail",
"(",
"ctx",
"context",
".",
"Context",
",",
"verifyCode",
"string",
")",
"error",
"{",
"verify",
":=",
"apitypes",
".",
"VerifyEmail",
"{",
"Code",
":",
"verifyCode",
",",
"}",
"\n",
"return",
"u"... | // VerifyEmail will confirm the user's email with the registry | [
"VerifyEmail",
"will",
"confirm",
"the",
"user",
"s",
"email",
"with",
"the",
"registry"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/users.go#L41-L46 |
123,760 | manifoldco/torus-cli | registry/users.go | Update | func (u *UsersClient) Update(ctx context.Context, userObj interface{}) (envelope.UserInf, error) {
e := envelope.Unsigned{}
err := u.client.RoundTrip(ctx, "PATCH", "/users/self", nil, userObj, &e)
if err != nil {
return nil, err
}
return envelope.ConvertUser(&e)
} | go | func (u *UsersClient) Update(ctx context.Context, userObj interface{}) (envelope.UserInf, error) {
e := envelope.Unsigned{}
err := u.client.RoundTrip(ctx, "PATCH", "/users/self", nil, userObj, &e)
if err != nil {
return nil, err
}
return envelope.ConvertUser(&e)
} | [
"func",
"(",
"u",
"*",
"UsersClient",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"userObj",
"interface",
"{",
"}",
")",
"(",
"envelope",
".",
"UserInf",
",",
"error",
")",
"{",
"e",
":=",
"envelope",
".",
"Unsigned",
"{",
"}",
"\n",
... | // Update patches the user object with whitelisted fields | [
"Update",
"patches",
"the",
"user",
"object",
"with",
"whitelisted",
"fields"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/users.go#L49-L57 |
123,761 | manifoldco/torus-cli | daemon/logic/engine.go | ApproveInvite | func (e *Engine) ApproveInvite(ctx context.Context, notifier *observer.Notifier,
InviteID *identity.ID) (*envelope.OrgInvite, error) {
n := notifier.Notifier(3)
invite, err := e.client.OrgInvites.Get(ctx, InviteID)
if err != nil {
log.Printf("could not fetch org invitation: %s", err)
return nil, err
}
if i... | go | func (e *Engine) ApproveInvite(ctx context.Context, notifier *observer.Notifier,
InviteID *identity.ID) (*envelope.OrgInvite, error) {
n := notifier.Notifier(3)
invite, err := e.client.OrgInvites.Get(ctx, InviteID)
if err != nil {
log.Printf("could not fetch org invitation: %s", err)
return nil, err
}
if i... | [
"func",
"(",
"e",
"*",
"Engine",
")",
"ApproveInvite",
"(",
"ctx",
"context",
".",
"Context",
",",
"notifier",
"*",
"observer",
".",
"Notifier",
",",
"InviteID",
"*",
"identity",
".",
"ID",
")",
"(",
"*",
"envelope",
".",
"OrgInvite",
",",
"error",
")"... | // ApproveInvite approves an invitation of a user into an organzation by
// encoding them into a Keyring. | [
"ApproveInvite",
"approves",
"an",
"invitation",
"of",
"a",
"user",
"into",
"an",
"organzation",
"by",
"encoding",
"them",
"into",
"a",
"Keyring",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/daemon/logic/engine.go#L435-L489 |
123,762 | manifoldco/torus-cli | registry/version.go | Get | func (v *VersionClient) Get(ctx context.Context) (*apitypes.Version, error) {
version := apitypes.Version{}
err := v.client.RoundTrip(ctx, "GET", "/version", nil, nil, &version)
return &version, err
} | go | func (v *VersionClient) Get(ctx context.Context) (*apitypes.Version, error) {
version := apitypes.Version{}
err := v.client.RoundTrip(ctx, "GET", "/version", nil, nil, &version)
return &version, err
} | [
"func",
"(",
"v",
"*",
"VersionClient",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"apitypes",
".",
"Version",
",",
"error",
")",
"{",
"version",
":=",
"apitypes",
".",
"Version",
"{",
"}",
"\n",
"err",
":=",
"v",
".",
"clien... | // Get returns the registry's release version. | [
"Get",
"returns",
"the",
"registry",
"s",
"release",
"version",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/version.go#L16-L20 |
123,763 | manifoldco/torus-cli | registry/projects.go | Create | func (p *ProjectsClient) Create(ctx context.Context, org *identity.ID, name string) (*envelope.Project, error) {
project := projectCreateRequest{}
project.Body.OrgID = org
project.Body.Name = name
res := envelope.Project{}
err := p.client.RoundTrip(ctx, "POST", "/projects", nil, &project, &res)
return &res, err
... | go | func (p *ProjectsClient) Create(ctx context.Context, org *identity.ID, name string) (*envelope.Project, error) {
project := projectCreateRequest{}
project.Body.OrgID = org
project.Body.Name = name
res := envelope.Project{}
err := p.client.RoundTrip(ctx, "POST", "/projects", nil, &project, &res)
return &res, err
... | [
"func",
"(",
"p",
"*",
"ProjectsClient",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"org",
"*",
"identity",
".",
"ID",
",",
"name",
"string",
")",
"(",
"*",
"envelope",
".",
"Project",
",",
"error",
")",
"{",
"project",
":=",
"project... | // Create creates a new project with the given name within the given org | [
"Create",
"creates",
"a",
"new",
"project",
"with",
"the",
"given",
"name",
"within",
"the",
"given",
"org"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/projects.go#L34-L42 |
123,764 | manifoldco/torus-cli | registry/projects.go | List | func (p *ProjectsClient) List(ctx context.Context, orgID *identity.ID) ([]envelope.Project, error) {
orgs := []identity.ID{*orgID}
return p.Search(ctx, orgs, nil)
} | go | func (p *ProjectsClient) List(ctx context.Context, orgID *identity.ID) ([]envelope.Project, error) {
orgs := []identity.ID{*orgID}
return p.Search(ctx, orgs, nil)
} | [
"func",
"(",
"p",
"*",
"ProjectsClient",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
")",
"(",
"[",
"]",
"envelope",
".",
"Project",
",",
"error",
")",
"{",
"orgs",
":=",
"[",
"]",
"identity",
".",
... | // List returns a list of all Projects within the given org. | [
"List",
"returns",
"a",
"list",
"of",
"all",
"Projects",
"within",
"the",
"given",
"org",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/projects.go#L60-L63 |
123,765 | manifoldco/torus-cli | registry/projects.go | GetTree | func (p *ProjectsClient) GetTree(ctx context.Context, orgID *identity.ID) ([]ProjectTreeSegment, error) {
v := &url.Values{}
v.Set("org_id", orgID.String())
var segments []ProjectTreeSegment
err := p.client.RoundTrip(ctx, "GET", "/projecttree", v, nil, &segments)
return segments, err
} | go | func (p *ProjectsClient) GetTree(ctx context.Context, orgID *identity.ID) ([]ProjectTreeSegment, error) {
v := &url.Values{}
v.Set("org_id", orgID.String())
var segments []ProjectTreeSegment
err := p.client.RoundTrip(ctx, "GET", "/projecttree", v, nil, &segments)
return segments, err
} | [
"func",
"(",
"p",
"*",
"ProjectsClient",
")",
"GetTree",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
")",
"(",
"[",
"]",
"ProjectTreeSegment",
",",
"error",
")",
"{",
"v",
":=",
"&",
"url",
".",
"Values",
"{",
"... | // GetTree returns a project tree | [
"GetTree",
"returns",
"a",
"project",
"tree"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/projects.go#L66-L73 |
123,766 | manifoldco/torus-cli | prompts/select.go | SelectAcceptAction | func SelectAcceptAction() (int, string, error) {
label := "Do you want to login or create an account?"
v := []string{"Login", "Signup"}
p := selectPrompt(label, "Action", validate.OneOf(v))
return p(v, "")
} | go | func SelectAcceptAction() (int, string, error) {
label := "Do you want to login or create an account?"
v := []string{"Login", "Signup"}
p := selectPrompt(label, "Action", validate.OneOf(v))
return p(v, "")
} | [
"func",
"SelectAcceptAction",
"(",
")",
"(",
"int",
",",
"string",
",",
"error",
")",
"{",
"label",
":=",
"\"",
"\"",
"\n",
"v",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"p",
":=",
"selectPrompt",
"(",
"label",
",",
... | // SelectAcceptAction prompts the user to select whether they want to log into
// an existing account or to create a new one when they're accepting an org
// invitation. | [
"SelectAcceptAction",
"prompts",
"the",
"user",
"to",
"select",
"whether",
"they",
"want",
"to",
"log",
"into",
"an",
"existing",
"account",
"or",
"to",
"create",
"a",
"new",
"one",
"when",
"they",
"re",
"accepting",
"an",
"org",
"invitation",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/prompts/select.go#L59-L65 |
123,767 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | Parse | func (pp *primitiveParser) Parse() map[string]*data {
pp.loadTypeComments()
pp.loadStructs()
visible := make(map[string]*data)
for k := range pp.structmap {
if strings.ToUpper(string(k[0])) != string(k[0]) { // not exported
continue
}
pp.visitStruct(visible, k, false)
}
return visible
} | go | func (pp *primitiveParser) Parse() map[string]*data {
pp.loadTypeComments()
pp.loadStructs()
visible := make(map[string]*data)
for k := range pp.structmap {
if strings.ToUpper(string(k[0])) != string(k[0]) { // not exported
continue
}
pp.visitStruct(visible, k, false)
}
return visible
} | [
"func",
"(",
"pp",
"*",
"primitiveParser",
")",
"Parse",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"data",
"{",
"pp",
".",
"loadTypeComments",
"(",
")",
"\n",
"pp",
".",
"loadStructs",
"(",
")",
"\n\n",
"visible",
":=",
"make",
"(",
"map",
"[",
"st... | // Parse performs the actual work of walking over all defined structs,
// and building data representations of them for use in template rendering. | [
"Parse",
"performs",
"the",
"actual",
"work",
"of",
"walking",
"over",
"all",
"defined",
"structs",
"and",
"building",
"data",
"representations",
"of",
"them",
"for",
"use",
"in",
"template",
"rendering",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L115-L128 |
123,768 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | visitStruct | func (pp *primitiveParser) visitStruct(reachable map[string]*data, k string, visible bool) {
if _, ok := reachable[k]; ok { // already included
return
}
s := pp.structmap[k]
d := data{
Name: k,
Byte: pp.typedecls[pp.fset.Position(s.Pos()).Line],
}
d.Immutable, d.Version, d.Fields = pp.gatherFields(reachab... | go | func (pp *primitiveParser) visitStruct(reachable map[string]*data, k string, visible bool) {
if _, ok := reachable[k]; ok { // already included
return
}
s := pp.structmap[k]
d := data{
Name: k,
Byte: pp.typedecls[pp.fset.Position(s.Pos()).Line],
}
d.Immutable, d.Version, d.Fields = pp.gatherFields(reachab... | [
"func",
"(",
"pp",
"*",
"primitiveParser",
")",
"visitStruct",
"(",
"reachable",
"map",
"[",
"string",
"]",
"*",
"data",
",",
"k",
"string",
",",
"visible",
"bool",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"reachable",
"[",
"k",
"]",
";",
"ok",
"{",
... | // visitStruct inspects the struct with the given name, parsing out its
// field definitions and mutability state. | [
"visitStruct",
"inspects",
"the",
"struct",
"with",
"the",
"given",
"name",
"parsing",
"out",
"its",
"field",
"definitions",
"and",
"mutability",
"state",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L132-L148 |
123,769 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | gatherFields | func (pp *primitiveParser) gatherFields(reachable map[string]*data, s *ast.StructType, visible bool) (bool, uint8, []field) {
fields := []field{}
immutable := false
var version uint8
if s == nil {
return immutable, version, fields
}
for _, f := range s.Fields.List {
var typeName string
switch t := f.Type.... | go | func (pp *primitiveParser) gatherFields(reachable map[string]*data, s *ast.StructType, visible bool) (bool, uint8, []field) {
fields := []field{}
immutable := false
var version uint8
if s == nil {
return immutable, version, fields
}
for _, f := range s.Fields.List {
var typeName string
switch t := f.Type.... | [
"func",
"(",
"pp",
"*",
"primitiveParser",
")",
"gatherFields",
"(",
"reachable",
"map",
"[",
"string",
"]",
"*",
"data",
",",
"s",
"*",
"ast",
".",
"StructType",
",",
"visible",
"bool",
")",
"(",
"bool",
",",
"uint8",
",",
"[",
"]",
"field",
")",
... | // gatherFields is used by visitStruct to gather the fields for a struct.
// embedded struct fields are hoisted up to the enclosing struct for JSON
// representation.
// referenced structs will in turn be visited.
//
// gatherFields transfers visibility from immutable structs, or any already
// known visible structs, t... | [
"gatherFields",
"is",
"used",
"by",
"visitStruct",
"to",
"gather",
"the",
"fields",
"for",
"a",
"struct",
".",
"embedded",
"struct",
"fields",
"are",
"hoisted",
"up",
"to",
"the",
"enclosing",
"struct",
"for",
"JSON",
"representation",
".",
"referenced",
"stru... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L158-L220 |
123,770 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | loadTypeComments | func (pp *primitiveParser) loadTypeComments() {
pp.typedecls = make(map[int]string)
for _, c := range pp.p.Comments {
cmt := strings.Trim(c.List[0].Text, "/* \t")
parts := strings.Split(cmt, " ")
if len(parts) == 2 && parts[0] == "type:" {
pp.typedecls[pp.fset.Position(c.List[0].Pos()).Line] = parts[1]
}
... | go | func (pp *primitiveParser) loadTypeComments() {
pp.typedecls = make(map[int]string)
for _, c := range pp.p.Comments {
cmt := strings.Trim(c.List[0].Text, "/* \t")
parts := strings.Split(cmt, " ")
if len(parts) == 2 && parts[0] == "type:" {
pp.typedecls[pp.fset.Position(c.List[0].Pos()).Line] = parts[1]
}
... | [
"func",
"(",
"pp",
"*",
"primitiveParser",
")",
"loadTypeComments",
"(",
")",
"{",
"pp",
".",
"typedecls",
"=",
"make",
"(",
"map",
"[",
"int",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"pp",
".",
"p",
".",
"Comments",
"{",
"... | // loadTypeComments loads our annotation comments on structs, indicating
// their enumerated byte type, allowing us to look it up later by line. | [
"loadTypeComments",
"loads",
"our",
"annotation",
"comments",
"on",
"structs",
"indicating",
"their",
"enumerated",
"byte",
"type",
"allowing",
"us",
"to",
"look",
"it",
"up",
"later",
"by",
"line",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L224-L233 |
123,771 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | loadStructs | func (pp *primitiveParser) loadStructs() {
pp.structmap = make(map[string]*ast.StructType)
for k, o := range pp.p.Scope.Objects {
// We only care about types
if o.Kind != ast.Typ {
continue
}
ts, ok := o.Decl.(*ast.TypeSpec)
if !ok {
continue
}
// and to be more exact, only struct types
s, ok ... | go | func (pp *primitiveParser) loadStructs() {
pp.structmap = make(map[string]*ast.StructType)
for k, o := range pp.p.Scope.Objects {
// We only care about types
if o.Kind != ast.Typ {
continue
}
ts, ok := o.Decl.(*ast.TypeSpec)
if !ok {
continue
}
// and to be more exact, only struct types
s, ok ... | [
"func",
"(",
"pp",
"*",
"primitiveParser",
")",
"loadStructs",
"(",
")",
"{",
"pp",
".",
"structmap",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"ast",
".",
"StructType",
")",
"\n\n",
"for",
"k",
",",
"o",
":=",
"range",
"pp",
".",
"p",
".... | // loadStructs creates a map of name to ast node for struct types from the
// parsed file, filtering out other types. | [
"loadStructs",
"creates",
"a",
"map",
"of",
"name",
"to",
"ast",
"node",
"for",
"struct",
"types",
"from",
"the",
"parsed",
"file",
"filtering",
"out",
"other",
"types",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L237-L263 |
123,772 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | parseJSONTag | func parseJSONTag(tag string) string {
if len(tag) == 0 {
return ""
}
if tag[:7] != "`json:\"" {
return ""
}
parts := strings.Split(tag[7:len(tag)-2], ",")
return parts[0]
} | go | func parseJSONTag(tag string) string {
if len(tag) == 0 {
return ""
}
if tag[:7] != "`json:\"" {
return ""
}
parts := strings.Split(tag[7:len(tag)-2], ",")
return parts[0]
} | [
"func",
"parseJSONTag",
"(",
"tag",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"tag",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"tag",
"[",
":",
"7",
"]",
"!=",
"\"",
"\\\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",... | // parseJSONTag parses the given JSON struct field tag, to get its name.
// omitting fields via tags is not supported. | [
"parseJSONTag",
"parses",
"the",
"given",
"JSON",
"struct",
"field",
"tag",
"to",
"get",
"its",
"name",
".",
"omitting",
"fields",
"via",
"tags",
"is",
"not",
"supported",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L267-L279 |
123,773 | manifoldco/torus-cli | tools/primitive-boilerplate/main.go | writeTemplate | func writeTemplate(fileName string, tmpl *template.Template, data interface{}) {
buf := &bytes.Buffer{}
err := tmpl.Execute(buf, data)
if err != nil {
log.Fatal(err)
}
formatted, err := format.Source(buf.Bytes())
if err != nil {
log.Fatal(err)
}
fd, err := os.Create(fileName)
if err != nil {
log.Fatal(... | go | func writeTemplate(fileName string, tmpl *template.Template, data interface{}) {
buf := &bytes.Buffer{}
err := tmpl.Execute(buf, data)
if err != nil {
log.Fatal(err)
}
formatted, err := format.Source(buf.Bytes())
if err != nil {
log.Fatal(err)
}
fd, err := os.Create(fileName)
if err != nil {
log.Fatal(... | [
"func",
"writeTemplate",
"(",
"fileName",
"string",
",",
"tmpl",
"*",
"template",
".",
"Template",
",",
"data",
"interface",
"{",
"}",
")",
"{",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"err",
":=",
"tmpl",
".",
"Execute",
"(",
"buf"... | // writeTemplate writes the given template to the given file, with the given
// data. Templates are assumed to be generating go source files, so they
// are formatted as well. | [
"writeTemplate",
"writes",
"the",
"given",
"template",
"to",
"the",
"given",
"file",
"with",
"the",
"given",
"data",
".",
"Templates",
"are",
"assumed",
"to",
"be",
"generating",
"go",
"source",
"files",
"so",
"they",
"are",
"formatted",
"as",
"well",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/tools/primitive-boilerplate/main.go#L284-L303 |
123,774 | manifoldco/torus-cli | apitypes/credential.go | String | func (c *CredentialValue) String() string {
if c.cvtype == unsetCV {
panic("CredentialValue has been unset")
}
if c.cvtype == undecryptedCV {
panic("CredentialValue was not decrypted")
}
return c.value
} | go | func (c *CredentialValue) String() string {
if c.cvtype == unsetCV {
panic("CredentialValue has been unset")
}
if c.cvtype == undecryptedCV {
panic("CredentialValue was not decrypted")
}
return c.value
} | [
"func",
"(",
"c",
"*",
"CredentialValue",
")",
"String",
"(",
")",
"string",
"{",
"if",
"c",
".",
"cvtype",
"==",
"unsetCV",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"cvtype",
"==",
"undecryptedCV",
"{",
"panic",
"(",
... | // String returns the string representation of this credential. It panics
// if the credential was deleted. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"this",
"credential",
".",
"It",
"panics",
"if",
"the",
"credential",
"was",
"deleted",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/apitypes/credential.go#L124-L134 |
123,775 | manifoldco/torus-cli | apitypes/credential.go | Raw | func (c *CredentialValue) Raw() (interface{}, error) {
if c.IsUnset() {
return nil, errors.New("Cannot return raw value of an unset Credential")
}
return c.raw, nil
} | go | func (c *CredentialValue) Raw() (interface{}, error) {
if c.IsUnset() {
return nil, errors.New("Cannot return raw value of an unset Credential")
}
return c.raw, nil
} | [
"func",
"(",
"c",
"*",
"CredentialValue",
")",
"Raw",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"c",
".",
"IsUnset",
"(",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
... | // Raw returns the underlying typed value for this Credential. | [
"Raw",
"returns",
"the",
"underlying",
"typed",
"value",
"for",
"this",
"Credential",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/apitypes/credential.go#L145-L151 |
123,776 | manifoldco/torus-cli | apitypes/credential.go | NewStringCredentialValue | func NewStringCredentialValue(s string) *CredentialValue {
return &CredentialValue{
cvtype: stringCV,
value: s,
raw: s,
}
} | go | func NewStringCredentialValue(s string) *CredentialValue {
return &CredentialValue{
cvtype: stringCV,
value: s,
raw: s,
}
} | [
"func",
"NewStringCredentialValue",
"(",
"s",
"string",
")",
"*",
"CredentialValue",
"{",
"return",
"&",
"CredentialValue",
"{",
"cvtype",
":",
"stringCV",
",",
"value",
":",
"s",
",",
"raw",
":",
"s",
",",
"}",
"\n",
"}"
] | // NewStringCredentialValue creates a CredentialValue with a string value. | [
"NewStringCredentialValue",
"creates",
"a",
"CredentialValue",
"with",
"a",
"string",
"value",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/apitypes/credential.go#L253-L259 |
123,777 | manifoldco/torus-cli | apitypes/credential.go | NewIntCredentialValue | func NewIntCredentialValue(i int) *CredentialValue {
return &CredentialValue{
cvtype: intCV,
value: strconv.Itoa(i),
raw: i,
}
} | go | func NewIntCredentialValue(i int) *CredentialValue {
return &CredentialValue{
cvtype: intCV,
value: strconv.Itoa(i),
raw: i,
}
} | [
"func",
"NewIntCredentialValue",
"(",
"i",
"int",
")",
"*",
"CredentialValue",
"{",
"return",
"&",
"CredentialValue",
"{",
"cvtype",
":",
"intCV",
",",
"value",
":",
"strconv",
".",
"Itoa",
"(",
"i",
")",
",",
"raw",
":",
"i",
",",
"}",
"\n",
"}"
] | // NewIntCredentialValue creates a CredentialValue with an int value. | [
"NewIntCredentialValue",
"creates",
"a",
"CredentialValue",
"with",
"an",
"int",
"value",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/apitypes/credential.go#L262-L268 |
123,778 | manifoldco/torus-cli | apitypes/credential.go | NewFloatCredentialValue | func NewFloatCredentialValue(f float64) *CredentialValue {
return &CredentialValue{
cvtype: floatCV,
value: strconv.FormatFloat(f, 'g', -1, 64),
raw: f,
}
} | go | func NewFloatCredentialValue(f float64) *CredentialValue {
return &CredentialValue{
cvtype: floatCV,
value: strconv.FormatFloat(f, 'g', -1, 64),
raw: f,
}
} | [
"func",
"NewFloatCredentialValue",
"(",
"f",
"float64",
")",
"*",
"CredentialValue",
"{",
"return",
"&",
"CredentialValue",
"{",
"cvtype",
":",
"floatCV",
",",
"value",
":",
"strconv",
".",
"FormatFloat",
"(",
"f",
",",
"'g'",
",",
"-",
"1",
",",
"64",
"... | // NewFloatCredentialValue creates a CredentialValue with a float value. | [
"NewFloatCredentialValue",
"creates",
"a",
"CredentialValue",
"with",
"a",
"float",
"value",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/apitypes/credential.go#L271-L277 |
123,779 | manifoldco/torus-cli | registry/services.go | Create | func (s *ServicesClient) Create(ctx context.Context, orgID, projectID *identity.ID, name string) error {
if orgID == nil || projectID == nil {
return errors.New("invalid org or project")
}
serviceBody := primitive.Service{
Name: name,
OrgID: orgID,
ProjectID: projectID,
}
ID, err := identity.New... | go | func (s *ServicesClient) Create(ctx context.Context, orgID, projectID *identity.ID, name string) error {
if orgID == nil || projectID == nil {
return errors.New("invalid org or project")
}
serviceBody := primitive.Service{
Name: name,
OrgID: orgID,
ProjectID: projectID,
}
ID, err := identity.New... | [
"func",
"(",
"s",
"*",
"ServicesClient",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
",",
"projectID",
"*",
"identity",
".",
"ID",
",",
"name",
"string",
")",
"error",
"{",
"if",
"orgID",
"==",
"nil",
"||",
"projectID",
"==",
... | // Create performs a request to create a new service object | [
"Create",
"performs",
"a",
"request",
"to",
"create",
"a",
"new",
"service",
"object"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/services.go#L40-L63 |
123,780 | manifoldco/torus-cli | registry/claimtree.go | Find | func (ct *ClaimTree) Find(id *identity.ID, mustActive bool) (*apitypes.PublicKeySegment, error) {
for _, pks := range ct.PublicKeys {
if *pks.PublicKey.ID == *id {
if mustActive && pks.Revoked() {
continue
}
return &pks, nil
}
}
return nil, ErrKeyNotFound
} | go | func (ct *ClaimTree) Find(id *identity.ID, mustActive bool) (*apitypes.PublicKeySegment, error) {
for _, pks := range ct.PublicKeys {
if *pks.PublicKey.ID == *id {
if mustActive && pks.Revoked() {
continue
}
return &pks, nil
}
}
return nil, ErrKeyNotFound
} | [
"func",
"(",
"ct",
"*",
"ClaimTree",
")",
"Find",
"(",
"id",
"*",
"identity",
".",
"ID",
",",
"mustActive",
"bool",
")",
"(",
"*",
"apitypes",
".",
"PublicKeySegment",
",",
"error",
")",
"{",
"for",
"_",
",",
"pks",
":=",
"range",
"ct",
".",
"Publi... | // Find returns the PublicKeySegment for the given PublicKeyID. Accepts a
// boolean for indicating whether or not to enforce that the key must be
// active.
//
// If a key segment could not be found an error is returned. | [
"Find",
"returns",
"the",
"PublicKeySegment",
"for",
"the",
"given",
"PublicKeyID",
".",
"Accepts",
"a",
"boolean",
"for",
"indicating",
"whether",
"or",
"not",
"to",
"enforce",
"that",
"the",
"key",
"must",
"be",
"active",
".",
"If",
"a",
"key",
"segment",
... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/claimtree.go#L51-L63 |
123,781 | manifoldco/torus-cli | registry/claimtree.go | FindActive | func (ct *ClaimTree) FindActive(ownerID *identity.ID, t primitive.KeyType) (*apitypes.PublicKeySegment, error) {
for _, pks := range ct.PublicKeys {
if *pks.PublicKey.Body.OwnerID != *ownerID {
continue
}
if pks.PublicKey.Body.KeyType != t {
continue
}
if pks.Revoked() {
continue
}
return &pk... | go | func (ct *ClaimTree) FindActive(ownerID *identity.ID, t primitive.KeyType) (*apitypes.PublicKeySegment, error) {
for _, pks := range ct.PublicKeys {
if *pks.PublicKey.Body.OwnerID != *ownerID {
continue
}
if pks.PublicKey.Body.KeyType != t {
continue
}
if pks.Revoked() {
continue
}
return &pk... | [
"func",
"(",
"ct",
"*",
"ClaimTree",
")",
"FindActive",
"(",
"ownerID",
"*",
"identity",
".",
"ID",
",",
"t",
"primitive",
".",
"KeyType",
")",
"(",
"*",
"apitypes",
".",
"PublicKeySegment",
",",
"error",
")",
"{",
"for",
"_",
",",
"pks",
":=",
"rang... | // FindActive returns the PublicKeySegment for a non-revoked Public Key for
// the given owner id.
//
// If an active key cannot be found an error is returned | [
"FindActive",
"returns",
"the",
"PublicKeySegment",
"for",
"a",
"non",
"-",
"revoked",
"Public",
"Key",
"for",
"the",
"given",
"owner",
"id",
".",
"If",
"an",
"active",
"key",
"cannot",
"be",
"found",
"an",
"error",
"is",
"returned"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/claimtree.go#L69-L87 |
123,782 | manifoldco/torus-cli | registry/claimtree.go | List | func (c *ClaimTreeClient) List(ctx context.Context, orgID *identity.ID,
ownerID *identity.ID) ([]ClaimTree, error) {
query := &url.Values{}
if orgID != nil {
query.Set("org_id", orgID.String())
}
if ownerID != nil {
query.Set("owner_id", ownerID.String())
}
var resp []ClaimTree
err := c.client.RoundTrip(... | go | func (c *ClaimTreeClient) List(ctx context.Context, orgID *identity.ID,
ownerID *identity.ID) ([]ClaimTree, error) {
query := &url.Values{}
if orgID != nil {
query.Set("org_id", orgID.String())
}
if ownerID != nil {
query.Set("owner_id", ownerID.String())
}
var resp []ClaimTree
err := c.client.RoundTrip(... | [
"func",
"(",
"c",
"*",
"ClaimTreeClient",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
",",
"ownerID",
"*",
"identity",
".",
"ID",
")",
"(",
"[",
"]",
"ClaimTree",
",",
"error",
")",
"{",
"query",
":... | // List returns a list of all claimtrees for a given orgID. If no orgID is
// provided then it returns all claimtrees for every organization the user
// belongs too.
//
// If an ownerID is provided then only public keys and claims related to that
// user or machine will be returned. | [
"List",
"returns",
"a",
"list",
"of",
"all",
"claimtrees",
"for",
"a",
"given",
"orgID",
".",
"If",
"no",
"orgID",
"is",
"provided",
"then",
"it",
"returns",
"all",
"claimtrees",
"for",
"every",
"organization",
"the",
"user",
"belongs",
"too",
".",
"If",
... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/claimtree.go#L95-L110 |
123,783 | manifoldco/torus-cli | registry/claimtree.go | Get | func (c *ClaimTreeClient) Get(ctx context.Context, orgID *identity.ID,
ownerID *identity.ID) (*ClaimTree, error) {
if orgID == nil {
return nil, errors.New("An org id must be provided")
}
cts, err := c.List(ctx, orgID, ownerID)
if err != nil {
return nil, err
}
if len(cts) != 1 {
return nil, ErrClaimTre... | go | func (c *ClaimTreeClient) Get(ctx context.Context, orgID *identity.ID,
ownerID *identity.ID) (*ClaimTree, error) {
if orgID == nil {
return nil, errors.New("An org id must be provided")
}
cts, err := c.List(ctx, orgID, ownerID)
if err != nil {
return nil, err
}
if len(cts) != 1 {
return nil, ErrClaimTre... | [
"func",
"(",
"c",
"*",
"ClaimTreeClient",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"*",
"identity",
".",
"ID",
",",
"ownerID",
"*",
"identity",
".",
"ID",
")",
"(",
"*",
"ClaimTree",
",",
"error",
")",
"{",
"if",
"orgID",
"=... | // Get returns a claimtree for a specific organization by the given orgID.
//
// If an ownerID is provided then only public keys and claims related to that
// user or machine will be returned. | [
"Get",
"returns",
"a",
"claimtree",
"for",
"a",
"specific",
"organization",
"by",
"the",
"given",
"orgID",
".",
"If",
"an",
"ownerID",
"is",
"provided",
"then",
"only",
"public",
"keys",
"and",
"claims",
"related",
"to",
"that",
"user",
"or",
"machine",
"w... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/registry/claimtree.go#L116-L133 |
123,784 | manifoldco/torus-cli | prompts/prompts.go | Password | func Password(confirm bool, override *string) (string, error) {
preferences, err := prefs.NewPreferences()
if err != nil {
return "", err
}
label := "Password"
if override != nil {
label = *override
}
if !ui.Attached() {
return "", errs.ErrTerminalRequired
}
prompt := &promptui.Prompt{
Label: la... | go | func Password(confirm bool, override *string) (string, error) {
preferences, err := prefs.NewPreferences()
if err != nil {
return "", err
}
label := "Password"
if override != nil {
label = *override
}
if !ui.Attached() {
return "", errs.ErrTerminalRequired
}
prompt := &promptui.Prompt{
Label: la... | [
"func",
"Password",
"(",
"confirm",
"bool",
",",
"override",
"*",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"preferences",
",",
"err",
":=",
"prefs",
".",
"NewPreferences",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\... | // Password prompts the user to provide a password. The value provided by the
// user is masked.
//
// If confirm is true the user will be prompted to supply the password again. | [
"Password",
"prompts",
"the",
"user",
"to",
"provide",
"a",
"password",
".",
"The",
"value",
"provided",
"by",
"the",
"user",
"is",
"masked",
".",
"If",
"confirm",
"is",
"true",
"the",
"user",
"will",
"be",
"prompted",
"to",
"supply",
"the",
"password",
... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/prompts/prompts.go#L69-L113 |
123,785 | manifoldco/torus-cli | api/users.go | Create | func (u *UsersClient) Create(ctx context.Context, signup *apitypes.Signup, output *ProgressFunc) (envelope.UserInf, error) {
e := envelope.Unsigned{}
err := u.client.DaemonRoundTrip(ctx, "POST", "/signup", nil, &signup, &e, nil)
if err != nil {
return nil, err
}
return envelope.ConvertUser(&e)
} | go | func (u *UsersClient) Create(ctx context.Context, signup *apitypes.Signup, output *ProgressFunc) (envelope.UserInf, error) {
e := envelope.Unsigned{}
err := u.client.DaemonRoundTrip(ctx, "POST", "/signup", nil, &signup, &e, nil)
if err != nil {
return nil, err
}
return envelope.ConvertUser(&e)
} | [
"func",
"(",
"u",
"*",
"UsersClient",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"signup",
"*",
"apitypes",
".",
"Signup",
",",
"output",
"*",
"ProgressFunc",
")",
"(",
"envelope",
".",
"UserInf",
",",
"error",
")",
"{",
"e",
":=",
"e... | // Create will have the daemon create a new user request | [
"Create",
"will",
"have",
"the",
"daemon",
"create",
"a",
"new",
"user",
"request"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/users.go#L22-L30 |
123,786 | manifoldco/torus-cli | api/users.go | Update | func (u *UsersClient) Update(ctx context.Context, delta apitypes.ProfileUpdate) (envelope.UserInf, error) {
e := envelope.Unsigned{}
err := u.client.DaemonRoundTrip(ctx, "PATCH", "/self", nil, &delta, &e, nil)
if err != nil {
return nil, err
}
return envelope.ConvertUser(&e)
} | go | func (u *UsersClient) Update(ctx context.Context, delta apitypes.ProfileUpdate) (envelope.UserInf, error) {
e := envelope.Unsigned{}
err := u.client.DaemonRoundTrip(ctx, "PATCH", "/self", nil, &delta, &e, nil)
if err != nil {
return nil, err
}
return envelope.ConvertUser(&e)
} | [
"func",
"(",
"u",
"*",
"UsersClient",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"delta",
"apitypes",
".",
"ProfileUpdate",
")",
"(",
"envelope",
".",
"UserInf",
",",
"error",
")",
"{",
"e",
":=",
"envelope",
".",
"Unsigned",
"{",
"}",
... | // Update performs a profile update to the user object | [
"Update",
"performs",
"a",
"profile",
"update",
"to",
"the",
"user",
"object"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/users.go#L33-L41 |
123,787 | manifoldco/torus-cli | api/users.go | Verify | func (u *UsersClient) Verify(ctx context.Context, code string) error {
verifyEmail := apitypes.VerifyEmail{
Code: code,
}
return u.client.DaemonRoundTrip(ctx, "POST", "/verify", nil, &verifyEmail, nil, nil)
} | go | func (u *UsersClient) Verify(ctx context.Context, code string) error {
verifyEmail := apitypes.VerifyEmail{
Code: code,
}
return u.client.DaemonRoundTrip(ctx, "POST", "/verify", nil, &verifyEmail, nil, nil)
} | [
"func",
"(",
"u",
"*",
"UsersClient",
")",
"Verify",
"(",
"ctx",
"context",
".",
"Context",
",",
"code",
"string",
")",
"error",
"{",
"verifyEmail",
":=",
"apitypes",
".",
"VerifyEmail",
"{",
"Code",
":",
"code",
",",
"}",
"\n\n",
"return",
"u",
".",
... | // Verify verifies the users account using the given code | [
"Verify",
"verifies",
"the",
"users",
"account",
"using",
"the",
"given",
"code"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/users.go#L44-L50 |
123,788 | manifoldco/torus-cli | dirprefs/dirprefs.go | Load | func Load(recurse bool) (*DirPreferences, error) {
path, err := os.Getwd()
if err != nil {
return nil, err
}
prefs := &DirPreferences{}
var f *os.File
for {
f, err = os.Open(filepath.Join(path, ".torus.json"))
if err != nil {
if isSystemRoot(path) || !recurse {
return prefs, nil
}
path = fil... | go | func Load(recurse bool) (*DirPreferences, error) {
path, err := os.Getwd()
if err != nil {
return nil, err
}
prefs := &DirPreferences{}
var f *os.File
for {
f, err = os.Open(filepath.Join(path, ".torus.json"))
if err != nil {
if isSystemRoot(path) || !recurse {
return prefs, nil
}
path = fil... | [
"func",
"Load",
"(",
"recurse",
"bool",
")",
"(",
"*",
"DirPreferences",
",",
"error",
")",
"{",
"path",
",",
"err",
":=",
"os",
".",
"Getwd",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"prefs",... | // Load loads DirPreferences. It starts in the current working directory,
// looking for a readable '.torus.json' file, and walks up the directory
// hierarchy until it finds one, or reaches the root of the fs.
//
// It returns an empty DirPreferences is no '.torus.json' files are found.
// It returns an error if a mal... | [
"Load",
"loads",
"DirPreferences",
".",
"It",
"starts",
"in",
"the",
"current",
"working",
"directory",
"looking",
"for",
"a",
"readable",
".",
"torus",
".",
"json",
"file",
"and",
"walks",
"up",
"the",
"directory",
"hierarchy",
"until",
"it",
"finds",
"one"... | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/dirprefs/dirprefs.go#L24-L57 |
123,789 | manifoldco/torus-cli | dirprefs/dirprefs.go | Save | func (d *DirPreferences) Save() error {
f, err := os.Create(d.Path)
if err != nil {
return err
}
defer f.Close()
enc := json.NewEncoder(f)
return enc.Encode(d)
} | go | func (d *DirPreferences) Save() error {
f, err := os.Create(d.Path)
if err != nil {
return err
}
defer f.Close()
enc := json.NewEncoder(f)
return enc.Encode(d)
} | [
"func",
"(",
"d",
"*",
"DirPreferences",
")",
"Save",
"(",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"d",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"defer",
"f",
".",
... | // Save writes the DirPreferences values to the file in the struct's Path
// field | [
"Save",
"writes",
"the",
"DirPreferences",
"values",
"to",
"the",
"file",
"in",
"the",
"struct",
"s",
"Path",
"field"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/dirprefs/dirprefs.go#L61-L71 |
123,790 | manifoldco/torus-cli | dirprefs/dirprefs.go | isSystemRoot | func isSystemRoot(path string) bool {
if len(path) != rootPathLength {
return false
}
return os.PathSeparator == path[rootPathLength-1]
} | go | func isSystemRoot(path string) bool {
if len(path) != rootPathLength {
return false
}
return os.PathSeparator == path[rootPathLength-1]
} | [
"func",
"isSystemRoot",
"(",
"path",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"path",
")",
"!=",
"rootPathLength",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"os",
".",
"PathSeparator",
"==",
"path",
"[",
"rootPathLength",
"-",
"1",
"]",
... | // isSystemRoot validates if the given path is the root of the system for the
// OS the application is running on. | [
"isSystemRoot",
"validates",
"if",
"the",
"given",
"path",
"is",
"the",
"root",
"of",
"the",
"system",
"for",
"the",
"OS",
"the",
"application",
"is",
"running",
"on",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/dirprefs/dirprefs.go#L80-L86 |
123,791 | manifoldco/torus-cli | errs/errs.go | ToError | func ToError(err error) error {
switch e := err.(type) {
case *cli.ExitError:
return e
case nil:
return nil
default:
return cli.NewExitError(err.Error(), -1)
}
} | go | func ToError(err error) error {
switch e := err.(type) {
case *cli.ExitError:
return e
case nil:
return nil
default:
return cli.NewExitError(err.Error(), -1)
}
} | [
"func",
"ToError",
"(",
"err",
"error",
")",
"error",
"{",
"switch",
"e",
":=",
"err",
".",
"(",
"type",
")",
"{",
"case",
"*",
"cli",
".",
"ExitError",
":",
"return",
"e",
"\n",
"case",
"nil",
":",
"return",
"nil",
"\n",
"default",
":",
"return",
... | // ToError converts the given error into a cli.ExitError | [
"ToError",
"converts",
"the",
"given",
"error",
"into",
"a",
"cli",
".",
"ExitError"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/errs/errs.go#L19-L28 |
123,792 | manifoldco/torus-cli | errs/errs.go | NewUsageExitError | func NewUsageExitError(message string, ctx *cli.Context) error {
if wordRegex.MatchString(message[len(message)-1:]) {
message += "."
}
return cli.NewExitError(message+"\n"+usageString(ctx), -1)
} | go | func NewUsageExitError(message string, ctx *cli.Context) error {
if wordRegex.MatchString(message[len(message)-1:]) {
message += "."
}
return cli.NewExitError(message+"\n"+usageString(ctx), -1)
} | [
"func",
"NewUsageExitError",
"(",
"message",
"string",
",",
"ctx",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"wordRegex",
".",
"MatchString",
"(",
"message",
"[",
"len",
"(",
"message",
")",
"-",
"1",
":",
"]",
")",
"{",
"message",
"+=",
"... | // NewUsageExitError creates an ExitError with appended usage text | [
"NewUsageExitError",
"creates",
"an",
"ExitError",
"with",
"appended",
"usage",
"text"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/errs/errs.go#L36-L41 |
123,793 | manifoldco/torus-cli | errs/errs.go | NewErrorExitError | func NewErrorExitError(message string, err error) error {
if wordRegex.MatchString(message[len(message)-1:]) {
message += "."
}
return cli.NewExitError(message+"\n"+err.Error(), -1)
} | go | func NewErrorExitError(message string, err error) error {
if wordRegex.MatchString(message[len(message)-1:]) {
message += "."
}
return cli.NewExitError(message+"\n"+err.Error(), -1)
} | [
"func",
"NewErrorExitError",
"(",
"message",
"string",
",",
"err",
"error",
")",
"error",
"{",
"if",
"wordRegex",
".",
"MatchString",
"(",
"message",
"[",
"len",
"(",
"message",
")",
"-",
"1",
":",
"]",
")",
"{",
"message",
"+=",
"\"",
"\"",
"\n",
"}... | // NewErrorExitError creates an ExitError with an appended error message | [
"NewErrorExitError",
"creates",
"an",
"ExitError",
"with",
"an",
"appended",
"error",
"message"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/errs/errs.go#L44-L49 |
123,794 | manifoldco/torus-cli | errs/errs.go | NewExitError | func NewExitError(message string) error {
if wordRegex.MatchString(message[len(message)-1:]) {
message += "."
}
return cli.NewExitError(message, -1)
} | go | func NewExitError(message string) error {
if wordRegex.MatchString(message[len(message)-1:]) {
message += "."
}
return cli.NewExitError(message, -1)
} | [
"func",
"NewExitError",
"(",
"message",
"string",
")",
"error",
"{",
"if",
"wordRegex",
".",
"MatchString",
"(",
"message",
"[",
"len",
"(",
"message",
")",
"-",
"1",
":",
"]",
")",
"{",
"message",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"cli",
... | // NewExitError creates an ExitError with -1 | [
"NewExitError",
"creates",
"an",
"ExitError",
"with",
"-",
"1"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/errs/errs.go#L52-L57 |
123,795 | manifoldco/torus-cli | errs/errs.go | MultiError | func MultiError(errors ...error) cli.MultiError {
nonNilErrs := []error{}
for _, e := range errors {
if e != nil {
nonNilErrs = append(nonNilErrs, e)
}
}
return cli.NewMultiError(nonNilErrs...)
} | go | func MultiError(errors ...error) cli.MultiError {
nonNilErrs := []error{}
for _, e := range errors {
if e != nil {
nonNilErrs = append(nonNilErrs, e)
}
}
return cli.NewMultiError(nonNilErrs...)
} | [
"func",
"MultiError",
"(",
"errors",
"...",
"error",
")",
"cli",
".",
"MultiError",
"{",
"nonNilErrs",
":=",
"[",
"]",
"error",
"{",
"}",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"errors",
"{",
"if",
"e",
"!=",
"nil",
"{",
"nonNilErrs",
"=",
"app... | // MultiError loops over all given errors unpacks them and then creates a new
// MultiError for non-nil entries. | [
"MultiError",
"loops",
"over",
"all",
"given",
"errors",
"unpacks",
"them",
"and",
"then",
"creates",
"a",
"new",
"MultiError",
"for",
"non",
"-",
"nil",
"entries",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/errs/errs.go#L61-L70 |
123,796 | manifoldco/torus-cli | api/version.go | GetDaemon | func (v *VersionClient) GetDaemon(ctx context.Context) (*apitypes.Version, error) {
version := &apitypes.Version{}
err := v.client.DaemonRoundTrip(ctx, "GET", "/version", nil, nil, version, nil)
return version, err
} | go | func (v *VersionClient) GetDaemon(ctx context.Context) (*apitypes.Version, error) {
version := &apitypes.Version{}
err := v.client.DaemonRoundTrip(ctx, "GET", "/version", nil, nil, version, nil)
return version, err
} | [
"func",
"(",
"v",
"*",
"VersionClient",
")",
"GetDaemon",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"apitypes",
".",
"Version",
",",
"error",
")",
"{",
"version",
":=",
"&",
"apitypes",
".",
"Version",
"{",
"}",
"\n",
"err",
":=",
"v",
... | // GetDaemon returns the daemon's release version. | [
"GetDaemon",
"returns",
"the",
"daemon",
"s",
"release",
"version",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/api/version.go#L22-L26 |
123,797 | manifoldco/torus-cli | gatekeeper/http/http.go | NewGatekeeper | func NewGatekeeper(org, team, certpath, keypath string, cfg *config.Config, api *api.Client) (*Gatekeeper, error) {
server := &http.Server{
Addr: cfg.GatekeeperAddress,
}
keypair, err := tlsKeypair(certpath, keypath)
if err != nil {
log.Printf("Starting Gatekeeper without SSL: %s", err)
} else {
if err != n... | go | func NewGatekeeper(org, team, certpath, keypath string, cfg *config.Config, api *api.Client) (*Gatekeeper, error) {
server := &http.Server{
Addr: cfg.GatekeeperAddress,
}
keypair, err := tlsKeypair(certpath, keypath)
if err != nil {
log.Printf("Starting Gatekeeper without SSL: %s", err)
} else {
if err != n... | [
"func",
"NewGatekeeper",
"(",
"org",
",",
"team",
",",
"certpath",
",",
"keypath",
"string",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"api",
"*",
"api",
".",
"Client",
")",
"(",
"*",
"Gatekeeper",
",",
"error",
")",
"{",
"server",
":=",
"&",
... | // NewGatekeeper returns a new Gatekeeper. | [
"NewGatekeeper",
"returns",
"a",
"new",
"Gatekeeper",
"."
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/gatekeeper/http/http.go#L34-L66 |
123,798 | manifoldco/torus-cli | gatekeeper/http/http.go | Listen | func (g *Gatekeeper) Listen() error {
mux := bone.New()
mux.Post("/v0/machine/aws", routes.AWSBootstrapRoute(g.defaults.Org, g.defaults.Team, g.api))
g.s.Handler = loggingHandler(mux)
h := httpdown.HTTP{}
var err error
g.hd, err = h.ListenAndServe(g.s)
if err != nil {
return err
}
return g.hd.Wait()
} | go | func (g *Gatekeeper) Listen() error {
mux := bone.New()
mux.Post("/v0/machine/aws", routes.AWSBootstrapRoute(g.defaults.Org, g.defaults.Team, g.api))
g.s.Handler = loggingHandler(mux)
h := httpdown.HTTP{}
var err error
g.hd, err = h.ListenAndServe(g.s)
if err != nil {
return err
}
return g.hd.Wait()
} | [
"func",
"(",
"g",
"*",
"Gatekeeper",
")",
"Listen",
"(",
")",
"error",
"{",
"mux",
":=",
"bone",
".",
"New",
"(",
")",
"\n\n",
"mux",
".",
"Post",
"(",
"\"",
"\"",
",",
"routes",
".",
"AWSBootstrapRoute",
"(",
"g",
".",
"defaults",
".",
"Org",
",... | // Listen listens on a TCP port for HTTP machine requests | [
"Listen",
"listens",
"on",
"a",
"TCP",
"port",
"for",
"HTTP",
"machine",
"requests"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/gatekeeper/http/http.go#L69-L84 |
123,799 | manifoldco/torus-cli | cmd/gatekeeper.go | startGatekeeperCmd | func startGatekeeperCmd(ctx *cli.Context) error {
log.SetOutput(os.Stdout)
cfg, err := config.LoadConfig()
if err != nil {
return errs.NewErrorExitError("Failed to load config.", err)
}
gatekeeper, err := gatekeeper.New(ctx.String("org"), ctx.String("role"), ctx.String("cert"), ctx.String("key"), cfg)
if err ... | go | func startGatekeeperCmd(ctx *cli.Context) error {
log.SetOutput(os.Stdout)
cfg, err := config.LoadConfig()
if err != nil {
return errs.NewErrorExitError("Failed to load config.", err)
}
gatekeeper, err := gatekeeper.New(ctx.String("org"), ctx.String("role"), ctx.String("cert"), ctx.String("key"), cfg)
if err ... | [
"func",
"startGatekeeperCmd",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"log",
".",
"SetOutput",
"(",
"os",
".",
"Stdout",
")",
"\n\n",
"cfg",
",",
"err",
":=",
"config",
".",
"LoadConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // startGatekeeper starts the machine Gatekeeper | [
"startGatekeeper",
"starts",
"the",
"machine",
"Gatekeeper"
] | 137599f985e6f676c081ffb4230aaad52fb7d26c | https://github.com/manifoldco/torus-cli/blob/137599f985e6f676c081ffb4230aaad52fb7d26c/cmd/gatekeeper.go#L48-L69 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.