text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func VisitorMiddleware() gin.HandlerFunc {
return func(g *gin.Context) {
if g.GetHeader("Authorization") == "" {
helpers.ReturnForbidden(g, "Invalid API token!")
return
}
user := models.GetUserBYToken(g.GetHeader("Authorization"))
if user.ID == 0 || user.Type != 2 {
helpers.ReturnForbidden(g, "Invali... | [
-1.010353446006775,
-0.5110923051834106,
0.69800865650177,
0.0000857887789607048,
-0.866901695728302,
-0.478088915348053,
0.42481210827827454,
-0.11839400231838226,
0.22979649901390076,
1.0380353927612305,
-0.03705647587776184,
-0.032886065542697906,
-0.1169557273387909,
-0.523958504199981... |
func (v *visitor) GetUserName() string {
// anonymous username for unauthenticated Visitor
if !v.ctx.IsAuthenticated() {
return "anonymous"
}
return v.ctx.GetUsername()
} | [
-0.7460840940475464,
-0.02881512977182865,
0.620067834854126,
0.9066336750984192,
-0.1336970329284668,
0.39150646328926086,
0.215473473072052,
0.17084379494190216,
0.3172212541103363,
0.7516786456108093,
0.5376838445663452,
-0.33069294691085815,
0.37611404061317444,
-0.26319420337677,
-0... |
func (v *visitor) GetPolicies() []*rbac.Policy {
if v.ctx.IsSysAdmin() {
return GetAllPolicies(v.namespace)
}
if v.namespace.IsPublic() {
return PoliciesForPublicProject(v.namespace)
}
return nil
} | [
-0.04093962162733078,
0.6240091323852539,
0.49678224325180054,
1.0171679258346558,
0.8624724745750427,
0.9578157663345337,
-0.4257187843322754,
-1.2222075462341309,
1.1357001066207886,
-0.15597020089626312,
0.829839825630188,
0.6730943918228149,
-0.5062648057937622,
0.8651789426803589,
-... |
func (v *visitor) GetRoles() []rbac.Role {
// Ignore roles when visitor is anonymous or system admin
if !v.ctx.IsAuthenticated() || v.ctx.IsSysAdmin() {
return nil
}
roles := []rbac.Role{}
for _, roleID := range v.projectRoles {
roles = append(roles, &visitorRole{roleID: roleID, namespace: v.namespace})
}
... | [
-0.17106486856937408,
1.0145777463912964,
0.3234226703643799,
0.42115408182144165,
0.9740604758262634,
0.5546565055847168,
0.057324059307575226,
-0.9359270334243774,
0.650861918926239,
0.10188706964254379,
0.7793657779693604,
0.4853616952896118,
-0.7859512567520142,
0.45556575059890747,
... |
func NewUser(ctx visitorContext, namespace rbac.Namespace, projectRoles ...int) rbac.User {
return &visitor{
ctx: ctx,
namespace: namespace,
projectRoles: projectRoles,
}
} | [
0.29473423957824707,
0.37870585918426514,
0.3465992510318756,
0.6251232624053955,
-0.13585035502910614,
0.6957336664199829,
0.6586286425590515,
-1.2493070363998413,
0.9519109725952148,
-0.783025324344635,
0.299446702003479,
0.3857865035533905,
-0.3769620656967163,
-0.348955363035202,
-0.... |
func ParsePort(port string) (int, error) {
i, err := strconv.Atoi(port)
if err != nil || !isPort(i) {
return -1, fmt.Errorf("\"%s\" is not a valid TCP port", port)
}
return i, nil
} | [
-0.31103071570396423,
0.06179720535874367,
0.7654018998146057,
-0.17778179049491882,
-0.5023119449615479,
-0.2835152745246887,
0.9393928050994873,
0.10080823302268982,
-0.05762437358498573,
-0.03066273033618927,
0.3289636969566345,
-0.5488770604133606,
-0.9382535815238953,
-0.2463401407003... |
func ParsePortRange(portRange string) (PortRange, error) {
bounds := strings.Split(portRange, "-")
if len(bounds) > 2 {
return PortRange{}, fmt.Errorf("ranges expected as <lower>-<upper>")
}
if len(bounds) == 1 {
// If only provided a single value, treat as both lower- and upper-bounds
bounds = append(bounds,... | [
-0.2671315371990204,
-1.2052266597747803,
0.531456708908081,
0.08023571223020554,
-0.15930961072444916,
0.2930777072906494,
0.08909901231527328,
0.18076902627944946,
-0.21997930109500885,
-0.4447334110736847,
0.12756435573101044,
0.7196475863456726,
-0.9130544662475586,
0.11466345191001892... |
func isPort(port int) bool {
return 0 <= port && port <= 65535
} | [
-0.5014318823814392,
0.012810785323381424,
0.44621744751930237,
0.693052351474762,
-0.15153521299362183,
0.6183788776397705,
0.33960333466529846,
-0.6019413471221924,
1.0427647829055786,
-0.4939534366130829,
-0.410293847322464,
0.06330037862062454,
-1.0967075824737549,
-0.19971749186515808... |
func (pr PortRange) Ports() []uint16 {
var ports []uint16
for i := pr.LowerBound; i <= pr.UpperBound; i++ {
ports = append(ports, uint16(i))
}
return ports
} | [
-0.3440811038017273,
-0.2971455454826355,
0.18101008236408234,
-0.5316570401191711,
1.399734377861023,
0.8461081385612488,
-0.36874234676361084,
-0.32629963755607605,
0.43580156564712524,
-0.27031925320625305,
0.1267971694469452,
0.33409440517425537,
-0.9952079653739929,
0.2437741309404373... |
func (o *DeleteTestsE2eEnodebdTestPkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteTestsE2eEnodebdTestPkNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return ni... | [
0.011266708374023438,
-0.6188995242118835,
0.7375754117965698,
0.6131263375282288,
0.3852466940879822,
-1.0961893796920776,
-0.07066748291254044,
-0.05056951940059662,
0.24257124960422516,
0.21435533463954926,
0.5188129544258118,
-0.4055279493331909,
-0.9516704678535461,
0.1949734538793563... |
func NewDeleteTestsE2eEnodebdTestPkNoContent() *DeleteTestsE2eEnodebdTestPkNoContent {
return &DeleteTestsE2eEnodebdTestPkNoContent{}
} | [
0.6813808679580688,
-0.5134292840957642,
0.0468723326921463,
0.6413506865501404,
-0.8066988587379456,
0.26026710867881775,
-0.472656786441803,
-0.3703959584236145,
-0.7615724205970764,
-0.5172935724258423,
-0.14230504631996155,
0.015835918486118317,
0.34084662795066833,
0.06404920667409897... |
func NewDeleteTestsE2eEnodebdTestPkDefault(code int) *DeleteTestsE2eEnodebdTestPkDefault {
return &DeleteTestsE2eEnodebdTestPkDefault{
_statusCode: code,
}
} | [
0.7708957195281982,
0.007430228870362043,
0.25336113572120667,
0.5528971552848816,
1.0788464546203613,
0.3063783049583435,
-0.7019979953765869,
0.9250434041023254,
-0.4355190694332123,
0.10547205805778503,
-0.4992074966430664,
-0.309292197227478,
0.05412278324365616,
0.05505315586924553,
... |
func (o *DeleteTestsE2eEnodebdTestPkDefault) Code() int {
return o._statusCode
} | [
0.394330233335495,
0.1351134032011032,
0.2526952028274536,
0.9484679698944092,
1.096488118171692,
0.183062344789505,
-0.01207038201391697,
1.2539818286895752,
-0.5656924247741699,
0.08594066649675369,
0.052506931126117706,
-0.13184905052185059,
-0.36198922991752625,
0.7302241921424866,
-... |
func (l TestableLog) TestData() []settings.TestBundle {
return []settings.TestBundle{
{
Description: "Basic log",
Data: templates.Args{
"Log": "This is the log",
"Closed": true,
},
},
}
} | [
-0.08373510837554932,
-0.04805169999599457,
0.40937674045562744,
-0.38183268904685974,
0.35530418157577515,
0.6034001708030701,
-0.36793383955955505,
-0.3374648094177246,
-0.05302485451102257,
-0.9022468328475952,
0.08203235268592834,
-0.04805285111069679,
-0.055800095200538635,
0.56823146... |
func (b TestableBuild) TestData() []settings.TestBundle {
basic := resp.MiloBuild{
Summary: resp.BuildComponent{
Label: "Test swarming build",
Status: resp.Success,
Started: time.Date(2016, 1, 2, 15, 4, 5, 999999999, time.UTC),
Finished: time.Date(2016, 1, 2, 15, 4, 6, 999999999, time.UTC),
Dura... | [
-0.17821718752384186,
-0.11428911983966827,
0.7170931100845337,
0.12750756740570068,
0.7922843098640442,
0.8656275272369385,
0.5384033918380737,
-0.6966965794563293,
-0.3933365046977997,
-0.5354171991348267,
0.21492724120616913,
-0.11968491226434708,
-0.29910171031951904,
0.720523357391357... |
func (o *Update) Read(r *bufio.Reader, h *Header) error {
o.Header = h
// Skip reserved field
if _, err := r.Discard(4); err != nil {
return fmt.Errorf("op_update reserved field: %s", err)
}
var raw [4]byte
d := raw[:]
// Decode full collection name
name, err := cstring(r)
if err != nil {
return fmt.Err... | [
-0.2691740393638611,
-0.987902820110321,
0.9058369398117065,
-0.45381757616996765,
-0.9234238266944885,
0.13183416426181793,
0.5690895915031433,
-0.45793822407722473,
-0.45176318287849426,
0.3651670813560486,
-0.6903983354568481,
0.030063750222325325,
-0.7331528663635254,
-0.45991089940071... |
func (table *hashtable) willExceedCapacity() bool {
const hashtableMaxLoad = 0.75
return table.size+1 > int(float64(table.capacity)*hashtableMaxLoad)
} | [
0.09622902423143387,
0.9709659814834595,
0.46691980957984924,
1.0959522724151611,
-0.8857539296150208,
0.25792238116264343,
0.04325217008590698,
-0.9889571666717529,
-0.22793953120708466,
-0.7242625951766968,
-0.18581053614616394,
-0.2504301071166992,
0.4807295501232147,
0.8603794574737549... |
func validateExtraConfig(reflectValue reflect.Value) schema.SchemaValidateDiagFunc {
return func(v interface{}, path cty.Path) diag.Diagnostics {
var diags diag.Diagnostics
extraConfig := v.(map[string]interface{})
for i := 0; i < reflectValue.NumField(); i++ {
field := reflectValue.Field(i)
jsonKey := s... | [
-1.0398576259613037,
-0.04111795127391815,
0.5720547437667847,
-0.4540760815143585,
-1.2438383102416992,
-0.006973955314606428,
1.0439523458480835,
0.43250828981399536,
-0.46372929215431213,
0.679373562335968,
-0.334749698638916,
0.575096607208252,
0.5205381512641907,
1.4689950942993164,
... |
func TestExp(t *testing.T) {
var tests = []ExpTestCase{
{"1.2 + 34.5 + 56.7", "(1.2 + (34.5 + 56.7))", 92.4},
{"7 + 15 / 5 * 6", "(7 + ((15 / 5) * 6))", 25.0},
{"11*(55-5)-50*3", "((11 * (55 - 5)) - (50 * 3))", 400},
{"50/5 + 3.33-8+(3*25)", "((50 / 5) + ((3.33 - 8) + (3 * 25)))", 80.33},
{"", "", 0.0},
}
... | [
0.4637101888656616,
-0.2448459416627884,
0.514233410358429,
-0.41943562030792236,
0.03397376462817192,
-0.029049718752503395,
0.42500782012939453,
-0.1716284602880478,
0.790378212928772,
-0.007932661101222038,
-0.5289255380630493,
-0.4067820608615875,
-0.4461841285228729,
-0.67180526256561... |
func (s Slice) SliceToMap(is ...interface{}) M {
m := M{}
var inter []interface{}
var interNum int
switch si := s.I.(type) {
case []string:
if len(is) > 0 {
var ok bool
inter, ok = is[0].([]interface{})
if !ok {
return m
}
}
interNum = len(inter)
for key, value := range si {
if key <= i... | [
-1.2534246444702148,
-0.44805535674095154,
0.8288965225219727,
0.22448930144309998,
-0.6555740237236023,
-0.5804246068000793,
0.3894224464893341,
-0.0014985882444307208,
1.2144931554794312,
1.035053014755249,
0.08596334606409073,
0.09928436577320099,
0.06594358384609222,
-0.531261503696441... |
func parseConfig(path string) (config *Config, err error) {
file, err := os.Open(path)
if err != nil {
return
}
defer file.Close()
data, err := ioutil.ReadAll(file)
if err != nil {
return
}
config = &Config{}
if err = json.Unmarshal(data, config); err != nil {
return nil, err
}
return
} | [
-0.16284394264221191,
-0.2628089189529419,
0.7979374527931213,
-0.786532461643219,
-0.5790066123008728,
0.17451171576976776,
-0.09753138571977615,
0.3387283682823181,
-1.026219367980957,
0.7840679883956909,
-0.3990630805492401,
-0.2834434509277344,
0.2787366509437561,
0.388304740190506,
... |
func (action *TransactionCreateAction) JSON() error {
action.Do(
action.loadTX,
action.loadResult,
action.loadResource,
func() { hal.Render(action.W, action.Resource) },
)
return action.Err
} | [
-0.6424498558044434,
-0.584556519985199,
0.43487298488616943,
-0.7173810601234436,
-0.3602287471294403,
-0.48221683502197266,
0.6763022541999817,
-0.7410524487495422,
-0.35173243284225464,
0.1659468710422516,
-0.48297548294067383,
0.16451087594032288,
0.680034339427948,
0.11692986637353897... |
func GetList(c Context) {
res, err := db.SelectAllItems()
if err != nil {
c.JSON(http.StatusInternalServerError, err)
return
}
c.JSON(http.StatusOK, res)
} | [
-0.5474875569343567,
-0.4174978733062744,
0.6997830867767334,
0.45193397998809814,
0.8937715888023376,
-0.08768480271100998,
-0.8171563148498535,
0.6141759157180786,
0.44700780510902405,
0.5279348492622375,
-0.8382257223129272,
0.0359930656850338,
0.1532466858625412,
0.15264713764190674,
... |
func GetItem(c Context) {
identifer, err := strconv.Atoi(c.Param("id"))
if err != nil {
c.JSON(http.StatusInternalServerError, err)
return
}
res, err := db.SelectItem(int64(identifer))
if err != nil {
c.JSON(http.StatusInternalServerError, err)
return
}
c.JSON(http.StatusOK, res)
} | [
-1.2232887744903564,
0.23088665306568146,
0.4032786190509796,
0.6951038241386414,
0.2784193754196167,
0.7203075885772705,
0.04653383791446686,
-0.45762160420417786,
0.12581656873226166,
0.3087538778781891,
0.1871102750301361,
0.4129592478275299,
-0.19258330762386322,
-0.130275160074234,
... |
func FetchLatestTag() (string, error) {
klog.V(4).Infof("Fetching latest tag from GitHub")
response, err := http.Get(versionURL)
if err != nil {
return "", errors.Wrapf(err, "could not GET the latest release")
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return "", errors.Errorf("ex... | [
0.43922314047813416,
-0.7641840577125549,
0.43029719591140747,
-0.03555070236325264,
-0.1148906797170639,
0.023140685632824898,
-1.3850278854370117,
-0.22915244102478027,
-0.3004993796348572,
1.1506896018981934,
-0.49972501397132874,
0.5077955722808838,
0.24307462573051453,
0.7368294000625... |
func NewArtistHandler(d *mgo.Session) *ArtistHandler {
return &ArtistHandler{d}
} | [
0.3080030679702759,
-0.6115415096282959,
0.06372338533401489,
-0.37192437052726746,
-2.1594882011413574,
0.1267804503440857,
0.015749819576740265,
0.4049775004386902,
0.7886769771575928,
-0.232923224568367,
-0.25272470712661743,
0.1994154006242752,
-0.6398817896842957,
-0.28780004382133484... |
func (handle ArtistHandler) Create(w http.ResponseWriter, req *http.Request) {
var artist model.Artist
if err := json.NewDecoder(req.Body).Decode(&artist); err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusNotAcceptable)
}
dao := model.NewArtistDAO(handle.db)
artist.ID = bson.NewObjectIdWith... | [
-0.9025170207023621,
-0.5812803506851196,
0.7524476051330566,
0.30132821202278137,
-0.007886319421231747,
0.7790379524230957,
0.19860495626926422,
0.012669315561652184,
-0.5630024075508118,
0.15858551859855652,
-0.4184876084327698,
-0.4150813817977905,
-0.4349663555622101,
0.92557930946350... |
func (handle ArtistHandler) Read(w http.ResponseWriter, req *http.Request) {
dao := model.NewArtistDAO(handle.db)
results, err := dao.Read()
if err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
log.Printf("%s - %s - %s\n", req.Method, req.Host, req.URL.Path)
w.Header... | [
-0.8177021145820618,
-0.3650355339050293,
0.7237299680709839,
-0.29544195532798767,
-0.13759315013885498,
0.6440785527229309,
0.684541642665863,
-0.08850763738155365,
-0.6697735786437988,
-0.4140825569629669,
0.18441352248191833,
0.20412375032901764,
-0.3755359947681427,
0.3958881199359894... |
func (handle ArtistHandler) Update(w http.ResponseWriter, req *http.Request) {
var artist model.Artist
if err := json.NewDecoder(req.Body).Decode(&artist); err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
params := mux.Vars(req)
dao := model.NewArtistDAO(handle.db)
... | [
-1.1786088943481445,
-1.1445515155792236,
0.4856788218021393,
-0.3423987329006195,
-0.7365754842758179,
0.7076677083969116,
0.04360063374042511,
0.0032757800072431564,
-0.0845860093832016,
0.3034227192401886,
-0.3736094534397125,
0.2665384113788605,
-0.7573688626289368,
0.38695645332336426... |
func (handle ArtistHandler) FindByID(w http.ResponseWriter, req *http.Request) {
param := mux.Vars(req)
artist, err := model.NewArtistDAO(handle.db).FindByID(param["id"])
if err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusNotFound)
}
log.Printf("%s - %s - %s\n", req.Method, req.Host, req.... | [
-0.03630448132753372,
-0.5605901479721069,
0.5259935259819031,
-0.3925558924674988,
-0.42111679911613464,
0.15976330637931824,
0.4923899173736572,
-0.6398239731788635,
-0.30381983518600464,
0.20501962304115295,
-0.6347573399543762,
0.1949499249458313,
-0.8517119288444519,
1.490344882011413... |
func (handle ArtistHandler) Delete(w http.ResponseWriter, req *http.Request) {
params := mux.Vars(req)
if err := model.NewArtistDAO(handle.db).Delete(params["id"]); err != nil {
log.Println(err)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
log.Printf("%s - %s - %s\n", req.Method, req.Host, req... | [
-0.4272269904613495,
-0.21362121403217316,
0.7025454044342041,
0.39342013001441956,
0.24253633618354797,
0.9403009414672852,
0.8165904879570007,
0.5089419484138489,
0.19143204391002655,
-0.1559145152568817,
0.00503690866753459,
0.07844369113445282,
-1.2275581359863281,
0.602912187576294,
... |
func preflightConfigLoader() map[string]string {
cfm := make(map[string]string)
//EnvKpGcpBucket is the cloud storage bucket to target
cfm["EnvKpGcpBucket"] = os.Getenv("KP_GCP_BUCKET")
//EnvKpPrivateKey is the jwt private key
cfm["EnvKpPrivateKey"] = os.Getenv("KP_PRIKEY")
//EnvKpPublicKey is the jwt public key... | [
-0.5974530577659607,
-0.7135143280029297,
0.9933076500892639,
-0.4020645022392273,
-0.5352445244789124,
0.9155925512313843,
-1.252321481704712,
-0.5204846858978271,
-0.9204872250556946,
0.8070127964019775,
-0.28399014472961426,
-0.6241807341575623,
-0.16087400913238525,
1.0693821907043457,... |
func Visit(depth int, ent Entity, entType Type, visitorFn Visitor) bool {
op := ent.Opcode()
switch {
case (entType == TypeAny) ||
(entType == TypeDevice && op == OpDevice) ||
(entType == TypeProcessor && op == OpProcessor) ||
(entType == TypePowerResource && op == OpPowerRes) ||
(entType == TypeThermalZone ... | [
-1.2297285795211792,
0.3349248766899109,
0.9472650289535522,
-0.6555781960487366,
-0.052670132368803024,
-0.2911539077758789,
1.11069917678833,
-0.33952441811561584,
-0.7149897217750549,
0.3464961647987366,
0.2305808812379837,
-0.06487614661455154,
-0.48291197419166565,
0.5213573575019836,... |
func (m *GatewayRecommendationV4Response) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateHostGroups(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
0.46641406416893005,
-0.36969614028930664,
-0.10507424920797348,
-0.598182737827301,
-0.22036945819854736,
-0.38732993602752686,
0.5145213603973389,
-0.10230843722820282,
-0.6093114018440247,
1.773353934288025,
0.4285605549812317,
0.7446092963218689,
-1.5210331678390503,
0.1884373873472213... |
func Text(s string) *html.Node {
return &html.Node{
Type: html.TextNode, Data: s,
}
} | [
0.11344479024410248,
0.9009288549423218,
0.07264644652605057,
-0.8094112873077393,
-0.6098595261573792,
0.1121021956205368,
-0.32031017541885376,
0.3227114677429199,
0.9433326721191406,
-0.3104398548603058,
-0.6435418725013733,
1.0320430994033813,
0.41652172803878784,
-1.3456320762634277,
... |
func RenderNodes(nodes ...*html.Node) (template.HTML, error) {
var buf bytes.Buffer
for _, node := range nodes {
err := html.Render(&buf, node)
if err != nil {
return "", err
}
}
return template.HTML(buf.String()), nil
} | [
-0.8207570314407349,
1.2087846994400024,
-0.08353213220834732,
-0.42608240246772766,
-0.36608609557151794,
0.006961484905332327,
-0.6697477102279663,
-0.03550957143306732,
-0.514031708240509,
0.42801550030708313,
0.06970728933811188,
-0.18493272364139557,
-0.9382791519165039,
0.03246187791... |
func initRouter(e *bm.Engine) {
version := e.Group("/ep/admin/saga/v1", authSvc.Permit2(""))
{
project := version.Group("/projects")
{
project.GET("/favorite", favoriteProjects)
project.POST("/favorite/edit", editFavorite)
project.GET("/common", queryCommonProjects)
}
tasks := version.Group("/tasks"... | [
-0.44521233439445496,
0.2149890959262848,
0.9292281270027161,
-0.03724562004208565,
-0.48508554697036743,
0.43211206793785095,
0.7967804670333862,
0.4761265516281128,
-0.6541323661804199,
0.40119966864585876,
-0.2819548547267914,
0.46896857023239136,
-0.22304028272628784,
0.715263128280639... |
func Usage() {
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\tgen-bash-completion\n")
os.Exit(2)
} | [
0.13990652561187744,
0.01260509341955185,
0.9210723638534546,
-0.2392791509628296,
0.19518786668777466,
0.0442948192358017,
0.7399503588676453,
-0.0676441639661789,
-1.0690447092056274,
0.39908742904663086,
0.4606166183948517,
0.4874345064163208,
0.5863859057426453,
1.2548481225967407,
0... |
func NewListTaskNexusParams() *ListTaskNexusParams {
return &ListTaskNexusParams{
timeout: cr.DefaultTimeout,
}
} | [
-0.24921230971813202,
-0.33186426758766174,
0.09550362080335617,
0.47997403144836426,
-0.9492502808570862,
0.011413740925490856,
-1.3234083652496338,
1.0964057445526123,
-0.19282744824886322,
-0.2577204704284668,
-1.0659757852554321,
0.4790555536746979,
0.720173180103302,
0.808109223842620... |
func NewListTaskNexusParamsWithTimeout(timeout time.Duration) *ListTaskNexusParams {
return &ListTaskNexusParams{
timeout: timeout,
}
} | [
0.21739313006401062,
-0.19217459857463837,
0.314028263092041,
0.4326319694519043,
-0.7840653657913208,
0.41686514019966125,
-2.0207183361053467,
1.163690447807312,
-0.1066526472568512,
0.8647823929786682,
-0.448906809091568,
0.7331498265266418,
0.5729901194572449,
0.77386474609375,
-1.14... |
func NewListTaskNexusParamsWithContext(ctx context.Context) *ListTaskNexusParams {
return &ListTaskNexusParams{
Context: ctx,
}
} | [
-0.3231075704097748,
-0.18109716475009918,
0.40111494064331055,
0.12877406179904938,
-0.5136531591415405,
0.5759389400482178,
-1.8257362842559814,
0.22447562217712402,
0.3948530852794647,
0.0847369134426117,
-0.25786253809928894,
0.3699628710746765,
0.6537815928459167,
0.4793822467327118,
... |
func NewListTaskNexusParamsWithHTTPClient(client *http.Client) *ListTaskNexusParams {
return &ListTaskNexusParams{
HTTPClient: client,
}
} | [
-0.2907090187072754,
-0.4191131889820099,
0.3026367425918579,
0.1493443101644516,
-0.4915276765823364,
0.4908107817173004,
-0.810116708278656,
0.6767851114273071,
-0.6763134002685547,
-0.13852423429489136,
-0.6777926683425903,
0.4023956060409546,
0.9060022234916687,
0.5365584492683411,
-... |
func (o *ListTaskNexusParams) WithTimeout(timeout time.Duration) *ListTaskNexusParams {
o.SetTimeout(timeout)
return o
} | [
0.2584100365638733,
0.52338045835495,
0.30184632539749146,
0.16826634109020233,
-0.668588399887085,
0.00938966404646635,
-1.0753843784332275,
0.8096535801887512,
0.30842387676239014,
0.33963704109191895,
-0.7011139988899231,
0.1501351296901703,
1.1330606937408447,
1.0200515985488892,
-1.... |
func (o *ListTaskNexusParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | [
-0.06029897183179855,
0.40432116389274597,
0.251581072807312,
0.1805361658334732,
-0.4520598351955414,
0.4416425824165344,
-0.996793806552887,
1.1650880575180054,
-0.24721409380435944,
0.45899611711502075,
-0.9186069965362549,
0.28570979833602905,
0.7244480848312378,
1.1274620294570923,
... |
func (o *ListTaskNexusParams) WithContext(ctx context.Context) *ListTaskNexusParams {
o.SetContext(ctx)
return o
} | [
-0.46476539969444275,
0.44044703245162964,
0.3577207624912262,
-0.0008638371946290135,
-0.6565716862678528,
0.00790227297693491,
-1.184812307357788,
0.09969709068536758,
0.7119448184967041,
-0.27163174748420715,
-0.5585110187530518,
-0.0292682908475399,
0.530010998249054,
0.565649271011352... |
func (o *ListTaskNexusParams) SetContext(ctx context.Context) {
o.Context = ctx
} | [
-0.5457385182380676,
0.5140712261199951,
0.24338865280151367,
0.1511813849210739,
-0.08532805740833282,
0.2165696769952774,
-1.009127140045166,
0.3888927400112152,
0.6208360195159912,
-0.2697781026363373,
-0.9195277690887451,
0.1563391536474228,
0.2962942123413086,
0.8275567293167114,
-1... |
func (o *ListTaskNexusParams) WithHTTPClient(client *http.Client) *ListTaskNexusParams {
o.SetHTTPClient(client)
return o
} | [
-0.22445763647556305,
-0.3297784626483917,
0.31645336747169495,
-0.28704920411109924,
-0.7195262908935547,
-0.009282697923481464,
-0.186930850148201,
0.10970547795295715,
-0.3475325107574463,
-0.5142046213150024,
-0.6275485754013062,
0.011399783194065094,
1.1106904745101929,
0.242103099822... |
func (o *ListTaskNexusParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | [
-0.12303664535284042,
-0.11786850541830063,
0.22229906916618347,
-0.6013215780258179,
-0.984790027141571,
-0.1522870659828186,
-0.22676397860050201,
0.21591173112392426,
-0.8151723146438599,
-0.2611635625362396,
-0.9272487163543701,
0.4864366948604584,
0.6100555658340454,
0.198406934738159... |
func (o *ListTaskNexusParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
-1.1698389053344727,
0.28791341185569763,
0.7070126533508301,
-0.1923438012599945,
0.7671712636947632,
-0.3108345866203308,
0.4097420573234558,
0.6206325888633728,
-0.2627261281013489,
0.3312978446483612,
-0.18648754060268402,
0.2576693892478943,
-0.1925986409187317,
0.3424007296562195,
... |
func (o *Tag) GetId() int64 {
if o == nil || o.Id == nil {
var ret int64
return ret
}
return *o.Id
} | [
1.1806166172027588,
0.11921484768390656,
0.35302531719207764,
1.2245539426803589,
0.41752421855926514,
-0.23262374103069305,
0.9186099767684937,
-0.3850509226322174,
1.3962458372116089,
-0.7112310528755188,
-0.3124065399169922,
-1.2749994993209839,
-0.5919275879859924,
1.3615367412567139,
... |
func (o *Tag) GetIdOk() (int64, bool) {
if o == nil || o.Id == nil {
var ret int64
return ret, false
}
return *o.Id, true
} | [
-0.7358896136283875,
0.8723819255828857,
0.5708111524581909,
1.3187439441680908,
0.25422030687332153,
-0.8133635520935059,
1.0508328676223755,
0.2539595365524292,
0.6050207018852234,
-0.5773096084594727,
-1.2802143096923828,
-1.1698596477508545,
-0.14048416912555695,
0.979306697845459,
0... |
func (o *Tag) HasId() bool {
if o != nil && o.Id != nil {
return true
}
return false
} | [
1.4401336908340454,
-0.371939092874527,
0.5543338060379028,
0.6621798276901245,
0.5663947463035583,
0.3257984519004822,
-0.0918886736035347,
0.6955603361129761,
1.180301308631897,
-0.7562782764434814,
-0.8048990368843079,
-0.9205694198608398,
-0.3086545765399933,
0.5248114466667175,
-0.3... |
func (o *Tag) SetId(v int64) {
o.Id = &v
} | [
0.7826079726219177,
0.13787683844566345,
-0.08646702021360397,
0.6613114476203918,
-0.44860702753067017,
0.22796297073364258,
-0.4920370876789093,
-0.8781577348709106,
0.804660975933075,
0.4291410446166992,
-0.4546113610267639,
0.16737760603427887,
0.3220309913158417,
0.6910861134529114,
... |
func (o *Tag) GetName() string {
if o == nil || o.Name == nil {
var ret string
return ret
}
return *o.Name
} | [
0.5193001627922058,
0.4207104444503784,
0.38674288988113403,
0.9142490029335022,
-0.2367701381444931,
-1.3910062313079834,
0.44204768538475037,
-0.6065922379493713,
0.11211125552654266,
0.36422961950302124,
-0.5364790558815002,
-1.7370303869247437,
-0.14116019010543823,
1.2170560359954834,... |
func (o *Tag) GetNameOk() (string, bool) {
if o == nil || o.Name == nil {
var ret string
return ret, false
}
return *o.Name, true
} | [
-0.11412832885980606,
0.03692660480737686,
0.6416102051734924,
0.30835866928100586,
-0.5101567506790161,
-0.32845357060432434,
0.37611743807792664,
-0.5195568203926086,
-0.29355543851852417,
0.9854565858840942,
-1.5582431554794312,
-1.493777871131897,
0.2659854590892792,
1.180919885635376,... |
func (o *Tag) HasName() bool {
if o != nil && o.Name != nil {
return true
}
return false
} | [
0.5312994122505188,
-0.07464927434921265,
0.3839808404445648,
0.45927155017852783,
0.1284603625535965,
-1.1352254152297974,
-0.12534818053245544,
0.09278064221143723,
-0.14762000739574432,
0.5455809235572815,
-0.9836650490760803,
-1.4191817045211792,
0.26455461978912354,
0.6550376415252686... |
func (o *Tag) SetName(v string) {
o.Name = &v
} | [
0.7711158394813538,
0.13916029036045074,
-0.13354253768920898,
-0.07234179228544235,
-1.1007874011993408,
-0.9682456851005554,
-0.837279200553894,
-1.014161229133606,
-0.4301958680152893,
0.9313558340072632,
-0.9141435623168945,
0.12266822159290314,
0.1033269464969635,
0.3606470823287964,
... |
func (o Tag) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if o.Name != nil {
toSerialize["name"] = o.Name
}
return json.Marshal(toSerialize)
} | [
-0.22394190728664398,
-1.1740458011627197,
0.39067700505256653,
-0.31600964069366455,
-0.07891394942998886,
-0.5361592173576355,
-0.3649638295173645,
0.29014885425567627,
0.28143712878227234,
0.07596457749605179,
-1.7992920875549316,
0.7328721880912781,
0.3700339198112488,
0.94082444906234... |
func Example_container_ClientSetAccessPolicy() {
accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME")
if !ok {
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
}
containerName := "testcontainer"
containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName)
cred, ... | [
1.2297306060791016,
-0.27598273754119873,
0.9528510570526123,
-0.0715896412730217,
0.3770133852958679,
0.37377819418907166,
0.33783936500549316,
-0.3968583643436432,
-0.757147490978241,
0.3702533543109894,
-0.227403461933136,
1.0358738899230957,
-0.4268622100353241,
-0.3325386941432953,
... |
func Example_container_BatchDelete() {
accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME")
if !ok {
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
}
accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY")
if !ok {
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
}
const container... | [
1.2866523265838623,
-0.20822353661060333,
0.9058735370635986,
1.0040796995162964,
0.6229474544525146,
0.2812857925891876,
0.7253600358963013,
0.3442027270793915,
0.1687549203634262,
0.36939969658851624,
-0.719035804271698,
-0.03111167438328266,
-0.3336070775985718,
-0.25164127349853516,
... |
func Example_container_BatchSetTier() {
accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME")
if !ok {
panic("AZURE_STORAGE_ACCOUNT_NAME could not be found")
}
tenantID, ok := os.LookupEnv("AZURE_STORAGE_TENANT_ID")
if !ok {
panic("AZURE_STORAGE_TENANT_ID could not be found")
}
clientID, ok := os.Loo... | [
1.0279299020767212,
-0.2844243347644806,
0.8736191987991333,
0.6689596176147461,
0.40997710824012756,
0.3576633334159851,
0.2668865919113159,
-0.3118150532245636,
-0.5366888046264648,
-0.04692869260907173,
-0.7523282766342163,
-0.06553377956151962,
-0.38313207030296326,
-0.0422149971127510... |
func newUser(userID interface{}) *User {
return &User{connMap: newConnMap(), id: userID}
} | [
-0.43488168716430664,
-0.4780367910861969,
0.07301301509141922,
1.2202962636947632,
-0.7167366743087769,
0.31768080592155457,
0.18587955832481384,
-0.3984547555446625,
0.8622622489929199,
-0.6858217716217041,
-0.6677394509315491,
0.041783738881349564,
-0.23192019760608673,
0.32062202692031... |
func (u *User) ID() interface{} {
return u.id
} | [
-0.024526899680495262,
-0.6324430108070374,
0.18204911053180695,
1.6243356466293335,
-0.34703582525253296,
1.4955047369003296,
0.5798490643501282,
0.06792834401130676,
1.8103798627853394,
-0.8689293265342712,
-0.6966494917869568,
0.18826903402805328,
-0.5929105877876282,
0.3672998249530792... |
func (u *User) Send(command string, message interface{}) error {
errStr := ""
for _, connection := range u.connMap.Copy() {
if err := connection.Send(command, message); err != nil {
errStr += fmt.Sprintf("Connect %d: %v/n", connection.ID(), err)
}
}
if errStr != "" {
return errors.New(errStr)
}
return ni... | [
-0.8158692717552185,
-0.0034211548045277596,
0.4782816171646118,
0.9988828897476196,
0.4479626417160034,
0.18679527938365936,
-0.22398239374160767,
-0.8532832860946655,
-0.6287760734558105,
0.34892913699150085,
0.389547735452652,
0.15863467752933502,
-0.39311835169792175,
0.701243340969085... |
func (u *User) Connection(connID uint64) *Connection {
connection, ok := u.connMap.GetEx(connID)
if !ok {
connection = emptyConnection()
}
return connection
} | [
-0.4873077869415283,
-0.5667093396186829,
0.40729382634162903,
0.6666045188903809,
-0.048249926418066025,
-0.2246849238872528,
-0.743712842464447,
-0.3031459152698517,
1.097712755203247,
0.09476136416196823,
0.5923339128494263,
-0.23879969120025635,
-0.13476452231407166,
-0.219794809818267... |
func (u *User) Subscribers(commands string, message interface{}) Connections {
ret := newConnections()
for _, connection := range u.connMap.Copy() {
if connection.IsSubscribed(commands) {
ret.Add(connection)
}
}
return ret
} | [
-0.19409030675888062,
-0.7610966563224792,
0.4738442897796631,
0.707581639289856,
0.027953792363405228,
-0.7237086296081543,
-0.5845077037811279,
-0.029329493641853333,
-0.12020568549633026,
-0.5683655738830566,
0.2908582091331482,
-0.14938107132911682,
-0.6057571768760681,
0.3609424233436... |
func (u *User) GetConnects() (connectIDs map[uint64]*Connection) {
return u.connMap.Copy()
} | [
-0.8726774454116821,
-0.8927013874053955,
0.4109857976436615,
1.0359559059143066,
-0.1431507021188736,
-0.05450964719057083,
-0.013109608553349972,
-1.2756110429763794,
1.3446898460388184,
-0.8348968029022217,
-0.19185322523117065,
0.47228723764419556,
-0.5827074646949768,
0.18177863955497... |
func New(config config.Config, s3bucket *awsV1alpha1.S3Bucket, topicARN string) *Cloudformation {
return &Cloudformation{
S3Bucket: s3bucket,
config: config,
topicARN: topicARN,
}
} | [
0.6984454989433289,
-0.993766188621521,
0.233564555644989,
-0.6609116792678833,
0.08242173492908478,
-0.41362789273262024,
-0.2371247559785843,
-0.011839532293379307,
-0.05078194662928581,
-0.18263475596904755,
-0.3556690216064453,
-0.013300825841724873,
0.8681745529174805,
0.5434419512748... |
func (s *Cloudformation) StackName() string {
return helpers.StackName(s.config.ClusterName, "s3bucket", s.S3Bucket.Name, s.S3Bucket.Namespace)
} | [
0.6011701226234436,
-0.2621997594833374,
0.39775729179382324,
-0.09038978815078735,
0.2200956493616104,
0.20375312864780426,
-0.1483098268508911,
-0.0013051650021225214,
-0.5525950789451599,
0.8939847350120544,
-0.24232207238674164,
-0.00520456675440073,
0.790280818939209,
-0.1224699839949... |
func (s *Cloudformation) GetOutputs() (map[string]string, error) {
outputs := map[string]string{}
sess := s.config.AWSSession
svc := cloudformation.New(sess)
stackInputs := cloudformation.DescribeStacksInput{
StackName: aws.String(s.StackName()),
}
output, err := svc.DescribeStacks(&stackInputs)
if err != ni... | [
-0.548385500907898,
0.2727701961994171,
0.5771738886833191,
-0.07527545839548111,
-0.013020581565797329,
-1.1956027746200562,
0.008327839896082878,
-0.7850058674812317,
-0.7308687567710876,
-0.03226408362388611,
-0.172175332903862,
-0.2679837942123413,
-0.08615240454673767,
1.2855857610702... |
func (s *Cloudformation) CreateStack() (output *cloudformation.CreateStackOutput, err error) {
sess := s.config.AWSSession
svc := cloudformation.New(sess)
cftemplate := helpers.GetCloudFormationTemplate(s.config, "s3bucket", s.S3Bucket.Spec.CloudFormationTemplateName, s.S3Bucket.Spec.CloudFormationTemplateNamespace... | [
0.4517229199409485,
-0.31722015142440796,
0.5834795236587524,
-0.6527918577194214,
0.21136891841888428,
-0.3115310072898865,
0.41199541091918945,
0.04545098915696144,
-0.4010774791240692,
0.33808836340904236,
-0.26826682686805725,
0.07977265864610672,
0.22425411641597748,
0.194477245211601... |
func (s *Cloudformation) UpdateStack(updated *awsV1alpha1.S3Bucket) (output *cloudformation.UpdateStackOutput, err error) {
sess := s.config.AWSSession
svc := cloudformation.New(sess)
cftemplate := helpers.GetCloudFormationTemplate(s.config, "s3bucket", updated.Spec.CloudFormationTemplateName, updated.Spec.CloudFor... | [
-0.12165404111146927,
-1.0787829160690308,
0.6139335632324219,
-0.4858195185661316,
-0.578613817691803,
-0.2910711169242859,
0.5825393795967102,
0.20110204815864563,
-0.3171708881855011,
0.7771013379096985,
-0.5146870017051697,
0.49162545800209045,
0.34488552808761597,
0.07738688588142395,... |
func (s *Cloudformation) DeleteStack() (err error) {
sess := s.config.AWSSession
svc := cloudformation.New(sess)
stackInputs := cloudformation.DeleteStackInput{}
stackInputs.SetStackName(s.StackName())
_, err = svc.DeleteStack(&stackInputs)
return
} | [
-0.29429441690444946,
0.9297081828117371,
0.42682015895843506,
-0.0636988952755928,
0.4658902883529663,
-0.22129860520362854,
0.9562386870384216,
-0.2572329640388489,
0.2527276873588562,
-0.9004418253898621,
-0.49160316586494446,
0.6892882585525513,
0.3964692950248718,
0.6147522330284119,
... |
func (s *Cloudformation) WaitUntilStackDeleted() (err error) {
sess := s.config.AWSSession
svc := cloudformation.New(sess)
stackInputs := cloudformation.DescribeStacksInput{
StackName: aws.String(s.StackName()),
}
err = svc.WaitUntilStackDeleteComplete(&stackInputs)
return
} | [
1.012790560722351,
0.2773840129375458,
0.2825590968132019,
-0.6964882612228394,
0.5650671720504761,
0.0924789309501648,
-0.08315636962652206,
-0.3353011906147003,
0.14344799518585205,
-0.8139275908470154,
-0.5330668687820435,
0.6788604259490967,
0.06435280293226242,
0.2749421298503876,
0... |
func NewController(dao Dao) *Controller {
return &Controller{Dao: dao}
} | [
0.8708088397979736,
0.23555880784988403,
0.011249079369008541,
0.49811431765556335,
-1.1405620574951172,
0.19639761745929718,
0.14387965202331543,
0.5033158659934998,
1.407507300376892,
-0.6377078890800476,
0.07253982126712799,
0.20076759159564972,
0.7928668260574341,
0.04211123660206795,
... |
func (c *Controller) ListResources(w http.ResponseWriter, r *http.Request) {
resources := c.Dao.GetResources()
log.Println(resources)
data, _ := json.Marshal(resources)
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(http.StatusOK... | [
-0.5987318158149719,
-1.0708305835723877,
0.45258021354675293,
-0.6807785630226135,
-0.2751566767692566,
-0.37459439039230347,
0.14121440052986145,
0.30177271366119385,
0.7887288331985474,
0.4836397171020508,
-0.10887853056192398,
-0.19408094882965088,
0.1851317286491394,
0.222534045577049... |
func (c *Controller) CreateResource(w http.ResponseWriter, r *http.Request) {
var resource Resource
body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))
if err != nil {
log.Fatalln("Error creating resource", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
if err := r.Body.Close(); err != ... | [
-0.8221331238746643,
-0.3109890818595886,
0.5146976709365845,
-0.04758226126432419,
0.21373198926448822,
-0.23770476877689362,
0.10398723185062408,
-0.03103923611342907,
0.24503977596759796,
0.5704336762428284,
-0.02783510461449623,
-0.7366955280303955,
-0.33194610476493835,
0.616709887981... |
func (c *Controller) UpdateResource(w http.ResponseWriter, r *http.Request) {
var resource Resource
body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))
if err != nil {
log.Fatalln("Error updating resource", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
if err := r.Body.Close(); err != ... | [
-1.0873713493347168,
-0.8351189494132996,
0.7547721862792969,
-0.031696055084466934,
-0.5292785167694092,
-0.1954493671655655,
0.10650545358657837,
0.19750919938087463,
-0.018472451716661453,
0.7733404040336609,
0.17493729293346405,
-0.21547552943229675,
-0.16271346807479858,
0.39502754807... |
func (c *Controller) DeleteResource(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id := vars["id"]
if err := c.Dao.DeleteResource(id); err != "" {
if strings.Contains(err, "404") {
w.WriteHeader(http.StatusNotFound)
} else if strings.Contains(err, "500") {
w.WriteHeader(http.StatusInternalS... | [
-0.9270004034042358,
-0.30988094210624695,
0.5696637034416199,
0.1913057267665863,
-0.18545372784137726,
-0.28122660517692566,
0.20542022585868835,
0.48626866936683655,
0.5553615689277649,
0.4323507249355316,
0.21688774228096008,
-0.2656696140766144,
-0.20871520042419434,
1.000013589859008... |
func New(entities []interface{}, dba orm.ORM, version orm.VersionNumber,
migrations []orm.Migration, identityCalculator orm.IdentityHashCalculator) (room *Room, errors []error) {
if len(entities) < 1 {
errors = append(errors, fmt.Errorf("No entities provided for the database"))
}
if dba == nil {
errors = appen... | [
-0.48207420110702515,
-0.3305661976337433,
0.40080228447914124,
0.5898688435554504,
-0.5597469806671143,
0.05912630259990692,
0.3173782229423523,
0.48261210322380066,
-0.6868410706520081,
0.05079801008105278,
0.4795883297920227,
0.006916602607816458,
-0.0862819030880928,
1.4010003805160522... |
func GetKeys(rw io.ReadWriter) ([]tpmutil.Handle, error) {
b, err := getCapability(rw, CapHandle, rtKey)
if err != nil {
return nil, err
}
var handles []tpmutil.Handle
if _, err := tpmutil.Unpack(b, &handles); err != nil {
return nil, err
}
return handles, err
} | [
-0.42175352573394775,
-0.509745717048645,
0.43756765127182007,
-0.3406558930873871,
0.573226273059845,
-0.4347059726715088,
0.2903643548488617,
-0.34750744700431824,
-0.24826782941818237,
0.14959174394607544,
0.1743399053812027,
0.1267540007829666,
-1.0138050317764282,
-0.16040891408920288... |
func PcrExtend(rw io.ReadWriter, pcrIndex uint32, pcr pcrValue) ([]byte, error) {
in := []interface{}{pcrIndex, pcr}
var d pcrValue
out := []interface{}{&d}
if _, err := submitTPMRequest(rw, tagRQUCommand, ordExtend, in, out); err != nil {
return nil, err
}
return d[:], nil
} | [
-0.3517638146877289,
0.21718798577785492,
0.6489084959030151,
-0.4999935030937195,
-0.6718360781669617,
-0.6435813903808594,
-1.5537868738174438,
-0.5626013875007629,
0.04401855170726776,
-0.039232078939676285,
0.39469367265701294,
0.040689919143915176,
-1.3054193258285522,
0.2954809963703... |
func ReadPCR(rw io.ReadWriter, pcrIndex uint32) ([]byte, error) {
in := []interface{}{pcrIndex}
var v pcrValue
out := []interface{}{&v}
// There's no need to check the ret value here, since the err value contains
// all the necessary information.
if _, err := submitTPMRequest(rw, tagRQUCommand, ordPCRRead, in, ou... | [
-0.8182222247123718,
-0.3764532804489136,
0.5230386853218079,
-0.5473399758338928,
-0.3567889928817749,
-0.4175441861152649,
-0.6600101590156555,
-1.0283598899841309,
-0.09266076982021332,
-0.3797770142555237,
1.1072487831115723,
-0.36733317375183105,
-0.8171234130859375,
0.252687692642211... |
func FetchPCRValues(rw io.ReadWriter, pcrVals []int) ([]byte, error) {
var pcrs []byte
for _, v := range pcrVals {
pcr, err := ReadPCR(rw, uint32(v))
if err != nil {
return nil, err
}
pcrs = append(pcrs, pcr...)
}
return pcrs, nil
} | [
-0.17984476685523987,
-0.2682408094406128,
0.4347671568393707,
-0.3532005548477173,
-0.7429271936416626,
0.5780951380729675,
-1.5936992168426514,
-1.3797279596328735,
0.05467107892036438,
0.3593072295188904,
0.5166332721710205,
-0.1597897708415985,
-0.6833016872406006,
1.3039441108703613,
... |
func GetRandom(rw io.ReadWriter, size uint32) ([]byte, error) {
var b tpmutil.U32Bytes
in := []interface{}{size}
out := []interface{}{&b}
// There's no need to check the ret value here, since the err value
// contains all the necessary information.
if _, err := submitTPMRequest(rw, tagRQUCommand, ordGetRandom, in... | [
-0.3431781232357025,
0.22132064402103424,
0.6599986553192139,
-0.3003402054309845,
0.15349529683589935,
-0.5690776109695435,
-0.11168895661830902,
-0.680334746837616,
0.22271683812141418,
-0.6845118403434753,
0.3260977864265442,
0.24830950796604156,
-0.77198725938797,
0.22822342813014984,
... |
func LoadKey2(rw io.ReadWriter, keyBlob []byte, srkAuth []byte) (tpmutil.Handle, error) {
// Deserialize the keyBlob as a key
var k key
if _, err := tpmutil.Unpack(keyBlob, &k); err != nil {
return 0, err
}
// Run OSAP for the SRK, reading a random OddOSAP for our initial
// command and getting back a secret a... | [
-0.23448389768600464,
-0.43198060989379883,
0.7753357887268066,
0.3050128221511841,
-0.2766534388065338,
0.022540641948580742,
-0.17748486995697021,
-0.7856582403182983,
0.036837365478277206,
-0.3824670612812042,
0.13558878004550934,
-0.21225447952747345,
-1.1350756883621216,
0.31650075316... |
func Quote2(rw io.ReadWriter, handle tpmutil.Handle, data []byte, pcrVals []int, addVersion byte, aikAuth []byte) ([]byte, error) {
// Run OSAP for the handle, reading a random OddOSAP for our initial
// command and getting back a secret and a response.
sharedSecret, osapr, err := newOSAPSession(rw, etKeyHandle, han... | [
-0.3907093107700348,
-1.1437560319900513,
0.6550308465957642,
0.0442202053964138,
0.06294075399637222,
-0.08879463374614716,
-0.3227735459804535,
-1.1635191440582275,
0.39855802059173584,
-0.21310710906982422,
0.2894795536994934,
-0.05839749425649643,
-0.5130866765975952,
0.429651200771331... |
func GetPubKey(rw io.ReadWriter, keyHandle tpmutil.Handle, srkAuth []byte) ([]byte, error) {
// Run OSAP for the handle, reading a random OddOSAP for our initial
// command and getting back a secret and a response.
sharedSecret, osapr, err := newOSAPSession(rw, etKeyHandle, keyHandle, srkAuth)
if err != nil {
ret... | [
-0.10118314623832703,
0.3964640200138092,
0.7968204617500305,
0.09199100732803345,
0.4373592138290405,
-0.12286648154258728,
0.18361571431159973,
-0.5614168047904968,
0.7352762222290039,
0.02061706967651844,
0.1435985565185547,
-0.22881948947906494,
-0.5976788401603699,
0.589222252368927,
... |
func newOSAPSession(rw io.ReadWriter, entityType uint16, entityValue tpmutil.Handle, srkAuth []byte) ([20]byte, *osapResponse, error) {
osapc := &osapCommand{
EntityType: entityType,
EntityValue: entityValue,
}
var sharedSecret [20]byte
if _, err := rand.Read(osapc.OddOSAP[:]); err != nil {
return sharedSec... | [
-0.9880332946777344,
-0.32353344559669495,
0.6722978353500366,
-0.2524349093437195,
-0.202124685049057,
-0.6320558190345764,
0.3874908685684204,
-0.5783830285072327,
1.2618764638900757,
0.1424870789051056,
-0.5823951959609985,
-0.6625006794929504,
0.17200659215450287,
0.2523960769176483,
... |
func newCommandAuth(authHandle tpmutil.Handle, nonceEven Nonce, nonceOdd *Nonce, key []byte, params []interface{}) (*commandAuth, error) {
// Auth = HMAC-SHA1(key, SHA1(params) || NonceEven || NonceOdd || ContSession)
digestBytes, err := tpmutil.Pack(params...)
if err != nil {
return nil, err
}
digest := sha1.Su... | [
-0.37115272879600525,
-0.29277458786964417,
0.6785736680030823,
0.5122058987617493,
0.06038264185190201,
0.5005929470062256,
0.45920416712760925,
0.1326167732477188,
0.710719883441925,
0.06100885197520256,
0.8464163541793823,
0.3217950165271759,
-0.4458106756210327,
0.8044445514678955,
0... |
func (ra *responseAuth) verify(nonceOdd Nonce, key []byte, params []interface{}) error {
// Auth = HMAC-SHA1(key, SHA1(params) || ra.NonceEven || NonceOdd || ra.ContSession)
digestBytes, err := tpmutil.Pack(params...)
if err != nil {
return err
}
digest := sha1.Sum(digestBytes)
authBytes, err := tpmutil.Pack(d... | [
0.10605774819850922,
0.2031913846731186,
0.7667992115020752,
0.4593264162540436,
0.7824869155883789,
0.17847269773483276,
0.4018974006175995,
-0.4458045959472656,
0.5393209457397461,
0.2331043928861618,
-0.2940051853656769,
0.42859598994255066,
-0.846368134021759,
0.5048784613609314,
0.4... |
func zeroBytes(b []byte) {
for i := range b {
b[i] = 0
}
} | [
-0.23564887046813965,
-0.28762322664260864,
0.2307552546262741,
0.40983566641807556,
1.0912144184112549,
0.27204546332359314,
0.17151862382888794,
0.958409309387207,
0.2312767058610916,
0.23686140775680542,
-0.6108940243721008,
0.7712798714637756,
-1.6934798955917358,
0.509479820728302,
... |
func Seal(rw io.ReadWriter, loc Locality, pcrs []int, data []byte, srkAuth []byte) ([]byte, error) {
pcrInfo, err := newPCRInfoLong(rw, loc, pcrs)
if err != nil {
return nil, err
}
return sealHelper(rw, pcrInfo, data, srkAuth)
} | [
-0.23842884600162506,
-0.12216824293136597,
0.2730698585510254,
-0.8976286053657532,
-0.4178294539451599,
-0.5307006239891052,
-0.5811773538589478,
-0.48912519216537476,
0.2690645754337311,
-0.5717825293540955,
0.19245645403862,
0.6632620096206665,
-0.5425213575363159,
0.10555051267147064,... |
func Reseal(rw io.ReadWriter, loc Locality, pcrs map[int][]byte, data []byte, srkAuth []byte) ([]byte, error) {
pcrInfo, err := newPCRInfoLongWithHashes(loc, pcrs)
if err != nil {
return nil, err
}
return sealHelper(rw, pcrInfo, data, srkAuth)
} | [
-0.1660057008266449,
-0.3001675009727478,
0.48503655195236206,
-0.7060093879699707,
-0.6436663269996643,
-0.4699944853782654,
-1.0854878425598145,
-0.38514649868011475,
0.20487569272518158,
-0.7048233151435852,
0.6085413098335266,
0.3059912621974945,
-0.7745237946510315,
-0.260210543870925... |
func Unseal(rw io.ReadWriter, sealed []byte, srkAuth []byte) ([]byte, error) {
// Run OSAP for the SRK, reading a random OddOSAP for our initial
// command and getting back a secret and a handle.
sharedSecret, osapr, err := newOSAPSession(rw, etSRK, khSRK, srkAuth)
if err != nil {
return nil, err
}
defer osapr.... | [
-0.30641260743141174,
-0.06837792694568634,
0.751102864742279,
-0.2207886278629303,
-0.10286840051412582,
-0.3384179472923279,
0.6219484210014343,
0.12864327430725098,
0.4684530794620514,
-0.3041280210018158,
0.32573115825653076,
0.47777870297431946,
-0.14438189566135406,
0.100880518555641... |
func Quote(rw io.ReadWriter, handle tpmutil.Handle, data []byte, pcrNums []int, aikAuth []byte) ([]byte, []byte, error) {
// Run OSAP for the handle, reading a random OddOSAP for our initial
// command and getting back a secret and a response.
sharedSecret, osapr, err := newOSAPSession(rw, etKeyHandle, handle, aikAu... | [
-0.29703226685523987,
-0.8774773478507996,
0.7012875080108643,
-0.14319594204425812,
0.5157065987586975,
-0.48538702726364136,
-0.1635449081659317,
-0.6895232200622559,
0.5389823317527771,
-0.13112057745456696,
0.24726732075214386,
-0.16324102878570557,
-0.42481914162635803,
0.554220438003... |
func MakeIdentity(rw io.ReadWriter, srkAuth []byte, ownerAuth []byte, aikAuth []byte, pk crypto.PublicKey, label []byte) ([]byte, error) {
// Run OSAP for the SRK, reading a random OddOSAP for our initial command
// and getting back a secret and a handle.
sharedSecretSRK, osaprSRK, err := newOSAPSession(rw, etSRK, k... | [
-0.5557422041893005,
-0.2712010443210602,
0.7742499113082886,
0.2639693021774292,
0.965589165687561,
0.3751480281352997,
0.15188303589820862,
-0.13584086298942566,
0.5969892740249634,
0.3342337906360626,
0.040976740419864655,
-0.07009518146514893,
-0.38255271315574646,
-0.12457132339477539... |
func ActivateIdentity(rw io.ReadWriter, aikAuth []byte, ownerAuth []byte, aik tpmutil.Handle, asym, sym []byte) ([]byte, error) {
// Run OIAP for the AIK.
oiaprAIK, err := oiap(rw)
if err != nil {
return nil, fmt.Errorf("failed to start OIAP session: %v", err)
}
// Run OSAP for the owner, reading a random OddOS... | [
-1.0507614612579346,
-0.861824095249176,
0.7536724805831909,
0.29838335514068604,
1.6164829730987549,
-0.6293466091156006,
0.6234787702560425,
-0.3006470501422882,
0.7782905101776123,
-0.16410712897777557,
-0.2117326557636261,
0.277278870344162,
-0.20694424211978912,
-0.29037272930145264,
... |
func ResetLockValue(rw io.ReadWriter, ownerAuth Digest) error {
// Run OSAP for the Owner, reading a random OddOSAP for our initial command
// and getting back a secret and a handle.
sharedSecretOwn, osaprOwn, err := newOSAPSession(rw, etOwner, khOwner, ownerAuth[:])
if err != nil {
return err
}
defer osaprOwn.... | [
-0.578585684299469,
0.09538913518190384,
0.7596919536590576,
0.8072445392608643,
0.5661373734474182,
-0.16903622448444366,
0.37716931104660034,
0.19285812973976135,
0.6594103574752808,
-0.707404613494873,
0.5261865258216858,
1.0571767091751099,
-0.14902760088443756,
0.025002384558320045,
... |
func ownerReadInternalHelper(rw io.ReadWriter, kh tpmutil.Handle, ownerAuth Digest) (*pubKey, error) {
// Run OSAP for the Owner, reading a random OddOSAP for our initial command
// and getting back a secret and a handle.
sharedSecretOwn, osaprOwn, err := newOSAPSession(rw, etOwner, khOwner, ownerAuth[:])
if err !=... | [
0.03487391024827957,
-0.7125899791717529,
0.8301873207092285,
0.006962928455322981,
-0.09431186318397522,
0.280041366815567,
0.5478054285049438,
-0.010657480917870998,
0.664042592048645,
-0.5980641841888428,
1.1500513553619385,
0.08772154152393341,
-0.5076369643211365,
0.09478788077831268,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.