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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
132,200 | currantlabs/ble | linux/hci/gap.go | StopScanning | func (h *HCI) StopScanning() error {
h.params.scanEnable.LEScanEnable = 0
return h.Send(&h.params.scanEnable, nil)
} | go | func (h *HCI) StopScanning() error {
h.params.scanEnable.LEScanEnable = 0
return h.Send(&h.params.scanEnable, nil)
} | [
"func",
"(",
"h",
"*",
"HCI",
")",
"StopScanning",
"(",
")",
"error",
"{",
"h",
".",
"params",
".",
"scanEnable",
".",
"LEScanEnable",
"=",
"0",
"\n",
"return",
"h",
".",
"Send",
"(",
"&",
"h",
".",
"params",
".",
"scanEnable",
",",
"nil",
")",
"... | // StopScanning stops scanning. | [
"StopScanning",
"stops",
"scanning",
"."
] | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/gap.go#L38-L41 |
132,201 | currantlabs/ble | linux/hci/gap.go | AdvertiseNameAndServices | func (h *HCI) AdvertiseNameAndServices(name string, uuids ...ble.UUID) error {
ad, err := adv.NewPacket(adv.Flags(adv.FlagGeneralDiscoverable | adv.FlagLEOnly))
if err != nil {
return err
}
f := adv.AllUUID
// Current length of ad packet plus two bytes of length and tag.
l := ad.Len() + 1 + 1
for _, u := rang... | go | func (h *HCI) AdvertiseNameAndServices(name string, uuids ...ble.UUID) error {
ad, err := adv.NewPacket(adv.Flags(adv.FlagGeneralDiscoverable | adv.FlagLEOnly))
if err != nil {
return err
}
f := adv.AllUUID
// Current length of ad packet plus two bytes of length and tag.
l := ad.Len() + 1 + 1
for _, u := rang... | [
"func",
"(",
"h",
"*",
"HCI",
")",
"AdvertiseNameAndServices",
"(",
"name",
"string",
",",
"uuids",
"...",
"ble",
".",
"UUID",
")",
"error",
"{",
"ad",
",",
"err",
":=",
"adv",
".",
"NewPacket",
"(",
"adv",
".",
"Flags",
"(",
"adv",
".",
"FlagGeneral... | // AdvertiseNameAndServices advertises device name, and specified service UUIDs.
// It tries to fit the UUIDs in the advertising data as much as possible.
// If name doesn't fit in the advertising data, it will be put in scan response. | [
"AdvertiseNameAndServices",
"advertises",
"device",
"name",
"and",
"specified",
"service",
"UUIDs",
".",
"It",
"tries",
"to",
"fit",
"the",
"UUIDs",
"in",
"the",
"advertising",
"data",
"as",
"much",
"as",
"possible",
".",
"If",
"name",
"doesn",
"t",
"fit",
"... | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/gap.go#L46-L79 |
132,202 | currantlabs/ble | linux/hci/gap.go | StopAdvertising | func (h *HCI) StopAdvertising() error {
h.params.advEnable.AdvertisingEnable = 0
return h.Send(&h.params.advEnable, nil)
} | go | func (h *HCI) StopAdvertising() error {
h.params.advEnable.AdvertisingEnable = 0
return h.Send(&h.params.advEnable, nil)
} | [
"func",
"(",
"h",
"*",
"HCI",
")",
"StopAdvertising",
"(",
")",
"error",
"{",
"h",
".",
"params",
".",
"advEnable",
".",
"AdvertisingEnable",
"=",
"0",
"\n",
"return",
"h",
".",
"Send",
"(",
"&",
"h",
".",
"params",
".",
"advEnable",
",",
"nil",
")... | // StopAdvertising stops advertising. | [
"StopAdvertising",
"stops",
"advertising",
"."
] | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/gap.go#L130-L133 |
132,203 | currantlabs/ble | linux/hci/gap.go | Accept | func (h *HCI) Accept() (ble.Conn, error) {
var tmo <-chan time.Time
if h.listenerTmo != time.Duration(0) {
tmo = time.After(h.listenerTmo)
}
select {
case <-h.done:
return nil, h.err
case c := <-h.chSlaveConn:
return c, nil
case <-tmo:
return nil, fmt.Errorf("listner timed out")
}
} | go | func (h *HCI) Accept() (ble.Conn, error) {
var tmo <-chan time.Time
if h.listenerTmo != time.Duration(0) {
tmo = time.After(h.listenerTmo)
}
select {
case <-h.done:
return nil, h.err
case c := <-h.chSlaveConn:
return c, nil
case <-tmo:
return nil, fmt.Errorf("listner timed out")
}
} | [
"func",
"(",
"h",
"*",
"HCI",
")",
"Accept",
"(",
")",
"(",
"ble",
".",
"Conn",
",",
"error",
")",
"{",
"var",
"tmo",
"<-",
"chan",
"time",
".",
"Time",
"\n",
"if",
"h",
".",
"listenerTmo",
"!=",
"time",
".",
"Duration",
"(",
"0",
")",
"{",
"... | // Accept starts advertising and accepts connection. | [
"Accept",
"starts",
"advertising",
"and",
"accepts",
"connection",
"."
] | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/gap.go#L136-L149 |
132,204 | currantlabs/ble | linux/hci/gap.go | SetAdvertisement | func (h *HCI) SetAdvertisement(ad []byte, sr []byte) error {
if len(ad) > adv.MaxEIRPacketLength || len(sr) > adv.MaxEIRPacketLength {
return ble.ErrEIRPacketTooLong
}
h.params.advData.AdvertisingDataLength = uint8(len(ad))
copy(h.params.advData.AdvertisingData[:], ad)
if err := h.Send(&h.params.advData, nil); ... | go | func (h *HCI) SetAdvertisement(ad []byte, sr []byte) error {
if len(ad) > adv.MaxEIRPacketLength || len(sr) > adv.MaxEIRPacketLength {
return ble.ErrEIRPacketTooLong
}
h.params.advData.AdvertisingDataLength = uint8(len(ad))
copy(h.params.advData.AdvertisingData[:], ad)
if err := h.Send(&h.params.advData, nil); ... | [
"func",
"(",
"h",
"*",
"HCI",
")",
"SetAdvertisement",
"(",
"ad",
"[",
"]",
"byte",
",",
"sr",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"len",
"(",
"ad",
")",
">",
"adv",
".",
"MaxEIRPacketLength",
"||",
"len",
"(",
"sr",
")",
">",
"adv",
"."... | // SetAdvertisement sets advertising data and scanResp. | [
"SetAdvertisement",
"sets",
"advertising",
"data",
"and",
"scanResp",
"."
] | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/gap.go#L197-L214 |
132,205 | currantlabs/ble | linux/hci/signal_gen.go | Marshal | func (s *CommandReject) Marshal() []byte {
buf := bytes.NewBuffer(make([]byte, 0))
binary.Write(buf, binary.LittleEndian, s)
return buf.Bytes()
} | go | func (s *CommandReject) Marshal() []byte {
buf := bytes.NewBuffer(make([]byte, 0))
binary.Write(buf, binary.LittleEndian, s)
return buf.Bytes()
} | [
"func",
"(",
"s",
"*",
"CommandReject",
")",
"Marshal",
"(",
")",
"[",
"]",
"byte",
"{",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
")",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".... | // Marshal serializes the command parameters into binary form. | [
"Marshal",
"serializes",
"the",
"command",
"parameters",
"into",
"binary",
"form",
"."
] | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/signal_gen.go#L21-L25 |
132,206 | currantlabs/ble | linux/hci/signal_gen.go | Unmarshal | func (s *CommandReject) Unmarshal(b []byte) error {
return binary.Read(bytes.NewBuffer(b), binary.LittleEndian, s)
} | go | func (s *CommandReject) Unmarshal(b []byte) error {
return binary.Read(bytes.NewBuffer(b), binary.LittleEndian, s)
} | [
"func",
"(",
"s",
"*",
"CommandReject",
")",
"Unmarshal",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"binary",
".",
"Read",
"(",
"bytes",
".",
"NewBuffer",
"(",
"b",
")",
",",
"binary",
".",
"LittleEndian",
",",
"s",
")",
"\n",
"}"
] | // Unmarshal de-serializes the binary data and stores the result in the receiver. | [
"Unmarshal",
"de",
"-",
"serializes",
"the",
"binary",
"data",
"and",
"stores",
"the",
"result",
"in",
"the",
"receiver",
"."
] | c1d21c164cf83d3360fd5abd73a3405cb588c06c | https://github.com/currantlabs/ble/blob/c1d21c164cf83d3360fd5abd73a3405cb588c06c/linux/hci/signal_gen.go#L28-L30 |
132,207 | elithrar/simple-scrypt | scrypt.go | CompareHashAndPassword | func CompareHashAndPassword(hash []byte, password []byte) error {
// Decode existing hash, retrieve params and salt.
params, salt, dk, err := decodeHash(hash)
if err != nil {
return err
}
// scrypt the cleartext password with the same parameters and salt
other, err := scrypt.Key(password, salt, params.N, param... | go | func CompareHashAndPassword(hash []byte, password []byte) error {
// Decode existing hash, retrieve params and salt.
params, salt, dk, err := decodeHash(hash)
if err != nil {
return err
}
// scrypt the cleartext password with the same parameters and salt
other, err := scrypt.Key(password, salt, params.N, param... | [
"func",
"CompareHashAndPassword",
"(",
"hash",
"[",
"]",
"byte",
",",
"password",
"[",
"]",
"byte",
")",
"error",
"{",
"// Decode existing hash, retrieve params and salt.",
"params",
",",
"salt",
",",
"dk",
",",
"err",
":=",
"decodeHash",
"(",
"hash",
")",
"\n... | // CompareHashAndPassword compares a derived key with the possible cleartext
// equivalent. The parameters used in the provided derived key are used.
// The comparison performed by this function is constant-time. It returns nil
// on success, and an error if the derived keys do not match. | [
"CompareHashAndPassword",
"compares",
"a",
"derived",
"key",
"with",
"the",
"possible",
"cleartext",
"equivalent",
".",
"The",
"parameters",
"used",
"in",
"the",
"provided",
"derived",
"key",
"are",
"used",
".",
"The",
"comparison",
"performed",
"by",
"this",
"f... | 28a8a89db0e1201d1b61b8ee90597fd7d035c0d5 | https://github.com/elithrar/simple-scrypt/blob/28a8a89db0e1201d1b61b8ee90597fd7d035c0d5/scrypt.go#L102-L121 |
132,208 | elithrar/simple-scrypt | scrypt.go | Check | func (p *Params) Check() error {
// Validate N
if p.N > maxInt || p.N <= 1 || p.N%2 != 0 {
return ErrInvalidParams
}
// Validate r
if p.R < 1 || p.R > maxInt {
return ErrInvalidParams
}
// Validate p
if p.P < 1 || p.P > maxInt {
return ErrInvalidParams
}
// Validate that r & p don't exceed 2^30 and t... | go | func (p *Params) Check() error {
// Validate N
if p.N > maxInt || p.N <= 1 || p.N%2 != 0 {
return ErrInvalidParams
}
// Validate r
if p.R < 1 || p.R > maxInt {
return ErrInvalidParams
}
// Validate p
if p.P < 1 || p.P > maxInt {
return ErrInvalidParams
}
// Validate that r & p don't exceed 2^30 and t... | [
"func",
"(",
"p",
"*",
"Params",
")",
"Check",
"(",
")",
"error",
"{",
"// Validate N",
"if",
"p",
".",
"N",
">",
"maxInt",
"||",
"p",
".",
"N",
"<=",
"1",
"||",
"p",
".",
"N",
"%",
"2",
"!=",
"0",
"{",
"return",
"ErrInvalidParams",
"\n",
"}",
... | // Check checks that the parameters are valid for input into the
// scrypt key derivation function. | [
"Check",
"checks",
"that",
"the",
"parameters",
"are",
"valid",
"for",
"input",
"into",
"the",
"scrypt",
"key",
"derivation",
"function",
"."
] | 28a8a89db0e1201d1b61b8ee90597fd7d035c0d5 | https://github.com/elithrar/simple-scrypt/blob/28a8a89db0e1201d1b61b8ee90597fd7d035c0d5/scrypt.go#L125-L158 |
132,209 | djherbis/buffer | list.go | Pop | func (l *List) Pop() (b Buffer) {
b = (*l)[0]
*l = (*l)[1:]
return b
} | go | func (l *List) Pop() (b Buffer) {
b = (*l)[0]
*l = (*l)[1:]
return b
} | [
"func",
"(",
"l",
"*",
"List",
")",
"Pop",
"(",
")",
"(",
"b",
"Buffer",
")",
"{",
"b",
"=",
"(",
"*",
"l",
")",
"[",
"0",
"]",
"\n",
"*",
"l",
"=",
"(",
"*",
"l",
")",
"[",
"1",
":",
"]",
"\n",
"return",
"b",
"\n",
"}"
] | // Pop removes and returns a Buffer from the front of the List | [
"Pop",
"removes",
"and",
"returns",
"a",
"Buffer",
"from",
"the",
"front",
"of",
"the",
"List"
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/list.go#L43-L47 |
132,210 | djherbis/buffer | limio/limit.go | LimitWriter | func LimitWriter(w io.Writer, n int64) io.Writer {
return &limitedWriter{W: w, N: n}
} | go | func LimitWriter(w io.Writer, n int64) io.Writer {
return &limitedWriter{W: w, N: n}
} | [
"func",
"LimitWriter",
"(",
"w",
"io",
".",
"Writer",
",",
"n",
"int64",
")",
"io",
".",
"Writer",
"{",
"return",
"&",
"limitedWriter",
"{",
"W",
":",
"w",
",",
"N",
":",
"n",
"}",
"\n",
"}"
] | // LimitWriter works like io.LimitReader. It writes at most n bytes
// to the underlying Writer. It returns io.ErrShortWrite if more than n
// bytes are attempted to be written. | [
"LimitWriter",
"works",
"like",
"io",
".",
"LimitReader",
".",
"It",
"writes",
"at",
"most",
"n",
"bytes",
"to",
"the",
"underlying",
"Writer",
".",
"It",
"returns",
"io",
".",
"ErrShortWrite",
"if",
"more",
"than",
"n",
"bytes",
"are",
"attempted",
"to",
... | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/limio/limit.go#L29-L31 |
132,211 | djherbis/buffer | wrapio/limitwrap.go | NewWrapper | func NewWrapper(rwa ReadWriterAt, L, O, N int64) *Wrapper {
return &Wrapper{
L: L,
O: O,
N: N,
rwa: rwa,
}
} | go | func NewWrapper(rwa ReadWriterAt, L, O, N int64) *Wrapper {
return &Wrapper{
L: L,
O: O,
N: N,
rwa: rwa,
}
} | [
"func",
"NewWrapper",
"(",
"rwa",
"ReadWriterAt",
",",
"L",
",",
"O",
",",
"N",
"int64",
")",
"*",
"Wrapper",
"{",
"return",
"&",
"Wrapper",
"{",
"L",
":",
"L",
",",
"O",
":",
"O",
",",
"N",
":",
"N",
",",
"rwa",
":",
"rwa",
",",
"}",
"\n",
... | // NewWrapper creates a Wrapper based on ReadWriterAt rwa.
// L is the current length, O is the current offset, and N is offset at which we "wrap". | [
"NewWrapper",
"creates",
"a",
"Wrapper",
"based",
"on",
"ReadWriterAt",
"rwa",
".",
"L",
"is",
"the",
"current",
"length",
"O",
"is",
"the",
"current",
"offset",
"and",
"N",
"is",
"offset",
"at",
"which",
"we",
"wrap",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/limitwrap.go#L30-L37 |
132,212 | djherbis/buffer | wrapio/wrap.go | NewWrapWriter | func NewWrapWriter(w io.WriterAt, off int64, wrapAt int64) *WrapWriter {
return &WrapWriter{
&wrapper{
doat: w.WriteAt,
off: (off % wrapAt),
wrapAt: wrapAt,
},
}
} | go | func NewWrapWriter(w io.WriterAt, off int64, wrapAt int64) *WrapWriter {
return &WrapWriter{
&wrapper{
doat: w.WriteAt,
off: (off % wrapAt),
wrapAt: wrapAt,
},
}
} | [
"func",
"NewWrapWriter",
"(",
"w",
"io",
".",
"WriterAt",
",",
"off",
"int64",
",",
"wrapAt",
"int64",
")",
"*",
"WrapWriter",
"{",
"return",
"&",
"WrapWriter",
"{",
"&",
"wrapper",
"{",
"doat",
":",
"w",
".",
"WriteAt",
",",
"off",
":",
"(",
"off",
... | // NewWrapWriter creates a WrapWriter starting at offset off, and wrapping at offset wrapAt. | [
"NewWrapWriter",
"creates",
"a",
"WrapWriter",
"starting",
"at",
"offset",
"off",
"and",
"wrapping",
"at",
"offset",
"wrapAt",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/wrap.go#L46-L54 |
132,213 | djherbis/buffer | wrapio/wrap.go | Write | func (w *WrapWriter) Write(p []byte) (n int, err error) {
n, err = Wrap(w, p, w.off, w.wrapAt)
w.off = (w.off + int64(n)) % w.wrapAt
return n, err
} | go | func (w *WrapWriter) Write(p []byte) (n int, err error) {
n, err = Wrap(w, p, w.off, w.wrapAt)
w.off = (w.off + int64(n)) % w.wrapAt
return n, err
} | [
"func",
"(",
"w",
"*",
"WrapWriter",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"n",
",",
"err",
"=",
"Wrap",
"(",
"w",
",",
"p",
",",
"w",
".",
"off",
",",
"w",
".",
"wrapAt",
")",
"\n"... | // Write writes p starting at the current offset, wrapping when it reaches the end.
// The current offset is shifted forward by the amount written. | [
"Write",
"writes",
"p",
"starting",
"at",
"the",
"current",
"offset",
"wrapping",
"when",
"it",
"reaches",
"the",
"end",
".",
"The",
"current",
"offset",
"is",
"shifted",
"forward",
"by",
"the",
"amount",
"written",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/wrap.go#L58-L62 |
132,214 | djherbis/buffer | wrapio/wrap.go | WriteAt | func (w *WrapWriter) WriteAt(p []byte, off int64) (n int, err error) {
return Wrap(w, p, off, w.wrapAt)
} | go | func (w *WrapWriter) WriteAt(p []byte, off int64) (n int, err error) {
return Wrap(w, p, off, w.wrapAt)
} | [
"func",
"(",
"w",
"*",
"WrapWriter",
")",
"WriteAt",
"(",
"p",
"[",
"]",
"byte",
",",
"off",
"int64",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"Wrap",
"(",
"w",
",",
"p",
",",
"off",
",",
"w",
".",
"wrapAt",
")",
"\n",
... | // WriteAt writes p starting at offset off, wrapping when it reaches the end. | [
"WriteAt",
"writes",
"p",
"starting",
"at",
"offset",
"off",
"wrapping",
"when",
"it",
"reaches",
"the",
"end",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/wrap.go#L65-L67 |
132,215 | djherbis/buffer | wrapio/wrap.go | NewWrapReader | func NewWrapReader(r io.ReaderAt, off int64, wrapAt int64) *WrapReader {
return &WrapReader{
&wrapper{
doat: r.ReadAt,
off: (off % wrapAt),
wrapAt: wrapAt,
},
}
} | go | func NewWrapReader(r io.ReaderAt, off int64, wrapAt int64) *WrapReader {
return &WrapReader{
&wrapper{
doat: r.ReadAt,
off: (off % wrapAt),
wrapAt: wrapAt,
},
}
} | [
"func",
"NewWrapReader",
"(",
"r",
"io",
".",
"ReaderAt",
",",
"off",
"int64",
",",
"wrapAt",
"int64",
")",
"*",
"WrapReader",
"{",
"return",
"&",
"WrapReader",
"{",
"&",
"wrapper",
"{",
"doat",
":",
"r",
".",
"ReadAt",
",",
"off",
":",
"(",
"off",
... | // NewWrapReader creates a WrapReader starting at offset off, and wrapping at offset wrapAt. | [
"NewWrapReader",
"creates",
"a",
"WrapReader",
"starting",
"at",
"offset",
"off",
"and",
"wrapping",
"at",
"offset",
"wrapAt",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/wrap.go#L75-L83 |
132,216 | djherbis/buffer | wrapio/wrap.go | Read | func (r *WrapReader) Read(p []byte) (n int, err error) {
n, err = Wrap(r, p, r.off, r.wrapAt)
r.off = (r.off + int64(n)) % r.wrapAt
return n, err
} | go | func (r *WrapReader) Read(p []byte) (n int, err error) {
n, err = Wrap(r, p, r.off, r.wrapAt)
r.off = (r.off + int64(n)) % r.wrapAt
return n, err
} | [
"func",
"(",
"r",
"*",
"WrapReader",
")",
"Read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"n",
",",
"err",
"=",
"Wrap",
"(",
"r",
",",
"p",
",",
"r",
".",
"off",
",",
"r",
".",
"wrapAt",
")",
"\n",... | // Read reads into p starting at the current offset, wrapping if it reaches the end.
// The current offset is shifted forward by the amount read. | [
"Read",
"reads",
"into",
"p",
"starting",
"at",
"the",
"current",
"offset",
"wrapping",
"if",
"it",
"reaches",
"the",
"end",
".",
"The",
"current",
"offset",
"is",
"shifted",
"forward",
"by",
"the",
"amount",
"read",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/wrap.go#L87-L91 |
132,217 | djherbis/buffer | wrapio/wrap.go | ReadAt | func (r *WrapReader) ReadAt(p []byte, off int64) (n int, err error) {
return Wrap(r, p, off, r.wrapAt)
} | go | func (r *WrapReader) ReadAt(p []byte, off int64) (n int, err error) {
return Wrap(r, p, off, r.wrapAt)
} | [
"func",
"(",
"r",
"*",
"WrapReader",
")",
"ReadAt",
"(",
"p",
"[",
"]",
"byte",
",",
"off",
"int64",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"Wrap",
"(",
"r",
",",
"p",
",",
"off",
",",
"r",
".",
"wrapAt",
")",
"\n",
... | // ReadAt reads into p starting at the current offset, wrapping when it reaches the end. | [
"ReadAt",
"reads",
"into",
"p",
"starting",
"at",
"the",
"current",
"offset",
"wrapping",
"when",
"it",
"reaches",
"the",
"end",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/wrapio/wrap.go#L94-L96 |
132,218 | djherbis/buffer | spill.go | NewSpill | func NewSpill(buf Buffer, w io.Writer) Buffer {
if w == nil {
w = ioutil.Discard
}
return &spill{
Buffer: buf,
Spiller: w,
}
} | go | func NewSpill(buf Buffer, w io.Writer) Buffer {
if w == nil {
w = ioutil.Discard
}
return &spill{
Buffer: buf,
Spiller: w,
}
} | [
"func",
"NewSpill",
"(",
"buf",
"Buffer",
",",
"w",
"io",
".",
"Writer",
")",
"Buffer",
"{",
"if",
"w",
"==",
"nil",
"{",
"w",
"=",
"ioutil",
".",
"Discard",
"\n",
"}",
"\n",
"return",
"&",
"spill",
"{",
"Buffer",
":",
"buf",
",",
"Spiller",
":",... | // NewSpill returns a Buffer which writes data to w when there's an error
// writing to buf. Such as when buf is full, or the disk is full, etc. | [
"NewSpill",
"returns",
"a",
"Buffer",
"which",
"writes",
"data",
"to",
"w",
"when",
"there",
"s",
"an",
"error",
"writing",
"to",
"buf",
".",
"Such",
"as",
"when",
"buf",
"is",
"full",
"or",
"the",
"disk",
"is",
"full",
"etc",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/spill.go#L17-L25 |
132,219 | djherbis/buffer | file.go | NewFile | func NewFile(N int64, file File) BufferAt {
return &fileBuffer{
file: file,
Wrapper: wrapio.NewWrapper(file, 0, 0, N),
}
} | go | func NewFile(N int64, file File) BufferAt {
return &fileBuffer{
file: file,
Wrapper: wrapio.NewWrapper(file, 0, 0, N),
}
} | [
"func",
"NewFile",
"(",
"N",
"int64",
",",
"file",
"File",
")",
"BufferAt",
"{",
"return",
"&",
"fileBuffer",
"{",
"file",
":",
"file",
",",
"Wrapper",
":",
"wrapio",
".",
"NewWrapper",
"(",
"file",
",",
"0",
",",
"0",
",",
"N",
")",
",",
"}",
"\... | // NewFile returns a new BufferAt backed by "file" with max-size N. | [
"NewFile",
"returns",
"a",
"new",
"BufferAt",
"backed",
"by",
"file",
"with",
"max",
"-",
"size",
"N",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/file.go#L29-L34 |
132,220 | djherbis/buffer | mem.go | New | func New(n int64) BufferAt {
return &memory{
N: n,
Buffer: bytes.NewBuffer(nil),
}
} | go | func New(n int64) BufferAt {
return &memory{
N: n,
Buffer: bytes.NewBuffer(nil),
}
} | [
"func",
"New",
"(",
"n",
"int64",
")",
"BufferAt",
"{",
"return",
"&",
"memory",
"{",
"N",
":",
"n",
",",
"Buffer",
":",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
",",
"}",
"\n",
"}"
] | // New returns a new in memory BufferAt with max size N.
// It's backed by a bytes.Buffer. | [
"New",
"returns",
"a",
"new",
"in",
"memory",
"BufferAt",
"with",
"max",
"size",
"N",
".",
"It",
"s",
"backed",
"by",
"a",
"bytes",
".",
"Buffer",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/mem.go#L19-L24 |
132,221 | djherbis/buffer | buffer.go | NewUnboundedBuffer | func NewUnboundedBuffer(mem, file int64) Buffer {
return NewMulti(New(mem), NewPartition(NewFilePool(file, os.TempDir())))
} | go | func NewUnboundedBuffer(mem, file int64) Buffer {
return NewMulti(New(mem), NewPartition(NewFilePool(file, os.TempDir())))
} | [
"func",
"NewUnboundedBuffer",
"(",
"mem",
",",
"file",
"int64",
")",
"Buffer",
"{",
"return",
"NewMulti",
"(",
"New",
"(",
"mem",
")",
",",
"NewPartition",
"(",
"NewFilePool",
"(",
"file",
",",
"os",
".",
"TempDir",
"(",
")",
")",
")",
")",
"\n",
"}"... | // NewUnboundedBuffer returns a Buffer which buffers "mem" bytes to memory
// and then creates file's of size "file" to buffer above "mem" bytes. | [
"NewUnboundedBuffer",
"returns",
"a",
"Buffer",
"which",
"buffers",
"mem",
"bytes",
"to",
"memory",
"and",
"then",
"creates",
"file",
"s",
"of",
"size",
"file",
"to",
"buffer",
"above",
"mem",
"bytes",
"."
] | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/buffer.go#L46-L48 |
132,222 | djherbis/buffer | multi.go | NewMultiAt | func NewMultiAt(buffers ...BufferAt) BufferAt {
if len(buffers) == 0 {
return nil
} else if len(buffers) == 1 {
return buffers[0]
}
buf := &chain{
Buf: buffers[0],
Next: NewMultiAt(buffers[1:]...),
}
buf.Defrag()
return buf
} | go | func NewMultiAt(buffers ...BufferAt) BufferAt {
if len(buffers) == 0 {
return nil
} else if len(buffers) == 1 {
return buffers[0]
}
buf := &chain{
Buf: buffers[0],
Next: NewMultiAt(buffers[1:]...),
}
buf.Defrag()
return buf
} | [
"func",
"NewMultiAt",
"(",
"buffers",
"...",
"BufferAt",
")",
"BufferAt",
"{",
"if",
"len",
"(",
"buffers",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"else",
"if",
"len",
"(",
"buffers",
")",
"==",
"1",
"{",
"return",
"buffers",
"[",
"0",
"]... | // NewMultiAt returns a BufferAt which is the logical concatenation of the passed BufferAts.
// The data in the buffers is shifted such that there is no non-empty buffer following
// a non-full buffer, this process is also run after every Read.
// If no buffers are passed, the returned Buffer is nil. | [
"NewMultiAt",
"returns",
"a",
"BufferAt",
"which",
"is",
"the",
"logical",
"concatenation",
"of",
"the",
"passed",
"BufferAts",
".",
"The",
"data",
"in",
"the",
"buffers",
"is",
"shifted",
"such",
"that",
"there",
"is",
"no",
"non",
"-",
"empty",
"buffer",
... | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/multi.go#L36-L51 |
132,223 | djherbis/buffer | multi.go | NewMulti | func NewMulti(buffers ...Buffer) Buffer {
bufAt := make([]BufferAt, len(buffers))
for i, buf := range buffers {
bufAt[i] = toBufferAt(buf)
}
return NewMultiAt(bufAt...)
} | go | func NewMulti(buffers ...Buffer) Buffer {
bufAt := make([]BufferAt, len(buffers))
for i, buf := range buffers {
bufAt[i] = toBufferAt(buf)
}
return NewMultiAt(bufAt...)
} | [
"func",
"NewMulti",
"(",
"buffers",
"...",
"Buffer",
")",
"Buffer",
"{",
"bufAt",
":=",
"make",
"(",
"[",
"]",
"BufferAt",
",",
"len",
"(",
"buffers",
")",
")",
"\n",
"for",
"i",
",",
"buf",
":=",
"range",
"buffers",
"{",
"bufAt",
"[",
"i",
"]",
... | // NewMulti returns a Buffer which is the logical concatenation of the passed buffers.
// The data in the buffers is shifted such that there is no non-empty buffer following
// a non-full buffer, this process is also run after every Read.
// If no buffers are passed, the returned Buffer is nil. | [
"NewMulti",
"returns",
"a",
"Buffer",
"which",
"is",
"the",
"logical",
"concatenation",
"of",
"the",
"passed",
"buffers",
".",
"The",
"data",
"in",
"the",
"buffers",
"is",
"shifted",
"such",
"that",
"there",
"is",
"no",
"non",
"-",
"empty",
"buffer",
"foll... | 3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3 | https://github.com/djherbis/buffer/blob/3c732ee9b562a82a6e1354ea29bbc7ddd9f333b3/multi.go#L57-L63 |
132,224 | gofn/gofn | iaas/tcp/tcp.go | New | func New(URL string) (p *Provider, err error) {
u, err := url.Parse(URL)
if err != nil {
return
}
if !strings.Contains(u.Scheme, "tcp") {
err = errInvalidURL
return
}
var clientPort int
if u.Port() != "" {
clientPort, err = strconv.Atoi(u.Port())
if err != nil {
return
}
}
p = &Provider{
Host:... | go | func New(URL string) (p *Provider, err error) {
u, err := url.Parse(URL)
if err != nil {
return
}
if !strings.Contains(u.Scheme, "tcp") {
err = errInvalidURL
return
}
var clientPort int
if u.Port() != "" {
clientPort, err = strconv.Atoi(u.Port())
if err != nil {
return
}
}
p = &Provider{
Host:... | [
"func",
"New",
"(",
"URL",
"string",
")",
"(",
"p",
"*",
"Provider",
",",
"err",
"error",
")",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"URL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"!",
"strin... | // New create provider | [
"New",
"create",
"provider"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/iaas/tcp/tcp.go#L23-L44 |
132,225 | gofn/gofn | iaas/tcp/tcp.go | CreateMachine | func (p *Provider) CreateMachine() (*iaas.Machine, error) {
return &iaas.Machine{
IP: p.Host,
Port: p.Port,
Kind: "TCP",
}, nil
} | go | func (p *Provider) CreateMachine() (*iaas.Machine, error) {
return &iaas.Machine{
IP: p.Host,
Port: p.Port,
Kind: "TCP",
}, nil
} | [
"func",
"(",
"p",
"*",
"Provider",
")",
"CreateMachine",
"(",
")",
"(",
"*",
"iaas",
".",
"Machine",
",",
"error",
")",
"{",
"return",
"&",
"iaas",
".",
"Machine",
"{",
"IP",
":",
"p",
".",
"Host",
",",
"Port",
":",
"p",
".",
"Port",
",",
"Kind... | // CreateMachine tcp iaas | [
"CreateMachine",
"tcp",
"iaas"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/iaas/tcp/tcp.go#L47-L53 |
132,226 | gofn/gofn | gofn.go | ProvideMachine | func ProvideMachine(ctx context.Context, service iaas.Iaas) (client *docker.Client, machine *iaas.Machine, err error) {
machine, err = service.CreateMachine()
if err != nil {
if machine != nil {
cerr := service.DeleteMachine()
if cerr != nil {
log.Errorln(cerr)
}
}
return
}
if machine.Port == 0 {... | go | func ProvideMachine(ctx context.Context, service iaas.Iaas) (client *docker.Client, machine *iaas.Machine, err error) {
machine, err = service.CreateMachine()
if err != nil {
if machine != nil {
cerr := service.DeleteMachine()
if cerr != nil {
log.Errorln(cerr)
}
}
return
}
if machine.Port == 0 {... | [
"func",
"ProvideMachine",
"(",
"ctx",
"context",
".",
"Context",
",",
"service",
"iaas",
".",
"Iaas",
")",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"machine",
"*",
"iaas",
".",
"Machine",
",",
"err",
"error",
")",
"{",
"machine",
",",
"err",
... | // ProvideMachine provisioning a machine in the cloud | [
"ProvideMachine",
"provisioning",
"a",
"machine",
"in",
"the",
"cloud"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/gofn.go#L19-L36 |
132,227 | gofn/gofn | gofn.go | PrepareContainer | func PrepareContainer(ctx context.Context, client *docker.Client, buildOpts *provision.BuildOptions, containerOpts *provision.ContainerOptions) (container *docker.Container, err error) {
img, err := provision.FnFindImage(client, buildOpts.GetImageName())
if err != nil && err != provision.ErrImageNotFound {
return
... | go | func PrepareContainer(ctx context.Context, client *docker.Client, buildOpts *provision.BuildOptions, containerOpts *provision.ContainerOptions) (container *docker.Container, err error) {
img, err := provision.FnFindImage(client, buildOpts.GetImageName())
if err != nil && err != provision.ErrImageNotFound {
return
... | [
"func",
"PrepareContainer",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"docker",
".",
"Client",
",",
"buildOpts",
"*",
"provision",
".",
"BuildOptions",
",",
"containerOpts",
"*",
"provision",
".",
"ContainerOptions",
")",
"(",
"container",
"*"... | // PrepareContainer build an image if necessary and run the container | [
"PrepareContainer",
"build",
"an",
"image",
"if",
"necessary",
"and",
"run",
"the",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/gofn.go#L39-L61 |
132,228 | gofn/gofn | gofn.go | RunWait | func RunWait(ctx context.Context, client *docker.Client, container *docker.Container) (errors chan error, err error) {
err = provision.FnStart(client, container.ID)
if err != nil {
return
}
errors = provision.FnWaitContainer(client, container.ID)
return
} | go | func RunWait(ctx context.Context, client *docker.Client, container *docker.Container) (errors chan error, err error) {
err = provision.FnStart(client, container.ID)
if err != nil {
return
}
errors = provision.FnWaitContainer(client, container.ID)
return
} | [
"func",
"RunWait",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"docker",
".",
"Client",
",",
"container",
"*",
"docker",
".",
"Container",
")",
"(",
"errors",
"chan",
"error",
",",
"err",
"error",
")",
"{",
"err",
"=",
"provision",
".",
... | // RunWait runs the conainer returning channels to control your status | [
"RunWait",
"runs",
"the",
"conainer",
"returning",
"channels",
"to",
"control",
"your",
"status"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/gofn.go#L64-L71 |
132,229 | gofn/gofn | gofn.go | Attach | func Attach(ctx context.Context, client *docker.Client, container *docker.Container, stdin io.Reader, stdout io.Writer, stderr io.Writer) (docker.CloseWaiter, error) {
return provision.FnAttach(client, container.ID, stdin, stdout, stderr)
} | go | func Attach(ctx context.Context, client *docker.Client, container *docker.Container, stdin io.Reader, stdout io.Writer, stderr io.Writer) (docker.CloseWaiter, error) {
return provision.FnAttach(client, container.ID, stdin, stdout, stderr)
} | [
"func",
"Attach",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"docker",
".",
"Client",
",",
"container",
"*",
"docker",
".",
"Container",
",",
"stdin",
"io",
".",
"Reader",
",",
"stdout",
"io",
".",
"Writer",
",",
"stderr",
"io",
".",
... | // Attach allow to connect into a running container and interact using stdout, stderr and stdin | [
"Attach",
"allow",
"to",
"connect",
"into",
"a",
"running",
"container",
"and",
"interact",
"using",
"stdout",
"stderr",
"and",
"stdin"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/gofn.go#L74-L76 |
132,230 | gofn/gofn | gofn.go | Run | func Run(ctx context.Context, buildOpts *provision.BuildOptions, containerOpts *provision.ContainerOptions) (stdout string, stderr string, err error) {
var client *docker.Client
var container *docker.Container
var machine *iaas.Machine
done := make(chan struct{})
go func(ctx context.Context, done chan struct{}) {
... | go | func Run(ctx context.Context, buildOpts *provision.BuildOptions, containerOpts *provision.ContainerOptions) (stdout string, stderr string, err error) {
var client *docker.Client
var container *docker.Container
var machine *iaas.Machine
done := make(chan struct{})
go func(ctx context.Context, done chan struct{}) {
... | [
"func",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"buildOpts",
"*",
"provision",
".",
"BuildOptions",
",",
"containerOpts",
"*",
"provision",
".",
"ContainerOptions",
")",
"(",
"stdout",
"string",
",",
"stderr",
"string",
",",
"err",
"error",
")",
... | // Run runs the designed image | [
"Run",
"runs",
"the",
"designed",
"image"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/gofn.go#L79-L157 |
132,231 | gofn/gofn | gofn.go | DestroyContainer | func DestroyContainer(ctx context.Context, client *docker.Client, container *docker.Container) error {
return provision.FnRemove(client, container.ID)
} | go | func DestroyContainer(ctx context.Context, client *docker.Client, container *docker.Container) error {
return provision.FnRemove(client, container.ID)
} | [
"func",
"DestroyContainer",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"docker",
".",
"Client",
",",
"container",
"*",
"docker",
".",
"Container",
")",
"error",
"{",
"return",
"provision",
".",
"FnRemove",
"(",
"client",
",",
"container",
"... | // DestroyContainer remove by force a container | [
"DestroyContainer",
"remove",
"by",
"force",
"a",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/gofn.go#L160-L162 |
132,232 | gofn/gofn | provision/docker.go | GetImageName | func (opts BuildOptions) GetImageName() string {
if opts.DoNotUsePrefixImageName {
return opts.ImageName
}
return path.Join("gofn", opts.ImageName)
} | go | func (opts BuildOptions) GetImageName() string {
if opts.DoNotUsePrefixImageName {
return opts.ImageName
}
return path.Join("gofn", opts.ImageName)
} | [
"func",
"(",
"opts",
"BuildOptions",
")",
"GetImageName",
"(",
")",
"string",
"{",
"if",
"opts",
".",
"DoNotUsePrefixImageName",
"{",
"return",
"opts",
".",
"ImageName",
"\n",
"}",
"\n",
"return",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"opts",
".",
... | // GetImageName sets prefix gofn when needed | [
"GetImageName",
"sets",
"prefix",
"gofn",
"when",
"needed"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L53-L58 |
132,233 | gofn/gofn | provision/docker.go | FnRemove | func FnRemove(client *docker.Client, containerID string) (err error) {
err = client.RemoveContainer(docker.RemoveContainerOptions{ID: containerID, Force: true})
return
} | go | func FnRemove(client *docker.Client, containerID string) (err error) {
err = client.RemoveContainer(docker.RemoveContainerOptions{ID: containerID, Force: true})
return
} | [
"func",
"FnRemove",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
"string",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"client",
".",
"RemoveContainer",
"(",
"docker",
".",
"RemoveContainerOptions",
"{",
"ID",
":",
"containerID",
",... | // FnRemove remove container | [
"FnRemove",
"remove",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L61-L64 |
132,234 | gofn/gofn | provision/docker.go | FnContainer | func FnContainer(client *docker.Client, opts ContainerOptions) (container *docker.Container, err error) {
config := &docker.Config{
Image: opts.Image,
Cmd: opts.Cmd,
Env: opts.Env,
StdinOnce: true,
OpenStdin: true,
}
var uid uuid.UUID
uid, err = uuid.NewV4()
if err != nil {
return
}
c... | go | func FnContainer(client *docker.Client, opts ContainerOptions) (container *docker.Container, err error) {
config := &docker.Config{
Image: opts.Image,
Cmd: opts.Cmd,
Env: opts.Env,
StdinOnce: true,
OpenStdin: true,
}
var uid uuid.UUID
uid, err = uuid.NewV4()
if err != nil {
return
}
c... | [
"func",
"FnContainer",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"opts",
"ContainerOptions",
")",
"(",
"container",
"*",
"docker",
".",
"Container",
",",
"err",
"error",
")",
"{",
"config",
":=",
"&",
"docker",
".",
"Config",
"{",
"Image",
":",
... | // FnContainer create container | [
"FnContainer",
"create",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L67-L86 |
132,235 | gofn/gofn | provision/docker.go | FnImageBuild | func FnImageBuild(client *docker.Client, opts *BuildOptions) (Name string, Stdout *bytes.Buffer, err error) {
if opts.Dockerfile == "" {
opts.Dockerfile = "Dockerfile"
}
if opts.ContextDir == "" && opts.RemoteURI == "" {
opts.ContextDir = "./"
}
err = auth(client, opts)
if err != nil {
return
}
stdout := ... | go | func FnImageBuild(client *docker.Client, opts *BuildOptions) (Name string, Stdout *bytes.Buffer, err error) {
if opts.Dockerfile == "" {
opts.Dockerfile = "Dockerfile"
}
if opts.ContextDir == "" && opts.RemoteURI == "" {
opts.ContextDir = "./"
}
err = auth(client, opts)
if err != nil {
return
}
stdout := ... | [
"func",
"FnImageBuild",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"opts",
"*",
"BuildOptions",
")",
"(",
"Name",
"string",
",",
"Stdout",
"*",
"bytes",
".",
"Buffer",
",",
"err",
"error",
")",
"{",
"if",
"opts",
".",
"Dockerfile",
"==",
"\"",
... | // FnImageBuild builds an image | [
"FnImageBuild",
"builds",
"an",
"image"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L89-L126 |
132,236 | gofn/gofn | provision/docker.go | FnPull | func FnPull(client *docker.Client, opts *BuildOptions) (err error) {
repo, tag := parseDockerImage(opts.GetImageName())
err = client.PullImage(docker.PullImageOptions{
Repository: repo,
Tag: tag,
}, opts.Auth)
return
} | go | func FnPull(client *docker.Client, opts *BuildOptions) (err error) {
repo, tag := parseDockerImage(opts.GetImageName())
err = client.PullImage(docker.PullImageOptions{
Repository: repo,
Tag: tag,
}, opts.Auth)
return
} | [
"func",
"FnPull",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"opts",
"*",
"BuildOptions",
")",
"(",
"err",
"error",
")",
"{",
"repo",
",",
"tag",
":=",
"parseDockerImage",
"(",
"opts",
".",
"GetImageName",
"(",
")",
")",
"\n",
"err",
"=",
"cli... | // FnPull pull image from registry | [
"FnPull",
"pull",
"image",
"from",
"registry"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L144-L151 |
132,237 | gofn/gofn | provision/docker.go | FnFindImage | func FnFindImage(client *docker.Client, imageName string) (image docker.APIImages, err error) {
var imgs []docker.APIImages
imgs, err = client.ListImages(docker.ListImagesOptions{Filter: imageName})
if err != nil {
return
}
if len(imgs) == 0 {
err = ErrImageNotFound
return
}
image = imgs[0]
return
} | go | func FnFindImage(client *docker.Client, imageName string) (image docker.APIImages, err error) {
var imgs []docker.APIImages
imgs, err = client.ListImages(docker.ListImagesOptions{Filter: imageName})
if err != nil {
return
}
if len(imgs) == 0 {
err = ErrImageNotFound
return
}
image = imgs[0]
return
} | [
"func",
"FnFindImage",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"imageName",
"string",
")",
"(",
"image",
"docker",
".",
"APIImages",
",",
"err",
"error",
")",
"{",
"var",
"imgs",
"[",
"]",
"docker",
".",
"APIImages",
"\n",
"imgs",
",",
"err",... | // FnFindImage returns image data by name | [
"FnFindImage",
"returns",
"image",
"data",
"by",
"name"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L169-L181 |
132,238 | gofn/gofn | provision/docker.go | FnFindContainerByID | func FnFindContainerByID(client *docker.Client, ID string) (container docker.APIContainers, err error) {
var containers []docker.APIContainers
containers, err = client.ListContainers(docker.ListContainersOptions{All: true})
if err != nil {
return
}
for _, v := range containers {
if v.ID == ID {
container = ... | go | func FnFindContainerByID(client *docker.Client, ID string) (container docker.APIContainers, err error) {
var containers []docker.APIContainers
containers, err = client.ListContainers(docker.ListContainersOptions{All: true})
if err != nil {
return
}
for _, v := range containers {
if v.ID == ID {
container = ... | [
"func",
"FnFindContainerByID",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"ID",
"string",
")",
"(",
"container",
"docker",
".",
"APIContainers",
",",
"err",
"error",
")",
"{",
"var",
"containers",
"[",
"]",
"docker",
".",
"APIContainers",
"\n",
"con... | // FnFindContainerByID return container by ID | [
"FnFindContainerByID",
"return",
"container",
"by",
"ID"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L184-L198 |
132,239 | gofn/gofn | provision/docker.go | FnFindContainer | func FnFindContainer(client *docker.Client, imageName string) (container docker.APIContainers, err error) {
var containers []docker.APIContainers
containers, err = client.ListContainers(docker.ListContainersOptions{All: true})
if err != nil {
return
}
if !strings.HasPrefix(imageName, "gofn") {
imageName = "go... | go | func FnFindContainer(client *docker.Client, imageName string) (container docker.APIContainers, err error) {
var containers []docker.APIContainers
containers, err = client.ListContainers(docker.ListContainersOptions{All: true})
if err != nil {
return
}
if !strings.HasPrefix(imageName, "gofn") {
imageName = "go... | [
"func",
"FnFindContainer",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"imageName",
"string",
")",
"(",
"container",
"docker",
".",
"APIContainers",
",",
"err",
"error",
")",
"{",
"var",
"containers",
"[",
"]",
"docker",
".",
"APIContainers",
"\n",
"... | // FnFindContainer return container by image name | [
"FnFindContainer",
"return",
"container",
"by",
"image",
"name"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L201-L220 |
132,240 | gofn/gofn | provision/docker.go | FnKillContainer | func FnKillContainer(client *docker.Client, containerID string) (err error) {
err = client.KillContainer(docker.KillContainerOptions{ID: containerID})
return
} | go | func FnKillContainer(client *docker.Client, containerID string) (err error) {
err = client.KillContainer(docker.KillContainerOptions{ID: containerID})
return
} | [
"func",
"FnKillContainer",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
"string",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"client",
".",
"KillContainer",
"(",
"docker",
".",
"KillContainerOptions",
"{",
"ID",
":",
"containerID",
... | // FnKillContainer kill the container | [
"FnKillContainer",
"kill",
"the",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L223-L226 |
132,241 | gofn/gofn | provision/docker.go | FnAttach | func FnAttach(client *docker.Client, containerID string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (w docker.CloseWaiter, err error) {
return client.AttachToContainerNonBlocking(docker.AttachToContainerOptions{
Container: containerID,
RawTerminal: true,
Stream: true,
Stdin: true,
... | go | func FnAttach(client *docker.Client, containerID string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (w docker.CloseWaiter, err error) {
return client.AttachToContainerNonBlocking(docker.AttachToContainerOptions{
Container: containerID,
RawTerminal: true,
Stream: true,
Stdin: true,
... | [
"func",
"FnAttach",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
"string",
",",
"stdin",
"io",
".",
"Reader",
",",
"stdout",
"io",
".",
"Writer",
",",
"stderr",
"io",
".",
"Writer",
")",
"(",
"w",
"docker",
".",
"CloseWaiter",
",",
... | //FnAttach attach into a running container | [
"FnAttach",
"attach",
"into",
"a",
"running",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L229-L242 |
132,242 | gofn/gofn | provision/docker.go | FnStart | func FnStart(client *docker.Client, containerID string) error {
return client.StartContainer(containerID, nil)
} | go | func FnStart(client *docker.Client, containerID string) error {
return client.StartContainer(containerID, nil)
} | [
"func",
"FnStart",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
"string",
")",
"error",
"{",
"return",
"client",
".",
"StartContainer",
"(",
"containerID",
",",
"nil",
")",
"\n",
"}"
] | // FnStart start the container | [
"FnStart",
"start",
"the",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L245-L247 |
132,243 | gofn/gofn | provision/docker.go | FnRun | func FnRun(client *docker.Client, containerID, input string) (Stdout *bytes.Buffer, Stderr *bytes.Buffer, err error) {
err = FnStart(client, containerID)
if err != nil {
return
}
// attach to write input
_, err = FnAttach(client, containerID, strings.NewReader(input), nil, nil)
if err != nil {
return
}
e ... | go | func FnRun(client *docker.Client, containerID, input string) (Stdout *bytes.Buffer, Stderr *bytes.Buffer, err error) {
err = FnStart(client, containerID)
if err != nil {
return
}
// attach to write input
_, err = FnAttach(client, containerID, strings.NewReader(input), nil, nil)
if err != nil {
return
}
e ... | [
"func",
"FnRun",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
",",
"input",
"string",
")",
"(",
"Stdout",
"*",
"bytes",
".",
"Buffer",
",",
"Stderr",
"*",
"bytes",
".",
"Buffer",
",",
"err",
"error",
")",
"{",
"err",
"=",
"FnStart... | // FnRun runs the container | [
"FnRun",
"runs",
"the",
"container"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L250-L274 |
132,244 | gofn/gofn | provision/docker.go | FnLogs | func FnLogs(client *docker.Client, containerID string, stdout io.Writer, stderr io.Writer) error {
return client.Logs(docker.LogsOptions{
Container: containerID,
Stdout: true,
Stderr: true,
ErrorStream: stderr,
OutputStream: stdout,
})
} | go | func FnLogs(client *docker.Client, containerID string, stdout io.Writer, stderr io.Writer) error {
return client.Logs(docker.LogsOptions{
Container: containerID,
Stdout: true,
Stderr: true,
ErrorStream: stderr,
OutputStream: stdout,
})
} | [
"func",
"FnLogs",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
"string",
",",
"stdout",
"io",
".",
"Writer",
",",
"stderr",
"io",
".",
"Writer",
")",
"error",
"{",
"return",
"client",
".",
"Logs",
"(",
"docker",
".",
"LogsOptions",
... | // FnLogs logs all container activity | [
"FnLogs",
"logs",
"all",
"container",
"activity"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L277-L285 |
132,245 | gofn/gofn | provision/docker.go | FnWaitContainer | func FnWaitContainer(client *docker.Client, containerID string) chan error {
errs := make(chan error)
go func() {
code, err := client.WaitContainer(containerID)
if err != nil {
errs <- err
}
if code != 0 {
errs <- ErrContainerExecutionFailed
}
errs <- nil
}()
return errs
} | go | func FnWaitContainer(client *docker.Client, containerID string) chan error {
errs := make(chan error)
go func() {
code, err := client.WaitContainer(containerID)
if err != nil {
errs <- err
}
if code != 0 {
errs <- ErrContainerExecutionFailed
}
errs <- nil
}()
return errs
} | [
"func",
"FnWaitContainer",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"containerID",
"string",
")",
"chan",
"error",
"{",
"errs",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"code",
",",
"err",
":=",
"client",
"... | // FnWaitContainer wait until container finnish your processing | [
"FnWaitContainer",
"wait",
"until",
"container",
"finnish",
"your",
"processing"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L288-L301 |
132,246 | gofn/gofn | provision/docker.go | FnListContainers | func FnListContainers(client *docker.Client) (containers []docker.APIContainers, err error) {
hostContainers, err := client.ListContainers(docker.ListContainersOptions{
All: true,
})
if err != nil {
containers = nil
return
}
for _, container := range hostContainers {
if strings.HasPrefix(container.Image, "... | go | func FnListContainers(client *docker.Client) (containers []docker.APIContainers, err error) {
hostContainers, err := client.ListContainers(docker.ListContainersOptions{
All: true,
})
if err != nil {
containers = nil
return
}
for _, container := range hostContainers {
if strings.HasPrefix(container.Image, "... | [
"func",
"FnListContainers",
"(",
"client",
"*",
"docker",
".",
"Client",
")",
"(",
"containers",
"[",
"]",
"docker",
".",
"APIContainers",
",",
"err",
"error",
")",
"{",
"hostContainers",
",",
"err",
":=",
"client",
".",
"ListContainers",
"(",
"docker",
".... | // FnListContainers lists all the containers created by the gofn.
// It returns the APIContainers from the API, but have to be formatted for pretty printing | [
"FnListContainers",
"lists",
"all",
"the",
"containers",
"created",
"by",
"the",
"gofn",
".",
"It",
"returns",
"the",
"APIContainers",
"from",
"the",
"API",
"but",
"have",
"to",
"be",
"formatted",
"for",
"pretty",
"printing"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/provision/docker.go#L305-L319 |
132,247 | gofn/gofn | iaas/google/google.go | CreateMachine | func (p *Provider) CreateMachine() (machine *iaas.Machine, err error) {
err = p.Client.Create(p.Host)
if err != nil {
return
}
config, err := getConfig(p.Client.GetMachinesDir(), p.Name)
if err != nil {
return
}
ip, err := p.Host.Driver.GetIP()
if err != nil {
return
}
machine = &iaas.Machine{
ID: ... | go | func (p *Provider) CreateMachine() (machine *iaas.Machine, err error) {
err = p.Client.Create(p.Host)
if err != nil {
return
}
config, err := getConfig(p.Client.GetMachinesDir(), p.Name)
if err != nil {
return
}
ip, err := p.Host.Driver.GetIP()
if err != nil {
return
}
machine = &iaas.Machine{
ID: ... | [
"func",
"(",
"p",
"*",
"Provider",
")",
"CreateMachine",
"(",
")",
"(",
"machine",
"*",
"iaas",
".",
"Machine",
",",
"err",
"error",
")",
"{",
"err",
"=",
"p",
".",
"Client",
".",
"Create",
"(",
"p",
".",
"Host",
")",
"\n",
"if",
"err",
"!=",
"... | // CreateMachine on google | [
"CreateMachine",
"on",
"google"
] | 6c6d4df46796d123f15f960722dd418b5d06dda7 | https://github.com/gofn/gofn/blob/6c6d4df46796d123f15f960722dd418b5d06dda7/iaas/google/google.go#L102-L126 |
132,248 | russellhaering/goxmldsig | tls_keystore.go | GetKeyPair | func (d TLSCertKeyStore) GetKeyPair() (*rsa.PrivateKey, []byte, error) {
pk, ok := d.PrivateKey.(*rsa.PrivateKey)
if !ok {
return nil, nil, ErrNonRSAKey
}
if len(d.Certificate) < 1 {
return nil, nil, ErrMissingCertificates
}
crt := d.Certificate[0]
return pk, crt, nil
} | go | func (d TLSCertKeyStore) GetKeyPair() (*rsa.PrivateKey, []byte, error) {
pk, ok := d.PrivateKey.(*rsa.PrivateKey)
if !ok {
return nil, nil, ErrNonRSAKey
}
if len(d.Certificate) < 1 {
return nil, nil, ErrMissingCertificates
}
crt := d.Certificate[0]
return pk, crt, nil
} | [
"func",
"(",
"d",
"TLSCertKeyStore",
")",
"GetKeyPair",
"(",
")",
"(",
"*",
"rsa",
".",
"PrivateKey",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pk",
",",
"ok",
":=",
"d",
".",
"PrivateKey",
".",
"(",
"*",
"rsa",
".",
"PrivateKey",
")",
"\n\... | //GetKeyPair implements X509KeyStore using the underlying tls.Certificate | [
"GetKeyPair",
"implements",
"X509KeyStore",
"using",
"the",
"underlying",
"tls",
".",
"Certificate"
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/tls_keystore.go#L20-L34 |
132,249 | russellhaering/goxmldsig | etreeutils/namespace.go | LookupPrefix | func (ctx NSContext) LookupPrefix(prefix string) (string, error) {
if namespace, ok := ctx.prefixes[prefix]; ok {
return namespace, nil
}
return "", ErrUndeclaredNSPrefix{
Prefix: prefix,
}
} | go | func (ctx NSContext) LookupPrefix(prefix string) (string, error) {
if namespace, ok := ctx.prefixes[prefix]; ok {
return namespace, nil
}
return "", ErrUndeclaredNSPrefix{
Prefix: prefix,
}
} | [
"func",
"(",
"ctx",
"NSContext",
")",
"LookupPrefix",
"(",
"prefix",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"namespace",
",",
"ok",
":=",
"ctx",
".",
"prefixes",
"[",
"prefix",
"]",
";",
"ok",
"{",
"return",
"namespace",
",",
"ni... | // LookupPrefix attempts to find a declared namespace for the specified prefix. If the prefix
// is an empty string this will be the default namespace for this context. If the prefix is
// undeclared in this context an ErrUndeclaredNSPrefix will be returned. | [
"LookupPrefix",
"attempts",
"to",
"find",
"a",
"declared",
"namespace",
"for",
"the",
"specified",
"prefix",
".",
"If",
"the",
"prefix",
"is",
"an",
"empty",
"string",
"this",
"will",
"be",
"the",
"default",
"namespace",
"for",
"this",
"context",
".",
"If",
... | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L126-L134 |
132,250 | russellhaering/goxmldsig | etreeutils/namespace.go | NSDetatch | func NSDetatch(ctx NSContext, el *etree.Element) (*etree.Element, error) {
ctx, err := ctx.SubContext(el)
if err != nil {
return nil, err
}
el = el.Copy()
// Build a new attribute list
attrs := make([]etree.Attr, 0, len(el.Attr))
// First copy over anything that isn't a namespace declaration
for _, attr :=... | go | func NSDetatch(ctx NSContext, el *etree.Element) (*etree.Element, error) {
ctx, err := ctx.SubContext(el)
if err != nil {
return nil, err
}
el = el.Copy()
// Build a new attribute list
attrs := make([]etree.Attr, 0, len(el.Attr))
// First copy over anything that isn't a namespace declaration
for _, attr :=... | [
"func",
"NSDetatch",
"(",
"ctx",
"NSContext",
",",
"el",
"*",
"etree",
".",
"Element",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"error",
")",
"{",
"ctx",
",",
"err",
":=",
"ctx",
".",
"SubContext",
"(",
"el",
")",
"\n",
"if",
"err",
"!=",
"ni... | // NSDetatch makes a copy of the passed element, and declares any namespaces in
// the passed context onto the new element before returning it. | [
"NSDetatch",
"makes",
"a",
"copy",
"of",
"the",
"passed",
"element",
"and",
"declares",
"any",
"namespaces",
"in",
"the",
"passed",
"context",
"onto",
"the",
"new",
"element",
"before",
"returning",
"it",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L166-L221 |
132,251 | russellhaering/goxmldsig | etreeutils/namespace.go | NSSelectOne | func NSSelectOne(el *etree.Element, namespace, tag string) (*etree.Element, error) {
return NSSelectOneCtx(DefaultNSContext, el, namespace, tag)
} | go | func NSSelectOne(el *etree.Element, namespace, tag string) (*etree.Element, error) {
return NSSelectOneCtx(DefaultNSContext, el, namespace, tag)
} | [
"func",
"NSSelectOne",
"(",
"el",
"*",
"etree",
".",
"Element",
",",
"namespace",
",",
"tag",
"string",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"error",
")",
"{",
"return",
"NSSelectOneCtx",
"(",
"DefaultNSContext",
",",
"el",
",",
"namespace",
",",... | // NSSelectOne behaves identically to NSSelectOneCtx, but uses DefaultNSContext as the
// surrounding context. | [
"NSSelectOne",
"behaves",
"identically",
"to",
"NSSelectOneCtx",
"but",
"uses",
"DefaultNSContext",
"as",
"the",
"surrounding",
"context",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L225-L227 |
132,252 | russellhaering/goxmldsig | etreeutils/namespace.go | NSFindIterate | func NSFindIterate(el *etree.Element, namespace, tag string, handle NSIterHandler) error {
return NSFindIterateCtx(DefaultNSContext, el, namespace, tag, handle)
} | go | func NSFindIterate(el *etree.Element, namespace, tag string, handle NSIterHandler) error {
return NSFindIterateCtx(DefaultNSContext, el, namespace, tag, handle)
} | [
"func",
"NSFindIterate",
"(",
"el",
"*",
"etree",
".",
"Element",
",",
"namespace",
",",
"tag",
"string",
",",
"handle",
"NSIterHandler",
")",
"error",
"{",
"return",
"NSFindIterateCtx",
"(",
"DefaultNSContext",
",",
"el",
",",
"namespace",
",",
"tag",
",",
... | // NSFindIterate behaves identically to NSFindIterateCtx, but uses DefaultNSContext
// as the surrounding context. | [
"NSFindIterate",
"behaves",
"identically",
"to",
"NSFindIterateCtx",
"but",
"uses",
"DefaultNSContext",
"as",
"the",
"surrounding",
"context",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L256-L258 |
132,253 | russellhaering/goxmldsig | etreeutils/namespace.go | NSFindIterateCtx | func NSFindIterateCtx(ctx NSContext, el *etree.Element, namespace, tag string, handle NSIterHandler) error {
err := NSTraverse(ctx, el, func(ctx NSContext, el *etree.Element) error {
_ctx, err := ctx.SubContext(el)
if err != nil {
return err
}
currentNS, err := _ctx.LookupPrefix(el.Space)
if err != nil {... | go | func NSFindIterateCtx(ctx NSContext, el *etree.Element, namespace, tag string, handle NSIterHandler) error {
err := NSTraverse(ctx, el, func(ctx NSContext, el *etree.Element) error {
_ctx, err := ctx.SubContext(el)
if err != nil {
return err
}
currentNS, err := _ctx.LookupPrefix(el.Space)
if err != nil {... | [
"func",
"NSFindIterateCtx",
"(",
"ctx",
"NSContext",
",",
"el",
"*",
"etree",
".",
"Element",
",",
"namespace",
",",
"tag",
"string",
",",
"handle",
"NSIterHandler",
")",
"error",
"{",
"err",
":=",
"NSTraverse",
"(",
"ctx",
",",
"el",
",",
"func",
"(",
... | // NSFindIterateCtx conducts a depth-first traversal searching for elements with the
// specified tag in the specified namespace. It uses the passed NSContext for prefix
// lookups. For each such element, the passed handler function is invoked. If the
// handler function returns an error traversal is immediately halted... | [
"NSFindIterateCtx",
"conducts",
"a",
"depth",
"-",
"first",
"traversal",
"searching",
"for",
"elements",
"with",
"the",
"specified",
"tag",
"in",
"the",
"specified",
"namespace",
".",
"It",
"uses",
"the",
"passed",
"NSContext",
"for",
"prefix",
"lookups",
".",
... | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L267-L292 |
132,254 | russellhaering/goxmldsig | etreeutils/namespace.go | NSFindOne | func NSFindOne(el *etree.Element, namespace, tag string) (*etree.Element, error) {
return NSFindOneCtx(DefaultNSContext, el, namespace, tag)
} | go | func NSFindOne(el *etree.Element, namespace, tag string) (*etree.Element, error) {
return NSFindOneCtx(DefaultNSContext, el, namespace, tag)
} | [
"func",
"NSFindOne",
"(",
"el",
"*",
"etree",
".",
"Element",
",",
"namespace",
",",
"tag",
"string",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"error",
")",
"{",
"return",
"NSFindOneCtx",
"(",
"DefaultNSContext",
",",
"el",
",",
"namespace",
",",
"... | // NSFindOne behaves identically to NSFindOneCtx, but uses DefaultNSContext for
// context. | [
"NSFindOne",
"behaves",
"identically",
"to",
"NSFindOneCtx",
"but",
"uses",
"DefaultNSContext",
"for",
"context",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L296-L298 |
132,255 | russellhaering/goxmldsig | etreeutils/namespace.go | NSIterateChildren | func NSIterateChildren(ctx NSContext, el *etree.Element, handle NSIterHandler) error {
ctx, err := ctx.SubContext(el)
if err != nil {
return err
}
// Iterate the child elements.
for _, child := range el.ChildElements() {
err = handle(ctx, child)
if err != nil {
return err
}
}
return nil
} | go | func NSIterateChildren(ctx NSContext, el *etree.Element, handle NSIterHandler) error {
ctx, err := ctx.SubContext(el)
if err != nil {
return err
}
// Iterate the child elements.
for _, child := range el.ChildElements() {
err = handle(ctx, child)
if err != nil {
return err
}
}
return nil
} | [
"func",
"NSIterateChildren",
"(",
"ctx",
"NSContext",
",",
"el",
"*",
"etree",
".",
"Element",
",",
"handle",
"NSIterHandler",
")",
"error",
"{",
"ctx",
",",
"err",
":=",
"ctx",
".",
"SubContext",
"(",
"el",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // NSIterateChildren iterates the children of an element, invoking the passed
// handler with each direct child of the element, and the context surrounding
// that child. | [
"NSIterateChildren",
"iterates",
"the",
"children",
"of",
"an",
"element",
"invoking",
"the",
"passed",
"handler",
"with",
"each",
"direct",
"child",
"of",
"the",
"element",
"and",
"the",
"context",
"surrounding",
"that",
"child",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L320-L335 |
132,256 | russellhaering/goxmldsig | etreeutils/namespace.go | NSFindOneChild | func NSFindOneChild(el *etree.Element, namespace, tag string) (*etree.Element, error) {
return NSFindOneChildCtx(DefaultNSContext, el, namespace, tag)
} | go | func NSFindOneChild(el *etree.Element, namespace, tag string) (*etree.Element, error) {
return NSFindOneChildCtx(DefaultNSContext, el, namespace, tag)
} | [
"func",
"NSFindOneChild",
"(",
"el",
"*",
"etree",
".",
"Element",
",",
"namespace",
",",
"tag",
"string",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"error",
")",
"{",
"return",
"NSFindOneChildCtx",
"(",
"DefaultNSContext",
",",
"el",
",",
"namespace",
... | // NSFindOneChild behaves identically to NSFindOneChildCtx, but uses
// DefaultNSContext for context. | [
"NSFindOneChild",
"behaves",
"identically",
"to",
"NSFindOneChildCtx",
"but",
"uses",
"DefaultNSContext",
"for",
"context",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L370-L372 |
132,257 | russellhaering/goxmldsig | etreeutils/namespace.go | NSFindOneChildCtx | func NSFindOneChildCtx(ctx NSContext, el *etree.Element, namespace, tag string) (*etree.Element, error) {
var found *etree.Element
err := NSFindChildrenIterateCtx(ctx, el, namespace, tag, func(ctx NSContext, el *etree.Element) error {
found = el
return ErrTraversalHalted
})
if err != nil && err != ErrTraversa... | go | func NSFindOneChildCtx(ctx NSContext, el *etree.Element, namespace, tag string) (*etree.Element, error) {
var found *etree.Element
err := NSFindChildrenIterateCtx(ctx, el, namespace, tag, func(ctx NSContext, el *etree.Element) error {
found = el
return ErrTraversalHalted
})
if err != nil && err != ErrTraversa... | [
"func",
"NSFindOneChildCtx",
"(",
"ctx",
"NSContext",
",",
"el",
"*",
"etree",
".",
"Element",
",",
"namespace",
",",
"tag",
"string",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"error",
")",
"{",
"var",
"found",
"*",
"etree",
".",
"Element",
"\n\n",... | // NSFindOneCtx conducts a depth-first search for the specified element. If such an
// element is found a reference to it is returned. | [
"NSFindOneCtx",
"conducts",
"a",
"depth",
"-",
"first",
"search",
"for",
"the",
"specified",
"element",
".",
"If",
"such",
"an",
"element",
"is",
"found",
"a",
"reference",
"to",
"it",
"is",
"returned",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L376-L389 |
132,258 | russellhaering/goxmldsig | etreeutils/namespace.go | NSBuildParentContext | func NSBuildParentContext(el *etree.Element) (NSContext, error) {
parent := el.Parent()
if parent == nil {
return DefaultNSContext, nil
}
ctx, err := NSBuildParentContext(parent)
if err != nil {
return ctx, err
}
return ctx.SubContext(parent)
} | go | func NSBuildParentContext(el *etree.Element) (NSContext, error) {
parent := el.Parent()
if parent == nil {
return DefaultNSContext, nil
}
ctx, err := NSBuildParentContext(parent)
if err != nil {
return ctx, err
}
return ctx.SubContext(parent)
} | [
"func",
"NSBuildParentContext",
"(",
"el",
"*",
"etree",
".",
"Element",
")",
"(",
"NSContext",
",",
"error",
")",
"{",
"parent",
":=",
"el",
".",
"Parent",
"(",
")",
"\n",
"if",
"parent",
"==",
"nil",
"{",
"return",
"DefaultNSContext",
",",
"nil",
"\n... | // NSBuildParentContext recurses upward from an element in order to build an NSContext
// for its immediate parent. If the element has no parent DefaultNSContext
// is returned. | [
"NSBuildParentContext",
"recurses",
"upward",
"from",
"an",
"element",
"in",
"order",
"to",
"build",
"an",
"NSContext",
"for",
"its",
"immediate",
"parent",
".",
"If",
"the",
"element",
"has",
"no",
"parent",
"DefaultNSContext",
"is",
"returned",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/namespace.go#L394-L407 |
132,259 | russellhaering/goxmldsig | etreeutils/canonicalize.go | TransformExcC14n | func TransformExcC14n(el *etree.Element, inclusiveNamespacesPrefixList string) error {
prefixes := strings.Fields(inclusiveNamespacesPrefixList)
prefixSet := make(map[string]struct{}, len(prefixes))
for _, prefix := range prefixes {
prefixSet[prefix] = struct{}{}
}
err := transformExcC14n(DefaultNSContext, Def... | go | func TransformExcC14n(el *etree.Element, inclusiveNamespacesPrefixList string) error {
prefixes := strings.Fields(inclusiveNamespacesPrefixList)
prefixSet := make(map[string]struct{}, len(prefixes))
for _, prefix := range prefixes {
prefixSet[prefix] = struct{}{}
}
err := transformExcC14n(DefaultNSContext, Def... | [
"func",
"TransformExcC14n",
"(",
"el",
"*",
"etree",
".",
"Element",
",",
"inclusiveNamespacesPrefixList",
"string",
")",
"error",
"{",
"prefixes",
":=",
"strings",
".",
"Fields",
"(",
"inclusiveNamespacesPrefixList",
")",
"\n",
"prefixSet",
":=",
"make",
"(",
"... | // TransformExcC14n transforms the passed element into xml-exc-c14n form. | [
"TransformExcC14n",
"transforms",
"the",
"passed",
"element",
"into",
"xml",
"-",
"exc",
"-",
"c14n",
"form",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/etreeutils/canonicalize.go#L11-L25 |
132,260 | russellhaering/goxmldsig | validate.go | transform | func (ctx *ValidationContext) transform(
el *etree.Element,
sig *types.Signature,
ref *types.Reference) (*etree.Element, Canonicalizer, error) {
transforms := ref.Transforms.Transforms
if len(transforms) != 2 {
return nil, nil, errors.New("Expected Enveloped and C14N transforms")
}
// map the path to the pas... | go | func (ctx *ValidationContext) transform(
el *etree.Element,
sig *types.Signature,
ref *types.Reference) (*etree.Element, Canonicalizer, error) {
transforms := ref.Transforms.Transforms
if len(transforms) != 2 {
return nil, nil, errors.New("Expected Enveloped and C14N transforms")
}
// map the path to the pas... | [
"func",
"(",
"ctx",
"*",
"ValidationContext",
")",
"transform",
"(",
"el",
"*",
"etree",
".",
"Element",
",",
"sig",
"*",
"types",
".",
"Signature",
",",
"ref",
"*",
"types",
".",
"Reference",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"Canonicalizer... | // Transform returns a new element equivalent to the passed root el, but with
// the set of transformations described by the ref applied.
//
// The functionality of transform is currently very limited and purpose-specific. | [
"Transform",
"returns",
"a",
"new",
"element",
"equivalent",
"to",
"the",
"passed",
"root",
"el",
"but",
"with",
"the",
"set",
"of",
"transformations",
"described",
"by",
"the",
"ref",
"applied",
".",
"The",
"functionality",
"of",
"transform",
"is",
"currently... | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/validate.go#L107-L163 |
132,261 | russellhaering/goxmldsig | validate.go | findSignature | func (ctx *ValidationContext) findSignature(el *etree.Element) (*types.Signature, error) {
idAttr := el.SelectAttr(ctx.IdAttribute)
if idAttr == nil || idAttr.Value == "" {
return nil, errors.New("Missing ID attribute")
}
var sig *types.Signature
// Traverse the tree looking for a Signature element
err := etr... | go | func (ctx *ValidationContext) findSignature(el *etree.Element) (*types.Signature, error) {
idAttr := el.SelectAttr(ctx.IdAttribute)
if idAttr == nil || idAttr.Value == "" {
return nil, errors.New("Missing ID attribute")
}
var sig *types.Signature
// Traverse the tree looking for a Signature element
err := etr... | [
"func",
"(",
"ctx",
"*",
"ValidationContext",
")",
"findSignature",
"(",
"el",
"*",
"etree",
".",
"Element",
")",
"(",
"*",
"types",
".",
"Signature",
",",
"error",
")",
"{",
"idAttr",
":=",
"el",
".",
"SelectAttr",
"(",
"ctx",
".",
"IdAttribute",
")",... | // findSignature searches for a Signature element referencing the passed root element. | [
"findSignature",
"searches",
"for",
"a",
"Signature",
"element",
"referencing",
"the",
"passed",
"root",
"element",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/validate.go#L300-L401 |
132,262 | russellhaering/goxmldsig | validate.go | Validate | func (ctx *ValidationContext) Validate(el *etree.Element) (*etree.Element, error) {
// Make a copy of the element to avoid mutating the one we were passed.
el = el.Copy()
sig, err := ctx.findSignature(el)
if err != nil {
return nil, err
}
cert, err := ctx.verifyCertificate(sig)
if err != nil {
return nil, ... | go | func (ctx *ValidationContext) Validate(el *etree.Element) (*etree.Element, error) {
// Make a copy of the element to avoid mutating the one we were passed.
el = el.Copy()
sig, err := ctx.findSignature(el)
if err != nil {
return nil, err
}
cert, err := ctx.verifyCertificate(sig)
if err != nil {
return nil, ... | [
"func",
"(",
"ctx",
"*",
"ValidationContext",
")",
"Validate",
"(",
"el",
"*",
"etree",
".",
"Element",
")",
"(",
"*",
"etree",
".",
"Element",
",",
"error",
")",
"{",
"// Make a copy of the element to avoid mutating the one we were passed.",
"el",
"=",
"el",
".... | // Validate verifies that the passed element contains a valid enveloped signature
// matching a currently-valid certificate in the context's CertificateStore. | [
"Validate",
"verifies",
"that",
"the",
"passed",
"element",
"contains",
"a",
"valid",
"enveloped",
"signature",
"matching",
"a",
"currently",
"-",
"valid",
"certificate",
"in",
"the",
"context",
"s",
"CertificateStore",
"."
] | 7acd5e4a6ef74fe1b082c20f119556adf70c3944 | https://github.com/russellhaering/goxmldsig/blob/7acd5e4a6ef74fe1b082c20f119556adf70c3944/validate.go#L452-L467 |
132,263 | sethvargo/go-fastly | fastly/dictionary_item.go | ListDictionaryItems | func (c *Client) ListDictionaryItems(i *ListDictionaryItemsInput) ([]*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
path := fmt.Sprintf("/service/%s/dictionary/%s/items", i.Service, i.Dictionary)
resp, err := c.Get(pa... | go | func (c *Client) ListDictionaryItems(i *ListDictionaryItemsInput) ([]*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
path := fmt.Sprintf("/service/%s/dictionary/%s/items", i.Service, i.Dictionary)
resp, err := c.Get(pa... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListDictionaryItems",
"(",
"i",
"*",
"ListDictionaryItemsInput",
")",
"(",
"[",
"]",
"*",
"DictionaryItem",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissi... | // ListDictionaryItems returns the list of dictionary items for the
// configuration version. | [
"ListDictionaryItems",
"returns",
"the",
"list",
"of",
"dictionary",
"items",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary_item.go#L53-L74 |
132,264 | sethvargo/go-fastly | fastly/dictionary_item.go | CreateDictionaryItem | func (c *Client) CreateDictionaryItem(i *CreateDictionaryItemInput) (*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
path := fmt.Sprintf("/service/%s/dictionary/%s/item", i.Service, i.Dictionary)
resp, err := c.PostFor... | go | func (c *Client) CreateDictionaryItem(i *CreateDictionaryItemInput) (*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
path := fmt.Sprintf("/service/%s/dictionary/%s/item", i.Service, i.Dictionary)
resp, err := c.PostFor... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateDictionaryItem",
"(",
"i",
"*",
"CreateDictionaryItemInput",
")",
"(",
"*",
"DictionaryItem",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
... | // CreateDictionaryItem creates a new Fastly dictionary item. | [
"CreateDictionaryItem",
"creates",
"a",
"new",
"Fastly",
"dictionary",
"item",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary_item.go#L88-L108 |
132,265 | sethvargo/go-fastly | fastly/dictionary_item.go | CreateDictionaryItems | func (c *Client) CreateDictionaryItems(i []CreateDictionaryItemInput) ([]DictionaryItem, error) {
var b []DictionaryItem
for _, cdii := range i {
di, err := c.CreateDictionaryItem(&cdii)
if err != nil {
return nil, err
}
b = append(b, *di)
}
return b, nil
} | go | func (c *Client) CreateDictionaryItems(i []CreateDictionaryItemInput) ([]DictionaryItem, error) {
var b []DictionaryItem
for _, cdii := range i {
di, err := c.CreateDictionaryItem(&cdii)
if err != nil {
return nil, err
}
b = append(b, *di)
}
return b, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateDictionaryItems",
"(",
"i",
"[",
"]",
"CreateDictionaryItemInput",
")",
"(",
"[",
"]",
"DictionaryItem",
",",
"error",
")",
"{",
"var",
"b",
"[",
"]",
"DictionaryItem",
"\n",
"for",
"_",
",",
"cdii",
":=",
"... | // CreateDictionaryItems creates new Fastly dictionary items from a slice. | [
"CreateDictionaryItems",
"creates",
"new",
"Fastly",
"dictionary",
"items",
"from",
"a",
"slice",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary_item.go#L111-L122 |
132,266 | sethvargo/go-fastly | fastly/dictionary_item.go | GetDictionaryItem | func (c *Client) GetDictionaryItem(i *GetDictionaryItemInput) (*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
if i.ItemKey == "" {
return nil, ErrMissingItemKey
}
path := fmt.Sprintf("/service/%s/dictionary/%s/ite... | go | func (c *Client) GetDictionaryItem(i *GetDictionaryItemInput) (*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
if i.ItemKey == "" {
return nil, ErrMissingItemKey
}
path := fmt.Sprintf("/service/%s/dictionary/%s/ite... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDictionaryItem",
"(",
"i",
"*",
"GetDictionaryItemInput",
")",
"(",
"*",
"DictionaryItem",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n"... | // GetDictionaryItem gets the dictionary item with the given parameters. | [
"GetDictionaryItem",
"gets",
"the",
"dictionary",
"item",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary_item.go#L136-L160 |
132,267 | sethvargo/go-fastly | fastly/dictionary_item.go | UpdateDictionaryItem | func (c *Client) UpdateDictionaryItem(i *UpdateDictionaryItemInput) (*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
if i.ItemKey == "" {
return nil, ErrMissingItemKey
}
path := fmt.Sprintf("/service/%s/dictionary/... | go | func (c *Client) UpdateDictionaryItem(i *UpdateDictionaryItemInput) (*DictionaryItem, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Dictionary == "" {
return nil, ErrMissingDictionary
}
if i.ItemKey == "" {
return nil, ErrMissingItemKey
}
path := fmt.Sprintf("/service/%s/dictionary/... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateDictionaryItem",
"(",
"i",
"*",
"UpdateDictionaryItemInput",
")",
"(",
"*",
"DictionaryItem",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
... | // UpdateDictionaryItem updates a specific dictionary item. | [
"UpdateDictionaryItem",
"updates",
"a",
"specific",
"dictionary",
"item",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary_item.go#L176-L200 |
132,268 | sethvargo/go-fastly | fastly/dictionary_item.go | DeleteDictionaryItem | func (c *Client) DeleteDictionaryItem(i *DeleteDictionaryItemInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.Dictionary == "" {
return ErrMissingDictionary
}
if i.ItemKey == "" {
return ErrMissingItemKey
}
path := fmt.Sprintf("/service/%s/dictionary/%s/item/%s", i.Service, i.Dictiona... | go | func (c *Client) DeleteDictionaryItem(i *DeleteDictionaryItemInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.Dictionary == "" {
return ErrMissingDictionary
}
if i.ItemKey == "" {
return ErrMissingItemKey
}
path := fmt.Sprintf("/service/%s/dictionary/%s/item/%s", i.Service, i.Dictiona... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteDictionaryItem",
"(",
"i",
"*",
"DeleteDictionaryItemInput",
")",
"error",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"Dictionary",
... | // DeleteDictionaryItem deletes the given dictionary item. | [
"DeleteDictionaryItem",
"deletes",
"the",
"given",
"dictionary",
"item",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary_item.go#L214-L237 |
132,269 | sethvargo/go-fastly | fastly/request.go | RawRequest | func (c *Client) RawRequest(verb, p string, ro *RequestOptions) (*http.Request, error) {
// Ensure we have request options.
if ro == nil {
ro = new(RequestOptions)
}
// Append the path to the URL.
u := *c.url
u.Path = strings.TrimRight(c.url.Path, "/") + "/" + strings.TrimLeft(p, "/")
// Add the token and ot... | go | func (c *Client) RawRequest(verb, p string, ro *RequestOptions) (*http.Request, error) {
// Ensure we have request options.
if ro == nil {
ro = new(RequestOptions)
}
// Append the path to the URL.
u := *c.url
u.Path = strings.TrimRight(c.url.Path, "/") + "/" + strings.TrimLeft(p, "/")
// Add the token and ot... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RawRequest",
"(",
"verb",
",",
"p",
"string",
",",
"ro",
"*",
"RequestOptions",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"// Ensure we have request options.",
"if",
"ro",
"==",
"nil",
"{",
"r... | // RawRequest accepts a verb, URL, and RequestOptions struct and returns the
// constructed http.Request and any errors that occurred | [
"RawRequest",
"accepts",
"a",
"verb",
"URL",
"and",
"RequestOptions",
"struct",
"and",
"returns",
"the",
"constructed",
"http",
".",
"Request",
"and",
"any",
"errors",
"that",
"occurred"
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/request.go#L26-L68 |
132,270 | sethvargo/go-fastly | fastly/request.go | SimpleGet | func (c *Client) SimpleGet(target string) (*http.Response, error) {
// We parse the URL and then convert it right back to a string
// later; this just acts as a check that Fastly isn't sending
// us nonsense.
url, err := url.Parse(target)
if err != nil {
return nil, err
}
request, err := http.NewRequest("GET"... | go | func (c *Client) SimpleGet(target string) (*http.Response, error) {
// We parse the URL and then convert it right back to a string
// later; this just acts as a check that Fastly isn't sending
// us nonsense.
url, err := url.Parse(target)
if err != nil {
return nil, err
}
request, err := http.NewRequest("GET"... | [
"func",
"(",
"c",
"*",
"Client",
")",
"SimpleGet",
"(",
"target",
"string",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"// We parse the URL and then convert it right back to a string",
"// later; this just acts as a check that Fastly isn't sending",
"... | // SimpleGet combines the RawRequest and Request methods,
// but doesn't add any parameters or change any encoding in the URL
// passed to it. It's mostly for calling the URLs given to us
// directly from Fastly without mangling them. | [
"SimpleGet",
"combines",
"the",
"RawRequest",
"and",
"Request",
"methods",
"but",
"doesn",
"t",
"add",
"any",
"parameters",
"or",
"change",
"any",
"encoding",
"in",
"the",
"URL",
"passed",
"to",
"it",
".",
"It",
"s",
"mostly",
"for",
"calling",
"the",
"URL... | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/request.go#L74-L98 |
132,271 | sethvargo/go-fastly | fastly/acl_entry.go | ListACLEntries | func (c *Client) ListACLEntries(i *ListACLEntriesInput) ([]*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
path := fmt.Sprintf("/service/%s/acl/%s/entries", i.Service, i.ACL)
resp, err := c.Get(path, nil)
if err != nil {
return nil, e... | go | func (c *Client) ListACLEntries(i *ListACLEntriesInput) ([]*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
path := fmt.Sprintf("/service/%s/acl/%s/entries", i.Service, i.ACL)
resp, err := c.Get(path, nil)
if err != nil {
return nil, e... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListACLEntries",
"(",
"i",
"*",
"ListACLEntriesInput",
")",
"(",
"[",
"]",
"*",
"ACLEntry",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\... | // ListACLEntries return a list of entries for an ACL | [
"ListACLEntries",
"return",
"a",
"list",
"of",
"entries",
"for",
"an",
"ACL"
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl_entry.go#L40-L64 |
132,272 | sethvargo/go-fastly | fastly/acl_entry.go | GetACLEntry | func (c *Client) GetACLEntry(i *GetACLEntryInput) (*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
if i.ID == "" {
return nil, ErrMissingID
}
path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)
resp, err := c.... | go | func (c *Client) GetACLEntry(i *GetACLEntryInput) (*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
if i.ID == "" {
return nil, ErrMissingID
}
path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)
resp, err := c.... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetACLEntry",
"(",
"i",
"*",
"GetACLEntryInput",
")",
"(",
"*",
"ACLEntry",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",... | // GetACLEntry returns a single ACL entry based on its ID. | [
"GetACLEntry",
"returns",
"a",
"single",
"ACL",
"entry",
"based",
"on",
"its",
"ID",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl_entry.go#L74-L100 |
132,273 | sethvargo/go-fastly | fastly/acl_entry.go | CreateACLEntry | func (c *Client) CreateACLEntry(i *CreateACLEntryInput) (*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
if i.IP == "" {
return nil, ErrMissingIP
}
path := fmt.Sprintf("/service/%s/acl/%s/entry", i.Service, i.ACL)
resp, err := c.Pos... | go | func (c *Client) CreateACLEntry(i *CreateACLEntryInput) (*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
if i.IP == "" {
return nil, ErrMissingIP
}
path := fmt.Sprintf("/service/%s/acl/%s/entry", i.Service, i.ACL)
resp, err := c.Pos... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateACLEntry",
"(",
"i",
"*",
"CreateACLEntryInput",
")",
"(",
"*",
"ACLEntry",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // CreateACLEntry creates and returns a new ACL entry. | [
"CreateACLEntry",
"creates",
"and",
"returns",
"a",
"new",
"ACL",
"entry",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl_entry.go#L116-L142 |
132,274 | sethvargo/go-fastly | fastly/acl_entry.go | DeleteACLEntry | func (c *Client) DeleteACLEntry(i *DeleteACLEntryInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.ACL == "" {
return ErrMissingACL
}
if i.ID == "" {
return ErrMissingID
}
path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)
resp, err := c.Delete(path, nil)
if ... | go | func (c *Client) DeleteACLEntry(i *DeleteACLEntryInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.ACL == "" {
return ErrMissingACL
}
if i.ID == "" {
return ErrMissingID
}
path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)
resp, err := c.Delete(path, nil)
if ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteACLEntry",
"(",
"i",
"*",
"DeleteACLEntryInput",
")",
"error",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"ACL",
"==",
"\"",
"\... | // DeleteACLEntry deletes an entry from an ACL based on its ID | [
"DeleteACLEntry",
"deletes",
"an",
"entry",
"from",
"an",
"ACL",
"based",
"on",
"its",
"ID"
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl_entry.go#L152-L183 |
132,275 | sethvargo/go-fastly | fastly/acl_entry.go | UpdateACLEntry | func (c *Client) UpdateACLEntry(i *UpdateACLEntryInput) (*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
if i.ID == "" {
return nil, ErrMissingID
}
path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)
resp, err... | go | func (c *Client) UpdateACLEntry(i *UpdateACLEntryInput) (*ACLEntry, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.ACL == "" {
return nil, ErrMissingACL
}
if i.ID == "" {
return nil, ErrMissingID
}
path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)
resp, err... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateACLEntry",
"(",
"i",
"*",
"UpdateACLEntryInput",
")",
"(",
"*",
"ACLEntry",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // UpdateACLEntry updates an ACL entry | [
"UpdateACLEntry",
"updates",
"an",
"ACL",
"entry"
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/acl_entry.go#L200-L226 |
132,276 | sethvargo/go-fastly | fastly/director.go | ListDirectors | func (c *Client) ListDirectors(i *ListDirectorsInput) ([]*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/director", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
... | go | func (c *Client) ListDirectors(i *ListDirectorsInput) ([]*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/director", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListDirectors",
"(",
"i",
"*",
"ListDirectorsInput",
")",
"(",
"[",
"]",
"*",
"Director",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n"... | // ListDirectors returns the list of directors for the configuration version. | [
"ListDirectors",
"returns",
"the",
"list",
"of",
"directors",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/director.go#L63-L84 |
132,277 | sethvargo/go-fastly | fastly/director.go | CreateDirector | func (c *Client) CreateDirector(i *CreateDirectorInput) (*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/director", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != ... | go | func (c *Client) CreateDirector(i *CreateDirectorInput) (*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/director", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateDirector",
"(",
"i",
"*",
"CreateDirectorInput",
")",
"(",
"*",
"Director",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // CreateDirector creates a new Fastly director. | [
"CreateDirector",
"creates",
"a",
"new",
"Fastly",
"director",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/director.go#L103-L123 |
132,278 | sethvargo/go-fastly | fastly/director.go | GetDirector | func (c *Client) GetDirector(i *GetDirectorInput) (*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.Service, i.Version, i... | go | func (c *Client) GetDirector(i *GetDirectorInput) (*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.Service, i.Version, i... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDirector",
"(",
"i",
"*",
"GetDirectorInput",
")",
"(",
"*",
"Director",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",... | // GetDirector gets the director configuration with the given parameters. | [
"GetDirector",
"gets",
"the",
"director",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/director.go#L137-L161 |
132,279 | sethvargo/go-fastly | fastly/director.go | UpdateDirector | func (c *Client) UpdateDirector(i *UpdateDirectorInput) (*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.Service, i.Vers... | go | func (c *Client) UpdateDirector(i *UpdateDirectorInput) (*Director, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.Service, i.Vers... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateDirector",
"(",
"i",
"*",
"UpdateDirectorInput",
")",
"(",
"*",
"Director",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // UpdateDirector updates a specific director. | [
"UpdateDirector",
"updates",
"a",
"specific",
"director",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/director.go#L183-L207 |
132,280 | sethvargo/go-fastly | fastly/director.go | DeleteDirector | func (c *Client) DeleteDirector(i *DeleteDirectorInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.Version == 0 {
return ErrMissingVersion
}
if i.Name == "" {
return ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.Service, i.Version, i.Name)
resp, err := c... | go | func (c *Client) DeleteDirector(i *DeleteDirectorInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.Version == 0 {
return ErrMissingVersion
}
if i.Name == "" {
return ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.Service, i.Version, i.Name)
resp, err := c... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteDirector",
"(",
"i",
"*",
"DeleteDirectorInput",
")",
"error",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"Version",
"==",
"0",
... | // DeleteDirector deletes the given director version. | [
"DeleteDirector",
"deletes",
"the",
"given",
"director",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/director.go#L221-L248 |
132,281 | sethvargo/go-fastly | fastly/ip.go | IPs | func (c *Client) IPs() (IPAddrs, error) {
resp, err := c.Get("/public-ip-list", nil)
if err != nil {
return nil, err
}
var m map[string][]string
if err := decodeJSON(&m, resp.Body); err != nil {
return nil, err
}
return IPAddrs(m["addresses"]), nil
} | go | func (c *Client) IPs() (IPAddrs, error) {
resp, err := c.Get("/public-ip-list", nil)
if err != nil {
return nil, err
}
var m map[string][]string
if err := decodeJSON(&m, resp.Body); err != nil {
return nil, err
}
return IPAddrs(m["addresses"]), nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"IPs",
"(",
")",
"(",
"IPAddrs",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\... | // IPs returns the list of public IP addresses for Fastly's network. | [
"IPs",
"returns",
"the",
"list",
"of",
"public",
"IP",
"addresses",
"for",
"Fastly",
"s",
"network",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/ip.go#L7-L18 |
132,282 | sethvargo/go-fastly | fastly/decode_hooks.go | mapToHTTPHeaderHookFunc | func mapToHTTPHeaderHookFunc() mapstructure.DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{}) (interface{}, error) {
if f.Kind() != reflect.Map {
return data, nil
}
if t != reflect.TypeOf(new(http.Header)) {
return data, nil
}
typed, ok := data.(map[string]interface... | go | func mapToHTTPHeaderHookFunc() mapstructure.DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{}) (interface{}, error) {
if f.Kind() != reflect.Map {
return data, nil
}
if t != reflect.TypeOf(new(http.Header)) {
return data, nil
}
typed, ok := data.(map[string]interface... | [
"func",
"mapToHTTPHeaderHookFunc",
"(",
")",
"mapstructure",
".",
"DecodeHookFunc",
"{",
"return",
"func",
"(",
"f",
"reflect",
".",
"Type",
",",
"t",
"reflect",
".",
"Type",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"erro... | // mapToHTTPHeaderHookFunc returns a function that converts maps into an
// http.Header value. | [
"mapToHTTPHeaderHookFunc",
"returns",
"a",
"function",
"that",
"converts",
"maps",
"into",
"an",
"http",
".",
"Header",
"value",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/decode_hooks.go#L14-L49 |
132,283 | sethvargo/go-fastly | fastly/decode_hooks.go | stringToTimeHookFunc | func stringToTimeHookFunc() mapstructure.DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{}) (interface{}, error) {
if f.Kind() != reflect.String {
return data, nil
}
if t != reflect.TypeOf(time.Now()) {
return data, nil
}
// Convert it by parsing
return time.Parse(... | go | func stringToTimeHookFunc() mapstructure.DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{}) (interface{}, error) {
if f.Kind() != reflect.String {
return data, nil
}
if t != reflect.TypeOf(time.Now()) {
return data, nil
}
// Convert it by parsing
return time.Parse(... | [
"func",
"stringToTimeHookFunc",
"(",
")",
"mapstructure",
".",
"DecodeHookFunc",
"{",
"return",
"func",
"(",
"f",
"reflect",
".",
"Type",
",",
"t",
"reflect",
".",
"Type",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",... | // stringToTimeHookFunc returns a function that converts strings to a time.Time
// value. | [
"stringToTimeHookFunc",
"returns",
"a",
"function",
"that",
"converts",
"strings",
"to",
"a",
"time",
".",
"Time",
"value",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/decode_hooks.go#L53-L68 |
132,284 | sethvargo/go-fastly | fastly/header.go | ListHeaders | func (c *Client) ListHeaders(i *ListHeadersInput) ([]*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/header", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return n... | go | func (c *Client) ListHeaders(i *ListHeadersInput) ([]*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/header", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil {
return n... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListHeaders",
"(",
"i",
"*",
"ListHeadersInput",
")",
"(",
"[",
"]",
"*",
"Header",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}... | // ListHeaders returns the list of headers for the configuration version. | [
"ListHeaders",
"returns",
"the",
"list",
"of",
"headers",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/header.go#L90-L111 |
132,285 | sethvargo/go-fastly | fastly/header.go | CreateHeader | func (c *Client) CreateHeader(i *CreateHeaderInput) (*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/header", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != nil {
... | go | func (c *Client) CreateHeader(i *CreateHeaderInput) (*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/header", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateHeader",
"(",
"i",
"*",
"CreateHeaderInput",
")",
"(",
"*",
"Header",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",... | // CreateHeader creates a new Fastly header. | [
"CreateHeader",
"creates",
"a",
"new",
"Fastly",
"header",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/header.go#L135-L155 |
132,286 | sethvargo/go-fastly | fastly/header.go | GetHeader | func (c *Client) GetHeader(i *GetHeaderInput) (*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.Service, i.Version, i.Name)
... | go | func (c *Client) GetHeader(i *GetHeaderInput) (*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.Service, i.Version, i.Name)
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetHeader",
"(",
"i",
"*",
"GetHeaderInput",
")",
"(",
"*",
"Header",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if... | // GetHeader gets the header configuration with the given parameters. | [
"GetHeader",
"gets",
"the",
"header",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/header.go#L169-L193 |
132,287 | sethvargo/go-fastly | fastly/header.go | UpdateHeader | func (c *Client) UpdateHeader(i *UpdateHeaderInput) (*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.Service, i.Version, i.N... | go | func (c *Client) UpdateHeader(i *UpdateHeaderInput) (*Header, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.Service, i.Version, i.N... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateHeader",
"(",
"i",
"*",
"UpdateHeaderInput",
")",
"(",
"*",
"Header",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"\n\n",... | // UpdateHeader updates a specific header. | [
"UpdateHeader",
"updates",
"a",
"specific",
"header",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/header.go#L220-L244 |
132,288 | sethvargo/go-fastly | fastly/bigquery.go | GetBigQuery | func (c *Client) GetBigQuery(i *GetBigQueryInput) ([]*BigQuery, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil ... | go | func (c *Client) GetBigQuery(i *GetBigQueryInput) ([]*BigQuery, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err != nil ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBigQuery",
"(",
"i",
"*",
"GetBigQueryInput",
")",
"(",
"[",
"]",
"*",
"BigQuery",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
... | // GetBigQuery lists all BigQuerys associated with a service version. | [
"GetBigQuery",
"lists",
"all",
"BigQuerys",
"associated",
"with",
"a",
"service",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/bigquery.go#L34-L54 |
132,289 | sethvargo/go-fastly | fastly/bigquery.go | CreateBigQuery | func (c *Client) CreateBigQuery(i *CreateBigQueryInput) (*BigQuery, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
if i.ProjectID == "" {
return nil, ErrMissingProjectID
}
if i.Dataset ... | go | func (c *Client) CreateBigQuery(i *CreateBigQueryInput) (*BigQuery, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
if i.ProjectID == "" {
return nil, ErrMissingProjectID
}
if i.Dataset ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateBigQuery",
"(",
"i",
"*",
"CreateBigQueryInput",
")",
"(",
"*",
"BigQuery",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // CreateBigQuery creates a new Fastly BigQuery logging endpoint. | [
"CreateBigQuery",
"creates",
"a",
"new",
"Fastly",
"BigQuery",
"logging",
"endpoint",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/bigquery.go#L100-L167 |
132,290 | sethvargo/go-fastly | fastly/bigquery.go | UpdateBigQuery | func (c *Client) UpdateBigQuery(i *UpdateBigQueryInput) (*BigQuery, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
if i.NewName == "" {
return nil, ErrMissingNewName
}
params := make(ma... | go | func (c *Client) UpdateBigQuery(i *UpdateBigQueryInput) (*BigQuery, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
if i.NewName == "" {
return nil, ErrMissingNewName
}
params := make(ma... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateBigQuery",
"(",
"i",
"*",
"UpdateBigQueryInput",
")",
"(",
"*",
"BigQuery",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // UpdateBigQuery updates a BigQuery logging endpoint. | [
"UpdateBigQuery",
"updates",
"a",
"BigQuery",
"logging",
"endpoint",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/bigquery.go#L221-L282 |
132,291 | sethvargo/go-fastly | fastly/request_setting.go | ListRequestSettings | func (c *Client) ListRequestSettings(i *ListRequestSettingsInput) ([]*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/request_settings", i.Service, i.Version)
resp, err := c.Get(path... | go | func (c *Client) ListRequestSettings(i *ListRequestSettingsInput) ([]*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/request_settings", i.Service, i.Version)
resp, err := c.Get(path... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListRequestSettings",
"(",
"i",
"*",
"ListRequestSettingsInput",
")",
"(",
"[",
"]",
"*",
"RequestSetting",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissi... | // ListRequestSettings returns the list of request settings for the
// configuration version. | [
"ListRequestSettings",
"returns",
"the",
"list",
"of",
"request",
"settings",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/request_setting.go#L81-L102 |
132,292 | sethvargo/go-fastly | fastly/request_setting.go | CreateRequestSetting | func (c *Client) CreateRequestSetting(i *CreateRequestSettingInput) (*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/request_settings", i.Service, i.Version)
resp, err := c.PostForm... | go | func (c *Client) CreateRequestSetting(i *CreateRequestSettingInput) (*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/request_settings", i.Service, i.Version)
resp, err := c.PostForm... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateRequestSetting",
"(",
"i",
"*",
"CreateRequestSettingInput",
")",
"(",
"*",
"RequestSetting",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
... | // CreateRequestSetting creates a new Fastly request settings. | [
"CreateRequestSetting",
"creates",
"a",
"new",
"Fastly",
"request",
"settings",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/request_setting.go#L127-L147 |
132,293 | sethvargo/go-fastly | fastly/request_setting.go | GetRequestSetting | func (c *Client) GetRequestSetting(i *GetRequestSettingInput) (*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/request_settings/%s... | go | func (c *Client) GetRequestSetting(i *GetRequestSettingInput) (*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/request_settings/%s... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRequestSetting",
"(",
"i",
"*",
"GetRequestSettingInput",
")",
"(",
"*",
"RequestSetting",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n"... | // GetRequestSetting gets the request settings configuration with the given
// parameters. | [
"GetRequestSetting",
"gets",
"the",
"request",
"settings",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/request_setting.go#L162-L186 |
132,294 | sethvargo/go-fastly | fastly/request_setting.go | UpdateRequestSetting | func (c *Client) UpdateRequestSetting(i *UpdateRequestSettingInput) (*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/request_setti... | go | func (c *Client) UpdateRequestSetting(i *UpdateRequestSettingInput) (*RequestSetting, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/request_setti... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateRequestSetting",
"(",
"i",
"*",
"UpdateRequestSettingInput",
")",
"(",
"*",
"RequestSetting",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
... | // UpdateRequestSetting updates a specific request settings. | [
"UpdateRequestSetting",
"updates",
"a",
"specific",
"request",
"settings",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/request_setting.go#L214-L238 |
132,295 | sethvargo/go-fastly | fastly/dictionary.go | ListDictionaries | func (c *Client) ListDictionaries(i *ListDictionariesInput) ([]*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err !... | go | func (c *Client) ListDictionaries(i *ListDictionariesInput) ([]*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.Service, i.Version)
resp, err := c.Get(path, nil)
if err !... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListDictionaries",
"(",
"i",
"*",
"ListDictionariesInput",
")",
"(",
"[",
"]",
"*",
"Dictionary",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService"... | // ListDictionaries returns the list of dictionaries for the configuration version. | [
"ListDictionaries",
"returns",
"the",
"list",
"of",
"dictionaries",
"for",
"the",
"configuration",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary.go#L55-L76 |
132,296 | sethvargo/go-fastly | fastly/dictionary.go | CreateDictionary | func (c *Client) CreateDictionary(i *CreateDictionaryInput) (*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if... | go | func (c *Client) CreateDictionary(i *CreateDictionaryInput) (*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.Service, i.Version)
resp, err := c.PostForm(path, i, nil)
if... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateDictionary",
"(",
"i",
"*",
"CreateDictionaryInput",
")",
"(",
"*",
"Dictionary",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}... | // CreateDictionary creates a new Fastly dictionary. | [
"CreateDictionary",
"creates",
"a",
"new",
"Fastly",
"dictionary",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary.go#L90-L110 |
132,297 | sethvargo/go-fastly | fastly/dictionary.go | GetDictionary | func (c *Client) GetDictionary(i *GetDictionaryInput) (*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.Service, i.Ve... | go | func (c *Client) GetDictionary(i *GetDictionaryInput) (*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.Service, i.Ve... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDictionary",
"(",
"i",
"*",
"GetDictionaryInput",
")",
"(",
"*",
"Dictionary",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}",
"... | // GetDictionary gets the dictionary configuration with the given parameters. | [
"GetDictionary",
"gets",
"the",
"dictionary",
"configuration",
"with",
"the",
"given",
"parameters",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary.go#L124-L148 |
132,298 | sethvargo/go-fastly | fastly/dictionary.go | UpdateDictionary | func (c *Client) UpdateDictionary(i *UpdateDictionaryInput) (*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.Service... | go | func (c *Client) UpdateDictionary(i *UpdateDictionaryInput) (*Dictionary, error) {
if i.Service == "" {
return nil, ErrMissingService
}
if i.Version == 0 {
return nil, ErrMissingVersion
}
if i.Name == "" {
return nil, ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.Service... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateDictionary",
"(",
"i",
"*",
"UpdateDictionaryInput",
")",
"(",
"*",
"Dictionary",
",",
"error",
")",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrMissingService",
"\n",
"}... | // UpdateDictionary updates a specific dictionary. | [
"UpdateDictionary",
"updates",
"a",
"specific",
"dictionary",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary.go#L165-L189 |
132,299 | sethvargo/go-fastly | fastly/dictionary.go | DeleteDictionary | func (c *Client) DeleteDictionary(i *DeleteDictionaryInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.Version == 0 {
return ErrMissingVersion
}
if i.Name == "" {
return ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.Service, i.Version, i.Name)
resp, er... | go | func (c *Client) DeleteDictionary(i *DeleteDictionaryInput) error {
if i.Service == "" {
return ErrMissingService
}
if i.Version == 0 {
return ErrMissingVersion
}
if i.Name == "" {
return ErrMissingName
}
path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.Service, i.Version, i.Name)
resp, er... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteDictionary",
"(",
"i",
"*",
"DeleteDictionaryInput",
")",
"error",
"{",
"if",
"i",
".",
"Service",
"==",
"\"",
"\"",
"{",
"return",
"ErrMissingService",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"Version",
"==",
"0... | // DeleteDictionary deletes the given dictionary version. | [
"DeleteDictionary",
"deletes",
"the",
"given",
"dictionary",
"version",
"."
] | f249287bd4fda366a7f324f45a2308e934198464 | https://github.com/sethvargo/go-fastly/blob/f249287bd4fda366a7f324f45a2308e934198464/fastly/dictionary.go#L203-L226 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.