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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
18,200 | sassoftware/go-rpmutils | writeheader.go | WriteTo | func (hdr *rpmHeader) WriteTo(outfile io.Writer, regionTag int) error {
if regionTag != 0 && regionTag >= RPMTAG_HEADERREGIONS {
return errors.New("invalid region tag")
}
// sort tags
var keys []int
for k := range hdr.entries {
if k < RPMTAG_HEADERREGIONS {
// discard existing regions
continue
}
keys... | go | func (hdr *rpmHeader) WriteTo(outfile io.Writer, regionTag int) error {
if regionTag != 0 && regionTag >= RPMTAG_HEADERREGIONS {
return errors.New("invalid region tag")
}
// sort tags
var keys []int
for k := range hdr.entries {
if k < RPMTAG_HEADERREGIONS {
// discard existing regions
continue
}
keys... | [
"func",
"(",
"hdr",
"*",
"rpmHeader",
")",
"WriteTo",
"(",
"outfile",
"io",
".",
"Writer",
",",
"regionTag",
"int",
")",
"error",
"{",
"if",
"regionTag",
"!=",
"0",
"&&",
"regionTag",
">=",
"RPMTAG_HEADERREGIONS",
"{",
"return",
"errors",
".",
"New",
"("... | // Write the header out, adding a region tag encompassing all the existing tags. | [
"Write",
"the",
"header",
"out",
"adding",
"a",
"region",
"tag",
"encompassing",
"all",
"the",
"existing",
"tags",
"."
] | c37ab0fd127a1e43f40d0ba2250302e20eaee937 | https://github.com/sassoftware/go-rpmutils/blob/c37ab0fd127a1e43f40d0ba2250302e20eaee937/writeheader.go#L71-L121 |
18,201 | sassoftware/go-rpmutils | writeheader.go | DumpSignatureHeader | func (hdr *RpmHeader) DumpSignatureHeader(sameSize bool) ([]byte, error) {
if len(hdr.lead) != 96 {
return nil, errors.New("invalid or missing RPM lead")
}
sigh := hdr.sigHeader
regionTag := RPMTAG_HEADERSIGNATURES
delete(sigh.entries, SIG_RESERVEDSPACE-_SIGHEADER_TAG_BASE)
if sameSize {
needed, err := sigh.s... | go | func (hdr *RpmHeader) DumpSignatureHeader(sameSize bool) ([]byte, error) {
if len(hdr.lead) != 96 {
return nil, errors.New("invalid or missing RPM lead")
}
sigh := hdr.sigHeader
regionTag := RPMTAG_HEADERSIGNATURES
delete(sigh.entries, SIG_RESERVEDSPACE-_SIGHEADER_TAG_BASE)
if sameSize {
needed, err := sigh.s... | [
"func",
"(",
"hdr",
"*",
"RpmHeader",
")",
"DumpSignatureHeader",
"(",
"sameSize",
"bool",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"hdr",
".",
"lead",
")",
"!=",
"96",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
... | // Dump the lead and signature header, optionally adding or changing padding to
// make it the same size as when it was originally read. Otherwise padding is
// removed to make it as small as possible. | [
"Dump",
"the",
"lead",
"and",
"signature",
"header",
"optionally",
"adding",
"or",
"changing",
"padding",
"to",
"make",
"it",
"the",
"same",
"size",
"as",
"when",
"it",
"was",
"originally",
"read",
".",
"Otherwise",
"padding",
"is",
"removed",
"to",
"make",
... | c37ab0fd127a1e43f40d0ba2250302e20eaee937 | https://github.com/sassoftware/go-rpmutils/blob/c37ab0fd127a1e43f40d0ba2250302e20eaee937/writeheader.go#L145-L174 |
18,202 | marksalpeter/token | Token.go | Encode | func (t Token) Encode() string {
bs, _ := t.MarshalText()
return string(bs)
} | go | func (t Token) Encode() string {
bs, _ := t.MarshalText()
return string(bs)
} | [
"func",
"(",
"t",
"Token",
")",
"Encode",
"(",
")",
"string",
"{",
"bs",
",",
"_",
":=",
"t",
".",
"MarshalText",
"(",
")",
"\n",
"return",
"string",
"(",
"bs",
")",
"\n",
"}"
] | // Encode encodes the token into a base62 string | [
"Encode",
"encodes",
"the",
"token",
"into",
"a",
"base62",
"string"
] | 27d8e59762a88663f89b6cf73cd01a485fae47e6 | https://github.com/marksalpeter/token/blob/27d8e59762a88663f89b6cf73cd01a485fae47e6/Token.go#L52-L55 |
18,203 | marksalpeter/token | Token.go | MarshalText | func (t Token) MarshalText() ([]byte, error) {
number := uint64(t)
var chars []byte
if number == 0 {
return chars, nil
}
for number > 0 {
result := number / base62Len
remainder := number % base62Len
chars = append(chars, Base62[remainder])
number = result
}
for i, j := 0, len(chars)-1; i < j; i, j =... | go | func (t Token) MarshalText() ([]byte, error) {
number := uint64(t)
var chars []byte
if number == 0 {
return chars, nil
}
for number > 0 {
result := number / base62Len
remainder := number % base62Len
chars = append(chars, Base62[remainder])
number = result
}
for i, j := 0, len(chars)-1; i < j; i, j =... | [
"func",
"(",
"t",
"Token",
")",
"MarshalText",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"number",
":=",
"uint64",
"(",
"t",
")",
"\n",
"var",
"chars",
"[",
"]",
"byte",
"\n\n",
"if",
"number",
"==",
"0",
"{",
"return",
"chars",
... | // MarshalText implements the `encoding.TextMarsheler` interface | [
"MarshalText",
"implements",
"the",
"encoding",
".",
"TextMarsheler",
"interface"
] | 27d8e59762a88663f89b6cf73cd01a485fae47e6 | https://github.com/marksalpeter/token/blob/27d8e59762a88663f89b6cf73cd01a485fae47e6/Token.go#L89-L109 |
18,204 | marksalpeter/token | Token.go | Decode | func Decode(token string) (Token, error) {
var t Token
err := (&t).UnmarshalText([]byte(token))
return t, err
} | go | func Decode(token string) (Token, error) {
var t Token
err := (&t).UnmarshalText([]byte(token))
return t, err
} | [
"func",
"Decode",
"(",
"token",
"string",
")",
"(",
"Token",
",",
"error",
")",
"{",
"var",
"t",
"Token",
"\n",
"err",
":=",
"(",
"&",
"t",
")",
".",
"UnmarshalText",
"(",
"[",
"]",
"byte",
"(",
"token",
")",
")",
"\n",
"return",
"t",
",",
"err... | // Decode returns a token from a 1-12 character base62 encoded string | [
"Decode",
"returns",
"a",
"token",
"from",
"a",
"1",
"-",
"12",
"character",
"base62",
"encoded",
"string"
] | 27d8e59762a88663f89b6cf73cd01a485fae47e6 | https://github.com/marksalpeter/token/blob/27d8e59762a88663f89b6cf73cd01a485fae47e6/Token.go#L135-L139 |
18,205 | marksalpeter/token | Token.go | maxHashInt | func maxHashInt(length int) uint64 {
return uint64(math.Max(0, math.Min(math.MaxUint64, math.Pow(float64(base62Len), float64(length)))))
} | go | func maxHashInt(length int) uint64 {
return uint64(math.Max(0, math.Min(math.MaxUint64, math.Pow(float64(base62Len), float64(length)))))
} | [
"func",
"maxHashInt",
"(",
"length",
"int",
")",
"uint64",
"{",
"return",
"uint64",
"(",
"math",
".",
"Max",
"(",
"0",
",",
"math",
".",
"Min",
"(",
"math",
".",
"MaxUint64",
",",
"math",
".",
"Pow",
"(",
"float64",
"(",
"base62Len",
")",
",",
"flo... | // maxHashInt returns the largest possible int that will yeild a base62 encoded token of the specified length | [
"maxHashInt",
"returns",
"the",
"largest",
"possible",
"int",
"that",
"will",
"yeild",
"a",
"base62",
"encoded",
"token",
"of",
"the",
"specified",
"length"
] | 27d8e59762a88663f89b6cf73cd01a485fae47e6 | https://github.com/marksalpeter/token/blob/27d8e59762a88663f89b6cf73cd01a485fae47e6/Token.go#L142-L144 |
18,206 | crackcomm/nsqueue | consumer/consumer.go | New | func New() *Consumer {
return &Consumer{
Logger: nsqlog.Logger,
LogLevel: nsqlog.LogLevel,
handlers: make(map[topicChan]*queue),
}
} | go | func New() *Consumer {
return &Consumer{
Logger: nsqlog.Logger,
LogLevel: nsqlog.LogLevel,
handlers: make(map[topicChan]*queue),
}
} | [
"func",
"New",
"(",
")",
"*",
"Consumer",
"{",
"return",
"&",
"Consumer",
"{",
"Logger",
":",
"nsqlog",
".",
"Logger",
",",
"LogLevel",
":",
"nsqlog",
".",
"LogLevel",
",",
"handlers",
":",
"make",
"(",
"map",
"[",
"topicChan",
"]",
"*",
"queue",
")"... | // New - Creates a new consumer structure | [
"New",
"-",
"Creates",
"a",
"new",
"consumer",
"structure"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/consumer.go#L28-L34 |
18,207 | crackcomm/nsqueue | consumer/consumer.go | Connect | func (c *Consumer) Connect(addrs ...string) error {
for _, q := range c.handlers {
for _, addr := range addrs {
if err := q.ConnectToNSQD(addr); err != nil {
return err
}
}
}
return nil
} | go | func (c *Consumer) Connect(addrs ...string) error {
for _, q := range c.handlers {
for _, addr := range addrs {
if err := q.ConnectToNSQD(addr); err != nil {
return err
}
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"Connect",
"(",
"addrs",
"...",
"string",
")",
"error",
"{",
"for",
"_",
",",
"q",
":=",
"range",
"c",
".",
"handlers",
"{",
"for",
"_",
",",
"addr",
":=",
"range",
"addrs",
"{",
"if",
"err",
":=",
"q",
"... | // Connect - Connects all readers to NSQ | [
"Connect",
"-",
"Connects",
"all",
"readers",
"to",
"NSQ"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/consumer.go#L64-L73 |
18,208 | crackcomm/nsqueue | consumer/consumer.go | ConnectLookupd | func (c *Consumer) ConnectLookupd(addrs ...string) error {
for _, q := range c.handlers {
for _, addr := range addrs {
if err := q.ConnectToNSQLookupd(addr); err != nil {
return err
}
}
}
return nil
} | go | func (c *Consumer) ConnectLookupd(addrs ...string) error {
for _, q := range c.handlers {
for _, addr := range addrs {
if err := q.ConnectToNSQLookupd(addr); err != nil {
return err
}
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"ConnectLookupd",
"(",
"addrs",
"...",
"string",
")",
"error",
"{",
"for",
"_",
",",
"q",
":=",
"range",
"c",
".",
"handlers",
"{",
"for",
"_",
",",
"addr",
":=",
"range",
"addrs",
"{",
"if",
"err",
":=",
"... | // ConnectLookupd - Connects all readers to NSQ lookupd | [
"ConnectLookupd",
"-",
"Connects",
"all",
"readers",
"to",
"NSQ",
"lookupd"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/consumer.go#L76-L85 |
18,209 | crackcomm/nsqueue | consumer/consumer.go | Start | func (c *Consumer) Start(debug bool) error {
if debug {
for i := range c.handlers {
log.Printf("Handler: topic=%s channel=%s\n", i.topic, i.channel)
}
}
<-make(chan bool)
return nil
} | go | func (c *Consumer) Start(debug bool) error {
if debug {
for i := range c.handlers {
log.Printf("Handler: topic=%s channel=%s\n", i.topic, i.channel)
}
}
<-make(chan bool)
return nil
} | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"Start",
"(",
"debug",
"bool",
")",
"error",
"{",
"if",
"debug",
"{",
"for",
"i",
":=",
"range",
"c",
".",
"handlers",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"i",
".",
"topic",
",",
"i",
... | // Start - Just waits | [
"Start",
"-",
"Just",
"waits"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/consumer.go#L88-L96 |
18,210 | crackcomm/nsqueue | consumer/message.go | WithMessage | func WithMessage(ctx context.Context, msg *Message) context.Context {
return context.WithValue(ctx, msgkey, msg)
} | go | func WithMessage(ctx context.Context, msg *Message) context.Context {
return context.WithValue(ctx, msgkey, msg)
} | [
"func",
"WithMessage",
"(",
"ctx",
"context",
".",
"Context",
",",
"msg",
"*",
"Message",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"msgkey",
",",
"msg",
")",
"\n",
"}"
] | // WithMessage - Returns nsq message from context. | [
"WithMessage",
"-",
"Returns",
"nsq",
"message",
"from",
"context",
"."
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/message.go#L18-L20 |
18,211 | crackcomm/nsqueue | consumer/message.go | MessageFromContext | func MessageFromContext(ctx context.Context) (*Message, bool) {
value, ok := ctx.Value(msgkey).(*Message)
return value, ok
} | go | func MessageFromContext(ctx context.Context) (*Message, bool) {
value, ok := ctx.Value(msgkey).(*Message)
return value, ok
} | [
"func",
"MessageFromContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"Message",
",",
"bool",
")",
"{",
"value",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"msgkey",
")",
".",
"(",
"*",
"Message",
")",
"\n",
"return",
"value",
",",
"o... | // MessageFromContext - Returns nsq message from context. | [
"MessageFromContext",
"-",
"Returns",
"nsq",
"message",
"from",
"context",
"."
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/message.go#L23-L26 |
18,212 | crackcomm/nsqueue | consumer/message.go | Finish | func (m *Message) Finish(success bool) {
if success {
m.Message.Finish()
} else {
m.Message.Requeue(-1)
}
} | go | func (m *Message) Finish(success bool) {
if success {
m.Message.Finish()
} else {
m.Message.Requeue(-1)
}
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"Finish",
"(",
"success",
"bool",
")",
"{",
"if",
"success",
"{",
"m",
".",
"Message",
".",
"Finish",
"(",
")",
"\n",
"}",
"else",
"{",
"m",
".",
"Message",
".",
"Requeue",
"(",
"-",
"1",
")",
"\n",
"}",
... | // Finish - Finish processing message | [
"Finish",
"-",
"Finish",
"processing",
"message"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/message.go#L44-L50 |
18,213 | crackcomm/nsqueue | consumer/message.go | ReadJSON | func (m *Message) ReadJSON(v interface{}) error {
return json.Unmarshal(m.Body, v)
} | go | func (m *Message) ReadJSON(v interface{}) error {
return json.Unmarshal(m.Body, v)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"ReadJSON",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"json",
".",
"Unmarshal",
"(",
"m",
".",
"Body",
",",
"v",
")",
"\n",
"}"
] | // ReadJSON - Unmarshals JSON message body to interface. | [
"ReadJSON",
"-",
"Unmarshals",
"JSON",
"message",
"body",
"to",
"interface",
"."
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/consumer/message.go#L53-L55 |
18,214 | crackcomm/nsqueue | producer/default.go | Publish | func Publish(topic string, body []byte) error {
return DefaultProducer.Publish(topic, body)
} | go | func Publish(topic string, body []byte) error {
return DefaultProducer.Publish(topic, body)
} | [
"func",
"Publish",
"(",
"topic",
"string",
",",
"body",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"DefaultProducer",
".",
"Publish",
"(",
"topic",
",",
"body",
")",
"\n",
"}"
] | // Publish - sends message to nsq topic | [
"Publish",
"-",
"sends",
"message",
"to",
"nsq",
"topic"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/default.go#L15-L17 |
18,215 | crackcomm/nsqueue | producer/default.go | PublishAsync | func PublishAsync(topic string, body []byte, doneChan chan *nsq.ProducerTransaction, args ...interface{}) error {
return DefaultProducer.PublishAsync(topic, body, doneChan, args...)
} | go | func PublishAsync(topic string, body []byte, doneChan chan *nsq.ProducerTransaction, args ...interface{}) error {
return DefaultProducer.PublishAsync(topic, body, doneChan, args...)
} | [
"func",
"PublishAsync",
"(",
"topic",
"string",
",",
"body",
"[",
"]",
"byte",
",",
"doneChan",
"chan",
"*",
"nsq",
".",
"ProducerTransaction",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"DefaultProducer",
".",
"PublishAsync",
... | // PublishAsync - sends a message to nsq topic asynchronously | [
"PublishAsync",
"-",
"sends",
"a",
"message",
"to",
"nsq",
"topic",
"asynchronously"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/default.go#L30-L32 |
18,216 | crackcomm/nsqueue | producer/default.go | MultiPublish | func MultiPublish(topic string, body [][]byte) error {
return DefaultProducer.MultiPublish(topic, body)
} | go | func MultiPublish(topic string, body [][]byte) error {
return DefaultProducer.MultiPublish(topic, body)
} | [
"func",
"MultiPublish",
"(",
"topic",
"string",
",",
"body",
"[",
"]",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"DefaultProducer",
".",
"MultiPublish",
"(",
"topic",
",",
"body",
")",
"\n",
"}"
] | // MultiPublish - sends multiple message to to nsq topic | [
"MultiPublish",
"-",
"sends",
"multiple",
"message",
"to",
"to",
"nsq",
"topic"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/default.go#L35-L37 |
18,217 | crackcomm/nsqueue | producer/default.go | ConnectConfig | func ConnectConfig(addr string, config *nsq.Config) error {
return DefaultProducer.ConnectConfig(addr, config)
} | go | func ConnectConfig(addr string, config *nsq.Config) error {
return DefaultProducer.ConnectConfig(addr, config)
} | [
"func",
"ConnectConfig",
"(",
"addr",
"string",
",",
"config",
"*",
"nsq",
".",
"Config",
")",
"error",
"{",
"return",
"DefaultProducer",
".",
"ConnectConfig",
"(",
"addr",
",",
"config",
")",
"\n",
"}"
] | // ConnectConfig method initialize the connection to nsq with config | [
"ConnectConfig",
"method",
"initialize",
"the",
"connection",
"to",
"nsq",
"with",
"config"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/default.go#L50-L52 |
18,218 | crackcomm/nsqueue | producer/producer.go | Connect | func (p *Producer) Connect(addr string) (err error) {
return p.ConnectConfig(addr, nsq.NewConfig())
} | go | func (p *Producer) Connect(addr string) (err error) {
return p.ConnectConfig(addr, nsq.NewConfig())
} | [
"func",
"(",
"p",
"*",
"Producer",
")",
"Connect",
"(",
"addr",
"string",
")",
"(",
"err",
"error",
")",
"{",
"return",
"p",
".",
"ConnectConfig",
"(",
"addr",
",",
"nsq",
".",
"NewConfig",
"(",
")",
")",
"\n",
"}"
] | // Connect - Connects prodocuer to nsq instance. | [
"Connect",
"-",
"Connects",
"prodocuer",
"to",
"nsq",
"instance",
"."
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/producer.go#L28-L30 |
18,219 | crackcomm/nsqueue | producer/producer.go | ConnectConfig | func (p *Producer) ConnectConfig(addr string, config *nsq.Config) (err error) {
p.Producer, err = nsq.NewProducer(addr, config)
p.Producer.SetLogger(p.Logger, p.LogLevel)
return
} | go | func (p *Producer) ConnectConfig(addr string, config *nsq.Config) (err error) {
p.Producer, err = nsq.NewProducer(addr, config)
p.Producer.SetLogger(p.Logger, p.LogLevel)
return
} | [
"func",
"(",
"p",
"*",
"Producer",
")",
"ConnectConfig",
"(",
"addr",
"string",
",",
"config",
"*",
"nsq",
".",
"Config",
")",
"(",
"err",
"error",
")",
"{",
"p",
".",
"Producer",
",",
"err",
"=",
"nsq",
".",
"NewProducer",
"(",
"addr",
",",
"confi... | // ConnectConfig method initialize the connection to nsq with config. | [
"ConnectConfig",
"method",
"initialize",
"the",
"connection",
"to",
"nsq",
"with",
"config",
"."
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/producer.go#L33-L37 |
18,220 | crackcomm/nsqueue | producer/producer.go | PublishJSON | func (p *Producer) PublishJSON(topic string, v interface{}) error {
body, err := json.Marshal(v)
if err != nil {
return err
}
return p.Publish(topic, body)
} | go | func (p *Producer) PublishJSON(topic string, v interface{}) error {
body, err := json.Marshal(v)
if err != nil {
return err
}
return p.Publish(topic, body)
} | [
"func",
"(",
"p",
"*",
"Producer",
")",
"PublishJSON",
"(",
"topic",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"body",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"er... | // PublishJSON - sends message to nsq topic in json format | [
"PublishJSON",
"-",
"sends",
"message",
"to",
"nsq",
"topic",
"in",
"json",
"format"
] | 6ee4382f836581113c3c3a6f8ee765138add72b3 | https://github.com/crackcomm/nsqueue/blob/6ee4382f836581113c3c3a6f8ee765138add72b3/producer/producer.go#L49-L55 |
18,221 | atlassian/smith | pkg/store/crd.go | Get | func (s *Crd) Get(resource schema.GroupKind) (*apiext_v1b1.CustomResourceDefinition, error) {
objs, err := s.byIndex(byGroupKindIndexName, byGroupKindIndexKey(resource.Group, resource.Kind))
if err != nil {
return nil, err
}
switch len(objs) {
case 0:
return nil, nil
case 1:
crd := objs[0].(*apiext_v1b1.Cus... | go | func (s *Crd) Get(resource schema.GroupKind) (*apiext_v1b1.CustomResourceDefinition, error) {
objs, err := s.byIndex(byGroupKindIndexName, byGroupKindIndexKey(resource.Group, resource.Kind))
if err != nil {
return nil, err
}
switch len(objs) {
case 0:
return nil, nil
case 1:
crd := objs[0].(*apiext_v1b1.Cus... | [
"func",
"(",
"s",
"*",
"Crd",
")",
"Get",
"(",
"resource",
"schema",
".",
"GroupKind",
")",
"(",
"*",
"apiext_v1b1",
".",
"CustomResourceDefinition",
",",
"error",
")",
"{",
"objs",
",",
"err",
":=",
"s",
".",
"byIndex",
"(",
"byGroupKindIndexName",
",",... | // Get returns the CRD that defines the resource of provided group and kind. | [
"Get",
"returns",
"the",
"CRD",
"that",
"defines",
"the",
"resource",
"of",
"provided",
"group",
"and",
"kind",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/crd.go#L31-L49 |
18,222 | atlassian/smith | pkg/store/multi.go | AddInformer | func (s *Multi) AddInformer(gvk schema.GroupVersionKind, informer cache.SharedIndexInformer) error {
s.mx.Lock()
defer s.mx.Unlock()
if _, ok := s.informers[gvk]; ok {
return errors.New("informer is already registered")
}
f := informer.GetIndexer().GetIndexers()[ByNamespaceAndControllerUIDIndex]
if f == nil {
... | go | func (s *Multi) AddInformer(gvk schema.GroupVersionKind, informer cache.SharedIndexInformer) error {
s.mx.Lock()
defer s.mx.Unlock()
if _, ok := s.informers[gvk]; ok {
return errors.New("informer is already registered")
}
f := informer.GetIndexer().GetIndexers()[ByNamespaceAndControllerUIDIndex]
if f == nil {
... | [
"func",
"(",
"s",
"*",
"Multi",
")",
"AddInformer",
"(",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"informer",
"cache",
".",
"SharedIndexInformer",
")",
"error",
"{",
"s",
".",
"mx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mx",
".",
"Un... | // AddInformer adds an Informer to the store.
// Can only be called with a not yet started informer. Otherwise bad things will happen. | [
"AddInformer",
"adds",
"an",
"Informer",
"to",
"the",
"store",
".",
"Can",
"only",
"be",
"called",
"with",
"a",
"not",
"yet",
"started",
"informer",
".",
"Otherwise",
"bad",
"things",
"will",
"happen",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/multi.go#L28-L46 |
18,223 | atlassian/smith | pkg/specchecker/hash.go | HashConfigMap | func HashConfigMap(configMap *core_v1.ConfigMap, h hash.Hash, filter sets.String) bool {
keys := make([]string, 0, len(configMap.Data))
search := sets.NewString(filter.UnsortedList()...)
for k := range configMap.Data {
if filter.Len() == 0 || filter.Has(k) {
keys = append(keys, k)
}
}
for k := range configM... | go | func HashConfigMap(configMap *core_v1.ConfigMap, h hash.Hash, filter sets.String) bool {
keys := make([]string, 0, len(configMap.Data))
search := sets.NewString(filter.UnsortedList()...)
for k := range configMap.Data {
if filter.Len() == 0 || filter.Has(k) {
keys = append(keys, k)
}
}
for k := range configM... | [
"func",
"HashConfigMap",
"(",
"configMap",
"*",
"core_v1",
".",
"ConfigMap",
",",
"h",
"hash",
".",
"Hash",
",",
"filter",
"sets",
".",
"String",
")",
"bool",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"configMap",... | // HashConfigMap hashes the sorted values in the ConfigMap in sorted order
// with a NUL as a separator character between and within pairs of key + value. | [
"HashConfigMap",
"hashes",
"the",
"sorted",
"values",
"in",
"the",
"ConfigMap",
"in",
"sorted",
"order",
"with",
"a",
"NUL",
"as",
"a",
"separator",
"character",
"between",
"and",
"within",
"pairs",
"of",
"key",
"+",
"value",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/specchecker/hash.go#L55-L91 |
18,224 | atlassian/smith | pkg/specchecker/hash.go | HashSecret | func HashSecret(secret *core_v1.Secret, h hash.Hash, filter sets.String) bool {
keys := make([]string, 0, len(secret.Data))
search := sets.NewString(filter.UnsortedList()...)
for k := range secret.Data {
if filter.Len() == 0 || filter.Has(k) {
keys = append(keys, k)
}
}
search.Delete(keys...)
if search.Len... | go | func HashSecret(secret *core_v1.Secret, h hash.Hash, filter sets.String) bool {
keys := make([]string, 0, len(secret.Data))
search := sets.NewString(filter.UnsortedList()...)
for k := range secret.Data {
if filter.Len() == 0 || filter.Has(k) {
keys = append(keys, k)
}
}
search.Delete(keys...)
if search.Len... | [
"func",
"HashSecret",
"(",
"secret",
"*",
"core_v1",
".",
"Secret",
",",
"h",
"hash",
".",
"Hash",
",",
"filter",
"sets",
".",
"String",
")",
"bool",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"secret",
".",
"D... | // HashSecret hashes the sorted values in the secret in sorted order
// with a NUL as a separator character between and within pairs of key + value. | [
"HashSecret",
"hashes",
"the",
"sorted",
"values",
"in",
"the",
"secret",
"in",
"sorted",
"order",
"with",
"a",
"NUL",
"as",
"a",
"separator",
"character",
"between",
"and",
"within",
"pairs",
"of",
"key",
"+",
"value",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/specchecker/hash.go#L95-L117 |
18,225 | atlassian/smith | pkg/client/clientset_generated/clientset/typed/smith/v1/bundle.go | newBundles | func newBundles(c *SmithV1Client, namespace string) *bundles {
return &bundles{
client: c.RESTClient(),
ns: namespace,
}
} | go | func newBundles(c *SmithV1Client, namespace string) *bundles {
return &bundles{
client: c.RESTClient(),
ns: namespace,
}
} | [
"func",
"newBundles",
"(",
"c",
"*",
"SmithV1Client",
",",
"namespace",
"string",
")",
"*",
"bundles",
"{",
"return",
"&",
"bundles",
"{",
"client",
":",
"c",
".",
"RESTClient",
"(",
")",
",",
"ns",
":",
"namespace",
",",
"}",
"\n",
"}"
] | // newBundles returns a Bundles | [
"newBundles",
"returns",
"a",
"Bundles"
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/typed/smith/v1/bundle.go#L45-L50 |
18,226 | atlassian/smith | pkg/resources/crd_helpers.go | IsCrdConditionTrue | func IsCrdConditionTrue(crd *apiext_v1b1.CustomResourceDefinition, conditionType apiext_v1b1.CustomResourceDefinitionConditionType) bool {
return IsCrdConditionPresentAndEqual(crd, conditionType, apiext_v1b1.ConditionTrue)
} | go | func IsCrdConditionTrue(crd *apiext_v1b1.CustomResourceDefinition, conditionType apiext_v1b1.CustomResourceDefinitionConditionType) bool {
return IsCrdConditionPresentAndEqual(crd, conditionType, apiext_v1b1.ConditionTrue)
} | [
"func",
"IsCrdConditionTrue",
"(",
"crd",
"*",
"apiext_v1b1",
".",
"CustomResourceDefinition",
",",
"conditionType",
"apiext_v1b1",
".",
"CustomResourceDefinitionConditionType",
")",
"bool",
"{",
"return",
"IsCrdConditionPresentAndEqual",
"(",
"crd",
",",
"conditionType",
... | // IsCrdConditionTrue indicates if the condition is present and strictly true | [
"IsCrdConditionTrue",
"indicates",
"if",
"the",
"condition",
"is",
"present",
"and",
"strictly",
"true"
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/resources/crd_helpers.go#L133-L135 |
18,227 | atlassian/smith | pkg/store/multi_basic.go | AddInformer | func (s *MultiBasic) AddInformer(gvk schema.GroupVersionKind, informer cache.SharedIndexInformer) error {
s.mx.Lock()
defer s.mx.Unlock()
if _, ok := s.informers[gvk]; ok {
return errors.New("informer is already registered")
}
s.informers[gvk] = informer
return nil
} | go | func (s *MultiBasic) AddInformer(gvk schema.GroupVersionKind, informer cache.SharedIndexInformer) error {
s.mx.Lock()
defer s.mx.Unlock()
if _, ok := s.informers[gvk]; ok {
return errors.New("informer is already registered")
}
s.informers[gvk] = informer
return nil
} | [
"func",
"(",
"s",
"*",
"MultiBasic",
")",
"AddInformer",
"(",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"informer",
"cache",
".",
"SharedIndexInformer",
")",
"error",
"{",
"s",
".",
"mx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mx",
".",
... | // AddInformer adds an Informer to the store. | [
"AddInformer",
"adds",
"an",
"Informer",
"to",
"the",
"store",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/multi_basic.go#L25-L33 |
18,228 | atlassian/smith | pkg/store/multi_basic.go | GetInformers | func (s *MultiBasic) GetInformers() map[schema.GroupVersionKind]cache.SharedIndexInformer {
s.mx.RLock()
defer s.mx.RUnlock()
informers := make(map[schema.GroupVersionKind]cache.SharedIndexInformer, len(s.informers))
for gvk, inf := range s.informers {
informers[gvk] = inf
}
return informers
} | go | func (s *MultiBasic) GetInformers() map[schema.GroupVersionKind]cache.SharedIndexInformer {
s.mx.RLock()
defer s.mx.RUnlock()
informers := make(map[schema.GroupVersionKind]cache.SharedIndexInformer, len(s.informers))
for gvk, inf := range s.informers {
informers[gvk] = inf
}
return informers
} | [
"func",
"(",
"s",
"*",
"MultiBasic",
")",
"GetInformers",
"(",
")",
"map",
"[",
"schema",
".",
"GroupVersionKind",
"]",
"cache",
".",
"SharedIndexInformer",
"{",
"s",
".",
"mx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"mx",
".",
"RUnlock",
"... | // GetInformers gets all registered Informers. | [
"GetInformers",
"gets",
"all",
"registered",
"Informers",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/multi_basic.go#L46-L54 |
18,229 | atlassian/smith | pkg/store/multi_basic.go | Get | func (s *MultiBasic) Get(gvk schema.GroupVersionKind, namespace, name string) (obj runtime.Object, exists bool, e error) {
var informer cache.SharedIndexInformer
func() {
s.mx.RLock()
defer s.mx.RUnlock()
informer = s.informers[gvk]
}()
if informer == nil {
return nil, false, errors.Errorf("no informer for ... | go | func (s *MultiBasic) Get(gvk schema.GroupVersionKind, namespace, name string) (obj runtime.Object, exists bool, e error) {
var informer cache.SharedIndexInformer
func() {
s.mx.RLock()
defer s.mx.RUnlock()
informer = s.informers[gvk]
}()
if informer == nil {
return nil, false, errors.Errorf("no informer for ... | [
"func",
"(",
"s",
"*",
"MultiBasic",
")",
"Get",
"(",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"namespace",
",",
"name",
"string",
")",
"(",
"obj",
"runtime",
".",
"Object",
",",
"exists",
"bool",
",",
"e",
"error",
")",
"{",
"var",
"informer",
... | // Get looks up object of specified GVK in the specified namespace by name.
// A deep copy of the object is returned so it is safe to modify it. | [
"Get",
"looks",
"up",
"object",
"of",
"specified",
"GVK",
"in",
"the",
"specified",
"namespace",
"by",
"name",
".",
"A",
"deep",
"copy",
"of",
"the",
"object",
"is",
"returned",
"so",
"it",
"is",
"safe",
"to",
"modify",
"it",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/multi_basic.go#L58-L69 |
18,230 | atlassian/smith | pkg/specchecker/checker.go | BeforeCreate | func (c *Checker) BeforeCreate(logger *zap.Logger, spec *unstructured.Unstructured) (*unstructured.Unstructured /*updatedSpec*/, error) {
processor, ok := c.KnownTypes[spec.GroupVersionKind().GroupKind()]
if !ok {
return spec, nil
}
ctx := &Context{
Logger: logger,
Store: c.Store,
}
updatedSpec, err := pro... | go | func (c *Checker) BeforeCreate(logger *zap.Logger, spec *unstructured.Unstructured) (*unstructured.Unstructured /*updatedSpec*/, error) {
processor, ok := c.KnownTypes[spec.GroupVersionKind().GroupKind()]
if !ok {
return spec, nil
}
ctx := &Context{
Logger: logger,
Store: c.Store,
}
updatedSpec, err := pro... | [
"func",
"(",
"c",
"*",
"Checker",
")",
"BeforeCreate",
"(",
"logger",
"*",
"zap",
".",
"Logger",
",",
"spec",
"*",
"unstructured",
".",
"Unstructured",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
"/*updatedSpec*/",
",",
"error",
")",
"{",
"processo... | // BeforeCreate pre-processes object specification and returns an updated version. | [
"BeforeCreate",
"pre",
"-",
"processes",
"object",
"specification",
"and",
"returns",
"an",
"updated",
"version",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/specchecker/checker.go#L38-L52 |
18,231 | atlassian/smith | pkg/specchecker/builtin/process_service_instance.go | setSecretParametersChecksumAnnotation | func (s serviceInstance) setSecretParametersChecksumAnnotation(ctx *specchecker.Context, spec, actual *sc_v1b1.ServiceInstance) error {
if spec.Annotations[SecretParametersChecksumAnnotation] == Disabled {
return nil
}
var previousEncodedChecksum string
var updateCount int64
if actual != nil {
previousEncoded... | go | func (s serviceInstance) setSecretParametersChecksumAnnotation(ctx *specchecker.Context, spec, actual *sc_v1b1.ServiceInstance) error {
if spec.Annotations[SecretParametersChecksumAnnotation] == Disabled {
return nil
}
var previousEncodedChecksum string
var updateCount int64
if actual != nil {
previousEncoded... | [
"func",
"(",
"s",
"serviceInstance",
")",
"setSecretParametersChecksumAnnotation",
"(",
"ctx",
"*",
"specchecker",
".",
"Context",
",",
"spec",
",",
"actual",
"*",
"sc_v1b1",
".",
"ServiceInstance",
")",
"error",
"{",
"if",
"spec",
".",
"Annotations",
"[",
"Se... | // works around the fact that service catalog does not know when to send an update request if the
// parameters section would change as the result of changing a secret referenced in parametersFrom. To
// do this we record the contents of all referenced secrets in an annotation, compare that annotations value
// each ti... | [
"works",
"around",
"the",
"fact",
"that",
"service",
"catalog",
"does",
"not",
"know",
"when",
"to",
"send",
"an",
"update",
"request",
"if",
"the",
"parameters",
"section",
"would",
"change",
"as",
"the",
"result",
"of",
"changing",
"a",
"secret",
"referenc... | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/specchecker/builtin/process_service_instance.go#L82-L106 |
18,232 | atlassian/smith | pkg/specchecker/builtin/process_deployment.go | setLastAppliedReplicasAnnotation | func (deployment) setLastAppliedReplicasAnnotation(ctx *specchecker.Context, spec, actual *apps_v1.Deployment) {
if spec.Annotations[LastAppliedReplicasAnnotation] == Disabled {
return
}
if spec.Spec.Replicas == nil {
var one int32 = 1
spec.Spec.Replicas = &one
}
specReplicas := *spec.Spec.Replicas
if act... | go | func (deployment) setLastAppliedReplicasAnnotation(ctx *specchecker.Context, spec, actual *apps_v1.Deployment) {
if spec.Annotations[LastAppliedReplicasAnnotation] == Disabled {
return
}
if spec.Spec.Replicas == nil {
var one int32 = 1
spec.Spec.Replicas = &one
}
specReplicas := *spec.Spec.Replicas
if act... | [
"func",
"(",
"deployment",
")",
"setLastAppliedReplicasAnnotation",
"(",
"ctx",
"*",
"specchecker",
".",
"Context",
",",
"spec",
",",
"actual",
"*",
"apps_v1",
".",
"Deployment",
")",
"{",
"if",
"spec",
".",
"Annotations",
"[",
"LastAppliedReplicasAnnotation",
"... | // setLastAppliedReplicasAnnotation updates replicas based on LastAppliedReplicas annotation and running config
// to avoid conflicts with other controllers like HPA.
// actual may be nil. | [
"setLastAppliedReplicasAnnotation",
"updates",
"replicas",
"based",
"on",
"LastAppliedReplicas",
"annotation",
"and",
"running",
"config",
"to",
"avoid",
"conflicts",
"with",
"other",
"controllers",
"like",
"HPA",
".",
"actual",
"may",
"be",
"nil",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/specchecker/builtin/process_deployment.go#L76-L120 |
18,233 | atlassian/smith | pkg/client/clientset_generated/clientset/fake/clientset_generated.go | SmithV1 | func (c *Clientset) SmithV1() smithv1.SmithV1Interface {
return &fakesmithv1.FakeSmithV1{Fake: &c.Fake}
} | go | func (c *Clientset) SmithV1() smithv1.SmithV1Interface {
return &fakesmithv1.FakeSmithV1{Fake: &c.Fake}
} | [
"func",
"(",
"c",
"*",
"Clientset",
")",
"SmithV1",
"(",
")",
"smithv1",
".",
"SmithV1Interface",
"{",
"return",
"&",
"fakesmithv1",
".",
"FakeSmithV1",
"{",
"Fake",
":",
"&",
"c",
".",
"Fake",
"}",
"\n",
"}"
] | // SmithV1 retrieves the SmithV1Client | [
"SmithV1",
"retrieves",
"the",
"SmithV1Client"
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/fake/clientset_generated.go#L61-L63 |
18,234 | atlassian/smith | pkg/client/clientset_generated/clientset/fake/clientset_generated.go | Smith | func (c *Clientset) Smith() smithv1.SmithV1Interface {
return &fakesmithv1.FakeSmithV1{Fake: &c.Fake}
} | go | func (c *Clientset) Smith() smithv1.SmithV1Interface {
return &fakesmithv1.FakeSmithV1{Fake: &c.Fake}
} | [
"func",
"(",
"c",
"*",
"Clientset",
")",
"Smith",
"(",
")",
"smithv1",
".",
"SmithV1Interface",
"{",
"return",
"&",
"fakesmithv1",
".",
"FakeSmithV1",
"{",
"Fake",
":",
"&",
"c",
".",
"Fake",
"}",
"\n",
"}"
] | // Smith retrieves the SmithV1Client | [
"Smith",
"retrieves",
"the",
"SmithV1Client"
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/fake/clientset_generated.go#L66-L68 |
18,235 | atlassian/smith | pkg/specchecker/builtin/process_util.go | setEmptyFieldsFromActual | func setEmptyFieldsFromActual(requested, actual interface{}, fields ...string) error {
requestedValue := reflect.ValueOf(requested).Elem()
actualValue := reflect.ValueOf(actual).Elem()
if requestedValue.Type() != actualValue.Type() {
return errors.Errorf("attempted to set fields from different types: %q from %q",... | go | func setEmptyFieldsFromActual(requested, actual interface{}, fields ...string) error {
requestedValue := reflect.ValueOf(requested).Elem()
actualValue := reflect.ValueOf(actual).Elem()
if requestedValue.Type() != actualValue.Type() {
return errors.Errorf("attempted to set fields from different types: %q from %q",... | [
"func",
"setEmptyFieldsFromActual",
"(",
"requested",
",",
"actual",
"interface",
"{",
"}",
",",
"fields",
"...",
"string",
")",
"error",
"{",
"requestedValue",
":=",
"reflect",
".",
"ValueOf",
"(",
"requested",
")",
".",
"Elem",
"(",
")",
"\n",
"actualValue... | // setFieldsFromActual mutates the target with fields from the instantiated object,
// iff that field was not set in the original object. | [
"setFieldsFromActual",
"mutates",
"the",
"target",
"with",
"fields",
"from",
"the",
"instantiated",
"object",
"iff",
"that",
"field",
"was",
"not",
"set",
"in",
"the",
"original",
"object",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/specchecker/builtin/process_util.go#L28-L53 |
18,236 | atlassian/smith | pkg/controller/bundlec/controller.go | Prepare | func (c *Controller) Prepare(crdInf cache.SharedIndexInformer, resourceInfs map[schema.GroupVersionKind]cache.SharedIndexInformer) error {
c.crdContext, c.crdContextCancel = context.WithCancel(context.Background())
crdInf.AddEventHandler(&crdEventHandler{
controller: c,
watchers: make(map[string]watchState),
}... | go | func (c *Controller) Prepare(crdInf cache.SharedIndexInformer, resourceInfs map[schema.GroupVersionKind]cache.SharedIndexInformer) error {
c.crdContext, c.crdContextCancel = context.WithCancel(context.Background())
crdInf.AddEventHandler(&crdEventHandler{
controller: c,
watchers: make(map[string]watchState),
}... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Prepare",
"(",
"crdInf",
"cache",
".",
"SharedIndexInformer",
",",
"resourceInfs",
"map",
"[",
"schema",
".",
"GroupVersionKind",
"]",
"cache",
".",
"SharedIndexInformer",
")",
"error",
"{",
"c",
".",
"crdContext",
... | // Prepare prepares the controller to be run. | [
"Prepare",
"prepares",
"the",
"controller",
"to",
"be",
"run",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/controller.go#L82-L158 |
18,237 | atlassian/smith | pkg/controller/bundlec/controller.go | Run | func (c *Controller) Run(ctx context.Context) {
defer c.wg.Wait()
defer c.crdContextCancel() // should be executed after stopping is set to true
defer func() {
c.wgLock.Lock()
defer c.wgLock.Unlock()
c.stopping = true
}()
c.Logger.Info("Starting Bundle controller")
defer c.Logger.Info("Shutting down Bundle... | go | func (c *Controller) Run(ctx context.Context) {
defer c.wg.Wait()
defer c.crdContextCancel() // should be executed after stopping is set to true
defer func() {
c.wgLock.Lock()
defer c.wgLock.Unlock()
c.stopping = true
}()
c.Logger.Info("Starting Bundle controller")
defer c.Logger.Info("Shutting down Bundle... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"defer",
"c",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"defer",
"c",
".",
"crdContextCancel",
"(",
")",
"// should be executed after stopping is set to true",
... | // Run begins watching and syncing.
// All informers must be synced before this method is invoked. | [
"Run",
"begins",
"watching",
"and",
"syncing",
".",
"All",
"informers",
"must",
"be",
"synced",
"before",
"this",
"method",
"is",
"invoked",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/controller.go#L162-L183 |
18,238 | atlassian/smith | pkg/controller/bundlec/controller.go | lookupBundleByObjectByIndex | func (c *Controller) lookupBundleByObjectByIndex(byIndex byIndexFunc, indexName string, indexKey indexKeyFunc) func(runtime.Object) ([]runtime.Object, error) {
return func(obj runtime.Object) ([]runtime.Object /*bundles*/, error) {
// obj is an object that is referred by some other object that might be in a Bundle
... | go | func (c *Controller) lookupBundleByObjectByIndex(byIndex byIndexFunc, indexName string, indexKey indexKeyFunc) func(runtime.Object) ([]runtime.Object, error) {
return func(obj runtime.Object) ([]runtime.Object /*bundles*/, error) {
// obj is an object that is referred by some other object that might be in a Bundle
... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"lookupBundleByObjectByIndex",
"(",
"byIndex",
"byIndexFunc",
",",
"indexName",
"string",
",",
"indexKey",
"indexKeyFunc",
")",
"func",
"(",
"runtime",
".",
"Object",
")",
"(",
"[",
"]",
"runtime",
".",
"Object",
","... | // lookupBundleByObjectByIndex returns a function that can be used to perform lookups of Bundles that contain
// objects returned from an index. | [
"lookupBundleByObjectByIndex",
"returns",
"a",
"function",
"that",
"can",
"be",
"used",
"to",
"perform",
"lookups",
"of",
"Bundles",
"that",
"contain",
"objects",
"returned",
"from",
"an",
"index",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/controller.go#L187-L231 |
18,239 | atlassian/smith | examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go | DeepCopy | func (in *Sleeper) DeepCopy() *Sleeper {
if in == nil {
return nil
}
out := new(Sleeper)
in.DeepCopyInto(out)
return out
} | go | func (in *Sleeper) DeepCopy() *Sleeper {
if in == nil {
return nil
}
out := new(Sleeper)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Sleeper",
")",
"DeepCopy",
"(",
")",
"*",
"Sleeper",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Sleeper",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sleeper. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Sleeper",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go#L24-L31 |
18,240 | atlassian/smith | examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go | DeepCopy | func (in *SleeperList) DeepCopy() *SleeperList {
if in == nil {
return nil
}
out := new(SleeperList)
in.DeepCopyInto(out)
return out
} | go | func (in *SleeperList) DeepCopy() *SleeperList {
if in == nil {
return nil
}
out := new(SleeperList)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SleeperList",
")",
"DeepCopy",
"(",
")",
"*",
"SleeperList",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SleeperList",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SleeperList. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SleeperList",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go#L57-L64 |
18,241 | atlassian/smith | examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go | DeepCopy | func (in *SleeperSpec) DeepCopy() *SleeperSpec {
if in == nil {
return nil
}
out := new(SleeperSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *SleeperSpec) DeepCopy() *SleeperSpec {
if in == nil {
return nil
}
out := new(SleeperSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SleeperSpec",
")",
"DeepCopy",
"(",
")",
"*",
"SleeperSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SleeperSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SleeperSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SleeperSpec",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go#L81-L88 |
18,242 | atlassian/smith | examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go | DeepCopy | func (in *SleeperStatus) DeepCopy() *SleeperStatus {
if in == nil {
return nil
}
out := new(SleeperStatus)
in.DeepCopyInto(out)
return out
} | go | func (in *SleeperStatus) DeepCopy() *SleeperStatus {
if in == nil {
return nil
}
out := new(SleeperStatus)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SleeperStatus",
")",
"DeepCopy",
"(",
")",
"*",
"SleeperStatus",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SleeperStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SleeperStatus. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SleeperStatus",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/examples/sleeper/pkg/apis/sleeper/v1/zz_generated.deepcopy.go#L97-L104 |
18,243 | atlassian/smith | pkg/store/bundle.go | Get | func (s *BundleStore) Get(namespace, bundleName string) (*smith_v1.Bundle, error) {
bundle, exists, err := s.store.Get(smith_v1.BundleGVK, namespace, bundleName)
if err != nil || !exists {
return nil, err
}
return bundle.(*smith_v1.Bundle), nil
} | go | func (s *BundleStore) Get(namespace, bundleName string) (*smith_v1.Bundle, error) {
bundle, exists, err := s.store.Get(smith_v1.BundleGVK, namespace, bundleName)
if err != nil || !exists {
return nil, err
}
return bundle.(*smith_v1.Bundle), nil
} | [
"func",
"(",
"s",
"*",
"BundleStore",
")",
"Get",
"(",
"namespace",
",",
"bundleName",
"string",
")",
"(",
"*",
"smith_v1",
".",
"Bundle",
",",
"error",
")",
"{",
"bundle",
",",
"exists",
",",
"err",
":=",
"s",
".",
"store",
".",
"Get",
"(",
"smith... | // Get returns a bundle by its namespace and name.
// nil is returned if bundle does not exist. | [
"Get",
"returns",
"a",
"bundle",
"by",
"its",
"namespace",
"and",
"name",
".",
"nil",
"is",
"returned",
"if",
"bundle",
"does",
"not",
"exist",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/bundle.go#L49-L55 |
18,244 | atlassian/smith | pkg/store/bundle.go | GetBundlesByCrd | func (s *BundleStore) GetBundlesByCrd(crd *apiext_v1b1.CustomResourceDefinition) ([]*smith_v1.Bundle, error) {
return s.getBundles(byCrdGroupKindIndexName, byCrdGroupKindIndexKey(crd.Spec.Group, crd.Spec.Names.Kind))
} | go | func (s *BundleStore) GetBundlesByCrd(crd *apiext_v1b1.CustomResourceDefinition) ([]*smith_v1.Bundle, error) {
return s.getBundles(byCrdGroupKindIndexName, byCrdGroupKindIndexKey(crd.Spec.Group, crd.Spec.Names.Kind))
} | [
"func",
"(",
"s",
"*",
"BundleStore",
")",
"GetBundlesByCrd",
"(",
"crd",
"*",
"apiext_v1b1",
".",
"CustomResourceDefinition",
")",
"(",
"[",
"]",
"*",
"smith_v1",
".",
"Bundle",
",",
"error",
")",
"{",
"return",
"s",
".",
"getBundles",
"(",
"byCrdGroupKin... | // GetBundlesByCrd returns Bundles which have a resource defined by CRD. | [
"GetBundlesByCrd",
"returns",
"Bundles",
"which",
"have",
"a",
"resource",
"defined",
"by",
"CRD",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/bundle.go#L58-L60 |
18,245 | atlassian/smith | pkg/store/bundle.go | GetBundlesByObject | func (s *BundleStore) GetBundlesByObject(gk schema.GroupKind, namespace, name string) ([]*smith_v1.Bundle, error) {
return s.getBundles(byObjectIndexName, byObjectIndexKey(gk, namespace, name))
} | go | func (s *BundleStore) GetBundlesByObject(gk schema.GroupKind, namespace, name string) ([]*smith_v1.Bundle, error) {
return s.getBundles(byObjectIndexName, byObjectIndexKey(gk, namespace, name))
} | [
"func",
"(",
"s",
"*",
"BundleStore",
")",
"GetBundlesByObject",
"(",
"gk",
"schema",
".",
"GroupKind",
",",
"namespace",
",",
"name",
"string",
")",
"(",
"[",
"]",
"*",
"smith_v1",
".",
"Bundle",
",",
"error",
")",
"{",
"return",
"s",
".",
"getBundles... | // GetBundlesByObject returns bundles where a resource with specified GVK, namespace and name is defined. | [
"GetBundlesByObject",
"returns",
"bundles",
"where",
"a",
"resource",
"with",
"specified",
"GVK",
"namespace",
"and",
"name",
"is",
"defined",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/store/bundle.go#L63-L65 |
18,246 | atlassian/smith | pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go | Get | func (c *FakeBundles) Get(name string, options v1.GetOptions) (result *smithv1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(bundlesResource, c.ns, name), &smithv1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*smithv1.Bundle), err
} | go | func (c *FakeBundles) Get(name string, options v1.GetOptions) (result *smithv1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(bundlesResource, c.ns, name), &smithv1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*smithv1.Bundle), err
} | [
"func",
"(",
"c",
"*",
"FakeBundles",
")",
"Get",
"(",
"name",
"string",
",",
"options",
"v1",
".",
"GetOptions",
")",
"(",
"result",
"*",
"smithv1",
".",
"Bundle",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"I... | // Get takes name of the bundle, and returns the corresponding bundle object, and an error if there is any. | [
"Get",
"takes",
"name",
"of",
"the",
"bundle",
"and",
"returns",
"the",
"corresponding",
"bundle",
"object",
"and",
"an",
"error",
"if",
"there",
"is",
"any",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go#L28-L36 |
18,247 | atlassian/smith | pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go | List | func (c *FakeBundles) List(opts v1.ListOptions) (result *smithv1.BundleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(bundlesResource, bundlesKind, c.ns, opts), &smithv1.BundleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {... | go | func (c *FakeBundles) List(opts v1.ListOptions) (result *smithv1.BundleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(bundlesResource, bundlesKind, c.ns, opts), &smithv1.BundleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {... | [
"func",
"(",
"c",
"*",
"FakeBundles",
")",
"List",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"result",
"*",
"smithv1",
".",
"BundleList",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing... | // List takes label and field selectors, and returns the list of Bundles that match those selectors. | [
"List",
"takes",
"label",
"and",
"field",
"selectors",
"and",
"returns",
"the",
"list",
"of",
"Bundles",
"that",
"match",
"those",
"selectors",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go#L39-L58 |
18,248 | atlassian/smith | pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go | Watch | func (c *FakeBundles) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(bundlesResource, c.ns, opts))
} | go | func (c *FakeBundles) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(bundlesResource, c.ns, opts))
} | [
"func",
"(",
"c",
"*",
"FakeBundles",
")",
"Watch",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"c",
".",
"Fake",
".",
"InvokesWatch",
"(",
"testing",
".",
"NewWatchAction",
"(",
"bundle... | // Watch returns a watch.Interface that watches the requested bundles. | [
"Watch",
"returns",
"a",
"watch",
".",
"Interface",
"that",
"watches",
"the",
"requested",
"bundles",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go#L61-L65 |
18,249 | atlassian/smith | pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go | Delete | func (c *FakeBundles) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(bundlesResource, c.ns, name), &smithv1.Bundle{})
return err
} | go | func (c *FakeBundles) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(bundlesResource, c.ns, name), &smithv1.Bundle{})
return err
} | [
"func",
"(",
"c",
"*",
"FakeBundles",
")",
"Delete",
"(",
"name",
"string",
",",
"options",
"*",
"v1",
".",
"DeleteOptions",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewDeleteAction",
"(",
"bun... | // Delete takes name of the bundle and deletes it. Returns an error if one occurs. | [
"Delete",
"takes",
"name",
"of",
"the",
"bundle",
"and",
"deletes",
"it",
".",
"Returns",
"an",
"error",
"if",
"one",
"occurs",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go#L102-L107 |
18,250 | atlassian/smith | pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go | Patch | func (c *FakeBundles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *smithv1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(bundlesResource, c.ns, name, pt, data, subresources...), &smithv1.Bundle{})
if obj == nil {
return nil, err
}
ret... | go | func (c *FakeBundles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *smithv1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(bundlesResource, c.ns, name, pt, data, subresources...), &smithv1.Bundle{})
if obj == nil {
return nil, err
}
ret... | [
"func",
"(",
"c",
"*",
"FakeBundles",
")",
"Patch",
"(",
"name",
"string",
",",
"pt",
"types",
".",
"PatchType",
",",
"data",
"[",
"]",
"byte",
",",
"subresources",
"...",
"string",
")",
"(",
"result",
"*",
"smithv1",
".",
"Bundle",
",",
"err",
"erro... | // Patch applies the patch and returns the patched bundle. | [
"Patch",
"applies",
"the",
"patch",
"and",
"returns",
"the",
"patched",
"bundle",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/client/clientset_generated/clientset/typed/smith/v1/fake/fake_bundle.go#L118-L126 |
18,251 | atlassian/smith | pkg/controller/bundlec/controller_crd_event_handler.go | ensureWatch | func (h *crdEventHandler) ensureWatch(logger *zap.Logger, crd *apiext_v1b1.CustomResourceDefinition) bool {
if crd.Name == smith_v1.BundleResourceName {
return false
}
if _, ok := h.watchers[crd.Name]; ok {
return true
}
if !resources.IsCrdConditionTrue(crd, apiext_v1b1.Established) {
logger.Info("Not adding... | go | func (h *crdEventHandler) ensureWatch(logger *zap.Logger, crd *apiext_v1b1.CustomResourceDefinition) bool {
if crd.Name == smith_v1.BundleResourceName {
return false
}
if _, ok := h.watchers[crd.Name]; ok {
return true
}
if !resources.IsCrdConditionTrue(crd, apiext_v1b1.Established) {
logger.Info("Not adding... | [
"func",
"(",
"h",
"*",
"crdEventHandler",
")",
"ensureWatch",
"(",
"logger",
"*",
"zap",
".",
"Logger",
",",
"crd",
"*",
"apiext_v1b1",
".",
"CustomResourceDefinition",
")",
"bool",
"{",
"if",
"crd",
".",
"Name",
"==",
"smith_v1",
".",
"BundleResourceName",
... | // ensureWatch ensures there is a watch for CRs of a CRD.
// Returns true if a watch was found or set up successfully and false if there is no watch and it was not set up for
// some reason. | [
"ensureWatch",
"ensures",
"there",
"is",
"a",
"watch",
"for",
"CRs",
"of",
"a",
"CRD",
".",
"Returns",
"true",
"if",
"a",
"watch",
"was",
"found",
"or",
"set",
"up",
"successfully",
"and",
"false",
"if",
"there",
"is",
"no",
"watch",
"and",
"it",
"was"... | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/controller_crd_event_handler.go#L90-L144 |
18,252 | atlassian/smith | pkg/controller/bundlec/controller_crd_event_handler.go | ensureNoWatch | func (h *crdEventHandler) ensureNoWatch(logger *zap.Logger, crd *apiext_v1b1.CustomResourceDefinition) bool {
crdWatch, ok := h.watchers[crd.Name]
if !ok {
// Nothing to do. This can happen if there was an error adding a watch
return false
}
logger.Info("Removing watch for CRD")
crdWatch.cancel()
delete(h.wat... | go | func (h *crdEventHandler) ensureNoWatch(logger *zap.Logger, crd *apiext_v1b1.CustomResourceDefinition) bool {
crdWatch, ok := h.watchers[crd.Name]
if !ok {
// Nothing to do. This can happen if there was an error adding a watch
return false
}
logger.Info("Removing watch for CRD")
crdWatch.cancel()
delete(h.wat... | [
"func",
"(",
"h",
"*",
"crdEventHandler",
")",
"ensureNoWatch",
"(",
"logger",
"*",
"zap",
".",
"Logger",
",",
"crd",
"*",
"apiext_v1b1",
".",
"CustomResourceDefinition",
")",
"bool",
"{",
"crdWatch",
",",
"ok",
":=",
"h",
".",
"watchers",
"[",
"crd",
".... | // ensureNoWatch ensures there is no watch for CRs of a CRD.
// Returns true if a watch was found and terminated and false if there was no watch already. | [
"ensureNoWatch",
"ensures",
"there",
"is",
"no",
"watch",
"for",
"CRs",
"of",
"a",
"CRD",
".",
"Returns",
"true",
"if",
"a",
"watch",
"was",
"found",
"and",
"terminated",
"and",
"false",
"if",
"there",
"was",
"no",
"watch",
"already",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/controller_crd_event_handler.go#L148-L164 |
18,253 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *Bundle) DeepCopy() *Bundle {
if in == nil {
return nil
}
out := new(Bundle)
in.DeepCopyInto(out)
return out
} | go | func (in *Bundle) DeepCopy() *Bundle {
if in == nil {
return nil
}
out := new(Bundle)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Bundle",
")",
"DeepCopy",
"(",
")",
"*",
"Bundle",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Bundle",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"re... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bundle. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Bundle",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L25-L32 |
18,254 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *BundleList) DeepCopy() *BundleList {
if in == nil {
return nil
}
out := new(BundleList)
in.DeepCopyInto(out)
return out
} | go | func (in *BundleList) DeepCopy() *BundleList {
if in == nil {
return nil
}
out := new(BundleList)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"BundleList",
")",
"DeepCopy",
"(",
")",
"*",
"BundleList",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"BundleList",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleList. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"BundleList",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L58-L65 |
18,255 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *BundleSpec) DeepCopy() *BundleSpec {
if in == nil {
return nil
}
out := new(BundleSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *BundleSpec) DeepCopy() *BundleSpec {
if in == nil {
return nil
}
out := new(BundleSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"BundleSpec",
")",
"DeepCopy",
"(",
")",
"*",
"BundleSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"BundleSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"BundleSpec",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L89-L96 |
18,256 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *BundleStatus) DeepCopy() *BundleStatus {
if in == nil {
return nil
}
out := new(BundleStatus)
in.DeepCopyInto(out)
return out
} | go | func (in *BundleStatus) DeepCopy() *BundleStatus {
if in == nil {
return nil
}
out := new(BundleStatus)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"BundleStatus",
")",
"DeepCopy",
"(",
")",
"*",
"BundleStatus",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"BundleStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleStatus. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"BundleStatus",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L129-L136 |
18,257 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *PluginSpec) DeepCopy() *PluginSpec {
if in == nil {
return nil
}
out := new(PluginSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *PluginSpec) DeepCopy() *PluginSpec {
if in == nil {
return nil
}
out := new(PluginSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"PluginSpec",
")",
"DeepCopy",
"(",
")",
"*",
"PluginSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"PluginSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"PluginSpec",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L139-L146 |
18,258 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *Reference) DeepCopy() *Reference {
if in == nil {
return nil
}
out := new(Reference)
in.DeepCopyInto(out)
return out
} | go | func (in *Reference) DeepCopy() *Reference {
if in == nil {
return nil
}
out := new(Reference)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Reference",
")",
"DeepCopy",
"(",
")",
"*",
"Reference",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Reference",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reference. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Reference",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L149-L156 |
18,259 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *Resource) DeepCopy() *Resource {
if in == nil {
return nil
}
out := new(Resource)
in.DeepCopyInto(out)
return out
} | go | func (in *Resource) DeepCopy() *Resource {
if in == nil {
return nil
}
out := new(Resource)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Resource",
")",
"DeepCopy",
"(",
")",
"*",
"Resource",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Resource",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Resource",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L173-L180 |
18,260 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceSpec) DeepCopy() *ResourceSpec {
if in == nil {
return nil
}
out := new(ResourceSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceSpec) DeepCopy() *ResourceSpec {
if in == nil {
return nil
}
out := new(ResourceSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceSpec",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceSpec",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L196-L203 |
18,261 | atlassian/smith | pkg/apis/smith/v1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceStatusData) DeepCopy() *ResourceStatusData {
if in == nil {
return nil
}
out := new(ResourceStatusData)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceStatusData) DeepCopy() *ResourceStatusData {
if in == nil {
return nil
}
out := new(ResourceStatusData)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceStatusData",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceStatusData",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceStatusData",
")",
"\n",
"in",
".",
"DeepCopyInto",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStatusData. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceStatusData",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/apis/smith/v1/zz_generated.deepcopy.go#L236-L243 |
18,262 | atlassian/smith | pkg/controller/bundlec/controller_worker.go | ProcessBundle | func (c *Controller) ProcessBundle(logger *zap.Logger, bundle *smith_v1.Bundle) (bool /*external*/, bool /*retriable*/, error) {
st := bundleSyncTask{
logger: logger,
bundleClient: c.BundleClient,
smartClient: c.SmartClient,
checker: ... | go | func (c *Controller) ProcessBundle(logger *zap.Logger, bundle *smith_v1.Bundle) (bool /*external*/, bool /*retriable*/, error) {
st := bundleSyncTask{
logger: logger,
bundleClient: c.BundleClient,
smartClient: c.SmartClient,
checker: ... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"ProcessBundle",
"(",
"logger",
"*",
"zap",
".",
"Logger",
",",
"bundle",
"*",
"smith_v1",
".",
"Bundle",
")",
"(",
"bool",
"/*external*/",
",",
"bool",
"/*retriable*/",
",",
"error",
")",
"{",
"st",
":=",
"bun... | // ProcessBundle is only visible for testing purposes. Should not be called directly. | [
"ProcessBundle",
"is",
"only",
"visible",
"for",
"testing",
"purposes",
".",
"Should",
"not",
"be",
"called",
"directly",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/controller_worker.go#L18-L97 |
18,263 | atlassian/smith | pkg/controller/bundlec/bundle_sync_task.go | findObjectsToDelete | func (st *bundleSyncTask) findObjectsToDelete() (bool /*external*/, bool /*retriable*/, error) {
objs, err := st.store.ObjectsControlledBy(st.bundle.Namespace, st.bundle.UID)
if err != nil {
return false, false, err
}
st.objectsToDelete = make(map[objectRef]runtime.Object, len(objs))
for _, obj := range objs {
... | go | func (st *bundleSyncTask) findObjectsToDelete() (bool /*external*/, bool /*retriable*/, error) {
objs, err := st.store.ObjectsControlledBy(st.bundle.Namespace, st.bundle.UID)
if err != nil {
return false, false, err
}
st.objectsToDelete = make(map[objectRef]runtime.Object, len(objs))
for _, obj := range objs {
... | [
"func",
"(",
"st",
"*",
"bundleSyncTask",
")",
"findObjectsToDelete",
"(",
")",
"(",
"bool",
"/*external*/",
",",
"bool",
"/*retriable*/",
",",
"error",
")",
"{",
"objs",
",",
"err",
":=",
"st",
".",
"store",
".",
"ObjectsControlledBy",
"(",
"st",
".",
"... | // findObjectsToDelete initializes objectsToDelete field with objects that have controller owner references to
// the Bundle being processed but are not defined in it. | [
"findObjectsToDelete",
"initializes",
"objectsToDelete",
"field",
"with",
"objects",
"that",
"have",
"controller",
"owner",
"references",
"to",
"the",
"Bundle",
"being",
"processed",
"but",
"are",
"not",
"defined",
"in",
"it",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/bundle_sync_task.go#L234-L280 |
18,264 | atlassian/smith | pkg/controller/bundlec/bundle_sync_task.go | pluginStatuses | func (st *bundleSyncTask) pluginStatuses() []smith_v1.PluginStatus {
// Plugin statuses
name2status := make(map[smith_v1.PluginName]struct{})
// most likely will be of the same size as before
pluginStatuses := make([]smith_v1.PluginStatus, 0, len(st.bundle.Status.PluginStatuses))
for _, res := range st.bundle.Spec... | go | func (st *bundleSyncTask) pluginStatuses() []smith_v1.PluginStatus {
// Plugin statuses
name2status := make(map[smith_v1.PluginName]struct{})
// most likely will be of the same size as before
pluginStatuses := make([]smith_v1.PluginStatus, 0, len(st.bundle.Status.PluginStatuses))
for _, res := range st.bundle.Spec... | [
"func",
"(",
"st",
"*",
"bundleSyncTask",
")",
"pluginStatuses",
"(",
")",
"[",
"]",
"smith_v1",
".",
"PluginStatus",
"{",
"// Plugin statuses",
"name2status",
":=",
"make",
"(",
"map",
"[",
"smith_v1",
".",
"PluginName",
"]",
"struct",
"{",
"}",
")",
"\n"... | // pluginStatuses visits each valid Plugin just once, collecting its PluginStatus. | [
"pluginStatuses",
"visits",
"each",
"valid",
"Plugin",
"just",
"once",
"collecting",
"its",
"PluginStatus",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/bundle_sync_task.go#L599-L633 |
18,265 | atlassian/smith | pkg/controller/bundlec/bundle_sync_task.go | resourceConditions | func (st *bundleSyncTask) resourceConditions(res smith_v1.Resource) (
cond_v1.Condition, /* blockedCond */
cond_v1.Condition, /* inProgressCond */
cond_v1.Condition, /* readyCond */
cond_v1.Condition, /* errorCond */
) {
blockedCond := cond_v1.Condition{Type: smith_v1.ResourceBlocked, Status: cond_v1.ConditionFals... | go | func (st *bundleSyncTask) resourceConditions(res smith_v1.Resource) (
cond_v1.Condition, /* blockedCond */
cond_v1.Condition, /* inProgressCond */
cond_v1.Condition, /* readyCond */
cond_v1.Condition, /* errorCond */
) {
blockedCond := cond_v1.Condition{Type: smith_v1.ResourceBlocked, Status: cond_v1.ConditionFals... | [
"func",
"(",
"st",
"*",
"bundleSyncTask",
")",
"resourceConditions",
"(",
"res",
"smith_v1",
".",
"Resource",
")",
"(",
"cond_v1",
".",
"Condition",
",",
"/* blockedCond */",
"cond_v1",
".",
"Condition",
",",
"/* inProgressCond */",
"cond_v1",
".",
"Condition",
... | // resourceConditions calculates conditions for a given Resource,
// which can be useful when determining whether to retry or not. | [
"resourceConditions",
"calculates",
"conditions",
"for",
"a",
"given",
"Resource",
"which",
"can",
"be",
"useful",
"when",
"determining",
"whether",
"to",
"retry",
"or",
"not",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/bundle_sync_task.go#L637-L687 |
18,266 | atlassian/smith | pkg/controller/bundlec/bundle_sync_task.go | checkBundleConditionNeedsUpdate | func (st *bundleSyncTask) checkBundleConditionNeedsUpdate(condition *cond_v1.Condition) bool {
now := meta_v1.Now()
condition.LastTransitionTime = now
needsUpdate := cond_v1.PrepareCondition(st.bundle.Status.Conditions, condition)
if needsUpdate && condition.Status == cond_v1.ConditionTrue {
st.bundleTransition... | go | func (st *bundleSyncTask) checkBundleConditionNeedsUpdate(condition *cond_v1.Condition) bool {
now := meta_v1.Now()
condition.LastTransitionTime = now
needsUpdate := cond_v1.PrepareCondition(st.bundle.Status.Conditions, condition)
if needsUpdate && condition.Status == cond_v1.ConditionTrue {
st.bundleTransition... | [
"func",
"(",
"st",
"*",
"bundleSyncTask",
")",
"checkBundleConditionNeedsUpdate",
"(",
"condition",
"*",
"cond_v1",
".",
"Condition",
")",
"bool",
"{",
"now",
":=",
"meta_v1",
".",
"Now",
"(",
")",
"\n",
"condition",
".",
"LastTransitionTime",
"=",
"now",
"\... | // checkBundleConditionNeedsUpdate updates passed condition by fetching information from an existing resource condition if present.
// Sets LastTransitionTime to now if the status has changed.
// Returns true if resource condition in the bundle does not match and needs to be updated. | [
"checkBundleConditionNeedsUpdate",
"updates",
"passed",
"condition",
"by",
"fetching",
"information",
"from",
"an",
"existing",
"resource",
"condition",
"if",
"present",
".",
"Sets",
"LastTransitionTime",
"to",
"now",
"if",
"the",
"status",
"has",
"changed",
".",
"R... | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/bundle_sync_task.go#L692-L728 |
18,267 | atlassian/smith | pkg/controller/bundlec/bundle_sync_task.go | checkResourceConditionNeedsUpdate | func (st *bundleSyncTask) checkResourceConditionNeedsUpdate(resName smith_v1.ResourceName, condition *cond_v1.Condition) bool {
now := meta_v1.Now()
condition.LastTransitionTime = now
needsUpdate := true
// Try to find this resource status
_, status := st.bundle.Status.GetResourceStatus(resName)
if status != n... | go | func (st *bundleSyncTask) checkResourceConditionNeedsUpdate(resName smith_v1.ResourceName, condition *cond_v1.Condition) bool {
now := meta_v1.Now()
condition.LastTransitionTime = now
needsUpdate := true
// Try to find this resource status
_, status := st.bundle.Status.GetResourceStatus(resName)
if status != n... | [
"func",
"(",
"st",
"*",
"bundleSyncTask",
")",
"checkResourceConditionNeedsUpdate",
"(",
"resName",
"smith_v1",
".",
"ResourceName",
",",
"condition",
"*",
"cond_v1",
".",
"Condition",
")",
"bool",
"{",
"now",
":=",
"meta_v1",
".",
"Now",
"(",
")",
"\n",
"co... | // checkResourceConditionNeedsUpdate updates passed condition by fetching information from an existing resource condition if present.
// Sets LastTransitionTime to now if the status has changed.
// Returns true if resource condition in the bundle does not match and needs to be updated. | [
"checkResourceConditionNeedsUpdate",
"updates",
"passed",
"condition",
"by",
"fetching",
"information",
"from",
"an",
"existing",
"resource",
"condition",
"if",
"present",
".",
"Sets",
"LastTransitionTime",
"to",
"now",
"if",
"the",
"status",
"has",
"changed",
".",
... | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/bundle_sync_task.go#L733-L782 |
18,268 | atlassian/smith | pkg/util/util.go | ConvertType | func ConvertType(scheme *runtime.Scheme, in, out runtime.Object) error {
in = in.DeepCopyObject()
if err := scheme.Convert(in, out, nil); err != nil {
return err
}
gvkOut := out.GetObjectKind().GroupVersionKind()
if gvkOut.Kind == "" || gvkOut.Version == "" { // Group can be empty
// API machinery discards Typ... | go | func ConvertType(scheme *runtime.Scheme, in, out runtime.Object) error {
in = in.DeepCopyObject()
if err := scheme.Convert(in, out, nil); err != nil {
return err
}
gvkOut := out.GetObjectKind().GroupVersionKind()
if gvkOut.Kind == "" || gvkOut.Version == "" { // Group can be empty
// API machinery discards Typ... | [
"func",
"ConvertType",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
",",
"in",
",",
"out",
"runtime",
".",
"Object",
")",
"error",
"{",
"in",
"=",
"in",
".",
"DeepCopyObject",
"(",
")",
"\n",
"if",
"err",
":=",
"scheme",
".",
"Convert",
"(",
"in",
... | // ConvertType should be used to convert to typed objects.
// If the in object is unstructured then it must have GVK set otherwise it must be
// recognizable by scheme or have the GVK set. | [
"ConvertType",
"should",
"be",
"used",
"to",
"convert",
"to",
"typed",
"objects",
".",
"If",
"the",
"in",
"object",
"is",
"unstructured",
"then",
"it",
"must",
"have",
"GVK",
"set",
"otherwise",
"it",
"must",
"be",
"recognizable",
"by",
"scheme",
"or",
"ha... | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/util/util.go#L27-L42 |
18,269 | atlassian/smith | pkg/util/util.go | RuntimeToUnstructured | func RuntimeToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error) {
gvk := obj.GetObjectKind().GroupVersionKind()
if gvk.Kind == "" || gvk.Version == "" { // Group can be empty
return nil, errors.Errorf("cannot convert %T to Unstructured: object Kind and/or object Version is empty", obj)
}
u, err... | go | func RuntimeToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error) {
gvk := obj.GetObjectKind().GroupVersionKind()
if gvk.Kind == "" || gvk.Version == "" { // Group can be empty
return nil, errors.Errorf("cannot convert %T to Unstructured: object Kind and/or object Version is empty", obj)
}
u, err... | [
"func",
"RuntimeToUnstructured",
"(",
"obj",
"runtime",
".",
"Object",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"gvk",
":=",
"obj",
".",
"GetObjectKind",
"(",
")",
".",
"GroupVersionKind",
"(",
")",
"\n",
"if",
"gvk",
"... | // RuntimeToUnstructured can be used to convert any typed or unstructured object into
// an unstructured object. The obj must have GVK set. | [
"RuntimeToUnstructured",
"can",
"be",
"used",
"to",
"convert",
"any",
"typed",
"or",
"unstructured",
"object",
"into",
"an",
"unstructured",
"object",
".",
"The",
"obj",
"must",
"have",
"GVK",
"set",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/util/util.go#L46-L58 |
18,270 | atlassian/smith | pkg/controller/bundlec/resource_sync_task.go | evalPluginSpec | func (st *resourceSyncTask) evalPluginSpec(res *smith_v1.Resource, actual runtime.Object) (*unstructured.Unstructured, resourceStatus) {
pluginContainer, ok := st.pluginContainers[res.Spec.Plugin.Name]
if !ok {
return nil, resourceStatusError{
err: errors.Errorf("no such plugin %q", res.Spec.Plugin.N... | go | func (st *resourceSyncTask) evalPluginSpec(res *smith_v1.Resource, actual runtime.Object) (*unstructured.Unstructured, resourceStatus) {
pluginContainer, ok := st.pluginContainers[res.Spec.Plugin.Name]
if !ok {
return nil, resourceStatusError{
err: errors.Errorf("no such plugin %q", res.Spec.Plugin.N... | [
"func",
"(",
"st",
"*",
"resourceSyncTask",
")",
"evalPluginSpec",
"(",
"res",
"*",
"smith_v1",
".",
"Resource",
",",
"actual",
"runtime",
".",
"Object",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
",",
"resourceStatus",
")",
"{",
"pluginContainer",
... | // evalPluginSpec evaluates the plugin resource specification and returns the result. | [
"evalPluginSpec",
"evaluates",
"the",
"plugin",
"resource",
"specification",
"and",
"returns",
"the",
"result",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/resource_sync_task.go#L652-L719 |
18,271 | atlassian/smith | pkg/controller/bundlec/resource_sync_task.go | createOrUpdate | func (st *resourceSyncTask) createOrUpdate(spec *unstructured.Unstructured, actual runtime.Object) (actualRet *unstructured.Unstructured, retriableRet bool, e error) {
// Prepare client
gvk := spec.GroupVersionKind()
resClient, err := st.smartClient.ForGVK(gvk, st.bundle.Namespace)
if err != nil {
return nil, fal... | go | func (st *resourceSyncTask) createOrUpdate(spec *unstructured.Unstructured, actual runtime.Object) (actualRet *unstructured.Unstructured, retriableRet bool, e error) {
// Prepare client
gvk := spec.GroupVersionKind()
resClient, err := st.smartClient.ForGVK(gvk, st.bundle.Namespace)
if err != nil {
return nil, fal... | [
"func",
"(",
"st",
"*",
"resourceSyncTask",
")",
"createOrUpdate",
"(",
"spec",
"*",
"unstructured",
".",
"Unstructured",
",",
"actual",
"runtime",
".",
"Object",
")",
"(",
"actualRet",
"*",
"unstructured",
".",
"Unstructured",
",",
"retriableRet",
"bool",
","... | // createOrUpdate creates or updates a resources. | [
"createOrUpdate",
"creates",
"or",
"updates",
"a",
"resources",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/resource_sync_task.go#L778-L791 |
18,272 | atlassian/smith | pkg/controller/bundlec/resource_sync_task.go | updateResource | func (st *resourceSyncTask) updateResource(resClient dynamic.ResourceInterface, spec *unstructured.Unstructured, actual runtime.Object) (actualRet *unstructured.Unstructured, retriableError bool, e error) {
st.logger.Debug("Object found, checking spec", ctrlLogz.ObjectGk(spec.GroupVersionKind().GroupKind()), ctrlLogz.... | go | func (st *resourceSyncTask) updateResource(resClient dynamic.ResourceInterface, spec *unstructured.Unstructured, actual runtime.Object) (actualRet *unstructured.Unstructured, retriableError bool, e error) {
st.logger.Debug("Object found, checking spec", ctrlLogz.ObjectGk(spec.GroupVersionKind().GroupKind()), ctrlLogz.... | [
"func",
"(",
"st",
"*",
"resourceSyncTask",
")",
"updateResource",
"(",
"resClient",
"dynamic",
".",
"ResourceInterface",
",",
"spec",
"*",
"unstructured",
".",
"Unstructured",
",",
"actual",
"runtime",
".",
"Object",
")",
"(",
"actualRet",
"*",
"unstructured",
... | // Mutates spec and actual. | [
"Mutates",
"spec",
"and",
"actual",
"."
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/controller/bundlec/resource_sync_task.go#L820-L859 |
18,273 | atlassian/smith | pkg/resources/objects.go | GetJSONPathString | func GetJSONPathString(obj interface{}, path string) (string, error) {
j := jsonpath.New("GetJSONPathString")
// If the key is missing, return an empty string without errors
j.AllowMissingKeys(true)
err := j.Parse(path)
if err != nil {
return "", errors.Wrapf(err, "JsonPath parse %s error", path)
}
var buf byt... | go | func GetJSONPathString(obj interface{}, path string) (string, error) {
j := jsonpath.New("GetJSONPathString")
// If the key is missing, return an empty string without errors
j.AllowMissingKeys(true)
err := j.Parse(path)
if err != nil {
return "", errors.Wrapf(err, "JsonPath parse %s error", path)
}
var buf byt... | [
"func",
"GetJSONPathString",
"(",
"obj",
"interface",
"{",
"}",
",",
"path",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"j",
":=",
"jsonpath",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"// If the key is missing, return an empty string without errors",
... | // GetJSONPathString extracts the value from the object using given JsonPath template, in a string format | [
"GetJSONPathString",
"extracts",
"the",
"value",
"from",
"the",
"object",
"using",
"given",
"JsonPath",
"template",
"in",
"a",
"string",
"format"
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/resources/objects.go#L12-L26 |
18,274 | atlassian/smith | pkg/resources/objects.go | GetJSONPathValue | func GetJSONPathValue(obj interface{}, path string, allowMissingKeys bool) (interface{}, error) {
j := jsonpath.New("GetJSONPathValue")
// If the key is missing, return an empty string without errors
j.AllowMissingKeys(allowMissingKeys)
err := j.Parse(path)
if err != nil {
return "", errors.Wrapf(err, "JsonPath ... | go | func GetJSONPathValue(obj interface{}, path string, allowMissingKeys bool) (interface{}, error) {
j := jsonpath.New("GetJSONPathValue")
// If the key is missing, return an empty string without errors
j.AllowMissingKeys(allowMissingKeys)
err := j.Parse(path)
if err != nil {
return "", errors.Wrapf(err, "JsonPath ... | [
"func",
"GetJSONPathValue",
"(",
"obj",
"interface",
"{",
"}",
",",
"path",
"string",
",",
"allowMissingKeys",
"bool",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"j",
":=",
"jsonpath",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"// If the ke... | // GetJSONPathValue extracts the value from the object using given JsonPath template | [
"GetJSONPathValue",
"extracts",
"the",
"value",
"from",
"the",
"object",
"using",
"given",
"JsonPath",
"template"
] | e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438 | https://github.com/atlassian/smith/blob/e4fa63e5dcb5b4dc532a3dcb7b93ca4a5ad19438/pkg/resources/objects.go#L29-L51 |
18,275 | smallnest/goreq | goreq.go | New | func New() *GoReq {
gr := &GoReq{
Data: make(map[string]interface{}),
Header: make(map[string]string),
FormData: url.Values{},
QueryData: url.Values{},
Client: nil,
Transport: &http.Transport{},
Cookies: make([]*http.Cookie, 0),
Errors: ... | go | func New() *GoReq {
gr := &GoReq{
Data: make(map[string]interface{}),
Header: make(map[string]string),
FormData: url.Values{},
QueryData: url.Values{},
Client: nil,
Transport: &http.Transport{},
Cookies: make([]*http.Cookie, 0),
Errors: ... | [
"func",
"New",
"(",
")",
"*",
"GoReq",
"{",
"gr",
":=",
"&",
"GoReq",
"{",
"Data",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"Header",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"FormDat... | // New returns a new GoReq object. | [
"New",
"returns",
"a",
"new",
"GoReq",
"object",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L100-L118 |
18,276 | smallnest/goreq | goreq.go | SetCurlCommand | func (gr *GoReq) SetCurlCommand(enable bool) *GoReq {
gr.CurlCommand = enable
return gr
} | go | func (gr *GoReq) SetCurlCommand(enable bool) *GoReq {
gr.CurlCommand = enable
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"SetCurlCommand",
"(",
"enable",
"bool",
")",
"*",
"GoReq",
"{",
"gr",
".",
"CurlCommand",
"=",
"enable",
"\n",
"return",
"gr",
"\n",
"}"
] | // SetCurlCommand enables the curlcommand mode which display a CURL command line | [
"SetCurlCommand",
"enables",
"the",
"curlcommand",
"mode",
"which",
"display",
"a",
"CURL",
"command",
"line"
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L127-L130 |
18,277 | smallnest/goreq | goreq.go | SetLogger | func (gr *GoReq) SetLogger(logger *log.Logger) *GoReq {
gr.logger = logger
return gr
} | go | func (gr *GoReq) SetLogger(logger *log.Logger) *GoReq {
gr.logger = logger
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"SetLogger",
"(",
"logger",
"*",
"log",
".",
"Logger",
")",
"*",
"GoReq",
"{",
"gr",
".",
"logger",
"=",
"logger",
"\n",
"return",
"gr",
"\n",
"}"
] | // SetLogger is used to set a Logger | [
"SetLogger",
"is",
"used",
"to",
"set",
"a",
"Logger"
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L133-L136 |
18,278 | smallnest/goreq | goreq.go | SetClient | func (gr *GoReq) SetClient(client *http.Client) *GoReq {
gr.Client = client
return gr
} | go | func (gr *GoReq) SetClient(client *http.Client) *GoReq {
gr.Client = client
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"SetClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"GoReq",
"{",
"gr",
".",
"Client",
"=",
"client",
"\n",
"return",
"gr",
"\n",
"}"
] | // SetClient ise used to set a shared http.Client | [
"SetClient",
"ise",
"used",
"to",
"set",
"a",
"shared",
"http",
".",
"Client"
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L139-L142 |
18,279 | smallnest/goreq | goreq.go | Reset | func (gr *GoReq) Reset() *GoReq {
gr.URL = ""
gr.Method = ""
gr.Header = make(map[string]string)
gr.Data = make(map[string]interface{})
gr.FormData = url.Values{}
gr.QueryData = url.Values{}
gr.RawStringData = ""
gr.RawBytesData = make([]byte, 0)
gr.FilePath = ""
gr.FileParam = ""
gr.Cookies = make([]*http.C... | go | func (gr *GoReq) Reset() *GoReq {
gr.URL = ""
gr.Method = ""
gr.Header = make(map[string]string)
gr.Data = make(map[string]interface{})
gr.FormData = url.Values{}
gr.QueryData = url.Values{}
gr.RawStringData = ""
gr.RawBytesData = make([]byte, 0)
gr.FilePath = ""
gr.FileParam = ""
gr.Cookies = make([]*http.C... | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Reset",
"(",
")",
"*",
"GoReq",
"{",
"gr",
".",
"URL",
"=",
"\"",
"\"",
"\n",
"gr",
".",
"Method",
"=",
"\"",
"\"",
"\n",
"gr",
".",
"Header",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
... | // Reset is used to clear GoReq data for another new request only keep client and logger. | [
"Reset",
"is",
"used",
"to",
"clear",
"GoReq",
"data",
"for",
"another",
"new",
"request",
"only",
"keep",
"client",
"and",
"logger",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L155-L171 |
18,280 | smallnest/goreq | goreq.go | Get | func (gr *GoReq) Get(targetURL string) *GoReq {
//gr.Reset()
gr.Method = GET
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Get(targetURL string) *GoReq {
//gr.Reset()
gr.Method = GET
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Get",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"GET",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",
"gr",... | // Get is used to set GET HttpMethod with a url. | [
"Get",
"is",
"used",
"to",
"set",
"GET",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L174-L180 |
18,281 | smallnest/goreq | goreq.go | Post | func (gr *GoReq) Post(targetURL string) *GoReq {
//gr.Reset()
gr.Method = POST
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Post(targetURL string) *GoReq {
//gr.Reset()
gr.Method = POST
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Post",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"POST",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",
"gr... | // Post is used to set POST HttpMethod with a url. | [
"Post",
"is",
"used",
"to",
"set",
"POST",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L183-L189 |
18,282 | smallnest/goreq | goreq.go | Head | func (gr *GoReq) Head(targetURL string) *GoReq {
//gr.Reset()
gr.Method = HEAD
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Head(targetURL string) *GoReq {
//gr.Reset()
gr.Method = HEAD
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Head",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"HEAD",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",
"gr... | // Head is used to set HEAD HttpMethod with a url. | [
"Head",
"is",
"used",
"to",
"set",
"HEAD",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L192-L198 |
18,283 | smallnest/goreq | goreq.go | Put | func (gr *GoReq) Put(targetURL string) *GoReq {
//gr.Reset()
gr.Method = PUT
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Put(targetURL string) *GoReq {
//gr.Reset()
gr.Method = PUT
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Put",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"PUT",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",
"gr",... | // Put is used to set PUT HttpMethod with a url. | [
"Put",
"is",
"used",
"to",
"set",
"PUT",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L201-L207 |
18,284 | smallnest/goreq | goreq.go | Delete | func (gr *GoReq) Delete(targetURL string) *GoReq {
//gr.Reset()
gr.Method = DELETE
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Delete(targetURL string) *GoReq {
//gr.Reset()
gr.Method = DELETE
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Delete",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"DELETE",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",
... | // Delete is used to set DELETE HttpMethod with a url. | [
"Delete",
"is",
"used",
"to",
"set",
"DELETE",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L210-L216 |
18,285 | smallnest/goreq | goreq.go | Patch | func (gr *GoReq) Patch(targetURL string) *GoReq {
//gr.Reset()
gr.Method = PATCH
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Patch(targetURL string) *GoReq {
//gr.Reset()
gr.Method = PATCH
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Patch",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"PATCH",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",
"... | // Patch is used to set PATCH HttpMethod with a url. | [
"Patch",
"is",
"used",
"to",
"set",
"PATCH",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L219-L225 |
18,286 | smallnest/goreq | goreq.go | Options | func (gr *GoReq) Options(targetURL string) *GoReq {
//gr.Reset()
gr.Method = OPTIONS
gr.URL = targetURL
gr.Errors = nil
return gr
} | go | func (gr *GoReq) Options(targetURL string) *GoReq {
//gr.Reset()
gr.Method = OPTIONS
gr.URL = targetURL
gr.Errors = nil
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Options",
"(",
"targetURL",
"string",
")",
"*",
"GoReq",
"{",
"//gr.Reset()",
"gr",
".",
"Method",
"=",
"OPTIONS",
"\n",
"gr",
".",
"URL",
"=",
"targetURL",
"\n",
"gr",
".",
"Errors",
"=",
"nil",
"\n",
"return",... | // Options is used to set OPTIONS HttpMethod with a url. | [
"Options",
"is",
"used",
"to",
"set",
"OPTIONS",
"HttpMethod",
"with",
"a",
"url",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L228-L234 |
18,287 | smallnest/goreq | goreq.go | queryStruct | func (gr *GoReq) queryStruct(content interface{}) *GoReq {
if marshalContent, err := json.Marshal(content); err != nil {
gr.Errors = append(gr.Errors, err)
} else {
var val map[string]interface{}
if err := json.Unmarshal(marshalContent, &val); err != nil {
gr.Errors = append(gr.Errors, err)
} else {
for... | go | func (gr *GoReq) queryStruct(content interface{}) *GoReq {
if marshalContent, err := json.Marshal(content); err != nil {
gr.Errors = append(gr.Errors, err)
} else {
var val map[string]interface{}
if err := json.Unmarshal(marshalContent, &val); err != nil {
gr.Errors = append(gr.Errors, err)
} else {
for... | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"queryStruct",
"(",
"content",
"interface",
"{",
"}",
")",
"*",
"GoReq",
"{",
"if",
"marshalContent",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"content",
")",
";",
"err",
"!=",
"nil",
"{",
"gr",
".",
"Err... | //create queryData by parsing structs. | [
"create",
"queryData",
"by",
"parsing",
"structs",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L416-L430 |
18,288 | smallnest/goreq | goreq.go | Timeout | func (gr *GoReq) Timeout(timeout time.Duration) *GoReq {
gr.Transport.Dial = func(network, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(network, addr, timeout)
if err != nil {
gr.Errors = append(gr.Errors, err)
return nil, err
}
conn.SetDeadline(time.Now().Add(timeout))
return conn, ni... | go | func (gr *GoReq) Timeout(timeout time.Duration) *GoReq {
gr.Transport.Dial = func(network, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(network, addr, timeout)
if err != nil {
gr.Errors = append(gr.Errors, err)
return nil, err
}
conn.SetDeadline(time.Now().Add(timeout))
return conn, ni... | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"Timeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"GoReq",
"{",
"gr",
".",
"Transport",
".",
"Dial",
"=",
"func",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
... | // Timeout is used to set timeout for connections. | [
"Timeout",
"is",
"used",
"to",
"set",
"timeout",
"for",
"connections",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L480-L491 |
18,289 | smallnest/goreq | goreq.go | RedirectPolicy | func (gr *GoReq) RedirectPolicy(policy func(req Request, via []Request) error) *GoReq {
gr.CheckRedirect = func(r *http.Request, v []*http.Request) error {
vv := make([]Request, len(v))
for i, r := range v {
vv[i] = Request(r)
}
return policy(Request(r), vv)
}
if gr.Client != nil {
gr.Client.CheckRedire... | go | func (gr *GoReq) RedirectPolicy(policy func(req Request, via []Request) error) *GoReq {
gr.CheckRedirect = func(r *http.Request, v []*http.Request) error {
vv := make([]Request, len(v))
for i, r := range v {
vv[i] = Request(r)
}
return policy(Request(r), vv)
}
if gr.Client != nil {
gr.Client.CheckRedire... | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"RedirectPolicy",
"(",
"policy",
"func",
"(",
"req",
"Request",
",",
"via",
"[",
"]",
"Request",
")",
"error",
")",
"*",
"GoReq",
"{",
"gr",
".",
"CheckRedirect",
"=",
"func",
"(",
"r",
"*",
"http",
".",
"Reque... | // RedirectPolicy is used to set redirect policy. | [
"RedirectPolicy",
"is",
"used",
"to",
"set",
"redirect",
"policy",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L534-L546 |
18,290 | smallnest/goreq | goreq.go | SendFile | func (gr *GoReq) SendFile(paramName, filePath string) *GoReq {
gr.FileParam = paramName
gr.FilePath = filePath
return gr
} | go | func (gr *GoReq) SendFile(paramName, filePath string) *GoReq {
gr.FileParam = paramName
gr.FilePath = filePath
return gr
} | [
"func",
"(",
"gr",
"*",
"GoReq",
")",
"SendFile",
"(",
"paramName",
",",
"filePath",
"string",
")",
"*",
"GoReq",
"{",
"gr",
".",
"FileParam",
"=",
"paramName",
"\n",
"gr",
".",
"FilePath",
"=",
"filePath",
"\n",
"return",
"gr",
"\n",
"}"
] | // SendFile posts a file to server. | [
"SendFile",
"posts",
"a",
"file",
"to",
"server",
"."
] | 2e3372c80388e4b95c699c950eb2c9faba6c32e0 | https://github.com/smallnest/goreq/blob/2e3372c80388e4b95c699c950eb2c9faba6c32e0/goreq.go#L662-L666 |
18,291 | yosida95/golang-jenkins | jenkins.go | checkCrumb | func (jenkins *Jenkins) checkCrumb(req *http.Request) (*http.Request, error) {
// api - store jenkins api useCrumbs response
api := struct {
UseCrumbs bool `json:"useCrumbs"`
}{}
err := jenkins.get("/api/json", url.Values{"tree": []string{"useCrumbs"}}, &api)
if err != nil {
return req, err
}
if !api.UseC... | go | func (jenkins *Jenkins) checkCrumb(req *http.Request) (*http.Request, error) {
// api - store jenkins api useCrumbs response
api := struct {
UseCrumbs bool `json:"useCrumbs"`
}{}
err := jenkins.get("/api/json", url.Values{"tree": []string{"useCrumbs"}}, &api)
if err != nil {
return req, err
}
if !api.UseC... | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"checkCrumb",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"// api - store jenkins api useCrumbs response",
"api",
":=",
"struct",
"{",
"UseCrumbs",
"bool... | // checkCrumb - checks if `useCrumb` is enabled and if so, retrieves crumb field and value and updates request header | [
"checkCrumb",
"-",
"checks",
"if",
"useCrumb",
"is",
"enabled",
"and",
"if",
"so",
"retrieves",
"crumb",
"field",
"and",
"value",
"and",
"updates",
"request",
"header"
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L52-L84 |
18,292 | yosida95/golang-jenkins | jenkins.go | GetJobs | func (jenkins *Jenkins) GetJobs() ([]Job, error) {
var payload = struct {
Jobs []Job `json:"jobs"`
}{}
err := jenkins.get("", nil, &payload)
return payload.Jobs, err
} | go | func (jenkins *Jenkins) GetJobs() ([]Job, error) {
var payload = struct {
Jobs []Job `json:"jobs"`
}{}
err := jenkins.get("", nil, &payload)
return payload.Jobs, err
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"GetJobs",
"(",
")",
"(",
"[",
"]",
"Job",
",",
"error",
")",
"{",
"var",
"payload",
"=",
"struct",
"{",
"Jobs",
"[",
"]",
"Job",
"`json:\"jobs\"`",
"\n",
"}",
"{",
"}",
"\n",
"err",
":=",
"jenkins",
"... | // GetJobs returns all jobs you can read. | [
"GetJobs",
"returns",
"all",
"jobs",
"you",
"can",
"read",
"."
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L203-L209 |
18,293 | yosida95/golang-jenkins | jenkins.go | GetJob | func (jenkins *Jenkins) GetJob(name string) (job Job, err error) {
err = jenkins.get(fmt.Sprintf("/job/%s", name), nil, &job)
return
} | go | func (jenkins *Jenkins) GetJob(name string) (job Job, err error) {
err = jenkins.get(fmt.Sprintf("/job/%s", name), nil, &job)
return
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"GetJob",
"(",
"name",
"string",
")",
"(",
"job",
"Job",
",",
"err",
"error",
")",
"{",
"err",
"=",
"jenkins",
".",
"get",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
",",
"nil",
"... | // GetJob returns a job which has specified name. | [
"GetJob",
"returns",
"a",
"job",
"which",
"has",
"specified",
"name",
"."
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L212-L215 |
18,294 | yosida95/golang-jenkins | jenkins.go | GetJobConfig | func (jenkins *Jenkins) GetJobConfig(name string) (job MavenJobItem, err error) {
err = jenkins.getXml(fmt.Sprintf("/job/%s/config.xml", name), nil, &job)
return
} | go | func (jenkins *Jenkins) GetJobConfig(name string) (job MavenJobItem, err error) {
err = jenkins.getXml(fmt.Sprintf("/job/%s/config.xml", name), nil, &job)
return
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"GetJobConfig",
"(",
"name",
"string",
")",
"(",
"job",
"MavenJobItem",
",",
"err",
"error",
")",
"{",
"err",
"=",
"jenkins",
".",
"getXml",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
... | //GetJobConfig returns a maven job, has the one used to create Maven job | [
"GetJobConfig",
"returns",
"a",
"maven",
"job",
"has",
"the",
"one",
"used",
"to",
"create",
"Maven",
"job"
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L218-L221 |
18,295 | yosida95/golang-jenkins | jenkins.go | GetBuild | func (jenkins *Jenkins) GetBuild(job Job, number int) (build Build, err error) {
err = jenkins.get(fmt.Sprintf("/job/%s/%d", job.Name, number), nil, &build)
return
} | go | func (jenkins *Jenkins) GetBuild(job Job, number int) (build Build, err error) {
err = jenkins.get(fmt.Sprintf("/job/%s/%d", job.Name, number), nil, &build)
return
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"GetBuild",
"(",
"job",
"Job",
",",
"number",
"int",
")",
"(",
"build",
"Build",
",",
"err",
"error",
")",
"{",
"err",
"=",
"jenkins",
".",
"get",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"job... | // GetBuild returns a number-th build result of specified job. | [
"GetBuild",
"returns",
"a",
"number",
"-",
"th",
"build",
"result",
"of",
"specified",
"job",
"."
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L224-L227 |
18,296 | yosida95/golang-jenkins | jenkins.go | GetLastBuild | func (jenkins *Jenkins) GetLastBuild(job Job) (build Build, err error) {
err = jenkins.get(fmt.Sprintf("/job/%s/lastBuild", job.Name), nil, &build)
return
} | go | func (jenkins *Jenkins) GetLastBuild(job Job) (build Build, err error) {
err = jenkins.get(fmt.Sprintf("/job/%s/lastBuild", job.Name), nil, &build)
return
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"GetLastBuild",
"(",
"job",
"Job",
")",
"(",
"build",
"Build",
",",
"err",
"error",
")",
"{",
"err",
"=",
"jenkins",
".",
"get",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"job",
".",
"Name",
")... | // GetLastBuild returns the last build of specified job. | [
"GetLastBuild",
"returns",
"the",
"last",
"build",
"of",
"specified",
"job",
"."
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L230-L233 |
18,297 | yosida95/golang-jenkins | jenkins.go | CreateJob | func (jenkins *Jenkins) CreateJob(mavenJobItem MavenJobItem, jobName string) error {
mavenJobItemXml, _ := xml.Marshal(mavenJobItem)
reader := bytes.NewReader(mavenJobItemXml)
params := url.Values{"name": []string{jobName}}
return jenkins.postXml("/createItem", params, reader, nil)
} | go | func (jenkins *Jenkins) CreateJob(mavenJobItem MavenJobItem, jobName string) error {
mavenJobItemXml, _ := xml.Marshal(mavenJobItem)
reader := bytes.NewReader(mavenJobItemXml)
params := url.Values{"name": []string{jobName}}
return jenkins.postXml("/createItem", params, reader, nil)
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"CreateJob",
"(",
"mavenJobItem",
"MavenJobItem",
",",
"jobName",
"string",
")",
"error",
"{",
"mavenJobItemXml",
",",
"_",
":=",
"xml",
".",
"Marshal",
"(",
"mavenJobItem",
")",
"\n",
"reader",
":=",
"bytes",
"... | // Create a new job | [
"Create",
"a",
"new",
"job"
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L236-L242 |
18,298 | yosida95/golang-jenkins | jenkins.go | DeleteJob | func (jenkins *Jenkins) DeleteJob(job Job) error {
return jenkins.post(fmt.Sprintf("/job/%s/doDelete", job.Name), nil, nil)
} | go | func (jenkins *Jenkins) DeleteJob(job Job) error {
return jenkins.post(fmt.Sprintf("/job/%s/doDelete", job.Name), nil, nil)
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"DeleteJob",
"(",
"job",
"Job",
")",
"error",
"{",
"return",
"jenkins",
".",
"post",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"job",
".",
"Name",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] | // Delete a job | [
"Delete",
"a",
"job"
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L245-L247 |
18,299 | yosida95/golang-jenkins | jenkins.go | AddJobToView | func (jenkins *Jenkins) AddJobToView(viewName string, job Job) error {
params := url.Values{"name": []string{job.Name}}
return jenkins.post(fmt.Sprintf("/view/%s/addJobToView", viewName), params, nil)
} | go | func (jenkins *Jenkins) AddJobToView(viewName string, job Job) error {
params := url.Values{"name": []string{job.Name}}
return jenkins.post(fmt.Sprintf("/view/%s/addJobToView", viewName), params, nil)
} | [
"func",
"(",
"jenkins",
"*",
"Jenkins",
")",
"AddJobToView",
"(",
"viewName",
"string",
",",
"job",
"Job",
")",
"error",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"job",
".",
"Name",
"}",
"}",
"\n",
... | // Add job to view | [
"Add",
"job",
"to",
"view"
] | 4772716c47ca769dea7f92bc28dc607eeb16d8a8 | https://github.com/yosida95/golang-jenkins/blob/4772716c47ca769dea7f92bc28dc607eeb16d8a8/jenkins.go#L250-L253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.