query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
ee60b147842cc762f5580ac8dec127cb
NewCustomWidgetStarted creates and starts the custom widget.
[ { "docid": "f14c69e3e5bffb90e3f0b492ae26c177", "score": "0.82575226", "text": "func NewCustomWidgetStarted() *CustomWidget {\n\tw := NewCustomWidget()\n\tgo w.Loop()\n\treturn w\n}", "title": "" } ]
[ { "docid": "ea6c5329fad7f77e35faa557bf8f3b6f", "score": "0.6549125", "text": "func NewCustomWidget() *CustomWidget {\n\tbox := &CustomWidget{\n\t\tBox: *gtknew.HBox(10),\n\t\tsw: gtk.NewSwitch(),\n\t\timg: gtk.NewImage(),\n\t\tlabelState: gtk.NewLabel(\"Custom Widget\"),\n\t\tlabelTime: gtk.NewLabel(\"\"),\n\t}\n\n\tbox.labelTime.SetHAlign(gtk.AlignEnd)\n\tbox.labelTime.SetHExpand(true)\n\n\tbox.sw.Connect(\"activate\", func() { fmt.Println(\"custom activate\", box.Active()) }) // signal \"activate\" doesn't seem to work\n\tbox.sw.Connect(\"state-set\", box.switchToggled)\n\tbox.SetActive(true)\n\n\t// Packing\n\tbox.Append(gtk.NewLabel(\"Custom Widget:\"))\n\tbox.Append(box.sw)\n\tbox.Append(box.img)\n\tbox.Append(box.labelState)\n\tbox.Append(box.labelTime)\n\treturn box\n}", "title": "" }, { "docid": "8b2025727dff08b6389304fe92179ba6", "score": "0.61573786", "text": "func NewCustomWidget(parent Container, style uint, paint PaintFunc) (*CustomWidget, error) {\n\tcw := &CustomWidget{paint: paint}\n\terr := cw.init(parent, style)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cw, nil\n}", "title": "" }, { "docid": "711cdd7424e6e4b282ac79eb1d22d5cf", "score": "0.51128006", "text": "func (win *Window) Custom(state nstyle.WidgetStates) (bounds rect.Rect, out *command.Buffer) {\n\tvar s bool\n\n\tif s, bounds, _ = win.widget(); !s {\n\t\treturn\n\t}\n\tprevstate := win.widgets.PrevState(bounds)\n\texitstate := basicWidgetStateControl(&prevstate, win.inputMaybe(s), bounds)\n\tif state != nstyle.WidgetStateActive {\n\t\tstate = exitstate\n\t}\n\twin.widgets.Add(state, bounds)\n\treturn bounds, &win.cmds\n}", "title": "" }, { "docid": "bebe3a8aa0accf9b77d107d2fa7aac8c", "score": "0.5086764", "text": "func StartCustom(image string, ports NamedPorts, opts ...Option) (*Container, error) {\n\tconfig, image := buildConfig(opts...), buildImage(image)\n\n\tg, err := newG(config.Debug)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't create new gnomock session: %w\", err)\n\t}\n\n\tdefer func() { _ = g.log.Sync() }()\n\n\tif config.CustomNamedPorts != nil {\n\t\tports = config.CustomNamedPorts\n\t}\n\n\tg.log.Infow(\"starting\", \"image\", image, \"ports\", ports)\n\tg.log.Infow(\"using config\", \"image\", image, \"ports\", ports, \"config\", config)\n\n\tc, err := newContainer(g, image, ports, config)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\tg.log.Infow(\"container is ready to use\", \"id\", c.ID, \"ports\", c.Ports)\n\n\treturn c, nil\n}", "title": "" }, { "docid": "7eaee69ccba4e8c5617cce9c1b9d7e89", "score": "0.5036888", "text": "func NewCustomInputWindow(introwords string, wid int, ht int, isValid validCheck, uiEvents <-chan ui.Event) (string, error) {\n\tif err := ui.Init(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to initialize termui: %v\", err)\n\t}\n\tdefer ui.Close()\n\n\tinput, _, err := processInput(introwords, 0, wid, ht, isValid, uiEvents)\n\n\treturn input, err\n}", "title": "" }, { "docid": "34057e2fb94fc7ee0f84d6a4959b4264", "score": "0.47221288", "text": "func New(args Options) *Widget {\n\tif args.Target == 0 {\n\t\targs.Target = 100\n\t}\n\tres := &Widget{\n\t\tCurrent: args.Current,\n\t\tDone: args.Target,\n\t\tnormal: args.Normal,\n\t\tcomplete: args.Complete,\n\t\tCallbacks: gowid.NewCallbacks(),\n\t}\n\tvar _ IWidget = res\n\treturn res\n}", "title": "" }, { "docid": "e1e26d73b6632f2fc9cb298965b05565", "score": "0.46516165", "text": "func NewCustomWidgetPixels(parent Container, style uint, paintPixels PaintFunc) (*CustomWidget, error) {\n\tcw := &CustomWidget{paintPixels: paintPixels}\n\terr := cw.init(parent, style)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cw, nil\n}", "title": "" }, { "docid": "9d993560f6d0e09acd84b7345a0fe0d4", "score": "0.46205786", "text": "func CreateInputWidget() *InputWidget {\n\tvar widgets []Widget\n\tfont, _ := truetype.Parse(assets.OpenSans(400))\n\n\treturn &InputWidget{\n\t\tbaseWidget: baseWidget{\n\n\t\t\tneedsRepaint: true,\n\t\t\twidgets: widgets,\n\n\t\t\twidgetType: inputWidget,\n\n\t\t\tcursor: glfw.CreateStandardCursor(glfw.IBeamCursor),\n\n\t\t\tbackgroundColor: \"#fff\",\n\n\t\t\tfont: font,\n\t\t},\n\n\t\tfontSize: 20,\n\t\tfontColor: \"#000\",\n\t}\n}", "title": "" }, { "docid": "87c6e2923b17728fbd7af7ed6ce0f79a", "score": "0.45257074", "text": "func newWidgets(ctx context.Context, cancel context.CancelFunc, c *container.Container) (*widgets, error) {\n\n\ttopList, err := newTopList(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogScroll, err := newLogScroll(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tserviceInfo, err := newServiceInfo(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsizePlot, err := newSizePlot(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlatencyPlot, err := newLatencyPlot(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttimePlot, err := newTimePlot(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &widgets{\n\t\ttopList: topList,\n\t\tlogScroll: logScroll,\n\t\tserviceInfo: serviceInfo,\n\t\tsizePlot: sizePlot,\n\t\tlatencyPlot: latencyPlot,\n\t\ttimePlot: timePlot,\n\t}, nil\n\n}", "title": "" }, { "docid": "3a1cf7294c68c93b88876b3827689d1c", "score": "0.43377364", "text": "func New(name string, initialState *k.State) *Widget {\n\treturn &Widget{\n\t\tName: name,\n\t\tState: initialState,\n\t}\n}", "title": "" }, { "docid": "6f2603110533bd518457b27cbfd9b4e2", "score": "0.43353352", "text": "func New(name, text string, centered bool, position Position, store *k.State) *Widget {\n\treturn &Widget{\n\t\tName: name,\n\t\tText: text,\n\t\tCentered: centered,\n\t\tPos: position,\n\t\tState: store,\n\t}\n}", "title": "" }, { "docid": "657f994e12b9f553476aa86d67da7b22", "score": "0.43073556", "text": "func InitCustomView(customView CustomView, tag string, session Session, params Params) bool {\n\tcustomView.setTag(tag)\n\tif view := customView.CreateSuperView(session); view != nil {\n\t\tcustomView.setSuperView(view)\n\t\tsetInitParams(customView, params)\n\t} else {\n\t\tErrorLog(`nil SuperView of \"` + tag + `\" view`)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "be92f20821011f0386551fc9f8caa478", "score": "0.42777434", "text": "func NewCustomLineItem(ctx *pulumi.Context,\n\tname string, args *CustomLineItemArgs, opts ...pulumi.ResourceOption) (*CustomLineItem, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.BillingGroupArn == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'BillingGroupArn'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource CustomLineItem\n\terr := ctx.RegisterResource(\"aws-native:billingconductor:CustomLineItem\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "149c376d8db78c648ce7c93c36bab703", "score": "0.41987726", "text": "func (self *TraitTooltip) SetCustom(custom_widget IsWidget) {\n\tvar __cgo__custom_widget *C.GtkWidget\n\tif custom_widget != nil {\n\t\t__cgo__custom_widget = custom_widget.GetWidgetPointer()\n\t}\n\tC.gtk_tooltip_set_custom(self.CPointer, __cgo__custom_widget)\n\treturn\n}", "title": "" }, { "docid": "c2eb749ee640ce9227d7a77b3266338b", "score": "0.41506264", "text": "func NewCustomTimer(h Histogram, m Meter) Timer {\n\treturn &timer{h, m}\n}", "title": "" }, { "docid": "c0409fc05f3203864233b53df8cf85ec", "score": "0.4150573", "text": "func (client *ClientImpl) CreateWidget(ctx context.Context, args CreateWidgetArgs) (*Widget, error) {\n\tif args.Widget == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.Widget\"}\n\t}\n\trouteValues := make(map[string]string)\n\tif args.Project == nil || *args.Project == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.Project\"}\n\t}\n\trouteValues[\"project\"] = *args.Project\n\tif args.Team != nil && *args.Team != \"\" {\n\t\trouteValues[\"team\"] = *args.Team\n\t}\n\tif args.DashboardId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.DashboardId\"}\n\t}\n\trouteValues[\"dashboardId\"] = (*args.DashboardId).String()\n\n\tbody, marshalErr := json.Marshal(*args.Widget)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"bdcff53a-8355-4172-a00a-40497ea23afc\")\n\tresp, err := client.Client.Send(ctx, http.MethodPost, locationId, \"7.1-preview.2\", routeValues, nil, bytes.NewReader(body), \"application/json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue Widget\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "59eefa3ab4f6d324b1bda38705d5dd5f", "score": "0.4081347", "text": "func NewCustomTimer(h Histogram, m Meter) *StandardTimer {\n\treturn &StandardTimer{h, m}\n}", "title": "" }, { "docid": "11e6430a3731de03fdd2a1af70a386c5", "score": "0.40775988", "text": "func NewCustomImage(ctx *pulumi.Context,\n\tname string, args *CustomImageArgs, opts ...pulumi.ResourceOption) (*CustomImage, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.CustomImageName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'CustomImageName'\")\n\t}\n\tif args.InstanceId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InstanceId'\")\n\t}\n\tif args.SystemSnapshotId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'SystemSnapshotId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource CustomImage\n\terr := ctx.RegisterResource(\"alicloud:simpleapplicationserver/customImage:CustomImage\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "dd31b4f37fc7fd671fe06fa4ec5f5d8b", "score": "0.40542167", "text": "func New(group *[]IWidget) *Widget {\n\tres := &Widget{\n\t\tSelected: false,\n\t\tgroup: group,\n\t\tDecoration: checkbox.Decoration{button.Decoration{\"(\", \")\"}, \"X\"},\n\t}\n\tres.ClickCallbacks = gowid.ClickCallbacks{CB: &res.Callbacks}\n\tres.initRadioButton(group)\n\n\tvar _ IWidget = res\n\n\treturn res\n}", "title": "" }, { "docid": "aebf39cfebd029ae9fd008d30c25b9cc", "score": "0.40532246", "text": "func NewCustomService(ctx *pulumi.Context,\n\tname string, args *CustomServiceArgs, opts ...pulumi.ResourceOption) (*CustomService, error) {\n\tif args == nil {\n\t\targs = &CustomServiceArgs{}\n\t}\n\tvar resource CustomService\n\terr := ctx.RegisterResource(\"gcp:monitoring/customService:CustomService\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "d1bdcf784c31207d6383fc472b8e95fb", "score": "0.40248993", "text": "func NewCustom(id discord.WebhookID, token string, hcl *httputil.Client) *Client {\n\tses := Session{\n\t\tLimiter: rate.NewLimiter(api.Path),\n\t\tID: id,\n\t\tToken: token,\n\t}\n\n\thcl = hcl.Copy()\n\thcl.OnRequest = append(hcl.OnRequest, ses.OnRequest)\n\thcl.OnResponse = append(hcl.OnResponse, ses.OnResponse)\n\n\treturn &Client{\n\t\tClient: hcl,\n\t\tSession: &ses,\n\t}\n}", "title": "" }, { "docid": "2dc6b266b27b1409b601ec93a4a44d71", "score": "0.40225706", "text": "func (PluginBase) Started(engine.Sandbox) error {\n\treturn nil\n}", "title": "" }, { "docid": "1bb0157f97f5c6c982ddfe3f6f69ffcc", "score": "0.40178367", "text": "func Start(app cli.App, cfg Config) {\n\tif cfg.Cursor == nil {\n\t\tcfg.Cursor = NewOSCursor()\n\t}\n\tif cfg.WidthRatio == nil {\n\t\tcfg.WidthRatio = func() [3]int { return [3]int{1, 3, 4} }\n\t}\n\n\tvar w *widget\n\tw = &widget{\n\t\tConfig: cfg,\n\t\tapp: app,\n\t\tcodeArea: cli.NewCodeArea(cli.CodeAreaSpec{\n\t\t\tPrompt: func() ui.Text {\n\t\t\t\tif w.CopyState().ShowHidden {\n\t\t\t\t\treturn cli.ModeLine(\" NAVIGATING (show hidden) \", true)\n\t\t\t\t} else {\n\t\t\t\t\treturn cli.ModeLine(\" NAVIGATING \", true)\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t\tcolView: cli.NewColView(cli.ColViewSpec{\n\t\t\tOverlayHandler: cfg.Binding,\n\t\t\tWeights: func(int) []int {\n\t\t\t\ta := cfg.WidthRatio()\n\t\t\t\treturn a[:]\n\t\t\t},\n\t\t\tOnLeft: func(cli.ColView) { w.ascend() },\n\t\t\tOnRight: func(cli.ColView) { w.descend() },\n\t\t}),\n\t}\n\tupdateState(w, \"\")\n\tapp.MutateState(func(s *cli.State) { s.Addon = w })\n\tapp.Redraw()\n}", "title": "" }, { "docid": "f3fc0d3ca576dcec427635e70585c69a", "score": "0.40078747", "text": "func startCreateCallback(scope *Scope) {\n\tscope.Operation = OpCreate\n}", "title": "" }, { "docid": "9db3693a20d8e83bb8bb8edc3988a1cc", "score": "0.4004281", "text": "func NewItemWidget(x, y, w, h int, hideGuids bool, shouldRender bool, content string, filterHandler func(s string) error) *ItemWidget {\n\tconfigureYAMLHighlighting()\n\n\treturn &ItemWidget{\n\t\tx: x, y: y, w: w, h: h,\n\t\thideGuids: hideGuids,\n\t\tshouldRender: shouldRender,\n\t\tcontent: content,\n\t\tfilterHandler: filterHandler,\n\t}\n}", "title": "" }, { "docid": "c4ade58b6c1d3755066886f2b56bb7af", "score": "0.39848232", "text": "func (w *CustomWidget) SetActive(active bool) { w.sw.SetActive(active) }", "title": "" }, { "docid": "b1cbeda02d1138a7bf9e2188cb3f4e39", "score": "0.39720592", "text": "func ShowCustom(title, dismiss string, content fyne.CanvasObject, parent fyne.Window) {\n\td := &skydialog{content: content, title: title, icon: nil, parent: parent}\n\td.response = make(chan bool, 1)\n\n\td.dismiss = &widget.Button{Text: dismiss,\n\t\tOnTapped: func() {\n\t\t\td.response <- false\n\t\t},\n\t}\n\td.setButtons(widget.NewHBox(layout.NewSpacer(), d.dismiss, layout.NewSpacer()))\n\td.Show()\n}", "title": "" }, { "docid": "1856ffa5a645f9ae7bf170311fcf7b49", "score": "0.3962966", "text": "func (v *HeaderBar) PackStart(child IWidget) {\n\tC.gtk_header_bar_pack_start(v.native(), child.toWidget())\n}", "title": "" }, { "docid": "39da087f77dac4087a5ac4983facf8bf", "score": "0.39587912", "text": "func (v *HeaderBar) PackStart(child IWidget) {\n\tC.gtk_header_bar_pack_start(v.Native(), child.toWidget())\n}", "title": "" }, { "docid": "78617317adc06ae34e09a6ec2cfa1ba3", "score": "0.39532003", "text": "func (self *TraitWidget) RegisterWindow(window *C.GdkWindow) {\n\tC.gtk_widget_register_window(self.CPointer, window)\n\treturn\n}", "title": "" }, { "docid": "6c38f5016cad8121f845bd37985305de", "score": "0.39506575", "text": "func NewMainWidget(epnStatus *epn.Status, eventsHub *EventsHub) *MainWidget {\n\n\ttermWidth, termHeight := ui.TerminalDimensions()\n\theaderHeight := 3\n\n\tmain := &MainWidget{\n\t\tBlock: ui.NewBlock(),\n\t\theader: NewHeaderWidget(termWidth, headerHeight),\n\t\tnodesGrid: NewNodesGridWidget(termWidth, termHeight, headerHeight, epnStatus, eventsHub),\n\t\teventsCh: eventsHub.Subscribe(),\n\t}\n\n\tmain.Border = false\n\n\tgo main.controller()\n\n\treturn main\n}", "title": "" }, { "docid": "59276a300d52b3cb124d18ce11e9b87f", "score": "0.3947653", "text": "func (widgets *Widgets) RegisterWidget(w *Widget) {\n\tregisteredWidgets = append(registeredWidgets, w)\n}", "title": "" }, { "docid": "79ee4f4c7bf78d9f33f4a4b58c61ed9d", "score": "0.3946363", "text": "func NewCustomStage(name StageName, runner stageRunner) *stage {\n\treturn &stage{\n\t\tName: name,\n\t\trunner: runner,\n\t}\n}", "title": "" }, { "docid": "776a114f439271d6d3847394248b73ea", "score": "0.39412877", "text": "func (p *progressBarManager) newHeadlineBar(headline string) {\n\tp.barsWg.Add(1)\n\tp.headlineBar = p.container.AddSpinner(1, mpb.SpinnerOnLeft,\n\t\tmpb.SpinnerStyle([]string{\"-\", \"-\", \"\\\\\", \"\\\\\", \"|\", \"|\", \"/\", \"/\"}),\n\t\tmpb.BarRemoveOnComplete(),\n\t\tmpb.PrependDecorators(\n\t\t\tdecor.Name(headline),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "d6fe7b37d621cfc0898c924f639a6a4f", "score": "0.3914744", "text": "func RegisterWidget(source docker.SourceType, w termui.Widget) {\n\tlast := time.Now()\n\tdocker.GlobalRegistry.Register(\n\t\tsource,\n\t\tfunc(ctx context.Context, message events.Message) error {\n\t\t\tif time.Since(last) > timeBetweenRefresh {\n\t\t\t\tlast = time.Now()\n\n\t\t\t\treturn w.Unmount()\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n}", "title": "" }, { "docid": "5ca097b5c8d6d77a02ae0b96facd9ffe", "score": "0.39046344", "text": "func NewCustomImage(ctx *pulumi.Context,\n\tname string, args *CustomImageArgs, opts ...pulumi.ResourceOption) (*CustomImage, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.LabName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'LabName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab/v20180915:CustomImage\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:devtestlab:CustomImage\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab:CustomImage\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:devtestlab/v20150521preview:CustomImage\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab/v20150521preview:CustomImage\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:devtestlab/v20160515:CustomImage\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab/v20160515:CustomImage\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource CustomImage\n\terr := ctx.RegisterResource(\"azure-native:devtestlab/v20180915:CustomImage\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "a63b6c8958162c6ab9343de2e27d83b5", "score": "0.3894526", "text": "func NewCustomClient(accessKeyId, accessKeySecret string, endpoint string) *Client {\n\tclient := &Client{}\n\tclient.Init(endpoint, DNSAPIVersion, accessKeyId, accessKeySecret)\n\treturn client\n}", "title": "" }, { "docid": "ce07da3a10fff68231c0cb14a42286a9", "score": "0.3885235", "text": "func (f *FakeFactory) CreateCustomJenkinsClient(kubeClient kubernetes.Interface, ns string, jenkinsServiceName string, handles util.IOFileHandles) (gojenkins.JenkinsClient, error) {\n\treturn f.GetDelegateFactory().CreateCustomJenkinsClient(kubeClient, ns, jenkinsServiceName, handles)\n}", "title": "" }, { "docid": "6f06f18f6910a40f1698df2f2a0a9896", "score": "0.38845223", "text": "func NewCustomDateTime(value string) (CustomDateTime, error) {\n\td, err := time.Parse(CustomDateTimeFormat, value)\n\treturn CustomDateTime(d), err\n}", "title": "" }, { "docid": "84f1a516ca7b3a13c01fb3224aad6c1d", "score": "0.38606295", "text": "func (l *Loading) Construct() {\n\twidget := widgets.NewParagraph()\n\twidget.Text = `\n\t ____\n / ___| ___ ___ ___ _ __ ___ _ __ __ _\n\t| | _ / _ \\ / __/ _ \\| '__/ _ \\| '_ \\ / _' |\n\t| |_| | (_) | (_| (_) | | | (_) | | | | (_| |\n\t \\____|\\___/ \\___\\___/|_| \\___/|_| |_|\\__,_|\n\n [Gocorona](fg:black,bg:yellow) by Ayooluwa Isaiah\n\n Worldwide COVID-19 tracker for your terminal\n\t`\n\twidget.SetRect(0, 0, 100, 50)\n\twidget.Border = false\n\twidget.TextStyle = ui.NewStyle(ui.ColorClear)\n\n\tl.Widget = widget\n}", "title": "" }, { "docid": "62a0c5b2d0bcffeee840de0aaba21452", "score": "0.3859099", "text": "func CreateCustom(ums UnmarshalStr) *Loader {\n\treturn &Loader{ums}\n}", "title": "" }, { "docid": "2dda85b21a526d4c60f485cfc40f69a4", "score": "0.38203034", "text": "func createCustomMetric(projectID, metricType string) error {\n\tctx := context.Background()\n\tc, err := monitoring.NewMetricClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmd := &metric.MetricDescriptor{\n\t\tName: \"Custom Metric\",\n\t\tType: metricType,\n\t\tLabels: []*label.LabelDescriptor{{\n\t\t\tKey: \"environment\",\n\t\t\tValueType: label.LabelDescriptor_STRING,\n\t\t\tDescription: \"An arbitrary measurement\",\n\t\t}},\n\t\tMetricKind: metric.MetricDescriptor_GAUGE,\n\t\tValueType: metric.MetricDescriptor_INT64,\n\t\tUnit: \"s\",\n\t\tDescription: \"An arbitrary measurement\",\n\t\tDisplayName: \"Custom Metric\",\n\t}\n\treq := &monitoringpb.CreateMetricDescriptorRequest{\n\t\tName: \"projects/\" + projectID,\n\t\tMetricDescriptor: md,\n\t}\n\tresp, err := c.CreateMetricDescriptor(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not create custom metric: %v\", err)\n\t}\n\n\tlog.Printf(\"createCustomMetric: %s\\n\", formatResource(resp))\n\treturn nil\n}", "title": "" }, { "docid": "7fe096c362fb4981a31b21bca6f81235", "score": "0.38160288", "text": "func NewCommandWidget(bw *BaseWidget, opts WidgetConfig) *CommandWidget {\n\tbw.setInterval(time.Duration(opts.Interval)*time.Millisecond, time.Second)\n\n\tvar commands, fonts, frameReps []string\n\t_ = ConfigValue(opts.Config[\"command\"], &commands)\n\t_ = ConfigValue(opts.Config[\"font\"], &fonts)\n\t_ = ConfigValue(opts.Config[\"layout\"], &frameReps)\n\tvar colors []color.Color\n\t_ = ConfigValue(opts.Config[\"color\"], &colors)\n\n\tlayout := NewLayout(int(bw.dev.Pixels))\n\tframes := layout.FormatLayout(frameReps, len(commands))\n\n\tfor i := 0; i < len(commands); i++ {\n\t\tif len(fonts) < i+1 {\n\t\t\tfonts = append(fonts, \"regular\")\n\t\t}\n\t\tif len(colors) < i+1 {\n\t\t\tcolors = append(colors, DefaultColor)\n\t\t}\n\t}\n\n\treturn &CommandWidget{\n\t\tBaseWidget: bw,\n\t\tcommands: commands,\n\t\tfonts: fonts,\n\t\tframes: frames,\n\t\tcolors: colors,\n\t}\n}", "title": "" }, { "docid": "c470e33e3a6cd4f97949d1df39297d48", "score": "0.38121098", "text": "func (w *CustomWidget) Active() bool { return w.sw.Active() }", "title": "" }, { "docid": "92c13340cc8c6cf9d6d28c4407c71673", "score": "0.3811085", "text": "func NewCustomClient(conf *sarama.Config, brokerList ...string) (*KClient, error) {\n\tvar client sarama.Client\n\tswitch {\n\tcase conf == nil:\n\t\tvar err error\n\t\tclient, err = getClient(conf, brokerList...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\terr := conf.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclient, err = getClient(conf, brokerList...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tkc := KClient{\n\t\tcl: client,\n\t\tconfig: conf,\n\t\tbrokers: client.Brokers(),\n\t\tlogger: logger,\n\t}\n\tkc.Connect()\n\treturn &kc, nil\n}", "title": "" }, { "docid": "9d94c75ded67792cd9a5f8f34d982382", "score": "0.38054043", "text": "func NewLogsCustomPipeline(ctx *pulumi.Context,\n\tname string, args *LogsCustomPipelineArgs, opts ...pulumi.ResourceOption) (*LogsCustomPipeline, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Filters == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Filters'\")\n\t}\n\tif args.Name == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Name'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource LogsCustomPipeline\n\terr := ctx.RegisterResource(\"datadog:index/logsCustomPipeline:LogsCustomPipeline\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "3a86adda53232bff56954b383ffa9e1c", "score": "0.37966418", "text": "func NewCustom(config jsoniter.Config) parsers.JSONParser {\n\treturn &Parser{config.Froze()}\n}", "title": "" }, { "docid": "02b3bf4d424d5e1034aac04c20c833a2", "score": "0.37781125", "text": "func NewCustomDomain(ctx *pulumi.Context,\n\tname string, args *CustomDomainArgs, opts ...pulumi.ResourceOption) (*CustomDomain, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ApiManagementId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ApiManagementId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource CustomDomain\n\terr := ctx.RegisterResource(\"azure:apimanagement/customDomain:CustomDomain\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "bed1097652a30ee3fc7e874f7ae82b79", "score": "0.37736765", "text": "func (driver *Driver) Start() {\n\tdriver.window.Add(driver.view)\n\tdriver.window.ShowAll()\n\tgtk.Main()\n}", "title": "" }, { "docid": "cb9ed6d1a03e904af5ea10b73e748720", "score": "0.37676245", "text": "func (s *Split) ExtendBaseWidget(wid fyne.Widget) {\n\ts.BaseWidget.ExtendBaseWidget(wid)\n}", "title": "" }, { "docid": "88390432c9a1e90c447462a1644645ec", "score": "0.37667635", "text": "func createCustomMetric(ctx context.Context, mc *monitoring.MetricClient, w io.Writer, name, metricType, description string) (*metricpb.MetricDescriptor, error) {\n\tmd := &metric.MetricDescriptor{\n\t\tName: name,\n\t\tDisplayName: name,\n\t\tType: metricType,\n\t\tLabels: []*label.LabelDescriptor{{\n\t\t\tKey: \"environment\",\n\t\t\tValueType: label.LabelDescriptor_STRING,\n\t\t\tDescription: \"The environment of the reported metric\",\n\t\t}},\n\t\tMetricKind: metric.MetricDescriptor_GAUGE,\n\t\tValueType: metric.MetricDescriptor_INT64,\n\t\tUnit: \"1\",\n\t\tDescription: description,\n\t}\n\treq := &monitoringpb.CreateMetricDescriptorRequest{\n\t\tName: \"projects/\" + projectID,\n\t\tMetricDescriptor: md,\n\t}\n\tm, err := mc.CreateMetricDescriptor(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create custom metric: %v\", err)\n\t}\n\n\t_, _ = fmt.Fprintf(w, \"Created %s custom metric\\n\", m.GetName())\n\treturn m, nil\n}", "title": "" }, { "docid": "6c643954a3be91627074874568de5b71", "score": "0.3766293", "text": "func newCustomClient(telemetryFilePath string, segmentEndpoint string) (*Client, error) {\n\t// get the locale information\n\ttag, err := locale.Detect()\n\tif err != nil {\n\t\tklog.V(4).Infof(\"couldn't fetch locale info: %s\", err.Error())\n\t}\n\t// DefaultContext has IP set to 0.0.0.0 so that it does not track user's IP, which it does in case no IP is set\n\tclient, err := analytics.NewWithConfig(writeKey, analytics.Config{\n\t\tEndpoint: segmentEndpoint,\n\t\tVerbose: true,\n\t\tDefaultContext: &analytics.Context{\n\t\t\tIP: net.IPv4(0, 0, 0, 0),\n\t\t\tTimezone: getTimeZoneRelativeToUTC(),\n\t\t\tOS: analytics.OSInfo{\n\t\t\t\tName: runtime.GOOS,\n\t\t\t},\n\t\t\tLocale: tag.String(),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tSegmentClient: client,\n\t\tTelemetryFilePath: telemetryFilePath,\n\t}, nil\n}", "title": "" }, { "docid": "e21e7c7ed186b2048cab215d6a17824b", "score": "0.3759504", "text": "func newWidgetB(wi WidgetInfo) *WidgetB {\n\tw := &WidgetB{}\n\tw.WidgetInfo = wi\n\tw.m = make(map[interface{}]struct{})\n\tvar _ Widget_iface = w // Enforce interface compliance\n\treturn w\n}", "title": "" }, { "docid": "ed9baa7cc78a2a5aedbc595877ab13b7", "score": "0.37485376", "text": "func NewImportLookmlDashboardCreated() *ImportLookmlDashboardCreated {\n\treturn &ImportLookmlDashboardCreated{}\n}", "title": "" }, { "docid": "d7d2f963c520579754c388863d8c90c7", "score": "0.37383687", "text": "func (win *Window) CustomState() nstyle.WidgetStates {\n\tbounds := win.WidgetBounds()\n\ts := true\n\tif !win.layout.Clip.Intersect(&bounds) {\n\t\ts = false\n\t}\n\n\tws := win.widgets.PrevState(bounds)\n\tbasicWidgetStateControl(&ws, win.inputMaybe(s), bounds)\n\treturn ws\n}", "title": "" }, { "docid": "53697e07fc99c24be4300f9a8dc0d834", "score": "0.3734523", "text": "func CustomShowHome(w http.ResponseWriter, r *http.Request) {\n\t// do something interesting here, and then render the template\n\thelpers.Render(w, r, \"client-sample.page.tmpl\", &templates.TemplateData{})\n}", "title": "" }, { "docid": "54c99ad355a57f4e490ec9833b902db3", "score": "0.37307024", "text": "func (d *Dota2) SendCustomGameListenServerStartedLoading(\n\tlobbyID uint64,\n\tcustomGameID uint64,\n\tlobbyMembers []uint32,\n\tstartTime uint32,\n) {\n\treq := &protocol.CMsgDOTACustomGameListenServerStartedLoading{\n\t\tLobbyId: &lobbyID,\n\t\tCustomGameId: &customGameID,\n\t\tLobbyMembers: lobbyMembers,\n\t\tStartTime: &startTime,\n\t}\n\td.write(uint32(protocol.EDOTAGCMsg_k_EMsgCustomGameListenServerStartedLoading), req)\n}", "title": "" }, { "docid": "d93a1dd4c1d4fc6e1ed36df1ea83a560", "score": "0.37243462", "text": "func NewCfnCustomResource(scope Construct, id *string, props *CfnCustomResourceProps) CfnCustomResource {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnCustomResource{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.CfnCustomResource\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "978e917568150974e1396e4cdcaea7aa", "score": "0.37142596", "text": "func NewOnTokenIssuanceStartCustomExtension()(*OnTokenIssuanceStartCustomExtension) {\n m := &OnTokenIssuanceStartCustomExtension{\n CustomAuthenticationExtension: *NewCustomAuthenticationExtension(),\n }\n odataTypeValue := \"#microsoft.graph.onTokenIssuanceStartCustomExtension\"\n m.SetOdataType(&odataTypeValue)\n return m\n}", "title": "" }, { "docid": "9c6a8bf043a5f855005cb557190e1787", "score": "0.37045845", "text": "func NewCustomClient(cfg Config) *Client {\n\tif cfg.PollInterval < 1 {\n\t\tcfg.PollInterval = DefaultPollInterval\n\t}\n\tlogger := newLeveledLogger(cfg.Logger, cfg.Hooks)\n\tif cfg.FlagOverrides != nil {\n\t\tcfg.FlagOverrides.loadEntries(logger)\n\t}\n\tclient := &Client{\n\t\tcfg: cfg,\n\t\tlogger: logger,\n\t\tfetcher: newConfigFetcher(cfg, logger, cfg.DefaultUser),\n\t\tneedGetCheck: cfg.PollingMode == Lazy || cfg.PollingMode == AutoPoll && !cfg.NoWaitForRefresh,\n\t\tdefaultUser: cfg.DefaultUser,\n\t}\n\n\tif cfg.PollingMode == Lazy || cfg.PollingMode == Manual {\n\t\tclient.ready = make(chan struct{})\n\t\tclose(client.ready)\n\t} else {\n\t\tclient.ready = client.fetcher.doneInitialGet\n\t}\n\n\treturn client\n}", "title": "" }, { "docid": "e8c819f9277c9d6533053480a8eac624", "score": "0.3701466", "text": "func (d *WindowDelegate) OnWindowCreated(window *Window) {\n\tlookupWindowDelegateProxy(d.Base().Base.Base()).OnWindowCreated(d, window)\n}", "title": "" }, { "docid": "743e40620d9f5a243a72230089c1d826", "score": "0.37000045", "text": "func GenerateContainerWithCustomPkgName(provider Provider, outputDirectory, pkgName string) error {\n\tscan, err := scanDefs(provider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn writeScan(scan, outputDirectory, pkgName)\n}", "title": "" }, { "docid": "fbc86fc8e569f1062fcad716ac259ea8", "score": "0.36984876", "text": "func newButton() gtk.Widgetter {\n\tw := gtk.NewButtonWithLabel(\"Button\")\n\tw.Connect(\"clicked\", callPrint(\"button 1 clicked\"))\n\n\tx := gtk.NewButtonFromIconName(\"preferences-system\")\n\tx.Connect(\"clicked\", callPrint(\"button 2 clicked\"))\n\treturn gtknew.VBox(boxMargin, w, x)\n}", "title": "" }, { "docid": "4ebaaddb42dff821129f3c0317efb755", "score": "0.36890864", "text": "func (s *BaseTSqlParserListener) EnterCreate_external_library(ctx *Create_external_libraryContext) {}", "title": "" }, { "docid": "1fee613d87655e35b2fa00367ade425e", "score": "0.3688192", "text": "func NewTextWidget(title, content string) *tview.TextView {\n\ttxt := tview.NewTextView()\n\ttxt.SetScrollable(true).\n\t\tSetWrap(true).\n\t\tSetText(content).\n\t\tSetTitle(title).\n\t\tSetBorder(true)\n\n\treturn txt\n}", "title": "" }, { "docid": "a9ca439a196218903ddd5174654b7222", "score": "0.3684259", "text": "func (self *TraitAppChooserButton) AppendCustomItem(name string, label string, icon *C.GIcon) {\n\t__cgo__name := (*C.gchar)(unsafe.Pointer(C.CString(name)))\n\t__cgo__label := (*C.gchar)(unsafe.Pointer(C.CString(label)))\n\tC.gtk_app_chooser_button_append_custom_item(self.CPointer, __cgo__name, __cgo__label, icon)\n\tC.free(unsafe.Pointer(__cgo__name))\n\tC.free(unsafe.Pointer(__cgo__label))\n\treturn\n}", "title": "" }, { "docid": "3e10174d342425fa831bfbe71f2db72d", "score": "0.36760858", "text": "func NewBuiltIn(eb core.MessageBus, am core.ArtifactManager) *BuiltIn {\n\tbi := BuiltIn{\n\t\tAM: am,\n\t\tEB: eb,\n\t\tRegistry: make(map[string]Contract),\n\t}\n\n\tbi.Registry[\"helloworld\"] = helloworld.NewHelloWorld()\n\n\treturn &bi\n}", "title": "" }, { "docid": "1922f60257182f62e1bfd0ee3cce4bf7", "score": "0.36711547", "text": "func NewCustomClient(aeClient apiextensionscli.Interface, time wraptime.Time, logger log.Logger) *Client {\n\treturn &Client{\n\t\taeClient: aeClient,\n\t\tlogger: logger,\n\t\ttime: time,\n\t}\n}", "title": "" }, { "docid": "ae95bd259f6652098820448382168a1e", "score": "0.36675233", "text": "func (o *Orchestrator) StartNewNode() (string, error) {\n\tif o.NodeLauncher == nil {\n\t\treturn \"\", ErrNoNodeLauncher\n\t}\n\n\treturn o.NodeLauncher.LaunchNewNode()\n}", "title": "" }, { "docid": "898ad49bdde9a5266b24b0712b4104d8", "score": "0.36660007", "text": "func init() {\n\tgo func() {\n\t\tw := GetNewWindow(Do, \"Hello\", 320, 240)\n\t\tdone := make(chan struct{})\n\t\tWait(Do, w.OnClosing(func(c Doer) bool {\n\t\t\tStop()\n\t\t\tdone <- struct{}{}\n\t\t\treturn true\n\t\t}))\n\t\tWait(Do, w.Show())\n\t\t<-done\n\t}()\n\terr := Go()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "251f4db10806a62972d33aeed2fc9e20", "score": "0.36515415", "text": "func (c *Converter) CreateUploadStartedJSON(prNum int, sha string) error {\n\tlog.Printf(\"Generating started.json\")\n\tstr, err := c.GenerateStartedJSON(prNum, sha)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgcsPath := filepath.Join(c.gcsPathPrefix, startedJSON)\n\tlog.Printf(\"Uploading started.json to gs://%s/%s\", c.bucket, gcsPath)\n\treturn c.gcsClient.Write(gcsPath, str)\n}", "title": "" }, { "docid": "b87cd1dcacb4120b581b3ab1d8646cd1", "score": "0.3650201", "text": "func (c *Catalog) BuildWithCustomAnnotationAndFinalizer(\n\tname string,\n\tns string,\n\tstrategyName string,\n\ta map[string]string,\n\tf []string,\n) *build.Build {\n\treturn &build.Build{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: ns,\n\t\t\tAnnotations: a,\n\t\t\tFinalizers: f,\n\t\t},\n\t\tSpec: build.BuildSpec{\n\t\t\tSource: build.GitSource{\n\t\t\t\tURL: \"foobar\",\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9d0bd111906788d8a3f4245edadb60cb", "score": "0.3645744", "text": "func NewCustomSignature(pin, tan string) *CustomSignatureDataElement {\n\tp := &PinTanDataElement{\n\t\tPIN: NewAlphaNumeric(pin, 99),\n\t}\n\tif tan != \"\" {\n\t\tp.TAN = NewAlphaNumeric(tan, 99)\n\t}\n\tp.DataElement = NewDataElementGroup(pinTanDEG, 2, p)\n\tcust := &CustomSignatureDataElement{\n\t\tPinTanDataElement: p,\n\t}\n\treturn cust\n}", "title": "" }, { "docid": "4f118a3c90ef43062b51c8e4ce4e433a", "score": "0.36363095", "text": "func (self *TraitInfoBar) AddActionWidget(child IsWidget, response_id int) {\n\tC.gtk_info_bar_add_action_widget(self.CPointer, child.GetWidgetPointer(), C.gint(response_id))\n\treturn\n}", "title": "" }, { "docid": "90e6bd6ca84b4fff5b3d909feb05245f", "score": "0.3631848", "text": "func (self *TraitSpinner) Start() {\n\tC.gtk_spinner_start(self.CPointer)\n\treturn\n}", "title": "" }, { "docid": "cc347355a77d09102260394e43989c4d", "score": "0.36279157", "text": "func addInitCustomizations(projectName string, componentConfig bool) error {\n\tmanagerFile := filepath.Join(\"config\", \"manager\", \"manager.yaml\")\n\n\t// todo: we ought to use afero instead. Replace this methods to insert/update\n\t// by https://github.com/kubernetes-sigs/kubebuilder/pull/2119\n\n\t// Add leader election arg in config/manager/manager.yaml and in config/default/manager_auth_proxy_patch.yaml\n\tif componentConfig {\n\t\terr := util.InsertCode(managerFile,\n\t\t\t\"- /manager\",\n\t\t\tfmt.Sprintf(\"\\n args:\\n - --leader-election-id=%s\", projectName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = util.InsertCode(filepath.Join(\"config\", \"default\", \"manager_auth_proxy_patch.yaml\"),\n\t\t\t\"memory: 64Mi\",\n\t\t\tfmt.Sprintf(\"\\n - name: manager\\n args:\\n - \\\"--leader-election-id=%s\\\"\", projectName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Remove the webhook option for the componentConfig since webhooks are not supported by helm\n\t\terr = util.ReplaceInFile(filepath.Join(\"config\", \"manager\", \"controller_manager_config.yaml\"),\n\t\t\t\"webhook:\\n port: 9443\", \"\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\terr := util.InsertCode(managerFile,\n\t\t\t\"--leader-elect\",\n\t\t\tfmt.Sprintf(\"\\n - --leader-election-id=%s\", projectName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = util.InsertCode(filepath.Join(\"config\", \"default\", \"manager_auth_proxy_patch.yaml\"),\n\t\t\t\"- \\\"--leader-elect\\\"\",\n\t\t\tfmt.Sprintf(\"\\n - \\\"--leader-election-id=%s\\\"\", projectName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Remove the call to the command as manager. Helm has not been exposing this entrypoint\n\t// todo: provide the manager entrypoint for helm and then remove it\n\tconst command = `command:\n - /manager\n `\n\terr := util.ReplaceInFile(managerFile, command, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := sdkpluginutil.UpdateKustomizationsInit(); err != nil {\n\t\treturn fmt.Errorf(\"error updating kustomization.yaml files: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "44fae6a934869e83387660e38767c7df", "score": "0.36219668", "text": "func newCustomClient(preference *preference.PreferenceInfo, telemetryFilePath string, segmentEndpoint string) (*Client, error) {\n\t// DefaultContext has IP set to 0.0.0.0 so that it does not track user's IP, which it does in case no IP is set\n\tclient, err := analytics.NewWithConfig(writeKey, analytics.Config{\n\t\tEndpoint: segmentEndpoint,\n\t\tDefaultContext: &analytics.Context{\n\t\t\tIP: net.IPv4(0, 0, 0, 0),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tSegmentClient: client,\n\t\tPreference: preference,\n\t\tTelemetryFilePath: telemetryFilePath,\n\t}, nil\n}", "title": "" }, { "docid": "9e25fbeafb4262dfbd531a2c62c21267", "score": "0.36053905", "text": "func (b *BulletWidget) Build() {\n\timgui.Bullet()\n}", "title": "" }, { "docid": "30165faf39fb55fa692329ed4b6d848f", "score": "0.3599468", "text": "func NewStatusbarWidget(apiClient *api.Client, filter api.Filter, pause bool, sortorder api.Sort, viewType ViewType, termWidth, termHeight int) *StatusbarWidget {\n\tbar := ui.NewBlock()\n\tbar.Border = false\n\n\tbar.SetRect(0, termHeight-1, termWidth, termHeight)\n\n\treturn &StatusbarWidget{\n\t\tbar,\n\n\t\tapiClient,\n\t\tfilter,\n\t\tpause,\n\t\tsortorder,\n\t\tviewType,\n\t}\n}", "title": "" }, { "docid": "3e9dc7d288c3004a6f9eb9a1f41d7a6b", "score": "0.35990742", "text": "func (ui *PicoUi) NewPage(title string, prevText string, onPrevClick clickHandler) *Page {\n\tpage := newPage(ui, title, prevText, onPrevClick)\n\tui.handlers.newPage(\"ui\", title, page)\n\tpage.pagePost()\n\treturn page\n}", "title": "" }, { "docid": "0ffacabfcd5b69d40310f2bcb973015c", "score": "0.35892826", "text": "func (self *CustomAttrsPlugin) Run() {\n\tself.Context.AddReconnecting(self)\n\n\tdata := agent.PluginInventoryDataset{CustomAttrs(self.customAttributes)}\n\tentityKey := self.Context.EntityKey()\n\n\ttrace.Attr(\"run, entity: %s, data: %+v\", entityKey, self.customAttributes)\n\n\tself.EmitInventory(data, entity.NewFromNameWithoutID(entityKey))\n}", "title": "" }, { "docid": "dee25424dc8147a5852921bc5c8cb686", "score": "0.3584772", "text": "func (i *InputTextMultilineWidget) Build() {\n\tif imgui.InputTextMultilineV(\n\t\tContext.FontAtlas.RegisterString(i.label),\n\t\tContext.FontAtlas.RegisterStringPointer(i.text),\n\t\timgui.Vec2{\n\t\t\tX: i.width,\n\t\t\tY: i.height,\n\t\t},\n\t\tint(i.flags), i.cb,\n\t) && i.onChange != nil {\n\t\ti.onChange()\n\t}\n\n\tif i.scrollToBottom {\n\t\timgui.BeginChild(i.label)\n\t\timgui.SetScrollHereY(1.0)\n\t\timgui.EndChild()\n\t}\n}", "title": "" }, { "docid": "bcc758c16ca7091fb944aedc4fb36f4b", "score": "0.3575746", "text": "func CustomDashboard(w http.ResponseWriter, r *http.Request) {\n\tcfg := business.DashboardsConfig()\n\tkhttp.DashboardHandler(r.URL.Query(), mux.Vars(r), w, cfg)\n}", "title": "" }, { "docid": "4e5755e5394f9590097af41dcb1406e5", "score": "0.35719532", "text": "func (bt *BulletTextWidget) Build() {\n\timgui.BulletText(bt.text)\n}", "title": "" }, { "docid": "be7946dc491c453b944ae37add753a38", "score": "0.35616103", "text": "func newLabel() gtk.Widgetter {\n\treturn gtknew.VBox(boxMargin, gtk.NewLabel(\"Label\"))\n}", "title": "" }, { "docid": "dda4a40dd6a36fa3aa63f14cab670d1a", "score": "0.35590425", "text": "func (r *RayEntry) Custom(content string, label string) *RayEntry {\n\tpayload := payloads.NewCustom(label, content)\n\n\treturn r.sendRequest(payload)\n}", "title": "" }, { "docid": "af81c0d6f0329f758a8494ad93fb7466", "score": "0.35586095", "text": "func NewCustomClient(clientID, publicKey, secret string, environment EnvironmentURL,\n\thttpClient *http.Client) *Client {\n\treturn &Client{clientID, publicKey, secret, environment, httpClient}\n}", "title": "" }, { "docid": "8f074da41af2c0b82cc6380431d984b4", "score": "0.3555405", "text": "func (c *UHostClient) NewImportCustomImageRequest() *ImportCustomImageRequest {\n\treq := &ImportCustomImageRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "0c21f1baeb1d53219cff64d20484db2d", "score": "0.35494626", "text": "func ServiceCreateCustom(cmd *cobra.Command, args []string) error {\n\tcmd.SilenceUsage = true\n\n\tclient, err := usercmd.New()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error initializing cli\")\n\t}\n\n\terr = client.CreateCustomService(args[0], args[1:])\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error creating custom service\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9256651f0e97ee08697ad3d20a2271ca", "score": "0.3549144", "text": "func (self *rawContainerHandler) Start() {}", "title": "" }, { "docid": "287003b5ca8d152a4f90d99ba8d15017", "score": "0.35394636", "text": "func (l *launch) newButtonAnimation() animation { return &buttonAnimation{l: l} }", "title": "" }, { "docid": "1f85e0f416c0374be77f21ba12ceaa02", "score": "0.35377523", "text": "func (self *TraitWidget) ShowNow() {\n\tC.gtk_widget_show_now(self.CPointer)\n\treturn\n}", "title": "" }, { "docid": "fd6d22840b7f8ee143e536f8a167a5e6", "score": "0.35354516", "text": "func (s *BaseTSqlParserListener) EnterBUILT_IN_FUNC(ctx *BUILT_IN_FUNCContext) {}", "title": "" }, { "docid": "06cf3fa30f79091f45e2ff8a25428103", "score": "0.3533862", "text": "func (c *Converter) GenerateStartedJSON(prNum int, sha string) (string, error) {\n\tprNumColonSHA := fmt.Sprintf(\"%d:%s\", prNum, sha)\n\tstarted := ProwJobConfig{\n\t\tTimeStamp: time.Now().Unix(),\n\t\tPull: prNumColonSHA,\n\t\tRepos: map[string]string{\n\t\t\tfmt.Sprintf(\"github.com/%s/%s\", c.org, c.repo): prNumColonSHA,\n\t\t},\n\t}\n\tflattened, err := json.MarshalIndent(started, \"\", \"\\t\")\n\treturn string(flattened), err\n}", "title": "" }, { "docid": "e6311542d1940570a07575942f5155c1", "score": "0.35286722", "text": "func InstallCustomInstances(c *gin.Context) {\n\tparam := c.Param(\"param\")\n\tservice.InstallCustomInstance(param)\n\tc.JSON(http.StatusOK, gin.H{})\n}", "title": "" }, { "docid": "96221788aeb14abd482f1a9fd78c74f1", "score": "0.35245275", "text": "func GenMarkdownCustom(cmd *cobra.Command, w io.Writer) error {\n\tcmd.InitDefaultHelpCmd()\n\tcmd.InitDefaultHelpFlag()\n\n\tbuf := new(bytes.Buffer)\n\tname := cmd.CommandPath()\n\n\tshort := cmd.Short\n\tlong := cmd.Long\n\tif len(long) == 0 {\n\t\tlong = short\n\t}\n\n\tbuf.WriteString(\"## \" + name + \"\\n\\n\")\n\tbuf.WriteString(short + \"\\n\\n\")\n\tbuf.WriteString(\"### Synopsis\\n\\n\")\n\tbuf.WriteString(long + \"\\n\\n\")\n\n\tif cmd.Runnable() {\n\t\tbuf.WriteString(fmt.Sprintf(\"```shell\\n%s\\n```\\n\\n\", cmd.UseLine()))\n\t}\n\n\tif len(cmd.Aliases) > 0 {\n\t\tbuf.WriteString(\"### Aliases\\n\\n\")\n\t\tbuf.WriteString(fmt.Sprintf(\"%s\\n\\n\", cmd.Aliases))\n\t}\n\n\tif len(cmd.Example) > 0 {\n\t\tbuf.WriteString(\"### Examples\\n\\n\")\n\t\tbuf.WriteString(fmt.Sprintf(\"```\\n%s\\n```\\n\\n\", cmd.Example))\n\t}\n\n\tif err := printOptions(buf, cmd); err != nil {\n\t\treturn err\n\t}\n\t_, err := buf.WriteTo(w)\n\treturn err\n}", "title": "" }, { "docid": "b61b6720b7ef1f7af8729556a2433a38", "score": "0.35235777", "text": "func NewVBox(children ...fyne.CanvasObject) *Box {\n\treturn &Box{BaseWidget: BaseWidget{}, Horizontal: false, Children: children}\n}", "title": "" }, { "docid": "6331e2e5dde761106ad96b64623f02e1", "score": "0.35187796", "text": "func CreateOnTokenIssuanceStartCustomExtensionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewOnTokenIssuanceStartCustomExtension(), nil\n}", "title": "" }, { "docid": "b929935c9fcf88f992b06737a6388699", "score": "0.35178766", "text": "func NewBarWidget() *BarWidget {\n\treturn &BarWidget{Marker: \"#\", Left: \"|\", Right: \"|\", Fill: \" \"}\n}", "title": "" }, { "docid": "3b64cbcad953723e4232a0232deb33c0", "score": "0.3507034", "text": "func NewListWidget(ctx context.Context, x, y, w, h int, items []string, selected int, contentView *ItemWidget, status *StatusbarWidget) *ListWidget {\n\treturn &ListWidget{ctx: ctx, x: x, y: y, w: w, h: h, contentView: contentView, statusView: status}\n}", "title": "" } ]
db3fb63fac86d9584eba113181ed6eb5
ENIByMac indicates an expected call of ENIByMac.
[ { "docid": "a6188810f818f3fc58e3864d348cd60d", "score": "0.70873034", "text": "func (mr *MockTaskEngineStateMockRecorder) ENIByMac(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ENIByMac\", reflect.TypeOf((*MockTaskEngineState)(nil).ENIByMac), arg0)\n}", "title": "" } ]
[ { "docid": "a6874f19fe80caeb6b1118d1702134fd", "score": "0.6919523", "text": "func (m *MockTaskEngineState) ENIByMac(arg0 string) (*networkinterface.ENIAttachment, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ENIByMac\", arg0)\n\tret0, _ := ret[0].(*networkinterface.ENIAttachment)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "14a01bd099e054bf40622663167771a5", "score": "0.5541492", "text": "func (o *V2DownloadInfraEnvFilesParams) validateMac(formats strfmt.Registry) error {\n\n\tif err := validate.FormatOf(\"mac\", \"query\", \"mac\", o.Mac.String(), formats); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40a451e2472cddb0539b200fc3e4a967", "score": "0.55029005", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_BridgeTable_MacTable_Mac_NotProgrammedReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "3d1d72913006e576a4c3be280e5f82f2", "score": "0.549151", "text": "func TestAccountingBadMACaddress(t *testing.T) {\n\t// Run mock sessiond and pipelined\n\tmock_pipelined.NewRunningPipelined(t)\n\tmock_sessiond.NewRunningSessionManager(t)\n\n\t// MAC address has a missing character at the end on start\n\taaaCtx := getAAAcontext(SESSIONID1, IMSI1)\n\taaaCtx.Apn = \"98-76-54-AA-BB-C:Wifi-Offload-hotspot20\"\n\tsessionTable := createSessionTableWithAuthenticatedUE(t, aaaCtx)\n\taaaConfig := getAAAConfig()\n\taccService, err := servicers.NewAccountingService(sessionTable, aaaConfig)\n\tassert.NoError(t, err)\n\n\t_, err = accService.Start(context.Background(), aaaCtx)\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "6e0f86b5e12b105a931f8063b3cc86f9", "score": "0.5383427", "text": "func TestParseMAC(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tprefix net.IP\n\t\tmac net.HardwareAddr\n\t\tip net.IP\n\t\terr error\n\t}{\n\t\t{\n\t\t\tdesc: \"nil IPv6 prefix\",\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"short IPv6 prefix\",\n\t\t\tprefix: bytes.Repeat([]byte{0}, 15),\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"long IPv6 prefix\",\n\t\t\tprefix: bytes.Repeat([]byte{0}, 17),\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"IPv4 prefix\",\n\t\t\tprefix: net.IPv4(192, 168, 1, 1),\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"IPv6 /128 prefix\",\n\t\t\tprefix: net.ParseIP(\"fe80::1\"),\n\t\t\terr: errInvalidPrefix,\n\t\t},\n\t\t{\n\t\t\tdesc: \"nil MAC address\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\terr: errInvalidMAC,\n\t\t},\n\t\t{\n\t\t\tdesc: \"length 5 MAC address\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0xde, 0xad, 0xbe, 0xef, 0xde},\n\t\t\terr: errInvalidMAC,\n\t\t},\n\t\t{\n\t\t\tdesc: \"length 9 MAC address\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde},\n\t\t\terr: errInvalidMAC,\n\t\t},\n\t\t{\n\t\t\tdesc: \"EUI-48 MAC address 02:00:00:00:00:01\",\n\t\t\tprefix: net.ParseIP(\"2002:db8::\"),\n\t\t\tmac: net.HardwareAddr{0x02, 0x00, 0x00, 0x00, 0x00, 0x01},\n\t\t\tip: net.ParseIP(\"2002:db8::ff:fe00:1\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"EUI-48 MAC address 00:12:7f:eb:6b:40\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0x00, 0x12, 0x7f, 0xeb, 0x6b, 0x40},\n\t\t\tip: net.ParseIP(\"fe80::212:7fff:feeb:6b40\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"EUI-48 MAC address 22:ac:9e:18:be:80\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0x22, 0xac, 0x9e, 0x18, 0xbe, 0x80},\n\t\t\tip: net.ParseIP(\"fe80::20ac:9eff:fe18:be80\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"EUI-64 MAC address 00:00:00:ff:fe:00:00:01\",\n\t\t\tprefix: net.ParseIP(\"2002:db8::\"),\n\t\t\tmac: net.HardwareAddr{0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01},\n\t\t\tip: net.ParseIP(\"2002:db8::200:ff:fe00:1\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"EUI-64 MAC address 00:12:7f:ff:fe:eb:6b:40\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0x00, 0x12, 0x7f, 0xff, 0xfe, 0xeb, 0x6b, 0x40},\n\t\t\tip: net.ParseIP(\"fe80::212:7fff:feeb:6b40\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"EUI-64 MAC address 22:ac:9e:ff:fe:18:be:80\",\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0x22, 0xac, 0x9e, 0xff, 0xfe, 0x18, 0xbe, 0x80},\n\t\t\tip: net.ParseIP(\"fe80::20ac:9eff:fe18:be80\"),\n\t\t},\n\t}\n\n\tfor i, tt := range tests {\n\t\t// Copy input values to ensure they are not modified later\n\t\torigPrefix := make(net.IP, len(tt.prefix))\n\t\tcopy(origPrefix, tt.prefix)\n\t\torigMAC := make(net.HardwareAddr, len(tt.mac))\n\t\tcopy(origMAC, tt.mac)\n\n\t\tip, err := ParseMAC(tt.prefix, tt.mac)\n\t\tif err != nil {\n\t\t\tif want, got := tt.err, err; want != got {\n\t\t\t\tt.Fatalf(\"[%02d] test %q, unexpected error:\\n- want: %v\\n- got: %v\",\n\t\t\t\t\ti, tt.desc, want, got)\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Verify input values were not modified\n\t\tif want, got := origPrefix, tt.prefix; !want.Equal(got) {\n\t\t\tt.Fatalf(\"[%02d] test %q, prefix was modified:\\n- want: %v\\n- got: %v\",\n\t\t\t\ti, tt.desc, want, got)\n\t\t}\n\t\tif want, got := origMAC, tt.mac; !bytes.Equal(want, got) {\n\t\t\tt.Fatalf(\"[%02d] test %q, MAC was modified:\\n- want: %v\\n- got: %v\",\n\t\t\t\ti, tt.desc, want, got)\n\t\t}\n\n\t\tif want, got := tt.ip, ip; !want.Equal(got) {\n\t\t\tt.Fatalf(\"[%02d] test %q, unexpected IPv6 address:\\n- want: %v\\n- got: %v\",\n\t\t\t\ti, tt.desc, want, got)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b082fb85d606e81db62244e5a060695", "score": "0.53811663", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_BridgeTable_MacDuplication_Action) IsYANGGoEnum() {}", "title": "" }, { "docid": "68f79aa7865002c9afb48472f500357f", "score": "0.5360068", "text": "func (o *DeviceInterfaceDataData) GetInterfaceVendorMacOk() (*string, bool) {\n\tif o == nil || o.InterfaceVendorMac == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InterfaceVendorMac, true\n}", "title": "" }, { "docid": "87a3d9a4e217f89bef42204ad059e0be", "score": "0.527716", "text": "func (o *DeviceInterfaceDataData) GetInterfaceMacOk() (*string, bool) {\n\tif o == nil || o.InterfaceMac == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InterfaceMac, true\n}", "title": "" }, { "docid": "9098bf1a22fb411b48206ded54a6d7ed", "score": "0.5251436", "text": "func IsMac(mac string) bool {\n\tif len(mac) != 17 {\n\t\treturn false\n\t}\n\tmac = strings.ToLower(mac)\n\n\tr := `^(?i:[0-9a-f]{1})(?i:[02468ace]{1}):(?i:[0-9a-f]{2}):(?i:[0-9a-f]{2}):(?i:[0-9a-f]{2}):(?i:[0-9a-f]{2}):(?i:[0-9a-f]{2})`\n\treg, err := regexp.Compile(r)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn reg.FindStringSubmatch(mac) == nil\n}", "title": "" }, { "docid": "1ed94b8a02359ef912fddfbf18aa0165", "score": "0.5212542", "text": "func (m *MacNumbersSuite) TestMacNumbers(c *C) {\n\txlsxFile, err := OpenFile(\"macNumbersTest.xlsx\")\n\tc.Assert(err, IsNil)\n\tc.Assert(xlsxFile, NotNil)\n\ts := xlsxFile.Sheets[0].Cell(0, 0).String()\n\tc.Assert(s, Equals, \"编号\")\n}", "title": "" }, { "docid": "737c62b23bc91a007e87d507a565593f", "score": "0.51833844", "text": "func (E_SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacTable_Mac_NotProgrammedReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "5c955956b22bb1d150ef96b04800f322", "score": "0.5163523", "text": "func (o *VnicEthIfInventory) GetMacAddressOk() (*string, bool) {\n\tif o == nil || o.MacAddress == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MacAddress, true\n}", "title": "" }, { "docid": "b1994a119231bd8fba16d468eca0f21c", "score": "0.51229596", "text": "func (E_SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacDuplication_Action) IsYANGGoEnum() {}", "title": "" }, { "docid": "c00accd9afb359fdf67fd4345dd26487", "score": "0.5121634", "text": "func (E_SrlNokiaInterfacesBridgeTableMacTable_MacType) IsYANGGoEnum() {}", "title": "" }, { "docid": "36c78da7cef4737d5e78169db7faeff0", "score": "0.51104164", "text": "func checkMAC(msg, msgMac, key []byte) (ans bool) {\n\tmac := hmac.New(sha256.New, key)\n\tmac.Write([]byte(msg))\n\texpectedMAC := mac.Sum(nil)\n\treturn hmac.Equal(msgMac, expectedMAC)\n}", "title": "" }, { "docid": "83987bbefc636d2901fc93b492330ec5", "score": "0.5107567", "text": "func (o *ManagementInterfaceAllOf) GetMacAddressOk() (*string, bool) {\n\tif o == nil || o.MacAddress == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MacAddress, true\n}", "title": "" }, { "docid": "7baf5f0a9385997643962cb3474d1540", "score": "0.50700253", "text": "func (E_SrlNokiaTunnelInterfaces_TunnelInterface_VxlanInterface_BridgeTable_UnicastDestinations_Destination_MacTable_Mac_NotProgrammedReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "3a57060bfcf064ce4c95532f4701e1d6", "score": "0.5048376", "text": "func macsAreEqual(a, b *MAC) (bool, string) {\n\tif a.Address != b.Address {\n\t\treturn false, \"Address\"\n\t}\n\tif a.Company != b.Company {\n\t\treturn false, \"Company\"\n\t}\n\tif a.Country != b.Country {\n\t\treturn false, \"Country\"\n\t}\n\tif a.MacPrefix != b.MacPrefix {\n\t\treturn false, \"MacPrefix\"\n\t}\n\tif a.StartHex != b.StartHex {\n\t\treturn false, \"StartHex\"\n\t}\n\tif a.EndHex != b.EndHex {\n\t\treturn false, \"EndHex\"\n\t}\n\tif a.Type != b.Type {\n\t\treturn false, \"Type\"\n\t}\n\treturn true, \"\"\n}", "title": "" }, { "docid": "9d34345a2cdef7dba9a14b8355daa807", "score": "0.50229156", "text": "func (E_SrlNokiaBridgeTableMacTable_MacType) IsYANGGoEnum() {}", "title": "" }, { "docid": "b706793a51e9e3e6b2fcb918a379312b", "score": "0.5021109", "text": "func MacGetApplicationEUI() string {\n\terr := serialWrite(\"mac get appeui\")\n\tif err != nil {\n\t\tWARN.Println(\"mac get appeui error:\", err)\n\t\treturn \"0000000000000000\"\n\t}\n\n\tn, answer := serialRead()\n\tif n != 0 {\n\t\treturn string(sanitize(answer))\n\t}\n\n\treturn \"0000000000000000\"\n}", "title": "" }, { "docid": "d548fa586175617f647f404632787f8f", "score": "0.49857304", "text": "func (_ NetworkInterfaceAliases) Mac(p graphql.ResolveParams) (string, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := val.(string)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'mac'\")\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "04f68742005fe5804072521d050b6653", "score": "0.49830565", "text": "func CheckMAC(message, messageMAC, key []byte) bool {\n mac := hmac.New(sha1.New, key)\n mac.Write(message)\n expectedMAC := mac.Sum(nil)\n log.Println(hex.EncodeToString(expectedMAC), hex.EncodeToString(messageMAC))\n return hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "87a9ac38988b735581f32aa6ebac0639", "score": "0.49625105", "text": "func checkMAC(message, messageMAC, key []byte) bool {\n\tmac := hmac.New(sha256.New, key)\n\tmac.Write(message)\n\texpectedMAC := mac.Sum(nil)\n\texpectedSig := \"sha1=\" + hex.EncodeToString(expectedMAC)\n\treturn hmac.Equal(messageMAC, []byte(expectedSig))\n}", "title": "" }, { "docid": "4e337f9c9f4932e3acbf157a54344e64", "score": "0.49507016", "text": "func TestInstr_00EE(t *testing.T) {\n\ttc := []struct {\n\t\tStack [16]rune\n\t\tSP byte\n\t\tPC rune\n\t\tExpectedSP byte\n\t\tExpectedPC rune\n\t}{\n\t\t{[16]rune{0x0000, 0x0001, 0x0002, 0x0003, 0x0004}, 0x04, 0x0034, 0x03, 0x0004},\n\t\t{[16]rune{0x1234}, 0x00, 0x034, 0x00, 0x1234},\n\t}\n\n\tfor _, c := range tc {\n\t\tcpu := &CPU{}\n\t\tr := &Registers{}\n\t\tr.Reset()\n\t\tcpu.R = r\n\n\t\tcpu.R.Stack = c.Stack\n\t\tcpu.R.SP = c.SP\n\t\tcpu.R.PC = c.PC\n\n\t\tcpu.instr_00EE()\n\t\tif cpu.R.SP != c.ExpectedSP {\n\t\t\tt.Errorf(\"stack pointer should be 0x%02x, actual: 0x%02x\\n\", c.ExpectedSP, cpu.R.SP)\n\t\t}\n\n\t\tif cpu.R.PC != c.ExpectedPC {\n\t\t\tt.Errorf(\"program counter should be 0x%04x, actual: 0x%04x\\n\", c.ExpectedPC, cpu.R.PC)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb6b5daf0295b475aaf70d495fbbb2d9", "score": "0.49454442", "text": "func (E_SrlNokiaTunnelInterfacesVxlanInterfaceBridgeTable_MacType) IsYANGGoEnum() {}", "title": "" }, { "docid": "e6e1c20d175bbef9789dc312e8a9d966", "score": "0.49197286", "text": "func testDecodeHMAC(t *testing.T) {\n\thmac := []byte{0x1f, 0x86, 0x98, 0x69, 0x0e, 0x02, 0xca, 0x16, 0x61, 0x85, 0x50, 0xef, 0x7f, 0x19, 0xda, 0x8e, 0x94, 0x5b, 0x55, 0x5a}\n\tcode := decodeHMAC(hmac)\n\tif code != 872921 {\n\t\tt.Error(\"Returned code does not match expectation\")\n\t}\n}", "title": "" }, { "docid": "96f57f9502ab24ee8be5949c70e6051d", "score": "0.4916485", "text": "func (E_SrlNokiaInterfacesBridgeTableStatistics_MacType) IsYANGGoEnum() {}", "title": "" }, { "docid": "ff881f480976e98ea9aa7a9a66b38ed9", "score": "0.48630127", "text": "func checkMAC(message, messageMAC, key []byte) bool {\n\tmac := hmac.New(sha256.New, key)\n\tmac.Write(message)\n\texpectedMAC := mac.Sum(nil)\n\treturn hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "0d637af52401e67043a3365f3b2daab5", "score": "0.48471084", "text": "func MacSetApplicationEUI(eui string) error {\n\tif len(eui) != 16 {\n\t\treturn errors.New(\"invalid eui length\")\n\t}\n\n\terr := serialWrite(fmt.Sprintf(\"mac set appeui %s\", eui))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not set application eui\")\n\t}\n\n\tn, answer := serialRead()\n\tif n == 0 || string(sanitize(answer)) == invalidParameter {\n\t\treturn errors.New(\"could not set application eui: invalid parameter\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b53cb416835f400022408857c91b3bb5", "score": "0.48420683", "text": "func (s *ComputeTestSuite) TestMultiNicsPickMac(c *check.C) {\n\tinstance := model.Instance{}\n\tinstance.Nics = []model.Nic{\n\t\t{\n\t\t\tMacAddress: \"02:03:04:05:06:07\",\n\t\t\tDeviceNumber: 0,\n\t\t},\n\t\t{\n\t\t\tMacAddress: \"02:03:04:05:06:09\",\n\t\t\tDeviceNumber: 1,\n\t\t},\n\t}\n\tconfig := container.Config{Labels: map[string]string{}}\n\tsetupMacAndIP(instance, &config, true, true)\n\tc.Assert(config.MacAddress, check.Equals, \"02:03:04:05:06:07\")\n\tc.Assert(config.Labels, check.DeepEquals, map[string]string{constants.RancherMacLabel: \"02:03:04:05:06:07\"})\n}", "title": "" }, { "docid": "3699c0199d1bb4346044c6af6000a70a", "score": "0.48392704", "text": "func (o *CanonicalFactsIn) GetMacAddressesOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.MacAddresses, true\n}", "title": "" }, { "docid": "a0aff0881ab90a659fec47e6aa110566", "score": "0.48218492", "text": "func (c *keyManagementRESTClient) MacVerify(ctx context.Context, req *kmspb.MacVerifyRequest, opts ...gax.CallOption) (*kmspb.MacVerifyResponse, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tjsonReq, err := m.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v:macVerify\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\topts = append((*c.CallOptions).MacVerify[0:len((*c.CallOptions).MacVerify):len((*c.CallOptions).MacVerify)], opts...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &kmspb.MacVerifyResponse{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "54673ae19a63fb89c6e537b8912aacca", "score": "0.48144615", "text": "func Os(t *testing.T) {\n\titerator(t, func(line, source string, pos int) {\n\t\tif !(strings.Contains(strings.ToUpper(line), \"DAR\"+\"WIN\") ||\n\t\t\tstrings.Contains(strings.ToUpper(line), \"MAC\"+\"OS\")) {\n\t\t\treturn\n\t\t}\n\t\tt.Errorf(\"Fail: %13s:%-4d %s\", source, pos, line)\n\t})\n}", "title": "" }, { "docid": "1a4d0f062e8858c5bf880ebef710522a", "score": "0.481349", "text": "func macValidator(ans interface{}) error {\n\treturn validate.MAC(ans.(string))\n}", "title": "" }, { "docid": "3a9d50893c2a1188168d5d7dd165c5a3", "score": "0.48054522", "text": "func TestInstructingFIIdentifierAlphaNumeric(t *testing.T) {\n\tbfi := mockInstructingFI()\n\tbfi.FinancialInstitution.Identifier = \"®\"\n\n\terr := bfi.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"Identifier\", ErrNonAlphanumeric, bfi.FinancialInstitution.Identifier).Error())\n}", "title": "" }, { "docid": "f97638f1135f76c87d07854ac20737fe", "score": "0.48032922", "text": "func MacGetDeviceEUI() string {\n\terr := serialWrite(\"mac get deveui\")\n\tif err != nil {\n\t\tWARN.Println(\"mac get deveui error:\", err)\n\t\treturn \"0000000000000000\"\n\t}\n\n\tn, answer := serialRead()\n\tif n != 0 {\n\t\treturn string(sanitize(answer))\n\t}\n\n\treturn \"0000000000000000\"\n}", "title": "" }, { "docid": "0429b1d7eac103849c36cd55be9ca585", "score": "0.48029858", "text": "func (o *DeviceInterfaceDataData) HasInterfaceVendorMac() bool {\n\tif o != nil && o.InterfaceVendorMac != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "678cbea9b19562c255913849d5335cc1", "score": "0.48024288", "text": "func (receiver *Receiver) checkMAC(message, messageMAC []byte) bool {\n\tmac := hmac.New(sha1.New, receiver.hookSecret)\n\tmac.Write(message)\n\texpectedMAC := mac.Sum(nil)\n\treturn hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "1e84e5518cc20687de6a0d2458788aef", "score": "0.47973534", "text": "func (a *ConfiguredNSSAI) GetIei() (iei uint8) {}", "title": "" }, { "docid": "9e6909c797b78e527190b694b848bc8f", "score": "0.47668576", "text": "func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool {\n\texpectedMAC := genMAC(message, key, hashFunc)\n\treturn hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "8ee30708aad43ba7f67f830f6df1c5f3", "score": "0.4765789", "text": "func (s *service) VerifyMAC(mac, data []byte, kh interface{}) error {\n\terr := s.crypto.VerifyMAC(mac, data, kh)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"verify MAC: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ec8508bc49b2bb5882027d026f28e8df", "score": "0.47653708", "text": "func (wtg *workloadTestGroup) testWorkloadMacaddr() {\n\t// workload-4 object\n\twkld4 := workload.Workload{\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tName: wkld4Name,\n\t\t\tTenant: \"default\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tSpec: workload.WorkloadSpec{\n\t\t\tHostName: \"naples4-host.local\",\n\t\t\t// Interfaces Spec keyed by MAC addr of Interface\n\t\t\tInterfaces: []workload.WorkloadIntfSpec{\n\t\t\t\t{\n\t\t\t\t\tMACAddress: \"aaBB.ccDD.00.00\",\n\t\t\t\t\tMicroSegVlan: 101,\n\t\t\t\t\tExternalVlan: 1001,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Verify creation for workload-4 object fails with invalid interface mac-address\n\tEventually(func() bool {\n\t\t_, err := wtg.wkldIf.Create(wtg.suite.loggedInCtx, &wkld4)\n\t\tBy(fmt.Sprintf(\"ts:%s Workload CREATE status, [%s] err: %+v w4: %+v\", time.Now().String(), wkld4Name, err, wkld4))\n\t\tif err != nil {\n\t\t\tBy(fmt.Sprintf(\"ts:%s Workload CREATE failed due to invalid interface-mac[%+v]\", time.Now().String(), wkld4))\n\t\t\treturn true\n\t\t}\n\t\tBy(fmt.Sprintf(\"ts:%s Workload CREATE expected to fail, but succeeded for [%s] err: %+v w4: %+v\", time.Now().String(), wkld4Name, err, wkld4))\n\t\treturn false\n\t}, 30, 1).Should(BeTrue(), fmt.Sprintf(\"Object creation expected to fail, but succeeded for obj:%s with invalid mac\", wkld4Name))\n\n\t// Verify creation for workload-4 object succeeds with valid interface mac-address\n\twkld4.Spec.Interfaces = []workload.WorkloadIntfSpec{\n\t\t{\n\t\t\tMACAddress: \"00:50:56:00:00:01\",\n\t\t\tMicroSegVlan: 101,\n\t\t\tExternalVlan: 1001,\n\t\t},\n\t}\n\tEventually(func() bool {\n\t\tw4, err := wtg.wkldIf.Create(wtg.suite.loggedInCtx, &wkld4)\n\t\tif err != nil || w4.Name != wkld4.Name || w4.Spec.HostName != wkld4.Spec.HostName {\n\t\t\tBy(fmt.Sprintf(\"ts:%s Workload CREATE failed for [%s] err: %+v w4: %+v\", time.Now().String(), wkld4Name, err, w4))\n\t\t\treturn false\n\t\t}\n\t\tBy(fmt.Sprintf(\"ts:%s Workload CREATE validated for [%+v]\", time.Now().String(), wkld4))\n\t\treturn true\n\t}, 30, 1).Should(BeTrue(), fmt.Sprintf(\"Failed to create %s object\", wkld4Name))\n}", "title": "" }, { "docid": "b2798769d5fda3131df412994433ed4f", "score": "0.47624448", "text": "func IsMAC(str string) bool {\n\t_, err := net.ParseMAC(str)\n\treturn err == nil\n}", "title": "" }, { "docid": "f2dfe4dafd244803cd54390510552b5c", "score": "0.47517863", "text": "func (E_SrlNokiaSystemBridgeTable_MacType) IsYANGGoEnum() {}", "title": "" }, { "docid": "e916411f84ee947b71284504d96b410b", "score": "0.47447512", "text": "func opEI() Instruction {\n\treturn func(io InstructionIO) {\n\t\tio.SetIME(true)\n\t}\n}", "title": "" }, { "docid": "5a6a94b1951eaa3eeb6bce68a2d713dd", "score": "0.47187766", "text": "func checkMAC(message, messageMAC, key []byte) bool {\n\tmac := hmac.New(sha1.New, key)\n\tmac.Write(message)\n\texpectedMAC := mac.Sum(nil)\n\treturn hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "b6698fc10ffc1d7b9fba624c0888cd96", "score": "0.47163945", "text": "func (E_SrlNokiaTunnelInterfacesVxlanInterfaceBridgeTableUnicastDestinations_MacType) IsYANGGoEnum() {}", "title": "" }, { "docid": "dd06c052d5b3f16a7b7a6e6f5f70eda8", "score": "0.46851245", "text": "func MacSetDeviceEUI(eui string) error {\n\tif len(eui) != 16 {\n\t\treturn errors.New(\"invalid eui length\")\n\t}\n\n\terr := serialWrite(fmt.Sprintf(\"mac set deveui %s\", eui))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not set device eui\")\n\t}\n\n\tn, answer := serialRead()\n\tif n == 0 || string(sanitize(answer)) == invalidParameter {\n\t\treturn errors.New(\"could not set device eui: invalid parameter\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dce59367e0b30837d1e0247bb2b90ba7", "score": "0.4672333", "text": "func (c *Crypto) VerifyMAC(mac, data []byte, kh interface{}) error {\n\treturn c.VerifyMACErr\n}", "title": "" }, { "docid": "745b569b0b3212d2e54d9aa769d74aa8", "score": "0.46566513", "text": "func (o *DeviceInterfaceDataData) GetInterfaceVendorMac() string {\n\tif o == nil || o.InterfaceVendorMac == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.InterfaceVendorMac\n}", "title": "" }, { "docid": "4a39a2ff03a6e8eef31862d1daa71798", "score": "0.4647107", "text": "func testIATEDInvalidTransactionCode(t testing.TB) {\n\tiatEd := mockIATEntryDetail()\n\tiatEd.TransactionCode = 77\n\terr := iatEd.Validate()\n\tif !base.Match(err, ErrTransactionCode) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "d1fdbdfe74ef9e5a0ae08173695ba270", "score": "0.46462512", "text": "func (o *DeviceInterfaceDataData) HasInterfaceMac() bool {\n\tif o != nil && o.InterfaceMac != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e95a3b3a3f676fe4b193072f396f6aa9", "score": "0.46451253", "text": "func weirdAESEnc(msg, xormix, key [32]byte) (result [32]byte) {\n\tc, _ := aes.NewCipher(key[:])\n\n\t// plaintext gets xored with the xormix\n\tfor i, _ := range xormix {\n\t\tmsg[i] ^= xormix[i]\n\t}\n\n\t// encrypt in 2 iterations the xormix with the key.\n\tc.Encrypt(result[:16], msg[:16])\n\tc.Encrypt(result[16:], msg[16:])\n\n\treturn\n}", "title": "" }, { "docid": "a70d41788a7e69bfc844185d4c7732bd", "score": "0.46340242", "text": "func (a *ReplayedUESecurityCapabilities) GetIei() (iei uint8) {}", "title": "" }, { "docid": "fe488b81993d8d07c3d3882fe133d870", "score": "0.46331847", "text": "func (c *Client) matchesMAC(f *Filter) bool {\n\tif f.MAC == \"\" {\n\t\treturn true\n\t}\n\n\tfor _, mac := range c.MACs {\n\t\tif f.MAC == mac {\n\t\t\treturn true\n\t\t}\n\n\t\tlog.Debug(\"failed match on mac %v %v\", f.MAC, mac)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "81c990fdd8644e5ad1b760e41feaf0bb", "score": "0.46223462", "text": "func (o *VirtualizationVmwareNetworkAllOf) GetMacAddressChangesOk() (*string, bool) {\n\tif o == nil || o.MacAddressChanges == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MacAddressChanges, true\n}", "title": "" }, { "docid": "6e375a2551f2eec8f1923431d9e71104", "score": "0.46143633", "text": "func TestIATReturn(t *testing.T) {\n\ttestIATReturn(t)\n}", "title": "" }, { "docid": "9509a9f995a79eb9ba07cab00f28a2af", "score": "0.45871544", "text": "func (t *SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacLearning_LearntEntries_Mac) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacLearning_LearntEntries_Mac\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "49b9b3b0c18a4cb95b1c88c86c511d51", "score": "0.45799106", "text": "func MacReset(band uint16) bool {\n\tif band != 433 && band != 868 {\n\t\tWARN.Println(\"mac reset error: invalid band selected (433 or 868)\")\n\t\treturn false\n\t}\n\n\terr := serialWrite(fmt.Sprintf(\"mac reset %v\", band))\n\tif err != nil {\n\t\tWARN.Println(\"mac reset error:\", err)\n\t\treturn false\n\t}\n\n\tn, answer := serialRead()\n\tif n == 0 || string(sanitize(answer)) == invalidParameter {\n\t\tWARN.Println(\"mac reset error: invalid parameter\")\n\t\treturn false\n\t}\n\n\t//state.macPaused = false\n\n\treturn true\n}", "title": "" }, { "docid": "3d6165df45ab05ad08c3f67f04b74512", "score": "0.4560336", "text": "func (o *VnicEthIfInventory) HasMacAddress() bool {\n\tif o != nil && o.MacAddress != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "11a712164aa684746b04b90216f846e9", "score": "0.45457217", "text": "func PAN(c *CPU6502) byte {\n\tpanic(\"Test Failed\")\n}", "title": "" }, { "docid": "e91b3eaf00c835073c03a3142ab2cf65", "score": "0.4536392", "text": "func TestBytesToInstrFail(t *testing.T) {\n\ttestInstrBytesFail([]Nibble{0x0, 0x2, 0x3, 0x4}, t)\n\ttestInstrBytesFail([]Nibble{0x4, 0x2, 0x3, 0x4}, t)\n\ttestInstrBytesFail([]Nibble{0xa, 0x2, 0x3, 0x4}, t)\n\ttestInstrBytesFail([]Nibble{0xc, 0x2, 0x3, 0x4}, t)\n}", "title": "" }, { "docid": "69182c40e8d4ea8cfb684ef9b311bba8", "score": "0.45290586", "text": "func (o *DeviceInterfaceDataData) SetInterfaceVendorMac(v string) {\n\to.InterfaceVendorMac = &v\n}", "title": "" }, { "docid": "109a954111a135a1eed5f6aba1a9075a", "score": "0.45273867", "text": "func ValidateMAC(message, messageMAC, key []byte) bool {\n\texpectedMAC := GenMAC(message, key)\n\treturn hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "54e0a17689c99b7c1f1e1382c8c0a9b4", "score": "0.45244464", "text": "func (t *SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacDuplication_DuplicateEntries_Mac) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacDuplication_DuplicateEntries_Mac\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31b0bd31ccd3daab4b40dc721d4caf39", "score": "0.451815", "text": "func (a *MICOIndication) GetIei() (iei uint8) {}", "title": "" }, { "docid": "7c88c0761f0052a33ebf6dd585166303", "score": "0.45037696", "text": "func TestParseIP(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tip net.IP\n\t\tprefix net.IP\n\t\tmac net.HardwareAddr\n\t\terr error\n\t}{\n\t\t{\n\t\t\tdesc: \"nil IP address\",\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"short IP address\",\n\t\t\tip: bytes.Repeat([]byte{0}, 15),\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"long IP address\",\n\t\t\tip: bytes.Repeat([]byte{0}, 17),\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"IPv4 address\",\n\t\t\tip: net.IPv4(192, 168, 1, 1),\n\t\t\terr: errInvalidIP,\n\t\t},\n\t\t{\n\t\t\tdesc: \"IPv6 EUI-64 MAC\",\n\t\t\tip: net.ParseIP(\"2001:db8::1\"),\n\t\t\tprefix: net.ParseIP(\"2001:db8::\"),\n\t\t\tmac: net.HardwareAddr{0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},\n\t\t},\n\t\t{\n\t\t\tdesc: \"IPv6 EUI-48 MAC\",\n\t\t\tip: net.ParseIP(\"fe80::212:7fff:feeb:6b40\"),\n\t\t\tprefix: net.ParseIP(\"fe80::\"),\n\t\t\tmac: net.HardwareAddr{0x00, 0x12, 0x7f, 0xeb, 0x6b, 0x40},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.desc, func(t *testing.T) {\n\t\t\t// Copy input value to ensure it is not modified later\n\t\t\torigIP := make(net.IP, len(tt.ip))\n\t\t\tcopy(origIP, tt.ip)\n\n\t\t\tprefix, mac, err := ParseIP(tt.ip)\n\t\t\tif err != nil {\n\t\t\t\tif want, got := tt.err, err; want != got {\n\t\t\t\t\tt.Fatalf(\"unexpected error:\\n- want: %v\\n- got: %v\",\n\t\t\t\t\t\twant, got)\n\t\t\t\t}\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Verify input value was not modified\n\t\t\tif want, got := origIP, tt.ip; !want.Equal(got) {\n\t\t\t\tt.Fatalf(\"IP was modified:\\n- want: %v\\n- got: %v\",\n\t\t\t\t\twant, got)\n\t\t\t}\n\n\t\t\tif want, got := tt.prefix, prefix; !want.Equal(got) {\n\t\t\t\tt.Fatalf(\"unexpected IPv6 prefix:\\n- want: %v\\n- got: %v\",\n\t\t\t\t\twant, got)\n\t\t\t}\n\t\t\tif want, got := tt.mac, mac; !bytes.Equal(want, got) {\n\t\t\t\tt.Fatalf(\"unexpected MAC address:\\n- want: %v\\n- got: %v\",\n\t\t\t\t\twant, got)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "64fcc95ecbc5571733145fa6ca6b5026", "score": "0.4502775", "text": "func TestInvalidPublicKey(t *testing.T) {\n\tstorage, err := util.NewTempFileStorage()\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdatabase := db.NewDatabaseWithStorage(storage)\n\tbridge, err := hap.NewSecuredDevice(\"Macbook Bridge\", \"001-02-003\", database)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcontext := hap.NewContextForSecuredDevice(bridge)\n\n\tcontroller := NewVerifyServerController(database, context)\n\n\tclient, _ := hap.NewDevice(\"HomeKit Client\", database)\n\tclientController := NewVerifyClientController(client, database)\n\n\treq := clientController.InitialKeyVerifyRequest()\n\treqContainer, err := util.NewTLV8ContainerFromReader(req)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treqContainer.SetByte(TagPublicKey, byte(0x01))\n\t// 1) C -> S\n\tif _, err = HandleReaderForHandler(reqContainer.BytesBuffer(), controller); err != errInvalidClientKeyLength {\n\t\tt.Fatal(\"expected invalid client key length error\")\n\t}\n}", "title": "" }, { "docid": "a32bc55f7197a8cb0b56c691ca6be351", "score": "0.44808143", "text": "func CheckMAC(message, messageMAC, key []byte) bool {\n\tmac := hmac.New(sha256.New, key)\n\t_, err := mac.Write(message)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\texpectedMAC := mac.Sum(nil)\n\treturn hmac.Equal(messageMAC, expectedMAC)\n}", "title": "" }, { "docid": "65f7f2693806d6630a9aeae61230fc5f", "score": "0.4479213", "text": "func TestInstructingFIAddressLineTwoAlphaNumeric(t *testing.T) {\n\tbfi := mockInstructingFI()\n\tbfi.FinancialInstitution.Address.AddressLineTwo = \"®\"\n\n\terr := bfi.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"AddressLineTwo\", ErrNonAlphanumeric, bfi.FinancialInstitution.Address.AddressLineTwo).Error())\n}", "title": "" }, { "docid": "c7aba5a95d19303bb08712b2ae1b6324", "score": "0.44774592", "text": "func (o *VnicEthIfInventory) GetMacAddressTypeOk() (*string, bool) {\n\tif o == nil || o.MacAddressType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MacAddressType, true\n}", "title": "" }, { "docid": "a2e375a2e6d6718c54e051fc7539cb09", "score": "0.4470042", "text": "func (l *libnet) GetMac() (lua.String, error) {\n\tifas, err := net.Interfaces()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, ifa := range ifas {\n\t\tif addr := ifa.HardwareAddr.String(); addr != \"\" {\n\t\t\treturn lua.String(addr), nil\n\t\t}\n\t}\n\treturn \"\", errors.New(\"no valid mac address found\")\n}", "title": "" }, { "docid": "e3e4e747d61b5a78e4f79cdcd1e0b93f", "score": "0.446491", "text": "func (t *SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacTable_Mac) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacTable_Mac\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e9fcad2d45b91168a4df96990dad5ee3", "score": "0.44568038", "text": "func testEDIATisCheckDigit(t testing.TB) {\n\ted := mockIATEntryDetail()\n\ted.CheckDigit = \"1\"\n\terr := ed.Validate()\n\tif !base.Match(err, NewErrValidCheckDigit(7)) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "17c72172e6370e914a8f6f6a986d0d5d", "score": "0.4453888", "text": "func MAC(v string) error {\n\tif err := NonEmpty(v); err != nil {\n\t\treturn err\n\t}\n\tif _, err := net.ParseMAC(v); err != nil {\n\t\treturn errors.New(\"invalid MAC Address\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b6ffe835a0af4fc965ccdc9698d99355", "score": "0.44525024", "text": "func (E_SrlNokiaTunnelInterfaces_TunnelInterface_VxlanInterface_Egress_InnerEthernetHeader_SourceMac) IsYANGGoEnum() {}", "title": "" }, { "docid": "174e3f3535f3150facd10847adfabee7", "score": "0.4452449", "text": "func MacTx(confirmed bool, port uint8, data []byte, callback receiveCallback) bool {\n\tif port < 1 || port > 223 {\n\t\tWARN.Printf(\"mac tx error: invalid port number (%v)\", port)\n\t\treturn false\n\t}\n\n\tif len(data) == 0 {\n\t\tWARN.Println(\"mac tx error: trying to send zero bytes\")\n\t\treturn false\n\t}\n\n\tuplinkType := UNCONFIRMED\n\n\tif confirmed {\n\t\tuplinkType = CONFIRMED\n\t}\n\n\terr := serialWrite(fmt.Sprintf(\"mac tx %s %v %X\", uplinkType, port, data))\n\tif err != nil {\n\t\tWARN.Println(\"mac tx error:\", err)\n\t\treturn false\n\t}\n\n\tn, answer := serialRead()\n\tif n == 0 || string(sanitize(answer)) != \"ok\" {\n\t\tWARN.Println(\"mac tx error:\", string(sanitize(answer)))\n\t\treturn false\n\t}\n\n\ttimeout := time.After(time.Second * 15)\n\ttick := time.Tick(time.Second)\n\n\tfor {\n\t\tselect {\n\t\tcase <- timeout:\n\t\t\tWARN.Println(\"timed out\")\n\t\t\treturn false\n\t\tcase <- tick:\n\t\t\tn, answer = serialRead()\n\t\t\ts := string(sanitize(answer))\n\n\t\t\tif n != 0 {\n\t\t\t\tif s == \"mac_err\" || s == \"invalid_data_len\" {\n\t\t\t\t\tWARN.Printf(\"mac tx error: %s\", s)\n\t\t\t\t\treturn false\n\t\t\t\t} else if s == \"mac_tx_ok\" {\n\t\t\t\t\treturn true\n\t\t\t\t} else if strings.HasPrefix(s, \"mac_rx\") {\n\t\t\t\t\tif callback != nil {\n\t\t\t\t\t\tparams := strings.Split(s, \" \")\n\n\t\t\t\t\t\tport, err := strconv.ParseInt(params[1], 10, 8)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tWARN.Printf(\"mac_rx invalid port: %s\", params[1])\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdecoded, err := hex.DecodeString(params[2])\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tWARN.Printf(\"mac_rx invalid hex data: %s\", params[2])\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcallback(uint8(port), []byte(decoded))\n\t\t\t\t\t}\n\t\t\t\t\treturn true\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a1484f8bb832c53c57a5c213852454cd", "score": "0.4451574", "text": "func TestIATEDInvalidTransactionCode(t *testing.T) {\n\ttestIATEDInvalidTransactionCode(t)\n}", "title": "" }, { "docid": "d4196d98276138c1f6a64ad5483f17e7", "score": "0.44504058", "text": "func (c *BasicClient) MAC() [6]byte {\n\treturn c.MACAddr\n}", "title": "" }, { "docid": "2d006dcf484e5838e33a89d7cb845043", "score": "0.44503108", "text": "func (e E_SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacTable_Mac_NotProgrammedReason) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacTable_Mac_NotProgrammedReason\")\n}", "title": "" }, { "docid": "4bdeafe234dfe45c4b0a1d0f1ecf8433", "score": "0.44489795", "text": "func (c *KeyManagementClient) MacVerify(ctx context.Context, req *kmspb.MacVerifyRequest, opts ...gax.CallOption) (*kmspb.MacVerifyResponse, error) {\n\treturn c.internalClient.MacVerify(ctx, req, opts...)\n}", "title": "" }, { "docid": "dfd29bb55c08ae9a8894f366f3c51a98", "score": "0.44453976", "text": "func (imds TypedIMDS) GetMAC(ctx context.Context) (string, error) {\n\tmac, err := imds.GetMetadataWithContext(ctx, \"mac\")\n\tif err != nil {\n\t\tif imdsErr, ok := err.(*imdsRequestError); ok {\n\t\t\tlog.Warnf(\"%v\", err)\n\t\t\treturn mac, imdsErr.err\n\t\t}\n\t\treturn \"\", err\n\t}\n\treturn mac, err\n}", "title": "" }, { "docid": "849f6f6a7bdef60d0e6a407a0e6c4a18", "score": "0.44386286", "text": "func (p *mesh) GetOwnMac(macs []string) []string {\r\n\town_macs := make([]string, 0, 100)\r\n\tfor _, mac := range macs {\r\n\t\tfor _, val := range p.deviceList {\r\n\t\t\tif val == mac {\r\n\t\t\t\town_macs = append(own_macs, val)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn own_macs\r\n}", "title": "" }, { "docid": "4113097a2ae96c0039a91a9802a26b09", "score": "0.44202024", "text": "func (o *VnicEthIfInventory) GetStaticMacAddressOk() (*string, bool) {\n\tif o == nil || o.StaticMacAddress == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StaticMacAddress, true\n}", "title": "" }, { "docid": "f9d1adda6aec665dc92700fb9b64fb04", "score": "0.44199243", "text": "func TestCreateBridgeWithMac(t *testing.T) {\n\tif testing.Short() {\n\t\treturn\n\t}\n\n\tname := \"testbridge\"\n\n\tif err := CreateBridge(name, true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif _, err := net.InterfaceByName(name); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// cleanup and tests\n\n\tif err := DeleteBridge(name); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif _, err := net.InterfaceByName(name); err == nil {\n\t\tt.Fatalf(\"expected error getting interface because %s bridge was deleted\", name)\n\t}\n}", "title": "" }, { "docid": "e265a59bf3df6079fb49d36023e029b0", "score": "0.4419074", "text": "func TestOmciDecode(t *testing.T) {\n\t// TID = 0 on autonomous ONU notifications only. Get packet back but ErrorLayer()\n\t// returns non-nil\n\ttidZeroOnNonNotification := \"0000440A010C01000400800003010000\" +\n\t\t\"00000000000000000000000000000000\" +\n\t\t\"000000000000000000000028\"\n\n\tdata, err := stringToPacket(tidZeroOnNonNotification)\n\tassert.NoError(t, err)\n\tpacket := gopacket.NewPacket(data, LayerTypeOMCI, gopacket.NoCopy)\n\tassert.NotNil(t, packet)\n\tassert.NotNil(t, packet.ErrorLayer())\n\n\t// Only Baseline and Extended Message types allowed\n\tinvalidMessageType := \"000C440F010C01000400800003010000\" +\n\t\t\"00000000000000000000000000000000\" +\n\t\t\"000000000000000000000028\"\n\n\tdata, err = stringToPacket(invalidMessageType)\n\tassert.NoError(t, err)\n\tpacket = gopacket.NewPacket(data, LayerTypeOMCI, gopacket.NoCopy)\n\tassert.NotNil(t, packet)\n\tassert.NotNil(t, packet.ErrorLayer())\n\n\t// Bad baseline message length\n\tbadBaselineMsgLength := \"000C440A010C01000400800003010000\" +\n\t\t\"00000000000000000000000000000000\" +\n\t\t\"000000000000000000000029\"\n\n\tdata, err = stringToPacket(badBaselineMsgLength)\n\tassert.NoError(t, err)\n\tpacket = gopacket.NewPacket(data, LayerTypeOMCI, gopacket.NoCopy)\n\tassert.NotNil(t, packet)\n\tassert.NotNil(t, packet.ErrorLayer())\n\n\t// Bad extended message length\n\tbadExtendedMsgLength := \"000C440B010C010000290400800003010000\" +\n\t\t\"00000000000000000000000000000000\" +\n\t\t\"00000000000000000000\"\n\n\tdata, err = stringToPacket(badExtendedMsgLength)\n\tassert.NoError(t, err)\n\tpacket = gopacket.NewPacket(data, LayerTypeOMCI, gopacket.NoCopy)\n\tassert.NotNil(t, packet)\n\tassert.NotNil(t, packet.ErrorLayer())\n\n\t// Huge extended message length\n\thugeExtendedMsgLength := \"000C440B010C010007BD0400800003010000\" +\n\t\t\"00000000000000000000000000000000\" +\n\t\t\"00000000000000000000\"\n\n\tdata, err = stringToPacket(hugeExtendedMsgLength)\n\tassert.NoError(t, err)\n\tpacket = gopacket.NewPacket(data, LayerTypeOMCI, gopacket.NoCopy)\n\tassert.NotNil(t, packet)\n\tassert.NotNil(t, packet.ErrorLayer())\n}", "title": "" }, { "docid": "25448fb481682eace0df414388ddf697", "score": "0.44170427", "text": "func (E_SrlNokiaIfIp_AnycastGwMacOrigin) IsYANGGoEnum() {}", "title": "" }, { "docid": "0c85cfe218c5f7ebd787f834c80f9da0", "score": "0.4413797", "text": "func (fm *FieldModelEnumChar) Verify() bool { return true }", "title": "" }, { "docid": "2a787e3b09e4f19dd341f1e0221ccf9f", "score": "0.44120064", "text": "func TestFIBeneficiaryFIAdviceLineFiveAlphaNumeric(t *testing.T) {\n\tfibfia := mockFIBeneficiaryFIAdvice()\n\tfibfia.Advice.LineFive = \"®\"\n\n\terr := fibfia.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"LineFive\", ErrNonAlphanumeric, fibfia.Advice.LineFive).Error())\n}", "title": "" }, { "docid": "ad10c3089b500ac2fcb2f85feb7eac5f", "score": "0.44027317", "text": "func (a *UESecurityCapability) GetIei() (iei uint8) {}", "title": "" }, { "docid": "8e132b5762dbf823197e2c036704052a", "score": "0.4400149", "text": "func TestCoverage(t *testing.T) {\n\tConvey(\"Cover inaccessible code paths\", t, func() {\n\t\tConvey(\"Malformed received HMAC hex\", func() {\n\t\t\tSo(check_hmac([]byte(\"SWORDFISH\"), \"xyzzy\", \"whatever\"), ShouldBeFalse)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "247de69e179b578260f598e2b0daf510", "score": "0.43979898", "text": "func TestInstructingFIAddressLineOneAlphaNumeric(t *testing.T) {\n\tbfi := mockInstructingFI()\n\tbfi.FinancialInstitution.Address.AddressLineOne = \"®\"\n\n\terr := bfi.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"AddressLineOne\", ErrNonAlphanumeric, bfi.FinancialInstitution.Address.AddressLineOne).Error())\n}", "title": "" }, { "docid": "3e91f577f09ffeb74b6e29736ad07060", "score": "0.43946674", "text": "func TestVerifyHMAC(t *testing.T) {\n\tkey := []byte(\"DOZDgBdMhGLImnk0BGYgOUI+h1n7U+OdxcZPctMbeFCsuAom2aFU4JPV4Qj11hbcb5yaM4WDuNP/3B7b+BnFhw==\")\n\tvar tests = []struct {\n\t\tinput []byte\n\t\texpected []byte\n\t\tpass bool\n\t}{\n\t\t{[]byte{18, 144}, []byte{188, 172, 214, 59, 3, 185, 57, 113, 68, 244, 55, 50, 30, 114, 166, 217, 178, 131, 203, 179, 164, 23, 95, 22, 155, 150, 204, 234, 204, 61, 215, 227, 34, 239, 116, 239, 239, 135, 104, 98, 220, 111, 227, 149, 217, 122, 101, 157, 37, 116, 120, 116, 13, 237, 238, 125, 173, 38, 116, 228, 0, 5, 109, 161}, true},\n\t\t{[]byte{18, 144}, []byte{188, 172, 214, 59, 3, 185, 57, 113, 68, 244, 55, 50, 30, 114, 166, 217, 178, 131, 203, 179, 164, 23, 95, 22, 155, 150, 204, 234, 204, 61, 215, 227, 34, 239, 116, 239, 239, 135, 104, 98, 220, 111, 227, 149, 217, 122, 101, 157, 37, 116, 120, 116, 13, 237, 238, 125, 173, 38, 116, 228, 0, 5, 109, 8}, false},\n\t\t{[]byte{2, 144}, []byte{188, 172, 214, 59, 3, 185, 57, 113, 68, 244, 55, 50, 30, 114, 166, 217, 178, 131, 203, 179, 164, 23, 95, 22, 155, 150, 204, 234, 204, 61, 215, 227, 34, 239, 116, 239, 239, 135, 104, 98, 220, 111, 227, 149, 217, 122, 101, 157, 37, 116, 120, 116, 13, 237, 238, 125, 173, 38, 116, 228, 0, 5, 109, 161}, false},\n\t\t{[]byte{28, 139, 66, 249}, []byte{142, 144, 179, 31, 86, 98, 236, 244, 138, 217, 39, 119, 119, 176, 66, 89, 251, 183, 167, 151, 191, 219, 171, 197, 77, 133, 242, 207, 137, 249, 80, 66, 242, 245, 200, 105, 202, 49, 153, 189, 3, 231, 153, 125, 165, 14, 34, 169, 151, 50, 226, 129, 97, 118, 95, 121, 37, 216, 248, 176, 254, 54, 15, 134}, true},\n\t\t{[]byte{47, 5, 71, 14, 100, 105, 224, 166}, []byte{52, 196, 147, 117, 93, 31, 250, 6, 178, 226, 16, 150, 145, 74, 38, 33, 26, 132, 158, 8, 157, 50, 223, 232, 110, 217, 67, 38, 46, 222, 4, 33, 78, 89, 7, 179, 26, 107, 79, 88, 189, 175, 51, 181, 127, 12, 183, 220, 127, 218, 53, 12, 233, 196, 186, 127, 248, 127, 8, 228, 209, 236, 124, 239}, true},\n\t\t{[]byte{126, 139, 249, 41, 122, 74, 67, 128, 232, 100, 76, 62, 126, 68, 136, 228}, []byte{158, 9, 177, 189, 9, 148, 175, 217, 151, 219, 116, 206, 188, 229, 46, 124, 181, 176, 243, 111, 52, 171, 179, 134, 68, 217, 49, 226, 97, 93, 17, 157, 36, 189, 51, 14, 220, 75, 189, 224, 206, 1, 84, 173, 193, 68, 195, 52, 110, 157, 5, 113, 45, 88, 164, 137, 115, 11, 104, 227, 17, 188, 203, 149}, true},\n\t\t{[]byte{165, 151, 79, 126, 203, 85, 84, 240, 36, 116, 1, 34, 20, 186, 13, 135, 57, 24, 198, 58, 144, 225, 161, 33, 58, 230, 113, 116, 25, 238, 124, 71}, []byte{124, 178, 171, 82, 57, 21, 12, 193, 209, 0, 234, 236, 137, 26, 59, 71, 250, 199, 29, 2, 179, 4, 95, 124, 188, 36, 105, 223, 230, 249, 248, 29, 155, 9, 129, 90, 125, 117, 189, 235, 212, 149, 38, 155, 112, 182, 211, 241, 158, 150, 252, 208, 138, 165, 136, 202, 10, 7, 194, 157, 228, 234, 131, 47}, true},\n\t\t{[]byte{165, 151, 79, 126, 203, 85, 84, 240, 36, 116, 1, 34, 20, 186, 13, 135, 57, 24, 198, 58, 144, 225, 161, 33, 58, 230, 113, 116, 25, 238, 124, 71}, []byte{124, 178, 171, 82, 57, 21, 12, 193, 209, 0, 234, 236, 137, 26, 59, 71, 250, 199, 29, 2, 179, 4, 95, 124, 188, 36, 105, 223, 230, 249, 248, 29, 155, 9, 129, 90, 125, 117, 189, 235, 212, 149, 38, 155, 112, 182, 211, 241, 158, 150, 252, 208, 138, 165, 136, 202, 10, 7, 194, 157, 228, 234, 131, 8}, false},\n\t\t{[]byte{2, 151, 79, 126, 203, 85, 84, 240, 36, 116, 1, 34, 20, 186, 13, 135, 57, 24, 198, 58, 144, 225, 161, 33, 58, 230, 113, 116, 25, 238, 124, 71}, []byte{124, 178, 171, 82, 57, 21, 12, 193, 209, 0, 234, 236, 137, 26, 59, 71, 250, 199, 29, 2, 179, 4, 95, 124, 188, 36, 105, 223, 230, 249, 248, 29, 155, 9, 129, 90, 125, 117, 189, 235, 212, 149, 38, 155, 112, 182, 211, 241, 158, 150, 252, 208, 138, 165, 136, 202, 10, 7, 194, 157, 228, 234, 131, 47}, false},\n\t\t{[]byte{233, 205, 185, 131, 206, 50, 24, 128, 178, 172, 45, 67, 200, 64, 109, 30, 212, 115, 192, 108, 35, 89, 100, 131, 145, 62, 201, 55, 84, 251, 193, 146, 107, 213, 81, 191, 105, 198, 12, 88, 57, 150, 160, 214, 22, 63, 115, 188, 154, 72, 152, 49, 31, 43, 27, 1, 21, 154, 29, 228, 223, 250, 57, 133}, []byte{67, 3, 175, 22, 32, 15, 99, 67, 58, 13, 137, 218, 184, 137, 129, 93, 106, 55, 177, 141, 139, 124, 33, 80, 205, 18, 102, 151, 31, 172, 221, 145, 144, 5, 49, 228, 147, 167, 208, 207, 105, 245, 121, 208, 38, 23, 58, 105, 172, 171, 102, 177, 86, 84, 229, 134, 222, 41, 35, 139, 229, 215, 4, 107}, true},\n\t\t{[]byte{189, 152, 232, 118, 226, 112, 112, 95, 164, 32, 239, 130, 202, 211, 207, 5, 244, 179, 124, 103, 101, 53, 66, 231, 17, 18, 245, 120, 47, 110, 219, 55, 255, 181, 201, 240, 201, 195, 243, 40, 219, 228, 23, 17, 12, 222, 72, 169, 242, 136, 242, 77, 196, 218, 173, 74, 176, 152, 191, 38, 54, 25, 35, 254, 132, 184, 1, 50, 204, 0, 49, 241, 64, 230, 245, 78, 104, 142, 85, 184, 187, 165, 136, 41, 46, 166, 56, 246, 40, 7, 123, 162, 181, 192, 250, 87, 198, 13, 188, 125, 112, 205, 205, 192, 247, 124, 253, 94, 14, 202, 249, 222, 59, 38, 174, 60, 164, 168, 215, 14, 30, 142, 0, 233, 95, 45, 10, 14}, []byte{58, 44, 38, 68, 20, 120, 29, 236, 163, 237, 239, 134, 16, 173, 228, 170, 170, 80, 86, 91, 211, 42, 177, 87, 217, 30, 27, 148, 49, 224, 28, 101, 139, 43, 11, 252, 77, 13, 78, 13, 149, 135, 165, 208, 108, 78, 42, 80, 60, 174, 47, 39, 41, 131, 170, 63, 231, 6, 84, 30, 79, 98, 26, 91}, true},\n\t\t{[]byte{189, 152, 232, 118, 226, 112, 112, 95, 164, 32, 239, 130, 202, 211, 207, 5, 244, 179, 124, 103, 101, 53, 66, 231, 17, 18, 245, 120, 47, 110, 219, 55, 255, 181, 201, 240, 201, 195, 243, 40, 219, 228, 23, 17, 12, 222, 72, 169, 242, 136, 242, 77, 196, 218, 173, 74, 176, 152, 191, 38, 54, 25, 35, 254, 132, 184, 1, 50, 204, 0, 49, 241, 64, 230, 245, 78, 104, 142, 85, 184, 187, 165, 136, 41, 46, 166, 56, 246, 40, 7, 123, 162, 181, 192, 250, 87, 198, 13, 188, 125, 112, 205, 205, 192, 247, 124, 253, 94, 14, 202, 249, 222, 59, 38, 174, 60, 164, 168, 215, 14, 30, 142, 0, 233, 95, 45, 10, 14}, []byte{58, 44, 38, 68, 20, 120, 29, 236, 163, 237, 239, 134, 16, 173, 228, 170, 170, 80, 86, 91, 211, 42, 177, 87, 217, 30, 27, 148, 49, 224, 28, 101, 139, 43, 11, 252, 77, 13, 78, 13, 149, 135, 165, 208, 108, 78, 42, 80, 60, 174, 47, 39, 41, 131, 170, 63, 231, 6, 84, 30, 79, 98, 26, 8}, false},\n\t\t{[]byte{2, 152, 232, 118, 226, 112, 112, 95, 164, 32, 239, 130, 202, 211, 207, 5, 244, 179, 124, 103, 101, 53, 66, 231, 17, 18, 245, 120, 47, 110, 219, 55, 255, 181, 201, 240, 201, 195, 243, 40, 219, 228, 23, 17, 12, 222, 72, 169, 242, 136, 242, 77, 196, 218, 173, 74, 176, 152, 191, 38, 54, 25, 35, 254, 132, 184, 1, 50, 204, 0, 49, 241, 64, 230, 245, 78, 104, 142, 85, 184, 187, 165, 136, 41, 46, 166, 56, 246, 40, 7, 123, 162, 181, 192, 250, 87, 198, 13, 188, 125, 112, 205, 205, 192, 247, 124, 253, 94, 14, 202, 249, 222, 59, 38, 174, 60, 164, 168, 215, 14, 30, 142, 0, 233, 95, 45, 10, 14}, []byte{58, 44, 38, 68, 20, 120, 29, 236, 163, 237, 239, 134, 16, 173, 228, 170, 170, 80, 86, 91, 211, 42, 177, 87, 217, 30, 27, 148, 49, 224, 28, 101, 139, 43, 11, 252, 77, 13, 78, 13, 149, 135, 165, 208, 108, 78, 42, 80, 60, 174, 47, 39, 41, 131, 170, 63, 231, 6, 84, 30, 79, 98, 26, 91}, false},\n\t}\n\n\tfor idx, tt := range tests {\n\t\tz := verifyHMAC(&tt.input, &tt.expected, &key)\n\n\t\tif tt.pass != z {\n\t\t\tt.Errorf(\"test #%d failed; pass: %t, verifyHMAC: %t, input: %v, expected: %v\", idx+1, tt.pass, z, tt.input, tt.expected)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "83430cf1db3b3f26239eff0c0684f136", "score": "0.43929294", "text": "func (s Server) GetInterfaceFromMac(mac string) (Interface, error) {\n\tvar intface Interface\n\tfor _, ife := range s.Interfaces {\n\t\tif strings.ToLower(ife.MACAddr) == strings.ToLower(mac) {\n\t\t\tintface = ife\n\t\t\treturn intface, nil\n\t\t}\n\t}\n\treturn intface, errors.New(\"Error interface not found, please try a different mac address.\")\n}", "title": "" }, { "docid": "954685795d7e5bc853fc2aceaf516898", "score": "0.43924546", "text": "func LoadIpAndMac(netConf *types.NetConf) (bool) {\n\tvar found bool\n\tvar data []byte\n\tvar err error\n\t\n\tif netConf.HostNicFile != \"\" {\n\t\tlogging.Debugf(\"LoadIpAndMac - netConf.HostNicFile=%s\", netConf.HostNicFile)\n\t\tdata, err = ioutil.ReadFile(netConf.HostNicFile)\n\t\tif err != nil {\n\t\t\tlogging.Debugf(\"LoadIpAndMac - Failed to read input file - %v\", err)\n\t\t\treturn found\n\t\t}\n\n\t\tmappingTable := make([]PciMapping,0)\n\t\tif err = json.Unmarshal(data, &mappingTable); err != nil {\n\t\t\tlogging.Debugf(\"LoadIpAndMac - Failed to Unmarshal - %v\", err)\n\t\t\treturn found\n\t\t}\n\n\t\tlogging.Debugf(\"LoadIpAndMac - Loaded: DeviceID=%s\", netConf.DeviceID)\n\t\tfor _, vdpaIface := range mappingTable {\n\t\t\tlogging.Debugf(\" PCI: %s IPAddr: %s IPMask: %s MAC: %s\",\n\t\t\t\tvdpaIface.PciAddress, vdpaIface.IpAddr, vdpaIface.IpMask, vdpaIface.Mac)\n\t\t\tif netConf.DeviceID == vdpaIface.PciAddress {\n\t\t\t\tlogging.Debugf(\"LoadIpAndMac - Found\")\n\t\t\t\tfound = true\n\t\t\t\tnetConf.IP = vdpaIface.IpAddr\n\t\t\t\tnetConf.IPMask = vdpaIface.IpMask\n\t\t\t\tnetConf.MAC = vdpaIface.Mac\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlogging.Debugf(\"LoadIpAndMac - File not provided.\")\n\t}\n\n\treturn found\n}", "title": "" }, { "docid": "6ce0df0b13eaf48964311748dd66a1d7", "score": "0.43902424", "text": "func TestInvalidUTF8(t *testing.T) {\n\tattributes1 := GenericPasswordAttributes{\n\t\tServiceName: \"osxkeychain_test with invalid UTF-8 \\xc3\\x28\",\n\t\tAccountName: \"test account\",\n\t}\n\n\terrServiceName := \"ServiceName is not a valid UTF-8 string\"\n\n\terr := AddGenericPassword(&attributes1)\n\tif err.Error() != errServiceName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errServiceName, err)\n\t}\n\n\t_, err = FindGenericPassword(&attributes1)\n\tif err.Error() != errServiceName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errServiceName, err)\n\t}\n\n\terr = RemoveAndAddGenericPassword(&attributes1)\n\tif err.Error() != errServiceName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errServiceName, err)\n\t}\n\n\terr = FindAndRemoveGenericPassword(&attributes1)\n\tif err.Error() != errServiceName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errServiceName, err)\n\t}\n\n\tattributes2 := GenericPasswordAttributes{\n\t\tServiceName: \"osxkeychain_test\",\n\t\tAccountName: \"test account with invalid UTF-8 \\xc3\\x28\",\n\t}\n\n\terrAccountName := \"AccountName is not a valid UTF-8 string\"\n\n\terr = AddGenericPassword(&attributes2)\n\tif err.Error() != errAccountName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errAccountName, err)\n\t}\n\n\t_, err = FindGenericPassword(&attributes2)\n\tif err.Error() != errAccountName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errAccountName, err)\n\t}\n\n\terr = RemoveAndAddGenericPassword(&attributes2)\n\tif err.Error() != errAccountName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errAccountName, err)\n\t}\n\n\terr = FindAndRemoveGenericPassword(&attributes2)\n\tif err.Error() != errAccountName {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got %v\", errAccountName, err)\n\t}\n}", "title": "" }, { "docid": "9fcf062f1cb58383ee31adb9ea9758d6", "score": "0.43805563", "text": "func GetIntfMac(intfName string) (net.HardwareAddr, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "4bbd7530250f8f3118f38404ca6cc55b", "score": "0.4380123", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_Interface_OperMacLearningDisabledReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "05a74cbb85b5f04294f4e40320baa0f9", "score": "0.43715534", "text": "func GenerateMac() string {\n\tprefix := \"00:00:00\"\n\tnewRand := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tmac := fmt.Sprintf(\"%s:%02X:%02X:%02X\", prefix, newRand.Intn(255), newRand.Intn(255), newRand.Intn(255))\n\treturn mac\n}", "title": "" }, { "docid": "2f588887e324dcc0d824173b0e597f1c", "score": "0.43712014", "text": "func (o *ManagementInterfaceAllOf) HasMacAddress() bool {\n\tif o != nil && o.MacAddress != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
e92c5a96e7d90a6cfd98dd0105bb1558
PutCF queues a keyvalue pair in a column family.
[ { "docid": "63fa1994a6abb04ad55f2948bf645600", "score": "0.7338676", "text": "func (wb *WriteBatch) PutCF(cf *ColumnFamilyHandle, key, value []byte) {\n\tnewsize := (uint64(len(key)) + uint64(len(value)))\n\tif _, ok := wb.sizes[cf.Name]; ok {\n\t\twb.sizes[cf.Name] += newsize\n\t} else {\n\t\twb.sizes[cf.Name] = newsize\n\t}\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_put_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" } ]
[ { "docid": "0b88ee313e6a89eb45a1ec86508d81d7", "score": "0.7530578", "text": "func (db *DB) PutCF(wo *WriteOptions, cf *ColumnFamilyHandle, key, value []byte) error {\n\tcKey := bytesToChar(key)\n\tcValue := bytesToChar(value)\n\tvar cErr *C.char\n\tC.rocksdb_put_cf(db.c, wo.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\tif cErr != nil {\n\t\tdefer C.free(unsafe.Pointer(cErr))\n\t\treturn errors.New(C.GoString(cErr))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e16945e55bcb16ec7f6fec594bc53b9d", "score": "0.74179167", "text": "func (db *DB) PutCF(opts *WriteOptions, cf *ColumnFamilyHandle, key, value []byte) (err error) {\n\tvar (\n\t\tcErr *C.char\n\t\tcKey = byteToChar(key)\n\t\tcValue = byteToChar(value)\n\t)\n\n\tC.rocksdb_put_cf(db.c, opts.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "92405a9f720b44adf6a18f5bae881587", "score": "0.74107116", "text": "func (wb *WriteBatch) PutCF(cf *ColumnFamilyHandle, key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_put_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "eb527272eb1fd0834d6863fbb8234994", "score": "0.7133018", "text": "func (wb *WriteBatchWithIndex) PutCF(cf *ColumnFamilyHandle, key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_wi_put_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "065c7f627aee32b8b12677d95729f8a4", "score": "0.6621324", "text": "func (wb *WriteBatch) PutVCF(cf *ColumnFamilyHandle, keys, values [][]byte) {\n\tvar (\n\t\tcKeys, cKeysSize = byteSlicesToCSlices(keys)\n\t\tcValues, cValuesSize = byteSlicesToCSlices(values)\n\t)\n\tdefer cKeys.Destroy()\n\tdefer cValues.Destroy()\n\n\tC.rocksdb_writebatch_putv_cf(\n\t\twb.c,\n\t\tcf.c,\n\t\tC.int(len(keys)),\n\t\tcKeys.c(),\n\t\tcKeysSize.c(),\n\t\tC.int(len(values)),\n\t\tcValues.c(),\n\t\tcValuesSize.c(),\n\t)\n}", "title": "" }, { "docid": "eb95e6b1452c76dd69f6323b204a1377", "score": "0.6309308", "text": "func (wb *WriteBatchWithIndex) PutVCF(cf *ColumnFamilyHandle, keys, values [][]byte) {\n\tvar (\n\t\tcKeys, cKeysSize = byteSlicesToCSlices(keys)\n\t\tcValues, cValuesSize = byteSlicesToCSlices(values)\n\t)\n\tdefer cKeys.Destroy()\n\tdefer cValues.Destroy()\n\n\tC.rocksdb_writebatch_wi_putv_cf(\n\t\twb.c,\n\t\tcf.c,\n\t\tC.int(len(keys)),\n\t\tcKeys.c(),\n\t\tcKeysSize.c(),\n\t\tC.int(len(values)),\n\t\tcValues.c(),\n\t\tcValuesSize.c(),\n\t)\n}", "title": "" }, { "docid": "fa8313e16d3db9e18f7e34c6d68dbda7", "score": "0.5863919", "text": "func (db *DB) PutCFWithTS(opts *WriteOptions, cf *ColumnFamilyHandle, key, ts, value []byte) (err error) {\n\tvar (\n\t\tcErr *C.char\n\t\tcKey = byteToChar(key)\n\t\tcValue = byteToChar(value)\n\t\tcTs = byteToChar(ts)\n\t)\n\n\tC.rocksdb_put_cf_with_ts(db.c, opts.c, cf.c, cKey, C.size_t(len(key)), cTs, C.size_t(len(ts)), cValue, C.size_t(len(value)), &cErr)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "6fb8776a4ab2b4ff76b7ba6e9cbebc55", "score": "0.5813813", "text": "func put(conn redis.Conn, queue <-chan map[string]string) {\n\tfor batch := range queue {\n\t\tfor key, value := range batch {\n\t\t\tconn.Send(\"RESTORE\", key, \"0\", value)\n\t\t}\n\t\t_, err := conn.Do(\"\")\n\t\thandle(err)\n\n\t\tfmt.Printf(\".\")\n\t}\n}", "title": "" }, { "docid": "b554275e4762e646861e3e8304e60b1f", "score": "0.5733095", "text": "func (txn *MvccTxn) PutValue(key []byte, value []byte) {\n\t// Your Code Here (4A).\n\ttxn.writes = append(txn.writes, storage.Modify{\n\t\tData: storage.Put{\n\t\t\tKey: EncodeKey(key, txn.StartTS),\n\t\t\tValue: value,\n\t\t\tCf: engine_util.CfDefault,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "9c35c7659286be8b4046a4ae48c76bd0", "score": "0.5682084", "text": "func (o *CMFFamily) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no cmf_family provided for insertion\")\n\t}\n\n\tvar err error\n\n\tif err := o.doBeforeInsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(cmfFamilyColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tcmfFamilyInsertCacheMut.RLock()\n\tcache, cached := cmfFamilyInsertCache[key]\n\tcmfFamilyInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tcmfFamilyAllColumns,\n\t\t\tcmfFamilyColumnsWithDefault,\n\t\t\tcmfFamilyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(cmfFamilyType, cmfFamilyMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(cmfFamilyType, cmfFamilyMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO `cmf_family` (`%s`) %%sVALUES (%s)%%s\", strings.Join(wl, \"`,`\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO `cmf_family` () VALUES ()%s%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tcache.retQuery = fmt.Sprintf(\"SELECT `%s` FROM `cmf_family` WHERE %s\", strings.Join(returnColumns, \"`,`\"), strmangle.WhereClause(\"`\", \"`\", 0, cmfFamilyPrimaryKeyColumns))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into cmf_family\")\n\t}\n\n\tvar lastID int64\n\tvar identifierCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == cmfFamilyMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.ID,\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, identifierCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, identifierCols...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for cmf_family\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcmfFamilyInsertCacheMut.Lock()\n\t\tcmfFamilyInsertCache[key] = cache\n\t\tcmfFamilyInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "37b12aeec4e75f470d422ae3eeccb2eb", "score": "0.56532", "text": "func (s *CassandraStore) Set(key string, value []byte, ttl int) error {\n\tquery := fmt.Sprintf(`INSERT INTO \"%s\".\"%s\" (key, value) VALUES (?,?) USING TTL ?`, s.Keyspace, s.Table)\n\treturn s.session.Query(query, key, value, ttl).Consistency(gocql.LocalQuorum).Exec()\n}", "title": "" }, { "docid": "9e928f2cf5b43e32c707f1a6979c8295", "score": "0.56226337", "text": "func (q RedisQueue) Put(queue, key string, value []byte, options interface{}) error {\n\tvar err error\n\n\tconn := q.r.pool.Get()\n\tdefer conn.Close()\n\n\t_, err = conn.Do(\"RPUSH\", queue, value)\n\n\treturn err\n}", "title": "" }, { "docid": "4b537a6e80f7b481084ce69c7b2e435b", "score": "0.5602411", "text": "func (dht *IpfsDHT) handlePutValue(p *peer.Peer, pmes *PBDHTMessage) {\n\tdskey := ds.NewKey(pmes.GetKey())\n\terr := dht.datastore.Put(dskey, pmes.GetValue())\n\tif err != nil {\n\t\t// For now, just panic, handle this better later maybe\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "7d049b38058c002b5614ff4b4d0c7822", "score": "0.5599525", "text": "func (f *FDBBackend) Put(ctx context.Context, entry *physical.Entry) error {\n\tdefer metrics.MeasureSince([]string{\"foundationdb\", \"put\"}, time.Now())\n\n\tdecoratedPath, err := decoratePath(entry.Key)\n\tif err != nil {\n\t\treturn errwrap.Wrapf(fmt.Sprintf(\"could not build decorated path to put item %s: {{err}}\", entry.Key), err)\n\t}\n\n\t_, err = f.db.Transact(func(tr fdb.Transaction) (interface{}, error) {\n\t\terr := f.internalPut(tr, decoratedPath, entry.Key, entry.Value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, nil\n\t})\n\n\tif err != nil {\n\t\treturn errwrap.Wrapf(fmt.Sprintf(\"put failed for item %s: {{err}}\", entry.Key), err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "71bba15dc014e4cf3f6023e40598c122", "score": "0.5517161", "text": "func (database *Boltdb) Put(key string, value interface{}) {\n\tdb := database.db\n\tif db == nil {\n\t\tlog.Fatal(\"database is not opened yet.\")\n\t\treturn\n\t}\n\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\tbucket, err := tx.CreateBucketIfNotExists([]byte(\"my_bucket\"))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\treturn nil\n\t\t}\n\t\tif str, ok := value.(string); ok {\n\t\t\terr = bucket.Put([]byte(key), []byte(str))\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatal(\"couldn't convert input to bytearray\")\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "7affdbee6d74a1f693a430206eb8d13e", "score": "0.5493808", "text": "func (db *DB) FlushCF(cf *ColumnFamilyHandle, opts *FlushOptions) (err error) {\n\tvar cErr *C.char\n\n\tC.rocksdb_flush_cf(db.c, opts.c, cf.c, &cErr)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "9d64b487643e6274be3bdff27419ec05", "score": "0.54698116", "text": "func (bdb *BoltDB) Put(key string, value interface{}) error {\n\n\tdb, err := bdb.open()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar buf bytes.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(value); err != nil {\n\t\treturn err\n\t}\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\treturn tx.Bucket(bucketName).Put([]byte(key), buf.Bytes())\n\t})\n\n\t// If an error occurs on close we won't see it\n\tdb.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "ea089bf2cb83f0de7327d016aac199cb", "score": "0.5433765", "text": "func (wb *WriteBatch) Put(key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_put(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "ea089bf2cb83f0de7327d016aac199cb", "score": "0.5433765", "text": "func (wb *WriteBatch) Put(key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_put(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "1a432708884b6cea8134c439d8dd32ac", "score": "0.53653854", "text": "func HustdbPut(backend string, args map[string][]byte, val []byte, retChan chan *HustdbResponse) {\n\turl := ComposeUrl(backend, \"put\", args)\n\thttpCode, _, _ := HttpPost(url, val)\n\tretChan <- &HustdbResponse{Code: httpCode, Backend: backend}\n}", "title": "" }, { "docid": "0439542c48831132534951f84bee6e02", "score": "0.5361967", "text": "func (k *KRPC) MPut(addr *net.UDPAddr, value string, pbk []byte, sig []byte, seq int, cas int, salt string, writeToken string, onResponse func(kmsg.Msg)) (*socket.Tx, error) {\n\ta := map[string]interface{}{\n\t\t\"token\": writeToken,\n\t\t\"v\": value,\n\t\t\"sig\": sig,\n\t\t\"k\": pbk,\n\t\t\"seq\": seq,\n\t\t\"cas\": cas,\n\t\t\"salt\": salt,\n\t}\n\treturn k.Query(addr, kmsg.QPut, a, onResponse)\n}", "title": "" }, { "docid": "e2d96e16cbcd6f4c5e598654a1782a91", "score": "0.53413254", "text": "func puts(args ...[]byte) error {\n\ttx, err := client.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := 0; i < len(args); i += 2 {\n\t\tkey, val := args[i], args[i+1]\n\t\terr := tx.Set(key, val)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn tx.Commit(context.Background())\n}", "title": "" }, { "docid": "662937d8ab74a15178872efa81c9c7dc", "score": "0.5326046", "text": "func (b *ShardsBuilder) Put(hash64 uint64, offset uint64) (err error) {\n\tshardId, key := calcShard(hash64)\n\tlittleEndianPutOffset(vBuf, offset)\n\treturn b[shardId].Put(key, vBuf)\n}", "title": "" }, { "docid": "0e1ec9f968cfa2639ff9c6f3df26bb45", "score": "0.5325815", "text": "func (b *mbatch) Put(key, value []byte) error {\n\tb.bsm.Lock()\n\tdefer b.bsm.Unlock()\n\n\tb.ops = append(b.ops, &bop{\n\t\to: opPut,\n\t\tk: key,\n\t\tv: value,\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "ccb1141709c77067e9a3ee0278a1d73b", "score": "0.5304777", "text": "func DatabasePut(family string, key string, value string) Command {\n\treturn &databasePutCommand{\n\t\tfamily: family,\n\t\tkey: key,\n\t\tvalue: value,\n\t}\n}", "title": "" }, { "docid": "37e822003f28029421ef344424daac6e", "score": "0.53031665", "text": "func (db *DB) Put(wo *WriteOptions, key, value []byte) error {\n\tcKey := bytesToChar(key)\n\tcValue := bytesToChar(value)\n\tvar cErr *C.char\n\tC.rocksdb_put(db.c, wo.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\tif cErr != nil {\n\t\tdefer C.free(unsafe.Pointer(cErr))\n\t\treturn errors.New(C.GoString(cErr))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fedfb484a15cdaa596c41d6e3e9492ff", "score": "0.5302591", "text": "func (db *DB) Put(args *proto.PutRequest) <-chan *proto.PutResponse {\n\t// Init the value checksum if not set by requesting client.\n\targs.Value.InitChecksum(args.Key)\n\treplyChan := make(chan *proto.PutResponse, 1)\n\tgo db.executeCmd(storage.Put, args, replyChan)\n\treturn replyChan\n}", "title": "" }, { "docid": "487057acde1a3e58a7ba53ee7c53f017", "score": "0.52985287", "text": "func Put(ctx interface{}, key string, value interface{}) {}", "title": "" }, { "docid": "b9b027fe14ad338f7a373bf9f7ed44db", "score": "0.5295279", "text": "func (r SSDBCache) Put(call, key string, value []byte, options interface{}) error {\n\tvar err error\n\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\tttl := 0\n\tif options, ok := options.(PutOptions); ok {\n\t\tttl = int(options.TTL / time.Second)\n\t}\n\n\tif ttl > 0 {\n\t\t_, err = conn.Do(\"SETX\", key, value, ttl)\n\t} else {\n\t\t_, err = conn.Do(\"SET\", key, value)\n\t}\n\n\treturn err\n\n}", "title": "" }, { "docid": "494343ce6b2e14dafb2043149bc9adc7", "score": "0.52805626", "text": "func (t *Table) Put(rv reflect.Value, pk int) (e error) {\n\n\t// add to chunk\n\tc, e := t.chunk.Put(strconv.Itoa(pk), rv.Interface())\n\tif e != nil {\n\t\treturn\n\t}\n\tif e = t.chunk.flushChunk(c); e != nil {\n\t\treturn\n\t}\n\n\t// add to pk index\n\tt.pkIndex.Put(pk)\n\tif e = t.pkIndex.Flush(); e != nil {\n\t\treturn\n\t}\n\n\t// add values to index\n\tfor name, idx := range t.valueIndex {\n\t\tidx.Put(fmt.Sprintf(\"%v\", getReflectFieldValue(rv, name)), pk)\n\t\te = idx.Flush()\n\t\tif e != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "dbdc0cd9ee33ed67cc7911b5a1da45b6", "score": "0.5266776", "text": "func (a *addressbook) PutChequebook(peer swarm.Address, chequebook common.Address) error {\n\terr := a.store.Put(peerKey(peer), chequebook)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn a.store.Put(chequebookPeerKey(chequebook), peer)\n}", "title": "" }, { "docid": "7bb57d251897da1b46e66bcc799065ee", "score": "0.5261478", "text": "func (b *ByteChanPool) Put(value []byte) {\n\tselect {\n\tcase b.pool <- value:\n\t\t//put on pool\n\tdefault:\n\t\t//drop value\n\t}\n\treturn\n}", "title": "" }, { "docid": "6846fafb05f923afaae7e1b03bd8fa19", "score": "0.5256928", "text": "func (p ChMap) Set(key, value interface{}) {\n\tch := make(chan callBack, 1)\n\tdefer close(ch)\n\tp.chCallBack <- callBack{\n\t\tKey: key,\n\t\tValue: value,\n\t\tRoute: _Put,\n\t\tChBack: ch,\n\t}\n\t<-ch\n}", "title": "" }, { "docid": "f44a9fdea2104061df6c1df6fe74f016", "score": "0.5255943", "text": "func (sm *SafeMap) Put(key string, value interface{}) {\n\tsm.commandStream <- command{action: put, key: key, value: value}\n}", "title": "" }, { "docid": "0fb97c599662f66ce62056b3b2042a91", "score": "0.5234761", "text": "func (r *ROTx) Put(key, value []byte) {\n}", "title": "" }, { "docid": "3153f2c019dbe1fff413934a97c05295", "score": "0.5228891", "text": "func (pcs *persistentContiguousStorage) put(req Request) error {\n\t// Nil requests are ignored\n\tif req == nil {\n\t\treturn nil\n\t}\n\n\tpcs.mu.Lock()\n\tdefer pcs.mu.Unlock()\n\n\tif pcs.size() >= pcs.capacity {\n\t\tpcs.logger.Warn(\"Maximum queue capacity reached\", zap.String(zapQueueNameKey, pcs.queueName))\n\t\treturn errMaxCapacityReached\n\t}\n\n\titemKey := pcs.itemKey(pcs.writeIndex)\n\tpcs.writeIndex++\n\tpcs.itemsCount.Store(uint64(pcs.writeIndex - pcs.readIndex))\n\n\tctx := context.Background()\n\t_, err := newBatch(pcs).setItemIndex(writeIndexKey, pcs.writeIndex).setRequest(itemKey, req).execute(ctx)\n\n\t// Inform the loop that there's some data to process\n\tpcs.putChan <- struct{}{}\n\n\treturn err\n}", "title": "" }, { "docid": "3b301731cf8ceceab5738bbc6664253d", "score": "0.5225931", "text": "func (k *KRPC) Put(addr *net.UDPAddr, value, writeToken string, onResponse func(kmsg.Msg)) (*socket.Tx, error) {\n\ta := map[string]interface{}{\n\t\t\"token\": writeToken,\n\t\t\"v\": value,\n\t}\n\treturn k.Query(addr, kmsg.QPut, a, onResponse)\n}", "title": "" }, { "docid": "bf97da981cd332aa26e050b6f4a462d1", "score": "0.52153236", "text": "func (d *DataBase) write(bucket, key, value string) error {\r\n\terr := d.db.Update(func(tx *bbolt.Tx) error {\r\n\t\tb := tx.Bucket([]byte(bucket))\r\n\t\treturn b.Put([]byte(key), []byte(value))\r\n\t})\r\n\treturn err\r\n}", "title": "" }, { "docid": "9571d878d7f29791ea048c1b8aa80298", "score": "0.5212719", "text": "func (a *adapter) Put(contract uint32, topic, payload []byte) error {\n\tentry := unitdb.NewEntry(topic, payload)\n\tentry.WithContract(contract)\n\treturn a.db.PutEntry(entry)\n}", "title": "" }, { "docid": "7d45a72767dfcc139595fca5a72b7b88", "score": "0.5212522", "text": "func (db *DB) SetOptionsCF(cf *ColumnFamilyHandle, keys, values []string) (err error) {\n\tnumKeys := len(keys)\n\tif numKeys == 0 {\n\t\treturn nil\n\t}\n\n\tcKeys := make([]*C.char, numKeys)\n\tcValues := make([]*C.char, numKeys)\n\tfor i := range keys {\n\t\tcKeys[i] = C.CString(keys[i])\n\t\tcValues[i] = C.CString(values[i])\n\t}\n\n\tvar cErr *C.char\n\n\tC.rocksdb_set_options_cf(\n\t\tdb.c,\n\t\tcf.c,\n\t\tC.int(numKeys),\n\t\t&cKeys[0],\n\t\t&cValues[0],\n\t\t&cErr,\n\t)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "f7c186fc850c555acd0197ae984b32f5", "score": "0.5209239", "text": "func (b *ShardBuilder) Put(k, v []byte) (err error) {\n\t_, err = b.bufioWriter.Write(k[:kLen])\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = b.bufioWriter.Write(v[:vLen])\n\tif err != nil {\n\t\treturn\n\t}\n\tb.keycount++\n\treturn\n}", "title": "" }, { "docid": "e612de0ee78721676f2cf4560b02bf14", "score": "0.52091503", "text": "func (db *Database) Put(key, value []byte) (err error) {\n\tif !db.open || db.closing {\n\t\treturn ErrDatabaseClosed\n\t}\n\tif db.options.ReadOnly {\n\t\treturn ErrDataBaseReadOnly\n\t}\n\tif key == nil || len(key) == 0 {\n\t\treturn ErrKeyRequired\n\t}\n\tif value == nil || len(value) == 0 {\n\t\treturn ErrValueRequired\n\t}\n\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\tr := memfs.Record{\n\t\tKey: key,\n\t\tVal: value,\n\t}\n\terr = WriteLog(db.log, []byte(r.String()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif db.options.SyncWrite {\n\t\terr = db.log.Sync()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif db.memdb.Size() >= filterSize {\n\t\toldMemdb := db.memdb\n\t\tdb.writeKeysToFilter(oldMemdb)\n\t\terr := db.writeSSTable(oldMemdb)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to write data to sstable\")\n\t\t}\n\t\tdb.memdb = memfs.NewMemtable()\n\t\tif err = RotateLog(db); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to rotate log file\")\n\t\t}\n\n\t\tif err := db.fs.DeleteFile(MemdbFileName); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to delete memdb file\")\n\t\t}\n\n\t}\n\tdb.memdb.Insert(r)\n\n\treturn nil\n}", "title": "" }, { "docid": "5a94797e31563654e10347261e524900", "score": "0.52065575", "text": "func (m *PostgreSQLBackend) Put(ctx context.Context, entry *physical.Entry) error {\n\tdefer metrics.MeasureSince([]string{\"postgres\", \"put\"}, time.Now())\n\n\tm.permitPool.Acquire()\n\tdefer m.permitPool.Release()\n\n\tparentPath, path, key := m.splitKey(entry.Key)\n\n\t_, err := m.client.Exec(m.put_query, parentPath, path, key, entry.Value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef9f3c920aa1ab6f65cb23a7fdd8caf5", "score": "0.52062964", "text": "func (bs ByteStore) Put(bucket string, key string, value []byte) error {\n\n\terr := bs.BoltDB.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists([]byte(bucket))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = b.Put([]byte(key), value)\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "640bfa78a3baf7855cbdb8bd4f39e42c", "score": "0.5197451", "text": "func (m *ItemPrimaryChannelMessagesItemHostedContentsItemValueContentRequestBuilder) Put(ctx context.Context, body []byte, requestConfiguration *ItemPrimaryChannelMessagesItemHostedContentsItemValueContentRequestBuilderPutRequestConfiguration)([]byte, error) {\n requestInfo, err := m.ToPutRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.SendPrimitive(ctx, requestInfo, \"[]byte\", errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.([]byte), nil\n}", "title": "" }, { "docid": "6fdb3d063d19f05321f3ff5e0d30a093", "score": "0.5189564", "text": "func put(key string, value string, h string) {\n\n\tn := Data{val: value} //storing key value in keyValue hash map\n\tn.hash = h // storing key hash in keyHash hash map\n\n\tLocalkeyValue[key] = n\n\tkeyValue[key] = n\n}", "title": "" }, { "docid": "b0e45704d4decb813f6c706996dd3bde", "score": "0.51820856", "text": "func (b *queBatch) Put(item *QueItem) error {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tvar height [4]byte\n\tbinary.BigEndian.PutUint32(height[:], item.Height)\n\tvalue := append(item.NotifyId[:], item.TxId[:]...)\n\tb.Batch.Put(toKey(BKTQue, value...), height[:])\n\tb.Batch.Put(toKey(BKTQueIdx, append(height[:], value...)...), empty)\n\treturn nil\n}", "title": "" }, { "docid": "e6a2b9a1f5b88f14722e8c25a9fffd0d", "score": "0.51581484", "text": "func (st *ContextStack) Put(key string, value interface{}) (err *FsmError) {\n\tif st.Empty() {\n\t\terr = newFsmErrorRuntime(\"Can't put to empty context stack\", st)\n\t\treturn\n\t}\n\tst.Peek().Put(key, value)\n\treturn\n}", "title": "" }, { "docid": "df86b22ab0917e3a0817bf2f9624748d", "score": "0.5155481", "text": "func (dbPtr *NodeSet) Put(key []byte, value []byte) error {\n\tdbPtr.lock.Lock()\n\tdefer dbPtr.lock.Unlock()\n\n\tif _, ok := dbPtr.db[string(key)]; !ok {\n\t\tdbPtr.db[string(key)] = bgmcommon.CopyBytes(value)\n\t\tdbPtr.dataSize += len(value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c663eac3813fabb1bfd5e273d72ef82f", "score": "0.5153661", "text": "func (ck *Clerk) Put(key string, value string) {\n\tck.PutAppend(key, value, \"Put\")\n}", "title": "" }, { "docid": "c663eac3813fabb1bfd5e273d72ef82f", "score": "0.5153661", "text": "func (ck *Clerk) Put(key string, value string) {\n\tck.PutAppend(key, value, \"Put\")\n}", "title": "" }, { "docid": "c663eac3813fabb1bfd5e273d72ef82f", "score": "0.5153661", "text": "func (ck *Clerk) Put(key string, value string) {\n\tck.PutAppend(key, value, \"Put\")\n}", "title": "" }, { "docid": "c663eac3813fabb1bfd5e273d72ef82f", "score": "0.5153661", "text": "func (ck *Clerk) Put(key string, value string) {\n\tck.PutAppend(key, value, \"Put\")\n}", "title": "" }, { "docid": "5204ef12937657e847606d8c3418a7f3", "score": "0.5145267", "text": "func (wb *WriteBatch) MergeCF(cf *ColumnFamilyHandle, key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_merge_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "5204ef12937657e847606d8c3418a7f3", "score": "0.5145267", "text": "func (wb *WriteBatch) MergeCF(cf *ColumnFamilyHandle, key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_merge_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "4a14a500aa1d3c06bd70e7cd7593d095", "score": "0.5126008", "text": "func PutBDB(key []byte, value []byte, ifDelete []byte, bdb *badger.DB) error {\n\terr := bdb.Update(func(txn *badger.Txn) error {\n\t\terr := txn.Set(key, value)\n\t\tif err != nil {\n\t\t\tif ifDelete != nil {\n\t\t\t\ttxn.Delete(ifDelete)\n\t\t\t}\n\t\t}\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eefc5f1640f4387cd36fa8d402a266e2", "score": "0.51248574", "text": "func (c *Etcd2Backend) Put(ctx context.Context, entry *physical.Entry) error {\n\tdefer metrics.MeasureSince([]string{\"etcd\", \"put\"}, time.Now())\n\tvalue := base64.StdEncoding.EncodeToString(entry.Value)\n\n\tc.permitPool.Acquire()\n\tdefer c.permitPool.Release()\n\n\t_, err := c.kAPI.Set(context.Background(), c.nodePath(entry.Key), value, nil)\n\treturn err\n}", "title": "" }, { "docid": "b5a32764cd2af451f7722f4eaf8f399c", "score": "0.5124307", "text": "func (f *FixedHashMap) Set(key string, value interface{}) bool {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tif f.capacity <= f.count {\n\t\tlog.Print(\"At maximum capacity!\")\n\t\treturn false\n\t}\n\n\tif key == \"\" {\n\t\tlog.Print(\"Invalid input.\")\n\t\treturn false\n\t}\n\n\thashValue := hash(key, f.capacity*MULTIPLICATION_FACTOR)\n\tif f.keys[hashValue] == \"\" && f.values[hashValue] == nil {\n\t\tf.keys[hashValue] = key\n\t\tf.values[hashValue] = newBucket(value, key)\n\t\tf.count++\n\t\treturn true\n\t}\n\tif f.keys[hashValue] == key {\n\t\tf.values[hashValue].value = value\n\t\treturn true\n\t}\n\tfor e := f.values[hashValue]; e != nil; e = e.next {\n\t\tif e.key == key {\n\t\t\te.value = value\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f33fc701e5309f166c39bb1b457e84de", "score": "0.5118543", "text": "func (db *DB) Put(opts *WriteOptions, key, value []byte) (err error) {\n\tvar (\n\t\tcErr *C.char\n\t\tcKey = byteToChar(key)\n\t\tcValue = byteToChar(value)\n\t)\n\n\tC.rocksdb_put(db.c, opts.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "be191ce0d697afbfc881bac7db400910", "score": "0.51134974", "text": "func (n *Node) put(key string, value []byte) error {\n\tnode, err := n.locate(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif bytes.Compare(n.Id, node.Id) == 0 {\n\t\t// key belongs to current node\n\n\t\t// store kv in our datastore\n\t\tmyId := BytesToUint64(n.Id)\n\t\tn.rgsMtx.RLock()\n\t\tn.rgs[myId].data[key] = value\n\t\tn.rgsMtx.RUnlock()\n\n\t\t// send kv to our replica group\n\t\tn.sendReplica(key)\n\t\treturn nil\n\t} else {\n\t\t// key belongs to remote node\n\t\t_, err := n.PutRPC(node, key, value)\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "d6353988ca76d22f0cc8c5fb5dace079", "score": "0.50980467", "text": "func (c amqpHeadersCarrier) Set(key, val string) {\n\tc[key] = val\n}", "title": "" }, { "docid": "d6353988ca76d22f0cc8c5fb5dace079", "score": "0.50980467", "text": "func (c amqpHeadersCarrier) Set(key, val string) {\n\tc[key] = val\n}", "title": "" }, { "docid": "e218f1ea831f2d7d3f3a4b495ff62387", "score": "0.50976074", "text": "func Put(bucket string, key interface{}, value interface{}) error {\n\treturn ds.Update(func(tx *bolt.Tx) error {\n\t\tdsKey, err := json.Marshal(key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdsValue, err := json.Marshal(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn tx.Bucket([]byte(bucket)).Put(dsKey, dsValue)\n\t})\n}", "title": "" }, { "docid": "ce87255d0c0135efe48d7bde614e2e36", "score": "0.50958157", "text": "func Set(key, value string, ttl time.Duration) error {\r\n\tif db == nil {\r\n\t\treturn fmt.Errorf(\"database is not connected\")\r\n\t}\r\n\treturn db.Update(func(txn *badger.Txn) error {\r\n\t\tentry := badger.NewEntry([]byte(key), []byte(value))\r\n\t\tif ttl > 0 {\r\n\t\t\tentry = entry.WithTTL(ttl)\r\n\t\t}\r\n\r\n\t\treturn txn.SetEntry(entry)\r\n\t})\r\n}", "title": "" }, { "docid": "a59da93e7feb006ceaea9a0e49bf36a8", "score": "0.5094103", "text": "func (m LDBMap) BatchPut(key string, value string) {\n\t(*m.lock).Lock()\n\tdefer (*m.lock).Unlock()\n\n\tm.batch.Put([]byte(key), []byte(value))\n}", "title": "" }, { "docid": "7fc7e452d9e273a6fbf090013920e3d9", "score": "0.508584", "text": "func PutKV(db *bitcask.Bitcask, key, value string) (err error) {\n\terr = db.Put([]byte(key), []byte(value))\n\tif err != nil {\n\t\tlog.Printf(\"Error during inserting KV - %v\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4fd96e83529340da2e39b3785bc284cb", "score": "0.507869", "text": "func (db *DB) Set(bucket, key string, value interface{}) error {\n\tdb.Lock()\n\tdefer db.Unlock()\n\tbValue, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn db.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(bucket))\n\t\terr := b.Put([]byte(key), bValue)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "bcf7d493a012ce83b464279f4f899ce4", "score": "0.50734055", "text": "func (db *DB) MergeCF(opts *WriteOptions, cf *ColumnFamilyHandle, key []byte, value []byte) (err error) {\n\tvar (\n\t\tcErr *C.char\n\t\tcKey = byteToChar(key)\n\t\tcValue = byteToChar(value)\n\t)\n\n\tC.rocksdb_merge_cf(db.c, opts.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "50976b0e5af9398537273e07918928ec", "score": "0.5067995", "text": "func (s *CqlSetting) Put(site, name, value string) error {\n\tname = strings.ToLower(name)\n\n\terr := s.cql.Query(\"update setting set value=? where site=? and name=?\", value, site, name).Exec()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s.sites == nil {\n\t\ts.sites = make(map[string]map[string]string)\n\t}\n\n\tsm, exists := s.sites[site]\n\tif !exists {\n\t\tsm = make(map[string]string)\n\t\ts.sites[site] = sm\n\t}\n\n\ts.sites[site][name] = value\n\treturn nil\n}", "title": "" }, { "docid": "a827a2bbd7375f00d668f862be55f696", "score": "0.5067306", "text": "func (b *leveldbBatch) Put(key, value []byte) error {\n\tb.b.Put(key, value)\n\tb.size += len(value)\n\treturn nil\n}", "title": "" }, { "docid": "f939e6e33f8b3475346c7e89351730a8", "score": "0.5067184", "text": "func (r *Redis) Put(ctx context.Context, tab, key string, val interface{}) error {\n\tdata, err := json.Marshal(val)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn r.Client.Set(ctx, r.prepareKey(tab, key), data, 0).Err()\n}", "title": "" }, { "docid": "56153dbbc37069915ecbd855e3e98455", "score": "0.5063813", "text": "func (b GRPCInterface) Put(key, value []byte) error {\n\t_, err := b.GRPC.Put(b.Context, &proto.Operation{\n\t\tBucket: b.Bucket,\n\t\tKey: key,\n\t\tValue: value,\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "fbbef748f871ea65f726c89ff6af6800", "score": "0.506148", "text": "func (wb *WriteBatchWithIndex) MergeCF(cf *ColumnFamilyHandle, key, value []byte) {\n\tcKey := byteToChar(key)\n\tcValue := byteToChar(value)\n\tC.rocksdb_writebatch_wi_merge_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)))\n}", "title": "" }, { "docid": "515e946faf9327111d526993cae8e3c6", "score": "0.5058491", "text": "func (o *CMFFamily) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcmfFamilyUpdateCacheMut.RLock()\n\tcache, cached := cmfFamilyUpdateCache[key]\n\tcmfFamilyUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcmfFamilyAllColumns,\n\t\t\tcmfFamilyPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update cmf_family, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `cmf_family` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, cmfFamilyPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(cmfFamilyType, cmfFamilyMapping, append(wl, cmfFamilyPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update cmf_family row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for cmf_family\")\n\t}\n\n\tif !cached {\n\t\tcmfFamilyUpdateCacheMut.Lock()\n\t\tcmfFamilyUpdateCache[key] = cache\n\t\tcmfFamilyUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "eba37a8722ee064ddae8659594fe7ff3", "score": "0.5056065", "text": "func (db *DB) DeleteCF(wo *WriteOptions, cf *ColumnFamilyHandle, key []byte) error {\n\tvar cErr *C.char\n\tcKey := bytesToChar(key)\n\tC.rocksdb_delete_cf(db.c, wo.c, cf.c, cKey, C.size_t(len(key)), &cErr)\n\tif cErr != nil {\n\t\tdefer C.free(unsafe.Pointer(cErr))\n\t\treturn errors.New(C.GoString(cErr))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f14f5cfd6a1fab2345e176b06d46692d", "score": "0.50451255", "text": "func (w *Writer) Put(cellID s2.CellID, value []byte) error {\n\treturn w.store.Put(sstKey(cellID), value)\n}", "title": "" }, { "docid": "a5b8c70fa6279e2e0738d500e5fcb436", "score": "0.5035829", "text": "func (ck *Clerk) Put(key string, value string) {\n\tck.PutAppend(key, value, PUT_OPERATION)\n}", "title": "" }, { "docid": "fb0205d98bbabd31dfaba48dccc46aab", "score": "0.5034782", "text": "func (tx *Transaction) Put(bucketPath, key string, val map[string]interface{}) error {\n\tbucket, err := tx.getBucketOrCreate(bucketPath)\n\tif err != nil {\n\t\tlog.Print(\"bucket err:\", err)\n\t\treturn err\n\t}\n\tbs, err := tx.dataToBytes(val)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn bucket.Put([]byte(key), bs)\n}", "title": "" }, { "docid": "f34951c297bbbe074afb7c7bbcd426c7", "score": "0.50336117", "text": "func (a *AerospikeBackend) Put(ctx context.Context, key string, value string, ttlSeconds int) error {\n\tasKey, err := a.client.NewUUIDKey(a.namespace, key)\n\tif err != nil {\n\t\treturn classifyAerospikeError(err)\n\t}\n\n\tbins := as.BinMap{binValue: value}\n\tpolicy := &as.WritePolicy{\n\t\tExpiration: uint32(ttlSeconds),\n\t\tRecordExistsAction: as.CREATE_ONLY,\n\t}\n\n\tif err := a.client.Put(policy, asKey, bins); err != nil {\n\t\treturn classifyAerospikeError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9dd7f88c9a5259d6f2f3c85dc3b2c71", "score": "0.5031134", "text": "func (s *Store) Put(k, v []byte) error {\n\tselect {\n\tcase <-s.ctx.Done():\n\t\treturn s.ctx.Err()\n\tdefault:\n\t}\n\n\tif !s.writable {\n\t\treturn engine.ErrTransactionReadOnly\n\t}\n\n\tif len(k) == 0 {\n\t\treturn errors.New(\"cannot store empty key\")\n\t}\n\n\tif len(v) == 0 {\n\t\treturn errors.New(\"cannot store empty value\")\n\t}\n\n\treturn s.tx.Set(buildKey(s.prefix, k), v)\n}", "title": "" }, { "docid": "c1ad41c51b5b21240c5f7ec7caa0b39d", "score": "0.5031011", "text": "func (f *FileDataStore) Put(key string, val []byte) error {\n\terr := f.db.Update(func(tx *bolt.Tx) error {\n\t\t//err := tx.Bucket([]byte(\"data\")).Put([]byte(key), buf.Bytes())\n\t\terr := tx.Bucket([]byte(f.DefaultBucket)).Put([]byte(key), val)\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "6b423a4f1dab428512ec4ea208cd9cfd", "score": "0.50304997", "text": "func (this *MyHashMap) Put(key int, value int) {\n\tthis.content[key] = value\n}", "title": "" }, { "docid": "d5bf3c2fec9198d6a13c96fcee9349a5", "score": "0.5027931", "text": "func (cursor *Cursor) Put(key, val []byte, flags uint) error {\n\tckey := Wrap(key)\n\tcval := Wrap(val)\n\treturn cursor.PutVal(ckey, cval, flags)\n}", "title": "" }, { "docid": "da4030654f4f78533dd37054b04a1c6f", "score": "0.5013091", "text": "func (store *BoltStorage) Put(key string, value []byte) error {\n\treturn store.db.Update(func(tx *bolt.Tx) error {\n\t\tb, k, err := store.getOrCreateBucketForKey(tx, \"kv/\"+key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := b.Put([]byte(k), value); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "700dd69eb99daab5246d8651c91541b7", "score": "0.5010094", "text": "func BufPut(c context.Context, wb WrapBlob, skey string) (mkk string, errClosure error) {\n\n\tt := fmt.Sprintf(\"%T\", wb)\n\tmkk = t + \"__\" + skey // kombi key\n\n\tfcTrans := func(c context.Context) error {\n\t\tdskey1 := datastore.NewKey(c, t, skey, 0, nil)\n\t\t_, err := datastore.Put(c, dskey1, &wb)\n\t\tMcacheSet(c, mkk, wb)\n\t\tmemoryInstanceStore[mkk] = &wb\n\t\tmultiCastInstanceCacheChange(c, mkk)\n\t\tif ll > 2 {\n\t\t\taelog.Infof(c, \"saved to ds and memcache and instance RAM - combikey is %v\", mkk)\n\t\t}\n\t\treturn err\n\t}\n\n\terrClosure = datastore.RunInTransaction(c, fcTrans, nil)\n\tif errClosure != nil {\n\t\taelog.Errorf(c, \"%v\", errClosure)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e8f1ef29d4ed0e6303363d19f0190037", "score": "0.49999496", "text": "func (c *Client) Put(key, val string, timeout time.Duration) error {\n\tmsg := &Message{\n\t\tmethod: MethodPut,\n\t\tsequence: 0,\n\t\tkey: key,\n\t\tbody: []byte(val),\n\t}\n\n\tif err := msg.Send(c.socket, nil); err != nil {\n\t\treturn err\n\t}\n\n\trep, _, err := RecvMessage(c.socket, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif rep.method == MethodError {\n\t\tfmt.Printf(\"could not put %s: %s\\n\", rep.key, string(rep.body))\n\t} else {\n\t\tfmt.Printf(\"%s set in state %d\\n\", rep.key, rep.sequence)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60cb0b45185c475f6cf99ba20e298824", "score": "0.4998955", "text": "func (c *Client) put(key string, value string, ttl uint64,\n\toptions Options) (*RawResponse, error) {\n\n\tlogger.Debugf(\"put %s, %s, ttl: %d, [%s]\", key, value, ttl, c.cluster.pick())\n\tp := keyToPath(key)\n\n\tstr, err := options.toParameters(VALID_PUT_OPTIONS)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp += str\n\n\treq := NewRawRequest(\"PUT\", p, buildValues(value, ttl), nil)\n\tresp, err := c.SendRequest(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "3c69791984fa35adf3124dc971fc4090", "score": "0.4998268", "text": "func (kvs *KVStore) Put(key string, value interface{}) error {\n\tif value == nil {\n\t\treturn ErrBadValue\n\t}\n\tvar buf bytes.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(value); err != nil {\n\t\treturn err\n\t}\n\treturn kvs.db.Update(func(tx *bolt.Tx) error {\n\t\treturn tx.Bucket(bucketName).Put([]byte(key), buf.Bytes())\n\t})\n}", "title": "" }, { "docid": "e1e889ad53ff4f0c512b8705c0f684f9", "score": "0.49981645", "text": "func (c *Changeset) Put(k DocumentKey, b Blob) {\n\tc.ensureLeafs()\n\tc.leafs[k] = b\n}", "title": "" }, { "docid": "9866df57ff374eb28caf99219b41b70c", "score": "0.49979374", "text": "func (txn *MvccTxn) PutWrite(key []byte, ts uint64, write *Write) {\n\t// Your Code Here (4A).\n\ttxn.writes = append(txn.writes, storage.Modify{\n\t\tData: storage.Put{\n\t\t\tKey: EncodeKey(key, ts),\n\t\t\tValue: write.ToBytes(),\n\t\t\tCf: engine_util.CfWrite,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "be09ea87e95befb80ec1a36d4696d85b", "score": "0.49919784", "text": "func (m Message) SetValue(value []byte) {\n\tkeyLength := binary.BigEndian.Uint32(m[keySizeOffset:])\n\tbinary.BigEndian.PutUint32(m[keyOffset+keyLength:], uint32(len(value)))\n\tcopy(m[keyOffset+keyLength+valueSizeLength:], value)\n}", "title": "" }, { "docid": "f784213e3fc0f616c88447b36edb5ac4", "score": "0.49891928", "text": "func (b *bucket) Put(key, value []byte) error {\n\tif b.writable {\n\t\treturn b.Bucket.Put(key, value)\n\t}\n\treturn kv.ErrTxNotWritable\n}", "title": "" }, { "docid": "e07df45bd835ff5a1aa774fc86959447", "score": "0.49882284", "text": "func (o *CMFFamily) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no cmf_family provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(cmfFamilyColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCMFFamilyUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcmfFamilyUpsertCacheMut.RLock()\n\tcache, cached := cmfFamilyUpsertCache[key]\n\tcmfFamilyUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcmfFamilyAllColumns,\n\t\t\tcmfFamilyColumnsWithDefault,\n\t\t\tcmfFamilyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcmfFamilyAllColumns,\n\t\t\tcmfFamilyPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert cmf_family, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`cmf_family`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `cmf_family` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(cmfFamilyType, cmfFamilyMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(cmfFamilyType, cmfFamilyMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for cmf_family\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == cmfFamilyMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(cmfFamilyType, cmfFamilyMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for cmf_family\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for cmf_family\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcmfFamilyUpsertCacheMut.Lock()\n\t\tcmfFamilyUpsertCache[key] = cache\n\t\tcmfFamilyUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "fa065b5bf9d583de6a29ce05eb0e64db", "score": "0.49855375", "text": "func (b *Backend) Put(ctx context.Context, bucket, key string, in []byte) (out []byte, err error) {\n\tvar buc *Bucket\n\n\tif buc, err = b.bucket(bucket); err != nil {\n\t\treturn\n\t}\n\n\tbuc.data[key] = in\n\tout = in\n\treturn\n}", "title": "" }, { "docid": "7f23fd80375bee6047eff1d4b8e99133", "score": "0.49737605", "text": "func (b *ankaLDBBatch) Put(key, value []byte) error {\n\tb.b.Put(key, value)\n\tb.size += len(value)\n\treturn nil\n}", "title": "" }, { "docid": "ce1ba980556fb49153d870f61ee92d41", "score": "0.49698424", "text": "func (kv *ShardKV) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error {\n\t// Your code here.\n\t//fmt.Printf(\"%d %d S-PutAppend key: %v value: %v \\n\",kv.me,kv.gid, args.Key, args.Value)\n\tkv.mu.Lock()\n\tif args.ConfigNum != kv.config.Num {\n\t\treply.Err = \"ErrWrongGroup\"\n\t\tfmt.Printf(\"%d %d WWWW S-PutAppend key: %v value: %v conf: %d \\n\",kv.me,kv.gid, args.Key, args.Value,kv.config.Num)\n\t} else {\n\t\t//fmt.Printf(\"%d %d RRR S-PutAppend key: %v value: %v conf: %d \\n\",kv.me,kv.gid, args.Key, args.Value,kv.config.Num)\n\t\tship := new(Op)\n\t\tship.Key = args.Key\n\t\tship.Value = args.Value\n\t\tship.What = args.Op\n\t\tship.XID = args.XID\n\t\t//fmt.Printf(\"\\n##########\\n## > > PUT LOCK (%d,%d)\\n##########\\n\" , kv.me , kv.gid)\n\t\t\n\t\t\n\t\t//fmt.Printf(\" %d %d >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PUT LOCK\\n\" , kv.me , kv.gid)\n\t\tkv.currentSeq = kv.px.Max() + 1\n\t\t//kv.mu.Unlock()\n\t\tfmt.Printf(\"%d %d RRR S-PutAppend key: %v value: %v kv.conf: %d args.conf: %d MAX=%d \\n\",kv.me,kv.gid, args.Key, args.Value,kv.config.Num,args.ConfigNum,kv.currentSeq)\n\t\tkv.px.Start(kv.currentSeq,*ship)\n\t\tto := 10 * time.Millisecond\n\t\tfor {\n\t\t\tstatus, vvv := kv.px.Status(kv.currentSeq)\n\t\t\tif status == paxos.Decided{\n\t\t\t\tvvv1 := vvv.(Op)\n\t\t\t\tif vvv1.XID != ship.XID {\n\t\t\t\t\tkv.currentSeq = kv.px.Max() + 1\n\t\t\t\t\tkv.px.Start(kv.currentSeq,*ship)\n\t\t\t\t\tto = 10 * time.Millisecond\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif status == paxos.Decided{\n\t\t\t\t} else if status == paxos.Forgotten{\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\ttime.Sleep(to)\n\t\t\tif to < 10 * time.Second {\n\t\t\t\tto *= 2\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t//fmt.Printf(\"%d %d <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< PUT UNLOCK\\n\" , kv.me , kv.gid)\n\t\t\n\t\t//fmt.Printf(\"\\n##########\\n## < < PUT UN- LOCK (%d,%d)\\n##########\\n\" , kv.me , kv.gid)\n\n\t\treply.Err = \"OK\"\n\t}\n\tkv.mu.Unlock()\n\treturn nil\n\t\n}", "title": "" }, { "docid": "0b1b4f407a975f024bacd09959ef7964", "score": "0.49684748", "text": "func (c *Client) put(k string, v string, opts ...clientv3.OpOption) error {\n\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\tif c.rawClient == nil {\n\t\treturn ErrNilETCDV3Client\n\t}\n\n\t_, err := c.rawClient.Txn(c.ctx).\n\t\tIf(clientv3.Compare(clientv3.Version(k), \"<\", 1)).\n\t\tThen(clientv3.OpPut(k, v, opts...)).\n\t\tCommit()\n\tif err != nil {\n\t\treturn err\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ed99af1f117b4824938aa8f4408a52f", "score": "0.49670863", "text": "func (c Coordinator) Put(e interface{}) {\n\tc.Queue.Enqueue(e)\n}", "title": "" }, { "docid": "9fa7e84ed81f00e122568bec1a677436", "score": "0.49655426", "text": "func (tx *Tx) Put(key string, value interface{}) error {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(\"Recovered in f\", r)\n\t\t\ttx.Err = fmt.Errorf(\"Recovered\")\n\t\t}\n\t}()\n\tif tx.ro {\n\t\terr := fmt.Errorf(\"etcd.Put(%q) called on read-only transaction\", key)\n\t\tif tx.Err == nil {\n\t\t\ttx.Err = err\n\t\t}\n\t\treturn err\n\t}\n\tif tx.Err != nil {\n\t\treturn tx.Err\n\t}\n\t_, curVal, err := tx.get(key)\n\tif err != nil {\n\t\ttx.Err = fmt.Errorf(\"etcd.Put(%q): %w\", key, err)\n\t\treturn tx.Err\n\t}\n\tif tx.puts == nil {\n\t\ttx.puts = make(map[string]interface{})\n\t}\n\tvar cloned interface{}\n\tif value != nil {\n\t\tcloned, err = tx.db.clone(key, value)\n\t\tif err != nil {\n\t\t\ttx.Err = fmt.Errorf(\"etcd.Put(%q): %w\", key, err)\n\t\t\treturn tx.Err\n\t\t}\n\t}\n\tif tx.PendingUpdate != nil {\n\t\ttx.PendingUpdate(key, curVal.value, value)\n\t}\n\ttx.puts[key] = cloned\n\treturn nil\n}", "title": "" }, { "docid": "f102eb20c2022d8a7eff859af4738003", "score": "0.49548146", "text": "func (bq *BlockingQueue) Put(value interface{}) bool {\n\tif bq.closed {\n\t\treturn false\n\t}\n\tbq.lock.Lock()\n\tif bq.closed {\n\t\treturn false\n\t}\n\tbq.queue = append(bq.queue, value)\n\tbq.lock.Unlock()\n\n\tbq.notifyLock.Lock()\n\tbq.monitor.Signal()\n\tbq.notifyLock.Unlock()\n\treturn true\n}", "title": "" } ]
b4ff2517d0e732eb72fd8d9c99914b02
CreateOrUpdatePreparer prepares the CreateOrUpdate request.
[ { "docid": "6ddd91ca9c6cc05ba30d9a8fd24b7b36", "score": "0.6552505", "text": "func (client GroupsClient) CreateOrUpdatePreparer(ctx context.Context, parameters Group, resourceGroupName string, networkManagerName string, networkGroupName string, ifMatch string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"networkGroupName\": autorest.Encode(\"path\", networkGroupName),\n\t\t\"networkManagerName\": autorest.Encode(\"path\", networkManagerName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tparameters.SystemData = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(ifMatch) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Match\", autorest.String(ifMatch)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" } ]
[ { "docid": "223bb53d961bc1e671a883e474323895", "score": "0.7705498", "text": "func (client ResourcesClient) CreateOrUpdateRequestPreparer() autorest.Preparer {\n\treturn autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseUri),\n\t\tautorest.WithPath(\"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}\"))\n}", "title": "" }, { "docid": "7291ce81f7965d2e2ab5c08398f0b21a", "score": "0.7165558", "text": "func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"namespaceName\": autorest.Encode(\"path\", namespaceName),\n\t\t\"notificationHubName\": autorest.Encode(\"path\", notificationHubName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-04-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5ae273df43ad4280e17fc91139ec2e24", "score": "0.6971015", "text": "func (client SchedulesClient) CreateOrUpdatePreparer(ctx context.Context, body Schedule, resourceGroupName string, labName string, scheduleName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"scheduleName\": autorest.Encode(\"path\", scheduleName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tbody.SystemData = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}\", pathParameters),\n\t\tautorest.WithJSON(body),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "3c43a2e0a435ed4e2f7b4cd14e23d53e", "score": "0.6902788", "text": "func (client SensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"columnName\": autorest.Encode(\"path\", columnName),\n\t\t\"databaseName\": autorest.Encode(\"path\", databaseName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"schemaName\": autorest.Encode(\"path\", schemaName),\n\t\t\"sensitivityLabelSource\": autorest.Encode(\"path\", \"current\"),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"tableName\": autorest.Encode(\"path\", tableName),\n\t}\n\n\tconst APIVersion = \"2017-03-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "09ba42714e6c92b67e0ecaa076379d45", "score": "0.68721604", "text": "func (client JobExecutionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"jobAgentName\": autorest.Encode(\"path\", jobAgentName),\n\t\t\"jobExecutionId\": autorest.Encode(\"path\", jobExecutionID),\n\t\t\"jobName\": autorest.Encode(\"path\", jobName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "9de969c4756607aaaf5348fcffe2e95e", "score": "0.68516874", "text": "func (client ScheduleOperationsClient) CreateOrUpdateResourcePreparer(resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": client.APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}\", pathParameters),\n\t\tautorest.WithJSON(schedule),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "5a96bbb9980117a36034698ade4e235b", "score": "0.6809279", "text": "func (client GroupClient) CreatePreparer(accountName string, pathParameter string, write string, op string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"accountName\": accountName,\n\t\t\"adlsFileSystemDnsSuffix\": client.AdlsFileSystemDNSSuffix,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"path\": autorest.Encode(\"path\", pathParameter),\n\t}\n\n\tconst APIVersion = \"2016-11-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t\t\"op\": autorest.Encode(\"query\", op),\n\t\t\"write\": autorest.Encode(\"query\", write),\n\t}\n\tif overwrite != nil {\n\t\tqueryParameters[\"overwrite\"] = autorest.Encode(\"query\", *overwrite)\n\t}\n\tif len(string(syncFlag)) > 0 {\n\t\tqueryParameters[\"syncFlag\"] = autorest.Encode(\"query\", syncFlag)\n\t}\n\tif leaseID != nil {\n\t\tqueryParameters[\"leaseId\"] = autorest.Encode(\"query\", *leaseID)\n\t}\n\tif permission != nil {\n\t\tqueryParameters[\"permission\"] = autorest.Encode(\"query\", *permission)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPut(),\n\t\tautorest.WithCustomBaseURL(\"https://{accountName}.{adlsFileSystemDnsSuffix}\", urlParameters),\n\t\tautorest.WithPathParameters(\"/webhdfs/v1/{path}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif streamContents != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(streamContents))\n\t}\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "c0da235df8cdc367f6b0622c0c08967c", "score": "0.68068016", "text": "func (client ServiceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters *ServiceResource) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"communicationServiceName\": autorest.Encode(\"path\", communicationServiceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-08-20-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tparameters.ID = nil\n\tparameters.Name = nil\n\tparameters.Type = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif parameters != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(parameters))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "579e4f834e59e2a6166681bc8a2cba82", "score": "0.67846924", "text": "func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"firewallRuleName\": autorest.Encode(\"path\", firewallRuleName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "65951516856f331a8ab499dd9474108c", "score": "0.6772085", "text": "func (client JobExecutionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"jobAgentName\": autorest.Encode(\"path\", jobAgentName),\n\t\t\"jobName\": autorest.Encode(\"path\", jobName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "61c16bd9e955b7639579fcc61e439306", "score": "0.67704976", "text": "func (client LabPlansClient) CreateOrUpdatePreparer(ctx context.Context, body LabPlan, resourceGroupName string, labPlanName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labPlanName\": autorest.Encode(\"path\", labPlanName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tbody.SystemData = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}\", pathParameters),\n\t\tautorest.WithJSON(body),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5fa2f673920724172212cbbe3adb2739", "score": "0.67087317", "text": "func (client FilesystemClient) CreatePreparer(ctx context.Context, filesystem string, xMsProperties string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"accountName\": client.AccountName,\n\t\t\"dnsSuffix\": client.DNSSuffix,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"filesystem\": autorest.Encode(\"path\", filesystem),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"resource\": autorest.Encode(\"query\", \"filesystem\"),\n\t}\n\tif timeout != nil {\n\t\tqueryParameters[\"timeout\"] = autorest.Encode(\"query\", *timeout)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPut(),\n\t\tautorest.WithCustomBaseURL(\"http://{accountName}.{dnsSuffix}\", urlParameters),\n\t\tautorest.WithPathParameters(\"/{filesystem}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(xMsProperties) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-properties\", autorest.String(xMsProperties)))\n\t}\n\tif len(xMsClientRequestID) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-client-request-id\", autorest.String(xMsClientRequestID)))\n\t}\n\tif len(xMsDate) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-date\", autorest.String(xMsDate)))\n\t}\n\tif len(client.XMsVersion) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-version\", autorest.String(client.XMsVersion)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "be0fa976a5a80d735ebcfa3b6f4b6588", "score": "0.6700013", "text": "func (client BaseClient) CreateTagPreparer(ctx context.Context, projectID uuid.UUID, name string, description string, typeParameter string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"projectId\": autorest.Encode(\"path\", projectID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"name\": autorest.Encode(\"query\", name),\n\t}\n\tif len(description) > 0 {\n\t\tqueryParameters[\"description\"] = autorest.Encode(\"query\", description)\n\t}\n\tif len(string(typeParameter)) > 0 {\n\t\tqueryParameters[\"type\"] = autorest.Encode(\"query\", typeParameter)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/customvision/v2.2/Training\", urlParameters),\n\t\tautorest.WithPathParameters(\"/projects/{projectId}/tags\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters),\n\t\tautorest.WithHeader(\"Training-Key\", client.APIKey))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "46a5528c5c08c05ac814db439fdc311e", "score": "0.66703343", "text": "func (client ReportsClient) CreateOrUpdatePreparer(ctx context.Context, reportName string, parameters Report) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"reportName\": autorest.Encode(\"path\", reportName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2018-08-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/providers/Microsoft.CostManagement/reports/{reportName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "538c6c63ebacc645aec5d22f9caa3a81", "score": "0.6650935", "text": "func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, body Image, resourceGroupName string, labPlanName string, imageName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"imageName\": autorest.Encode(\"path\", imageName),\n\t\t\"labPlanName\": autorest.Encode(\"path\", labPlanName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tbody.SystemData = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}\", pathParameters),\n\t\tautorest.WithJSON(body),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5f7529bb209f438efbb1fec554643dae", "score": "0.6640671", "text": "func (client WorkspaceConnectionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string, parameters WorkspaceConnection) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"connectionName\": autorest.Encode(\"path\", connectionName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"workspaceName\": autorest.Encode(\"path\", workspaceName),\n\t}\n\n\tconst APIVersion = \"2021-07-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tparameters.ID = nil\n\tparameters.Name = nil\n\tparameters.Type = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "f71769bb725600f38d2a2e8640934e80", "score": "0.6626209", "text": "func (client EventHubsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string, parameters Model) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"eventHubName\": autorest.Encode(\"path\", eventHubName),\n\t\t\"namespaceName\": autorest.Encode(\"path\", namespaceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-04-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "efadeae6ba41f053ab3b5002768bbd59", "score": "0.66128254", "text": "func (client EvaluationsClient) CreatePreparer(ctx context.Context, evaluation EvaluationContract) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/personalizer/v1.0\", urlParameters),\n\t\tautorest.WithPath(\"/evaluations\"),\n\t\tautorest.WithJSON(evaluation))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "127d0b9a48ab3faece2a81dc1e55dfe8", "score": "0.6581649", "text": "func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"certificateOrderName\": autorest.Encode(\"path\", certificateOrderName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2015-08-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}\", pathParameters),\n\t\tautorest.WithJSON(certificateDistinguishedName),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{Cancel: cancel})\n}", "title": "" }, { "docid": "aedaa461f60004fafc74b6b2df74f0f9", "score": "0.6519953", "text": "func (client RuleGroupClient) CreatePreparer(ctx context.Context, parameters RuleGroupRequest) (*http.Request, error) {\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)\n\tsec := security.NewSignature(client.Secretkey, crypto.SHA256)\n\tsignature, err := sec.Signature(\"POST\", common.GetPath(DefaultBaseURI, \"/cw_fea/real/cw/api/rule/group/ruleGrp\"), client.AccessKey, timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/cw_fea/real/cw/api/rule/group/ruleGrp\"),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithHeader(\"x-ncp-apigw-api-key\", client.APIGatewayAPIKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-timestamp\", timestamp),\n\t\tautorest.WithHeader(\"x-ncp-iam-access-key\", client.AccessKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-signature-v2\", signature))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "effdad5ece7f5f39b7c8da37e73da175", "score": "0.6493945", "text": "func (client LargeFaceListClient) CreatePreparer(ctx context.Context, largeFaceListID string, body NameAndUserDataContract) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"largeFaceListId\": autorest.Encode(\"path\", largeFaceListID),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/face/v1.0\", urlParameters),\n\t\tautorest.WithPathParameters(\"/largefacelists/{largeFaceListId}\", pathParameters),\n\t\tautorest.WithJSON(body))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "822539028fb65549327e2165fac79a53", "score": "0.63424283", "text": "func (client OperationalizationClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters OperationalizationCluster) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"clusterName\": autorest.Encode(\"path\", clusterName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-08-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "221d7fda173a5423cd7ff9a64fc61587", "score": "0.6327791", "text": "func (client SecurityPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicy SecurityPolicy) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"profileName\": autorest.Encode(\"path\", profileName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"securityPolicyName\": autorest.Encode(\"path\", securityPolicyName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-09-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}\", pathParameters),\n\t\tautorest.WithJSON(securityPolicy),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "658f8cbc31c02c40fa28c6a456548d53", "score": "0.6302918", "text": "func (client ManagementClient) ValidationOfBodyPreparer(resourceGroupName string, id int32, body *Product) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"id\": autorest.Encode(\"path\",id),\n \"resourceGroupName\": autorest.Encode(\"path\",resourceGroupName),\n \"subscriptionId\": autorest.Encode(\"path\",client.SubscriptionID),\n }\n\n queryParameters := map[string]interface{} {\n \"api-version\": client.APIVersion,\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsJSON(),\n autorest.AsPut(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/fakepath/{subscriptionId}/{resourceGroupName}/{id}\",pathParameters),\n autorest.WithQueryParameters(queryParameters))\n if body != nil {\n preparer = autorest.DecoratePreparer(preparer,\n autorest.WithJSON(body))\n }\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "d87f167c03d34f7062fa75bf787644bb", "score": "0.6269468", "text": "func (client ResourcesClient) NewCreateOrUpdateRequest(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"parentResourcePath\": parentResourcePath,\n\t\t\"resourceGroupName\": url.QueryEscape(resourceGroupName),\n\t\t\"resourceName\": url.QueryEscape(resourceName),\n\t\t\"resourceProviderNamespace\": url.QueryEscape(resourceProviderNamespace),\n\t\t\"resourceType\": resourceType,\n\t\t\"subscriptionId\": url.QueryEscape(client.SubscriptionId),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": ApiVersion,\n\t}\n\n\treturn autorest.DecoratePreparer(\n\t\tclient.CreateOrUpdateRequestPreparer(),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithPathParameters(pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters)).Prepare(&http.Request{})\n}", "title": "" }, { "docid": "c2e5357c462d80812aa5851c4ac804ec", "score": "0.6259173", "text": "func (client SchedulesClient) UpdatePreparer(ctx context.Context, body ScheduleUpdate, resourceGroupName string, labName string, scheduleName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"scheduleName\": autorest.Encode(\"path\", scheduleName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}\", pathParameters),\n\t\tautorest.WithJSON(body),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "1f04b77471c9905a0c578bf2282df615", "score": "0.62495476", "text": "func (client IntegrationRuntimesClient) CreateOrUpdatePreparer(resourceGroupName string, factoryName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"factoryName\": autorest.Encode(\"path\", factoryName),\n\t\t\"integrationRuntimeName\": autorest.Encode(\"path\", integrationRuntimeName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-09-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}\", pathParameters),\n\t\tautorest.WithJSON(integrationRuntime),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(ifMatch) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Match\", autorest.String(ifMatch)))\n\t}\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "6e8ecdcb2f4384003ab2fe92b6f23d25", "score": "0.6234824", "text": "func (client VirtualMachineImageTemplatesClient) CreateOrUpdatePreparer(ctx context.Context, parameters ImageTemplate, resourceGroupName string, imageTemplateName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"imageTemplateName\": autorest.Encode(\"path\", imageTemplateName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2019-02-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "cbbf99ec1cf8b17cdf524fb7e8a8867a", "score": "0.62293273", "text": "func (client ManagementClient) ValidationOfMethodParametersPreparer(resourceGroupName string, id int32) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"id\": autorest.Encode(\"path\",id),\n \"resourceGroupName\": autorest.Encode(\"path\",resourceGroupName),\n \"subscriptionId\": autorest.Encode(\"path\",client.SubscriptionID),\n }\n\n queryParameters := map[string]interface{} {\n \"api-version\": client.APIVersion,\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsGet(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/fakepath/{subscriptionId}/{resourceGroupName}/{id}\",pathParameters),\n autorest.WithQueryParameters(queryParameters))\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "eaabb9d01cee0710decd6feadfd66a5d", "score": "0.61645913", "text": "func (client ScheduleOperationsClient) ExecutePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": client.APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{Cancel: cancel})\n}", "title": "" }, { "docid": "b52ba1028fd7e7fbed3a7ff3922253ba", "score": "0.61577356", "text": "func NewPreparer(t test.Tester) Preparer {\n\treturn preparer{t}\n}", "title": "" }, { "docid": "7e480762ed6e15c15ad9bde9238abf2e", "score": "0.61494213", "text": "func (client ServiceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters *TaggedResource) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"communicationServiceName\": autorest.Encode(\"path\", communicationServiceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-08-20-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif parameters != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(parameters))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5a22ee879e9b1c5073ca4990d5fca77f", "score": "0.61409986", "text": "func (client BaseClient) CreateProjectPreparer(ctx context.Context, name string, description string, domainID *uuid.UUID, classificationType string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"name\": autorest.Encode(\"query\", name),\n\t}\n\tif len(description) > 0 {\n\t\tqueryParameters[\"description\"] = autorest.Encode(\"query\", description)\n\t}\n\tif domainID != nil {\n\t\tqueryParameters[\"domainId\"] = autorest.Encode(\"query\", *domainID)\n\t}\n\tif len(string(classificationType)) > 0 {\n\t\tqueryParameters[\"classificationType\"] = autorest.Encode(\"query\", classificationType)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/customvision/v2.2/Training\", urlParameters),\n\t\tautorest.WithPath(\"/projects\"),\n\t\tautorest.WithQueryParameters(queryParameters),\n\t\tautorest.WithHeader(\"Training-Key\", client.APIKey))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "52351c0f4cc3249500eac825f45581e3", "score": "0.61402714", "text": "func (client PrivateEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, privateEndpoint PrivateEndpoint, resourceGroupName string, clusterName string, privateEndpointName string, ifMatch string, ifNoneMatch string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"clusterName\": autorest.Encode(\"path\", clusterName),\n\t\t\"privateEndpointName\": autorest.Encode(\"path\", privateEndpointName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-03-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tprivateEndpoint.Etag = nil\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}\", pathParameters),\n\t\tautorest.WithJSON(privateEndpoint),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(ifMatch) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Match\", autorest.String(ifMatch)))\n\t}\n\tif len(ifNoneMatch) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-None-Match\", autorest.String(ifNoneMatch)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "f1b2b2a4bde6ce4644b8094240011112", "score": "0.61142385", "text": "func (client LargeFaceListClient) UpdatePreparer(ctx context.Context, largeFaceListID string, body NameAndUserDataContract) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"largeFaceListId\": autorest.Encode(\"path\", largeFaceListID),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/face/v1.0\", urlParameters),\n\t\tautorest.WithPathParameters(\"/largefacelists/{largeFaceListId}\", pathParameters),\n\t\tautorest.WithJSON(body))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5eb9c5c15b44e65140af0aba5ae213b9", "score": "0.6057934", "text": "func (client ResourcesClient) CheckExistenceRequestPreparer() autorest.Preparer {\n\treturn autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsHead(),\n\t\tautorest.WithBaseURL(client.BaseUri),\n\t\tautorest.WithPath(\"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}\"))\n}", "title": "" }, { "docid": "9d429fb5767a890b203b2255aced7e62", "score": "0.6044304", "text": "func (client DpsCertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, provisioningServiceName string, certificateName string, certificateDescription CertificateBodyDescription, ifMatch string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"certificateName\": autorest.Encode(\"path\", certificateName),\n\t\t\"provisioningServiceName\": autorest.Encode(\"path\", provisioningServiceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-08-21-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}\", pathParameters),\n\t\tautorest.WithJSON(certificateDescription),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(ifMatch) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Match\", autorest.String(ifMatch)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d58f7f70db6f4c9561157a75ed80f92e", "score": "0.60031027", "text": "func (client ScheduleOperationsClient) PatchResourcePreparer(resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": client.APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}\", pathParameters),\n\t\tautorest.WithJSON(schedule),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "b41c0efaf849eab08746c4f0a10ef9a4", "score": "0.59943795", "text": "func (client VirtualMachineImageTemplatesClient) UpdatePreparer(ctx context.Context, parameters ImageTemplateUpdateParameters, resourceGroupName string, imageTemplateName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"imageTemplateName\": autorest.Encode(\"path\", imageTemplateName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2019-02-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "ac74b16e994883cdc00b080a9d313a4e", "score": "0.5987881", "text": "func (client LabPlansClient) UpdatePreparer(ctx context.Context, body LabPlanUpdate, resourceGroupName string, labPlanName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labPlanName\": autorest.Encode(\"path\", labPlanName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}\", pathParameters),\n\t\tautorest.WithJSON(body),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "6a4262bdb12c7a2b3bd6b3752c0edef9", "score": "0.59615564", "text": "func (client ReportsClient) CreateOrUpdateByResourceGroupNamePreparer(ctx context.Context, resourceGroupName string, reportName string, parameters Report) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"reportName\": autorest.Encode(\"path\", reportName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2018-08-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CostManagement/reports/{reportName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "cff474cfda5d80f94e6266e8bae8c928", "score": "0.5952004", "text": "func (client InitScriptClient) CreatePreparer(ctx context.Context, initScriptContent string, osTypeCode OsTypeCode, initScriptName string, initScriptDescription string) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"initScriptContent\": autorest.Encode(\"query\", initScriptContent),\n\t\t\"responseFormatType\": autorest.Encode(\"query\", \"json\"),\n\t}\n\n\tqueryParameters[\"regionCode\"] = autorest.Encode(\"query\", \"FKR\")\n\n\tif len(string(osTypeCode)) > 0 {\n\t\tqueryParameters[\"osTypeCode\"] = autorest.Encode(\"query\", osTypeCode)\n\t}\n\tif len(initScriptName) > 0 {\n\t\tqueryParameters[\"initScriptName\"] = autorest.Encode(\"query\", initScriptName)\n\t}\n\tif len(initScriptDescription) > 0 {\n\t\tqueryParameters[\"initScriptDescription\"] = autorest.Encode(\"query\", initScriptDescription)\n\t}\n\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)\n\tsec := security.NewSignature(client.Secretkey, crypto.SHA256)\n\tsignature, err := sec.Signature(\"POST\", common.GetPath(DefaultBaseURI, \"/createInitScript\")+\"?\"+common.GetQuery(queryParameters), client.AccessKey, timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/createInitScript\"),\n\t\tautorest.WithQueryParameters(queryParameters),\n\t\tautorest.WithHeader(\"x-ncp-apigw-timestamp\", timestamp),\n\t\tautorest.WithHeader(\"x-ncp-iam-access-key\", client.AccessKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-signature-v2\", signature))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "b01a677c97cca2ffdda14aea630a0be1", "score": "0.59495604", "text": "func (client FirewallRulesClient) ReplacePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters FirewallRuleList) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "538c294917d6cfac80f4fc77ddfb0ec1", "score": "0.5940189", "text": "func (client InheritanceClient) PutValidPreparer(complexBody Siamese) (*http.Request, error) {\n preparer := autorest.CreatePreparer(\n autorest.AsJSON(),\n autorest.AsPut(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/complex/inheritance/valid\"),\n autorest.WithJSON(complexBody))\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "ed30d986b3485d8991473489470a0266", "score": "0.59350455", "text": "func (client SetsClient) GetAllPreparer(ctx context.Context) (*http.Request, error) {\n preparer := autorest.CreatePreparer(\nautorest.AsGet(),\nautorest.WithBaseURL(client.BaseURI),\nautorest.WithPath(\"/sets\"))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "d83f1dd5ec217fc44c9c4c5d8fc7058b", "score": "0.58628553", "text": "func (client ReportsClient) CreateOrUpdateByDepartmentPreparer(ctx context.Context, departmentID string, reportName string, parameters Report) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"departmentId\": autorest.Encode(\"path\", departmentID),\n\t\t\"reportName\": autorest.Encode(\"path\", reportName),\n\t}\n\n\tconst APIVersion = \"2018-08-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.CostManagement/reports/{reportName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "fe849bb5d0d53498c787faf9ce116762", "score": "0.583394", "text": "func (client ImagesClient) UpdatePreparer(ctx context.Context, body ImageUpdate, resourceGroupName string, labPlanName string, imageName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"imageName\": autorest.Encode(\"path\", imageName),\n\t\t\"labPlanName\": autorest.Encode(\"path\", labPlanName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}\", pathParameters),\n\t\tautorest.WithJSON(body),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "de385882c7244cad034eb35297ac8ddd", "score": "0.5829548", "text": "func (client BaseClient) WriteAttributesPreparer(ctx context.Context, endpointID string, body WriteRequestAPIModel) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"endpointId\": autorest.Encode(\"path\",endpointID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v2/write/{endpointId}/attributes\",pathParameters),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "d21ee872e729dca4fa4051943f68ce8e", "score": "0.5822231", "text": "func (machinesetRESTStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {\n\tmachineset, ok := obj.(*clusteroperator.MachineSet)\n\tif !ok {\n\t\tglog.Fatal(\"received a non-machineset object to create\")\n\t}\n\n\t// Creating a brand new object, thus it must have no\n\t// status. We can't fail here if they passed a status in, so\n\t// we just wipe it clean.\n\tmachineset.Status = clusteroperator.MachineSetStatus{}\n\n\tmachineset.Generation = 1\n}", "title": "" }, { "docid": "40f075020c00cc6dd170a76cdec3bdc3", "score": "0.58171856", "text": "func (client OperationalizationClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters OperationalizationClusterUpdateParameters) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"clusterName\": autorest.Encode(\"path\", clusterName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-08-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "1f6fa181e376ddb449fc89c2e46fc00b", "score": "0.57763547", "text": "func (client BaseClient) BrowsePreparer(ctx context.Context, endpointID string, body BrowseRequestAPIModel) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"endpointId\": autorest.Encode(\"path\",endpointID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v2/browse/{endpointId}\",pathParameters),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "eb86528461c2a776872d4f69ffab3f29", "score": "0.5773994", "text": "func (client LROsClient) PutNonResourcePreparer(ctx context.Context, sku *Sku) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/lro/putnonresource/202/200\"))\n\tif sku != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(sku))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "b3a259983b5c9c81d3ef962afd78fb63", "score": "0.5771997", "text": "func (client SessionHostsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, sessionHost *SessionHostPatch) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"hostPoolName\": autorest.Encode(\"path\", hostPoolName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"sessionHostName\": autorest.Encode(\"path\", sessionHostName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2019-12-10-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif sessionHost != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(sessionHost))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "3be16fa438eef224ccdcf6564e114c66", "score": "0.57637644", "text": "func (client LROsClient) Put201CreatingSucceeded200Preparer(ctx context.Context, product *Product) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/lro/put/201/creating/succeeded/200\"))\n\tif product != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(product))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "ab4e164f46d8020f46f012101020c2ed", "score": "0.57503146", "text": "func (client SchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, scheduleName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"scheduleName\": autorest.Encode(\"path\", scheduleName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "c44e1647845897a86142406093e18d8f", "score": "0.57384133", "text": "func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target Target, options *TargetsClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif parentProviderNamespace == \"\" {\n\t\treturn nil, errors.New(\"parameter parentProviderNamespace cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{parentProviderNamespace}\", url.PathEscape(parentProviderNamespace))\n\tif parentResourceType == \"\" {\n\t\treturn nil, errors.New(\"parameter parentResourceType cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{parentResourceType}\", url.PathEscape(parentResourceType))\n\tif parentResourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter parentResourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{parentResourceName}\", url.PathEscape(parentResourceName))\n\tif targetName == \"\" {\n\t\treturn nil, errors.New(\"parameter targetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{targetName}\", url.PathEscape(targetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, target); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "0407e98658a1195291f0865f8e987e85", "score": "0.5735192", "text": "func (client JobExecutionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"jobAgentName\": autorest.Encode(\"path\", jobAgentName),\n\t\t\"jobExecutionId\": autorest.Encode(\"path\", jobExecutionID),\n\t\t\"jobName\": autorest.Encode(\"path\", jobName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "0ecdb49dfc51264a721ade2c5e2875c6", "score": "0.5733388", "text": "func (client RuleGroupClient) UpdatePreparer(ctx context.Context, parameters RuleGroupRequest) (*http.Request, error) {\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)\n\tsec := security.NewSignature(client.Secretkey, crypto.SHA256)\n\tsignature, err := sec.Signature(\"POST\", common.GetPath(DefaultBaseURI, \"/cw_fea/real/cw/api/rule/group/ruleGrp/update\"), client.AccessKey, timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/cw_fea/real/cw/api/rule/group/ruleGrp/update\"),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithHeader(\"x-ncp-apigw-api-key\", client.APIGatewayAPIKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-timestamp\", timestamp),\n\t\tautorest.WithHeader(\"x-ncp-iam-access-key\", client.AccessKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-signature-v2\", signature))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "ab626533dab5b9235d2ee67dc817bb0e", "score": "0.572589", "text": "func (client FilesystemClient) SetPropertiesPreparer(ctx context.Context, filesystem string, xMsProperties string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"accountName\": client.AccountName,\n\t\t\"dnsSuffix\": client.DNSSuffix,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"filesystem\": autorest.Encode(\"path\", filesystem),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"resource\": autorest.Encode(\"query\", \"filesystem\"),\n\t}\n\tif timeout != nil {\n\t\tqueryParameters[\"timeout\"] = autorest.Encode(\"query\", *timeout)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPatch(),\n\t\tautorest.WithCustomBaseURL(\"http://{accountName}.{dnsSuffix}\", urlParameters),\n\t\tautorest.WithPathParameters(\"/{filesystem}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(xMsProperties) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-properties\", autorest.String(xMsProperties)))\n\t}\n\tif len(ifModifiedSince) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Modified-Since\", autorest.String(ifModifiedSince)))\n\t}\n\tif len(ifUnmodifiedSince) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Unmodified-Since\", autorest.String(ifUnmodifiedSince)))\n\t}\n\tif len(xMsClientRequestID) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-client-request-id\", autorest.String(xMsClientRequestID)))\n\t}\n\tif len(xMsDate) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-date\", autorest.String(xMsDate)))\n\t}\n\tif len(client.XMsVersion) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-version\", autorest.String(client.XMsVersion)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "563383b093ee69b7a7a4f04eff1ff9e5", "score": "0.57223684", "text": "func (h Handlers[R, T]) CreateOrUpdateResource(r *http.Request) (corev3.Resource, error) {\n\tvar payload R\n\tif err := json.NewDecoder(r.Body).Decode(&payload); err != nil {\n\t\treturn nil, actions.NewError(actions.InvalidArgument, err)\n\t}\n\n\tmeta := payload.GetMetadata()\n\n\tif meta == nil {\n\t\treturn nil, actions.NewError(actions.InvalidArgument, errors.New(\"nil metadata\"))\n\t}\n\n\tif err := checkMeta(*meta, mux.Vars(r), \"id\"); err != nil {\n\t\treturn nil, actions.NewError(actions.InvalidArgument, err)\n\t}\n\n\tif claims := jwt.GetClaimsFromContext(r.Context()); claims != nil {\n\t\tmeta.CreatedBy = claims.StandardClaims.Subject\n\t}\n\n\tgstore := storev2.Of[R](h.Store)\n\n\tif err := gstore.CreateOrUpdate(r.Context(), payload); err != nil {\n\t\tswitch err := err.(type) {\n\t\tcase *store.ErrNotValid:\n\t\t\treturn nil, actions.NewError(actions.InvalidArgument, err)\n\t\tdefault:\n\t\t\treturn nil, actions.NewError(actions.InternalErr, err)\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "2dafed13e5dd58948e0872ee8d6a21f8", "score": "0.57196325", "text": "func (el EnvironmentList) environmentListPreparer(ctx context.Context) (*http.Request, error) {\n\tif el.NextLink == nil || len(to.String(el.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(el.NextLink)))\n}", "title": "" }, { "docid": "21b9bcd06128d9b46f015b3943671062", "score": "0.57034546", "text": "func (client ResourcesClient) GetRequestPreparer() autorest.Preparer {\n\treturn autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseUri),\n\t\tautorest.WithPath(\"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}\"))\n}", "title": "" }, { "docid": "62cc31043398d804b6bfe30b1b30ea19", "score": "0.56997466", "text": "func (client ScheduleOperationsClient) ListPreparer(resourceGroupName string, labName string, filter string, top *int32, orderBy string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": client.APIVersion,\n\t}\n\tif len(filter) > 0 {\n\t\tqueryParameters[\"$filter\"] = autorest.Encode(\"query\", filter)\n\t}\n\tif top != nil {\n\t\tqueryParameters[\"$top\"] = autorest.Encode(\"query\", *top)\n\t}\n\tif len(orderBy) > 0 {\n\t\tqueryParameters[\"$orderBy\"] = autorest.Encode(\"query\", orderBy)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "9d4ca2f41920940dc0277f666fcd6594", "score": "0.5699575", "text": "func (client ResourceHealthMetadataClient) ListPreparer(ctx context.Context) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-03-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "bdf85234848fb064aa2f9555061e87cf", "score": "0.5698568", "text": "func (sl SolutionList) solutionListPreparer(ctx context.Context) (*http.Request, error) {\n\tif !sl.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(sl.NextLink)))\n}", "title": "" }, { "docid": "71e9a18eb792921c73ec6c6467b5d211", "score": "0.5694777", "text": "func (client Client) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"authorizationRuleName\": autorest.Encode(\"path\", authorizationRuleName),\n\t\t\"namespaceName\": autorest.Encode(\"path\", namespaceName),\n\t\t\"notificationHubName\": autorest.Encode(\"path\", notificationHubName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-04-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "fa8483b11d2a4e3f47b1a49cb8a09f1b", "score": "0.569364", "text": "func (client ScheduleOperationsClient) GetResourcePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": client.APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "c4ae55797420ad4dec03151eb381bbe2", "score": "0.56516707", "text": "func (client ResourcesClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource) (result GenericResource, ae autorest.Error) {\n\treq, err := client.NewCreateOrUpdateRequest(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"resources.ResourcesClient\", \"CreateOrUpdate\", \"Failure creating request\")\n\t}\n\n\treq, err = autorest.Prepare(\n\t\treq,\n\t\tclient.WithAuthorization(),\n\t\tclient.WithInspection())\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"resources.ResourcesClient\", \"CreateOrUpdate\", \"Failure preparing request\")\n\t}\n\n\tresp, err := autorest.SendWithSender(\n\t\tclient,\n\t\treq,\n\t\tautorest.DoErrorUnlessStatusCode(http.StatusCreated, http.StatusAccepted, http.StatusOK))\n\tif err == nil {\n\t\terr = client.IsPollingAllowed(resp)\n\t\tif err == nil {\n\t\t\tresp, err = client.PollAsNeeded(resp)\n\t\t}\n\t}\n\n\tif err == nil {\n\t\terr = autorest.Respond(\n\t\t\tresp,\n\t\t\tclient.ByInspecting(),\n\t\t\tautorest.WithErrorUnlessOK(),\n\t\t\tautorest.ByUnmarshallingJSON(&result))\n\t\tif err != nil {\n\t\t\tae = autorest.NewErrorWithError(err, \"resources.ResourcesClient\", \"CreateOrUpdate\", \"Failure responding to request\")\n\t\t}\n\t} else {\n\t\tae = autorest.NewErrorWithError(err, \"resources.ResourcesClient\", \"CreateOrUpdate\", \"Failure sending request\")\n\t}\n\n\tautorest.Respond(resp,\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\n\treturn\n}", "title": "" }, { "docid": "b4a2ccf02a8c0003afbcda505920a3e7", "score": "0.56499994", "text": "func (client RuleGroupClient) CreateDirectlyPreparer(ctx context.Context, parameters DirectRuleGroupCreateRequest) (*http.Request, error) {\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)\n\tsec := security.NewSignature(client.Secretkey, crypto.SHA256)\n\tsignature, err := sec.Signature(\"POST\", common.GetPath(DefaultBaseURI, \"/cw_fea/real/cw/api/rule/group/ruleGrp/createDirectly\"), client.AccessKey, timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/cw_fea/real/cw/api/rule/group/ruleGrp/createDirectly\"),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithHeader(\"x-ncp-apigw-api-key\", client.APIGatewayAPIKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-timestamp\", timestamp),\n\t\tautorest.WithHeader(\"x-ncp-iam-access-key\", client.AccessKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-signature-v2\", signature))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "e27470ddc5266c869da81fd475f36c61", "score": "0.5642619", "text": "func (client RepositoryClient) UpdateAttributesPreparer(ctx context.Context, name string, value *ChangeableAttributes) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"url\": client.LoginURI,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithCustomBaseURL(\"{url}\", urlParameters),\n\t\tautorest.WithPathParameters(\"/acr/v1/{name}\", pathParameters))\n\tif value != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(value))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "2763e7fe261bc239a2eed14d0fd18630", "score": "0.56341857", "text": "func (client LargeFaceListClient) TrainPreparer(ctx context.Context, largeFaceListID string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"largeFaceListId\": autorest.Encode(\"path\", largeFaceListID),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/face/v1.0\", urlParameters),\n\t\tautorest.WithPathParameters(\"/largefacelists/{largeFaceListId}/train\", pathParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "28b796ae09e50b3f8bd5f2c539afe3a8", "score": "0.5623608", "text": "func (c ConfigurationsClient) preparerForUpdateOnNode(ctx context.Context, id NodeConfigurationId, input ServerConfiguration) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": defaultApiVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(c.baseUri),\n\t\tautorest.WithPath(id.ID()),\n\t\tautorest.WithJSON(input),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d9a786b9405711c05d27f884e3b714aa", "score": "0.56210583", "text": "func (client OperationalizationClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"clusterName\": autorest.Encode(\"path\", clusterName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-08-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "9df0262032a5c9e737ed46fec34f6701", "score": "0.5620839", "text": "func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceProviderNamespace == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceProviderNamespace cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceProviderNamespace}\", url.PathEscape(resourceProviderNamespace))\n\turlPath = strings.ReplaceAll(urlPath, \"{parentResourcePath}\", parentResourcePath)\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceType}\", resourceType)\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", apiVersion)\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "4b5dfe21c3b62c2c5043677ebc6270ab", "score": "0.56196654", "text": "func (client BaseClient) CreateRoleAssignmentPreparer(ctx context.Context, createRoleAssignmentOptions RoleAssignmentOptions) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"endpoint\": client.Endpoint,\n\t}\n\n\tconst APIVersion = \"2020-02-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{endpoint}\", urlParameters),\n\t\tautorest.WithPath(\"/rbac/roleAssignments\"),\n\t\tautorest.WithJSON(createRoleAssignmentOptions),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "51dfaa425a83eb3c0eae524d06b60c83", "score": "0.5616336", "text": "func (client BaseClient) WriteValuePreparer(ctx context.Context, endpointID string, body ValueWriteRequestAPIModel) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"endpointId\": autorest.Encode(\"path\",endpointID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v2/write/{endpointId}\",pathParameters),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "0db8d886a9b3bdf2220a87e65f9ef7d2", "score": "0.56077886", "text": "func (client SymbologyClient) GetAllPreparer(ctx context.Context) (*http.Request, error) {\n preparer := autorest.CreatePreparer(\nautorest.AsGet(),\nautorest.WithBaseURL(client.BaseURI),\nautorest.WithPath(\"/symbology\"))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "decd787a13e87b12be7fb907fa987598", "score": "0.5604496", "text": "func (client BaseClient) GetTagsPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"projectId\": autorest.Encode(\"path\", projectID),\n\t}\n\n\tqueryParameters := map[string]interface{}{}\n\tif iterationID != nil {\n\t\tqueryParameters[\"iterationId\"] = autorest.Encode(\"query\", *iterationID)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/customvision/v2.2/Training\", urlParameters),\n\t\tautorest.WithPathParameters(\"/projects/{projectId}/tags\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters),\n\t\tautorest.WithHeader(\"Training-Key\", client.APIKey))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "23da37d9bb32561ca338c35891bcc7c5", "score": "0.55978626", "text": "func (client LROsClient) Put201CreatingFailed200Preparer(ctx context.Context, product *Product) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/lro/put/201/created/failed/200\"))\n\tif product != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(product))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "7dc48661a22c8a59e40a34ec761a4d17", "score": "0.5577473", "text": "func (client InheritanceClient) GetValidPreparer() (*http.Request, error) {\n preparer := autorest.CreatePreparer(\n autorest.AsGet(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/complex/inheritance/valid\"))\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "43a5d7ee8d6787fe23cd56c10182c801", "score": "0.55672693", "text": "func (client SchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, scheduleName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labName\": autorest.Encode(\"path\", labName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"scheduleName\": autorest.Encode(\"path\", scheduleName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsDelete(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "1908fa8d8e880eaf8795a8ea13065d85", "score": "0.5556858", "text": "func (cl ComplianceList) complianceListPreparer(ctx context.Context) (*http.Request, error) {\n\tif !cl.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(cl.NextLink)))\n}", "title": "" }, { "docid": "dca6cec3f5bbca616e3deaf127ff6cfb", "score": "0.5556496", "text": "func (client SensitivityLabelsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"columnName\": autorest.Encode(\"path\", columnName),\n\t\t\"databaseName\": autorest.Encode(\"path\", databaseName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"schemaName\": autorest.Encode(\"path\", schemaName),\n\t\t\"sensitivityLabelSource\": autorest.Encode(\"path\", sensitivityLabelSource),\n\t\t\"serverName\": autorest.Encode(\"path\", serverName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"tableName\": autorest.Encode(\"path\", tableName),\n\t}\n\n\tconst APIVersion = \"2017-03-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "95a6fa5deb668c6cec653a17f1c8adfd", "score": "0.55523336", "text": "func (client LabPlansClient) GetPreparer(ctx context.Context, resourceGroupName string, labPlanName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"labPlanName\": autorest.Encode(\"path\", labPlanName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-11-15-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d84c7c44adb7147dc6b07259b40b2a17", "score": "0.55453664", "text": "func (client BaseClient) UpdateProjectPreparer(ctx context.Context, projectID uuid.UUID, updatedProject Project) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"projectId\": autorest.Encode(\"path\", projectID),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/customvision/v2.2/Training\", urlParameters),\n\t\tautorest.WithPathParameters(\"/projects/{projectId}\", pathParameters),\n\t\tautorest.WithJSON(updatedProject),\n\t\tautorest.WithHeader(\"Training-Key\", client.APIKey))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "be4705453d74056fa3978b198893c512", "score": "0.5544245", "text": "func (client Client) PatchPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters *PatchParameters) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"namespaceName\": autorest.Encode(\"path\", namespaceName),\n\t\t\"notificationHubName\": autorest.Encode(\"path\", notificationHubName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-04-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif parameters != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(parameters))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "1be66fa60f2815661b53b7bb192337c7", "score": "0.5543728", "text": "func (client ScheduleOperationsClient) CreateOrUpdateResourceSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "535003c44b694ff1f009fc109038364b", "score": "0.5527463", "text": "func (client ResourcesClient) ListRequestPreparer() autorest.Preparer {\n\treturn autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseUri),\n\t\tautorest.WithPath(\"/subscriptions/{subscriptionId}/resources\"))\n}", "title": "" }, { "docid": "c12b730c02162da7adea050fa5d1d571", "score": "0.552691", "text": "func (client GroupClient) CreateOrUpdateCertificatePreparer(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"certificateOrderName\": autorest.Encode(\"path\", certificateOrderName),\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2015-08-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsJSON(),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}\", pathParameters),\n\t\tautorest.WithJSON(keyVaultCertificate),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{Cancel: cancel})\n}", "title": "" }, { "docid": "e8e9d7784c5202162ead1a4299c3b8c3", "score": "0.5523349", "text": "func (client blockBlobsClient) putBlockPreparer(blockID string, body io.ReadSeeker, timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) {\n\treq, err := pipeline.NewRequest(\"PUT\", client.url, body)\n\tif err != nil {\n\t\treturn req, pipeline.NewError(err, \"failed to create request\")\n\t}\n\tparams := req.URL.Query()\n\tparams.Set(\"blockid\", blockID)\n\tif timeout != nil {\n\t\tparams.Set(\"timeout\", fmt.Sprintf(\"%v\", *timeout))\n\t}\n\tparams.Set(\"comp\", \"block\")\n\treq.URL.RawQuery = params.Encode()\n\tif leaseID != nil {\n\t\treq.Header.Set(\"x-ms-lease-id\", *leaseID)\n\t}\n\treq.Header.Set(\"x-ms-version\", ServiceVersion)\n\tif requestID != nil {\n\t\treq.Header.Set(\"x-ms-client-request-id\", *requestID)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "715994bb9b9f625649a109820cacc595", "score": "0.5522824", "text": "func (client StaticSitesClient) CreateOrUpdateDatabaseConnectionPreparer(ctx context.Context, resourceGroupName string, name string, databaseConnectionName string, databaseConnectionRequestEnvelope DatabaseConnection) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"databaseConnectionName\": autorest.Encode(\"path\", databaseConnectionName),\n\t\t\"name\": autorest.Encode(\"path\", name),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-09-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/databaseConnections/{databaseConnectionName}\", pathParameters),\n\t\tautorest.WithJSON(databaseConnectionRequestEnvelope),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "db489c7a546b2d7ba22ba154a2449cf1", "score": "0.5522065", "text": "func (client FilesystemClient) DeletePreparer(ctx context.Context, filesystem string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"accountName\": client.AccountName,\n\t\t\"dnsSuffix\": client.DNSSuffix,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"filesystem\": autorest.Encode(\"path\", filesystem),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"resource\": autorest.Encode(\"query\", \"filesystem\"),\n\t}\n\tif timeout != nil {\n\t\tqueryParameters[\"timeout\"] = autorest.Encode(\"query\", *timeout)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsDelete(),\n\t\tautorest.WithCustomBaseURL(\"http://{accountName}.{dnsSuffix}\", urlParameters),\n\t\tautorest.WithPathParameters(\"/{filesystem}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(ifModifiedSince) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Modified-Since\", autorest.String(ifModifiedSince)))\n\t}\n\tif len(ifUnmodifiedSince) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-Unmodified-Since\", autorest.String(ifUnmodifiedSince)))\n\t}\n\tif len(xMsClientRequestID) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-client-request-id\", autorest.String(xMsClientRequestID)))\n\t}\n\tif len(xMsDate) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-date\", autorest.String(xMsDate)))\n\t}\n\tif len(client.XMsVersion) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"x-ms-version\", autorest.String(client.XMsVersion)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "a76518b3e0d2847a29d79d216ee3ea7f", "score": "0.5500621", "text": "func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"authorizationRuleName\": autorest.Encode(\"path\", authorizationRuleName),\n\t\t\"eventHubName\": autorest.Encode(\"path\", eventHubName),\n\t\t\"namespaceName\": autorest.Encode(\"path\", namespaceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2017-04-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d8222af6507b28401b5f0d11ff4aacf5", "score": "0.54958767", "text": "func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, communicationServiceName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"communicationServiceName\": autorest.Encode(\"path\", communicationServiceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-08-20-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5fefc04370a9c2ae817920cdf031a75c", "score": "0.54890406", "text": "func (l Lots) lotsPreparer(ctx context.Context) (*http.Request, error) {\n\tif !l.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(l.NextLink)))\n}", "title": "" }, { "docid": "8fee0615b70246aa52bc076c88210e09", "score": "0.54885095", "text": "func (client BaseClient) UpdateTagPreparer(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID, updatedTag Tag) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"projectId\": autorest.Encode(\"path\", projectID),\n\t\t\"tagId\": autorest.Encode(\"path\", tagID),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/customvision/v2.2/Training\", urlParameters),\n\t\tautorest.WithPathParameters(\"/projects/{projectId}/tags/{tagId}\", pathParameters),\n\t\tautorest.WithJSON(updatedTag),\n\t\tautorest.WithHeader(\"Training-Key\", client.APIKey))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "f25c84e255186c93577daf0eabd406fa", "score": "0.5483495", "text": "func (client ResourceHealthMetadataClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2021-03-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "021402fe2cafa810f80599c58f86d01e", "score": "0.54834497", "text": "func (client EvaluationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/personalizer/v1.0\", urlParameters),\n\t\tautorest.WithPath(\"/evaluations\"))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "2a35c2dfa3f28b17fc25d26cd95e98e7", "score": "0.5473668", "text": "func (client BaseClient) TrainProjectPreparer(ctx context.Context, projectID uuid.UUID) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"projectId\": autorest.Encode(\"path\", projectID),\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/customvision/v2.2/Training\", urlParameters),\n\t\tautorest.WithPathParameters(\"/projects/{projectId}/train\", pathParameters),\n\t\tautorest.WithHeader(\"Training-Key\", client.APIKey))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "4d44e1f666abcb9e44c9601810ea2ff4", "score": "0.54671663", "text": "func (client SecurityPoliciesClient) PatchPreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicyProperties SecurityPolicyProperties) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"profileName\": autorest.Encode(\"path\", profileName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"securityPolicyName\": autorest.Encode(\"path\", securityPolicyName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2020-09-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPatch(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}\", pathParameters),\n\t\tautorest.WithJSON(securityPolicyProperties),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" } ]
bd47bdbce68f33e9904e2aefe9f91dd0
AssignProperties_To_SignalRCorsSettings populates the provided destination SignalRCorsSettings from our SignalRCorsSettings
[ { "docid": "39a1d81d1f96ff18425babaaf617e0c3", "score": "0.7199651", "text": "func (settings *SignalRCorsSettings) AssignProperties_To_SignalRCorsSettings(destination *v1beta20211001s.SignalRCorsSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AllowedOrigins\n\tdestination.AllowedOrigins = genruntime.CloneSliceOfString(settings.AllowedOrigins)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" } ]
[ { "docid": "9f6481329d916f46f4d766c894451ee3", "score": "0.7141197", "text": "func (settings *SignalRCorsSettings) AssignProperties_From_SignalRCorsSettings(source *v1beta20211001s.SignalRCorsSettings) error {\n\n\t// AllowedOrigins\n\tsettings.AllowedOrigins = genruntime.CloneSliceOfString(source.AllowedOrigins)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "9d921f2d3ec8c195692967fc0ff06181", "score": "0.67603195", "text": "func (settings *SignalRTlsSettings) AssignProperties_To_SignalRTlsSettings(destination *v1beta20211001s.SignalRTlsSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// ClientCertEnabled\n\tif settings.ClientCertEnabled != nil {\n\t\tclientCertEnabled := *settings.ClientCertEnabled\n\t\tdestination.ClientCertEnabled = &clientCertEnabled\n\t} else {\n\t\tdestination.ClientCertEnabled = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "1d86890a2ffd6d058de2880e3696c2c0", "score": "0.67238796", "text": "func (signalR *SignalR_Spec) AssignProperties_To_SignalR_Spec(destination *v1beta20211001s.SignalR_Spec) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AzureName\n\tdestination.AzureName = signalR.AzureName\n\n\t// Cors\n\tif signalR.Cors != nil {\n\t\tvar cor v1beta20211001s.SignalRCorsSettings\n\t\terr := signalR.Cors.AssignProperties_To_SignalRCorsSettings(&cor)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRCorsSettings() to populate field Cors\")\n\t\t}\n\t\tdestination.Cors = &cor\n\t} else {\n\t\tdestination.Cors = nil\n\t}\n\n\t// DisableAadAuth\n\tif signalR.DisableAadAuth != nil {\n\t\tdisableAadAuth := *signalR.DisableAadAuth\n\t\tdestination.DisableAadAuth = &disableAadAuth\n\t} else {\n\t\tdestination.DisableAadAuth = nil\n\t}\n\n\t// DisableLocalAuth\n\tif signalR.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *signalR.DisableLocalAuth\n\t\tdestination.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tdestination.DisableLocalAuth = nil\n\t}\n\n\t// Features\n\tif signalR.Features != nil {\n\t\tfeatureList := make([]v1beta20211001s.SignalRFeature, len(signalR.Features))\n\t\tfor featureIndex, featureItem := range signalR.Features {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tfeatureItem := featureItem\n\t\t\tvar feature v1beta20211001s.SignalRFeature\n\t\t\terr := featureItem.AssignProperties_To_SignalRFeature(&feature)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRFeature() to populate field Features\")\n\t\t\t}\n\t\t\tfeatureList[featureIndex] = feature\n\t\t}\n\t\tdestination.Features = featureList\n\t} else {\n\t\tdestination.Features = nil\n\t}\n\n\t// Identity\n\tif signalR.Identity != nil {\n\t\tvar identity v1beta20211001s.ManagedIdentity\n\t\terr := signalR.Identity.AssignProperties_To_ManagedIdentity(&identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ManagedIdentity() to populate field Identity\")\n\t\t}\n\t\tdestination.Identity = &identity\n\t} else {\n\t\tdestination.Identity = nil\n\t}\n\n\t// Kind\n\tif signalR.Kind != nil {\n\t\tkind := string(*signalR.Kind)\n\t\tdestination.Kind = &kind\n\t} else {\n\t\tdestination.Kind = nil\n\t}\n\n\t// Location\n\tdestination.Location = genruntime.ClonePointerToString(signalR.Location)\n\n\t// NetworkACLs\n\tif signalR.NetworkACLs != nil {\n\t\tvar networkACL v1beta20211001s.SignalRNetworkACLs\n\t\terr := signalR.NetworkACLs.AssignProperties_To_SignalRNetworkACLs(&networkACL)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRNetworkACLs() to populate field NetworkACLs\")\n\t\t}\n\t\tdestination.NetworkACLs = &networkACL\n\t} else {\n\t\tdestination.NetworkACLs = nil\n\t}\n\n\t// OriginalVersion\n\tdestination.OriginalVersion = signalR.OriginalVersion()\n\n\t// Owner\n\tif signalR.Owner != nil {\n\t\towner := signalR.Owner.Copy()\n\t\tdestination.Owner = &owner\n\t} else {\n\t\tdestination.Owner = nil\n\t}\n\n\t// PublicNetworkAccess\n\tdestination.PublicNetworkAccess = genruntime.ClonePointerToString(signalR.PublicNetworkAccess)\n\n\t// ResourceLogConfiguration\n\tif signalR.ResourceLogConfiguration != nil {\n\t\tvar resourceLogConfiguration v1beta20211001s.ResourceLogConfiguration\n\t\terr := signalR.ResourceLogConfiguration.AssignProperties_To_ResourceLogConfiguration(&resourceLogConfiguration)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ResourceLogConfiguration() to populate field ResourceLogConfiguration\")\n\t\t}\n\t\tdestination.ResourceLogConfiguration = &resourceLogConfiguration\n\t} else {\n\t\tdestination.ResourceLogConfiguration = nil\n\t}\n\n\t// Sku\n\tif signalR.Sku != nil {\n\t\tvar sku v1beta20211001s.ResourceSku\n\t\terr := signalR.Sku.AssignProperties_To_ResourceSku(&sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ResourceSku() to populate field Sku\")\n\t\t}\n\t\tdestination.Sku = &sku\n\t} else {\n\t\tdestination.Sku = nil\n\t}\n\n\t// Tags\n\tdestination.Tags = genruntime.CloneMapOfStringToString(signalR.Tags)\n\n\t// Tls\n\tif signalR.Tls != nil {\n\t\tvar tl v1beta20211001s.SignalRTlsSettings\n\t\terr := signalR.Tls.AssignProperties_To_SignalRTlsSettings(&tl)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRTlsSettings() to populate field Tls\")\n\t\t}\n\t\tdestination.Tls = &tl\n\t} else {\n\t\tdestination.Tls = nil\n\t}\n\n\t// Upstream\n\tif signalR.Upstream != nil {\n\t\tvar upstream v1beta20211001s.ServerlessUpstreamSettings\n\t\terr := signalR.Upstream.AssignProperties_To_ServerlessUpstreamSettings(&upstream)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ServerlessUpstreamSettings() to populate field Upstream\")\n\t\t}\n\t\tdestination.Upstream = &upstream\n\t} else {\n\t\tdestination.Upstream = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "3a0a5ad3caacec00e72621662317f19d", "score": "0.64785", "text": "func (signalR *SignalR_Spec) AssignProperties_From_SignalR_Spec(source *v1beta20211001s.SignalR_Spec) error {\n\n\t// AzureName\n\tsignalR.AzureName = source.AzureName\n\n\t// Cors\n\tif source.Cors != nil {\n\t\tvar cor SignalRCorsSettings\n\t\terr := cor.AssignProperties_From_SignalRCorsSettings(source.Cors)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRCorsSettings() to populate field Cors\")\n\t\t}\n\t\tsignalR.Cors = &cor\n\t} else {\n\t\tsignalR.Cors = nil\n\t}\n\n\t// DisableAadAuth\n\tif source.DisableAadAuth != nil {\n\t\tdisableAadAuth := *source.DisableAadAuth\n\t\tsignalR.DisableAadAuth = &disableAadAuth\n\t} else {\n\t\tsignalR.DisableAadAuth = nil\n\t}\n\n\t// DisableLocalAuth\n\tif source.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *source.DisableLocalAuth\n\t\tsignalR.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tsignalR.DisableLocalAuth = nil\n\t}\n\n\t// Features\n\tif source.Features != nil {\n\t\tfeatureList := make([]SignalRFeature, len(source.Features))\n\t\tfor featureIndex, featureItem := range source.Features {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tfeatureItem := featureItem\n\t\t\tvar feature SignalRFeature\n\t\t\terr := feature.AssignProperties_From_SignalRFeature(&featureItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRFeature() to populate field Features\")\n\t\t\t}\n\t\t\tfeatureList[featureIndex] = feature\n\t\t}\n\t\tsignalR.Features = featureList\n\t} else {\n\t\tsignalR.Features = nil\n\t}\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity ManagedIdentity\n\t\terr := identity.AssignProperties_From_ManagedIdentity(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ManagedIdentity() to populate field Identity\")\n\t\t}\n\t\tsignalR.Identity = &identity\n\t} else {\n\t\tsignalR.Identity = nil\n\t}\n\n\t// Kind\n\tif source.Kind != nil {\n\t\tkind := ServiceKind(*source.Kind)\n\t\tsignalR.Kind = &kind\n\t} else {\n\t\tsignalR.Kind = nil\n\t}\n\n\t// Location\n\tsignalR.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// NetworkACLs\n\tif source.NetworkACLs != nil {\n\t\tvar networkACL SignalRNetworkACLs\n\t\terr := networkACL.AssignProperties_From_SignalRNetworkACLs(source.NetworkACLs)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRNetworkACLs() to populate field NetworkACLs\")\n\t\t}\n\t\tsignalR.NetworkACLs = &networkACL\n\t} else {\n\t\tsignalR.NetworkACLs = nil\n\t}\n\n\t// Owner\n\tif source.Owner != nil {\n\t\towner := source.Owner.Copy()\n\t\tsignalR.Owner = &owner\n\t} else {\n\t\tsignalR.Owner = nil\n\t}\n\n\t// PublicNetworkAccess\n\tsignalR.PublicNetworkAccess = genruntime.ClonePointerToString(source.PublicNetworkAccess)\n\n\t// ResourceLogConfiguration\n\tif source.ResourceLogConfiguration != nil {\n\t\tvar resourceLogConfiguration ResourceLogConfiguration\n\t\terr := resourceLogConfiguration.AssignProperties_From_ResourceLogConfiguration(source.ResourceLogConfiguration)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ResourceLogConfiguration() to populate field ResourceLogConfiguration\")\n\t\t}\n\t\tsignalR.ResourceLogConfiguration = &resourceLogConfiguration\n\t} else {\n\t\tsignalR.ResourceLogConfiguration = nil\n\t}\n\n\t// Sku\n\tif source.Sku != nil {\n\t\tvar sku ResourceSku\n\t\terr := sku.AssignProperties_From_ResourceSku(source.Sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ResourceSku() to populate field Sku\")\n\t\t}\n\t\tsignalR.Sku = &sku\n\t} else {\n\t\tsignalR.Sku = nil\n\t}\n\n\t// Tags\n\tsignalR.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// Tls\n\tif source.Tls != nil {\n\t\tvar tl SignalRTlsSettings\n\t\terr := tl.AssignProperties_From_SignalRTlsSettings(source.Tls)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRTlsSettings() to populate field Tls\")\n\t\t}\n\t\tsignalR.Tls = &tl\n\t} else {\n\t\tsignalR.Tls = nil\n\t}\n\n\t// Upstream\n\tif source.Upstream != nil {\n\t\tvar upstream ServerlessUpstreamSettings\n\t\terr := upstream.AssignProperties_From_ServerlessUpstreamSettings(source.Upstream)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ServerlessUpstreamSettings() to populate field Upstream\")\n\t\t}\n\t\tsignalR.Upstream = &upstream\n\t} else {\n\t\tsignalR.Upstream = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "90db712ef3934d7110a0ac9c434b55df", "score": "0.6431845", "text": "func (settings *SignalRTlsSettings) AssignProperties_From_SignalRTlsSettings(source *v1beta20211001s.SignalRTlsSettings) error {\n\n\t// ClientCertEnabled\n\tif source.ClientCertEnabled != nil {\n\t\tclientCertEnabled := *source.ClientCertEnabled\n\t\tsettings.ClientCertEnabled = &clientCertEnabled\n\t} else {\n\t\tsettings.ClientCertEnabled = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "97acc63123777d057d5db2b183a798ff", "score": "0.6139031", "text": "func (signalR *SignalR) AssignProperties_From_SignalR(source *v1beta20211001s.SignalR) error {\n\n\t// ObjectMeta\n\tsignalR.ObjectMeta = *source.ObjectMeta.DeepCopy()\n\n\t// Spec\n\tvar spec SignalR_Spec\n\terr := spec.AssignProperties_From_SignalR_Spec(&source.Spec)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalR_Spec() to populate field Spec\")\n\t}\n\tsignalR.Spec = spec\n\n\t// Status\n\tvar status SignalR_STATUS\n\terr = status.AssignProperties_From_SignalR_STATUS(&source.Status)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalR_STATUS() to populate field Status\")\n\t}\n\tsignalR.Status = status\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0c28c22a8bfad9ebfa4c721275368048", "score": "0.61177015", "text": "func (signalR *SignalR) AssignProperties_To_SignalR(destination *v1beta20211001s.SignalR) error {\n\n\t// ObjectMeta\n\tdestination.ObjectMeta = *signalR.ObjectMeta.DeepCopy()\n\n\t// Spec\n\tvar spec v1beta20211001s.SignalR_Spec\n\terr := signalR.Spec.AssignProperties_To_SignalR_Spec(&spec)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalR_Spec() to populate field Spec\")\n\t}\n\tdestination.Spec = spec\n\n\t// Status\n\tvar status v1beta20211001s.SignalR_STATUS\n\terr = signalR.Status.AssignProperties_To_SignalR_STATUS(&status)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalR_STATUS() to populate field Status\")\n\t}\n\tdestination.Status = status\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "77a81465e888f56ddd0f69db6196d7e4", "score": "0.5887434", "text": "func (settings *ServerlessUpstreamSettings) AssignProperties_From_ServerlessUpstreamSettings(source *v1beta20211001s.ServerlessUpstreamSettings) error {\n\n\t// Templates\n\tif source.Templates != nil {\n\t\ttemplateList := make([]UpstreamTemplate, len(source.Templates))\n\t\tfor templateIndex, templateItem := range source.Templates {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttemplateItem := templateItem\n\t\t\tvar template UpstreamTemplate\n\t\t\terr := template.AssignProperties_From_UpstreamTemplate(&templateItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_UpstreamTemplate() to populate field Templates\")\n\t\t\t}\n\t\t\ttemplateList[templateIndex] = template\n\t\t}\n\t\tsettings.Templates = templateList\n\t} else {\n\t\tsettings.Templates = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "ad2925c01c50e1b7e7343762dfa735e1", "score": "0.58859986", "text": "func (settings *SignalRCorsSettings_STATUS) AssignProperties_To_SignalRCorsSettings_STATUS(destination *v1beta20211001s.SignalRCorsSettings_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AllowedOrigins\n\tdestination.AllowedOrigins = genruntime.CloneSliceOfString(settings.AllowedOrigins)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "a1353950028d2f4af439c579ca590ae9", "score": "0.58681667", "text": "func (signalR *SignalR_STATUS) AssignProperties_To_SignalR_STATUS(destination *v1beta20211001s.SignalR_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Conditions\n\tdestination.Conditions = genruntime.CloneSliceOfCondition(signalR.Conditions)\n\n\t// Cors\n\tif signalR.Cors != nil {\n\t\tvar cor v1beta20211001s.SignalRCorsSettings_STATUS\n\t\terr := signalR.Cors.AssignProperties_To_SignalRCorsSettings_STATUS(&cor)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRCorsSettings_STATUS() to populate field Cors\")\n\t\t}\n\t\tdestination.Cors = &cor\n\t} else {\n\t\tdestination.Cors = nil\n\t}\n\n\t// DisableAadAuth\n\tif signalR.DisableAadAuth != nil {\n\t\tdisableAadAuth := *signalR.DisableAadAuth\n\t\tdestination.DisableAadAuth = &disableAadAuth\n\t} else {\n\t\tdestination.DisableAadAuth = nil\n\t}\n\n\t// DisableLocalAuth\n\tif signalR.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *signalR.DisableLocalAuth\n\t\tdestination.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tdestination.DisableLocalAuth = nil\n\t}\n\n\t// ExternalIP\n\tdestination.ExternalIP = genruntime.ClonePointerToString(signalR.ExternalIP)\n\n\t// Features\n\tif signalR.Features != nil {\n\t\tfeatureList := make([]v1beta20211001s.SignalRFeature_STATUS, len(signalR.Features))\n\t\tfor featureIndex, featureItem := range signalR.Features {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tfeatureItem := featureItem\n\t\t\tvar feature v1beta20211001s.SignalRFeature_STATUS\n\t\t\terr := featureItem.AssignProperties_To_SignalRFeature_STATUS(&feature)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRFeature_STATUS() to populate field Features\")\n\t\t\t}\n\t\t\tfeatureList[featureIndex] = feature\n\t\t}\n\t\tdestination.Features = featureList\n\t} else {\n\t\tdestination.Features = nil\n\t}\n\n\t// HostName\n\tdestination.HostName = genruntime.ClonePointerToString(signalR.HostName)\n\n\t// HostNamePrefix\n\tdestination.HostNamePrefix = genruntime.ClonePointerToString(signalR.HostNamePrefix)\n\n\t// Id\n\tdestination.Id = genruntime.ClonePointerToString(signalR.Id)\n\n\t// Identity\n\tif signalR.Identity != nil {\n\t\tvar identity v1beta20211001s.ManagedIdentity_STATUS\n\t\terr := signalR.Identity.AssignProperties_To_ManagedIdentity_STATUS(&identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ManagedIdentity_STATUS() to populate field Identity\")\n\t\t}\n\t\tdestination.Identity = &identity\n\t} else {\n\t\tdestination.Identity = nil\n\t}\n\n\t// Kind\n\tif signalR.Kind != nil {\n\t\tkind := string(*signalR.Kind)\n\t\tdestination.Kind = &kind\n\t} else {\n\t\tdestination.Kind = nil\n\t}\n\n\t// Location\n\tdestination.Location = genruntime.ClonePointerToString(signalR.Location)\n\n\t// Name\n\tdestination.Name = genruntime.ClonePointerToString(signalR.Name)\n\n\t// NetworkACLs\n\tif signalR.NetworkACLs != nil {\n\t\tvar networkACL v1beta20211001s.SignalRNetworkACLs_STATUS\n\t\terr := signalR.NetworkACLs.AssignProperties_To_SignalRNetworkACLs_STATUS(&networkACL)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRNetworkACLs_STATUS() to populate field NetworkACLs\")\n\t\t}\n\t\tdestination.NetworkACLs = &networkACL\n\t} else {\n\t\tdestination.NetworkACLs = nil\n\t}\n\n\t// PrivateEndpointConnections\n\tif signalR.PrivateEndpointConnections != nil {\n\t\tprivateEndpointConnectionList := make([]v1beta20211001s.PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded, len(signalR.PrivateEndpointConnections))\n\t\tfor privateEndpointConnectionIndex, privateEndpointConnectionItem := range signalR.PrivateEndpointConnections {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tprivateEndpointConnectionItem := privateEndpointConnectionItem\n\t\t\tvar privateEndpointConnection v1beta20211001s.PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded\n\t\t\terr := privateEndpointConnectionItem.AssignProperties_To_PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded(&privateEndpointConnection)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded() to populate field PrivateEndpointConnections\")\n\t\t\t}\n\t\t\tprivateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection\n\t\t}\n\t\tdestination.PrivateEndpointConnections = privateEndpointConnectionList\n\t} else {\n\t\tdestination.PrivateEndpointConnections = nil\n\t}\n\n\t// ProvisioningState\n\tif signalR.ProvisioningState != nil {\n\t\tprovisioningState := string(*signalR.ProvisioningState)\n\t\tdestination.ProvisioningState = &provisioningState\n\t} else {\n\t\tdestination.ProvisioningState = nil\n\t}\n\n\t// PublicNetworkAccess\n\tdestination.PublicNetworkAccess = genruntime.ClonePointerToString(signalR.PublicNetworkAccess)\n\n\t// PublicPort\n\tdestination.PublicPort = genruntime.ClonePointerToInt(signalR.PublicPort)\n\n\t// ResourceLogConfiguration\n\tif signalR.ResourceLogConfiguration != nil {\n\t\tvar resourceLogConfiguration v1beta20211001s.ResourceLogConfiguration_STATUS\n\t\terr := signalR.ResourceLogConfiguration.AssignProperties_To_ResourceLogConfiguration_STATUS(&resourceLogConfiguration)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ResourceLogConfiguration_STATUS() to populate field ResourceLogConfiguration\")\n\t\t}\n\t\tdestination.ResourceLogConfiguration = &resourceLogConfiguration\n\t} else {\n\t\tdestination.ResourceLogConfiguration = nil\n\t}\n\n\t// ServerPort\n\tdestination.ServerPort = genruntime.ClonePointerToInt(signalR.ServerPort)\n\n\t// SharedPrivateLinkResources\n\tif signalR.SharedPrivateLinkResources != nil {\n\t\tsharedPrivateLinkResourceList := make([]v1beta20211001s.SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded, len(signalR.SharedPrivateLinkResources))\n\t\tfor sharedPrivateLinkResourceIndex, sharedPrivateLinkResourceItem := range signalR.SharedPrivateLinkResources {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tsharedPrivateLinkResourceItem := sharedPrivateLinkResourceItem\n\t\t\tvar sharedPrivateLinkResource v1beta20211001s.SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded\n\t\t\terr := sharedPrivateLinkResourceItem.AssignProperties_To_SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded(&sharedPrivateLinkResource)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded() to populate field SharedPrivateLinkResources\")\n\t\t\t}\n\t\t\tsharedPrivateLinkResourceList[sharedPrivateLinkResourceIndex] = sharedPrivateLinkResource\n\t\t}\n\t\tdestination.SharedPrivateLinkResources = sharedPrivateLinkResourceList\n\t} else {\n\t\tdestination.SharedPrivateLinkResources = nil\n\t}\n\n\t// Sku\n\tif signalR.Sku != nil {\n\t\tvar sku v1beta20211001s.ResourceSku_STATUS\n\t\terr := signalR.Sku.AssignProperties_To_ResourceSku_STATUS(&sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ResourceSku_STATUS() to populate field Sku\")\n\t\t}\n\t\tdestination.Sku = &sku\n\t} else {\n\t\tdestination.Sku = nil\n\t}\n\n\t// SystemData\n\tif signalR.SystemData != nil {\n\t\tvar systemDatum v1beta20211001s.SystemData_STATUS\n\t\terr := signalR.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SystemData_STATUS() to populate field SystemData\")\n\t\t}\n\t\tdestination.SystemData = &systemDatum\n\t} else {\n\t\tdestination.SystemData = nil\n\t}\n\n\t// Tags\n\tdestination.Tags = genruntime.CloneMapOfStringToString(signalR.Tags)\n\n\t// Tls\n\tif signalR.Tls != nil {\n\t\tvar tl v1beta20211001s.SignalRTlsSettings_STATUS\n\t\terr := signalR.Tls.AssignProperties_To_SignalRTlsSettings_STATUS(&tl)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SignalRTlsSettings_STATUS() to populate field Tls\")\n\t\t}\n\t\tdestination.Tls = &tl\n\t} else {\n\t\tdestination.Tls = nil\n\t}\n\n\t// Type\n\tdestination.Type = genruntime.ClonePointerToString(signalR.Type)\n\n\t// Upstream\n\tif signalR.Upstream != nil {\n\t\tvar upstream v1beta20211001s.ServerlessUpstreamSettings_STATUS\n\t\terr := signalR.Upstream.AssignProperties_To_ServerlessUpstreamSettings_STATUS(&upstream)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ServerlessUpstreamSettings_STATUS() to populate field Upstream\")\n\t\t}\n\t\tdestination.Upstream = &upstream\n\t} else {\n\t\tdestination.Upstream = nil\n\t}\n\n\t// Version\n\tdestination.Version = genruntime.ClonePointerToString(signalR.Version)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7e73ad8f9712d0591aa2ff10f1e1a942", "score": "0.5790012", "text": "func (settings *CosmosDbSettings) AssignProperties_From_CosmosDbSettings(source *v20210701s.CosmosDbSettings) error {\n\n\t// CollectionsThroughput\n\tsettings.CollectionsThroughput = genruntime.ClonePointerToInt(source.CollectionsThroughput)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "6e66503a43d2474afa4730bbd3ef8fd1", "score": "0.5687855", "text": "func (patchSettingsStatus *PatchSettings_Status) AssignPropertiesToPatchSettingsStatus(destination *v1alpha1api20201201storage.PatchSettings_Status) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// EnableHotpatching\n\tif patchSettingsStatus.EnableHotpatching != nil {\n\t\tenableHotpatching := *patchSettingsStatus.EnableHotpatching\n\t\tdestination.EnableHotpatching = &enableHotpatching\n\t} else {\n\t\tdestination.EnableHotpatching = nil\n\t}\n\n\t// PatchMode\n\tif patchSettingsStatus.PatchMode != nil {\n\t\tpatchMode := string(*patchSettingsStatus.PatchMode)\n\t\tdestination.PatchMode = &patchMode\n\t} else {\n\t\tdestination.PatchMode = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "2695b16d9169dff1de692d26c7ca47c2", "score": "0.5659737", "text": "func (settings *SignalRCorsSettings_STATUS) AssignProperties_From_SignalRCorsSettings_STATUS(source *v1beta20211001s.SignalRCorsSettings_STATUS) error {\n\n\t// AllowedOrigins\n\tsettings.AllowedOrigins = genruntime.CloneSliceOfString(source.AllowedOrigins)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "96f1426826cba463489edbe07038658b", "score": "0.5654589", "text": "func (settings *SignalRTlsSettings_STATUS) AssignProperties_To_SignalRTlsSettings_STATUS(destination *v1beta20211001s.SignalRTlsSettings_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// ClientCertEnabled\n\tif settings.ClientCertEnabled != nil {\n\t\tclientCertEnabled := *settings.ClientCertEnabled\n\t\tdestination.ClientCertEnabled = &clientCertEnabled\n\t} else {\n\t\tdestination.ClientCertEnabled = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "9d05bf12ff971e31735c0d905786c80c", "score": "0.5646058", "text": "func (patchSettings *PatchSettings) AssignPropertiesToPatchSettings(destination *v1alpha1api20201201storage.PatchSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// EnableHotpatching\n\tif patchSettings.EnableHotpatching != nil {\n\t\tenableHotpatching := *patchSettings.EnableHotpatching\n\t\tdestination.EnableHotpatching = &enableHotpatching\n\t} else {\n\t\tdestination.EnableHotpatching = nil\n\t}\n\n\t// PatchMode\n\tif patchSettings.PatchMode != nil {\n\t\tpatchMode := string(*patchSettings.PatchMode)\n\t\tdestination.PatchMode = &patchMode\n\t} else {\n\t\tdestination.PatchMode = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "08e8fde340f807c3e9003ab5180b47bb", "score": "0.56041086", "text": "func (settings *ServerlessUpstreamSettings) AssignProperties_To_ServerlessUpstreamSettings(destination *v1beta20211001s.ServerlessUpstreamSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Templates\n\tif settings.Templates != nil {\n\t\ttemplateList := make([]v1beta20211001s.UpstreamTemplate, len(settings.Templates))\n\t\tfor templateIndex, templateItem := range settings.Templates {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttemplateItem := templateItem\n\t\t\tvar template v1beta20211001s.UpstreamTemplate\n\t\t\terr := templateItem.AssignProperties_To_UpstreamTemplate(&template)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_UpstreamTemplate() to populate field Templates\")\n\t\t\t}\n\t\t\ttemplateList[templateIndex] = template\n\t\t}\n\t\tdestination.Templates = templateList\n\t} else {\n\t\tdestination.Templates = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "ac3a930cc94f3bcd5cf26448d83d5149", "score": "0.5601637", "text": "func (settings *CrossSubscriptionRestoreSettings) AssignProperties_To_CrossSubscriptionRestoreSettings(destination *v20230101s.CrossSubscriptionRestoreSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// State\n\tif settings.State != nil {\n\t\tstate := string(*settings.State)\n\t\tdestination.State = &state\n\t} else {\n\t\tdestination.State = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "efce1d2dc4a6ac0f6e8e5c6cb8b14759", "score": "0.5595958", "text": "func (virtualMachineScaleSetNetworkConfigurationDnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings) AssignPropertiesToVirtualMachineScaleSetNetworkConfigurationDnsSettings(destination *v1alpha1api20201201storage.VirtualMachineScaleSetNetworkConfigurationDnsSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// DnsServers\n\tdnsServerList := make([]string, len(virtualMachineScaleSetNetworkConfigurationDnsSettings.DnsServers))\n\tfor dnsServerIndex, dnsServerItem := range virtualMachineScaleSetNetworkConfigurationDnsSettings.DnsServers {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tdnsServerItem := dnsServerItem\n\t\tdnsServerList[dnsServerIndex] = dnsServerItem\n\t}\n\tdestination.DnsServers = dnsServerList\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "f7c190d44b787c76ac248b269bdeba2f", "score": "0.55784065", "text": "func (connection *Workspaces_Connection_Spec) AssignProperties_To_Workspaces_Connection_Spec(destination *v20210701s.Workspaces_Connection_Spec) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(connection.PropertyBag)\n\n\t// AuthType\n\tdestination.AuthType = genruntime.ClonePointerToString(connection.AuthType)\n\n\t// AzureName\n\tdestination.AzureName = connection.AzureName\n\n\t// Category\n\tdestination.Category = genruntime.ClonePointerToString(connection.Category)\n\n\t// OriginalVersion\n\tdestination.OriginalVersion = connection.OriginalVersion\n\n\t// Owner\n\tif connection.Owner != nil {\n\t\towner := connection.Owner.Copy()\n\t\tdestination.Owner = &owner\n\t} else {\n\t\tdestination.Owner = nil\n\t}\n\n\t// Target\n\tdestination.Target = genruntime.ClonePointerToString(connection.Target)\n\n\t// Value\n\tdestination.Value = genruntime.ClonePointerToString(connection.Value)\n\n\t// ValueFormat\n\tdestination.ValueFormat = genruntime.ClonePointerToString(connection.ValueFormat)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForWorkspaces_Connection_Spec interface (if implemented) to customize the conversion\n\tvar connectionAsAny any = connection\n\tif augmentedConnection, ok := connectionAsAny.(augmentConversionForWorkspaces_Connection_Spec); ok {\n\t\terr := augmentedConnection.AssignPropertiesTo(destination)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesTo() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "cfe0169045d99a43c4bd6ada34b63474", "score": "0.5556964", "text": "func (patchSettings *PatchSettings) AssignPropertiesFromPatchSettings(source *v1alpha1api20201201storage.PatchSettings) error {\n\n\t// EnableHotpatching\n\tif source.EnableHotpatching != nil {\n\t\tenableHotpatching := *source.EnableHotpatching\n\t\tpatchSettings.EnableHotpatching = &enableHotpatching\n\t} else {\n\t\tpatchSettings.EnableHotpatching = nil\n\t}\n\n\t// PatchMode\n\tif source.PatchMode != nil {\n\t\tpatchMode := PatchSettingsPatchMode(*source.PatchMode)\n\t\tpatchSettings.PatchMode = &patchMode\n\t} else {\n\t\tpatchSettings.PatchMode = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "8bd7812bd553b93b45c6baf730bf5bee", "score": "0.553913", "text": "func (signalR *SignalR_STATUS) AssignProperties_From_SignalR_STATUS(source *v1beta20211001s.SignalR_STATUS) error {\n\n\t// Conditions\n\tsignalR.Conditions = genruntime.CloneSliceOfCondition(source.Conditions)\n\n\t// Cors\n\tif source.Cors != nil {\n\t\tvar cor SignalRCorsSettings_STATUS\n\t\terr := cor.AssignProperties_From_SignalRCorsSettings_STATUS(source.Cors)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRCorsSettings_STATUS() to populate field Cors\")\n\t\t}\n\t\tsignalR.Cors = &cor\n\t} else {\n\t\tsignalR.Cors = nil\n\t}\n\n\t// DisableAadAuth\n\tif source.DisableAadAuth != nil {\n\t\tdisableAadAuth := *source.DisableAadAuth\n\t\tsignalR.DisableAadAuth = &disableAadAuth\n\t} else {\n\t\tsignalR.DisableAadAuth = nil\n\t}\n\n\t// DisableLocalAuth\n\tif source.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *source.DisableLocalAuth\n\t\tsignalR.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tsignalR.DisableLocalAuth = nil\n\t}\n\n\t// ExternalIP\n\tsignalR.ExternalIP = genruntime.ClonePointerToString(source.ExternalIP)\n\n\t// Features\n\tif source.Features != nil {\n\t\tfeatureList := make([]SignalRFeature_STATUS, len(source.Features))\n\t\tfor featureIndex, featureItem := range source.Features {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tfeatureItem := featureItem\n\t\t\tvar feature SignalRFeature_STATUS\n\t\t\terr := feature.AssignProperties_From_SignalRFeature_STATUS(&featureItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRFeature_STATUS() to populate field Features\")\n\t\t\t}\n\t\t\tfeatureList[featureIndex] = feature\n\t\t}\n\t\tsignalR.Features = featureList\n\t} else {\n\t\tsignalR.Features = nil\n\t}\n\n\t// HostName\n\tsignalR.HostName = genruntime.ClonePointerToString(source.HostName)\n\n\t// HostNamePrefix\n\tsignalR.HostNamePrefix = genruntime.ClonePointerToString(source.HostNamePrefix)\n\n\t// Id\n\tsignalR.Id = genruntime.ClonePointerToString(source.Id)\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity ManagedIdentity_STATUS\n\t\terr := identity.AssignProperties_From_ManagedIdentity_STATUS(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ManagedIdentity_STATUS() to populate field Identity\")\n\t\t}\n\t\tsignalR.Identity = &identity\n\t} else {\n\t\tsignalR.Identity = nil\n\t}\n\n\t// Kind\n\tif source.Kind != nil {\n\t\tkind := ServiceKind_STATUS(*source.Kind)\n\t\tsignalR.Kind = &kind\n\t} else {\n\t\tsignalR.Kind = nil\n\t}\n\n\t// Location\n\tsignalR.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// Name\n\tsignalR.Name = genruntime.ClonePointerToString(source.Name)\n\n\t// NetworkACLs\n\tif source.NetworkACLs != nil {\n\t\tvar networkACL SignalRNetworkACLs_STATUS\n\t\terr := networkACL.AssignProperties_From_SignalRNetworkACLs_STATUS(source.NetworkACLs)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRNetworkACLs_STATUS() to populate field NetworkACLs\")\n\t\t}\n\t\tsignalR.NetworkACLs = &networkACL\n\t} else {\n\t\tsignalR.NetworkACLs = nil\n\t}\n\n\t// PrivateEndpointConnections\n\tif source.PrivateEndpointConnections != nil {\n\t\tprivateEndpointConnectionList := make([]PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded, len(source.PrivateEndpointConnections))\n\t\tfor privateEndpointConnectionIndex, privateEndpointConnectionItem := range source.PrivateEndpointConnections {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tprivateEndpointConnectionItem := privateEndpointConnectionItem\n\t\t\tvar privateEndpointConnection PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded\n\t\t\terr := privateEndpointConnection.AssignProperties_From_PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded(&privateEndpointConnectionItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded() to populate field PrivateEndpointConnections\")\n\t\t\t}\n\t\t\tprivateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection\n\t\t}\n\t\tsignalR.PrivateEndpointConnections = privateEndpointConnectionList\n\t} else {\n\t\tsignalR.PrivateEndpointConnections = nil\n\t}\n\n\t// ProvisioningState\n\tif source.ProvisioningState != nil {\n\t\tprovisioningState := ProvisioningState_STATUS(*source.ProvisioningState)\n\t\tsignalR.ProvisioningState = &provisioningState\n\t} else {\n\t\tsignalR.ProvisioningState = nil\n\t}\n\n\t// PublicNetworkAccess\n\tsignalR.PublicNetworkAccess = genruntime.ClonePointerToString(source.PublicNetworkAccess)\n\n\t// PublicPort\n\tsignalR.PublicPort = genruntime.ClonePointerToInt(source.PublicPort)\n\n\t// ResourceLogConfiguration\n\tif source.ResourceLogConfiguration != nil {\n\t\tvar resourceLogConfiguration ResourceLogConfiguration_STATUS\n\t\terr := resourceLogConfiguration.AssignProperties_From_ResourceLogConfiguration_STATUS(source.ResourceLogConfiguration)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ResourceLogConfiguration_STATUS() to populate field ResourceLogConfiguration\")\n\t\t}\n\t\tsignalR.ResourceLogConfiguration = &resourceLogConfiguration\n\t} else {\n\t\tsignalR.ResourceLogConfiguration = nil\n\t}\n\n\t// ServerPort\n\tsignalR.ServerPort = genruntime.ClonePointerToInt(source.ServerPort)\n\n\t// SharedPrivateLinkResources\n\tif source.SharedPrivateLinkResources != nil {\n\t\tsharedPrivateLinkResourceList := make([]SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded, len(source.SharedPrivateLinkResources))\n\t\tfor sharedPrivateLinkResourceIndex, sharedPrivateLinkResourceItem := range source.SharedPrivateLinkResources {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tsharedPrivateLinkResourceItem := sharedPrivateLinkResourceItem\n\t\t\tvar sharedPrivateLinkResource SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded\n\t\t\terr := sharedPrivateLinkResource.AssignProperties_From_SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded(&sharedPrivateLinkResourceItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded() to populate field SharedPrivateLinkResources\")\n\t\t\t}\n\t\t\tsharedPrivateLinkResourceList[sharedPrivateLinkResourceIndex] = sharedPrivateLinkResource\n\t\t}\n\t\tsignalR.SharedPrivateLinkResources = sharedPrivateLinkResourceList\n\t} else {\n\t\tsignalR.SharedPrivateLinkResources = nil\n\t}\n\n\t// Sku\n\tif source.Sku != nil {\n\t\tvar sku ResourceSku_STATUS\n\t\terr := sku.AssignProperties_From_ResourceSku_STATUS(source.Sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ResourceSku_STATUS() to populate field Sku\")\n\t\t}\n\t\tsignalR.Sku = &sku\n\t} else {\n\t\tsignalR.Sku = nil\n\t}\n\n\t// SystemData\n\tif source.SystemData != nil {\n\t\tvar systemDatum SystemData_STATUS\n\t\terr := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SystemData_STATUS() to populate field SystemData\")\n\t\t}\n\t\tsignalR.SystemData = &systemDatum\n\t} else {\n\t\tsignalR.SystemData = nil\n\t}\n\n\t// Tags\n\tsignalR.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// Tls\n\tif source.Tls != nil {\n\t\tvar tl SignalRTlsSettings_STATUS\n\t\terr := tl.AssignProperties_From_SignalRTlsSettings_STATUS(source.Tls)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SignalRTlsSettings_STATUS() to populate field Tls\")\n\t\t}\n\t\tsignalR.Tls = &tl\n\t} else {\n\t\tsignalR.Tls = nil\n\t}\n\n\t// Type\n\tsignalR.Type = genruntime.ClonePointerToString(source.Type)\n\n\t// Upstream\n\tif source.Upstream != nil {\n\t\tvar upstream ServerlessUpstreamSettings_STATUS\n\t\terr := upstream.AssignProperties_From_ServerlessUpstreamSettings_STATUS(source.Upstream)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ServerlessUpstreamSettings_STATUS() to populate field Upstream\")\n\t\t}\n\t\tsignalR.Upstream = &upstream\n\t} else {\n\t\tsignalR.Upstream = nil\n\t}\n\n\t// Version\n\tsignalR.Version = genruntime.ClonePointerToString(source.Version)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "5b7cc8a8ad458c06343452e73014b47e", "score": "0.5522343", "text": "func (settings *CrossSubscriptionRestoreSettings) AssignProperties_From_CrossSubscriptionRestoreSettings(source *v20230101s.CrossSubscriptionRestoreSettings) error {\n\n\t// State\n\tif source.State != nil {\n\t\tstate := CrossSubscriptionRestoreSettings_State(*source.State)\n\t\tsettings.State = &state\n\t} else {\n\t\tsettings.State = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "788450771f69477285ae9c2aacfd8788", "score": "0.55092096", "text": "func (virtualMachineScaleSetNetworkConfigurationDnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings) AssignPropertiesFromVirtualMachineScaleSetNetworkConfigurationDnsSettings(source *v1alpha1api20201201storage.VirtualMachineScaleSetNetworkConfigurationDnsSettings) error {\n\n\t// DnsServers\n\tdnsServerList := make([]string, len(source.DnsServers))\n\tfor dnsServerIndex, dnsServerItem := range source.DnsServers {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tdnsServerItem := dnsServerItem\n\t\tdnsServerList[dnsServerIndex] = dnsServerItem\n\t}\n\tvirtualMachineScaleSetNetworkConfigurationDnsSettings.DnsServers = dnsServerList\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "e7c707145fabaff7d305c8c61ff8ef23", "score": "0.54991585", "text": "func (acLs *SignalRNetworkACLs) AssignProperties_To_SignalRNetworkACLs(destination *v1beta20211001s.SignalRNetworkACLs) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// DefaultAction\n\tif acLs.DefaultAction != nil {\n\t\tdefaultAction := string(*acLs.DefaultAction)\n\t\tdestination.DefaultAction = &defaultAction\n\t} else {\n\t\tdestination.DefaultAction = nil\n\t}\n\n\t// PrivateEndpoints\n\tif acLs.PrivateEndpoints != nil {\n\t\tprivateEndpointList := make([]v1beta20211001s.PrivateEndpointACL, len(acLs.PrivateEndpoints))\n\t\tfor privateEndpointIndex, privateEndpointItem := range acLs.PrivateEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tprivateEndpointItem := privateEndpointItem\n\t\t\tvar privateEndpoint v1beta20211001s.PrivateEndpointACL\n\t\t\terr := privateEndpointItem.AssignProperties_To_PrivateEndpointACL(&privateEndpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_PrivateEndpointACL() to populate field PrivateEndpoints\")\n\t\t\t}\n\t\t\tprivateEndpointList[privateEndpointIndex] = privateEndpoint\n\t\t}\n\t\tdestination.PrivateEndpoints = privateEndpointList\n\t} else {\n\t\tdestination.PrivateEndpoints = nil\n\t}\n\n\t// PublicNetwork\n\tif acLs.PublicNetwork != nil {\n\t\tvar publicNetwork v1beta20211001s.NetworkACL\n\t\terr := acLs.PublicNetwork.AssignProperties_To_NetworkACL(&publicNetwork)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_NetworkACL() to populate field PublicNetwork\")\n\t\t}\n\t\tdestination.PublicNetwork = &publicNetwork\n\t} else {\n\t\tdestination.PublicNetwork = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "96cf78ef09ca32b4ffeebc0ab246dcd4", "score": "0.5451035", "text": "func (settings *ServiceManagedResourcesSettings) AssignProperties_To_ServiceManagedResourcesSettings(destination *v20210701s.ServiceManagedResourcesSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// CosmosDb\n\tif settings.CosmosDb != nil {\n\t\tvar cosmosDb v20210701s.CosmosDbSettings\n\t\terr := settings.CosmosDb.AssignProperties_To_CosmosDbSettings(&cosmosDb)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_CosmosDbSettings() to populate field CosmosDb\")\n\t\t}\n\t\tdestination.CosmosDb = &cosmosDb\n\t} else {\n\t\tdestination.CosmosDb = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "eb312c273dddd47100ff8038eda37647", "score": "0.5445933", "text": "func (feature *SignalRFeature) AssignProperties_To_SignalRFeature(destination *v1beta20211001s.SignalRFeature) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Flag\n\tif feature.Flag != nil {\n\t\tflag := string(*feature.Flag)\n\t\tdestination.Flag = &flag\n\t} else {\n\t\tdestination.Flag = nil\n\t}\n\n\t// Properties\n\tdestination.Properties = genruntime.CloneMapOfStringToString(feature.Properties)\n\n\t// Value\n\tif feature.Value != nil {\n\t\tvalue := *feature.Value\n\t\tdestination.Value = &value\n\t} else {\n\t\tdestination.Value = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "13e546a6f64477e91906b71f08e6c87d", "score": "0.5444683", "text": "func (winRMConfiguration *WinRMConfiguration) AssignPropertiesToWinRMConfiguration(destination *v1alpha1api20201201storage.WinRMConfiguration) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Listeners\n\tlistenerList := make([]v1alpha1api20201201storage.WinRMListener, len(winRMConfiguration.Listeners))\n\tfor listenerIndex, listenerItem := range winRMConfiguration.Listeners {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tlistenerItem := listenerItem\n\t\tvar listener v1alpha1api20201201storage.WinRMListener\n\t\terr := listenerItem.AssignPropertiesToWinRMListener(&listener)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating Listeners from Listeners, calling AssignPropertiesToWinRMListener()\")\n\t\t}\n\t\tlistenerList[listenerIndex] = listener\n\t}\n\tdestination.Listeners = listenerList\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "eb256f336bd3d3b3a8f883dcb6225dc5", "score": "0.5438932", "text": "func (settings *BgpSettings) AssignProperties_From_BgpSettings(source *v1beta20201101s.BgpSettings) error {\n\n\t// Asn\n\tif source.Asn != nil {\n\t\tasn := *source.Asn\n\t\tsettings.Asn = &asn\n\t} else {\n\t\tsettings.Asn = nil\n\t}\n\n\t// BgpPeeringAddress\n\tsettings.BgpPeeringAddress = genruntime.ClonePointerToString(source.BgpPeeringAddress)\n\n\t// BgpPeeringAddresses\n\tif source.BgpPeeringAddresses != nil {\n\t\tbgpPeeringAddressList := make([]IPConfigurationBgpPeeringAddress, len(source.BgpPeeringAddresses))\n\t\tfor bgpPeeringAddressIndex, bgpPeeringAddressItem := range source.BgpPeeringAddresses {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tbgpPeeringAddressItem := bgpPeeringAddressItem\n\t\t\tvar bgpPeeringAddress IPConfigurationBgpPeeringAddress\n\t\t\terr := bgpPeeringAddress.AssignProperties_From_IPConfigurationBgpPeeringAddress(&bgpPeeringAddressItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IPConfigurationBgpPeeringAddress() to populate field BgpPeeringAddresses\")\n\t\t\t}\n\t\t\tbgpPeeringAddressList[bgpPeeringAddressIndex] = bgpPeeringAddress\n\t\t}\n\t\tsettings.BgpPeeringAddresses = bgpPeeringAddressList\n\t} else {\n\t\tsettings.BgpPeeringAddresses = nil\n\t}\n\n\t// PeerWeight\n\tsettings.PeerWeight = genruntime.ClonePointerToInt(source.PeerWeight)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "45a91095fbb6799ebc2a3770eb54573b", "score": "0.5438651", "text": "func (settings *ScaleSettings) AssignProperties_To_ScaleSettings(destination *v20210701s.ScaleSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// MaxNodeCount\n\tdestination.MaxNodeCount = genruntime.ClonePointerToInt(settings.MaxNodeCount)\n\n\t// MinNodeCount\n\tdestination.MinNodeCount = genruntime.ClonePointerToInt(settings.MinNodeCount)\n\n\t// NodeIdleTimeBeforeScaleDown\n\tdestination.NodeIdleTimeBeforeScaleDown = genruntime.ClonePointerToString(settings.NodeIdleTimeBeforeScaleDown)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "6d15ac23484d2c1112729856dcab5ef1", "score": "0.54199", "text": "func (settings *CosmosDbSettings) AssignProperties_To_CosmosDbSettings(destination *v20210701s.CosmosDbSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// CollectionsThroughput\n\tdestination.CollectionsThroughput = genruntime.ClonePointerToInt(settings.CollectionsThroughput)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "188cf89089da62a0fb91e4250fdb8122", "score": "0.5395384", "text": "func (settings *BgpSettings) AssignProperties_To_BgpSettings(destination *v1beta20201101s.BgpSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Asn\n\tif settings.Asn != nil {\n\t\tasn := *settings.Asn\n\t\tdestination.Asn = &asn\n\t} else {\n\t\tdestination.Asn = nil\n\t}\n\n\t// BgpPeeringAddress\n\tdestination.BgpPeeringAddress = genruntime.ClonePointerToString(settings.BgpPeeringAddress)\n\n\t// BgpPeeringAddresses\n\tif settings.BgpPeeringAddresses != nil {\n\t\tbgpPeeringAddressList := make([]v1beta20201101s.IPConfigurationBgpPeeringAddress, len(settings.BgpPeeringAddresses))\n\t\tfor bgpPeeringAddressIndex, bgpPeeringAddressItem := range settings.BgpPeeringAddresses {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tbgpPeeringAddressItem := bgpPeeringAddressItem\n\t\t\tvar bgpPeeringAddress v1beta20201101s.IPConfigurationBgpPeeringAddress\n\t\t\terr := bgpPeeringAddressItem.AssignProperties_To_IPConfigurationBgpPeeringAddress(&bgpPeeringAddress)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IPConfigurationBgpPeeringAddress() to populate field BgpPeeringAddresses\")\n\t\t\t}\n\t\t\tbgpPeeringAddressList[bgpPeeringAddressIndex] = bgpPeeringAddress\n\t\t}\n\t\tdestination.BgpPeeringAddresses = bgpPeeringAddressList\n\t} else {\n\t\tdestination.BgpPeeringAddresses = nil\n\t}\n\n\t// PeerWeight\n\tdestination.PeerWeight = genruntime.ClonePointerToInt(settings.PeerWeight)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0262f539366c594c9d398c84e9d3ddc0", "score": "0.53868246", "text": "func (settings *ServerlessUpstreamSettings_STATUS) AssignProperties_To_ServerlessUpstreamSettings_STATUS(destination *v1beta20211001s.ServerlessUpstreamSettings_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Templates\n\tif settings.Templates != nil {\n\t\ttemplateList := make([]v1beta20211001s.UpstreamTemplate_STATUS, len(settings.Templates))\n\t\tfor templateIndex, templateItem := range settings.Templates {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttemplateItem := templateItem\n\t\t\tvar template v1beta20211001s.UpstreamTemplate_STATUS\n\t\t\terr := templateItem.AssignProperties_To_UpstreamTemplate_STATUS(&template)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_UpstreamTemplate_STATUS() to populate field Templates\")\n\t\t\t}\n\t\t\ttemplateList[templateIndex] = template\n\t\t}\n\t\tdestination.Templates = templateList\n\t} else {\n\t\tdestination.Templates = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "a66e130e0351869d559aac5205804af4", "score": "0.5381941", "text": "func (settings *SignalRCorsSettings) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif settings == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &SignalRCorsSettings_ARM{}\n\n\t// Set property \"AllowedOrigins\":\n\tfor _, item := range settings.AllowedOrigins {\n\t\tresult.AllowedOrigins = append(result.AllowedOrigins, item)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "59ceb2dc8e6b7904c34529ed968807c3", "score": "0.5378104", "text": "func (settings *ScaleSettings) AssignProperties_From_ScaleSettings(source *v20210701s.ScaleSettings) error {\n\n\t// MaxNodeCount\n\tsettings.MaxNodeCount = genruntime.ClonePointerToInt(source.MaxNodeCount)\n\n\t// MinNodeCount\n\tsettings.MinNodeCount = genruntime.ClonePointerToInt(source.MinNodeCount)\n\n\t// NodeIdleTimeBeforeScaleDown\n\tsettings.NodeIdleTimeBeforeScaleDown = genruntime.ClonePointerToString(source.NodeIdleTimeBeforeScaleDown)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "a77a462e6883229f9de47183763ef94e", "score": "0.53739786", "text": "func (virtualMachineScaleSetNetworkConfigurationDnsSettingsStatus *VirtualMachineScaleSetNetworkConfigurationDnsSettings_Status) AssignPropertiesToVirtualMachineScaleSetNetworkConfigurationDnsSettingsStatus(destination *v1alpha1api20201201storage.VirtualMachineScaleSetNetworkConfigurationDnsSettings_Status) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// DnsServers\n\tdnsServerList := make([]string, len(virtualMachineScaleSetNetworkConfigurationDnsSettingsStatus.DnsServers))\n\tfor dnsServerIndex, dnsServerItem := range virtualMachineScaleSetNetworkConfigurationDnsSettingsStatus.DnsServers {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tdnsServerItem := dnsServerItem\n\t\tdnsServerList[dnsServerIndex] = dnsServerItem\n\t}\n\tdestination.DnsServers = dnsServerList\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "79b0fda599bf1f94935ebba0b71db393", "score": "0.53711385", "text": "func (embedded *PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded) AssignProperties_To_PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded(destination *v1beta20211001s.PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Id\n\tdestination.Id = genruntime.ClonePointerToString(embedded.Id)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "abf8f243fda7c488aa51abe3ef0b8f25", "score": "0.5367359", "text": "func (settings *ImmutabilitySettings) AssignProperties_To_ImmutabilitySettings(destination *v20230101s.ImmutabilitySettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// State\n\tif settings.State != nil {\n\t\tstate := string(*settings.State)\n\t\tdestination.State = &state\n\t} else {\n\t\tdestination.State = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "06f65563d19e8e151cef226253ff7066", "score": "0.5366777", "text": "func (iotHub *IotHub_Spec) AssignProperties_To_IotHub_Spec(destination *v20210702s.IotHub_Spec) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AzureName\n\tdestination.AzureName = iotHub.AzureName\n\n\t// Identity\n\tif iotHub.Identity != nil {\n\t\tvar identity v20210702s.ArmIdentity\n\t\terr := iotHub.Identity.AssignProperties_To_ArmIdentity(&identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ArmIdentity() to populate field Identity\")\n\t\t}\n\t\tdestination.Identity = &identity\n\t} else {\n\t\tdestination.Identity = nil\n\t}\n\n\t// Location\n\tdestination.Location = genruntime.ClonePointerToString(iotHub.Location)\n\n\t// OperatorSpec\n\tif iotHub.OperatorSpec != nil {\n\t\tvar operatorSpec v20210702s.IotHubOperatorSpec\n\t\terr := iotHub.OperatorSpec.AssignProperties_To_IotHubOperatorSpec(&operatorSpec)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IotHubOperatorSpec() to populate field OperatorSpec\")\n\t\t}\n\t\tdestination.OperatorSpec = &operatorSpec\n\t} else {\n\t\tdestination.OperatorSpec = nil\n\t}\n\n\t// OriginalVersion\n\tdestination.OriginalVersion = iotHub.OriginalVersion()\n\n\t// Owner\n\tif iotHub.Owner != nil {\n\t\towner := iotHub.Owner.Copy()\n\t\tdestination.Owner = &owner\n\t} else {\n\t\tdestination.Owner = nil\n\t}\n\n\t// Properties\n\tif iotHub.Properties != nil {\n\t\tvar property v20210702s.IotHubProperties\n\t\terr := iotHub.Properties.AssignProperties_To_IotHubProperties(&property)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IotHubProperties() to populate field Properties\")\n\t\t}\n\t\tdestination.Properties = &property\n\t} else {\n\t\tdestination.Properties = nil\n\t}\n\n\t// Sku\n\tif iotHub.Sku != nil {\n\t\tvar sku v20210702s.IotHubSkuInfo\n\t\terr := iotHub.Sku.AssignProperties_To_IotHubSkuInfo(&sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IotHubSkuInfo() to populate field Sku\")\n\t\t}\n\t\tdestination.Sku = &sku\n\t} else {\n\t\tdestination.Sku = nil\n\t}\n\n\t// Tags\n\tdestination.Tags = genruntime.CloneMapOfStringToString(iotHub.Tags)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "95ee921b189a3de510e1642944948d28", "score": "0.5347435", "text": "func (settings *ServerlessUpstreamSettings_STATUS) AssignProperties_From_ServerlessUpstreamSettings_STATUS(source *v1beta20211001s.ServerlessUpstreamSettings_STATUS) error {\n\n\t// Templates\n\tif source.Templates != nil {\n\t\ttemplateList := make([]UpstreamTemplate_STATUS, len(source.Templates))\n\t\tfor templateIndex, templateItem := range source.Templates {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttemplateItem := templateItem\n\t\t\tvar template UpstreamTemplate_STATUS\n\t\t\terr := template.AssignProperties_From_UpstreamTemplate_STATUS(&templateItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_UpstreamTemplate_STATUS() to populate field Templates\")\n\t\t\t}\n\t\t\ttemplateList[templateIndex] = template\n\t\t}\n\t\tsettings.Templates = templateList\n\t} else {\n\t\tsettings.Templates = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "4598a289a30e2aeb7f6d29b66553354b", "score": "0.5335843", "text": "func (linuxPatchSettingsStatus *LinuxPatchSettings_Status) AssignPropertiesToLinuxPatchSettingsStatus(destination *v1alpha1api20201201storage.LinuxPatchSettings_Status) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// PatchMode\n\tif linuxPatchSettingsStatus.PatchMode != nil {\n\t\tpatchMode := string(*linuxPatchSettingsStatus.PatchMode)\n\t\tdestination.PatchMode = &patchMode\n\t} else {\n\t\tdestination.PatchMode = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "110ecce37ae4990fa1e7fa9daf0b7f93", "score": "0.53219324", "text": "func (settings *SecuritySettings) AssignProperties_From_SecuritySettings(source *v20230101s.SecuritySettings) error {\n\n\t// ImmutabilitySettings\n\tif source.ImmutabilitySettings != nil {\n\t\tvar immutabilitySetting ImmutabilitySettings\n\t\terr := immutabilitySetting.AssignProperties_From_ImmutabilitySettings(source.ImmutabilitySettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ImmutabilitySettings() to populate field ImmutabilitySettings\")\n\t\t}\n\t\tsettings.ImmutabilitySettings = &immutabilitySetting\n\t} else {\n\t\tsettings.ImmutabilitySettings = nil\n\t}\n\n\t// SoftDeleteSettings\n\tif source.SoftDeleteSettings != nil {\n\t\tvar softDeleteSetting SoftDeleteSettings\n\t\terr := softDeleteSetting.AssignProperties_From_SoftDeleteSettings(source.SoftDeleteSettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SoftDeleteSettings() to populate field SoftDeleteSettings\")\n\t\t}\n\t\tsettings.SoftDeleteSettings = &softDeleteSetting\n\t} else {\n\t\tsettings.SoftDeleteSettings = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "d2d917019fa85f000c5c64ff4f0339ca", "score": "0.53095144", "text": "func (rule *Namespaces_Topics_Subscriptions_Rule_Spec) AssignProperties_To_Namespaces_Topics_Subscriptions_Rule_Spec(destination *v20210101ps.Namespaces_Topics_Subscriptions_Rule_Spec) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(rule.PropertyBag)\n\n\t// Action\n\tif rule.Action != nil {\n\t\tvar action v20210101ps.Action\n\t\terr := rule.Action.AssignProperties_To_Action(&action)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_Action() to populate field Action\")\n\t\t}\n\t\tdestination.Action = &action\n\t} else {\n\t\tdestination.Action = nil\n\t}\n\n\t// AzureName\n\tdestination.AzureName = rule.AzureName\n\n\t// CorrelationFilter\n\tif rule.CorrelationFilter != nil {\n\t\tvar correlationFilter v20210101ps.CorrelationFilter\n\t\terr := rule.CorrelationFilter.AssignProperties_To_CorrelationFilter(&correlationFilter)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_CorrelationFilter() to populate field CorrelationFilter\")\n\t\t}\n\t\tdestination.CorrelationFilter = &correlationFilter\n\t} else {\n\t\tdestination.CorrelationFilter = nil\n\t}\n\n\t// FilterType\n\tdestination.FilterType = genruntime.ClonePointerToString(rule.FilterType)\n\n\t// OriginalVersion\n\tdestination.OriginalVersion = rule.OriginalVersion\n\n\t// Owner\n\tif rule.Owner != nil {\n\t\towner := rule.Owner.Copy()\n\t\tdestination.Owner = &owner\n\t} else {\n\t\tdestination.Owner = nil\n\t}\n\n\t// SqlFilter\n\tif rule.SqlFilter != nil {\n\t\tvar sqlFilter v20210101ps.SqlFilter\n\t\terr := rule.SqlFilter.AssignProperties_To_SqlFilter(&sqlFilter)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SqlFilter() to populate field SqlFilter\")\n\t\t}\n\t\tdestination.SqlFilter = &sqlFilter\n\t} else {\n\t\tdestination.SqlFilter = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForNamespaces_Topics_Subscriptions_Rule_Spec interface (if implemented) to customize the conversion\n\tvar ruleAsAny any = rule\n\tif augmentedRule, ok := ruleAsAny.(augmentConversionForNamespaces_Topics_Subscriptions_Rule_Spec); ok {\n\t\terr := augmentedRule.AssignPropertiesTo(destination)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesTo() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "fdad963f8dadee4d791a238e160836d7", "score": "0.5290365", "text": "func (vault *BackupVaultSpec) AssignProperties_From_BackupVaultSpec(source *v20230101s.BackupVaultSpec) error {\n\n\t// FeatureSettings\n\tif source.FeatureSettings != nil {\n\t\tvar featureSetting FeatureSettings\n\t\terr := featureSetting.AssignProperties_From_FeatureSettings(source.FeatureSettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_FeatureSettings() to populate field FeatureSettings\")\n\t\t}\n\t\tvault.FeatureSettings = &featureSetting\n\t} else {\n\t\tvault.FeatureSettings = nil\n\t}\n\n\t// MonitoringSettings\n\tif source.MonitoringSettings != nil {\n\t\tvar monitoringSetting MonitoringSettings\n\t\terr := monitoringSetting.AssignProperties_From_MonitoringSettings(source.MonitoringSettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_MonitoringSettings() to populate field MonitoringSettings\")\n\t\t}\n\t\tvault.MonitoringSettings = &monitoringSetting\n\t} else {\n\t\tvault.MonitoringSettings = nil\n\t}\n\n\t// SecuritySettings\n\tif source.SecuritySettings != nil {\n\t\tvar securitySetting SecuritySettings\n\t\terr := securitySetting.AssignProperties_From_SecuritySettings(source.SecuritySettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SecuritySettings() to populate field SecuritySettings\")\n\t\t}\n\t\tvault.SecuritySettings = &securitySetting\n\t} else {\n\t\tvault.SecuritySettings = nil\n\t}\n\n\t// StorageSettings\n\tif source.StorageSettings != nil {\n\t\tstorageSettingList := make([]StorageSetting, len(source.StorageSettings))\n\t\tfor storageSettingIndex, storageSettingItem := range source.StorageSettings {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tstorageSettingItem := storageSettingItem\n\t\t\tvar storageSetting StorageSetting\n\t\t\terr := storageSetting.AssignProperties_From_StorageSetting(&storageSettingItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_StorageSetting() to populate field StorageSettings\")\n\t\t\t}\n\t\t\tstorageSettingList[storageSettingIndex] = storageSetting\n\t\t}\n\t\tvault.StorageSettings = storageSettingList\n\t} else {\n\t\tvault.StorageSettings = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "08677c9900d7be1ea5703ba52104fe64", "score": "0.5284837", "text": "func (properties *RoutingEventHubProperties) AssignProperties_From_RoutingEventHubProperties(source *v20210702s.RoutingEventHubProperties) error {\n\n\t// AuthenticationType\n\tif source.AuthenticationType != nil {\n\t\tauthenticationType := RoutingEventHubProperties_AuthenticationType(*source.AuthenticationType)\n\t\tproperties.AuthenticationType = &authenticationType\n\t} else {\n\t\tproperties.AuthenticationType = nil\n\t}\n\n\t// ConnectionString\n\tif source.ConnectionString != nil {\n\t\tconnectionString := source.ConnectionString.Copy()\n\t\tproperties.ConnectionString = &connectionString\n\t} else {\n\t\tproperties.ConnectionString = nil\n\t}\n\n\t// EndpointUri\n\tproperties.EndpointUri = genruntime.ClonePointerToString(source.EndpointUri)\n\n\t// EntityPath\n\tproperties.EntityPath = genruntime.ClonePointerToString(source.EntityPath)\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity ManagedIdentity\n\t\terr := identity.AssignProperties_From_ManagedIdentity(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ManagedIdentity() to populate field Identity\")\n\t\t}\n\t\tproperties.Identity = &identity\n\t} else {\n\t\tproperties.Identity = nil\n\t}\n\n\t// Name\n\tif source.Name != nil {\n\t\tname := *source.Name\n\t\tproperties.Name = &name\n\t} else {\n\t\tproperties.Name = nil\n\t}\n\n\t// Reference\n\tif source.Reference != nil {\n\t\treference := source.Reference.Copy()\n\t\tproperties.Reference = &reference\n\t} else {\n\t\tproperties.Reference = nil\n\t}\n\n\t// ResourceGroup\n\tproperties.ResourceGroup = genruntime.ClonePointerToString(source.ResourceGroup)\n\n\t// SubscriptionId\n\tproperties.SubscriptionId = genruntime.ClonePointerToString(source.SubscriptionId)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "cf778c4469f9dd2c25cd785f4da22402", "score": "0.5284606", "text": "func (linuxPatchSettings *LinuxPatchSettings) AssignPropertiesToLinuxPatchSettings(destination *v1alpha1api20201201storage.LinuxPatchSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// PatchMode\n\tif linuxPatchSettings.PatchMode != nil {\n\t\tpatchMode := string(*linuxPatchSettings.PatchMode)\n\t\tdestination.PatchMode = &patchMode\n\t} else {\n\t\tdestination.PatchMode = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "5c1ea15d1432f28315efaaae0c7d3d83", "score": "0.5279241", "text": "func (settings *ManagedIdentitySettings) AssignProperties_From_ManagedIdentitySettings(source *v1beta20211001s.ManagedIdentitySettings) error {\n\n\t// Resource\n\tsettings.Resource = genruntime.ClonePointerToString(source.Resource)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "4bc314bac693338e7f603dcc5dd5416a", "score": "0.5276626", "text": "func (settings *ImmutabilitySettings) AssignProperties_From_ImmutabilitySettings(source *v20230101s.ImmutabilitySettings) error {\n\n\t// State\n\tif source.State != nil {\n\t\tstate := ImmutabilitySettings_State(*source.State)\n\t\tsettings.State = &state\n\t} else {\n\t\tsettings.State = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "45fbbc229f99732766fa658ad8cfc3d4", "score": "0.5273327", "text": "func (server *RadiusServer) AssignProperties_To_RadiusServer(destination *v1beta20201101s.RadiusServer) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// RadiusServerAddress\n\tdestination.RadiusServerAddress = genruntime.ClonePointerToString(server.RadiusServerAddress)\n\n\t// RadiusServerScore\n\tdestination.RadiusServerScore = genruntime.ClonePointerToInt(server.RadiusServerScore)\n\n\t// RadiusServerSecret\n\tdestination.RadiusServerSecret = genruntime.ClonePointerToString(server.RadiusServerSecret)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "c8830d0a49ecb2f8eb69826867969fc4", "score": "0.52704895", "text": "func (settings *ComputeInstanceSshSettings) AssignProperties_From_ComputeInstanceSshSettings(source *v20210701s.ComputeInstanceSshSettings) error {\n\n\t// AdminPublicKey\n\tsettings.AdminPublicKey = genruntime.ClonePointerToString(source.AdminPublicKey)\n\n\t// SshPublicAccess\n\tif source.SshPublicAccess != nil {\n\t\tsshPublicAccess := ComputeInstanceSshSettings_SshPublicAccess(*source.SshPublicAccess)\n\t\tsettings.SshPublicAccess = &sshPublicAccess\n\t} else {\n\t\tsettings.SshPublicAccess = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "dfcfa392f18986bf903f88c51e607ff8", "score": "0.52632886", "text": "func (iotHub *IotHub_Spec) AssignProperties_From_IotHub_Spec(source *v20210702s.IotHub_Spec) error {\n\n\t// AzureName\n\tiotHub.AzureName = source.AzureName\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity ArmIdentity\n\t\terr := identity.AssignProperties_From_ArmIdentity(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ArmIdentity() to populate field Identity\")\n\t\t}\n\t\tiotHub.Identity = &identity\n\t} else {\n\t\tiotHub.Identity = nil\n\t}\n\n\t// Location\n\tiotHub.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// OperatorSpec\n\tif source.OperatorSpec != nil {\n\t\tvar operatorSpec IotHubOperatorSpec\n\t\terr := operatorSpec.AssignProperties_From_IotHubOperatorSpec(source.OperatorSpec)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IotHubOperatorSpec() to populate field OperatorSpec\")\n\t\t}\n\t\tiotHub.OperatorSpec = &operatorSpec\n\t} else {\n\t\tiotHub.OperatorSpec = nil\n\t}\n\n\t// Owner\n\tif source.Owner != nil {\n\t\towner := source.Owner.Copy()\n\t\tiotHub.Owner = &owner\n\t} else {\n\t\tiotHub.Owner = nil\n\t}\n\n\t// Properties\n\tif source.Properties != nil {\n\t\tvar property IotHubProperties\n\t\terr := property.AssignProperties_From_IotHubProperties(source.Properties)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IotHubProperties() to populate field Properties\")\n\t\t}\n\t\tiotHub.Properties = &property\n\t} else {\n\t\tiotHub.Properties = nil\n\t}\n\n\t// Sku\n\tif source.Sku != nil {\n\t\tvar sku IotHubSkuInfo\n\t\terr := sku.AssignProperties_From_IotHubSkuInfo(source.Sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IotHubSkuInfo() to populate field Sku\")\n\t\t}\n\t\tiotHub.Sku = &sku\n\t} else {\n\t\tiotHub.Sku = nil\n\t}\n\n\t// Tags\n\tiotHub.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "4ade15d15c640ba34703c3f1667e253b", "score": "0.5245183", "text": "func (settings *SignalRCorsSettings) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {\n\ttypedInput, ok := armInput.(SignalRCorsSettings_ARM)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unexpected type supplied for PopulateFromARM() function. Expected SignalRCorsSettings_ARM, got %T\", armInput)\n\t}\n\n\t// Set property \"AllowedOrigins\":\n\tfor _, item := range typedInput.AllowedOrigins {\n\t\tsettings.AllowedOrigins = append(settings.AllowedOrigins, item)\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "ad39a10db4757bd8606015b2a53a9535", "score": "0.5213722", "text": "func (embedded *SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded) AssignProperties_To_SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded(destination *v1beta20211001s.SharedPrivateLinkResource_STATUS_SignalR_SubResourceEmbedded) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Id\n\tdestination.Id = genruntime.ClonePointerToString(embedded.Id)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "620bff111d40c07aa7954e972d20561c", "score": "0.5212357", "text": "func (winRMConfiguration *WinRMConfiguration) AssignPropertiesFromWinRMConfiguration(source *v1alpha1api20201201storage.WinRMConfiguration) error {\n\n\t// Listeners\n\tlistenerList := make([]WinRMListener, len(source.Listeners))\n\tfor listenerIndex, listenerItem := range source.Listeners {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tlistenerItem := listenerItem\n\t\tvar listener WinRMListener\n\t\terr := listener.AssignPropertiesFromWinRMListener(&listenerItem)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating Listeners from Listeners, calling AssignPropertiesFromWinRMListener()\")\n\t\t}\n\t\tlistenerList[listenerIndex] = listener\n\t}\n\twinRMConfiguration.Listeners = listenerList\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "40f0fe72849cab2eba55155563dbd5f3", "score": "0.52066004", "text": "func (settings *SignalRTlsSettings_STATUS) AssignProperties_From_SignalRTlsSettings_STATUS(source *v1beta20211001s.SignalRTlsSettings_STATUS) error {\n\n\t// ClientCertEnabled\n\tif source.ClientCertEnabled != nil {\n\t\tclientCertEnabled := *source.ClientCertEnabled\n\t\tsettings.ClientCertEnabled = &clientCertEnabled\n\t} else {\n\t\tsettings.ClientCertEnabled = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "443a364d84e5092f9f4f46c1e7e22464", "score": "0.5200124", "text": "func (settings *SecuritySettings) AssignProperties_To_SecuritySettings(destination *v20230101s.SecuritySettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// ImmutabilitySettings\n\tif settings.ImmutabilitySettings != nil {\n\t\tvar immutabilitySetting v20230101s.ImmutabilitySettings\n\t\terr := settings.ImmutabilitySettings.AssignProperties_To_ImmutabilitySettings(&immutabilitySetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ImmutabilitySettings() to populate field ImmutabilitySettings\")\n\t\t}\n\t\tdestination.ImmutabilitySettings = &immutabilitySetting\n\t} else {\n\t\tdestination.ImmutabilitySettings = nil\n\t}\n\n\t// SoftDeleteSettings\n\tif settings.SoftDeleteSettings != nil {\n\t\tvar softDeleteSetting v20230101s.SoftDeleteSettings\n\t\terr := settings.SoftDeleteSettings.AssignProperties_To_SoftDeleteSettings(&softDeleteSetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SoftDeleteSettings() to populate field SoftDeleteSettings\")\n\t\t}\n\t\tdestination.SoftDeleteSettings = &softDeleteSetting\n\t} else {\n\t\tdestination.SoftDeleteSettings = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7a421cb81da34ab5c201d20a9c106fe0", "score": "0.51953745", "text": "func (properties *IotHubProperties) AssignProperties_From_IotHubProperties(source *v20210702s.IotHubProperties) error {\n\n\t// AllowedFqdnList\n\tproperties.AllowedFqdnList = genruntime.CloneSliceOfString(source.AllowedFqdnList)\n\n\t// AuthorizationPolicies\n\tif source.AuthorizationPolicies != nil {\n\t\tauthorizationPolicyList := make([]SharedAccessSignatureAuthorizationRule, len(source.AuthorizationPolicies))\n\t\tfor authorizationPolicyIndex, authorizationPolicyItem := range source.AuthorizationPolicies {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tauthorizationPolicyItem := authorizationPolicyItem\n\t\t\tvar authorizationPolicy SharedAccessSignatureAuthorizationRule\n\t\t\terr := authorizationPolicy.AssignProperties_From_SharedAccessSignatureAuthorizationRule(&authorizationPolicyItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SharedAccessSignatureAuthorizationRule() to populate field AuthorizationPolicies\")\n\t\t\t}\n\t\t\tauthorizationPolicyList[authorizationPolicyIndex] = authorizationPolicy\n\t\t}\n\t\tproperties.AuthorizationPolicies = authorizationPolicyList\n\t} else {\n\t\tproperties.AuthorizationPolicies = nil\n\t}\n\n\t// CloudToDevice\n\tif source.CloudToDevice != nil {\n\t\tvar cloudToDevice CloudToDeviceProperties\n\t\terr := cloudToDevice.AssignProperties_From_CloudToDeviceProperties(source.CloudToDevice)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_CloudToDeviceProperties() to populate field CloudToDevice\")\n\t\t}\n\t\tproperties.CloudToDevice = &cloudToDevice\n\t} else {\n\t\tproperties.CloudToDevice = nil\n\t}\n\n\t// Comments\n\tproperties.Comments = genruntime.ClonePointerToString(source.Comments)\n\n\t// DisableDeviceSAS\n\tif source.DisableDeviceSAS != nil {\n\t\tdisableDeviceSAS := *source.DisableDeviceSAS\n\t\tproperties.DisableDeviceSAS = &disableDeviceSAS\n\t} else {\n\t\tproperties.DisableDeviceSAS = nil\n\t}\n\n\t// DisableLocalAuth\n\tif source.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *source.DisableLocalAuth\n\t\tproperties.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tproperties.DisableLocalAuth = nil\n\t}\n\n\t// DisableModuleSAS\n\tif source.DisableModuleSAS != nil {\n\t\tdisableModuleSAS := *source.DisableModuleSAS\n\t\tproperties.DisableModuleSAS = &disableModuleSAS\n\t} else {\n\t\tproperties.DisableModuleSAS = nil\n\t}\n\n\t// EnableDataResidency\n\tif source.EnableDataResidency != nil {\n\t\tenableDataResidency := *source.EnableDataResidency\n\t\tproperties.EnableDataResidency = &enableDataResidency\n\t} else {\n\t\tproperties.EnableDataResidency = nil\n\t}\n\n\t// EnableFileUploadNotifications\n\tif source.EnableFileUploadNotifications != nil {\n\t\tenableFileUploadNotification := *source.EnableFileUploadNotifications\n\t\tproperties.EnableFileUploadNotifications = &enableFileUploadNotification\n\t} else {\n\t\tproperties.EnableFileUploadNotifications = nil\n\t}\n\n\t// EventHubEndpoints\n\tif source.EventHubEndpoints != nil {\n\t\teventHubEndpointMap := make(map[string]EventHubProperties, len(source.EventHubEndpoints))\n\t\tfor eventHubEndpointKey, eventHubEndpointValue := range source.EventHubEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\teventHubEndpointValue := eventHubEndpointValue\n\t\t\tvar eventHubEndpoint EventHubProperties\n\t\t\terr := eventHubEndpoint.AssignProperties_From_EventHubProperties(&eventHubEndpointValue)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_EventHubProperties() to populate field EventHubEndpoints\")\n\t\t\t}\n\t\t\teventHubEndpointMap[eventHubEndpointKey] = eventHubEndpoint\n\t\t}\n\t\tproperties.EventHubEndpoints = eventHubEndpointMap\n\t} else {\n\t\tproperties.EventHubEndpoints = nil\n\t}\n\n\t// Features\n\tif source.Features != nil {\n\t\tfeature := IotHubProperties_Features(*source.Features)\n\t\tproperties.Features = &feature\n\t} else {\n\t\tproperties.Features = nil\n\t}\n\n\t// IpFilterRules\n\tif source.IpFilterRules != nil {\n\t\tipFilterRuleList := make([]IpFilterRule, len(source.IpFilterRules))\n\t\tfor ipFilterRuleIndex, ipFilterRuleItem := range source.IpFilterRules {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tipFilterRuleItem := ipFilterRuleItem\n\t\t\tvar ipFilterRule IpFilterRule\n\t\t\terr := ipFilterRule.AssignProperties_From_IpFilterRule(&ipFilterRuleItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IpFilterRule() to populate field IpFilterRules\")\n\t\t\t}\n\t\t\tipFilterRuleList[ipFilterRuleIndex] = ipFilterRule\n\t\t}\n\t\tproperties.IpFilterRules = ipFilterRuleList\n\t} else {\n\t\tproperties.IpFilterRules = nil\n\t}\n\n\t// MessagingEndpoints\n\tif source.MessagingEndpoints != nil {\n\t\tmessagingEndpointMap := make(map[string]MessagingEndpointProperties, len(source.MessagingEndpoints))\n\t\tfor messagingEndpointKey, messagingEndpointValue := range source.MessagingEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tmessagingEndpointValue := messagingEndpointValue\n\t\t\tvar messagingEndpoint MessagingEndpointProperties\n\t\t\terr := messagingEndpoint.AssignProperties_From_MessagingEndpointProperties(&messagingEndpointValue)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_MessagingEndpointProperties() to populate field MessagingEndpoints\")\n\t\t\t}\n\t\t\tmessagingEndpointMap[messagingEndpointKey] = messagingEndpoint\n\t\t}\n\t\tproperties.MessagingEndpoints = messagingEndpointMap\n\t} else {\n\t\tproperties.MessagingEndpoints = nil\n\t}\n\n\t// MinTlsVersion\n\tproperties.MinTlsVersion = genruntime.ClonePointerToString(source.MinTlsVersion)\n\n\t// NetworkRuleSets\n\tif source.NetworkRuleSets != nil {\n\t\tvar networkRuleSet NetworkRuleSetProperties\n\t\terr := networkRuleSet.AssignProperties_From_NetworkRuleSetProperties(source.NetworkRuleSets)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_NetworkRuleSetProperties() to populate field NetworkRuleSets\")\n\t\t}\n\t\tproperties.NetworkRuleSets = &networkRuleSet\n\t} else {\n\t\tproperties.NetworkRuleSets = nil\n\t}\n\n\t// PublicNetworkAccess\n\tif source.PublicNetworkAccess != nil {\n\t\tpublicNetworkAccess := IotHubProperties_PublicNetworkAccess(*source.PublicNetworkAccess)\n\t\tproperties.PublicNetworkAccess = &publicNetworkAccess\n\t} else {\n\t\tproperties.PublicNetworkAccess = nil\n\t}\n\n\t// RestrictOutboundNetworkAccess\n\tif source.RestrictOutboundNetworkAccess != nil {\n\t\trestrictOutboundNetworkAccess := *source.RestrictOutboundNetworkAccess\n\t\tproperties.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess\n\t} else {\n\t\tproperties.RestrictOutboundNetworkAccess = nil\n\t}\n\n\t// Routing\n\tif source.Routing != nil {\n\t\tvar routing RoutingProperties\n\t\terr := routing.AssignProperties_From_RoutingProperties(source.Routing)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_RoutingProperties() to populate field Routing\")\n\t\t}\n\t\tproperties.Routing = &routing\n\t} else {\n\t\tproperties.Routing = nil\n\t}\n\n\t// StorageEndpoints\n\tif source.StorageEndpoints != nil {\n\t\tstorageEndpointMap := make(map[string]StorageEndpointProperties, len(source.StorageEndpoints))\n\t\tfor storageEndpointKey, storageEndpointValue := range source.StorageEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tstorageEndpointValue := storageEndpointValue\n\t\t\tvar storageEndpoint StorageEndpointProperties\n\t\t\terr := storageEndpoint.AssignProperties_From_StorageEndpointProperties(&storageEndpointValue)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_StorageEndpointProperties() to populate field StorageEndpoints\")\n\t\t\t}\n\t\t\tstorageEndpointMap[storageEndpointKey] = storageEndpoint\n\t\t}\n\t\tproperties.StorageEndpoints = storageEndpointMap\n\t} else {\n\t\tproperties.StorageEndpoints = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "3ea434724ad1d54648258b3b4001483c", "score": "0.5192271", "text": "func (connection *Workspaces_Connection_Spec) AssignProperties_From_Workspaces_Connection_Spec(source *v20210701s.Workspaces_Connection_Spec) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(source.PropertyBag)\n\n\t// AuthType\n\tconnection.AuthType = genruntime.ClonePointerToString(source.AuthType)\n\n\t// AzureName\n\tconnection.AzureName = source.AzureName\n\n\t// Category\n\tconnection.Category = genruntime.ClonePointerToString(source.Category)\n\n\t// OriginalVersion\n\tconnection.OriginalVersion = source.OriginalVersion\n\n\t// Owner\n\tif source.Owner != nil {\n\t\towner := source.Owner.Copy()\n\t\tconnection.Owner = &owner\n\t} else {\n\t\tconnection.Owner = nil\n\t}\n\n\t// Target\n\tconnection.Target = genruntime.ClonePointerToString(source.Target)\n\n\t// Value\n\tconnection.Value = genruntime.ClonePointerToString(source.Value)\n\n\t// ValueFormat\n\tconnection.ValueFormat = genruntime.ClonePointerToString(source.ValueFormat)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tconnection.PropertyBag = propertyBag\n\t} else {\n\t\tconnection.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForWorkspaces_Connection_Spec interface (if implemented) to customize the conversion\n\tvar connectionAsAny any = connection\n\tif augmentedConnection, ok := connectionAsAny.(augmentConversionForWorkspaces_Connection_Spec); ok {\n\t\terr := augmentedConnection.AssignPropertiesFrom(source)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesFrom() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "88a72fc63766b645777baa8c867cca31", "score": "0.51896805", "text": "func (virtualMachineScaleSetPublicIPAddressConfigurationDnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings) AssignPropertiesToVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(destination *v1alpha1api20201201storage.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// DomainNameLabel\n\tdomainNameLabel := virtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.DomainNameLabel\n\tdestination.DomainNameLabel = &domainNameLabel\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "2ece906713438148032c1355e4864a44", "score": "0.5176071", "text": "func (settings *SignalRTlsSettings) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {\n\ttypedInput, ok := armInput.(SignalRTlsSettings_ARM)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unexpected type supplied for PopulateFromARM() function. Expected SignalRTlsSettings_ARM, got %T\", armInput)\n\t}\n\n\t// Set property \"ClientCertEnabled\":\n\tif typedInput.ClientCertEnabled != nil {\n\t\tclientCertEnabled := *typedInput.ClientCertEnabled\n\t\tsettings.ClientCertEnabled = &clientCertEnabled\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "d2f0e3c538bc5250f88a3c119b2e2341", "score": "0.51697797", "text": "func (properties *RoutingEventHubProperties) AssignProperties_To_RoutingEventHubProperties(destination *v20210702s.RoutingEventHubProperties) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AuthenticationType\n\tif properties.AuthenticationType != nil {\n\t\tauthenticationType := string(*properties.AuthenticationType)\n\t\tdestination.AuthenticationType = &authenticationType\n\t} else {\n\t\tdestination.AuthenticationType = nil\n\t}\n\n\t// ConnectionString\n\tif properties.ConnectionString != nil {\n\t\tconnectionString := properties.ConnectionString.Copy()\n\t\tdestination.ConnectionString = &connectionString\n\t} else {\n\t\tdestination.ConnectionString = nil\n\t}\n\n\t// EndpointUri\n\tdestination.EndpointUri = genruntime.ClonePointerToString(properties.EndpointUri)\n\n\t// EntityPath\n\tdestination.EntityPath = genruntime.ClonePointerToString(properties.EntityPath)\n\n\t// Identity\n\tif properties.Identity != nil {\n\t\tvar identity v20210702s.ManagedIdentity\n\t\terr := properties.Identity.AssignProperties_To_ManagedIdentity(&identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ManagedIdentity() to populate field Identity\")\n\t\t}\n\t\tdestination.Identity = &identity\n\t} else {\n\t\tdestination.Identity = nil\n\t}\n\n\t// Name\n\tif properties.Name != nil {\n\t\tname := *properties.Name\n\t\tdestination.Name = &name\n\t} else {\n\t\tdestination.Name = nil\n\t}\n\n\t// Reference\n\tif properties.Reference != nil {\n\t\treference := properties.Reference.Copy()\n\t\tdestination.Reference = &reference\n\t} else {\n\t\tdestination.Reference = nil\n\t}\n\n\t// ResourceGroup\n\tdestination.ResourceGroup = genruntime.ClonePointerToString(properties.ResourceGroup)\n\n\t// SubscriptionId\n\tdestination.SubscriptionId = genruntime.ClonePointerToString(properties.SubscriptionId)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "aa1ba1b1be75317fbcc35e53a51081de", "score": "0.5166217", "text": "func (properties *IotHubProperties) AssignProperties_To_IotHubProperties(destination *v20210702s.IotHubProperties) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AllowedFqdnList\n\tdestination.AllowedFqdnList = genruntime.CloneSliceOfString(properties.AllowedFqdnList)\n\n\t// AuthorizationPolicies\n\tif properties.AuthorizationPolicies != nil {\n\t\tauthorizationPolicyList := make([]v20210702s.SharedAccessSignatureAuthorizationRule, len(properties.AuthorizationPolicies))\n\t\tfor authorizationPolicyIndex, authorizationPolicyItem := range properties.AuthorizationPolicies {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tauthorizationPolicyItem := authorizationPolicyItem\n\t\t\tvar authorizationPolicy v20210702s.SharedAccessSignatureAuthorizationRule\n\t\t\terr := authorizationPolicyItem.AssignProperties_To_SharedAccessSignatureAuthorizationRule(&authorizationPolicy)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SharedAccessSignatureAuthorizationRule() to populate field AuthorizationPolicies\")\n\t\t\t}\n\t\t\tauthorizationPolicyList[authorizationPolicyIndex] = authorizationPolicy\n\t\t}\n\t\tdestination.AuthorizationPolicies = authorizationPolicyList\n\t} else {\n\t\tdestination.AuthorizationPolicies = nil\n\t}\n\n\t// CloudToDevice\n\tif properties.CloudToDevice != nil {\n\t\tvar cloudToDevice v20210702s.CloudToDeviceProperties\n\t\terr := properties.CloudToDevice.AssignProperties_To_CloudToDeviceProperties(&cloudToDevice)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_CloudToDeviceProperties() to populate field CloudToDevice\")\n\t\t}\n\t\tdestination.CloudToDevice = &cloudToDevice\n\t} else {\n\t\tdestination.CloudToDevice = nil\n\t}\n\n\t// Comments\n\tdestination.Comments = genruntime.ClonePointerToString(properties.Comments)\n\n\t// DisableDeviceSAS\n\tif properties.DisableDeviceSAS != nil {\n\t\tdisableDeviceSAS := *properties.DisableDeviceSAS\n\t\tdestination.DisableDeviceSAS = &disableDeviceSAS\n\t} else {\n\t\tdestination.DisableDeviceSAS = nil\n\t}\n\n\t// DisableLocalAuth\n\tif properties.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *properties.DisableLocalAuth\n\t\tdestination.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tdestination.DisableLocalAuth = nil\n\t}\n\n\t// DisableModuleSAS\n\tif properties.DisableModuleSAS != nil {\n\t\tdisableModuleSAS := *properties.DisableModuleSAS\n\t\tdestination.DisableModuleSAS = &disableModuleSAS\n\t} else {\n\t\tdestination.DisableModuleSAS = nil\n\t}\n\n\t// EnableDataResidency\n\tif properties.EnableDataResidency != nil {\n\t\tenableDataResidency := *properties.EnableDataResidency\n\t\tdestination.EnableDataResidency = &enableDataResidency\n\t} else {\n\t\tdestination.EnableDataResidency = nil\n\t}\n\n\t// EnableFileUploadNotifications\n\tif properties.EnableFileUploadNotifications != nil {\n\t\tenableFileUploadNotification := *properties.EnableFileUploadNotifications\n\t\tdestination.EnableFileUploadNotifications = &enableFileUploadNotification\n\t} else {\n\t\tdestination.EnableFileUploadNotifications = nil\n\t}\n\n\t// EventHubEndpoints\n\tif properties.EventHubEndpoints != nil {\n\t\teventHubEndpointMap := make(map[string]v20210702s.EventHubProperties, len(properties.EventHubEndpoints))\n\t\tfor eventHubEndpointKey, eventHubEndpointValue := range properties.EventHubEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\teventHubEndpointValue := eventHubEndpointValue\n\t\t\tvar eventHubEndpoint v20210702s.EventHubProperties\n\t\t\terr := eventHubEndpointValue.AssignProperties_To_EventHubProperties(&eventHubEndpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_EventHubProperties() to populate field EventHubEndpoints\")\n\t\t\t}\n\t\t\teventHubEndpointMap[eventHubEndpointKey] = eventHubEndpoint\n\t\t}\n\t\tdestination.EventHubEndpoints = eventHubEndpointMap\n\t} else {\n\t\tdestination.EventHubEndpoints = nil\n\t}\n\n\t// Features\n\tif properties.Features != nil {\n\t\tfeature := string(*properties.Features)\n\t\tdestination.Features = &feature\n\t} else {\n\t\tdestination.Features = nil\n\t}\n\n\t// IpFilterRules\n\tif properties.IpFilterRules != nil {\n\t\tipFilterRuleList := make([]v20210702s.IpFilterRule, len(properties.IpFilterRules))\n\t\tfor ipFilterRuleIndex, ipFilterRuleItem := range properties.IpFilterRules {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tipFilterRuleItem := ipFilterRuleItem\n\t\t\tvar ipFilterRule v20210702s.IpFilterRule\n\t\t\terr := ipFilterRuleItem.AssignProperties_To_IpFilterRule(&ipFilterRule)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IpFilterRule() to populate field IpFilterRules\")\n\t\t\t}\n\t\t\tipFilterRuleList[ipFilterRuleIndex] = ipFilterRule\n\t\t}\n\t\tdestination.IpFilterRules = ipFilterRuleList\n\t} else {\n\t\tdestination.IpFilterRules = nil\n\t}\n\n\t// MessagingEndpoints\n\tif properties.MessagingEndpoints != nil {\n\t\tmessagingEndpointMap := make(map[string]v20210702s.MessagingEndpointProperties, len(properties.MessagingEndpoints))\n\t\tfor messagingEndpointKey, messagingEndpointValue := range properties.MessagingEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tmessagingEndpointValue := messagingEndpointValue\n\t\t\tvar messagingEndpoint v20210702s.MessagingEndpointProperties\n\t\t\terr := messagingEndpointValue.AssignProperties_To_MessagingEndpointProperties(&messagingEndpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_MessagingEndpointProperties() to populate field MessagingEndpoints\")\n\t\t\t}\n\t\t\tmessagingEndpointMap[messagingEndpointKey] = messagingEndpoint\n\t\t}\n\t\tdestination.MessagingEndpoints = messagingEndpointMap\n\t} else {\n\t\tdestination.MessagingEndpoints = nil\n\t}\n\n\t// MinTlsVersion\n\tdestination.MinTlsVersion = genruntime.ClonePointerToString(properties.MinTlsVersion)\n\n\t// NetworkRuleSets\n\tif properties.NetworkRuleSets != nil {\n\t\tvar networkRuleSet v20210702s.NetworkRuleSetProperties\n\t\terr := properties.NetworkRuleSets.AssignProperties_To_NetworkRuleSetProperties(&networkRuleSet)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_NetworkRuleSetProperties() to populate field NetworkRuleSets\")\n\t\t}\n\t\tdestination.NetworkRuleSets = &networkRuleSet\n\t} else {\n\t\tdestination.NetworkRuleSets = nil\n\t}\n\n\t// PublicNetworkAccess\n\tif properties.PublicNetworkAccess != nil {\n\t\tpublicNetworkAccess := string(*properties.PublicNetworkAccess)\n\t\tdestination.PublicNetworkAccess = &publicNetworkAccess\n\t} else {\n\t\tdestination.PublicNetworkAccess = nil\n\t}\n\n\t// RestrictOutboundNetworkAccess\n\tif properties.RestrictOutboundNetworkAccess != nil {\n\t\trestrictOutboundNetworkAccess := *properties.RestrictOutboundNetworkAccess\n\t\tdestination.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess\n\t} else {\n\t\tdestination.RestrictOutboundNetworkAccess = nil\n\t}\n\n\t// Routing\n\tif properties.Routing != nil {\n\t\tvar routing v20210702s.RoutingProperties\n\t\terr := properties.Routing.AssignProperties_To_RoutingProperties(&routing)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_RoutingProperties() to populate field Routing\")\n\t\t}\n\t\tdestination.Routing = &routing\n\t} else {\n\t\tdestination.Routing = nil\n\t}\n\n\t// StorageEndpoints\n\tif properties.StorageEndpoints != nil {\n\t\tstorageEndpointMap := make(map[string]v20210702s.StorageEndpointProperties, len(properties.StorageEndpoints))\n\t\tfor storageEndpointKey, storageEndpointValue := range properties.StorageEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tstorageEndpointValue := storageEndpointValue\n\t\t\tvar storageEndpoint v20210702s.StorageEndpointProperties\n\t\t\terr := storageEndpointValue.AssignProperties_To_StorageEndpointProperties(&storageEndpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_StorageEndpointProperties() to populate field StorageEndpoints\")\n\t\t\t}\n\t\t\tstorageEndpointMap[storageEndpointKey] = storageEndpoint\n\t\t}\n\t\tdestination.StorageEndpoints = storageEndpointMap\n\t} else {\n\t\tdestination.StorageEndpoints = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "65559dd6fd1efcf633fd9e9ff7bda531", "score": "0.51631075", "text": "func (windowsConfiguration *WindowsConfiguration) AssignPropertiesToWindowsConfiguration(destination *v1alpha1api20201201storage.WindowsConfiguration) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AdditionalUnattendContent\n\tadditionalUnattendContentList := make([]v1alpha1api20201201storage.AdditionalUnattendContent, len(windowsConfiguration.AdditionalUnattendContent))\n\tfor additionalUnattendContentIndex, additionalUnattendContentItem := range windowsConfiguration.AdditionalUnattendContent {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tadditionalUnattendContentItem := additionalUnattendContentItem\n\t\tvar additionalUnattendContent v1alpha1api20201201storage.AdditionalUnattendContent\n\t\terr := additionalUnattendContentItem.AssignPropertiesToAdditionalUnattendContent(&additionalUnattendContent)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating AdditionalUnattendContent from AdditionalUnattendContent, calling AssignPropertiesToAdditionalUnattendContent()\")\n\t\t}\n\t\tadditionalUnattendContentList[additionalUnattendContentIndex] = additionalUnattendContent\n\t}\n\tdestination.AdditionalUnattendContent = additionalUnattendContentList\n\n\t// EnableAutomaticUpdates\n\tif windowsConfiguration.EnableAutomaticUpdates != nil {\n\t\tenableAutomaticUpdate := *windowsConfiguration.EnableAutomaticUpdates\n\t\tdestination.EnableAutomaticUpdates = &enableAutomaticUpdate\n\t} else {\n\t\tdestination.EnableAutomaticUpdates = nil\n\t}\n\n\t// PatchSettings\n\tif windowsConfiguration.PatchSettings != nil {\n\t\tvar patchSetting v1alpha1api20201201storage.PatchSettings\n\t\terr := (*windowsConfiguration.PatchSettings).AssignPropertiesToPatchSettings(&patchSetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating PatchSettings from PatchSettings, calling AssignPropertiesToPatchSettings()\")\n\t\t}\n\t\tdestination.PatchSettings = &patchSetting\n\t} else {\n\t\tdestination.PatchSettings = nil\n\t}\n\n\t// ProvisionVMAgent\n\tif windowsConfiguration.ProvisionVMAgent != nil {\n\t\tprovisionVMAgent := *windowsConfiguration.ProvisionVMAgent\n\t\tdestination.ProvisionVMAgent = &provisionVMAgent\n\t} else {\n\t\tdestination.ProvisionVMAgent = nil\n\t}\n\n\t// TimeZone\n\tif windowsConfiguration.TimeZone != nil {\n\t\ttimeZone := *windowsConfiguration.TimeZone\n\t\tdestination.TimeZone = &timeZone\n\t} else {\n\t\tdestination.TimeZone = nil\n\t}\n\n\t// WinRM\n\tif windowsConfiguration.WinRM != nil {\n\t\tvar winRM v1alpha1api20201201storage.WinRMConfiguration\n\t\terr := (*windowsConfiguration.WinRM).AssignPropertiesToWinRMConfiguration(&winRM)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating WinRM from WinRM, calling AssignPropertiesToWinRMConfiguration()\")\n\t\t}\n\t\tdestination.WinRM = &winRM\n\t} else {\n\t\tdestination.WinRM = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "e47a2547393f575fbd28011d155e03c1", "score": "0.5156909", "text": "func (feature *SignalRFeature) AssignProperties_From_SignalRFeature(source *v1beta20211001s.SignalRFeature) error {\n\n\t// Flag\n\tif source.Flag != nil {\n\t\tflag := FeatureFlags(*source.Flag)\n\t\tfeature.Flag = &flag\n\t} else {\n\t\tfeature.Flag = nil\n\t}\n\n\t// Properties\n\tfeature.Properties = genruntime.CloneMapOfStringToString(source.Properties)\n\n\t// Value\n\tif source.Value != nil {\n\t\tvalue := *source.Value\n\t\tfeature.Value = &value\n\t} else {\n\t\tfeature.Value = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "ae495bc8537df6cacac5f90d93a3ac08", "score": "0.51556456", "text": "func (virtualMachineScaleSetPublicIPAddressConfigurationDnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings) AssignPropertiesFromVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(source *v1alpha1api20201201storage.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings) error {\n\n\t// DomainNameLabel\n\tif source.DomainNameLabel != nil {\n\t\tvirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.DomainNameLabel = *source.DomainNameLabel\n\t} else {\n\t\tvirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.DomainNameLabel = \"\"\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "f9eaccf44ba837274323d6b5eac26151", "score": "0.5154429", "text": "func (properties *PeriodicModeProperties) AssignProperties_From_PeriodicModeProperties(source *v20210515s.PeriodicModeProperties) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(source.PropertyBag)\n\n\t// BackupIntervalInMinutes\n\tproperties.BackupIntervalInMinutes = genruntime.ClonePointerToInt(source.BackupIntervalInMinutes)\n\n\t// BackupRetentionIntervalInHours\n\tproperties.BackupRetentionIntervalInHours = genruntime.ClonePointerToInt(source.BackupRetentionIntervalInHours)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tproperties.PropertyBag = propertyBag\n\t} else {\n\t\tproperties.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForPeriodicModeProperties interface (if implemented) to customize the conversion\n\tvar propertiesAsAny any = properties\n\tif augmentedProperties, ok := propertiesAsAny.(augmentConversionForPeriodicModeProperties); ok {\n\t\terr := augmentedProperties.AssignPropertiesFrom(source)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesFrom() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "c7d206c9d42dc0524fe328d9b9253172", "score": "0.51466477", "text": "func (configuration *VpnClientConfiguration) AssignProperties_To_VpnClientConfiguration(destination *v1beta20201101s.VpnClientConfiguration) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AadAudience\n\tdestination.AadAudience = genruntime.ClonePointerToString(configuration.AadAudience)\n\n\t// AadIssuer\n\tdestination.AadIssuer = genruntime.ClonePointerToString(configuration.AadIssuer)\n\n\t// AadTenant\n\tdestination.AadTenant = genruntime.ClonePointerToString(configuration.AadTenant)\n\n\t// RadiusServerAddress\n\tdestination.RadiusServerAddress = genruntime.ClonePointerToString(configuration.RadiusServerAddress)\n\n\t// RadiusServerSecret\n\tdestination.RadiusServerSecret = genruntime.ClonePointerToString(configuration.RadiusServerSecret)\n\n\t// RadiusServers\n\tif configuration.RadiusServers != nil {\n\t\tradiusServerList := make([]v1beta20201101s.RadiusServer, len(configuration.RadiusServers))\n\t\tfor radiusServerIndex, radiusServerItem := range configuration.RadiusServers {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tradiusServerItem := radiusServerItem\n\t\t\tvar radiusServer v1beta20201101s.RadiusServer\n\t\t\terr := radiusServerItem.AssignProperties_To_RadiusServer(&radiusServer)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_RadiusServer() to populate field RadiusServers\")\n\t\t\t}\n\t\t\tradiusServerList[radiusServerIndex] = radiusServer\n\t\t}\n\t\tdestination.RadiusServers = radiusServerList\n\t} else {\n\t\tdestination.RadiusServers = nil\n\t}\n\n\t// VpnAuthenticationTypes\n\tif configuration.VpnAuthenticationTypes != nil {\n\t\tvpnAuthenticationTypeList := make([]string, len(configuration.VpnAuthenticationTypes))\n\t\tfor vpnAuthenticationTypeIndex, vpnAuthenticationTypeItem := range configuration.VpnAuthenticationTypes {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tvpnAuthenticationTypeItem := vpnAuthenticationTypeItem\n\t\t\tvpnAuthenticationTypeList[vpnAuthenticationTypeIndex] = string(vpnAuthenticationTypeItem)\n\t\t}\n\t\tdestination.VpnAuthenticationTypes = vpnAuthenticationTypeList\n\t} else {\n\t\tdestination.VpnAuthenticationTypes = nil\n\t}\n\n\t// VpnClientAddressPool\n\tif configuration.VpnClientAddressPool != nil {\n\t\tvar vpnClientAddressPool v1beta20201101s.AddressSpace\n\t\terr := configuration.VpnClientAddressPool.AssignProperties_To_AddressSpace(&vpnClientAddressPool)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_AddressSpace() to populate field VpnClientAddressPool\")\n\t\t}\n\t\tdestination.VpnClientAddressPool = &vpnClientAddressPool\n\t} else {\n\t\tdestination.VpnClientAddressPool = nil\n\t}\n\n\t// VpnClientIpsecPolicies\n\tif configuration.VpnClientIpsecPolicies != nil {\n\t\tvpnClientIpsecPolicyList := make([]v1beta20201101s.IpsecPolicy, len(configuration.VpnClientIpsecPolicies))\n\t\tfor vpnClientIpsecPolicyIndex, vpnClientIpsecPolicyItem := range configuration.VpnClientIpsecPolicies {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tvpnClientIpsecPolicyItem := vpnClientIpsecPolicyItem\n\t\t\tvar vpnClientIpsecPolicy v1beta20201101s.IpsecPolicy\n\t\t\terr := vpnClientIpsecPolicyItem.AssignProperties_To_IpsecPolicy(&vpnClientIpsecPolicy)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IpsecPolicy() to populate field VpnClientIpsecPolicies\")\n\t\t\t}\n\t\t\tvpnClientIpsecPolicyList[vpnClientIpsecPolicyIndex] = vpnClientIpsecPolicy\n\t\t}\n\t\tdestination.VpnClientIpsecPolicies = vpnClientIpsecPolicyList\n\t} else {\n\t\tdestination.VpnClientIpsecPolicies = nil\n\t}\n\n\t// VpnClientProtocols\n\tif configuration.VpnClientProtocols != nil {\n\t\tvpnClientProtocolList := make([]string, len(configuration.VpnClientProtocols))\n\t\tfor vpnClientProtocolIndex, vpnClientProtocolItem := range configuration.VpnClientProtocols {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tvpnClientProtocolItem := vpnClientProtocolItem\n\t\t\tvpnClientProtocolList[vpnClientProtocolIndex] = string(vpnClientProtocolItem)\n\t\t}\n\t\tdestination.VpnClientProtocols = vpnClientProtocolList\n\t} else {\n\t\tdestination.VpnClientProtocols = nil\n\t}\n\n\t// VpnClientRevokedCertificates\n\tif configuration.VpnClientRevokedCertificates != nil {\n\t\tvpnClientRevokedCertificateList := make([]v1beta20201101s.VpnClientRevokedCertificate, len(configuration.VpnClientRevokedCertificates))\n\t\tfor vpnClientRevokedCertificateIndex, vpnClientRevokedCertificateItem := range configuration.VpnClientRevokedCertificates {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tvpnClientRevokedCertificateItem := vpnClientRevokedCertificateItem\n\t\t\tvar vpnClientRevokedCertificate v1beta20201101s.VpnClientRevokedCertificate\n\t\t\terr := vpnClientRevokedCertificateItem.AssignProperties_To_VpnClientRevokedCertificate(&vpnClientRevokedCertificate)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_VpnClientRevokedCertificate() to populate field VpnClientRevokedCertificates\")\n\t\t\t}\n\t\t\tvpnClientRevokedCertificateList[vpnClientRevokedCertificateIndex] = vpnClientRevokedCertificate\n\t\t}\n\t\tdestination.VpnClientRevokedCertificates = vpnClientRevokedCertificateList\n\t} else {\n\t\tdestination.VpnClientRevokedCertificates = nil\n\t}\n\n\t// VpnClientRootCertificates\n\tif configuration.VpnClientRootCertificates != nil {\n\t\tvpnClientRootCertificateList := make([]v1beta20201101s.VpnClientRootCertificate, len(configuration.VpnClientRootCertificates))\n\t\tfor vpnClientRootCertificateIndex, vpnClientRootCertificateItem := range configuration.VpnClientRootCertificates {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tvpnClientRootCertificateItem := vpnClientRootCertificateItem\n\t\t\tvar vpnClientRootCertificate v1beta20201101s.VpnClientRootCertificate\n\t\t\terr := vpnClientRootCertificateItem.AssignProperties_To_VpnClientRootCertificate(&vpnClientRootCertificate)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_VpnClientRootCertificate() to populate field VpnClientRootCertificates\")\n\t\t\t}\n\t\t\tvpnClientRootCertificateList[vpnClientRootCertificateIndex] = vpnClientRootCertificate\n\t\t}\n\t\tdestination.VpnClientRootCertificates = vpnClientRootCertificateList\n\t} else {\n\t\tdestination.VpnClientRootCertificates = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7095d0076dabc226fd3e17737752c8e3", "score": "0.51309913", "text": "func (settings *UpstreamAuthSettings) AssignProperties_From_UpstreamAuthSettings(source *v1beta20211001s.UpstreamAuthSettings) error {\n\n\t// ManagedIdentity\n\tif source.ManagedIdentity != nil {\n\t\tvar managedIdentity ManagedIdentitySettings\n\t\terr := managedIdentity.AssignProperties_From_ManagedIdentitySettings(source.ManagedIdentity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ManagedIdentitySettings() to populate field ManagedIdentity\")\n\t\t}\n\t\tsettings.ManagedIdentity = &managedIdentity\n\t} else {\n\t\tsettings.ManagedIdentity = nil\n\t}\n\n\t// Type\n\tif source.Type != nil {\n\t\ttypeVar := UpstreamAuthType(*source.Type)\n\t\tsettings.Type = &typeVar\n\t} else {\n\t\tsettings.Type = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "48b6a2650f22812a987c1e01b4f33f2e", "score": "0.51268923", "text": "func (settings *ServiceManagedResourcesSettings) AssignProperties_From_ServiceManagedResourcesSettings(source *v20210701s.ServiceManagedResourcesSettings) error {\n\n\t// CosmosDb\n\tif source.CosmosDb != nil {\n\t\tvar cosmosDb CosmosDbSettings\n\t\terr := cosmosDb.AssignProperties_From_CosmosDbSettings(source.CosmosDb)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_CosmosDbSettings() to populate field CosmosDb\")\n\t\t}\n\t\tsettings.CosmosDb = &cosmosDb\n\t} else {\n\t\tsettings.CosmosDb = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "37cc20102a92501f1e2ac56750069a77", "score": "0.51043093", "text": "func (filter *CorrelationFilter) AssignProperties_To_CorrelationFilter(destination *v20210101ps.CorrelationFilter) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(filter.PropertyBag)\n\n\t// ContentType\n\tdestination.ContentType = genruntime.ClonePointerToString(filter.ContentType)\n\n\t// CorrelationId\n\tdestination.CorrelationId = genruntime.ClonePointerToString(filter.CorrelationId)\n\n\t// Label\n\tdestination.Label = genruntime.ClonePointerToString(filter.Label)\n\n\t// MessageId\n\tdestination.MessageId = genruntime.ClonePointerToString(filter.MessageId)\n\n\t// Properties\n\tdestination.Properties = genruntime.CloneMapOfStringToString(filter.Properties)\n\n\t// ReplyTo\n\tdestination.ReplyTo = genruntime.ClonePointerToString(filter.ReplyTo)\n\n\t// ReplyToSessionId\n\tdestination.ReplyToSessionId = genruntime.ClonePointerToString(filter.ReplyToSessionId)\n\n\t// RequiresPreprocessing\n\tif filter.RequiresPreprocessing != nil {\n\t\trequiresPreprocessing := *filter.RequiresPreprocessing\n\t\tdestination.RequiresPreprocessing = &requiresPreprocessing\n\t} else {\n\t\tdestination.RequiresPreprocessing = nil\n\t}\n\n\t// SessionId\n\tdestination.SessionId = genruntime.ClonePointerToString(filter.SessionId)\n\n\t// To\n\tdestination.To = genruntime.ClonePointerToString(filter.To)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForCorrelationFilter interface (if implemented) to customize the conversion\n\tvar filterAsAny any = filter\n\tif augmentedFilter, ok := filterAsAny.(augmentConversionForCorrelationFilter); ok {\n\t\terr := augmentedFilter.AssignPropertiesTo(destination)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesTo() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "1b42458389e59d3d782f48326ba00da4", "score": "0.5098167", "text": "func (embedded *PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded) AssignProperties_From_PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded(source *v1beta20211001s.PrivateEndpointConnection_STATUS_SignalR_SubResourceEmbedded) error {\n\n\t// Id\n\tembedded.Id = genruntime.ClonePointerToString(source.Id)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "95056e8b7b482db4d76c6f4c55c8db9a", "score": "0.50804216", "text": "func (properties *EventHubProperties) AssignProperties_From_EventHubProperties(source *v20210702s.EventHubProperties) error {\n\n\t// PartitionCount\n\tproperties.PartitionCount = genruntime.ClonePointerToInt(source.PartitionCount)\n\n\t// RetentionTimeInDays\n\tproperties.RetentionTimeInDays = genruntime.ClonePointerToInt(source.RetentionTimeInDays)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "3f25b8311054e13e6a9537300e1366a2", "score": "0.50794756", "text": "func (vault *BackupVaultSpec) AssignProperties_To_BackupVaultSpec(destination *v20230101s.BackupVaultSpec) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// FeatureSettings\n\tif vault.FeatureSettings != nil {\n\t\tvar featureSetting v20230101s.FeatureSettings\n\t\terr := vault.FeatureSettings.AssignProperties_To_FeatureSettings(&featureSetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_FeatureSettings() to populate field FeatureSettings\")\n\t\t}\n\t\tdestination.FeatureSettings = &featureSetting\n\t} else {\n\t\tdestination.FeatureSettings = nil\n\t}\n\n\t// MonitoringSettings\n\tif vault.MonitoringSettings != nil {\n\t\tvar monitoringSetting v20230101s.MonitoringSettings\n\t\terr := vault.MonitoringSettings.AssignProperties_To_MonitoringSettings(&monitoringSetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_MonitoringSettings() to populate field MonitoringSettings\")\n\t\t}\n\t\tdestination.MonitoringSettings = &monitoringSetting\n\t} else {\n\t\tdestination.MonitoringSettings = nil\n\t}\n\n\t// SecuritySettings\n\tif vault.SecuritySettings != nil {\n\t\tvar securitySetting v20230101s.SecuritySettings\n\t\terr := vault.SecuritySettings.AssignProperties_To_SecuritySettings(&securitySetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SecuritySettings() to populate field SecuritySettings\")\n\t\t}\n\t\tdestination.SecuritySettings = &securitySetting\n\t} else {\n\t\tdestination.SecuritySettings = nil\n\t}\n\n\t// StorageSettings\n\tif vault.StorageSettings != nil {\n\t\tstorageSettingList := make([]v20230101s.StorageSetting, len(vault.StorageSettings))\n\t\tfor storageSettingIndex, storageSettingItem := range vault.StorageSettings {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tstorageSettingItem := storageSettingItem\n\t\t\tvar storageSetting v20230101s.StorageSetting\n\t\t\terr := storageSettingItem.AssignProperties_To_StorageSetting(&storageSetting)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_StorageSetting() to populate field StorageSettings\")\n\t\t\t}\n\t\t\tstorageSettingList[storageSettingIndex] = storageSetting\n\t\t}\n\t\tdestination.StorageSettings = storageSettingList\n\t} else {\n\t\tdestination.StorageSettings = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "d0ea9d32dcabb539d10bb705af591cd9", "score": "0.5068799", "text": "func (uefiSettings *UefiSettings) AssignPropertiesFromUefiSettings(source *v1alpha1api20201201storage.UefiSettings) error {\n\n\t// SecureBootEnabled\n\tif source.SecureBootEnabled != nil {\n\t\tsecureBootEnabled := *source.SecureBootEnabled\n\t\tuefiSettings.SecureBootEnabled = &secureBootEnabled\n\t} else {\n\t\tuefiSettings.SecureBootEnabled = nil\n\t}\n\n\t// VTpmEnabled\n\tif source.VTpmEnabled != nil {\n\t\tvTpmEnabled := *source.VTpmEnabled\n\t\tuefiSettings.VTpmEnabled = &vTpmEnabled\n\t} else {\n\t\tuefiSettings.VTpmEnabled = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "8be5bfb9a46fc498fccf8f8369dd8b9f", "score": "0.5051988", "text": "func (database *RedisEnterprise_Database_Spec) AssignProperties_To_RedisEnterprise_Database_Spec(destination *v20210301s.RedisEnterprise_Database_Spec) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(database.PropertyBag)\n\n\t// AzureName\n\tdestination.AzureName = database.AzureName\n\n\t// ClientProtocol\n\tdestination.ClientProtocol = genruntime.ClonePointerToString(database.ClientProtocol)\n\n\t// ClusteringPolicy\n\tdestination.ClusteringPolicy = genruntime.ClonePointerToString(database.ClusteringPolicy)\n\n\t// EvictionPolicy\n\tdestination.EvictionPolicy = genruntime.ClonePointerToString(database.EvictionPolicy)\n\n\t// Modules\n\tif database.Modules != nil {\n\t\tmoduleList := make([]v20210301s.Module, len(database.Modules))\n\t\tfor moduleIndex, moduleItem := range database.Modules {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tmoduleItem := moduleItem\n\t\t\tvar module v20210301s.Module\n\t\t\terr := moduleItem.AssignProperties_To_Module(&module)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_Module() to populate field Modules\")\n\t\t\t}\n\t\t\tmoduleList[moduleIndex] = module\n\t\t}\n\t\tdestination.Modules = moduleList\n\t} else {\n\t\tdestination.Modules = nil\n\t}\n\n\t// OriginalVersion\n\tdestination.OriginalVersion = database.OriginalVersion\n\n\t// Owner\n\tif database.Owner != nil {\n\t\towner := database.Owner.Copy()\n\t\tdestination.Owner = &owner\n\t} else {\n\t\tdestination.Owner = nil\n\t}\n\n\t// Persistence\n\tif database.Persistence != nil {\n\t\tvar persistence v20210301s.Persistence\n\t\terr := database.Persistence.AssignProperties_To_Persistence(&persistence)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_Persistence() to populate field Persistence\")\n\t\t}\n\t\tdestination.Persistence = &persistence\n\t} else {\n\t\tdestination.Persistence = nil\n\t}\n\n\t// Port\n\tdestination.Port = genruntime.ClonePointerToInt(database.Port)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForRedisEnterprise_Database_Spec interface (if implemented) to customize the conversion\n\tvar databaseAsAny any = database\n\tif augmentedDatabase, ok := databaseAsAny.(augmentConversionForRedisEnterprise_Database_Spec); ok {\n\t\terr := augmentedDatabase.AssignPropertiesTo(destination)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesTo() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "71d575f1c6c94d0757e185331591a2d4", "score": "0.50508237", "text": "func (resource *ThroughputSettingsResource) AssignProperties_From_ThroughputSettingsResource(source *v1beta20210515s.ThroughputSettingsResource) error {\n\n\t// AutoscaleSettings\n\tif source.AutoscaleSettings != nil {\n\t\tvar autoscaleSetting AutoscaleSettingsResource\n\t\terr := autoscaleSetting.AssignProperties_From_AutoscaleSettingsResource(source.AutoscaleSettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_AutoscaleSettingsResource() to populate field AutoscaleSettings\")\n\t\t}\n\t\tresource.AutoscaleSettings = &autoscaleSetting\n\t} else {\n\t\tresource.AutoscaleSettings = nil\n\t}\n\n\t// Throughput\n\tresource.Throughput = genruntime.ClonePointerToInt(source.Throughput)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "60ec8e56577a7fc1495a46aefbf5a7c3", "score": "0.5047652", "text": "func (acLs *SignalRNetworkACLs) AssignProperties_From_SignalRNetworkACLs(source *v1beta20211001s.SignalRNetworkACLs) error {\n\n\t// DefaultAction\n\tif source.DefaultAction != nil {\n\t\tdefaultAction := ACLAction(*source.DefaultAction)\n\t\tacLs.DefaultAction = &defaultAction\n\t} else {\n\t\tacLs.DefaultAction = nil\n\t}\n\n\t// PrivateEndpoints\n\tif source.PrivateEndpoints != nil {\n\t\tprivateEndpointList := make([]PrivateEndpointACL, len(source.PrivateEndpoints))\n\t\tfor privateEndpointIndex, privateEndpointItem := range source.PrivateEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tprivateEndpointItem := privateEndpointItem\n\t\t\tvar privateEndpoint PrivateEndpointACL\n\t\t\terr := privateEndpoint.AssignProperties_From_PrivateEndpointACL(&privateEndpointItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_PrivateEndpointACL() to populate field PrivateEndpoints\")\n\t\t\t}\n\t\t\tprivateEndpointList[privateEndpointIndex] = privateEndpoint\n\t\t}\n\t\tacLs.PrivateEndpoints = privateEndpointList\n\t} else {\n\t\tacLs.PrivateEndpoints = nil\n\t}\n\n\t// PublicNetwork\n\tif source.PublicNetwork != nil {\n\t\tvar publicNetwork NetworkACL\n\t\terr := publicNetwork.AssignProperties_From_NetworkACL(source.PublicNetwork)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_NetworkACL() to populate field PublicNetwork\")\n\t\t}\n\t\tacLs.PublicNetwork = &publicNetwork\n\t} else {\n\t\tacLs.PublicNetwork = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "edf5f03568f2f5edcd796bd53c7cdb41", "score": "0.5046887", "text": "func (rule *Namespaces_Topics_Subscriptions_Rule_Spec) AssignProperties_From_Namespaces_Topics_Subscriptions_Rule_Spec(source *v20210101ps.Namespaces_Topics_Subscriptions_Rule_Spec) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(source.PropertyBag)\n\n\t// Action\n\tif source.Action != nil {\n\t\tvar action Action\n\t\terr := action.AssignProperties_From_Action(source.Action)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_Action() to populate field Action\")\n\t\t}\n\t\trule.Action = &action\n\t} else {\n\t\trule.Action = nil\n\t}\n\n\t// AzureName\n\trule.AzureName = source.AzureName\n\n\t// CorrelationFilter\n\tif source.CorrelationFilter != nil {\n\t\tvar correlationFilter CorrelationFilter\n\t\terr := correlationFilter.AssignProperties_From_CorrelationFilter(source.CorrelationFilter)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_CorrelationFilter() to populate field CorrelationFilter\")\n\t\t}\n\t\trule.CorrelationFilter = &correlationFilter\n\t} else {\n\t\trule.CorrelationFilter = nil\n\t}\n\n\t// FilterType\n\trule.FilterType = genruntime.ClonePointerToString(source.FilterType)\n\n\t// OriginalVersion\n\trule.OriginalVersion = source.OriginalVersion\n\n\t// Owner\n\tif source.Owner != nil {\n\t\towner := source.Owner.Copy()\n\t\trule.Owner = &owner\n\t} else {\n\t\trule.Owner = nil\n\t}\n\n\t// SqlFilter\n\tif source.SqlFilter != nil {\n\t\tvar sqlFilter SqlFilter\n\t\terr := sqlFilter.AssignProperties_From_SqlFilter(source.SqlFilter)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SqlFilter() to populate field SqlFilter\")\n\t\t}\n\t\trule.SqlFilter = &sqlFilter\n\t} else {\n\t\trule.SqlFilter = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\trule.PropertyBag = propertyBag\n\t} else {\n\t\trule.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForNamespaces_Topics_Subscriptions_Rule_Spec interface (if implemented) to customize the conversion\n\tvar ruleAsAny any = rule\n\tif augmentedRule, ok := ruleAsAny.(augmentConversionForNamespaces_Topics_Subscriptions_Rule_Spec); ok {\n\t\terr := augmentedRule.AssignPropertiesFrom(source)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling augmented AssignPropertiesFrom() for conversion\")\n\t\t}\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "f3d37af637312ba8b86e9e6d2e3ad67a", "score": "0.50465935", "text": "func (settings *AzureMonitorAlertSettings) AssignProperties_To_AzureMonitorAlertSettings(destination *v20230101s.AzureMonitorAlertSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AlertsForAllJobFailures\n\tif settings.AlertsForAllJobFailures != nil {\n\t\talertsForAllJobFailure := string(*settings.AlertsForAllJobFailures)\n\t\tdestination.AlertsForAllJobFailures = &alertsForAllJobFailure\n\t} else {\n\t\tdestination.AlertsForAllJobFailures = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "fd1dd6e7a6e5c608024041ecf00f314b", "score": "0.504473", "text": "func (sshConfigurationStatus *SshConfiguration_Status) AssignPropertiesToSshConfigurationStatus(destination *v1alpha1api20201201storage.SshConfiguration_Status) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// PublicKeys\n\tpublicKeyList := make([]v1alpha1api20201201storage.SshPublicKey_Status, len(sshConfigurationStatus.PublicKeys))\n\tfor publicKeyIndex, publicKeyItem := range sshConfigurationStatus.PublicKeys {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tpublicKeyItem := publicKeyItem\n\t\tvar publicKey v1alpha1api20201201storage.SshPublicKey_Status\n\t\terr := publicKeyItem.AssignPropertiesToSshPublicKeyStatus(&publicKey)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating PublicKeys from PublicKeys, calling AssignPropertiesToSshPublicKeyStatus()\")\n\t\t}\n\t\tpublicKeyList[publicKeyIndex] = publicKey\n\t}\n\tdestination.PublicKeys = publicKeyList\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "85877554f5d0391e85db24258ddca401", "score": "0.504062", "text": "func (settings *ServerlessUpstreamSettings) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif settings == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &ServerlessUpstreamSettings_ARM{}\n\n\t// Set property \"Templates\":\n\tfor _, item := range settings.Templates {\n\t\titem_ARM, err := item.ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult.Templates = append(result.Templates, *item_ARM.(*UpstreamTemplate_ARM))\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2a557b5706efc7d334f50e5cba72bd15", "score": "0.5038949", "text": "func (patchSettingsStatus *PatchSettings_Status) AssignPropertiesFromPatchSettingsStatus(source *v1alpha1api20201201storage.PatchSettings_Status) error {\n\n\t// EnableHotpatching\n\tif source.EnableHotpatching != nil {\n\t\tenableHotpatching := *source.EnableHotpatching\n\t\tpatchSettingsStatus.EnableHotpatching = &enableHotpatching\n\t} else {\n\t\tpatchSettingsStatus.EnableHotpatching = nil\n\t}\n\n\t// PatchMode\n\tif source.PatchMode != nil {\n\t\tpatchMode := PatchSettingsStatusPatchMode(*source.PatchMode)\n\t\tpatchSettingsStatus.PatchMode = &patchMode\n\t} else {\n\t\tpatchSettingsStatus.PatchMode = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "6b00ecea8181098d38bd1e006562a59f", "score": "0.50377953", "text": "func AddRelatedPropertyGeneratorsForSmbSetting_ARM(gens map[string]gopter.Gen) {\n\tgens[\"Multichannel\"] = gen.PtrOf(Multichannel_ARMGenerator())\n}", "title": "" }, { "docid": "b1d44f80830c041fb06762a884b31558", "score": "0.50314754", "text": "func (sshPublicKeyStatus *SshPublicKey_Status) AssignPropertiesToSshPublicKeyStatus(destination *v1alpha1api20201201storage.SshPublicKey_Status) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// KeyData\n\tif sshPublicKeyStatus.KeyData != nil {\n\t\tkeyDatum := *sshPublicKeyStatus.KeyData\n\t\tdestination.KeyData = &keyDatum\n\t} else {\n\t\tdestination.KeyData = nil\n\t}\n\n\t// Path\n\tif sshPublicKeyStatus.Path != nil {\n\t\tpath := *sshPublicKeyStatus.Path\n\t\tdestination.Path = &path\n\t} else {\n\t\tdestination.Path = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "011688a6535dcbe2468122faeaeec254", "score": "0.5030417", "text": "func (properties *RoutingEventHubProperties) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {\n\ttypedInput, ok := armInput.(RoutingEventHubProperties_ARM)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unexpected type supplied for PopulateFromARM() function. Expected RoutingEventHubProperties_ARM, got %T\", armInput)\n\t}\n\n\t// Set property \"AuthenticationType\":\n\tif typedInput.AuthenticationType != nil {\n\t\tauthenticationType := *typedInput.AuthenticationType\n\t\tproperties.AuthenticationType = &authenticationType\n\t}\n\n\t// no assignment for property \"ConnectionString\"\n\n\t// Set property \"EndpointUri\":\n\tif typedInput.EndpointUri != nil {\n\t\tendpointUri := *typedInput.EndpointUri\n\t\tproperties.EndpointUri = &endpointUri\n\t}\n\n\t// Set property \"EntityPath\":\n\tif typedInput.EntityPath != nil {\n\t\tentityPath := *typedInput.EntityPath\n\t\tproperties.EntityPath = &entityPath\n\t}\n\n\t// Set property \"Identity\":\n\tif typedInput.Identity != nil {\n\t\tvar identity1 ManagedIdentity\n\t\terr := identity1.PopulateFromARM(owner, *typedInput.Identity)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tidentity := identity1\n\t\tproperties.Identity = &identity\n\t}\n\n\t// Set property \"Name\":\n\tif typedInput.Name != nil {\n\t\tname := *typedInput.Name\n\t\tproperties.Name = &name\n\t}\n\n\t// no assignment for property \"Reference\"\n\n\t// Set property \"ResourceGroup\":\n\tif typedInput.ResourceGroup != nil {\n\t\tresourceGroup := *typedInput.ResourceGroup\n\t\tproperties.ResourceGroup = &resourceGroup\n\t}\n\n\t// Set property \"SubscriptionId\":\n\tif typedInput.SubscriptionId != nil {\n\t\tsubscriptionId := *typedInput.SubscriptionId\n\t\tproperties.SubscriptionId = &subscriptionId\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "e4ca7a0ab710bd018fead3a229c97c7e", "score": "0.50293386", "text": "func AddRelatedPropertyGeneratorsForProtocolSettings_ARM(gens map[string]gopter.Gen) {\n\tgens[\"Smb\"] = gen.PtrOf(SmbSetting_ARMGenerator())\n}", "title": "" }, { "docid": "01a37e3e750b84113e62ea13003e36a5", "score": "0.50245667", "text": "func (settings *MonitoringSettings) AssignProperties_To_MonitoringSettings(destination *v20230101s.MonitoringSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AzureMonitorAlertSettings\n\tif settings.AzureMonitorAlertSettings != nil {\n\t\tvar azureMonitorAlertSetting v20230101s.AzureMonitorAlertSettings\n\t\terr := settings.AzureMonitorAlertSettings.AssignProperties_To_AzureMonitorAlertSettings(&azureMonitorAlertSetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_AzureMonitorAlertSettings() to populate field AzureMonitorAlertSettings\")\n\t\t}\n\t\tdestination.AzureMonitorAlertSettings = &azureMonitorAlertSetting\n\t} else {\n\t\tdestination.AzureMonitorAlertSettings = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "6f9659c05023e7f7442640bf60654b9f", "score": "0.5024518", "text": "func (settings *BgpSettings_STATUS) AssignProperties_To_BgpSettings_STATUS(destination *v1beta20201101s.BgpSettings_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Asn\n\tif settings.Asn != nil {\n\t\tasn := *settings.Asn\n\t\tdestination.Asn = &asn\n\t} else {\n\t\tdestination.Asn = nil\n\t}\n\n\t// BgpPeeringAddress\n\tdestination.BgpPeeringAddress = genruntime.ClonePointerToString(settings.BgpPeeringAddress)\n\n\t// BgpPeeringAddresses\n\tif settings.BgpPeeringAddresses != nil {\n\t\tbgpPeeringAddressList := make([]v1beta20201101s.IPConfigurationBgpPeeringAddress_STATUS, len(settings.BgpPeeringAddresses))\n\t\tfor bgpPeeringAddressIndex, bgpPeeringAddressItem := range settings.BgpPeeringAddresses {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tbgpPeeringAddressItem := bgpPeeringAddressItem\n\t\t\tvar bgpPeeringAddress v1beta20201101s.IPConfigurationBgpPeeringAddress_STATUS\n\t\t\terr := bgpPeeringAddressItem.AssignProperties_To_IPConfigurationBgpPeeringAddress_STATUS(&bgpPeeringAddress)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_IPConfigurationBgpPeeringAddress_STATUS() to populate field BgpPeeringAddresses\")\n\t\t\t}\n\t\t\tbgpPeeringAddressList[bgpPeeringAddressIndex] = bgpPeeringAddress\n\t\t}\n\t\tdestination.BgpPeeringAddresses = bgpPeeringAddressList\n\t} else {\n\t\tdestination.BgpPeeringAddresses = nil\n\t}\n\n\t// PeerWeight\n\tdestination.PeerWeight = genruntime.ClonePointerToInt(settings.PeerWeight)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "1983620f20b52867badc93d031bd0ffc", "score": "0.5019867", "text": "func (winRMConfigurationStatus *WinRMConfiguration_Status) AssignPropertiesToWinRMConfigurationStatus(destination *v1alpha1api20201201storage.WinRMConfiguration_Status) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Listeners\n\tlistenerList := make([]v1alpha1api20201201storage.WinRMListener_Status, len(winRMConfigurationStatus.Listeners))\n\tfor listenerIndex, listenerItem := range winRMConfigurationStatus.Listeners {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tlistenerItem := listenerItem\n\t\tvar listener v1alpha1api20201201storage.WinRMListener_Status\n\t\terr := listenerItem.AssignPropertiesToWinRMListenerStatus(&listener)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating Listeners from Listeners, calling AssignPropertiesToWinRMListenerStatus()\")\n\t\t}\n\t\tlistenerList[listenerIndex] = listener\n\t}\n\tdestination.Listeners = listenerList\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "8878de9f031674e30c8dc57a1bafb9e2", "score": "0.50196", "text": "func (settings *ServiceManagedResourcesSettings_STATUS) AssignProperties_To_ServiceManagedResourcesSettings_STATUS(destination *v20210701s.ServiceManagedResourcesSettings_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// CosmosDb\n\tif settings.CosmosDb != nil {\n\t\tvar cosmosDb v20210701s.CosmosDbSettings_STATUS\n\t\terr := settings.CosmosDb.AssignProperties_To_CosmosDbSettings_STATUS(&cosmosDb)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_CosmosDbSettings_STATUS() to populate field CosmosDb\")\n\t\t}\n\t\tdestination.CosmosDb = &cosmosDb\n\t} else {\n\t\tdestination.CosmosDb = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0caa3061e08f9b2c29f9c737fd778644", "score": "0.50170577", "text": "func (settings *AzureMonitorAlertSettings) AssignProperties_From_AzureMonitorAlertSettings(source *v20230101s.AzureMonitorAlertSettings) error {\n\n\t// AlertsForAllJobFailures\n\tif source.AlertsForAllJobFailures != nil {\n\t\talertsForAllJobFailure := AzureMonitorAlertSettings_AlertsForAllJobFailures(*source.AlertsForAllJobFailures)\n\t\tsettings.AlertsForAllJobFailures = &alertsForAllJobFailure\n\t} else {\n\t\tsettings.AlertsForAllJobFailures = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7e6514afecaaef4f4b935f201355006b", "score": "0.50162995", "text": "func (properties *NetworkRuleSetProperties) AssignProperties_To_NetworkRuleSetProperties(destination *v20210702s.NetworkRuleSetProperties) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// ApplyToBuiltInEventHubEndpoint\n\tif properties.ApplyToBuiltInEventHubEndpoint != nil {\n\t\tapplyToBuiltInEventHubEndpoint := *properties.ApplyToBuiltInEventHubEndpoint\n\t\tdestination.ApplyToBuiltInEventHubEndpoint = &applyToBuiltInEventHubEndpoint\n\t} else {\n\t\tdestination.ApplyToBuiltInEventHubEndpoint = nil\n\t}\n\n\t// DefaultAction\n\tif properties.DefaultAction != nil {\n\t\tdefaultAction := string(*properties.DefaultAction)\n\t\tdestination.DefaultAction = &defaultAction\n\t} else {\n\t\tdestination.DefaultAction = nil\n\t}\n\n\t// IpRules\n\tif properties.IpRules != nil {\n\t\tipRuleList := make([]v20210702s.NetworkRuleSetIpRule, len(properties.IpRules))\n\t\tfor ipRuleIndex, ipRuleItem := range properties.IpRules {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tipRuleItem := ipRuleItem\n\t\t\tvar ipRule v20210702s.NetworkRuleSetIpRule\n\t\t\terr := ipRuleItem.AssignProperties_To_NetworkRuleSetIpRule(&ipRule)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_NetworkRuleSetIpRule() to populate field IpRules\")\n\t\t\t}\n\t\t\tipRuleList[ipRuleIndex] = ipRule\n\t\t}\n\t\tdestination.IpRules = ipRuleList\n\t} else {\n\t\tdestination.IpRules = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0835c03480b4292ff5870ae1378a45ec", "score": "0.50098634", "text": "func (setting *DatabaseAccounts_MongodbDatabases_Collections_ThroughputSetting_Spec) AssignProperties_From_DatabaseAccounts_MongodbDatabases_Collections_ThroughputSetting_Spec(source *v1beta20210515s.DatabaseAccounts_MongodbDatabases_Collections_ThroughputSetting_Spec) error {\n\n\t// Location\n\tsetting.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// Owner\n\tif source.Owner != nil {\n\t\towner := source.Owner.Copy()\n\t\tsetting.Owner = &owner\n\t} else {\n\t\tsetting.Owner = nil\n\t}\n\n\t// Resource\n\tif source.Resource != nil {\n\t\tvar resource ThroughputSettingsResource\n\t\terr := resource.AssignProperties_From_ThroughputSettingsResource(source.Resource)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ThroughputSettingsResource() to populate field Resource\")\n\t\t}\n\t\tsetting.Resource = &resource\n\t} else {\n\t\tsetting.Resource = nil\n\t}\n\n\t// Tags\n\tsetting.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7e614aaf939ca7b336b29c15cce553b6", "score": "0.5003353", "text": "func (additionalCapabilities *AdditionalCapabilities) AssignPropertiesToAdditionalCapabilities(destination *v1alpha1api20201201storage.AdditionalCapabilities) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// UltraSSDEnabled\n\tif additionalCapabilities.UltraSSDEnabled != nil {\n\t\tultraSSDEnabled := *additionalCapabilities.UltraSSDEnabled\n\t\tdestination.UltraSSDEnabled = &ultraSSDEnabled\n\t} else {\n\t\tdestination.UltraSSDEnabled = nil\n\t}\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "c6e081174f8fd2e9f1cc69cfd4118e5f", "score": "0.49915215", "text": "func (feature *SignalRFeature_STATUS) AssignProperties_To_SignalRFeature_STATUS(destination *v1beta20211001s.SignalRFeature_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Flag\n\tif feature.Flag != nil {\n\t\tflag := string(*feature.Flag)\n\t\tdestination.Flag = &flag\n\t} else {\n\t\tdestination.Flag = nil\n\t}\n\n\t// Properties\n\tdestination.Properties = genruntime.CloneMapOfStringToString(feature.Properties)\n\n\t// Value\n\tdestination.Value = genruntime.ClonePointerToString(feature.Value)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "45ab0ad991c510ed86a6e9911ba8d35c", "score": "0.49825904", "text": "func (iotHub *IotHub) AssignProperties_From_IotHub(source *v20210702s.IotHub) error {\n\n\t// ObjectMeta\n\tiotHub.ObjectMeta = *source.ObjectMeta.DeepCopy()\n\n\t// Spec\n\tvar spec IotHub_Spec\n\terr := spec.AssignProperties_From_IotHub_Spec(&source.Spec)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IotHub_Spec() to populate field Spec\")\n\t}\n\tiotHub.Spec = spec\n\n\t// Status\n\tvar status IotHub_STATUS\n\terr = status.AssignProperties_From_IotHub_STATUS(&source.Status)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"calling AssignProperties_From_IotHub_STATUS() to populate field Status\")\n\t}\n\tiotHub.Status = status\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "066ca966670788dd14daa85ed6250504", "score": "0.49794722", "text": "func (settings *ComputeInstanceSshSettings) AssignProperties_To_ComputeInstanceSshSettings(destination *v20210701s.ComputeInstanceSshSettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// AdminPublicKey\n\tdestination.AdminPublicKey = genruntime.ClonePointerToString(settings.AdminPublicKey)\n\n\t// SshPublicAccess\n\tif settings.SshPublicAccess != nil {\n\t\tsshPublicAccess := string(*settings.SshPublicAccess)\n\t\tdestination.SshPublicAccess = &sshPublicAccess\n\t} else {\n\t\tdestination.SshPublicAccess = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "9bb0e2978fcbe919afd43653496d7640", "score": "0.49483865", "text": "func (settings *SecuritySettings_STATUS) AssignProperties_To_SecuritySettings_STATUS(destination *v20230101s.SecuritySettings_STATUS) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// ImmutabilitySettings\n\tif settings.ImmutabilitySettings != nil {\n\t\tvar immutabilitySetting v20230101s.ImmutabilitySettings_STATUS\n\t\terr := settings.ImmutabilitySettings.AssignProperties_To_ImmutabilitySettings_STATUS(&immutabilitySetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_ImmutabilitySettings_STATUS() to populate field ImmutabilitySettings\")\n\t\t}\n\t\tdestination.ImmutabilitySettings = &immutabilitySetting\n\t} else {\n\t\tdestination.ImmutabilitySettings = nil\n\t}\n\n\t// SoftDeleteSettings\n\tif settings.SoftDeleteSettings != nil {\n\t\tvar softDeleteSetting v20230101s.SoftDeleteSettings_STATUS\n\t\terr := settings.SoftDeleteSettings.AssignProperties_To_SoftDeleteSettings_STATUS(&softDeleteSetting)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_To_SoftDeleteSettings_STATUS() to populate field SoftDeleteSettings\")\n\t\t}\n\t\tdestination.SoftDeleteSettings = &softDeleteSetting\n\t} else {\n\t\tdestination.SoftDeleteSettings = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "8c2058ede32c0316dd8525d120130566", "score": "0.49450022", "text": "func (settings *ManagedIdentitySettings) AssignProperties_To_ManagedIdentitySettings(destination *v1beta20211001s.ManagedIdentitySettings) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// Resource\n\tdestination.Resource = genruntime.ClonePointerToString(settings.Resource)\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tdestination.PropertyBag = propertyBag\n\t} else {\n\t\tdestination.PropertyBag = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "111f65a353a4535ddf0283d83a5d42ae", "score": "0.49398875", "text": "func (sshConfiguration *SshConfiguration) AssignPropertiesToSshConfiguration(destination *v1alpha1api20201201storage.SshConfiguration) error {\n\t// Create a new property bag\n\tpropertyBag := genruntime.NewPropertyBag()\n\n\t// PublicKeys\n\tpublicKeyList := make([]v1alpha1api20201201storage.SshPublicKey, len(sshConfiguration.PublicKeys))\n\tfor publicKeyIndex, publicKeyItem := range sshConfiguration.PublicKeys {\n\t\t// Shadow the loop variable to avoid aliasing\n\t\tpublicKeyItem := publicKeyItem\n\t\tvar publicKey v1alpha1api20201201storage.SshPublicKey\n\t\terr := publicKeyItem.AssignPropertiesToSshPublicKey(&publicKey)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"populating PublicKeys from PublicKeys, calling AssignPropertiesToSshPublicKey()\")\n\t\t}\n\t\tpublicKeyList[publicKeyIndex] = publicKey\n\t}\n\tdestination.PublicKeys = publicKeyList\n\n\t// Update the property bag\n\tdestination.PropertyBag = propertyBag\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "9f478ff27797dea5fd0b7016d345adcd", "score": "0.4935367", "text": "func (settings *BgpSettings) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {\n\ttypedInput, ok := armInput.(BgpSettings_ARM)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unexpected type supplied for PopulateFromARM() function. Expected BgpSettings_ARM, got %T\", armInput)\n\t}\n\n\t// Set property \"Asn\":\n\tif typedInput.Asn != nil {\n\t\tasn := *typedInput.Asn\n\t\tsettings.Asn = &asn\n\t}\n\n\t// Set property \"BgpPeeringAddress\":\n\tif typedInput.BgpPeeringAddress != nil {\n\t\tbgpPeeringAddress := *typedInput.BgpPeeringAddress\n\t\tsettings.BgpPeeringAddress = &bgpPeeringAddress\n\t}\n\n\t// Set property \"BgpPeeringAddresses\":\n\tfor _, item := range typedInput.BgpPeeringAddresses {\n\t\tvar item1 IPConfigurationBgpPeeringAddress\n\t\terr := item1.PopulateFromARM(owner, item)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsettings.BgpPeeringAddresses = append(settings.BgpPeeringAddresses, item1)\n\t}\n\n\t// Set property \"PeerWeight\":\n\tif typedInput.PeerWeight != nil {\n\t\tpeerWeight := *typedInput.PeerWeight\n\t\tsettings.PeerWeight = &peerWeight\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" } ]
15f90eac564774951a7d8a0bf3b32cd3
Key is used to retrieve the corresponding parameter value. This should be unique for a given fired event. These parameters must be predefined in the workflow definition.
[ { "docid": "9dd8d6a1c31fc6e31f9781290a8fc61d", "score": "0.5758894", "text": "func (o EnterpriseCrmFrontendsEventbusProtoWorkflowParameterEntryResponseOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmFrontendsEventbusProtoWorkflowParameterEntryResponse) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "2aa182c74fd9970fa20c538bb171708c", "score": "0.63003707", "text": "func (o EnterpriseCrmFrontendsEventbusProtoWorkflowParameterEntryOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmFrontendsEventbusProtoWorkflowParameterEntry) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bd40c006faa2ce9b397451e58d244cae", "score": "0.61341923", "text": "func eventKey(event *registry.PremisEvent) string {\n\tsuffix := event.OutcomeDetail\n\tif event.EventType == constants.EventIdentifierAssignment || event.EventType == constants.EventReplication {\n\t\tsuffix = event.OutcomeInformation\n\t}\n\treturn fmt.Sprintf(\"%s / %s\", event.EventType, suffix)\n}", "title": "" }, { "docid": "91edb08b8efd967f289fc9dcf7e8f2c0", "score": "0.6112004", "text": "func (o EnterpriseCrmEventbusProtoParameterEntryOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoParameterEntry) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "68957a6974bac14a85e2eaf4a1b5a046", "score": "0.5976544", "text": "func EventKey(event *cloudevents.Event) (string, error) {\n\tvar (\n\t\tdata eventData\n\t\tresourceName string\n\t\tresourceNamespace string\n\t\tresourceKind string\n\t)\n\terr := json.Unmarshal(event.Data(), &data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif data.CustomRun == nil {\n\t\treturn \"\", fmt.Errorf(\"Invalid CustomRun data in %v\", event)\n\t}\n\tresourceName = data.CustomRun.Name\n\tresourceNamespace = data.CustomRun.Namespace\n\tresourceKind = \"customrun\"\n\teventType := event.Type()\n\treturn fmt.Sprintf(\"%s/%s/%s/%s\", eventType, resourceKind, resourceNamespace, resourceName), nil\n}", "title": "" }, { "docid": "10686c726247b2cbd083fbd5bff31bea", "score": "0.5966639", "text": "func Key(k string) func(*VarsProber) {\n\treturn func(p *VarsProber) {\n\t\tp.Key = k\n\t}\n}", "title": "" }, { "docid": "8fd05f0a64c97d9e0be1c2cb6492ad98", "score": "0.5924135", "text": "func (o EnterpriseCrmFrontendsEventbusProtoParameterEntryOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmFrontendsEventbusProtoParameterEntry) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1b3089a09edd427a7dbd47b62ee89506", "score": "0.58752817", "text": "func (myKeyValue *KeyValue) Key() (param string) {\n\treturn myKeyValue.Keyvar\n}", "title": "" }, { "docid": "4fb0631f75bc5a45bae68123b00cc3db", "score": "0.5867637", "text": "func Getkey(params string, args ...interface{}) {\n}", "title": "" }, { "docid": "a9589956ad27d91e3eeb91c67620698e", "score": "0.58435404", "text": "func (r *Route) Key(name string) *datastore.Key {\n\tkey, _ := datastore.DecodeKey(r.params[name])\n\treturn key\n}", "title": "" }, { "docid": "7a0fb070db05fecdb3b5afbcdeaf7e6e", "score": "0.57566184", "text": "func (s *Position) Key() (key string) {\n\treturn \"run/position/\" + s.PipelineName\n}", "title": "" }, { "docid": "153d1cc61c84d2626f910d47d046db91", "score": "0.57064956", "text": "func (step *Step) Key() string {\n\treturn step.key\n}", "title": "" }, { "docid": "79e2bc3e28ec387b66830ac942e02970", "score": "0.5693171", "text": "func (e *ServiceEvent) Key() string {\n\tif len(e.key) > 0 {\n\t\treturn e.key\n\t}\n\te.key = e.Service.Key()\n\treturn e.key\n}", "title": "" }, { "docid": "93c131726bddd2b7b4be5ef412bc6944", "score": "0.5650101", "text": "func (a *ArgBusiness) Key() int64 {\n\treturn a.BusinessID\n}", "title": "" }, { "docid": "b638e9cbac97242afe7933548ec5cad3", "score": "0.5638081", "text": "func (e Event) Key(status uint8) []byte {\n\tkey := fmt.Sprintf(\n\t\t\"event:%s:%d:%s:%s\",\n\t\te.StreamID,\n\t\tstatus,\n\t\te.CreatedAt.Format(time.RFC3339),\n\t\te.ID,\n\t)\n\treturn []byte(key)\n}", "title": "" }, { "docid": "e77cab683d9f0da0bcc64d674d9ecedb", "score": "0.55899507", "text": "func (o EnterpriseCrmEventbusProtoParameterEntryResponseOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoParameterEntryResponse) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "65390a88a1486caf4aac685ced3cbf52", "score": "0.5568315", "text": "func EventKey(event *spec.Event) []byte {\n\treturn storage.NewKeyGenerator().Event(event)\n}", "title": "" }, { "docid": "0f228f09b9b7ab7e04e728ba49b94ec0", "score": "0.55666745", "text": "func (e QueryParameterValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "0f3f8b91129d85dd0f757e5868b06c18", "score": "0.5526245", "text": "func (e CreateEventTriggeredMessageRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "70d87f7c4b07aa2eeef2e7046dde67ed", "score": "0.55194986", "text": "func (e *Event) DataKey() string {\n\treturn \"events:data:\" + e.Id\n}", "title": "" }, { "docid": "e09279550a43cbfb08704d8312f29d4e", "score": "0.5500368", "text": "func (e EventRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c8efb3169bbcd1cbf91a5b07e273dd49", "score": "0.5497618", "text": "func (o GoogleCloudIntegrationsV1alphaIntegrationParameterOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudIntegrationsV1alphaIntegrationParameter) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "afdbd9880cfcd8cb465903286595b38b", "score": "0.54634076", "text": "func (cmd *Command) P(key string) string {\n\tif p, ok := cmd.Params[key]; ok {\n\t\treturn *p.Val\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "543a5516e09305f81eb1ea9dfebbf0e3", "score": "0.5463041", "text": "func (s *SiteInfo) Param(key interface{}) (interface{}, error) {\n\tkeyStr, err := cast.ToStringE(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkeyStr = strings.ToLower(keyStr)\n\treturn s.Params[keyStr], nil\n}", "title": "" }, { "docid": "46d8562d1b3dffe41ffcf0d7003ae275", "score": "0.54051256", "text": "func (pie ParametersISCEntry) Key() string {\n\tif pie.Group == \"\" {\n\t\treturn pie.Name\n\t}\n\n\treturn pie.Group + \".\" + pie.Name\n}", "title": "" }, { "docid": "8f34e26a3e0c517d8c4cd603fcc7be6b", "score": "0.5372757", "text": "func (e UpdateEventTriggeredMessageRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "9ccbd18edb185b42cc5fa1299006622d", "score": "0.53715557", "text": "func (o EnterpriseCrmFrontendsEventbusProtoParameterEntryResponseOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmFrontendsEventbusProtoParameterEntryResponse) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c319211e318099f996be2f512377c946", "score": "0.53691685", "text": "func (e EventValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c319211e318099f996be2f512377c946", "score": "0.53691685", "text": "func (e EventValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "fb19a99e7c6b3255398c86c744e1b5b5", "score": "0.53483814", "text": "func Param(key, value string) KeyValue {\n\treturn func() (string, string) {\n\t\treturn key, value\n\t}\n}", "title": "" }, { "docid": "18a9e4c6dd4d74de015ff57eec13ef72", "score": "0.53238285", "text": "func (ctx *Context) Param(key string) string {\n\treturn ctx.Params[key] // Get from context\n}", "title": "" }, { "docid": "a92cee0fa90f12f91683566f8a52c8d3", "score": "0.53143466", "text": "func (e *Entry) GetParameter(name string) string {\n\treturn shared.Search(&e.Parameter, name)\n}", "title": "" }, { "docid": "cf29b86e5a206a3e2b1c5965baa95a22", "score": "0.529158", "text": "func (p ExecutorParams) Key() ops.SiteOperationKey {\n\treturn ops.SiteOperationKey{\n\t\tAccountID: p.Plan.AccountID,\n\t\tSiteDomain: p.Plan.ClusterName,\n\t\tOperationID: p.Plan.OperationID,\n\t}\n}", "title": "" }, { "docid": "09dad9519ef17839f033cc7e0c22cbf4", "score": "0.52910477", "text": "func (e CreateEventTriggeredMessageResponceValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "af145ac047c14fc5105f116cdcfb30c6", "score": "0.5279211", "text": "func (c *Context) Param(key string) string {\n\treturn c.Params.ByName(key)\n}", "title": "" }, { "docid": "d76a19e8a0e8f57b0798263f848ce12f", "score": "0.52675486", "text": "func (e ListEventTriggeredMessagesRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "4521bd4a98165e5717fe07272633d4c7", "score": "0.52667636", "text": "func (r *Robot) GetParameter(key string) string {\n\tc := r.getContext()\n\tvalue, ok := c.environment[key]\n\tif ok {\n\t\treturn value\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8a1ec18b71abb97abdb00d51204904a5", "score": "0.5258897", "text": "func (e EventResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "37c15d15f24256c3e75262eb11d23cdf", "score": "0.52570903", "text": "func (r *VarRef) Key() string {\n\treturn r.key.(string)\n}", "title": "" }, { "docid": "0c24d675ad8b3165945454369ba4b10f", "score": "0.525251", "text": "func (m *UserAction) Key() *datastore.Key {\n\t// if there is no Id, we want to generate an \"incomplete\"\n\t// one and let datastore determine the key/Id for us\n\tif m.ID == \"\" {\n\t\treturn DS.NewKey(UserActionKind)\n\t}\n\n\t// if Id is already set, we'll just build the Key based\n\t// on the one provided.\n\tkey, err := datastore.DecodeKey(m.ID)\n\tif err != nil {\n\t\tDS.Logger.Error(\"Key not found:\", err)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "918121ee51f998134acc08290c69a5c8", "score": "0.5250963", "text": "func (c *constructor) Key() (nm.Key, error) {\n\tvar args []nm.OptionalArg\n\n\tfor _, param := range c.params {\n\t\toption, err := param.Option()\n\t\tif err != nil {\n\t\t\treturn nm.Key{}, errors.Wrap(err, \"unable to create key from param\")\n\t\t}\n\n\t\targs = append(args, option)\n\t}\n\n\tkey := nm.FunctionKey(c.name, []string{}, nm.KeyOptNamedParams(args...))\n\treturn key, nil\n}", "title": "" }, { "docid": "5085bc633117366a494ad78ba8472d76", "score": "0.5243425", "text": "func (o EnterpriseCrmFrontendsEventbusProtoParamSpecEntryOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmFrontendsEventbusProtoParamSpecEntry) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "31c906cd97294762b1f32271fdc86ebe", "score": "0.52291375", "text": "func (e *Event) TimeKey() string {\n\treturn \"events:time:\" + e.Camera\n}", "title": "" }, { "docid": "13abc2737deae53446a4bddbd88abb2b", "score": "0.52138174", "text": "func (this *Target) Key() string {\n\treturn fmt.Sprintf(\"%s:%s\", this.Repository.Uri, this.Name)\n}", "title": "" }, { "docid": "98fa2609703e2b7449c1276e2c572da0", "score": "0.51998293", "text": "func (o GetPolicyDocumentRuleAllowedParameterOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPolicyDocumentRuleAllowedParameter) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7853e222e8f82ecea085535698052d34", "score": "0.5186133", "text": "func (scv *StandardConfigValue) Key() string {\n\treturn scv.key\n}", "title": "" }, { "docid": "047e38528bb09aea90290814e930ecb6", "score": "0.517843", "text": "func (c *Command) Key() string {\n\treturn c.Name\n}", "title": "" }, { "docid": "9d1fbc070408e3513ae92e3e17a08d4e", "score": "0.5169962", "text": "func (instance *Instance) Key() string {\n\tif instance.task.Slot == 0 {\n\t\treturn fmt.Sprintf(\"%v.%v\", instance.serviceName, instance.task.NodeID)\n\t}\n\treturn fmt.Sprintf(\"%v.%v\", instance.serviceName, instance.task.Slot)\n}", "title": "" }, { "docid": "a01f2fc58b0b31b64b53bae23b7ef4c9", "score": "0.5150995", "text": "func (r *kinesisEvalResult) Key() string {\n\tif r.EvalResult == nil || r.EvalContext == nil {\n\t\treturn \"\"\n\t}\n\treturn util.SafeString(r.EvalContext.EntityID)\n}", "title": "" }, { "docid": "299a748c38eb1f1ce68909ced3bc003a", "score": "0.51381814", "text": "func (s *Segment) Key() string {\n\treturn s.TraceID + \"-\" + s.ID\n}", "title": "" }, { "docid": "35384e8005ab14ec38134a3c99be4d4d", "score": "0.51373804", "text": "func (e ListEventTriggeredMessagesResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "9793e1b7b020d67c5ec16775efa375b4", "score": "0.5136901", "text": "func (o EventDataStoreTagOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EventDataStoreTag) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fe419870f248d2857a5b9a4e3ddab59e", "score": "0.51322216", "text": "func (ctx *Context) Param(key string) string {\n\treturn ctx.Params.Get(key)\n}", "title": "" }, { "docid": "c3b8f2c5c51c2f1d110b7ef8d08e0416", "score": "0.5125357", "text": "func (e DeleteEventTriggeredMessageRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "6af664c8258a9fa38c6611a2fee01fc3", "score": "0.5120288", "text": "func (pm *PingMeasurement) Key() string {\n\tsa, _ := util.IPStringToInt32(pm.SAddr)\n\tif pm.RR {\n\t\treturn fmt.Sprintf(\"%s_%d_%d_%d\", \"XRRP\", pm.Src, pm.Dst, sa)\n\t}\n\treturn fmt.Sprintf(\"%s_%d_%d_%d\", \"XXXP\", pm.Src, pm.Dst, sa)\n}", "title": "" }, { "docid": "0aab10698f340ce21231ee279ef3f5bb", "score": "0.51100624", "text": "func (e *Endpoint) Key() string {\n\treturn e.Id\n}", "title": "" }, { "docid": "09c004ba63d5df90f09c95229400dd9c", "score": "0.5109737", "text": "func (i SQSCreateQueueAttribute) Key() string {\n\tif val, ok := _SQSCreateQueueAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "f093cdecb18f1c8c312157b7d030b03b", "score": "0.5104323", "text": "func EventName(val string) attribute.KeyValue {\n\treturn EventNameKey.String(val)\n}", "title": "" }, { "docid": "6b1e1f08d181ff2b7bb278f2610e01bb", "score": "0.5097104", "text": "func (c *Context) Key(key string, defaults ...interface{}) interface{} {\n\tif value, ok := c.Get(key); ok {\n\t\treturn value\n\t}\n\treturn IndexOf(defaults, 0, nil)\n}", "title": "" }, { "docid": "9f8b1b9496a5573e0ef3214cae952d95", "score": "0.50967884", "text": "func (o DbParameterGroupTagOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DbParameterGroupTag) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "165c934a46a72f9d901d039115b2017e", "score": "0.50927526", "text": "func (i SNSGetTopicAttribute) Key() string {\n\tif val, ok := _SNSGetTopicAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "f6ab4e08ae0b4f412814b7b7d5b57df7", "score": "0.50912935", "text": "func (o GoogleCloudIntegrationsV1alphaIntegrationParameterResponseOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudIntegrationsV1alphaIntegrationParameterResponse) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "52f9af2cf2e69d6458a22b5183507fb2", "score": "0.5088879", "text": "func (e *Event) EnumKey() string {\n\treturn \"events:enum:\" + e.Camera + \":\" + e.Number\n}", "title": "" }, { "docid": "d86f8d4a80b6066b8673a9e637865134", "score": "0.50865245", "text": "func (e Event) Get(key string) (interface{}, bool) {\n\tt := reflect.TypeOf(e)\n\tfor i := 0; i < t.NumField(); i++ {\n\t\t// Find a matching field by name, ignoring case\n\t\tif strings.EqualFold(t.Field(i).Name, key) {\n\t\t\t// return the value of that field\n\t\t\treturn reflect.ValueOf(e).Field(i).Interface(), true\n\t\t}\n\t}\n\n\tv, ok := e.extension[strings.ToLower(key)]\n\treturn v, ok\n}", "title": "" }, { "docid": "74ed6f43d7edc55c81e040f54113233b", "score": "0.50857097", "text": "func (r Robot) GetParameter(key string) string {\n\tvalue, ok := r.environment[key]\n\tif ok {\n\t\treturn value\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c3005ff28a59e3d1278788e32d95b432", "score": "0.50802743", "text": "func (req GetRequest) Key(key Tuple) GetRequest {\n\treq.key = key\n\treturn req\n}", "title": "" }, { "docid": "4363959d42a33fbb7176ecc37afbe952", "score": "0.5080009", "text": "func Parameter(key, value string) error {\n\tf, ok := valid[key]\n\tif !ok {\n\t\treturn Error{Code: http.StatusBadRequest, Err: fmt.Errorf(\"no validator for %s\", key)}\n\t}\n\n\treturn f(value)\n}", "title": "" }, { "docid": "f4f0fe300b9e1eeb98cf5cb397ee37c5", "score": "0.5073793", "text": "func (e QuizAPIEventValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "ef6cdcae32ee170ef96e1248454fb6b2", "score": "0.5071087", "text": "func (mr *TopicMetadataRequest) Key() int16 {\n\treturn 3\n}", "title": "" }, { "docid": "51ea5ef920d77edbf864a73b20370149", "score": "0.50689125", "text": "func (o DbClusterParameterGroupTagOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DbClusterParameterGroupTag) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "001d453addcb3cf019a0a6d70f282270", "score": "0.5065254", "text": "func (e ApplicationSearchParamsValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "8726a1af9b2dad1c226f16b9b94492e2", "score": "0.506237", "text": "func (p Params) Get(key string) string {\n\tfor _, p := range p.params {\n\t\tif p.name == key {\n\t\t\treturn p.value\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "753afc9c8864a90f50f0c627c1bdf410", "score": "0.50617933", "text": "func (fr *FetchRequest) Key() int16 {\n\treturn 1\n}", "title": "" }, { "docid": "6f0ce729a088209ea64c0528b3eb1722", "score": "0.5058575", "text": "func (e *HTMLScript) Key(key interface{}) *HTMLScript {\n\te.key = F(key)\n\treturn e\n}", "title": "" }, { "docid": "ef91f2141a5d3fe3e423c8289829fc95", "score": "0.50541085", "text": "func (ent Entry) Key() string {\n return ent.Token\n}", "title": "" }, { "docid": "2a761587cb814864b31bc79e19ab8b60", "score": "0.5050749", "text": "func (ie InputEvent) KeyString() string {\n\treturn keyCodes[ie.Code]\n}", "title": "" }, { "docid": "c45bf530d997c9c671bdf84dd6ced509", "score": "0.5041926", "text": "func (key TaskCacheKey) Key() (string, error) {\n\tenvs, err := resolveStepsEnvironment(key.Task.Steps)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\traw, err := json.Marshal(struct {\n\t\t*Task\n\t\tEnvironments []map[string]string\n\t}{\n\t\tTask: key.Task,\n\t\tEnvironments: envs,\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\thash := sha256.Sum256(raw)\n\treturn base64.RawURLEncoding.EncodeToString(hash[:16]), nil\n}", "title": "" }, { "docid": "5fb726d016c2e4fbdfdd1e824d8b536a", "score": "0.5038226", "text": "func GetParam(ctx context.Context, name string) string {\r\n\tparams, _ := ctx.Value(ParamsKey).(params)\r\n\r\n\tfor i := range params {\r\n\t\tif params[i].key == name {\r\n\t\t\treturn params[i].value\r\n\t\t}\r\n\t}\r\n\r\n\treturn \"\"\r\n}", "title": "" }, { "docid": "653691dfcb80d1dafbb8ff58e42a1e4f", "score": "0.5038142", "text": "func (sh *ShellJob) Key() int {\n\treturn HashCode(sh.Description())\n}", "title": "" }, { "docid": "1040aebbe816215b3e3776370decd600", "score": "0.50344205", "text": "func (this *RangerAppFunctionDesc) Get_paramIndex() int64 {\n return this.paramIndex\n}", "title": "" }, { "docid": "9c9afe01ba86ca90f33993eea65a4951", "score": "0.5030643", "text": "func (e DynamicParameterConstraintsValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "33b6040e8417035041467ccfb2a94e44", "score": "0.502706", "text": "func ResolveParamValue(src *v1alpha1.TriggerParameterSource, events map[string]*v1alpha1.Event) (*string, string, error) {\n\tvar err error\n\tvar eventPayload []byte\n\tvar key string\n\tvar tmplt string\n\tvar resultValue string\n\n\tevent, eventExists := events[src.DependencyName]\n\tswitch {\n\tcase eventExists:\n\t\t// If no data or context selection was provided\n\t\tif src.ContextKey == \"\" && src.DataKey == \"\" && src.DataTemplate == \"\" && src.ContextTemplate == \"\" {\n\t\t\t// Return default value if exists\n\t\t\tif src.Value != nil {\n\t\t\t\tresultValue = *src.Value\n\t\t\t} else {\n\t\t\t\t// Default value doesn't exist so return the whole event payload\n\t\t\t\teventPayload, err = json.Marshal(&event)\n\t\t\t\tresultValue = string(eventPayload)\n\t\t\t}\n\n\t\t\tif err == nil {\n\t\t\t\treturn &resultValue, stringType, nil\n\t\t\t}\n\t\t}\n\n\t\t// Get the context part of the payload\n\t\tif src.ContextKey != \"\" || src.ContextTemplate != \"\" {\n\t\t\tkey = src.ContextKey\n\t\t\ttmplt = src.ContextTemplate\n\t\t\teventPayload, err = json.Marshal(&event.Context)\n\t\t}\n\n\t\t// Get the data part of the payload\n\t\tif src.DataKey != \"\" || src.DataTemplate != \"\" {\n\t\t\tkey = src.DataKey\n\t\t\ttmplt = src.DataTemplate\n\t\t\teventPayload, err = renderEventDataAsJSON(event)\n\t\t}\n\tcase src.Value != nil:\n\t\t// Use the default value set by the user in case the event is missing\n\t\tresultValue = *src.Value\n\t\treturn &resultValue, stringType, nil\n\tdefault:\n\t\t// The parameter doesn't have a default value and is referencing a dependency that is\n\t\t// missing in the received events. This is not an error and may happen with || conditions.\n\t\treturn nil, stringType, nil\n\t}\n\t// If the event payload parsing failed\n\tif err != nil {\n\t\t// Fall back to the default value in case it exists\n\t\tif src.Value != nil {\n\t\t\tfmt.Printf(\"failed to parse the event payload, using default value. err: %+v\\n\", err)\n\t\t\tresultValue = *src.Value\n\t\t\treturn &resultValue, stringType, nil\n\t\t}\n\t\t// Otherwise, return the error\n\t\treturn nil, \"\", err\n\t}\n\t// Get the value corresponding to specified key or template within event payload\n\tif eventPayload != nil {\n\t\tif tmplt != \"\" {\n\t\t\tresultValue, err = getValueWithTemplate(eventPayload, tmplt)\n\t\t\tif err == nil {\n\t\t\t\treturn &resultValue, stringType, nil\n\t\t\t}\n\t\t\tfmt.Printf(\"failed to execute the src event template, falling back to key or value. err: %+v\\n\", err)\n\t\t}\n\t\tif key != \"\" {\n\t\t\ttmp, typ, err := getValueByKey(eventPayload, key)\n\t\t\t// For block injection support\n\t\t\tresultValue = tmp\n\t\t\tif err == nil {\n\t\t\t\treturn &resultValue, typ, nil\n\t\t\t}\n\t\t\tfmt.Printf(\"failed to get value by key: %+v\\n\", err)\n\t\t}\n\t\t// In case neither key nor template resolving was successful, fall back to the default value if exists\n\t\tif src.Value != nil {\n\t\t\tresultValue = *src.Value\n\t\t\treturn &resultValue, stringType, nil\n\t\t}\n\t}\n\n\t// if we got here it means that both key and template did not match the event payload\n\t// and no default value was provided, so we need to return an error\n\treturn nil, \"\", fmt.Errorf(\"unable to resolve '%s' parameter value. err: %+v\", src.DependencyName, err)\n}", "title": "" }, { "docid": "79dca1a9abf78e2fdde86a37a77942bd", "score": "0.5026279", "text": "func (o EnvironmentVariableOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnvironmentVariable) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b28ffdaaa4dd0cff8e6c7ab9a55e1044", "score": "0.50241834", "text": "func (p Params) Get(key string) string {\n\treturn p[key]\n}", "title": "" }, { "docid": "06dd95a78d9abf701364bf12d49cf05d", "score": "0.50135213", "text": "func (spec *configSpec) ConfigKey() string {\n\treturn ModuleId\n}", "title": "" }, { "docid": "3e79672e482be8ab4459315aa986f9b0", "score": "0.50064987", "text": "func (o ClusterParameterGroupTagOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ClusterParameterGroupTag) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b57e641d02a7b1fe90c96cd7346766d0", "score": "0.50045764", "text": "func (a *Annotation) Key() string {\n\treturn a.IssueID\n}", "title": "" }, { "docid": "501b36adeef70eb740a8f34a08bc8b6c", "score": "0.500392", "text": "func (me *sift) Key() string {\n\treturn me.key\n}", "title": "" }, { "docid": "ffcb0eb8f81ecc4f37416f7f278e7c0b", "score": "0.49962607", "text": "func (c *ConcreteContext) Param(key string) string {\n\n\tparams, err := c.Params()\n\tif err != nil {\n\t\tc.Logf(\"Error parsing request %s\", err)\n\t\treturn \"\"\n\t}\n\n\treturn params.Get(key)\n}", "title": "" }, { "docid": "659d9e2f5f05e9c3ed2dd2df19de3780", "score": "0.49941802", "text": "func (o Enum) Key() string {\n\treturn enums[int(o)].Key\n}", "title": "" }, { "docid": "2c623b5f1f14c7d06287026eae35c620", "score": "0.49893203", "text": "func (e WatchBusinessRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "67dde4bde7565eb954a47754344f02f5", "score": "0.4986024", "text": "func (e GetTaskRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "581aa8d53ab521c7570e68ce2ed480ae", "score": "0.4977858", "text": "func (o GetPolicyDocumentRuleDeniedParameterOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPolicyDocumentRuleDeniedParameter) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "179d39bbb1cc3d9a0f8f0d9fd85259e5", "score": "0.49760327", "text": "func (this *RangerAppParamDesc) Get_paramIndex() int64 {\n return this.paramIndex\n}", "title": "" }, { "docid": "b392e0dd8f145d2d96841de050447e32", "score": "0.4963201", "text": "func (e ExternalIDPSearchRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "03ea772722f9905e8ed5d91830f8aee0", "score": "0.495938", "text": "func (e EventListener) Event(event *core.Event) {\n\tconfigValue := CONFIG.GetConfigurationByKey(event.Key)\n\tfor _, c := range ConfigChangeCallbacks {\n\t\tc.Callback(event.Key, configValue)\n\t\tfmt.Printf(\"config value %v | %v\", event.Key, configValue)\n\t}\n}", "title": "" }, { "docid": "c20cb20a78f0ad92e3e4069f8be602f7", "score": "0.49434498", "text": "func (s *LocalService) GetKey() string {\n\tserviceNameUnique := s.GetPrefix()\n\tserviceNameUnique += DefaultSeparator + s.Endpoints.String()\n\treturn serviceNameUnique\n}", "title": "" }, { "docid": "52f22d312349a765076b24d37d7604e9", "score": "0.49395525", "text": "func getKey(c *fiber.Ctx) string {\n\treturn stripQueryParam(c.OriginalURL(), \"refresh\")\n}", "title": "" }, { "docid": "c1cc988cdfab391a98b78b08094f81ce", "score": "0.49367785", "text": "func (e SingleTaskRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "47a62e3f176e327f6e5c10f85ccbc2f0", "score": "0.49355108", "text": "func (e *endpoint) Key() string {\n\treturn e.key\n}", "title": "" }, { "docid": "35cdf924edfe2800e91466de84e2b6d7", "score": "0.4931576", "text": "func (o EnterpriseCrmEventbusProtoPropertyEntryOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnterpriseCrmEventbusProtoPropertyEntry) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
56a260877716f929721bd880e93fd2ff
Play plays the loaded music loop times through from start to finish. The previous music will be halted, or if fading out it waits (blocking) for that to finish. (
[ { "docid": "4ab4ef745b593693090209411ec20475", "score": "0.6725898", "text": "func (music *Music) Play(loops int) error {\n\t_music := (*C.Mix_Music)(unsafe.Pointer(music))\n\t_loops := (C.int)(loops)\n\tif C.Mix_PlayMusic(_music, _loops) == -1 {\n\t\treturn sdl.GetError()\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "6950b2a58fb97a7505939c3a1348fc9d", "score": "0.67209774", "text": "func PlaySong3() {\n\tBeep(784, 100)\n\tBeep(784, 100)\n\tBeep(784, 100)\n\ttime.Sleep(time.Millisecond * 100)\n\tBeep(784, 600)\n\tBeep(622, 600)\n\tBeep(698, 600)\n\tBeep(784, 200)\n\ttime.Sleep(time.Millisecond * 200)\n\tBeep(698, 200)\n\tBeep(784, 800)\n\n}", "title": "" }, { "docid": "c4be7ee88b42816896c7f7a1c47ec99b", "score": "0.6695206", "text": "func Play() {\n\tplaying = true\n\tPlayLoop()\n}", "title": "" }, { "docid": "80cb5a0c036ca2047200af80954f11c1", "score": "0.6470044", "text": "func PlayLoop() {\n\tif playing {\n\t\tboard.Step()\n\t\tjs.Global.Call(\"setTimeout\", PlayLoop, 5)\n\t}\n}", "title": "" }, { "docid": "7712d7f09fdbac90542a47bfdd388c85", "score": "0.64014876", "text": "func PlaySong1() {\n\tBeep(349, 400)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(392, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(440, 267)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(440, 267)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(392, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(349, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(392, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(440, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(349, 267)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(262, 267)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(349, 400)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(392, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(440, 267)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(440, 267)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(392, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(349, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(392, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(440, 133)\n\ttime.Sleep(time.Millisecond * 33)\n\tBeep(349, 533)\n\ttime.Sleep(time.Millisecond * 33)\n}", "title": "" }, { "docid": "f41a845816df93e1bd8ac352a27e89b1", "score": "0.62106997", "text": "func (chunk *Chunk) Play(channel, loops int) (channel_ int, err error) {\n\t_channel := (C.int)(channel)\n\t_chunk := (*C.Mix_Chunk)(unsafe.Pointer(chunk))\n\t_loops := (C.int)(loops)\n\tchannel_ = int(C.Mix_PlayChannelTimed(_channel, _chunk, _loops, -1))\n\tif channel_ == -1 {\n\t\terr = sdl.GetError()\n\t}\n\treturn\n}", "title": "" }, { "docid": "fa4478ee5ea54d448bc5b152c662c613", "score": "0.6070597", "text": "func (cd * CD) Play(start, length int) {\n if cd.cd != nil {\n CDPlay(cd.cd, start, length)\n }\n}", "title": "" }, { "docid": "155298300fc2a98d9ae2ca69dbd5c7c7", "score": "0.59939426", "text": "func play() {\n\tswitch state {\n\tcase statePause:\n\t\tif curCmd != nil {\n\t\t\tcurCmd.Process.Signal(syscall.SIGCONT)\n\t\t\tstate = statePlay\n\t\t}\n\tcase stateStop:\n\t\tif curElem == nil {\n\t\t\tcurElem = queue.Front()\n\t\t}\n\t\tif curElem != nil {\n\t\t\targ := curElem.Value.(string)\n\t\t\tcmd := []string{\"/bin/sh\", \"-c\"}\n\t\t\tfor _, assoc := range assocs {\n\t\t\t\tif assoc.Regexp.MatchString(arg) {\n\t\t\t\t\tcmd = assoc.Cmd\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurCmd = exec.Command(cmd[0], append(cmd[1:], arg)...)\n\t\t\tcurCmd.Start()\n\t\t\tstate = statePlay\n\t\t\tgo waitCmd(curCmd)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "578b99ac518159c1672b8e985fb57052", "score": "0.5890708", "text": "func (b BlyncLight) Play(mp3 byte, id int) {\n\tb.bytes[5] = mp3\n\tb.sendFeatureReport(id)\n}", "title": "" }, { "docid": "eb7be6322416ff2c3cef12c31416493e", "score": "0.5889543", "text": "func (queue *SongQueue) Start(sess *Session, callback func(string)) {\n\tqueue.Running = true\n\tfor queue.HasNext() && queue.Running {\n\t\tsong := queue.Next()\n\t\tcallback(song.Title)\n\t\tsess.PlayYoutube(song)\n\t}\n\tif !queue.Running {\n\t\tcallback(\"stop\")\n\t} else {\n\t\tcallback(\"finish\")\n\t}\n}", "title": "" }, { "docid": "2e11703bc54edd6fafc6467149d8758a", "score": "0.57939696", "text": "func PlayAsync(path string) {\n\tc1 := exec.Command(\"aplay\", path)\n\t_ = c1.Start()\n}", "title": "" }, { "docid": "59c2fd50f80697febc595c4b346837c7", "score": "0.5789413", "text": "func (sF *SongFile) play() (shouldExit bool) {\n\tplayMu.Lock()\n\n\tfmt.Println(\"initializing song file\")\n\n\ts := sF.initFile()\n\n\t//Signal to the ui what's playing. Perhaps an atomic.Value would be better?\n\tsF.playingSong = PlayingSong{\n\t\tCurrentSong: path.Base(sF.FileName),\n\t\tSongLength: sF.PlayTime,\n\t\tSongScore: sF.Score,\n\t}\n\n\tfmt.Println(\"sending song to client: \" + sF.playingSong.CurrentSong)\n\n\tSongState <- sF.playingSong\n\n\tfmt.Println(\"song file initialized, initializing player\")\n\n\tvar skipped atomic.Value\n\tskipped.Store(false)\n\n\t//So we can pause songs\n\tctrl := &beep.Ctrl{\n\t\tPaused: false,\n\t\tStreamer: beep.Seq(s, beep.Callback(func() {\n\t\t\twasSkipped := skipped.Load().(bool)\n\t\t\tif wasSkipped {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tPlayerSignal <- SignalSongComplete\n\t\t})),\n\t}\n\n\t//fmt.Println(\"initiating play for song: \" + sF.FileName)\n\n\ttimePaused.Store(time.Time{})\n\t//So we know when the song started.\n\tplayStart.Store(time.Now())\n\n\tspeaker.Play(ctrl)\n\n\tvar plyrSig int64\n\ttkr := time.NewTicker(75 * time.Millisecond)\n\n\tfor {\n\t\tselect {\n\t\tcase <-tkr.C:\n\t\t\tsF.playingSong.SongTime = format.SampleRate.D(s.Position())\n\t\t\tSongState <- sF.playingSong\n\t\tcase plyrSig = <-PlayerSignal:\n\t\t\t//Signal the exit here, which will cause the done func up above to trigger and send\n\t\t\t//the signalComplete signal. Hopefully, out of order event reception doesn't happen super often\n\t\t\tswitch plyrSig {\n\t\t\tcase SignalSkip:\n\t\t\t\tspeaker.Clear()\n\t\t\t\tgoto closeShop\n\t\t\tcase SignalExit:\n\t\t\t\tshouldExit = true\n\t\t\t\tskipped.Store(false)\n\t\t\tcase SignalPause, SignalPlay:\n\t\t\t\tsF.togglePause(ctrl)\n\t\t\tcase SignalSongComplete:\n\t\t\t\tgoto closeShop\n\t\t\t}\n\t\t\tplyrSig = 0\n\t\t}\n\t}\n\ncloseShop:\n\ttkr.Stop()\n\tplayMu.Unlock()\n\tskpd := plyrSig == SignalSkip\n\tskipped.Store(skpd)\n\tsF.onFinish(ctrl, skpd)\n\treturn\n}", "title": "" }, { "docid": "57eee1e2387e99222e5b66e9632f891e", "score": "0.5738373", "text": "func PauseMusic() {\n\tC.Mix_PauseMusic()\n}", "title": "" }, { "docid": "c06879b00718c9701e2af08da2dbebea", "score": "0.57169086", "text": "func (s *Sound) Play(vc *discordgo.VoiceConnection) {\n\tvc.Speaking(true)\n\tdefer vc.Speaking(false)\n\n\tfor _, buff := range s.buffer {\n\t\tvc.OpusSend <- buff\n\t}\n}", "title": "" }, { "docid": "dc785ed5c7126bd14b53ba8f7a507be7", "score": "0.57127255", "text": "func (t *Track) Play() error {\n\tif _, err := t.obj.CallMethod(\"Play\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ccde348e288128e1f2cca5e286f81dd", "score": "0.571036", "text": "func (s *Sound) Play() {\n\tC.alSourcePlay(s.source)\n}", "title": "" }, { "docid": "91068de35284ee1ca581193073f29318", "score": "0.56829315", "text": "func (chunk *Chunk) PlayTimed(channel, loops, ticks int) (channel_ int, err error) {\n\t_channel := (C.int)(channel)\n\t_chunk := (*C.Mix_Chunk)(unsafe.Pointer(chunk))\n\t_loops := (C.int)(loops)\n\t_ticks := (C.int)(ticks)\n\tchannel_ = int(C.Mix_PlayChannelTimed(_channel, _chunk, _loops, _ticks))\n\tif channel_ == -1 {\n\t\terr = sdl.GetError()\n\t}\n\treturn\n}", "title": "" }, { "docid": "34a806dd6700a110d03294c4439b75ea", "score": "0.56738913", "text": "func (s *SoundStream) Play() {\n\tif s.source == 0 {\n\t\tpanic(\"SoundStream: call of nil object on Play()\")\n\t}\n\n\ts.lock.Lock()\n\tstreaming := s.streaming\n\tstate := s.state\n\ts.lock.Unlock()\n\n\tif streaming {\n\t\tif state == Paused {\n\t\t\ts.lock.Lock()\n\t\t\ts.state = Playing\n\t\t\ts.lock.Unlock()\n\t\t\tC.alSourcePlay(s.source)\n\t\t\treturn\n\t\t} else if state == Playing {\n\t\t\t// stop the stream and start it again\n\t\t\ts.Stop()\n\t\t}\n\t}\n\n\ts.streaming = true\n\ts.state = Playing\n\tgo s.streamData()\n}", "title": "" }, { "docid": "3bd42a89230f92622b84e815869c797f", "score": "0.563745", "text": "func fetchAndCacheAndPlayMP3(v *discordgo.VoiceConnection, text string) {\n\tstop := make(chan bool)\n\tfilename := \"cache/\" + text + \".mp3\"\n\tlib.GetMP3ForText(text)\n\tlib.PlayAudioFile(v, filename, stop)\n}", "title": "" }, { "docid": "d5bf4a8e20d2ba24e7f326201b032dee", "score": "0.56102246", "text": "func Play(filename string) {\n\tif !speakerRunning {\n\t\tcatlog.Debug(\"Not playing file, speaker not initialised\")\n\t\treturn\n\t}\n\n\tcatlog.Debugf(\"Attempting to play %s\", filename)\n\n\t// Check if audio file exists\n\tif aud, ok := allAudioFiles[filename]; ok {\n\t\t// If it does, play then return\n\t\taud.play()\n\t\treturn\n\t}\n\n\tcatlog.Info(\"Could not find %s while trying to play audio, will not play\", filename)\n}", "title": "" }, { "docid": "16e56267e0e790dc5278e685974ad71e", "score": "0.560462", "text": "func (ap *AudioPlayer) Play(buffer []byte, doneCh chan bool) {\n\tap.ap.play(buffer, doneCh)\n}", "title": "" }, { "docid": "23470c2bec8613d5fd6d06cc751d6b7b", "score": "0.5567147", "text": "func (w *WavReader) Start() error {\n\n\tw.Lock()\n\tdefer w.Unlock()\n\n\tif w.isPlaying {\n\t\treturn nil\n\t}\n\n\tw.stopPlayCh = make(chan struct{})\n\n\tgo w.play(w.buffer, w.stopPlayCh, w.cb)\n\tw.isPlaying = true\n\n\treturn nil\n}", "title": "" }, { "docid": "efe0be0628b096a8717dea39d857bbba", "score": "0.55622566", "text": "func StartPlayer(song string) *beep.Buffer {\n\tf, err := os.Open(song)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tstreamer, format, err := mp3.Decode(f)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tbuffer := beep.NewBuffer(format)\n\tbuffer.Append(streamer)\n\tstreamer.Close()\n\n\tspeaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))\n\tdefer streamer.Close()\n\n\treturn buffer\n}", "title": "" }, { "docid": "69c25d3b644cb4ec26138bb4b68ff0a6", "score": "0.5550277", "text": "func (music *Music) FadeIn(loops, ms int) error {\n\t_music := (*C.Mix_Music)(unsafe.Pointer(music))\n\t_loops := (C.int)(loops)\n\t_ms := (C.int)(ms)\n\tif C.Mix_FadeInMusic(_music, _loops, _ms) == -1 {\n\t\treturn sdl.GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd10f5f66eed58350e1893a01e7efe32", "score": "0.5542609", "text": "func Play(text, lang, voiceToken, guildID string) error {\n\tconn, ok := voiceConnection(guildID)\n\tif !ok {\n\t\treturn fmt.Errorf(\"voice channel on guild %s is deleted. maybe zombie worker\", guildID)\n\t}\n\n\toggBuf, err := tts.OGGGoogle(text, lang, voiceToken)\n\tif err != nil {\n\t\tlog.Printf(\"failed to create tts audio: %s\", err.Error())\n\t\treturn nil\n\t}\n\tif err := conn.Speaking(true); err != nil {\n\t}\n\tfor _, buff := range oggBuf {\n\t\tconn.OpusSend <- buff\n\t}\n\tif err := conn.Speaking(false); err != nil {\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e38fc0b7882b864c29a5673e9f796f4", "score": "0.5492482", "text": "func playGauge(ctx context.Context, g *gauge.Gauge, step int, delay time.Duration, pt playType) {\n\tprogress := 0\n\tmult := 1\n\n\tticker := time.NewTicker(delay)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tswitch pt {\n\t\t\tcase playTypePercent:\n\t\t\t\tif err := g.Percent(progress); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\tcase playTypeAbsolute:\n\t\t\t\tif err := g.Absolute(progress, 100); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprogress += step * mult\n\t\t\tif progress > 100 || 100-progress < step {\n\t\t\t\tprogress = 100\n\t\t\t} else if progress < 0 || progress < step {\n\t\t\t\tprogress = 0\n\t\t\t}\n\n\t\t\tif progress == 100 {\n\t\t\t\tmult = -1\n\t\t\t} else if progress == 0 {\n\t\t\t\tmult = 1\n\t\t\t}\n\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bfd361f54f0089fcdb15b25d1a93545a", "score": "0.54835314", "text": "func (p *Player) Start() {\n\tp.after, p.Music = gedditGet(p.getRedditURL())\n\tFireFinishedRedditDownload(*p)\n\n\tgo playerStartDownloads(p)\n\tsleep(waitBeforeStartingPlayback)\n\tgo playerStartPlayback(p)\n}", "title": "" }, { "docid": "3dfc7936c761547ca5c3069ad3d21b2f", "score": "0.5475594", "text": "func (g *game) Start(done chan *ball) {\n\tfor _, p := range g.Players {\n\t\tgo p.Play(g.Table(), done) // HL3\n\t}\n}", "title": "" }, { "docid": "1e4d69179d3496127f54750348764d96", "score": "0.54733956", "text": "func Play(path string) {\n\tc1 := exec.Command(\"aplay\", path)\n\t_ = c1.Run()\n}", "title": "" }, { "docid": "5135cd1e032f08b13fd6088644c2ca87", "score": "0.5458071", "text": "func (l *Loading) Run() {\n\tfor {\n\t\tl.sprite.Advance()\n\t\ttime.Sleep(time.Duration(100) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "76561833b1f409cee91a4aa87fd44c63", "score": "0.5452851", "text": "func (ply *Player) Play() (err error) {\n\tif ply.track == nil {\n\t\treturn errors.New(\"undefined track, call SetTrack() first\")\n\t}\n\ttrackUrl := ply.track.GetURL()\n\terr = ply.vlc.PlayURL(trackUrl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch {\n\tcase ply.status == conply.StatusPause:\n\t\tply.verbose.Debug3(\"Instantly pause new track since current status is Pause\")\n\t\treturn ply.vlc.Pause()\n\tcase ply.status == conply.StatusStop:\n\t\tply.verbose.Debug3(\"Instantly stop new track since current status is Pause\")\n\t\treturn ply.vlc.Stop()\n\tdefault:\n\t\tply.verbose.Debug3(\"Track URL: \", trackUrl)\n\t\tply.status = conply.StatusPlay\n\t}\n\treturn\n}", "title": "" }, { "docid": "4f1afabe33c1e5627114795eb690d863", "score": "0.5432457", "text": "func ResumeMusic() {\n\tC.Mix_ResumeMusic()\n}", "title": "" }, { "docid": "1cca37f29ec95044272d4ecbff4a0513", "score": "0.54185766", "text": "func (s *Stream) Play() error {\n\ts.stateChange.Lock()\n\tdefer s.stateChange.Unlock()\n\tif s.IsPaused() {\n\t\tgo s.sourceRoutine()\n\t\treturn nil\n\t}\n\tif s.IsActive() {\n\t\treturn errors.New(\"stream is already active\")\n\t}\n\tif s.Source == nil {\n\t\treturn errors.New(\"nil source\")\n\t}\n\targs := s.Source.arguments()\n\tif s.Offset > 0 {\n\t\targs = append([]string{\"-ss\", strconv.FormatFloat(s.Offset.Seconds(), 'f', -1, 64)}, args...)\n\t}\n\targs = append(args, \"-ac\", strconv.Itoa(gumble.AudioChannels), \"-ar\", strconv.Itoa(gumble.AudioSampleRate), \"-f\", \"s16le\", \"-\")\n\tcmd := exec.Command(s.Command, args...)\n\tif pipe, err := cmd.StdoutPipe(); err != nil {\n\t\treturn err\n\t} else {\n\t\ts.pipe = pipe\n\t}\n\tif err := s.Source.start(cmd); err != nil {\n\t\treturn err\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\ts.Source.done()\n\t\treturn err\n\t}\n\ts.stopWaitGroup.Add(1)\n\ts.cmd = cmd\n\ts.Elapsed = 0\n\tgo s.sourceRoutine()\n\treturn nil\n}", "title": "" }, { "docid": "42e4586567ac6759d5d6995fca5ea859", "score": "0.5413672", "text": "func (self *Text) Play3O(name string, frameRate int, loop bool, killOnComplete bool) *Animation{\n return &Animation{self.Object.Call(\"play\", name, frameRate, loop, killOnComplete)}\n}", "title": "" }, { "docid": "b85331c4ae9935f2c8dd61ab95797007", "score": "0.53352886", "text": "func (s *Sequencer) Start() {\n\tgo func() {\n\t\tppqnCount := 0\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-s.Timer.Pulses:\n\t\t\t\tppqnCount++\n\n\t\t\t\t// TODO add in time signatures\n\t\t\t\tif ppqnCount%(int(Ppqn)/4) == 0 {\n\t\t\t\t\tindex := (s.Bar * 4) + s.Beat\n\t\t\t\t\tgo s.PlayTrigger(index)\n\n\t\t\t\t\ts.Beat++\n\t\t\t\t\ts.Beat = s.Beat % 4\n\t\t\t\t}\n\n\t\t\t\t// TODO Add in time signatures\n\t\t\t\tif ppqnCount%int(Ppqn) == 0 {\n\t\t\t\t\ts.Bar++\n\t\t\t\t\ts.Bar = s.Bar % 4\n\t\t\t\t}\n\n\t\t\t\t// 4 bars of quarter notes\n\t\t\t\tif ppqnCount == (int(Ppqn) * 4) {\n\t\t\t\t\tppqnCount = 0\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}()\n\n\ts.Timer.Start()\n\ts.Stream.Start()\n}", "title": "" }, { "docid": "67609945c7d0cbbe5d239f86d2986a12", "score": "0.5323586", "text": "func (song *Song) Load() {\n\tsong.loadChan <- true\n}", "title": "" }, { "docid": "bc0c4c366dbd34ae039927af73a6b61f", "score": "0.5307952", "text": "func (c *controller) Play(playURL string) error {\n\tmedia, err := c.client.Media(c.ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"fail to call cast.Client.Media()\")\n\t}\n\n\tmediaItem := controllers.MediaItem{\n\t\tContentId: playURL,\n\t\tStreamType: \"BUFFERED\",\n\t\tContentType: \"audio/mpeg\",\n\t}\n\tcustomData := map[string]interface{}{}\n\n\t_, err = media.LoadMedia(c.ctx, mediaItem, 0, true, customData)\n\treturn err\n}", "title": "" }, { "docid": "3ca2e8825929f6311265f8ae77d1e37b", "score": "0.525498", "text": "func playSound(s *discordgo.Session, guildID, channelID string) (err error) {\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\n\t// Send the buffer data.\n\tfor _, buff := range buffer {\n\t\tvc.OpusSend <- buff\n\t}\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specificed amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\treturn nil\n}", "title": "" }, { "docid": "e3558606142161d1bb869a4a58b31b21", "score": "0.51913863", "text": "func playSound(s *discordgo.Session, guildID, channelID string, buffer [][]byte) (err error) {\n\t// Join the provided channel\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sleep for a specified ammount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking\n\tvc.Speaking(true)\n\n\t// Send the buffer data\n\tfor _, buff := range buffer {\n\t\tvc.OpusSend <- buff\n\t}\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specified amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided channel.\n\tvc.Disconnect()\n\n\treturn nil\n}", "title": "" }, { "docid": "f4dd1fd88d176caa8e8d9f0b45d8d1f7", "score": "0.51859105", "text": "func playPing(pingChan chan<- bool, pongChan <-chan bool, wg *sync.WaitGroup) {\n\tfor {\n\t\twg.Add(1)\n\t\tdefer wg.Done()\n\n\t\ttime.Sleep(500 * time.Millisecond)\n\t\t// wait to read on pongChan\n\t\t<-pongChan\n\t\tfmt.Println(\"Ping\")\n\t\tpingChan <- true\n\t}\n}", "title": "" }, { "docid": "ca6a2ce5258afca247caf13670c43d36", "score": "0.5183696", "text": "func PlayingMusic() bool {\n\treturn int(C.Mix_PlayingMusic()) > 0\n}", "title": "" }, { "docid": "c45c4d10f8828244e9692bc3bc8fb71e", "score": "0.51730853", "text": "func PlayDirectory(directoryPath string, channelID string, loop bool, shuffle bool) {\n\tif !strings.HasPrefix(directoryPath, string(os.PathSeparator)) {\n\t\tdirectoryPath += string(os.PathSeparator)\n\t}\n\n\tdirectory, err := os.Open(directoryPath)\n\tif HandleError(err, false) {\n\t\tlog.Println(\"Failure opening directory.\")\n\t\treturn\n\t}\n\n\tfiles, err := directory.Readdirnames(math.MaxUint16)\n\tif HandleError(err, false) {\n\t\tlog.Println(\"Failure listing directory.\")\n\t\treturn\n\t}\n\n\tif shuffle {\n\t\trand.Shuffle(len(files), func(i, j int) { files[i], files[j] = files[j], files[i] })\n\t}\n\n\tfor _, audioFile := range files {\n\t\tRoutineReadAudio(directoryPath+audioFile, channelID)\n\t}\n\n\tif loop {\n\t\tPlayDirectory(directoryPath, channelID, loop, shuffle)\n\t}\n}", "title": "" }, { "docid": "5f332670517398bb41ad7756762fead9", "score": "0.5140343", "text": "func playSound(channel *discordgo.VoiceConnection, sound string) (err error) {\n\tbuffer, err := loadSound(sound)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tchannel.Speaking(true)\n\tfor _, buff := range buffer {\n\t\tchannel.OpusSend <- buff\n\t}\n\tchannel.Speaking(false)\n\treturn nil\n}", "title": "" }, { "docid": "a5e7cdef6d3d0d146faf4c13266156d2", "score": "0.5139348", "text": "func (p *Party) doPlayNextSong() error {\n\n\tnsid, err := p.doGetNextSongToPlay()\n\n\t// if nil then we couldn't pull a song out of a queue\n\t// close anything currently playing\n\tif err != nil {\n\n\t\t// TODO: may be out of songs, check to go to radio\n\t\tif !p.nowPlaying.CurrentlyHasSong() {\n\t\t\treturn fmt.Errorf(\"no songs to play, nothing to skip\")\n\t\t}\n\n\t\t// need to add current to previous\n\t\tp.previous.Push(p.nowPlaying.GetCurrentlyPlaying())\n\n\t\t// bad pop, but current song is still over, so we update\n\t\tp.nowPlaying.SetNonePlaying()\n\n\t\tp.setUpdated()\n\n\t\t// return error\n\t\treturn err\n\t}\n\n\t// go ahead and play the song now\n\tp.playSong(nsid)\n\n\treturn nil\n}", "title": "" }, { "docid": "0323259507c2a6c4f556c9805a775695", "score": "0.5130858", "text": "func (e Engine) LoadMusic(filename string) error {\n\treturn e.sm.LoadMusic(filename)\n}", "title": "" }, { "docid": "054eb674b70967595bf09f033027f02d", "score": "0.5127406", "text": "func (g *game) loop() {\n\tfor {\n\t\tselect {\n\t\tcase <-g.done: // HL3\n\t\t\tfor _, p := range g.Players {\n\t\t\t\tp.Done()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "945491f84cadd1904a8d77c1ed682d32", "score": "0.5114768", "text": "func Pause() {\n\tplaying = false\n}", "title": "" }, { "docid": "0bceb54ec604687ef9c37a2e89cd423e", "score": "0.51078254", "text": "func (s *SampleInstance) Play() error {\n\tif !bool(C.al_play_sample_instance((*C.ALLEGRO_SAMPLE_INSTANCE)(s))) {\n\t\treturn errors.New(\"failed to play sample instance\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6a15e863cfa165ad0a00488af84be87", "score": "0.5105861", "text": "func (m MultiTrack) Play(ctx Context, at time.Time) error {\n\t// because all tracks must be synchronized, we first stop the beatmaster\n\t// then schedule all tracks\n\t// then start the beatmaster again.\n\tctx.Control().Stop()\n\tfor _, each := range m.Tracks {\n\t\tif track, ok := each.Value().(*Track); ok {\n\t\t\tfor bar, seq := range track.Content {\n\t\t\t\tch := NewChannelSelector(seq, On(track.Channel))\n\t\t\t\tctx.Control().Plan(int64(bar-1), ch)\n\t\t\t}\n\t\t} else {\n\t\t\t// TODO\n\t\t\tnotify.NewErrorf(\"not a track:%v\", each)\n\t\t}\n\t}\n\tctx.Control().Start()\n\treturn nil\n}", "title": "" }, { "docid": "9bc19fd5b9815421eef9ae1cfc66c4bc", "score": "0.5102068", "text": "func playBeep(music *beep.Music, volume, duration, count int, freq float64) {\n\tbuf := buildABeep(volume, duration, count, freq)\n\tjustPlayBeep(music, buf)\n}", "title": "" }, { "docid": "4758ffb3403b997a065f77d752e3b471", "score": "0.5099804", "text": "func (j *Jammer) PlayFreq(freq float32, dur float64) {\n\tj.beeper.Beep(freq, int(dur*j.tempo))\n}", "title": "" }, { "docid": "3b4cfb4edb1d8f26700e2d16035484f8", "score": "0.50886846", "text": "func playMinigame() () {\n\tfor true {\n\t// 1. Simulate a 'Z' keypress.\n\tpressZ()\n\t// 2. Wait until we have a fish on the hook.\n\t// 3. Press 'Z' to start reeling in the fish.\n\tpressZ()\n\t// 4. Press the left and right keys to play the minigame.\n\t}\n}", "title": "" }, { "docid": "8f4dd95918462efac5fad8d38a50ac12", "score": "0.5059795", "text": "func (cowboyImpl *CowboyImpl) Play(piano saloon.Furnishing) bool {\n\treturn cowboyImpl.RunOnServer(\"play\", map[string]interface{}{\n\t\t\"piano\": piano,\n\t}).(bool)\n}", "title": "" }, { "docid": "e4dc0db52d44120320f8a0a053524b64", "score": "0.503494", "text": "func PlayTone(freq uint32, duration uint64) {\n\tutilities.WriteUIntValue(\"/sys/devices/platform/snd-legoev3\", \"tone\", uint64(freq))\n\ttime.Sleep(time.Duration(duration) * time.Millisecond)\n\tutilities.WriteUIntValue(\"/sys/devices/platform/snd-legoev3\", \"tone\", 0)\n}", "title": "" }, { "docid": "6a627d9cbbba59cb7f20afccae515acb", "score": "0.50275123", "text": "func QuickLoadWAV(mem []byte) (chunk *Chunk, err error) {\n\t_mem := (*C.Uint8)(&mem[0])\n\tchunk = (*Chunk)(unsafe.Pointer(C.Mix_QuickLoad_WAV(_mem)))\n\tif chunk == nil {\n\t\terr = sdl.GetError()\n\t}\n\treturn\n}", "title": "" }, { "docid": "2c9bd4a4861a7d345537e69307df1751", "score": "0.50166374", "text": "func LoadTestPageAndStartPlaying(ctx context.Context, cr *chrome.Chrome, url string) (*chrome.Conn, error) {\n\tconn, err := cr.NewConn(ctx, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := conn.Exec(ctx, \"audio.play()\"); err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\tif err := conn.WaitForExpr(ctx, \"audio.currentTime > 0\"); err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "9b9d2ce0330a594b477eca1fdeeb2eb4", "score": "0.5004668", "text": "func (c *MediaController) Play(timeout time.Duration) (*api.CastMessage, error) {\n\treturn c.sendCommand(commandMediaPlay, timeout)\n}", "title": "" }, { "docid": "0b12441c1263b74ab2246e2d8c74f811", "score": "0.49835646", "text": "func (queue *SongQueue) Pause() {\n\tqueue.Running = false\n}", "title": "" }, { "docid": "1630e2b8446529c6fc371ff32abbac9e", "score": "0.49607933", "text": "func playFramer(mode playMode, fps float64, seqLen int, w screen.Window, eventCh <-chan event) {\n\tplaying := true\n\tstart := time.Now()\n\tvar f int\n\tfor {\n\t\tselect {\n\t\tcase ev := <-eventCh:\n\t\t\tif playing {\n\t\t\t\tf += int(time.Since(start).Seconds() * fps)\n\t\t\t\tif f >= seqLen {\n\t\t\t\t\tf %= seqLen\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = time.Now()\n\n\t\t\tswitch ev {\n\t\t\tcase playPauseEvent:\n\t\t\t\tif playing {\n\t\t\t\t\tplaying = false\n\t\t\t\t} else {\n\t\t\t\t\tplaying = true\n\t\t\t\t}\n\t\t\tcase seekPrevEvent:\n\t\t\t\tf -= int(fps) // TODO: rounding for non-integer fps\n\t\t\t\tif f < 0 {\n\t\t\t\t\tf = 0\n\t\t\t\t}\n\t\t\tcase seekNextEvent:\n\t\t\t\tf += int(fps) // TODO: rounding for non-integer fps\n\t\t\t\tif f >= seqLen {\n\t\t\t\t\tf = seqLen - 1\n\t\t\t\t}\n\t\t\tcase seekPrevFrameEvent:\n\t\t\t\t// when seeking frames, player should stop.\n\t\t\t\tplaying = false\n\t\t\t\tf -= 1\n\t\t\t\tif f < 0 {\n\t\t\t\t\tf = 0\n\t\t\t\t}\n\t\t\tcase seekNextFrameEvent:\n\t\t\t\t// when seeking frames, player should stop.\n\t\t\t\tplaying = false\n\t\t\t\tf += 1\n\t\t\t\tif f >= seqLen {\n\t\t\t\t\tf = seqLen - 1\n\t\t\t\t}\n\t\t\tcase playRealTimeEvent:\n\t\t\t\tmode = playRealTime\n\t\t\tcase playEveryFrameEvent:\n\t\t\t\tmode = playEveryFrame\n\t\t\t}\n\t\tcase <-time.After(time.Second / time.Duration(fps)):\n\t\t\tif !playing {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tvar tf int\n\t\tif mode == playRealTime {\n\t\t\ttf = f + int(time.Since(start).Seconds()*fps)\n\t\t\tif tf >= seqLen {\n\t\t\t\ttf %= seqLen\n\t\t\t}\n\t\t} else {\n\t\t\tf++\n\t\t\tif f >= seqLen {\n\t\t\t\tf %= seqLen\n\t\t\t}\n\t\t\ttf = f\n\t\t\tstart = time.Now()\n\t\t}\n\t\tw.Send(frameEvent(tf))\n\t}\n}", "title": "" }, { "docid": "a2b9b023579a5a40dc66de7573c90f1f", "score": "0.49566787", "text": "func (e *Engine) LoadMusic(filename string) (Track, error) {\n\tmus, err := mix.LoadMUS(filename)\n\treturn Track{\n\t\tisMusic: true,\n\t\tmus: mus,\n\t}, err\n}", "title": "" }, { "docid": "786cf0edf3c3d74d8c91876399957dcf", "score": "0.4920629", "text": "func (b *Bot) PlaySound(gid, voiceChanID, textChanID string, vi VoiceItem) {\n\tb.voiceMu.Lock()\n\tdefer b.voiceMu.Unlock()\n\n\tvh, ok := b.voiceHandlers[gid]\n\tif !ok {\n\t\tb.voiceHandlers[gid] = b.generator.voiceHandlerGenerator(b.sess, b, gid, voiceChanID, textChanID, vi)\n\t\treturn\n\t}\n\tvh.Play(vi)\n}", "title": "" }, { "docid": "1d1d7e8a7dcda9d05f988a95d8a04168", "score": "0.4917257", "text": "func PlayToneAndRest(freq uint32, duration uint64, rest uint64) {\n\tPlayTone(freq, duration)\n\ttime.Sleep(time.Duration(rest) * time.Millisecond)\n}", "title": "" }, { "docid": "6930598de5dcd55e1af19996ca138d43", "score": "0.49166313", "text": "func (y *YtWeb) Play() uiauto.Action {\n\treturn uiauto.IfSuccessThen(y.IsPaused(), uiauto.NamedCombine(\"play video\",\n\t\ty.ui.WithTimeout(longUITimeout).RetryUntil(y.kb.TypeAction(\"k\"), y.IsPlaying())))\n}", "title": "" }, { "docid": "e95b8fe3eada256d658d7f1228ee78b0", "score": "0.49014026", "text": "func (g *gallery) Play(ctx context.Context, media *apputil.Media) (retErr error) {\n\tfiles, err := filesapp.Launch(ctx, g.tconn)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer files.Close(ctx)\n\tdefer faillog.DumpUITreeWithScreenshotOnError(ctx, g.outDir, func() bool { return retErr != nil }, g.cr, \"ui_filesapp\")\n\n\tgallery := nodewith.NameStartingWith(apps.Gallery.Name).HasClass(\"BrowserFrame\")\n\treturn uiauto.Combine(\"play from files app\",\n\t\tfiles.OpenDownloads(),\n\t\tfiles.OpenFile(media.Subtitle),\n\t\tuiauto.New(g.tconn).WaitUntilExists(gallery),\n\t)(ctx)\n}", "title": "" }, { "docid": "f2cf449a26802f221c1b2df968f30c6e", "score": "0.48930368", "text": "func (p *Party) PlayNow(uid UserUUID, sid SongUID) error {\n\tp.mux.Lock()\n\tdefer p.mux.Unlock()\n\n\tif can, err := p.canUserPerformAction(uid, UserCanPlaySongNextPermission); err != nil {\n\t\treturn err\n\t} else if !can {\n\t\treturn fmt.Errorf(\"user can't play-next\")\n\t}\n\n\t// try to remove from the queues\n\t// don't do anything on error case\n\tp.removeFromSuggestions(sid)\n\tp.playNext.Remove(sid)\n\n\t// play song now\n\tp.playSong(sid)\n\n\tp.setUpdated()\n\n\treturn nil\n}", "title": "" }, { "docid": "72090ac2ef1366f4338948599ac11489", "score": "0.486975", "text": "func (g *Game) Update() error {\n\tif debugMode {\n\t\tcursorPosition = getCursorPosition()\n\t}\n\n\tswitch {\n\tcase inpututil.IsKeyJustPressed(speedUpAnimKey):\n\t\tif tickPerFrame > 1 {\n\t\t\ttickPerFrame--\n\t\t}\n\tcase inpututil.IsKeyJustPressed(slowDownAnimKey):\n\t\tif tickPerFrame < 8 {\n\t\t\ttickPerFrame++\n\t\t}\n\tcase inpututil.IsKeyJustPressed(changeCharaKey):\n\t\tswitch currentChar {\n\t\tcase ameImage:\n\t\t\tcurrentChar = kfcImage\n\t\tcase kfcImage:\n\t\t\tcurrentChar = ameImage\n\t\t}\n\t//30 frames\n\tcase inpututil.KeyPressDuration(debugKey) == 30:\n\t\tdebugMode = !debugMode\n\t}\n\n\tif g.player != nil {\n\t\tg.count++\n\t\treturn nil\n\t}\n\tmp3S, err := mp3.Decode(audioContext, bytes.NewReader(backgroundMusic))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts := audio.NewInfiniteLoop(mp3S, 32*sampleRate)\n\n\tg.player, err = audio.NewPlayer(audioContext, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.player.Play()\n\tg.count++\n\treturn nil\n}", "title": "" }, { "docid": "6961fac679e5dd1a5f5e10aac45cea87", "score": "0.4869164", "text": "func (self *Text) Play(name string) *Animation{\n return &Animation{self.Object.Call(\"play\", name)}\n}", "title": "" }, { "docid": "8086ba2377d84582c6bd84f4ae3dead0", "score": "0.4862744", "text": "func (p *Party) playSong(nsid SongUID) {\n\t// get current song to add to back\n\tcsid := p.nowPlaying.GetCurrentlyPlaying()\n\n\thavePlaying := p.nowPlaying.CurrentlyHasSong()\n\n\t// now try to play the song\n\tp.nowPlaying.ChangeSong(nsid)\n\n\tif havePlaying {\n\t\tp.previous.Push(csid)\n\t}\n\n\t// finally update state\n\tp.setUpdated()\n}", "title": "" }, { "docid": "194fa40726513f45cd701eee9fb78123", "score": "0.48593038", "text": "func Start(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tlog.Printf(\"Start %s\", ps.ByName(\"name\"))\n\tfilename, _ := base64.URLEncoding.DecodeString(ps.ByName(\"name\"))\n\tstringFilename := string(filename[:])\n\tomxOptions := append(strings.Split(omx, \" \"), stringFilename)\n\n\terr := p.Start(omxOptions)\n\tif err != nil {\n\t\tp.Playing = false\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tlog.Printf(\"Playing media file: %s\\n\", stringFilename)\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "f49e3b63e66b17ef034ca6c29a52e82e", "score": "0.48563135", "text": "func PausedMusic() bool {\n\treturn int(C.Mix_PausedMusic()) > 0\n}", "title": "" }, { "docid": "aa6decdcf623e8550a5edf82776bb0f9", "score": "0.4854007", "text": "func (pb Playback) Next() bool {\n\ttime.Sleep(20 * time.Millisecond)\n\treturn true\n}", "title": "" }, { "docid": "9cab20bd2ba056ebbe6014198063254b", "score": "0.48514077", "text": "func (game *GuessingGame) Play(ch chan bool) {\n\tguessing_game := NewGuessingGame()\n\tguessing_game.play()\n\tch <- guessing_game.win\n}", "title": "" }, { "docid": "a975b86e778c7ccd83c0f5cfb2bb12e7", "score": "0.48471892", "text": "func AudioPlayString(number int32) string {\n\tconst _suffix = \"收听\"\n\treturn StatString(number, _suffix)\n}", "title": "" }, { "docid": "ae14b51de90a8172fc4dfdf9859233db", "score": "0.48374262", "text": "func (cd * CD) PlayTracks(start_track, start_frame, ntracks, nframes int) {\n if cd.cd == nil { return}\n CDPlayTracks(cd.cd, start_track, start_frame, ntracks, nframes)\n}", "title": "" }, { "docid": "d2565da9db5c1bcbdc34cddcdcd4dd75", "score": "0.4836008", "text": "func downloadAndPlay(s *discordgo.Session, guildID, channelID, link, user, txtChannel string, random bool) {\n\tgo sendAndDeleteEmbed(s, NewEmbed().SetTitle(s.State.User.Username).AddField(\"Enqueued\", link).SetColor(0x7289DA).MessageEmbed, txtChannel)\n\n\t//Check if the song is the db, to speedup things\n\tel := checkInDb(link)\n\tif el.title != \"\" {\n\t\tel.user = user\n\t\tqueue[guildID] = append(queue[guildID], el)\n\t\tgo playSound(s, guildID, channelID, el.id+\".dca\", txtChannel)\n\t\treturn\n\t}\n\n\t//Gets info about songs\n\tout, _ := exec.Command(\"youtube-dl\", \"--ignore-errors\", \"-q\", \"--no-warnings\", \"-j\", link).Output()\n\n\t//Parse output as string, splitting it on every newline\n\tstrOut := strings.Split(strings.TrimSuffix(string(out), \"\\n\"), \"\\n\")\n\n\tvar ytdl YoutubeDL\n\n\t//If we want to play the song in a random order, we just shuffle the slice\n\tif random {\n\t\tstrOut = shuffle(strOut)\n\t}\n\n\t//We parse every track as individual json, because youtube-dl\n\tfor _, singleJson := range strOut {\n\t\t_ = json.Unmarshal([]byte(singleJson), &ytdl)\n\t\tfileName := ytdl.ID + \"-\" + ytdl.Extractor\n\t\tel := Queue{ytdl.Title, formatDuration(ytdl.Duration), fileName, ytdl.WebpageURL, user, nil, 0, \"\", nil}\n\n\t\t//Checks if video is already downloaded\n\t\t_, err := os.Stat(\"./audio_cache/\" + fileName + \".dca\")\n\n\t\t//We add the song to the db, for faster parsing\n\t\taddToDb(el)\n\n\t\t//If we have a single song, we also add it with the given link\n\t\tif len(strOut) == 1 {\n\t\t\tel.link = link\n\t\t\taddToDb(el)\n\t\t}\n\n\t\t//If not, we download and convert it\n\t\tif err != nil {\n\t\t\t//Download\n\t\t\t_ = exec.Command(\"youtube-dl\", \"-o\", \"download/\"+fileName+\".m4a\", \"-x\", \"--audio-format\", \"m4a\", ytdl.WebpageURL).Run()\n\n\t\t\t//Conversion to DCA\n\t\t\tswitch runtime.GOOS {\n\t\t\tcase \"linux\":\n\t\t\t\t_ = exec.Command(\"bash\", \"gen.sh\", fileName, fileName+\".m4a\").Run()\n\t\t\t\tbreak\n\t\t\tcase \"windows\":\n\t\t\t\t_ = exec.Command(\"gen.bat\", fileName, fileName+\".m4a\").Run()\n\t\t\t}\n\n\t\t\terr = os.Remove(\"./download/\" + fileName + \".m4a\")\n\t\t}\n\n\t\tqueue[guildID] = append(queue[guildID], el)\n\t\tgo playSound(s, guildID, channelID, fileName+\".dca\", txtChannel)\n\n\t}\n\n}", "title": "" }, { "docid": "377e674b70c9abf34233fe8f839c78e1", "score": "0.48253763", "text": "func Play(bg *Game) {\n\t// Make sure we shuffle the deck before starting this Hand.\n\tbg.Deck.ShuffleRemaining()\n\n\tfor bg.ContinuePlaying {\n\t\t// If there's less than half the cards left in the Deck then reshuffle.\n\t\tif len(bg.Deck.Cards) < 26 {\n\t\t\tbg.Deck.ReShuffle()\n\t\t}\n\n\t\t// Deal the initial Hands to the Player and Dealer and send a message\n\t\t// to the channel so we update the UI.\n\t\terr := bg.deal()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tbg.PlayerTurn = true\n\t\thasUpdate <- true\n\n\t\t// Process the Player's turn.\n\t\tbg.PlayerTurn = <-playerHit\n\t\tfor bg.PlayerTurn {\n\t\t\tfmt.Fprintln(historyText, \"player hits on \", bg.Player.Total, \"\\n-\")\n\t\t\t// Deal a Card to the Player and update the UI.\n\t\t\tc, err := bg.Deck.DealOne()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\tbg.Player.addCard(*c)\n\t\t\thasUpdate <- true\n\n\t\t\t// If the Player busted then we can early exit and skip the Dealer loop.\n\t\t\tif bg.Player.Bust {\n\t\t\t\tfmt.Fprintln(historyText, \"player busts\\n-\")\n\t\t\t\tbg.PlayerTurn = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Wait here until we get a response from the Player.\n\t\t\tbg.PlayerTurn = <-playerHit\n\t\t}\n\n\t\t// If the Player busted then we don't need to process the Dealer's turn.\n\t\tif !bg.Player.Bust {\n\t\t\tfor bg.Dealer.Hand.Total < 17 {\n\t\t\t\tfmt.Fprintln(historyText, \"dealer hits on \", bg.Dealer.Total, \"\\n-\")\n\n\t\t\t\t// Deal a Card to the Dealer, update the UI and wait 3 seconds\n\t\t\t\t// before Dealer makes their next move.\n\t\t\t\tc, err := bg.Deck.DealOne()\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\t\t\t\tbg.Dealer.addCard(*c)\n\t\t\t\thasUpdate <- true\n\t\t\t}\n\t\t\tif bg.Dealer.Total > 21 {\n\t\t\t\tfmt.Fprintln(historyText, \"dealer busts\\n-\")\n\t\t\t}\n\t\t}\n\n\t\t// Set the HandComplete Field on the Game and send a message on the hasUpdate\n\t\t// channel so we can update the status box can update to let the Player\n\t\t// choose to play another hand or not.\n\t\tbg.HandComplete = true\n\t\thasUpdate <- true\n\n\t\t// Set the Game's ContinuePlaying field based on which button the Player\n\t\t// selected when asked to play another hand.\n\t\tbg.ContinuePlaying = <-continuePlaying\n\t}\n}", "title": "" }, { "docid": "a78c75f44749aa8db3cc5c6809f3a183", "score": "0.48196077", "text": "func (o *AudioOutput) PlayStrong() {\n\tif o.Stream == nil {\n\t\tpanic(errors.New(\"AudioOutput is not started yet or terminated\"))\n\t}\n\n\to.strong <- struct{}{}\n}", "title": "" }, { "docid": "35ba8f79f59142adbe633ba8dcb1783f", "score": "0.48192605", "text": "func HaltMusic() {\n\tC.Mix_HaltMusic()\n}", "title": "" }, { "docid": "b56c9148faf136011cdd051c67a19ddb", "score": "0.48157874", "text": "func (self *Text) Play1O(name string, frameRate int) *Animation{\n return &Animation{self.Object.Call(\"play\", name, frameRate)}\n}", "title": "" }, { "docid": "9e5bff12b57003a593fdc1ebe5dddca7", "score": "0.47996002", "text": "func PlaySound(soundfile string) {\n\n\tfmt.Printf(\"Playing %s\\n\", soundfile)\n\n\t// This is possiby the most horrific way to play a sound, but it works\n\t// cmd := exec.Command(\"/usr/local/bin/aplay\", soundfile)\n\tcmd := exec.Command(\"/usr/bin/mplayer\", \"-ao\", \"pulse\", soundfile)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Printf(\"%s\\n\", out)\n}", "title": "" }, { "docid": "97250547e884182d203a3eba09e2f1d4", "score": "0.47971076", "text": "func (g *game) run() {\n\tmetronome := time.NewTicker(metronomeFrequency)\n\tdefer metronome.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-metronome.C:\n\t\t\tg.step()\n\t\t\tg.broadcast()\n\t\t\tg.print()\n\t\tcase joinRequest := <-g.joinRequests:\n\t\t\tg.addPlayer(joinRequest.name)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8a283ed775cf0b540dbd69bddd42d8dd", "score": "0.47937164", "text": "func (self *Text) PlayI(args ...interface{}) *Animation{\n return &Animation{self.Object.Call(\"play\", args)}\n}", "title": "" }, { "docid": "6b63b33116b378e600423dda0b484a42", "score": "0.47928944", "text": "func Playpause() {\n\tscriptAsyncExec(\"playpause\")\n}", "title": "" }, { "docid": "6dbc23b3bfddd4439302b6969d1ad222", "score": "0.47928727", "text": "func PlaySound(b beep.Buffer) {\n\tsound := b.Streamer(0, b.Len())\n\tspeaker.Play(sound)\n}", "title": "" }, { "docid": "9242309d16afc842d59bd74e3a2c07d0", "score": "0.47813842", "text": "func (p player) Play(table chan *ball, done chan *ball) { // HL3\n\tfor {\n\t\ts := rand.NewSource(time.Now().UnixNano()) // OMIT\n\t\tr := rand.New(s) // OMIT\n\t\t//.....\n\t\tselect {\n\t\tcase ball := <-table:\n\t\t\tv := r.Intn(1001) // OMIT\n\t\t\tif v%11 == 0 {\n\t\t\t\tlog.Println(p.Name, \"drop the ball\") // OMIT\n\t\t\t\tdone <- ball\n\t\t\t\tcontinue //continue instead of return // HL3\n\t\t\t}\n\n\t\t\tball.hits++\n\t\t\tball.lastPlayer = p.Name\n\t\t\ttime.Sleep(50 * time.Millisecond)\n\t\t\tlog.Println(p.Name, \"hits ball\", ball.hits) // OMIT\n\t\t\ttable <- ball\n\t\tcase <-p.done: // receive from done channel // HL3\n\t\t\tlog.Println(p.Name, \"done with the game\") // OMIT\n\t\t\treturn // HL3\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cba335b8d74ecd5223e903c6cb054b38", "score": "0.47657222", "text": "func (ytm *ytMusic) Play(ctx context.Context, media *apputil.Media) error {\n\t// YouTube Music needs to play a video in this test case.\n\treturn ytm.PlayVideo(ctx, media)\n}", "title": "" }, { "docid": "9b6d907090bced7c441a976f31fd1f30", "score": "0.47629464", "text": "func (blueControl *BluesoundController) Play() (State BluesoundCommandState) {\n\treturn blueControl.sendCommandPlayPause(httpURIPlay)\n}", "title": "" }, { "docid": "0550f83ed09446ecb0bb7d2b958327a5", "score": "0.47614905", "text": "func (gop *GameOperator) Play() error {\n\tif gop.playing == true {\n\t\tlog.Printf(\"WARNING GameOperator: game %s already operated\\n\", gop.contractAddress)\n\t\treturn errors.New(\"GameOperator: game operated\")\n\t}\n\tgo gop.playGame()\n\tgop.playing = true\n\treturn nil\n}", "title": "" }, { "docid": "baabee8cf9d3d6edae9cad3baeddfa61", "score": "0.47451577", "text": "func (song *Song) WaitLoad() {\n\tsong.lock.Lock()\n\tisWaited := song.isWaited\n\tsong.lock.Unlock()\n\tif !isWaited {\n\t\t<-song.loadChan\n\t\tsong.lock.Lock()\n\t\tsong.isWaited = true\n\t\tsong.lock.Unlock()\n\t}\n}", "title": "" }, { "docid": "26a7b1bb68b953f8d01e13bfea8ed026", "score": "0.47444052", "text": "func (s *Sample) Play(gain, pan, speed float32, loop PlayMode) (*SampleID, error) {\n\tvar id SampleID\n\tok := bool(C.al_play_sample(\n\t\t(*C.ALLEGRO_SAMPLE)(s),\n\t\tC.float(gain),\n\t\tC.float(pan),\n\t\tC.float(speed),\n\t\tC.ALLEGRO_PLAYMODE(loop),\n\t\t(*C.ALLEGRO_SAMPLE_ID)(&id)))\n\tif !ok {\n\t\treturn nil, errors.New(\"failed to play sample\")\n\t}\n\treturn &id, nil\n}", "title": "" }, { "docid": "1708745c4f274200ae37edb340956051", "score": "0.47418106", "text": "func loadingAnimation(msg string, done chan struct{}) {\n\tfmt.Print(msg)\n\n\tfor {\n\t\tselect {\n\t\tcase <-done:\n\t\t\treturn\n\t\tcase <-time.Tick(time.Second):\n\t\t\tfmt.Print(\".\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "575018a78d3998919fff32a36d87fbc1", "score": "0.4741591", "text": "func (music *Music) FadeInPos(loops, ms int, position float64) error {\n\t_music := (*C.Mix_Music)(unsafe.Pointer(music))\n\t_loops := (C.int)(loops)\n\t_ms := (C.int)(ms)\n\t_position := (C.double)(position)\n\tif C.Mix_FadeInMusicPos(_music, _loops, _ms, _position) == -1 {\n\t\treturn sdl.GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a98f93f56d8f267680e8354c5ed9b64d", "score": "0.4735645", "text": "func GetPlaylist(c *http.Client, urlStr string, recTime time.Duration, useLocalTime bool, dlc chan *Download, wg *sync.WaitGroup) {\n\tstartTime := time.Now()\n\tvar recDuration time.Duration = 0\n\tcache, _ := lru.New(1024)\n\tplaylistURL, err := url.Parse(urlStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor {\n\t\treq, err := http.NewRequest(\"GET\", urlStr, nil)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tresp, err := c.Do(req)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\ttime.Sleep(time.Duration(3) * time.Second)\n\t\t}\n\t\tplaylist, listType, err := m3u8.DecodeFrom(resp.Body, true)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tresp.Body.Close()\n\t\tif listType == m3u8.MEDIA {\n\t\t\tmpl := playlist.(*m3u8.MediaPlaylist)\n\n\t\t\tfor segmentIndex, v := range mpl.Segments {\n\t\t\t\tif v != nil {\n\t\t\t\t\tvar msURI string\n\t\t\t\t\tif strings.HasPrefix(v.URI, \"http\") {\n\t\t\t\t\t\tmsURI, err = url.QueryUnescape(v.URI)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmsURL, err := playlistURL.Parse(v.URI)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Print(err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmsURI, err = url.QueryUnescape(msURL.String())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t_, hit := cache.Get(msURI)\n\t\t\t\t\tif !hit {\n\t\t\t\t\t\tcache.Add(msURI, nil)\n\t\t\t\t\t\tif useLocalTime {\n\t\t\t\t\t\t\trecDuration = time.Now().Sub(startTime)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trecDuration += time.Duration(int64(v.Duration * 1000000000))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdlc <- &Download{\n\t\t\t\t\t\t\tURI: msURI,\n\t\t\t\t\t\t\tExtXKey: mpl.Key,\n\t\t\t\t\t\t\tSeqNo: uint64(segmentIndex) + mpl.SeqNo,\n\t\t\t\t\t\t\ttotalDuration: recDuration,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif recTime != 0 && recDuration != 0 && recDuration >= recTime {\n\t\t\t\t\t\tclose(dlc)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif mpl.Closed {\n\t\t\t\tclose(dlc)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttime.Sleep(time.Duration(int64(mpl.TargetDuration * 1000000000)))\n\n\t\t} else {\n\t\t\tlog.Fatal(\"Not a valid media playlist\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7fe910d7062ba852e79695f85a3f4777", "score": "0.47240916", "text": "func Play(ctx context.Context, p ari.Player, opts ...OptionFunc) Session {\n\to, err := NewPlay(ctx, p, opts...)\n\tif err != nil {\n\t\treturn errorSession(err)\n\t}\n\n\treturn o.Play(ctx, p)\n}", "title": "" }, { "docid": "419b85e30f7ae9b852ce8a5320b0f34b", "score": "0.4722516", "text": "func (e *Engine) LoadSound(filename string) (Track, error) {\n\twav, err := mix.LoadWAV(filename)\n\treturn Track{\n\t\tisMusic: false,\n\t\twav: wav,\n\t\tchannel: -1,\n\t}, err\n}", "title": "" }, { "docid": "08ffc03a06562f1e18022cd836564155", "score": "0.4718615", "text": "func Play(timer *timer.Timer, pins []mcp23017.Pin, seq []sequence.Action, stop <-chan struct{}, done chan<- struct{}) {\n\tstart := time.Now()\n\tvar active mcp23017.Pins\nsequenceLoop:\n\tfor i, a := range seq {\n\t\tif dt := time.Until(start.Add(a.When)); dt > 0 {\n\t\t\tselect {\n\t\t\tcase <-timer.After(dt):\n\t\t\tcase <-stop:\n\t\t\t\t// We've been stopped; don't stop immediately but play out\n\t\t\t\t// all the disable events so that we end up with a clean\n\t\t\t\t// slate and we always activate solenoids for the correct time.\n\t\t\t\tfor _, a := range seq[i:] {\n\t\t\t\t\tif active == 0 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif !a.On {\n\t\t\t\t\t\tpins[a.Chan].Low()\n\t\t\t\t\t\tactive.Low(int(a.Chan))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak sequenceLoop\n\t\t\t}\n\t\t}\n\t\tprintln(\"channel \", a.Chan, a.On)\n\t\tpins[a.Chan].Set(a.On)\n\t\tactive.Set(int(a.Chan), a.On)\n\t}\n\tif done != nil {\n\t\tdone <- struct{}{}\n\t}\n}", "title": "" }, { "docid": "190f1d93fae4eed92428d8a67f343436", "score": "0.47091603", "text": "func Playing(channel int) int {\n\t_channel := (C.int)(channel)\n\treturn int(C.Mix_Playing(_channel))\n}", "title": "" }, { "docid": "baf5f42e6677a0d6c05af990553dcd04", "score": "0.47081423", "text": "func (self *Loader) Audio(key string, urls interface{}) *Loader{\n return &Loader{self.Object.Call(\"audio\", key, urls)}\n}", "title": "" }, { "docid": "888becb4ae1123ad1df6b883a5d6c60b", "score": "0.47051674", "text": "func (sounds *Sounds) Audio(key model.ResourceKey) (data audio.SoundData, err error) {\n\tinfo, known := knownSounds[key.Type]\n\tif known && (key.Index < info.limit) && key.HasValidLanguage() {\n\t\tstore := sounds.store(key)\n\t\tholder := store.Get(res.ResourceID(int(key.Type) + int(key.Index)))\n\n\t\tif (holder != nil) && (info.contentType == chunk.Media) {\n\t\t\tblockData := holder.BlockData(0)\n\t\t\tvar container movi.Container\n\t\t\tcontainer, err = movi.Read(bytes.NewReader(blockData))\n\n\t\t\tif err == nil {\n\t\t\t\tsamples := []byte{}\n\t\t\t\tfor index := 0; index < container.EntryCount(); index++ {\n\t\t\t\t\tentry := container.Entry(index)\n\t\t\t\t\tif entry.Type() == movi.Audio {\n\t\t\t\t\t\tsamples = append(samples, entry.Data()...)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdata = memAudio.NewL8SoundData(float32(container.AudioSampleRate()), samples)\n\t\t\t}\n\t\t}\n\t} else {\n\t\terr = fmt.Errorf(\"Unsupported resource key: %v\", key)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a1fe489cf50c0c44350de46a3adad6ae", "score": "0.4702316", "text": "func (o *Options) Play(ctx context.Context, p ari.Player) Session {\n\ts := newPlaySession(o)\n\n\tgo s.play(ctx, p)\n\n\treturn s\n}", "title": "" }, { "docid": "fb39ebbaa0cfa221b45cd658b6d7833e", "score": "0.47022313", "text": "func (s *Sound) Pause() {\n\tC.alSourcePause(s.source)\n}", "title": "" } ]
b31b15dc570f5e13d712816c2ed540ac
OnUpdate calls UpdateFunc if it's not nil.
[ { "docid": "4498afbaa1eca52377392d67c783c321", "score": "0.7319528", "text": "func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{}) {\n\tif r.UpdateFunc != nil {\n\t\tr.UpdateFunc(oldObj, newObj)\n\t}\n}", "title": "" } ]
[ { "docid": "66525cca9ad4601654273f585acb2a63", "score": "0.74649984", "text": "func (e *EventHandlerFuncs) OnUpdate(table string, old, new model.Model) {\n\tif e.UpdateFunc != nil {\n\t\te.UpdateFunc(table, old, new)\n\t}\n}", "title": "" }, { "docid": "4f83b147533a0bdcdba9358d51215005", "score": "0.7334461", "text": "func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{}) {\n\tif r.UpdateFunc != nil && r.ShouldProcess() {\n\t\tr.UpdateFunc(oldObj, newObj)\n\t}\n}", "title": "" }, { "docid": "d2e08a8e0e7c0663d88f670a7e3992be", "score": "0.7254423", "text": "func (r ResourceEventHandlerDetailedFuncs) OnUpdate(oldObj, newObj interface{}) {\n\tif r.UpdateFunc != nil {\n\t\tr.UpdateFunc(oldObj, newObj)\n\t}\n}", "title": "" }, { "docid": "543b8c3032b4829dd3077de288a2d708", "score": "0.71604526", "text": "func (r ResourceEventHandlerFuncs) OnUpdate(obj Resource) {\n\tif r.UpdateFunc != nil {\n\t\tr.UpdateFunc(obj)\n\t}\n}", "title": "" }, { "docid": "b5633d98df680778e91799e672c3ced0", "score": "0.7092383", "text": "func (r ResourceEventHandlerFuncs) OnUpdate(gvrk GroupVersionResourceKind, oldObj, newObj unstructured.Unstructured) {\n\tif r.UpdateFunc != nil {\n\t\tr.UpdateFunc(gvrk, oldObj, newObj)\n\t}\n}", "title": "" }, { "docid": "fdde094c172852e8f57f70071f90e301", "score": "0.70486414", "text": "func (b *BlockingEventHandler) OnUpdate(old, new interface{}) {\n\tif reflect.DeepEqual(old, new) {\n\t\treturn\n\t}\n\tb.WorkFunc(new)\n}", "title": "" }, { "docid": "ecd1ffad026bed8cd7e01e8044ef42ad", "score": "0.7014591", "text": "func (_m *Listener) OnUpdate(newObject interface{}, oldObject interface{}) {\n\t_m.Called(newObject, oldObject)\n}", "title": "" }, { "docid": "3ef6d1a34123c35ffe6de3c860d2ef02", "score": "0.6853529", "text": "func(g *Gogram) OnUpdate(ut types.UpdateType, handler Handler) {\n\tg.dispatcher.OnUpdate(ut, handler)\n}", "title": "" }, { "docid": "75253dcdab8e029e1d62ca75df1d6505", "score": "0.675212", "text": "func (wm *Manager) OnUpdate(oldObj, newObj interface{}) {\n\t// Send event to eventLoop() for processing\n\tselect {\n\tcase wm.events <- oldObj:\n\tcase <-wm.stopped:\n\t}\n\tselect {\n\tcase wm.events <- newObj:\n\tcase <-wm.stopped:\n\t}\n}", "title": "" }, { "docid": "9ec1f48115d6fa1cf82938eafdb0ec7f", "score": "0.6484481", "text": "func (q *QueuingEventHandler) OnUpdate(old, new interface{}) {\n\tif reflect.DeepEqual(old, new) {\n\t\treturn\n\t}\n\tq.Enqueue(new)\n}", "title": "" }, { "docid": "0c6bba9be12456912e0f72f3d3250fb8", "score": "0.6442755", "text": "func MethViewUpdateFunc(act *gi.Action) {\n\tmd := act.Data.(*MethViewData)\n\tif md.UpdateFunc != nil && md.Val != nil {\n\t\tmd.UpdateFunc(md.Val, act)\n\t}\n}", "title": "" }, { "docid": "329e0154aca0b631db8ba1ca750bec3c", "score": "0.6344868", "text": "func (e *Entity) OnUpdate(GM *GameManager) {\n\t// Update the timestamps\n\te.UpdatedAt = time.Now()\n}", "title": "" }, { "docid": "e8d86f16ade6cd7c3c7eac0f08e9ebc1", "score": "0.63378716", "text": "func (c *queuedEventHandler) OnUpdate(oldObj, newObj interface{}) {\n\tc.publishEvent(newObj)\n}", "title": "" }, { "docid": "3d0e6f0c8ae88f26a28cdc286d32527b", "score": "0.6334858", "text": "func (d *NodeDelegate) NotifyUpdate(n *memberlist.Node) {\n d.mu.Lock()\n defer d.mu.Unlock()\n if d.Enabled {\n d.UpdateFunc(n.Meta)\n }\n}", "title": "" }, { "docid": "7382dcf7295ad097bba446b95ed8eb5a", "score": "0.6311238", "text": "func (rot *Rotator) OnUpdate(xOffset float64, yOffset float64) error {\n\treturn nil\n}", "title": "" }, { "docid": "d4e176ca3e39e7a26ca3721a2f62a693", "score": "0.6264762", "text": "func (r FilteringResourceEventHandler) OnUpdate(obj Resource) {\n\tif !r.FilterFunc(obj) {\n\t\treturn\n\t}\n\tr.Handler.OnUpdate(obj)\n}", "title": "" }, { "docid": "3f93a719ba5a685ec96ed88794dcefad", "score": "0.6136486", "text": "func (r FilteringResourceEventHandler) OnUpdate(oldObj, newObj interface{}) {\n\tnewer := r.FilterFunc(newObj)\n\tolder := r.FilterFunc(oldObj)\n\tswitch {\n\tcase newer && older:\n\t\tr.Handler.OnUpdate(oldObj, newObj)\n\tcase newer && !older:\n\t\tr.Handler.OnAdd(newObj, false)\n\tcase !newer && older:\n\t\tr.Handler.OnDelete(oldObj)\n\tdefault:\n\t\t// do nothing\n\t}\n}", "title": "" }, { "docid": "31aa1a134ef200195846fd62de36d3e7", "score": "0.6131156", "text": "func (field Field) GetOnUpdate() interface{} {\n\tif caller, ok := field.OnUpdate.(ValueFunc); ok {\n\t\treturn caller()\n\t}\n\treturn field.OnUpdate\n}", "title": "" }, { "docid": "cedb8c0fed6131d3aad43dc27b10ecc2", "score": "0.612863", "text": "func (c *Conn) UpdateFunc(f UpdateFunc) (prev UpdateFunc) {\n\tidx := updateRegistry.register(f)\n\tprevIdx := c.updateIdx\n\tc.updateIdx = idx\n\tC.set_update_hook(c.db, unsafe.Pointer(&c.updateIdx), cBool(f != nil))\n\tprev, _ = updateRegistry.unregister(prevIdx).(UpdateFunc)\n\treturn\n}", "title": "" }, { "docid": "0bb754481d0edbbd0ff803848a416b73", "score": "0.6112916", "text": "func (fb *FirestoreFunctionBuilder) OnUpdate(fn FirestoreFunction) *FirestoreFunctionBuilder {\n\treturn fb.onOperation(FirestoreOnUpdate, fn)\n}", "title": "" }, { "docid": "74239e58f3ff1a0a9c870935d3f77c8e", "score": "0.6112009", "text": "func (h *Handler) OnUpdate(oldObj, newObj interface{}) {\n\t// Assert the type to an object to pull out relevant data.\n\tswitch obj := newObj.(type) {\n\tcase *corev1.Service:\n\t\tif h.ignored.IsIgnored(obj.ObjectMeta) {\n\t\t\treturn\n\t\t}\n\n\t\toldService := oldObj.(*corev1.Service)\n\t\tif _, err := h.updateMeshServiceFunc(oldService, obj); err != nil {\n\t\t\tlog.Errorf(\"Could not update mesh service: %v\", err)\n\t\t}\n\n\t\tlog.Debugf(\"MeshControllerHandler ObjectUpdated with type: *corev1.Service: %s/%s\", obj.Namespace, obj.Name)\n\tcase *corev1.Endpoints:\n\t\t// We can use the same ignore for services and endpoints.\n\t\tif h.ignored.IsIgnored(obj.ObjectMeta) {\n\t\t\treturn\n\t\t}\n\n\t\tlog.Debugf(\"MeshControllerHandler ObjectUpdated with type: *corev1.Endpoints: %s/%s\", obj.Namespace, obj.Name)\n\tcase *corev1.Pod:\n\t\tif !isMeshPod(obj) {\n\t\t\t// We don't track updates of user pods, updates are done through endpoints.\n\t\t\treturn\n\t\t}\n\n\t\tlog.Debugf(\"MeshControllerHandler ObjectUpdated with type: *corev1.Pod: %s/%s\", obj.Namespace, obj.Name)\n\t\t// Since this is a mesh pod update, trigger a force deploy.\n\t\th.configRefreshChan <- k8s.ConfigMessageChanForce\n\n\t\treturn\n\t}\n\n\t// Trigger a configuration rebuild.\n\th.configRefreshChan <- k8s.ConfigMessageChanRebuild\n}", "title": "" }, { "docid": "fe136dd0fb408592c52ca64f44737c44", "score": "0.6073664", "text": "func Update() {}", "title": "" }, { "docid": "1e63cc07fdb50c0fe791fc911427e98c", "score": "0.5999481", "text": "func (p *PodHandler) OnUpdate(oldObj, newObj interface{}) {\n\toldPod, ok1 := oldObj.(*v1.Pod)\n\tnewPod, ok2 := newObj.(*v1.Pod)\n\tif !ok1 || !ok2 {\n\t\tlog.Errorf(\"Expected Pod but OnUpdate handler received %+v %+v\", oldObj, newObj)\n\t\treturn\n\t}\n\tlogger := log.WithFields(p.podFields(newPod))\n\tlogger.Debug(\"Pod OnUpdate\")\n\n\tif p.shouldUpdate(oldPod, newPod) {\n\t\tlogger.Info(\"Updating pod due to added/updated annotation value or different pod IP\")\n\t\tp.mutex.Lock()\n\t\tdefer p.mutex.Unlock()\n\t\tp.OnDelete(oldPod)\n\t\tp.OnAdd(newPod)\n\t}\n}", "title": "" }, { "docid": "1fb437c05078b75915dd116950a89ebc", "score": "0.59786516", "text": "func (n *KongController) OnUpdate(state *parser.KongState) error {\n\tif n.cfg.InMemory {\n\t\treturn n.onUpdateInMemoryMode(state)\n\t}\n\treturn n.onUpdateDBMode(state)\n}", "title": "" }, { "docid": "2109067d487019557fa3671ae284958f", "score": "0.59763765", "text": "func (b *Base) Update() {\n\tb.Lock()\n\tdefer b.Unlock()\n\tif b.updateFunc == nil {\n\t\treturn\n\t}\n\tif b.paused {\n\t\tb.updateOnResume = true\n\t\treturn\n\t}\n\tgo b.updateFunc()\n}", "title": "" }, { "docid": "f9ec1ecc541cbf3a7ac0835188d8fc32", "score": "0.59223604", "text": "func (a *Autoscaler) OnUpdate(trainingjob *edlresource.TrainingJob) {\n\ta.eventCh <- event{Type: update, Job: trainingjob}\n}", "title": "" }, { "docid": "32054598545c5983ab241c14150d2bfe", "score": "0.58934003", "text": "func (g *Gauge) Update() {\n\tg.lock.Lock()\n\tdefer g.lock.Unlock()\n\tif g.function != nil {\n\t\tg.value = g.function()\n\t}\n}", "title": "" }, { "docid": "4945813cf838c78eb95ac055bcc81ced", "score": "0.58911324", "text": "func (s *SimpleKeyRotator) SetUpdateFunc(updateFunc func() error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.updateFunc = updateFunc\n}", "title": "" }, { "docid": "9c02da84460cc5f4f693842e13c6f71e", "score": "0.5811427", "text": "func (NilFGauge) Update(v float64) {}", "title": "" }, { "docid": "1d85716713c27e3ff022699f97c8c619", "score": "0.57830507", "text": "func (l *RawChain) OnUpdate(oldObj, newObj interface{}) {\n\tl.RLock()\n\tdefer l.RUnlock()\n\tfor _, s := range l.subs {\n\t\ts.OnUpdate(oldObj, newObj)\n\t}\n}", "title": "" }, { "docid": "d9b9b0f712494eb0897eb95ae27c78da", "score": "0.57645917", "text": "func (NilFRate) Update(float64) {}", "title": "" }, { "docid": "debd34ef5d628db66b6cefbb0736bde2", "score": "0.57617897", "text": "func (manager *Manager) Update(dt float64) {\n}", "title": "" }, { "docid": "012aac02d1dd96fc575cf0478f975e32", "score": "0.57270306", "text": "func (self *InputHandler) Update(pointer *Pointer) bool{\n return self.Object.Call(\"update\", pointer).Bool()\n}", "title": "" }, { "docid": "bddf0834a797a4eee2142900451056d3", "score": "0.5671717", "text": "func (_this *ApplicationCache) OnNoupdate() domcore.EventHandlerFunc {\n\tvar ret domcore.EventHandlerFunc\n\tvalue := _this.Value_JS.Get(\"onnoupdate\")\n\tif value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {\n\t\tret = domcore.EventHandlerFromJS(value)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "cd95c13110eaa008246d3870972155cd", "score": "0.564782", "text": "func update() {\n // to be implemented\n}", "title": "" }, { "docid": "02d2de61eaf34f62b2c9c8d530435e27", "score": "0.56170726", "text": "func (del *events) NotifyUpdate(nd *memberlist.Node) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "ce7e0529b70a596396e8cdeea51e4bd1", "score": "0.5615549", "text": "func (self *ComponentPhysicsBody) PreUpdate() {\n self.Object.Call(\"preUpdate\")\n}", "title": "" }, { "docid": "13ba19bafb82263d19081b2e8ebd4a5b", "score": "0.5597875", "text": "func (bw *BuildWatcher) UpdateFunc(oldobj, newobj interface{}) {\n\tbuild := newobj.(*kpack.Build)\n\n\tlog.Printf(\n\t\t`[UpdateFunc] Update to Build: %s\nstatus: %s\nsteps: %+v\n\n`, build.GetName(), spew.Sdump(build.Status.Status), build.Status.StepsCompleted)\n\n\tif bw.isBuildGUIDMissing(build) {\n\t\treturn\n\t}\n\n\tc := build.Status.GetCondition(\"Succeeded\")\n\tif c.IsTrue() {\n\t\tbw.handleSuccessfulBuild(build)\n\t} else if c.IsFalse() {\n\t\tbw.handleFailedBuild(build)\n\t} // c.isUnknown() is also available for pending builds\n}", "title": "" }, { "docid": "92ae6ace91a155727e70235a8c060b2d", "score": "0.5569815", "text": "func (pc *podPolicyController) OnPodUpdate(obj interface{}) {}", "title": "" }, { "docid": "0b53554b7565b94ee431d5e2cc95815e", "score": "0.5551257", "text": "func (mr *MockListenerMockRecorder) OnUpdate(keys, values, newKey interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnUpdate\", reflect.TypeOf((*MockListener)(nil).OnUpdate), keys, values, newKey)\n}", "title": "" }, { "docid": "d38f87e9b2b17808aaa170ae30e7104e", "score": "0.551989", "text": "func NewUpdateFunc(tp elastictransport.Interface) NewUpdate {\n\treturn func(index, id string) *Update {\n\t\tn := New(tp)\n\n\t\tn.Id(id)\n\n\t\tn.Index(index)\n\n\t\treturn n\n\t}\n}", "title": "" }, { "docid": "449d0f06b4cc2d8aab7b99a9d000438c", "score": "0.5512787", "text": "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\t// if _, ok := scope.Get(\"gorm:update_column\"); !ok {\n\t// \tscope.SetColumn(\"UpdatedAt\", time.Now().Unix())\n\t// }\n\tif !scope.HasError() {\n\t\tnowTime := strconv.FormatInt(time.Now().Unix(), 10)\n\t\tif UpdatedAtField, ok := scope.FieldByName(\"UpdatedAt\"); ok {\n\t\t\tif UpdatedAtField.IsBlank {\n\t\t\t\tUpdatedAtField.Set(nowTime)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14cce52a1234f31a65671dd6ab49c611", "score": "0.54509276", "text": "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\tif scope.HasError() {\n\t\treturn\n\t}\n\n\tif updatedAtField, ok := scope.FieldByName(\"UpdatedAt\"); ok {\n\t\tif updatedAtField.IsBlank {\n\t\t\tif err := updatedAtField.Set(gorm.NowFunc()); err != nil {\n\t\t\t\tpanic(\"could not set updated_at field: \" + err.Error())\n\t\t\t}\n\t\t}\n\t}\n\n\tif _, ok := scope.FieldByName(\"CreatedAt\"); ok {\n\t\tomit := append(scope.OmitAttrs(), \"CreatedAt\")\n\t\tscope.Search.Omit(omit...)\n\t}\n}", "title": "" }, { "docid": "2f8a2f1c50394c495436480cef98a1ed", "score": "0.5446606", "text": "func (b *Bot) OnUpdateVotes(clb func(UpdateVotesEvt)) {\n\tb.addCallback(updateVotes, clb)\n}", "title": "" }, { "docid": "8d5fde34c5c20ff0150bd3aecea39201", "score": "0.5424204", "text": "func (self *SoundManager) Update() {\n self.Object.Call(\"update\")\n}", "title": "" }, { "docid": "53652fd96f54d7a1abb8d1aa1261d4f4", "score": "0.5423553", "text": "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\tif _, ok := scope.Get(\"gorm:update_column\"); !ok {\n\t\tscope.SetColumn(\"ModifiedOn\", time.Now().Unix())\n\t}\n}", "title": "" }, { "docid": "53652fd96f54d7a1abb8d1aa1261d4f4", "score": "0.5423553", "text": "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\tif _, ok := scope.Get(\"gorm:update_column\"); !ok {\n\t\tscope.SetColumn(\"ModifiedOn\", time.Now().Unix())\n\t}\n}", "title": "" }, { "docid": "ab63fd91c8661f8337bb22f78b07967c", "score": "0.5423478", "text": "func (hc *HomepageCache) AddUpdateFunc(key string, updateFunc func() (*model.HomepageData, error)) {\n\thc.UpdateFuncs[key] = func() (interface{}, error) {\n\t\treturn updateFunc()\n\t}\n}", "title": "" }, { "docid": "9f707b588fb7a22b848341396c9bbb72", "score": "0.53876406", "text": "func (e EventThing) NotifyUpdate(n *memberlist.Node) {\n\tfmt.Printf(\"NotifyUpdate:%+v\", n)\n}", "title": "" }, { "docid": "d8ebcea80387e1720fca3ba8344fb7a7", "score": "0.53745747", "text": "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\tif _, ok := scope.Get(\"gorm:update_column\"); !ok {\n\t\tscope.SetColumn(\"UpdateDate\", time.Now().Unix())\n\t}\n}", "title": "" }, { "docid": "13ebd08d367b20d54b45938022afd560", "score": "0.5365302", "text": "func (_this *HTMLElement) OnTimeUpdate() domcore.EventHandlerFunc {\n\tvar ret domcore.EventHandlerFunc\n\tvalue := _this.Value_JS.Get(\"ontimeupdate\")\n\tif value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {\n\t\tret = domcore.EventHandlerFromJS(value)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "06f1bdfcc28a38706de1bef4b454e353", "score": "0.53647363", "text": "func (_this *ApplicationCache) SetOnNoupdate(listener func(event *domcore.Event, currentTarget *ApplicationCache)) js.Func {\n\tcb := eventFuncApplicationCache_domcore_Event(listener)\n\t_this.Value_JS.Set(\"onnoupdate\", cb)\n\treturn cb\n}", "title": "" }, { "docid": "afaacae50f9792790358a002d339e930", "score": "0.53270346", "text": "func (a *UpdateAction) UpdateRequestHandlerFunc(f UpdateRequestHandlerFunc) {\n\ta.requestHandler = f\n}", "title": "" }, { "docid": "1fd2a6f9e539f059f380d64e0fba3766", "score": "0.53079623", "text": "func (m *Manager) UpdateHook(next telegram.UpdateHandler) telegram.UpdateHandler {\n\tf := func(ctx context.Context, u tg.UpdatesClass) error {\n\t\tvar (\n\t\t\tusers []tg.UserClass\n\t\t\tchats []tg.ChatClass\n\t\t\tupdates []tg.UpdateClass\n\t\t)\n\t\tswitch u := u.(type) {\n\t\tcase *tg.UpdatesCombined:\n\t\t\tusers = u.GetUsers()\n\t\t\tchats = u.GetChats()\n\t\t\tupdates = u.GetUpdates()\n\t\tcase *tg.Updates:\n\t\t\tusers = u.GetUsers()\n\t\t\tchats = u.GetChats()\n\t\t\tupdates = u.GetUpdates()\n\t\t}\n\t\tm.applyUpdates(updates)\n\t\tapplyErr := m.applyEntities(ctx, users, chats)\n\t\thandleErr := next.Handle(ctx, u)\n\t\treturn multierr.Append(handleErr, applyErr)\n\t}\n\treturn telegram.UpdateHandlerFunc(f)\n}", "title": "" }, { "docid": "d6ac2177ac2d11dbaeb67a9d19caf4ad", "score": "0.53064114", "text": "func handleUpdate() {\n\treturn\n}", "title": "" }, { "docid": "1e3636d0d97b7d54d6270df0254b33c9", "score": "0.5297219", "text": "func (m *SafeMap) Update(key string, fn func(interface{}) interface{}) interface{} {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\t// get old value\n\tvar oldV interface{}\n\tif len(m.data) != 0 {\n\t\toldV, _ = m.data[key]\n\t}\n\n\t// get new value\n\tnewV := fn(oldV)\n\tif newV == nil {\n\t\t//nothing changed\n\t\treturn oldV\n\t}\n\n\t// set new value\n\tif m.data == nil {\n\t\tm.data = make(map[string]interface{})\n\t}\n\tm.data[key] = newV\n\treturn newV\n}", "title": "" }, { "docid": "5a6390ebbf930cd215caf4ffea6d62fa", "score": "0.5288798", "text": "func (_m *UserI) Update(ctx *gin.Context) {\n\t_m.Called(ctx)\n}", "title": "" }, { "docid": "31d51f7b83796e97dad8345e9fc947cf", "score": "0.5288165", "text": "func (self *ComponentPhysicsBody) PostUpdate() {\n self.Object.Call(\"postUpdate\")\n}", "title": "" }, { "docid": "dae24772d1f046454f3ee43f2771396a", "score": "0.5285476", "text": "func (v *View) onUpdate(ev *Update) {\n\tif v.rect.Contains(ev.Point) {\n\t\tv.Inbox <- *ev // (copy)\n\t}\n}", "title": "" }, { "docid": "232006135c85247295fd21c37fd0b863", "score": "0.5262995", "text": "func (l *Level) Update(dt float64, win *pixelgl.Window) {\n\t// Do not update the level if the game is paused\n\tif gamestate.IsPaused() {\n\t\treturn\n\t}\n\n\tl.updateFunc(dt, win)\n\n\t// Update the player if displayed\n\tif l.displayPlayer {\n\t\tplayer.Update(dt)\n\t}\n}", "title": "" }, { "docid": "7211862f6c68af8a3e7649b13fe13135", "score": "0.5237133", "text": "func (mr *MockUpdateListenerMockRecorder) Update(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Update\", reflect.TypeOf((*MockUpdateListener)(nil).Update), arg0)\n}", "title": "" }, { "docid": "9069f1594292ef3d9c8645f2c0b47a63", "score": "0.5233315", "text": "func (g *Group) RegisterUpdateFunc(updateFunc func() time.Time) {\n\t(*region)(g).registerUpdateFunc(updateFunc)\n}", "title": "" }, { "docid": "a9501fcc32f79aef898a63359850e7ab", "score": "0.5230701", "text": "func (tr *TransitionManager) Update(ev *Event) {\n\n\tif !tr.active {\n\n\t\treturn\n\t}\n\n\ttr.timer -= ev.Step()\n\tif tr.timer <= 0 {\n\n\t\tif tr.fadeIn {\n\n\t\t\ttr.timer += tr.time\n\t\t\ttr.fadeIn = false\n\n\t\t\tif tr.cb != nil {\n\n\t\t\t\ttr.cb(ev)\n\t\t\t}\n\n\t\t} else {\n\n\t\t\ttr.timer = 0\n\t\t\ttr.active = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "09d46a64b79cc72424a2b6f8c8802cb4", "score": "0.52294844", "text": "func (s *Stage) update(e *types.Event) {\n\tval := s.fn(e)\n\ts.state.Min = gomath.Min(s.state.Min, val)\n\ts.state.Max = gomath.Max(s.state.Max, val)\n\ts.state.Sum += val\n\ts.state.N++\n}", "title": "" }, { "docid": "134446a70e2eada257b06c2cf3e5e180", "score": "0.52116954", "text": "func (f *Fn) Update(patch *Fn) {\n\toriginal := f.Clone()\n\n\tif patch.Image != \"\" {\n\t\tf.Image = patch.Image\n\t}\n\tif patch.Memory != 0 {\n\t\tf.Memory = patch.Memory\n\t}\n\n\tif patch.Timeout != 0 {\n\t\tf.Timeout = patch.Timeout\n\t}\n\tif patch.IdleTimeout != 0 {\n\t\tf.IdleTimeout = patch.IdleTimeout\n\t}\n\tif patch.Config != nil {\n\t\tif f.Config == nil {\n\t\t\tf.Config = make(Config)\n\t\t}\n\t\tfor k, v := range patch.Config {\n\t\t\tif v == \"\" {\n\t\t\t\tdelete(f.Config, k)\n\t\t\t} else {\n\t\t\t\tf.Config[k] = v\n\t\t\t}\n\t\t}\n\t}\n\n\tf.Annotations = f.Annotations.MergeChange(patch.Annotations)\n\n\tif !f.Equals(original) {\n\t\tf.UpdatedAt = common.DateTime(time.Now())\n\t}\n}", "title": "" }, { "docid": "03c04998bc83f7abd492e01b891a4913", "score": "0.5211583", "text": "func (env *Env) Update(fn TxnOp) error {\n\treturn env.run(true, 0, fn)\n}", "title": "" }, { "docid": "a1bcc7e2574489edbad9d709510045e0", "score": "0.520715", "text": "func (m *MockUserManagerInterface) UpdateCalled() bool {\n\tm.lockUpdate.Lock()\n\tdefer m.lockUpdate.Unlock()\n\n\treturn len(m.calls.Update) > 0\n}", "title": "" }, { "docid": "6a8a03b4106e272188e0b9f7f923448a", "score": "0.52000004", "text": "func playerUpdatedEvent(f map[string]interface{}) {\n\tvar p Player\n\tvar pptr *Player\n\tvar msg string\n\t// If this is the first time through, do a resetGame\n\tif currentGame.p1.id == 0 {\n\t\tresetGame()\n\t}\n\t// See if this player is config'd and figure out if it's p1 or p2\n\tpptr = checkPlayerConfigured(f[\"Id\"])\n\t// Go ahead and make the updates\n\t// p, c = updatePlayer(pptr, res, thresholds)\n\tp, msg = updatePlayer(pptr, f)\n\tif msg != \"\" {\n\t\tfmt.Printf(\"%v\", msg)\n\t\tif Config[\"debug_player_update\"] == \"true\" {\n\t\t\tfmt.Printf(\"PlayerUpdate for %v\\n\", p)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1435705482ea0a95d668c9117fd00b83", "score": "0.5197634", "text": "func (GenerationOrAnnotationChangedPredicate) Update(e event.UpdateEvent) bool {\n\tif e.MetaOld == nil {\n\t\tlog.Error(nil, \"Update event has no old metadata\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectOld == nil {\n\t\tlog.Error(nil, \"Update event has no old runtime object to update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectNew == nil {\n\t\tlog.Error(nil, \"Update event has no new runtime object for update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.MetaNew == nil {\n\t\tlog.Error(nil, \"Update event has no new metadata\", \"event\", e)\n\t\treturn false\n\t}\n\n\treturn e.MetaNew.GetGeneration() != e.MetaOld.GetGeneration() ||\n\t\t!reflect.DeepEqual(e.MetaNew.GetAnnotations(), e.MetaOld.GetAnnotations())\n}", "title": "" }, { "docid": "5009df5ce3fb38102dfcd95f01cf3586", "score": "0.5196426", "text": "func (af *avgFunction) Update(evalCtx *AggEvaluateContext, sc *stmtctx.StatementContext, row chunk.Row) (err error) {\n\tswitch af.Mode {\n\tcase Partial1Mode, CompleteMode:\n\t\terr = af.updateSum(sc, evalCtx, row)\n\tcase Partial2Mode, FinalMode:\n\t\terr = af.updateAvg(sc, evalCtx, row)\n\tcase DedupMode:\n\t\tpanic(\"DedupMode is not supported now.\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4401248715e5284bfc5ac45aceaaa00d", "score": "0.5188624", "text": "func (h *OverlayHandle) Update(data Drawable) {\n\th.c <- OverlayUpdate{h.id, data, true}\n}", "title": "" }, { "docid": "65ebd8642e201bf71dd78d12724958a6", "score": "0.51605874", "text": "func (self *InputHandler) UpdateI(args ...interface{}) bool{\n return self.Object.Call(\"update\", args).Bool()\n}", "title": "" }, { "docid": "df42a3f0a5e046b3f9aab9eda6863d73", "score": "0.51452464", "text": "func (d *Debouncer) Update(state bool) {\n\td.updateAtTime(state, time.Now())\n}", "title": "" }, { "docid": "fde7dc9c146291ec7d935de6d5cd8029", "score": "0.5141538", "text": "func (d *Default) ObjectUpdated(oldObj, newObj interface{}) {\n\tlogrus.Info(\"Default UPDATE function invoked\")\n\n}", "title": "" }, { "docid": "0139c6db164695f1d3d7222eef0192f0", "score": "0.5141001", "text": "func (b *Bot) OnUpdateUser(clb func([]byte)) {\n\tb.addCallback(updateUser, clb)\n}", "title": "" }, { "docid": "65a5bfe0b56311970091faa5b38255db", "score": "0.513857", "text": "func (policy *NoPolicy) Update(deltaTime time.Duration) bool {\n\t// nothing\n\n\treturn true\n}", "title": "" }, { "docid": "f710846d1f03948a80015c86430b9170", "score": "0.5120444", "text": "func (t *Performance) Update(a *app.App, deltaTime time.Duration) {}", "title": "" }, { "docid": "2ade631de45386b593ac2f3ce1d12f15", "score": "0.5113987", "text": "func (t *GuiScroller) Update(a *app.App, deltaTime time.Duration) {}", "title": "" }, { "docid": "8355080ed18d4561a010c29069d412a7", "score": "0.5113047", "text": "func (hc *HookController) Update(tpl string, uType parameters.UpdateType) error {\n\t_, err := hc.c.Client.Call(\"one.hook.update\", hc.ID, tpl, uType)\n\treturn err\n}", "title": "" }, { "docid": "9df728b001453596316f92d4fa4ebc25", "score": "0.51092124", "text": "func (mm *MultiMux) Update(key string, fn func()) {\n\tm := mm.RWMutex(key)\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tfn()\n}", "title": "" }, { "docid": "926bc013800b0e1d3c63c35d039049ad", "score": "0.5108317", "text": "func (s *BaseSprite) Update() {\n\t// Do things\n}", "title": "" }, { "docid": "8a858fe934be0c7dfc48cc4a501d3665", "score": "0.5086016", "text": "func (h *Handler) Update(c *gin.Context) {\n\th.update(c, false)\n}", "title": "" }, { "docid": "205b03577e5d7d6b237d88a458f38447", "score": "0.5077595", "text": "func (me TlifecycleCallbackType) IsPreUpdate() bool { return me.String() == \"preUpdate\" }", "title": "" }, { "docid": "d962da34d005665fc70352cf4c9cf08d", "score": "0.50757724", "text": "func (resourceGenerationOrFinalizerChangedPredicate) Update(e event.UpdateEvent) bool {\n\tif e.MetaOld == nil {\n\t\tlog.Error(nil, \"UpdateEvent has no old metadata\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectOld == nil {\n\t\tlog.Error(nil, \"GenericEvent has no old runtime object to update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectNew == nil {\n\t\tlog.Error(nil, \"GenericEvent has no new runtime object for update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.MetaNew == nil {\n\t\tlog.Error(nil, \"UpdateEvent has no new metadata\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.MetaNew.GetGeneration() == e.MetaOld.GetGeneration() && reflect.DeepEqual(e.MetaNew.GetFinalizers(), e.MetaOld.GetFinalizers()) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "68ad46e2d70fdaee3d04d38fdb853edf", "score": "0.506899", "text": "func (mmf *maxMinFunction) Update(evalCtx *AggEvaluateContext, sc *stmtctx.StatementContext, row chunk.Row) error {\n\ta := mmf.Args[0]\n\tvalue, err := a.Eval(row)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif evalCtx.Value.IsNull() {\n\t\tvalue.Copy(&evalCtx.Value)\n\t}\n\tif value.IsNull() {\n\t\treturn nil\n\t}\n\tvar c int\n\tc, err = evalCtx.Value.Compare(sc, &value, mmf.ctor)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif (mmf.isMax && c == -1) || (!mmf.isMax && c == 1) {\n\t\tvalue.Copy(&evalCtx.Value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "61814567fd13e761e91b2b6852476e9b", "score": "0.5063276", "text": "func (ac *Autocache) NotifyUpdate(node *memberlist.Node) {\n\tac.logger.Printf(\"NotifyUpdate: %+v\\n\", node)\n}", "title": "" }, { "docid": "a21da8bcd7b2a0bff909cf5339cc2502", "score": "0.5060672", "text": "func (m *Menu) Update(dt float64, win *pixelgl.Window) {\n\tm.updateFunc(dt, win)\n}", "title": "" }, { "docid": "96b33bceeb17cc64dfa94e0e17d57345", "score": "0.5048451", "text": "func (m *MetricsDAO) Update() {\n\n}", "title": "" }, { "docid": "3b5ce8a84890de27a7661285adb6a155", "score": "0.5044621", "text": "func (self *ComponentPhysicsBody) PreUpdateI(args ...interface{}) {\n self.Object.Call(\"preUpdate\", args)\n}", "title": "" }, { "docid": "d2b6a43c8eef437041e6b1cef9951e81", "score": "0.5028685", "text": "func (c *Controller) onServiceUpdate(prevObj, obj interface{}) {\n\tservice := obj.(*v1.Service)\n\tprevService := prevObj.(*v1.Service)\n\tif service == nil || prevService == nil {\n\t\tutilruntime.HandleError(fmt.Errorf(\"onServiceUpdate() expected type v1.Service, got %T, %T\", prevObj, obj))\n\t\treturn\n\t}\n\tif (service.Spec.Selector == nil) != (prevService.Spec.Selector == nil) {\n\t\tc.queueEndpoints(obj)\n\t}\n}", "title": "" }, { "docid": "b610762b4a2c63d2c9dc9b96c8b14a42", "score": "0.50265664", "text": "func Update(args []js.Value) {\n\t// We normally don't need to do anything here\n}", "title": "" }, { "docid": "d11cd546a74a5a4b9918b1a16cc4e10d", "score": "0.5019399", "text": "func (me TlifecycleCallbackType) IsPostUpdate() bool { return me.String() == \"postUpdate\" }", "title": "" }, { "docid": "dc0579a4705ddb8967c482694cdaf364", "score": "0.50139946", "text": "func (l *levelDbUtxoBackend) Update(fn func(tx UtxoBackendTx) error) error {\n\t// Start a leveldb transaction.\n\t//\n\t// Note: A leveldb.Transaction is used rather than a leveldb.Batch because\n\t// it uses significantly less memory when atomically updating a large amount\n\t// of data. Due to the UtxoCache only flushing to the UtxoBackend\n\t// periodically, the UtxoBackend is almost always updating a large amount of\n\t// data at once, and thus leveldb transactions are used by default over\n\t// batches.\n\tldbTx, err := l.db.OpenTransaction()\n\tif err != nil {\n\t\treturn convertLdbErr(err, \"failed to open leveldb transaction\")\n\t}\n\n\tif err := fn(&levelDbUtxoBackendTx{ldbTx}); err != nil {\n\t\tldbTx.Discard()\n\t\treturn err\n\t}\n\n\t// Commit the leveldb transaction.\n\tif err := ldbTx.Commit(); err != nil {\n\t\tldbTx.Discard()\n\t\treturn convertLdbErr(err, \"failed to commit leveldb transaction\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7982de9688001211d2aa558bce0e0d70", "score": "0.50112444", "text": "func (NilFRate) UpdateTs(float64, int64) {}", "title": "" }, { "docid": "d4f014d250ad515fc390324bc3f05a1f", "score": "0.5001026", "text": "func (m *MockListener) OnUpdate(keys, values []string, newKey string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnUpdate\", keys, values, newKey)\n}", "title": "" }, { "docid": "e2e0b9fbbbe57e017db2ab63130ad515", "score": "0.49901295", "text": "func (v *View) OnChange(func(added, removed []string)) {\n}", "title": "" }, { "docid": "5145b5cdddd53a5f38427e82f9e1f42f", "score": "0.49888027", "text": "func (sm *Statemgr) OnProfileOperUpdate(nodeID string, objinfo *netproto.Profile) error {\n\tsm.UpdateDSCProfileStatusOnOperUpdate(nodeID, objinfo.ObjectMeta.Tenant, objinfo.ObjectMeta.Name, objinfo.ObjectMeta.GenerationID)\n\treturn nil\n}", "title": "" }, { "docid": "a4f1baef8d93c591da1eaff657c20585", "score": "0.49852893", "text": "func (customResourceValidator) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {\n\treturn nil\n}", "title": "" }, { "docid": "c7469a19073c62727e6f0e033229a87c", "score": "0.49825028", "text": "func (b *Bot) PreUpdate() {\n\tb.UpdateAt = GetMillis()\n}", "title": "" }, { "docid": "c21ad6d9d52b24095022ac8dfd6772de", "score": "0.49793273", "text": "func (d *Duplex) onUpdate(data interface{}) {\n\tupdate := data.(*sb.Update)\n\td.log.WithField(\"update\", update).Debug(\"got 'update' on stream:\")\n\n\t// current stream is in write-only mode\n\tif !d.readable {\n\t\td.log.Debug(\"'update' ignored by its non-readable flag\")\n\t\treturn\n\t}\n\n\tif !validate(update) || !sb.Filter(update, d.peerSources) {\n\t\treturn\n\t}\n\n\t// this update comes from our peer stream, don't send back\n\tif update.From == d.peerId {\n\t\td.log.WithField(\"peerId\", d.peerId).Debug(\"'update' ignored by peerId:\")\n\t\treturn\n\t}\n\n\tisAccepted := true\n\tif d.peerAccept != nil {\n\t\tisAccepted = d.sb.Model.IsAccepted(d.peerAccept, update)\n\t}\n\n\tif !isAccepted {\n\t\td.log.WithField(\"update\", update).WithField(\"peerAccept\", d.peerAccept).Debug(\"'update' ignored by peerAccept\")\n\t\treturn\n\t}\n\n\t// send 'scuttlebutt' to peer\n\tupdate.From = d.sb.Id()\n\td.push(update, false)\n\td.log.WithField(\"update\", update).Debug(\"'sent 'update to peer\")\n\n\t// really, this should happen before emitting.\n\tts := update.Timestamp\n\tsource := update.SourceId\n\td.peerSources[source] = ts\n\td.log.WithField(\"peerSources\", d.peerSources).Debug(\"updated peerSources to\")\n}", "title": "" } ]
20303f84ec69ebd1af095d4bccce8387
NewIssueLicenseOK creates IssueLicenseOK with default headers values
[ { "docid": "26ecc14752f9cb4b011efaaf4bea6873", "score": "0.6468137", "text": "func NewIssueLicenseOK() *IssueLicenseOK {\n\n\treturn &IssueLicenseOK{}\n}", "title": "" } ]
[ { "docid": "e1fcacbcf838b882bad0901ab39a83fd", "score": "0.66592246", "text": "func NewIssueLicenseDefault(code int) *IssueLicenseDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &IssueLicenseDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "ca7703dabf8c2fdfd9df5346b6144f57", "score": "0.60733306", "text": "func NewIssueLicenseParams() *IssueLicenseParams {\n\tvar ()\n\treturn &IssueLicenseParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "ae5fac4f5e52f5b29bbdb41c5d430fe1", "score": "0.5686406", "text": "func CreateDescribeLicenseRequest() (request *DescribeLicenseRequest) {\n\trequest = &DescribeLicenseRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Market\", \"2015-11-01\", \"DescribeLicense\", \"yunmarket\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "15816d444d04d4532de1f5a3ab184889", "score": "0.5435553", "text": "func NewIssueLicenseParamsWithTimeout(timeout time.Duration) *IssueLicenseParams {\n\tvar ()\n\treturn &IssueLicenseParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "e9d63cb942d14eed19166deade7471e4", "score": "0.5289989", "text": "func NewLicenseDetails()(*LicenseDetails) {\n m := &LicenseDetails{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "a3451dee35d70d5fbcc53c241c766eb8", "score": "0.5232393", "text": "func (c *Client) newRequest(method string, fullPath string, headers map[string]string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(method, fullPath, body)\n\tif err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Printf(PaymentName, \" Request creation failed: %s\\n\", err)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"x-sign-key\", c.XSignKey)\n\n\tif headers != nil {\n\t\tfor k, vv := range headers {\n\t\t\treq.Header.Set(k, vv)\n\t\t}\n\t}\n\tfmt.Printf(\"%+v\", req)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "dcb11a0ef94956540d44bad87814ac44", "score": "0.51948214", "text": "func (o *IssueLicenseDefault) WithStatusCode(code int) *IssueLicenseDefault {\n\to._statusCode = code\n\treturn o\n}", "title": "" }, { "docid": "0fab355af6f47a127e2f488adf0a2fe6", "score": "0.51812184", "text": "func NewIssueLicenseParamsWithHTTPClient(client *http.Client) *IssueLicenseParams {\n\tvar ()\n\treturn &IssueLicenseParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "2172a20ae3851f68b192fac1c95a9f55", "score": "0.5167528", "text": "func CreateIssue(r *http.Request, params martini.Params) string {\n\tprintln(\"hal\")\n\tvar t CreateAttr\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&t)\n\n\tif err != nil {\n\t\treturn GenerateErrorMessage(err)\n\t}\n\n\tmsg := messages.CreateIssue{\n\t\tIssue: &messages.Issue{\n\t\t\tTitle: t.Title,\n\t\t\tBody: t.Body,\n\t\t\tRepo: t.Repo,\n\t\t\tOrg: t.Org,\n\t\t},\n\t\tConfig: config(),\n\t}\n\n\treturn Request(\"issues.create\", msg)\n}", "title": "" }, { "docid": "e8e35fdc14737ddc843adf2d160cea9d", "score": "0.5142539", "text": "func NewIssue(\n\tvendorID, vendorPublisher, vendorSeriesName, vendorSeriesNumber string,\n\tpublicationDate, saleDate time.Time,\n\tisVariant, monthUncertain, isReprint bool,\n\tformat Format) *Issue {\n\treturn &Issue{\n\t\tVendorID: vendorID,\n\t\tVendorSeriesName: vendorSeriesName,\n\t\tVendorSeriesNumber: vendorSeriesNumber,\n\t\tVendorPublisher: vendorPublisher,\n\t\tPublicationDate: publicationDate,\n\t\tSaleDate: saleDate,\n\t\tIsVariant: isVariant,\n\t\tIsReprint: isReprint,\n\t\tVendorType: VendorTypeCb, // Make this default for now.\n\t\tMonthUncertain: monthUncertain,\n\t\tFormat: format,\n\t}\n}", "title": "" }, { "docid": "600c8259d0faacd0feedf644b1442abb", "score": "0.5129035", "text": "func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) {\n\terrors := make([]error, 0)\n\tx := &License{}\n\tm, ok := compiler.UnpackMap(in)\n\tif !ok {\n\t\tmessage := fmt.Sprintf(\"has unexpected value: %+v (%T)\", in, in)\n\t\terrors = append(errors, compiler.NewError(context, message))\n\t} else {\n\t\trequiredKeys := []string{\"name\"}\n\t\tmissingKeys := compiler.MissingKeysInMap(m, requiredKeys)\n\t\tif len(missingKeys) > 0 {\n\t\t\tmessage := fmt.Sprintf(\"is missing required %s: %+v\", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, \", \"))\n\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t}\n\t\tallowedKeys := []string{\"name\", \"url\"}\n\t\tallowedPatterns := []*regexp.Regexp{pattern0}\n\t\tinvalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)\n\t\tif len(invalidKeys) > 0 {\n\t\t\tmessage := fmt.Sprintf(\"has invalid %s: %+v\", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, \", \"))\n\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t}\n\t\t// string name = 1;\n\t\tv1 := compiler.MapValueForKey(m, \"name\")\n\t\tif v1 != nil {\n\t\t\tx.Name, ok = compiler.StringForScalarNode(v1)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for name: %s\", compiler.Display(v1))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// string url = 2;\n\t\tv2 := compiler.MapValueForKey(m, \"url\")\n\t\tif v2 != nil {\n\t\t\tx.Url, ok = compiler.StringForScalarNode(v2)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for url: %s\", compiler.Display(v2))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// repeated NamedAny vendor_extension = 3;\n\t\t// MAP: Any ^x-\n\t\tx.VendorExtension = make([]*NamedAny, 0)\n\t\tfor i := 0; i < len(m.Content); i += 2 {\n\t\t\tk, ok := compiler.StringForScalarNode(m.Content[i])\n\t\t\tif ok {\n\t\t\t\tv := m.Content[i+1]\n\t\t\t\tif strings.HasPrefix(k, \"x-\") {\n\t\t\t\t\tpair := &NamedAny{}\n\t\t\t\t\tpair.Name = k\n\t\t\t\t\tresult := &Any{}\n\t\t\t\t\thandled, resultFromExt, err := compiler.CallExtension(context, v, k)\n\t\t\t\t\tif handled {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbytes := compiler.Marshal(v)\n\t\t\t\t\t\t\tresult.Yaml = string(bytes)\n\t\t\t\t\t\t\tresult.Value = resultFromExt\n\t\t\t\t\t\t\tpair.Value = result\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpair.Value, err = NewAny(v, compiler.NewContext(k, v, context))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tx.VendorExtension = append(x.VendorExtension, pair)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn x, compiler.NewErrorGroupOrNil(errors)\n}", "title": "" }, { "docid": "13e7d8846496595c319d5b3f6fec2002", "score": "0.5091611", "text": "func CreateIssueRequest(result VetResult, quote string) github.IssueRequest {\n\n\tslocCount := result.End.Line - result.Start.Line + 1\n\ttitle := fmt.Sprintf(\"%s/%s: %s; %d LoC\", result.Owner, result.Repo, result.FilePath, slocCount)\n\tbody := Description(result, quote)\n\tlabels := Labels(result)\n\tstate := State(result)\n\n\t// TODO: labels based on lines of code\n\treturn github.IssueRequest{\n\t\tTitle: &title,\n\t\tBody: &body,\n\t\tLabels: &labels,\n\t\tState: &state,\n\t}\n}", "title": "" }, { "docid": "dd455e0a425665f0123258227147bf5e", "score": "0.5081283", "text": "func (a *LicensesApiService) StartFreeLicense(ctx context.Context, accountIdentifier string, moduleType string) (ResponseDtoModuleLicense, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ResponseDtoModuleLicense\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ng/api/licenses/free\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"accountIdentifier\", parameterToString(accountIdentifier, \"\"))\n\tlocalVarQueryParams.Add(\"moduleType\", parameterToString(moduleType, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/yaml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-api-key\"] = key\n\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v Failure\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 0 {\n\t\t\tvar v ResponseDtoModuleLicense\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "6cef1a9464fafb3173bc18dcb60cdb07", "score": "0.5034419", "text": "func (o *IssueLicenseParams) WithTimeout(timeout time.Duration) *IssueLicenseParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "80933d4d26575f66d95f56c87e07365e", "score": "0.50182766", "text": "func NewIosVppAppRevokeLicensesActionResult()(*IosVppAppRevokeLicensesActionResult) {\n m := &IosVppAppRevokeLicensesActionResult{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "d3b1d9fe46cdb4213e209347f4f58d84", "score": "0.4998894", "text": "func newRequest(t testing.TB, method, path string, body io.Reader) *http.Request {\n\treq := httptest.NewRequest(method, path, body)\n\treq.Header.Add(\"Accept\", resticAPIV2)\n\treturn req\n}", "title": "" }, { "docid": "43119aa73bff897c9e9b7a671ba7520d", "score": "0.49850944", "text": "func newHeader(length int) (*header, error) {\n\tif length > maxLength {\n\t\terr := fmt.Errorf(\n\t\t\t\"message size (%d bytes) is greater than %d bytes\",\n\t\t\tlength,\n\t\t\tmaxLength,\n\t\t)\n\t\treturn nil, err\n\t}\n\th := new(header)\n\th.Length = int16(length) + box.Overhead\n\tif _, err := io.ReadFull(rand.Reader, h.Nonce[:]); err != nil {\n\t\treturn nil, err\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "9c7a41b217d03436ee19ab7d6aed7c08", "score": "0.49533007", "text": "func (a *LicensesApiService) StartTrialLicense(ctx context.Context, body StartTrial, accountIdentifier string) (ResponseDtoModuleLicense, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ResponseDtoModuleLicense\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ng/api/licenses/trial\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"accountIdentifier\", parameterToString(accountIdentifier, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/yaml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-api-key\"] = key\n\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v Failure\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 0 {\n\t\t\tvar v ResponseDtoModuleLicense\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "60828c03440a20dff034e5ca9e8c7d0c", "score": "0.49332377", "text": "func newIssue(analyzerID string, desc string, fileSet *token.FileSet,\n\tpos token.Pos, severity, confidence issue.Score,\n) *issue.Issue {\n\tfile := fileSet.File(pos)\n\tline := file.Line(pos)\n\tcol := file.Position(pos).Column\n\n\treturn &issue.Issue{\n\t\tRuleID: analyzerID,\n\t\tFile: file.Name(),\n\t\tLine: strconv.Itoa(line),\n\t\tCol: strconv.Itoa(col),\n\t\tSeverity: severity,\n\t\tConfidence: confidence,\n\t\tWhat: desc,\n\t\tCwe: issue.GetCweByRule(analyzerID),\n\t\tCode: issueCodeSnippet(fileSet, pos),\n\t}\n}", "title": "" }, { "docid": "7f0f43f2db576a0951cb89e51325d9d0", "score": "0.4922511", "text": "func (a *LicensesApiService) ExtendTrialLicense(ctx context.Context, body StartTrial, accountIdentifier string) (ResponseDtoModuleLicense, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ResponseDtoModuleLicense\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ng/api/licenses/extend-trial\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"accountIdentifier\", parameterToString(accountIdentifier, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/yaml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-api-key\"] = key\n\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v Failure\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 0 {\n\t\t\tvar v ResponseDtoModuleLicense\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "ffda50e74fd2aceaa39f40dc89627ec1", "score": "0.48983923", "text": "func (p *Project) License(name string) {\n switch name {\n case \"mit\":\n // TODO implement\n return\n default:\n return\n }\n}", "title": "" }, { "docid": "5ece20fb0d5cff3b1fd4d79c9b3f1191", "score": "0.48950896", "text": "func (o *IssueLicenseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Args != nil {\n\t\tif err := r.SetBodyParam(o.Args); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd437761aa835de52c52700ca0a09cc3", "score": "0.48751503", "text": "func NewIssue(moc, lccn, dt string, ed int) *Issue {\n\treturn &Issue{MARCOrgCode: moc, LCCN: lccn, Date: dt, Edition: ed, WorkflowStep: schema.WSAwaitingProcessing}\n}", "title": "" }, { "docid": "fa5ce43653dce93b40e43710421a4eee", "score": "0.48372185", "text": "func CreateDescribeLicenseResponse() (response *DescribeLicenseResponse) {\n\tresponse = &DescribeLicenseResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "814a687324893c5b263b9b3325d76ed5", "score": "0.48309532", "text": "func CreateNewOrgEnvelope(origChannelGroup map[string]interface{}, modifiedChannelGroup map[string]interface{}, channelID string) ([]byte, error) {\n\t//Encode channel group to buffer\n\toriBuffer := EncodeAndReplaceNull(origChannelGroup)\n\tupdatedBuffer := EncodeAndReplaceNull(modifiedChannelGroup)\n\n\t//Encode and compute update proto bytes\n\toriginalProtoBytes, err := configtxlator.EncodeProto(\"common.Config\", oriBuffer.Bytes())\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"error in encode json to proto message : %s \\n\", err)\n\t}\n\t//for debug\n\t//_ = originalProtoBytes\n\tupdatedProtoBytes, err := configtxlator.EncodeProto(\"common.Config\", updatedBuffer.Bytes())\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"error in encode json to proto message: %s \\n\", err)\n\t}\n\n\tcomputeUpdateBytes, err := configtxlator.ComputeUpdt(originalProtoBytes, updatedProtoBytes, channelID)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"Error in configtxlator.ComputeUpdt : %s \\n\", err)\n\t}\n\n\tconfigUpdate, err := configtxlator.DecodeProto(\"common.ConfigUpdate\", computeUpdateBytes)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"Error in decode proto : %s \\n\", err)\n\t}\n\n\t// Build config update envelope\n\tconfigUpdateEnvelope := &ConfigUpdate{}\n\tconfigUpdateEnvelope.Payload.Data.Config_update = configUpdate\n\tconfigUpdateEnvelope.Payload.Header.Channel_header.Type = \"2\"\n\tconfigUpdateEnvelope.Payload.Header.Channel_header.Channel_id = channelID\n\n\t// Replace and lowercase some strings\n\tvar cueBuffer bytes.Buffer\n\tencoderUpdated := json.NewEncoder(&cueBuffer)\n\tencoderUpdated.SetIndent(\"\", \"\\t\")\n\tencoderUpdated.Encode(configUpdateEnvelope)\n\tcuestring := string(cueBuffer.Bytes())\n\tr := regexp.MustCompile(\"\\\"value\\\": null,\\n\")\n\tcuestring = r.ReplaceAllString(cuestring, \"\")\n\tr = regexp.MustCompile(\"\\\"policy\\\": null,\\n\")\n\tcuestring = r.ReplaceAllString(cuestring, \"\")\n\tr = regexp.MustCompile(\"\\\"signing_identity\\\": null,\\n\")\n\tcuestring = r.ReplaceAllString(cuestring, \"\")\n\treplaceKeys := []string{\"Payload\", \"Header\", \"Channel_header\", \"Data\", \"Config_update\", \"Type\", \"Channel_id\"}\n\tcuestring = lowercaseStringWithKeys(cuestring, replaceKeys)\n\t//return oriBuffer.Bytes(),err\n\tcueProtoBytes, err := configtxlator.EncodeProto(\"common.Envelope\", []byte(cuestring))\n\tif cueProtoBytes == nil {\n\t\treturn nil, errors.Errorf(\"Error in update channel : no update envelope provided\")\n\t}\n\treturn cueProtoBytes, nil\n}", "title": "" }, { "docid": "3a85373f333153e31203286f44836f83", "score": "0.4814454", "text": "func (client *appendBlobClient) sealCreateRequest(ctx context.Context, appendBlobClientSealOptions *appendBlobClientSealOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, appendPositionAccessConditions *AppendPositionAccessConditions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"comp\", \"seal\")\n\tif appendBlobClientSealOptions != nil && appendBlobClientSealOptions.Timeout != nil {\n\t\treqQP.Set(\"timeout\", strconv.FormatInt(int64(*appendBlobClientSealOptions.Timeout), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"x-ms-version\", \"2020-10-02\")\n\tif appendBlobClientSealOptions != nil && appendBlobClientSealOptions.RequestID != nil {\n\t\treq.Raw().Header.Set(\"x-ms-client-request-id\", *appendBlobClientSealOptions.RequestID)\n\t}\n\tif leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {\n\t\treq.Raw().Header.Set(\"x-ms-lease-id\", *leaseAccessConditions.LeaseID)\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {\n\t\treq.Raw().Header.Set(\"If-Modified-Since\", modifiedAccessConditions.IfModifiedSince.Format(time.RFC1123))\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {\n\t\treq.Raw().Header.Set(\"If-Unmodified-Since\", modifiedAccessConditions.IfUnmodifiedSince.Format(time.RFC1123))\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfMatch != nil {\n\t\treq.Raw().Header.Set(\"If-Match\", *modifiedAccessConditions.IfMatch)\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfNoneMatch != nil {\n\t\treq.Raw().Header.Set(\"If-None-Match\", *modifiedAccessConditions.IfNoneMatch)\n\t}\n\tif appendPositionAccessConditions != nil && appendPositionAccessConditions.AppendPosition != nil {\n\t\treq.Raw().Header.Set(\"x-ms-blob-condition-appendpos\", strconv.FormatInt(*appendPositionAccessConditions.AppendPosition, 10))\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/xml\")\n\treturn req, nil\n}", "title": "" }, { "docid": "a8aa00ad1b516129add8078268fc9e38", "score": "0.48034787", "text": "func CreateIssue(w http.ResponseWriter, r *http.Request) {\n\tlog.Print(\"CreateIssue called\")\n\tvar newissue model.Issue\n\tjson.NewDecoder(r.Body).Decode(&newissue)\n\tlog.Print(\"LoggedInUserID in create:\" + strconv.Itoa(LoggedInUserID))\n\tnewissue, err := business.CreateIssue(newissue, LoggedInUserID)\n\n\tif err != nil {\n\t\tlog.Print(\"Error Creating Issue\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tresp, _ := json.Marshal(newissue)\n\tw.Write(resp)\n}", "title": "" }, { "docid": "76ed514cb80c0850737e8e56172bb806", "score": "0.4793253", "text": "func initLicenses() {\n\tinitMit()\n}", "title": "" }, { "docid": "9e8bea1b3221597ad0c662ae0a15a715", "score": "0.47885397", "text": "func CreateGetDataOpenConfigRequest() (request *GetDataOpenConfigRequest) {\nrequest = &GetDataOpenConfigRequest{\nRpcRequest: &requests.RpcRequest{},\n}\nrequest.InitWithApiInfo(\"Oms\", \"2015-02-12\", \"GetDataOpenConfig\", \"oms\", \"openAPI\")\nreturn\n}", "title": "" }, { "docid": "f6c34cf13cdaf23fc0e04a3d2f43b4f1", "score": "0.4769519", "text": "func newRequest(reqURL string) *http.Request {\n\tcustomHeader := \"X-Custom-Header\"\n\tcustomHeaderValue := \"basic-test\"\n\tcustomBody := \"This is my request to the backend\"\n\treq, _ := http.NewRequest(\"GET\", reqURL, bytes.NewBuffer([]byte(customBody)))\n\treq.Host = \"some-name\"\n\treq.Header.Add(customHeader, customHeaderValue)\n\treturn req\n}", "title": "" }, { "docid": "01d6c3c929582465d4debda0939872ad", "score": "0.47479206", "text": "func IssueNew(username string) (JWT, error) {\n\ttoken, err := newSigned(username)\n\tif err != nil {\n\t\tfmt.Print(err)\n\t\treturn JWT{}, err\n\t}\n\n\tr, err := redis.SET(token.ID, username, token.TTL)\n\tif r == nil {\n\t\tpanic(\"token with that ID was already registered\")\n\t}\n\tif err != nil {\n\t\tfmt.Print(err)\n\t\treturn JWT{}, err\n\t}\n\treturn token, err\n}", "title": "" }, { "docid": "921a717ee78dff3587810f49a69bb0bf", "score": "0.4747645", "text": "func setupHeaders(e *ESI, req *http.Request) {\n\treq.Header.Add(\"User-Agent\", e.UserAgent)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tif e.AccessToken != \"\" {\n\t\treq.Header.Add(\"Authorization\", \"Bearer \"+e.AccessToken)\n\t}\n}", "title": "" }, { "docid": "a05524a0f86de22ee0492ddfdfc815df", "score": "0.47464618", "text": "func createIssue(owner string, repo string, title string) error {\n\tvar err error\n\tfmt.Printf(\"Owner: %s\\n\", owner)\n\tfmt.Printf(\"Repo: %s\\n\", repo)\n\tfmt.Printf(\"Title: %s\\n\", title)\n\tGithubClient.Issues.List(Ctx, true, &github.IssueListOptions{})\n\n\trequest := &github.IssueRequest{\n\t\tTitle: &title,\n\t}\n\tissue, resp, err := GithubClient.Issues.Create(Ctx, owner, repo, request)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Github says %d\\n\", resp.StatusCode)\n\tfmt.Printf(\"%s\\n\", issue.GetHTMLURL())\n\tfmt.Printf(\"Issue status is %s\\n\", issue.GetState())\n\n\tvar stIssue storage.Issue\n\tstIssue.IssueURL = issue.GetHTMLURL()\n\tstIssue.Owner = owner\n\tstIssue.Repo = repo\n\tstIssue.Number = issue.GetNumber()\n\tstIssue.Palette = make(map[string]string)\n\n\tstorage.GetInstance().Github.Issue = append(storage.GetInstance().Github.Issue, stIssue)\n\tstorage.GetInstance().Save()\n\treturn nil\n}", "title": "" }, { "docid": "52be79780fbc48299dfb94410aca16be", "score": "0.4741808", "text": "func (t *CandidateInfoStore) CertificateIssue(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\r\n\r\nif len(args) != 6 {\r\n\t\t\treturn nil, fmt.Errorf(\"Incorrect number of arguments. Expecting 6. Got: %d.\", len(args))\r\n\t\t}\r\n\t\t\r\n\t\t//getting certifiactionId\r\n\t\t\r\n\t\tAvalbytes, err := stub.GetState(\"CERTIFICATEINCREAMENTER\")\r\n\t\tAval, _ := strconv.ParseInt(string(Avalbytes), 10, 0)\r\n\t\tnewAval:=int(Aval) + 1\r\n\r\n\t\tnewASNincrement:= strconv.Itoa(newAval)\r\n\t\tstub.PutState(\"CERTIFICATEINCREAMENTER\", []byte(newASNincrement))\r\n\r\n\t\t\r\n\r\n\t\tcertUniqueid:=string(Avalbytes)\r\n\t\t\r\n\t\tcertificateId:=certUniqueid\r\n\t\tcandidateId:=args[0]\r\n\t\tdegree:=args[1]\r\n\t\tmarks:=args[2]\r\n\t\tgrade:=args[3]\r\n\t\tyear:=args[4]\r\n\t\tuniversityName:=args[5]\r\n\t\t\r\n\t\t\r\n\t\tassignerOrg, err := stub.GetState(certificateId)\r\n\t\tif assignerOrg !=nil{\r\n\t\t\treturn nil, fmt.Errorf(\"Candidate already registered %s\",certificateId)\r\n\t\t} else if err !=nil{\r\n\t\t\treturn nil, fmt.Errorf(\"System error\")\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t// Insert a row\r\n\t\tok, err := stub.InsertRow(\"CertificateDetails\", shim.Row{\r\n\t\t\tColumns: []*shim.Column{\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: certificateId}},\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: candidateId}},\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: degree}},\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: marks}},\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: grade}},\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: year}},\r\n\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: universityName}},\r\n\t\t\t\t}})\r\n\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err \r\n\t\t}\r\n\t\tif !ok && err == nil {\r\n\t\t\treturn nil, errors.New(\"Row already exists.\")\r\n\t\t}\r\n\t\t\r\n\t\t//append the certificate against candidateId\r\n\t\tcertificate, err := stub.GetState(\"CERTIFICATE:\"+candidateId)\r\n\t\tif certificate !=nil{\r\n\t\t\tvar certificateString []string\r\n\t\t\terr = json.Unmarshal([]byte(certificate), &certificateString)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn nil, errors.New(\"Row already exists.\")\r\n\t\t\t}\r\n\t\t\tcertificateString = append(certificateString, certificateId)\r\n\t\t\toutputMapBytes, _ := json.Marshal(certificateString)\t\t\t\r\n\t\t\tstub.PutState(\"CERTIFICATE:\"+candidateId, []byte(outputMapBytes))\t\t\t\t\r\n\t\t} else{\r\n\t\t\tvar certificate []string\r\n\t\t\t\r\n\t\t\tcertificate = append(certificate, certificateId)\r\n\t\t\toutputMapBytes, _ := json.Marshal(certificate)\t\t\t\r\n\t\t\tstub.PutState(\"CERTIFICATE:\"+candidateId, []byte(outputMapBytes))\t\r\n\t\t}\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\treturn nil, nil\r\n\r\n}", "title": "" }, { "docid": "4aea155be9ae538ccc733265a839a996", "score": "0.47289398", "text": "func CreateLicenseDiagnostic() diagnostics.Diagnostic {\n\treturn diagnostics.Diagnostic{\n\t\tName: \"license\",\n\t\tGenerate: func(tstCtx diagnostics.TestContext) error {\n\t\t\tlicenseID, err := getLicenseID(tstCtx)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Could not get current license ID\")\n\t\t\t}\n\n\t\t\ttstCtx.SetValue(\"license\", licenseSave{\n\t\t\t\tLicenseID: licenseID,\n\t\t\t})\n\t\t\treturn nil\n\t\t},\n\n\t\tVerify: func(tstCtx diagnostics.VerificationTestContext) {\n\t\t\tloaded := licenseSave{}\n\t\t\terr := tstCtx.GetValue(\"license\", &loaded)\n\t\t\trequire.NoError(tstCtx, err, \"Generated context was not found\")\n\n\t\t\tlicenseID, err := getLicenseID(tstCtx)\n\t\t\trequire.NoError(tstCtx, err)\n\t\t\tassert.Equal(tstCtx, loaded.LicenseID, licenseID, \"Unexpected license id\")\n\t\t},\n\t\tCleanup: func(diagnostics.TestContext) error { return nil },\n\t}\n}", "title": "" }, { "docid": "1fa30e27bc3453fe2b103865f3078b3d", "score": "0.47269985", "text": "func createVersion(apihost, apikey, subject, repository, pkg, version string) error {\n\treq := map[string]interface{}{\"name\": version, \"release_notes\": \"built by goxc\", \"release_url\": \"http://x.x.x/x/x\"}\n\trequestData, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequestLength := len(requestData)\n\treader := bytes.NewReader(requestData)\n\tresp, err := doHttp(\"POST\", apihost+\"/packages/\"+subject+\"/\"+repository+\"/\"+pkg+\"/versions\", subject, apikey, reader, int64(requestLength))\n\tif err == nil {\n\t\tlog.Printf(\"Created new version. %v\", resp)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "ab6864c77a989a9dbdc2d85db28a45e6", "score": "0.47136453", "text": "func newOIDCClientSecretRequests(c *ClientsecretV1alpha1Client, namespace string) *oIDCClientSecretRequests {\n\treturn &oIDCClientSecretRequests{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "48d2f1db36dcd64d42a3326135d7c1a4", "score": "0.46977213", "text": "func NewLicence(id string, m *Meta) Licence {\n\treturn Licence{Str(id, m)}\n}", "title": "" }, { "docid": "9073919fbe926e9a2369bfcae9727196", "score": "0.46927676", "text": "func (client *AuthorizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, authorization ExpressRouteAuthorization, options *AuthorizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateCloudName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateCloudName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateCloudName}\", url.PathEscape(privateCloudName))\n\tif authorizationName == \"\" {\n\t\treturn nil, errors.New(\"parameter authorizationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{authorizationName}\", url.PathEscape(authorizationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, authorization)\n}", "title": "" }, { "docid": "19b01a07151fcf12f44bb36fb485d467", "score": "0.4690448", "text": "func createAcknowledgement(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar orderBytes []byte\n\tvar ackBytes []byte\n\tvar err error\n\n\tacknowledgement := Acknowledgement{}\n\tfuncName := getFunctionName()\n\t/*=================================================================\n\t\t Unmarshal the Acknowledgement object and error if that fails\n\t\t\tor we do not receieve a payload\n\t ================================================================= */\n\n\tif len(args) < 1 {\n\t\treturn shim.Error(funcName + \" : requires an Acknowledgement document\")\n\t}\n\tif err = json.Unmarshal([]byte(args[0]), &acknowledgement); err != nil {\n\t\treturn shim.Error(funcName + \" : Failed to convert arg[0] to an Acknolwdgement notice: \" + err.Error())\n\t}\n\n\t/*=================================================================\n\t\t we can receive different acks for different objects in upcoming\n\t\t\treleases, so we determine the object from the acks DocumentType\n\t\t\tand perform document specific ack processing\n\t ================================================================= */\n\tswitch acknowledgement.DocumentType {\n\tcase \"PO\":\n\t\t/*=================================================================\n\t\t\t Retrieve the Purchase Order using the keys from the Ack\n\t\t\t\t(swapping the From and To). We error if we cannot marshal or\n\t\t\t\trecieve no bytes\n\t\t ================================================================= */\n\t\tvar order PurchaseOrder\n\t\tkeys := []string{acknowledgement.To, acknowledgement.From, acknowledgement.DocumentNumber}\n\t\tif order, err = retrieveAndMarshalPOObject(stub, keys); err != nil {\n\t\t\treturn shim.Error(funcName + \" : no existing Purchase Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\n\t\tif order.Status != OPEN {\n\t\t\treturn shim.Error(funcName + \" : Sales Order Number \" + acknowledgement.DocumentNumber + \" not in OPEN state\")\n\t\t}\n\n\t\t/*=================================================================\n\t\t We have the Purchase Order, and we set the STATUS to 'ACKNOWLEDGED'\n\t\t\tThe updated Purchase Order is updated back into the ledger\n\t\t================================================================= */\n\t\torder.Status = ACKNOWLEDGED\n\t\torderBytes, err = json.Marshal(order)\n\t\tif err != nil {\n\t\t\treturn shim.Error(funcName + \" : failed to unmarshal existing Purchase Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\t\terr = dbapi.UpdateObject(stub, \"PO\", keys, orderBytes)\n\t\tif err != nil {\n\t\t\treturn shim.Error(funcName + \" : failed to update existing Purchase Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\n\t\t/*=================================================================\n\t\t\t The Acknowledgement document is now stored in the ledger\n\t\t\t\t(errors on failure to store)\n\t\t ================================================================= */\n\t\taKeys := []string{acknowledgement.From, acknowledgement.To, acknowledgement.AckNumber}\n\t\tackBytes, err = json.Marshal(acknowledgement)\n\t\tif err != nil {\n\t\t\treturn shim.Error(funcName + \" : failed to update existing Purchase Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\t\tdbapi.UpdateObject(stub, \"ACK\", aKeys, ackBytes)\n\t/*=================================================================\n\t If the documentType is SO, then ack the Sales Order\n\t\t================================================================= */\n\tcase \"SO\":\n\t\t/*=================================================================\n\t\t\tRetrieve the Purchase Order using the keys from the Ack\n\t\t\t(swapping the From and To). We error if we cannot marshal or we\n\t\t\trecieve no bytes\n\t\t ================================================================= */\n\t\tvar salesOrder SalesOrder\n\t\tkeys := []string{acknowledgement.To, acknowledgement.From, acknowledgement.DocumentNumber}\n\t\tif salesOrder, err = retrieveAndMarshalSOObject(stub, keys); err != nil {\n\t\t\treturn shim.Error(funcName + \" : no existing Sales Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\n\t\tif salesOrder.Status != OPEN {\n\t\t\tfmt.Println(\"Sales Order status is \" + salesOrder.Status)\n\t\t\treturn shim.Error(funcName + \" : Sales Order Number \" + acknowledgement.DocumentNumber + \" not in OPEN state\")\n\t\t}\n\n\t\t/*=================================================================\n\t\t\tWe have the Purchase Order, and we set the STATUS to 'ACKNOWLEDGED'\n\t\t\tThe updated Purchase Order is updated into the ledger\n\t\t===salesOrder============================================================== */\n\t\tsalesOrder.Status = ACKNOWLEDGED\n\t\tif orderBytes, err = json.Marshal(salesOrder); err != nil {\n\t\t\treturn shim.Error(funcName + \" : failed to unmarshal existing Sales Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\t\tif err = dbapi.UpdateObject(stub, \"SO\", keys, orderBytes); err != nil {\n\t\t\treturn shim.Error(funcName + \" : failed to update existing Sales Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\n\t\t/*=================================================================\n\t\t\tThe Acknowledgement document is now stored in the ledger\n\t\t\t(errors on failure to store)\n\t\t ================================================================= */\n\t\taKeys := []string{acknowledgement.From, acknowledgement.To, acknowledgement.AckNumber}\n\t\tif ackBytes, err = json.Marshal(acknowledgement); err != nil {\n\t\t\treturn shim.Error(funcName + \" : failed to update existing Purchase Order Number \" + acknowledgement.DocumentNumber)\n\t\t}\n\t\tdbapi.UpdateObject(stub, \"ACK\", aKeys, ackBytes)\n\tdefault:\n\t\treturn shim.Error(funcName + \" : Ack for Doctype \" + acknowledgement.DocumentType + \" not yet implemented\")\n\t}\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "6d839b601d21c72847b2eb2c5ebf5c94", "score": "0.4680098", "text": "func NewModuleEnrollRequestWithoutParam() *ModuleEnrollRequest {\n\n return &ModuleEnrollRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/module/{moduleName}/enroll\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "4269b42a3bf9d0a6e3dc0ca59697185d", "score": "0.46701014", "text": "func (c *Client) newRequest(ctx context.Context, method, url string, body io.Reader) (*http.Request, error) {\n\t// Build new request with base URL.\n\treq, err := http.NewRequest(method, c.URL+url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set API key in header.\n\t//if user := booking.UserFromContext(ctx); user != nil && user.APIKey != \"\" {\n\t//\treq.Header.Set(\"Authorization\", \"Bearer \"+user.APIKey)\n\t//}\n\n\t// Default to JSON format.\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b35e190a951878d6ce6dc7b0a23ac891", "score": "0.4660907", "text": "func GetLicenses() (map[string]License, error) {\n\ttype EncodedLicense struct {\n\t\tName string\n\t\tText string\n\t}\n\tdata := map[string]EncodedLicense{\n\n\t\t\"github.com/casimir/xdg-go\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzY7rJhTe8xSfZjUjWdMfqZvuGJvEqDZEmNw0S2KTMZUDliEd5e0rnMy9nbuyzDnf\n79GjRcs1GtdbHy2eW65fCCnDfFvc+5jw3L/g919/+wOtWZLzKEfjvCVkZ5eLi9EFDxcx2sWebnhfjE92\nKHBerEU4ox/N8m4LpADjb5jtEoNHOCXjvPPvMOjDfCPhjDS6iBjO6cMsFsYPMDGG3plkBwyhv16sTyZl\nvbObbMRzGi2eugfi6WUVGayZiPPIs88RPlwawzVhsTEtrs8cBZzvp+uQPXyOJ3dxD4UMX+NHkgKu0Rar\nzwKXMLhz/to11nw9TS6OBQaXqU/XZAvE/Li2WeQcv4QF0U4T6cPsbMSa9Ye7dSdbn3Oh6VFRzC8fY7h8\nTeIiOV8X7+JoV8wQEMOq+I/tU37J6+cwTeEjR+uDH1xOFP8kJJ/anMK/ds1yv64PyfX3utcDzD+u+hjF\n0UwTTvZRmB3gPMz/4ixZPibjkzMT5rCsej/HfCVE1wyd3OgDVQy8w07Jb7xiFZ5oB949FThwXcu9xoEq\nRYU+Qm5AxRF/cVEVYH/vFOs6SEV4u2s4qwpwUTb7iost3vYaQmo0vOWaVdASWfBBxVmXyVqmypoKTd94\nw/WxIBuuRebcSAWKHVWal/uGKuz2aic7BioqCCm42CgutqxlQr+CCwgJ9o0Jja6mTZOlCN3rWqrsD6Xc\nHRXf1hq1bCqmOrwxNJy+NewuJY4oG8rbAhVt6ZatKKlrpkheu7vDoWb5KetRAVpqLkWOUUqhFS11AS2V\n/g498I4VoIp3uZCNkm1Bcp1yk1e4yDjB7iy5any5iFTr/75j3wlRMdpwse0yOEf8XH4l/wUAAP//kAzo\n9TgEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/container\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/flow\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/fsm\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/lexer\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/matcher\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/parser\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/jawher/mow.cli/internal/values\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t},\n\t\t\"github.com/kopoli/appkit\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzW7jNhC+8yk+5JQAQrrYY2+MRVtEJNKg6HV9pCU6YiuLhkg3yNsXIzu7zZ4Eceb7\nHTt4NNKiDp2fksdjI+0TY6t4+ZjD25Dx2D3h+7fv3/DqxtHj1U3/uNkztvXzOaQU4oSQMPjZHz/wNrsp\n+77AafYe8YRucPObL5Aj3PSBi59TnBCP2YUpTG9w6OLlg8UT8hASUjzldzd7uKmHSyl2wWXfo4/d9eyn\n7DLpncLoEx7z4PHQ3hEPT4tI793IwgSafY7wHvIQrxmzT3kOHXEUCFM3Xnvy8DkewzncFQi+xE8sR1yT\nLxafBc6xDyf6+iXW5XocQxoK9IGoj9fsCyR6XNosKMcfcUby48i6eAk+Ycn6y92yQ9YvVGi+V5To5X2I\n569JQmKn6zyFNPgF00ekuCj+7btML7R+iuMY3ylaF6c+UKL0J2N0aneM//oly+26U8yhu9W9HODy66r3\nURrcOOLo74X5HmGC+1+cmeRTdlMObsQlzove7zGfGbOVQKvXds+NgGyxNfqHLEWJB95Ctg8F9tJWemex\n58ZwZQ/Qa3B1wKtUZQHx19aItoU2TDbbWoqygFSreldKtcHLzkJpi1o20ooSVoME71RStETWCLOquLL8\nRdbSHgq2llYR51obcGy5sXK1q7nBdme2uhXgqoTSSqq1kWojGqHsM6SC0hA/hLJoK17XJMX4zlbakD+s\n9PZg5KayqHRdCtPiRaCW/KUWNyl1wKrmsilQ8oZvxILSthKG0drNHfaVoCfS4wp8ZaVWFGOllTV8ZQtY\nbexP6F62ogA3sqVC1kY3BaM69ZpWpCKcEjcWqhpfLqLN8r9rxU9ClILXUm1aAlPEz+Vn9l8AAAD//7MD\nVDw4BAAA`,\n\t\t},\n\t\t\"github.com/kopoli/thelm/lib\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzW7jNhC+8yk+5JQAQvpz6KE3xqItIhJpUPS6PtISHbGVRUOkG+Tti5Gd3WZPgjjz\n/Y4dPBppUYfOT8njsZH2ibFVvHzM4W3IeOye8Puvv/2BVzeOHq9u+sfNnrGtn88hpRAnhITBz/74gbfZ\nTdn3BU6z94gndIOb33yBHOGmD1z8nOKEeMwuTGF6g0MXLx8snpCHkJDiKb+72cNNPVxKsQsu+x597K5n\nP2WXSe8URp/wmAePh/aOeHhaRHrvRhYm0OxzhPeQh3jNmH3Kc+iIo0CYuvHak4fP8RjO4a5A8CV+Yjni\nmnyx+Cxwjn040dcvsS7X4xjSUKAPRH28Zl8g0ePSZkE5fokzkh9H1sVL8AlL1h/ulh2yfqFC872iRC/v\nQzx/TRISO13nKaTBL5g+IsVF8W/fZXqh9VMcx/hO0bo49YESpT8Zo1O7Y/zXL1lu151iDt2t7uUAlx9X\nvY/S4MYRR38vzPcIE9z/4swkn7KbcnAjLnFe9H6O+cyYrQRavbZ7bgRki63R32QpSjzwFrJ9KLCXttI7\niz03hit7gF6DqwNepSoLiL+2RrQttGGy2dZSlAWkWtW7UqoNXnYWSlvUspFWlLAaJHinkqIlskaYVcWV\n5S+ylvZQsLW0ijjX2oBjy42Vq13NDbY7s9WtAFcllFZSrY1UG9EIZZ8hFZSG+CaURVvxuiYpxne20ob8\nYaW3ByM3lUWl61KYFi8CteQvtbhJqQNWNZdNgZI3fCMWlLaVMIzWbu6wrwQ9kR5X4CsrtaIYK62s4Stb\nwGpjv0P3shUFuJEtFbI2uikY1anXtCIV4ZS4sVDV+HIRbZb/XSu+E6IUvJZq0xKYIn4uP/8XAAD//6vn\nVXQ3BAAA`,\n\t\t},\n\t\t\"github.com/mattn/go-runewidth\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRTW/jNhO+81c8yCkBhLxve+ihN8aiLaISaVD0uj7SEh2xkEVDpBrk3xcjO7vdngRx\n5vkcO3g00qIOnZ+Sx3Mj7Qtjm3j7nMP7kPHcveDX///yG04uLUOYIxqX03KNOTK29/M1pBTihJAw+Nmf\nP/E+uyn7vsBl9h7xgm5w87svkCPc9Imbn1OcEM/ZhSlM73Do4u2TxQvyEBJSvOQPN3u4qYdLKXbBZd+j\nj91y9VN2mfQuYfQJz3nweGofiKeXVaT3bmRhAs2+RvgIeYhLxuxTnkNHHAXC1I1LTx6+xmO4hocCwdcO\nEssRS/LF6rPANfbhQl+/xrot5zGkoUAfiPq8ZF8g0eNaaUE5/hdnJD+OrIu34BPWrD/crTtk/UaF5kdF\niV4+hnj9OUlI7LLMU0iDXzF9RIqr4l++y/RC65c4jvGDonVx6gMlSr8zRvd25/i3X7PcTzzFHLp73esB\nbj+u+hilwY0jzv5RmO8RJrh/xZlJPmU35eBG3OK86v035itjthJo9dYeuRGQLfZGf5OlKPHEW8j2qcBR\n2kofLI7cGK7sCXoLrk74Q6qygPhzb0TbQhsmm30tRVlAqk19KKXa4e1gobRFLRtpRQmrQYIPKilaImuE\n2VRcWf4ma2lPBdtKq4hzqw049txYuTnU3GB/MHvdCnBVQmkl1dZItRONUPYVUkFpiG9CWbQVr2uSYvxg\nK23IHzZ6fzJyV1lUui6FafEmUEv+Vou7lDphU3PZFCh5w3diRWlbCcNo7e4Ox0rQE+lxBb6xUiuKsdHK\nGr6xBaw29jv0KFtRgBvZUiFbo5uCUZ16SytSEU6JOwtVjZ8uos36f2jFd0KUgtdS7VoCU8Sv5Vf2TwAA\nAP//SpF7+z0EAAA=`,\n\t\t},\n\t\t\"github.com/nsf/termbox-go\": EncodedLicense{\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRT4/jJhS/8yl+mtOu5E7bPfbG2CRGdSDCZNMciU1iKgciIJ3m21c4mV1NT5Yf7/f3\n1eF6j+48ZXypv+Lbb79/Q7bxcgz//nIOMLc8hZgI2dp4cSm54OESJhvt8Y5zND7bscIpWotwwjCZeLYV\ncoDxd1xtTMEjHLNx3vkzDIZwvZNwQp5cQgqn/G6ihfEjTEphcCbbEWMYbhfrs8lF7+Rmm/AlTxYv/RPx\n8nURGa2ZifMobx9PeHd5CreMaFOObigcFZwf5ttYPHw8z+7ingoFvnSQSA64JVstPitcwuhO5WuXWNfb\ncXZpqjC6Qn28ZVshleFgfUEZP/4aIpKdZzKEq7MJS9af7padYv1aCs3PilKZvE/h8jmJS+R0i96lyS6Y\nMSCFRfFvO+QyKeunMM/hvUQbgh9dSZT+IERPFuYY/rFLlseJfchueNS9HOD686rPpzSZecbRPguzI5wn\nZfQRJxb5lI3Pzsy4hrjo/T/mKyG6ZejlSu+pYuA9tkp+5w1r8EJ78P6lwp7rVu409lQpKvQBcgUqDviT\ni6YC+2urWN9DKsI3246zpgIXdbdruFjjbachpEbHN1yzBlqiCD6pOOsL2YapuqVC0zfecX2oyIprUThX\nUoFiS5Xm9a6jCtud2sqegYoGQgouVoqLNdswoV/BBYQE+86ERt/SritShO50K1Xxh1puD4qvW41Wdg1T\nPd4YOk7fOvaQEgfUHeWbCg3d0DVbUFK3TJGy9nCHfcvKqOhRAVprLkWJUUuhFa11BS2V/gHd855VoIr3\npZCVkpuKlDrlqqxwUXCCPVhK1fh0EamW/13PfhCiYbTjYt2Di0/neyX/BQAA//9NO/UaJgQAAA==`,\n\t\t},\n\t}\n\n\tdecode := func(input string) (string, error) {\n\t\tdata := &bytes.Buffer{}\n\t\tbr := base64.NewDecoder(base64.StdEncoding, strings.NewReader(input))\n\n\t\tr, err := gzip.NewReader(br)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t_, err = io.Copy(data, r)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// Make sure the gzip is decoded successfully\n\t\terr = r.Close()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn data.String(), nil\n\t}\n\n\tret := make(map[string]License)\n\n\tfor k := range data {\n\t\ttext, err := decode(data[k].Text)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tret[k] = License{\n\t\t\tName: data[k].Name,\n\t\t\tText: text,\n\t\t}\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "4acca7ff3b327ede8308ed8b7c97f22c", "score": "0.46583962", "text": "func (j dryrunJIRAClient) CreateIssue(issue jira.Issue) (jira.Issue, error) {\n\tlog := j.config.GetLogger()\n\n\tfields := issue.Fields\n\n\tlog.Info(\"\")\n\tlog.Info(\"Create new JIRA issue:\")\n\tlog.Infof(\" Summary: %s\", fields.Summary)\n\tlog.Infof(\" Description: %s\", truncate(fields.Description, 50))\n\tlog.Infof(\" GitHub ID: %d\", fields.Unknowns[j.config.GetFieldKey(cfg.GitHubID)])\n\tlog.Infof(\" GitHub Number: %d\", fields.Unknowns[j.config.GetFieldKey(cfg.GitHubNumber)])\n\tlog.Infof(\" Labels: %s\", fields.Unknowns[j.config.GetFieldKey(cfg.GitHubLabels)])\n\tlog.Infof(\" State: %s\", fields.Unknowns[j.config.GetFieldKey(cfg.GitHubStatus)])\n\tlog.Infof(\" Reporter: %s\", fields.Unknowns[j.config.GetFieldKey(cfg.GitHubReporter)])\n\tlog.Info(\"\")\n\n\treturn issue, nil\n}", "title": "" }, { "docid": "aae3e6972c12b1fed73e38917f551b6d", "score": "0.46530116", "text": "func CurriculumCreate(ctx *context.Context) {\n\n\t// bytes json body\n\tvar byteJson []byte\n\n\t// define\n\t// var error\n\tvar err error\n\n\t// msg json\n\tvar msgJson, Uuid string\n\n\t// tipo aceito de content-type\n\tcTypeAceito := \"application/json\"\n\n\t// capturando content-type\n\tcType := ctx.Req.Header.Get(\"Content-Type\")\n\n\t// validando content-type\n\tif strings.ToLower(strings.TrimSpace(cType)) == cTypeAceito {\n\n\t\t// capturando json findo da requisicao\n\t\t// estamos pegando em bytes para ser\n\t\t// usado no Unmarshal que recebe bytes\n\t\tbyteJson, err = ctx.Req.Body().Bytes()\n\n\t\t// fechando Req.Body\n\t\tdefer ctx.Req.Body().ReadCloser()\n\n\t\t// caso ocorra\n\t\t// erro ao ler\n\t\t// envia msg\n\t\t// de error\n\t\tif err != nil {\n\t\t\tmsgerror = \"[CurriculumCreate] Erro ao capturar Json: \" + err.Error()\n\t\t\tlog.Println(msgerror)\n\t\t\tmsgJson = `{\"status\":\"error\",\"msg\":\"` + msgerror + `}`\n\t\t\tctx.JSON(http.StatusUnauthorized, msgJson)\n\t\t\treturn\n\n\t\t} else {\n\n\t\t\t// se nao tiver nem um valor\n\t\t\t// no json, emite um erro\n\t\t\t// para o usuario\n\t\t\tif string(byteJson) != \"\" {\n\n\t\t\t\t// Criar registro no banco de dados\n\t\t\t\tUuid, err = repo.AddCurriculum(byteJson)\n\n\t\t\t\t// tratando o erro\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err.Error())\n\t\t\t\t\tmsgJson = `{\"status\":\"error\",\"msg\":\"` + err.Error() + `\"}`\n\t\t\t\t\tctx.JSON(http.StatusUnauthorized, msgJson)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\t// sucesso\n\t\t\t\t\tmsgJson = `{\"status\":\"ok\",\"msg\":\"seus dados foram cadastrados com sucesso!\", \"uuid\":\"` + Uuid + `\"}`\n\t\t\t\t\tctx.JSON(http.StatusOK, msgJson)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Println(\"[CurriculumCreate] Erro em sua string json nao pode ser vazia!\")\n\t\t\t\tmsgJson = `{\"status\":\"error\",\"msg\":\"Erro em sua string json\"}`\n\t\t\t\tctx.JSON(http.StatusUnauthorized, msgJson)\n\t\t\t\treturn\n\t\t\t}\n\t\t} // fim else\n\t} else {\n\n\t\tvetCot := strings.Split(cType, \";\")\n\t\tContent := strings.ToLower(strings.TrimSpace(vetCot[0]))\n\n\t\tif Content == \"multipart/form-data\" {\n\n\t\t\t//log.Println(\"teste nome:: \", ctx.Req.Form.Get(\"nome\"))\n\t\t\t//log.Println(\"teste cpf:: \", ctx.Req.Form.Get(\"cpf\"))\n\n\t\t\t_, fh, err := ctx.GetFile(conf.NAME_FORM_FILE)\n\n\t\t\tfi := &upload.FileInfo{\n\t\t\t\tSize: fh.Size,\n\t\t\t\tName: fh.Filename,\n\t\t\t\tType: fh.Header.Get(\"Content-Type\"),\n\t\t\t}\n\n\t\t\tif !fi.ValidateSize() {\n\n\t\t\t\tmsgTmp := \"size not allowed!\"\n\t\t\t\tmsgJson := `{\"status\":\"error\",\"msg\":\"` + msgTmp + `\"}`\n\n\t\t\t\tctx.JSON(http.StatusUnauthorized, msgJson)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tjsonl := `{` +\n\t\t\t\t`\"nome\":\"` + ctx.Req.Form.Get(\"nome\") + `\",` +\n\t\t\t\t`\"cpf\":\"` + ctx.Req.Form.Get(\"cpf\") + `\",` +\n\t\t\t\t`\"rg\":\"` + ctx.Req.Form.Get(\"rg\") + `\",` +\n\t\t\t\t`\"idade\":\"` + ctx.Req.Form.Get(\"idade\") + `\",` +\n\t\t\t\t`\"bio\":\"` + ctx.Req.Form.Get(\"bio\") + `\",` +\n\t\t\t\t`\"skill\":\"` + ctx.Req.Form.Get(\"skill\") + `\"` + `}`\n\n\t\t\t// log.Println(jsonl)\n\n\t\t\tbyteJson := []byte(jsonl)\n\n\t\t\t// adicionado curriculo\n\t\t\tUuid, err = repo.AddCurriculum(byteJson)\n\n\t\t\t// tratando o erro\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t\tmsgJson = `{\"status\":\"error\",\"msg\":\"` + err.Error() + `\"}`\n\t\t\t\tctx.JSON(http.StatusUnauthorized, msgJson)\n\t\t\t\treturn\n\t\t\t} else {\n\n\t\t\t\t// path upload\n\t\t\t\tpathUpload := \"/\" + conf.PATH_UPLOAD + \"/\" + Uuid\n\n\t\t\t\tpathNewOrg := repo.GetWdLocal(0)\n\n\t\t\t\tpathAbs := pathNewOrg + pathUpload\n\n\t\t\t\tlog.Println(\"upload:\", pathAbs)\n\n\t\t\t\t// salvando arquivo em disco\n\t\t\t\tctx.SaveToFile(conf.NAME_FORM_FILE, pathAbs)\n\n\t\t\t\t// sucesso\n\t\t\t\tmsgJson = `{\"status\":\"ok\",\"msg\":\"seus dados foram cadastrados com sucesso!\", \"uuid\":\"` + Uuid + `\"}`\n\t\t\t\tctx.JSON(http.StatusOK, msgJson)\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tlog.Println(\"[CurriculumCreate] Erro Content-Type: aceitamos somente \" + cTypeAceito)\n\t\t\tmsgJson = `{\"status\":\"error\",\"msg\":\"error no Content-Type: ` + cType + `, aceitamos somente [Content-Type: ` + cTypeAceito + `]\"}`\n\t\t\tctx.JSON(http.StatusUnauthorized, msgJson)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da981cb55a873ee4ca28bf2b923d734a", "score": "0.4633189", "text": "func (client *MultipleResponsesClient) get202None204NoneDefaultNone202InvalidCreateRequest(ctx context.Context, options *MultipleResponsesClientGet202None204NoneDefaultNone202InvalidOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/202/none/204/none/default/none/response/202/invalid\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "55c8e4f47b67a8848a6ca74c427c2376", "score": "0.46261093", "text": "func pawndGetLicenses() (map[string]pawndLicense, error) {\n\ttype EncodedLicense struct {\n\t\tName string\n\t\tText string\n\t\tlength int64\n\t}\n\tdata := map[string]EncodedLicense{\n\n\t\t\"github.com/ahmetalpbalkan/go-cursor\": {\n\t\t\tName: \"Apache-2.0\",\n\t\t\tText: `\nH4sIAAAAAAAC/9RaX5PbOHJ/x6foqCqVmSpa9vruktzek9YzvlXi1bhm5DiuVB5AsikiBgEuAI6G+fSp\nbgAk9cfeTSUv9zI1okCg//761w1telm1CB9Uhcaj+Dd0XlkDb9dvCvgXaQbpRnj75s0fRRtC/+Pr18fj\ncS35nbV1h9c6vudfC7G/f/zlCTa7O3j3sLvb7rcPuyd4//AIn57uC3i8//j4cPfpHT0ueNXd9mn/uP3p\nEz0R4oc13GGjjArKGr8WYpVEWoFvpdbQoTQQWoSArvMgTQ2VNXVcD411MHgswGHvbD1U9LigVaJWPjhV\nDvQEpIeajsEayhGesIqv/wChdXY4tPBnsA2EVnmobTV0aMIsi3UXwlS2H506tAHs0aAD6wBNUGEEOYTW\nOvXf8aSTtSKuDa0MoDwcnDRBmQMvSlrzoXiQGu55u4uDB0PqsKwIsuL388mmBlprQ4tJHIVe8HGVNcFZ\nXYB0mD9oFrEg2enpYGp0UNmusyYvgaMKbRQ4HrIW763js/vB9dajn+02ubGAVXp/xYJ7uFG38SV7RFdA\nrRxWAawTysT/CwgWKjl45HXxIWvqoJNGHpBcQmf5oWqTMAUcW2Rly1HwiZJ3jRY4KooL6+BGqdvoJt+q\nnvZoVBNG6NFVtOnNn978/S0fZB0m0wo7BB+kqcm+vpUOfd5L3UKJBhtVKalP913IRo78YocV3FgH9J9b\n3S59KQ2Q7s+qHmgXB0uvA76gq5RX5iB6dJ3ynsOVIyYHlvLLoHmyg6twRQnRncdM77BB57CO3zZs06+k\nWWdr1ahKcjYUoEylB1JZlEMAYwNo1Sk6MVjwtglHChTPR0FlayymbOEt0ldFztJGHQbH34hGaeT0fij/\nC6twKag0Y3zm0A+a47pxtoMOq1YaVUkNwUnjaY1MoSH4iU4fG5AQzcAbLdSBK+pUtusVpYBlgaI64oAG\nnaQlJ4pNGj1HnPS0Q8yzDmslIYx9VO+zdV8vkvZo3VeWj7GBomUOXWWy0NZBNE4Sv5M1CvkslZalzvm5\nwIqCUI2CqJIpKOQCl4wNqsIJbKItsBaKc0qGQFjOlpgkvJEG8EV2vUZ6pXf2WdVYk4i0ZtP3aGr1AiVq\ne7wlbe/QqWcZ1DMCKe5X5x6lfX+PriSmUB5K6cklhtOmpt0pap3tIn7QIewKiuFjq6qWH2OtgnWUjg6f\nFTuoENIYG3Jko5aldflThojT+Ocagh5NYMtKOLZWczAL69RBGamveHIN30TEyU/nZhLRShSRyS+8sY/e\ncthJZcBjLx17nvRnoTt0qEfQynxlA5XKkN+FkR3eZlcqE9A1smJBilOznQtC3zq0DfnyHQFoqpdX/Xge\nwXN60RmTiVKKiFSjprNpm1N7UxzWuZKz9DLE9dZd2iyJWixCOhDWWiO1HsEPZadCSu5ctzlOWE5mNymQ\naT9xXpznQk6J9F10XpR4wkU+WFgDJbZSN7k4n+38nThZVE6xmvTItXMCRtsAaqyCs0ZVBdm5lJrj4ujo\nDcPFezDJvkCRLFJQTAYhe4RFqLOF/fexUpzua81CDuik0vSaVj74YlkcJhLhRx+w85GWKe8HJCivuAKl\n76JTqbrEaj8xk6VZi1NVGioAsz3JPrXy1eCpbnLIqY4xLEXoZ8YiUg9fsrInmokcWZU1vlfVYAevR+ik\n+0qgtOAVUKNXB8O4qwzbn013nfBJD6udDSBhmWPr1TLpzjjmpGTOnO+E42QiSrlja7uzg6CVHkpEAw4r\nZEQtx9MT/FB6/HVAE/QolKms620sg0QAF2mzFuLtGv5KPITs/W6K8ZmKPA0R2FPkXaXtFwiJsmphYQyg\nZC9HwYyHweGLHUASZ+sxDBT3R+t0fVREQow1r9inXj3zx1dVK92B2gI7Sh3GV41DLIRyDp9txaA6p2fq\nZeiQ3EVgQaSpp3i8gEzbFKIfSq0qPVLA9VqOBUxPenSxpHl+kgq1qWHqR/AUF4k0iotTvlUq10L8YeGA\nj5Iw8G/P+jf4UmEfKDV8yGnEQvlI/G+hj6otvNPJr1hAK59REDcqYudnm4Z4kQWPWhfpr+p660I0/Jy1\nkUAmFvU5UxOHgol7Pkn2vVYEz0aP0Y6ELkmcSkvV+bSWVSnHyPsX9hMTmhms0HvplKYUbpwyh6kxVO4k\nTW/8LUhtDaYaVNmuVCYCUywpV15I/VkKp2ATKToVKK+VXkzVZQ3bhr2qjA8qUFROBg/qEJFeHiR9zQCU\nmsybuVBIUTnr/Ss2CQld2YG4R/ysDEjQ8ugHFUgxjYcIxDLMAhP8iBOs+h74MC5HYf3cQ8YyEw0/iqRE\ntnXHbC60GGnMaUzNDVWK8Eyx59wQjXULXhIRmpKKPIMUvqna1/QxhdFkP+WB+p56LcQf1/CIy5HEWgg6\nspPjjDrnOFHZXuF0xLeYUSZxRO2ZZGGthq6IsUHsQIXWDuG82eMC+S1CLibyz8qzpIjRc43V2h5j9cyY\n8mPSZvABDiQZCRI5tsNK9QoJSH5Lkdi/gG3E0gd/Yd4wbR+nBDObpAaBmss4QXBupMalU4YcHZugiDFT\n9H2xg6Ce8sDaYXz77BCHQSpTZMa4aCuZBZvxmheSoWYHFoLCZao0RYq/goCoRuIV0Q0yzAmQRebm9+zs\nJacuFiwmIlR+kwWpLZO4Hh0pQraJ8e9CnnCcKxAtsF24KPUm5JfV7mG/fXe/goAvgS1GsZ+3I0a5jO05\n48TvMVM0ee6EJDiU9VSjs7jXbESZL3mol5CCEzCKykJ+00ji9xnpwsscETKARukDMFhH8eak6DX1Xj9m\nkWSWZ7bcrHm9tOJ1pyww8CQK3fmEQjVzx0515CCm4nC5q3XFLGAiMTAPPxKRnd8TWfuGA5ar5jO6aPDQ\nKle/IjXGyTXGuo77Mtn3KN0a9m1sCBIQMHNfeIqrZezWpgmP1IteiYoxw2P0Gec+Syky+YGMp7Ku6X9H\njdfV3EqaX41NcZbC0ZZe1YyRksgUHYCmHrrMsk48nPOWk/QMR9lcueeV+qpwFQ8uoMRY7tzAUSKiwhfj\n4qs6z9yWyRWPTmOJOx95kEXp9SSmWMhGEaaIW52wsP/FEN660xm8ba5IwE1ew21I4lGXVWGexczm5J2u\nT/7h/NS55kxMsLIdk7w5Rxb6nDHSmVz/aQ1PRKB4HBv7n5m6+LUQn4xG7zkQ8aXXqlJBj3G/5VCadD1j\nPVdHGeKb4wvKUDrlvL2PBKVcTgsnl4nvtQCZJJBoiyCIL0eSVec7mp0NtHyaj/NVRGkj+afMOnADQXjM\n4vihR+cxZtCcuHnzRrDvedwVcKbhB4cxdMcU48T8AV+wGjI5nBV3eJCOR9cX3Jcc849r2OeaS5/3C+Wh\ntgxYIdJBmCfuZN58JcElG4zs0C/qty+ER/esKoT4kVRM8RgX5wDMknJJSq2Pw18HlebywqH01nDd4/wa\nfLCddCNLoAzU6CunytN5G5xN2UTOhrwsQW5et0DctRD/tIY75Zmvo6Mln6UjE4xzKE8ilmNsjGL/puWR\n4ZB8xPR5noIUs1NStjJD5QoCN6TaRbs5rSMiceK6W7B8V7LaPMH2aQU/bZ62T4X4vN3//PBpD583j4+b\n3X57/wQPj8v7x4f3sNl9gX/d7u4KQBVvxF56RypRTnH214WYupk5A3juNU39RzhGmzARd2dt9H67/3Bf\niN3D7tV29/5xu/vr/S/3u30Bv9w/vvt5s9tvftp+2O6/cFi83+5390/xbnQDHzeP++27Tx82j/Dx0+PH\nh6f7WMAktaNWo6a+wPfWeMUzYJ6Hx85jyrm+d7Z3ikglK9bAwLMvjqYZBRfzr0g3vR+6SKGd8oyw3lZq\narkiuKY7KGI4J5dQl03SWoh/XsOHyW4kyAclS6XjRdiWihvgM8UhnR93MBY0j7FCi9aNJ7cEwbqwbDUN\nHrQ6oKnwtphu+oqzq77hNyP2JtZfDzVqVTLXESTQgfpYPU7HBJBV8LffjvCIaycwTk07Cq34sNRPstNk\nJw+nE1Z6L197zhegvsdKSc0LVU28ThciRlyazSmp83a5C6laSaZAB9KpOPf0zKD9oMM5ylNcUIQnLBj4\nCSiTPLVEu5is3x0KZ0lISW1j+B2srY9Kx/nQV/DB9r08YMH1diAxG6n04GIlkLoZzEwWuPSc3GFXtuso\nCJd6x8PQ3xYcUcRIz8cv0EoveOAp62fFF0pNun72XiVl83Vt2ngtxJ/XsKkImknhjIR04Gauh8uw/twS\nb/1Won2nUS8mplq11vJsS/AUK10z8vQMJDTIeV+AZLGkqTCK3cfhVkKmkaMIO8NX4uRjNp7OooItdZpI\nMA94TeWS2GEcdCvPBSIRoUVWw8/2SCS/4MHCZBm22mLLWRu+fSeebs3MRdP0ngdx8THD2wxuLCMzh5Nh\n/2KCsHBtmujRIYrppOAEjfnJNmjGAmps0NRxbWv1lYrTStcxWmTqOVmLSsLg3HwDkSZ+0nt03LHFoVhx\nGXYlQTYVcRJ/JE1nq0309rgIrAXR0ovAut/dUQG79sMaITYfP97v7rb//iO5h1vWvtdjuqBd/qaHviMh\nOBWF2P/OlUW6Gz4b9ZRWaXS9JsiMnUoxDx8bhbr2gKbS1kfkLZ2svmLwsPqP/1wRR6euOJWXMcWGYJhL\nXc2i71vDzZ01/zCPBOiMvOHf3XIryb2Wb+2ga8Ld6ejEkRelMaKICeBHE+QLNOkajrvOeOYaPiNI7a1w\nGFenfk3GVTEKvGdGF1sMJmN9rnb5CqrE6aId+D4JwdMrq94pHjQSGq4Io09vCNNlPYmG0isqgtE0+c4t\ndqxi2WlLV7XqmZELYHET8/bND3+ATdthgI3u4Sepv0rDa5K760VzcBoIBSx+BwY3tGD6OdbtX2iLTMUp\nW2OtSDPOzGqVSb0Vo9UUIRNTAJjgwpY8dZHLMc8UkjKwyAC/8fuzD9t397un+1dv12/4hf8Dbc0/cKFt\nliOaix9egPInC65SVAD4f2KpbLQnxBMRchQza2hUBVqawyAPCAf7jI454pK1UW8AsCC3/lKvtfifAAAA\n//8SR9vCFigAAA==`,\n\t\t\tlength: 10262,\n\t\t},\n\t\t\"github.com/jawher/mow.cli\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/3xRvY7jNhjs+RSDre4AYvODVOm4Em0xkUiDos9xSUv0ioEsGiIVw28fUPbeYVNEjcDv\nZ+abGfz/ZwaHRhjUvnNTdIQU4Xqf/fuQ8KX7il9//uU3ij/sbXAzmrDEaAnZufniY/Rhgo8Y3OxOd7zP\ndkqupzjPziGc0Q12fncUKcBOd1zdHMOEcErWT356h0UXrncSzkiDj4jhnG52drBTDxtj6LxNrkcfuuXi\npmRT5jv70UV8SYPDS/vcePm6kvTOjsRPyL2PFm4+DWFJmF1Ms+8yBoWfunHp8w0f7dFf/JMhr6/6I0kB\nS3R0vZPiEnp/zn+3yroup9HHgaL3Gfq0JEcRc3E1kmYdP4UZ0Y0j6cLVu4hV64/r1pl8+jUbmp4WxVy5\nDeHyWYmP5LzMk4+DW3f6gBhWxr9dl3Ilj5/DOIZbltaFqfdZUfydkJyyPYV/3KrlEe8Uku8edq8BXH+k\n+mzFwY4jTu5pmOvhJ5JLH3LmTB+TnZK3I65hXvn+K/OVEFNxtGpjDkxziBY7rb6Jkpd4YS1E+0JxEKZS\ne4MD05pJc4TagMkj/hSypOB/7TRvWyhNRLOrBS8phCzqfSnkFm97A6kMatEIw0sYhUz4hBK8zWAN10XF\npGFvohbmSMlGGJkxN0qDYce0EcW+Zhq7vd6ploPJElJJITdayC1vuDSvEBJSgX/j0qCtWF1nKsL2plI6\n34dC7Y5abCuDStUl1y3eOGrB3mr+oJJHFDUTDUXJGrbl65YyFdckjz2uw6HiuZT5mAQrjFAyyyiUNJoV\nhsIobb6vHkTLKZgWbTZko1VDSbZTbfKIkHlP8gdKthqfElF6fe9b/h0QJWe1kNsWQn6K75WQfwMAAP//\neVpV+1MEAAA=`,\n\t\t\tlength: 1107,\n\t\t},\n\t\t\"github.com/kopoli/appkit\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzW7jNhC+8yk+5JQAQrrYY2+MRVtEJNKg6HV9pCU6YiuLhkg3yNsXIzu7zZ4Eceb7\nHTt4NNKiDp2fksdjI+0TY6t4+ZjD25Dx2D3h+7fv3/DqxtHj1U3/uNkztvXzOaQU4oSQMPjZHz/wNrsp\n+77AafYe8YRucPObL5Aj3PSBi59TnBCP2YUpTG9w6OLlg8UT8hASUjzldzd7uKmHSyl2wWXfo4/d9eyn\n7DLpncLoEx7z4PHQ3hEPT4tI793IwgSafY7wHvIQrxmzT3kOHXEUCFM3Xnvy8DkewzncFQi+xE8sR1yT\nLxafBc6xDyf6+iXW5XocQxoK9IGoj9fsCyR6XNosKMcfcUby48i6eAk+Ycn6y92yQ9YvVGi+V5To5X2I\n569JQmKn6zyFNPgF00ekuCj+7btML7R+iuMY3ylaF6c+UKL0J2N0aneM//oly+26U8yhu9W9HODy66r3\nURrcOOLo74X5HmGC+1+cmeRTdlMObsQlzove7zGfGbOVQKvXds+NgGyxNfqHLEWJB95Ctg8F9tJWemex\n58ZwZQ/Qa3B1wKtUZQHx19aItoU2TDbbWoqygFSreldKtcHLzkJpi1o20ooSVoME71RStETWCLOquLL8\nRdbSHgq2llYR51obcGy5sXK1q7nBdme2uhXgqoTSSqq1kWojGqHsM6SC0hA/hLJoK17XJMX4zlbakD+s\n9PZg5KayqHRdCtPiRaCW/KUWNyl1wKrmsilQ8oZvxILSthKG0drNHfaVoCfS4wp8ZaVWFGOllTV8ZQtY\nbexP6F62ogA3sqVC1kY3BaM69ZpWpCKcEjcWqhpfLqLN8r9rxU9ClILXUm1aAlPEz+Vn9l8AAAD//7MD\nVDw4BAAA`,\n\t\t\tlength: 1080,\n\t\t},\n\t\t\"github.com/kopoli/go-terminal-size\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzW7jNhC+8yk+5JQAQvpzKdAbY9EWEYk0KHpdH2mJjtjKoiHSDfL2xcjObrMnQZz5\nfscOHo20qEPnp+Tx2Ej7xNgqXj7m8DZkPHZP+P3X3/7AqxtHj1c3/eNmz9jWz+eQUogTQsLgZ3/8wNvs\npuz7AqfZe8QTusHNb75AjnDTBy5+TnFCPGYXpjC9waGLlw8WT8hDSEjxlN/d7OGmHi6l2AWXfY8+dtez\nn7LLpHcKo094zIPHQ3tHPDwtIr13IwsTaPY5wnvIQ7xmzD7lOXTEUSBM3XjtycPneAzncFcg+BI/sRxx\nTb5YfBY4xz6c6OuXWJfrcQxpKNAHoj5esy+Q6HFps6Acv8QZyY8j6+Il+IQl6w93yw5Zv1Ch+V5Ropf3\nIZ6/JgmJna7zFNLgF0wfkeKi+LfvMr3Q+imOY3ynaF2c+kCJ0p+M0andMf7rlyy3604xh+5W93KAy4+r\n3kdpcOOIo78X5nuECe5/cWaST9lNObgRlzgvej/HfGbMVgKtXts9NwKyxdbob7IUJR54C9k+FNhLW+md\nxZ4bw5U9QK/B1QGvUpUFxF9bI9oW2jDZbGspygJSrepdKdUGLzsLpS1q2UgrSlgNErxTSdESWSPMquLK\n8hdZS3so2FpaRZxrbcCx5cbK1a7mBtud2epWgKsSSiup1kaqjWiEss+QCkpDfBPKoq14XZMU4ztbaUP+\nsNLbg5GbyqLSdSlMixeBWvKXWtyk1AGrmsumQMkbvhELSttKGEZrN3fYV4KeSI8r8JWVWlGMlVbW8JUt\nYLWx36F72YoC3MiWClkb3RSM6tRrWpGKcErcWKhqfLmINsv/rhXfCVEKXku1aQlMET+Xn/8LAAD//6Ye\nih03BAAA`,\n\t\t\tlength: 1079,\n\t\t},\n\t\t\"github.com/kopoli/pawnd\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzW7jNhC+8yk+5JQAQvpzKnpjLNoiIpEGRa/rIy3REVtZNES6Qd6+GNnZbfYkiDPf\n79jBo5EWdej8lDweG2mfGFvFy8cc3oaMx+4Jv//62x94dePo8eqmf9zsGdv6+RxSCnFCSBj87I8feJvd\nlH1f4DR7j3hCN7j5zRfIEW76wMXPKU6Ix+zCFKY3OHTx8sHiCXkICSme8rubPdzUw6UUu+Cy79HH7nr2\nU3aZ9E5h9AmPefB4aO+Ih6dFpPduZGECzT5HeA95iNeM2ac8h444CoSpG689efgcj+Ec7goEX+InliOu\nyReLzwLn2IcTff0S63I9jiENBfpA1Mdr9gUSPS5tFpTjlzgj+XFkXbwEn7Bk/eFu2SHrFyo03ytK9PI+\nxPPXJCGx03WeQhr8gukjUlwU//ZdphdaP8VxjO8UrYtTHyhR+pMxOrU7xn/9kuV23Snm0N3qXg5w+XHV\n+ygNbhxx9PfCfI8wwf0vzkzyKbspBzfiEudF7+eYz4zZSqDVa7vnRkC22Br9TZaixANvIduHAntpK72z\n2HNjuLIH6DW4OuBVqrKA+GtrRNtCGyabbS1FWUCqVb0rpdrgZWehtEUtG2lFCatBgncqKVoia4RZVVxZ\n/iJraQ8FW0uriHOtDTi23Fi52tXcYLszW90KcFVCaSXV2ki1EY1Q9hlSQWmIb0JZtBWva5JifGcrbcgf\nVnp7MHJTWVS6LoVp8SJQS/5Si5uUOmBVc9kUKHnDN2JBaVsJw2jt5g77StAT6XEFvrJSK4qx0soavrIF\nrDb2O3QvW1GAG9lSIWujm4JRnXpNK1IRTokbC1WNLxfRZvnfteI7IUrBa6k2LYEp4ufyM/svAAD//2/y\nIu44BAAA`,\n\t\t\tlength: 1080,\n\t\t},\n\t\t\"github.com/mattn/go-colorable\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRTW/jNhO+81c8yCkBhLxve+ihN8aiLaISaVD0uj7SEh2xkEVDpBrk3xcjO7vdngRx\n5vkcO3g00qIOnZ+Sx3Mj7Qtjm3j7nMP7kPHcveDX///yG04uLUOYIxqX03KNOTK29/M1pBTihJAw+Nmf\nP/E+uyn7vsBl9h7xgm5w87svkCPc9Imbn1OcEM/ZhSlM73Do4u2TxQvyEBJSvOQPN3u4qYdLKXbBZd+j\nj91y9VN2mfQuYfQJz3nweGofiKeXVaT3bmRhAs2+RvgIeYhLxuxTnkNHHAXC1I1LTx6+xmO4hocCwdcO\nEssRS/LF6rPANfbhQl+/xrot5zGkoUAfiPq8ZF8g0eNaaUE5/hdnJD+OrIu34BPWrD/crTtk/UaF5kdF\niV4+hnj9OUlI7LLMU0iDXzF9RIqr4l++y/RC65c4jvGDonVx6gMlSr8zRvd25/i3X7PcTzzFHLp73esB\nbj+u+hilwY0jzv5RmO8RJrh/xZlJPmU35eBG3OK86v035itjthJo9dYeuRGQLfZGf5OlKPHEW8j2qcBR\n2kofLI7cGK7sCXoLrk74Q6qygPhzb0TbQhsmm30tRVlAqk19KKXa4e1gobRFLRtpRQmrQYIPKilaImuE\n2VRcWf4ma2lPBdtKq4hzqw049txYuTnU3GB/MHvdCnBVQmkl1dZItRONUPYVUkFpiG9CWbQVr2uSYvxg\nK23IHzZ6fzJyV1lUui6FafEmUEv+Vou7lDphU3PZFCh5w3diRWlbCcNo7e4Ox0rQE+lxBb6xUiuKsdHK\nGr6xBaw29jv0KFtRgBvZUiFbo5uCUZ16SytSEU6JOwtVjZ8uos36f2jFd0KUgtdS7VoCU8Sv5Vf2TwAA\nAP//SpF7+z0EAAA=`,\n\t\t\tlength: 1085,\n\t\t},\n\t\t\"github.com/mattn/go-isatty\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xSzY6rNhTe8xSfZjUjoXRfVVU94ASrYEfGuWmWDjjBVwQjbDrN21d2cjt3uoric77f\nQ+Hm+2KvQ8Br94aT9utgF4eGqPbQCCXw202HMG2+z39cb9qOm87dfs+yhinUtjOTN3il/8w6vGXZ3iw3\n6711E6zHYBZzvuO66CmYPsdlMQbugm7Qy9XkCA56umM2i3cT3DloO9npCo3Ozfe4GQbr4d0lfOjFQE89\ntPeuszqYHr3r1puZgg5R72JH4/EaBoOX9ol4eUsivdEj7IQ4+zHChw2DWwMW48Niu8iRw07duPbRw4/x\naG/2qRDhqSgfSVdv8uQzx8319hJ/TYo1r+fR+iFHbyP1eQ0mh4+Pqa085vjFLfBmHCODNf6R9dNd2okq\ncyw0PCtKuh+Du31NYj0u6zJZP5iE6R28S4rfTRfiS1y/uHF0HzFa56bexkT+1yxTg4E+u79NyvL4DiYX\nbPeoOx1g/rzqc+QHPY44m2dhpo/16p/iLFHeBz0Fq0fMbkl6/4+5yTJVUbRiq45EUrAWeym+sZKWeCEt\nWPuS48hUJQ4KRyIl4eoEsQXhJ/zJeJmD/rWXtG0hJFizrxktczBe1IeS8R3eDwpcKNSsYYqWUAJR8EnF\naBvJGiqLinBF3lnN1CnHlikeObdCgmBPpGLFoSYS+4Pci5aC8BJccMa3kvEdbShXGzAOLkC/Ua7QVqSu\nkxQ5qErI5K8Q+5Nku0qhEnVJZYt3ipqR95o+pPgJRU1Yk6MkDdnRhBKqojKtPd0dK5qeGAfhIIVigscY\nheBKkkLlUEKq/6BH1tIcRLI2FrKVoskR6xTb1BmPOE4fLLFqfLmIkOn/oaWfXkpKasZ3bQT/vLzJ/g0A\nAP//AGNqrEsEAAA=`,\n\t\t\tlength: 1099,\n\t\t},\n\t\t\"github.com/mattn/go-zglob\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRTW/jNhO+81c8yCkBhLxveynQG2PRFlGJNCh6XR9piY5YyKIhUg3y74uRnd1uT4I4\n83yOHTwaaVGHzk/J47mR9oWxTbx9zuF9yHjuXvDr/3/5DSeXliHMEY3LabnGHBnb+/kaUgpxQkgY/OzP\nn3if3ZR9X+Aye494QTe4+d0XyBFu+sTNzylOiOfswhSmdzh08fbJ4gV5CAkpXvKHmz3c1MOlFLvgsu/R\nx265+im7THqXMPqE5zx4PLUPxNPLKtJ7N7IwgWZfI3yEPMQlY/Ypz6EjjgJh6salJw9f4zFcw0OB4GsH\nieWIJfli9VngGvtwoa9fY92W8xjSUKAPRH1esi+Q6HGttKAc/4szkh9H1sVb8Alr1h/u1h2yfqNC86Oi\nRC8fQ7z+nCQkdlnmKaTBr5g+IsVV8S/fZXqh9Uscx/hB0bo49YESpd8Zo3u7c/zbr1nuJ55iDt297vUA\ntx9XfYzS4MYRZ/8ozPcIE9y/4swkn7KbcnAjbnFe9f4b85UxWwm0emuP3AjIFnujv8lSlHjiLWT7VOAo\nbaUPFkduDFf2BL0FVyf8IVVZQPy5N6JtoQ2Tzb6Woiwg1aY+lFLt8HawUNqilo20ooTVIMEHlRQtkTXC\nbCquLH+TtbSngm2lVcS51QYce26s3BxqbrA/mL1uBbgqobSSamuk2olGKPsKqaA0xDehLNqK1zVJMX6w\nlTbkDxu9Pxm5qywqXZfCtHgTqCV/q8VdSp2wqblsCpS84TuxorSthGG0dneHYyXoifS4At9YqRXF2Ghl\nDd/YAlYb+x16lK0owI1sqZCt0U3BqE69pRWpCKfEnYWqxk8X0Wb9P7TiOyFKwWupdi2BKeLX8iv7JwAA\n///Y6fA7PQQAAA==`,\n\t\t\tlength: 1085,\n\t\t},\n\t\t\"github.com/mattn/go-zglob/fastwalk\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRTW/jNhO+81c8yCkBhLxveynQG2PRFlGJNCh6XR9piY5YyKIhUg3y74uRnd1uT4I4\n83yOHTwaaVGHzk/J47mR9oWxTbx9zuF9yHjuXvDr/3/5DSeXliHMEY3LabnGHBnb+/kaUgpxQkgY/OzP\nn3if3ZR9X+Aye494QTe4+d0XyBFu+sTNzylOiOfswhSmdzh08fbJ4gV5CAkpXvKHmz3c1MOlFLvgsu/R\nx265+im7THqXMPqE5zx4PLUPxNPLKtJ7N7IwgWZfI3yEPMQlY/Ypz6EjjgJh6salJw9f4zFcw0OB4GsH\nieWIJfli9VngGvtwoa9fY92W8xjSUKAPRH1esi+Q6HGttKAc/4szkh9H1sVb8Alr1h/u1h2yfqNC86Oi\nRC8fQ7z+nCQkdlnmKaTBr5g+IsVV8S/fZXqh9Uscx/hB0bo49YESpd8Zo3u7c/zbr1nuJ55iDt297vUA\ntx9XfYzS4MYRZ/8ozPcIE9y/4swkn7KbcnAjbnFe9f4b85UxWwm0emuP3AjIFnujv8lSlHjiLWT7VOAo\nbaUPFkduDFf2BL0FVyf8IVVZQPy5N6JtoQ2Tzb6Woiwg1aY+lFLt8HawUNqilo20ooTVIMEHlRQtkTXC\nbCquLH+TtbSngm2lVcS51QYce26s3BxqbrA/mL1uBbgqobSSamuk2olGKPsKqaA0xDehLNqK1zVJMX6w\nlTbkDxu9Pxm5qywqXZfCtHgTqCV/q8VdSp2wqblsCpS84TuxorSthGG0dneHYyXoifS4At9YqRXF2Ghl\nDd/YAlYb+x16lK0owI1sqZCt0U3BqE69pRWpCKfEnYWqxk8X0Wb9P7TiOyFKwWupdi2BKeLX8iv7JwAA\n///Y6fA7PQQAAA==`,\n\t\t\tlength: 1085,\n\t\t},\n\t\t\"github.com/mgutz/ansi\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzY7rJhTe+yk+zWpGsqZ/u+4Ym8SoNkSY3DRLYpMxlWMiwB2lT19Bcjt3urLMOd/v\nUZNBxxRaO5glGDx3TL0UlbvevH2fIp6HF/z68y+/odPeOrSv2K7RGu/NP0WxM/5iQ7BugQ2YjDenG969\nXqIZS5y9MXBnDJP276ZEdNDLDVfjg1vgTlHbxS7v0Bjc9ZY242QDgjvHD+0N9DJCh+AGq6MZMbphvZgl\n6pj0znY2Ac9xMnjqH4inlywyGj3DLkiz7yN82Di5NcKbEL0dEkcJuwzzOiYP38ezvdiHQoLnDkIiXYMp\ns88SFzfac/qaHOu6nmYbphKjTdSnNZoSIT3mRsuU4yfnEcw8JwZrwj3rp7u8k1SuqdD4qCjrfkzu8jWJ\nDTivfrFhMhkzOgSXFf8yQ0wvaf3s5tl9pGiDW0abEoXfiyKdW5/c3yZnuZ94cdEO97rzAa6fV32MwqTn\nGSfzKMyMqV79Qxyf5EPUS7R6xtX5rPf/mK9FoRqKXmzUgUgK1mMnxTdW0xpPpAfrn0ocmGrEXuFApCRc\nHSE2IPyIPxivS9A/d5L2PYQE63Yto3UJxqt2XzO+xdtegQuFlnVM0RpKIAk+qBjtE1lHZdUQrsgba5k6\nltgwxRPnRkgQ7IhUrNq3RGK3lzvRUxBegwvO+EYyvqUd5eoVjIML0G+UK/QNadssRfaqETL7q8TuKNm2\nUWhEW1PZ442iZeStpXcpfkTVEtaVqElHtjSjhGqozGsPd4eG5ifGQThIpZjgKUYluJKkUiWUkOo/6IH1\ntASRrE+FbKToSqQ6xSZ3xhOO0ztLqhpfLiJk/t/39NNLTUnL+LZP4B+XX4vi3wAAAP//SKx5nT0EAAA=\n`,\n\t\t\tlength: 1085,\n\t\t},\n\t\t\"github.com/robfig/cron\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1RSTY/jJhi+8ysezWlXsqbtHntjbDJGdSACsmmOjk1iKgciwDuaf1/hZHZ2T5bfj+fr\npQ639+guU8aX+iu+/fnXN6hwwsZdFuuiHQOh8wxVJhKUTTb+sOMzIVtu0PGaCc0I2dl4dSm54OESJhvt\n6R2X2PtsxwrnaC3CGcPUx4utkAN6/46bjSl4hFPunXf+gh5DuL0jnEmeXEIK5/zWR4vej+hTCoPrsx0x\nhmG5Wp/7XPjObrYJX/Jk8aQfG09fV5LR9jOcJ6X30cKby1NYMqJNObqhYFRwfpiXsWj4aM/u6h4MZT3e\n/edAlmSrVWeFaxjduXztauu2nGaXpgqjK9CnJdsKqRQH68tW78c/QkSy81wQnE13r5/q1pki/VYCzY+I\nCi/epnDFb05cwnmJ3qXJrjtjQAoVScvpPzvkUinj5zDP4a1YG4IfXXGU/ibETBb9Kfywq5f7A/Ahu+Ee\n93qA2+dVH6009fOMk30EZkc4j36eyYedWAyn3Pvs+hm3EFe+cvxfpT8TYloGLTfmQBUD19gp+Z03rMET\n1eD6qcKBm1buDQ5UKSrMEXIDKo74h4umAvt3p5jWkIrw7a7jrKnARd3tGy5e8bI3ELI80C03rIGRKIQP\nKM50AdsyVbdUGPrCO26OFTbcCKY12UgFih1Vhtf7jirs9monNQMVDYQUXGwUF69sy4R5BhcQEuw7Ewa6\npV23UtG9aaVa9dVyd1T8tTVoZdcwpfHC0HH60jGsVOKIuqN8W6GhW/pa1ClI0zK1jj3UHVpWSoQLUAFa\nGy5FsVFLYRStTQUjlfm5euCaVaCK6xLIRslthRKn3JQRLkgthWB3lBI1fruIVOv/XrNPLQ2jHRevujj+\ndfiZ/B8AAP//sSNflkQEAAA=`,\n\t\t\tlength: 1092,\n\t\t},\n\t\t\"github.com/ryanuber/go-glob\": {\n\t\t\tName: \"MIT\",\n\t\t\tText: `\nH4sIAAAAAAAC/1xRzW7jNhC+8yk+5JQAQvqDnnpjLNoiKpEGRa/royzREQuZNES6gd++GNnZbfYkiDPf\n79jRoZEWte9dSA7PjbQvjK3i5Tb79zHjuX/B77/+9gfMrQvYHd3M2NbNZ5+SjwE+YXSzO97wPnchu6HA\naXYO8YR+7OZ3VyBHdOGGi5tTDIjH3Pngwzs69PFyY/GEPPqEFE/5o5sdujCgSyn2vstuwBD769mF3GXS\nO/nJJTzn0eGpfSCeXhaRwXUT8wE0+xzhw+cxXjNml/Lse+Io4EM/XQfy8Dme/Nk/FAi+RE8sR1yTKxaf\nBc5x8Cf6uiXW5XqcfBoLDJ6oj9fsCiR6XJosKMcvcUZy08T6ePEuYcn6w92yQ9YvVGh+VJTo5WOM569J\nfGKn6xx8Gt2CGSJSXBT/cX2mF1o/xWmKHxStj2HwlCj9yRiduTvGf92S5X7ZELPv73UvB7j8uOpjlMZu\nmnB0j8LcAB/Q/S/OTPIpdyH7bsIlzovezzFfGbOVQKvXds+NgGyxNfqbLEWJJ95Ctk8F9tJWemex58Zw\nZQ/Qa3B1wF9SlQXE31sj2hbaMNlsaynKAlKt6l0p1QZvOwulLWrZSCtKWA0SfFBJ0RJZI8yq4sryN1lL\neyjYWlpFnGttwLHlxsrVruYG253Z6laAqxJKK6nWRqqNaISyr5AKSkN8E8qirXhdkxTjO1tpQ/6w0tuD\nkZvKotJ1KUyLN4Fa8rda3KXUAauay6ZAyRu+EQtK20oYRmt3d9hXgp5IjyvwlZVaUYyVVtbwlS1gtbHf\noXvZigLcyJYKWRvdFIzq1GtakYpwStxZqGp8uYg2y/+uFd8JUQpeS7VpCUwRP5df2X8BAAD//9UdrcM0\nBAAA`,\n\t\t\tlength: 1076,\n\t\t},\n\t\t\"golang.org/x/crypto/ssh/terminal\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwY/jph/F7/wVT3va+cnKb9VbuydikxjJMS7gyebosckEKTYRkBnNf1/BZDrZtlIP\nPRkZeN/3PrzSXd68fT5FfB0f8Mu3b79Cnwy2DvQaT86HFej5jHwkwJtg/IuZVoRIM9kQvX26RusWDMuE\nazCwC4K7+tHkP092Gfwbjs7PocCrjSc4n7/uGsnsJnu045AECgze4GL8bGM0Ey7evdjJTIinISKeDI7u\nfHavdnnG6JbJpkshXSKzib8RAuB/+NlUgDt+uBndZDBfQ4Q3cbBLlhye3EvauiEgi4t2NAXiyQacbYhJ\n4H7aMv3FymTDeB7sbPzqnx3Y5R7Ch4OLd9N1NJ8myJ8m8F9MkFuwyY3X2Sxx+Hib/zsPF0/GYx6i8XY4\nh0/E+V3iyZB767c8rbH5WlJdhtkkM1vnns8GfBlXWNznXuZtYyCjW951nA+Yhzc8mVSOCdHBLJPzwaQe\nXLybXTR4pxEDJuPti5lw9G4mOX9wx/iamnHrDMLFjKk0uHibquRTXZb34oSQfRNdcwUlNnpPJQNX6KR4\n5BWrsD5A1wyl6A6Sb2uNWjQVkwq0rVCKVku+7rWQinyhClx9yRu0PYD96CRTCkKC77qGswp7KiVtNWeq\nAG/Lpq94uy2w7jVaoUnDd1yzCloUeejfr0FssGOyrGmr6Zo3XB/yvA3XbZq1EZJQdFRqXvYNleh62QnF\nkGJVXJUN5TtWrcBbtALskbUaqqZN83NKIvYtk8n6fUSsGRpO1w1Lg3LIiktW6pTmc1XyirWaNgVRHSs5\nbQqwH2zXNVQeipumYr/3rNWcNqjojm6Zwtd/IdJJUfaS7ZJlsYHq10pz3WuGrRBV5qyYfOQlU9/RCJVh\n9YoVpKKa5sGdFBuu1fe0XveKZ2a81UzKvtNctA+oxZ49MomS9opVGa5oU1SiaybkIYkmBpl9gX3NdM1k\n4plJ0YRAaclLfX9MSGghNfnMiJZtG75lbcnSrkgqe67YA6jkKh3geSz29ADR58jpiXrFSF7eFbbIDwm+\nAa0eebJ9O9wJpfitJhlZWd9wr8gfAQAA//+AUlb6xwUAAA==`,\n\t\t\tlength: 1479,\n\t\t},\n\t\t\"golang.org/x/sync/errgroup\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwY/jph/F7/wVT3va+cnKb9VbuydikxjJMS7gyebosckEKTYRkBnNf1/BZDrZtlIP\nPRkZeN/3PrzSXd68fT5FfB0f8Mu3b79Cnwy2DvQaT86HFej5jHwkwJtg/IuZVoRIM9kQvX26RusWDMuE\nazCwC4K7+tHkP092Gfwbjs7PocCrjSc4n7/uGsnsJnu045AECgze4GL8bGM0Ey7evdjJTIinISKeDI7u\nfHavdnnG6JbJpkshXSKzib8RAuB/+NlUgDt+uBndZDBfQ4Q3cbBLlhye3EvauiEgi4t2NAXiyQacbYhJ\n4H7aMv3FymTDeB7sbPzqnx3Y5R7Ch4OLd9N1NJ8myJ8m8F9MkFuwyY3X2Sxx+Hib/zsPF0/GYx6i8XY4\nh0/E+V3iyZB767c8rbH5WlJdhtkkM1vnns8GfBlXWNznXuZtYyCjW951nA+Yhzc8mVSOCdHBLJPzwaQe\nXLybXTR4pxEDJuPti5lw9G4mOX9wx/iamnHrDMLFjKk0uHibquRTXZb34oSQfRNdcwUlNnpPJQNX6KR4\n5BWrsD5A1wyl6A6Sb2uNWjQVkwq0rVCKVku+7rWQinyhClx9yRu0PYD96CRTCkKC77qGswp7KiVtNWeq\nAG/Lpq94uy2w7jVaoUnDd1yzCloUeejfr0FssGOyrGmr6Zo3XB/yvA3XbZq1EZJQdFRqXvYNleh62QnF\nkGJVXJUN5TtWrcBbtALskbUaqqZN83NKIvYtk8n6fUSsGRpO1w1Lg3LIiktW6pTmc1XyirWaNgVRHSs5\nbQqwH2zXNVQeipumYr/3rNWcNqjojm6Zwtd/IdJJUfaS7ZJlsYHq10pz3WuGrRBV5qyYfOQlU9/RCJVh\n9YoVpKKa5sGdFBuu1fe0XveKZ2a81UzKvtNctA+oxZ49MomS9opVGa5oU1SiaybkIYkmBpl9gX3NdM1k\n4plJ0YRAaclLfX9MSGghNfnMiJZtG75lbcnSrkgqe67YA6jkKh3geSz29ADR58jpiXrFSF7eFbbIDwm+\nAa0eebJ9O9wJpfitJhlZWd9wr8gfAQAA//+AUlb6xwUAAA==`,\n\t\t\tlength: 1479,\n\t\t},\n\t\t\"golang.org/x/sys/unix\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwY/jph/F7/wVT3va+cnKb9VbuydikxjJMS7gyebosckEKTYRkBnNf1/BZDrZtlIP\nPRkZeN/3PrzSXd68fT5FfB0f8Mu3b79Cnwy2DvQaT86HFej5jHwkwJtg/IuZVoRIM9kQvX26RusWDMuE\nazCwC4K7+tHkP092Gfwbjs7PocCrjSc4n7/uGsnsJnu045AECgze4GL8bGM0Ey7evdjJTIinISKeDI7u\nfHavdnnG6JbJpkshXSKzib8RAuB/+NlUgDt+uBndZDBfQ4Q3cbBLlhye3EvauiEgi4t2NAXiyQacbYhJ\n4H7aMv3FymTDeB7sbPzqnx3Y5R7Ch4OLd9N1NJ8myJ8m8F9MkFuwyY3X2Sxx+Hib/zsPF0/GYx6i8XY4\nh0/E+V3iyZB767c8rbH5WlJdhtkkM1vnns8GfBlXWNznXuZtYyCjW951nA+Yhzc8mVSOCdHBLJPzwaQe\nXLybXTR4pxEDJuPti5lw9G4mOX9wx/iamnHrDMLFjKk0uHibquRTXZb34oSQfRNdcwUlNnpPJQNX6KR4\n5BWrsD5A1wyl6A6Sb2uNWjQVkwq0rVCKVku+7rWQinyhClx9yRu0PYD96CRTCkKC77qGswp7KiVtNWeq\nAG/Lpq94uy2w7jVaoUnDd1yzCloUeejfr0FssGOyrGmr6Zo3XB/yvA3XbZq1EZJQdFRqXvYNleh62QnF\nkGJVXJUN5TtWrcBbtALskbUaqqZN83NKIvYtk8n6fUSsGRpO1w1Lg3LIiktW6pTmc1XyirWaNgVRHSs5\nbQqwH2zXNVQeipumYr/3rNWcNqjojm6Zwtd/IdJJUfaS7ZJlsYHq10pz3WuGrRBV5qyYfOQlU9/RCJVh\n9YoVpKKa5sGdFBuu1fe0XveKZ2a81UzKvtNctA+oxZ49MomS9opVGa5oU1SiaybkIYkmBpl9gX3NdM1k\n4plJ0YRAaclLfX9MSGghNfnMiJZtG75lbcnSrkgqe67YA6jkKh3geSz29ADR58jpiXrFSF7eFbbIDwm+\nAa0eebJ9O9wJpfitJhlZWd9wr8gfAQAA//+AUlb6xwUAAA==`,\n\t\t\tlength: 1479,\n\t\t},\n\t\t\"gopkg.in/fsnotify.v1\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwY7jKBeF9zzFUa+6f1n5Z3o5vSI2iZEc4wFc6SxdNqkgxSYCUqV6+xFUaio901Iv\nZmVkuPee891Tusurt0+niM/jF3z97fev0CeDrQO9xpPzYQV6PiM/CfAmGP9sphX5Sd0xLC7a4+svKok0\nkw3R28drtG7BsEy4BgO7ILirH03+82iXwb/i6PwcCrzYeILz+euukcxuskc7DqlBgcEbXIyfbYxmwsW7\nZzuZCfE0RMSTwdGdz+7FLk8Y3TLZVBRSEZlN/IMQAP/Dj6IC3PFdzegmg/kaIryJg11yy+HRPaerGwSS\nnI+mQDzZgLMNMTW4n7ZM/5Ay2TCeBzsbv/q5ArvcQ3hXcPFuuo7mQwT5WwT+iwhyMza58TqbJQ7vu/m/\n83DxZDzmIRpvh3P4QJz3Ek+G3Eu/+WmNzWWp6zLMJonZOvd0NuDLuMLiPu4ybxsDGd3y1sf5gHl4xaNJ\n4ZgQHcwyOR9MysHFu9lFgzcaMWAy3j6bCUfvZpL9B3eMLykZt8wgXMyYQoOLtylKPsVleQtOCFk30TVX\nUGKj91QycIVOigdesQrrA3TNUIruIPm21qhFUzGpQNsKpWi15OteC6nIJ6rA1ad8QdsD2PdOMqUgJPiu\nazirsKdS0lZzpgrwtmz6irfbAuteoxWaNHzHNaugRZGH/rsMYoMdk2VNW03XvOH6kOdtuG7TrI2QhKKj\nUvOyb6hE18tOKIZkq+KqbCjfsWoF3qIVYA+s1VA1bZofXRKxb5lM0u8tYs3QcLpuWBqUTVZcslInNx+n\nkles1bQpiOpYyWlTgH1nu66h8lDceir2Z89azWmDiu7olil8/gWRToqyl2yXJIsNVL9WmuteM2yFqDJn\nxeQDL5n6hkaoDKtXrCAV1TQP7qTYcK2+pfO6Vzwz461mUvad5qL9glrs2QOTKGmvWJXhijZZJbpmQh5S\n08Qgsy+wr5mumUw8MymaECgteanvnwkJLaQmHx7Rsm3Dt6wtWboVqcueK/YFVHKVHvA8Fnt6gOiz5bSi\nXjGSj3eBLfIiwTeg1QNPsm+PO6EUv8UkIyvrG+4V+SsAAP//48/9mQEGAAA=`,\n\t\t\tlength: 1537,\n\t\t},\n\t\t\"gopkg.in/ini.v1\": {\n\t\t\tName: \"Apache-2.0\",\n\t\t\tText: `\nH4sIAAAAAAAC/9Ra3ZLbuHK+x1N0VJXKTBUte509Sc6eq1nP+KwSr8Y1kuO4UrkAyaaIGAS4ADga5ulT\n3QBI6sfeTSU3uZkaUSDQv19/3dBdL6sW4YOq0HgU/4rOK2vg7fpNAf8szSDdCG/fvPlRtCH0P71+fTwe\n15LfWVt3eK3je/61EPuHp193cLe9h3eP2/vNfvO43cH7xyf4tHso4Onh49Pj/ad39LjgVfeb3f5p8/Mn\neiLED2u4x0YZFZQ1fi3EKom0At9KraFDaSC0CAFd50GaGipr6rgeGutg8FiAw97ZeqjocUGrRK18cKoc\n6AlIDzUdgzWUI+ywiq//AKF1dji08GewDYRWeahtNXRowiyLdRfCVLYfnTq0AezRoAPrAE1QYQQ5hNY6\n9V/xpJO1Iq4NrQygPBycNEGZAy9KWvOheJAaHni7i4MHQ+qwrAiy4vfzyaYGWmtDi0kchV7wcZU1wVld\ngHSYP2gWsSDZ6elganRQ2a6zJi+BowptFDgeshbvreOz+8H11qOf7Ta5sYBVen/Fgnu4UbfxJXtEV0Ct\nHFYBrBPKxP8LCBYqOXjkdfEha+qgk0YekFxCZ/mhapMwBRxbZGXLUfCJkneNFjgqigvr4Eap2+gm36qe\n9mhUE0bo0VW06c2f3vztLR9kHSbTCjsEH6Spyb6+lQ593kvdQokGG1UpqU/3XchGjvxihxXcWAf0n1vd\nLn0pDZDuz6oeaBcHS68DvqCrlFfmIHp0nfKew5UjJgeW8sug2dnBVbiihOjOY6Z32KBzWMdvG7bpV9Ks\ns7VqVCU5GwpQptIDqSzKIYCxAbTqFJ0YLHjbhCMFiuejoLI1FlO28BbpqyJnaaMOg+NvRKM0cno/lv+J\nVbgUVJoxPnPoB81x3TjbQYdVK42qpIbgpPG0RqbQEPxEp48NSIhm4I0W6sAVdSrb9YpSwLJAUR1xQINO\n0pITxSaNniNOetoh5lmHtZIQxj6q99m6rxdJe7TuK8vH2EDRMoeuMllo6yAaJ4nfyRqFfJZKy1Ln/Fxg\nRUGoRkFUyRQUcoFLxgZV4QQ20RZYC8U5JUMgLGdLTBLeSAP4IrteI73SO/usaqxJRFpz1/doavUCJWp7\nvCVt79GpZxnUMwIp7lfnHqV9/4iuJKZQHkrpySWG06am3Slqne0iftAh7AqK4WOrqpYfY62CdZSODp8V\nO6gQ0hgbcmSjlqV1+VOGiNP45xqCHk1gy0o4tlZzMAvr1EEZqa94cg3fRMTJT+dmEtFKFJHJL7yxj95y\n2EllwGMvHXue9GehO3SoR9DKfGUDlcqQ34WRHd5mVyoT0DWyYkGKU7OdC0LfOrQN+fIdAWiql1f9eB7B\nc3rRGZOJUoqIVKOms2mbU3tTHNa5krP0MsT11l3aLIlaLEI6ENZaI7UewQ9lp0JK7ly3OU5YTmY3KZBp\nP3FenOdCTon0XXRelHjCRT5YWAMltlI3uTif7fydOFlUTrGa9Mi1cwJG2wBqrIKzRlUF2bmUmuPi6OgN\nw8V7MMm+QJEsUlBMBiF7hEWos4X997FSnO5rzUIO6KTS9JpWPvhiWRwmEuFHH7DzkZYp7wckKK+4AqXv\nolOpusRqPzGTpVmLU1UaKgCzPck+tfLV4KlucsipjjEsRehnxiJSD1+ysieaiRxZlTW+V9VgB69H6KT7\nSqC04BVQo1cHw7irDNufTXed8EkPq60NIGGZY+vVMunOOOakZM6c74TjZCJKuWNru7ODoJUeSkQDDitk\nRC3H0xP8UHr8bUAT9CiUqazrbSyDRAAXabMW4u0a/ko8hOz9borxmYrshgjsKfKu0vYLhERZtbAwBlCy\nl6NgxsPg8MUOIImz9RgGivujdbo+KiIhxppX7FOvnvnjq6qV7kBtgR2lDuOrxiEWQjmHz7ZiUJ3TM/Uy\ndEjuIrAg0tRTPF5Apm0K0Q+lVpUeKeB6LccCpic9uljSPD9JhdrUMPUjeIqLRBrFxSnfKpVrIf5+4YCP\nkjDw/5/1b/Clwj5QaviQ04iF8pH430IfVVt4p5NfsYBWPqMgblTEzs82DfEiCx61LtJf1fXWhWj4OWsj\ngUws6nOmJg4FE/d8kux7rQiejR6jHQldkjiVlqrzaS2rUo6R9y/sJyY0M1ih99IpTSncOGUOU2Oo3Ema\n3vhbkNoaTDWosl2pTASmWFKuvJD6sxROwSZSdCpQXiu9mKrLGjYNe1UZH1SgqJwMHtQhIr08SPqaASg1\nmTdzoZCictb7V2wSErqyA3GP+FkZkKDl0Q8qkGIaDxGIZZgFJvgRJ1j1PfBhXI7C+rmHjGUmGn4USYls\n647ZXGgx0pjTmJobqhThmWLPuSEa6xa8JCI0JRV5Bil8U7Wv6WMKo8l+ygP1PfVaiB/X8ITLkcRaCDqy\nk+OMOuc4Udle4XTEt5hRJnFE7ZlkYa2GroixQexAhdYO4bzZ4wL5LUIuJvLPyrOkiNFzjdXaHmP1zJjy\nU9Jm8AEOJBkJEjm2w0r1CglIfk+R2L+AbcTSB39h3jBtH6cEM5ukBoGayzhBcG6kxqVThhwdm6CIMVP0\nfbGDoJ7ywNphfPvsEIdBKlNkxrhoK5kFm/GaF5KhZgcWgsJlqjRFir+CgKhG4hXRDTLMCZBF5ub37Owl\npy4WLCYiVH6TBaktk7geHSlCtonx70KecJwrEC2wWbgo9Sbkl9X2cb9597CCgC+BLUaxn7cjRrmM7Tnj\nxB8xUzR57oQkOJT1VKOzuNdsRJkveaiXkIITMIrKQn7TSOKPGenCyxwRMoBG6QMwWEfx5qToNfVeP2WR\nZJZnttyseb204nWnLDDwJArd+YRCNXPHTnXkIKbicLmrdcUsYCIxMA8/EpGd3xNZ+4YDlqvmM7po8NAq\nV78iNcbJNca6jvsy2fco3Rr2bWwIEhAwc194iqtl7NamCY/Ui16JijHDY/QZ5z5LKTL5gYynsq7pf0eN\n19XcSppfjU1xlsLRll7VjJGSyBQdgKYeusyyTjyc85aT9AxH2Vy555X6qnAVDy6gxFju3MBRIqLCF+Pi\nqzrP3JbJFY9OY4k7H3mQRen1JKZYyEYRpohbnbCw/8EQ3rrTGbxtrkjATV7DbUjiUZdVYZ7FzObkna5P\n/uH81LnmTEywsh2TvDlHFvqcMdKZXP9pDTsiUDyOjf3PTF38WohPRqP3HIj40mtVqaDHuN9yKE26nrGe\nq6MM8c3xBWUonXLe3keCUi6nhZPLxPdagEwSSLRFEMSXI8mq8x3N1gZaPs3H+SqitJH8U2YduIEgPGZx\n/NCj8xgzaE7cvHkj2Pc87go40/CDwxi6Y4pxYv6AL1gNmRzOijs8SMej6wvuS475hzXsc82lz/uF8lBb\nBqwQ6SDME3cyb76S4JINRnboF/XbF8Kje1YVQvxIKqZ4jItzAGZJuSSl1sfhb4NKc3nhUHpruO5xfg0+\n2E66kSVQBmr0lVPl6bwNzqZsImdDXpYgN69bIO5aiH9cw73yzNfR0ZLP0pEJxjmUJxHLMTZGsX/T8shw\nSD5i+jxPQYrZKSlbmaFyBYEbUu2i3ZzWEZE4cd0tWL4rWd3tYLNbwc93u82uEJ83+18eP+3h893T0912\nv3nYwePT8v7x8T3cbb/Av2y29wWgijdiL70jlSinOPvrQkzdzJwBPPeapv4jHKNNmIi7szZ6v9l/eCjE\n9nH7arN9/7TZ/vXh14ftvoBfH57e/XK33d/9vPmw2X/hsHi/2W8fdvFu9A4+3j3tN+8+fbh7go+fnj4+\n7h5iAZPUjlqNmvoC31vjFc+AeR4eO48p5/re2d4pIpWsWAMDz744mmYUXMy/It30fugihXbKM8J6W6mp\n5Yrgmu6giOGcXEJdNklrIf5pDR8mu5EgH5QslY4XYRsqboDPFId0ftzBWNA8xgotWjee3BIE68Ky1TR4\n0OqApsLbYrrpK86u+obfjdibWH891KhVyVxHkEAH6mP1OB0TQFbB3347wiOuncA4Ne0otOLDUj/JTpOd\nPJxOWOm9fO05X4D6HislNS9UNfE6XYgYcWk2p6TO2+UupGolmQIdSKfi3NMzg/aDDucoT3FBEZ6wYOAn\noEzy1BLtYrJ+dyicJSEltY3hd7C2Piod50NfwQfb9/KABdfbgcRspNKDi5VA6mYwM1ng0nNyh13ZrqMg\nXOodD0N/W3BEESM9H79AK73ggaesnxVfKDXp+tl7lZTN17Vp47UQf17DXUXQTApnJKQD7+Z6uAzrzy3x\n1m8l2nca9WJiqlVrLc+2BE+x0jUjT89AQoOc9wVIFkuaCqPYfRxuJWQaOYqwM3wlTj5m4+ksKthSp4kE\n84DXVC6JHcZBt/JcIBIRWmQ1/GKPRPILHixMlmGrLbacteHbd+Lp1sxcNE3veRAXHzO8zeDGMjJzOBn2\nLyYIC9emiR4dophOCk7QmJ9sg2YsoMYGTR3XtlZfqTitdB2jRaaek7WoJAzOzTcQaeInvUfHHVscihWX\nYVcSZFMRJ/FH0nS22kRvj4vAWhAtvQish+09FbBrP6wR4u7jx4ft/ebffiL3cMva93pMF7TL3/TQdyQE\np6IQ+z+4skh3w2ejntIqja7XBJmxUynm4WOjUNce0FTa+oi8pZPVVwweVv/+Hyvi6NQVp/IyptgQDHOp\nq1n0fWu4ubfm7+aRAJ2RN/ybW24ludfyrR10Tbg7HZ048qI0RhQxAfxognyBJl3DcdcZz1zDZwSpvRUO\n4+rUr8m4KkaB98zoYovBZKzP1S5fQZU4XbQD3ycheHpl1TvFg0ZCwxVh9OkNYbqsJ9FQekVFMJom37nF\njlUsO23pqlY9M3IBLG5i3r754Uf4ZL6aozX8VfJyvegJTv1fwOLnX3BDC6ZfYd3+hbbIDJySNJaINNrM\nZFaZ1FIxSE2BMREEgAklbMnDFrmc7kyRKAOLDPA7Pzv7sHn3sN09vHq7fsMv/C/Yav5dC22znMxc/N4C\nlD9ZcJWZAsD/ETllo+0QT0TIwctkoVEVaGkOgzwgHOwzOqaGS7JGLQHAgtP6S73W4r8DAAD//xIOvKQN\nKAAA`,\n\t\t\tlength: 10253,\n\t\t},\n\t\t\"mvdan.cc/sh/expand\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwW7jNheF93yKg1lNfgj52y666KxoibYIyKJKUvF4qUj0mIAlGiSdIA/Vp+iLFWSc\n2tMW6KIrEeLlved895Tu/Obtt2PE5/EBP/3w488FqmGx5oTt4OPvvz2Cnk7IJQHeBONfzPRIiDSTDdHb\n50u0bsGwTLgEA7sguIsfTf7zbJfBv+Hg/BwKvNp4hPP56y6RzG6yBzsOqUGBwRucjZ9tjGbC2bsXO5kJ\n8ThExKPBwZ1O7tUu3zC6ZbLpUUiPyGziL4QA+B++FxXgDh9qRjcZzJcQ4U0c7JJbDs/uJV1dEZDFRTua\nAvFoA042xNTgftoy/UXKZMN4Guxs/OM/K7DLPYQPBWfvpstobiLInyLwX0SQq7HJjZfZLHH42M3/nYeL\nR+MxD9F4O5zCDXHeSzwaci/96qc1Nj9LXZdhNklMOt/0Ht1pMh6LuxVl8DYGMrrlvaHzAfPwhmeTUjIh\nOphlcj6YFIizd7OLBu9YYsBkvH0xEw7ezSSDCO4QX1NEruFBOJsxpQdnb1OmfMrN8p6gELIBomuuoMRa\n76hk4AqdFE+8YhVWe+iaoRTdXvJNrVGLpmJSgbYVStFqyVe9FlKRT1SBq0/5grZ7sK+dZEpBSPBt13BW\nYUelpK3mTBXgbdn0FW83BVa9Ris0afiWa1ZBiyIP/fsziDW2TJY1bTVd8YbrfZ635rpNs9ZCEoqOSs3L\nvqESXS87oRiSrYqrsqF8y6pH8BatAHtirYaqadN875KIXctkkn5vESuGhtNVw9KgbLLikpU6ubmdSl6x\nVtOmIKpjJadNAfaVbbuGyn1x7anYrz1rNacNKrqlG6bw+V+IdFKUvWTbJFmsofqV0lz3mmEjRJU5Kyaf\neMnUFzRCZVi9YgWpqKZ5cCfFmmv1JZ1XveKZGW81k7LvNBftA2qxY09MoqS9YlWGK9pkleiaCblPTROD\nzL7Arma6ZjLxzKRoQqC05KW+LxMSWkhNbh7Rsk3DN6wtWboVqcuOK/YAKrlKBTyPxY7uIfpsOa2oV4zk\n411gi7xI8DVo9cST7GtxJ5Ti15hkZGV9xf1I/ggAAP//Rs5lGNAFAAA=`,\n\t\t\tlength: 1488,\n\t\t},\n\t\t\"mvdan.cc/sh/interp\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwW7jNheF93yKg1lNfgj52y666KxoibYIyKJKUvF4qUj0mIAlGiSdIA/Vp+iLFWSc\n2tMW6KIrEeLlved895Tu/Obtt2PE5/EBP/3w488FqmGx5oTt4OPvvz2Cnk7IJQHeBONfzPRIiDSTDdHb\n50u0bsGwTLgEA7sguIsfTf7zbJfBv+Hg/BwKvNp4hPP56y6RzG6yBzsOqUGBwRucjZ9tjGbC2bsXO5kJ\n8ThExKPBwZ1O7tUu3zC6ZbLpUUiPyGziL4QA+B++FxXgDh9qRjcZzJcQ4U0c7JJbDs/uJV1dEZDFRTua\nAvFoA042xNTgftoy/UXKZMN4Guxs/OM/K7DLPYQPBWfvpstobiLInyLwX0SQq7HJjZfZLHH42M3/nYeL\nR+MxD9F4O5zCDXHeSzwaci/96qc1Nj9LXZdhNklMOt/0Ht1pMh6LuxVl8DYGMrrlvaHzAfPwhmeTUjIh\nOphlcj6YFIizd7OLBu9YYsBkvH0xEw7ezSSDCO4QX1NEruFBOJsxpQdnb1OmfMrN8p6gELIBomuuoMRa\n76hk4AqdFE+8YhVWe+iaoRTdXvJNrVGLpmJSgbYVStFqyVe9FlKRT1SBq0/5grZ7sK+dZEpBSPBt13BW\nYUelpK3mTBXgbdn0FW83BVa9Ris0afiWa1ZBiyIP/fsziDW2TJY1bTVd8YbrfZ635rpNs9ZCEoqOSs3L\nvqESXS87oRiSrYqrsqF8y6pH8BatAHtirYaqadN875KIXctkkn5vESuGhtNVw9KgbLLikpU6ubmdSl6x\nVtOmIKpjJadNAfaVbbuGyn1x7anYrz1rNacNKrqlG6bw+V+IdFKUvWTbJFmsofqV0lz3mmEjRJU5Kyaf\neMnUFzRCZVi9YgWpqKZ5cCfFmmv1JZ1XveKZGW81k7LvNBftA2qxY09MoqS9YlWGK9pkleiaCblPTROD\nzL7Arma6ZjLxzKRoQqC05KW+LxMSWkhNbh7Rsk3DN6wtWboVqcuOK/YAKrlKBTyPxY7uIfpsOa2oV4zk\n411gi7xI8DVo9cST7GtxJ5Ti15hkZGV9xf1I/ggAAP//Rs5lGNAFAAA=`,\n\t\t\tlength: 1488,\n\t\t},\n\t\t\"mvdan.cc/sh/syntax\": {\n\t\t\tName: \"NewBSD\",\n\t\t\tText: `\nH4sIAAAAAAAC/6SSwW7jNheF93yKg1lNfgj52y666KxoibYIyKJKUvF4qUj0mIAlGiSdIA/Vp+iLFWSc\n2tMW6KIrEeLlved895Tu/Obtt2PE5/EBP/3w488FqmGx5oTt4OPvvz2Cnk7IJQHeBONfzPRIiDSTDdHb\n50u0bsGwTLgEA7sguIsfTf7zbJfBv+Hg/BwKvNp4hPP56y6RzG6yBzsOqUGBwRucjZ9tjGbC2bsXO5kJ\n8ThExKPBwZ1O7tUu3zC6ZbLpUUiPyGziL4QA+B++FxXgDh9qRjcZzJcQ4U0c7JJbDs/uJV1dEZDFRTua\nAvFoA042xNTgftoy/UXKZMN4Guxs/OM/K7DLPYQPBWfvpstobiLInyLwX0SQq7HJjZfZLHH42M3/nYeL\nR+MxD9F4O5zCDXHeSzwaci/96qc1Nj9LXZdhNklMOt/0Ht1pMh6LuxVl8DYGMrrlvaHzAfPwhmeTUjIh\nOphlcj6YFIizd7OLBu9YYsBkvH0xEw7ezSSDCO4QX1NEruFBOJsxpQdnb1OmfMrN8p6gELIBomuuoMRa\n76hk4AqdFE+8YhVWe+iaoRTdXvJNrVGLpmJSgbYVStFqyVe9FlKRT1SBq0/5grZ7sK+dZEpBSPBt13BW\nYUelpK3mTBXgbdn0FW83BVa9Ris0afiWa1ZBiyIP/fsziDW2TJY1bTVd8YbrfZ635rpNs9ZCEoqOSs3L\nvqESXS87oRiSrYqrsqF8y6pH8BatAHtirYaqadN875KIXctkkn5vESuGhtNVw9KgbLLikpU6ubmdSl6x\nVtOmIKpjJadNAfaVbbuGyn1x7anYrz1rNacNKrqlG6bw+V+IdFKUvWTbJFmsofqV0lz3mmEjRJU5Kyaf\neMnUFzRCZVi9YgWpqKZ5cCfFmmv1JZ1XveKZGW81k7LvNBftA2qxY09MoqS9YlWGK9pkleiaCblPTROD\nzL7Arma6ZjLxzKRoQqC05KW+LxMSWkhNbh7Rsk3DN6wtWboVqcuOK/YAKrlKBTyPxY7uIfpsOa2oV4zk\n411gi7xI8DVo9cST7GtxJ5Ti15hkZGV9xf1I/ggAAP//Rs5lGNAFAAA=`,\n\t\t\tlength: 1488,\n\t\t},\n\t}\n\n\tdecode := func(input string, length int64) (string, error) {\n\t\tdata := &bytes.Buffer{}\n\t\tbr := base64.NewDecoder(base64.StdEncoding, strings.NewReader(input))\n\n\t\tr, err := gzip.NewReader(br)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t_, err = io.CopyN(data, r, length)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// Make sure the gzip is decoded successfully\n\t\terr = r.Close()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn data.String(), nil\n\t}\n\n\tret := make(map[string]pawndLicense)\n\n\tfor k := range data {\n\t\ttext, err := decode(data[k].Text, data[k].length)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tret[k] = pawndLicense{\n\t\t\tName: data[k].Name,\n\t\t\tText: text,\n\t\t}\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "a27199daf33e497c63fbe590cdc9992b", "score": "0.46219194", "text": "func (i *Identity) Issue(template Template) (*Identity, error) {\n\n\tkey, err := rsa.GenerateKey(rand.Reader, 4096)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error generating private key for [%s]\", template.Subject.CommonName)\n\t}\n\n\tcertificate, err := sign(template.certificate(), i.Certificate, &key.PublicKey, i.Key)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error signing certificate for [%s]\", template.Subject.CommonName)\n\t}\n\n\treturn NewIdentity(append([]*x509.Certificate{i.Certificate}, i.Authorities...), certificate, key), nil\n}", "title": "" }, { "docid": "231d787ba147b678e3e150d2c3f27716", "score": "0.46203053", "text": "func (ca *CA) IssueClient(name, curve string, rsaBits int) (cert, key []byte, err error) {\n\treturn GenerateCert(ca, name, \"\", 10*365*24*time.Hour, false, rsaBits, curve, x509.ExtKeyUsageClientAuth)\n}", "title": "" }, { "docid": "77ef44ee58240f1fabb8f09939c60714", "score": "0.46170607", "text": "func (p *BitcoinClient) IssueNewAsset(ctx context.Context, changeAddress string, outputs common.SpendInfo, request common.IssuanceRequest, addressInfo common.GetAddressInfo, blindTransaction bool) (common.IssuanceResponse, error) {\n\tlog := logger.Logger(ctx).WithField(\"Method\", \"bitcoin.IssueNewAsset\")\n\n\tcryptoMode := common.CryptoModeFromContext(ctx)\n\tlog = log.WithField(\"CryptoMode\", cryptoMode)\n\n\tclient := p.client\n\tif p.client == nil {\n\t\treturn common.IssuanceResponse{}, ErrInternalError\n\t}\n\n\tanswer := common.IssuanceResponse{\n\t\tChain: request.Chain,\n\t\tIssuerID: request.IssuerID,\n\t}\n\n\t// We create 2 LBTC outputs, which might be a bit unnecessary\n\thex, err := commands.CreateRawTransaction(ctx, client.Client, nil, []commands.SpendInfo{\n\t\t{Address: outputs.PublicAddress, Amount: outputs.Amount},\n\t}, nil)\n\tif err != nil {\n\t\tlog.WithError(err).\n\t\t\tError(\"CreateRawTransaction failed\")\n\t\treturn common.IssuanceResponse{}, ErrRPCError\n\t}\n\n\tfunded, err := commands.FundRawTransactionWithOptions(ctx,\n\t\tclient.Client,\n\t\thex,\n\t\tcommands.FundRawTransactionOptions{\n\t\t\tChangeAddress: changeAddress,\n\t\t\tIncludeWatching: true,\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.WithError(err).\n\t\t\tError(\"FundRawTransaction failed\")\n\t\treturn common.IssuanceResponse{}, ErrRPCError\n\t}\n\n\tvar issued commands.IssuedTransaction\n\tswitch request.Mode {\n\tcase common.AssetIssuanceModeWithAsset:\n\t\tassetAddress := request.AssetPublicAddress\n\t\tassetAmount := request.AssetIssuedAmount\n\t\ttx := commands.Transaction(funded.Hex)\n\t\tissued, err = commands.RawIssueAssetWithAsset(ctx, client.Client, tx, assetAddress, assetAmount)\n\t\tif err != nil {\n\t\t\treturn common.IssuanceResponse{}, err\n\t\t}\n\tcase common.AssetIssuanceModeWithToken:\n\t\tassetAddress := request.AssetPublicAddress\n\t\tassetAmount := request.AssetIssuedAmount\n\t\ttokenAddress := request.TokenPublicAddress\n\t\ttokenAmount := request.TokenIssuedAmount\n\t\ttx := commands.Transaction(funded.Hex)\n\t\tissued, err = commands.RawIssueAssetWithToken(ctx, client.Client, tx, assetAddress, assetAmount, tokenAddress, tokenAmount)\n\t\tif err != nil {\n\t\t\treturn common.IssuanceResponse{}, err\n\t\t}\n\tcase common.AssetIssuanceModeWithContract:\n\t\tassetAddress := request.AssetPublicAddress\n\t\tassetAmount := request.AssetIssuedAmount\n\t\tcontractHash := request.ContractHash\n\t\ttx := commands.Transaction(funded.Hex)\n\t\tissued, err = commands.RawIssueAssetWithContract(ctx, client.Client, tx, assetAddress, assetAmount, contractHash)\n\t\tif err != nil {\n\t\t\treturn common.IssuanceResponse{}, err\n\t\t}\n\tcase common.AssetIssuanceModeWithTokenWithContract:\n\t\tassetAddress := request.AssetPublicAddress\n\t\tassetAmount := request.AssetIssuedAmount\n\t\ttokenAddress := request.TokenPublicAddress\n\t\ttokenAmount := request.TokenIssuedAmount\n\t\tcontractHash := request.ContractHash\n\t\ttx := commands.Transaction(funded.Hex)\n\t\tissued, err = commands.RawIssueAssetWithTokenWithContract(ctx, client.Client, tx, assetAddress, assetAmount, tokenAddress, tokenAmount, contractHash)\n\t\tif err != nil {\n\t\t\treturn common.IssuanceResponse{}, err\n\t\t}\n\t}\n\n\t// blind transaction if required\n\ttxToSign := issued.Hex\n\tif blindTransaction {\n\t\tblinded, err := commands.BlindRawTransaction(ctx, client.Client, commands.Transaction(txToSign))\n\t\tif err != nil {\n\t\t\tlog.WithError(err).\n\t\t\t\tError(\"BlindRawTransaction failed\")\n\t\t\treturn common.IssuanceResponse{}, err\n\t\t}\n\n\t\ttxToSign = string(blinded)\n\t}\n\n\t// Sign transaction\n\tsigned, err := signRawTransactionWithCryptoMode(ctx, client.Client, cryptoMode, txToSign, addressInfo, blindTransaction)\n\tif err != nil {\n\t\tlog.WithError(err).\n\t\t\tWithField(\"TxToSign\", txToSign).\n\t\t\tError(\"signRawTransactionWithCryptoMode failed\")\n\t\treturn common.IssuanceResponse{}, err\n\t}\n\tif !signed.Complete {\n\t\tlog.Error(\"signRawTransactionWithCryptoMode not Complete\")\n\t\treturn common.IssuanceResponse{}, err\n\t}\n\n\t// Broadcast transaction to network\n\ttx, err := commands.SendRawTransaction(ctx, client.Client, commands.Transaction(signed.Hex))\n\tif err != nil {\n\t\tlog.WithError(err).\n\t\t\tError(\"SendRawTransaction failed\")\n\t\treturn common.IssuanceResponse{}, err\n\t}\n\n\t// Update\n\tanswer.AssetID = issued.Asset\n\tanswer.TokenID = issued.Token\n\tanswer.Entropy = issued.Entropy\n\tanswer.TxID = string(tx)\n\n\tlog.\n\t\tWithFields(logrus.Fields{\n\t\t\t\"Asset ID\": answer.AssetID,\n\t\t\t\"Token ID\": answer.TokenID,\n\t\t\t\"Issuance Tx ID\": answer.TxID,\n\t\t}).Info(\"New asset issued\")\n\n\t// return IssuanceResponse completed with all the data about first issuance Tx\n\treturn answer, nil\n}", "title": "" }, { "docid": "e50ad01b7802d946551e4bafb1552f27", "score": "0.46150398", "text": "func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) (err error) {\n\tsess := x.NewSession()\n\tdefer sess.Close()\n\tif err = sess.Begin(); err != nil {\n\t\treturn err\n\t}\n\n\tif err = newIssue(sess, NewIssueOptions{\n\t\tRepo: repo,\n\t\tIssue: issue,\n\t\tLableIDs: labelIDs,\n\t\tAttachments: uuids,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"newIssue: %v\", err)\n\t}\n\n\tif err = sess.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"Commit: %v\", err)\n\t}\n\n\tif err = NotifyWatchers(&Action{\n\t\tActUserID: issue.Poster.ID,\n\t\tActUserName: issue.Poster.Name,\n\t\tOpType: ActionCreateIssue,\n\t\tContent: fmt.Sprintf(\"%d|%s\", issue.Index, issue.Title),\n\t\tRepoID: repo.ID,\n\t\tRepoUserName: repo.Owner.Name,\n\t\tRepoName: repo.Name,\n\t\tIsPrivate: repo.IsPrivate,\n\t}); err != nil {\n\t\tlog.Error(\"NotifyWatchers: %v\", err)\n\t}\n\tif err = issue.MailParticipants(); err != nil {\n\t\tlog.Error(\"MailParticipants: %v\", err)\n\t}\n\n\tif err = PrepareWebhooks(repo, HOOK_EVENT_ISSUES, &api.IssuesPayload{\n\t\tAction: api.HOOK_ISSUE_OPENED,\n\t\tIndex: issue.Index,\n\t\tIssue: issue.APIFormat(),\n\t\tRepository: repo.APIFormatLegacy(nil),\n\t\tSender: issue.Poster.APIFormat(),\n\t}); err != nil {\n\t\tlog.Error(\"PrepareWebhooks: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90c5aac5714cad2d69be88d3e74ba278", "score": "0.46123612", "text": "func (f *FakeClient) CreateIssue(org, repo, title, body string, milestone int, labels, assignees []string) (int, error) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\tf.IssueID++\n\tif f.Issues == nil {\n\t\tf.Issues = make(map[int]*github.Issue)\n\t}\n\tvar ls []github.Label\n\tfor _, l := range labels {\n\t\tls = append(ls, github.Label{Name: l})\n\t}\n\tvar as []github.User\n\tfor _, a := range assignees {\n\t\tas = append(as, github.User{Name: a})\n\t}\n\tnew := &github.Issue{\n\t\tID: f.IssueID,\n\t\tTitle: title,\n\t\tBody: body,\n\t\tMilestone: github.Milestone{Number: milestone},\n\t\tLabels: ls,\n\t\tAssignees: as,\n\t}\n\tf.Issues[f.IssueID] = new\n\tf.IssueComments[f.IssueID] = make([]github.IssueComment, 0)\n\treturn new.ID, nil\n}", "title": "" }, { "docid": "ea9f0ea1e2ca26a18853d8e436507ff5", "score": "0.46091324", "text": "func newLicenseMutation(c config, op Op, opts ...licenseOption) *LicenseMutation {\n\tm := &LicenseMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeLicense,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "94200443a2368721ddc5ac460406f041", "score": "0.4597918", "text": "func generateCredentials(t *testing.T, accessKey string, date string, region, service, requestVersion string) credentialHeader {\n\tcred := credentialHeader{\n\t\taccessKey: accessKey,\n\t}\n\tparsedDate, err := time.Parse(yyyymmdd, date)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to parse date\")\n\t}\n\tcred.scope.date = parsedDate\n\tcred.scope.region = region\n\tcred.scope.service = service\n\tcred.scope.request = requestVersion\n\n\treturn cred\n}", "title": "" }, { "docid": "b4495555e6e53d82cbbce3defee4063b", "score": "0.45975256", "text": "func (a *DefaultApiService) GetLicence(ctx _context.Context) (Licence, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Licence\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/cluster/licence\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 503 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "629dbafc40548ddb0aca4b5ec3c6dbeb", "score": "0.45920637", "text": "func (r *IOSVPPAppAssignedLicensesCollectionRequest) Add(ctx context.Context, reqObj *IOSVPPAppAssignedLicense) (resObj *IOSVPPAppAssignedLicense, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "title": "" }, { "docid": "5e68cc10ff7fcb444d80c013264f6248", "score": "0.45747122", "text": "func (client *MultipleResponsesClient) get202None204NoneDefaultNone204NoneCreateRequest(ctx context.Context, options *MultipleResponsesClientGet202None204NoneDefaultNone204NoneOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/202/none/204/none/default/none/response/204/none\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "fc2539ad38f8dc8f7fbf4f2b0099bcca", "score": "0.45743996", "text": "func (c *Client) Issue(credential json.RawMessage, options *ProofOptions) (json.RawMessage, error) {\n\t// TODO to be added #2433\n\treturn nil, fmt.Errorf(\"to be implemented\")\n}", "title": "" }, { "docid": "2a5589fd5d898b057c96b3cdb8129900", "score": "0.4574051", "text": "func (h *handler) CreateIssue(writer http.ResponseWriter, request *http.Request) {\n\tissue, err := issueFromRequest(request)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar createdIssue *entity.Issue\n\tif err := h.store.ReadWrite(\n\t\trequest.Context(),\n\t\tfunc(tx store.ReadWriteTx) error {\n\t\t\tcreatedIssue, err = h.controller.CreateIssue(tx, issue)\n\t\t\treturn err\n\t\t},\n\t); err != nil {\n\t\t// TODO: We need to correctly handle error codes here.\n\t\t// Not all errors should be handled as internal\n\t\t// server errors.\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif err := writeIssue(writer, createdIssue); err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "0db291997983b173d13c74f783accf47", "score": "0.45719758", "text": "func NewHeader(kvs ...string) Header {\n\tif len(kvs)%2 == 1 {\n\t\tpanic(\"twister: even number args required for NewHeader\")\n\t}\n\tm := Header{}\n\tfor i := 0; i < len(kvs); i += 2 {\n\t\tm.Add(kvs[i], kvs[i+1])\n\t}\n\treturn m\n}", "title": "" }, { "docid": "fc1cd01c9689ee66e70cc22083137e0b", "score": "0.4569041", "text": "func createOrder(w http.ResponseWriter, r *http.Request) error {\n\ttype Message struct {\n\t\tOrder Order\n\t\tCustomer Customer\n\t}\n\tvar msg Message\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&msg)\n\tif err != nil {\n\t\treturn BadRequest{err.Error()}\n\t}\n\n\ttotalAmount := strconv.FormatFloat(msg.Order.Price, 'f', -1, 64)\n\tshippingAmount := strconv.FormatFloat(msg.Order.ShippingCosts, 'f', -1, 64)\n\n\torderData := []KeyValuePair{\n\t\tKeyValuePair{\"total_amount\", totalAmount},\n\t\tKeyValuePair{\"billing_account_id\", msg.Customer.ID},\n\t\tKeyValuePair{\"shipping_amount\", shippingAmount},\n\t\tKeyValuePair{\"name\", \"GENERATED BY API\"},\n\t\tKeyValuePair{\"status\", \"Unpaid\"},\n\t}\n\n\torderResponse, err := crmSetEntry(\"AOS_Invoices\", orderData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar orderMap map[string]interface{}\n\terr = json.Unmarshal(orderResponse, &orderMap)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\torderID, ok := orderMap[\"id\"]\n\tif !ok {\n\t\treturn errors.New(\"Unable to acquire order id\")\n\t}\n\n\tmsg.Order.ID = orderID.(string)\n\tjson.NewEncoder(w).Encode(msg.Order)\n\n\treturn nil\n}", "title": "" }, { "docid": "ca05af78bb40eb21f7f56350330074b5", "score": "0.45657504", "text": "func (client *MultipleResponsesClient) get202None204NoneDefaultNone400NoneCreateRequest(ctx context.Context, options *MultipleResponsesClientGet202None204NoneDefaultNone400NoneOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/202/none/204/none/default/none/response/400/none\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "a70b3fbfb36d60cc2a318661449b6516", "score": "0.4558999", "text": "func (o *IssueLicenseParams) WithContext(ctx context.Context) *IssueLicenseParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "be37e0c8ccbd25a9d481e252697e0d81", "score": "0.45532584", "text": "func NewLicense(ctx *pulumi.Context,\n\tname string, args *LicenseArgs, opts ...pulumi.ResourceOption) (*License, error) {\n\tif args == nil || args.LicenseKey == nil {\n\t\treturn nil, errors.New(\"missing required argument 'LicenseKey'\")\n\t}\n\tif args == nil {\n\t\targs = &LicenseArgs{}\n\t}\n\tvar resource License\n\terr := ctx.RegisterResource(\"vsphere:index/license:License\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "dc0cb527f99ec690d909b457e52200ab", "score": "0.45480216", "text": "func newRequestWithHeaders(method, url string, headers ...string) *http.Request {\n\treq := newRequest(method, url)\n\n\tif len(headers)%2 != 0 {\n\t\tpanic(fmt.Sprintf(\"Expected headers length divisible by 2 but got %v\", len(headers)))\n\t}\n\n\tfor i := 0; i < len(headers); i += 2 {\n\t\treq.Header.Set(headers[i], headers[i+1])\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "76665570bbfa3f0d61acfe8635f831a8", "score": "0.45425075", "text": "func newOracleOptions() oracleOptions {\n\treturn oracleOptions{\n\t\tsigner: \"creator\",\n\t}\n}", "title": "" }, { "docid": "15a5f8297c192fe850edaf91a8d2a306", "score": "0.45351756", "text": "func CreateGetDataSetOssHeaderRequest() (request *GetDataSetOssHeaderRequest) {\n\trequest = &GetDataSetOssHeaderRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Qualitycheck\", \"2019-01-15\", \"GetDataSetOssHeader\", \"\", \"\")\n\treturn\n}", "title": "" }, { "docid": "18438d0e31f48b9d7f664aa80254f637", "score": "0.4530282", "text": "func newPKI(stdout io.Writer, options *validateOpts) (*install.LocalPKI, error) {\n\tansibleDir := \"ansible\"\n\tif options.generatedAssetsDir == \"\" {\n\t\treturn nil, fmt.Errorf(\"GeneratedAssetsDirectory option cannot be empty\")\n\t}\n\tcertsDir := filepath.Join(options.generatedAssetsDir, \"keys\")\n\tpki := &install.LocalPKI{\n\t\tCACsr: filepath.Join(ansibleDir, \"playbooks\", \"tls\", \"ca-csr.json\"),\n\t\tGeneratedCertsDirectory: certsDir,\n\t\tLog: stdout,\n\t}\n\treturn pki, nil\n}", "title": "" }, { "docid": "377cc340830155ab4bc19c0d8088ebb1", "score": "0.45281208", "text": "func (client *AuthorizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, options *AuthorizationsClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateCloudName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateCloudName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateCloudName}\", url.PathEscape(privateCloudName))\n\tif authorizationName == \"\" {\n\t\treturn nil, errors.New(\"parameter authorizationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{authorizationName}\", url.PathEscape(authorizationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e28e7738c92b686ffe223dfd1fac8d65", "score": "0.4526528", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.4.1\")\n\treturn req, nil\n}", "title": "" }, { "docid": "5613123f0b6ca1470d3b49d9c0e0648a", "score": "0.45241234", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.3.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "407361532f8c949d4cd8040fda422db3", "score": "0.45227548", "text": "func createOrderbookRequest(bType, bCode, bIssuer, cType, cCode, cIssuer string) horizonclient.OrderBookRequest {\n\tr := horizonclient.OrderBookRequest{\n\t\tSellingAssetType: horizonclient.AssetType(bType),\n\t\tBuyingAssetType: horizonclient.AssetType(cType),\n\t\t// NOTE (Alex C, 2019-05-02):\n\t\t// Orderbook requests are currently not paginated on Horizon.\n\t\t// This limit has been added to ensure we capture at least 200\n\t\t// orderbook entries once pagination is added.\n\t\tLimit: 200,\n\t}\n\n\t// The Horizon API requires *AssetCode and *AssetIssuer fields to be empty\n\t// when an Asset is native. As we store \"XLM\" as the asset code for native,\n\t// we should only add Code and Issuer info in case we're dealing with\n\t// non-native assets.\n\t// See: https://developers.stellar.org/api/aggregations/order-books/single/\n\tif bType != string(horizonclient.AssetTypeNative) {\n\t\tr.SellingAssetCode = bCode\n\t\tr.SellingAssetIssuer = bIssuer\n\t}\n\tif cType != string(horizonclient.AssetTypeNative) {\n\t\tr.BuyingAssetCode = cCode\n\t\tr.BuyingAssetIssuer = cIssuer\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "a8116534c86e9300fbc37cc800e017a0", "score": "0.45175618", "text": "func newErrCode(statusCode int, extraCode int32) errCode {\n\tcodeLabels = append(codeLabels, statusCode)\n\tif extraCode == 0 {\n\t\textraCode = int32(statusCode)\n\t}\n\treturn errCode{status: statusCode, extra: extraCode}\n}", "title": "" }, { "docid": "3f194d68b104cd8f5b95501880c9b2e9", "score": "0.4515482", "text": "func NewGetAuthorizationTokenRequestWithoutParam() *GetAuthorizationTokenRequest {\n\n return &GetAuthorizationTokenRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/registries/{registryName}:getAuthorizationToken\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "f05b4dadd4b2d0f2a98f4a8e3e93b6a8", "score": "0.45144814", "text": "func release(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tio.WriteString(w, \"<h3>Creating Inventory ...<h3>\")\n\n\tif len(sdkDir) > 0 {\n\t\tfiles, err := ioutil.ReadDir(sdkDir)\n\t\tcheck(err)\n\n\t\tbom, err := os.Create(sdkDir + \"/AV-Inventory.bom\")\n\t\tcheck(err)\n\n//\t\tif err != nil {\n\t\t\tfor _, f := range files {\n\t\t\t\tname := f.Name()\n\t\t\t\tif (len(name) >= 4) && (name[0]|0x20 == 'a') && (name[1]|0x20 == 'v') && (name[2] == '-') {\n\t\t\t\t\tchksum := createMD5(sdkDir+\"/\"+name, true)\n\t\t\t\t\tfmt.Fprintf(bom, \"%X\\t%s\\n\", chksum.Sum(nil), name)\n\t\t\t\t\tio.WriteString(w, name+\"<br>\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tbom.Close()\n\t\t\tio.WriteString(w, \"<h3>done</h3>\")\n\n//\t\t} else {\n//\t\t\tio.WriteString(w, \" ERROR</h3>\")\n//\t\t}\n\t}\n}", "title": "" }, { "docid": "061b08354635567a7d86215c6a61afcb", "score": "0.4513265", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.5.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "680ac181884a2d7d2fba4c570e0cee6b", "score": "0.45094728", "text": "func (client *MultipleResponsesClient) get202None204NoneDefaultNone400InvalidCreateRequest(ctx context.Context, options *MultipleResponsesClientGet202None204NoneDefaultNone400InvalidOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/202/none/204/none/default/none/response/400/invalid\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "3882cba7834d9a4e8cd4beafa1885e44", "score": "0.45065185", "text": "func (client *APITagDescriptionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, tagDescriptionID string, parameters TagDescriptionCreateParameters, options *APITagDescriptionClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif apiID == \"\" {\n\t\treturn nil, errors.New(\"parameter apiID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{apiId}\", url.PathEscape(apiID))\n\tif tagDescriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter tagDescriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tagDescriptionId}\", url.PathEscape(tagDescriptionID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.IfMatch != nil {\n\t\treq.Raw().Header[\"If-Match\"] = []string{*options.IfMatch}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "03fbc431835e66fc3d8613cd5a1c23e3", "score": "0.45058075", "text": "func NewIssue(repo *models.Repository, issue *models.Issue, labelIDs []int64, assigneeIDs []int64, uuids []string) error {\n\tif err := models.NewIssue(repo, issue, labelIDs, assigneeIDs, uuids); err != nil {\n\t\treturn err\n\t}\n\n\tif err := models.NotifyWatchers(&models.Action{\n\t\tActUserID: issue.Poster.ID,\n\t\tActUser: issue.Poster,\n\t\tOpType: models.ActionCreateIssue,\n\t\tContent: fmt.Sprintf(\"%d|%s\", issue.Index, issue.Title),\n\t\tRepoID: repo.ID,\n\t\tRepo: repo,\n\t\tIsPrivate: repo.IsPrivate,\n\t}); err != nil {\n\t\tlog.Error(\"NotifyWatchers: %v\", err)\n\t}\n\n\tmode, _ := models.AccessLevel(issue.Poster, issue.Repo)\n\tif err := models.PrepareWebhooks(repo, models.HookEventIssues, &api.IssuePayload{\n\t\tAction: api.HookIssueOpened,\n\t\tIndex: issue.Index,\n\t\tIssue: issue.APIFormat(),\n\t\tRepository: repo.APIFormat(mode),\n\t\tSender: issue.Poster.APIFormat(),\n\t}); err != nil {\n\t\tlog.Error(\"PrepareWebhooks: %v\", err)\n\t} else {\n\t\tgo models.HookQueue.Add(issue.RepoID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "26042211c7c84e24fa3e2c2279992ba1", "score": "0.44954497", "text": "func NewCreateIssuanceRequestSuccessExt(v LedgerVersion, value interface{}) (result CreateIssuanceRequestSuccessExt, err error) {\n\tresult.V = v\n\tswitch LedgerVersion(v) {\n\tcase LedgerVersionEmptyVersion:\n\t\t// void\n\t}\n\treturn\n}", "title": "" }, { "docid": "6240a4a7945660b2460335f0c4a902e0", "score": "0.44885597", "text": "func (client *KeyVaultClient) releaseCreateRequest(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyReleaseParameters, options *KeyVaultClientReleaseOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/keys/{key-name}/{key-version}/release\"\n\tif keyName == \"\" {\n\t\treturn nil, errors.New(\"parameter keyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{key-name}\", url.PathEscape(keyName))\n\t// if keyVersion == \"\" {\n\t// \treturn nil, errors.New(\"parameter keyVersion cannot be empty\")\n\t// }\n\turlPath = strings.ReplaceAll(urlPath, \"{key-version}\", url.PathEscape(keyVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.3-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "80f334ae0ec7cfb83cc67e589477bbb5", "score": "0.44816086", "text": "func createAuthorizationHeader(e *ESI) string {\n\treturn \"Basic \" + base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(\"%s:%s\", e.ClientID, e.ClientSecret)))\n}", "title": "" }, { "docid": "aab2853f1294b8ac9173bd2d6ef2f8b9", "score": "0.44774923", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\tif headers, ok := HTTPRequestHeaders(ctx); ok {\n\t\tfor k := range headers {\n\t\t\tfor _, v := range headers[k] {\n\t\t\t\treq.Header.Add(k, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "fbd8a35cd5ced15f4964fbefad40823c", "score": "0.44741562", "text": "func newSignedGetRequest(apiURL, service, region string, creds *credentials) (*http.Request, error) {\n\treturn newSignedGetRequestWithTime(apiURL, service, region, creds, time.Now().UTC())\n}", "title": "" }, { "docid": "2a5f21b9e04d5ceb4657bf258df3370d", "score": "0.44633204", "text": "func (t *SimpleChaincode) issueCommercialPaper(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\t/*\t\t0\n\t\tjson\n\t \t{\n\t\t\t\"ticker\": \"string\",\n\t\t\t\"par\": 0.00,\n\t\t\t\"qty\": 10,\n\t\t\t\"discount\": 7.5,\n\t\t\t\"maturity\": 30,\n\t\t\t\"owners\": [ // This one is not required\n\t\t\t\t{\n\t\t\t\t\t\"company\": \"company1\",\n\t\t\t\t\t\"quantity\": 5\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"company\": \"company3\",\n\t\t\t\t\t\"quantity\": 3\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"company\": \"company4\",\n\t\t\t\t\t\"quantity\": 2\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"issuer\":\"company2\",\n\t\t\t\"issueDate\":\"1456161763790\" (current time in milliseconds as a string)\n\n\t\t}\n\t*/\n\t//need one arg\n\tif len(args) != 1 {\n\t\tfmt.Println(\"error invalid arguments\")\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting commercial paper record\")\n\t}\n\n\tvar cp CP\n\tvar err error\n\tvar account Account\n\n\tfmt.Println(\"Unmarshalling CP\")\n\terr = json.Unmarshal([]byte(args[0]), &cp)\n\tif err != nil {\n\t\tfmt.Println(\"error invalid paper issue\")\n\t\treturn nil, errors.New(\"Invalid commercial paper issue\")\n\t}\n\n\t//generate the CUSIP\n\t//get account prefix\n\tfmt.Println(\"Getting state of - \" + accountPrefix + cp.Issuer)\n\taccountBytes, err := stub.GetState(accountPrefix + cp.Issuer)\n\tif err != nil {\n\t\tfmt.Println(\"Error Getting state of - \" + accountPrefix + cp.Issuer)\n\t\treturn nil, errors.New(\"Error retrieving account \" + cp.Issuer)\n\t}\n\terr = json.Unmarshal(accountBytes, &account)\n\tif err != nil {\n\t\tfmt.Println(\"Error Unmarshalling accountBytes\")\n\t\treturn nil, errors.New(\"Error retrieving account \" + cp.Issuer)\n\t}\n\n\taccount.AssetsIds = append(account.AssetsIds, cp.CUSIP)\n\n\t// Set the issuer to be the owner of all quantity\n\tvar owner Owner\n\towner.Company = cp.Issuer\n\towner.Quantity = cp.Qty\n\n\tcp.Owners = append(cp.Owners, owner)\n\n\tsuffix, err := generateCUSIPSuffix(cp.IssueDate, cp.Maturity)\n\tif err != nil {\n\t\tfmt.Println(\"Error generating cusip\")\n\t\treturn nil, errors.New(\"Error generating CUSIP\")\n\t}\n\n\tfmt.Println(\"Marshalling CP bytes\")\n\tcp.CUSIP = account.Prefix + suffix\n\n\tfmt.Println(\"Getting State on CP \" + cp.CUSIP)\n\tcpRxBytes, err := stub.GetState(cpPrefix + cp.CUSIP)\n\tif cpRxBytes == nil {\n\t\tfmt.Println(\"CUSIP does not exist, creating it\")\n\t\tcpBytes, err := json.Marshal(&cp)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error marshalling cp\")\n\t\t\treturn nil, errors.New(\"Error issuing commercial paper\")\n\t\t}\n\t\terr = stub.PutState(cpPrefix+cp.CUSIP, cpBytes)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error issuing paper\")\n\t\t\treturn nil, errors.New(\"Error issuing commercial paper\")\n\t\t}\n\n\t\tfmt.Println(\"Marshalling account bytes to write\")\n\t\taccountBytesToWrite, err := json.Marshal(&account)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error marshalling account\")\n\t\t\treturn nil, errors.New(\"Error issuing commercial paper\")\n\t\t}\n\t\terr = stub.PutState(accountPrefix+cp.Issuer, accountBytesToWrite)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error putting state on accountBytesToWrite\")\n\t\t\treturn nil, errors.New(\"Error issuing commercial paper\")\n\t\t}\n\n\t\t// Update the paper keys by adding the new key\n\t\tfmt.Println(\"Getting Paper Keys\")\n\t\tkeysBytes, err := stub.GetState(\"PaperKeys\")\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error retrieving paper keys\")\n\t\t\treturn nil, errors.New(\"Error retrieving paper keys\")\n\t\t}\n\t\tvar keys []string\n\t\terr = json.Unmarshal(keysBytes, &keys)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error unmarshel keys\")\n\t\t\treturn nil, errors.New(\"Error unmarshalling paper keys \")\n\t\t}\n\n\t\tfmt.Println(\"Appending the new key to Paper Keys\")\n\t\tfoundKey := false\n\t\tfor _, key := range keys {\n\t\t\tif key == cpPrefix+cp.CUSIP {\n\t\t\t\tfoundKey = true\n\t\t\t}\n\t\t}\n\t\tif foundKey == false {\n\t\t\tkeys = append(keys, cpPrefix+cp.CUSIP)\n\t\t\tkeysBytesToWrite, err := json.Marshal(&keys)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error marshalling keys\")\n\t\t\t\treturn nil, errors.New(\"Error marshalling the keys\")\n\t\t\t}\n\t\t\tfmt.Println(\"Put state on PaperKeys\")\n\t\t\terr = stub.PutState(\"PaperKeys\", keysBytesToWrite)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error writting keys back\")\n\t\t\t\treturn nil, errors.New(\"Error writing the keys back\")\n\t\t\t}\n\t\t}\n\n\t\tfmt.Println(\"Issue commercial paper %+v\\n\", cp)\n\t\treturn nil, nil\n\t} else {\n\t\tfmt.Println(\"CUSIP exists\")\n\n\t\tvar cprx CP\n\t\tfmt.Println(\"Unmarshalling CP \" + cp.CUSIP)\n\t\terr = json.Unmarshal(cpRxBytes, &cprx)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error unmarshalling cp \" + cp.CUSIP)\n\t\t\treturn nil, errors.New(\"Error unmarshalling cp \" + cp.CUSIP)\n\t\t}\n\n\t\tcprx.Qty = cprx.Qty + cp.Qty\n\n\t\tfor key, val := range cprx.Owners {\n\t\t\tif val.Company == cp.Issuer {\n\t\t\t\tcprx.Owners[key].Quantity += cp.Qty\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tcpWriteBytes, err := json.Marshal(&cprx)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error marshalling cp\")\n\t\t\treturn nil, errors.New(\"Error issuing commercial paper\")\n\t\t}\n\t\terr = stub.PutState(cpPrefix+cp.CUSIP, cpWriteBytes)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error issuing paper\")\n\t\t\treturn nil, errors.New(\"Error issuing commercial paper\")\n\t\t}\n\n\t\tfmt.Println(\"Updated commercial paper %+v\\n\", cprx)\n\t\treturn nil, nil\n\t}\n}", "title": "" }, { "docid": "74ac8049b3441b54f79eca9c3f882510", "score": "0.44608104", "text": "func (j realJIRAClient) CreateIssue(issue jira.Issue) (jira.Issue, error) {\n\tlog := j.config.GetLogger()\n\n\ti, res, err := j.request(func() (interface{}, *jira.Response, error) {\n\t\treturn j.client.Issue.Create(&issue)\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating JIRA issue: %v\", err)\n\t\treturn jira.Issue{}, getErrorBody(j.config, res)\n\t}\n\tis, ok := i.(*jira.Issue)\n\tif !ok {\n\t\tlog.Errorf(\"Create JIRA issue did not return issue! Got: %v\", i)\n\t\treturn jira.Issue{}, fmt.Errorf(\"Create JIRA issue failed: expected *jira.Issue; got %T\", i)\n\t}\n\n\treturn *is, nil\n}", "title": "" }, { "docid": "ad0e498e6906ba7c8bf8697752278e8a", "score": "0.44600594", "text": "func TestFillEnterpriseLicenseLegacy_validExpired(t *testing.T) {\n\tv := &types.Info{}\n\n\terr := fillEnterpriseLicenseLegacy(context.Background(), legacyLicenseExpired, v)\n\tassert.NilError(t, err)\n\tassert.Assert(t, is.Contains(v.ProductLicense, \"Expired\"))\n}", "title": "" }, { "docid": "e152996c6d439f7b2fa102725466b2d7", "score": "0.44449905", "text": "func New(securitystatusreqid field.SecurityStatusReqIDField, symbol field.SymbolField, subscriptionrequesttype field.SubscriptionRequestTypeField) (m SecurityStatusRequest) {\n\tm.Header = fix42.NewHeader()\n\tm.Init()\n\tm.Trailer.Init()\n\n\tm.Header.Set(field.NewMsgType(\"e\"))\n\tm.Set(securitystatusreqid)\n\tm.Set(symbol)\n\tm.Set(subscriptionrequesttype)\n\n\treturn\n}", "title": "" }, { "docid": "ddaa4f9a5ae1899073adb2aa817fa6a6", "score": "0.44411847", "text": "func newResourceAtVersion(t *testing.T, version string) client.Object {\n\tswitch version {\n\tcase \"v1\":\n\t\treturn &v1.TestType{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: \"object\",\n\t\t\t\tNamespace: \"default\",\n\t\t\t},\n\t\t\tTestField: \"abc\",\n\t\t\tTestFieldImmutable: \"def\",\n\t\t}\n\tcase \"v2\":\n\t\treturn &v2.TestType{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: \"object\",\n\t\t\t\tNamespace: \"default\",\n\t\t\t},\n\t\t\tTestField: \"abc\",\n\t\t\tTestFieldImmutable: \"def\",\n\t\t}\n\tdefault:\n\t\tt.Fatalf(\"unknown version %q\", version)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "553b2f79b4ca7e52d344cd86870cd0e0", "score": "0.44387817", "text": "func (*License) Descriptor() ([]byte, []int) {\n\treturn file_openapi_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "11cd7d067f045fafdc0d5186f12ffafb", "score": "0.44374466", "text": "func NewCreateIssuanceRequestOpExt(v LedgerVersion, value interface{}) (result CreateIssuanceRequestOpExt, err error) {\n\tresult.V = v\n\tswitch LedgerVersion(v) {\n\tcase LedgerVersionEmptyVersion:\n\t\t// void\n\tcase LedgerVersionAddTasksToReviewableRequest:\n\t\ttv, ok := value.(*Uint32)\n\t\tif !ok {\n\t\t\terr = fmt.Errorf(\"invalid value, must be *Uint32\")\n\t\t\treturn\n\t\t}\n\t\tresult.AllTasks = &tv\n\t}\n\treturn\n}", "title": "" }, { "docid": "0b77b3f2ade64faa30149ec9eca2c079", "score": "0.44350076", "text": "func Create(locale string) API {\n\tconf := config.GetConfig()\n\n\tif locale == \"\" {\n\t\tlocale = conf.Locale\n\t}\n\n\treturn API{\n\t\tProductAPI: &amazonproduct.AmazonProductAPI{\n\t\t\tAccessKey: os.Getenv(\"AMAZON_ACCESS_KEY\"),\n\t\t\tSecretKey: os.Getenv(\"AMAZON_SECRET_KEY\"),\n\t\t\tHost: hosts[strings.ToUpper(locale)],\n\t\t\tAssociateTag: \"matthi-20\",\n\t\t},\n\t\tLocale: locale,\n\t}\n}", "title": "" }, { "docid": "bfa95b2f05a42169ff6e74794cbaa95c", "score": "0.4429986", "text": "func License(path string) error {\n\tlicenseBytes, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot read license file at %q: %v\", path, err)\n\t}\n\tc := struct {\n\t\tExpirationDate time.Time `json:\"expirationDate\"`\n\t\tjwt.StandardClaims\n\t}{}\n\tif _, _, err := (&jwt.Parser{}).ParseUnverified(string(licenseBytes), &c); err != nil {\n\t\treturn fmt.Errorf(\"invalid JWT in license: %v; %q\", err, string(licenseBytes))\n\t}\n\tif time.Now().After(c.ExpirationDate) {\n\t\treturn fmt.Errorf(\"expired license %v\", c.ExpirationDate)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1afe4580bb48c207916f024549e639ec", "score": "0.44295543", "text": "func newBogusOpenAIClient(t *testing.T) *azopenai.Client {\n\tcred, err := azopenai.NewKeyCredential(\"bogus-api-key\")\n\trequire.NoError(t, err)\n\n\tclient, err := azopenai.NewClientForOpenAI(openAI.Endpoint, cred, newClientOptionsForTest(t))\n\trequire.NoError(t, err)\n\treturn client\n}", "title": "" }, { "docid": "79b977807c09d97284d835c67f410c27", "score": "0.44268736", "text": "func (c *aftership) newRequest(method string, body io.Reader, pathParams ...string) (*request, error) {\n\treq, err := http.NewRequest(method, fmt.Sprintf(\"%s/%s\", url, strings.Join(pathParams, \"/\")), body)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"aftership-api-key\", c.apiKey)\n\n\treturn &request{req: req, client: c.client}, err\n}", "title": "" }, { "docid": "fee5ddb9bcef9ceae076214a84cc8d45", "score": "0.44232658", "text": "func testCreateRenewProject(t *testing.T, c *TestContext) (ID int) {\n\ttcc := []TestCase{\n\t\t*c.AdminCheckTestCase, // 0 : user unauthorized\n\t\t{\n\t\t\tSent: []byte(`fake`),\n\t\t\tToken: c.Config.Users.Admin.Token,\n\t\t\tRespContains: []string{`Création de projet de renouvellement, décodage :`},\n\t\t\tStatusCode: http.StatusInternalServerError}, // 1 : bad request\n\t\t{\n\t\t\tSent: []byte(`{\"RenewProject\":{\"Reference\":\"\",\"Name\":\"PRU\"}}`),\n\t\t\tToken: c.Config.Users.Admin.Token,\n\t\t\tRespContains: []string{`Création de projet de renouvellement : Champ reference incorrect`},\n\t\t\tStatusCode: http.StatusBadRequest}, // 2 : reference empty\n\t\t{\n\t\t\tSent: []byte(`{\"RenewProject\":{\"Reference\":\"PRU001\",\"Name\":\"\"}}`),\n\t\t\tToken: c.Config.Users.Admin.Token,\n\t\t\tRespContains: []string{`Création de projet de renouvellement : Champ name incorrect`},\n\t\t\tStatusCode: http.StatusBadRequest}, // 3 : name empty\n\t\t{\n\t\t\tSent: []byte(`{\"RenewProject\":{\"Reference\":\"PRU001\",\"Name\":\"PRU\",\"Budget\":0}}`),\n\t\t\tToken: c.Config.Users.Admin.Token,\n\t\t\tRespContains: []string{`Création de projet de renouvellement : Champ budget incorrect`},\n\t\t\tStatusCode: http.StatusBadRequest}, // 4 : budget null\n\t\t{\n\t\t\tSent: []byte(`{\"RenewProject\":{\"Reference\":\"PRU001\",\"Name\":\"PRU\",\"Budget\":250000000,\"CityCode1\":0}}`),\n\t\t\tToken: c.Config.Users.Admin.Token,\n\t\t\tRespContains: []string{`Création de projet de renouvellement : Champ citycode1 incorrect`},\n\t\t\tStatusCode: http.StatusBadRequest}, // 5 : CityCode1 null\n\t\t{\n\t\t\tSent: []byte(`{\"RenewProject\":{\"Reference\":\"PRU001\",\"Name\":\"PRU\",` +\n\t\t\t\t`\"Budget\":250000000,\"CityCode1\":75101,\"BudgetCity1\":100000}}`),\n\t\t\tToken: c.Config.Users.Admin.Token,\n\t\t\tIDName: `{\"ID\"`,\n\t\t\tRespContains: []string{`\"RenewProject\":{\"ID\":1,\"Reference\":\"PRU001\",` +\n\t\t\t\t`\"Name\":\"PRU\",\"Budget\":250000000,\"PRIN\":false,\"CityCode1\":75101,` +\n\t\t\t\t`\"CityName1\":\"PARIS 1\",\"BudgetCity1\":100000,\"CityCode2\":null,` +\n\t\t\t\t`\"CityName2\":null,\"BudgetCity2\":null,\"CityCode3\":null,\"CityName3\":null,` +\n\t\t\t\t`\"BudgetCity3\":null,\"Population\":null,\"CompositeIndex\":null`},\n\t\t\tStatusCode: http.StatusCreated}, // 6 : ok\n\t}\n\tf := func(tc TestCase) *httpexpect.Response {\n\t\treturn c.E.POST(\"/api/renew_project\").WithBytes(tc.Sent).\n\t\t\tWithHeader(\"Authorization\", \"Bearer \"+tc.Token).Expect()\n\t}\n\tfor _, r := range chkFactory(tcc, f, \"CreateRenewProject\", &ID) {\n\t\tt.Error(r)\n\t}\n\treturn ID\n}", "title": "" }, { "docid": "29941716d6bbc5171a23cb3f72494130", "score": "0.4421491", "text": "func (client *ArtifactSourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSource, options *ArtifactSourcesClientCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, artifactSource)\n}", "title": "" }, { "docid": "cc58791e19679128e719a869055a774b", "score": "0.442139", "text": "func setDefaultHeaders(tag *BidderMacro) {\n\t// openrtb2. auction.go setDeviceImplicitly\n\t// already populates OpenRTB bid request based on http request headers\n\t// reusing the same information to set these headers via Macro* methods\n\theaders := http.Header{}\n\tip := tag.IBidderMacro.MacroIP(\"\")\n\tuserAgent := tag.IBidderMacro.MacroUserAgent(\"\")\n\treferer := tag.IBidderMacro.MacroSitePage(\"\")\n\tlanguage := tag.IBidderMacro.MacroDeviceLanguage(\"\")\n\n\t// 1 - vast 1 - 3 expected, 2 - vast 4 expected\n\texpectedVastTags := 0\n\tif nil != tag.Imp && nil != tag.Imp.Video && nil != tag.Imp.Video.Protocols && len(tag.Imp.Video.Protocols) > 0 {\n\t\tfor _, protocol := range tag.Imp.Video.Protocols {\n\t\t\tif protocol == adcom1.CreativeVAST40 || protocol == adcom1.CreativeVAST40Wrapper {\n\t\t\t\texpectedVastTags |= 1 << 1\n\t\t\t}\n\t\t\tif protocol <= adcom1.CreativeVAST30Wrapper {\n\t\t\t\texpectedVastTags |= 1 << 0\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// not able to detect protocols. set all headers\n\t\texpectedVastTags = 3\n\t}\n\n\tif expectedVastTags == 1 || expectedVastTags == 3 {\n\t\t// vast prior to version 3 headers\n\t\tsetHeaders(headers, \"X-Forwarded-For\", ip)\n\t\tsetHeaders(headers, \"User-Agent\", userAgent)\n\t}\n\n\tif expectedVastTags == 2 || expectedVastTags == 3 {\n\t\t// vast 4 specific headers\n\t\tsetHeaders(headers, \"X-device-Ip\", ip)\n\t\tsetHeaders(headers, \"X-Device-User-Agent\", userAgent)\n\t\tsetHeaders(headers, \"X-Device-Referer\", referer)\n\t\tsetHeaders(headers, \"X-Device-Accept-Language\", language)\n\t}\n\ttag.ImpReqHeaders = headers\n}", "title": "" }, { "docid": "47fdde921b5fd3d14f99fb28ad47a7ca", "score": "0.44201142", "text": "func (c client) newRequest(context context.Context, method string, url string, query *url.Values, body []byte, headers *http.Header, isSigned bool) (*http.Request, error) {\n\treq, err := http.NewRequestWithContext(context, method, url, strings.NewReader(string(body)))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create request %w\", err)\n\t}\n\n\taddHeaders(req, headers)\n\taddQueryParameters(req, query)\n\n\tif isSigned {\n\t\thashedBody, err := calculateHash(body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to calculated the hash of the request body %w\", err)\n\t\t}\n\n\t\treq.Header.Add(\"Authorization\", \"Sign \"+hashedBody)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "c56dfd3022bf656d95e2e7a753a743b5", "score": "0.44189", "text": "func (t *OpenconfigSystem_System_License_Licenses) NewLicense(LicenseId string) (*OpenconfigSystem_System_License_Licenses_License, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.License == nil {\n\t\tt.License = make(map[string]*OpenconfigSystem_System_License_Licenses_License)\n\t}\n\n\tkey := LicenseId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.License[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list License\", key)\n\t}\n\n\tt.License[key] = &OpenconfigSystem_System_License_Licenses_License{\n\t\tLicenseId: &LicenseId,\n\t}\n\n\treturn t.License[key], nil\n}", "title": "" } ]
58e45fbb4f4baf5dfdecf0baba70038f
Finalize tells persister that it can finalize and close writes It is an error to send new items to persist once Finalize has been called
[ { "docid": "46f09e2c18aa429470210575d7516b1f", "score": "0.7170332", "text": "func (lp *JournalPersister) Finalize() {\n\tlogrus.Info(\"JournalPersister:Finalize finalizing persister\")\n\n\t// close db\n\tif lp.writer != nil {\n\t\tlogrus.Info(\"JournalPersister:Finalize closing writer db\")\n\t\terr := lp.writer.Flush()\n\t\tif err != nil {\n\t\t\tlogrus.Error(\"JournalPersister:Finalize error flushing journal\", err)\n\t\t}\n\t\terr = lp.writer.Close()\n\t\tif err != nil {\n\t\t\tlogrus.Error(\"JournalPersister:Finalize error finalizing writer\", err)\n\t\t}\n\t\tlogrus.Info(\"JournalPersister:Finalize closed writer db\")\n\t}\n\tlogrus.Info(\"JournalPersister:Finalize done\")\n}", "title": "" } ]
[ { "docid": "1b9d2910836bb85107f0e2f3e795159f", "score": "0.61845344", "text": "func (d *FileBackedDevice) Finalize() {\n\tif d.resumable {\n\t\td.blockMapIntentLogger.finalize(d)\n\t}\n}", "title": "" }, { "docid": "619600fc67a9944bc4d1ac8a1878c0e7", "score": "0.6115721", "text": "func (sq *Sqinn) Finalize() error {\n\tsq.mx.Lock()\n\tdefer sq.mx.Unlock()\n\t// req\n\treq := []byte{fcFinalize}\n\t// resp\n\t_, err := sq.writeAndRead(req)\n\treturn err\n}", "title": "" }, { "docid": "ebfabfa6225358766e43384755be3728", "score": "0.5969808", "text": "func (act *Actor) finalize() {\n\tact.mu.Lock()\n\tdefer act.mu.Unlock()\n\tif act.finalizer != nil {\n\t\tact.err = act.finalizer(act.err)\n\t}\n}", "title": "" }, { "docid": "dff1ccf8e378c316d1574bc8deccefee", "score": "0.59259194", "text": "func (b *ReadWrite) Finalize() error {\n\tb.ronly.mu.Lock()\n\tdefer b.ronly.mu.Unlock()\n\n\tif b.ronly.closed {\n\t\t// Allow duplicate Finalize calls, just like Close.\n\t\t// Still error, just like ReadOnly.Close; it should be discarded.\n\t\treturn fmt.Errorf(\"called Finalize on a closed blockstore\")\n\t}\n\n\t// TODO check if add index option is set and don't write the index then set index offset to zero.\n\tb.header = b.header.WithDataSize(uint64(b.dataWriter.Position()))\n\tb.header.Characteristics.SetFullyIndexed(b.opts.StoreIdentityCIDs)\n\n\t// Note that we can't use b.Close here, as that tries to grab the same\n\t// mutex we're holding here.\n\tdefer b.ronly.closeWithoutMutex()\n\n\t// TODO if index not needed don't bother flattening it.\n\tfi, err := b.idx.flatten(b.opts.IndexCodec)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := index.WriteTo(fi, NewOffsetWriter(b.f, int64(b.header.IndexOffset))); err != nil {\n\t\treturn err\n\t}\n\tif _, err := b.header.WriteTo(NewOffsetWriter(b.f, carv2.PragmaSize)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := b.ronly.closeWithoutMutex(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f96b60d8693e5af5f240a54872bd8b4f", "score": "0.5768307", "text": "func Finalize() {\n\tsmInitializations--\n\tif smInitializations == 0 {\n\t\tsmForceFinalize()\n\t}\n}", "title": "" }, { "docid": "ed0530eb959839d120e9f6a11ae1d087", "score": "0.57128143", "text": "func finalizePersistence() {\n\terr := saveState(filepath.Join(outDir, \"state\"), state)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Merge temp files to permanent files.\n\tfor file := range outFiles {\n\t\tin, err := newFileReader(file + \".temp\")\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tout, err := newFileAppender(file)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t_, err = io.Copy(out, in)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tin.Close()\n\t\tout.Close()\n\t\tos.Remove(file + \".temp\")\n\t}\n}", "title": "" }, { "docid": "15f81a86fbb8c8eb1906c64fabcfcd61", "score": "0.56600744", "text": "func (sl *DiskSessionLogger) Finalize() error {\n\tsl.Lock()\n\tdefer sl.Unlock()\n\n\treturn sl.finalize()\n}", "title": "" }, { "docid": "35e864807fb258d5d3673a4d52338309", "score": "0.56562096", "text": "func (_Finalizable *FinalizableTransactor) Finalize(opts *bind.TransactOpts, fin bool) (*types.Transaction, error) {\n\treturn _Finalizable.contract.Transact(opts, \"finalize\", fin)\n}", "title": "" }, { "docid": "be66680b6b3db7c9b6785535e200a59e", "score": "0.56210387", "text": "func (_m *ObjectStore) Close() {\n\t_m.Called()\n}", "title": "" }, { "docid": "db87b3d1ce4de6949e53dda29bb5d77b", "score": "0.55676204", "text": "func (_Finalizable *FinalizableTransactorSession) Finalize(fin bool) (*types.Transaction, error) {\n\treturn _Finalizable.Contract.Finalize(&_Finalizable.TransactOpts, fin)\n}", "title": "" }, { "docid": "66504db256d9aa10ef58e98000755209", "score": "0.55531985", "text": "func (s *GeneralStats) Finalize() {\n\ts.Reads.MappedReadsStats.UpdateUnmapped()\n\ts.Pairs.MappedReadsStats.UpdateUnmapped()\n\ts.Reads.UpdateMappingsRatio()\n}", "title": "" }, { "docid": "53217eaa1c78b9868fb294d602defcf5", "score": "0.55172014", "text": "func (_Finalizable *FinalizableSession) Finalize(fin bool) (*types.Transaction, error) {\n\treturn _Finalizable.Contract.Finalize(&_Finalizable.TransactOpts, fin)\n}", "title": "" }, { "docid": "ad22efdd60f2a8d0b4723c15d37fe61e", "score": "0.5512658", "text": "func (ut *uploadPayload) Finalize() {\n\tvar defaultAllowOverwrite = false\n\tif ut.AllowOverwrite == nil {\n\t\tut.AllowOverwrite = &defaultAllowOverwrite\n\t}\n\tvar defaultCopyUIDGID = false\n\tif ut.CopyUIDGID == nil {\n\t\tut.CopyUIDGID = &defaultCopyUIDGID\n\t}\n}", "title": "" }, { "docid": "b70024c644f156ed572a46af8160f74f", "score": "0.5497505", "text": "func (a *Adaptor) Finalize() (err error) {\n\ta.Disconnect()\n\treturn\n}", "title": "" }, { "docid": "cb8f8ddac1f3456e01c79a2abf124ef2", "score": "0.5465392", "text": "func (idx *Index) Finalize(w io.Writer) error {\n\tdebug.Log(\"Index.Encode\", \"encoding index\")\n\tidx.m.Lock()\n\tdefer idx.m.Unlock()\n\n\tidx.final = true\n\n\treturn idx.encode(w)\n}", "title": "" }, { "docid": "743132fc2fe6478dcbd75a1de122433d", "score": "0.5440196", "text": "func (a *APIManagedFinalizer) Finalize(ctx context.Context, mg Managed) error {\n\t// TODO(negz): We probably want to delete the managed resource here if its\n\t// reclaim policy is delete, rather than relying on garbage collection, per\n\t// https://github.com/crossplaneio/crossplane/issues/550\n\tmg.SetBindingPhase(v1alpha1.BindingPhaseUnbound)\n\tmg.SetClaimReference(nil)\n\treturn errors.Wrap(IgnoreNotFound(a.client.Update(ctx, mg)), errUpdateManaged)\n}", "title": "" }, { "docid": "e0b3d2363cda680a1d80012d35be1219", "score": "0.54363656", "text": "func (c *Adaptor) Finalize() (err error) {\n\tfor _, pin := range c.digitalPins {\n\t\tif pin != nil {\n\t\t\tif e := pin.Unexport(); e != nil {\n\t\t\t\terr = multierror.Append(err, e)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, bus := range c.i2cBuses {\n\t\tif bus != nil {\n\t\t\tif e := bus.Close(); e != nil {\n\t\t\t\terr = multierror.Append(err, e)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2674c305df2e36362043d83cb42e077a", "score": "0.54197085", "text": "func (m *Finalizer2P) Finalize() error {\n\tfor _, commit := range m.deferredCommits {\n\t\terr := commit()\n\t\tif err != nil {\n\t\t\treturn m.finalizerError(\n\t\t\t\ttxmanager.WrapError(\n\t\t\t\t\terr, \"Running deferred commits\",\n\t\t\t\t))\n\t\t}\n\t}\n\tm.id = uuid.New().String()\n\tm.Trace(\"Create Finalizer2P ID\")\n\t_, err := m.TX.Exec(fmt.Sprintf(\"PREPARE TRANSACTION '%s'\", m.id))\n\tif err != nil {\n\t\tdefer func() { m.id = \"\" }()\n\t\treturn m.finalizerError(\n\t\t\ttxmanager.WrapError(err, \"Doing PREPARE\"),\n\t\t)\n\t}\n\tm.Trace(\"Transaction prepared\")\n\tm.TX = nil\n\treturn nil\n}", "title": "" }, { "docid": "019d77d7cae21d4f9bf548826dce9da4", "score": "0.5404457", "text": "func (s *Store) Finalize(jid ffs.JobID, st ffs.JobStatus, jobError error, dealErrors []ffs.DealError) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\tj, err := s.get(jid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx := context.Background()\n\ts.metricJobCounter.Add(ctx, -1, attrStatusExecuting)\n\tswitch st {\n\tcase ffs.Success:\n\t\ts.metricJobCounter.Add(ctx, 1, attrStatusSuccess)\n\tcase ffs.Failed:\n\t\ts.metricJobCounter.Add(ctx, 1, attrStatusFailed)\n\tcase ffs.Canceled:\n\t\ts.metricJobCounter.Add(ctx, 1, attrStatusCanceled)\n\tdefault:\n\t\treturn fmt.Errorf(\"can't finalize job with status %s\", ffs.JobStatusStr[st])\n\t}\n\tj.Status = st\n\tif jobError != nil {\n\t\tj.ErrCause = jobError.Error()\n\t}\n\tj.DealErrors = dealErrors\n\tif err := s.put(j, false); err != nil {\n\t\treturn fmt.Errorf(\"saving in datastore: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e9c2563a4e3b83b6e5f84865447621af", "score": "0.5399927", "text": "func (saver *ChangesSaver) Finalize() interface{} {\n\treturn saver.result\n}", "title": "" }, { "docid": "f94e94fe7bea3b7d88eb257a97cfbb65", "score": "0.53921175", "text": "func (bsw *blockStreamWriter) Finalize(ph *partHeader) {\n\tph.UncompressedSizeBytes = bsw.globalUncompressedSizeBytes\n\tph.RowsCount = bsw.globalRowsCount\n\tph.BlocksCount = bsw.globalBlocksCount\n\tph.MinTimestamp = bsw.globalMinTimestamp\n\tph.MaxTimestamp = bsw.globalMaxTimestamp\n\n\tbsw.mustFlushIndexBlock(bsw.indexBlockData)\n\n\t// Write metaindex data\n\tbb := longTermBufPool.Get()\n\tbb.B = encoding.CompressZSTDLevel(bb.B[:0], bsw.metaindexData, 1)\n\tbsw.streamWriters.metaindexWriter.MustWrite(bb.B)\n\tif len(bb.B) < 1024*1024 {\n\t\tlongTermBufPool.Put(bb)\n\t}\n\n\tph.CompressedSizeBytes = bsw.streamWriters.totalBytesWritten()\n\n\tbsw.streamWriters.MustClose()\n\tbsw.reset()\n}", "title": "" }, { "docid": "a26e158fa495ed8b9d4e3ffbfce5b6d6", "score": "0.53913945", "text": "func finalizer(a *Enforcer) {\n\tif a.engine == nil {\n\t\treturn\n\t}\n\n\terr := a.engine.Close()\n\tif err != nil {\n\t\tlogger.Infof(\"close xorm adapter engine failed, err: %v\", err)\n\t}\n}", "title": "" }, { "docid": "f45c92f7c1a95217b715ab837b0d7ae3", "score": "0.53734857", "text": "func (payload *createCustomsItemPayload) Finalize() {\n\tvar defaultCurrency = \"USD\"\n\tif payload.Currency == nil {\n\t\tpayload.Currency = &defaultCurrency\n\t}\n\tvar defaultOriginCountry = \"US\"\n\tif payload.OriginCountry == nil {\n\t\tpayload.OriginCountry = &defaultOriginCountry\n\t}\n}", "title": "" }, { "docid": "cb782a6546d759b0f64ec7696510e594", "score": "0.53705394", "text": "func (_MSContract *MSContractTransactor) FinalizeClose(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MSContract.contract.Transact(opts, \"finalizeClose\")\n}", "title": "" }, { "docid": "c5444d07dc99c5242cacb4bb7d55ed44", "score": "0.5360453", "text": "func (this *Analyzer) Finalize() error {\n\tthis.mu.Lock()\n\tdefer this.mu.Unlock()\n\n\t//fmt.Printf(\"in finalize\\n\")\n\tif err := this.merge(); err != nil {\n\t\treturn err\n\t}\n\n\treturn this.compact()\n}", "title": "" }, { "docid": "1752ed7e507f36e8154e3f30883275d3", "score": "0.5356299", "text": "func (t *AlfredScriptFilterTranslator) Finalize(w io.Writer, s Storage) {\n\tfmt.Fprint(w, \"</items>\\n\")\n}", "title": "" }, { "docid": "e0734ba67b4c0c409390525663bc4b1d", "score": "0.5336571", "text": "func (payload *subExamplePayload) Finalize() {\n\tvar defaultMessage = \"\"\n\tif payload.Message == nil {\n\t\tpayload.Message = &defaultMessage\n\t}\n}", "title": "" }, { "docid": "871358c09573cddcf85a4a859e2a9dd1", "score": "0.5332237", "text": "func (c *CloneSetController) Finalize() error {\n\treturn nil\n}", "title": "" }, { "docid": "733add512b69a508ba0239d9077e5c83", "score": "0.53199923", "text": "func (_MSContract *MSContractTransactorSession) FinalizeClose() (*types.Transaction, error) {\n\treturn _MSContract.Contract.FinalizeClose(&_MSContract.TransactOpts)\n}", "title": "" }, { "docid": "9ae7e9bb8197095be430a9c138829bad", "score": "0.5311955", "text": "func (b *ClientAdaptor) Finalize() (err error) {\n\treturn b.Disconnect()\n}", "title": "" }, { "docid": "91294b297c0ae07e237feba2625da6f7", "score": "0.53117484", "text": "func (c *closeTrackingConn) finalize() {\n\tmon.Event(\"connection_leaked\")\n\t_ = c.Conn.Close()\n}", "title": "" }, { "docid": "d3aab455a4db6c59b56ebe0cdbb12fa9", "score": "0.53110325", "text": "func (s *StatefulSetRolloutController) Finalize(ctx context.Context, succeed bool) bool {\n\tif err := s.fetchStatefulSet(ctx); err != nil {\n\t\t// don't fail the rollout just because of we can't get the resource\n\t\treturn false\n\t}\n\n\t// release StatefulSet\n\tif _, err := s.releaseStatefulSet(ctx, s.statefulSet); err != nil {\n\t\treturn false\n\t}\n\n\t// mark the resource finalized\n\ts.rolloutStatus.LastAppliedPodTemplateIdentifier = s.rolloutStatus.NewPodTemplateIdentifier\n\ts.recorder.Event(s.parentController, event.Normal(\"Rollout Finalized\",\n\t\tfmt.Sprintf(\"Rollout resource are finalized, succeed := %t\", succeed)))\n\treturn true\n}", "title": "" }, { "docid": "11abd303245e67e23254f998b5da360e", "score": "0.5305862", "text": "func (d *models.Database) Finalize() {\n\tvar err error\n\n\ta.DB, err = sql.Close(\"postgres\", connectionString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "6e1786f938bd50de5110e67bc0599792", "score": "0.52934265", "text": "func (m *DataStore) Close() {\n}", "title": "" }, { "docid": "913f83331df6b9f1ea56c71a40b55214", "score": "0.529157", "text": "func (r *_Receiver[Elem]) finalize() {\n\tclose(r.done)\n}", "title": "" }, { "docid": "7b34cbb77b078bf3cd95c7b283a729b0", "score": "0.52721953", "text": "func (idx *Index) Finalize() {\n\tdebug.Log(\"finalizing index\")\n\tidx.m.Lock()\n\tdefer idx.m.Unlock()\n\n\tidx.final = true\n\t// clear packIDToIndex as no more elements will be added\n\tidx.packIDToIndex = nil\n}", "title": "" }, { "docid": "54308278164e8646f9d370d7ff0f09a7", "score": "0.5268629", "text": "func (a *APIStatusManagedFinalizer) Finalize(ctx context.Context, mg Managed) error {\n\t// TODO(negz): We probably want to delete the managed resource here if its\n\t// reclaim policy is delete, rather than relying on garbage collection, per\n\t// https://github.com/crossplaneio/crossplane/issues/550\n\tmg.SetBindingPhase(v1alpha1.BindingPhaseUnbound)\n\tmg.SetClaimReference(nil)\n\n\tif err := a.client.Update(ctx, mg); err != nil {\n\t\treturn errors.Wrap(IgnoreNotFound(err), errUpdateManaged)\n\t}\n\n\treturn errors.Wrap(IgnoreNotFound(a.client.Status().Update(ctx, mg)), errUpdateManagedStatus)\n}", "title": "" }, { "docid": "a55e2ad22e3de983a45fe452c884d624", "score": "0.52629465", "text": "func (rt *Runtime) Finalize() error {\n\trt.CSVWriter.Flush()\n\terr := rt.CSVFile.Close()\n\treturn err\n}", "title": "" }, { "docid": "28f608da0e01ca601598b611b3f9825a", "score": "0.52583957", "text": "func (r *VAdaptor) Finalize() (err error) {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\n\tfor _, pin := range r.digitalPins {\n\t\tif pin != nil {\n\t\t\tif perr := pin.Unexport(); err != nil {\n\t\t\t\terr = multierror.Append(err, perr)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, pin := range r.pwmPins {\n\t\tif pin != nil {\n\t\t\tif perr := pin.Unexport(); err != nil {\n\t\t\t\terr = multierror.Append(err, perr)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, bus := range r.i2cBuses {\n\t\tif bus != nil {\n\t\t\tif e := bus.Close(); e != nil {\n\t\t\t\terr = multierror.Append(err, e)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, dev := range r.spiDevices {\n\t\tif dev != nil {\n\t\t\tif e := dev.Close(); e != nil {\n\t\t\t\terr = multierror.Append(err, e)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "458d7b891f261c10601a667e7d9f9736", "score": "0.52555805", "text": "func (m MockStore) Cleanup() error { return nil }", "title": "" }, { "docid": "391387638a29861fac63a42dbab093d7", "score": "0.52553463", "text": "func (p *Packer) Finalize() (uint, error) {\n\tp.m.Lock()\n\tdefer p.m.Unlock()\n\n\tbytesWritten := p.bytes\n\n\thdrBuf := bytes.NewBuffer(nil)\n\tbytesHeader, err := p.writeHeader(hdrBuf)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tencryptedHeader, err := crypto.Encrypt(p.k, nil, hdrBuf.Bytes())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// append the header\n\tn, err := p.wr.Write(encryptedHeader)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"Write\")\n\t}\n\n\thdrBytes := bytesHeader + crypto.Extension\n\tif uint(n) != hdrBytes {\n\t\treturn 0, errors.New(\"wrong number of bytes written\")\n\t}\n\n\tbytesWritten += hdrBytes\n\n\t// write length\n\terr = binary.Write(p.wr, binary.LittleEndian, uint32(uint(len(p.blobs))*entrySize+crypto.Extension))\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"binary.Write\")\n\t}\n\tbytesWritten += uint(binary.Size(uint32(0)))\n\n\tp.bytes = uint(bytesWritten)\n\n\tif w, ok := p.wr.(io.Closer); ok {\n\t\treturn bytesWritten, w.Close()\n\t}\n\n\treturn bytesWritten, nil\n}", "title": "" }, { "docid": "8ee2ac5cdc3ff96c21db4c4e609f1d88", "score": "0.52511215", "text": "func (h *Afp) Finalize() error {\n\t<-h.finished\n\th.TPacket.Close()\n\treturn nil\n}", "title": "" }, { "docid": "8ff7dd2270dc9fa248ea0f50e22cbaf1", "score": "0.52496105", "text": "func finalizer(a *OrmManager) {\n\terr := a.engine.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "ec8e6b9c0c15409513448a2fbe43727f", "score": "0.5249445", "text": "func (f *SourceFile) Finalize(len int) {\n\tf.length = len\n}", "title": "" }, { "docid": "3ed0b4679b5282a557b076bba7a47e7f", "score": "0.524848", "text": "func (store *Store) Close() {\n\tif store.ptr != nil {\n\t\twrap.DestroyMetadataStore(store.ptr)\n\t\tstore.ptr = nil\n\t}\n}", "title": "" }, { "docid": "cf8c067f626a4aea53888cef4775f017", "score": "0.52455264", "text": "func (dpos *DummyDpos) Finalize(*types.Block) error { return nil }", "title": "" }, { "docid": "09d3dde32a58ff4324d27806ec5482b1", "score": "0.5239934", "text": "func (s *StateDB) Finalise(deleteEmptyObjects bool) {\n\t//todo: do we need this?\n}", "title": "" }, { "docid": "86f805d73db2ba271d6b9afcf66098bb", "score": "0.5226549", "text": "func (_MSContract *MSContractSession) FinalizeClose() (*types.Transaction, error) {\n\treturn _MSContract.Contract.FinalizeClose(&_MSContract.TransactOpts)\n}", "title": "" }, { "docid": "c36b7ec92513585e512a110c3252af92", "score": "0.5221379", "text": "func (s *Storage) Shutdown() {\n\ts.shutdownOnce.Do(func() {\n\t\tif err := s.Permanent.Commitments.Close(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\ts.databaseManager.Shutdown()\n\t})\n}", "title": "" }, { "docid": "ca4c4fd5f1b85eed6304a9e834343746", "score": "0.5216425", "text": "func (stx *stateTX) Finalize() error {\n\tif stx.finalized {\n\t\treturn errors.New(\"Cannot finalize a working set twice\")\n\t}\n\t// Persist current chain Height\n\tstx.flusher.KVStoreWithBuffer().MustPut(\n\t\tAccountKVNamespace,\n\t\t[]byte(CurrentHeightKey),\n\t\tbyteutil.Uint64ToBytes(stx.blockHeight),\n\t)\n\tstx.finalized = true\n\n\treturn nil\n}", "title": "" }, { "docid": "9d97d7fd4b9ba27bd5cc690a535f3e2c", "score": "0.5214326", "text": "func (w *PersistChannelWriter) Close() {\n\tif w.ticker != nil {\n\t\tw.ctrl <- writeClose\n\t\t<-w.ackCtrl\n\t}\n\tif w.file != nil {\n\t\tw.file.Close()\n\t\tw.file = nil\n\t}\n}", "title": "" }, { "docid": "7cd5ff16352ab66ac50448f6c6a9dcd1", "score": "0.51933277", "text": "func (payload *listTrackerPayload) Finalize() {\n\tvar defaultPageSize = 1\n\tif payload.PageSize == nil {\n\t\tpayload.PageSize = &defaultPageSize\n\t}\n}", "title": "" }, { "docid": "f62145955543354bb7ebee5923b71aa4", "score": "0.5189093", "text": "func (_RevokedCert *RevokedCertTransactor) Finalize(opts *bind.TransactOpts, fin bool) (*types.Transaction, error) {\n\treturn _RevokedCert.contract.Transact(opts, \"finalize\", fin)\n}", "title": "" }, { "docid": "07fbf03c47f5fa5a9968e46418d774d2", "score": "0.51862466", "text": "func (s *ScopedKeyManager) Close() {\n\ts.mtx.Lock()\n\tdefer s.mtx.Unlock()\n\n\t// Attempt to clear sensitive public key material from memory too.\n\ts.zeroSensitivePublicData()\n}", "title": "" }, { "docid": "0321ca93b942f594dabd61bb0da2ec05", "score": "0.5183801", "text": "func (c *Adaptor) Finalize() error {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\terr := c.DigitalPinsAdaptor.Finalize()\n\n\tif e := c.PWMPinsAdaptor.Finalize(); e != nil {\n\t\terr = multierror.Append(err, e)\n\t}\n\n\tif e := c.I2cBusAdaptor.Finalize(); e != nil {\n\t\terr = multierror.Append(err, e)\n\t}\n\n\tif e := c.SpiBusAdaptor.Finalize(); e != nil {\n\t\terr = multierror.Append(err, e)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c3b36905ec754eeb024e9c8e60586fc3", "score": "0.51743937", "text": "func (store *BlockStore) Shutdown() {\n\tstore.fileMgr.close()\n}", "title": "" }, { "docid": "e6b15aedd6cf5754ca307d3c7dbce23c", "score": "0.51691484", "text": "func (_MSContract *MSContractTransactor) FinalizeRegister(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MSContract.contract.Transact(opts, \"finalizeRegister\")\n}", "title": "" }, { "docid": "7ffe430b8f6e53836af1829bcaa8c6e6", "score": "0.51655304", "text": "func (m MemKVStore) Cleanup() error { return nil }", "title": "" }, { "docid": "0ac8d10d2fc3941b078cef483987e926", "score": "0.51581144", "text": "func (_MSContract *MSContractTransactorSession) FinalizeRegister() (*types.Transaction, error) {\n\treturn _MSContract.Contract.FinalizeRegister(&_MSContract.TransactOpts)\n}", "title": "" }, { "docid": "a5d9f74b58a0128c5a65158173b8a366", "score": "0.5149769", "text": "func (_MSContract *MSContractSession) FinalizeRegister() (*types.Transaction, error) {\n\treturn _MSContract.Contract.FinalizeRegister(&_MSContract.TransactOpts)\n}", "title": "" }, { "docid": "c32f5dea930b056c8f229e2a9e7e5ed1", "score": "0.5146867", "text": "func (c *Collector) Finish() {\n\tc.panicIfFinished(errFinishAfterFinish)\n\tc.finished = true\n\tc.pushAdded()\n\tc.pushRemoved()\n\tc.pushEqual()\n}", "title": "" }, { "docid": "b4e5a42d00390c865d28ebd442686219", "score": "0.51460886", "text": "func (m *ReplicaStorageMock) Finish() {\n\tm.MinimockFinish()\n}", "title": "" }, { "docid": "aafab226cf19a3a8cb393dcafffc6305", "score": "0.5145478", "text": "func (bds *BadgerDatastorage) Flush() {\n\tbds.cleanup()\n}", "title": "" }, { "docid": "660e17569f71343520fa7051ecb9f83a", "score": "0.5139591", "text": "func (r *Reader) Finalize() {\n\tr.reader.Reset(nil)\n\tbufPool.Put(r.reader)\n\tr.reader = nil\n}", "title": "" }, { "docid": "ac7433aaddf6735f9c8afcb8dc696c32", "score": "0.5135885", "text": "func (ws *workingSet) Finalize() error {\n\tif ws.finalized {\n\t\treturn errors.New(\"Cannot finalize a working set twice\")\n\t}\n\tws.finalized = true\n\t// Persist current chain Height\n\th := byteutil.Uint64ToBytes(ws.blockHeight)\n\tws.flusher.KVStoreWithBuffer().MustPut(AccountKVNamespace, []byte(CurrentHeightKey), h)\n\t// Persist accountTrie's root hash\n\trootHash := ws.accountTrie.RootHash()\n\tws.flusher.KVStoreWithBuffer().MustPut(AccountTrieNamespace, []byte(AccountTrieRootKey), rootHash)\n\t// Persist the historical accountTrie's root hash\n\tws.flusher.KVStoreWithBuffer().MustPut(\n\t\tAccountTrieNamespace,\n\t\t[]byte(fmt.Sprintf(\"%s-%d\", AccountTrieRootKey, ws.blockHeight)),\n\t\trootHash,\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "75dcfd8454e820097fcfe4735ede7874", "score": "0.51358366", "text": "func (h *hasherStore) Close() {\n\tclose(h.doneC)\n}", "title": "" }, { "docid": "3a86981363acea53b4cbc33cd5e24166", "score": "0.5126703", "text": "func Finalize() {\n\t// flush stdout.\n\tif stdout.IsLoaded() {\n\t\tStdout().(*stdOutput).close()\n\t\tstdout.Clear()\n\t}\n\n\t// flush stackdriver out.\n\tif stackdriverOut.IsLoaded() {\n\t\terr := Stackdriver().(*stackdriverOutput).client.Close()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tstackdriverOut.Clear()\n\t}\n}", "title": "" }, { "docid": "7343e430c3852b31840e46db6843865b", "score": "0.51258683", "text": "func (s Server) Finalize(N gg.GroupElement, x, aux []byte) ([]byte, error) {\n\treturn nil, oerr.ErrOPRFUnimplementedFunctionServer\n}", "title": "" }, { "docid": "b59a9eca0e4384b22e975f681048499c", "score": "0.51253134", "text": "func (b *Backend) Close() {\n\tclose(b.writeChan)\n\t// Wait for it to finish writing using the syncClose mutex.\n\tb.syncClose.Lock()\n\tdefer b.syncClose.Unlock()\n\tfor _, writer := range b.writers {\n\t\t_ = writer.Close()\n\t}\n}", "title": "" }, { "docid": "6e2d65d28f47bd8bbe242858d696265e", "score": "0.5115846", "text": "func (payload *listInsurancePayload) Finalize() {\n\tvar defaultPageSize = 20\n\tif payload.PageSize == nil {\n\t\tpayload.PageSize = &defaultPageSize\n\t}\n}", "title": "" }, { "docid": "806f0fe7520cec666607534a61564768", "score": "0.5101051", "text": "func (payload *createCustomsInfoPayload) Finalize() {\n\tfor _, e := range payload.CustomsItems {\n\t\tvar defaultCurrency = \"USD\"\n\t\tif e.Currency == nil {\n\t\t\te.Currency = &defaultCurrency\n\t\t}\n\t\tvar defaultOriginCountry = \"US\"\n\t\tif e.OriginCountry == nil {\n\t\t\te.OriginCountry = &defaultOriginCountry\n\t\t}\n\t}\n}", "title": "" }, { "docid": "918d0d67b237029318c4ac93191b6c34", "score": "0.5096592", "text": "func (store *Storage) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "69b249f9bc0eacb9de86d4dbadf760af", "score": "0.508958", "text": "func (aop *AppendOnlyPersist) Close() error {\n\treturn aop.staticF.Close()\n}", "title": "" }, { "docid": "1dfd9b235d73b947e654e0a0a3fa57c9", "score": "0.50822663", "text": "func (b Backend) Flush() {\n\tb.writeAPI.Flush()\n}", "title": "" }, { "docid": "c9eaded0fd2eb4d6fe80519767c0cc12", "score": "0.50728357", "text": "func (c *Class) Finalize(rateLimit uint) {\n\tif rateLimit == 0 {\n\t\trateLimit = 1\n\t}\n\n\tfor code, count := range c.errorsMap {\n\t\tc.ErrorsCode = append(c.ErrorsCode, code)\n\t\tc.ErrorsCount = append(c.ErrorsCount, count)\n\t}\n\n\tc.TotalQueries = (c.TotalQueries * rateLimit) + c.outliers\n\tc.Metrics.Finalize(rateLimit, c.TotalQueries)\n\tif c.Example.QueryTime == 0 {\n\t\tc.Example = nil\n\t}\n}", "title": "" }, { "docid": "99d1b03d75204b4552fc9c8923a87f99", "score": "0.5072501", "text": "func (a *Adaptor) Finalize() error {\n\tprintln(\"adaptor stop\")\n\treturn a.connection.Close()\n}", "title": "" }, { "docid": "b823bf20f4766e4b3b650d80d64c8d34", "score": "0.5062452", "text": "func (s *Store) Close() {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\ts.isClosed = true\n}", "title": "" }, { "docid": "603022880933fec5d3e600ed21e8e422", "score": "0.5055167", "text": "func (this *controllerStruct) finalize() {\n\tthis.running = false\n\tbinding := this.binding\n\thwio.Unregister(binding)\n\tptc := this.processingTaskChannel\n\tclose(ptc)\n}", "title": "" }, { "docid": "56decf86a626d218f6b77d08c2b248e6", "score": "0.5040325", "text": "func (s *MockStore) Close() error {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "608f91fc0d0d6e1b8d774431af18f0bf", "score": "0.503224", "text": "func (w *Writer) Finalize() error {\n\t_, err := fmt.Fprintf(w.output, \"\\n]}\")\n\treturn err\n}", "title": "" }, { "docid": "0ea5c88291568f2418be919af39e8e3c", "score": "0.50308555", "text": "func (baseController *BaseController) Finish() {\n\tdefer func() {\n\t\tif baseController.MongoSession != nil {\n\t\t\tmongo.CloseSession(baseController.UserID, baseController.MongoSession)\n\t\t\tbaseController.MongoSession = nil\n\t\t}\n\t}()\n\n\tlog.Completedf(baseController.UserID, \"Finish\", baseController.Ctx.Request.URL.Path)\n}", "title": "" }, { "docid": "690ade10c51be1ef3abed5ae1e24abcd", "score": "0.5027255", "text": "func (f *FakeChunkStore) Close() {\n}", "title": "" }, { "docid": "06b0b819ce1394e85016890e9707fec3", "score": "0.5024126", "text": "func (t *buildStateTracker) finalize() {\n\tt.latestStateMu.Lock()\n\tdefer t.latestStateMu.Unlock()\n\n\tstate := *t.latestState\n\tif state.final {\n\t\tpanic(\"impossible; finalize called twice?\")\n\t}\n\n\tstate.closed = true\n\tstate.final = true\n\tif state.build == nil {\n\t\tstate.build = &bbpb.Build{\n\t\t\tSummaryMarkdown: \"Never received any build data.\",\n\t\t\tStatus: bbpb.Status_INFRA_FAILURE,\n\t\t}\n\t}\n\tprocessFinalBuild(t.merger.clockNow(), state.build)\n\tstate.buildReadOnly = nil\n\tt.latestState = &state\n\tt.merger.informNewData()\n}", "title": "" }, { "docid": "4849a4491e85e0992e19b9ba35fd3481", "score": "0.50233495", "text": "func (s *MapSessionPersister) Close() {\n\ts.db = nil\n}", "title": "" }, { "docid": "19fdf82987034cee91e729c2beab73ac", "score": "0.5023333", "text": "func (c *Committer) Close() {\n\tlogger.Info(c.context, \"cleaning up handler\")\n\n\t_ = c.environment.Clear()\n\tdefer c.dataPlane.Close()\n}", "title": "" }, { "docid": "03f5d93eaf8f9bab57fdc22aa42dc5c8", "score": "0.50159067", "text": "func (a *APIDefinition) Finalize() {\n\tif len(a.Consumes) == 0 {\n\t\ta.Consumes = DefaultDecoders\n\t}\n\tif len(a.Produces) == 0 {\n\t\ta.Produces = DefaultEncoders\n\t}\n}", "title": "" }, { "docid": "132107db1d71e613f501fb809e3c8366", "score": "0.50098234", "text": "func (w *Writer) Close() error {\n\tlog.Infof(\"FHIR Resources successfully written by the FHIR Writer: %d\", w.count)\n\treturn nil\n}", "title": "" }, { "docid": "df1a278bb2f6ab35c404b569798a7f81", "score": "0.5008018", "text": "func (c connections) Finalize() {\n\tfor _, connection := range c {\n\t\tconnection.Finalize()\n\t}\n}", "title": "" }, { "docid": "c56678749a7bc4f0dfc584d8bbc0df8c", "score": "0.50063276", "text": "func (a *APIClaimFinalizer) Finalize(ctx context.Context, cm Claim) error {\n\tmeta.RemoveFinalizer(cm, finalizerName)\n\treturn errors.Wrap(IgnoreNotFound(a.client.Update(ctx, cm)), errUpdateClaim)\n}", "title": "" }, { "docid": "235b937b0fb603fab4410e4ff19ff60e", "score": "0.50036407", "text": "func finalize(\n\trequest *generic.SyncHookRequest,\n\tresponse *generic.SyncHookResponse,\n) error {\n\tglog.Infof(\"Starting DontPanic finalize\")\n\tdefer glog.Infof(\"Completed DontPanic finalize\")\n\n\tif request.Attachments.IsEmpty() {\n\t\tresponse.Finalized = true\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f15a6cd74aa328c54dbfe071a375581", "score": "0.49975997", "text": "func (bs *Store) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "317bc23f1e6faf05f9c559af5840d0d4", "score": "0.49936914", "text": "func (d *DataStore) Close() {\n\td.s.Close()\n}", "title": "" }, { "docid": "ae24d6c030098011b5ce5e7149c195b2", "score": "0.4989266", "text": "func (s *Live) Finalize(d time.Duration) {}", "title": "" }, { "docid": "596f7d715a8e4f27aa1ff3ba51e06ce5", "score": "0.4989126", "text": "func (s *ExtentStore) Close() {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tif s.closed {\n\t\treturn\n\t}\n\n\t// Release cache\n\ts.cache.Flush()\n\ts.cache.Clear()\n\ts.tinyExtentDeleteFp.Sync()\n\ts.tinyExtentDeleteFp.Close()\n\ts.normalExtentDeleteFp.Sync()\n\ts.normalExtentDeleteFp.Close()\n\ts.verifyExtentFp.Sync()\n\ts.verifyExtentFp.Close()\n\ts.closed = true\n}", "title": "" }, { "docid": "6dd284e7454efc6beffbfeb310e999e8", "score": "0.49883872", "text": "func (DummyStore) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "65c8bfaa21ae2a71d3f57feaddd69ff1", "score": "0.4987244", "text": "func (this *BaseController) Finish() {\n\tdefer func() {\n\t\tif this.MongoSession != nil {\n\t\t\tmongo.CloseSession(this.UserId, this.MongoSession)\n\t\t\tthis.MongoSession = nil\n\t\t}\n\t}()\n\n\ttracelog.COMPLETEDf(this.UserId, \"Finish\", this.Ctx.Request.URL.Path)\n}", "title": "" }, { "docid": "aa67b89936adf34b72fee4f8b2cf5ab1", "score": "0.49825892", "text": "func (kpl *KopiaPersisterLight) Cleanup() {\n\tif err := os.RemoveAll(kpl.baseDir); err != nil {\n\t\tlog.Println(\"cannot remove persistence dir\")\n\t}\n}", "title": "" }, { "docid": "456c72d956a7e3e2554d0fe47e474dce", "score": "0.4980975", "text": "func (w *FHIRWriter) Close() error {\n\tlog.Infof(\"Resources successfully written by the FHIRWriter: %d\", w.count)\n\treturn nil\n}", "title": "" }, { "docid": "456c72d956a7e3e2554d0fe47e474dce", "score": "0.4980975", "text": "func (w *FHIRWriter) Close() error {\n\tlog.Infof(\"Resources successfully written by the FHIRWriter: %d\", w.count)\n\treturn nil\n}", "title": "" }, { "docid": "c3e592214e870c4e7d0a56a148bf18bd", "score": "0.4968898", "text": "func (_VPC *VPCTransactor) Finalize(opts *bind.TransactOpts, alice common.Address, bob common.Address, sid *big.Int) (*types.Transaction, error) {\n\treturn _VPC.contract.Transact(opts, \"finalize\", alice, bob, sid)\n}", "title": "" } ]
50fa81ba77956b6470c73fb90f2d650f
Get gets the specified Azure key vault. Parameters: resourceGroupName the name of the Resource Group to which the vault belongs. vaultName the name of the vault.
[ { "docid": "c4f839ba4ebc3c26af0f6e1397ae8678", "score": "0.7876157", "text": "func (client VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result Vault, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VaultsClient.Get\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetPreparer(ctx, resourceGroupName, vaultName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"Get\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" } ]
[ { "docid": "eaf2ffcf66e990a7ac633af379ba8c35", "score": "0.6498471", "text": "func GetVault(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *VaultState, opts ...pulumi.ResourceOption) (*Vault, error) {\n\tvar resource Vault\n\terr := ctx.ReadResource(\"azure:recoveryservices/vault:Vault\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "1566cadff288b02052e501afde0c23c4", "score": "0.6374382", "text": "func GetVault(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *VaultState, opts ...pulumi.ResourceOption) (*Vault, error) {\n\tvar resource Vault\n\terr := ctx.ReadResource(\"aws:backup/vault:Vault\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "48736a9596d7aeef6a806cf94c77441b", "score": "0.6156428", "text": "func GetVault(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *VaultState, opts ...pulumi.ResourceOpt) (*Vault, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"accessPolicy\"] = state.AccessPolicy\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"location\"] = state.Location\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"notifications\"] = state.Notifications\n\t\tinputs[\"tags\"] = state.Tags\n\t}\n\ts, err := ctx.ReadResource(\"aws:glacier/vault:Vault\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Vault{s: s}, nil\n}", "title": "" }, { "docid": "77fe309496fe24c1a7811ccecec00185", "score": "0.5588938", "text": "func (secretEngine *SecretEngine) GetSecretFromKeyVault(vaultBaseURI, secretName, secretVersion string) string {\n\tfmt.Printf(\"uri %s\", vaultBaseURI)\n\tfmt.Printf(\"name %s\", secretName)\n\tfmt.Printf(\"version %s\", secretVersion)\n\n\ttenantID := secretEngine.TenantID\n\tclientID := secretEngine.ClientID\n\tclientSecret := secretEngine.ClientSecret\n\n\toauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, tenantID)\n\tupdatedAuthorizeEndpoint, err := url.Parse(\"https://login.windows.net/\" + tenantID + \"/oauth2/token\")\n\toauthConfig.AuthorizeEndpoint = *updatedAuthorizeEndpoint\n\tspToken, err := adal.NewServicePrincipalToken(*oauthConfig, clientID, clientSecret, \"https://vault.azure.net\")\n\n\tif err != nil {\n\t\tlog.Fatal(\"failed to create token\", err)\n\t}\n\n\tvaultsClient := keyvault.NewWithoutDefaults()\n\tvaultsClient.Authorizer = autorest.NewBearerAuthorizer(spToken)\n\n\tvault, err := vaultsClient.GetSecret(context.Background(), vaultBaseURI, secretName, secretVersion)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to get secret \", err)\n\t}\n\treturn *vault.Value\n}", "title": "" }, { "docid": "a9a3d55e2a78483f427edeaa356f79d6", "score": "0.5545015", "text": "func (a *StorageProjectVaultApiService) StorageProjectVaultGet(ctx context.Context, projectId string, locationId string, vaultId string) ApiStorageProjectVaultGetRequest {\n\treturn ApiStorageProjectVaultGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tlocationId: locationId,\n\t\tvaultId: vaultId,\n\t}\n}", "title": "" }, { "docid": "dc5a22b11740153bf484d50ca8cf6bc2", "score": "0.5490318", "text": "func GetVaultFile(name string) (*CredentialVault, error) {\n\tp, err := getVaultFilePath(name)\n\tif err != nil && err != ErrVaultFileNotExist {\n\t\treturn nil, err\n\t}\n\n\tf, err := os.Open(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\td := make([]byte, 0)\n\tj := make([]byte, 1)\n\tfor {\n\t\tn, err := f.Read(j)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\td = append(d, j[:n]...)\n\t}\n\n\tv := &CredentialVault{Path: p, body: d, cur: 0}\n\n\treturn v, err\n}", "title": "" }, { "docid": "04efca1089c01d054933919ed54526fb", "score": "0.54710335", "text": "func (v *Vault) Get(key string) (Keyer, error) {\n\tif !v.Exists(key) {\n\t\treturn nil, NotFoundError\n\t}\n\n\treturn v.vault[key], nil\n}", "title": "" }, { "docid": "86de16ab3b957bccc120751415ed7c03", "score": "0.5439613", "text": "func GetKeyVaultResource() (string, error) {\n\tenvName := os.Getenv(\"AZURE_ENVIRONMENT\")\n\tvar env azure.Environment\n\tvar err error\n\n\tif envName == \"\" {\n\t\tenv = azure.PublicCloud\n\t} else {\n\t\tenv, err = azure.EnvironmentFromName(envName)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tresource := os.Getenv(\"AZURE_KEYVAULT_RESOURCE\")\n\tif resource == \"\" {\n\t\tresource = strings.TrimSuffix(env.KeyVaultEndpoint, \"/\")\n\t}\n\n\treturn resource, nil\n}", "title": "" }, { "docid": "61ab999f15289d5e368fa20f0e4ff7f1", "score": "0.54312086", "text": "func GetKeyVaultName(instance runtime.Object) string {\n\tkeyVaultName := \"\"\n\ttarget := &v1alpha1.GenericResource{}\n\tserial, err := json.Marshal(instance)\n\tif err != nil {\n\t\treturn keyVaultName\n\t}\n\t_ = json.Unmarshal(serial, target)\n\treturn target.Spec.KeyVaultToStoreSecrets\n}", "title": "" }, { "docid": "5d4223b5df447ffa08221ffe0324b0a6", "score": "0.5362671", "text": "func (client VaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"vaultName\": autorest.Encode(\"path\", vaultName),\n\t}\n\n\tconst APIVersion = \"2019-09-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "1f73da55a0d2721f2867ef8d07693403", "score": "0.51708937", "text": "func (e *ExternalServiceList) GetVault(cfg *config.Config, retries int) (client *vault.Client, err error) {\n\tclient, err = vault.CreateClient(cfg.VaultToken, cfg.VaultAddr, retries)\n\tif err != nil {\n\t\treturn\n\t}\n\n\te.Vault = true\n\treturn\n}", "title": "" }, { "docid": "b1f977e7557d5eff1f82007fbf53b5ed", "score": "0.49938494", "text": "func (c *Vault) VaultName() string {\n\treturn c.config.keyRingName()\n}", "title": "" }, { "docid": "65cd8963b241f20aa34b08fe67ec460e", "score": "0.49612793", "text": "func (_ConvictionBeta *ConvictionBetaCaller) GetRecoveryVault(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ConvictionBeta.contract.Call(opts, &out, \"getRecoveryVault\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "a487565b0342fa6f39dfa2c5486f2d42", "score": "0.49571097", "text": "func (v *Keyring) Get(id keys.ID) (*api.Key, error) {\n\titem, err := v.Vault.Get(id.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif item == nil {\n\t\treturn nil, nil\n\t}\n\treturn keyForItem(item)\n}", "title": "" }, { "docid": "d4e6528e8d39fa12ec8fbd3333a32817", "score": "0.49430025", "text": "func (a *StorageProjectVaultApiService) StorageProjectVaultTagGet(ctx context.Context, projectId string, locationId string, vaultId string, tagId string) ApiStorageProjectVaultTagGetRequest {\n\treturn ApiStorageProjectVaultTagGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tlocationId: locationId,\n\t\tvaultId: vaultId,\n\t\ttagId: tagId,\n\t}\n}", "title": "" }, { "docid": "4e49b60e06776792999f6b514425a2e2", "score": "0.48877388", "text": "func (a *StorageProjectVaultApiService) StorageProjectVaultSnapshotGet(ctx context.Context, projectId string, locationId string, vaultId string, snapshotId string) ApiStorageProjectVaultSnapshotGetRequest {\n\treturn ApiStorageProjectVaultSnapshotGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tlocationId: locationId,\n\t\tvaultId: vaultId,\n\t\tsnapshotId: snapshotId,\n\t}\n}", "title": "" }, { "docid": "430bbceaff8da15c068f3853a7e13092", "score": "0.48504388", "text": "func (k KVStore) GetVaultData(ctx cosmos.Context) (VaultData, error) {\n\trecord := NewVaultData()\n\t_, err := k.get(ctx, k.GetKey(ctx, prefixVaultData, \"\"), &record)\n\treturn record, err\n}", "title": "" }, { "docid": "8a3562ff87fd260a1ed797d2e9ce8c03", "score": "0.48427916", "text": "func (p *Provider) GetKeyvaultToken(grantType OAuthGrantType) (authorizer autorest.Authorizer, err error) {\n\tkvEndPoint := p.AzureCloudEnvironment.KeyVaultEndpoint\n\tif '/' == kvEndPoint[len(kvEndPoint)-1] {\n\t\tkvEndPoint = kvEndPoint[:len(kvEndPoint)-1]\n\t}\n\tservicePrincipalToken, err := p.GetServicePrincipalToken(kvEndPoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tauthorizer = autorest.NewBearerAuthorizer(servicePrincipalToken)\n\treturn authorizer, nil\n}", "title": "" }, { "docid": "5730e6733fe67cdf9270105b1485c318", "score": "0.48188674", "text": "func (_Distribution *DistributionCaller) GetRecoveryVault(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Distribution.contract.Call(opts, out, \"getRecoveryVault\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "78ff2fc67907562bf5a9246ac3ca8f12", "score": "0.48106644", "text": "func LookupBackupVault(ctx *pulumi.Context, args *LookupBackupVaultArgs, opts ...pulumi.InvokeOption) (*LookupBackupVaultResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupBackupVaultResult\n\terr := ctx.Invoke(\"aws-native:backup:getBackupVault\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "d981c52af1b2158bbaf1a5da3ba0e12e", "score": "0.47354186", "text": "func (c *Client) Get(ctx context.Context, obj runtime.Object) (keyvault.SecretBundle, error) {\n\tsecret, err := c.convert(obj)\n\tif err != nil {\n\t\treturn keyvault.SecretBundle{}, err\n\t}\n\tvault := fmt.Sprintf(\"https://%s.%s\", secret.Spec.Vault, azure.PublicCloud.KeyVaultDNSSuffix)\n\treturn c.internal.GetSecret(ctx, vault, secret.Spec.Name, \"\")\n}", "title": "" }, { "docid": "8ab7539e366f62154769fb04ea7f9a10", "score": "0.47083238", "text": "func (t *ManagementService) Vault() *Vault {\n\treturn &Vault{v: t.vaultProvider.Vault(t.network, t.channel, t.namespace)}\n}", "title": "" }, { "docid": "68a98334b5bc9cf5ca84b38def02a64e", "score": "0.47062376", "text": "func (v *Vault) VaultName() string {\n\treturn v.config.ID\n}", "title": "" }, { "docid": "b7db114eb7b356a159a92b3e030c07b5", "score": "0.47043738", "text": "func getCredsFromVault(providerCredentials map[string][]byte, strAccessKey, strSecretKey string) (string, string, error) {\n\tvClient, err := vault2.NewVaultClient(providerCredentials)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// sample vault path\n\t// vault:kv/data/foo#key\n\t// remove vault prefix\n\tstrAccessIdPath := strings.Replace(strAccessKey, \"vault:\", \"\", 1)\n\tstrSecretKeyPath := strings.Replace(strSecretKey, \"vault:\", \"\", 1)\n\n\t// separate path and key by splitting at #\n\taccessIDPathKeySplit := strings.Split(strAccessIdPath, \"#\")\n\tsecretKeyPathSplit := strings.Split(strSecretKeyPath, \"#\")\n\n\taccessKeyFromVault, err := vClient.ReadVaultSecretPath(accessIDPathKeySplit[0], accessIDPathKeySplit[1])\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tsecretAccessKeyFromVault, err := vClient.ReadVaultSecretPath(secretKeyPathSplit[0], secretKeyPathSplit[1])\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn accessKeyFromVault, secretAccessKeyFromVault, nil\n}", "title": "" }, { "docid": "bb449248c986a79ed8a625d75c4bf937", "score": "0.46879706", "text": "func (_ConvictionBeta *ConvictionBetaCallerSession) Vault() (common.Address, error) {\n\treturn _ConvictionBeta.Contract.Vault(&_ConvictionBeta.CallOpts)\n}", "title": "" }, { "docid": "e5615556741dae6f38f64e84106d5e66", "score": "0.4620021", "text": "func (v *vaultSecretStore) getSecret(ctx context.Context, secret, version string) (*vaultKVResponse, error) {\n\t// Create get secret url\n\tvar vaultSecretPathAddr string\n\tif v.vaultKVPrefix == \"\" {\n\t\tvaultSecretPathAddr = v.vaultAddress + \"/v1/\" + v.vaultEnginePath + \"/data/\" + secret + \"?version=\" + version\n\t} else {\n\t\tvaultSecretPathAddr = v.vaultAddress + \"/v1/\" + v.vaultEnginePath + \"/data/\" + v.vaultKVPrefix + \"/\" + secret + \"?version=\" + version\n\t}\n\n\thttpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, vaultSecretPathAddr, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't generate request: %w\", err)\n\t}\n\t// Set vault token.\n\thttpReq.Header.Set(vaultHTTPHeader, v.vaultToken)\n\t// Set X-Vault-Request header\n\thttpReq.Header.Set(vaultHTTPRequestHeader, \"true\")\n\n\thttpresp, err := v.client.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't get secret: %w\", err)\n\t}\n\n\tdefer httpresp.Body.Close()\n\n\tif httpresp.StatusCode != http.StatusOK {\n\t\tvar b bytes.Buffer\n\t\tio.Copy(&b, httpresp.Body)\n\t\tv.logger.Debugf(\"getSecret %s couldn't get successful response: %#v, %s\", secret, httpresp, b.String())\n\t\tif httpresp.StatusCode == http.StatusNotFound {\n\t\t\t// handle not found error\n\t\t\treturn nil, fmt.Errorf(\"getSecret %s failed %w\", secret, ErrNotFound)\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"couldn't get successful response, status code %d, body %s\",\n\t\t\thttpresp.StatusCode, b.String())\n\t}\n\n\tvar d vaultKVResponse\n\n\tif v.vaultValueType.isMapType() {\n\t\t// parse the secret value to map[string]string\n\t\tif err := json.NewDecoder(httpresp.Body).Decode(&d); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"couldn't decode response body: %s\", err)\n\t\t}\n\t} else {\n\t\t// treat the secret as string\n\t\tb, err := io.ReadAll(httpresp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"couldn't read response: %s\", err)\n\t\t}\n\t\tres := v.json.Get(b, DataStr, DataStr).ToString()\n\t\td.Data.Data = map[string]string{\n\t\t\tsecret: res,\n\t\t}\n\t}\n\n\treturn &d, nil\n}", "title": "" }, { "docid": "b38351e3c1a93eb8598b4d87e55d4842", "score": "0.46164024", "text": "func (c *Client) QueryVault(vaultID, name, value string, opts ...client.ReqOption) ([]string, error) {\n\treturn c.QueryVaultReturnValue, nil\n}", "title": "" }, { "docid": "240497130ee35a21a19b803adadedb85", "score": "0.4611866", "text": "func GetKeyVaultClient(serverAddress *string, authorizer auth.Authorizer) (security_pb.KeyVaultAgentClient, error) {\n\tconn, err := getClientConnection(serverAddress, authorizer)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get KeyVaultClient. Failed to dial: %v\", err)\n\t}\n\n\treturn security_pb.NewKeyVaultAgentClient(conn), nil\n}", "title": "" }, { "docid": "9ab5b6682e53c28a40a2d18a02d92a02", "score": "0.46077117", "text": "func LoadVault() error {\n\terr := config()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif vault.Secret == \"\" {\n\t\tlog.Debug(\"No Secret defined for vault.\")\n\t\treturn nil\n\t}\n\n\tif vault.Addr == \"\" {\n\t\tlog.Fatal(\"No address defined for vault.\")\n\t}\n\n\tlog.Noticef(\"Read config from: %s secret: %s\", vault.Addr, vault.Secret)\n\n\tcl := newClient(vault.CA, \"\", \"\")\n\tcl.Token = vault.Token\n\tdata, err := cl.req(methodGET, fmt.Sprintf(\"%s/v1/%s\", vault.Addr, vault.Secret))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.NilDebugf(\"%#v\", data.Data)\n\tfor key, value := range data.Data {\n\t\tviper.Set(key, value)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ec5f76f47f3695c5d3fc03ed4146af46", "score": "0.4602201", "text": "func AzureKeyVaultLookupKey(hc hiera.ProviderContext, key string) dgo.Value {\n\tif key == `lookup_options` {\n\t\treturn nil\n\t}\n\tvaultName, ok := hc.StringOption(`vault_name`)\n\tif !ok {\n\t\tpanic(fmt.Errorf(`missing required provider option 'vault_name'`))\n\t}\n\tvar authorizer autorest.Authorizer\n\tvar err error\n\tif os.Getenv(\"AZURE_TENANT_ID\") != \"\" && os.Getenv(\"AZURE_CLIENT_ID\") != \"\" && os.Getenv(\"AZURE_CLIENT_SECRET\") != \"\" {\n\t\tauthorizer, err = auth.NewAuthorizerFromEnvironment()\n\t} else {\n\t\tauthorizer, err = auth.NewAuthorizerFromCLI()\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tclient := keyvault.New()\n\tclient.Authorizer = authorizer\n\tresp, err := client.GetSecret(context.Background(), \"https://\"+vaultName+\".vault.azure.net\", key, \"\")\n\tif err != nil {\n\t\tif ResponseWasStatusCode(resp.Response, http.StatusNotFound) {\n\t\t\treturn nil\n\t\t}\n\t\tpanic(err)\n\t}\n\treturn hc.ToData(*resp.Value)\n}", "title": "" }, { "docid": "02e8abf6574b712396a244d0c08b3f0c", "score": "0.45916954", "text": "func (client VaultsClient) GetDeleted(ctx context.Context, vaultName string, location string) (result DeletedVault, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VaultsClient.GetDeleted\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetDeletedPreparer(ctx, vaultName, location)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"GetDeleted\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetDeletedSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"GetDeleted\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetDeletedResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"GetDeleted\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "dc5b71f3c9e16522d7f9baa774cebdf7", "score": "0.45800093", "text": "func (_ConvictionBeta *ConvictionBetaSession) Vault() (common.Address, error) {\n\treturn _ConvictionBeta.Contract.Vault(&_ConvictionBeta.CallOpts)\n}", "title": "" }, { "docid": "f29eda40153e2be859042f15f3c103a0", "score": "0.45733333", "text": "func NewVault() Client {\n\n\tclient, err := api.NewClient(&api.Config{\n\t\tAddress: os.Getenv(\"VAULT_ADDR\"),\n\t})\n\tif err != nil {\n\t\tcommon.Logger.WithFields(logrus.Fields{\n\t\t\t\"unit\": \"vault\",\n\t\t\t\"function\": \"new\",\n\t\t}).Fatal(\"Failed to create vault client\")\n\t}\n\tclient.SetToken(os.Getenv(\"VAULT_TOKEN\"))\n\n\treturn &vaultClient{client}\n\n}", "title": "" }, { "docid": "3d7edcb4a4f3d5850e18f47ffe90942c", "score": "0.45717913", "text": "func (c Configuration) Vault() *SecretsVault {\n\tvault, vaultErr := MakeSecretsVault(\"env://LECTIO_VAULTPP_DEFAULT\")\n\tif vaultErr != nil {\n\t\tpanic(vaultErr)\n\t}\n\treturn vault\n}", "title": "" }, { "docid": "af435583627a57f640aca6956e87cc50", "score": "0.45632237", "text": "func (k *KVService) GetSecret(vaultBaseUrl, secretName string) (*string, error) {\n\t// finding latest version\n\tvar version string\n\tresp, err := k.KeyClient.GetSecretVersions(k.Ctx, vaultBaseUrl, secretName, to.Int32Ptr(5))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get secret versions\")\n\t}\n\n\t// should contain one version of secret\n\t// for resp.NotDone() {\n\tif resp.NotDone() {\n\t\titems := resp.Values()\n\t\tversion = filepath.Base(to.String(items[0].ID))\n\n\t\t//for _,item := range items {\n\t\t//\tfmt.Println(*item.ID)\n\t\t//\tfmt.Println(*item.Attributes.Created)\n\t\t//}\n\t\t//err = resp.Next()\n\t\t//if err!=nil {\n\t\t//\treturn nil, errors.Wrap(err, \"unable to get next pages of version\")\n\t\t//}\n\t\t//fmt.Println(\"iterating..\")\n\t}\n\n\tsr, err := k.KeyClient.GetSecret(k.Ctx, vaultBaseUrl, secretName, version)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to get secret(%s) of version(%s)\", secretName, version)\n\t}\n\n\treturn sr.Value, nil\n}", "title": "" }, { "docid": "df584bc8dff58ea5bdee981cc9ff9015", "score": "0.4556985", "text": "func (vault *Vault_Spec_ARM) GetName() string {\n\treturn vault.Name\n}", "title": "" }, { "docid": "0b133c32412a12b3d6a5506f91083db6", "score": "0.4553532", "text": "func (client ResourceClient) Get(resourceGroupName string, resourceName string) (result Description, err error) {\n\treq, err := client.GetPreparer(resourceGroupName, resourceName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"iothub.ResourceClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"iothub.ResourceClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"iothub.ResourceClient\", \"Get\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "155604e5e873b1219a035c3518d25c6f", "score": "0.45119983", "text": "func (a *StorageProjectVaultApiService) StorageProjectVaultCredentialGet(ctx context.Context, projectId string, locationId string, vaultId string, credentialId string) ApiStorageProjectVaultCredentialGetRequest {\n\treturn ApiStorageProjectVaultCredentialGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tlocationId: locationId,\n\t\tvaultId: vaultId,\n\t\tcredentialId: credentialId,\n\t}\n}", "title": "" }, { "docid": "b34101dc2e1d34b9c7ae46ad31a4c043", "score": "0.44847983", "text": "func (_ConvictionBeta *ConvictionBetaCallerSession) GetRecoveryVault() (common.Address, error) {\n\treturn _ConvictionBeta.Contract.GetRecoveryVault(&_ConvictionBeta.CallOpts)\n}", "title": "" }, { "docid": "e0da37bb950e2a9d4d1fc398269b9a36", "score": "0.44709828", "text": "func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string) (result VirtualMachine, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VirtualMachinesClient.Get\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: labName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"labName\", Name: validation.MaxLength, Rule: 100, Chain: nil},\n\t\t\t\t{Target: \"labName\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: virtualMachineName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"virtualMachineName\", Name: validation.MaxLength, Rule: 100, Chain: nil},\n\t\t\t\t{Target: \"virtualMachineName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"virtualMachineName\", Name: validation.Pattern, Rule: `^[-\\w\\\\._\\\\(\\\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"labservices.VirtualMachinesClient\", \"Get\", err.Error())\n\t}\n\n\treq, err := client.GetPreparer(ctx, resourceGroupName, labName, virtualMachineName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"labservices.VirtualMachinesClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"labservices.VirtualMachinesClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"labservices.VirtualMachinesClient\", \"Get\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8cbc52d2cfa511a33c383f2645b2794c", "score": "0.44664916", "text": "func (client VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string) (result autorest.Response, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VaultsClient.Delete\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response != nil {\n\t\t\t\tsc = result.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.DeletePreparer(ctx, resourceGroupName, vaultName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"Delete\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.DeleteSender(req)\n\tif err != nil {\n\t\tresult.Response = resp\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"Delete\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"Delete\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c5274801c6aa3912148bd5380760f428", "score": "0.44549507", "text": "func (vault *Vault) GetType() string {\n\treturn \"Microsoft.KeyVault/vaults\"\n}", "title": "" }, { "docid": "45f4e3cc667be4bbfe1f03c663272a4e", "score": "0.44486457", "text": "func (a *StorageProjectVaultApiService) StorageProjectVaultEventGet(ctx context.Context, projectId string, locationId string, vaultId string, eventId string) ApiStorageProjectVaultEventGetRequest {\n\treturn ApiStorageProjectVaultEventGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tlocationId: locationId,\n\t\tvaultId: vaultId,\n\t\teventId: eventId,\n\t}\n}", "title": "" }, { "docid": "8005d9c485944939c71644546de5c8bb", "score": "0.4445389", "text": "func (c *Configuration) GetVaultConfig() *Vault {\n\treturn Config[\"vault_config\"].(*Vault)\n}", "title": "" }, { "docid": "935f9963e0e31a2241f6db9ca7b7865c", "score": "0.44316632", "text": "func (_ConvictionBeta *ConvictionBetaSession) GetRecoveryVault() (common.Address, error) {\n\treturn _ConvictionBeta.Contract.GetRecoveryVault(&_ConvictionBeta.CallOpts)\n}", "title": "" }, { "docid": "886f927f4646e3103ce7a8a81ac3ba99", "score": "0.44189355", "text": "func (v *vaultSecretStore) GetSecret(ctx context.Context, req secretstores.GetSecretRequest) (secretstores.GetSecretResponse, error) {\n\t// version 0 represent for latest version\n\tversion := \"0\"\n\tif value, ok := req.Metadata[versionID]; ok {\n\t\tversion = value\n\t}\n\td, err := v.getSecret(ctx, req.Name, version)\n\tif err != nil {\n\t\treturn secretstores.GetSecretResponse{Data: nil}, err\n\t}\n\n\tresp := secretstores.GetSecretResponse{\n\t\tData: d.Data.Data,\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "c11697c8b4d2020431081b9a6dba8d36", "score": "0.43957323", "text": "func getTestVaultClient() *api.Client {\n\tconfig := &api.Config{\n\t\tAddress: vaultAddress,\n\t}\n\tclient, _ := api.NewClient(config)\n\tclient.SetToken(vaultToken)\n\n\treturn client\n}", "title": "" }, { "docid": "c11bf0e2197df1e24cd78d24f2f32a96", "score": "0.43695349", "text": "func (client VaultsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result VaultListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VaultsClient.ListByResourceGroup\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.vlr.Response.Response != nil {\n\t\t\t\tsc = result.vlr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listByResourceGroupNextResults\n\treq, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"ListByResourceGroup\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListByResourceGroupSender(req)\n\tif err != nil {\n\t\tresult.vlr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"ListByResourceGroup\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.vlr, err = client.ListByResourceGroupResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"ListByResourceGroup\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.vlr.hasNextLink() && result.vlr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "aa745a8bae602b14b163e716d3409b8e", "score": "0.43543467", "text": "func (s *Setup) Vault() (Service, error) {\n\tlogrus.Trace(\"creating vault secret client from setup\")\n\n\t// create new Vault secret service\n\t//\n\t// https://pkg.go.dev/github.com/go-vela/server/secret/vault?tab=doc#New\n\treturn vault.New(\n\t\tvault.WithAddress(s.Address),\n\t\tvault.WithAuthMethod(s.AuthMethod),\n\t\tvault.WithAWSRole(s.AwsRole),\n\t\tvault.WithPrefix(s.Prefix),\n\t\tvault.WithToken(s.Token),\n\t\tvault.WithTokenDuration(s.TokenDuration),\n\t\tvault.WithVersion(s.Version),\n\t)\n}", "title": "" }, { "docid": "d44c21a63a8faee1505ae7361dbe4770", "score": "0.4346731", "text": "func (v *Vault) GetSecret(key string) (string, error) {\n\n\tcipherText := v.Secrets[key]\n\n\tif cipherText == \"\" {\n\t\treturn \"\", fmt.Errorf(\"No secret by that name\")\n\t}\n\n\tsecretBytes, err := v.Crypter.Decrypt(cipherText)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(secretBytes), nil\n}", "title": "" }, { "docid": "531db9ecc586ed00c1366b860baa86a7", "score": "0.43091604", "text": "func GetVaultAddress() string {\n\treturn os.Getenv(VaultAddressKey)\n}", "title": "" }, { "docid": "5cb45d0a9af4f394abb5d05e2cd4ad50", "score": "0.43063968", "text": "func (p *Provider) GetKeyVaultObjectContent(ctx context.Context, objectType string, objectName string, objectVersion string) (content string, err error) {\n\tvaultURL, err := p.getVaultURL(ctx)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to get vault\")\n\t}\n\n\tkvClient, err := p.initializeKvClient()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to get keyvaultClient\")\n\t}\n\n\tswitch objectType {\n\tcase VaultObjectTypeSecret:\n\t\tsecret, err := kvClient.GetSecret(ctx, *vaultURL, objectName, objectVersion)\n\t\tif err != nil {\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\t\treturn *secret.Value, nil\n\tcase VaultObjectTypeKey:\n\t\tkeybundle, err := kvClient.GetKey(ctx, *vaultURL, objectName, objectVersion)\n\t\tif err != nil {\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\t\tswitch keybundle.Key.Kty {\n\t\tcase kv.RSA:\n\t\t\t// NOTE: we are writing the RSA modulus content of the key\n\t\t\treturn *keybundle.Key.N, nil\n\t\tdefault:\n\t\t\terr := errors.Errorf(\"failed to get key. key type '%s' currently not supported\", keybundle.Key.Kty)\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\tcase VaultObjectTypeCertificate:\n\t\tcertbundle, err := kvClient.GetCertificate(ctx, *vaultURL, objectName, objectVersion)\n\t\tif err != nil {\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\t\tif !*certbundle.Policy.KeyProperties.Exportable {\n\t\t\terr := errors.Errorf(\"cert key is not exportable\")\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\t\tsecretBundle, err := kvClient.GetSecret(ctx, *vaultURL, objectName, objectVersion)\n\t\tif err != nil {\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\t\tswitch *secretBundle.ContentType {\n\t\tcase certTypePem:\n\t\t\treturn *secretBundle.Value, nil\n\t\tcase certTypePfx:\n\t\t\tcontent, err := decodePKCS12(*secretBundle.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t\t}\n\t\t\treturn content, nil\n\t\tdefault:\n\t\t\terr := errors.Errorf(\"failed to get certificate. unknown content type '%s'\", *secretBundle.ContentType)\n\t\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t\t}\n\tdefault:\n\t\terr := errors.Errorf(\"Invalid vaultObjectTypes. Should be secret, key, or cert\")\n\t\treturn \"\", wrapObjectTypeError(err, objectType, objectName, objectVersion)\n\t}\n}", "title": "" }, { "docid": "0ba96a463ea4ac5f7ec155603bb559ee", "score": "0.42958543", "text": "func (_ConvictionBeta *ConvictionBetaCaller) Vault(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ConvictionBeta.contract.Call(opts, &out, \"vault\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "e74fdeca0dff1764cafd109752ff302f", "score": "0.42810112", "text": "func (group *Group) GetWithLangString(lang string, key string) (*Translation, error) {\n\treturn group.i18n.GetWithLangString(lang, group.key(key))\n}", "title": "" }, { "docid": "b40c0b24efb145d83fd8583991e2f1a6", "score": "0.42792246", "text": "func (s *Store) Get(k string) (string, error) {\n\tvalue, exists := s.data[k]\n\tif !exists {\n\t\treturn \"\", fmt.Errorf(\"Secret '%s' not found, has it been set in vault under vault.SecretsPath\", k)\n\t}\n\n\treturn value, nil\n}", "title": "" }, { "docid": "82db44bac18ef463067b241553770534", "score": "0.42731375", "text": "func GetVaultToken() string {\n\treturn os.Getenv(VaultSecretKey)\n}", "title": "" }, { "docid": "bbc057e50492421a3dd247425e8035fb", "score": "0.42660943", "text": "func readValueFromVault(path string) (string, bool, error) {\n\tvaultClient := getTestVaultClient()\n\treq := vaultClient.NewRequest(\"GET\", path)\n\tresp, err := vaultClient.RawRequest(req)\n\n\tif resp.StatusCode == 404 {\n\t\treturn \"\", false, nil\n\t}\n\n\tif err != nil {\n\t\treturn \"\", false, err\n\t}\n\n\tvar buf bytes.Buffer\n\tio.Copy(&buf, resp.Body)\n\n\tvar respJSON map[string]interface{}\n\n\terr = json.Unmarshal(buf.Bytes(), &respJSON)\n\tif err != nil {\n\t\treturn \"\", true, fmt.Errorf(\"cannot unmarshal Vault response: %v\", err)\n\t}\n\n\tdata, ok := respJSON[\"data\"]\n\tif !ok {\n\t\treturn \"\", true, fmt.Errorf(\"data not found in Vault response\")\n\t}\n\n\tdataMap, ok := data.(map[string]interface{})\n\tif !ok {\n\t\treturn \"\", true, fmt.Errorf(\"data in Vault response is of invalid type\")\n\t}\n\n\tvalue, ok := dataMap[\"value\"]\n\tif !ok {\n\t\treturn \"\", true, fmt.Errorf(\"value not found in Vault response\")\n\t}\n\n\tvalueText, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn \"\", true, fmt.Errorf(\"cannot get value text: %v\", err)\n\t}\n\n\treturn string(valueText), true, nil\n}", "title": "" }, { "docid": "c73ccf40438c36554bc4e3cbd27166f8", "score": "0.4238528", "text": "func (a *StorageProjectVaultApiService) StorageProjectVaultServiceGet(ctx context.Context, projectId string, locationId string, vaultId string, serviceId string) ApiStorageProjectVaultServiceGetRequest {\n\treturn ApiStorageProjectVaultServiceGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tlocationId: locationId,\n\t\tvaultId: vaultId,\n\t\tserviceId: serviceId,\n\t}\n}", "title": "" }, { "docid": "4864bf2e6b8bdc9e4191f0d37ef88a9a", "score": "0.42116892", "text": "func Load(c config.Vault) (*Store, error) {\n\ts := &Store{data: make(map[string]string)}\n\tv, err := vaultapi.NewClient(\n\t\t&vaultapi.Config{\n\t\t\tAddress: c.HostAddress,\n\t\t\tTimeout: 20 * time.Second,\n\t\t\tMaxRetries: 5,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tv.SetToken(c.Token)\n\tsecrets, err := v.Logical().Read(c.SecretsPath)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tif secrets == nil {\n\t\treturn s, fmt.Errorf(\"read on vault secrets path %s returned nil\", c.SecretsPath)\n\t}\n\n\tfor k, v := range secrets.Data {\n\t\ts.data[k] = v.(string)\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "ee6c5e8d05560628e4dc3d89bc44a183", "score": "0.41987652", "text": "func NewVault(ctx *pulumi.Context,\n\tname string, args *VaultArgs, opts ...pulumi.ResourceOption) (*Vault, error) {\n\tif args == nil {\n\t\targs = &VaultArgs{}\n\t}\n\n\tvar resource Vault\n\terr := ctx.RegisterResource(\"aws:backup/vault:Vault\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "4810b074dcad143fa2b751f57c40a1fd", "score": "0.41959026", "text": "func (_Distribution *DistributionSession) GetRecoveryVault() (common.Address, error) {\n\treturn _Distribution.Contract.GetRecoveryVault(&_Distribution.CallOpts)\n}", "title": "" }, { "docid": "3a0f3f73e3a5fdd86d207ed4caf7cc2d", "score": "0.41887072", "text": "func NewVault(ctx *pulumi.Context,\n\tname string, args *VaultArgs, opts ...pulumi.ResourceOption) (*Vault, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.Sku == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Sku'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Vault\n\terr := ctx.RegisterResource(\"azure:recoveryservices/vault:Vault\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "92c64383a3990b86ea8ae9e9fa7f152b", "score": "0.41869932", "text": "func (c *FakeKeyVaultKeys) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KeyVaultKey, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(keyvaultkeysResource, c.ns, name), &v1alpha1.KeyVaultKey{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.KeyVaultKey), err\n}", "title": "" }, { "docid": "7644c708ab1fb3b3e4c1aba9edea7eec", "score": "0.41820633", "text": "func (_Distribution *DistributionCallerSession) GetRecoveryVault() (common.Address, error) {\n\treturn _Distribution.Contract.GetRecoveryVault(&_Distribution.CallOpts)\n}", "title": "" }, { "docid": "40a5ce891aaa0a3ee939f07a0afb4d25", "score": "0.41814515", "text": "func GetKeyvaultAuthorizer() (autorest.Authorizer, error) {\n\tif keyvaultAuthorizer != nil {\n\t\treturn keyvaultAuthorizer, nil\n\t}\n\n\t// BUG: default value for KeyVaultEndpoint is wrong\n\tvaultEndpoint := strings.TrimSuffix(config.Environment().KeyVaultEndpoint, \"/\")\n\t// BUG: alternateEndpoint replaces other endpoints in the configs below\n\talternateEndpoint, _ := url.Parse(\n\t\t\"https://login.windows.net/\" + config.TenantID() + \"/oauth2/token\")\n\n\tvar a autorest.Authorizer\n\tvar err error\n\n\tswitch grantType() {\n\tcase OAuthGrantTypeServicePrincipal:\n\t\toauthconfig, err := adal.NewOAuthConfig(\n\t\t\tconfig.Environment().ActiveDirectoryEndpoint, config.TenantID())\n\t\tif err != nil {\n\t\t\treturn a, err\n\t\t}\n\t\toauthconfig.AuthorizeEndpoint = *alternateEndpoint\n\n\t\ttoken, err := adal.NewServicePrincipalToken(\n\t\t\t*oauthconfig, config.ClientID(), config.ClientSecret(), vaultEndpoint)\n\t\tif err != nil {\n\t\t\treturn a, err\n\t\t}\n\n\t\ta = autorest.NewBearerAuthorizer(token)\n\n\tcase OAuthGrantTypeDeviceFlow:\n\t\tdeviceConfig := auth.NewDeviceFlowConfig(config.ClientID(), config.TenantID())\n\t\tdeviceConfig.Resource = vaultEndpoint\n\t\tdeviceConfig.AADEndpoint = alternateEndpoint.String()\n\t\ta, err = deviceConfig.Authorizer()\n\tdefault:\n\t\treturn a, fmt.Errorf(\"invalid grant type specified\")\n\t}\n\n\tif err == nil {\n\t\tkeyvaultAuthorizer = a\n\t} else {\n\t\tkeyvaultAuthorizer = nil\n\t}\n\n\treturn keyvaultAuthorizer, err\n}", "title": "" }, { "docid": "3b84412985e3274b4640296c62c909ea", "score": "0.41790712", "text": "func (o GetCertificatesResultOutput) KeyVaultId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetCertificatesResult) string { return v.KeyVaultId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2d0c18b0339d6a8294d8cf0d0de5d069", "score": "0.4170355", "text": "func New(keyvaultName string, creds config.Credentials) *KeyvaultSecretClient {\n\tkeyvaultClient := keyvaults.New()\n\ta, _ := iam.GetKeyvaultAuthorizer(creds)\n\tkeyvaultClient.Authorizer = a\n\tkeyvaultClient.AddToUserAgent(config.UserAgent())\n\treturn &KeyvaultSecretClient{\n\t\tKeyVaultClient: keyvaultClient,\n\t\tKeyVaultName: keyvaultName,\n\t}\n\n}", "title": "" }, { "docid": "bbb788ab5e2b3129f0749eea485c6a4a", "score": "0.41658914", "text": "func (vault *Vault_Spec_ARM) GetType() string {\n\treturn \"Microsoft.KeyVault/vaults\"\n}", "title": "" }, { "docid": "3c394ad21698838cc97930615e85a4e9", "score": "0.4152145", "text": "func (r *ProjectsLocationsKeyRingsService) Get(name string) *ProjectsLocationsKeyRingsGetCall {\n\tc := &ProjectsLocationsKeyRingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "00c77363b8cdc76d0cacfbed793a658c", "score": "0.4141746", "text": "func (a *Client) GetLolInventoryV1Wallet(params *GetLolInventoryV1WalletParams) (*GetLolInventoryV1WalletOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLolInventoryV1WalletParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetLolInventoryV1Wallet\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/lol-inventory/v1/wallet\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/x-msgpack\", \"application/x-yaml\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.api+json\", \"application/x-msgpack\", \"application/x-www-form-urlencoded\", \"application/x-yaml\", \"multipart/form-data\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetLolInventoryV1WalletReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetLolInventoryV1WalletOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetLolInventoryV1Wallet: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "36cd7ede3675e6e385e2a5765e1998ee", "score": "0.41389534", "text": "func (a *App) Decrypt(vault string) {\n\tvar cfg *VaultConfig\n\tfor _, c := range a.vaultConfigs() {\n\t\tif c.vaultName == vault {\n\t\t\tcfg = c\n\t\t\tbreak\n\t\t}\n\t}\n\tif cfg == nil {\n\t\ta.Context.ExitWithError(fmt.Errorf(\"no vault found: %s\", vault))\n\t}\n\ta.info.Printf(\"using vault: %s\\n\", cfg.vaultName)\n\tjob := &Job{VaultConfig: cfg, context: a.Context}\n\tif _, err := job.Decrypt(); err != nil {\n\t\ta.Context.ExitWithError(err)\n\t}\n}", "title": "" }, { "docid": "4ccc8f72d49d013d81c2262c477c529a", "score": "0.4130681", "text": "func NewVault() (keyfob.KeyVault, error) {\n\tdb, err := bbolt.Open(\"dead.bolt\", unixPermOwnerRW, &bbolt.Options{Timeout: 1 * time.Second})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &vault{\n\t\tdb: db,\n\t}, nil\n}", "title": "" }, { "docid": "430cae84159f123ed98412cdba3ec782", "score": "0.4124995", "text": "func LookupVaultConfig(kvs config.KVS) (VaultConfig, error) {\n\tif err := config.CheckValidKeys(config.KmsVaultSubSys, kvs, DefaultVaultKVS); err != nil {\n\t\treturn VaultConfig{}, err\n\t}\n\n\tvcfg, err := lookupConfigLegacy(kvs)\n\tif err != nil {\n\t\treturn vcfg, err\n\t}\n\n\tif vcfg.Enabled {\n\t\treturn vcfg, nil\n\t}\n\n\tvcfg = VaultConfig{\n\t\tAuth: VaultAuth{\n\t\t\tType: \"approle\",\n\t\t},\n\t}\n\n\tendpointStr := env.Get(EnvKMSVaultEndpoint, kvs.Get(KMSVaultEndpoint))\n\tif endpointStr != \"\" {\n\t\t// Lookup Hashicorp-Vault configuration & overwrite config entry if ENV var is present\n\t\tendpoint, err := xnet.ParseHTTPURL(endpointStr)\n\t\tif err != nil {\n\t\t\treturn vcfg, err\n\t\t}\n\t\tendpointStr = endpoint.String()\n\t}\n\n\tvcfg.Endpoint = endpointStr\n\tvcfg.CAPath = env.Get(EnvKMSVaultCAPath, kvs.Get(KMSVaultCAPath))\n\tvcfg.Auth.Type = env.Get(EnvKMSVaultAuthType, kvs.Get(KMSVaultAuthType))\n\tif vcfg.Auth.Type == \"\" {\n\t\tvcfg.Auth.Type = \"approle\"\n\t}\n\n\tvcfg.Auth.AppRole.ID = env.Get(EnvKMSVaultAppRoleID, kvs.Get(KMSVaultAppRoleID))\n\tvcfg.Auth.AppRole.Secret = env.Get(EnvKMSVaultAppSecretID, kvs.Get(KMSVaultAppRoleSecret))\n\tvcfg.Key.Name = env.Get(EnvKMSVaultKeyName, kvs.Get(KMSVaultKeyName))\n\tvcfg.Namespace = env.Get(EnvKMSVaultNamespace, kvs.Get(KMSVaultNamespace))\n\tif keyVersion := env.Get(EnvKMSVaultKeyVersion, kvs.Get(KMSVaultKeyVersion)); keyVersion != \"\" {\n\t\tvcfg.Key.Version, err = strconv.Atoi(keyVersion)\n\t\tif err != nil {\n\t\t\treturn vcfg, Errorf(\"Unable to parse VaultKeyVersion value (`%s`)\", keyVersion)\n\t\t}\n\t}\n\n\tif reflect.DeepEqual(vcfg, defaultVaultCfg) {\n\t\treturn vcfg, nil\n\t}\n\n\t// Verify all the proper settings.\n\tif err = vcfg.Verify(); err != nil {\n\t\treturn vcfg, err\n\t}\n\n\tvcfg.Enabled = true\n\treturn vcfg, nil\n}", "title": "" }, { "docid": "93a060e1dd71e73957584472612ac38a", "score": "0.4097627", "text": "func (k *KeyvaultSecretClient) Get(ctx context.Context, key types.NamespacedName) (map[string][]byte, error) {\n\tvaultBaseURL := getVaultsURL(ctx, k.KeyVaultName)\n\tvar secretName string\n\tif len(key.Namespace) != 0 {\n\t\tsecretName = key.Namespace + \"-\" + key.Name\n\t} else {\n\t\tsecretName = key.Name\n\t}\n\n\tsecretVersion := \"\"\n\tdata := map[string][]byte{}\n\n\tresult, err := k.KeyVaultClient.GetSecret(ctx, vaultBaseURL, secretName, secretVersion)\n\n\tif err != nil {\n\t\treturn data, fmt.Errorf(\"secret does not exist\" + err.Error())\n\t}\n\n\tstringSecret := *result.Value\n\n\t// Convert the data from json string to map\n\tjsonErr := json.Unmarshal([]byte(stringSecret), &data)\n\n\t// If Unmarshal fails on the input data, the secret likely not a json string so we return the string value directly rather than unmarshaling\n\tif jsonErr != nil {\n\t\tdata = map[string][]byte{\n\t\t\tsecretName: []byte(stringSecret),\n\t\t}\n\t}\n\n\treturn data, err\n}", "title": "" }, { "docid": "01ed06170d40aea00cdbeedaaad1d601", "score": "0.40928927", "text": "func openVault(path string) (*secrets.Keeper, error) {\n\tdefaultVaultConfig := vaultapi.DefaultConfig()\n\tcfg := &vault.Config{\n\t\tToken: os.Getenv(\"VAULT_SERVER_TOKEN\"),\n\t\tAPIConfig: *defaultVaultConfig,\n\t}\n\tif v := os.Getenv(\"VAULT_SERVER_URL\"); v != \"\" {\n\t\tcfg.APIConfig.Address = v\n\t}\n\n\tctx, cancelFn := context.WithTimeout(context.TODO(), 10*time.Second)\n\tdefer cancelFn()\n\n\tapi, err := vault.Dial(ctx, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vault.OpenKeeper(api, path, nil), nil\n}", "title": "" }, { "docid": "761e143767a0d8623814d9f8be345fd6", "score": "0.40824583", "text": "func (o PolicyVMWorkloadOutput) RecoveryVaultName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PolicyVMWorkload) pulumi.StringOutput { return v.RecoveryVaultName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bac78ecbb13f304c214b61ef0a6449b8", "score": "0.4079468", "text": "func (client VaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (result VaultsCreateOrUpdateFuture, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VaultsClient.CreateOrUpdate\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response() != nil {\n\t\t\t\tsc = result.Response().StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: vaultName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"vaultName\", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}},\n\t\t{TargetValue: parameters,\n\t\t\tConstraints: []validation.Constraint{{Target: \"parameters.Location\", Name: validation.Null, Rule: true, Chain: nil},\n\t\t\t\t{Target: \"parameters.Properties\", Name: validation.Null, Rule: true,\n\t\t\t\t\tChain: []validation.Constraint{{Target: \"parameters.Properties.TenantID\", Name: validation.Null, Rule: true, Chain: nil},\n\t\t\t\t\t\t{Target: \"parameters.Properties.Sku\", Name: validation.Null, Rule: true,\n\t\t\t\t\t\t\tChain: []validation.Constraint{{Target: \"parameters.Properties.Sku.Family\", Name: validation.Null, Rule: true, Chain: nil}}},\n\t\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"keyvault.VaultsClient\", \"CreateOrUpdate\", err.Error())\n\t}\n\n\treq, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, parameters)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"CreateOrUpdate\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresult, err = client.CreateOrUpdateSender(req)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.VaultsClient\", \"CreateOrUpdate\", nil, \"Failure sending request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3f2583b6b5e5935249a135d909ea54c7", "score": "0.40751427", "text": "func (o WorkspaceEncryptionOutput) KeyVaultId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WorkspaceEncryption) string { return v.KeyVaultId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e7c963d9d7a59286a82d77f60baf1cea", "score": "0.4063503", "text": "func (azureTestClient *AzureTestClient) GetLoadBalancer(resourceGroupName, lbName string) (aznetwork.LoadBalancer, error) {\n\tlbClient := azureTestClient.createLoadBalancerClient()\n\treturn lbClient.Get(context.Background(), resourceGroupName, lbName, \"\")\n}", "title": "" }, { "docid": "2d303f266c5ea7f48363e5e420ce0f9d", "score": "0.4052855", "text": "func GetInventory(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *InventoryState, opts ...pulumi.ResourceOption) (*Inventory, error) {\n\tvar resource Inventory\n\terr := ctx.ReadResource(\"aws:s3/inventory:Inventory\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "0590c164f69b691cf33cca74fe3fcf5c", "score": "0.40398872", "text": "func (a *Client) GetLolInventoryV1SignedWallet(params *GetLolInventoryV1SignedWalletParams) (*GetLolInventoryV1SignedWalletOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLolInventoryV1SignedWalletParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetLolInventoryV1SignedWallet\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/lol-inventory/v1/signedWallet\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/x-msgpack\", \"application/x-yaml\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.api+json\", \"application/x-msgpack\", \"application/x-www-form-urlencoded\", \"application/x-yaml\", \"multipart/form-data\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetLolInventoryV1SignedWalletReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetLolInventoryV1SignedWalletOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetLolInventoryV1SignedWallet: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "b59d121c30b0c0e61371872e8027b8c9", "score": "0.4036607", "text": "func (c RestClient) SnapshotGet(ctx context.Context, volumeUUID, snapshotUUID string) (*storage.SnapshotGetOK, error) {\n\tparams := storage.NewSnapshotGetParamsWithTimeout(c.httpClient.Timeout)\n\tparams.Context = ctx\n\tparams.HTTPClient = c.httpClient\n\n\tparams.VolumeUUID = volumeUUID\n\tparams.UUID = snapshotUUID\n\n\treturn c.api.Storage.SnapshotGet(params, c.authInfo)\n}", "title": "" }, { "docid": "308917c040a9cd8802ace98cc5da8418", "score": "0.4027518", "text": "func (client Client) Get(resourceGroupName string, webServiceName string) (result WebService, err error) {\n\treq, err := client.GetPreparer(resourceGroupName, webServiceName)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"webservices.Client\", \"Get\", nil, \"Failure preparing request\")\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"webservices.Client\", \"Get\", resp, \"Failure sending request\")\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"webservices.Client\", \"Get\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b53c3b824383f92d78e53298d4689bab", "score": "0.40121093", "text": "func NewVault(ctx *pulumi.Context,\n\tname string, args *VaultArgs, opts ...pulumi.ResourceOpt) (*Vault, error) {\n\tinputs := make(map[string]interface{})\n\tif args == nil {\n\t\tinputs[\"accessPolicy\"] = nil\n\t\tinputs[\"name\"] = nil\n\t\tinputs[\"notifications\"] = nil\n\t\tinputs[\"tags\"] = nil\n\t} else {\n\t\tinputs[\"accessPolicy\"] = args.AccessPolicy\n\t\tinputs[\"name\"] = args.Name\n\t\tinputs[\"notifications\"] = args.Notifications\n\t\tinputs[\"tags\"] = args.Tags\n\t}\n\tinputs[\"arn\"] = nil\n\tinputs[\"location\"] = nil\n\ts, err := ctx.RegisterResource(\"aws:glacier/vault:Vault\", name, true, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Vault{s: s}, nil\n}", "title": "" }, { "docid": "48efce5fa82e2d46a0109833516662c2", "score": "0.40113348", "text": "func (r *ProjectsLocationsKeyRingsCryptoKeysService) Get(name string) *ProjectsLocationsKeyRingsCryptoKeysGetCall {\n\tc := &ProjectsLocationsKeyRingsCryptoKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "b7f68b4bf5abb64de1b0daada1f31475", "score": "0.4010026", "text": "func GetAWSCredentialsFromKeyring(keychainName string, awsProfile string, sessionDuration time.Duration, assumeRoleTTL time.Duration) (*credentials.Credentials, error) {\n\n\t// Open the keyring which holds the credentials\n\tring, err := keyring.Open(keyring.Config{\n\t\tServiceName: \"aws-vault\",\n\t\tAllowedBackends: []keyring.BackendType{keyring.KeychainBackend},\n\t\tKeychainName: keychainName,\n\t\tKeychainTrustApplication: true,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to configure and open keyring\")\n\t}\n\n\t// Prepare options for the vault before creating the provider\n\tvConfig, err := vault.LoadConfigFromEnv()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to load AWS config from environment\")\n\t}\n\tvOptions := vault.VaultOptions{\n\t\tConfig: vConfig,\n\t\tMfaPrompt: prompt.Method(\"terminal\"),\n\t\tSessionDuration: sessionDuration,\n\t\tAssumeRoleDuration: assumeRoleTTL,\n\t}\n\tvOptions = vOptions.ApplyDefaults()\n\terr = vOptions.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to validate aws-vault options\")\n\t}\n\n\t// Get a new provider to retrieve the credentials\n\tprovider, err := vault.NewVaultProvider(ring, awsProfile, vOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to create aws-vault provider\")\n\t}\n\tcredVals, err := provider.Retrieve()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to retrieve aws credentials from aws-vault\")\n\t}\n\treturn credentials.NewStaticCredentialsFromCreds(credVals), nil\n}", "title": "" }, { "docid": "7c4f0a31f4fd7db51fd8c816ba89fe10", "score": "0.39967123", "text": "func (kms *VaultKMS) GetPassphrase(key string) (string, error) {\n\ts, err := kms.secrets.GetSecret(filepath.Join(kms.vaultPassphrasePath, key), kms.keyContext)\n\tif errors.Is(err, loss.ErrInvalidSecretId) {\n\t\treturn \"\", MissingPassphrase{err}\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdata, ok := s[\"data\"].(map[string]interface{})\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"failed parsing data for get passphrase request for %q\", key)\n\t}\n\tpassphrase, ok := data[\"passphrase\"].(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"failed parsing passphrase for get passphrase request for %q\", key)\n\t}\n\n\treturn passphrase, nil\n}", "title": "" }, { "docid": "8c0869fd0f3361876cdcaded98770a4c", "score": "0.39798373", "text": "func (api *API) GetWallet(name string) (wal Wallet, err error) {\n\tu, err := api.buildURL(\"/wallets/\"+name, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = getResponse(u, &wal)\n\treturn\n}", "title": "" }, { "docid": "1d08441ff0ad7e64bb30e33f924fd1ff", "score": "0.39798182", "text": "func (o VMwareCbtProtectionContainerMappingDetailsResponseOutput) KeyVaultId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VMwareCbtProtectionContainerMappingDetailsResponse) string { return v.KeyVaultId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "39023316bff9ceaae5504633ea48dcce", "score": "0.39790946", "text": "func (client VaultsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2019-09-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif top != nil {\n\t\tqueryParameters[\"$top\"] = autorest.Encode(\"query\", *top)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "2255a90b557edc9b5ed7dd70b71dd5e9", "score": "0.39691773", "text": "func (c *Client) GetAuthorization(vaultID, id string) (*vault.CreatedAuthorization, error) { // nolint: dupl\n\ttarget := c.baseURL + fmt.Sprintf(getAuthorizationsPath, url.QueryEscape(vaultID), url.QueryEscape(id))\n\n\treq, err := http.NewRequest(http.MethodGet, target, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"new request: %w\", err)\n\t}\n\n\tresp, err := c.sendHTTPRequest(req, http.StatusOK)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http request: %w\", err)\n\t}\n\n\tvar result vault.CreatedAuthorization\n\tif err := json.Unmarshal(resp, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal to CreatedAuthorization: %w\", err)\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "a0dd805082fbaa894cc17b01d8232742", "score": "0.39573878", "text": "func (svc *GlacierSvc) Vaults() ([]*glacier.DescribeVaultOutput, error) {\n\tvar results []*glacier.DescribeVaultOutput\n\terr := svc.Client.ListVaultsPages(&glacier.ListVaultsInput{},\n\t\tfunc(page *glacier.ListVaultsOutput, lastPage bool) bool {\n\t\t\tresults = append(results, page.VaultList...)\n\t\t\treturn !lastPage\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "133f72be104220756c9b82a59353958b", "score": "0.39496788", "text": "func (ds *DockerSecrets) Get(secretName string) (string, error) {\n\tif _, ok := ds.secrets[secretName]; !ok {\n\t\treturn \"\", fmt.Errorf(\"secret not exsist: %s\", secretName)\n\t}\n\treturn ds.secrets[secretName], nil\n}", "title": "" }, { "docid": "98c832ba00833c03bc5804a74b2f717d", "score": "0.39423406", "text": "func NewKeyVaultClient() keyvault.BaseClient {\n\tif IsCLI() {\n\t\treturn NewKeyVaultClientFromCLI()\n\t}\n\treturn NewKeyVaultClientFromAppKey(appID, appKey, appTenant)\n}", "title": "" }, { "docid": "d9d631ab84fe8850e13d188527568b1f", "score": "0.3940191", "text": "func vaultInit() (*api.Client, error) {\n\tcfg := api.DefaultConfig()\n\n\tv, err := api.NewClient(cfg)\n\tif err != nil {\n\t\treturn v, err\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "dfe4d7f4a3406f9c03d0dfa25541a79c", "score": "0.39332607", "text": "func GetVolume(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *VolumeState, opts ...pulumi.ResourceOption) (*Volume, error) {\n\tvar resource Volume\n\terr := ctx.ReadResource(\"azure-nextgen:storsimple/latest:Volume\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "527f64c82e1354f98f9708724eadab6e", "score": "0.39310125", "text": "func (o ManagedStorageAccountOutput) KeyVaultId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ManagedStorageAccount) pulumi.StringOutput { return v.KeyVaultId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "527904e0054249c0ce198cc957fdf219", "score": "0.39304152", "text": "func (c *restClient) queryVault(vaultID, name, value string) ([]string, error) {\n\tvar jsonToSend []byte\n\n\tvar err error\n\n\tif value == \"\" {\n\t\tquery := hasQuery{\n\t\t\tHas: name,\n\t\t}\n\n\t\tjsonToSend, err = json.Marshal(query)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(`failed to marshal name-only \"has\" query: %w`, err)\n\t\t}\n\t} else {\n\t\tquery := nameAndValueQuery{\n\t\t\tName: name,\n\t\t\tValue: value,\n\t\t}\n\n\t\tjsonToSend, err = json.Marshal(query)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to marshal name + value query: %w\", err)\n\t\t}\n\t}\n\n\tendpoint := fmt.Sprintf(\"%s/%s/query\", c.edvServerURL, url.PathEscape(vaultID))\n\n\tstatusCode, _, respBytes, err := c.sendHTTPRequest(http.MethodPost, endpoint, jsonToSend, c.headersFunc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(failSendPOSTRequest, err)\n\t}\n\n\tif statusCode == http.StatusOK {\n\t\tvar docLocations []string\n\n\t\terr = json.Unmarshal(respBytes, &docLocations)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to unmarshal response bytes into document locations: %w\", err)\n\t\t}\n\n\t\treturn docLocations, nil\n\t}\n\n\treturn nil, fmt.Errorf(failResponseFromEDVServer, statusCode, respBytes)\n}", "title": "" }, { "docid": "dd6fa7b29adaea675004b6b452b65997", "score": "0.39240107", "text": "func GetVaultHandler(w http.ResponseWriter, r *http.Request) {\n\tisAuth, message, id := isLoggedIn(r)\n\n\tvar user model.User\n\tvar result model.ResponseResult\n\n\tif !isAuth {\n\t\tresult.Result = message\n\t\tjson.NewEncoder(w).Encode(result)\n\t\treturn\n\t}\n\n\t// Get Database\n\tcollection, err := db.GetDBCollection()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Find User\n\terr = collection.FindOne(context.TODO(), bson.D{{\"id\", id}}).Decode(&user)\n\n\tif err != nil {\n\t\tresult.Result = err.Error()\n\t\tjson.NewEncoder(w).Encode(result)\n\t\treturn\n\t}\n\n\t// Send to User\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "dd76cf397885c74ca55a9859fde42a84", "score": "0.39217538", "text": "func Get(kubeclient kubernetes.Interface, name, namespace string) (*v1.Secret, error) {\n\treturn kubeclient.CoreV1().Secrets(namespace).Get(name, metav1.GetOptions{})\n}", "title": "" } ]
997fd3176e8f73725da1012e9eefa57a
Ilk is a free data retrieval call binding the contract method 0xc5ce281e. Solidity: function ilk() view returns(bytes32)
[ { "docid": "6f5e834fec2f83f0c314662b3af47e8f", "score": "0.7359273", "text": "func (_GemJoin *GemJoinSession) Ilk() ([32]byte, error) {\n\treturn _GemJoin.Contract.Ilk(&_GemJoin.CallOpts)\n}", "title": "" } ]
[ { "docid": "30c8257d29f43097aa643d4e9a45b71b", "score": "0.7920122", "text": "func (_GemJoin *GemJoinCaller) Ilk(opts *bind.CallOpts) ([32]byte, error) {\n\tvar out []interface{}\n\terr := _GemJoin.contract.Call(opts, &out, \"ilk\")\n\n\tif err != nil {\n\t\treturn *new([32]byte), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "9fb2d5feaa89317eb85a978e36f4ce5a", "score": "0.73752064", "text": "func (_GemJoin *GemJoinCallerSession) Ilk() ([32]byte, error) {\n\treturn _GemJoin.Contract.Ilk(&_GemJoin.CallOpts)\n}", "title": "" }, { "docid": "d0b119028ff37ee7791da4c54b9f1e24", "score": "0.59350455", "text": "func (e *Event) ILK() ILK {\n\treturn ilkValue[e.EventType]\n}", "title": "" }, { "docid": "9723e2f3ba342bc80ce12e042c0d3629", "score": "0.53860027", "text": "func (client *Client) Getl(vb uint16, key string, expiry uint32) (*Response, error) {\n body := []byte{0,0,0,0}\n binary.BigEndian.PutUint32(body, expiry)\n\n\treturn client.Send(&Request{\n\t\tOpcode: GETL,\n\t\tVBucket: vb,\n\t\tKey: []byte(key),\n\t\tCas: 0,\n\t\tOpaque: 0,\n\t\tExtras: []byte{},\n\t\tBody: body})\n}", "title": "" }, { "docid": "fc568f9e86519a355798dfb4ef6184bb", "score": "0.5252922", "text": "func (s *Storage) LGet(key string) (ItemListInterface, error) {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\td, found := s.data[key]\n\tif !found {\n\t\treturn nil, ErrNotFound\n\t}\n\tif itemList, ok := (d.Value()).(ItemListInterface); ok {\n\t\treturn itemList, nil\n\t}\n\treturn nil, ErrNotList\n}", "title": "" }, { "docid": "e497b3facb9d65250fb4d7e924ab2347", "score": "0.5086417", "text": "func (c *Client) LLEN(key string) (int64, error) {\n\tr := newRequest(\"*2\\r\\n$4\\r\\nLLEN\\r\\n$\")\n\tr.addString(key)\n\treturn c.commandInteger(r)\n}", "title": "" }, { "docid": "12c6791f5e94152f10bf6c0be8ce0ed6", "score": "0.50342786", "text": "func (r *Redis) Llen(key string) (int, error) {\n\tc, err := r.redisPool.Get(r.ConnTimeout)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer r.redisPool.Put(c)\n\n\tpCon := c.(*poolConn)\n\n\t//Send command\n\tpCon.SendLlen(key)\n\n\treturn pCon.ParserReturnInt()\n}", "title": "" }, { "docid": "c74bea755fdffe18ff393b63d4e79f75", "score": "0.49691755", "text": "func GetKlBtwnKlid(code string, tab model.DBTab, sklid, eklid string, desc bool) (hist []*model.Quote) {\n\tvar (\n\t\tk1cond, k2cond string\n\t)\n\tif sklid != \"\" {\n\t\top := \">\"\n\t\tif strings.HasPrefix(sklid, \"[\") {\n\t\t\top += \"=\"\n\t\t\tsklid = sklid[1:]\n\t\t}\n\t\tk1cond = fmt.Sprintf(\"and klid %s %s\", op, sklid)\n\t}\n\tif eklid != \"\" {\n\t\top := \"<\"\n\t\tif strings.HasSuffix(eklid, \"]\") {\n\t\t\top += \"=\"\n\t\t\teklid = eklid[:len(eklid)-1]\n\t\t}\n\t\tk2cond = fmt.Sprintf(\"and klid %s %s\", op, eklid)\n\t}\n\td := \"\"\n\tif desc {\n\t\td = \"desc\"\n\t}\n\tsql := fmt.Sprintf(\"select * from %s where code = ? %s %s order by klid %s\", tab, k1cond, k2cond, d)\n\t_, e := dbmap.Select(&hist, sql, code)\n\tutil.CheckErr(e, \"failed to query \"+string(tab)+\" for \"+code+\", sql: \"+sql)\n\tfor _, q := range hist {\n\t\tq.Type = tab\n\t}\n\treturn\n}", "title": "" }, { "docid": "167753638ad69a235442dff0bef60dc7", "score": "0.49472314", "text": "func (s *Socket) RecoveryIvl() (time.Duration, error) {\n\tms, err := s.GetSockOptInt64(RECOVERY_IVL)\n\treturn time.Duration(ms) * time.Millisecond, err\n}", "title": "" }, { "docid": "f9fbb6cfc0cab6cc85d0eb4eea9e0fa0", "score": "0.48980328", "text": "func LLen(conn *redis.Conn, listName string) (int, error) {\n\treturn redis.Int((*conn).Do(\"LLEN\", listName))\n}", "title": "" }, { "docid": "345d279f8a35b05783d03b1f27211134", "score": "0.48866004", "text": "func LIDT(rm interface{}) {\n\tunsafe.Asm(\"LIDT\", rm)\n}", "title": "" }, { "docid": "516e6e22c4000fb0e2fdb9178a838c6e", "score": "0.48632213", "text": "func (r *Redis) Lindex(key string, index int) (string, error) {\n\tc, err := r.redisPool.Get(r.ConnTimeout)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer r.redisPool.Put(c)\n\n\tpCon := c.(*poolConn)\n\n\t//Send command\n\tpCon.SendLindex(key, index)\n\n\treturn pCon.ParserReturnString()\n}", "title": "" }, { "docid": "105abb982d72b2b3d319847ffdce6a53", "score": "0.48533213", "text": "func CallGetKey(instance *Identity, key [32]byte) (*metaIDKey, error) {\n\tvar err error\n\tif instance == nil {\n\t\terr = fmt.Errorf(\"Error - Identity nil\")\n\t\treturn nil, err\n\t}\n\tresult, err := instance.GetKey(&bind.CallOpts{}, key)\n\tif err != nil {\n\t\t//데이터가 없을때 나는 에러 처리\n\t\tif err.Error() == \"abi: unmarshalling empty output\" {\n\t\t\treturn nil, nil\n\t\t}\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\tlog.Debugf(\"key: %x \", result)\n\treturn &result, nil\n}", "title": "" }, { "docid": "2651aa167f37cd4c2a8c9166af3ddedb", "score": "0.482201", "text": "func (m *AlternativeSecurityId) GetKey()([]byte) {\n return m.key\n}", "title": "" }, { "docid": "369f3d148c96297634f18d09cb8b6796", "score": "0.48212045", "text": "func (key *LedgerKey) LedgerKey() LedgerKey {\n\treturn *key\n}", "title": "" }, { "docid": "ed20645edf3600df7fb68fc73db3f165", "score": "0.48066038", "text": "func (kc *kmipClient) GetKey(id string, algorithm string, keyLength int) ([]byte, error) {\n\tdefaultLog.Trace(\"kmipclient/kmipclient:GetKey() Entering\")\n\tdefer defaultLog.Trace(\"kmipclient/kmipclient:GetKey() Leaving\")\n\n\tkeyID := C.CString(id)\n\tdefer C.free(unsafe.Pointer(keyID))\n\n\tkeyAlgorithm := C.CString(algorithm)\n\tdefer C.free(unsafe.Pointer(keyAlgorithm))\n\n\tif algorithm == constants.CRYPTOALG_AES {\n\t\tkeyLength = keyLength / 8\n\t} else {\n\t\tkeyLength = keyLength / 8 * 5\n\t}\n\n\tkeyBuffer := C.malloc(C.ulong(keyLength))\n\tdefer C.free(unsafe.Pointer(keyBuffer))\n\n\tresult := C.kmipw_get((*C.char)(keyID), (*C.char)(keyBuffer), (*C.char)(keyAlgorithm), (C.int)(kc.KMIPVersion))\n\tif result != constants.KMIP_CLIENT_SUCCESS {\n\t\treturn nil, errors.New(\"Failed to retrieve key from kmip server. Check kmipclient logs for more details.\")\n\t}\n\n\tdefaultLog.Info(\"kmipclient/kmipclient:GetKey() Retrieved key from kmip server\")\n\tkey := C.GoBytes(keyBuffer, C.int(keyLength))\n\n\t// Removing empty bytes from buffer\n\treturn bytes.Trim(key, \"\\x00\"), nil\n}", "title": "" }, { "docid": "f83db888161325fc7305d94c0e4470fc", "score": "0.48012674", "text": "func (k *K) L() int {\n\treturn k.t.L()\n}", "title": "" }, { "docid": "c03324a3a469d5cbbfe2ebb9e62bb730", "score": "0.4786301", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_HelloAuthentication_Keychain) IsYANGGoStruct() {}", "title": "" }, { "docid": "c03324a3a469d5cbbfe2ebb9e62bb730", "score": "0.47843143", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_HelloAuthentication_Keychain) IsYANGGoStruct() {}", "title": "" }, { "docid": "00d90385457b270e915ae3f67cb4721a", "score": "0.4776113", "text": "func kDL(i int) (result []*models.IP) {\n\tclog.Info(\"[kuaidaili] start\")\n\tpollURL := \"http://www.kuaidaili.com/free/inha/\"\n\tpollURL = pollURL + strconv.Itoa(i) + \"/\"\n\tdoc,_ := htmlquery.LoadURL(pollURL)\n\ttrNode, err := htmlquery.Find(doc, \"//tbody//tr\")\n\tif err != nil {\n\t\tclog.Warn(\"KDL find error: %v\", err)\n\t}\n\tfor i := 0; i < len(trNode); i++ {\n\t\tIP := models.NewIP()\n\t\ttdNode, _ := htmlquery.Find(trNode[i],\"//td\")\n\t\tIP.Data = htmlquery.InnerText(tdNode[0])\n\t\tIP.Port = htmlquery.InnerText(tdNode[1])\n\t\tIP.Type = htmlquery.InnerText(tdNode[2])\n\t\tIP.Protocol = strings.ToLower(htmlquery.InnerText(tdNode[3]))\n\t\tIP.Position = htmlquery.InnerText(tdNode[4])\n\t\tIP.Speed = extractSpeed(htmlquery.InnerText(tdNode[5]))\n\t\tresult = append(result, IP)\n\t\tcount++\n\t}\n\n\tclog.Info(\"[kuaidaili] done, %d\", count)\n\treturn\n}", "title": "" }, { "docid": "57bb65c70430e1bd462de79b492ef1db", "score": "0.47617814", "text": "func (entry *LedgerEntry) LedgerKey() LedgerKey {\n\tvar body interface{}\n\n\tswitch entry.Data.Type {\n\tcase LedgerEntryTypeAccount:\n\t\taccount := entry.Data.MustAccount()\n\t\tbody = LedgerKeyAccount{\n\t\t\tAccountId: account.AccountId,\n\t\t}\n\tcase LedgerEntryTypeData:\n\t\tdata := entry.Data.MustData()\n\t\tbody = LedgerKeyData{\n\t\t\tAccountId: data.AccountId,\n\t\t\tDataName: data.DataName,\n\t\t}\n\tcase LedgerEntryTypeOffer:\n\t\toffer := entry.Data.MustOffer()\n\t\tbody = LedgerKeyOffer{\n\t\t\tSellerId: offer.SellerId,\n\t\t\tOfferId: offer.OfferId,\n\t\t}\n\tcase LedgerEntryTypeTrustline:\n\t\ttline := entry.Data.MustTrustLine()\n\t\tbody = LedgerKeyTrustLine{\n\t\t\tAccountId: tline.AccountId,\n\t\t\tAsset: tline.Asset,\n\t\t}\n\tcase LedgerEntryTypeClaimableBalance:\n\t\tcBalance := entry.Data.MustClaimableBalance()\n\t\tbody = LedgerKeyClaimableBalance{\n\t\t\tBalanceId: cBalance.BalanceId,\n\t\t}\n\tcase LedgerEntryTypeLiquidityPool:\n\t\tlPool := entry.Data.MustLiquidityPool()\n\t\tbody = LedgerKeyLiquidityPool{\n\t\t\tLiquidityPoolId: lPool.LiquidityPoolId,\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Unknown entry type: %v\", entry.Data.Type))\n\t}\n\n\tret, err := NewLedgerKey(entry.Data.Type, body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "c178efc31b9b2678e7ab8ea2ba333dfe", "score": "0.4761295", "text": "func (_RootValidator *RootValidatorCallerSession) LimeRoot() ([32]byte, error) {\n\treturn _RootValidator.Contract.LimeRoot(&_RootValidator.CallOpts)\n}", "title": "" }, { "docid": "5462aabb1a92f4d41294a2e9f682e5df", "score": "0.4736585", "text": "func (l *Lock) Key() string {\n\treturn l.key\n}", "title": "" }, { "docid": "a0c27f31e76cc5118758bc6e5d57170b", "score": "0.47186002", "text": "func (i *blockIter) Key() *InternalKey {\n\treturn &i.ikey\n}", "title": "" }, { "docid": "c79ae9e9a0c47c26751599166cca1747", "score": "0.47148407", "text": "func (_LockedEthereum *LockedEthereumCaller) LockinHtlc(opts *bind.CallOpts, arg0 common.Address) (struct {\n\tSecretHash [32]byte\n\tExpiration *big.Int\n\tValue *big.Int\n}, error) {\n\tret := new(struct {\n\t\tSecretHash [32]byte\n\t\tExpiration *big.Int\n\t\tValue *big.Int\n\t})\n\tout := ret\n\terr := _LockedEthereum.contract.Call(opts, out, \"lockin_htlc\", arg0)\n\treturn *ret, err\n}", "title": "" }, { "docid": "a1ddbc78c6ac5ab594c8db2c86b1a0a5", "score": "0.46762684", "text": "func (_TxReg *TxRegSession) TxLKP() (*types.Transaction, error) {\n\treturn _TxReg.Contract.TxLKP(&_TxReg.TransactOpts)\n}", "title": "" }, { "docid": "a94856a9a6e19b5bf7c2abf7091cdbe1", "score": "0.46603954", "text": "func (_RootValidator *RootValidatorSession) LimeRoot() ([32]byte, error) {\n\treturn _RootValidator.Contract.LimeRoot(&_RootValidator.CallOpts)\n}", "title": "" }, { "docid": "51b4aa6a63984e253a08faa24c83dca0", "score": "0.4658905", "text": "func randKey(l int) []byte {\n\tb := make([]byte, l)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "d55fde4eafd492f18033dd444c60411c", "score": "0.46555972", "text": "func (c *Client) Key(ctx context.Context, id string) (*Key, error) {\n\tpath := fmt.Sprintf(\"%s/api/v2/tailnet/%s/keys/%s\", c.baseURL(), c.tailnet, id)\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb, resp, err := c.sendRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, handleErrorResponse(b, resp)\n\t}\n\n\tvar key Key\n\tif err := json.Unmarshal(b, &key); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &key, nil\n}", "title": "" }, { "docid": "57cde5c75431d8203e5f8cba042d74c1", "score": "0.46488068", "text": "func getid(host string, ikey string) {\n\turlreq := host + \"/keys/\" + ikey\n\tfmt.Printf(\"\\n GET URL: %s\", urlreq)\n\tfmt.Printf(\"\\n Fetching key: %s from server: %s\", ikey, host)\n\treq, _ := http.NewRequest(\"GET\", urlreq, nil)\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tfmt.Println(\"\\n Response:\", string(body))\n\tdefer resp.Body.Close()\n}", "title": "" }, { "docid": "54d3f15e12da28743ec4783556c8f45d", "score": "0.46446103", "text": "func (_LockedEthereum *LockedEthereumCallerSession) LockinHtlc(arg0 common.Address) (struct {\n\tSecretHash [32]byte\n\tExpiration *big.Int\n\tValue *big.Int\n}, error) {\n\treturn _LockedEthereum.Contract.LockinHtlc(&_LockedEthereum.CallOpts, arg0)\n}", "title": "" }, { "docid": "8e281ebd05180fbd4568a41a034e901f", "score": "0.46397462", "text": "func (_CK *CKCaller) GetKitty(opts *bind.CallOpts, _id *big.Int) (struct {\n\tIsGestating bool\n\tIsReady bool\n\tCooldownIndex *big.Int\n\tNextActionAt *big.Int\n\tSiringWithId *big.Int\n\tBirthTime *big.Int\n\tMatronId *big.Int\n\tSireId *big.Int\n\tGeneration *big.Int\n\tGenes *big.Int\n}, error) {\n\tret := new(struct {\n\t\tIsGestating bool\n\t\tIsReady bool\n\t\tCooldownIndex *big.Int\n\t\tNextActionAt *big.Int\n\t\tSiringWithId *big.Int\n\t\tBirthTime *big.Int\n\t\tMatronId *big.Int\n\t\tSireId *big.Int\n\t\tGeneration *big.Int\n\t\tGenes *big.Int\n\t})\n\tout := ret\n\terr := _CK.contract.Call(opts, out, \"getKitty\", _id)\n\treturn *ret, err\n}", "title": "" }, { "docid": "0cb1ba087fc93f3d318ee8ecb886e8c7", "score": "0.46391705", "text": "func (_RootValidator *RootValidatorCaller) LimeRoot(opts *bind.CallOpts) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _RootValidator.contract.Call(opts, out, \"limeRoot\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "aa628526838a324b369d92c352c25d48", "score": "0.46306685", "text": "func NewLoki(cfg *Config) (Loki, error) {\n\tif err := validate(cfg); err != nil {\n\t\treturn Loki{}, fmt.Errorf(\"the provided config is not valid: %w\", err)\n\t}\n\tlcfg, err := cfg.buildLokiConfig()\n\tif err != nil {\n\t\treturn Loki{}, err\n\t}\n\tlokiClient, err := loki.NewWithLogger(lcfg, logadapter.NewLogrusLogger(log))\n\tif err != nil {\n\t\treturn Loki{}, err\n\t}\n\treturn Loki{\n\t\tconfig: *cfg,\n\t\tlokiConfig: lcfg,\n\t\temitter: lokiClient,\n\t\ttimeNow: time.Now,\n\t}, nil\n}", "title": "" }, { "docid": "8c07a4d5d14695c5cee5135d62bd4b7a", "score": "0.4623149", "text": "func (delai Delai) Key() string {\n\treturn delai.key\n}", "title": "" }, { "docid": "877211c294c578a9a75cbde6b896f590", "score": "0.46139786", "text": "func (ck *Clerk) Get(key string) string {\n\t// Your code here.\n\tck.rpc_id++\n\targs := &GetArgs{key, ck.me, ck.rpc_id}\n\tvar reply GetReply\n\tok := false\n\tfor !ok {\n\t\t//ck.primary = ck.vs.Primary()\n\t\tlog.Printf(\"[client %s] Get(%s) to [%v] %v times\\n\", ck.me, key, ck.primary, args.Rpc_id)\n\t\trpc_ok := call(ck.primary, \"PBServer.Get\", args, &reply)\n\t\tif !rpc_ok {\n\t\t\ttime.Sleep(viewservice.PingInterval)\n\t\t\tck.primary = ck.vs.Primary()\n\t\t\tcontinue\n\t\t}\n\t\tswitch reply.Err {\n\t\tcase OK:\n\t\t\tok = true\n\t\tcase ErrDuplicated:\n\t\t\tok = true\n\t\tcase ErrCopyNotFinished:\n\t\t\tlog.Printf(\"[ErrCopyNotFinished][client %v] Primary %v not copy finished\\n\", ck.me, ck.primary)\n\t\t\tck.primary = ck.vs.Primary()\n\t\tcase ErrWrongServer:\n\t\t\tlog.Printf(\"[ErrWrongServer][client %v] %v don't think it's primary\\n\", ck.me, ck.primary)\n\t\t\tck.primary = ck.vs.Primary()\n\t\tcase ErrUnReliable:\n\t\t\tlog.Printf(\"[ErrUnReliable][client %v] %v unreliable\", ck.me, ck.primary)\n\t\t\tck.primary = ck.vs.Primary()\n\t\tdefault:\n\t\t\tck.primary = ck.vs.Primary()\n\t\t}\n\t}\n\tlog.Printf(\"[client %s] Get(%s)-%v to [%v] SUCCESS\\n\", ck.me, key, reply.Value, ck.primary)\n\n\treturn reply.Value\n}", "title": "" }, { "docid": "2af803af3cb8b0ab9a32c55922444a41", "score": "0.46115923", "text": "func (o VolumeOutput) LinodeId() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Volume) pulumi.IntOutput { return v.LinodeId }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "81f5cb843ed9ab4f9415fc6622efc8b4", "score": "0.4602174", "text": "func (_Identity *IdentityCallerSession) GetData(_key [32]byte) ([32]byte, error) {\n\treturn _Identity.Contract.GetData(&_Identity.CallOpts, _key)\n}", "title": "" }, { "docid": "4fe6dbdff699faa7cc62b155586a7223", "score": "0.4594445", "text": "func (ylf YubikeyLoaderFunc) YubikeyLoad(name string) (*Yubikey, error) { return ylf(name) }", "title": "" }, { "docid": "2d3b521dd8df627ac1942400c4a2e3c2", "score": "0.45878127", "text": "func keypoolRefill(icmd interface{}, w *wallet.Wallet) (interface{}, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "499c8e05f3e4bd3780fa56b27c06ad5a", "score": "0.45847872", "text": "func (m *MockKmipClient) GetKey(id string, algorithm string, keyLength int) ([]byte, error) {\n\targs := m.Called(id)\n\treturn args.Get(0).([]byte), args.Error(1)\n}", "title": "" }, { "docid": "491001785af5e8866047e34b7315e2ab", "score": "0.45821664", "text": "func (i *blockIter) Key() []byte {\n\tif i.soi {\n\t\treturn nil\n\t}\n\treturn i.key\n}", "title": "" }, { "docid": "c43c4f4496e997b064bff428673bc869", "score": "0.45815298", "text": "func (ck *Clerk) Get(key string) string {\n\n\t// You will have to modify this function.\n\tvar reply GetReply\n\tretStr := \"\"\n\trequestID := nrand()\n\targs := GetArgs{Key: key, RequestID: requestID}\n\tDPrintf3(\"Clerk get(%s), reqID %d\", key, requestID)\n\tok := false\n\tfor !(ok && reply.Err == \"\") {\n\t\tck.mu.Lock()\n\t\tcurLeaderID := ck.leaderID\n\t\tck.mu.Unlock()\n\t\treply.Err = \"\"\n\t\t//DPrintf3(\"Getting.......................................................\")\n\t\tok = ck.servers[curLeaderID].Call(\"KVServer.Get\", &args, &reply)\n\t\t//DPrintf3(\"Getting.......................................................Done\")\n\t\tif !ok {\n\t\t\t// Network failure?\n\t\t\tDPrintf3(\"Clerk Get() network error. %d\", curLeaderID)\n\t\t\tck.updateLeader(curLeaderID)\n\t\t} else {\n\t\t\tif reply.Err == \"\" {\n\t\t\t\tretStr = reply.Value\n\t\t\t} else {\n\t\t\t\tif reply.Err == \"NotLeader\" || reply.Err == \"Killed\" || reply.Err == \"Timeout\" {\n\t\t\t\t\tck.updateLeader(curLeaderID)\n\t\t\t\t\ttime.Sleep(time.Millisecond * 100)\n\t\t\t\t}\n\t\t\t\tif reply.Err == \"ExpiredRequest\" {\n\t\t\t\t\trequestID = nrand()\n\t\t\t\t}\n\t\t\t\tif reply.Err != \"NotLeader\" {\n\t\t\t\t\tDPrintf3(\"Clerk Get() failed: %s\", reply.Err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn retStr\n}", "title": "" }, { "docid": "5f619669d3d0c1b0ded060fef5cea4ba", "score": "0.45718908", "text": "func (_LockedEthereum *LockedEthereumSession) LockinHtlc(arg0 common.Address) (struct {\n\tSecretHash [32]byte\n\tExpiration *big.Int\n\tValue *big.Int\n}, error) {\n\treturn _LockedEthereum.Contract.LockinHtlc(&_LockedEthereum.CallOpts, arg0)\n}", "title": "" }, { "docid": "ff8e46aa9b64bb7c8ba5f6a4255ca9be", "score": "0.45682526", "text": "func (_Identity *IdentityCaller) GetData(opts *bind.CallOpts, _key [32]byte) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _Identity.contract.Call(opts, out, \"getData\", _key)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "45ae929cd8bc90548bba550bd542381d", "score": "0.45656797", "text": "func (cipher *Cipher) ikf() {\n\tcipher.mstate[0] = 0xF0F1F2F3F4F5F6F7\n\tcipher.mstate[1] = cipher.Key[0]\n\tcipher.mstate[2] = cipher.Key[1]\n\tcipher.mstate[3] = cipher.Key[2]\n\tcipher.mstate[4] = cipher.Nonce[0]\n\tcipher.mstate[5] = cipher.times\n\tcipher.mstate[6] = cipher.Key[3]\n\tcipher.mstate[7] = cipher.Nonce[1]\n}", "title": "" }, { "docid": "218b0cde9f0bf5728fd872e901cbb351", "score": "0.45563474", "text": "func (this *SecretIdentity) Lock() (id *LockedIdentity) {\n\tsalt := make([]byte, 16)\n\t// I think IV is actually worthless here since *key* differs every time\n\t// due to salt, but whatever, better safe than sorry.\n\tiv := make([]byte, 16)\n\t_, err := io.ReadFull(rand.Reader, salt)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = io.ReadFull(rand.Reader, iv)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//fmt.Printf(\"IV = %v\\n\", iv)\n\t//fmt.Printf(\"SALT = %v\\n\", salt)\n\tdk, err := scrypt.Key([]byte(this.password), salt, 16384, 8, 1, 32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//fmt.Printf(\"DK = %v\\n\",dk)\n\tflat := x509.MarshalPKCS1PrivateKey(this.key)\n\thasher := NewHasher()\n\thasher.Write(flat)\n\tdigest := hasher.Finalize()\n\t//fmt.Printf(\"DIGEST = %v\\n\",digest.impl)\n\tac, err := aes.NewCipher(dk)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tstream := cipher.NewOFB(ac, iv)\n\t//fmt.Printf(\"FLAT ~= %v\\n\",flat[:10])\n\tstream.XORKeyStream(flat, flat)\n\t//fmt.Printf(\"CRYPTOFLAT ~= %v\\n\", flat[:10])\n\tfinal := []byte{}\n\tfinal = append(final, salt...)\n\tfinal = append(final, iv...)\n\tfinal = append(final, digest.impl...)\n\tfinal = append(final, flat...)\n\treturn &LockedIdentity{impl: final}\n}", "title": "" }, { "docid": "2acbf6b3fe503d5d9f2adb10f066f628", "score": "0.45326197", "text": "func (_Identity *IdentitySession) GetData(_key [32]byte) ([32]byte, error) {\n\treturn _Identity.Contract.GetData(&_Identity.CallOpts, _key)\n}", "title": "" }, { "docid": "ecb1ea3a87f9d2f451176cb46bfd00d2", "score": "0.4527836", "text": "func (_CK *CKCallerSession) GetKitty(_id *big.Int) (struct {\n\tIsGestating bool\n\tIsReady bool\n\tCooldownIndex *big.Int\n\tNextActionAt *big.Int\n\tSiringWithId *big.Int\n\tBirthTime *big.Int\n\tMatronId *big.Int\n\tSireId *big.Int\n\tGeneration *big.Int\n\tGenes *big.Int\n}, error) {\n\treturn _CK.Contract.GetKitty(&_CK.CallOpts, _id)\n}", "title": "" }, { "docid": "534a5e8eb803b35d5faab732b36f068b", "score": "0.45274657", "text": "func (c *Client) LPush(key string, val string) error {\n\t_, err := c.sendCommand(\"LPUSH\", key, val)\n\treturn err\n}", "title": "" }, { "docid": "40cbdef73d4af863083573def9e2132b", "score": "0.4521945", "text": "func (_UniswapPair *UniswapPairCallerSession) KLast() (*big.Int, error) {\n\treturn _UniswapPair.Contract.KLast(&_UniswapPair.CallOpts)\n}", "title": "" }, { "docid": "53a968a61e395675e69b55c990277519", "score": "0.45172837", "text": "func (eb EntryBlock) Key() int64 {\n\treturn eb.key\n}", "title": "" }, { "docid": "6900e857aad8cb0bf2ebdea400a88e64", "score": "0.45156273", "text": "func (b *baseClient) Key() string { return b.key }", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" }, { "docid": "d5de62fabceed8f9487a50b8aee1091c", "score": "0.45129263", "text": "func ihash(key string) int {\n\th := fnv.New32a()\n\th.Write([]byte(key))\n\treturn int(h.Sum32() & 0x7fffffff)\n}", "title": "" } ]
df3fdc18934987bc5d6c866dd4d3b1a2
VPMULLQ_Z: Multiply Packed Signed Quadword Integers and Store Low Result (Zeroing Masking). Forms: VPMULLQ.Z m128 xmm k xmm VPMULLQ.Z m256 ymm k ymm VPMULLQ.Z xmm xmm k xmm VPMULLQ.Z ymm ymm k ymm VPMULLQ.Z m512 zmm k zmm VPMULLQ.Z zmm zmm k zmm
[ { "docid": "11e32038c8769b2a430d6d61cc9a96e4", "score": "0.79562247", "text": "func VPMULLQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULLQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" } ]
[ { "docid": "9ed3dad631f4aacf3c957209341ad9ae", "score": "0.7494182", "text": "func VPMULLQ(ops ...operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULLQ.Forms(), sffxs{}, ops)\n}", "title": "" }, { "docid": "75537184e6ad9bc8d9602d1628213b27", "score": "0.7396901", "text": "func VPMULDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "6e9fc1f46d69e88933cf33eac4cb3e9e", "score": "0.7251528", "text": "func VPMULUDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULUDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "cd96dd3bc01230c1ef8012bdd8987dff", "score": "0.7122841", "text": "func VPUNPCKLDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPUNPCKLDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "f9c5c6c189e3930a4ff98e8824e18582", "score": "0.7002734", "text": "func VPUNPCKLQDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPUNPCKLQDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "57fd7a402c5d200ebf600893d330b62a", "score": "0.6967673", "text": "func VPMULLD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULLD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "22e86e6cf436c6994cfdca3e90ed8384", "score": "0.6924858", "text": "func VPSLLQ_Z(imx, mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSLLQ.Forms(), sffxs{sffxZ}, []operand.Op{imx, mxyz, k, xyz})\n}", "title": "" }, { "docid": "26a2f460e16543162dd2e18b40d0b9e6", "score": "0.69030696", "text": "func VPMULLW_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULLW.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "d479db803cf51e8dd8a2f7a370fccd8a", "score": "0.6869712", "text": "func VMOVDQU64_Z(mxyz, k, mxyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMOVDQU64.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, k, mxyz1})\n}", "title": "" }, { "docid": "5a255ff76bed9e63f4f92bae43dfebd0", "score": "0.68500704", "text": "func VPSUBQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSUBQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "d1c183e8d98f4d5e31f61cf4f543064e", "score": "0.6767573", "text": "func VPMULDQ(ops ...operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULDQ.Forms(), sffxs{}, ops)\n}", "title": "" }, { "docid": "c43448f39e75c94a0d67c2f669f58684", "score": "0.6757611", "text": "func VPUNPCKHDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPUNPCKHDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "8194e2f2c5d5e09e5c722245d4ca7ee9", "score": "0.671014", "text": "func VMULPD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMULPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "0aee44dc0985b91a8e3d4450f67dbfec", "score": "0.66919225", "text": "func VMOVDQU32_Z(mxyz, k, mxyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMOVDQU32.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, k, mxyz1})\n}", "title": "" }, { "docid": "838610a3c048d0d8895cc71e9f91fdc2", "score": "0.66826457", "text": "func VPROLVQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPROLVQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "b4dfa39513fdbe7f788dcc81bd92fafc", "score": "0.6623555", "text": "func VPMOVUSQD_Z(xyz, k, mxy operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVUSQD.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mxy})\n}", "title": "" }, { "docid": "fc737ed6d4dfd640d46de8f45a74f998", "score": "0.66100734", "text": "func VPUNPCKHQDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPUNPCKHQDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "fdd7b54bde3d6854ad9e2f731bb18a14", "score": "0.6608299", "text": "func VPROLQ_Z(i, mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPROLQ.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, k, xyz})\n}", "title": "" }, { "docid": "996a41a9bdec27b4fb3022efc1e9e989", "score": "0.65706897", "text": "func VPMAXUQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMAXUQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "3542dbabf46d6fbc20e0f8a2a97eab4c", "score": "0.6568242", "text": "func VPMOVSXDQ_Z(mxy, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVSXDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxy, k, xyz})\n}", "title": "" }, { "docid": "761d7e53dfd16f7bb0c921527bd4ec32", "score": "0.65272427", "text": "func VPMOVUSQB_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVUSQB.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "0657055d4db33d9515a19e3a44847f35", "score": "0.65236664", "text": "func VPSHRDVQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSHRDVQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "5596b170abb074b87a008a10ca1a4d3c", "score": "0.6521129", "text": "func VPMINUQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMINUQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "cfde5094eeda7171dab5bba6c798cac9", "score": "0.6519209", "text": "func VMOVDQU8_Z(mxyz, k, mxyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMOVDQU8.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, k, mxyz1})\n}", "title": "" }, { "docid": "9c35ddb24d7d45341878f26ed1a0ea72", "score": "0.65030044", "text": "func VPUNPCKLDQ(ops ...operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPUNPCKLDQ.Forms(), sffxs{}, ops)\n}", "title": "" }, { "docid": "7b42e6a1b1ce4a6919c52e4af56a108d", "score": "0.6488552", "text": "func VPMOVZXDQ_Z(mxy, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVZXDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxy, k, xyz})\n}", "title": "" }, { "docid": "5345d286be12eab5fe838c988d9bf5e9", "score": "0.64790946", "text": "func VMOVDQA64_Z(mxyz, k, mxyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMOVDQA64.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, k, mxyz1})\n}", "title": "" }, { "docid": "f3e00d022b7c66c3a657bff6ed69bb78", "score": "0.6462486", "text": "func VFIXUPIMMPD_Z(i, mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFIXUPIMMPD.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "8f22c97020c12b6706c4f6bebf13dc1b", "score": "0.64486265", "text": "func VUNPCKLPD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVUNPCKLPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "76c9ef01348a60a30baee4f3502b3181", "score": "0.64308083", "text": "func VPMOVSQD_Z(xyz, k, mxy operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVSQD.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mxy})\n}", "title": "" }, { "docid": "339650acb7ae491669948256969df011", "score": "0.64168143", "text": "func VPSRLQ_Z(imx, mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSRLQ.Forms(), sffxs{sffxZ}, []operand.Op{imx, mxyz, k, xyz})\n}", "title": "" }, { "docid": "46e6c77d433428d4acca550ad4579d3d", "score": "0.6396943", "text": "func VREDUCEPD_Z(i, mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVREDUCEPD.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, k, xyz})\n}", "title": "" }, { "docid": "621773cd33fc0c045c1690c2f3b166f7", "score": "0.63779616", "text": "func VPMOVQD_Z(xyz, k, mxy operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVQD.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mxy})\n}", "title": "" }, { "docid": "adff972c5c68a863b40b9e1c99925f2f", "score": "0.63640916", "text": "func VMULPS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMULPS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "339a882e7934ee0a046e48a55ea80cd6", "score": "0.63531244", "text": "func VPORQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPORQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "74ef10b02cb8a8a588dbe64c7f458369", "score": "0.63517755", "text": "func VPMULUDQ(ops ...operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULUDQ.Forms(), sffxs{}, ops)\n}", "title": "" }, { "docid": "ff6439aad22a0f20279f1ee7560cab3b", "score": "0.63453716", "text": "func VPMOVQB_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVQB.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "a10a760d87e357961b260b05303dfc3d", "score": "0.63380367", "text": "func VPSLLVQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSLLVQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "75daaeba3131c3cd8efbd5e64a15063d", "score": "0.63307416", "text": "func VFNMSUB231PD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFNMSUB231PD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "2a7d024b73f117a44cd5529b538ab9d2", "score": "0.63301075", "text": "func VPSHLDQ_Z(i, mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSHLDQ.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "7cd9bf34454b4cb1d2607cb7047e96c0", "score": "0.63226086", "text": "func VPMADD52LUQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMADD52LUQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "54883e119e81e6990b62bea338af2fce", "score": "0.6300939", "text": "func VPSUBD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSUBD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "a2580e868e47d4853f583428b2787220", "score": "0.6294812", "text": "func VPSHLDVQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSHLDVQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "724fc857a3354646b3783432af77180e", "score": "0.62891465", "text": "func VPMULTISHIFTQB_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULTISHIFTQB.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "7c4a2d2db6047a47c63c4456d926cf58", "score": "0.62647885", "text": "func VPMOVSXBQ_Z(mx, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVSXBQ.Forms(), sffxs{sffxZ}, []operand.Op{mx, k, xyz})\n}", "title": "" }, { "docid": "134565b8b6a22d574db8bb35648a8222", "score": "0.62639457", "text": "func VPMOVUSQW_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVUSQW.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "bdd3fbc3a44464c555c3930a35e4fa6d", "score": "0.6263366", "text": "func VPERMPD_Z(imyz, myz, k, yz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPERMPD.Forms(), sffxs{sffxZ}, []operand.Op{imyz, myz, k, yz})\n}", "title": "" }, { "docid": "570ece221bd49ded05682b1bccc48fac", "score": "0.6261666", "text": "func VPOPCNTQ_Z(mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPOPCNTQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, k, xyz})\n}", "title": "" }, { "docid": "209e7c236c9fdb9798225ad8cbc1a262", "score": "0.6254245", "text": "func VMAXPD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMAXPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "a80cbfd309a0c7b2150df046ba33eb5d", "score": "0.6251917", "text": "func VPMINSQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMINSQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "73434ddb3c3a899687c6704218187b62", "score": "0.6240031", "text": "func VPMULHW_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULHW.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "67451b95ba99da433fb2f92502e5369e", "score": "0.6238424", "text": "func VPMAXSQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMAXSQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "833f9e9b158724f628e5092ca59144a4", "score": "0.6237874", "text": "func VPMINUB_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMINUB.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "39b87de41482c0b06552b4e521abe678", "score": "0.6227273", "text": "func MOVLQZX(m, r operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcMOVLQZX.Forms(), sffxs{}, []operand.Op{m, r})\n}", "title": "" }, { "docid": "aaf59dbd7826171930e6495250f9188e", "score": "0.6203397", "text": "func VFIXUPIMMSD_Z(i, mx, x, k, x1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFIXUPIMMSD.Forms(), sffxs{sffxZ}, []operand.Op{i, mx, x, k, x1})\n}", "title": "" }, { "docid": "963f9e04e0f6688b4dc3bc6683808873", "score": "0.6199493", "text": "func VFMSUB231PD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFMSUB231PD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "f3da54f7f3ab67a1a2f28a4ee9cc933f", "score": "0.61986524", "text": "func VPMOVUSDB_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVUSDB.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "c278cc5899c58765dfb1c38091826a62", "score": "0.6198596", "text": "func VPMAXUD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMAXUD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "f20d7aca184884bf128ad1c811f5e94a", "score": "0.61849374", "text": "func VPMOVZXBQ_Z(mx, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVZXBQ.Forms(), sffxs{sffxZ}, []operand.Op{mx, k, xyz})\n}", "title": "" }, { "docid": "998849025fce1dfdef2abe6702407614", "score": "0.61561066", "text": "func VPMAXUB_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMAXUB.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "195cbeb4b631515ee683ec97b81b56af", "score": "0.61522067", "text": "func VPRORQ_Z(i, mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPRORQ.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, k, xyz})\n}", "title": "" }, { "docid": "a3be24abbd2723e2c337bb7032622b50", "score": "0.6145515", "text": "func VMINPD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMINPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "8a37ec00447afebd113b445aba568f29", "score": "0.61447483", "text": "func VPERMQ_Z(imyz, myz, k, yz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPERMQ.Forms(), sffxs{sffxZ}, []operand.Op{imyz, myz, k, yz})\n}", "title": "" }, { "docid": "d9800f5ede473305e05ea9270bc177ba", "score": "0.6140639", "text": "func VSCALEFPD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVSCALEFPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "a209007ce198fc266869b62e66722179", "score": "0.6137494", "text": "func VPUNPCKLQDQ(ops ...operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPUNPCKLQDQ.Forms(), sffxs{}, ops)\n}", "title": "" }, { "docid": "fdf87802ae174e03ec183d84fbf32136", "score": "0.6137479", "text": "func VFNMSUB132PD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFNMSUB132PD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "4d2be5f81dd321c0d0a0c751d5c42b20", "score": "0.6132686", "text": "func VPERMILPD_Z(imxyz, mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPERMILPD.Forms(), sffxs{sffxZ}, []operand.Op{imxyz, mxyz, k, xyz})\n}", "title": "" }, { "docid": "2836f2397f3e36976aeb89148f6059f5", "score": "0.61305684", "text": "func VFMSUB132PD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFMSUB132PD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "9b5dca5565a92298c0744c2a8d8d9ba1", "score": "0.6114227", "text": "func VFNMSUB213PD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFNMSUB213PD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "c15a73af4955707c631e2e682fa87057", "score": "0.6111998", "text": "func VPMOVSQW_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVSQW.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "82c4aca9843f7459dc21803de5a05ea6", "score": "0.61016154", "text": "func VPMOVQW_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVQW.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "fffcac60ddbc9b39a6a2fec5c8981dd6", "score": "0.61012495", "text": "func VPMOVSQB_Z(xyz, k, mx operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVSQB.Forms(), sffxs{sffxZ}, []operand.Op{xyz, k, mx})\n}", "title": "" }, { "docid": "5a589d90b574d17ba1a4cfd32d9209a4", "score": "0.6090867", "text": "func VRANGEPD_Z(i, mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVRANGEPD.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "ef38346a92d60515c37ec75b6dfc4271", "score": "0.60666865", "text": "func VPMINUD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMINUD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "23950d18edf4bd964290f0b784505190", "score": "0.60636514", "text": "func VPMULHUW_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMULHUW.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "33176bc473de1ac81728b22a0a1308b6", "score": "0.60514045", "text": "func VPMOVZXWQ_Z(mx, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVZXWQ.Forms(), sffxs{sffxZ}, []operand.Op{mx, k, xyz})\n}", "title": "" }, { "docid": "5790e4d8eee5ea00339f4a7da5ee84fc", "score": "0.6050787", "text": "func VPSRLVQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSRLVQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "36e7107022f05a9487bf423b8b3249d2", "score": "0.6046183", "text": "func VFMSUB213PD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFMSUB213PD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "c7ea61e4d4735b187c36ec9e22e82d1c", "score": "0.60444605", "text": "func VFMSUB132PS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFMSUB132PS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "f4c1276e6fee55df9d4b320072e0abb4", "score": "0.60419625", "text": "func VPSRLVD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSRLVD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "057dcbd302ead5d57e8140b494524e74", "score": "0.60292345", "text": "func VFNMSUB231PS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFNMSUB231PS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "3accb9e930a9374bee56d5a0a8f6b82e", "score": "0.60265297", "text": "func PMULDQ(mx, x operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcPMULDQ.Forms(), sffxs{}, []operand.Op{mx, x})\n}", "title": "" }, { "docid": "cd12b9a419fe67e50f25ae325d04e5b4", "score": "0.6024567", "text": "func VPCLMULQDQ(i, mxyz, xyz, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPCLMULQDQ.Forms(), sffxs{}, []operand.Op{i, mxyz, xyz, xyz1})\n}", "title": "" }, { "docid": "872cec60d1789cddde876ddc0dad0599", "score": "0.6018884", "text": "func VPADDQ_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPADDQ.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "a105d2dc426659d9d8a9c523f75849f5", "score": "0.6007857", "text": "func VDIVPD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVDIVPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "68fe8c65c3d92332c1dea18de023dae0", "score": "0.60024893", "text": "func VPMOVSXWQ_Z(mx, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPMOVSXWQ.Forms(), sffxs{sffxZ}, []operand.Op{mx, k, xyz})\n}", "title": "" }, { "docid": "c39be53b63d542880ad861ea11113734", "score": "0.599792", "text": "func VFNMSUB132PS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFNMSUB132PS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "b09e98826c2d9fdbb526740ff88265a4", "score": "0.5992714", "text": "func VSQRTPD_Z(mxyz, k, xyz operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVSQRTPD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, k, xyz})\n}", "title": "" }, { "docid": "525479a90ddd50fdf2bfef1afb5ec245", "score": "0.5991436", "text": "func VPSLLVD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSLLVD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "d91e9c4e437d045fcab0dc5f350c952b", "score": "0.5989311", "text": "func VPTERNLOGQ_Z(i, mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPTERNLOGQ.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "58e0272428681d823279b07be6a850b7", "score": "0.5987349", "text": "func VPSUBW_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSUBW.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "7e34fa928ff306a518c69fe4af05e4a6", "score": "0.59864336", "text": "func VPSHRDQ_Z(i, mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPSHRDQ.Forms(), sffxs{sffxZ}, []operand.Op{i, mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "33f7c25c14b72e1eb6ba1a1ed91c362d", "score": "0.5976866", "text": "func VPROLVD_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPROLVD.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "1d204bc9cc90cff49f3b38d54d40a67a", "score": "0.59727025", "text": "func VFMSUB231PS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFMSUB231PS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "36d39331284875d65a226c79c71d8b55", "score": "0.5966431", "text": "func VGF2P8MULB_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVGF2P8MULB.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "f373d38e95d962fa38c8cc971555723a", "score": "0.59662455", "text": "func VMULSD_Z(mx, x, k, x1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVMULSD.Forms(), sffxs{sffxZ}, []operand.Op{mx, x, k, x1})\n}", "title": "" }, { "docid": "f7a6d14576d5b0563aef2a04077a983d", "score": "0.5962779", "text": "func PMULULQ(mx, x operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcPMULULQ.Forms(), sffxs{}, []operand.Op{mx, x})\n}", "title": "" }, { "docid": "ba7ce2e1649df757f7011b2e79a0c3e3", "score": "0.59570515", "text": "func VPLZCNTQ(ops ...operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVPLZCNTQ.Forms(), sffxs{}, ops)\n}", "title": "" }, { "docid": "5de48683fd28dd25275f7a58129ba65b", "score": "0.595293", "text": "func VUNPCKLPS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVUNPCKLPS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" }, { "docid": "0a49a4fb2f2b1e882ed3fd772a65324c", "score": "0.59480655", "text": "func VFMSUB213PS_Z(mxyz, xyz, k, xyz1 operand.Op) (*intrep.Instruction, error) {\n\treturn build(opcVFMSUB213PS.Forms(), sffxs{sffxZ}, []operand.Op{mxyz, xyz, k, xyz1})\n}", "title": "" } ]
62a2cce008afc38efeb364b55ad29d6d
SetRelease adds the release to the show package params
[ { "docid": "d3a4357ff35fd934fcb593e9aaa7d24b", "score": "0.7298707", "text": "func (o *ShowPackageParams) SetRelease(release string) {\n\to.Release = release\n}", "title": "" } ]
[ { "docid": "f2b2954cf7306579379b7a82d594c427", "score": "0.6725861", "text": "func (o *ShowPackageParams) WithRelease(release string) *ShowPackageParams {\n\to.SetRelease(release)\n\treturn o\n}", "title": "" }, { "docid": "219495a2bc98b37fd239b8abfb62391e", "score": "0.6034907", "text": "func Release(version, commit, date string) {\n\tif version == \"\" {\n\t\tversion = \"dev\"\n\t} else if version[0] == 'v' {\n\t\tversion = version[1:]\n\t}\n\tif commit == \"\" {\n\t\tcommit = \"-\"\n\t}\n\tif date == \"\" {\n\t\tdate = \"-\"\n\t}\n\tVersion, Commit, Date = version, commit, date\n}", "title": "" }, { "docid": "bfac49a6c2aac3d4028bc4e86fe842e8", "score": "0.5584987", "text": "func (gauo *GithubAssetUpdateOne) SetRelease(g *GithubRelease) *GithubAssetUpdateOne {\n\treturn gauo.SetReleaseID(g.ID)\n}", "title": "" }, { "docid": "a4cc2d534e02a02bcdb17d4703f6550b", "score": "0.5575144", "text": "func (gau *GithubAssetUpdate) SetRelease(g *GithubRelease) *GithubAssetUpdate {\n\treturn gau.SetReleaseID(g.ID)\n}", "title": "" }, { "docid": "a02415634c2c892f2e75a86be02bf341", "score": "0.55069804", "text": "func (m *movieNode) setReleaseDate(t time.Time) {\n\tm.releaseDate = t\n}", "title": "" }, { "docid": "af3764d65904a13e228da63e605980e9", "score": "0.5477452", "text": "func (o *installOptions) printRelease(out io.Writer, rel *release.Release) {\n\tif rel == nil {\n\t\treturn\n\t}\n\tfmt.Fprintf(out, \"NAME: %s\\n\", rel.Name)\n\tif settings.Debug {\n\t\tprintRelease(out, rel)\n\t}\n\tif !rel.Info.LastDeployed.IsZero() {\n\t\tfmt.Fprintf(out, \"LAST DEPLOYED: %s\\n\", rel.Info.LastDeployed)\n\t}\n\tfmt.Fprintf(out, \"NAMESPACE: %s\\n\", rel.Namespace)\n\tfmt.Fprintf(out, \"STATUS: %s\\n\", rel.Info.Status.String())\n\tfmt.Fprintf(out, \"\\n\")\n\tif len(rel.Info.Resources) > 0 {\n\t\tre := regexp.MustCompile(\" +\")\n\n\t\tw := tabwriter.NewWriter(out, 0, 0, 2, ' ', tabwriter.TabIndent)\n\t\tfmt.Fprintf(w, \"RESOURCES:\\n%s\\n\", re.ReplaceAllString(rel.Info.Resources, \"\\t\"))\n\t\tw.Flush()\n\t}\n\tif rel.Info.LastTestSuiteRun != nil {\n\t\tlastRun := rel.Info.LastTestSuiteRun\n\t\tfmt.Fprintf(out, \"TEST SUITE:\\n%s\\n%s\\n\\n%s\\n\",\n\t\t\tfmt.Sprintf(\"Last Started: %s\", lastRun.StartedAt),\n\t\t\tfmt.Sprintf(\"Last Completed: %s\", lastRun.CompletedAt),\n\t\t\tformatTestResults(lastRun.Results))\n\t}\n\n\tif len(rel.Info.Notes) > 0 {\n\t\tfmt.Fprintf(out, \"NOTES:\\n%s\\n\", rel.Info.Notes)\n\t}\n}", "title": "" }, { "docid": "344cc7155d29d5d2794488e59f8813c4", "score": "0.54462874", "text": "func (p *GetAnnotationsParams) ByRelease(name, revision string) {\n\tp.Tags = append(p.Tags,\n\t\t\"heritage=chronologist\",\n\t\t\"release_name=\"+name,\n\t\t\"release_revision=\"+revision,\n\t)\n}", "title": "" }, { "docid": "88d21554f05305c800f7fa5cd370637a", "score": "0.5290094", "text": "func (c *CalVer) Release() string {\n\tc.major, c.minor, c.micro, c.increment = c.next(false)\n\n\tc.pre = false\n\n\treturn c.String()\n}", "title": "" }, { "docid": "92f0fda00d81f50bb59c4e565b2ad33a", "score": "0.52231234", "text": "func MockPrepareRelease(release *Release) {\n\trelease.SetDefaultRegionAccount(to.Strp(\"region\"), to.Strp(\"account\"))\n\trelease.SetDefaults()\n\trelease.SetUUID()\n}", "title": "" }, { "docid": "75739f4baeeb5620cd922a78d7f2cb8b", "score": "0.52160835", "text": "func (t TestDescription) Release() TestDescription {\n\treturn t.newLabel(\"RELEASE\")\n}", "title": "" }, { "docid": "492bbcd613e80898eb8e45dec2f66e6f", "score": "0.5206651", "text": "func release(name string, year uint32, lead string) {\n\tevents.EmitEvent(MovieRelease, name, year, lead)\n}", "title": "" }, { "docid": "792d5b0c48d1452f8d70c3086f807ef9", "score": "0.52012575", "text": "func NewRelease(name, namespace, chart, chartVersion string, chartSpec ChartSpec, currentReleaseVersion int32, values Values, usedSubstitute Substitute, overrides Overrides) Release {\n\treturn Release{Name: name, Namespace: namespace, Chart: chart, ChartVersion: chartVersion, ChartSpec: chartSpec, CurrentReleaseVersion: currentReleaseVersion, Values: values, usedSubstitute: usedSubstitute, overrides: overrides}\n}", "title": "" }, { "docid": "5a131cdfbb268ead91ffe5e38704c232", "score": "0.5169903", "text": "func (k *KV) Release(p *KVPair, q *WriteOptions) (bool, *WriteMeta, error) {\n\tparams := make(map[string]string, 2)\n\tif p.Flags != 0 {\n\t\tparams[\"flags\"] = strconv.FormatUint(p.Flags, 10)\n\t}\n\tparams[\"release\"] = p.Session\n\treturn k.put(p.Key, params, p.Value, q)\n}", "title": "" }, { "docid": "22b41f6ead80cdb1f719918fb455a537", "score": "0.51680017", "text": "func (z *zfsctl) Release(ctx context.Context, name string, r bool, tag string) *execute {\n\targs := []string{\"release\"}\n\tif r {\n\t\targs = append(args, \"-r\")\n\t}\n\targs = append(args, tag, name)\n\treturn &execute{ctx: ctx, name: z.cmd, args: args}\n}", "title": "" }, { "docid": "bb2569a973a0f48e81ec1e21ec95248c", "score": "0.5130731", "text": "func PrintHelmReleaseInfo(release *release.Release, debug bool) error {\n\tif release == nil {\n\t\treturn nil\n\t}\n\tinfo( \"NAME: %s\", release.Name)\n\tif !release.Info.LastDeployed.IsZero() {\n\t\tinfo( \"LAST DEPLOYED: %s\", release.Info.LastDeployed.Format(time.ANSIC))\n\t}\n\tinfo( \"NAMESPACE: %s\", release.Namespace)\n\tinfo( \"STATUS: %s\", release.Info.Status.String())\n\tinfo( \"REVISION: %d\", release.Version)\n\n\n\tout := os.Stdout\n\tif debug {\n\t\tinfo(\"USER-SUPPLIED VALUES:\")\n\t\terr := output.EncodeYAML(out, release.Config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Print an extra newline\n\t\tfmt.Fprintln(out)\n\n\t\tcfg, err := chartutil.CoalesceValues(release.Chart, release.Config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Fprintln(out, \"COMPUTED VALUES:\")\n\t\terr = output.EncodeYAML(out, cfg.AsMap())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Print an extra newline\n\t\tfmt.Fprintln(out)\n\t}\n\n\tif strings.EqualFold(release.Info.Description, \"Dry run complete\") || debug {\n\t\tfmt.Fprintln(out, \"HOOKS:\")\n\t\tfor _, h := range release.Hooks {\n\t\t\tfmt.Fprintf(out, \"---\\n# Source: %s\\n%s\\n\", h.Path, h.Manifest)\n\t\t}\n\t\tfmt.Fprintf(out, \"MANIFEST:\\n%s\\n\", release.Manifest)\n\t}\n\n\tif len(release.Info.Notes) > 0 {\n\t\tfmt.Fprintf(out, \"NOTES:\\n%s\\n\", strings.TrimSpace(release.Info.Notes))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73716a218db4dd295947bcae5b4d86e3", "score": "0.5121783", "text": "func (p *Package) Release() error {\n\tvar body []byte\n\tvar err error\n\tlog.Entry().Infof(\"Release package %s\", p.PackageName)\n\tp.Connector.GetToken(\"/odata/aas_ocs_package\")\n\tappendum := \"/odata/aas_ocs_package/ReleasePackage?Name='\" + url.QueryEscape(p.PackageName) + \"'\"\n\tbody, err = p.Connector.Post(appendum, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar jPck jsonPackage\n\tif err := json.Unmarshal(body, &jPck); err != nil {\n\t\treturn errors.Wrap(err, \"Unexpected AAKaaS response for release package: \"+string(body))\n\t}\n\tp.Status = jPck.Package.Status\n\treturn nil\n}", "title": "" }, { "docid": "3c94925c2a86e0c0795bbe88f4560f38", "score": "0.508227", "text": "func (r Release) print() {\n\tfmt.Println(\"\")\n\tfmt.Println(\"\\tname: \", r.Name)\n\tfmt.Println(\"\\tdescription: \", r.Description)\n\tfmt.Println(\"\\tnamespace: \", r.Namespace)\n\tfmt.Println(\"\\tenabled: \", r.Enabled.Value)\n\tfmt.Println(\"\\tchart: \", r.Chart)\n\tfmt.Println(\"\\tversion: \", r.Version)\n\tfmt.Println(\"\\tvaluesFile: \", r.ValuesFile)\n\tfmt.Println(\"\\tvaluesFiles: \", strings.Join(r.ValuesFiles, \",\"))\n\tfmt.Println(\"\\tpostRenderer: \", r.PostRenderer)\n\tfmt.Println(\"\\ttest: \", r.Test.Value)\n\tfmt.Println(\"\\tprotected: \", r.Protected.Value)\n\tfmt.Println(\"\\twait: \", r.Wait.Value)\n\tfmt.Println(\"\\tpriority: \", r.Priority)\n\tfmt.Println(\"\\tSuccessCondition: \", r.Hooks[\"successCondition\"])\n\tfmt.Println(\"\\tSuccessTimeout: \", r.Hooks[\"successTimeout\"])\n\tfmt.Println(\"\\tDeleteOnSuccess: \", r.Hooks[\"deleteOnSuccess\"])\n\tfmt.Println(\"\\tpreInstall: \", r.Hooks[preInstall])\n\tfmt.Println(\"\\tpostInstall: \", r.Hooks[postInstall])\n\tfmt.Println(\"\\tpreUpgrade: \", r.Hooks[preUpgrade])\n\tfmt.Println(\"\\tpostUpgrade: \", r.Hooks[postUpgrade])\n\tfmt.Println(\"\\tpreDelete: \", r.Hooks[preDelete])\n\tfmt.Println(\"\\tpostDelete: \", r.Hooks[postDelete])\n\tfmt.Println(\"\\tno-hooks: \", r.NoHooks.Value)\n\tfmt.Println(\"\\ttimeout: \", r.Timeout)\n\tfmt.Println(\"\\tvalues to override from env:\")\n\tprintMap(r.Set, 2)\n\tfmt.Println(\"------------------- \")\n}", "title": "" }, { "docid": "1c691ff1fd0d9f0d066beb78d319c49e", "score": "0.50666696", "text": "func (o *ApplianceImageBundleAllOf) SetReleaseTime(v time.Time) {\n\to.ReleaseTime = &v\n}", "title": "" }, { "docid": "c1ab533e35725fe88f4c39e8bbebb8ef", "score": "0.5057044", "text": "func (gau *GithubAssetUpdate) SetReleaseID(id int) *GithubAssetUpdate {\n\tgau.mutation.SetReleaseID(id)\n\treturn gau\n}", "title": "" }, { "docid": "dca96e2537546940e7479d1347126443", "score": "0.50489235", "text": "func (scl *SimpleConfigurationLayer) SetReleaseAssets(releaseAssets *map[string]*ent.Attachment) {\n\tscl.ReleaseAssets = releaseAssets\n}", "title": "" }, { "docid": "0c3e59371ec5ab64a2d99244e8418133", "score": "0.5023452", "text": "func (gauo *GithubAssetUpdateOne) SetReleaseID(id int) *GithubAssetUpdateOne {\n\tgauo.mutation.SetReleaseID(id)\n\treturn gauo\n}", "title": "" }, { "docid": "b04947781b0178e5cae2d235a1733cf4", "score": "0.4981386", "text": "func (scl *SimpleConfigurationLayer) SetReleasePrefix(releasePrefix *string) {\n\tscl.ReleasePrefix = releasePrefix\n}", "title": "" }, { "docid": "e433972acb81d8f7fee328ca107a07cc", "score": "0.49725413", "text": "func (tp *TownParser) fillRelease(r *data.Release) {\n\turl := r.Url\n\tsubforum := strings.Split(url, \"/\")[0]\n\ttp.checkCat(r, subforum)\n\tr.Url = \"http://www.town.ag/v2/\" + r.Url\n\ttp.checkQual(r)\n}", "title": "" }, { "docid": "08aa5efb3c5575139edc666f40a48c84", "score": "0.49580625", "text": "func (o *VulnerabilitiesRequest) SetReleasever(v string) {\n\to.Releasever = &v\n}", "title": "" }, { "docid": "fd1131d377841555f41226e5141b0a86", "score": "0.4946384", "text": "func GetRelease(cmd *cobra.Command, args []string) {\n\treq := &helmmanager.ListReleaseReq{}\n\n\tif !flagAll {\n\t\treq.Size = common.GetUint32P(uint32(flagNum))\n\t}\n\tif len(args) > 0 {\n\t\treq.Size = common.GetUint32P(1)\n\t\treq.Name = common.GetStringP(args[0])\n\t}\n\treq.ClusterID = &flagCluster\n\treq.Namespace = &flagNamespace\n\n\tc := newClientWithConfiguration()\n\tr, err := c.Release().List(cmd.Context(), req)\n\tif err != nil {\n\t\tfmt.Printf(\"get release failed, %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\tif flagOutput == outputTypeJson {\n\t\tprinter.PrintReleaseInJson(r)\n\t\treturn\n\t}\n\n\tprinter.PrintReleaseInTable(flagOutput == outputTypeWide, r)\n}", "title": "" }, { "docid": "ec4fa1d638dc65987c83865a4fa26a2c", "score": "0.49400854", "text": "func SetDebug(debug bool) {\n\tisDebug = debug\n}", "title": "" }, { "docid": "a9d6906e024b48c340ec843c542cf77e", "score": "0.49156627", "text": "func (operator *AccessOperator) UpdateRelease(cxt context.Context, option *ReleaseOption) error {\n\t//business first\n\tbusiness, _, err := getBusinessAndApp(operator, operator.Business, option.AppName)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequest := &accessserver.UpdateReleaseReq{\n\t\tSeq: pkgcommon.Sequence(),\n\t\tBid: business.Bid,\n\t\tReleaseid: option.ReleaseID,\n\t\tName: option.Name,\n\t\tOperator: operator.User,\n\t}\n\tgrpcOptions := []grpc.CallOption{\n\t\tgrpc.WaitForReady(true),\n\t}\n\tresponse, err := operator.Client.UpdateRelease(cxt, request, grpcOptions...)\n\tif err != nil {\n\t\tlogger.V(3).Infof(\"UpdateRelease %s failed, %s\", option.Name, err.Error())\n\t\treturn err\n\t}\n\tif response.ErrCode != common.ErrCode_E_OK {\n\t\tlogger.V(3).Infof(\"UpdateRelease %s successfully, but response Err, %s\", option.ReleaseID, response.ErrMsg)\n\t\treturn fmt.Errorf(\"%s\", response.ErrMsg)\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "e9e36568e91dfdc401883cd32475f8bf", "score": "0.4905934", "text": "func ReleaseMock(opts *MockReleaseOptions) *release.Release {\n\tdate := time.Unix(242085845, 0).UTC()\n\n\tname := opts.Name\n\tif name == \"\" {\n\t\tname = \"testrelease-\" + string(rand.Intn(100))\n\t}\n\n\tversion := 1\n\tif opts.Version != 0 {\n\t\tversion = opts.Version\n\t}\n\n\tnamespace := opts.Namespace\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tch := opts.Chart\n\tif opts.Chart == nil {\n\t\tch = &chart.Chart{\n\t\t\tMetadata: &chart.Metadata{\n\t\t\t\tName: \"foo\",\n\t\t\t\tVersion: \"0.1.0-beta.1\",\n\t\t\t},\n\t\t\tTemplates: []*chart.File{\n\t\t\t\t{Name: \"templates/foo.tpl\", Data: []byte(MockManifest)},\n\t\t\t},\n\t\t}\n\t}\n\n\tscode := release.StatusDeployed\n\tif len(opts.Status) > 0 {\n\t\tscode = opts.Status\n\t}\n\n\treturn &release.Release{\n\t\tName: name,\n\t\tInfo: &release.Info{\n\t\t\tFirstDeployed: date,\n\t\t\tLastDeployed: date,\n\t\t\tStatus: scode,\n\t\t\tDescription: \"Release mock\",\n\t\t},\n\t\tChart: ch,\n\t\tConfig: map[string]interface{}{\"name\": \"value\"},\n\t\tVersion: version,\n\t\tNamespace: namespace,\n\t\tHooks: []*release.Hook{\n\t\t\t{\n\t\t\t\tName: \"pre-install-hook\",\n\t\t\t\tKind: \"Job\",\n\t\t\t\tPath: \"pre-install-hook.yaml\",\n\t\t\t\tManifest: MockHookTemplate,\n\t\t\t\tLastRun: date,\n\t\t\t\tEvents: []release.HookEvent{release.HookPreInstall},\n\t\t\t},\n\t\t},\n\t\tManifest: MockManifest,\n\t}\n}", "title": "" }, { "docid": "da15a79b48a3d57c777fad99cb42bbb8", "score": "0.4867242", "text": "func IsRelease() bool {\n\treturn false\n}", "title": "" }, { "docid": "b7fc0dad283863a9585a29054f89e656", "score": "0.4845086", "text": "func IsRelease() bool {\n\tout, _ := strconv.ParseBool(__RELEASE__)\n\treturn out\n}", "title": "" }, { "docid": "978874654bd2733e37502d317ff58360", "score": "0.4828172", "text": "func (d Document) Release() string {\n\tvalue, _ := d.labels[releaseLabel].(string)\n\n\treturn value\n}", "title": "" }, { "docid": "bdaccfd4f495d4cdefcad213d88444ed", "score": "0.48260152", "text": "func (scl *SimpleConfigurationLayer) SetReleaseTypes(releaseTypes *ent.ReleaseTypes) {\n\tscl.ReleaseTypes = releaseTypes\n}", "title": "" }, { "docid": "ebc7d5f460ae9bd835d1b97e64b4a98c", "score": "0.48185128", "text": "func SetDebug(debug bool) {\n\tAPI.DEBUG = debug\n}", "title": "" }, { "docid": "de01ba37f209dc0a905361b61c437768", "score": "0.48095006", "text": "func SetDebug(b bool) {\n\tisDebug = b\n}", "title": "" }, { "docid": "08c238ecb6fec33e6b481a1c1189f820", "score": "0.48048264", "text": "func IsRelease() bool {\n\treturn Release == \"TRUE\"\n}", "title": "" }, { "docid": "1ea082bb2e4bab1753ecda7c3579fcdd", "score": "0.47997847", "text": "func (o *UpdatesV3Request) SetReleasever(v string) {\n\to.Releasever = &v\n}", "title": "" }, { "docid": "78dbe99eb8533e2e555a2668fe817093", "score": "0.47949973", "text": "func SetDebug(debug bool) {\n\tcurrentDebug = debug\n}", "title": "" }, { "docid": "95160a60e029bcbb9c6e70e5042045e1", "score": "0.47880557", "text": "func (g *GitHub) SetAsset(name string) {\n\tg.releaseAsset = name\n}", "title": "" }, { "docid": "d86aec25e3c3c29ee9d2ee3220f783fc", "score": "0.47630444", "text": "func SetDebug(flag bool) {\n\tdebug = flag\n}", "title": "" }, { "docid": "0eca40042feba91da4c13133747fa936", "score": "0.4750287", "text": "func (u *Uname) Release() string {\n\treturn toString(u.Utsname.Release[:])\n}", "title": "" }, { "docid": "b6262f752e5326ee3540186433730cce", "score": "0.47429523", "text": "func NewRelease(tag string) Release {\n\treturn Release{\n\t\tTag: tag,\n\t}\n}", "title": "" }, { "docid": "d3fee3cfab71d560fbdab594db415d19", "score": "0.4718366", "text": "func Release() string {\n\treturn New().Version\n}", "title": "" }, { "docid": "383c0fb1466db7cc6142f7ec47cfcd3c", "score": "0.4713394", "text": "func SetDebug(value bool) {\n\tdebug = value\n}", "title": "" }, { "docid": "be5fda5644c2bba7d3a9bb4bd62f8967", "score": "0.47005427", "text": "func SetProductionCommand(c *cli.Context) error {\n\n\tl, err := client.Productions()\n\tif err != nil {\n\t\tprintError(c, err)\n\t\treturn nil\n\t}\n\n\tif len(l.Productions) == 0 {\n\t\tfmt.Println(\"No shows available.\")\n\t\treturn nil\n\t}\n\n\tname := c.Args().First()\n\tif name == \"\" {\n\t\t// print the current show if one has been selected\n\t\tif client.GUID == \"\" {\n\t\t\tfmt.Println(\"No shows selected. Use 'po set NAME' first\")\n\t\t\treturn nil\n\t\t}\n\t\tfor _, details := range l.Productions {\n\t\t\tif details.GUID == client.GUID {\n\t\t\t\tfmt.Println(productionListing(\"GUID\", \"NAME\", \"TITLE\", false))\n\t\t\t\tfmt.Println(productionListing(details.GUID, details.Name, details.Title, false))\n\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfmt.Println(\"No shows selected. Use 'po set NAME' first\")\n\t\treturn nil\n\t}\n\n\tfor _, details := range l.Productions {\n\t\tif name == details.Name {\n\t\t\tclient.GUID = details.GUID\n\t\t\tclient.Store(defaultPathAndName)\n\n\t\t\tfmt.Println(productionListing(\"GUID\", \"NAME\", \"TITLE\", false))\n\t\t\tfmt.Println(productionListing(details.GUID, details.Name, details.Title, true))\n\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tfmt.Println(fmt.Sprintf(\"Can not set show '%s'. Use 'po list' to list available shows\", name))\n\n\treturn nil\n}", "title": "" }, { "docid": "766157120d302ab3e8dff6280f4d5fba", "score": "0.4698935", "text": "func newTestRelease() *Release {\n\tv, _ := version.NewVersion(\"1.0.0\")\n\tt, _ := time.Parse(time.RFC1123Z, \"Fri, 13 May 2016 12:00:00 +0200\")\n\n\treturn &Release{\n\t\tversion: v,\n\t\tbuild: \"1000\",\n\t\ttitle: \"Test\",\n\t\tdescription: \"Test\",\n\t\tpublishedDateTime: NewPublishedDateTime(&t),\n\t\treleaseNotesLink: \"https://example.com/changelogs/1.0.0.html\",\n\t\tminimumSystemVersion: \"10.9\",\n\t\tdownloads: []Download{\n\t\t\t*NewDownload(\"https://example.com/1.0.0/one.dmg\", \"application/octet-stream\", 100000),\n\t\t\t*NewDownload(\"https://example.com/1.0.0/two.dmg\", \"application/octet-stream\", 100000),\n\t\t},\n\t\tisPreRelease: false,\n\t}\n}", "title": "" }, { "docid": "8a7060ca938df06296be4d56843b7d0b", "score": "0.46937308", "text": "func (o *GetReleasesReleaseIDContainersParams) SetReleaseID(releaseID int64) {\n\to.ReleaseID = releaseID\n}", "title": "" }, { "docid": "22138287b28b26fc77cb120356761f60", "score": "0.46840513", "text": "func (m *ZebraFotaArtifact) SetReleaseNotesUrl(value *string)() {\n err := m.GetBackingStore().Set(\"releaseNotesUrl\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "efeea639332ec862898c9ecf7680d07c", "score": "0.4672083", "text": "func CreateRelease(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Set(\"Content-Type\", \"application/json\")\n\tc := Release{\"relid\", \"http://ispw:8080/ispw/ispw/releases/relid\"}\n\toutgoingJSON, err := json.Marshal(c)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tres.WriteHeader(http.StatusCreated)\n\tfmt.Fprint(res, string(outgoingJSON))\n}", "title": "" }, { "docid": "21b9faa11537215595abd4ca06209f9a", "score": "0.4664111", "text": "func (o *ShowPackageParams) SetPackage(packageVar string) {\n\to.Package = packageVar\n}", "title": "" }, { "docid": "89c6297e7c6fd484fc7bbb2c5a2d7813", "score": "0.4661087", "text": "func PrepareRelease(release *deployer.Release, zip_file_path *string) error {\n\tregion, account_id := to.RegionAccount()\n\trelease.SetDefaults(region, account_id, \"coinbase-step-deployer-\")\n\n\tlambda_sha, err := to.SHA256File(*zip_file_path)\n\tif err != nil {\n\t\treturn err\n\t}\n\trelease.LambdaSHA256 = &lambda_sha\n\n\t// Interpolate variables for resource strings\n\trelease.StateMachineJSON = to.InterpolateArnVariables(\n\t\trelease.StateMachineJSON,\n\t\trelease.AwsRegion,\n\t\trelease.AwsAccountID,\n\t\trelease.LambdaName,\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "96775585a8b9d33fac1101d17f73ec51", "score": "0.4623337", "text": "func SetDebug(debug bool) {\n\tmgo.SetDebug(debug)\n}", "title": "" }, { "docid": "6e42164f75de40699120a730c43d8534", "score": "0.46229345", "text": "func EditRelease(ctx *context.APIContext) {\n\t// swagger:operation PATCH /repos/{owner}/{repo}/releases/{id} repository repoEditRelease\n\t// ---\n\t// summary: Update a release\n\t// consumes:\n\t// - application/json\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: owner\n\t// in: path\n\t// description: owner of the repo\n\t// type: string\n\t// required: true\n\t// - name: repo\n\t// in: path\n\t// description: name of the repo\n\t// type: string\n\t// required: true\n\t// - name: id\n\t// in: path\n\t// description: id of the release to edit\n\t// type: integer\n\t// format: int64\n\t// required: true\n\t// - name: body\n\t// in: body\n\t// schema:\n\t// \"$ref\": \"#/definitions/EditReleaseOption\"\n\t// responses:\n\t// \"200\":\n\t// \"$ref\": \"#/responses/Release\"\n\t// \"404\":\n\t// \"$ref\": \"#/responses/notFound\"\n\n\tform := web.GetForm(ctx).(*api.EditReleaseOption)\n\tid := ctx.ParamsInt64(\":id\")\n\trel, err := repo_model.GetReleaseByID(ctx, id)\n\tif err != nil && !repo_model.IsErrReleaseNotExist(err) {\n\t\tctx.Error(http.StatusInternalServerError, \"GetReleaseByID\", err)\n\t\treturn\n\t}\n\tif err != nil && repo_model.IsErrReleaseNotExist(err) ||\n\t\trel.IsTag || rel.RepoID != ctx.Repo.Repository.ID {\n\t\tctx.NotFound()\n\t\treturn\n\t}\n\n\tif len(form.TagName) > 0 {\n\t\trel.TagName = form.TagName\n\t}\n\tif len(form.Target) > 0 {\n\t\trel.Target = form.Target\n\t}\n\tif len(form.Title) > 0 {\n\t\trel.Title = form.Title\n\t}\n\tif len(form.Note) > 0 {\n\t\trel.Note = form.Note\n\t}\n\tif form.IsDraft != nil {\n\t\trel.IsDraft = *form.IsDraft\n\t}\n\tif form.IsPrerelease != nil {\n\t\trel.IsPrerelease = *form.IsPrerelease\n\t}\n\tif err := release_service.UpdateRelease(ctx.Doer, ctx.Repo.GitRepo, rel, nil, nil, nil); err != nil {\n\t\tctx.Error(http.StatusInternalServerError, \"UpdateRelease\", err)\n\t\treturn\n\t}\n\n\t// reload data from database\n\trel, err = repo_model.GetReleaseByID(ctx, id)\n\tif err != nil {\n\t\tctx.Error(http.StatusInternalServerError, \"GetReleaseByID\", err)\n\t\treturn\n\t}\n\tif err := rel.LoadAttributes(ctx); err != nil {\n\t\tctx.Error(http.StatusInternalServerError, \"LoadAttributes\", err)\n\t\treturn\n\t}\n\tctx.JSON(http.StatusOK, convert.ToAPIRelease(ctx, ctx.Repo.Repository, rel))\n}", "title": "" }, { "docid": "b20a94dc69b3bd9628eaf7e5116dd05b", "score": "0.4620445", "text": "func SetPackage(v string) { packagingType.Store(v) }", "title": "" }, { "docid": "f57cebbe3b05fe28f46e724ca633d19e", "score": "0.46180722", "text": "func (c *FakeClient) InstallRelease(chStr, ns string, opts ...InstallOption) (*release.Release, error) {\n\tchart := &chart.Chart{}\n\treturn c.InstallReleaseFromChart(chart, ns, opts...)\n}", "title": "" }, { "docid": "2d7719606c09970696b2d7b623d52e71", "score": "0.4607143", "text": "func SwitchRelease(binToSlice string, helmBinPath string, helmVersionPath string) error {\n\n\t// Delete actual symlink\n\trmLn := &BashCmd{\n\t\tCmd: \"find\",\n\t\tArgs: []string{\"-L\", \".\", \"-xtype\", \"l\", \"-delete\"},\n\t\tExecPath: helmBinPath,\n\t}\n\t_, err := ExecBashCmd(rmLn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create symlink to helm new version\n\tln := &BashCmd{\n\t\tCmd: \"ln\",\n\t\tArgs: []string{\"-s\", fmt.Sprintf(\"%s/helm-%s\", helmVersionPath, binToSlice), fmt.Sprintf(\"%s/helm\", helmBinPath)},\n\t}\n\t_, err = ExecBashCmd(ln)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c276dd7d5dd3906f690ef230e84cb073", "score": "0.4606399", "text": "func SetProductionCommand(c *cli.Context) error {\n\n\tl, err := client.Productions()\n\tif err != nil {\n\t\tprintError(c, err)\n\t\treturn nil\n\t}\n\n\tif len(l.Productions) == 0 {\n\t\tfmt.Println(messagedef.MsgNoProductionsFound)\n\t\treturn nil\n\t}\n\n\tproduction := c.Args().First()\n\tif production == \"\" {\n\t\t// print the current show if one has been selected\n\t\tif client.DefaultProduction() == \"\" {\n\t\t\tfmt.Println(messagedef.MsgErrorNoProduction)\n\t\t\treturn nil\n\t\t}\n\t\tfor _, details := range l.Productions {\n\t\t\tif details.GUID == client.DefaultProduction() {\n\t\t\t\tfmt.Println(productionListing(\"ID\", \"NAME\", \"TITLE\", false))\n\t\t\t\tfmt.Println(productionListing(details.GUID, details.Name, details.Title, false))\n\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfmt.Println(messagedef.MsgErrorNoProduction)\n\t\treturn nil\n\t}\n\n\tfor _, details := range l.Productions {\n\t\tif production == details.GUID {\n\t\t\tstoreDefaultProduction(production)\n\t\t\tfmt.Println(productionListing(\"ID\", \"NAME\", \"TITLE\", false))\n\t\t\tfmt.Println(productionListing(details.GUID, details.Name, details.Title, true))\n\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tprintMsg(messagedef.MsgErrorCanNotSetProduction)\n\treturn nil\n}", "title": "" }, { "docid": "b9e1276ecb7e6fd3e3316efe4c5d25aa", "score": "0.46045113", "text": "func runReleaseCmd(cmd *cobra.Command, args []string) {\n\tconfigFile, _ := cmd.Flags().GetString(\"config\")\n\tconfig := &config.Config{}\n\terr := config.Load(configFile)\n\tif err != nil {\n\t\tfmt.Printf(\"could not load config file: %v\\n\", err)\n\t\tos.Exit(1)\n\t\treturn\n\t}\n\n\tspinner, err := initSpinner(fmt.Sprintf(\"Releasing v%s of %s\", args[0], config.Repository))\n\tif err != nil {\n\t\tfmt.Println(\"could not init spinner\")\n\t\tos.Exit(1)\n\t\treturn\n\t}\n\tspinner.Start()\n\n\tnewRelease, err := github.NewRelease(config, args, spinner)\n\tif err != nil {\n\t\tspinner.StopFailMessage(fmt.Sprintf(\"%v\", err))\n\t\tspinner.StopFail()\n\t\tos.Exit(1)\n\t\treturn\n\t}\n\n\tcl, err := changelog.HandleChangelog(newRelease.ProjectName, newRelease.Version, newRelease.Date, spinner)\n\tif err != nil {\n\t\tspinner.StopFailMessage(fmt.Sprintf(\"%v\", err))\n\t\tspinner.StopFail()\n\t\tos.Exit(1)\n\t\treturn\n\t}\n\n\tnewRelease.Changelog = cl\n\n\tvar binaryPath string\n\tskipBinary, _ := cmd.Flags().GetBool(\"skipBinary\")\n\tif !skipBinary {\n\t\t// set project build path so we have a predictable location\n\t\tbinaryPath = fmt.Sprintf(binaryPathFmt, newRelease.ProjectName, newRelease.Version)\n\t\trunBuildCmd(cmd, []string{newRelease.Version, binaryPath})\n\t}\n\n\ttokenFile, _ := cmd.Flags().GetString(\"tokenFile\")\n\terr = newRelease.CreateGithubRelease(tokenFile, binaryPath, spinner)\n\tif err != nil {\n\t\tspinner.StopFailMessage(fmt.Sprintf(\"%v\", err))\n\t\tspinner.StopFail()\n\t\tos.Exit(1)\n\t\treturn\n\t}\n\n\tspinner.Suffix(\" Finished release\")\n\tspinner.Stop()\n}", "title": "" }, { "docid": "ba5f41f3d4141897863c5527a002843c", "score": "0.45983598", "text": "func InstallWithReleaseName(name string) InstallOption {\n\treturn installOptionAdapter(func(o *installOptions) {\n\t\to.ReleaseName = name\n\t})\n}", "title": "" }, { "docid": "1be452a52dc0f94d397a46cf38a880ba", "score": "0.45942706", "text": "func SetDebug(isDebug bool) {\n\tplog.isDebug = isDebug\n}", "title": "" }, { "docid": "5c5efe8e27045238a24b455fc3f77684", "score": "0.45830262", "text": "func patchRelease(f *os.File, info *ReleaseInfo) {\n\t// Release note for different labels\n\tf.WriteString(fmt.Sprintf(\"## Changelog since %s\\n\\n\", info.startTag))\n\n\tif len(info.releaseActionRequiredPRs) > 0 {\n\t\tf.WriteString(\"### Action Required\\n\\n\")\n\t\tfor _, pr := range info.releaseActionRequiredPRs {\n\t\t\tf.WriteString(fmt.Sprintf(\"* %s (#%d, @%s)\\n\", extractReleaseNoteFromPR(info.prMap[pr]), pr, *info.prMap[pr].User.Login))\n\t\t}\n\t\tf.WriteString(\"\\n\")\n\t}\n\n\tif len(info.releasePRs) > 0 {\n\t\tf.WriteString(\"### Other notable changes\\n\\n\")\n\t\tfor _, pr := range info.releasePRs {\n\t\t\tf.WriteString(fmt.Sprintf(\"* %s (#%d, @%s)\\n\", extractReleaseNoteFromPR(info.prMap[pr]), pr, *info.prMap[pr].User.Login))\n\t\t}\n\t\tf.WriteString(\"\\n\")\n\t} else {\n\t\tf.WriteString(\"**No notable changes for this release**\\n\\n\")\n\t}\n}", "title": "" }, { "docid": "cf81352785b80b8cdee08a5100c9f986", "score": "0.45800802", "text": "func NewRelease(executer executer.Executer, config Config) Release {\n\treturn &release{executer: executer, config: config}\n}", "title": "" }, { "docid": "ead319111638ea862838f01af5126de6", "score": "0.45790404", "text": "func (o ApplicationSpecSourceHelmOutput) ReleaseName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationSpecSourceHelm) *string { return v.ReleaseName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cbfb99958c047be151a2b4760be9f943", "score": "0.4578698", "text": "func CutRelease(release string, rc string, isFirstMinorRelease bool, backportRelease bool,\n\tisDryRun bool, legacy bool, server string, webapp string) *AppError {\n\tvar jobName string\n\tif legacy {\n\t\tjobName = Cfg.ReleaseJobLegacy\n\t} else {\n\t\tjobName = Cfg.ReleaseJob\n\t}\n\n\tisRunning, err := IsCutReleaseRunning(jobName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif isRunning {\n\t\treturn NewError(\"There is a release job running.\", nil)\n\t}\n\n\tshortRelease := release[:len(release)-2]\n\treleaseBranch := \"release-\" + shortRelease\n\n\tvar fullRelease string\n\tvar rcpart string\n\tif rc == \"\" {\n\t\tfullRelease = release\n\t\trcpart = \"\"\n\t} else {\n\t\tfullRelease = release + \"-\" + rc\n\t\trcpart = \"-\" + rc\n\t}\n\n\tisFirstMinorReleaseStr := \"false\"\n\tif isFirstMinorRelease {\n\t\tisFirstMinorReleaseStr = \"true\"\n\t}\n\n\tisDryRunStr := \"false\"\n\tif isDryRun {\n\t\tisDryRunStr = \"true\"\n\t}\n\n\tisDotReleaseStr := \"false\"\n\tif backportRelease {\n\t\tisDotReleaseStr = \"true\"\n\t}\n\n\tparameters := map[string]string{\n\t\t\"MM_VERSION\": release,\n\t\t\"MM_RC\": rcpart,\n\t\t\"IS_FIRST_MINOR_RELEASE\": isFirstMinorReleaseStr,\n\t\t\"IS_DRY_RUN\": isDryRunStr,\n\t\t\"IS_DOT_RELEASE\": isDotReleaseStr,\n\t\t\"IS_BACKPORT\": isDotReleaseStr,\n\t\t\"PIP_BRANCH\": releaseBranch,\n\t}\n\n\tif server != \"\" {\n\t\tparameters[\"MM_BUILDER_SERVER_DOCKER\"] = server\n\t}\n\n\tif webapp != \"\" {\n\t\tparameters[\"MM_BUILDER_WEBAPP_DOCKER\"] = webapp\n\t}\n\n\t// We want to return so the user knows the build has started.\n\t// Build jobs should report their own failure.\n\tgo func() {\n\t\tresult, err := RunJobWaitForResult(\n\t\t\tjobName,\n\t\t\tparameters)\n\t\tif err != nil || result != gojenkins.STATUS_SUCCESS {\n\t\t\tLogError(\"Release Job failed. Version=\" + fullRelease + \" err= \" + err.Error() + \" Jenkins result= \" + result)\n\t\t\treturn\n\t\t}\n\n\t\t// If Release was success trigger the Rctesting job to update\n\t\tLogInfo(\"Release Job Status: \" + result)\n\t\tif !backportRelease {\n\t\t\tLogInfo(\"Will trigger Job: \" + Cfg.RCTestingJob)\n\t\t\tRunJobParameters(Cfg.RCTestingJob, map[string]string{\"LONG_RELEASE\": fullRelease}, Cfg.CIServerJenkinsUserName, Cfg.CIServerJenkinsToken, Cfg.CIServerJenkinsURL)\n\n\t\t\t// Only update the CI servers and community if this is the latest release\n\t\t\tLogInfo(\"Setting CI Servers\")\n\t\t\tSetCIServerBranch(releaseBranch)\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "7c0ab6a132e602297a0071c8f5109944", "score": "0.45760477", "text": "func SetDebug(b bool) {\n\tdebugon = b\n}", "title": "" }, { "docid": "b107f08d8b6f7268f0604a71d0960b9c", "score": "0.4575024", "text": "func SetDebug(mode bool) {\n\tdebug = mode\n}", "title": "" }, { "docid": "bc4a56263dcc294fb5b2fd7aa067ce66", "score": "0.45601493", "text": "func (in *Release) DeepCopy() *Release {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Release)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bc4a56263dcc294fb5b2fd7aa067ce66", "score": "0.45601493", "text": "func (in *Release) DeepCopy() *Release {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Release)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "67258b57af10173e8e299501281bfbb3", "score": "0.4547167", "text": "func (c *FakeClient) UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error) {\n\treturn c.UpdateReleaseFromChart(rlsName, &chart.Chart{}, opts...)\n}", "title": "" }, { "docid": "6b92cc77348623c09f95ed2a1aba36b2", "score": "0.4536285", "text": "func (m manager) InstallRelease(ctx context.Context, opts ...InstallOption) (*rpb.Release, error) {\n\tinstall := action.NewInstall(m.actionConfig)\n\tinstall.ReleaseName = m.releaseName\n\tinstall.Namespace = m.namespace\n\tfor _, o := range opts {\n\t\tif err := o(install); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to apply install option: %w\", err)\n\t\t}\n\t}\n\n\tinstalledRelease, err := install.Run(m.chart, m.values)\n\tif err != nil {\n\t\t// Workaround for helm/helm#3338\n\t\tif installedRelease != nil {\n\t\t\tuninstall := action.NewUninstall(m.actionConfig)\n\t\t\t_, uninstallErr := uninstall.Run(m.releaseName)\n\n\t\t\t// In certain cases, InstallRelease will return a partial release in\n\t\t\t// the response even when it doesn't record the release in its release\n\t\t\t// store (e.g. when there is an error rendering the release manifest).\n\t\t\t// In that case the rollback will fail with a not found error because\n\t\t\t// there was nothing to rollback.\n\t\t\t//\n\t\t\t// Only log a message about a rollback failure if the failure was caused\n\t\t\t// by something other than the release not being found.\n\t\t\tif uninstallErr != nil && !notFoundErr(uninstallErr) {\n\t\t\t\treturn nil, fmt.Errorf(\"failed installation (%s) and failed rollback: %w\", err, uninstallErr)\n\t\t\t}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to install release: %w\", err)\n\t}\n\treturn installedRelease, nil\n}", "title": "" }, { "docid": "be8c7fdd11f5d6bce15a70b105bdc193", "score": "0.45154038", "text": "func releaseString() string {\n\treturn fmt.Sprintf(\"%s/%s, %s, %s\\n\", runtime.GOOS, runtime.GOARCH, runtime.Version(), GitCommit)\n}", "title": "" }, { "docid": "0f8638a2f7e39ea0548ab1f6d640d37e", "score": "0.45062116", "text": "func (in *ReleaseSpec) DeepCopy() *ReleaseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReleaseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0f8638a2f7e39ea0548ab1f6d640d37e", "score": "0.45062116", "text": "func (in *ReleaseSpec) DeepCopy() *ReleaseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReleaseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "afe35d5b45e5fb516eb2a26dbd28893e", "score": "0.44850138", "text": "func (hdr RPMHeader) Release() string {\n\treturn hdr.Tag(\"Release\")[0]\n}", "title": "" }, { "docid": "e96169584a279a0b2404caa775cdaf04", "score": "0.44760242", "text": "func (s *ReleaseService) AddTextRelease(r *Release, authToken string) (*Release, error) {\n\tvar (\n\t\tmethod = http.MethodPost\n\t\tpath = fmt.Sprintf(\"/releases\")\n\t)\n\treq := s.client.newRequest(path, method)\n\taddJWTToRequest(req, authToken)\n\tr.Type = Text\n\terr := addBodyToRequestAsJSON(req, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.addRelease(req)\n}", "title": "" }, { "docid": "7cba920cddde31e4c23493cdb3aa4507", "score": "0.4469879", "text": "func (c *gitlabClient) CreateRelease(ctx *context.Context, body string) (releaseID string, err error) {\n\ttitle, err := tmpl.New(ctx).Apply(ctx.Config.Release.NameTemplate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tprojectID := ctx.Config.Release.GitLab.Owner + \"/\" + ctx.Config.Release.GitLab.Name\n\tlog.WithFields(log.Fields{\n\t\t\"owner\": ctx.Config.Release.GitLab.Owner,\n\t\t\"name\": ctx.Config.Release.GitLab.Name,\n\t}).Debug(\"projectID\")\n\n\tname := title\n\ttagName := ctx.Git.CurrentTag\n\trelease, resp, err := c.client.Releases.GetRelease(projectID, tagName)\n\tif err != nil && resp.StatusCode != 403 {\n\t\treturn \"\", err\n\t}\n\n\tif resp.StatusCode == 403 {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err.Error(),\n\t\t}).Debug(\"get release\")\n\n\t\tdescription := body\n\t\tref := ctx.Git.Commit\n\t\tgitURL := ctx.Git.URL\n\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"name\": name,\n\t\t\t\"description\": description,\n\t\t\t\"ref\": ref,\n\t\t\t\"url\": gitURL,\n\t\t}).Debug(\"creating release\")\n\t\trelease, _, err = c.client.Releases.CreateRelease(projectID, &gitlab.CreateReleaseOptions{\n\t\t\tName: &name,\n\t\t\tDescription: &description,\n\t\t\tRef: &ref,\n\t\t\tTagName: &tagName,\n\t\t})\n\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"err\": err.Error(),\n\t\t\t}).Debug(\"error create release\")\n\t\t\treturn \"\", err\n\t\t}\n\t\tlog.WithField(\"name\", release.Name).Info(\"release created\")\n\t} else {\n\t\tdesc := body\n\t\tif release != nil && release.DescriptionHTML != \"\" {\n\t\t\tdesc = release.DescriptionHTML\n\t\t}\n\n\t\trelease, _, err = c.client.Releases.UpdateRelease(projectID, tagName, &gitlab.UpdateReleaseOptions{\n\t\t\tName: &name,\n\t\t\tDescription: &desc,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"err\": err.Error(),\n\t\t\t}).Debug(\"error update release\")\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tlog.WithField(\"name\", release.Name).Info(\"release updated\")\n\t}\n\n\treturn tagName, err // gitlab references a tag in a repo by its name\n}", "title": "" }, { "docid": "8a9ac46a8a475e071988e86447e1910d", "score": "0.44680002", "text": "func (m manager) ReleaseName() string {\n\treturn m.releaseName\n}", "title": "" }, { "docid": "7148e0803292d69c1428c81fef3155c5", "score": "0.44556192", "text": "func (o *GetReleaseOptions) Run() error {\n\tjxClient, curNs, err := o.JXClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tns := o.Namespace\n\tif ns == \"\" {\n\t\tns = curNs\n\t}\n\treleases, err := kube.GetOrderedReleases(jxClient, ns, o.Filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(releases) == 0 {\n\t\tsuffix := \"\"\n\t\tif o.Filter != \"\" {\n\t\t\tsuffix = fmt.Sprintf(\" for filter: %s\", util.ColorInfo(o.Filter))\n\t\t}\n\t\tlog.Logger().Infof(\"No Releases found in namespace %s%s.\", util.ColorInfo(ns), suffix)\n\t\tlog.Logger().Infof(\"To create a release try merging code to a master branch to trigger a pipeline or try: %s\", util.ColorInfo(\"jx start build\"))\n\t\treturn nil\n\t}\n\ttable := o.CreateTable()\n\ttable.AddRow(\"NAME\", \"VERSION\")\n\tfor _, release := range releases {\n\t\ttable.AddRow(release.Spec.Name, release.Spec.Version)\n\t}\n\ttable.Render()\n\treturn nil\n}", "title": "" }, { "docid": "de48c22d68cff9e616094bb97e653fc1", "score": "0.44513533", "text": "func SetVersion(ver string) {\n\tversion = ver\n}", "title": "" }, { "docid": "83501ee9fcd2b05da35b5715e3f913f4", "score": "0.4446878", "text": "func (c Config) ReleaseOrDefault() string {\n\tif c.Release != \"\" {\n\t\treturn c.Release\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "074ed390df900edfcf6851d0c5ecf82d", "score": "0.44387007", "text": "func SetBlueprintAttribution(s *terraform.InstanceState, r *Resource, p *tfschema.Provider) *terraform.InstanceState {\n\tbp, found := k8s.GetAnnotation(k8s.BlueprintAttributionAnnotation, r)\n\tif !found {\n\t\treturn s\n\t}\n\tret := s\n\tif s == nil {\n\t\tret = &terraform.InstanceState{}\n\t}\n\tmeta := map[string]interface{}{\n\t\t\"module_name\": fmt.Sprintf(\"blueprints/%v\", bp),\n\t}\n\tret.ProviderMeta = MapToCtyValWithSchema(meta, p.ProviderMetaSchema)\n\treturn ret\n}", "title": "" }, { "docid": "ddcc82b81688da871f3a6135f536b28a", "score": "0.4435368", "text": "func (node *Release) Format(buf *TrackedBuffer) {\n\tbuf.astPrintf(node, \"release savepoint %v\", node.Name)\n}", "title": "" }, { "docid": "608384e2e51ecdf5b0770789d882dd38", "score": "0.4428646", "text": "func SetDebug() {\n\tglobalDebug = true\n}", "title": "" }, { "docid": "0253a3f1f1a82b9125f224c68314bf60", "score": "0.4420614", "text": "func (self *Graphics) SetDebugA(member bool) {\n self.Object.Set(\"debug\", member)\n}", "title": "" }, { "docid": "9e6d6c0794c20198caa1b5b7972bb951", "score": "0.44018894", "text": "func (r Release) String() string {\n\ts := fmt.Sprintf(\"%04d.%d.%d\", r.Year, r.Month, r.Iteration)\n\tif r.Extra != \"\" {\n\t\ts += \"-\" + r.Extra\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "c461aac8892336e79f776842fce8e0bf", "score": "0.43990386", "text": "func (o Chapter) SetAPIVersion(s string) error {\n\terr := o.hugo.addContent(o.part.name, o.name, markdown.Code(\"apiVersion: \"+s))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error adding GV for chapter %s/%s: %s\", o.part.name, o.name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7cc06b8e95e55983e91daba7f68e2f2", "score": "0.43824026", "text": "func (o *VulnerabilitiesRequest) HasReleasever() bool {\n\tif o != nil && o.Releasever != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "47f9b5540c4617fedb3f7817bdc953e4", "score": "0.4375534", "text": "func (scl *SimpleConfigurationLayer) SetReleaseLenient(releaseLenient *bool) {\n\tscl.ReleaseLenient = releaseLenient\n}", "title": "" }, { "docid": "bf97858ca2f3b2f9303946400953be20", "score": "0.43722633", "text": "func (repo *RemoteRepo) ReleaseURL() *url.URL {\n\tpath := &url.URL{Path: fmt.Sprintf(\"dists/%s/Release\", repo.Distribution)}\n\treturn repo.archiveRootURL.ResolveReference(path)\n}", "title": "" }, { "docid": "4f5e70664f1c80ab2c4723b60b6185e3", "score": "0.4372162", "text": "func (u *Uname) KernelRelease() string {\n\treturn charsToString(u.ub.Release[:])\n}", "title": "" }, { "docid": "7479ce3fd8b75ee04cf417a5aefdf08a", "score": "0.436996", "text": "func SetAPI(token string, url string, ver string) {\n\tSetToken(token)\n\tif url != \"\" {\n\t\tAPI.URL = url\n\t}\n\tif ver != \"\" {\n\t\tAPI.Ver = ver\n\t}\n}", "title": "" }, { "docid": "488c796ec9d5a21d68e3f6c138fd88c8", "score": "0.43562403", "text": "func (g *Generator) SetPackage(p string) *Generator {\n\tg.opts.Package = p\n\treturn g\n}", "title": "" }, { "docid": "ebebc71b2bf98432122c8f21fbab4e0f", "score": "0.43555206", "text": "func (a *Client) UpdateRelease(params *UpdateReleaseParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateReleaseOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateReleaseParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Update Release\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/{organization}/{project}/_apis/release/releases/{releaseId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateReleaseReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*UpdateReleaseOK), nil\n\n}", "title": "" }, { "docid": "299134b4fb60fa8365d13ff136fdb9f9", "score": "0.4350897", "text": "func SetDebug(val bool) {\n\tif val {\n\t\tatomic.StoreUint32(&debug, 1)\n\t} else {\n\t\tatomic.StoreUint32(&debug, 0)\n\t}\n}", "title": "" }, { "docid": "b044723878dbd5f83c8a344385796f75", "score": "0.43442434", "text": "func (operator *AccessOperator) CreateRelease(cxt context.Context, option *ReleaseOption) (string, error) {\n\tif option == nil {\n\t\treturn \"\", fmt.Errorf(\"Lost create Commit info\")\n\t}\n\n\tgrpcOptions := []grpc.CallOption{\n\t\tgrpc.WaitForReady(true),\n\t}\n\n\t// query business first.\n\tbusiness, app, err := getBusinessAndApp(operator, operator.Business, option.AppName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trequest := &accessserver.CreateReleaseReq{\n\t\tSeq: pkgcommon.Sequence(),\n\t\tBid: business.Bid,\n\t\tName: option.Name,\n\t\tCommitid: option.CommitID,\n\t\tCreator: operator.User,\n\t}\n\n\t// check strategy for this release.\n\tif len(option.StrategyName) != 0 {\n\t\tstrategy, styerr := operator.innerGetStrategyByID(cxt, business.Bid, app.Appid, option.StrategyName)\n\t\tif styerr != nil {\n\t\t\treturn \"\", styerr\n\t\t}\n\n\t\tif strategy == nil {\n\t\t\tlogger.V(3).Infof(\"CreateRelease: No relative Strategy %s with Release.\", option.StrategyName)\n\t\t\treturn \"\", fmt.Errorf(\"No relative Strategy %s\", option.StrategyName)\n\t\t}\n\t\trequest.Strategyid = strategy.Strategyid\n\t}\n\n\tresponse, err := operator.Client.CreateRelease(cxt, request, grpcOptions...)\n\tif err != nil {\n\t\tlogger.V(3).Infof(\n\t\t\t\"CreateRelease: post new Release %s for App[%s]/Cfgset[%s]/Commit %s failed, %s\",\n\t\t\toption.Name, option.AppName, option.CfgSetName, option.CommitID, err.Error(),\n\t\t)\n\t\treturn \"\", err\n\t}\n\tif response.ErrCode != common.ErrCode_E_OK {\n\t\tlogger.V(3).Infof(\n\t\t\t\"CreateStrategy: post new Release %s for App[%s]/Cfgset[%s]/Commit %s successfully, but reponse failed: %s\",\n\t\t\toption.Name, option.AppName, option.CfgSetName, option.CommitID, response.ErrMsg,\n\t\t)\n\t\treturn \"\", fmt.Errorf(\"%s\", response.ErrMsg)\n\t}\n\tif len(response.Releaseid) == 0 {\n\t\tlogger.V(3).Infof(\"CreateStrategy: BSCP system error, No ReleaseID response\")\n\t\treturn \"\", fmt.Errorf(\"Lost ReleaseID from configuraiotn platform\")\n\t}\n\treturn response.Releaseid, nil\n}", "title": "" }, { "docid": "61de3de48f41588a513bbcbc692a4086", "score": "0.43408057", "text": "func (a *Agent) GetRelease(\n\tctx context.Context,\n\tname string,\n\tversion int,\n\tgetDeps bool,\n) (*release.Release, error) {\n\tctx, span := telemetry.NewSpan(ctx, \"helm-get-release\")\n\tdefer span.End()\n\n\ttelemetry.WithAttributes(span,\n\t\ttelemetry.AttributeKV{Key: \"name\", Value: name},\n\t\ttelemetry.AttributeKV{Key: \"version\", Value: version},\n\t\ttelemetry.AttributeKV{Key: \"getDeps\", Value: getDeps},\n\t)\n\n\t// Namespace is already known by the RESTClientGetter.\n\tcmd := action.NewGet(a.ActionConfig)\n\n\tcmd.Version = version\n\n\trelease, err := cmd.Run(name)\n\tif err != nil {\n\t\treturn nil, telemetry.Error(ctx, span, err, \"error running get release\")\n\t}\n\n\tif getDeps && release.Chart != nil && release.Chart.Metadata != nil {\n\t\tfor _, dep := range release.Chart.Metadata.Dependencies {\n\t\t\t// only search for dependency if it passes the condition specified in Chart.yaml\n\t\t\tif dep.Enabled {\n\t\t\t\tdepExists := false\n\n\t\t\t\tfor _, currDep := range release.Chart.Dependencies() {\n\t\t\t\t\t// we just case on name for now -- there might be edge cases we're missing\n\t\t\t\t\t// but this will cover 99% of cases\n\t\t\t\t\tif dep != nil && currDep != nil && dep.Name == currDep.Name() {\n\t\t\t\t\t\tdepExists = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif !depExists {\n\t\t\t\t\tdepChart, err := loader.LoadChartPublic(ctx, dep.Repository, dep.Name, dep.Version)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, telemetry.Error(ctx, span, err, fmt.Sprintf(\"Error retrieving chart dependency %s/%s-%s\", dep.Repository, dep.Name, dep.Version))\n\t\t\t\t\t}\n\n\t\t\t\t\trelease.Chart.AddDependency(depChart)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn release, err\n}", "title": "" }, { "docid": "dcce70d8a4461e5c12f62f5d7a7b8e29", "score": "0.43328425", "text": "func (g *GHR) CreateRelease(ctx context.Context, req *github.RepositoryRelease, recreate bool) (*github.RepositoryRelease, error) {\n\n\t// When draft release creation is requested,\n\t// create it without any check (it can).\n\tif *req.Draft {\n\t\tfmt.Fprintln(g.outStream, \"==> Create a draft release\")\n\t\treturn g.GitHub.CreateRelease(ctx, req)\n\t}\n\n\t// Always create release as draft first. After uploading assets, turn off\n\t// draft unless the `-draft` flag is explicitly specified.\n\t// It is to prevent users from seeing empty release.\n\treq.Draft = github.Bool(true)\n\n\t// Check release exists.\n\t// If release is not found, then create a new release.\n\trelease, err := g.GitHub.GetRelease(ctx, *req.TagName)\n\tif err != nil {\n\t\tif !errors.Is(err, ErrReleaseNotFound) {\n\t\t\treturn nil, fmt.Errorf(\"failed to get release: %w\", err)\n\t\t}\n\t\tDebugf(\"Release (with tag %s) not found: create a new one\",\n\t\t\t*req.TagName)\n\n\t\tif recreate {\n\t\t\tfmt.Fprintf(g.outStream,\n\t\t\t\t\"WARNING: '-recreate' is specified but release (%s) not found\",\n\t\t\t\t*req.TagName)\n\t\t}\n\n\t\tfmt.Fprintln(g.outStream, \"==> Create a new release\")\n\t\treturn g.GitHub.CreateRelease(ctx, req)\n\t}\n\n\t// recreate is not true. Then use that existing release.\n\tif !recreate {\n\t\tDebugf(\"Release (with tag %s) exists: use existing one\",\n\t\t\t*req.TagName)\n\n\t\tfmt.Fprintf(g.outStream, \"WARNING: found release (%s). Use existing one.\\n\",\n\t\t\t*req.TagName)\n\t\treturn release, nil\n\t}\n\n\t// When recreate is requested, delete existing release and create a\n\t// new release.\n\tfmt.Fprintln(g.outStream, \"==> Recreate a release\")\n\tif err := g.DeleteRelease(ctx, *release.ID, *req.TagName); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn g.GitHub.CreateRelease(ctx, req)\n}", "title": "" }, { "docid": "7724f026eac905e2f3f8c7893fde3df6", "score": "0.43297708", "text": "func (a *Client) UpdateReleaseResource(params *UpdateReleaseResourceParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateReleaseResourceOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateReleaseResourceParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Update Release Resource\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/{organization}/{project}/_apis/release/releases/{releaseId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateReleaseResourceReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*UpdateReleaseResourceOK), nil\n\n}", "title": "" }, { "docid": "23d718b833024546f3c1185a0cbd9216", "score": "0.4327199", "text": "func (o ApplicationSpecSourceHelmPtrOutput) ReleaseName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ApplicationSpecSourceHelm) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ReleaseName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "61af74e61f546da1845ee86a01337f5d", "score": "0.43246928", "text": "func printReleases(m map[string]string) string {\n\trelease := parseUrlforStu(m[\"release\"])\n\tvar output string\n\tfor _, thing := range release.Items {\n\t\toutput += strFormatOut(thing)\n\t\toutput += \"\\n\"\n\t}\n\treturn output\n}", "title": "" }, { "docid": "ae8690190b01d8df568b154e55d91c39", "score": "0.43169665", "text": "func SetBuildInformation(version, revision, branch string) {\n\tedition := \"oss\"\n\tif setting.IsEnterprise {\n\t\tedition = \"enterprise\"\n\t}\n\n\tgrafanaBuildVersion.WithLabelValues(version, revision, branch, runtime.Version(), edition).Set(1)\n}", "title": "" } ]
ba884039212d1f53caf3164eaae958c9
startSignalHandler() sets a signal handler to catch SIGUSR2 and toggle throttling.
[ { "docid": "b1a0b2465002ce58fd3777906e3a1a29", "score": "0.78449863", "text": "func (tb *tokenBucket) startSignalHandler() {\n\tsignals := make(chan os.Signal, 1)\n\tsignal.Notify(signals, syscall.SIGUSR2)\n\n\tgo func() {\n\t\t// This runs forever, but blocks until the signal is received.\n\t\tfor {\n\t\t\t<-signals\n\n\t\t\tfunc() {\n\t\t\t\ttb.mu.Lock()\n\t\t\t\tdefer tb.mu.Unlock()\n\n\t\t\t\t// if there's no bandwidth limit configured now, do nothing\n\t\t\t\tif !tb.currLimit.Bandwidth.IsSet() {\n\t\t\t\t\tfs.Debugf(nil, \"SIGUSR2 received but no bandwidth limit configured right now, ignoring\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttb.toggledOff = !tb.toggledOff\n\t\t\t\ttb.curr, tb.prev = tb.prev, tb.curr\n\t\t\t\ts := \"disabled\"\n\t\t\t\tif !tb.curr._isOff() {\n\t\t\t\t\ts = \"enabled\"\n\t\t\t\t}\n\n\t\t\t\tfs.Logf(nil, \"Bandwidth limit %s by user\", s)\n\t\t\t}()\n\t\t}\n\t}()\n}", "title": "" } ]
[ { "docid": "03498d9830ec325b5d70157bf5b653e2", "score": "0.60150665", "text": "func setupSignalHandler() (stopCh <-chan struct{}) {\n\tclose(onlyOneSignalHandler) // panics when called twice\n\n\tstop := make(chan struct{})\n\tc := make(chan os.Signal, 2)\n\tsignal.Notify(c,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGQUIT,\n\t)\n\tgo func() {\n\t\t<-c\n\t\tclose(stop)\n\t\t<-c\n\t\tos.Exit(1) // second signal. Exit directly.\n\t}()\n\n\treturn stop\n}", "title": "" }, { "docid": "3c8db162fd08e963769b1cda6a315eb9", "score": "0.59894776", "text": "func setupSignalHandler() (stopCh <-chan struct{}) {\n\tclose(onlyOneSignalHandler) // panics when called twice\n\n\tstop := make(chan struct{})\n\tc := make(chan os.Signal, 2)\n\tsignal.Notify(c, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-c\n\t\tclose(stop)\n\t\t<-c\n\t\tos.Exit(1) // second signal. Exit directly.\n\t}()\n\n\treturn stop\n}", "title": "" }, { "docid": "7c8f5f6b6decc6e2778d032d2bb0db63", "score": "0.5906395", "text": "func setupSignalHandler() <-chan struct{} {\n\tshutdownHandler := make(chan os.Signal, 2)\n\tstop := make(chan struct{})\n\tsignal.Notify(shutdownHandler, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-shutdownHandler\n\t\tclose(stop)\n\t\t<-shutdownHandler\n\t\tos.Exit(1) // Second signal - exit directly.\n\t}()\n\n\treturn stop\n}", "title": "" }, { "docid": "e20c8fa802385170e2b4c62fc632b50f", "score": "0.56577563", "text": "func SetupSignalHandler() (stopCh <-chan struct{}) {\n\tclose(onlyOneSignalHandler) // panics when called twice\n\n\tstop := make(chan struct{})\n\tc := make(chan os.Signal, 2)\n\tsignal.Notify(c, shutdownSignals...)\n\tgo func() {\n\t\t<-c\n\t\tclose(stop)\n\t\t<-c\n\t\tos.Exit(1) // second signal. Exit directly.\n\t}()\n\n\treturn stop\n}", "title": "" }, { "docid": "91a2cbdb47e175db27986dcf45654c7e", "score": "0.5657147", "text": "func SetupSignalHandler() context.Context {\n\tclose(onlyOneSignalHandler) // panics when called twice\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tc := make(chan os.Signal, 2)\n\tsignal.Notify(c, shutdownSignals...)\n\tgo func() {\n\t\tlogSignal(<-c)\n\t\tcancel()\n\t\tlogSignal(<-c)\n\t\tos.Exit(1) // second signal. Exit directly.\n\t}()\n\n\treturn ctx\n}", "title": "" }, { "docid": "c9b3275c316af5d4ed251635ce0f85f7", "score": "0.5608841", "text": "func setupSigHandler(process *os.Process) {\n\t// terminationSignals are signals that cause the program to exit in the\n\t// supported platforms (linux, darwin, windows).\n\tterminationSignals := []os.Signal{syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT}\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, terminationSignals...)\n\n\t// Block until a signal is received.\n\tlog.Println(\"Now listening for interrupts\")\n\ts := <-c\n\tlog.Printf(\"Got signal: %v. Sending down to process (PID: %v)\", s, process.Pid)\n\tif err := process.Signal(s); err != nil {\n\t\tlog.Fatalf(\"Failed to signal process: %v\", err)\n\t}\n\tlog.Printf(\"Signalled process %v successfully.\", process.Pid)\n}", "title": "" }, { "docid": "a2f6d89593e4555ba99d79bf84cc80de", "score": "0.56039715", "text": "func SetupSignalHandler1() <-chan struct{} {\n\tclose(onlyOneSignalHandler) // panics when called twice\n\n\tshutdownHandler = make(chan os.Signal, 2)\n\n\tstop := make(chan struct{})\n\tsignal.Notify(shutdownHandler, shutdownSignals...)\n\tgo func() {\n\t\t<-shutdownHandler\n\t\tclose(stop)\n\t\t<-shutdownHandler\n\t\tos.Exit(1) // second signal. Exit directly.\n\t}()\n\n\treturn stop\n}", "title": "" }, { "docid": "7cbe5db4df9ac5cba0a4a440bb7c97ba", "score": "0.5594003", "text": "func (s *RaftServer) handleSignal(sig os.Signal) {\n\tswitch sig {\n\tcase syscall.SIGINT:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal SIGINT: %+v\", sig))\n\tcase syscall.SIGTERM:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal SIGTERM: %+v\", sig))\n\tcase syscall.SIGKILL:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal SIGKILL: %+v\", sig))\n\tcase syscall.SIGSTOP:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal SIGSTOP: %+v\", sig))\n\tcase syscall.SIGUSR1:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal START: %+v\", sig))\n\tcase syscall.SIGUSR2:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal STOP: %+v\", sig))\n\t\tpanic(fmt.Sprintf(\"%s stop\", s))\n\tdefault:\n\t\tcountlog.Info(fmt.Sprintf(\"handle signal OTHER: %+v\", sig))\n\t}\n}", "title": "" }, { "docid": "f69663e2be7af976a32368604a7bd8d0", "score": "0.55799925", "text": "func (sh *SignalHandler) setupSignalHandler(sig syscall.Signal) {\n\tsignalChan := make(chan os.Signal, 1)\n\n\tsignal.Notify(signalChan, sig)\n\n\t// Wait signal\n\t<-signalChan\n\n\tsh.log.WithField(\"method\", \"setupSignalHandler\").Debugf(\"Got %v signal\", sig)\n}", "title": "" }, { "docid": "81aa1bdaaf20b461daf052f4f4239dfe", "score": "0.55498976", "text": "func RunSignalHandler(m Mappings) {\n\tgo signalHandler(m)\n}", "title": "" }, { "docid": "c9baf9feeff78560e309dd390148fc37", "score": "0.5544012", "text": "func (n *netmon) setupSignalHandler() {\n\tsignals.SetLogger(n.logger())\n\n\tsigCh := make(chan os.Signal, 8)\n\n\tfor _, sig := range signals.HandledSignals() {\n\t\tsignal.Notify(sigCh, sig)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tsig := <-sigCh\n\n\t\t\tnativeSignal, ok := sig.(syscall.Signal)\n\t\t\tif !ok {\n\t\t\t\terr := errors.New(\"unknown signal\")\n\t\t\t\tnetmonLog.WithError(err).WithField(\"signal\", sig.String()).Error()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif signals.FatalSignal(nativeSignal) {\n\t\t\t\tnetmonLog.WithField(\"signal\", sig).Error(\"received fatal signal\")\n\t\t\t\tsignals.Die(nil)\n\t\t\t} else if n.debug && signals.NonFatalSignal(nativeSignal) {\n\t\t\t\tnetmonLog.WithField(\"signal\", sig).Debug(\"handling signal\")\n\t\t\t\tsignals.Backtrace()\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "0aa55aba4ae6778d8c9e7f2c92aa993b", "score": "0.548297", "text": "func StartProfOnSignal(path string, onProf func(err error), sig ...os.Signal) chan os.Signal {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, sig...)\n\tgo handler(c, path, onProf)\n\n\treturn c\n}", "title": "" }, { "docid": "f2472e4ce32bb37da14fa0c43c2d1b86", "score": "0.54759616", "text": "func signalHandler(stopCh chan interface{}) {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\n\tselect {\n\tcase <-c:\n\t\tlog.Info(\"Caught signal, releasing lock and stopping...\")\n\t\tclose(stopCh)\n\tcase <-stopCh:\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "562ab5404472e414ac9a3a8ba0d1f8ad", "score": "0.54471827", "text": "func signalHandler(cancelFn func(), wg *sync.WaitGroup, logger *zap.Logger) {\n\tdefer cancelFn()\n\tdefer wg.Done()\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGSEGV,\n\t\tsyscall.SIGABRT,\n\t\tsyscall.SIGILL,\n\t\tsyscall.SIGFPE)\n\tsignal := <-c\n\tlogger.Sugar().Warnf(\"Signal %v Received, Shutting Down\", signal) // TODO: prefer structured logging\n}", "title": "" }, { "docid": "19e12d64f9450df8b6c42325f80fa7a3", "score": "0.5430336", "text": "func RegisterSignalHandlers() <-chan struct{} {\n\tnotifyCh := make(chan os.Signal, 2)\n\tstopCh := make(chan struct{})\n\n\tgo func() {\n\t\t<-notifyCh\n\t\tclose(stopCh)\n\t\t<-notifyCh\n\t\tklog.Warning(\"Received second signal, will force exit\")\n\t\tklog.Flush()\n\t\tos.Exit(1)\n\t}()\n\n\tsignal.Notify(notifyCh, capturedSignals...)\n\n\treturn stopCh\n}", "title": "" }, { "docid": "65690f270bc396abe104bab259826d65", "score": "0.5429694", "text": "func (server *Server) watchSignals() {\n\tlog := cfg.Log\n\tfor {\n\t\tsig := <-server.signals\n\t\tswitch sig {\n\t\tcase syscall.SIGUSR1:\n\t\t\tlog.Infof(\"Nothing to see here yet\")\n\t\tdefault:\n\t\t\tlog.Infof(\"Shutting gracefully down\")\n\t\t\tserver.Stop()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7fd18c488e91b0ab7e5b831a0a530017", "score": "0.54292476", "text": "func (r *runner) startSignalHandling() error {\n\t// configure SIGCHLD\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGCHLD)\n\tgo r.handleSIGCHLD(ch)\n\treturn nil\n}", "title": "" }, { "docid": "9499e4ed7324a2ae6a55fb510c4fb9e0", "score": "0.5175033", "text": "func signalHandler(copy *urlCopy) {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGABRT, syscall.SIGSEGV, syscall.SIGILL, syscall.SIGFPE,\n\t\tsyscall.SIGBUS, syscall.SIGTRAP, syscall.SIGSYS, syscall.SIGINT, syscall.SIGTERM)\n\n\tfor signum := range c {\n\t\tlog.Warning(\"Received signal \", signum)\n\t\tswitch signum {\n\t\tcase syscall.SIGINT, syscall.SIGTERM:\n\t\t\tcopy.Cancel()\n\t\tdefault:\n\t\t\tcopy.Panic(\"Transfer process died with: %d\", signum)\n\t\t\tlog.Panic(\"Transfer process died with: \", signum)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31ddee1df6eb1c3db495b0b5fdebb16a", "score": "0.5121281", "text": "func sigHandler() <-chan struct{} {\n\tstop := make(chan struct{})\n\tgo func() {\n\t\tc := make(chan os.Signal, 1)\n\t\tsignal.Notify(c,\n\t\t\tsyscall.SIGINT, // Ctrl+C\n\t\t\tsyscall.SIGTERM, // Termination Request\n\t\t\tsyscall.SIGSEGV, // FullDerp\n\t\t\tsyscall.SIGABRT, // Abnormal termination\n\t\t\tsyscall.SIGILL, // illegal instruction\n\t\t\tsyscall.SIGFPE) // floating point - this is why we can't have nice things\n\t\tsig := <-c\n\t\tglog.Warningf(\"Signal (%v) Detected, Shutting Down\", sig)\n\t\tclose(stop)\n\t}()\n\treturn stop\n}", "title": "" }, { "docid": "ef5ac0b034bd08727060b34c8bcc401e", "score": "0.5088332", "text": "func BeginSignalHandling(logger log.Logger, defaultHandler func(Signal), signalHandlingPairs ...interface{}) error {\n\tif logger == nil {\n\t\tpanic(\"nil logger\")\n\t}\n\n\thandlerMu.Lock()\n\tdefer handlerMu.Unlock()\n\n\tdefer func() {\n\t\t// Undo signal handling setup if a panic occurs.\n\t\tif r := recover(); r != nil {\n\t\t\tsetNoOpHandlers()\n\t\t\thandlersSet = false\n\t\t\tpanic(r)\n\t\t}\n\t}()\n\n\tif handlersSet {\n\t\treturn ErrHandlersAlreadySet\n\t}\n\n\tlogger.Debugf(\"attempting to set up signal handling\")\n\n\thandlersSet = true\n\n\tif defaultHandler == nil {\n\t\tdefaultHandler = func(Signal) {}\n\t}\n\n\tshp := signalHandlingPairs\n\n\tif len(shp)%2 == 1 {\n\t\tpanic(\"odd number of handling pairs given\")\n\t}\n\n\tvar currentSignal Signal\n\tvar isOdd bool\n\tsignalsSet := map[Signal]struct{}{}\n\tfor i := range shp {\n\t\tif isOdd {\n\t\t\t// Function.\n\t\t\tif v, ok := shp[i].(func(Signal)); ok {\n\t\t\t\tlogger.Debugf(\"registering signal for %s\", currentSignal.String())\n\t\t\t\thandlerMap[currentSignal] = v\n\t\t\t} else {\n\t\t\t\tpanic(\"not a func() for odd argument\")\n\t\t\t}\n\t\t} else {\n\t\t\t// Signal.\n\t\t\tif v, ok := shp[i].(Signal); ok {\n\t\t\t\tcurrentSignal = v\n\t\t\t\tsignalsSet[v] = struct{}{}\n\t\t\t} else {\n\t\t\t\tif _, ok := shp[i].(syscall.Signal); ok {\n\t\t\t\t\tpanic(\"gave syscall.Signal for argument but expected Signal from this package\")\n\t\t\t\t}\n\t\t\t\tpanic(\"not a Signal for even argument\")\n\t\t\t}\n\t\t}\n\t\tisOdd = !isOdd\n\t}\n\n\t// Set the default handler for all signals that haven't gotten a signal\n\t// set.\n\tfor k := range sigToOSSig {\n\t\tif _, ok := signalsSet[k]; !ok {\n\t\t\thandlerMap[k] = defaultHandler\n\t\t}\n\t}\n\n\t// WaitGroup to wait for signal handling to actually be ready.\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\n\tgo func() {\n\t\tosSigC := make(chan os.Signal, 10)\n\n\t\tsignal.Notify(osSigC)\n\t\tlogger.Debugf(\"all OS signals now being handled\")\n\t\tdefer signal.Stop(osSigC)\n\t\twg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase sig := <-osSigC:\n\t\t\t\tlogger.Debugf(\"handling OS signal: %s\", sig.String())\n\t\t\t\tvar nonOSSig Signal\n\t\t\t\tvar ok bool\n\t\t\t\tif nonOSSig, ok = osSigToSig[sig]; !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfunc() {\n\t\t\t\t\tdefer func() {\n\t\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\t\tlogger.Errorf(\"panic from calling handler for OS signal %s: %+v\", sig.String(), r)\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\t\t\t\t\thandlerMap[osSigToSig[sig]](nonOSSig)\n\t\t\t\t}()\n\t\t\tcase sig := <-sigC:\n\t\t\t\tlogger.Debugf(\"handling non-OS signal: %s\", sig.String())\n\t\t\t\tfunc() {\n\t\t\t\t\tdefer func() {\n\t\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\t\tlogger.Errorf(\"panic from calling handler for non-OS signal %s: %+v\", sig.String(), r)\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\t\t\t\t\thandlerMap[sig](sig)\n\t\t\t\t}()\n\t\t\tcase <-stopC:\n\t\t\t\tlogger.Debugf(\"stopping signal handling loop\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}()\n\n\twg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "5b0c193863f872bed89afcd25c70124d", "score": "0.5084185", "text": "func newSignalHandler() chan os.Signal {\n\tstop := make(chan os.Signal, 1)\n\tsignal.Notify(stop, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)\n\treturn stop\n}", "title": "" }, { "docid": "0689b2ac9d2bb502adc3c401d6c27d90", "score": "0.5081806", "text": "func (sh *signalHandler) enable() {\n\tsignal.Notify(sh.chSignals, sh.signals...)\n\tvar once sync.Once\n\tgo func() {\n\t\tselect {\n\t\tcase sig := <-sh.chSignals:\n\t\t\tonce.Do(func() {\n\t\t\t\tsh.mtx.Lock()\n\t\t\t\tdefer sh.mtx.Unlock()\n\t\t\t\tsklog.Warningf(\"Caught %s\", sig)\n\t\t\t\tfor _, fn := range sh.callbacks {\n\t\t\t\t\tfunc() {\n\t\t\t\t\t\tdefer func() {\n\t\t\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\t\t\tsklog.Errorf(\"Panic during handler for signal %s: %s\", sig, r)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}()\n\t\t\t\t\t\tfn()\n\t\t\t\t\t}()\n\t\t\t\t}\n\t\t\t\tsklog.Flush()\n\n\t\t\t\t// Exit with the correct code, according to:\n\t\t\t\t// http://tldp.org/LDP/abs/html/exitcodes.html\n\t\t\t\t//\n\t\t\t\t// Note: if not for this line, signalHandler could be\n\t\t\t\t// made public so that it could be used to handle any\n\t\t\t\t// signal, eg. SIGUSR1, for whatever reason. Since we\n\t\t\t\t// generally use HTTP endpoints for communication\n\t\t\t\t// between servers, we don't anticipate needing it, so\n\t\t\t\t// this is left here for simplicity under the assumption\n\t\t\t\t// that we only handle signals which should cause us to\n\t\t\t\t// exit.\n\t\t\t\tos.Exit(128 + int(sig.(syscall.Signal)))\n\t\t\t})\n\t\tcase <-sh.chDisable:\n\t\t\treturn\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "9c844ca7d334aef5881aa40f0d9c0587", "score": "0.50633377", "text": "func setupSignalHandler(shutdownFunc func()) {\n\tcloseSignalChan := make(chan os.Signal, 1)\n\tsignal.Notify(closeSignalChan,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGQUIT)\n\n\tgo func() {\n\t\tsig := <-closeSignalChan\n\t\tlog.Infof(\"got signal %s to exit\", sig.String())\n\t\tshutdownFunc()\n\t}()\n}", "title": "" }, { "docid": "a11152069e5f1b8b0661f4b4f7e2699c", "score": "0.50497407", "text": "func setRateLimitHandler(handler http.Handler) http.Handler {\n\tif globalMaxConn == 0 {\n\t\treturn handler\n\t} // else proceed to rate limiting.\n\n\t// For max connection limit of > '0' we initialize rate limit handler.\n\treturn &rateLimit{\n\t\thandler: handler,\n\t\trqueue: make(chan struct{}, globalMaxConn),\n\t}\n}", "title": "" }, { "docid": "01b38524da39fc438ce11c2fba5351b2", "score": "0.5023604", "text": "func setupSignalContext(baseCtx context.Context) context.Context {\n\tshutdownCtx, cancel := context.WithCancel(baseCtx)\n\tshutdownHandler := server.SetupSignalHandler()\n\tgo func() {\n\t\tdefer cancel()\n\t\t<-shutdownHandler\n\t\tklog.Infof(\"Received SIGTERM or SIGINT signal, shutting down the process.\")\n\t}()\n\treturn shutdownCtx\n}", "title": "" }, { "docid": "dcf2a422234ae39a7b5cc1185733263b", "score": "0.50082487", "text": "func signalHandler() {\n\t// setup signal catching\n\tsignChan := make(chan os.Signal, 1)\n\n\t// catch listed signals SIGINT and SIGTERM\n\tsignal.Notify(signChan, syscall.SIGINT, syscall.SIGTERM)\n\n\t<-signChan\n\tfmt.Println(\"Termination signal received.\")\n}", "title": "" }, { "docid": "c7d9bddf86c7ab45ea8f949ba20b5470", "score": "0.4990778", "text": "func (context *Context) signalHandler(p *proxy.Proxy) {\n\tsignals := make(chan os.Signal, 3)\n\tsignal.Notify(signals, append(shutdownSignals, refreshSignals...)...)\n\tdefer signal.Stop(signals)\n\n\tfor {\n\t\t// Wait for a signal\n\t\tselect {\n\t\tcase sig := <-signals:\n\t\t\tif isShutdownSignal(sig) {\n\t\t\t\tlogger.Printf(\"received %s, shutting down\", sig.String())\n\n\t\t\t\t// Best-effort graceful shutdown of status listener\n\t\t\t\tif context.statusHTTP != nil {\n\t\t\t\t\tgo context.statusHTTP.Shutdown(ctx.Background())\n\t\t\t\t}\n\n\t\t\t\t// Force-exit after timeout\n\t\t\t\ttime.AfterFunc(context.shutdownTimeout, func() {\n\t\t\t\t\t// Graceful shutdown timeout reached. If we can't drain connections\n\t\t\t\t\t// to exit gracefully after this timeout, let's just exit.\n\t\t\t\t\tlogger.Printf(\"graceful shutdown timeout: forcing exit\")\n\t\t\t\t\texitFunc(1)\n\t\t\t\t})\n\n\t\t\t\tp.Shutdown()\n\t\t\t\tlogger.Printf(\"shutdown proxy, waiting for drain\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlogger.Printf(\"received %s, reloading TLS configuration\", sig.String())\n\t\t\tcontext.reload()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "79849b20ded39e009d9babb2d53133a1", "score": "0.4980028", "text": "func startSignal() {\n\tvar (\n\t\tc chan os.Signal\n\t\ts os.Signal\n\t)\n\tc = make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM,\n\t\tsyscall.SIGINT, syscall.SIGSTOP)\n\t// Block until a signal is received.\n\tfor {\n\t\ts = <-c\n\t\tglog.Infof(\"get a signal %s\", s.String())\n\t\tswitch s {\n\t\tcase syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT:\n\t\t\tclose()\n\t\t\tos.Exit(0)\n\t\t\treturn\n\t\tcase syscall.SIGHUP:\n\t\t\t// TODO reload\n\t\t\t//return\n\t\t\tclose()\n\t\t\topenAndRestore()\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e13d5dcd6374c76b7adaf74d4e7ecac6", "score": "0.4973914", "text": "func signalHandler(shutdown func() error) {\n\t// Make signal channel and register notifiers for Interupt and Terminate\n\tsigchan := make(chan os.Signal, 1)\n\tsignal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)\n\n\t// Block until we receive a signal on the channel\n\t<-sigchan\n\n\t// Shutdown now that we've received the signal\n\tif err := shutdown(); err != nil {\n\t\tmsg := fmt.Sprintf(\"shutdown error: %s\", err.Error())\n\t\tlog.Fatal(msg)\n\t}\n\n\t// Make a clean exit\n\tos.Exit(0)\n}", "title": "" }, { "docid": "0c95e5cfb4cba651732d88ffbf18a6b6", "score": "0.4950086", "text": "func handleSignal() {\n\tsigChannel := make(chan os.Signal, 1)\n\tsignal.Notify(sigChannel, os.Interrupt)\n\t<- sigChannel\n\n\tprintSample()\n}", "title": "" }, { "docid": "494931878e266948d10d90fc747e301f", "score": "0.49432355", "text": "func installSignalHandler(ctx context.Context) {\n\tvar st *terminal.State\n\tfd := int(os.Stdin.Fd())\n\tif terminal.IsTerminal(fd) {\n\t\tvar err error\n\t\tif st, err = terminal.GetState(fd); err != nil {\n\t\t\tlogging.Info(ctx, \"Failed to get terminal state: \", err)\n\t\t}\n\t}\n\n\tcommand.InstallSignalHandler(os.Stderr, func(os.Signal) {\n\t\tif st != nil {\n\t\t\tterminal.Restore(fd, st)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b753b02f245024029bb1a41a3b8a014b", "score": "0.4931635", "text": "func handleSignal(servers ...*http.Server) {\n\tsigChan := make(chan os.Signal, 1)\n\t// register signals\n\tsignal.Notify(sigChan, syscall.SIGINT, syscall.SIGHUP, syscall.SIGTERM)\n\t// wait for signal\n\tc := <-sigChan\n\tfmt.Printf(\"received signal: %v, shuting down server...\\r\\n\", c)\n\t// shuting down all servers with each a 3 seconds time bound\n\tfor _, svr := range servers {\n\t\tfmt.Printf(\"server %s will shutdown in less than 3 seconds\\r\\n\", svr.Addr)\n\t\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\t\tdefer cancel()\n\t\tsvr.Shutdown(ctx)\n\t}\n}", "title": "" }, { "docid": "0f8682fbc3fafc375e383970b5d82654", "score": "0.49150756", "text": "func (sh *SignalHandler) SetupSIGTERMHandler(server *rpc.ServerRunner) {\n\tsh.setupSignalHandler(syscall.SIGTERM)\n\t// We received an interrupt signal, shut down.\n\tserver.StopServer()\n}", "title": "" }, { "docid": "e01f2e68d12d045e8ad85cdad677445a", "score": "0.48908195", "text": "func (d *Demon) handleSignals() {\n //connect channel with signal\n ch := make(chan os.Signal, 2)\n signal.Notify(ch, TERMINATE,SHUTDOWN,RELOAD,RESTART)\n\n //listen for signals and handle them\n go func(c chan os.Signal) {\n sig := <-c\n switch sig {\n \tcase TERMINATE:\n \t\tlog.Printf(\"Caught signal %s: Terminating ungracefully but clean\",sig)\n \t\td.Terminate()\n \tcase SHUTDOWN:\n \t\tlog.Printf(\"Caught signal %s: Gracyfully shuting down\",sig)\n \t\td.Shutdown()\n case RESTART:\n log.Printf(\"Caught signal %s: Restarting gracefully\",sig)\n d.Restart() \n \tcase RELOAD:\n \t\tlog.Printf(\"Caught signal %s: Reloading Configuration, gracefully restarting workers\",sig)\n \t\td.Reload()\n }\n }(ch)\n}", "title": "" }, { "docid": "cf73895002b351136336ddca43bb6971", "score": "0.4824327", "text": "func setupSignalHandlers() chan os.Signal {\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, os.Interrupt)\n\tsignal.Notify(sigs, syscall.SIGTERM)\n\treturn sigs\n}", "title": "" }, { "docid": "f4e7e68b459c47620088de7579f28054", "score": "0.4808056", "text": "func HandleSignal(sig os.Signal, handler SignalHandler) {\n\t// Unregister handler if it exists\n\tStopHandleSignal(sig)\n\n\tlog.Printf(\"registering new [%s] handler\", sig)\n\n\t// Create buffered channel of os.Signal values\n\tch := make(chan os.Signal, 1)\n\n\t/////////////////////// protected section ///////////////////\n\t// Take exclusive lock\n\tdispatcher.Lock()\n\n\t// Install our new channel\n\tdispatcher.signals[sig] = ch\n\n\t// Fast unlock\n\tdispatcher.Unlock()\n\t/////////////////////// protected section ///////////////////\n\n\t// Install custom handler in the separate gorutine\n\tgo func(c <-chan os.Signal, sig os.Signal) {\n\t\tfor s := range c {\n\t\t\thandler(s)\n\t\t}\n\t\tlog.Printf(\"exiting [%s] handler\", sig)\n\t}(ch, sig)\n\n\t// Set notification\n\tsignal.Notify(ch, sig)\n}", "title": "" }, { "docid": "878e7713d3fd9ec50fe2d9f702d15ed7", "score": "0.47935182", "text": "func WithSignalHandler(ctx context.Context) (context.Context, context.CancelFunc) {\n\tctx2, cancel := context.WithCancel(context.Background())\n\n\tsignalChan := make(chan os.Signal, 1)\n\tsignal.Notify(signalChan, os.Interrupt)\n\tgo func() {\n\t\tselect {\n\t\tcase <-signalChan: // first signal, cancel context\n\t\t\tcancel()\n\t\tcase <-ctx.Done():\n\t\t}\n\t\t<-signalChan // second signal, hard exit\n\t\tos.Exit(2)\n\t}()\n\treturn ctx2, func() {\n\t\tsignal.Stop(signalChan)\n\t\tcancel()\n\t}\n}", "title": "" }, { "docid": "1a933a464dcba94497995897a57d6ddc", "score": "0.47768855", "text": "func (srv *GracefulServer) handleSignals(killMaster bool, mpid int) error {\n\tsigChan := make(chan os.Signal, 1024)\n\tsigHooks := []os.Signal{syscall.SIGHUP, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGINT, syscall.SIGTERM}\n\tsignal.Notify(sigChan, sigHooks...)\n\n\tfor {\n\t\tselect {\n\t\t\tcase sig := <-sigChan:\n\t\t\tlog.Printf(\"[INFO] Server (%d) received signal %q.\\n\", mpid, sig)\n\t\t\tswitch sig {\n\t\t\tcase syscall.SIGHUP:\n\t\t\t\terr := srv.forkChild(killMaster, mpid)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"[ERR] Unable to fork a child: %v.\\n\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn srv.shutDown()\n\t\t\tcase syscall.SIGUSR1, syscall.SIGUSR2:\n\t\t\t\terr := srv.forkChild(killMaster, mpid)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"[ERR] Unable to fork a child: %v.\\n\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase syscall.SIGINT, syscall.SIGTERM:\n\t\t\t\treturn srv.shutDown()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "77d9ff7c5f4acb92aeed19fdee13c889", "score": "0.47675616", "text": "func newHandler(sigs ...os.Signal) *signalHandler {\n\treturn &signalHandler{\n\t\tcallbacks: []func(){},\n\t\tchDisable: make(chan bool, 1),\n\t\tchSignals: make(chan os.Signal, 1),\n\t\tsignals: sigs,\n\t}\n}", "title": "" }, { "docid": "be89ff3b48dcf418249be43a3ce35105", "score": "0.47669548", "text": "func SignalHandlerUnblock(instance IsObject, handler_id uint64) {\n\tC.g_signal_handler_unblock(C.gpointer(unsafe.Pointer(instance.GetObjectPointer())), C.gulong(handler_id))\n\treturn\n}", "title": "" }, { "docid": "983b1028fd7a293eb9af3e4a5e65e8d0", "score": "0.47656637", "text": "func SignalHandlerBlock(instance IsObject, handler_id uint64) {\n\tC.g_signal_handler_block(C.gpointer(unsafe.Pointer(instance.GetObjectPointer())), C.gulong(handler_id))\n\treturn\n}", "title": "" }, { "docid": "f53555138f1b7245b34baaf050ce8cd3", "score": "0.47587955", "text": "func TestIngestBase_SignalHandler(t *testing.T) {\n\tingestBase := getIngestBase()\n\tsigTermState := ingestBase.GetSigTermState()\n\tassert.False(t, sigTermState.Received)\n\tassert.False(t, sigTermState.Completed)\n\tassert.Empty(t, sigTermState.ItemsInProcess)\n\tassert.Empty(t, sigTermState.ItemsReleased)\n\tassert.Empty(t, sigTermState.FailedReleases)\n\n\tingestBase.KillChannel <- syscall.SIGTERM\n\ttime.Sleep(500 * time.Millisecond)\n\n\tsigTermState = ingestBase.GetSigTermState()\n\tassert.True(t, sigTermState.Received)\n\tassert.True(t, sigTermState.Completed)\n}", "title": "" }, { "docid": "f13045149d6db16a1cdf210bc867719b", "score": "0.47488272", "text": "func SignalHandlerLoop(log logging.Interface, ss ...SignalReceiver) {\n\tNewHandler(log, ss...).Loop()\n}", "title": "" }, { "docid": "b9cf42b69f4c4c58428370c79f5639a1", "score": "0.47398588", "text": "func setUpSignalHandler(schedule *scheduler.Schedule, config *Config) {\r\n\tsignalHandlerChannel := make(chan os.Signal, 1)\r\n\tsignal.Notify(signalHandlerChannel, syscall.SIGINT, syscall.SIGTERM)\r\n\tgo func() {\r\n\t\tfor {\r\n\t\t\treceivedSignal := <-signalHandlerChannel\r\n\t\t\tfmt.Println(\"Received signal:\", receivedSignal)\r\n\t\t\tfmt.Println(\"Performing cleanup...\")\r\n\t\t\tschedule.StageList.WaitUntilAllListenerPortsUpdated()\r\n\t\t\tfor _, stage := range schedule.StageList.List {\r\n\t\t\t\tfor _, worker := range stage.Workers {\r\n\t\t\t\t\tsshConnection := types.NewSSHConnection(worker.Host, config.SSHUser, config.SSHPort)\r\n\t\t\t\t\tcommand := \"kill \" + strconv.Itoa(worker.PID)\r\n\t\t\t\t\tsshConnection.RunCommand(command, nil, nil)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tos.Exit(0)\r\n\t\t}\r\n\t}()\r\n}", "title": "" }, { "docid": "867aaa213dd8083b1a5a6975496366f9", "score": "0.4723446", "text": "func (handler *SignalHandler) Start() {\n\tgo handler.Listen()\n}", "title": "" }, { "docid": "cbd60987bc6f88b302da97623e9f306c", "score": "0.4717475", "text": "func (s *Latch)Signal(handler func()) {\n\tif s.handler != nil {\n\t\ts.task_c <- false\n\t\t<- s.quit_c\n\t}\n\ts.handler = handler\n\n\tstart_c := make(chan bool)\n\tgo func() {\n\t\tstart_c <- true\n\n\t\tfor {\n\t\t\tt := <- s.task_c\n\t\t\tif t == false {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ts.handler()\n\t\t}\n\n\t\ts.quit_c <- true\n\t}()\n\t<- start_c\n}", "title": "" }, { "docid": "eefb59cdb8a9da52af369a7c1ae2acf8", "score": "0.46997496", "text": "func TestSignalHandler(t *testing.T) {\n\tif os.Getenv(\"BE_CRASHER\") == \"1\" {\n\t\tsock, err := configur.CreateSocket()\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tsigs := configur.SetupSignalHandler(sock)\n\t\tsigs <- syscall.SIGTERM\n\t\ttime.Sleep(time.Second * 3)\n\t\treturn\n\t}\n\tcmd := exec.Command(os.Args[0], \"-test.run=TestSignalHandler\")\n\tcmd.Env = append(os.Environ(), \"BE_CRASHER=1\")\n\terr := cmd.Run()\n\tif e, ok := err.(*exec.ExitError); ok && !e.Success() {\n\t\treturn\n\t}\n\tt.Fatalf(\"process ran with err %v, want exit status 1\", err)\n}", "title": "" }, { "docid": "0128b1bcc0c18bf6476333c9993e8ac9", "score": "0.46826434", "text": "func (jnode *Jnode) handleSigs() {\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)\n\tgo func() {\n\t\t<-sigs\n\t\t_ = jnode.Stop()\n\t}()\n}", "title": "" }, { "docid": "ab468c3a2d9fda76bc3e76f3d8ae0597", "score": "0.46821603", "text": "func (s *Server) RunWithSigHandler(shutdown ...func() error) error {\n\tsigCh := make(chan os.Signal, 1)\n\tsignal.Notify(sigCh, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)\n\t\n\tgo func() {\n\t\t<-sigCh\n\t\ts.Shutdown()\n\t}()\n\t\n\terr := s.Run()\n\tif err != nil {\n\t\tif err != http.ErrServerClosed {\n\t\t\treturn err\n\t\t}\n\t}\n\t\n\tfor _, fn := range shutdown {\n\t\terr := fn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t\n\treturn nil\n}", "title": "" }, { "docid": "f8f71ca1158ea9eb64ff4ed782fed83e", "score": "0.4646", "text": "func (s *Server) killHandler() {\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-ch\n\t\tlog.Warning(\"ferryd shutting down\")\n\t\ts.Close()\n\t\t// Stop any mainLoop defers here\n\t\tos.Exit(1)\n\t}()\n}", "title": "" }, { "docid": "a55f143f419b5990b0ee68163003031c", "score": "0.46348706", "text": "func Throttle(maxEventsPerSec int, maxBurstSize int) gin.HandlerFunc {\n\tlimiter := rate.NewLimiter(rate.Limit(maxEventsPerSec), maxBurstSize)\n\n\treturn func(context *gin.Context) {\n\t\tif limiter.Allow() {\n\t\t\tcontext.Next()\n\t\t\treturn\n\t\t}\n\n\t\tcontext.Error(errors.New(\"Limit exceeded\"))\n\t\tcontext.AbortWithStatus(http.StatusTooManyRequests)\n\t}\n}", "title": "" }, { "docid": "58c903bc8505be85fc989c9c3c6948fd", "score": "0.46279705", "text": "func NewSignalHandler() *SignalHandler {\n\tterminate := make(chan os.Signal)\n\tsignal.Notify(terminate, syscall.SIGINT, syscall.SIGTERM)\n\thandler := &SignalHandler{\n\t\tterminateSignals: terminate,\n\t\tonTerminate: []func(){},\n\t}\n\tgo handler.Run()\n\treturn handler\n}", "title": "" }, { "docid": "061d68043c11e9a2c83d7ea89d4ed546", "score": "0.46272972", "text": "func (s *Server) handleSignals() {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGINT)\n\tgo func() {\n\t\tfor sig := range c {\n\t\t\tswitch sig {\n\t\t\tcase syscall.SIGINT:\n\t\t\t\ts.Stop()\n\t\t\t\tos.Exit(0)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "6c414d5d73505fe6b98a597a0fbbb03b", "score": "0.46266896", "text": "func signalHandler(mappings Mappings) {\n\n\tcases := make([]reflect.SelectCase, len(mappings))\n\tactions := make([]Action, len(mappings))\n\n\tvar idx = 0\n\tfor sig, action := range mappings {\n\t\tsigch := make(chan os.Signal, 1)\n\n\t\tcases[idx].Dir = reflect.SelectRecv\n\t\tcases[idx].Chan = reflect.ValueOf(sigch)\n\n\t\tactions[idx] = action\n\n\t\tsignal.Notify(sigch, sig)\n\t\tidx++\n\t}\n\n\tfor {\n\t\tchosen, _, _ := reflect.Select(cases)\n\t\tf := actions[chosen]\n\t\tf()\n\t}\n}", "title": "" }, { "docid": "4e8c53c55a1c0dd50e30176faac6118e", "score": "0.46174377", "text": "func trap() {\n\tc := make(chan os.Signal, 1)\n\t//signal.Notify(c, os.Interrupt)\n\tsignal.Notify(c, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGTERM, os.Interrupt)\n\tfor s := range c {\n\t\tstats()\n\t\tswitch s {\n\t\tcase syscall.SIGTERM, os.Interrupt:\n\t\t\tfmt.Fprintf(out, \"Received %s Signal. Exiting.\\n\", s)\n\t\t\tos.Exit(0)\n\t\tcase syscall.SIGUSR2:\n\t\t\tclearCounters()\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "18b001468a0c1edba030d8f69fc19e57", "score": "0.46162152", "text": "func watchSignal() {\n\tsigc := make(chan os.Signal, 1)\n\n\tsignal.Notify(\n\t\tsigc,\n\t\tos.Interrupt,\n\t\tos.Kill,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGKILL,\n\t\tsyscall.SIGQUIT,\n\t)\n\n\tgo func() {\n\t\ts := <-sigc\n\t\tfmt.Println(s)\n\t\t// TODO log this\n\t\ttime.Sleep(time.Second)\n\t\tos.Exit(0)\n\t}()\n}", "title": "" }, { "docid": "1ed75b404ec461497bd273def1c39986", "score": "0.46161088", "text": "func handleSignals(ctx context.Context, listeners []context.CancelFunc) {\n\tlogger := utils.ExtractLogger(ctx, \"signal handler\")\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)\n\tgo func() {\n\t\tsig := <-sigs\n\t\tlogger.Warnw(\"received signal\", \"signal\", sig)\n\t\tsignalReceived = true\n\t\tfor _, listener := range listeners {\n\t\t\tlistener()\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "50f92dd618e1cfe86cee995df10c75eb", "score": "0.4615912", "text": "func StopHandleSignal(sig os.Signal) {\n\t// Take exclusive lock\n\tdispatcher.Lock()\n\tdefer dispatcher.Unlock()\n\n\t// Check if we already have registered handler\n\tif ch, ok := dispatcher.signals[sig]; ok {\n\t\t// Signal handler already exists - do clean-up\n\t\tlog.Printf(\"unregistering existing [%s] handler\", sig)\n\n\t\t// Stop receiving signlas\n\t\tsignal.Stop(ch)\n\t\t// Close signal channel so gorutine can safely exit\n\t\tclose(ch)\n\n\t\t// Clear our signal table\n\t\tdelete(dispatcher.signals, sig)\n\t}\n}", "title": "" }, { "docid": "87863c264b5611ddbfb1af5ee1244018", "score": "0.46157694", "text": "func SimpleSignalHandling() {\n\tExitOnStandardSignals()\n\tDumpOnSigQuit()\n\tWaitForExit()\n}", "title": "" }, { "docid": "7e563ec6d609abef5a8b268071e28f90", "score": "0.46101746", "text": "func (limiter *StableRateLimiter) Start() {\n\ttimerId := atomic.AddUint64(&limiter.timerId, 1)\n\tlimiter.quitChannel = make(chan bool)\n\tquitChannel := limiter.quitChannel\n\tgo func(myId uint64) {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-quitChannel:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\ttime.Sleep(limiter.refillPeriod)\n\t\t\t\thasBeenStarted := atomic.LoadUint64(&limiter.timerId) != myId\n\t\t\t\tif hasBeenStarted {\n\t\t\t\t\t// limiter may be restarted while sleeping, a new timer will be created, just quit this one.\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tatomic.StoreInt64(&limiter.currentThreshold, limiter.threshold)\n\t\t\t\tclose(limiter.broadcastChannel)\n\t\t\t\tlimiter.broadcastChannel = make(chan bool)\n\t\t\t}\n\t\t}\n\t}(timerId)\n}", "title": "" }, { "docid": "80fefab342054fad5e2852f8fd22d3ef", "score": "0.46087936", "text": "func NewSignalHandler(timeoutSeconds int) *Handler {\n\tsignals := make(chan os.Signal)\n\tsignal.Notify(signals, os.Interrupt, os.Kill)\n\treturn &Handler{\n\t\ttimeoutSeconds: timeoutSeconds,\n\t\tsignals: signals,\n\t\tsignalReceived: 0,\n\t}\n}", "title": "" }, { "docid": "34f769c8263e1d0b82f24619bfb8537d", "score": "0.4602842", "text": "func createSignalWatcher(ctx context.Context, cancelInterruptChan <-chan struct{}, cancel context.CancelFunc) func() error {\n\treturn func() error {\n\t\tc := make(chan os.Signal, 1)\n\n\t\tsignal.Notify(c, syscall.SIGINT, syscall.SIGTERM)\n\t\tselect {\n\t\tcase sig := <-c:\n\t\t\terr := fmt.Errorf(\"received signal %s\", sig)\n\t\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err)\n\t\t\tsignal.Stop(c)\n\t\t\tcancel()\n\t\t\treturn err\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase <-cancelInterruptChan:\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "04ff04ad94e71a7b55e0f38513f69eec", "score": "0.45558363", "text": "func (rr *realRunner) signal(signal os.Signal) {\n\trr.Lock()\n\tdefer rr.Unlock()\n\tif rr.signals != nil && !rr.signalsClosed {\n\t\trr.signals <- signal\n\t}\n}", "title": "" }, { "docid": "d50df5e372c6c4b90b4abc8ba7b40666", "score": "0.4549251", "text": "func TestRealRunnerSignalForwarding(t *testing.T) {\n\trr := realRunner{}\n\trr.signals = make(chan os.Signal, 1)\n\trr.signal(syscall.SIGINT)\n\tif err := rr.Run(context.Background(), \"sleep\", \"3600\"); err.Error() == \"signal: interrupt\" {\n\t\tt.Logf(\"SIGINT forwarded to Entrypoint\")\n\t} else {\n\t\tt.Fatalf(\"Unexpected error received: %v\", err)\n\t}\n}", "title": "" }, { "docid": "a1ee6e48a1e20bc2d508564a5abab03a", "score": "0.45476452", "text": "func CaptureSignals(server IDocTransServer, registerURL string, wg *sync.WaitGroup) {\n\tsignalCh := make(chan os.Signal, 5)\n\tsignal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)\n\tgo HandleSignals(server, signalCh, registerURL, wg)\n}", "title": "" }, { "docid": "f0b99fd172a6cc81b77cb5117b68d93f", "score": "0.45409536", "text": "func HandleSignals(server IDocTransServer, signalCh chan os.Signal, registerURL string, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tsDTS := server.GetDocTransServer()\n\tfor sigs := range signalCh {\n\t\tswitch sigs {\n\t\tcase syscall.SIGTERM: // CTRL-D\n\t\t\tlog.Debugln(\"Received SIGTERM\")\n\t\t\tif sDTS.InstanceInfo() != nil {\n\t\t\t\tsDTS.UnregisterAtRegistry()\n\t\t\t} else {\n\t\t\t\tsDTS.RegisterAtRegistry(registerURL)\n\t\t\t}\n\t\tcase syscall.SIGINT: // CTRL-C\n\t\t\tlog.Debugln(\"Received SIGINT\")\n\t\t\tif sDTS.InstanceInfo() != nil {\n\t\t\t\tsDTS.UnregisterAtRegistry()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "01837864db2f08c0f95ba9210f9dd156", "score": "0.45387462", "text": "func shutdownOnSignal(srv *http.Server) error {\n\tc := shutdownSignalChan(2)\n\t<-c\n\n\t// If we receive another signal, immediate shutdown\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tgo func() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\tcase sig := <-c:\n\t\t\tlog.Printf(\"received another signal (%v), immediate shutdown\", sig)\n\t\t\tcancel()\n\t\t}\n\t}()\n\n\t// Wait for 10s to drain ongoing requests. Kubernetes gives us 30s to\n\t// shutdown, we have already used 15s waiting for our endpoint removal to\n\t// propagate.\n\tctx, cancel2 := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel2()\n\n\tlog.Printf(\"shutting down\")\n\treturn srv.Shutdown(ctx)\n}", "title": "" }, { "docid": "759ff9e05b3a30ee642daf36fcc974cc", "score": "0.45378315", "text": "func (s *server) rateLimit(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tip, _, err := net.SplitHostPort(r.RemoteAddr)\n\t\tif err != nil {\n\t\t\tresponse.ServerErrorResponse(w, r, s.logger, err)\n\t\t}\n\n\t\ts.limiter.mu.Lock()\n\n\t\tif _, found := s.limiter.clients[ip]; !found {\n\t\t\ts.limiter.clients[ip] = &client{limiter: rate.NewLimiter(2, 4)}\n\t\t}\n\n\t\ts.limiter.clients[ip].lastSeen = time.Now()\n\n\t\tif !s.limiter.clients[ip].limiter.Allow() {\n\t\t\ts.limiter.mu.Unlock()\n\t\t\tresponse.RateLimitExceededResponse(w, r)\n\t\t\treturn\n\t\t}\n\n\t\ts.limiter.mu.Unlock()\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "04f18ea8cf12f4abdc67e2eb9529a29d", "score": "0.4534684", "text": "func (s *GrpcServer) doSignalListen() {\n\tvar (\n\t\tctx = gctx.GetInitCtx()\n\t\tsigChan = make(chan os.Signal, 1)\n\t)\n\tsignal.Notify(\n\t\tsigChan,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGQUIT,\n\t\tsyscall.SIGKILL,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGABRT,\n\t)\n\tfor {\n\t\tsig := <-sigChan\n\t\tswitch sig {\n\t\tcase\n\t\t\tsyscall.SIGINT,\n\t\t\tsyscall.SIGQUIT,\n\t\t\tsyscall.SIGKILL,\n\t\t\tsyscall.SIGTERM,\n\t\t\tsyscall.SIGABRT:\n\t\t\ts.Logger().Infof(ctx, \"signal received: %s, gracefully shutting down\", sig.String())\n\t\t\ts.doServiceDeregister()\n\t\t\ttime.Sleep(time.Second)\n\t\t\ts.Stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c90f9112e4b8655fc978429261fda45", "score": "0.45284274", "text": "func Signal(sig os.Signal, handler SigHandler) Opt {\n\treturn func(opts *options) {\n\t\tif handler != nil {\n\t\t\topts.sigtraps = append(opts.sigtraps, &SigTrap{sig: sig, handler: handler})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "51787956eb7ae7bcbb1f9ef06b2894f9", "score": "0.45282263", "text": "func handleSigint(srv *fuse.Server, mountpoint string) {\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, os.Interrupt)\n\tsignal.Notify(ch, syscall.SIGTERM)\n\tgo func() {\n\t\t<-ch\n\t\tlog.Info(\"Unmounting\")\n\t\terr := srv.Unmount()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tlog.Debug(\"Trying lazy unmount\")\n\t\t\tcmd := exec.Command(\"fusermount\", \"-u\", \"-z\", mountpoint) //consider falling back to sudo umount mount-point\n\t\t\tcmd.Stdout = os.Stdout\n\t\t\tcmd.Stderr = os.Stderr\n\t\t\tcmd.Run()\n\t\t}\n\t\tos.Exit(1)\n\t}()\n}", "title": "" }, { "docid": "80e88f884bc63fdbd552d9d4b225835a", "score": "0.45242718", "text": "func rt_sigaction(sig uintptr, new, old *sigactiont, size uintptr) int32", "title": "" }, { "docid": "9c3a0e0e74f7fcfa00481359112abeb0", "score": "0.45212433", "text": "func (sc *http2serverConn) runHandler(rw *http2responseWriter, req *Request, handler func(ResponseWriter, *Request)) {\n\tdidPanic := true\n\tdefer func() {\n\t\trw.rws.stream.cancelCtx()\n\t\tif didPanic {\n\t\t\te := recover()\n\t\t\tsc.writeFrameFromHandler(http2FrameWriteRequest{\n\t\t\t\twrite: http2handlerPanicRST{rw.rws.stream.id},\n\t\t\t\tstream: rw.rws.stream,\n\t\t\t})\n\t\t\t// Same as net/http:\n\t\t\tif e != nil && e != ErrAbortHandler {\n\t\t\t\tconst size = 64 << 10\n\t\t\t\tbuf := make([]byte, size)\n\t\t\t\tbuf = buf[:runtime.Stack(buf, false)]\n\t\t\t\tsc.logf(\"http2: panic serving %v: %v\\n%s\", sc.conn.RemoteAddr(), e, buf)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\trw.handlerDone()\n\t}()\n\thandler(rw, req)\n\tdidPanic = false\n}", "title": "" }, { "docid": "c318a7bb8bac92c144370f89cbc438a0", "score": "0.45165324", "text": "func setupTerminateSignal(logger *log.Logger, httpServer *http.Server, port int) {\n\n\tquit := make(chan os.Signal, 1)\n\n\tsignal.Notify(quit, os.Interrupt)\n\n\tgo httpServerShutdown(logger, httpServer, port, quit)\n\n}", "title": "" }, { "docid": "0ce7ec4f19bdf3e90c19e05f3b85f09a", "score": "0.4503984", "text": "func main() {\n\t// First, Create a context to cancel all goroutines.\n\tcancelctx := sigctx.WithCancelSignals(context.Background(), syscall.SIGHUP)\n\t// Second, Wrap the cancel signal context to notify all goroutines.\n\tsignalctx := sigctx.WithSignals(cancelctx, syscall.SIGINT, syscall.SIGTERM)\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < 10; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\t// You do not have to think anything!!\n\t\t\t\t// Let's use the `signalctx` for everything.\n\t\t\t\tcase <-sigctx.Recv(signalctx):\n\t\t\t\t\tsignal, err := sigctx.Signal(signalctx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(signal.String())\n\t\t\t\t\t}\n\t\t\t\tcase <-signalctx.Done():\n\t\t\t\t\tfmt.Println(signalctx.Err())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "365d5a99c4805ff0cac2ef6414f6ba6d", "score": "0.45026073", "text": "func (v *Vl53l0x) SetSignalRateLimit(i2c *i2c.I2C, limitMcps float32) error {\n\tif limitMcps < 0 || limitMcps > 511.99 {\n\t\treturn errors.New(\"out of MCPS range\")\n\t}\n\t// Q9.7 fixed point format (9 integer bits, 7 fractional bits)\n\terr := v.writeRegU16(i2c, FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT,\n\t\tuint16(limitMcps*(1<<7)))\n\treturn err\n}", "title": "" }, { "docid": "f6bea20052a197712397f12b595a950b", "score": "0.4482328", "text": "func (this *udpSrv) startHandlers() {\n go this.handleReads()\n}", "title": "" }, { "docid": "c39ceb708ad819d1d211651fffda4e9e", "score": "0.44811293", "text": "func SetTypeHandler2(conf *config.Config, eventType string, callback func(ctx *core.Context, event map[string]interface{}) error) {\n\tSetTypeHandler(conf, eventType, &defaultHandler{callback: callback})\n}", "title": "" }, { "docid": "0e19d94102a214c06349b9d8c78feb98", "score": "0.44766855", "text": "func (w *waitObject) sigHandleThread(slWaitSignals ...os.Signal) {\n\tsignal.Notify(w.SigEventChannel, slWaitSignals...)\n\tsig := <-w.SigEventChannel\n\tw.SigResult = sig\n\tatomic.StoreUint64(&getInstance().counter, 0)\n}", "title": "" }, { "docid": "364662ad4c620c6e2ed94f68600989d9", "score": "0.4468076", "text": "func signalProxy() (sigproxyc chan os.Signal) {\n\tsigproxyc = make(chan os.Signal, 1)\n\tgo func() {\n\t\tsigc := make(chan os.Signal, 1)\n\t\tsignal.Notify(sigc, os.Interrupt)\n\t\tunixsignals.ListenUnixCloseSignals(sigc)\n\n\t\tsig := <-sigc\n\t\tlogger.Info().\n\t\t\tStr(\"signal\", sig.String()).\n\t\t\tMsg(\"stop signal received, if an update is ongoing the program will close once finished, resend the signal to force stop\")\n\t\tsigproxyc <- sig\n\n\t\tsig = <-sigc\n\t\tlogger.Info().\n\t\t\tStr(\"signal\", sig.String()).\n\t\t\tMsg(\"second close signal received, forcing stop...\")\n\t\tos.Exit(55)\n\t}()\n\treturn sigproxyc\n}", "title": "" }, { "docid": "26e8fa68a91bfa24945f9241e34d9791", "score": "0.44665197", "text": "func HandleSignals(server *pb.DocTransServer, signalCh chan os.Signal) {\n\tfor sigs := range signalCh {\n\t\tswitch sigs {\n\t\tcase syscall.SIGTERM: // CTRL-D\n\t\t\tlog.Debugln(\"Received SIGTERM\")\n\t\t\tif server.InstanceInfo() != nil {\n\t\t\t\tserver.UnregisterAtRegistry()\n\t\t\t} else {\n\t\t\t\tserver.RegisterAtRegistry(server.HostName, server.AppName, aux.GetIPAdress(), server.PortToListen, \"Service\", server.TTL, server.IsSSL)\n\t\t\t}\n\t\tcase syscall.SIGINT: // CTRL-C\n\t\t\tlog.Debugln(\"Received SIGINT\")\n\t\t\tif server.InstanceInfo() != nil {\n\t\t\t\tserver.UnregisterAtRegistry()\n\t\t\t}\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ee96be91481ef22ee6ab8c452c67edd", "score": "0.44665024", "text": "func (bs *BaseService) HandleSigterm() {\n\tskill := make(chan os.Signal, 1)\n\n\tsignal.Notify(skill, os.Interrupt)\n\tsignal.Notify(skill, syscall.SIGTERM)\n\n\t<-skill\n\n\tclose(bs.Done)\n}", "title": "" }, { "docid": "a5d44294a33e9cdbf49a0ecd3f06f02a", "score": "0.44649747", "text": "func (server *Server) configSignals() {\n\tsignal.Notify(server.signals, syscall.SIGINT, syscall.SIGTERM, syscall.SIGUSR1)\n}", "title": "" }, { "docid": "a025363e4ab7d2ead2878c2560f4cf2b", "score": "0.44237518", "text": "func handleSignals(sigChan <-chan os.Signal, stop chan<- struct{}, wg *sync.WaitGroup) {\n\tsig := <-sigChan\n\tlog.Printf(\"signal caught: %v\", sig)\n\tcleanup(stop, wg)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "0e49417c333b4bcfcc3819a3ea3bb2fd", "score": "0.44230124", "text": "func signalHandler(shutdown func() error) {\n\t// Make signal channel and register notifiers for Interupt and Terminate\n\tsigchan := make(chan os.Signal, 1)\n\tsignal.Notify(sigchan, os.Interrupt)\n\tsignal.Notify(sigchan, syscall.SIGTERM)\n\n\t// Block until we receive a signal on the channel\n\t<-sigchan\n\n\t// Defer the clean exit until the end of the function\n\tdefer os.Exit(0)\n\n\t// Shutdown now that we've received the signal\n\tif err := shutdown(); err != nil {\n\t\tlog.Printf(\"could not gracefully shutdown: %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\t// Declare graceful shutdown.\n\tlog.Println(\"zmqnet has gracefully shutdown\")\n}", "title": "" }, { "docid": "57f49d32628d783d148cbbf55ec8cc89", "score": "0.44190642", "text": "func (sc *http2serverConn) startGracefulShutdown() {\n\tsc.serveG.checkNotOn() // NOT\n\tsc.shutdownOnce.Do(func() { sc.sendServeMsg(http2gracefulShutdownMsg) })\n}", "title": "" }, { "docid": "23af3569aead252b48eb06c65f2078b7", "score": "0.44128338", "text": "func RateLimiter(cnf Config, handler http.HandlerFunc) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tuser, ok := req.Context().Value(\"user\").(User)\n\t\tif !ok {\n\t\t\tuser = cnf.DefaultUser\n\t\t}\n\n\t\tlimiter := LimiterForUser(user, cnf)\n\t\trelease, err := limiter.Acquire(semaphore.WithTimeout(cnf.SLA))\n\t\tif err != nil {\n\t\t\thttp.Error(rw, \"operation timeout\", http.StatusGatewayTimeout)\n\t\t\treturn\n\t\t}\n\n\t\tgo func() { handler.ServeHTTP(rw, req) }()\n\n\t\trl, ok := cnf.RateLimit[user]\n\t\tif !ok {\n\t\t\trl = cnf.DefaultRateLimit\n\t\t}\n\t\ttime.Sleep(rl)\n\t\trelease()\n\t}\n}", "title": "" }, { "docid": "22457de541136bc6ce34b2fd0e5a34bb", "score": "0.4409287", "text": "func (tb *tokenBucket) StartTokenBucket(ctx context.Context) {\n\ttb.mu.Lock()\n\tdefer tb.mu.Unlock()\n\tci := fs.GetConfig(ctx)\n\ttb.currLimit = ci.BwLimit.LimitAt(time.Now())\n\tif tb.currLimit.Bandwidth.IsSet() {\n\t\ttb.curr = newTokenBucket(tb.currLimit.Bandwidth)\n\t\tfs.Infof(nil, \"Starting bandwidth limiter at %v Byte/s\", &tb.currLimit.Bandwidth)\n\t}\n\n\t// Start the SIGUSR2 signal handler to toggle bandwidth.\n\t// This function does nothing in windows systems.\n\ttb.startSignalHandler()\n}", "title": "" }, { "docid": "6d3a32ce56e75c24772e99c22d5a3e16", "score": "0.44011894", "text": "func NewSignalHandler(logger mlog.Logger) *SignalHandler {\n\treturn &SignalHandler{\n\t\tSignals: []os.Signal{syscall.SIGINT, syscall.SIGTERM},\n\t\tMaxShutdownDuration: 5 * time.Second,\n\t\tExitFunc: os.Exit,\n\t\tLogger: logger.New(\"sig-handler\"),\n\t}\n}", "title": "" }, { "docid": "bc00f3310c8bcb233b0dace84b7292e6", "score": "0.43901604", "text": "func (nh *nsqHandler) SetThrottle(throttle bool) {\n\tnh.mu.Lock()\n\tnh.throttle = throttle\n\tnh.mu.Unlock()\n}", "title": "" }, { "docid": "3b11fe395ca0fad4eb7ce905bdda7ebe", "score": "0.43772316", "text": "func sendUsr1(pid int) {\n\tp, err := os.FindProcess(pid)\n\tif err != nil {\n\t\ttlog.Warn.Printf(\"sendUsr1: FindProcess: %v\\n\", err)\n\t\treturn\n\t}\n\terr = p.Signal(syscall.SIGUSR1)\n\tif err != nil {\n\t\ttlog.Warn.Printf(\"sendUsr1: Signal: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "6f256c3c22316ab04941c63fe70f508d", "score": "0.4365568", "text": "func HandleSignals() {\n\tAddSignal(stdSignals...)\n}", "title": "" }, { "docid": "99a58289560244c96c993f4aadd0848c", "score": "0.4363675", "text": "func (limiter *StableRateLimiter) Start() {\n\tlimiter.quitChannel = make(chan bool)\n\tquitChannel := limiter.quitChannel\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-quitChannel:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tatomic.StoreInt64(&limiter.currentThreshold, limiter.threshold)\n\t\t\t\ttime.Sleep(limiter.refillPeriod)\n\t\t\t\tclose(limiter.broadcastChannel)\n\t\t\t\tlimiter.broadcastChannel = make(chan bool)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "009613621c9ed4f84bc3377987ac3133", "score": "0.436358", "text": "func (c *APIClient) StartRatelimit(ctx context.Context) {\n\tc.log.Debug(\"start ratelimiter..\")\n\n\tgo func() {\n\t\tfor i := 0; i < 10; i++ {\n\t\t\tc.rateLimitChannel <- time.Now()\n\t\t}\n\n\t\tticker := time.NewTicker(c.rateLimit)\n\t\tdefer ticker.Stop()\n\n\t\tfor t := range ticker.C {\n\t\t\tselect {\n\t\t\tcase c.rateLimitChannel <- t:\n\t\t\t\tc.log.Trace(\"add ratelimit +1 free request..\")\n\t\t\tcase <-ctx.Done():\n\t\t\t\tc.log.Debug(\"stopped ratelimiter..\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "5dfa274e8fb34a25a54a312d056d5e43", "score": "0.4358482", "text": "func HandleSignal(cancelFunc context.CancelFunc) {\n\tsigc := make(chan os.Signal, 1)\n\tsignal.Notify(sigc,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGQUIT)\n\t<-sigc\n\tcancelFunc()\n}", "title": "" }, { "docid": "63475a6077319994c80e83bf561cdb3e", "score": "0.43489787", "text": "func ResetInterruptSignalHandler() {\n\t_, err := C.resetInterruptSignalHandler()\n\tif err != nil {\n\t\tlog.Warnf(\"Failed to reset interrupt signal handler: %v.\", err)\n\t}\n}", "title": "" }, { "docid": "f487927b48f4881dd52f1615e52bafa8", "score": "0.43483248", "text": "func StopSignalHandling() {\n\thandlerMu.Lock()\n\tdefer handlerMu.Unlock()\n\n\tstopC <- struct{}{}\n\n\tsetNoOpHandlers()\n\thandlersSet = false\n\n\tsigs := make([]os.Signal, len(sigToOSSig))\n\tvar index int\n\tfor sig := range sigToOSSig {\n\t\tsigs[index] = sigToOSSig[sig]\n\t\tindex++\n\t}\n\tsignal.Reset(sigs...)\n}", "title": "" }, { "docid": "a326fc3e303ffe3ef8d37d7d1eb52c23", "score": "0.43363506", "text": "func (limiter *RampUpRateLimiter) Start() {\n\ttimerId := atomic.AddUint64(&limiter.timerId, 1)\n\tlimiter.quitChannel = make(chan bool)\n\tquitChannel := limiter.quitChannel\n\n\tatomic.StoreInt64(&limiter.nextThreshold, limiter.getNextThreshold())\n\tatomic.StoreInt64(&limiter.currentThreshold, limiter.nextThreshold)\n\t// bucket updater\n\tgo func(myId uint64) {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-quitChannel:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\ttime.Sleep(limiter.refillPeriod)\n\t\t\t\thasBeenStarted := atomic.LoadUint64(&limiter.timerId) != myId\n\t\t\t\tif hasBeenStarted {\n\t\t\t\t\t// limiter may be restarted while sleeping, a new timer will be created, just quit this one.\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tatomic.StoreInt64(&limiter.currentThreshold, limiter.nextThreshold)\n\t\t\t\tclose(limiter.broadcastChannel)\n\t\t\t\tlimiter.broadcastChannel = make(chan bool)\n\t\t\t}\n\t\t}\n\t}(timerId)\n\n\t// threshold updater\n\tgo func(myId uint64) {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-quitChannel:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\ttime.Sleep(limiter.rampUpPeroid)\n\t\t\t\thasBeenStarted := atomic.LoadUint64(&limiter.timerId) != myId\n\t\t\t\tif hasBeenStarted {\n\t\t\t\t\t// limiter may be restarted while sleeping, a new timer will be created, just quit this one.\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tatomic.StoreInt64(&limiter.nextThreshold, limiter.getNextThreshold())\n\t\t\t}\n\t\t}\n\t}(timerId)\n}", "title": "" }, { "docid": "d73af127f845027d233d5053a9c7c8e0", "score": "0.43362695", "text": "func WatchTerminationSignals(ctx context.Context, cancel context.CancelFunc, stopper Stopper, log logrus.FieldLogger) {\n\tsignalC := make(chan os.Signal, 1)\n\tsignals := []os.Signal{\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGQUIT,\n\t}\n\tsignal.Notify(signalC, signals...)\n\tlog.Debugf(\"Installed signal handler: %v.\", signals)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tlocalCtx, localCancel := context.WithTimeout(ctx, 5*time.Second)\n\t\t\tstopper.Stop(localCtx)\n\t\t\tlocalCancel()\n\t\t\tcancel()\n\t\t}()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tsignal.Reset(signals...)\n\t\t\t\treturn\n\t\t\tcase sig := <-signalC:\n\t\t\t\tsignal.Reset(signals...)\n\t\t\t\tfmt.Printf(\"Received %q signal, shutting down...\\n\", sig)\n\t\t\t\tlog.Infof(\"Received %q signal.\", sig)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "841ab3f5d9196929a3a5683ff07601c4", "score": "0.43354145", "text": "func StartHandlers() {\n\trestAPIAddr := \"127.0.0.1:9999\"\n\n\t// To Do - handlers should pull bind information from a configuration file\n\tsimplehttp.StartHandler(\"192.168.0.4:8080\", restAPIAddr)\n\tlogger.Success(\"Started simpleHTTP handler on 192.168.0.4:8080\")\n\n\thttps.StartHandler(\"192.168.0.4:443\", restAPIAddr, \"\", \"\")\n\tlogger.Success(\"Started HTTPS handler on 192.168.0.4:443\")\n\n\ttrickbot.StartHandler(\"192.168.0.4:447\", restAPIAddr)\n\tlogger.Success(\"Started TrickBot handler on 192.168.0.4:447\")\n\n\temotet.StartHandler(\"192.168.0.4:80\", \"127.0.0.1:9999\")\n\tlogger.Success(\"Started Emotet handler on 192.168.0.4:80\")\n\n\texaramel.StartHandler(\"192.168.0.4:8443\", \"127.0.0.1:9999\", \"\", \"\")\n\tlogger.Success(\"Started Exaramel handler on 192.168.0.4:8443\")\n\t// To do - each handler should send a signal to indicate it started successfully\n}", "title": "" } ]
abe6df34caed7755ac4651efd0ea5931
Poll fetches the latest state of the LRO. It returns an HTTP response or error. If the LRO has completed successfully, the poller's state is updated and the HTTP response is returned. If the LRO has completed with failure or was cancelled, the poller's state is updated and the error is returned. If the LRO has not reached a terminal state, the poller's state is updated and the latest HTTP response is returned. If Poll fails, the poller's state is unmodified and the error is returned. Calling Poll on an LRO that has reached a terminal state will return the final HTTP response or error.
[ { "docid": "d61d809ae062dd791da5beaaaa38850a", "score": "0.60047394", "text": "func (p *SubnetsClientPrepareNetworkPoliciesPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" } ]
[ { "docid": "2f4c50a808f55ecf617124926bbc67dc", "score": "0.70149034", "text": "func (p *httpPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx, p.pipeline)\n}", "title": "" }, { "docid": "92a9d3c1fb5242734077eb30e9bd0cf5", "score": "0.68287003", "text": "func (op *RunPipelineOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*lifesciencespb.RunPipelineResponse, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp lifesciencespb.RunPipelineResponse\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "1dd539bb334fc749e22b26cb3442118b", "score": "0.6724608", "text": "func (p *WatchersClientGetNextHopPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "9d3fdb268443a41051d9159953ce90db", "score": "0.66212076", "text": "func (p *vaultPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx, p.pipeline)\n}", "title": "" }, { "docid": "eb48f0309201db8a6a47d775979fe41e", "score": "0.651394", "text": "func (p *ManagedDatabasesClientCompleteRestorePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "1cc26920cf3810ecf609b9aeceef4dba", "score": "0.65042573", "text": "func (p *ServiceClientRestorePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "31fe5818ce18aed360cf18b755454251", "score": "0.65039974", "text": "func (p *WatchersClientGetFlowLogStatusPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "12602e21903bbb5b83b423659124633b", "score": "0.6427938", "text": "func (op *RestoreAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.Poll(ctx, nil, opts...)\n}", "title": "" }, { "docid": "525e0c1ff01b0712f1888f2aefddc381", "score": "0.63467926", "text": "func (op *UpdateRestoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*gkebackuppb.Restore, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp gkebackuppb.Restore\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "d92aeb617095d949650831710c19a5c0", "score": "0.63039356", "text": "func (op *CreateRestoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*gkebackuppb.Restore, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp gkebackuppb.Restore\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "2fdba68bec9faa55b736f5dba11ddacf", "score": "0.62981486", "text": "func (p *APIManagementServiceRestorePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0652a19670c4eaf1003d706efa19d957", "score": "0.62900275", "text": "func (p *ReplicationLinksClientFailoverPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0279b39160b9cc7708dcf4133708ec7f", "score": "0.6250539", "text": "func (p *VirtualMachineScaleSetRollingUpgradesCancelPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "22c8e60b3fe05c952b72ba3ea06e0a9c", "score": "0.6241495", "text": "func (p *LabsClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "1bb619eb4c98505286305200ab74ec1c", "score": "0.6232915", "text": "func (p *P2SVPNGatewaysClientGetP2SVPNConnectionHealthPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "4cfac356618cb21defd6194f6615b247", "score": "0.6183881", "text": "func (p *ClientPerformConnectivityCheckAsyncPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "5e62368459b0fc08d1bea981d903e714", "score": "0.61707425", "text": "func (p *EncryptionProtectorsClientRevalidatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "76cf2405d7065febcda0c197af4a6ca8", "score": "0.61687464", "text": "func (p *VirtualNetworkGatewaysClientGetLearnedRoutesPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "98c9b7e1ed8ba27a5f32ad238086d79f", "score": "0.614868", "text": "func (p *VirtualMachinesReapplyPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "efb76030d02200166a3b47e4a9b04013", "score": "0.6144971", "text": "func (p *SubnetsClientUnprepareNetworkPoliciesPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "63b5ae95557296a877c840cbac75fbd2", "score": "0.6132402", "text": "func (op *CreateRestorePlanOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*gkebackuppb.RestorePlan, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp gkebackuppb.RestorePlan\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "76eaf2b0a3c6b6701648bd50770ddb73", "score": "0.6130364", "text": "func (p *ReplicationLinksClientFailoverAllowDataLossPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0c9c5e2d1260124b6b8a098f976dc7e5", "score": "0.6127155", "text": "func (p *WorkspacesClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "3ca06b474ccf7e6c97d8b9969ff82785", "score": "0.61114895", "text": "func (p *P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "cd7711d0bf13b205be8583a24cb0e032", "score": "0.6108648", "text": "func (p *LabPlansClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "c5960b9a2bb45c8d1eb14acab2303503", "score": "0.6086561", "text": "func (p *privateEndpointConnectionPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx, p.pipeline)\n}", "title": "" }, { "docid": "a44b619807bc1dcab70970f40ca95f91", "score": "0.60860723", "text": "func (p *WatchersClientGetTroubleshootingResultPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "638f49d5759315988f115c12b99bc535", "score": "0.60842615", "text": "func (op *UpdateRestorePlanOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*gkebackuppb.RestorePlan, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp gkebackuppb.RestorePlan\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "ca09744be23aea9479d6423f6c9d01cb", "score": "0.604249", "text": "func (p *FailoverGroupsClientFailoverPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "f590b0887e40d8c201ca122736d20dd2", "score": "0.6022646", "text": "func (p *LocalNetworkGatewaysClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "6c66860b7edaa2b7fd2d4529cf1e5ac9", "score": "0.6021188", "text": "func (p *PortalRevisionClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0a1a246465b08cb4e36e004bb16f67fb", "score": "0.6010692", "text": "func (p *VirtualNetworkGatewaysClientGetVpnclientConnectionHealthPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "92efd9c31bbc9ff046f6787b1ba92a1d", "score": "0.60077", "text": "func (p *FunctionsTestPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "809c0e97e38b76f5c7f363f163864946", "score": "0.6001763", "text": "func (c *client) Poll() error {\n\treturn c.client.Poll()\n}", "title": "" }, { "docid": "f29c534ce0eadab2994855466b94e104", "score": "0.59947556", "text": "func (p *IotDpsResourceClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "762a204b82dabc61a780247d9f009744", "score": "0.59821874", "text": "func (p *WatchersClientGetTroubleshootingPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "29b01bf5884954a3554c33ffc400ebda", "score": "0.5979232", "text": "func (p *InterfacesClientGetEffectiveRouteTablePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "d80426f9f529b6d718717e618a8ee6b8", "score": "0.5975755", "text": "func (p *VPNLinkConnectionsClientResetConnectionPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "dd3f51264884922edcc4fd28c33cb50e", "score": "0.59702325", "text": "func (p *ReplicationLinksClientUnlinkPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "85997517be8ccbfafec03a6492b77647", "score": "0.59696144", "text": "func (p *LabsClientPublishPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "383d97f94881c5e11ee7f800aa88df97", "score": "0.596155", "text": "func (p *LongTermRetentionBackupsClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "b279c33c087d6f7034e69e2bfd4c28a1", "score": "0.5959482", "text": "func (p *NamedValueClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "b12acde10af7bc9c15c6f37d34459695", "score": "0.59540784", "text": "func (p *VirtualNetworkRulesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "8b40ea0211bb44a06cb3495665c130a9", "score": "0.59407157", "text": "func (p *RestorePointsCreatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "5b9b44fe7aa02580ea8c206cf18e6cbc", "score": "0.5936345", "text": "func (p *RouteFilterRulesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "d9d642a86fb35a9eb2bd196a8065008d", "score": "0.5935631", "text": "func (p *SubscriptionsTestOutputPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "5cfbe9acc82f84a663928ab246264215", "score": "0.59355915", "text": "func (p *ConnectionMonitorsClientQueryPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "21e581955fabe84eea2c376fdf7372f1", "score": "0.5935415", "text": "func (p *WorkspacesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0a54165976f2d9be9bd2cbe324aa98df", "score": "0.5931752", "text": "func (p *WatchersClientGetAzureReachabilityReportPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "2bb26777f83271afcceed934a4b3155a", "score": "0.59312713", "text": "func (p *SubscriptionsTestQueryPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "1de5a64ade4d5273b3b3063fb17cd8c2", "score": "0.59274846", "text": "func (p *VirtualMachinesClientReimagePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "5cc18cd677729f467369eb4abc51aba4", "score": "0.5924108", "text": "func (p *FirewallPoliciesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0e847d4b125e8acf8411ff61328f3f89", "score": "0.59232956", "text": "func (p *PortalRevisionUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "a1a116beb2741d39550c478dfde4ee95", "score": "0.5922408", "text": "func (p *LongTermRetentionPoliciesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "f2fbcb6852406fd8690ef5a1fed6667a", "score": "0.5912935", "text": "func (p *LabsClientSyncGroupPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0b6263e793026b7d4603ad618edb7e6e", "score": "0.59112805", "text": "func (p *LabsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "299a599b10bb4ec792ac7c78a9de3523", "score": "0.59111744", "text": "func (p *SubscriptionsTestInputPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "baec6bd3aad55bd289a0f1ad9d62d143", "score": "0.59052086", "text": "func (p *IotConnectorsClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "79428bd64974168249f13e41c9042741", "score": "0.5901334", "text": "func (p *OutboundFirewallRulesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "fe40c04a9f96e2e7a253d07701bb1ac7", "score": "0.58988357", "text": "func (p *CloudServicesPowerOffPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "e469b0beb49da3a98969add2bc5bccd4", "score": "0.58937347", "text": "func (p *InboundSecurityRuleClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "97a7aef49a8f9537598d2c1f8c36cadc", "score": "0.5893386", "text": "func (p *ExpressRouteGatewaysClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "ac77d8f6f833f8b8f0cf2e416c22f260", "score": "0.5891357", "text": "func (p *ServiceClientApplyNetworkConfigurationUpdatesPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "2d22d150546624435c1d7a168ee82f5c", "score": "0.58896995", "text": "func (p *RestorePointsClientCreatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "d461873f61e8eacee445bec65146ce61", "score": "0.5886331", "text": "func (p *RoutesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "f8ad6de3492faad6e6f698732c315e00", "score": "0.58786714", "text": "func (p *JobAgentsClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "3dd111f942cb0c3745a397099ab6996b", "score": "0.58765924", "text": "func (p *InputsTestPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "9ba371895e26c8cb791a8ee96e716a56", "score": "0.58743227", "text": "func (p *ManagedInstancesClientFailoverPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "3557feb4cca5f4085e299e081e45c84a", "score": "0.5872353", "text": "func (p *NamedValueUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "93d76ab437e6311cbe20e23e67053d9e", "score": "0.5866608", "text": "func (p *ServiceClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "c2d46f95d73b8635cda323defdbd3a58", "score": "0.5865943", "text": "func (p *PacketCapturesClientGetStatusPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "64f0308d32b52356a10d0d44b5499760", "score": "0.58633184", "text": "func (p *ElasticPoolsClientFailoverPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "950e487fd9d9060e1d1425f9058e227d", "score": "0.5855035", "text": "func (p *NatRulesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0379c96fc69e6bb3264b420bca2d6c9f", "score": "0.5847939", "text": "func (p *APIManagementClientPerformConnectivityCheckAsyncPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "b85cb279b90ba297ed6180370893c15e", "score": "0.58458555", "text": "func (p *FlowLogsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "1317b58bb57fb2f60d35b2e949283c14", "score": "0.58457863", "text": "func (p *FailoverGroupsClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "8f44b5affdb4bb8fef58f9d230b05ced", "score": "0.5843016", "text": "func (p *VPNGatewaysClientResetPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "47a01f9fa4b6231520aaa7b31e16f734", "score": "0.5839407", "text": "func (p *LabPlansClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "7e50ea959e49800b38de9e3b21617885", "score": "0.583934", "text": "func (p *APICreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "aa41415293b986db983aca492576c178", "score": "0.5836226", "text": "func (p *OutputsTestPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "520be2a4c5697474a8a99adf16d53b35", "score": "0.583609", "text": "func (p *VirtualNetworkGatewaysClientGetBgpPeerStatusPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "c402fc2056644369120d35abdcdf2d3f", "score": "0.58309674", "text": "func (p *VirtualMachinesReimagePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "e4c21a5bc582f662e66536a04a0f1134", "score": "0.58233446", "text": "func (p *FhirServicesClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "0db25d206e87557a67e9933c4b8e8db3", "score": "0.58231694", "text": "func (p *VirtualNetworkGatewaysClientResetPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "387ee33f6c1293bc1c52ad86574316d8", "score": "0.5818437", "text": "func (p *P2SVPNGatewaysClientResetPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "03cd079e2ed100842f917e5e5d30a82d", "score": "0.5812339", "text": "func (p *SnapshotsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "92e45447dceeb85f9825673b1ecb3e74", "score": "0.5809723", "text": "func (p *DatabasesClientFailoverPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "41748481164afa42f916b9ef317ef1a0", "score": "0.5807642", "text": "func (p *CloudServicesReimagePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "b5a0705be47f46748a07b5df882def4a", "score": "0.5804293", "text": "func (s *SnmpRequest) Poll(ctx context.Context) PollResult {\n\tres := s.MakePollResult()\n\tres.Scalar, res.pollErr = s.Get(ctx)\n\tif ErrIsUnreachable(res.pollErr) {\n\t\tres.PollErr = res.pollErr.Error()\n\t\tres.Duration = int64(time.Since(res.PollStart) / time.Millisecond)\n\t\ts.Warningf(\"poll: %v\", res.pollErr)\n\t\tres.IsPartial = len(res.Scalar) > 0\n\t\treturn res\n\t}\n\tres.Indexed, res.pollErr = s.Walk(ctx)\n\tres.Duration = int64(time.Since(res.PollStart) / time.Millisecond)\n\tif res.pollErr != nil {\n\t\ts.Warningf(\"poll: %v\", res.pollErr)\n\t\tres.PollErr = res.pollErr.Error()\n\t\tres.IsPartial = len(res.Scalar)+len(res.Indexed) > 0\n\t}\n\treturn res\n}", "title": "" }, { "docid": "bf1ff4cfd341382d68f573eaf911eb62", "score": "0.580309", "text": "func (p *GalleriesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "4c6e450c66ffdd171309ebfa339c051c", "score": "0.58024", "text": "func (p *ManagedClustersClientRunCommandPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "6d4e16aa731cc481983ecbfea81caed1", "score": "0.5797462", "text": "func (p *PortalRevisionClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "28fd729e80623e27cabe56636dc5d093", "score": "0.57959646", "text": "func (p *ManagedDatabasesClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "2a37c29389ed6c001ca744c262e7a5b2", "score": "0.5795928", "text": "func (p *ManagedInstanceEncryptionProtectorsClientRevalidatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "2dd61bbd75ff85ce3ccb7e876beb519a", "score": "0.5795904", "text": "func (p *DatabasesClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "d0158ba0e79915eb70b396817715b45c", "score": "0.5786486", "text": "func Poll(interval, timeout time.Duration, condition ConditionFunc) error {\n\treturn pollInternal(poller(interval, timeout), condition)\n}", "title": "" }, { "docid": "f7badcfddd6cd1cac8926992c006e36f", "score": "0.57858455", "text": "func (p *WorkspacesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "f7badcfddd6cd1cac8926992c006e36f", "score": "0.57858455", "text": "func (p *WorkspacesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "1580db15e35a1c3c07fed9e8062efa59", "score": "0.57837033", "text": "func (p *AzureFirewallsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "5f47015a0f1d70e95cc85c7703644167", "score": "0.5782012", "text": "func (op *CreateRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp artifactregistrypb.Repository\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "title": "" } ]
afc3bac564408836e344da80351f09ef
UpdateCheckStatus updates the result of the health check for a vantage point
[ { "docid": "43db4961a2538da39a262171db2efba5", "score": "0.72268933", "text": "func (db *DB) UpdateCheckStatus(ip uint32, result string) error {\n\t_, err := db.GetReader().Exec(updateCheckStatus, result, ip)\n\treturn err\n}", "title": "" } ]
[ { "docid": "04be15acd39796d778cf42557237e1be", "score": "0.65143466", "text": "func (h *healthStatusEntry) UpdateHealthCheckStatus(\n\thealthCheckPassed bool,\n\triseCount int,\n\tfallCount int) bool {\n\n\th.mutex.Lock()\n\tdefer h.mutex.Unlock()\n\n\tif healthCheckPassed {\n\t\tif h.healthCount < 0 { // previous health check(s) failed\n\t\t\th.healthCount = 1\n\t\t} else {\n\t\t\th.healthCount++\n\t\t}\n\n\t\tif !h.isHealthy &&\n\t\t\th.healthCount >= riseCount {\n\n\t\t\th.isHealthy = true\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tif h.healthCount > 0 { // previous health check(s) passed\n\t\th.healthCount = -1\n\t} else {\n\t\th.healthCount--\n\t}\n\n\t// NOTE: -entry.healthCount because we use negative value\n\t// to track failed health checks.\n\tif h.isHealthy &&\n\t\t-h.healthCount >= fallCount {\n\n\t\th.isHealthy = false\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5f2d3e55c711a91d77c756e8c6f3c014", "score": "0.6319262", "text": "func (s *CommandService) UpdateStatus(cmd sigstat.Command) {}", "title": "" }, { "docid": "5ed6f03a5e7ac361f9a3fccbffd6f4c6", "score": "0.6252575", "text": "func (l *localState) UpdateCheck(checkID types.CheckID, status, output string) {\n\tl.Lock()\n\tdefer l.Unlock()\n\n\tcheck, ok := l.checks[checkID]\n\tif !ok {\n\t\treturn\n\t}\n\n\t// Update the critical time tracking (this doesn't cause a server updates\n\t// so we can always keep this up to date).\n\tif status == structs.HealthCritical {\n\t\t_, wasCritical := l.checkCriticalTime[checkID]\n\t\tif !wasCritical {\n\t\t\tl.checkCriticalTime[checkID] = time.Now()\n\t\t}\n\t} else {\n\t\tdelete(l.checkCriticalTime, checkID)\n\t}\n\n\t// Do nothing if update is idempotent\n\tif check.Status == status && check.Output == output {\n\t\treturn\n\t}\n\n\t// Defer a sync if the output has changed. This is an optimization around\n\t// frequent updates of output. Instead, we update the output internally,\n\t// and periodically do a write-back to the servers. If there is a status\n\t// change we do the write immediately.\n\tif l.config.CheckUpdateInterval > 0 && check.Status == status {\n\t\tcheck.Output = output\n\t\tif _, ok := l.deferCheck[checkID]; !ok {\n\t\t\tintv := time.Duration(uint64(l.config.CheckUpdateInterval)/2) + lib.RandomStagger(l.config.CheckUpdateInterval)\n\t\t\tdeferSync := time.AfterFunc(intv, func() {\n\t\t\t\tl.Lock()\n\t\t\t\tif _, ok := l.checkStatus[checkID]; ok {\n\t\t\t\t\tl.checkStatus[checkID] = syncStatus{inSync: false}\n\t\t\t\t\tl.changeMade()\n\t\t\t\t}\n\t\t\t\tdelete(l.deferCheck, checkID)\n\t\t\t\tl.Unlock()\n\t\t\t})\n\t\t\tl.deferCheck[checkID] = deferSync\n\t\t}\n\t\treturn\n\t}\n\n\t// Update status and mark out of sync\n\tcheck.Status = status\n\tcheck.Output = output\n\tl.checkStatus[checkID] = syncStatus{inSync: false}\n\tl.changeMade()\n}", "title": "" }, { "docid": "3daca204ead6592f508b8610a90f0ab1", "score": "0.62468594", "text": "func (p *Peer) UpdateStatus(ok bool) {\n\tif ok {\n\t\tp.Attempts = 0\n\t\tp.LastSuccess = time.Now()\n\t} else {\n\t\tp.Attempts++\n\t\tlog.WithFields(log.Fields{\"peer\": p, \"func\": \"UpdateStatus\"}).Infof(\"%d unsuccessful attempts\", p.Attempts)\n\t}\n}", "title": "" }, { "docid": "1cc7dba9483adca9812503101dafa793", "score": "0.6120607", "text": "func (repository *Repository) UpdateCheckStatus(ctx context.Context, receipt UsersReceipt, status RequestStatus) error {\n\tcollection := repository.getCollection()\n\n\tupdate := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\tcheckStatus: status,\n\t\t\t\"check_request_time\": time.Now().UTC(),\n\t\t},\n\t}\n\tfilter := bson.M{\"_id\": bson.M{\"$eq\": receipt.Id}}\n\t_, err := collection.UpdateOne(ctx, filter, update)\n\treturn err\n}", "title": "" }, { "docid": "fbae0e199594ecaa3b39177797bb6fbe", "score": "0.6021521", "text": "func (s *Service) UpdateVipStatus(c context.Context, mid int64, vs int32) (err error) {\n\ts.figureDao.UpdateVipStatus(c, mid, vs)\n\treturn\n}", "title": "" }, { "docid": "614cc479728077cd4bd4e5480b40a7ea", "score": "0.60163444", "text": "func (task *PingerTask) updateStatus(result ping.Result, output *bytes.Buffer) {\n\tif result.Status == task.Status.LatestResult.Status {\n\t\ttask.Status.Consecutive++\n\t} else {\n\t\ttask.Status.Consecutive = 1\n\t}\n\tnow := time.Now().UTC()\n\tswitch result.Status {\n\tcase ping.StatusOK:\n\t\ttask.Status.LatestOK = &now\n\tcase ping.StatusNOK:\n\t\ttask.Status.LatestNOK = &now\n\t}\n\ttask.Status.LatestResult = result\n\ttask.Output = output\n\n\ttask.statusChan <- StatusUpdate{Name: task.Name, Status: task.Status}\n}", "title": "" }, { "docid": "8446a2a17898a8cbf9193245485169af", "score": "0.60080767", "text": "func (h *HealthInfoMap) UpdateStatus(state *health.CheckState, minHealthyThreshold int, msgHealthy string) error {\n\tif state == nil {\n\t\treturn errors.New(\"state in UpdateStatus must not be nil\")\n\t}\n\tif h == nil || len(h.infoMap) == 0 {\n\t\treturn state.Update(health.StatusCritical, \"no brokers defined\", 0)\n\t}\n\n\tnumHealthy := 0\n\tfor _, healthInfo := range h.infoMap {\n\t\tif healthInfo.Reachable && healthInfo.HasTopic {\n\t\t\tnumHealthy++\n\t\t}\n\t}\n\n\tif numHealthy == len(h.infoMap) {\n\t\t// All brokers are healthy\n\t\treturn state.Update(health.StatusOK, msgHealthy, 0)\n\t}\n\n\tif numHealthy >= minHealthyThreshold {\n\t\t// Enough brokers are healthy, but not all of them. We should still return OK though as the services should not fail at this point\n\t\treturn state.Update(health.StatusOK, h.errorMsg(), 0)\n\t}\n\n\t// Not enough brokers are healthy\n\treturn state.Update(health.StatusCritical, h.errorMsg(), 0)\n}", "title": "" }, { "docid": "5ec4b9938cb98f174e377db40adb2cfc", "score": "0.5985824", "text": "func (a *HorizontalController) updateStatus(hpa *autoscalingv2.HorizontalPodAutoscaler) error {\n\t// convert back to autoscalingv1\n\thpaRaw, err := UnsafeConvertToVersionVia(hpa, autoscalingv1.SchemeGroupVersion)\n\tif err != nil {\n\t\ta.eventRecorder.Event(hpa, v1.EventTypeWarning, \"FailedConvertHPA\", err.Error())\n\t\treturn fmt.Errorf(\"failed to convert the given HPA to %s: %v\", autoscalingv2.SchemeGroupVersion.String(), err)\n\t}\n\thpav1 := hpaRaw.(*autoscalingv1.HorizontalPodAutoscaler)\n\n\t_, err = a.hpaNamespacer.HorizontalPodAutoscalers(hpav1.Namespace).UpdateStatus(hpav1)\n\tif err != nil {\n\t\ta.eventRecorder.Event(hpa, v1.EventTypeWarning, \"FailedUpdateStatus\", err.Error())\n\t\treturn fmt.Errorf(\"failed to update status for %s: %v\", hpa.Name, err)\n\t}\n\tglog.V(2).Infof(\"Successfully updated status for %s\", hpa.Name)\n\treturn nil\n}", "title": "" }, { "docid": "94c21225c42666acc4703622625fb312", "score": "0.59801656", "text": "func (c *CheckTTL) SetStatus(status, output string) {\n\tc.Logger.Printf(\"[DEBUG] agent: Check %q status is now %s\", c.CheckID, status)\n\tc.Notify.UpdateCheck(c.CheckID, status, output)\n\n\t// Store the last output so we can retain it if the TTL expires.\n\tc.lastOutputLock.Lock()\n\tc.lastOutput = output\n\tc.lastOutputLock.Unlock()\n\n\tc.timer.Reset(c.TTL)\n}", "title": "" }, { "docid": "da3cb525957a60cd001c1159be5a585c", "score": "0.5976272", "text": "func (m *CloudPcOnPremisesConnection) SetHealthCheckStatus(value *CloudPcOnPremisesConnectionStatus)() {\n err := m.GetBackingStore().Set(\"healthCheckStatus\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f3643f74b89d1e0b4954ce6ca0606e9b", "score": "0.5971642", "text": "func HealthCheck(w http.ResponseWriter, r *http.Request) {\n\tstatus := &status{}\n\tstatus.State = \"Healthy\"\n\t// Status.Version = &fhidConfig.Config.Version\n\tstatus.Version = fhidConfig.Version\n\tmsg := status.getStatus()\n\tfmt.Fprintf(w, msg)\n}", "title": "" }, { "docid": "637333aaf831e08ea04fcd4966559fc2", "score": "0.58868366", "text": "func (httpAPI *API) StatusCheck(params martini.Params, r render.Render, req *http.Request) {\n\thealth, err := process.HealthTest()\n\tif err != nil {\n\t\tr.JSON(500, &APIResponse{Code: ERROR, Message: fmt.Sprintf(\"Application node is unhealthy %+v\", err), Details: health})\n\t\treturn\n\t}\n\tRespond(r, &APIResponse{Code: OK, Message: \"Application node is healthy\", Details: health})\n}", "title": "" }, { "docid": "24cbc41149b70a6e089b4756b51fb11e", "score": "0.58834934", "text": "func (tr ThomsonReuters) CheckStatus(referenceID string) (res common.KYCResult, err error) {\n\terr = errors.New(\"Thomson Reuters doesn't support a verification status check\")\n\treturn\n}", "title": "" }, { "docid": "bd1385340d87794b9d0bbaac5bedcf53", "score": "0.5862838", "text": "func (a *Agent) UpdateStatus(new State) {\n\t//fmt.Println(\"calling update status on:\", a, \"new:\", new)\n\tif a.GetStatus() == SAFE && new == EXPOSED {\n\t\ta.status = EXPOSED\n\t\ta.statusCounter = 0\n\t\treturn\n\t}\n\tif a.GetStatus() == EXPOSED && new == INFECTED {\n\t\ta.status = INFECTED\n\t\ta.statusCounter = 0\n\t\treturn\n\t}\n\tif a.GetStatus() == INFECTED && new == REMOVED {\n\t\ta.status = REMOVED\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "40585e6a7b009e9581da2a9560087eb6", "score": "0.58618295", "text": "func healthCheck(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(Health{\"UP\"})\n}", "title": "" }, { "docid": "cf8361b9d8e6c34ded8747b5befc5af3", "score": "0.58521134", "text": "func (c *controller) healthCheck(r *web.Request) (*web.Response, error) {\n\tctx := r.Context()\n\tlogger := log.C(ctx)\n\tlogger.Debugf(\"Performing health check with %s...\", c.indicator.Name())\n\thealthResult := c.indicator.Health()\n\tvar status int\n\tif healthResult.Status == health.StatusUp {\n\t\tstatus = http.StatusOK\n\t} else {\n\t\tstatus = http.StatusServiceUnavailable\n\t}\n\treturn util.NewJSONResponse(status, healthResult)\n}", "title": "" }, { "docid": "e23199faff94b85a85142803d1cf6fa4", "score": "0.58417684", "text": "func (s *API) Check(ctx context.Context, in *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {\n\treturn &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}, nil\n}", "title": "" }, { "docid": "7974176377c8d5052cf318349c4774c8", "score": "0.5841092", "text": "func (r *HealthChecksService) Update(project string, healthCheck string, healthcheck *HealthCheck) *HealthChecksUpdateCall {\n\tc := &HealthChecksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.project = project\n\tc.healthCheck = healthCheck\n\tc.healthcheck = healthcheck\n\treturn c\n}", "title": "" }, { "docid": "f81fc9c13de859b5ddda73b6acaf0db0", "score": "0.5837063", "text": "func (v Validator) UpdateStatus(newStatus sdk.StakeStatus) Validator {\n\tv.Status = newStatus\n\treturn v\n}", "title": "" }, { "docid": "83c579d76b31f837ae124e03bc5fe41d", "score": "0.5823371", "text": "func (s *Insurance) updateInsuranceStatus(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n\tfmt.Println(\"============= START : Updating Insurance status =============\")\n\tpolicy := fetchInsuranceByPolicyID(APIstub, args[0])\n\tif !policy {\n\t\treturn shim.Error(\"updateInsuranceStatus:: Insurance policy not found.\") // need to check if condition\n\t}\n\tpolicy.Status = args[1]\n\tfmt.Println(\"updateInsuranceStatus:: Policy: \", policy)\n\terr = APIstub.PutState(policy.PolicyId, policy)\n\tif err != nil {\n\t\tfmt.Printf(\"\\nupdateInsuranceStatus:: Error when updating insurance policy: %s\", err)\n\t\treturn shim.Error(\"updateInsuranceStatus:: Error when updating insurance policy.Error: \", err)\n\t}\n\tfmt.Println(\"============= END : Updated Insurance status =============\")\n\treturn shim.Success(result)\n}", "title": "" }, { "docid": "f1fcfe2fa1feb4e793855a8d4696cb0b", "score": "0.58043647", "text": "func Healthcheck(response web.ResponseWriter, request *web.Request) {\n\tresponse.WriteHeader(http.StatusOK)\n\tfmt.Fprint(response, `{\"online\": true}`)\n}", "title": "" }, { "docid": "f1fcfe2fa1feb4e793855a8d4696cb0b", "score": "0.58043647", "text": "func Healthcheck(response web.ResponseWriter, request *web.Request) {\n\tresponse.WriteHeader(http.StatusOK)\n\tfmt.Fprint(response, `{\"online\": true}`)\n}", "title": "" }, { "docid": "2b7c734e3fd16f94be9afbde1054fd78", "score": "0.5803574", "text": "func (c *MockClient) UpdateCheck(check *types.CheckConfig) error {\n\targs := c.Called(check)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "120630a02bd5b2b209245dc22d9dc38b", "score": "0.5780701", "text": "func UpdateStatus(userGUID string, status bool) (int, error) {\n\tconn, connectionError := sql.Open(\"mysql\", DbURLDefault())\n\tdefer conn.Close()\n\n\tif connectionError != nil {\n\t\terrString := fmt.Sprintf(\"Error opening db connection : %s\", connectionError)\n\t\tfmt.Println(errString)\n\t\treturn -1, fmt.Errorf(errString)\n\t}\n\n\tinsertStatement, insertStatementError := conn.Prepare(\"UPDATE Citizens SET IsInside=? WHERE UserGuid=?;\")\n\n\tif insertStatementError != nil {\n\t\terrString := fmt.Sprintf(\"Error creating insert statement : %s \", insertStatementError)\n\t\tfmt.Println(errString)\n\t\treturn -1, fmt.Errorf(errString)\n\t}\n\n\tresult, insertExecError := insertStatement.Exec(status, userGUID)\n\tif insertExecError != nil {\n\t\terrString := fmt.Sprintf(\"Error executing update statement : %s \", insertExecError)\n\t\tfmt.Println(errString)\n\t\treturn -1, fmt.Errorf(errString)\n\t}\n\n\tRowsAffected, idError := result.RowsAffected()\n\tif idError != nil {\n\t\terrString := fmt.Sprintf(\"Error getting inserted id but maybe insert worked : %s \", idError)\n\t\tfmt.Println(errString)\n\t\treturn -1, fmt.Errorf(errString)\n\t}\n\n\treturn int(RowsAffected), nil\n}", "title": "" }, { "docid": "bd3a5255002e9b4e803ca27f0ac9fced", "score": "0.57649606", "text": "func (e *Endpoint) HealthCheck(healthCheckURL string) {\n\tpreviousStatus := e.isActive()\n\tstatusCode := 500\n\tif resp, err := http.Get(e.Address.String() + \"/\" + healthCheckURL); err != nil {\n\t\t// Something is up ... disable this endpoint\n\t\te.Active = false\n\t} else {\n\t\t// Woot! Good to go ...\n\t\tstatusCode = resp.StatusCode\n\t\tif resp.StatusCode >= 500 {\n\t\t\te.Active = false\n\t\t} else {\n\t\t\te.Active = true\n\t\t}\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"previous\": previousStatus,\n\t\t\"current\": e.Active,\n\t}).Debug(e.Registered)\n\tif e.Active != previousStatus {\n\t\tif e.Active {\n\t\t\t// Whew, we came back online\n\t\t\tlog.WithFields(\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"URL\": e.Address.String(),\n\t\t\t\t}).Info(\"Up\")\n\t\t\te.Available = time.Now()\n\t\t} else {\n\t\t\t// BOO HISS!\n\t\t\tlog.WithFields(\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"URL\": e.Address.String(),\n\t\t\t\t\t\"Status\": statusCode,\n\t\t\t\t}).Error(\"Down\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a2f065200f86413ce1b732199e7e9d3b", "score": "0.57554346", "text": "func healthCheck(vaultPool types.VaultPool) {\n\n\tversionLogger.Info(\"Starting health check...\")\n\tvaultPool.HealthCheck()\n\tversionLogger.Info(\"Health check completed\")\n}", "title": "" }, { "docid": "0dc1ab0ee1ab7b9789bbd038ef03b928", "score": "0.57543856", "text": "func (a *API) HealthCheck(c *wrapper.RequestContext, w http.ResponseWriter, r *http.Request) {\n\t// Check for status of DB or cache (Redis) in future\n\tio.WriteString(w, `{\"alive\": true}`)\n}", "title": "" }, { "docid": "c84785b30f6871b9424c10739efd4f4f", "score": "0.5750821", "text": "func (c *PcXchg) updateStatus(stub shim.ChaincodeStubInterface, args []string, status string) pb.Response {\n if len(args) != 1 {\n return shim.Error(\"This function needs the serial number as argument\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var pc PC\n // Decode JSON data\n json.Unmarshal(v, &pc)\n\n // Change the status\n pc.Status = status \n // Encode JSON data\n pcAsBytes, err := json.Marshal(pc)\n\n // Store in the Blockchain\n err = stub.PutState(pc.Snumber, pcAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n return shim.Success(nil)\n}", "title": "" }, { "docid": "b86b18656e688dae0c9a684df042d03e", "score": "0.571791", "text": "func healthCheck(c *gin.Context) {\n\tc.JSON(200, gin.H{\n\t\t\"status\": \"UP\",\n\t})\n}", "title": "" }, { "docid": "66572594e2567249dd40f7b717f24fcc", "score": "0.5715687", "text": "func Healthcheck(c echo.Context) error {\n\tvar APIHandler = &sdk.Restful{\n\t\tContext: c,\n\t}\n\n\treturn APIHandler.Response(&sdk.RestResponseData{\n\t\tCode: sdk.StatusCode.Ok,\n\t\tMessage: \"pong\",\n\t})\n}", "title": "" }, { "docid": "71df9f5a63561c9e8caaed1c31cba2bd", "score": "0.57088226", "text": "func (c *Checker) CheckStatus() error {\n\tif c.Closed() {\n\t\treturn errors.New(\"Checker is closed\")\n\t}\n\tcurrent, err := c.GetStatus()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif current.Status != OnlineStatus && current.Status != StartingStatus {\n\t\tstatus, err := c.GetMaintenance()\n\t\tif err == nil {\n\t\t\tif status.Status == OfflineStatus {\n\t\t\t\tcurrent = status\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Debugf(\"Error retrieving maintenance status %s\", err)\n\t\t}\n\t}\n\tc.Lock()\n\tdefer c.Unlock()\n\tif c.lastStatus != nil {\n\t\tif c.lastStatus.Status != current.Status {\n\t\t\tc.lastStatus = current\n\t\t\tc.Changes <- current\n\t\t\treturn nil\n\t\t}\n\t} else {\n\t\tc.lastStatus = current\n\t\tc.Changes <- current\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b831ed7cfdfb15467310dee1fa0b2777", "score": "0.5692285", "text": "func update_status(value string, statusmetric *prometheus.GaugeVec) *prometheus.GaugeVec {\n\tvalid_statuscodes := []string{\"ONLINE\", \"ONBATT\", \"CAL\", \"TRIM\", \"BOOST\", \"OVERLOAD\", \"LOWBATT\", \"REPLACEBATT\", \"NOBATT\", \"SLAVE\", \"SLAVEDOWN\", \"SHUTTING DOWN\", \"COMMLOST\"}\n\n\tif statusmetric == nil {\n\t\tstatusmetric = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\t\tName: \"apcupsd_ups_status\",\n\t\t\tHelp: \"UPS Status\",\n\t\t},\n\t\t[]string{\"type\"})\n\t\tprometheus.MustRegister(statusmetric)\n\t}\n\tfmt.Print(statusmetric)\n\n\tfor _, code := range valid_statuscodes {\n\t\tif strings.Contains(value, code) {\n\t\t\tstatusmetric.With(prometheus.Labels{\"type\": code}).Set(1)\n\t\t} else {\n\t\t\tstatusmetric.With(prometheus.Labels{\"type\": code}).Set(0)\n\t\t}\n\t}\n\n\treturn statusmetric\n}", "title": "" }, { "docid": "d173fd8a876abeca1cf6b65aa094a2a1", "score": "0.5691606", "text": "func (c *FakeIotCertificates) UpdateStatus(iotCertificate *v1alpha1.IotCertificate) (*v1alpha1.IotCertificate, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(iotcertificatesResource, \"status\", c.ns, iotCertificate), &v1alpha1.IotCertificate{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.IotCertificate), err\n}", "title": "" }, { "docid": "2be365c6fa5dde64edb257f45b090cb3", "score": "0.56871766", "text": "func (c *ArtXchg) updateStatus(stub shim.ChaincodeStubInterface, args []string, status string) pb.Response {\n if len(args) != 1 {\n return shim.Error(\"This function needs the serial number as argument\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var art ART\n // Decode JSON data\n json.Unmarshal(v, &art)\n\n // Change the status\n art.Status = status\n // Encode JSON data\n artAsBytes, err := json.Marshal(art)\n\n // Store in the Blockchain\n err = stub.PutState(art.Snumber, artAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n return shim.Success(nil)\n}", "title": "" }, { "docid": "8bf251817269e12f02e6f0b3fc593bdc", "score": "0.56648475", "text": "func (c *argusWatchers) UpdateStatus(argusWatcher *v1alpha1.ArgusWatcher) (result *v1alpha1.ArgusWatcher, err error) {\n\tresult = &v1alpha1.ArgusWatcher{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"arguswatchers\").\n\t\tName(argusWatcher.Name).\n\t\tSubResource(\"status\").\n\t\tBody(argusWatcher).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "5319832b2f44e93d9577047b34d5a11e", "score": "0.5661985", "text": "func (c *Checker) UpdateCheck(ctx context.Context, req *opsee.CheckResourceRequest) (*opsee.ResourceResponse, error) {\n\tc.invoke(ctx, \"DeleteCheck\", req)\n\treturn c.invoke(ctx, \"CreateCheck\", req)\n}", "title": "" }, { "docid": "3bdf2070d732f111ca3de32777fead40", "score": "0.5651344", "text": "func RunUptimeChecksUpdate(c *CmdConfig) error {\n\tif len(c.Args) == 0 {\n\t\treturn doctl.NewMissingArgsErr(c.NS)\n\t}\n\n\tcheckID := c.Args[0]\n\n\tcheckName, err := c.Doit.GetString(c.NS, doctl.ArgUptimeCheckName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcheckTarget, err := c.Doit.GetString(c.NS, doctl.ArgUptimeCheckTarget)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcheckType, err := c.Doit.GetString(c.NS, doctl.ArgUptimeCheckType)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif checkType != \"ping\" && checkType != \"http\" && checkType != \"https\" {\n\t\treturn fmt.Errorf(\"the uptime check type must be one of ping, http, or https, got %s\", checkType)\n\t}\n\n\tcheckRegions, err := c.Doit.GetStringSlice(c.NS, doctl.ArgUptimeCheckRegions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuptimeCheck, err := c.UptimeChecks().Update(checkID, &godo.UpdateUptimeCheckRequest{\n\t\tName: checkName,\n\t\tType: checkType,\n\t\tTarget: checkTarget,\n\t\tRegions: checkRegions,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := &displayers.UptimeCheck{UptimeChecks: []do.UptimeCheck{*uptimeCheck}}\n\treturn c.Display(item)\n}", "title": "" }, { "docid": "1799d88c73377f30c028762774d3282b", "score": "0.56494415", "text": "func checkStatus(ctx context.Context, env *localenv.LocalEnvironment, ignoreWarnings bool) error {\n\toperator, err := env.SiteOperator()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tcluster, err := operator.GetLocalSite(ctx)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tstatus, err := statusapi.FromCluster(ctx, operator, *cluster, \"\")\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tvar failedProbes []string\n\tvar warningProbes []string\n\tfor _, node := range status.Agent.Nodes {\n\t\tfailedProbes = append(failedProbes, node.FailedProbes...)\n\t\twarningProbes = append(warningProbes, node.WarnProbes...)\n\t}\n\n\tw := new(tabwriter.Writer)\n\tw.Init(os.Stdout, 0, 8, 1, '\\t', 0)\n\n\tif len(failedProbes) > 0 {\n\t\tfmt.Println(\"The upgrade is prohibited because some cluster nodes are currently degraded.\")\n\t\tprintAgentStatus(*status.Agent, w)\n\t\tif err := w.Flush(); err != nil {\n\t\t\tlog.WithError(err).Warn(\"Failed to flush to stdout.\")\n\t\t}\n\t\tfmt.Println(\"Please make sure the cluster is healthy before re-attempting the upgrade.\")\n\t\treturn trace.BadParameter(\"failed to start upgrade operation\")\n\t}\n\n\tif len(warningProbes) > 0 {\n\t\tif ignoreWarnings {\n\t\t\tlog.WithField(\"nodes\", status.Agent).Info(\"Upgrade forced with active warnings.\")\n\t\t\treturn nil\n\t\t}\n\n\t\tfmt.Println(\"Some cluster nodes have active warnings:\")\n\t\tprintAgentStatus(*status.Agent, w)\n\t\tif err := w.Flush(); err != nil {\n\t\t\tlog.WithError(err).Warn(\"Failed to flush to stdout.\")\n\t\t}\n\t\tfmt.Println(\"You can provide the --force flag to suppress this message and launch the upgrade anyways.\")\n\t\treturn trace.BadParameter(\"failed to start upgrade operation\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "11f71534fb7282acb25719267af95c8f", "score": "0.56072116", "text": "func (bc *basicController) CheckStatus() (*worker.Stats, error) {\n\treturn bc.backendWorker.Stats()\n}", "title": "" }, { "docid": "049e5684be6c4762aaef716012e5a100", "score": "0.5607116", "text": "func HealthStatus(config *config.Config, w http.ResponseWriter, r *http.Request) {\n\n\toverallStatus := \"up\"\n\tdatabaseStatus := model.DatabaseStatus{Status: \"up\"}\n\terr := config.DB.Ping()\n\tif err != nil {\n\t\toverallStatus = \"down\"\n\t\tdatabaseStatus = model.DatabaseStatus{Status: \"down\"}\n\t}\n\tURL := config.GetHealthStatusURL()\n\tgithubHealth, err := getHealthStatusOr404(URL)\n\tif err != nil || githubHealth.Status.Indicator != \"none\" {\n\t\toverallStatus = \"down\"\n\t}\n\trespondJSON(w, http.StatusOK, model.AppHealthStatus{Status: overallStatus, Database: databaseStatus, GithubStatus: githubHealth.Status})\n}", "title": "" }, { "docid": "41a753d87a885e3e1d9981c3d37ebc76", "score": "0.560231", "text": "func (c *ZKChecker) statusUpdater() {\n\tstatus_path := ZK_ROOT + \"/\" + c.info.Name + \"/localstatus\"\n\tfor {\n\t\tnodes, _, event, err := c.zc.conn.ChildrenW(status_path)\n\t\tif err == nil && len(nodes) > 0 {\n\t\t\tsort.Strings(nodes)\n\t\t\tif nodes[0] == c.id {\n\t\t\t\tfor {\n\t\t\t\t\texists, _, leaderevent, err := c.zc.conn.ExistsW(status_path)\n\t\t\t\t\tif err == nil && exists {\n\t\t\t\t\t\tc.checkVotes()\n\t\t\t\t\t}\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <- leaderevent:\n\t\t\t\t\tcase <- c.done: return\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tselect {\n\t\tcase <- event:\n\t\tcase <- c.done: return\n\t\t}\n\t}\n}", "title": "" }, { "docid": "08a5e46e53c7c945888b8b84bca20cbf", "score": "0.55970603", "text": "func (b *Builder) StatusCheck(statusCheck func(resp *http.Response) error) *Builder {\n\tb.statusCheck = statusCheck\n\treturn b\n}", "title": "" }, { "docid": "ded9234dfb47b7ef111fa10112110a1c", "score": "0.559626", "text": "func (api *RemoteController) HealthCheck(w http.ResponseWriter, req *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprint(w, \"OK\")\n}", "title": "" }, { "docid": "7127c5fe08f79fc97f338fccd8313dc9", "score": "0.5588268", "text": "func (db moneyTransferDatastore) UpdateStatus(businessID shared.BusinessID, moneyTransferID, status string) error {\n\tif os.Getenv(\"USE_BANKING_SERVICE\") == \"true\" {\n\t\tbts, err := NewBankingTransferService()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn bts.UpdateStatus(businessID, moneyTransferID, status)\n\t}\n\n\t_, err := db.Exec(`\n\t\tUPDATE business_money_transfer\n\t\tSET status = $1 WHERE bank_transfer_id = $2 AND business_id = $3`,\n\t\tstatus,\n\t\tmoneyTransferID,\n\t\tbusinessID,\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "dac39371d8b8e7a0ccc90208f0d2c87d", "score": "0.558136", "text": "func (t *Discord) StatusUpdate(ctx context.Context, online int, customText string) error {\n\tvar err error\n\tif customText != \"\" {\n\t\terr = t.conn.UpdateStatus(0, customText)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\ttmpl := template.New(\"online\")\n\ttmpl.Parse(t.config.BotStatus)\n\n\tbuf := new(bytes.Buffer)\n\ttmpl.Execute(buf, struct {\n\t\tPlayerCount int\n\t}{\n\t\tonline,\n\t})\n\n\terr = t.conn.UpdateStatus(0, buf.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ffbc46374df58c6e95e62f112fd4a284", "score": "0.5563764", "text": "func (h *Health) Check(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {\n\tif isStartReady == true {\n\t\treturn &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}, nil\n\t} else if isStartReady == false {\n\t\treturn &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_NOT_SERVING}, nil\n\t} else {\n\t\treturn &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_UNKNOWN}, nil\n\t}\n}", "title": "" }, { "docid": "0ba308524bc645ffac4b38d2d31a241f", "score": "0.5557463", "text": "func (c *FakeGuarddutyDetectors) UpdateStatus(guarddutyDetector *v1alpha1.GuarddutyDetector) (*v1alpha1.GuarddutyDetector, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(guarddutydetectorsResource, \"status\", c.ns, guarddutyDetector), &v1alpha1.GuarddutyDetector{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.GuarddutyDetector), err\n}", "title": "" }, { "docid": "a3840e847844d805a9f98e0542e31e60", "score": "0.5557363", "text": "func CheckStatus(cfg *config.Config, uid string) bool {\n\t// Build endpoint.\n\turlstr := cfg.APIURL + \"/\" + \"api/client/servers/\" + uid + \"/resources\"\n\n\t// Setup HTTP GET request.\n\tclient := &http.Client{Timeout: time.Second * 5}\n\treq, _ := http.NewRequest(\"GET\", urlstr, nil)\n\n\t// Set authorization header.\n\treq.Header.Set(\"Authorization\", \"Bearer \"+cfg.Token)\n\n\t// Set data to JSON.\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Accept JSON.\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Perform HTTP request and check for errors.\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Close body at the end.\n\tdefer resp.Body.Close()\n\n\t// Read body.\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Create utilization struct.\n\tvar util Utilization\n\n\t// Parse JSON.\n\tjson.Unmarshal([]byte(string(body)), &util)\n\n\t// Check if the server's state isn't on. If not, return false.\n\tif util.Attributes.State != \"running\" {\n\t\treturn false\n\t}\n\n\t// Otherwise, return true meaning the container is online.\n\treturn true\n}", "title": "" }, { "docid": "a3840e847844d805a9f98e0542e31e60", "score": "0.5557363", "text": "func CheckStatus(cfg *config.Config, uid string) bool {\n\t// Build endpoint.\n\turlstr := cfg.APIURL + \"/\" + \"api/client/servers/\" + uid + \"/resources\"\n\n\t// Setup HTTP GET request.\n\tclient := &http.Client{Timeout: time.Second * 5}\n\treq, _ := http.NewRequest(\"GET\", urlstr, nil)\n\n\t// Set authorization header.\n\treq.Header.Set(\"Authorization\", \"Bearer \"+cfg.Token)\n\n\t// Set data to JSON.\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Accept JSON.\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Perform HTTP request and check for errors.\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Close body at the end.\n\tdefer resp.Body.Close()\n\n\t// Read body.\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t\treturn false\n\t}\n\n\t// Create utilization struct.\n\tvar util Utilization\n\n\t// Parse JSON.\n\tjson.Unmarshal([]byte(string(body)), &util)\n\n\t// Check if the server's state isn't on. If not, return false.\n\tif util.Attributes.State != \"running\" {\n\t\treturn false\n\t}\n\n\t// Otherwise, return true meaning the container is online.\n\treturn true\n}", "title": "" }, { "docid": "6dab9983417e9a466b9f440af60e4fc0", "score": "0.55557996", "text": "func (traintuple *Traintuple) checkNewStatus(stub shim.ChaincodeStubInterface, status string) error {\n\t// get worker\n\tworker, err := getDataManagerOwner(stub, traintuple.Dataset.DataManagerKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// check validity of worker and change of status\n\tif err := checkUpdateTuple(stub, worker, traintuple.Status, status); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "789ee58483a8fc3ba173bd8f260dfbe1", "score": "0.55540544", "text": "func (m *CloudPcOnPremisesConnection) SetHealthCheckStatusDetails(value CloudPcOnPremisesConnectionStatusDetailsable)() {\n err := m.GetBackingStore().Set(\"healthCheckStatusDetails\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "161c07dbbbdfd34bc7556eda0248a64e", "score": "0.5552367", "text": "func (provider *DBus) UpdateStatus(w http.ResponseWriter, r *http.Request) {\n\tstatusFileLocation := provider.Conf.EdgeOS.UpdateStatusFile\n\t//check for file existence.\n\tif _, err := os.Stat(statusFileLocation); os.IsNotExist(err) {\n\t\tlog.Errorf(\"file does not exist\")\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\t//load the file contents into a struct, file will always contain a json.\n\t// json defined in /usr/bin/swupdate-status\n\tstatusJSON := UpdateFile{}\n\tfile, err := ioutil.ReadFile(statusFileLocation)\n\tif err != nil {\n\t\tlog.Errorf(\"[A/B Update Status] stack-trace: %s\", err.Error())\n\t\tresponse := basicDBusResponse{Status: \"FAIL\", Error: err.Error()}\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(response)\n\t\treturn\n\t}\n\terr = json.Unmarshal(file, &statusJSON)\n\tif err != nil {\n\t\tlog.Errorf(\"[A/B Update Status] stack-trace: %s\", err.Error())\n\t\tresponse := basicDBusResponse{Status: \"FAIL\", Error: err.Error()}\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(response)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(statusJSON)\n\treturn\n}", "title": "" }, { "docid": "6d64fea13c1027bcd23e86e38595f3ce", "score": "0.5538737", "text": "func HealthCheck(w http.ResponseWriter, r *http.Request) {\n\tRespondWithJSON(\n\t\tw,\n\t\thttp.StatusOK,\n\t\tmap[string]string{\"status\": \"All systems reporting at 100%\"},\n\t)\n}", "title": "" }, { "docid": "a20bf9be368eae3e16b8569beb5d45d0", "score": "0.55351293", "text": "func CommandUpdateCheck(_ []string, _ []string) {\n\tfmt.Printf(\"Checking For Updates... [Current Version: %s]\\n\", currentVersion)\n\n\t// Send Request and Get the Metadata\n\tresponse, err := http.Get(\"https://raw.githubusercontent.com/5elenay/unikorn/main/meta.json\")\n\tUnexceptedError(err)\n\n\tdefer response.Body.Close()\n\n\tvar result UnikornMeta\n\n\t// Convert JSON to UnikornMeta Struct\n\tdecoder := json.NewDecoder(response.Body)\n\terr = decoder.Decode(&result)\n\tUnexceptedError(err)\n\n\t// Check Version\n\tif result.Latest != currentVersion {\n\t\tfmt.Printf(\"Looks like you have an update for Unikorn. Please check: https://github.com/5elenay/unikorn/releases/latest\\nLatest Release: %s\\nCurrent: %s\\n\", result.Latest, currentVersion)\n\t} else {\n\t\tfmt.Println(\"Looks like you are using the latest version of Unikorn!\")\n\t}\n}", "title": "" }, { "docid": "2ff6b7b0e2ad2447b2a766c8311e1997", "score": "0.55311775", "text": "func (c *cloudListeners) UpdateStatus(cloudListener *v1.CloudListener) (result *v1.CloudListener, err error) {\n\tresult = &v1.CloudListener{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"cloudlisteners\").\n\t\tName(cloudListener.Name).\n\t\tSubResource(\"status\").\n\t\tBody(cloudListener).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "e0d5e2d1569c8764e06a133fd1de7fc6", "score": "0.55310875", "text": "func updateStatus(tfjob *tfv1alpha2.TFJob, rstatus map[string]v1.PodPhase) error {\n\tchiefReplicas, psReplicas, workerReplicas := getReplicasForTFJobType(tfjob)\n\n\tif psReplicas == 0 {\n\t\tif (chiefReplicas == 1 && workerReplicas == 0) || (chiefReplicas == 0 && workerReplicas == 1) {\n\t\t\terr := updateStatusSingle(tfjob, tfv1alpha2.TFReplicaTypeWorker, workerReplicas, false)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\terr := updateStatusDistributed(tfjob, rstatus)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdfb050245e666865fe56f31e13a2ec2", "score": "0.55271584", "text": "func (c *ZKChecker) checkVotes() {\n\tstatus_global := ZK_ROOT + \"/\" + c.info.Name + \"/status\"\n\tglobalstatus := make(map[string]ShardStatus)\n\tif globalbytes, _, err := c.zc.conn.Get(status_global); err == nil {\n\t\tjson.Unmarshal(globalbytes, &globalstatus)\n\t}\n\n\tstatus_path := ZK_ROOT + \"/\" + c.info.Name + \"/localstatus\"\n\tchanged := false\n\tif voters, _, err := c.zc.conn.Children(status_path); err == nil {\n\t\tballotbox := make(map[string]int)\n\t\tfor _, voter := range voters {\n\t\t\tif vote, _, err := c.zc.conn.Get(status_path + \"/\" + voter); err == nil {\n\t\t\t\tvar shardstatus map[string]ShardStatus\n\t\t\t\tif err := json.Unmarshal(vote, &shardstatus); err == nil {\n\t\t\t\t\tfor k, v := range shardstatus {\n\t\t\t\t\t\tif v.Alive {\n\t\t\t\t\t\t\tballotbox[k]++\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tballotbox[k]--\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor k, v := range ballotbox {\n\t\t\tif v != 0 {\n\t\t\t\tif status, ok := globalstatus[k]; !ok || status.Alive != (v > 0) {\n\t\t\t\t\tglobalstatus[k] = ShardStatus{\n\t\t\t\t\t\tAddr: k,\n\t\t\t\t\t\tAlive: v > 0,\n\t\t\t\t\t\tSince: time.Now().UnixNano() / 1000,\n\t\t\t\t\t}\n\t\t\t\t\tchanged = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif changed {\n\t\tif statusbytes, err := json.Marshal(globalstatus); err == nil {\n\t\t\tif _, err := c.zc.conn.Set(status_global, statusbytes, -1); err == zk.ErrNoNode {\n\t\t\t\tc.zc.conn.Create(status_global, statusbytes, DEF_FLAGS, DEF_ACL)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f6eee673c25284f50f8a0d9f751d65ab", "score": "0.55253625", "text": "func (c *FakeKNLearnings) UpdateStatus(kNLearning *operatorv1.KNLearning) (*operatorv1.KNLearning, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(knlearningsResource, \"status\", c.ns, kNLearning), &operatorv1.KNLearning{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*operatorv1.KNLearning), err\n}", "title": "" }, { "docid": "229d1ad3948904704c313547a5a743f8", "score": "0.5522739", "text": "func (c *MockHealthServer) Check(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {\n\treturn &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}, nil\n}", "title": "" }, { "docid": "14ebb9b41574d2b1c1261388a6f22ba1", "score": "0.5520041", "text": "func (*H) Check(ctx context.Context, _ *health.Request) (*health.Response, error) {\n\treturn &health.Response{\n\t\tStatus: 1,\n\t}, nil\n}", "title": "" }, { "docid": "351493406ed2bf589343dfade60ee360", "score": "0.55120087", "text": "func (device *Device) UpdateStatus(result *ExecutionResult) {\n\t// TODO: Find why I have to do this\n\tcleanResult := strings.Replace(strings.Trim(result.Out, \"'\"), \"\\\\\", \"\", -1)\n\n\t// If the execution stdout result is empty, don't update the device status\n\tif cleanResult == \"\" {\n\t\treturn\n\t}\n\n\t// For now, we just check if the output could be parsed into a json interface\n\tif err := json.Unmarshal([]byte(cleanResult), &device.Status); err != nil {\n\t\t// If not, we revert to using just the result string as the new device status\n\t\tdevice.Status = cleanResult\n\t}\n}", "title": "" }, { "docid": "68235657fd3c1ae2611c06fe74559c1b", "score": "0.5507318", "text": "func (o GetDataLimitsLimitOutput) CheckStatus() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetDataLimitsLimit) int { return v.CheckStatus }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "7507c32c2f03bdeefcc9a76a962add19", "score": "0.5502068", "text": "func (c *Producer) updateStatus(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n if len(args) != 2 {\n return shim.Error(\"This function needs the serial number and the new status as arguments\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var pc PC\n // Decode JSON data\n json.Unmarshal(v, &pc)\n\n // Change the status\n pc.Status = args[1] \n // Encode JSON data\n pcAsBytes, err := json.Marshal(pc)\n\n // Store in the Blockchain\n err = stub.PutState(pc.Snumber, pcAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n return shim.Success(nil)\n}", "title": "" }, { "docid": "a8466b44c23924c6c1c6ee4bda58bb11", "score": "0.54991347", "text": "func (a *App) UpdateStatus() error {\n\tstatus := NewStatus(a.ctx, a.helmApp, a.katoClient)\n\treturn status.Update()\n}", "title": "" }, { "docid": "ae01bca052989b494b279ca23ba3803e", "score": "0.54964644", "text": "func(repo *CheckRepositoryImpl) UpdateCheck(ctx context.Context,check Check) error{\r\n\tif err := repo.DB.Model(&check).Updates(check).Error; nil != err {\r\n\t\tlog.Println(\"CheckRepository UpdateCheck error \", err)\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "192e5fb955d94de4020d2b375bc4aea7", "score": "0.54949313", "text": "func (s *SimpleHealthServer) Check(ctx context.Context, req *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) {\n\treturn &healthpb.HealthCheckResponse{\n\t\tStatus: s.status,\n\t}, nil\n}", "title": "" }, { "docid": "35cac3af911275170268663ee14f24a3", "score": "0.5491244", "text": "func (c *FakePubkeys) UpdateStatus(pubkey *v1alpha1.Pubkey) (*v1alpha1.Pubkey, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(pubkeysResource, \"status\", c.ns, pubkey), &v1alpha1.Pubkey{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.Pubkey), err\n}", "title": "" }, { "docid": "06fba14db196be237c5790f0512d00bb", "score": "0.5482939", "text": "func (b *SelfhostBase) CheckForUpdate(userID DiscordUser, oldversion int) (int8, *UpdateStatus) {\n\tresp, err := HTTPRequestData(UpdateEndpoint(\"\", userID, oldversion))\n\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\n\tstatus := &UpdateStatus{}\n\terr = json.Unmarshal(resp, status)\n\tif err == nil && status.Version == 0 {\n\t\treturn -1, nil\n\t}\n\tif err != nil || b.Version >= status.Version {\n\t\treturn 0, nil\n\t}\n\treturn 1, status\n}", "title": "" }, { "docid": "2748310af4e974f415c082d3fb7a95fe", "score": "0.5481359", "text": "func (td *TestData) CheckStatus(status int) {\n\n\n td.T.Logf(\"TestData.CheckStatus()\\n\")\n\n if td.Resp == nil {\n td.T.Fatalf(\"Error: Missing HTTP Response\\n\")\n }\n\n if td.Resp.StatusCode != status {\n td.T.Fatalf(\"Error: Invalid Status Code of %d, needed %d\\n\", td.Resp.StatusCode, status)\n }\n\n td.T.Logf(\"...end TestData.CheckStatus\\n\")\n}", "title": "" }, { "docid": "cb02d9cac5922521c3c5950cc33b53ce", "score": "0.5481322", "text": "func (r *ReconcileKnativeEventing) updateStatus(instance *eventingv1alpha1.KnativeEventing) error {\n\n\t// Account for https://github.com/kubernetes-sigs/controller-runtime/issues/406\n\tgvk := instance.GroupVersionKind()\n\tdefer instance.SetGroupVersionKind(gvk)\n\n\tif err := r.client.Status().Update(context.TODO(), instance); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71db5574883fbb43c17d5b88f1493ce1", "score": "0.54719853", "text": "func (e Endpoints) Status(ctx context.Context, name string, version string) (rs model.HealthCheckResponse, err error) {\n\trequest := StatusRequest{\n\t\tName: name,\n\t\tVersion: version,\n\t}\n\tresponse, err := e.StatusEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(StatusResponse).Rs, response.(StatusResponse).Err\n}", "title": "" }, { "docid": "73a5a77da01fb4a56f15b8e3073c865f", "score": "0.5470723", "text": "func (n *NodeAccount) UpdateStatus(status NodeStatus, height int64) {\n\tif n.Status == status {\n\t\treturn\n\t}\n\tn.Status = status\n\tn.StatusSince = height\n}", "title": "" }, { "docid": "42b3b078e38782791dee00c0e9970cfd", "score": "0.5468298", "text": "func (t *Tugboat) UpdateStatus(d *Deployment, update StatusUpdate) error {\n\tswitch update.Status {\n\tcase StatusFailed:\n\t\td.Failed()\n\tcase StatusErrored:\n\t\tvar err error\n\t\tif update.Error != nil {\n\t\t\terr = errors.New(*update.Error)\n\t\t} else {\n\t\t\terr = errors.New(\"no error provided\")\n\t\t}\n\t\td.Errored(err)\n\tcase StatusSucceeded:\n\t\td.Succeeded()\n\tdefault:\n\t\treturn errors.New(\"invalid status\")\n\t}\n\n\treturn t.DeploymentsUpdate(d)\n}", "title": "" }, { "docid": "3da4b4e00054f9c9839ab2e5d7224501", "score": "0.5467698", "text": "func (repo *DBRepo) TestCheck(w http.ResponseWriter, r *http.Request) {\n\thostServiceID, _ := strconv.Atoi(chi.URLParam(r, \"id\"))\n\toldStatus := chi.URLParam(r, \"oldStatus\")\n\tokay := true\n\n\t// get host service\n\ths, err := repo.DB.GetHostServiceByID(hostServiceID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tokay = false\n\t}\n\n\t// get host\n\th, err := repo.DB.GetHostByID(hs.HostID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tokay = false\n\t}\n\t// test the service\n\tnewStatus, msg := repo.testServiceForHost(h, hs)\n\n\t// broadcast service status changed event (take service from old status tab to new server's tab)\n\tif newStatus != hs.Status {\n\t\trepo.pushStatusChangedEvent(h, hs, newStatus)\n\t\tevent := models.Event{\n\t\t\tHostServiceID: hs.ServiceID,\n\t\t\tEventType: newStatus,\n\t\t\tHostID: h.ID,\n\t\t\tServiceName: hs.Service.ServiceName,\n\t\t\tHostName: h.HostName,\n\t\t\tMessage: msg,\n\t\t\tCreatedAt: time.Time{},\n\t\t\tUpdatedAt: time.Time{},\n\t\t}\n\n\t\terr := repo.DB.InsertEvent(event)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\n\t// update the host service in the DB with status (if changed) and last check\n\ths.Status = newStatus\n\ths.LastMessage = msg\n\ths.LastCheck = time.Now()\n\ths.UpdatedAt = time.Now()\n\n\terr = repo.DB.UpdateHostService(hs) // nts - overwriting DB values.\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tokay = false\n\t}\n\n\tvar resp jsonResp\n\t// create json response\n\tif okay {\n\t\tresp = jsonResp{\n\t\t\tOK: true,\n\t\t\tMessage: msg,\n\t\t\tServiceID: hs.ServiceID,\n\t\t\tHostServiceID: hs.ID,\n\t\t\tHostID: hs.HostID,\n\t\t\tOldStatus: oldStatus,\n\t\t\tNewStatus: newStatus,\n\t\t\tLastCheck: time.Now(),\n\t\t}\n\t} else {\n\t\tresp.OK = false\n\t\tresp.Message = \"Something went wrong\"\n\t}\n\n\t// send json to client\n\n\tout, _ := json.MarshalIndent(resp, \"\", \" \") // this sends to host.jet's checkNow(id, oldStatus) function\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(out)\n}", "title": "" }, { "docid": "764a0e820d904fae5f738a72dd074808", "score": "0.5467637", "text": "func (c *UsersApiController) UpdateStatus(w http.ResponseWriter, r *http.Request) {\n\tquery := r.URL.Query()\n\tstatusText := query.Get(\"status_text\")\n\taway, err := parseBoolParameter(query.Get(\"away\"))\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\temojiName := query.Get(\"emoji_name\")\n\temojiCode := query.Get(\"emoji_code\")\n\treactionType := query.Get(\"reaction_type\")\n\tresult, err := c.service.UpdateStatus(r.Context(), statusText, away, emojiName, emojiCode, reactionType)\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\n}", "title": "" }, { "docid": "6e0e764165ce32ee80c29872ea9979a6", "score": "0.5447103", "text": "func HealthCheck(c *gin.Context) {\n\tc.JSON(http.StatusOK, healthCheckResponse{Status: \"UP\", Hostname: utils.GetHostname()})\n}", "title": "" }, { "docid": "34ee0650522f3f59cbac53def733e4d6", "score": "0.5443409", "text": "func (c *Producer) updateStatus(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n if len(args) != 2 {\n return shim.Error(\"This function needs the serial number as argument\")\n }\n\n // Look for the serial number\n v, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(\"Serialnumber \" + args[0] + \" not found \")\n }\n\n // Get Information from Blockchain\n var pc PC\n // Decode JSON data\n json.Unmarshal(v, &pc)\n\n // Change the status\n pc.Status = args[1] \n // Encode JSON data\n pcAsBytes, err := json.Marshal(pc)\n\n // Store in the Blockchain\n err = stub.PutState(pc.Snumber, pcAsBytes)\n if err != nil {\n return shim.Error(err.Error())\n }\n\n return shim.Success(nil)\n}", "title": "" }, { "docid": "f30947bc61b62111ae43085efdb3647f", "score": "0.5440696", "text": "func (a *API) HealthCheck(w http.ResponseWriter, req *http.Request) {\n\n\tw.Write([]byte(\"OK\"))\n}", "title": "" }, { "docid": "adcb0d4fe26f7848d2f355083ff9379d", "score": "0.5431212", "text": "func healthCheck(c *gin.Context) {\n\thealthcheckResponse := map[string]string{}\n\thealthcheckResponse[\"status\"] = \"ok\"\n\tc.JSON(200, healthcheckResponse)\n\treturn\n}", "title": "" }, { "docid": "621c6761ef1a4b354e5d759f5b3b38a3", "score": "0.5427909", "text": "func CheckAndUpdate(config *core.Configuration, updatesEnabled, updateCommand, forceUpdate, verify bool) {\n}", "title": "" }, { "docid": "e08502d52dd82b55fda49bdc629f651c", "score": "0.5427152", "text": "func (h *HealthCheckSource) HealthStatus(_ context.Context) health.HealthStatus {\n\th.heartbeatMutex.RLock()\n\tdefer h.heartbeatMutex.RUnlock()\n\tcurTime := time.Now()\n\n\tif h.lastHeartbeatTime.IsZero() {\n\t\tparams := map[string]interface{}{\n\t\t\t\"sourceStartupTime\": h.sourceStartupTime.String(),\n\t\t\t\"startupTimeout\": h.startupTimeout.String(),\n\t\t}\n\t\tif curTime.Sub(h.sourceStartupTime) < h.startupTimeout {\n\t\t\tmessage := \"Waiting for initial heartbeat\"\n\t\t\treturn health.HealthStatus{\n\t\t\t\tChecks: map[health.CheckType]health.HealthCheckResult{\n\t\t\t\t\th.checkType: {\n\t\t\t\t\t\tType: h.checkType,\n\t\t\t\t\t\tState: health.HealthStateRepairing,\n\t\t\t\t\t\tMessage: &message,\n\t\t\t\t\t\tParams: params,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tmessage := \"No heartbeats since startup\"\n\t\treturn health.HealthStatus{\n\t\t\tChecks: map[health.CheckType]health.HealthCheckResult{\n\t\t\t\th.checkType: {\n\t\t\t\t\tType: h.checkType,\n\t\t\t\t\tState: health.HealthStateError,\n\t\t\t\t\tMessage: &message,\n\t\t\t\t\tParams: params,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\n\tparams := map[string]interface{}{\n\t\t\"lastHeartbeatTime\": h.lastHeartbeatTime.String(),\n\t\t\"heartbeatTimeout\": h.heartbeatTimeout.String(),\n\t}\n\tif curTime.Sub(h.lastHeartbeatTime) < h.heartbeatTimeout {\n\t\treturn health.HealthStatus{\n\t\t\tChecks: map[health.CheckType]health.HealthCheckResult{\n\t\t\t\th.checkType: {\n\t\t\t\t\tType: h.checkType,\n\t\t\t\t\tState: health.HealthStateHealthy,\n\t\t\t\t\tParams: params,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\n\tmessage := \"Last heartbeat was too long ago\"\n\treturn health.HealthStatus{\n\t\tChecks: map[health.CheckType]health.HealthCheckResult{\n\t\t\th.checkType: {\n\t\t\t\tType: h.checkType,\n\t\t\t\tState: health.HealthStateError,\n\t\t\t\tMessage: &message,\n\t\t\t\tParams: params,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6318e02aeac88f2dbd5e9acbeac0f4a9", "score": "0.54262793", "text": "func (r *HealthCheckReconciler) syncStatus(healthCheck *healthcheckv1.HealthCheck, status healthcheckv1.HealthCheckStatus, ctx context.Context) error {\n\tif diff := deep.Equal(healthCheck.Status, status); diff != nil {\n\t\tr.Log.Info(fmt.Sprintf(\"Status change dectected: %s\", diff))\n\t\thealthCheck.Status = status\n\t\terr := r.Status().Update(ctx, healthCheck)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce87532fd8234521811c26f7bfce855d", "score": "0.5420663", "text": "func updateStatus(c client.Client) {\n\tinstance := &mcov1beta2.MultiClusterObservability{}\n\terr := c.Get(context.TODO(), types.NamespacedName{\n\t\tName: config.GetMonitoringCRName(),\n\t}, instance)\n\tif err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"Failed to get existing mco %s\", instance.Name))\n\t\treturn\n\t}\n\toldStatus := instance.Status\n\tnewStatus := oldStatus.DeepCopy()\n\tupdateInstallStatus(&newStatus.Conditions)\n\tupdateReadyStatus(&newStatus.Conditions, c, instance)\n\tupdateAddonSpecStatus(&newStatus.Conditions, instance)\n\tfillupStatus(&newStatus.Conditions)\n\tinstance.Status.Conditions = newStatus.Conditions\n\tif !reflect.DeepEqual(newStatus.Conditions, oldStatus.Conditions) {\n\t\terr := c.Status().Update(context.TODO(), instance)\n\t\tif err != nil {\n\t\t\tlog.Error(err, fmt.Sprintf(\"failed to update status of mco %s\", instance.Name))\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fc7454f201abdf03741e84f62c4d54fd", "score": "0.54204005", "text": "func (c *FakeZFSBackups) UpdateStatus(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (*v1.ZFSBackup, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(zfsbackupsResource, \"status\", c.ns, zFSBackup), &v1.ZFSBackup{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1.ZFSBackup), err\n}", "title": "" }, { "docid": "93e15ad6eb824993b841e3a4bfd6dc42", "score": "0.54079396", "text": "func UpdateStatus(c client.Client, instance *navarchosv1alpha1.NodeReplacement, result *Result) error {\n\tstatus := instance.Status\n\n\tsetPhase(&status, result)\n\n\terr := setNodePods(&status, result)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsetEvictedPods(&status, result)\n\n\terr = setIgnoredPods(&status, result)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsetFailedPods(&status, result)\n\n\terr = setCompletionTimestamp(&status, result)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = setCondition(&status, navarchosv1alpha1.NodeCordonedType, result.NodeCordonError, result.NodeCordonReason)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !reflect.DeepEqual(status, instance.Status) {\n\t\tinstance.Status = status\n\n\t\terr := c.Update(context.TODO(), instance)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error updating status: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "26d6305ce313b295bf15b7f39be7b645", "score": "0.5407004", "text": "func updateInstanceStatus(obj *ibmcloudv1alpha1.EsIndex, state string, msg string, generation int64) {\n\tobj.Status.State = state\n\tobj.Status.Message = msg\n\tobj.Status.Generation = generation\n}", "title": "" }, { "docid": "dd42c8786472808eccfc180b1ad54ddf", "score": "0.5401983", "text": "func (s StatusService) UpdateStatus(ctx context.Context, status cabby.Status) error {\n\treturn s.UpdateStatusFn(ctx, status)\n}", "title": "" }, { "docid": "418849b4f711936f1f53fe100ffb6c64", "score": "0.53990775", "text": "func (m *Master) Check(ctx context.Context, req *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) {\n\tstatus := atomic.LoadInt32(m.healthStatus)\n\n\treturn &healthpb.HealthCheckResponse{\n\t\tStatus: health.Status(status),\n\t}, nil\n}", "title": "" }, { "docid": "1bb00d6e543fb5598d4becedd8d7f6c3", "score": "0.53974867", "text": "func WithCheckStatus(check bool) HTTPOption {\n\treturn withCheckStatus(check)\n}", "title": "" }, { "docid": "c480dff78ab8f77f79692ce69bb7c0d3", "score": "0.53943145", "text": "func (pc *PyTorchController) updatePyTorchJobStatus(job *pyv1.PyTorchJob) error {\n\t_, err := pc.jobClientSet.KubeflowV1().PyTorchJobs(job.Namespace).UpdateStatus(job)\n\treturn err\n}", "title": "" }, { "docid": "20bf45e9067f912f1d5e82dd5fdc9890", "score": "0.53939146", "text": "func TryUpdateStatus(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, transform func() error) error {\n\treturn tryUpdate(ctx, backoff, c, obj, c.Status().Update, transform)\n}", "title": "" }, { "docid": "97b17cfd86364c60c71dd817118c81f1", "score": "0.53910536", "text": "func (sched *ExampleScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) {\n\tlog.Infoln(\"Status update: task\", status.TaskId.GetValue(), \" is in state \", status.State.Enum().String())\n\tif status.GetState() == mesos.TaskState_TASK_FINISHED {\n\t\tsched.tasksFinished++\n\t}\n\n\tif status.GetState() == mesos.TaskState_TASK_LOST ||\n\t\tstatus.GetState() == mesos.TaskState_TASK_KILLED ||\n\t\tstatus.GetState() == mesos.TaskState_TASK_FAILED {\n\t\tlog.Infoln(\n\t\t\t\"Aborting because task\", status.TaskId.GetValue(),\n\t\t\t\"is in unexpected state\", status.State.String(),\n\t\t\t\"with message\", status.GetMessage(),\n\t\t)\n\t\tdriver.Abort()\n\t}\n}", "title": "" }, { "docid": "efee3202b3bb220d05daa5e761648976", "score": "0.5384888", "text": "func (s *ServerPool) HealthCheck() {\n\tfor _, b := range s.backends {\n\t\tstatus := \"up\"\n\t\talive := isBackendAlive(b.URL)\n\t\tb.SetAlive(alive)\n\t\tif !alive {\n\t\t\tstatus = \"down\"\n\t\t}\n\t\tlog.Printf(\"%s [%s]\\n\", b.URL, status)\n\t}\n}", "title": "" }, { "docid": "1a1984738f144ff519ab03666ce5d5c0", "score": "0.5381589", "text": "func (c *FakePipes) UpdateStatus(ctx context.Context, pipe *camelv1.Pipe, opts v1.UpdateOptions) (*camelv1.Pipe, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(pipesResource, \"status\", c.ns, pipe), &camelv1.Pipe{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*camelv1.Pipe), err\n}", "title": "" }, { "docid": "dd4aa57f2e93dd8c972e7e6e5cfc5421", "score": "0.53814924", "text": "func (r *HttpHealthChecksService) Update(project string, httpHealthCheck string, httphealthcheck *HttpHealthCheck) *HttpHealthChecksUpdateCall {\n\tc := &HttpHealthChecksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.project = project\n\tc.httpHealthCheck = httpHealthCheck\n\tc.httphealthcheck = httphealthcheck\n\treturn c\n}", "title": "" }, { "docid": "343d256cae8083d50ad7f8e41b9b15a6", "score": "0.53784794", "text": "func main() {\n\t// Create a new Checker\n\tchecker := health.NewChecker(\n\n\t\t// Configure a global timeout that will be applied to all checks.\n\t\thealth.WithTimeout(10*time.Second),\n\n\t\t// A simple successFunc to see if a fake database connection is up.\n\t\thealth.WithCheck(health.Check{\n\t\t\tName: \"database\",\n\t\t\tTimeout: 2 * time.Second, // A successFunc specific timeout.\n\t\t\tStatusListener: onComponentStatusChanged,\n\t\t\tCheck: func(ctx context.Context) error {\n\t\t\t\treturn nil // no error\n\t\t\t},\n\t\t}),\n\n\t\t// A simple successFunc to see if a fake file system up.\n\t\thealth.WithCheck(health.Check{\n\t\t\tName: \"filesystem\",\n\t\t\tTimeout: 2 * time.Second, // A successFunc specific timeout.\n\t\t\tStatusListener: onComponentStatusChanged,\n\t\t\tCheck: func(ctx context.Context) error {\n\t\t\t\treturn nil // example error\n\t\t\t},\n\t\t}),\n\n\t\t// The following check will be executed periodically every 30 seconds.\n\t\thealth.WithPeriodicCheck(5*time.Second, 10*time.Second, health.Check{\n\t\t\tName: \"search-engine\",\n\t\t\tStatusListener: onComponentStatusChanged,\n\t\t\tCheck: volatileFunc(),\n\t\t}),\n\n\t\t// This listener will be called whenever system health status changes (e.g., from \"up\" to \"down\").\n\t\thealth.WithStatusListener(onSystemStatusChanged),\n\t)\n\n\t// We Create a new http.Handler that provides health successFunc information\n\t// serialized as a JSON string via HTTP.\n\thttp.Handle(\"/health\", health.NewHandler(checker))\n\thttp.ListenAndServe(\":3000\", nil)\n}", "title": "" }, { "docid": "5c99d68812d67c9c6c9379a8b756e6a6", "score": "0.53753", "text": "func updateStatus(ctx context.Context, cli client.Client) error {\n\tvar dep appsv1.Deployment\n\terr := cli.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"sample\"}, &dep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdep.Status.AvailableReplicas = 3\n\terr = cli.Status().Update(ctx, &dep)\n\treturn err\n}", "title": "" }, { "docid": "a8442c0f135372612a8431bee2480c81", "score": "0.53738075", "text": "func (manager *NodeManager) callCheckStatus(ip string, event Event, data interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Printf(\"panic from rpc call[%s]\\n\", ip)\n\t\t}\n\t}()\n\tclient, err := rpc.DialHTTP(\"tcp\", ip)\n\tdefer client.Close()\n\tif err != nil {\n\t\tlog.Printf(\"call remote node rpc failed:[%s] %s\\n\", ip, err.Error())\n\t\treturn\n\t}\n\tid, ok := data.(uuid.UUID)\n\tif ok != true {\n\t\tlog.Println(\"config data fail to send\")\n\t\treturn\n\t}\n\tvar result *RPCResult\n\targs := &RPCCall{\n\t\tEvent: event,\n\t\tID: id,\n\t}\n\terr = client.Call(\"Manager.CheckStatus\", args, &result)\n\tif err != nil {\n\t\tlog.Printf(\"send check status to node faile:[%s] %s\", ip, err.Error())\n\t\treturn\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ec64ed356b59ab3c031bce5bee1fbd6", "score": "0.5373359", "text": "func (c *DandelionClient) SetStatus(cfg *app.ClientConfig, status InstanceStatus, v ...interface{}) error {\n\tpayload := map[string]interface{}{\n\t\t\"app_id\": cfg.AppID,\n\t\t\"host\": cfg.Host,\n\t\t\"instance_id\": cfg.InstanceID,\n\t\t\"status\": status,\n\t}\n\tfor _, arg := range v {\n\t\tswitch e := arg.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tfor k, val := range e {\n\t\t\t\tpayload[k] = val\n\t\t\t}\n\t\t}\n\t}\n\tmessage := app.WSMessage{\n\t\tAction: \"status\",\n\t\tPayload: payload,\n\t}\n\t// use app_id as key, save last status\n\tc.lastStatuses[cfg.ID] = payload\n\tclientLogger.Debugf(\"set status: %v\", message)\n\n\tif c.conn == nil {\n\t\treturn nil\n\t}\n\n\tc.wsLock.Lock()\n\tdefer c.wsLock.Unlock()\n\treturn c.conn.WriteJSON(message)\n}", "title": "" } ]
e05f23da85b3055cb4fec53febba1a85
MultiplyByCostFactor multiplies a CostEstimate by a cost factor and returns the CostEstimate with the nearest integer of the result, rounded up.
[ { "docid": "c42c626c086489446792743fb284d19b", "score": "0.7726339", "text": "func (ce CostEstimate) MultiplyByCostFactor(costPerUnit float64) CostEstimate {\n\treturn CostEstimate{\n\t\tmultiplyByCostFactor(ce.Min, costPerUnit),\n\t\tmultiplyByCostFactor(ce.Max, costPerUnit),\n\t}\n}", "title": "" } ]
[ { "docid": "33d15f8a0ddf31a5fa3cd21747301352", "score": "0.7417567", "text": "func (se SizeEstimate) MultiplyByCostFactor(costPerUnit float64) CostEstimate {\n\treturn CostEstimate{\n\t\tmultiplyByCostFactor(se.Min, costPerUnit),\n\t\tmultiplyByCostFactor(se.Max, costPerUnit),\n\t}\n}", "title": "" }, { "docid": "afa9d4de1a826e002dd379877373a47a", "score": "0.6681635", "text": "func multiplyByCostFactor(x uint64, y float64) uint64 {\n\txFloat := float64(x)\n\tif xFloat > 0 && y > 0 && xFloat > math.MaxUint64/y {\n\t\treturn math.MaxUint64\n\t}\n\treturn uint64(math.Ceil(xFloat * y))\n}", "title": "" }, { "docid": "1e3cc802dd71bc639099ac2a503c62c4", "score": "0.6397079", "text": "func (se SizeEstimate) MultiplyByCost(cost CostEstimate) CostEstimate {\n\treturn CostEstimate{\n\t\tmultiplyUint64NoOverflow(se.Min, cost.Min),\n\t\tmultiplyUint64NoOverflow(se.Max, cost.Max),\n\t}\n}", "title": "" }, { "docid": "e0945bf0fe562831795c25dc3f8f0355", "score": "0.55857795", "text": "func (ce CostEstimate) Multiply(cost CostEstimate) CostEstimate {\n\treturn CostEstimate{\n\t\tmultiplyUint64NoOverflow(ce.Min, cost.Min),\n\t\tmultiplyUint64NoOverflow(ce.Max, cost.Max),\n\t}\n}", "title": "" }, { "docid": "71a748d2f0bcb1b2e60c192decfe0296", "score": "0.49601763", "text": "func (_Stake *StakeCallerSession) MULTIPLIER() (*big.Int, error) {\n\treturn _Stake.Contract.MULTIPLIER(&_Stake.CallOpts)\n}", "title": "" }, { "docid": "6cbe82bccc4b53d25115ed36f399972f", "score": "0.4953983", "text": "func (_Stake *StakeCaller) MULTIPLIER(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Stake.contract.Call(opts, out, \"MULTIPLIER\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a3f3819e338868275dd47f8e15e594fa", "score": "0.48906842", "text": "func (m *Money) Mul(n *Money) *Money {\n\treturn m.Set(m.M * n.M / DP)\n}", "title": "" }, { "docid": "f98202cbc9950733ff0cbb32aa0e77a7", "score": "0.48256984", "text": "func (_Stake *StakeSession) MULTIPLIER() (*big.Int, error) {\n\treturn _Stake.Contract.MULTIPLIER(&_Stake.CallOpts)\n}", "title": "" }, { "docid": "8989e6de9fd560518167348c1d979063", "score": "0.4794058", "text": "func (o *Optimizer) ratchetCost(state *groupState, candidate memo.RelExpr, cost memo.Cost) {\n\tif state.best == nil || cost.Less(state.cost) {\n\t\tstate.best = candidate\n\t\tstate.cost = cost\n\t}\n}", "title": "" }, { "docid": "8b5f0db921c6eb50e207e389ed0cb5eb", "score": "0.47447896", "text": "func (o *AStar) X_EstimateCost(fromId int64, toId int64) float64 {\n\tlog.Println(\"Calling AStar.X_EstimateCost()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 2, 2)\n\tgoArguments[0] = reflect.ValueOf(fromId)\n\tgoArguments[1] = reflect.ValueOf(toId)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"_estimate_cost\", goArguments, \"float64\")\n\n\treturnValue := goRet.Interface().(float64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "4470290482ec4750513a537610b804ec", "score": "0.47100684", "text": "func (se SizeEstimate) Multiply(sizeEstimate SizeEstimate) SizeEstimate {\n\treturn SizeEstimate{\n\t\tmultiplyUint64NoOverflow(se.Min, sizeEstimate.Min),\n\t\tmultiplyUint64NoOverflow(se.Max, sizeEstimate.Max),\n\t}\n}", "title": "" }, { "docid": "8bb6fd68eacc4109441538f237ac3a6f", "score": "0.4709564", "text": "func (cs *CS) mulConstant(c *Constraint, constant curve.Element) *Constraint {\n\texpression := &term{\n\t\tWire: c.outputWire,\n\t\tCoeff: constant,\n\t\tOperation: mul,\n\t}\n\treturn newConstraint(cs, expression)\n}", "title": "" }, { "docid": "ec830f7af00a0569d635153eaa730425", "score": "0.47004026", "text": "func MulWithRound(x, y float64, places int) float64 {\n\ta := big.NewFloat(x)\n\tb := big.NewFloat(y)\n\tc := new(big.Float).Mul(a, b)\n\td, _ := c.Float64()\n\treturn Round(d, places)\n}", "title": "" }, { "docid": "6652b3522973cc2e22e256603ced0ed8", "score": "0.4698075", "text": "func (fn *FieldValueFactorFunction) Factor(factor float64) *FieldValueFactorFunction {\r\n\tfn.factor = &factor\r\n\treturn fn\r\n}", "title": "" }, { "docid": "a12a08e78855f8b11087d2cb779b51d3", "score": "0.4614213", "text": "func (m *Money) Mulf(f float64) *Money {\n\ti := m.M * int64(f*Guardf*DPf)\n\tr := i / Guard / DP\n\treturn m.Set(Rnd(r, float64(i)/Guardf/DPf-float64(r)))\n}", "title": "" }, { "docid": "f26f5f513a4940b6b0adb5741046fd13", "score": "0.4596329", "text": "func (z *Num) Mul(x, y *Num) *Num {\n\t// n controls output unit\n\ta, b := z.Convert(x), z.Convert(y)\n\tz.dec = a.dec.Mul(b.dec).Round(Precision)\n\treturn z\n}", "title": "" }, { "docid": "12a7c2283723699649ec850aca943c9c", "score": "0.45696217", "text": "func (t Transform) MulScale(factor float64) Transform {\n\tt.sca = t.sca.Scaled(factor)\n\treturn t\n}", "title": "" }, { "docid": "94a5ab3ad5a2289e4ff9a085588957ef", "score": "0.45278856", "text": "func MPIN_EXTRACT_FACTOR(sha int, CID []byte, factor int32, facbits int32, TOKEN []byte) int {\n\tP := ECP_fromBytes(TOKEN)\n\tif P.Is_infinity() {\n\t\treturn INVALID_POINT\n\t}\n\th := mhashit(sha, 0, CID)\n\tR := ECP_mapit(h)\n\n\tR = R.pinmul(factor, facbits)\n\tP.Sub(R)\n\n\tP.ToBytes(TOKEN, false)\n\n\treturn 0\n}", "title": "" }, { "docid": "318df3e0bddd96b972bdcbce4a65950e", "score": "0.44338435", "text": "func (g *Group) Mul(x, y *big.Int) *big.Int {\n\tr := new(big.Int)\n\tr.Mul(x, y)\n\tr.Mod(r, g.N)\n\treturn r\n}", "title": "" }, { "docid": "65eea79d8e03165d8ad79c0700ba4d87", "score": "0.44322166", "text": "func (_PancakeLibrary *PancakeLibraryCaller) FEEFACTOR(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _PancakeLibrary.contract.Call(opts, &out, \"FEE_FACTOR\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "34fb628cebc9ad067f140324ae045cff", "score": "0.44180006", "text": "func (o AssessmentPropertiesPtrOutput) ScalingFactor() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *AssessmentProperties) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ScalingFactor\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "6a3b04462ad4619b715e901a2d2108ad", "score": "0.44175825", "text": "func (pt Point) Mul(n int) Point {\n\tpt.X *= n\n\tpt.Y *= n\n\treturn pt\n}", "title": "" }, { "docid": "062012f36aa87c308e40b710702e837b", "score": "0.44079024", "text": "func Factorial(ctx context.Context, db DB, p0 int64) (float64, error) {\n\t// call pg_catalog.factorial\n\tconst sqlstr = `SELECT * FROM pg_catalog.factorial($1)`\n\t// run\n\tvar r0 float64\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn 0.0, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "70007bd4543f088ec7cf7434bab18d1f", "score": "0.44073874", "text": "func Mul(pubKeyBytes []byte, cipher []byte, constant []byte) ([]byte,error) {\n\tpubKey,err:=ParsePublicKey(pubKeyBytes)\n\tif err != nil {\n\t\treturn nil,err\n\t}\n\tc := new(big.Int).SetBytes(cipher)\n\tx := new(big.Int).SetBytes(constant)\n\n\t// c ^ x mod n^2\n\treturn new(big.Int).Exp(c, x, pubKey.NSquared).Bytes(),nil\n}", "title": "" }, { "docid": "7f8511cce9cdc0ecf66c69cd280c7624", "score": "0.4367366", "text": "func MPIN_RESTORE_FACTOR(sha int, CID []byte, factor int32, facbits int32, TOKEN []byte) int {\n\tP := ECP_fromBytes(TOKEN)\n\tif P.Is_infinity() {\n\t\treturn INVALID_POINT\n\t}\n\th := mhashit(sha, 0, CID)\n\tR := ECP_mapit(h)\n\n\tR = R.pinmul(factor, facbits)\n\tP.Add(R)\n\n\tP.ToBytes(TOKEN, false)\n\n\treturn 0\n}", "title": "" }, { "docid": "e66fb76d1d32bb2f2e8bdfbff7334ee4", "score": "0.43580037", "text": "func (r *Resource) MultiplyTo(ratio float64) {\n if r != nil {\n for k, v := range r.Resources {\n r.Resources[k] = mulValRatio(v, ratio)\n }\n }\n}", "title": "" }, { "docid": "113bd4758c82241ce96bfa1f23bf140b", "score": "0.43413433", "text": "func FuncCost(f func()) int64 {\n\tt := Nanosecond()\n\tf()\n\treturn Nanosecond() - t\n}", "title": "" }, { "docid": "e6a025f174904a0814408c6b440a9843", "score": "0.43354583", "text": "func (t Tree) Mul(i int, value int32) int32 {\n\tif i < 0 || len(t) <= i {\n\t\treturn 0\n\t}\n\n\t// calculate number by subtracting relevant partial sums\n\tj := i\n\tnumber := t[i]\n\tk := i & (i + 1)\n\tfor k < i && 0 < i && i < len(t) {\n\t\tnumber -= t[i-1]\n\t\ti &= i - 1\n\t}\n\n\t// calculate delta that needs to be added\n\tdelta := number * (value - 1)\n\n\t// add delta to the relevant partial sums\n\tfor 0 <= j && j < len(t) {\n\t\tt[j] += delta\n\t\tj |= j + 1\n\t}\n\n\treturn number + delta\n}", "title": "" }, { "docid": "554000985f3f5e3ae6c31ab2f4c74771", "score": "0.43061268", "text": "func (o AssessmentPropertiesResponsePtrOutput) ScalingFactor() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *AssessmentPropertiesResponse) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ScalingFactor\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "35b9bc8071f14fdd89f6cbedef17f9f7", "score": "0.42763048", "text": "func Ff_mul(a *big.Int, b *big.Int, size *big.Int) *big.Int {\r\n\tres := new(big.Int).Mul(a, b)\r\n\tres = new(big.Int).Mod(res, size)\r\n\t\r\n\t// prevent negative numbers\r\n\t// \r\n\tif res.Cmp(big.NewInt(0)) < 0 {\r\n\t\tres = new(big.Int).Add(res, size)\r\n\t\tres = new(big.Int).Mod(res, size)\r\n\t}\r\n\t\r\n\treturn res\r\n}", "title": "" }, { "docid": "68614fd0d07620caaf34a082eebdccff", "score": "0.42675248", "text": "func (v *Mpcplx) Mul(rv *Mpcplx) {\n\tvar ac, ad, bc, bd Mpflt\n\n\tac.Set(&v.Real)\n\tac.Mul(&rv.Real) // ac\n\n\tbd.Set(&v.Imag)\n\tbd.Mul(&rv.Imag) // bd\n\n\tbc.Set(&v.Imag)\n\tbc.Mul(&rv.Real) // bc\n\n\tad.Set(&v.Real)\n\tad.Mul(&rv.Imag) // ad\n\n\tv.Real.Set(&ac)\n\tv.Real.Sub(&bd) // ac-bd\n\n\tv.Imag.Set(&bc)\n\tv.Imag.Add(&ad) // bc+ad\n}", "title": "" }, { "docid": "671e6905156604d509acb9a552687ab8", "score": "0.42664945", "text": "func adjust(limit int, factor float32) int {\n\treturn int(float32(limit) * (1 + factor))\n}", "title": "" }, { "docid": "5d5b6ee20f32990cb4bc73e99497ba21", "score": "0.42639795", "text": "func (_CZRX *CZRXTransactor) SetReserveFactor(opts *bind.TransactOpts, newReserveFactorMantissa *big.Int) (*types.Transaction, error) {\n\treturn _CZRX.contract.Transact(opts, \"_setReserveFactor\", newReserveFactorMantissa)\n}", "title": "" }, { "docid": "b6c74e6e384031b16e851e6e1fba72e9", "score": "0.4259083", "text": "func AdjustFloatQuantityByMinAmount(quantity, currentPrice, minAmount float64) float64 {\n\t// modify quantity for the min amount\n\tamount := currentPrice * quantity\n\tif amount < minAmount {\n\t\tratio := minAmount / amount\n\t\tquantity *= ratio\n\t}\n\n\treturn quantity\n}", "title": "" }, { "docid": "657a9c8b2e4049b77d3b547b28141cec", "score": "0.4252647", "text": "func (p Point) Mul(k float64) Point {\n\treturn Pt(p.X*k, p.Y*k)\n}", "title": "" }, { "docid": "b401ecab904acdd14bd74c7c9e667aaa", "score": "0.42487326", "text": "func faiss_ClusteringIterationStats_imbalance_factor(Arg0 *FaissClusteringIterationStats) float64 {\n\tcArg0, cArg0AllocMap := (*C.FaissClusteringIterationStats)(unsafe.Pointer(Arg0)), cgoAllocsUnknown\n\t__ret := C.faiss_ClusteringIterationStats_imbalance_factor(cArg0)\n\truntime.KeepAlive(cArg0AllocMap)\n\t__v := (float64)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "9d699b0976dc2a9b18cded262e21e96e", "score": "0.42420188", "text": "func AdjustQuantityByMinAmount(quantity, currentPrice, minAmount fixedpoint.Value) fixedpoint.Value {\n\t// modify quantity for the min amount\n\tamount := currentPrice.Mul(quantity)\n\tif amount < minAmount {\n\t\tratio := minAmount.Div(amount)\n\t\tquantity = quantity.Mul(ratio)\n\t}\n\n\treturn quantity\n}", "title": "" }, { "docid": "27f04ea33275e954287b8922d9bfff1e", "score": "0.42339206", "text": "func Factor(n big.Int, rnd *rand.Rand, logger *log.Logger) ([]big.Int, error) {\n\t// mpqs does not work for powers of a single prime. Check that first.\n\tif f, err := primepower.Factor(n, rnd, logger); err == nil {\n\t\treturn f, nil\n\t}\n\n\t// Pick a factor base\n\tfb, a := makeFactorBase(n)\n\tif a != 0 {\n\t\treturn []big.Int{big.Int64(a), n.Div64(a)}, nil\n\t}\n\n\tmaxp := fb[len(fb)-1]\n\n\t// Figure out maximum possible a we want.\n\tamax := n.SqrtCeil().Lsh(1).Div64(sieverange)\n\t// Point to stop adding more factors to a.\n\t// It is ok if a is a bit small.\n\tamin := amax.Div64(maxp).Max(big.Two)\n\tlogger.Printf(\"a range: [%d,%d]\\n\", amin, amax)\n\n\t// matrix is used to do gaussian elimination on mod 2 exponents.\n\tm := linear.NewMatrix(uint(len(fb)))\n\n\t// pair up large primes that we find using this table\n\ttype largerecord struct {\n\t\tx big.Int\n\t\tf []uint\n\t}\n\tlargeprimes := map[int64]largerecord{}\n\n\t// Set up worker goroutines.\n\tworkers := runtime.NumCPU() // TODO: set up as a parameter somehow?\n\tlogger.Printf(\"workers: %d\\n\", workers)\n\ttasks := make(chan task, workers+1)\n\tresults := make(chan result, workers+1)\n\tfor i := 0; i < workers; i++ {\n\t\tgo worker(tasks, results)\n\t}\n\n\t// Send initial tasks.\n\tvar id int64 // Identify tasks with a sequence number.\n\tfor i := 0; i < workers+1; i++ {\n\t\ttasks <- task{\n\t\t\tid: id,\n\t\t\tn: n,\n\t\t\tamin: amin,\n\t\t\tfb: fb,\n\t\t\tseed: rnd.Int63(),\n\t\t}\n\t\tid++\n\t}\n\n\t// Process results.\n\tpending := map[int64]result{}\n\tvar next int64\n\tvar basic int64\n\tvar large int64\n\tvar largeHit int64\n\tvar falsePos int64\n\tfor {\n\t\t// Wait for a result.\n\t\tres := <-results\n\t\t// Queue up another task.\n\t\ttasks <- task{\n\t\t\tid: id,\n\t\t\tn: n,\n\t\t\tamin: amin,\n\t\t\tfb: fb,\n\t\t\tseed: rnd.Int63(),\n\t\t}\n\t\tid++\n\t\t// Record the result.\n\t\tpending[res.id] = res\n\n\t\t// Process pending results.\n\t\t// We want to process these results in ID order, so that our results\n\t\t// are deterministic even when the underlying Go scheduler is not.\n\t\tfor {\n\t\t\tres, ok := pending[next]\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdelete(pending, next)\n\t\t\tnext++\n\n\t\t\tfalsePos += res.falsePos\n\t\t\tfor _, r := range res.r {\n\t\t\t\tx := r.X\n\t\t\t\tfactors := r.Factors\n\t\t\t\tremainder := r.Remainder\n\t\t\t\tif remainder == 1 {\n\t\t\t\t\tbasic++\n\t\t\t\t} else {\n\t\t\t\t\tlarge++\n\t\t\t\t\t// try to find another record with the same largeprime\n\t\t\t\t\tlr, ok := largeprimes[remainder]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\t// haven't seen this large prime yet. Save record for later\n\t\t\t\t\t\tlargeprimes[remainder] = largerecord{x, factors}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// combine current equation with other largeprime equation\n\t\t\t\t\t// x1^2 === prod(f1) * largeprime\n\t\t\t\t\t// x2^2 === prod(f2) * largeprime\n\t\t\t\t\t//fmt.Printf(\" largeprime %d match\\n\", remainder)\n\t\t\t\t\tx = x.Mul(lr.x).Mod(n).Mul(big.Int64(remainder).ModInv(n)).Mod(n) // TODO: could remainder divide n?\n\t\t\t\t\tfactors = append(factors, lr.f...)\n\t\t\t\t\tlargeHit++\n\t\t\t\t}\n\n\t\t\t\t// Add equation to the matrix\n\t\t\t\tidlist := m.AddRow(factors, eqn{x, factors})\n\t\t\t\tif idlist == nil {\n\t\t\t\t\tif m.Rows()%100 == 0 {\n\t\t\t\t\t\tlogger.Printf(\"%d/%d basic=%d large=%d largeHit=%d falsePos=%d\\n\", m.Rows(), len(fb), basic, large, largeHit, falsePos)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// We found a set of equations with all even powers.\n\t\t\t\t// Compute a and b where a^2 === b^2 mod n\n\t\t\t\ta := big.One\n\t\t\t\tb := big.One\n\t\t\t\todd := make([]bool, len(fb))\n\t\t\t\tfor _, id := range idlist {\n\t\t\t\t\te := id.(eqn)\n\t\t\t\t\ta = a.Mul(e.x).Mod(n)\n\t\t\t\t\tfor _, i := range e.f {\n\t\t\t\t\t\tif !odd[i] {\n\t\t\t\t\t\t\t// first occurrence of this factor\n\t\t\t\t\t\t\todd[i] = true\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// second occurrence of this factor\n\t\t\t\t\t\tb = b.Mul64(fb[i]).Mod(n)\n\t\t\t\t\t\todd[i] = false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, o := range odd {\n\t\t\t\t\tif o {\n\t\t\t\t\t\tpanic(\"gauss elim failed\")\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif a.Cmp(b) == 0 {\n\t\t\t\t\t// trivial equation, ignore it\n\t\t\t\t\tlogger.Println(\"triv A\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif a.Add(b).Cmp(n) == 0 {\n\t\t\t\t\t// trivial equation, ignore it\n\t\t\t\t\tlogger.Println(\"triv B\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tf := a.Add(b).GCD(n)\n\t\t\t\tres := []big.Int{f, n.Div(f)}\n\n\t\t\t\t// Tell workers to stop.\n\t\t\t\tclose(tasks)\n\n\t\t\t\treturn res, nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cf651c38e5fc58339f53db2225eaefc1", "score": "0.4223368", "text": "func (c Coord) Mul(c1 Coord) Coord {\n\treturn Coord{X: c.X * c1.X, Y: c.Y * c1.Y}\n}", "title": "" }, { "docid": "0f19733944dde34a48066024576d4273", "score": "0.42120922", "text": "func CalculateCost(carsCount int) uint {\n\treturn uint(carsCount/10*planned10CarCost) + uint(carsCount%10*carCost)\n}", "title": "" }, { "docid": "3b68c26faa4932a324536fa712788052", "score": "0.4210587", "text": "func (o AssessmentPropertiesOutput) ScalingFactor() pulumi.Float64Output {\n\treturn o.ApplyT(func(v AssessmentProperties) float64 { return v.ScalingFactor }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "732c2c839e4add91f5558277e5d05a31", "score": "0.42098853", "text": "func (d Display) ScaleFactor() float64 {\n\treturn *d.o.ScaleFactor\n}", "title": "" }, { "docid": "8b2e61cf3118fe46f338fc26a6d854dd", "score": "0.42082453", "text": "func (_CZRX *CZRXTransactorSession) SetReserveFactor(newReserveFactorMantissa *big.Int) (*types.Transaction, error) {\n\treturn _CZRX.Contract.SetReserveFactor(&_CZRX.TransactOpts, newReserveFactorMantissa)\n}", "title": "" }, { "docid": "1946e44403c24887f5583548fb284c34", "score": "0.4190063", "text": "func (cm *ClientManager) updateCapFactor(now mclock.AbsTime, refresh bool) {\n\tif cm.totalRecharge == 0 {\n\t\treturn\n\t}\n\tdt := now - cm.capLastUpdate\n\tcm.capLastUpdate = now\n\n\tvar d float64\n\tif cm.sumRecharge > cm.totalRecharge {\n\t\td = (1 - float64(cm.sumRecharge)/float64(cm.totalRecharge)) * capFactorDropTC\n\t} else {\n\t\ttotalConnected := float64(cm.totalConnected)\n\t\tvar connRatio float64\n\t\tif totalConnected < cm.totalCapacity {\n\t\t\tconnRatio = totalConnected / cm.totalCapacity\n\t\t} else {\n\t\t\tconnRatio = 1\n\t\t}\n\t\tif connRatio > capFactorRaiseThreshold {\n\t\t\tsumRecharge := float64(cm.sumRecharge)\n\t\t\tlimit := float64(cm.totalRecharge) * connRatio\n\t\t\tif sumRecharge < limit {\n\t\t\t\td = (1 - sumRecharge/limit) * (connRatio - capFactorRaiseThreshold) * (1 / (1 - capFactorRaiseThreshold)) * capFactorRaiseTC\n\t\t\t}\n\t\t}\n\t}\n\tif d != 0 {\n\t\tcm.capLogFactor += d * float64(dt)\n\t\tif cm.capLogFactor < 0 {\n\t\t\tcm.capLogFactor = 0\n\t\t}\n\t\tif refresh {\n\t\t\tcm.refreshCapacity()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4bafa0c69b33b1cd282235af88fdf1c9", "score": "0.4179387", "text": "func SetCPUMultiplier(i int) {\n\tif i <= 0 {\n\t\ti = 1\n\t}\n\tcpuMultiplier = i\n\tmaxProcs = cpu * cpuMultiplier\n}", "title": "" }, { "docid": "c98ab16baa424c1a8bbff3258c91e24e", "score": "0.4174088", "text": "func (f *clientPool) requestCost(p *peer, cost uint64) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tinfo, exist := f.connectedMap[p.ID()]\n\tif !exist || f.closed {\n\t\treturn\n\t}\n\tinfo.balanceTracker.requestCost(cost)\n}", "title": "" }, { "docid": "b593ec5e296807d5a129017da865e6e4", "score": "0.41701096", "text": "func (m *Money) Multiply(mul int64) *Money {\n\treturn &Money{amount: mutate.calc.multiply(m.amount, mul), currency: m.currency}\n}", "title": "" }, { "docid": "d5236ba737cb59792eebd6d35414f52d", "score": "0.41408566", "text": "func (o AssessmentPropertiesResponseOutput) ScalingFactor() pulumi.Float64Output {\n\treturn o.ApplyT(func(v AssessmentPropertiesResponse) float64 { return v.ScalingFactor }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "835b3f9f543635bcd6b3cafbd88ed5be", "score": "0.41264993", "text": "func TrainCost(number int) int {\n\t// First find out what tech level we are in, then figure out the first of the first train\n\t// of that tech level. This can be calculated by using the formula for triangle numbers\n\t// adjusted for the number of trains in each level and the base change between each train,\n\t// added to the cost of the cheapest train (last one of first tech level)\n\ttechLvl := TechLevel(number)\n\tfirstCost := 80 + 20*techLvl*(techLvl+1)/2\n\treturn firstCost - 5*techLvl*((number-1)%5)\n}", "title": "" }, { "docid": "d2e8dec0967d630b41baa5d5062e13d8", "score": "0.4124552", "text": "func contractCostScoreCalc(info storage.HostInfo, rent storage.RentPayment, market hostMarket) float64 {\n\t// Evaluate the cost of host and market\n\thostContractCost := evalContractCost(info, rent)\n\tmarketContractCost := evalMarketContractCost(market, rent)\n\tif marketContractCost.Cmp(common.BigInt0) <= 0 {\n\t\tmarketContractCost = common.BigInt1\n\t}\n\n\t// calculate the ratio\n\tratio := hostContractCost.Float64() / marketContractCost.Float64()\n\t// If ratio is smaller than 0.1, the factor has value 10; Else the factor has value 1/x\n\tif ratio <= 0.1 {\n\t\treturn 10\n\t}\n\treturn 1 / ratio\n}", "title": "" }, { "docid": "7f914ff1fc5dd6485def0b625e1566d4", "score": "0.41212818", "text": "func (z *Int) Mul(x, y *Int) *Int {\n\ta, b, temp := new(big.Int), new(big.Int), new(big.Int)\n\ta.Sub(\n\t\ta.Mul(&x.l, &y.l),\n\t\ttemp.Mul(&y.r, &x.r),\n\t)\n\tb.Add(\n\t\ttemp.Mul(&x.r, &y.l),\n\t\tb.Mul(&y.r, &x.l),\n\t)\n\tz.SetPair(a, b)\n\treturn z\n}", "title": "" }, { "docid": "43896d7d919c87623b5b9a6ab6ccea00", "score": "0.41161403", "text": "func (cs *CS) mul(c1, c2 *Constraint) *Constraint {\n\n\texpression := &quadraticExpression{\n\t\tleft: linearExpression{term{Wire: c1.outputWire, Coeff: curve.One()}},\n\t\tright: linearExpression{term{Wire: c2.outputWire, Coeff: curve.One()}},\n\t\toperation: mul,\n\t}\n\n\treturn newConstraint(cs, expression)\n}", "title": "" }, { "docid": "ce478b77ea7d3c83e3a3aef4965d9e3b", "score": "0.41105467", "text": "func (t Tree) RangeMul(i int, factors []int32) {\n\tfor j := 0; j < len(factors) && i < len(t); i, j = i+1, j+1 {\n\t\tt.Mul(i, factors[j])\n\t}\n}", "title": "" }, { "docid": "3b21215dffbcb9d851bf58cdd9f36005", "score": "0.41024032", "text": "func (pmf Pmf) Mul(k string, v float32) {\n\tpmf[k] *= v\n}", "title": "" }, { "docid": "16463ac8bb9a4edd43ee6de40c45b0bb", "score": "0.41017663", "text": "func EstimateCost(p Program) (min, max int64) {\n\treturn estimateCost(p)\n}", "title": "" }, { "docid": "0beecc62ed36f90386ca296d3c0f62a4", "score": "0.40977058", "text": "func (pPoint *Point) Mul(k *big.Int, curve *Curve) *Point {\n\tif new(big.Int).Mod(k, curve.n).Cmp(big.NewInt(0)) == 0 || pPoint.IsAtInfinity() {\n\t\treturn &Point{}\n\t}\n\n\tif k.Sign() == -1 {\n\t\treturn pPoint.Mul(new(big.Int).Neg(k), curve)\n\t}\n\n\tresult := &Point{}\n\taddend := pPoint\n\n\tkCopy := new(big.Int).Set(k)\n\tfor kCopy.Sign() != 0 {\n\t\tif kCopy.Bit(0) == 1 {\n\t\t\tresult = result.Add(addend, curve)\n\t\t}\n\n\t\taddend = addend.Add(addend, curve)\n\t\tkCopy.Rsh(kCopy, 1)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "aec27bcf08d74d2eb9536c8ffbea2b29", "score": "0.4093268", "text": "func (msg MsgEthereumTx) Cost() *big.Int {\n\ttotal := msg.Fee()\n\ttotal.Add(total, msg.Data.Amount.BigInt())\n\treturn total\n}", "title": "" }, { "docid": "993c6c830136db2b53e578ba29485035", "score": "0.40925428", "text": "func (f *Float) Mul(g *Float) *Float {\n\tbf := new(big.Float).Mul(f.Float, g.Float)\n\treturn &Float{Float: bf}\n}", "title": "" }, { "docid": "62905e37aea139c352e7bbc95a15c6ea", "score": "0.40648857", "text": "func (board Board) Cost() (cost float64) {\n\tfor _, choice := range board.choices {\n\t\tcost += choice.cost\n\t}\n\treturn\n}", "title": "" }, { "docid": "311e07675dc113ab3f31f28d086319f3", "score": "0.40640903", "text": "func CalculateCost(carsCount int) uint {\n return uint((carsCount / 10 * 95000) + (carsCount % 10 * 10000))\n}", "title": "" }, { "docid": "7a8fbed8e8146257404d43001a76e797", "score": "0.4059199", "text": "func modexpMultComplexity(x *big.Int) *big.Int {\n\tswitch {\n\tcase x.Cmp(big64) <= 0:\n\t\tx.Mul(x, x) // x ** 2\n\tcase x.Cmp(big1024) <= 0:\n\t\t// (x ** 2 // 4 ) + ( 96 * x - 3072)\n\t\tx = new(big.Int).Add(\n\t\t\tnew(big.Int).Div(new(big.Int).Mul(x, x), big4),\n\t\t\tnew(big.Int).Sub(new(big.Int).Mul(big96, x), big3072),\n\t\t)\n\tdefault:\n\t\t// (x ** 2 // 16) + (480 * x - 199680)\n\t\tx = new(big.Int).Add(\n\t\t\tnew(big.Int).Div(new(big.Int).Mul(x, x), big16),\n\t\t\tnew(big.Int).Sub(new(big.Int).Mul(big480, x), big199680),\n\t\t)\n\t}\n\treturn x\n}", "title": "" }, { "docid": "53ab4d995788753ea94f7799670dc1d7", "score": "0.40560132", "text": "func (m *CPUMatrixMultiplier) Multiply(mA, mB *Matrix) *Matrix {\n\tif mA.Width != mB.Height {\n\t\tlog.Panic(\"matrix dimension mismatch\")\n\t}\n\n\tmC := new(Matrix)\n\tmC.Width = mB.Width\n\tmC.Height = mA.Height\n\tmC.Data = make([]float32, mC.Width*mC.Height)\n\n\tfor x := uint32(0); x < mC.Width; x++ {\n\t\tfor y := uint32(0); y < mC.Height; y++ {\n\t\t\tindexC := y*mC.Width + x\n\n\t\t\tsum := float32(0)\n\t\t\tfor i := uint32(0); i < mA.Width; i++ {\n\t\t\t\tindexA := y*mA.Width + i\n\t\t\t\tindexB := i*mB.Width + x\n\t\t\t\tsum += mA.Data[indexA] * mB.Data[indexB]\n\t\t\t}\n\n\t\t\tmC.Data[indexC] = sum\n\t\t}\n\t}\n\n\treturn mC\n}", "title": "" }, { "docid": "5296ffc08704ca7833052587f8927cab", "score": "0.40509543", "text": "func calcFactorial(num int) (fac int){\n fac = 1\n for i := 0; i < num; i++ {\n fac *= (num - i)\n }\n return fac\n}", "title": "" }, { "docid": "733b9013acd9a40fbeba23f23227103c", "score": "0.40509287", "text": "func execmRatMul(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := args[0].(*big.Rat).Mul(args[1].(*big.Rat), args[2].(*big.Rat))\n\tp.Ret(3, ret)\n}", "title": "" }, { "docid": "8dc161b1d4fdb47bbc49297274385aa0", "score": "0.4042683", "text": "func (vm VM) mul(termAddress1, termAddress2, resultAddress int, mode1, mode2, mode3 ParamMode) {\n\tvm.ModeWrite(resultAddress, vm.ModeRead(termAddress1, mode1)*vm.ModeRead(termAddress2, mode2), mode3)\n}", "title": "" }, { "docid": "9fb40f393c654351c408face90fbf0a5", "score": "0.4041694", "text": "func execmFloatMul(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := args[0].(*big.Float).Mul(args[1].(*big.Float), args[2].(*big.Float))\n\tp.Ret(3, ret)\n}", "title": "" }, { "docid": "62a52de0662a21e2e5227384b57e009f", "score": "0.4032107", "text": "func (me Point) MultiplyOf(point Point) (p Point) {\n\tp.X = me.X * point.X\n\tp.Y = me.Y * point.Y\n\treturn\n}", "title": "" }, { "docid": "d144e785774205d8a78dd36f6b29de81", "score": "0.40191466", "text": "func (key *PubKey) NumMul(ciphertext Ct, plaintext *big.Int) (Ct, error) {\n\tif err := validatePubKey(key); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := validateCiphertext(ciphertext); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := validatePlaintext(plaintext); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !key.checkOperand(ciphertext) {\n\t\treturn nil, ErrInvalidMismatch\n\t}\n\n\tciphertextStr, err := ciphertext.GetCtStr()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresultCStr := C.paillier_num_mul(key.Key,\n\t\tC.CString(ciphertextStr),\n\t\tC.CString(plaintext.String()))\n\tdefer C.free(unsafe.Pointer(resultCStr))\n\n\tresultGoStr := C.GoString(resultCStr)\n\n\treturn key.constructCiphertext(resultGoStr)\n}", "title": "" }, { "docid": "3493613e7bbc5144c9825f9deccb12a3", "score": "0.39988524", "text": "func (i Int) Multiply(i2 Int) Int {\n\t// Ensure that i has fewer digits than i2\n\tif len(i.n) > len(i2.n) {\n\t\treturn i2.Multiply(i)\n\t}\n\n\tacc := MakeInt(\"0\")\n\tfor ind := range i.n {\n\t\t// Do single \"digit\" multiplication\n\t\tnum := i2.copyForMultiply(ind)\n\t\tfor k, v := range num {\n\t\t\tnum[k] = v * int64(i.n[ind])\n\t\t}\n\n\t\t// Carry overflows inside single \"digit\" product\n\t\tkerry := int64(0)\n\t\tkerrycount := 0\n\t\tfor idx := range num {\n\t\t\tkerrycount++\n\t\t\tnum[idx] += kerry\n\t\t\tif num[idx] > int64(biggestNum) {\n\t\t\t\tkerry = num[idx] / (int64(biggestNum) + 1)\n\t\t\t\tnum[idx] = num[idx] % (int64(biggestNum) + 1)\n\t\t\t} else {\n\t\t\t\tkerry = int64(0)\n\t\t\t}\n\t\t}\n\n\t\tif kerry != 0 {\n\t\t\tfoo := make([]int32, kerrycount)\n\t\t\tfoo = append(foo, int32(kerry))\n\t\t\tacc = acc.Add(Int{foo, false})\n\t\t}\n\n\t\t// Accumulate\n\t\tacc = acc.Add(convertMultiplyBack(num))\n\t}\n\n\treturn acc\n}", "title": "" }, { "docid": "9625e6f38332ccec172d61f5ccded5a6", "score": "0.3998374", "text": "func (m1 Mat3x2) Mul(c float32) Mat3x2 {\n\treturn Mat3x2{m1[0] *c,m1[1] *c,m1[2] *c,m1[3] *c,m1[4] *c,m1[5] *c}\n}", "title": "" }, { "docid": "fd2fa2715692214784a865294ae7e18f", "score": "0.39916033", "text": "func (m *DenseMatrix) MultiplyConstant(constant float64) *DenseMatrix {\n\trows, cols := m.Dims()\n\tresult := InitializeMatrix(rows, cols)\n\tvar vec *Vector\n\tfor i, rowVector := range m.Rows {\n\t\tvec = rowVector.MultiplyConstant(constant)\n\t\tresult.Rows[i] = vec\n\t}\n\treturn result\n}", "title": "" }, { "docid": "dd071111647a3acb2d9f7533dc558293", "score": "0.3984797", "text": "func (self *Affine2) Mul(other *Affine2) *Affine2 {\n\ttmp00 := self.m00*other.m00 + self.m01*other.m10\n\ttmp01 := self.m00*other.m01 + self.m01*other.m11\n\ttmp02 := self.m00*other.m02 + self.m01*other.m12 + self.m02\n\ttmp10 := self.m10*other.m00 + self.m11*other.m10\n\ttmp11 := self.m10*other.m01 + self.m11*other.m11\n\ttmp12 := self.m10*other.m02 + self.m11*other.m12 + self.m12\n\n\tself.m00 = tmp00\n\tself.m01 = tmp01\n\tself.m02 = tmp02\n\tself.m10 = tmp10\n\tself.m11 = tmp11\n\tself.m12 = tmp12\n\treturn self\n}", "title": "" }, { "docid": "5657d756e33258d2be7ddfb9e3726611", "score": "0.39842185", "text": "func (evaluator *Evaluator) Multiply(ct1, ct2 *Ciphertext) *Ciphertext {\n\t\n\tc0, err := ring.NewRing(evaluator.ctx.N, evaluator.ctx.BigQ, evaluator.ctx.BigNttParams)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc1, err := ring.NewRing(evaluator.ctx.N, evaluator.ctx.BigQ, evaluator.ctx.BigNttParams)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc2, err := ring.NewRing(evaluator.ctx.N, evaluator.ctx.BigQ, evaluator.ctx.BigNttParams)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttmp, err := ring.NewRing(evaluator.ctx.N, evaluator.ctx.BigQ, evaluator.ctx.BigNttParams)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// set c0, c1, c2\n\tct1.value[0].Poly.InverseNTT()\n\tct1.value[1].Poly.InverseNTT()\n\tct2.value[0].Poly.InverseNTT()\n\tct2.value[1].Poly.InverseNTT()\n\n\tevaluator.change2BigNttParams(ct1.value[0])\n\tevaluator.change2BigNttParams(ct1.value[1])\n\tevaluator.change2BigNttParams(ct2.value[0])\n\tevaluator.change2BigNttParams(ct2.value[1])\n\n\tc0.MulPoly(ct1.value[0], ct2.value[0])\n\n\tcenter(c0)\n\tc0.MulScalar(c0, evaluator.ctx.T)\n\tc0.DivRound(c0, evaluator.ctx.Q)\n\tc0.Mod(c0, evaluator.ctx.Q)\n\tevaluator.change2NormalNttParams(c0)\n\tc0.Poly.NTT()\n\n\tc1.MulPoly(ct1.value[0], ct2.value[1])\n\ttmp.MulPoly(ct1.value[1], ct2.value[0])\n\tc1.Add(c1, tmp)\n\tcenter(c1)\n\tc1.MulScalar(c1, evaluator.ctx.T)\n\tc1.DivRound(c1, evaluator.ctx.Q)\n\tc1.Mod(c1, evaluator.ctx.Q)\n\tevaluator.change2NormalNttParams(c1)\n\tc1.Poly.NTT()\n\n\tc2.MulPoly(ct1.value[1], ct2.value[1])\n\tcenter(c2)\n\tc2.MulScalar(c2, evaluator.ctx.T)\n\tc2.DivRound(c2, evaluator.ctx.Q)\n\tc2.Mod(c2, evaluator.ctx.Q)\n\tevaluator.change2NormalNttParams(c2)\n\n\tevaluator.change2NormalNttParams(ct1.value[0])\n\tevaluator.change2NormalNttParams(ct1.value[1])\n\tevaluator.change2NormalNttParams(ct2.value[0])\n\tevaluator.change2NormalNttParams(ct2.value[1])\n\tct1.value[0].Poly.NTT()\n\tct1.value[1].Poly.NTT()\n\tct2.value[0].Poly.NTT()\n\tct2.value[1].Poly.NTT()\n\n\t// relinearisation\n\tc2_i, err := ring.NewRing(evaluator.ctx.N, evaluator.ctx.Q, evaluator.ctx.NttParams)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl := int(math.Floor(float64(evaluator.ctx.Q.Value.BitLen() - 1) / float64(evaluator.evalsize))) + 1\n\tmask := bigint.NewInt(1)\n\tmask.Lsh(mask, evaluator.evalsize)\n\tmask.Sub(mask, bigint.NewInt(1))\n\tfor i := 0; i < l; i++ {\n\t\tc2_i.And(c2, *mask)\n\t\tc2_i.Poly.NTT()\n\t\tc2.Rsh(c2, evaluator.evalsize)\n\n\t\ttmp.MulCoeffs(c2_i, (*evaluator.evalkey)[i][0])\n\t\tc0.Add(c0, tmp)\n\n\t\ttmp.MulCoeffs(c2_i, (*evaluator.evalkey)[i][1])\n\t\tc1.Add(c1, tmp)\n\t}\n\tc0.Mod(c0, evaluator.ctx.Q)\n\tc1.Mod(c1, evaluator.ctx.Q)\n\t// construct result ciphertext\n\tnewCiphertext := new(Ciphertext)\n\tnewCiphertext.value[0] = c0\n\tnewCiphertext.value[1] = c1\n\treturn newCiphertext\n}", "title": "" }, { "docid": "4fc650d6d37b431dd465ce21ecb9ca23", "score": "0.39821777", "text": "func (_CZRX *CZRXSession) SetReserveFactor(newReserveFactorMantissa *big.Int) (*types.Transaction, error) {\n\treturn _CZRX.Contract.SetReserveFactor(&_CZRX.TransactOpts, newReserveFactorMantissa)\n}", "title": "" }, { "docid": "c64ab80a2f0c094a0e7c210b23669752", "score": "0.39712262", "text": "func multiply(ns numbers, idx int) numbers {\n\ta := ns[idx]\n\tb := ns[idx+1]\n\n\tns[idx].numerator = a.numerator * b.numerator\n\tns[idx].denominator = a.denominator * b.denominator\n\tns[idx].typ = maxType(a.typ, b.typ)\n\tns[idx].ordinal = b.ordinal\n\n\treturn drop(ns, idx+1)\n}", "title": "" }, { "docid": "f13f770231104a9327634f11467de8d6", "score": "0.39703983", "text": "func execmIntMul(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := args[0].(*big.Int).Mul(args[1].(*big.Int), args[2].(*big.Int))\n\tp.Ret(3, ret)\n}", "title": "" }, { "docid": "684207ea0d34ca6b9768832100c80a0d", "score": "0.39649075", "text": "func FloatToCoin(val float64, decimalnum int32) *big.Int {\n\t//避免转换的数量超过合约的最多小数位\n\tbigDecimal := decimal.NewFromFloat(val).Truncate(decimalnum)\n\tcoin := decimal.NewFromBigInt(GetTokenCoinNum(decimalnum), 0)\n\tbigDecimal = bigDecimal.Mul(coin)\n\tresult, _ := new(big.Int).SetString(bigDecimal.String(), 10)\n\treturn result\n}", "title": "" }, { "docid": "235c6928ad4fbb97e1c70833b14dce36", "score": "0.39646623", "text": "func (a Cardinality) Mul(x, y Cardinality) Cardinality {\n\n\ta.Int = a.Int.Mul(x.Int, y.Int)\n\treturn a\n}", "title": "" }, { "docid": "aebddf3ed2462e595962c90db51f1f94", "score": "0.3962844", "text": "func (t Transform) MulScaleXY(factor Vec) Transform {\n\tt.sca = V(\n\t\tt.sca.X()*factor.X(),\n\t\tt.sca.Y()*factor.Y(),\n\t)\n\treturn t\n}", "title": "" }, { "docid": "e14de10b39ce729931482dcb70bb17a6", "score": "0.39559993", "text": "func (pb *PutBlock) Cost() (*big.Int, error) {\n\tintrinsicGas, err := pb.IntrinsicGas()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get intrinsic gas for the start-sub chain action\")\n\t}\n\tfee := big.NewInt(0).Mul(pb.GasPrice(), big.NewInt(0).SetUint64(intrinsicGas))\n\treturn fee, nil\n}", "title": "" }, { "docid": "4cc50f44cc8ef7d552b868ee3d4b3d4f", "score": "0.39522028", "text": "func (dest *primeFieldElement) Mul(lhs, rhs *primeFieldElement) *primeFieldElement {\n\ta := &lhs.A // = a*R\n\tb := &rhs.A // = b*R\n\n\tvar ab FpElementX2\n\tfp503Mul(&ab, a, b) // = a*b*R*R\n\tfp503MontgomeryReduce(&dest.A, &ab) // = a*b*R mod p\n\n\treturn dest\n}", "title": "" }, { "docid": "7f270f6e65ca587e19b9ecff983df002", "score": "0.3951706", "text": "func (m *Matrix) Scale(val float64) {\n\tfor i := 0; i < m.GetRowCount(); i++ {\n\t\tfor j := 0; j < m.GetColumnCount(); j++ {\n\t\t\tm.data[i][j] = val * m.data[i][j]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e5667c326832385e359631822584912a", "score": "0.39488783", "text": "func AdjustQuantityByMaxAmount(quantity, currentPrice, maxAmount fixedpoint.Value) fixedpoint.Value {\n\t// modify quantity for the min amount\n\tamount := currentPrice.Mul(quantity)\n\tif amount > maxAmount {\n\t\tratio := maxAmount.Div(amount)\n\t\tquantity = quantity.Mul(ratio)\n\t}\n\n\treturn quantity\n}", "title": "" }, { "docid": "c4d34080deb0e6999f39519b125e3078", "score": "0.3948225", "text": "func computePrice(rate float32, nights int) float32 {\n\tn := float32(nights)\n\treturn rate * n\n}", "title": "" }, { "docid": "1d1374155a6d86de7e6849bf0d2a64f7", "score": "0.39453432", "text": "func (fb *FeeStub) CalcFee(payer *Address, fn string, amount Amount) (*Amount, error) {\n\ttoken, err := NewTokenStub(fb.stub).GetToken(payer.Code)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif token.FeePolicy != nil {\n\t\tfeeRate, ok := token.FeePolicy.Rates[fn]\n\t\tif ok {\n\t\t\tpayerAddr := payer.String()\n\t\t\t// no fee if the payer is the target account of fee policy or the genesis account.\n\t\t\tif token.GenesisAccount != payerAddr && token.FeePolicy.TargetAddress != payerAddr {\n\t\t\t\t// We've already checked validity of Rate on GetFeePolicy()\n\t\t\t\tfeeRateRat, _ := new(big.Rat).SetString(feeRate.Rate)\n\t\t\t\t// feeAmount = amount * rate\n\t\t\t\tfeeAmount := amount.Copy().MulRat(feeRateRat)\n\t\t\t\tif feeAmount.Sign() < 0 { // fee must be zero or positive\n\t\t\t\t\treturn ZeroAmount(), nil\n\t\t\t\t}\n\t\t\t\tif feeRate.MaxAmount > 0 { // fee limit\n\t\t\t\t\tmaxAmount := NewAmountWithBigInt(big.NewInt(feeRate.MaxAmount))\n\t\t\t\t\tif feeAmount.Cmp(maxAmount) > 0 { // feeAmount is gt.\n\t\t\t\t\t\treturn maxAmount, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn feeAmount, nil\n\t\t\t}\n\t\t} // else no such fn\n\t} // else policy does't exist\n\n\treturn ZeroAmount(), nil\n}", "title": "" }, { "docid": "b106f6b5ffdbe5c5ccf1818d656e3bad", "score": "0.39408618", "text": "func (x *BikeProfileMsg) GetPowerCalFactorScaled() float64 {\n\tif x.PowerCalFactor == 0xFFFF {\n\t\treturn math.NaN()\n\t}\n\treturn float64(x.PowerCalFactor) / 10\n}", "title": "" }, { "docid": "a8161e7b843ac79d94e4a070797dd1bb", "score": "0.39405644", "text": "func toFixed(num float64, precision int) float64 {\n output := math.Pow(10, float64(precision))\n return float64(round(num * output)) / output\n}", "title": "" }, { "docid": "1a4038451977dac5a698080551794718", "score": "0.39335686", "text": "func NewMultiplier(v float64, t kallos.TransformType) *Multiplier {\n\tm := &Multiplier{\n\t\tAmount: v,\n\t}\n\n\tm.SetTransformType(t)\n\n\treturn m\n}", "title": "" }, { "docid": "a3e215144cf16fa97a4bff6f3ab3aedc", "score": "0.3932492", "text": "func (cell *Cell) Scale(factor float64) {\n\twidth := cell.Width()\n\theight := cell.Height()\n\tnewWidth := width * factor\n\tnewHeight := height * factor\n\n\tcell.TopLeft[0] = cell.TopLeft[0] + width/2 - newWidth/2\n\tcell.TopLeft[1] = cell.TopLeft[1] + height/2 - newHeight/2\n\tcell.BottomRight[0] = cell.BottomRight[0] - width/2 + newWidth/2\n\tcell.BottomRight[1] = cell.BottomRight[1] - height/2 + newHeight/2\n}", "title": "" }, { "docid": "119f02f76a1da2d17db64661f30ae80c", "score": "0.39321434", "text": "func FactorID(index, id int) int {\n\treturn (index * 100) + id\n}", "title": "" }, { "docid": "6a0c0dc03da1672dfd1a1755aff13449", "score": "0.39313176", "text": "func (_CZRX *CZRXCaller) ReserveFactorMantissa(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _CZRX.contract.Call(opts, out, \"reserveFactorMantissa\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "70b18dfb25ef4f85a035a3eb4413ff33", "score": "0.39312905", "text": "func (m1 Mat2x3) Mul(c float32) Mat2x3 {\n\treturn Mat2x3{m1[0] *c,m1[1] *c,m1[2] *c,m1[3] *c,m1[4] *c,m1[5] *c}\n}", "title": "" }, { "docid": "dd295f3d02654ba840b7b6b01c7d3aa9", "score": "0.39300868", "text": "func Clamp(val, c0, c1 float64) float64 {\n\tswitch {\n\tcase val < c0:\n\t\treturn c0\n\tcase val > c1:\n\t\treturn c1\n\t}\n\treturn val\n}", "title": "" }, { "docid": "570144740cbd995e0c9607fce4deead8", "score": "0.39223447", "text": "func quotaIncreaseFactor() float64 {\n\tif QuotaIncreaseFactor < 1 {\n\t\tQuotaIncreaseFactor = 1\n\t\treturn 1\n\t}\n\treturn QuotaIncreaseFactor\n}", "title": "" }, { "docid": "8931f3c76199e36c07e6e8eccb5a9015", "score": "0.39186123", "text": "func Cost(checker *exprpb.CheckedExpr, estimator CostEstimator, opts ...CostOption) (CostEstimate, error) {\n\tc := &coster{\n\t\tcheckedExpr: checker,\n\t\testimator: estimator,\n\t\texprPath: map[int64][]string{},\n\t\titerRanges: map[string][]int64{},\n\t\tcomputedSizes: map[int64]SizeEstimate{},\n\t\tpresenceTestCost: CostEstimate{Min: 1, Max: 1},\n\t}\n\tfor _, opt := range opts {\n\t\terr := opt(c)\n\t\tif err != nil {\n\t\t\treturn CostEstimate{}, err\n\t\t}\n\t}\n\treturn c.cost(checker.GetExpr()), nil\n}", "title": "" }, { "docid": "1625fa11ed46d33088f25847f5ea8bd9", "score": "0.39118478", "text": "func ToFixed(num float64, precision int) (output float64) {\n\toutput = math.Pow(10, float64(precision))\n\toutput = float64(round(num*output)) / output\n\treturn\n}", "title": "" }, { "docid": "80f1bce8fbf680e76b3750beede7ea41", "score": "0.39114034", "text": "func (contour DrawContour) resizeByFactor(factor int) {\n\tcontour.factor = factor\n}", "title": "" }, { "docid": "caf69552e8f7a90bb305ef26f45bbe84", "score": "0.3906263", "text": "func convertCPUWeightToCPULimit(weight uint64) (uint64, error) {\n\tconst (\n\t\t// minWeight is the lowest value possible for cpu.weight\n\t\tminWeight = 1\n\t\t// maxWeight is the highest value possible for cpu.weight\n\t\tmaxWeight = 10000\n\t)\n\tif weight < minWeight || weight > maxWeight {\n\t\treturn 0, fmt.Errorf(\"convertCPUWeightToCPULimit: invalid cpu weight: %v\", weight)\n\t}\n\treturn 2 + ((weight-1)*262142)/9999, nil\n}", "title": "" }, { "docid": "caf69552e8f7a90bb305ef26f45bbe84", "score": "0.3906263", "text": "func convertCPUWeightToCPULimit(weight uint64) (uint64, error) {\n\tconst (\n\t\t// minWeight is the lowest value possible for cpu.weight\n\t\tminWeight = 1\n\t\t// maxWeight is the highest value possible for cpu.weight\n\t\tmaxWeight = 10000\n\t)\n\tif weight < minWeight || weight > maxWeight {\n\t\treturn 0, fmt.Errorf(\"convertCPUWeightToCPULimit: invalid cpu weight: %v\", weight)\n\t}\n\treturn 2 + ((weight-1)*262142)/9999, nil\n}", "title": "" }, { "docid": "86cb8579a503bd7a9c872e3faf6648a4", "score": "0.39051467", "text": "func (o GoogleCloudRetailV2betaPriceInfoResponseOutput) Cost() pulumi.Float64Output {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2betaPriceInfoResponse) float64 { return v.Cost }).(pulumi.Float64Output)\n}", "title": "" } ]
86a4f36b86a08581c85d1374ac1f64c7
updateHandleResponse handles the Update response.
[ { "docid": "2f2d866d65cd7aec85ad903c36393b21", "score": "0.77107656", "text": "func (client *FunctionsClient) updateHandleResponse(resp *http.Response) (FunctionsUpdateResponse, error) {\n\tresult := FunctionsUpdateResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil {\n\t\treturn FunctionsUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" } ]
[ { "docid": "c9e16beaffca6ac584078342bac1b53a", "score": "0.7842286", "text": "func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsClientUpdateResponse, error) {\n\tresult := VaultsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Vault); err != nil {\n\t\treturn VaultsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3cae93503d1cff041cf5c0b8e6d6adc4", "score": "0.7789251", "text": "func (client *SnapshotsClient) updateHandleResponse(resp *azcore.Response) (SnapshotResponse, error) {\n\tvar val *Snapshot\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn SnapshotResponse{}, err\n\t}\n\treturn SnapshotResponse{RawResponse: resp.Response, Snapshot: val}, nil\n}", "title": "" }, { "docid": "e9f5432fb044f24987b831dfe8d3271f", "score": "0.775135", "text": "func (client *VaultExtendedInfoClient) updateHandleResponse(resp *http.Response) (VaultExtendedInfoUpdateResponse, error) {\n\tresult := VaultExtendedInfoUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VaultExtendedInfoResource); err != nil {\n\t\treturn VaultExtendedInfoUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "15cd70207da45e8c717b55d23c5ab7f0", "score": "0.7748057", "text": "func (client *EventSourcesClient) updateHandleResponse(resp *http.Response) (EventSourcesClientUpdateResponse, error) {\n\tresult := EventSourcesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result); err != nil {\n\t\treturn EventSourcesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "73d05af404e6585369cf02e5b1100ca5", "score": "0.7700695", "text": "func (client *FunctionsClient) updateHandleResponse(resp *http.Response) (FunctionsClientUpdateResponse, error) {\n\tresult := FunctionsClientUpdateResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil {\n\t\treturn FunctionsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "cede94d90ea846dcaf6035b399610cb8", "score": "0.76978624", "text": "func (client *APIVersionSetClient) updateHandleResponse(resp *http.Response) (APIVersionSetUpdateResponse, error) {\n\tresult := APIVersionSetUpdateResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil {\n\t\treturn APIVersionSetUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3ad296ab887327bfc896a9eece595829", "score": "0.76921016", "text": "func (client *StreamingJobsClient) updateHandleResponse(resp *http.Response) (StreamingJobsUpdateResponse, error) {\n\tresult := StreamingJobsUpdateResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.StreamingJob); err != nil {\n\t\treturn StreamingJobsUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5bdd7c700d5daa940de3d68d985891a1", "score": "0.76794267", "text": "func (client *ConnectorsClient) updateHandleResponse(resp *http.Response) (ConnectorsClientUpdateResponse, error) {\n\tresult := ConnectorsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Connector); err != nil {\n\t\treturn ConnectorsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "cbc4c156a39fd66bc00f40566f0fbd7e", "score": "0.7670711", "text": "func (client *PoolClient) updateHandleResponse(resp *http.Response) (PoolClientUpdateResponse, error) {\n\tresult := PoolClientUpdateResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Pool); err != nil {\n\t\treturn PoolClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ac05a92a7cba6d73858c871c5f6e7885", "score": "0.7662987", "text": "func (client *AuthorizationServerClient) updateHandleResponse(resp *http.Response) (AuthorizationServerClientUpdateResponse, error) {\n\tresult := AuthorizationServerClientUpdateResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationServerContract); err != nil {\n\t\treturn AuthorizationServerClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e3a33edc07f2afc9daee574d292061da", "score": "0.7658095", "text": "func (client *VirtualMachinesClient) updateHandleResponse(resp *http.Response) (VirtualMachinesClientUpdateResponse, error) {\n\tresult := VirtualMachinesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LabVirtualMachine); err != nil {\n\t\treturn VirtualMachinesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c414883d2ebe57c3ea55d9521dad80b8", "score": "0.76530564", "text": "func (client *SecretsClient) updateHandleResponse(resp *http.Response) (SecretsUpdateResponse, error) {\n\tresult := SecretsUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil {\n\t\treturn SecretsUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "f58a946f68103fe48fdeed338431f8a9", "score": "0.7633839", "text": "func (client *TagClient) updateHandleResponse(resp *http.Response) (TagClientUpdateResponse, error) {\n\tresult := TagClientUpdateResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil {\n\t\treturn TagClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8e832678426875dad1e505ba14acddd6", "score": "0.75892854", "text": "func (client *OpenIDConnectProviderClient) updateHandleResponse(resp *http.Response) (OpenIDConnectProviderUpdateResponse, error) {\n\tresult := OpenIDConnectProviderUpdateResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.OpenidConnectProviderContract); err != nil {\n\t\treturn OpenIDConnectProviderUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "01794e1124ca28fd158524f2c32d4e4f", "score": "0.75812554", "text": "func (client *AccountsClient) updateHandleResponse(resp *http.Response) (AccountsClientUpdateResponse, error) {\n\tresult := AccountsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil {\n\t\treturn AccountsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6709a51d31650f2e9c005ba3fe18167e", "score": "0.7578415", "text": "func (client *DatabaseRecommendedActionsClient) updateHandleResponse(resp *http.Response) (DatabaseRecommendedActionsClientUpdateResponse, error) {\n\tresult := DatabaseRecommendedActionsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RecommendedAction); err != nil {\n\t\treturn DatabaseRecommendedActionsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c21619c83c183bd88ab243f2850413d9", "score": "0.75769556", "text": "func (client *FarmBeatsModelsClient) updateHandleResponse(resp *http.Response) (FarmBeatsModelsUpdateResponse, error) {\n\tresult := FarmBeatsModelsUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.FarmBeats); err != nil {\n\t\treturn FarmBeatsModelsUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "02c091bcc5fef162a432b728bda33235", "score": "0.7574897", "text": "func (client *WorkspacesClient) updateHandleResponse(resp *http.Response) (WorkspacesClientUpdateResponse, error) {\n\tresult := WorkspacesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil {\n\t\treturn WorkspacesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2f1cc4aa94c737a2368574b20ff30818", "score": "0.75191003", "text": "func (client *ExtensionsClient) updateHandleResponse(resp *http.Response) (ExtensionsClientUpdateResponse, error) {\n\tresult := ExtensionsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil {\n\t\treturn ExtensionsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7dff7d0f07e2ad9c73681ae3b823de92", "score": "0.7491751", "text": "func (client *AssetsClient) updateHandleResponse(resp *http.Response) (AssetsUpdateResponse, error) {\n\tresult := AssetsUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil {\n\t\treturn AssetsUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e8f6240f5de8f1ba4c16f242d8b2f244", "score": "0.7481109", "text": "func (client *SubAccountClient) updateHandleResponse(resp *http.Response) (SubAccountClientUpdateResponse, error) {\n\tresult := SubAccountClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.MonitorResource); err != nil {\n\t\treturn SubAccountClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "41660a1164cf43b983f1b08963ff1ed0", "score": "0.74810654", "text": "func (client *FirewallsClient) updateHandleResponse(resp *http.Response) (FirewallsClientUpdateResponse, error) {\n\tresult := FirewallsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.FirewallResource); err != nil {\n\t\treturn FirewallsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "75cff481f3981ae22ee2af3236c3f132", "score": "0.74748105", "text": "func (client *SQLServerInstancesClient) updateHandleResponse(resp *http.Response) (SQLServerInstancesClientUpdateResponse, error) {\n\tresult := SQLServerInstancesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SQLServerInstance); err != nil {\n\t\treturn SQLServerInstancesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e3cca6582f2b881915851f5cc1226f40", "score": "0.74311346", "text": "func (client *ApplicationDefinitionsClient) updateHandleResponse(resp *http.Response) (ApplicationDefinitionsClientUpdateResponse, error) {\n\tresult := ApplicationDefinitionsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ApplicationDefinition); err != nil {\n\t\treturn ApplicationDefinitionsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "f2a358a3f6b1acd573726db925f2dc51", "score": "0.7431077", "text": "func (client *BlobContainersClient) updateHandleResponse(resp *http.Response) (BlobContainersUpdateResponse, error) {\n\tresult := BlobContainersUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil {\n\t\treturn BlobContainersUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "13ef98d575ee9306d6942613c2544c5f", "score": "0.7407058", "text": "func (client *PoliciesClient) updateHandleResponse(resp *http.Response) (PoliciesClientUpdateResponse, error) {\n\tresult := PoliciesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Policy); err != nil {\n\t\treturn PoliciesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d4711dee59dc902678a3d915d13db2ea", "score": "0.7399255", "text": "func (client *EnterprisePoliciesClient) updateHandleResponse(resp *http.Response) (EnterprisePoliciesClientUpdateResponse, error) {\n\tresult := EnterprisePoliciesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePolicy); err != nil {\n\t\treturn EnterprisePoliciesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a666a72d31de2e95e857aabb71bef47c", "score": "0.73833007", "text": "func (client *TrafficControllerInterfaceClient) updateHandleResponse(resp *http.Response) (TrafficControllerInterfaceClientUpdateResponse, error) {\n\tresult := TrafficControllerInterfaceClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.TrafficController); err != nil {\n\t\treturn TrafficControllerInterfaceClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b99d5436f152fe86191cb84acf967a68", "score": "0.7335157", "text": "func (client *DomainsClient) updateHandleResponse(resp *http.Response) (DomainsClientUpdateResponse, error) {\n\tresult := DomainsClientUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Domain); err != nil {\n\t\treturn DomainsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "70af9e0d4181d5ebbcf041adb01242f7", "score": "0.7333212", "text": "func (client *RestorePointCollectionsClient) updateHandleResponse(resp *http.Response) (RestorePointCollectionsClientUpdateResponse, error) {\n\tresult := RestorePointCollectionsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil {\n\t\treturn RestorePointCollectionsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "384a10f592b61fe5d66603ab0346bd6b", "score": "0.7317858", "text": "func (client *ContentKeyPoliciesClient) updateHandleResponse(resp *http.Response) (ContentKeyPoliciesClientUpdateResponse, error) {\n\tresult := ContentKeyPoliciesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil {\n\t\treturn ContentKeyPoliciesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2f878b161dd12e65010c4c0019c9a12a", "score": "0.7314798", "text": "func (client *VirtualMachineScaleSetsClient) updateHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetResponse, error) {\n\tvar val *VirtualMachineScaleSet\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn VirtualMachineScaleSetResponse{}, err\n\t}\n\treturn VirtualMachineScaleSetResponse{RawResponse: resp.Response, VirtualMachineScaleSet: val}, nil\n}", "title": "" }, { "docid": "c04785c1cce49ff80c9f1f35965df9d6", "score": "0.7307315", "text": "func (client *HierarchySettingsClient) updateHandleResponse(resp *http.Response) (HierarchySettingsUpdateResponse, error) {\n\tresult := HierarchySettingsUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil {\n\t\treturn HierarchySettingsUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "1f121a110c7aecbea644a7de546c0623", "score": "0.73054755", "text": "func (client *AvailabilitySetsClient) updateHandleResponse(resp *http.Response) (AvailabilitySetsClientUpdateResponse, error) {\n\tresult := AvailabilitySetsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil {\n\t\treturn AvailabilitySetsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "123db1025fd202cfa27b01937aabe40f", "score": "0.73050654", "text": "func (client *ConnectedClusterClient) updateHandleResponse(resp *http.Response) (ConnectedClusterClientUpdateResponse, error) {\n\tresult := ConnectedClusterClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ConnectedCluster); err != nil {\n\t\treturn ConnectedClusterClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2bcb5c4adc04e02819f904762bb16aeb", "score": "0.7275578", "text": "func (client *PowerBIResourcesClient) updateHandleResponse(resp *http.Response) (PowerBIResourcesClientUpdateResponse, error) {\n\tresult := PowerBIResourcesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.TenantResource); err != nil {\n\t\treturn PowerBIResourcesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5c38fbac479139e7a2de8877051660f4", "score": "0.72536683", "text": "func (client *HierarchySettingsClient) updateHandleResponse(resp *http.Response) (HierarchySettingsClientUpdateResponse, error) {\n\tresult := HierarchySettingsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil {\n\t\treturn HierarchySettingsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e8fd607d15039f705020f0d449a084a5", "score": "0.72499454", "text": "func (client *CommunicationsGatewaysClient) updateHandleResponse(resp *http.Response) (CommunicationsGatewaysClientUpdateResponse, error) {\n\tresult := CommunicationsGatewaysClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CommunicationsGateway); err != nil {\n\t\treturn CommunicationsGatewaysClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5f67445ce8629c8770eda69880fa7d9e", "score": "0.72460544", "text": "func (rm *RouteMap) handleUpdateResponse(resp *etcd.Response) {\n\tnode := resp.Node\n\tif resp.Action == \"delete\" {\n\t\trm.deleteNode(node)\n\t} else {\n\t\trm.setNode(node)\n\t}\n}", "title": "" }, { "docid": "f70ed499f6113b31b37596fb7b9e8069", "score": "0.72062653", "text": "func (client *DatabaseAutomaticTuningClient) updateHandleResponse(resp *http.Response) (DatabaseAutomaticTuningUpdateResponse, error) {\n\tresult := DatabaseAutomaticTuningUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAutomaticTuning); err != nil {\n\t\treturn DatabaseAutomaticTuningUpdateResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "22b21fb612746ef937d99c202d99fb0b", "score": "0.7189498", "text": "func (client *ConnectedEnvironmentsClient) updateHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientUpdateResponse, error) {\n\tresult := ConnectedEnvironmentsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironment); err != nil {\n\t\treturn ConnectedEnvironmentsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "35078ae6445ee4b8a160987119c121b2", "score": "0.71751714", "text": "func (client *TransactionNodesClient) updateHandleResponse(resp *http.Response) (TransactionNodesClientUpdateResponse, error) {\n\tresult := TransactionNodesClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.TransactionNode); err != nil {\n\t\treturn TransactionNodesClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5aa1ada7710e8f82277df2b95c8f184b", "score": "0.71709335", "text": "func (client *MoveCollectionsClient) updateHandleResponse(resp *http.Response) (MoveCollectionsClientUpdateResponse, error) {\n\tresult := MoveCollectionsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.MoveCollection); err != nil {\n\t\treturn MoveCollectionsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c0b6af3ecd83fd97837fd5298849ce34", "score": "0.7157789", "text": "func (client *TenantAccessClient) updateHandleResponse(resp *http.Response) (TenantAccessClientUpdateResponse, error) {\n\tresult := TenantAccessClientUpdateResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.AccessInformationContract); err != nil {\n\t\treturn TenantAccessClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d5a9b7ed7b8ca44e071e6aaa3f898099", "score": "0.71442205", "text": "func (s *APISurface) UpdateHandler(w http.ResponseWriter, r *http.Request) {\n\tversion := getBrokerAPIVersionFromRequest(r)\n\tif err := s.BusinessLogic.ValidateBrokerAPIVersion(version); err != nil {\n\t\twriteError(w, err, http.StatusPreconditionFailed)\n\t\treturn\n\t}\n\n\trequest, err := unpackUpdateRequest(r)\n\tif err != nil {\n\t\twriteError(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tglog.Infof(\"Received Update Request for instanceID %q\", request.InstanceID)\n\n\tresponse, err := s.BusinessLogic.Update(request, w, r)\n\tif err != nil {\n\t\twriteError(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tstatus := http.StatusOK\n\tif response.Async {\n\t\tstatus = http.StatusAccepted\n\t}\n\n\twriteResponse(w, status, response)\n}", "title": "" }, { "docid": "b004284acc75e6b094521b3648f54a7d", "score": "0.71047956", "text": "func (client *CapacityReservationGroupsClient) updateHandleResponse(resp *http.Response) (CapacityReservationGroupsClientUpdateResponse, error) {\n\tresult := CapacityReservationGroupsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil {\n\t\treturn CapacityReservationGroupsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7fb57cf7a00064aa45765b73d42050c9", "score": "0.71020985", "text": "func (client *ResourceGroupsClient) updateHandleResponse(resp *http.Response) (ResourceGroupsClientUpdateResponse, error) {\n\tresult := ResourceGroupsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil {\n\t\treturn ResourceGroupsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "48d1b9fc891a482da29bccb709a76211", "score": "0.6954245", "text": "func (client *DiskAccessesClient) updateHandleResponse(resp *azcore.Response) (DiskAccessResponse, error) {\n\tvar val *DiskAccess\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn DiskAccessResponse{}, err\n\t}\n\treturn DiskAccessResponse{RawResponse: resp.Response, DiskAccess: val}, nil\n}", "title": "" }, { "docid": "018c4d83470aff07ee1b7f8a61e1b197", "score": "0.69459933", "text": "func (client *VPNSitesClient) updateTagsHandleResponse(resp *http.Response) (VPNSitesClientUpdateTagsResponse, error) {\n\tresult := VPNSitesClientUpdateTagsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VPNSite); err != nil {\n\t\treturn VPNSitesClientUpdateTagsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8e727a3f30ede89b47d0aafefaf6cd0c", "score": "0.69239295", "text": "func (client *ComponentsClient) updateTagsHandleResponse(resp *http.Response) (ComponentsClientUpdateTagsResponse, error) {\n\tresult := ComponentsClientUpdateTagsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Component); err != nil {\n\t\treturn ComponentsClientUpdateTagsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e356ede3a0eba55ad4c276d6fa4d2b84", "score": "0.6863988", "text": "func handleUpdate(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tctx = helper.PopulateContext(ctx, req)\n\n\tvar (\n\t\td dto.UpdatePage\n\t\timageData []byte = nil\n\t)\n\n\tif !isMultiPart(req) {\n\t\terr := helper.ReadBody(req, &d)\n\t\tif err != nil {\n\t\t\tbr := result.Failure(err).WithStatusCode(http.StatusBadRequest)\n\t\t\treturn helper.Response(ctx, br, req), nil\n\t\t}\n\t} else {\n\t\tvar ok bool\n\t\timageData, ok = readFormData(req, &d)\n\t\tif !ok {\n\t\t\tbr := result.Failure(\"invalid request body\").WithStatusCode(http.StatusBadRequest)\n\t\t\treturn helper.Response(ctx, br, req), nil\n\t\t}\n\t}\n\n\tres := pages.Update(ctx, &d, imageData)\n\treturn helper.Response(ctx, res, req), nil\n}", "title": "" }, { "docid": "335b6ede57ea3690150080eb9f3baddf", "score": "0.6819812", "text": "func (be *Baboon) HandleUpdate(e StatusUpdateEvent) {\n\tbe.modify(e)\n}", "title": "" }, { "docid": "44dd6a940679fa6143e9a79d20eb056d", "score": "0.6805104", "text": "func (client *PublicIPAddressesClient) updateTagsHandleResponse(resp *azcore.Response) (PublicIPAddressResponse, error) {\n\tvar val *PublicIPAddress\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn PublicIPAddressResponse{}, err\n\t}\n\treturn PublicIPAddressResponse{RawResponse: resp.Response, PublicIPAddress: val}, nil\n}", "title": "" }, { "docid": "4a4c31cbc76bfa3f307e91a3de61c379", "score": "0.67682654", "text": "func (client *Client) updateTagPropertiesHandleResponse(resp *http.Response) (ClientUpdateTagPropertiesResponse, error) {\n\tresult := ClientUpdateTagPropertiesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ArtifactTagProperties); err != nil {\n\t\treturn ClientUpdateTagPropertiesResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "f558b05e3e9caa3bff7afda92f2712ce", "score": "0.67624074", "text": "func (client *VaultsClient) updateAccessPolicyHandleResponse(resp *http.Response) (VaultsClientUpdateAccessPolicyResponse, error) {\n\tresult := VaultsClientUpdateAccessPolicyResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VaultAccessPolicyParameters); err != nil {\n\t\treturn VaultsClientUpdateAccessPolicyResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "247da6f8f7055f1e6280f609426907a8", "score": "0.6757068", "text": "func (client *RouteFiltersClient) updateTagsHandleResponse(resp *http.Response) (RouteFiltersUpdateTagsResponse, error) {\n\tresult := RouteFiltersUpdateTagsResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RouteFilter); err != nil {\n\t\treturn RouteFiltersUpdateTagsResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "dc555dbf2e3236d1a41381f7a602c7cd", "score": "0.6719588", "text": "func (client *WebTestsClient) updateTagsHandleResponse(resp *http.Response) (WebTestsClientUpdateTagsResponse, error) {\n\tresult := WebTestsClientUpdateTagsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.WebTest); err != nil {\n\t\treturn WebTestsClientUpdateTagsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "f25638a9b77b2702003ba37087ebd320", "score": "0.6713548", "text": "func (client *ConnectionMonitorsClient) updateTagsHandleResponse(resp *azcore.Response) (ConnectionMonitorResultResponse, error) {\n\tvar val *ConnectionMonitorResult\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn ConnectionMonitorResultResponse{}, err\n\t}\n\treturn ConnectionMonitorResultResponse{RawResponse: resp.Response, ConnectionMonitorResult: val}, nil\n}", "title": "" }, { "docid": "cd0198d1a2de95f3b836453812189ed7", "score": "0.6696034", "text": "func (client *Client) updateManifestPropertiesHandleResponse(resp *http.Response) (ClientUpdateManifestPropertiesResponse, error) {\n\tresult := ClientUpdateManifestPropertiesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ArtifactManifestProperties); err != nil {\n\t\treturn ClientUpdateManifestPropertiesResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "445e5c18571f151505eb622f1d6d2394", "score": "0.66920537", "text": "func (client *SubAccountClient) listVMHostUpdateHandleResponse(resp *http.Response) (SubAccountClientListVMHostUpdateResponse, error) {\n\tresult := SubAccountClientListVMHostUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VMResourcesListResponse); err != nil {\n\t\treturn SubAccountClientListVMHostUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "33829fb31cbe2eeecccc1a7d614c36cc", "score": "0.66882086", "text": "func (client *ContainerRegistryClient) updatePropertiesHandleResponse(resp *http.Response) (ContainerRegistryClientUpdatePropertiesResponse, error) {\n\tresult := ContainerRegistryClientUpdatePropertiesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ContainerRepositoryProperties); err != nil {\n\t\treturn ContainerRegistryClientUpdatePropertiesResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "57f9bf6dfcd35773c8b097f630850ad5", "score": "0.6676889", "text": "func (r *VpNamespaceReconciler) handleUpdate(req ctrl.Request, vpNamespace ververicaplatformv1beta1.VpNamespace, namespace vpAPI.Namespace) (ctrl.Result, error) {\n\t// Now update the k8s resource and status as well\n\terr := r.updateResource(&vpNamespace, &namespace)\n\treturn ctrl.Result{}, err\n}", "title": "" }, { "docid": "82d386d3a0a2a93d1ac8ab403a53a14f", "score": "0.66403437", "text": "func (client *Client) updateRepositoryPropertiesHandleResponse(resp *http.Response) (ClientUpdateRepositoryPropertiesResponse, error) {\n\tresult := ClientUpdateRepositoryPropertiesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ContainerRepositoryProperties); err != nil {\n\t\treturn ClientUpdateRepositoryPropertiesResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "96b19be82c357669682fb371208c310f", "score": "0.66165656", "text": "func (client *VirtualHubsClient) updateTagsHandleResponse(resp *azcore.Response) (VirtualHubResponse, error) {\n\tvar val *VirtualHub\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn VirtualHubResponse{}, err\n\t}\n\treturn VirtualHubResponse{RawResponse: resp.Response, VirtualHub: val}, nil\n}", "title": "" }, { "docid": "d807fc694a0d5de190048cc6d0dea526", "score": "0.6611901", "text": "func (client *DomainsClient) updateOwnershipIdentifierHandleResponse(resp *http.Response) (DomainsClientUpdateOwnershipIdentifierResponse, error) {\n\tresult := DomainsClientUpdateOwnershipIdentifierResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DomainOwnershipIdentifier); err != nil {\n\t\treturn DomainsClientUpdateOwnershipIdentifierResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "612a90ec79fc4d2699bf31c297e50fa8", "score": "0.65946203", "text": "func (client *DdosCustomPoliciesClient) updateTagsHandleResponse(resp *http.Response) (DdosCustomPoliciesClientUpdateTagsResponse, error) {\n\tresult := DdosCustomPoliciesClientUpdateTagsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DdosCustomPolicy); err != nil {\n\t\treturn DdosCustomPoliciesClientUpdateTagsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "08a2383c786dc42f8166596a422cf4b5", "score": "0.65605694", "text": "func (client *NetworkVirtualAppliancesClient) updateTagsHandleResponse(resp *http.Response) (NetworkVirtualAppliancesUpdateTagsResponse, error) {\n\tresult := NetworkVirtualAppliancesUpdateTagsResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualAppliance); err != nil {\n\t\treturn NetworkVirtualAppliancesUpdateTagsResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "87634e8ed51681f3c2cc0d680b5296a4", "score": "0.655736", "text": "func (mux *ServeMux) HandleUpdate(endpoint string, fn UpdateFunc) {\n\tmux.initResources()\n\thandler := mux.Resources[endpoint]\n\thandler.update.one = fn\n\tmux.Resources[endpoint] = handler\n}", "title": "" }, { "docid": "63b25f3244a502a82d0f6b47a67fc500", "score": "0.6543596", "text": "func (h *Handler) HandleEmployeeUpdate(w http.ResponseWriter, r *http.Request) {\n\tmid, ok := r.Context().Value(ctxKey(\"ctxData\")).(middlewareData)\n\tif !ok {\n\t\trespErrorJSON(w, r, http.StatusUnauthorized, errorMissingAuthSessionData)\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(r.Body)\n\tin := service.EmployeeUpdateInput{}\n\terr := decoder.Decode(&in)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"mid\": fmt.Sprintf(\"%+v\", mid),\n\t\t}).Errorln(\"[Delivery][HandleEmployeeUpdate][Decode]: \", err.Error())\n\t\trespErrorJSON(w, r, http.StatusBadRequest, errorWrongJSONFormat)\n\t\treturn\n\t}\n\tin.CompanyID = mid.User.CompanyID\n\n\tout, status, err := h.ServiceEmployee.UpdateEmployee(in)\n\tif err != nil {\n\t\tif status == http.StatusInternalServerError {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"mid\": fmt.Sprintf(\"%+v\", mid),\n\t\t\t\t\"in\": fmt.Sprintf(\"%+v\", in),\n\t\t\t}).Errorln(\"[Delivery][HandleEmployeeUpdate][UpdateEmployee]: \", err.Error())\n\t\t}\n\t\trespErrorJSON(w, r, status, errorFailedToUpdateEmployee)\n\t\treturn\n\t}\n\n\trespSuccessJSON(w, r, status, out)\n\treturn\n}", "title": "" }, { "docid": "11a84d988bc2d8a8688661e2ff7da84c", "score": "0.65270305", "text": "func (client *ContainerRegistryClient) updateManifestPropertiesHandleResponse(resp *http.Response) (ContainerRegistryClientUpdateManifestPropertiesResponse, error) {\n\tresult := ContainerRegistryClientUpdateManifestPropertiesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ArtifactManifestProperties); err != nil {\n\t\treturn ContainerRegistryClientUpdateManifestPropertiesResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8c9600d9e17de76dfc0e8646d45016f4", "score": "0.64554805", "text": "func (hdlr *HTTPHandler) Update(w http.ResponseWriter, r *http.Request) {\n\treturn\n}", "title": "" }, { "docid": "9d5b0f610634127dd946b03a2fb6abed", "score": "0.6416736", "text": "func (client *ContainerRegistryClient) updateTagAttributesHandleResponse(resp *http.Response) (ContainerRegistryClientUpdateTagAttributesResponse, error) {\n\tresult := ContainerRegistryClientUpdateTagAttributesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ArtifactTagProperties); err != nil {\n\t\treturn ContainerRegistryClientUpdateTagAttributesResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5a743c0681ae3e70432c6488afeffaf5", "score": "0.64070636", "text": "func updateResponse(httpResponse *http.Response, response interface{}) {\n\tif response == nil {\n\t\treturn\n\t}\n\tstatusCodeMutator, ok := response.(StatucCodeMutator)\n\tif ok {\n\t\tstatusCodeMutator.SetStatusCode(httpResponse.StatusCode)\n\t}\n\tcontentTypeMutator, ok := response.(ContentTypeMutator)\n\tif ok {\n\t\tcontentTypeMutator.SetContentType(httpResponse.Header.Get(contentTypeHeader))\n\t}\n}", "title": "" }, { "docid": "3886e516175adf722a0963086ed809d8", "score": "0.6396728", "text": "func (r *CommentResponse) MakeResponseHandleUpdateStatusPrivate(c domain.Comment) (int, []byte, error) {\n\tres, err := json.Marshal(PrivateResponseComment{\n\t\tID: c.ID,\n\t\tPostID: c.PostID,\n\t\tBody: c.Body,\n\t\tStatus: c.Status,\n\t\tCreatedAt: c.CreatedAt,\n\t\tUpdatedAt: c.UpdatedAt,\n\t})\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, nil, err\n\t}\n\n\treturn http.StatusOK, res, nil\n}", "title": "" }, { "docid": "b0202bfb26192f8924ecdccba4f8db13", "score": "0.63857263", "text": "func (client *DiskAccessesClient) updateAPrivateEndpointConnectionHandleResponse(resp *azcore.Response) (PrivateEndpointConnectionResponse, error) {\n\tvar val *PrivateEndpointConnection\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn PrivateEndpointConnectionResponse{}, err\n\t}\n\treturn PrivateEndpointConnectionResponse{RawResponse: resp.Response, PrivateEndpointConnection: val}, nil\n}", "title": "" }, { "docid": "5942586aeaff458c3d480f1e2ef27295", "score": "0.6378107", "text": "func (client *ContactProfilesClient) updateTagsHandleResponse(resp *http.Response) (ContactProfilesClientUpdateTagsResponse, error) {\n\tresult := ContactProfilesClientUpdateTagsResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ContactProfile); err != nil {\n\t\treturn ContactProfilesClientUpdateTagsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ccbd10d3bf3d7b40c3fe17a4d47b8d7e", "score": "0.63780886", "text": "func (client *VirtualNetworkTapsClient) updateTagsHandleResponse(resp *http.Response) (VirtualNetworkTapsUpdateTagsResponse, error) {\n\tresult := VirtualNetworkTapsUpdateTagsResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTap); err != nil {\n\t\treturn VirtualNetworkTapsUpdateTagsResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9b8810402d1343057ef8976279cb4550", "score": "0.6377769", "text": "func (client *NamespacesClient) patchHandleResponse(resp *http.Response) (NamespacesClientPatchResponse, error) {\n\tresult := NamespacesClientPatchResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.NamespaceResource); err != nil {\n\t\treturn NamespacesClientPatchResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7a186eac7a1ecb77dffe23ff0d85f94f", "score": "0.6374739", "text": "func HandleUpdate(ac *apictx.Context) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Parse the parameters from the request body\n\t\tvar params servblog.UpdateParams\n\t\tif err := json.NewDecoder(r.Body).Decode(&params); err != nil {\n\t\t\terrors.Default(ac.Logger, w, errors.ErrBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Try to get the blog ID\n\t\tvar id int\n\t\tid64, err := strconv.ParseInt(httprouter.GetParam(r, \"id\"), 10, 32)\n\t\tif err != nil {\n\t\t\terrors.Default(ac.Logger, w, errors.ErrBadRequest)\n\t\t\treturn\n\t\t}\n\t\tid = int(id64)\n\n\t\t// Get this user from the request context\n\t\t// This validates that this user exists and has their token\n\t\t_, err = auth.GetUserFromRequest(r)\n\t\tif err != nil {\n\t\t\terrors.Default(ac.Logger, w, errors.ErrInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Try to update this blog entry\n\t\tblogEntry, err := ac.Services.Blog.UpdateByID(id, &params)\n\t\tif pes, ok := err.(*serverrors.ParamErrors); ok && err != nil {\n\t\t\terrors.Params(ac.Logger, w, http.StatusBadRequest, pes)\n\t\t\treturn\n\t\t} else if err == servblog.ErrBlogEntryNotFound {\n\t\t\terrors.Default(ac.Logger, w, errors.New(http.StatusNotFound, \"\", err.Error()))\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\tac.Logger.Printf(\"*Blog.UpdateByID() service error: %s\\n\", err)\n\t\t\terrors.Default(ac.Logger, w, errors.ErrInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Create a new Result\n\t\tresult := ResultUpdate{\n\t\t\tData: &BlogEntry{\n\t\t\t\tID: blogEntry.ID,\n\t\t\t\tTitle: blogEntry.Title,\n\t\t\t\tUserID: blogEntry.UserID,\n\t\t\t\tPreview: blogEntry.Preview,\n\t\t\t\tContent: blogEntry.Content,\n\t\t\t\tCreatedAt: blogEntry.CreatedAt,\n\t\t\t\tUpdatedAt: blogEntry.UpdatedAt,\n\t\t\t},\n\t\t}\n\n\t\t// Render output\n\t\tif err := render.JSON(w, true, result); err != nil {\n\t\t\tac.Logger.Printf(\"render.JSON() error: %s\\n\", err)\n\t\t\terrors.Default(ac.Logger, w, errors.ErrInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2cc7907dfa2e5d9480aa526a1610465f", "score": "0.6366184", "text": "func UpdateResponse(ms MessageStorage, rsp *ProxyResponse) error {\n\tif rsp.Unmangled != nil {\n\t\tif rsp.DbId != \"\" && rsp.DbId == rsp.Unmangled.DbId {\n\t\t\treturn errors.New(\"response has same DbId as unmangled version\")\n\t\t}\n\t\tif err := UpdateResponse(ms, rsp.Unmangled); err != nil {\n\t\t\treturn fmt.Errorf(\"error saving unmangled version of response: %s\", err.Error())\n\t\t}\n\t}\n\n\tif rsp.DbId == \"\" {\n\t\treturn ms.SaveNewResponse(rsp)\n\t} else {\n\t\treturn ms.UpdateResponse(rsp)\n\t}\n}", "title": "" }, { "docid": "8d8e3fcb621e4735a7dc22279b73bb1a", "score": "0.6361708", "text": "func (client *ExpressRouteCrossConnectionsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsClientUpdateTagsResponse, error) {\n\tresult := ExpressRouteCrossConnectionsClientUpdateTagsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnection); err != nil {\n\t\treturn ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9864aa07de1fce5e73bef71e8af38d56", "score": "0.63576645", "text": "func handleUpdate(request *api.Request) (interface{}, error) {\n\t// Map the data to the custom type.\n\tvar data api.RequestUpdate\n\terr := request.MapTo(&data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Validate.\n\tif len(data.Name) == 0 {\n\t\treturn nil, fmt.Errorf(\"missing or invalid data: %+v\", data)\n\t}\n\n\t// Obtain the app with the given name.\n\ta, err := apps.Get(data.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to update app: %v\", err)\n\t}\n\n\t// Update the app.\n\terr = a.Update()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to update app: %v\", err)\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "280f81e7bf20eaab4f5260b7631454b3", "score": "0.6328173", "text": "func (c *ServerController) HandleUpdate(ctx *gin.Context) {\n\trequestAddr, _ := srvrepo.ParseServerAddress(ctx.Request.RemoteAddr)\n\tvar serverData srvrepo.Server\n\n\tbody, _ := ioutil.ReadAll(ctx.Request.Body)\n\tif err := json.Unmarshal(body, &serverData); err != nil {\n\t\tglog.Error(\"Server Update: invalid request JSON\")\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"result\": \"invalid request JSON\"})\n\t}\n\n\tserverAddr, err := srvrepo.ParseServerAddress(ctx.Param(\"server_id\"))\n\tif err != nil {\n\t\tglog.Error(\"Server Update: invalid server ID\")\n\t\t// 404, since the ID is a URL param\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"result\": \"invalid server ID\"})\n\t\treturn\n\t}\n\n\t/*\n\t\tDon't check to see if they existed already, just note whether or not they exist.\n\t\twe need to handle the case where they've registered but the repo restarted for some reason.\n\t*/\n\texisted := c.repository.Has(srvrepo.ServerID(serverAddr.String()))\n\n\t// Make sure that the provided address is what's set in the data, so that\n\t// the server data and ID match.\n\tserverData.ServerAddress = serverAddr\n\n\t// Update the last-seen value to \"now\"\n\tserverData.Seen()\n\n\tif err := serverData.Validate(); err != nil {\n\t\tglog.Error(\"error during input validation: %v\\n\", err)\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"result\": err.Error()})\n\t\treturn\n\t}\n\n\tif !serverData.IP.Equal(requestAddr.IP) {\n\t\tglog.Info(\"Server Update: request IP address does not match client IP address\")\n\t\terr := fmt.Errorf(\"request IP address does not match client IP address\")\n\n\t\tglog.Error(\"error during request validation: %v\\n\", err)\n\t\tctx.JSON(http.StatusForbidden, gin.H{\"result\": err.Error()})\n\t\treturn\n\t}\n\n\tglog.Infof(\"A server is attempting update: %s:%d\", serverData.IP, serverData.Port)\n\n\texisted, err = c.repository.Register(serverData)\n\tif err != nil {\n\t\tglog.Errorf(\"error registering server: %v\\n\", err)\n\t\tctx.JSON(http.StatusInternalServerError, gin.H{\"result\": \"internal server error\"})\n\t} else if existed {\n\t\tglog.Infof(\"This server updated: %s:%d\", serverData.IP, serverData.Port)\n\t\tctx.JSON(http.StatusAccepted, gin.H{\"result\": \"updated\"})\n\t} else {\n\t\tglog.Info(\"New server registered via update: %s:%d\", serverData.IP, serverData.Port)\n\t\tctx.JSON(http.StatusCreated, gin.H{\"result\": \"registered\"})\n\t}\n}", "title": "" }, { "docid": "ebffe33b4d6b2e2ea7b4c7d2a36b1fef", "score": "0.63158804", "text": "func (h *EventHandler) Update(w http.ResponseWriter, r *http.Request) {\n\th.LogRequestURL(r)\n\n\tif r.Method != \"POST\" {\n\t\th.MethodNotAllowedError(w, r)\n\t\treturn\n\t}\n\n\tform := RequestForm{Request: r}\n\n\teventID, err := form.ParseInt64(\"ID\", 0)\n\tif err != nil {\n\t\th.LogError(\"Request parsing\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif eventID <= 0 {\n\t\terr = errors.New(\"The event ID must be defined and be greater then zero\")\n\t\th.LogError(\"Request parsing\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tevent, err := form.ParseEvent()\n\tif err != nil {\n\t\th.LogError(\"Request parsing\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tevent.ID = eventID\n\n\tif err := h.ValidateEvent(event); err != nil {\n\t\th.LogError(\"Validation\", err)\n\t\tif err = h.WriteEventResult(w, EventError{Error: err.Error()}); err != nil {\n\t\t\th.LogError(\"Response writing\", err)\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\n\tif err := h.Repo.Update(event); err != nil {\n\t\th.LogError(\"Repository\", err)\n\t\tif err = h.WriteEventResult(w, EventError{Error: err.Error()}); err != nil {\n\t\t\th.LogError(\"Response writing\", err)\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\n\teventResult := EventResult{Result: event}\n\tif err = h.WriteEventResult(w, &eventResult); err != nil {\n\t\th.LogError(\"Response writing\", err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "73c1ddc661a4f0a7c213530f0e6e382c", "score": "0.6283411", "text": "func (client SnapshotClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "2a5aec72530e6beed5be3cafff2eec4e", "score": "0.62640715", "text": "func UpdateHandler(update tgbotapi.Update) (err error) {\n\treturn nil\n}", "title": "" }, { "docid": "852ff3a8b3fd38f7599ffebdda9ee1f4", "score": "0.62433034", "text": "func HandleUpdate(ac *apictx.Context) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Parse the parameters from the request body.\n\t\tvar params servtodos.UpdateParams\n\t\tif err := json.NewDecoder(r.Body).Decode(&params); err != nil {\n\t\t\terrors.Default(ac.Logger, w, errors.ErrBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Try to get the todo ID.\n\t\tvar id int\n\t\tid64, err := strconv.ParseInt(httprouter.GetParam(r, \"id\"), 10, 32)\n\t\tif err != nil {\n\t\t\terrors.Default(ac.Logger, w, errors.ErrBadRequest)\n\t\t\treturn\n\t\t}\n\t\tid = int(id64)\n\n\t\t// Get this member from the request context.\n\t\tmember, err := auth.GetMemberFromRequest(r)\n\t\tif err != nil {\n\t\t\terrors.Default(ac.Logger, w, errors.ErrInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Try to update this todo.\n\t\ttodo, err := ac.Services.Todos.UpdateByIDAndMemberID(id, member.ID, &params)\n\t\tif pes, ok := err.(*serverrors.ParamErrors); ok && err != nil {\n\t\t\terrors.Params(ac.Logger, w, http.StatusBadRequest, pes)\n\t\t\treturn\n\t\t} else if err == servtodos.ErrTodoNotFound {\n\t\t\terrors.Default(ac.Logger, w, errors.New(http.StatusNotFound, \"\", err.Error()))\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\tac.Logger.Printf(\"todos.New() service error: %s\\n\", err)\n\t\t\terrors.Default(ac.Logger, w, errors.ErrInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Create a new Result.\n\t\tresult := ResultUpdate{\n\t\t\tData: &Todo{\n\t\t\t\tID: todo.ID,\n\t\t\t\tMemberID: todo.MemberID,\n\t\t\t\tCreated: todo.Created,\n\t\t\t\tDetail: todo.Detail,\n\t\t\t\tCompleted: todo.Completed,\n\t\t\t},\n\t\t}\n\n\t\t// Render output.\n\t\tif err := render.JSON(w, true, result); err != nil {\n\t\t\tac.Logger.Printf(\"render.JSON() error: %s\\n\", err)\n\t\t\terrors.Default(ac.Logger, w, errors.ErrInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61c10d535224173d4f691b517ecc5b2a", "score": "0.62302387", "text": "func (client *SnapshotsClient) createOrUpdateHandleResponse(resp *azcore.Response) (SnapshotResponse, error) {\n\tvar val *Snapshot\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn SnapshotResponse{}, err\n\t}\n\treturn SnapshotResponse{RawResponse: resp.Response, Snapshot: val}, nil\n}", "title": "" }, { "docid": "46ce99de428eef92dabdffdcd6f9a1c2", "score": "0.62288314", "text": "func (s *Service) HandleUpdate(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.RawQuery != \"\" {\n\t\ts.writer.Error(\n\t\t\tw,\n\t\t\t\"error during document search\",\n\t\t\tfmt.Errorf(\"query string not allowed '%s'\", r.URL.RawQuery),\n\t\t\thttp.StatusBadRequest,\n\t\t)\n\t\treturn\n\t}\n\n\trawContent, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\ts.writer.Error(\n\t\t\tw,\n\t\t\t\"error during document process\",\n\t\t\terrors.Wrap(err, \"could not read the request body\"),\n\t\t\thttp.StatusInternalServerError,\n\t\t)\n\t\treturn\n\t}\n\n\tif len(rawContent) == 0 {\n\t\ts.writer.Error(w, \"missing document body\", nil, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdocumentID := s.getDocumentID(r)\n\tresource := s.fetchResource(r.Context(), documentID, w)\n\tif resource == nil {\n\t\treturn\n\t}\n\n\tdoc, err := parseDocument(documentID, rawContent, resource)\n\tif err != nil {\n\t\ts.writer.Error(w, \"error during document parse\", err, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err = doc.Valid(); err != nil {\n\t\ts.writer.Error(w, \"invalid document\", err, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err = s.documentRepository.Update(r.Context(), doc); err != nil {\n\t\ts.writer.Error(w, \"error during document update\", err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := s.subscriptionTrigger.Update(r.Context(), doc); err != nil {\n\t\ts.writer.Error(w, \"error during subscription trigger\", err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ts.writer.Response(w, nil, http.StatusAccepted, nil)\n}", "title": "" }, { "docid": "d2e4a68b1f39731359883dbd3a04beed", "score": "0.62087756", "text": "func (client ServicesClient) UpdateResponder(resp *http.Response) (result Service, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "eee2559f82cd01a120b0e908d31bd37a", "score": "0.6187821", "text": "func (h *handler) handleResponse(msg *jsonrpcMessage) {\n\top := h.respWait[string(msg.ID)]\n\tif op == nil {\n\t\th.log.Debug(\"Unsolicited RPC response\", \"reqid\", idForLog{msg.ID})\n\t\treturn\n\t}\n\tdelete(h.respWait, string(msg.ID))\n\t// For normal responses, just forward the reply to Call/BatchCall.\n\tif op.sub == nil {\n\t\top.resp <- msg\n\t\treturn\n\t}\n\t// For subscription responses, start the subscription if the server\n\t// indicates success. EthSubscribe gets unblocked in either case through\n\t// the op.resp channel.\n\tdefer close(op.resp)\n\tif msg.Error != nil {\n\t\top.err = msg.Error\n\t\treturn\n\t}\n\tif op.err = json.Unmarshal(msg.Result, &op.sub.subid); op.err == nil {\n\t\tgo op.sub.run()\n\t\th.clientSubs[op.sub.subid] = op.sub\n\t}\n}", "title": "" }, { "docid": "a9da46bd6c3c7b191bb0e738c2b5d37f", "score": "0.6171745", "text": "func (s *Server) HandlePollUpdate(handler func(*Poll)) {\n\ts.pollHandler = handler\n}", "title": "" }, { "docid": "a103bd167d3f40903d6f11ac06952734", "score": "0.61466306", "text": "func (serv *BookService) HandleUpdate(id int, book Book, store Storage) error {\n\terr := store.UpdateBook(id, book)\n\treturn err\n}", "title": "" }, { "docid": "c9cdeb17ff3cacfe0b7688cb5a979b56", "score": "0.6130916", "text": "func (r *Request) handleResponse(task *task.MessageTask, response *libcoap.Pdu) {\n\tisMoreBlock, eTag, block := r.env.CheckBlock(response)\n\t// if block is more block, sent request to server with block option\n\t// else display data received from server\n\tif isMoreBlock {\n\t\tr.pdu.MessageID = r.env.CoapSession().NewMessageID()\n\t\tr.pdu.SetOption(libcoap.OptionBlock2, uint32(block.ToInt()))\n\t\tr.Send()\n\t} else {\n\t\tif eTag != nil && block.NUM > 0 {\n\t\t\tresponse.Data = r.env.GetBlockData(*eTag)\n\t\t\tdelete(r.env.Blocks(), *eTag)\n\t\t}\n\t\tr.logMessage(response)\n\t}\n\t// If this is response of session config Get without abnormal, restart ping task with latest parameters\n\tif (r.requestName == \"session_configuration\") && (r.method == \"GET\") &&\n\t\t(response.Code == libcoap.ResponseContent) {\n\t\tRestartPingTask(response, r.env)\n\t\tRefreshSessionConfig(response, r.env, r.pdu)\n\t}\n}", "title": "" }, { "docid": "1eea0306c79b086df53aa39a9838bee9", "score": "0.61306167", "text": "func (s *serverWrapper) handleUserUpdate() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tvar (\n\t\t\treq pb.UpdateUserRequest\n\t\t\tresp userResponse\n\t\t)\n\t\tresp.Success = false\n\n\t\tenc := json.NewEncoder(w)\n\n\t\thandle, err := s.getSessionHandle(r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Call to update user by not logged in user\")\n\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\tresp.Error = invalidJSONError\n\t\t\tenc.Encode(resp)\n\t\t\treturn\n\t\t}\n\n\t\terr = decoder.Decode(&req)\n\t\tif err != nil {\n\t\t\tlog.Printf(invalidJSONErrorWithPrint, err)\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tresp.Error = invalidJSONError\n\t\t\tenc.Encode(resp)\n\t\t\treturn\n\t\t}\n\n\t\t// This makes the handle optional to send, since it's already\n\t\t// provided by the session handler.\n\t\treq.Handle = handle\n\n\t\tlog.Printf(\"Trying to update user %#v.\\n\", req.Handle)\n\t\tctx, cancel := context.WithTimeout(context.Background(), defaultTimeoutDuration)\n\t\tdefer cancel()\n\n\t\tupdateResp, err := s.users.Update(ctx, &req)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Could not update user: %v\", err)\n\t\t\tresp.Error = \"Error communicating with user update service\"\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t} else if updateResp.Result != pb.UpdateUserResponse_ACCEPTED {\n\t\t\t// Unlike in user response, we will be clear that they\n\t\t\t// provided an incorrect password.\n\t\t\tlog.Printf(\"Error updating user: %s\", resp.Error)\n\t\t\tresp.Error = updateResp.Error\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t} else {\n\t\t\tlog.Print(\"Update session display_name if it changed\")\n\t\t\tresp.Success = true\n\t\t}\n\n\t\tenc.Encode(resp)\n\t}\n}", "title": "" }, { "docid": "d42d0c01839a5a292bcc03ee5befd34d", "score": "0.61289173", "text": "func (n *Node) handleResponse(addr *net.UDPAddr, response Response) {\n\ttx := n.txFind(response.ID, Contact{ID: response.NodeID, IP: addr.IP, Port: addr.Port})\n\tif tx != nil {\n\t\tselect {\n\t\tcase tx.res <- response:\n\t\tdefault:\n\t\t\t//log.Errorf(\"[%s] query %s: response received, but tx has no listener or multiple responses to the same tx\", n.id.HexShort(), response.ID.HexShort())\n\t\t}\n\t}\n\n\tn.rt.Update(Contact{ID: response.NodeID, IP: addr.IP, Port: addr.Port})\n}", "title": "" }, { "docid": "1854e6af8e581c561ebd08ca42ccde26", "score": "0.61194426", "text": "func (h *AuthHandler) handleUpdateAuthorization(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\treq, err := decodeUpdateAuthorizationRequest(ctx, r)\n\tif err != nil {\n\t\th.log.Info(\"Failed to decode request\", zap.String(\"handler\", \"updateAuthorization\"), zap.Error(err))\n\t\th.api.Err(w, r, err)\n\t\treturn\n\t}\n\n\ta, err := h.authSvc.FindAuthorizationByID(ctx, req.ID)\n\tif err != nil {\n\t\th.api.Err(w, r, err)\n\t\treturn\n\t}\n\n\ta, err = h.authSvc.UpdateAuthorization(ctx, a.ID, req.AuthorizationUpdate)\n\tif err != nil {\n\t\th.api.Err(w, r, err)\n\t\treturn\n\t}\n\n\tps, err := h.newPermissionsResponse(ctx, a.Permissions)\n\tif err != nil {\n\t\th.api.Err(w, r, err)\n\t\treturn\n\t}\n\th.log.Debug(\"Auth updated\", zap.String(\"auth\", fmt.Sprint(a)))\n\n\tresp, err := h.newAuthResponse(ctx, a, ps)\n\tif err != nil {\n\t\th.api.Err(w, r, err)\n\t\treturn\n\t}\n\n\th.api.Respond(w, r, http.StatusOK, resp)\n}", "title": "" }, { "docid": "a5e852b1a71d75b2d1f8726e9fd097c3", "score": "0.61113036", "text": "func (s *Service) HandleEventResponse(blockHeight uint64, response *responses.EventsResponse) error {\n\tvar (\n\t\trewards []*models.Reward\n\t\tslashes []*models.Slash\n\t\tcoinsForUpdateMap = make(map[string]struct{})\n\t)\n\n\tfor _, event := range response.Result.Events {\n\t\tif event.Type == \"noah/CoinLiquidationEvent\" {\n\n\t\t\tcoinId, err := s.coinRepository.FindIdBySymbol(event.Value.Coin)\n\n\t\t\terr = s.balanceRepository.DeleteByCoinId(coinId)\n\n\t\t\tif err != nil {\n\t\t\t\ts.logger.WithFields(logrus.Fields{\n\t\t\t\t\t\"coin\": event.Value.Coin,\n\t\t\t\t}).Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = s.coinRepository.DeleteBySymbol(event.Value.Coin)\n\t\t\tif err != nil {\n\t\t\t\ts.logger.WithFields(logrus.Fields{\n\t\t\t\t\t\"coin\": event.Value.Coin,\n\t\t\t\t}).Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif event.Type == \"noah/UnbondEvent\" {\n\t\t\tcontinue\n\t\t}\n\n\t\taddressId, err := s.addressRepository.FindId(helpers.RemovePrefixFromAddress(event.Value.Address))\n\t\tif err != nil {\n\t\t\ts.logger.WithFields(logrus.Fields{\n\t\t\t\t\"address\": event.Value.Address,\n\t\t\t}).Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\tvalidatorId, err := s.validatorRepository.FindIdByPk(helpers.RemovePrefix(event.Value.ValidatorPubKey))\n\t\tif err != nil {\n\t\t\ts.logger.WithFields(logrus.Fields{\n\t\t\t\t\"public_key\": event.Value.ValidatorPubKey,\n\t\t\t}).Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\tswitch event.Type {\n\t\tcase models.RewardEvent:\n\t\t\trewards = append(rewards, &models.Reward{\n\t\t\t\tBlockID: blockHeight,\n\t\t\t\tRole: event.Value.Role,\n\t\t\t\tAmount: event.Value.Amount,\n\t\t\t\tAddressID: addressId,\n\t\t\t\tValidatorID: validatorId,\n\t\t\t})\n\n\t\tcase models.SlashEvent:\n\t\t\tcoinsForUpdateMap[event.Value.Coin] = struct{}{}\n\t\t\tcoinId, err := s.coinRepository.FindIdBySymbol(event.Value.Coin)\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tslashes = append(slashes, &models.Slash{\n\t\t\t\tBlockID: blockHeight,\n\t\t\t\tCoinID: coinId,\n\t\t\t\tAmount: event.Value.Amount,\n\t\t\t\tAddressID: addressId,\n\t\t\t\tValidatorID: validatorId,\n\t\t\t})\n\t\t}\n\t}\n\n\tif len(coinsForUpdateMap) > 0 {\n\t\ts.coinService.GetUpdateCoinsFromCoinsMapJobChannel() <- coinsForUpdateMap\n\t}\n\n\tif len(rewards) > 0 {\n\t\ts.saveRewards(rewards)\n\t}\n\n\tif len(slashes) > 0 {\n\t\ts.saveSlashes(slashes)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1fcbed06e5f4e213b49f82e6d7aef3dd", "score": "0.6109237", "text": "func (client *AccessReviewInstanceMyDecisionsClient) patchHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsPatchResponse, error) {\n\tresult := AccessReviewInstanceMyDecisionsPatchResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil {\n\t\treturn AccessReviewInstanceMyDecisionsPatchResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7ed4a378d6fb2d7ef9803cdf64cf0c2d", "score": "0.609127", "text": "func (h UpdateHandler) Handle(w http.ResponseWriter, r *http.Request) error {\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\treturn errors.Wrapf(response.BadRequestResponse(w), \"convert id query param to int: %v\", err)\n\t}\n\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(response.BadRequestResponse(w), \"read body\")\n\t}\n\n\tvar f article.Form\n\tif err := f.UnmarshalJSON(data); err != nil {\n\t\treturn errors.Wrap(response.BadRequestResponse(w), \"unmarshal json\")\n\t}\n\n\tart, err := h.Update(r.Context(), id, &f)\n\tif err != nil {\n\t\tswitch v := errors.Cause(err).(type) {\n\t\tcase validation.Errors:\n\t\t\treturn errors.Wrap(response.UnprocessabeEntityResponse(w, v), \"validation response\")\n\t\tdefault:\n\t\t\treturn errors.Wrap(response.InternalServerErrorResponse(w), \"update article\")\n\t\t}\n\t}\n\n\tdata, err = art.MarshalJSON()\n\tif err != nil {\n\t\treturn errors.Wrap(response.InternalServerErrorResponse(w), \"marshal json\")\n\t}\n\n\tif _, err := w.Write(data); err != nil {\n\t\treturn errors.Wrap(response.InternalServerErrorResponse(w), \"write response\")\n\t}\n\n\treturn nil\n}", "title": "" } ]
dc140a0acecc4a6a759d2b3453a96015
don't forget to close the io.ReadCloser
[ { "docid": "6ba0067b0632f1131c54023d2f6d5a7d", "score": "0.0", "text": "func createBasicAuthGetRequest(url, username, password string) (*http.Response, error) {\n\tclient := &http.Client{}\n\tgetRequest, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\tretrievalError()\n\t}\n\tgetRequest.SetBasicAuth(username, password)\n\n\tresp, err := client.Do(getRequest)\n\treturn resp, err\n}", "title": "" } ]
[ { "docid": "a7f523333499b3e111390b978480601f", "score": "0.69513446", "text": "func (nopReadCloser) Close() error { return nil }", "title": "" }, { "docid": "6451b086460de66477475b37bbfccedb", "score": "0.68282104", "text": "func (DummyReadCloser) Close() error { return nil }", "title": "" }, { "docid": "1405c9480ff51fda2ce878508ae75e39", "score": "0.62028027", "text": "func (z *Reader) Close() error {}", "title": "" }, { "docid": "1452aa4b6ef1155c5e5e53f19a89a47b", "score": "0.6028234", "text": "func (iJson invalidJsonIOReader) Close() error{\n\t//Doing absolutely nothing (:\n\treturn nil\n}", "title": "" }, { "docid": "a8716a2c1e0359199e05379205782904", "score": "0.5859447", "text": "func (*nopClosingBytesReader) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "18c59152f8ba49c2c73e5e3c96701433", "score": "0.5853775", "text": "func (*errorReader) Close() error { return nil }", "title": "" }, { "docid": "fc7a2c33fcca2af69903bc479d7322b0", "score": "0.5834938", "text": "func ReadCloser(r io.Reader) io.ReadCloser {\n\treturn &fakeReadClose{r}\n}", "title": "" }, { "docid": "a50ea698eef3bf3f528f77bd3410f676", "score": "0.5829103", "text": "func (src *StringReadCloser) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "c8af2b44aa41e29af0f268fd7eeb1d48", "score": "0.58047515", "text": "func Read() {}", "title": "" }, { "docid": "5c1f7f4ed508cdc3f2e3d04e5349e5b2", "score": "0.5795292", "text": "func (c readCloser) Close() error {\n\tc.b.Reset()\n\tc.bp.Put(c.b)\n\treturn nil\n}", "title": "" }, { "docid": "227d08598af53792e01187d4e7de12b3", "score": "0.5719898", "text": "func (limitedReadCloser *LimitReadCloser) Close() error {\n return limitedReadCloser.closer.Close()\n}", "title": "" }, { "docid": "afbaa12d5e344e5d9eeeb5328a0a9cb0", "score": "0.57107896", "text": "func (body *HTTPBody) Reader() io.ReadCloser {\n\tif body.factory == nil {\n\t\treturn nil\n\t}\n\treturn body.factory.NewDoppelganger()\n}", "title": "" }, { "docid": "648d510b2ccb49b8e2eb06f62e029f96", "score": "0.5699007", "text": "func (c *cstor) reader() (string, error) {\n\tbuf := make([]byte, BufSize)\n\tvar (\n\t\terr error\n\t\tn int\n\t\tstr, response string\n\t\tbuffer bytes.Buffer\n\t)\n\t// infinite for loop to collect all the chunks.\n\tfor {\n\t\tn, err = c.conn.Read(buf[:])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// concatnat the chunks received and then compare if it has\n\t\t// Footer (\" IOSTATS\") + EOF (\"\\r\\n\") and exit, else continue\n\t\t// appending the chunks at the end of str.\n\t\tbuffer.WriteString(string(buf[0:n]))\n\t\tstr = buffer.String()\n\t\t// It's possible that chunks read from socket is less than\n\t\t// 7 or 12(slice comparison), so exporter may panic, this check ensures\n\t\t// that str of atleast length 12 has been read from the socket, if not\n\t\t// it continue to read again\n\t\tif len(str) < 12 {\n\t\t\tcontinue\n\t\t}\n\t\t// confirm whether all the chunks have been collected\n\t\t// exp: \"IOSTATS(Command) <json response> OK IOSTATS(Footer+EOF)\\r\\n\"\n\t\tif str[:7] == Command && str[len(str)-12:] == Footer+EOF {\n\t\t\tresponse = str\n\t\t\tbreak\n\t\t}\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "13824f0a42607ba847be6e5f7bd64462", "score": "0.5672655", "text": "func (m mockReadCloser) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "fe02624e705d7a2f19450c428a1af818", "score": "0.56392807", "text": "func (i *innerReadCloser) Read(p []byte) (int, error) {\n\treturn i.outer.Read(p)\n}", "title": "" }, { "docid": "856e334438965af2bef8c8dc00df1dcb", "score": "0.56381345", "text": "func readCloser(s string) io.ReadCloser {\n\treturn ioutil.NopCloser(strings.NewReader(s))\n}", "title": "" }, { "docid": "88f15000168f4c4ef549447639450964", "score": "0.5587824", "text": "func (t *ssh2Client) reader(ch *ssh.Channel, s *Stream) {\n\n\tdata := make([]byte, 0)\n\n\tfor {\n\t\t// TODO: define default buffer size\n\t\t// TODO: allow dynamic buffer size\n\t\tbuf := make([]byte, 64)\n\t\tn, err := (*ch).Read(buf)\n\t\tif err != nil {\n\t\t\tif err.Error() == \"EOF\" {\n\t\t\t\tbuf = buf[:n]\n\t\t\t\tdata = append(data, buf...)\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tlogrus.Fatalln(err.Error())\n\t\t\t}\n\t\t}\n\t\tbuf = buf[:n]\n\t\tdata = append(data, buf...)\n\t}\n\n\tlogrus.Debugln(\"reader -- data:\", hex.EncodeToString(data))\n\n\t// end of response\n\ts.write(recvMsg{data: data})\n\n\tif s.state == streamWriteDone {\n\t\ts.state = streamDone\n\t\tlogrus.Debugln(\"s.state: streamDone\")\n\t} else {\n\t\ts.state = streamReadDone\n\t\tlogrus.Debugln(\"s.state: streamReadDone\")\n\t}\n\n\ts.statusCode = codes.OK\n\n\ts.write(recvMsg{err: io.EOF})\n\n\t// close headerChan to progress in\n\t// google.golang.org/grpc/call.go: func recvResponse\n\t// this line -> c.headerMD, err = stream.Header()\n\t// look at func (s *Stream) Header() in grpc/transport/transport.go\n\t// it waits for headerChan to be closed or stream cancellation\n\tclose(s.headerChan)\n}", "title": "" }, { "docid": "7d3d5085298d18052812e545000d6fd8", "score": "0.5581724", "text": "func (ctl *Control) reader() {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tctl.Error(\"panic error: %v\", err)\n\t\t\tctl.Error(string(debug.Stack()))\n\t\t}\n\t}()\n\tdefer ctl.readerShutdown.Done()\n\tdefer close(ctl.closedCh)\n\n\tencReader := crypto.NewReader(ctl.conn, []byte(g.GlbClientCfg.Token))\n\tfor {\n\t\tif m, err := msg.ReadMsg(encReader); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tctl.Debug(\"read from control connection EOF\")\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tctl.Warn(\"read error: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tctl.readCh <- m\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c64c1f8acb15d63b879a187a02a100ad", "score": "0.5575565", "text": "func (c *readClient) close() error {\n\tif c.rawClient == nil {\n\t\treturn fmt.Errorf(\"already closed\")\n\t}\n\tc.rawClient.Close()\n\tc.rawClient = nil\n\treturn nil\n}", "title": "" }, { "docid": "b45b4eb93b946f701ea17e7f140bc0e8", "score": "0.5566056", "text": "func HandleRead(req *f.ReadRequest, resp *f.ReadResponse, data []byte) {\n if req.Offset >= int64(len(data)) {\n data = nil\n } else {\n data = data[req.Offset:]\n }\n if len(data) > req.Size {\n data = data[:req.Size]\n }\n n := copy(resp.Data[:req.Size], data)\n resp.Data = resp.Data[:n]\n}", "title": "" }, { "docid": "6570827c7d7110141fddb2603bef01d9", "score": "0.5553976", "text": "func (d *driver) ReadStream(ctx context.Context, path string, offset int64) (io.ReadCloser, error) {\n resp, err := d.Bucket.GetResponseParams(d.scsPath(path), nil, offset, -1)\n if err != nil {\n if hasCode(err, \"NoSuchKey\") {\n return nil, storagedriver.PathNotFoundError{Path: path}\n }\n return nil, err\n }\n if resp.StatusCode != http.StatusPartialContent {\n resp.Body.Close()\n return ioutil.NopCloser(bytes.NewReader(nil)), nil\n }\n return resp.Body, nil\n}", "title": "" }, { "docid": "1aa494d86a5e50b6f0440094f643ad49", "score": "0.55387884", "text": "func (resp *RegistryResponse) readResponse() {\n\tif !resp.hasBeenRead && resp.Response != nil && resp.Response.Body != nil {\n\t\tresp.data, resp.Error = ioutil.ReadAll(resp.Response.Body)\n\t\tresp.Response.Body.Close()\n\t\tresp.hasBeenRead = true\n\t}\n}", "title": "" }, { "docid": "aa3ef080c5a321c207ffe754133061b4", "score": "0.55167216", "text": "func (d *DummyReadCloser) Read(b []byte) (n int, err error) {\n\tif d.consumed {\n\t\treturn 0, io.EOF\n\t}\n\tdata := []byte(`\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>Fake</title>\n<body>\n<div>\n\t<a href=\"magnet:?xt=urn:btih:db4c7f5d&dn=something%5D&tr=udp%3A%2F%2Ftracker.foo.com%3A80&tr=udp%3A%2F%2Ftracker.bar.com%3A80&tr=udp%3A%2F%2Ftracker.qux.it%3A6969&tr=udp%3A%2F%2Ftfoobar.de%3A80&tr=udp%3A%2F%2Fopen.foobar.com%3A1337\" title=\"Download this torrent using magnet\"><img src=\"/static/img/icon-magnet.gif\" alt=\"Magnet link\" /></a>\n</div>\n</body>`)\n\tcopy(b, data)\n\t// No more data from us.\n\td.consumed = true\n\treturn len(data), nil\n}", "title": "" }, { "docid": "bbe54a0cfdddc0f6bae405072d6dc34d", "score": "0.5497901", "text": "func IOReadCloser(r io.ReadCloser) *IOReaderElement {\n\treturn &IOReaderElement{\n\t\treadcloser: r,\n\t}\n}", "title": "" }, { "docid": "6596a761827632bf517cefbb22622aa1", "score": "0.54847336", "text": "func (rb *respBody) Close() error {\n\trb.conn.Close()\n\treturn rb.ReadCloser.Close()\n}", "title": "" }, { "docid": "ce6c880cae5dd70c8982a20c65d35a98", "score": "0.5455196", "text": "func (s *StorageServerError) ReadExecuted() {\n\t<-make(chan struct{})\n}", "title": "" }, { "docid": "3d3750bb1d936cf1e023f36b1ad28fd9", "score": "0.5442116", "text": "func (limitedReadCloser *LimitReadCloser) Read(p []byte) (n int, err error) {\n return limitedReadCloser.reader.Read(p)\n}", "title": "" }, { "docid": "ffef0679979de7ccfcf4afc25f46d987", "score": "0.5415216", "text": "func (t *httpReadWriteNopCloser) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "ffef0679979de7ccfcf4afc25f46d987", "score": "0.5415216", "text": "func (t *httpReadWriteNopCloser) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "ffef0679979de7ccfcf4afc25f46d987", "score": "0.5415216", "text": "func (t *httpReadWriteNopCloser) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "0eda230eaa48f85be3109b864cefb206", "score": "0.5405165", "text": "func (c *Client) read() {\n defer func() {\n hub.removeClient <- c\n c.ws.Close()\n }()\n\n for {\n _, message, err := c.ws.ReadMessage()\n if err != nil {\n hub.removeClient <- c\n c.ws.Close()\n break\n }\n\n hub.handle_req <- message\n }\n}", "title": "" }, { "docid": "90732842a6e2152434e3396e48f24b77", "score": "0.53908944", "text": "func (rc *ReadCloser) Read(contents []byte) (int, error) {\n\treturn rc.Reader.Read(contents)\n}", "title": "" }, { "docid": "670e8bd42e7255d49b01348b2704c5cc", "score": "0.5390059", "text": "func (it *iterator) Read(p []byte) (n int, err error) { return it.body.Read(p) }", "title": "" }, { "docid": "736cd492e21784a226e7aaa04af538f5", "score": "0.53788674", "text": "func (r *bufferedReadCloser) Close() error {\n\treturn r.reader.Close()\n}", "title": "" }, { "docid": "632739c46ed03ed4d560653fd53e5b1e", "score": "0.5375179", "text": "func (oc *objectContent) newReader(\n\tctx context.Context,\n\ttgs *TGStore,\n\taead cipher.AEAD,\n\toffset int64,\n) (io.ReadCloser, error) {\n\tif offset >= oc.Size {\n\t\treturn ioutil.NopCloser(bytes.NewReader(nil)), nil\n\t}\n\n\tfullChunkOffset := offset / objectChunkSize\n\toffset -= fullChunkOffset * objectChunkSize\n\n\trc, err := tgs.downloadTelegramFile(\n\t\tctx,\n\t\toc.ID,\n\t\tfullChunkOffset*objectEncryptedChunkSize,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpipeReader, pipeWriter := io.Pipe()\n\tgo func() (err error) {\n\t\tdefer func() {\n\t\t\tpipeWriter.CloseWithError(err)\n\t\t\trc.Close()\n\t\t}()\n\n\t\tbuf := make([]byte, objectEncryptedChunkSize)\n\t\tfor {\n\t\t\tn, err := io.ReadFull(rc, buf)\n\t\t\tif err != nil {\n\t\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\t\tbreak\n\t\t\t\t} else if !errors.Is(err, io.ErrUnexpectedEOF) {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnonce := buf[:chacha20poly1305.NonceSize]\n\t\t\tchunkContent := buf[chacha20poly1305.NonceSize:n]\n\t\t\tif chunkContent, err = aead.Open(\n\t\t\t\tchunkContent[:0],\n\t\t\t\tnonce,\n\t\t\t\tchunkContent,\n\t\t\t\tnil,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif offset > 0 {\n\t\t\t\tchunkContent = chunkContent[offset:]\n\t\t\t\toffset = 0\n\t\t\t}\n\n\t\t\tif _, err := pipeWriter.Write(\n\t\t\t\tchunkContent,\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}()\n\n\treturn pipeReader, nil\n}", "title": "" }, { "docid": "00d42c38908c293a178fbc69301bfe34", "score": "0.53662235", "text": "func (w *wrapReadCloser) Close() error {\n\tw.reader.Close()\n\tw.writer.Close()\n\treturn nil\n}", "title": "" }, { "docid": "ba8e8c960ddeda39cf4f4b46cdd57afb", "score": "0.5364917", "text": "func (r *HTTPHelper) readBody(resp *http.Response, err error) ([]byte, error) {\n\tr.last = nil\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\tif r.Log != nil {\n\t\tr.Log.TRACE.Printf(\"%s\\n%s\", resp.Request.URL.String(), string(b))\n\t}\n\n\tr.last = resp\n\tif resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent {\n\t\treturn b, fmt.Errorf(\"unexpected response %d: %s\", resp.StatusCode, string(b))\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "30c7e391007947a0273c4ecd392cf50e", "score": "0.5362301", "text": "func read() {\n\tb, err := reader.ReadBytes('\\n')\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t// Remove last byte since it is the newline character\n\tb = b[:len(b)-1]\n\tif len(b) > 1 && debug {\n\t\tfmt.Print(\"warning: multiple bytes were submitted\\n\")\n\t}\n\tmemory[memoryPointer] = b[0]\n}", "title": "" }, { "docid": "0f8605cc570331c7d3ab717e9b2c40fa", "score": "0.53493965", "text": "func drainBody(r io.ReadCloser, url string) {\n\t_, err := io.Copy(ioutil.Discard, r)\n\tif err != nil {\n\t\tif err.Error() != _errReadOnClosedResBody.Error() {\n\t\t\tlog.Warnw(\"failed to drain body (read)\",\n\t\t\t\tzap.String(\"url\", url),\n\t\t\t\tzap.Error(err),\n\t\t\t)\n\t\t}\n\t}\n\n\tif err := r.Close(); err != nil {\n\t\tlog.Warnw(\"failed to drain body (close)\",\n\t\t\tzap.String(\"url\", url),\n\t\t\tzap.Error(err),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "9f59224ca93189766ea68ae8d045e6e5", "score": "0.5344121", "text": "func read(conn *websocket.Conn) {\n\tvar unmarshedInterface interface{}\n\n\tfor {\n\t\t_, byteStream, err := conn.ReadMessage()\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\terror := json.Unmarshal(byteStream, &unmarshedInterface)\n\n\t\tif error != nil {\n\n\t\t}\n\n\t\t/*This whole block I think should be possible to do in a simpler way\n\t\t * although for some reason this is the only way I made it work,\n\t\t * so, sacrificed a more elegant solution for a working one here.\n\t\t */\n\t\tfor _, v := range unmarshedInterface.([]interface{}) {\n\t\t\tvar item inputItem\n\t\t\ttmpMap := v.(map[string]interface{})\n\n\t\t\tname, exists := tmpMap[\"name\"]\n\t\t\tif exists {\n\t\t\t\titem.Name = name.(string)\n\t\t\t}\n\t\t\tid, exists := tmpMap[\"session_id\"]\n\t\t\tif exists {\n\t\t\t\titem.SessionId = id.(string)\n\t\t\t}\n\t\t\titem.Type = tmpMap[\"type\"].(string)\n\t\t\titem.Timestamp = int64(tmpMap[\"timestamp\"].(float64))\n\n\t\t\tinputItems = append(inputItems, item)\n\t\t}\n\n\t\tshouldClose := transformInput(inputItems)\n\t\tlog.Println(\"Should Close \", shouldClose)\n\t\tinputItems = []inputItem{}\n\n\t\t//Closes session at the end\n\t\tif shouldClose {\n\t\t\tcurrentSession = \"\"\n\t\t\toutputItems = outputStruct{}\n\t\t\tconn.Close()\n\t\t\tlog.Println(\"Connection Closed\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "02e2fa0a5e4b03456306327d02be01b0", "score": "0.53398144", "text": "func (rc *ReadCloser) init(r *tar.Reader) error {\n\tdefer rc.Close()\n\n\trc.File = make([]*tar.Header, 0, 10)\n\tfor {\n\t\th, err := r.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trc.File = append(rc.File, h)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "954c937e82115a8bc30b27c23b5e6836", "score": "0.53321236", "text": "func (c readCloser) Read(p []byte) (n int, err error) {\n\treturn c.b.Read(p)\n}", "title": "" }, { "docid": "bf0356eb0799d451119cc2c10d385134", "score": "0.53259057", "text": "func PeekReadCloser(stream *io.ReadCloser, cpy *[]byte) {\n\t*cpy, _ = ioutil.ReadAll(*stream)\n\t*stream = ioutil.NopCloser(bytes.NewReader(*cpy))\n}", "title": "" }, { "docid": "4d30d711a0aee45ab09311748fe825de", "score": "0.5325389", "text": "func (itr *stringDedupeIterator) Close() error { return itr.input.Close() }", "title": "" }, { "docid": "485ae34ec6f8970ff2bacd434631f853", "score": "0.53247654", "text": "func (rc *ReadCloser) Close() error {\n\treturn rc.pr.Close()\n}", "title": "" }, { "docid": "372ca2fb92c1ad8698969c875244a07c", "score": "0.53220564", "text": "func (fi fileRef) Close() error { return fi.Closer.Close() }", "title": "" }, { "docid": "353b62d10c00b8af2eec2bca0cc956f7", "score": "0.53143823", "text": "func (r respBodyCloser) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "e11ef3c515fec14952436987061fa9c0", "score": "0.5310626", "text": "func (p *cancelReadCloser) Read(buf []byte) (n int, err error) {\n\treturn p.pR.Read(buf)\n}", "title": "" }, { "docid": "643f41ea58700ec116be807ce57cf244", "score": "0.53021425", "text": "func read(buf []byte, wrap Wrapable, r io.Reader) (n int, err error) {\n\tb, err := wrap.Decode(buf)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn r.Read(b)\n}", "title": "" }, { "docid": "e8029fd9580da5dedb12824c11fa4a82", "score": "0.5279996", "text": "func (rc *ReadCloser) Close() error {\n\treturn rc.Closer.Close()\n}", "title": "" }, { "docid": "fb46ae3e54f8e72ede14b8eb3b53b30b", "score": "0.52774066", "text": "func (this *node) read(reader io.ReadSeeker, offset int64) error {\n\tif _, err := reader.Seek(offset, os.SEEK_SET); err != nil {\n\t\treturn err\n\t}\n\tif _, err := io.ReadFull(reader, this.raw); err != nil {\n\t\treturn err\n\t}\n\tthis.count = int(bo.Uint32(this.raw[4:]))\n\tthis.offset = offset\n\tthis.datas = this.raw[8 : 8+int(this.count)*this.size]\n\treturn nil\n}", "title": "" }, { "docid": "240f6685dc285f20f0a06a69019e755f", "score": "0.5274009", "text": "func (c *cstor) readHeader() error {\n\tbuf := make([]byte, 1024)\n\tvar (\n\t\terr error\n\t\tn int\n\t\tstr string\n\t\tbuffer bytes.Buffer\n\t)\n\t// collect all the chunks ending with EOF (\"\\r\\n\").\n\tfor {\n\t\tn, err = c.conn.Read(buf[:])\n\t\tif err != nil {\n\t\t\tklog.Error(\"Error in reading response, error : \", err)\n\t\t\treturn err\n\t\t}\n\t\t// apend the chunks into str\n\t\tbuffer.WriteString(string(buf[0:n]))\n\t\tstr = buffer.String()\n\t\tif strings.HasPrefix(str, HeaderPrefix) && strings.HasSuffix(str, EOF) {\n\t\t\tbreak\n\t\t}\n\t}\n\tklog.V(2).Infof(\"Connection established with istgt, got header: %#v\", str)\n\treturn nil\n}", "title": "" }, { "docid": "c395847326cdffd5fe33d9eea78a06a8", "score": "0.526376", "text": "func (nc ReadCloserImpl) Close() error {\n\tif nc.closer != nil {\n\t\treturn nc.closer()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f650f30a477e103829e8813ae538e350", "score": "0.5257269", "text": "func (r SeekableBufferedReader) Close() error {\n\treturn r.reader.Close()\n}", "title": "" }, { "docid": "28c90eff3945fe1950fe16bacf99645f", "score": "0.52420425", "text": "func (i *repositoryIterator) Close() {}", "title": "" }, { "docid": "d88f14e399450d3353c1156aceeb8ac2", "score": "0.5237216", "text": "func (r *Reader) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "1e3ad2ec732307deffd44aebc9cb5622", "score": "0.5231383", "text": "func ExampleRead() {}", "title": "" }, { "docid": "1f7f3bab447d0b4aa35dfb04b98fe725", "score": "0.5229955", "text": "func (rc *ReadCloser) Close() error {\n\treturn rc.f.Close()\n}", "title": "" }, { "docid": "e5ba24f926e6fe0119e51256b43d088f", "score": "0.52238894", "text": "func (m *multiReadCloser) Read(p []byte) (int, error) {\n\treturn m.reader.Read(p)\n}", "title": "" }, { "docid": "dc0b487671dcd5e2dd9cd7b2433de74f", "score": "0.5212286", "text": "func (itr *stringStreamStringIterator) Close() error { return itr.input.Close() }", "title": "" }, { "docid": "23c9460c316c8b72258a31479cee392d", "score": "0.5197873", "text": "func (tr *GthReader) Close() {\n\ttr.reader.Close()\n\ttr.writer.Close()\n}", "title": "" }, { "docid": "93ef1cd830e1e16f4e21df317f5bf4eb", "score": "0.5186598", "text": "func (r *Response) readAndCloseResponseBody() ([]byte, error) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\treturn body, err\n}", "title": "" }, { "docid": "dc60c6ee5ad3819d846b8a0db6fee0bb", "score": "0.51860976", "text": "func (h *hdr) Close() error { return h.wc.Close() }", "title": "" }, { "docid": "22500bc7a4eefe4f0d59065e78499963", "score": "0.51775354", "text": "func main() {\n\tb := make([]byte, 5)\n\tr := ByteReader(35)\n\tReadAndClose(r, b)\n\tfmt.Println(b)\n\t// OUTPUT: [35 35 35 35 35]\n}", "title": "" }, { "docid": "c5322066f61c91b23a9ae9cf8185128b", "score": "0.51762164", "text": "func (c *connection) readPump(client *Client) {\n applog.Debugf(\"Started readPump\")\n defer func() {\n world.unregister <- client\n c.ws.Close()\n }()\n c.ws.SetReadLimit(maxMessageSize)\n c.ws.SetReadDeadline(time.Now().Add(readWait))\n c.readTemplate(func (r io.Reader) (bool, error) {\n message, err := ioutil.ReadAll(r)\n if err == nil {\n client.incoming <- message\n }\n return false, err\n })\n}", "title": "" }, { "docid": "e169cce7a6d8950c9679700586933b4f", "score": "0.517602", "text": "func (t *TeeReadCloser) Close() error {\n\terr1 := t.r.Close()\n\tt.w.Close()\n\treturn err1\n}", "title": "" }, { "docid": "fb93466711e99af103bd61f3889933e1", "score": "0.51759887", "text": "func readIo(t *testing.T, reader io.Reader) (seq uint64, data []byte) {\n\tbuf := make([]byte, ioHeaderLength)\n\tn, err := reader.Read(buf)\n\tassert.Nil(t, err)\n\tassert.Equal(t, ioHeaderLength, n)\n\n\tseq = binary.BigEndian.Uint64(buf[:8])\n\tlength := binary.BigEndian.Uint32(buf[8:12]) - ioHeaderLength\n\tif length == 0 {\n\t\treturn\n\t}\n\n\treceived := 0\n\tneed := int(length)\n\tdata = make([]byte, need)\n\tfor received < need {\n\t\tn, err := reader.Read(data[received:need])\n\t\tassert.Nil(t, err)\n\n\t\treceived += n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8def2b878057a13860122a09c673bd58", "score": "0.5175839", "text": "func (r *ReadCloserWrapper) Close() error {\n\treturn r.closer()\n}", "title": "" }, { "docid": "5416945b92fc8a31a1244ecb7d33e241", "score": "0.5172999", "text": "func (c *Content) Reader() io.Reader {\n return bytes.NewBuffer(c.data)\n}", "title": "" }, { "docid": "17b050ebcc96ae6a326a03cdf0600f2f", "score": "0.5167987", "text": "func (self *Client) body(res *http.Response) (io.ReadCloser, error) {\n var body io.ReadCloser\n var err error\n\n if res.Header.Get(\"Content-Encoding\") == \"gzip\" {\n if body, err = gzip.NewReader(res.Body); err != nil {\n return nil, err\n }\n } else {\n body = res.Body\n }\n\n return body, nil\n}", "title": "" }, { "docid": "d160be6cf672335e6e9e25c2466f8d7d", "score": "0.5166582", "text": "func (c *Conn) CloseRead() error { return c.Shutdown(unix.SHUT_RD) }", "title": "" }, { "docid": "e17866fbc4c745495f77413e6e858cac", "score": "0.5165798", "text": "func (h *header) read(r io.Reader) error {\n\tvar buf [headerSize]byte\n\n\tif _, err := io.ReadFull(r, buf[:]); err != nil {\n\t\treturn xerrors.Errorf(\"failed to read the header: %w\", err)\n\t}\n\n\tif err := h.UnmarshalBinary(buf[:]); err != nil {\n\t\treturn xerrors.Errorf(\"failed to unmarshal header: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b5b3efcb7e44ce3fd293b71fb8803ae", "score": "0.5165513", "text": "func (r *ReadCloser) Close() error {\n\treturn r.f.Close()\n}", "title": "" }, { "docid": "4890f67d9a1b1f086bd0ccdfa3376b89", "score": "0.5162814", "text": "func (t *Transport) readLoop() {\n\tvar header uint32\n\tfor {\n\t\tif err := binary.Read(t.conn, binary.BigEndian, &header); err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err := io.CopyN(ioutil.Discard, t.conn, int64(header))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f1c0c073e2b39b3c2071f33ce6d5314d", "score": "0.51589936", "text": "func main() {\n\tc := Closer{\n\t\tReader: strings.NewReader(\"Hello, World!\"),\n\t}\n\tif err := read(c); err != nil {\n\t\tfmt.Println(err)\n\t}\n\n}", "title": "" }, { "docid": "832679f15a96e3e40ed24a16ac98952d", "score": "0.515549", "text": "func readWithRead() {\n\tfmt.Println(\"---Using MyType.Read\")\n\tm := NewMyType()\n\tfmt.Fprintf(&m, \"Hello from %s\", \"MyNewType\")\n\t//\n\tbuffer := bytes.Buffer{}\n\tbuf := make([]byte, 10)\n\tfor true {\n\t\tn, err := m.Read(buf)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tbuffer.Write(buf[:n])\n\t}\n\tfmt.Printf(\"Read data from buffer: %s\\n\", buffer.Bytes())\n\tfmt.Println()\n}", "title": "" }, { "docid": "998e57bd6ff5b902a032b896b984f856", "score": "0.51546717", "text": "func (c *Client) reader() {\n\tfor {\n\t\tselect {\n\t\tcase next := <-c.decodeCh:\n\t\t\t// Set the read deadline\n\t\t\tc.conn.SetReadDeadline(time.Now().Add(c.config.Timeout))\n\n\t\t\t// Decode the next command\n\t\t\terr := next.Command().Decode(c.bufR)\n\t\t\tnext.respond(err)\n\n\t\t\t// Shutdown if there was an error\n\t\t\tif err != nil {\n\t\t\t\tc.Close()\n\t\t\t\tgoto DRAIN\n\t\t\t}\n\n\t\tcase <-c.closedCh:\n\t\t\tgoto DRAIN\n\t\t}\n\t}\n\n\t// After the main loop, drain the decode channel\nDRAIN:\n\tfor {\n\t\tselect {\n\t\tcase next := <-c.decodeCh:\n\t\t\tnext.respond(ErrClientClosed)\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b7d6eb4a7ca7d7db315058da76bcc44", "score": "0.5150444", "text": "func (itr *integerStreamStringIterator) Close() error { return itr.input.Close() }", "title": "" }, { "docid": "ed87de9c8b51adbcee09226c96994f9f", "score": "0.51489294", "text": "func (itr *bufStringIterator) Close() error { return itr.itr.Close() }", "title": "" }, { "docid": "4decf5caca318472b83f9138fe64e125", "score": "0.51455504", "text": "func (r *Reader) Close() {\n\tclose(r.stop)\n\n\t_ = r.client.Close()\n}", "title": "" }, { "docid": "38446a3a51c6bb2d493ae9de94b895b8", "score": "0.5142271", "text": "func copyBody(in io.ReadCloser, cpy *bytes.Buffer) io.ReadCloser {\n\tif _, err := cpy.ReadFrom(in); err != nil {\n\t\tpanic(err)\n\t}\n\n\tin.Close()\n\n\treturn ioutil.NopCloser(bytes.NewBuffer(cpy.Bytes()))\n}", "title": "" }, { "docid": "578e959065baeb749e49c735ff5bd5f9", "score": "0.5140263", "text": "func (or *ObjectReader) Read(b []byte) (int, error) {\n\tor.mutex.Lock()\n\tdefer or.mutex.Unlock()\n\n\tif or.closed {\n\t\treturn 0, os.ErrClosed\n\t} else if or.offset >= or.object.Size {\n\t\treturn 0, io.EOF\n\t}\n\n\tif or.readCloser == nil {\n\t\tpipeReader, pipeWriter := io.Pipe()\n\t\tgo func() (err error) {\n\t\t\tdefer func() {\n\t\t\t\tpipeWriter.CloseWithError(err)\n\t\t\t}()\n\n\t\t\toffset := or.offset\n\t\t\tfor _, content := range or.object.contents {\n\t\t\t\tif content.Size > offset {\n\t\t\t\t\tcr, err := content.newReader(\n\t\t\t\t\t\tor.ctx,\n\t\t\t\t\t\tor.object.tgs,\n\t\t\t\t\t\tor.object.aead,\n\t\t\t\t\t\toffset,\n\t\t\t\t\t)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\t_, err = io.Copy(pipeWriter, cr)\n\t\t\t\t\tcr.Close()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\toffset = 0\n\t\t\t\t} else {\n\t\t\t\t\toffset -= content.Size\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}()\n\n\t\tor.readCloser = pipeReader\n\t}\n\n\tn, err := or.readCloser.Read(b)\n\tor.offset += int64(n)\n\n\treturn n, err\n}", "title": "" }, { "docid": "5b315e98cce6fa8d331dcbd006aa9db4", "score": "0.51397514", "text": "func (a ReadAutoCloser) Read(buf []byte) (n int, err error) {\n\tif a.r == nil {\n\t\treturn 0, io.EOF\n\t}\n\tn, err = a.r.Read(buf)\n\tif err == io.EOF {\n\t\ta.Close()\n\t}\n\treturn n, err\n}", "title": "" }, { "docid": "4ba28623df092d404cdf8d84e0359fa0", "score": "0.5137619", "text": "func (v *VerifiedReadCloser) Close() error {\n\t// Consume any remaining bytes to make sure that we've actually read to the\n\t// end of the stream. VerifiedReadCloser.Read will not read past\n\t// ExpectedSize+1, so we don't need to add a limit here.\n\tif n, err := system.Copy(ioutil.Discard, v); err != nil {\n\t\treturn errors.Wrap(err, \"consume remaining unverified stream\")\n\t} else if n != 0 {\n\t\t// If there's trailing bytes being discarded at this point, that\n\t\t// indicates whatever you used to generate this blob is adding trailing\n\t\t// gunk.\n\t\tlog.Infof(\"verified reader: %d bytes of trailing data discarded from %s\", n, v.sourceName())\n\t}\n\t// Piped to underlying close.\n\terr := v.Reader.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Are we going to be a noop?\n\tif v.isNoop() {\n\t\treturn err\n\t}\n\t// Make sure we're ready.\n\tv.init()\n\t// Verify the state.\n\treturn v.verify(nil)\n}", "title": "" }, { "docid": "36d73dc3eeb8eccdf21fcc67737008c7", "score": "0.5137042", "text": "func (r *Reader) Close() error {\n\n if r.ReadCloser != nil {\n err := r.ReadCloser.Close()\n if err != nil {\n return errors.Wrap(err, \"Error closing read closer.\")\n }\n }\n\n if r.File != nil {\n err := r.File.Close()\n if err != nil {\n return errors.Wrap(err, \"Error closing file.\")\n }\n }\n\n return nil\n}", "title": "" }, { "docid": "3d2d2882edc7c27b35e7a9b3dbaa64ec", "score": "0.51359195", "text": "func (z *Reader) Reset(r io.Reader) error {}", "title": "" }, { "docid": "81fe1fde010120251d201d162c0d9496", "score": "0.51357234", "text": "func (r *readCloserMock) Read(p []byte) (n int, err error) {\n\treturn r.readMock(p)\n}", "title": "" }, { "docid": "611d7ee36c90810f36123d30454bf45f", "score": "0.51331156", "text": "func (o *Object) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {\n\tLog.Debugf(\"Read: Requested %d bytes\", req.Size)\n\n\tvar err error\n\tresp.Data, err = o.fromChunks(ctx, req.Offset, int64(req.Size))\n\n\tLog.Debugf(\"Read: Returned %d bytes\", len(resp.Data))\n\treturn toFuseErr(ctx, err)\n}", "title": "" }, { "docid": "4cdba6d259b5a4f59a8d825f2a6956be", "score": "0.5120289", "text": "func read(r io.Reader, i int) ([]byte, error) {\n\tout := make([]byte, i)\n\tin := out[:]\n\tfor i > 0 {\n\t\tif n, err := r.Read(in); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tin = in[n:]\n\t\t\ti -= n\n\t\t}\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "c49effca87cac56247d1405e17ef04a6", "score": "0.51199645", "text": "func (a ReadAutoCloser) Close() error {\n\tif a.r == nil {\n\t\treturn nil\n\t}\n\treturn a.r.(io.Closer).Close()\n}", "title": "" }, { "docid": "7ee4a305ffb3169445a5da6d52d37656", "score": "0.5117274", "text": "func getBody(url string) (io.ReadCloser, error) {\n\tlog.Printf(\"Connecting to %s..\\n\", url)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn &DummyReadCloser{}, err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn &DummyReadCloser{}, errors.New(\n\t\t\tfmt.Sprintf(\"Failed to retrieve %s: %d\", url, resp.Status))\n\t}\n\treturn resp.Body, nil\n}", "title": "" }, { "docid": "53573a30f8ce0933b85fe2462f3af21f", "score": "0.51166177", "text": "func (itr *stringStreamBooleanIterator) Close() error { return itr.input.Close() }", "title": "" }, { "docid": "20491c7d679cdbae6869b81bf92dcb09", "score": "0.51158535", "text": "func (dio *dockerio) Read(container, path string) (io.ReadCloser, error) {\n\tctx := context.Background()\n\n\treader, _, err := dio.cli.CopyFromContainer(ctx, container, path)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"couldn't open stream: %v\", err)\n\t}\n\n\ttr := tar.NewReader(reader)\n\tif _, err = tr.Next(); err != nil {\n\t\treturn nil, xerrors.Errorf(\"couldn't untar: %v\", err)\n\t}\n\n\treturn ioutil.NopCloser(tr), nil\n}", "title": "" }, { "docid": "7571528f1764db86580e9fe6c00d2c27", "score": "0.5113946", "text": "func (s *StreamTimelapse) readStreamResp() (bytes.Buffer, error) {\n\tvar output bytes.Buffer\n\tfirstRead := true\n\tclen := 0\n\tclient := http.Client{\n\t\tTimeout: 3 * time.Second,\n\t}\n\tresp, err := client.Get(s.Hostname)\n\tif err != nil {\n\t\treturn output, fmt.Errorf(\"unable to open stream: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tfor {\n\t\tbuffer := make([]byte, 1024)\n\t\tn, _ := resp.Body.Read(buffer)\n\t\tif firstRead {\n\t\t\tclen = contentLenght(buffer)\n\t\t\tfirstRead = false\n\t\t}\n\t\toutput.Write(buffer[:n])\n\t\t// reading until content-lenght is reached\n\t\tif output.Len() > clen {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "91c8719ba63f2890ed21fede2e8bb784", "score": "0.51114273", "text": "func (r *RpcDataPackage) ReadIO(rw io.Reader) error {\n\tif rw == nil {\n\t\treturn errors.New(\"bytes is nil\")\n\t}\n\n\tdoInit(r)\n\n\t// read Head\n\thead := make([]byte, SIZE)\n\n\t_, err := io.ReadFull(rw, head)\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\treturn errIgnoreErr\n\t\t}\n\t\tlog.Println(\"Read head error\", err)\n\t\t// only to close current connection\n\t\treturn err\n\t}\n\n\t// unmarshal Head message\n\tr.Head.Read(head)\n\tif strings.Compare(string(r.Head.MagicCode), MAGIC_CODE) != 0 {\n\t\treturn fmt.Errorf(\"invalid magic code '%v'\", string(r.Head.MagicCode))\n\t}\n\n\t// get RPC Meta size\n\tmetaSize := r.Head.GetMetaSize()\n\ttotalSize := r.Head.GetMessageSize()\n\tif totalSize <= 0 {\n\t\t// maybe heart beat data message, so do ignore here\n\t\treturn errIgnoreErr\n\t}\n\n\t// read left\n\tleftSize := totalSize\n\tbody := make([]byte, leftSize)\n\n\t_, err = io.ReadFull(rw, body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Read body error %w \", err)\n\t}\n\n\tproto.Unmarshal(body[0:metaSize], r.Meta)\n\n\tattachmentSize := r.Meta.GetAttachmentSize()\n\tdataSize := leftSize - metaSize - attachmentSize\n\n\tdataOffset := metaSize\n\tif dataSize > 0 {\n\t\tdataOffset = dataSize + metaSize\n\t\tr.Data = body[metaSize:dataOffset]\n\n\t\tcompressType := r.GetMeta().GetCompressType()\n\t\tif compressType == COMPRESS_GZIP {\n\t\t\tr.Data, err = GUNZIP(r.Data)\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if compressType == COMPRESS_SNAPPY {\n\t\t\tdst := make([]byte, 1)\n\t\t\tr.Data, err = snappy.Decode(dst, r.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// if need read Attachment\n\tif attachmentSize > 0 {\n\t\tr.Attachment = body[dataOffset:leftSize]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce9ed75481d89197af27ad8789b69713", "score": "0.51031727", "text": "func (itr *stringStreamIntegerIterator) Close() error { return itr.input.Close() }", "title": "" }, { "docid": "fce89698a59e7b58f6ec026f44d367c6", "score": "0.51019746", "text": "func (o *tracingObjClient) Reader(ctx context.Context, name string, offset uint64, size uint64) (io.ReadCloser, error) {\n\tspan, ctx := tracing.AddSpanToAnyExisting(ctx, \"/\"+o.provider+\"/Reader\",\n\t\t\"name\", name,\n\t\t\"offset\", fmt.Sprintf(\"%d\", offset),\n\t\t\"size\", fmt.Sprintf(\"%d\", size))\n\tdefer tracing.FinishAnySpan(span)\n\treturn o.Client.Reader(ctx, name, offset, size)\n}", "title": "" }, { "docid": "5952869b1052fe9ef6c38e672f773599", "score": "0.51006943", "text": "func (f *Reader) Close() error {\n\tif r, ok := f.r.(io.Closer); ok {\n\t\treturn r.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b89084bc6608b671f4b81627719d2de7", "score": "0.5095608", "text": "func (r *reader) Close() {\n\tclose(r.i)\n}", "title": "" }, { "docid": "93d49d924554c776e0a25fe01ac315ae", "score": "0.50950813", "text": "func (w *readCloserWrapper) Close() error {\n\tswitch t := w.Reader.(type) {\n\tcase io.Closer:\n\t\treturn t.Close()\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "435659efdd1a16db799217a7e5d5fcb1", "score": "0.5093194", "text": "func (fh *FileHandle) readFromStream(offset int64, buf []byte) (bytesRead int, err error) {\n\tif uint64(offset) >= fh.inode.Attributes.Size {\n\t\t// nothing to read\n\t\treturn\n\t}\n\n\tif fh.reader == nil {\n\t\tif fh.inode.ErrContents == \"\" {\n\t\t\tsd, _ := time.ParseDuration(\"30s\")\n\t\t\texp := fh.inode.Attributes.ExpirationDate\n\t\t\tif !exp.IsZero() {\n\t\t\t\ttwig.Debugf(\"seems like we have a url that expires: %s\", exp)\n\t\t\t\tif time.Until(exp) < sd {\n\t\t\t\t\ttwig.Debug(\"url is expired\")\n\t\t\t\t\t// Time to hot swap urls!\n\t\t\t\t\tlink, expiration, err := newURL(fh.inode)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t// fh.inode.logFuse(\"< readFromStream error\", 0, err)\n\t\t\t\t\t\treturn 0, syscall.EACCES\n\t\t\t\t\t}\n\t\t\t\t\tfh.inode.Link = link\n\t\t\t\t\tfh.inode.Attributes.ExpirationDate = expiration\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbytes := \"\"\n\t\t\tif offset != 0 {\n\t\t\t\tbytes = fmt.Sprintf(\"bytes=%v-\", offset)\n\t\t\t}\n\n\t\t\tresp, err := awsutil.GetObjectRange(fh.inode.Link, bytes)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\n\t\t\tfh.reader = resp.Body\n\t\t} else {\n\t\t\t// This is an error.log file, need to read from its error contents.\n\t\t\tfh.reader = ioutil.NopCloser(bytes.NewBufferString(fh.inode.ErrContents))\n\t\t}\n\t}\n\n\tbytesRead, err = fh.reader.Read(buf)\n\tif err != nil {\n\t\ttwig.Debug(\"error reading file\")\n\t\ttwig.Debug(err.Error())\n\t\tif err != io.EOF {\n\t\t\ttwig.Debugf(\"readFromStream error: %s\", err.Error())\n\t\t\t// fh.inode.logFuse(\"< readFromStream error\", bytesRead, err)\n\t\t}\n\t\t// always retry error on read\n\t\tfh.reader.Close()\n\t\tfh.reader = nil\n\t\terr = nil\n\t}\n\n\treturn\n}", "title": "" } ]
abad29c2dd020461f0270ad771781769
NewFcNeighbor instantiates a new FcNeighbor object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed
[ { "docid": "cafc14880d53b183341bc111f2be9cfe", "score": "0.69994324", "text": "func NewFcNeighbor(classId string, objectType string) *FcNeighbor {\n\tthis := FcNeighbor{}\n\tthis.ClassId = classId\n\tthis.ObjectType = objectType\n\treturn &this\n}", "title": "" } ]
[ { "docid": "b18703ae9f845aca1277db5a3f09a4d5", "score": "0.6755319", "text": "func NewFcNeighborWithDefaults() *FcNeighbor {\n\tthis := FcNeighbor{}\n\tvar classId string = \"fc.Neighbor\"\n\tthis.ClassId = classId\n\tvar objectType string = \"fc.Neighbor\"\n\tthis.ObjectType = objectType\n\treturn &this\n}", "title": "" }, { "docid": "900d2dcb8198d1c2ac83770e534a74e4", "score": "0.59789145", "text": "func (t *NetworkInstance_Protocol_Bgp) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "900d2dcb8198d1c2ac83770e534a74e4", "score": "0.59786785", "text": "func (t *NetworkInstance_Protocol_Bgp) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "900d2dcb8198d1c2ac83770e534a74e4", "score": "0.5978479", "text": "func (t *NetworkInstance_Protocol_Bgp) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "900d2dcb8198d1c2ac83770e534a74e4", "score": "0.5978479", "text": "func (t *NetworkInstance_Protocol_Bgp) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "6dfc6f8608cf32e82062f2ed8671012c", "score": "0.59307116", "text": "func (t *NetworkInstance_Protocol_Pim_Interface) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Pim_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Pim_Interface_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Pim_Interface_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "6dfc6f8608cf32e82062f2ed8671012c", "score": "0.59302086", "text": "func (t *NetworkInstance_Protocol_Pim_Interface) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Pim_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Pim_Interface_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Pim_Interface_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "6dfc6f8608cf32e82062f2ed8671012c", "score": "0.5929294", "text": "func (t *NetworkInstance_Protocol_Pim_Interface) NewNeighbor(NeighborAddress string) (*NetworkInstance_Protocol_Pim_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Pim_Interface_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Pim_Interface_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "c01c333cae4a7c52f499c551b13475fa", "score": "0.58839643", "text": "func (t *Bgp) NewNeighbor(NeighborAddress string) (*Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "c01c333cae4a7c52f499c551b13475fa", "score": "0.5882959", "text": "func (t *Bgp) NewNeighbor(NeighborAddress string) (*Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "c01c333cae4a7c52f499c551b13475fa", "score": "0.5882959", "text": "func (t *Bgp) NewNeighbor(NeighborAddress string) (*Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "c01c333cae4a7c52f499c551b13475fa", "score": "0.5882959", "text": "func (t *Bgp) NewNeighbor(NeighborAddress string) (*Bgp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Bgp_Neighbor)\n\t}\n\n\tkey := NeighborAddress\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Bgp_Neighbor{\n\t\tNeighborAddress: &NeighborAddress,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "614502c1e974b64af3441902d729ed2e", "score": "0.57108253", "text": "func (t *Interface_RoutedVlan_Ipv6) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "614502c1e974b64af3441902d729ed2e", "score": "0.57108253", "text": "func (t *Interface_RoutedVlan_Ipv6) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "614502c1e974b64af3441902d729ed2e", "score": "0.5709711", "text": "func (t *Interface_RoutedVlan_Ipv6) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "614502c1e974b64af3441902d729ed2e", "score": "0.5709489", "text": "func (t *Interface_RoutedVlan_Ipv6) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "65aa05dcdd30fa82e5343f365ef40c3f", "score": "0.56645995", "text": "func (t *Interface_Subinterface_Ipv6) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "65aa05dcdd30fa82e5343f365ef40c3f", "score": "0.5663703", "text": "func (t *Interface_Subinterface_Ipv6) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "65aa05dcdd30fa82e5343f365ef40c3f", "score": "0.5663703", "text": "func (t *Interface_Subinterface_Ipv6) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "65aa05dcdd30fa82e5343f365ef40c3f", "score": "0.56633127", "text": "func (t *Interface_Subinterface_Ipv6) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv6_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv6_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv6_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "9fe9ad04ead8fc971f8fd440113d0686", "score": "0.56556237", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Interface) NewNeighbor(RouterId string) (*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor)\n\t}\n\n\tkey := RouterId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor{\n\t\tRouterId: &RouterId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "9fe9ad04ead8fc971f8fd440113d0686", "score": "0.5655481", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Interface) NewNeighbor(RouterId string) (*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor)\n\t}\n\n\tkey := RouterId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor{\n\t\tRouterId: &RouterId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "9fe9ad04ead8fc971f8fd440113d0686", "score": "0.5655481", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Interface) NewNeighbor(RouterId string) (*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor)\n\t}\n\n\tkey := RouterId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor{\n\t\tRouterId: &RouterId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "9fe9ad04ead8fc971f8fd440113d0686", "score": "0.5655481", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Interface) NewNeighbor(RouterId string) (*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor)\n\t}\n\n\tkey := RouterId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Ospfv2_Area_Interface_Neighbor{\n\t\tRouterId: &RouterId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "2e4b83a0276f5ec1e999453ee5b54207", "score": "0.56430554", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "2e4b83a0276f5ec1e999453ee5b54207", "score": "0.56425536", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "2e4b83a0276f5ec1e999453ee5b54207", "score": "0.5642543", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "2e4b83a0276f5ec1e999453ee5b54207", "score": "0.5642494", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3a9658110cd4d054f07fb10382a84925", "score": "0.5580503", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3a9658110cd4d054f07fb10382a84925", "score": "0.5580503", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3a9658110cd4d054f07fb10382a84925", "score": "0.5580503", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "e88c3c950afac69918ae50bce15ce226", "score": "0.5553273", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "e88c3c950afac69918ae50bce15ce226", "score": "0.5553273", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "e88c3c950afac69918ae50bce15ce226", "score": "0.5553273", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "e88c3c950afac69918ae50bce15ce226", "score": "0.5553273", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "4bd6d804d78072ec9d1cab8d48d5dfa1", "score": "0.55348265", "text": "func NewNeighborhood() *Neighborhood {\n\treturn &Neighborhood{\n\t\topen: make(map[interface{}]Avatar),\n\t}\n}", "title": "" }, { "docid": "82de7d1941f6960928a2ecfd511a0e88", "score": "0.5530176", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "82de7d1941f6960928a2ecfd511a0e88", "score": "0.55285835", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "82de7d1941f6960928a2ecfd511a0e88", "score": "0.55271274", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "82de7d1941f6960928a2ecfd511a0e88", "score": "0.55271274", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewNeighbor(Address string) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor)\n\t}\n\n\tkey := Address\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Neighbor{\n\t\tAddress: &Address,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "a7f68d065fb5734e2416f4defc2bbc12", "score": "0.54737425", "text": "func (t *Interface_Subinterface_Ipv4) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "a7f68d065fb5734e2416f4defc2bbc12", "score": "0.54721314", "text": "func (t *Interface_Subinterface_Ipv4) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "a7f68d065fb5734e2416f4defc2bbc12", "score": "0.54721314", "text": "func (t *Interface_Subinterface_Ipv4) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "a7f68d065fb5734e2416f4defc2bbc12", "score": "0.54721314", "text": "func (t *Interface_Subinterface_Ipv4) NewNeighbor(Ip string) (*Interface_Subinterface_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_Subinterface_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_Subinterface_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3c7be7607c8b6a1a843380855aa0c687", "score": "0.5469134", "text": "func (t *Interface_RoutedVlan_Ipv4) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3c7be7607c8b6a1a843380855aa0c687", "score": "0.5469134", "text": "func (t *Interface_RoutedVlan_Ipv4) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3c7be7607c8b6a1a843380855aa0c687", "score": "0.5469134", "text": "func (t *Interface_RoutedVlan_Ipv4) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "3c7be7607c8b6a1a843380855aa0c687", "score": "0.5468347", "text": "func (t *Interface_RoutedVlan_Ipv4) NewNeighbor(Ip string) (*Interface_RoutedVlan_Ipv4_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Interface_RoutedVlan_Ipv4_Neighbor)\n\t}\n\n\tkey := Ip\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Interface_RoutedVlan_Ipv4_Neighbor{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "f8320ecf197cda088604c59af988dcbd", "score": "0.5373916", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "f8320ecf197cda088604c59af988dcbd", "score": "0.5372209", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "f8320ecf197cda088604c59af988dcbd", "score": "0.5372209", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "f8320ecf197cda088604c59af988dcbd", "score": "0.5371807", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "d9a4d70a10d2e7dcd53e61172507371d", "score": "0.5367737", "text": "func (t *Lldp_Interface) NewNeighbor(Id string) (*Lldp_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Lldp_Interface_Neighbor)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Lldp_Interface_Neighbor{\n\t\tId: &Id,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "d9a4d70a10d2e7dcd53e61172507371d", "score": "0.5367527", "text": "func (t *Lldp_Interface) NewNeighbor(Id string) (*Lldp_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Lldp_Interface_Neighbor)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Lldp_Interface_Neighbor{\n\t\tId: &Id,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "d9a4d70a10d2e7dcd53e61172507371d", "score": "0.5367527", "text": "func (t *Lldp_Interface) NewNeighbor(Id string) (*Lldp_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Lldp_Interface_Neighbor)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Lldp_Interface_Neighbor{\n\t\tId: &Id,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "d9a4d70a10d2e7dcd53e61172507371d", "score": "0.5367527", "text": "func (t *Lldp_Interface) NewNeighbor(Id string) (*Lldp_Interface_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*Lldp_Interface_Neighbor)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &Lldp_Interface_Neighbor{\n\t\tId: &Id,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "9b7c92ca9413edb58b7cf7872ced915b", "score": "0.5357766", "text": "func NewNeighbors() (*Neighbors, error) {\n\tt := make(map[string]map[string]NeighborDetails)\n\treturn &Neighbors{\n\t\tInterfaces: t,\n\t}, nil\n\n}", "title": "" }, { "docid": "1f111fc738952d2927b87428f2d14f0a", "score": "0.53032935", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "1f111fc738952d2927b87428f2d14f0a", "score": "0.53032935", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "1f111fc738952d2927b87428f2d14f0a", "score": "0.5300589", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "1f111fc738952d2927b87428f2d14f0a", "score": "0.5300589", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability) NewNeighbor(SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[string]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor)\n\t}\n\n\tkey := SystemId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor{\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "612cc91d8e3f6c5888bdbe956e4ad241", "score": "0.5284745", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_Ldp) NewNeighbor(LsrId string, LabelSpaceId uint16) (*NetworkInstance_Mpls_SignalingProtocols_Ldp_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Mpls_SignalingProtocols_Ldp_Neighbor_Key]*NetworkInstance_Mpls_SignalingProtocols_Ldp_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Mpls_SignalingProtocols_Ldp_Neighbor_Key{\n\t\tLsrId: LsrId,\n\t\tLabelSpaceId: LabelSpaceId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Mpls_SignalingProtocols_Ldp_Neighbor{\n\t\tLsrId: &LsrId,\n\t\tLabelSpaceId: &LabelSpaceId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "58d54b89fe7b817d526653ca7c3a04be", "score": "0.5281036", "text": "func newFact() *fact {\n\tvar f fact\n\tf.op = \"\"\n\tf.value = defaultF\n\tf.isKnown = false\n\tf.fixed = false\n\treturn &f\n}", "title": "" }, { "docid": "b18f46fb9cc3cea385077cc14f994b31", "score": "0.52283275", "text": "func New(opt Options) Codefresh {\n\thost := opt.Host\n\tif host == \"\" {\n\t\thost = defaultHost\n\t}\n\n\treturn &cf{\n\t\tagentID: opt.AgentID,\n\t\thttpClient: opt.HTTPClient,\n\t\thost: host,\n\t\tlogger: opt.Logger,\n\t\ttoken: opt.Token,\n\t\theaders: opt.Headers,\n\t}\n}", "title": "" }, { "docid": "18b1d4c404ae8d4475d48bdbe091e855", "score": "0.52124363", "text": "func (x *fastReflection_Params) New() protoreflect.Message {\n\treturn new(fastReflection_Params)\n}", "title": "" }, { "docid": "10b2a85db8f9378abd105f7bce3d0781", "score": "0.5192876", "text": "func NewDummyNeighbor(user string, similarity float64) Neighbor {\n\tdummy := Neighbor{\n\t\tUser: user,\n\t\tSimilarity: similarity,\n\t\tCommonBookmarks: []Bookmark{},\n\t}\n\treturn dummy\n}", "title": "" }, { "docid": "1defb1a0f32a6a3be0e46a8823b67400", "score": "0.5160708", "text": "func NewNeighborhood() map[uint8]uint8 {\n\treturn map[uint8]uint8{\n\t\t1: 0, // Red\n\t\t2: 0, // Green\n\t\t3: 0, // Blue\n\t}\n}", "title": "" }, { "docid": "ae8ebd172b1492686f898deb727816e1", "score": "0.51211053", "text": "func NewFordFromConfig(other map[string]interface{}) (api.Vehicle, error) {\n\tcc := struct {\n\t\tTitle string\n\t\tCapacity int64\n\t\tUser, Password, VIN string\n\t\tCache time.Duration\n\t}{\n\t\tCache: interval,\n\t}\n\n\tif err := util.DecodeOther(other, &cc); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog := util.NewLogger(\"ford\")\n\n\tv := &Ford{\n\t\tembed: &embed{cc.Title, cc.Capacity},\n\t\tHelper: request.NewHelper(log),\n\t\tuser: cc.User,\n\t\tpassword: cc.Password,\n\t\tvin: strings.ToUpper(cc.VIN),\n\t}\n\n\tv.chargeStateG = provider.NewCached(v.chargeState, cc.Cache).FloatGetter()\n\n\tvar err error\n\tif cc.VIN == \"\" {\n\t\tv.vin, err = findVehicle(v.vehicles())\n\t\tif err == nil {\n\t\t\tlog.DEBUG.Printf(\"found vehicle: %v\", v.vin)\n\t\t}\n\t}\n\n\treturn v, err\n}", "title": "" }, { "docid": "40e41f1a908ad7d5950cd2ebdc09c5cd", "score": "0.5105588", "text": "func New(opts Opts) *Node {\n\tlogger := opts.Log\n\tif opts.Log == nil {\n\t\tlogger = log.Default()\n\t}\n\treturn &Node{\n\t\tlatest: make(map[string]uint64),\n\t\tneighbors: make(map[transport.NeighborPos]neighbor, 3),\n\t\tcdrAddress: opts.CdrAddress,\n\t\taddress: opts.Address,\n\t\tstore: opts.Store,\n\t\ttransport: opts.Transport,\n\t\tpubAddr: opts.PubAddress,\n\t\tcdr: opts.CoordinatorClient,\n\t\tlog: logger,\n\t}\n}", "title": "" }, { "docid": "4c4498e71a102264a9a208b461baea39", "score": "0.5064618", "text": "func (self *OfnetBgp) AddProtoNeighbor(neighborInfo *OfnetProtoNeighborInfo, localas string) error {\n\n\t<-self.start\n\n\tlog.Infof(\"Received AddProtoNeighbor to Add bgp neighbor %v\", neighborInfo.NeighborIP)\n\n//\tvar policyConfig bgpconf.RoutingPolicy\n//\tvar policyConfig *bgpconf.BgpConfigSet\n\tlocalAs, _ := strconv.Atoi(localas)\n\tpeerAs, _ := strconv.Atoi(neighborInfo.As)\n\tp := &bgpconf.Neighbor{}\n\tsetNeighborConfigValues(p)\n\tp.Config.NeighborAddress = neighborInfo.NeighborIP\n\tp.Config.NeighborAddress = neighborInfo.NeighborIP\n\tp.Config.PeerAs = uint32(peerAs)\n\tp.Config.LocalAs = uint32(localAs)\n\t//FIX ME set ipv6 depending on peerip (for v6 BGP)\n\tp.AfiSafis = []bgpconf.AfiSafi{\n\t\tbgpconf.AfiSafi{\n Config: bgpconf.AfiSafiConfig{\n AfiSafiName: \"ipv4-labelled-unicast\",\n },\n },\n\t\t}\n\n\tself.bgpServer.SetBmpConfig([]bgpconf.BmpServer{})\n\n\tself.bgpServer.PeerAdd(*p)\n\t//self.bgpServer.SetRoutingPolicy(policyConfig)\n\t/*pol := bgpconf.ConfigSetToRoutingPolicy(policyConfig)\n\terr1 := self.bgpServer.UpdatePolicy(*pol)\n\tif err1 != nil {\n\t\tlog.Infof(\"failed to set routing policy: %s\", err1)\n\t}\t\n\t*/\n\tepid := self.agent.getEndpointIdByIpVrf(net.ParseIP(neighborInfo.NeighborIP), \"default\")\n\n\n\n\tepreg := &OfnetEndpoint{\n\t\tEndpointID: epid,\n\t\tEndpointType: \"external-bgp\",\n\t\tIpAddr: net.ParseIP(neighborInfo.NeighborIP),\n\t\tIpMask: net.ParseIP(\"255.255.255.255\"),\n\t\tVrf: \"default\", // FIXME set VRF correctly\n\t\tVlan: 1,\n\t\tTimestamp: time.Now(),\n\t}\n\n\t// Install the endpoint in datapath\n\t// First, add the endpoint to local routing table\n\tself.agent.endpointDb[epreg.EndpointID] = epreg\n\terr := self.agent.datapath.AddEndpoint(epreg)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Error adding endpoint: {%+v}. Err: %v\", epreg, err)\n\t\treturn err\n\t}\n\tself.myBgpPeer = neighborInfo.NeighborIP\n\tgo self.sendArp()\n\n\t//Walk through all the localEndpointDb and them to protocol rib\n\tfor _, endpoint := range self.agent.localEndpointDb {\n\t\tpath := &OfnetProtoRouteInfo{\n\t\t\tProtocolType: \"bgp\",\n\t\t\tlocalEpIP: endpoint.IpAddr.String(),\n\t\t\tnextHopIP: self.routerIP,\n\t\t}\n\t\tself.AddLocalProtoRoute(path)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb3736edf5472767049bb25003b5d679", "score": "0.50056654", "text": "func New() *Params {\n var i = make(map[string]int)\n var b = make(map[string]bool)\n var s = make(map[string]string)\n var f = make(map[string]string)\n var n = make(map[string]float64)\n var r = make(map[string]string)\n var c = make(map[string]bool) // boolean fixed\n return &Params{ints:i, bools:b, strs:s, files:f, nums:n, raw:r, fixed:c}\n}", "title": "" }, { "docid": "f6093d681c6ca432432505e1f1e6310d", "score": "0.5005589", "text": "func (d *BgpDescriptor) Create(key string, value *model.BgpConf) (metadata interface{}, err error) {\n\tglobalConf := value.Global\n\tpeersConf := value.Peers\n\n\t/*GLOBAL DESCRIPTOR*/\n\t//Checks if RouterId is a valid IP Address\n\tif net.ParseIP(globalConf.RouterId) == nil {\n\t\td.log.Errorf(\"Invalid IP Address for RouterId = %s\", globalConf.RouterId)\n\t\treturn nil, err\n\t}\n\td.log.Info(\"parsed IP global descriptor\")\n\t//Checks if AS is above 64512 and below 65536\n\tif globalConf.As < 64512 || globalConf.As > 65536 {\n\t\td.log.Errorf(\"Invalid AS Number = %d. AS Number should be above 64512 and below 65536\", globalConf.As)\n\t\treturn nil, err\n\t}\n\td.log.Info(\"parsed AS global descriptor\")\n\t//Checks if ListenPort is -1\n\tif globalConf.ListenPort != -1 {\n\t\td.log.Errorf(\"Invalid ListenPort = %d. ListenPort should be -1\", globalConf.ListenPort)\n\t\treturn nil, err\n\t}\n\td.log.Info(\"parsed ListenPort global descriptor\")\n\td.log.Infof(\"Creating GlobalConf As = %d, RouterId = %s, ListenPort = %d\",\n\t\tglobalConf.As, globalConf.RouterId, globalConf.ListenPort)\n\terr = d.server.StartBgp(context.Background(), &bgpapi.StartBgpRequest{\n\t\tGlobal: &bgpapi.Global{\n\t\t\tAs: globalConf.As,\n\t\t\tRouterId: globalConf.RouterId,\n\t\t\tListenPort: globalConf.ListenPort,\n\t\t},\n\t})\n\n\t/*PEER DESCRIPTOR*/\n\tfor _, nextPeer := range peersConf {\n\t\tif net.ParseIP(nextPeer.NeighborAddress) == nil {\n\t\t\td.log.Errorf(\"Invalid IP Address for NeighborAddress = %s\", nextPeer.NeighborAddress)\n\t\t\treturn nil, err\n\t\t}\n\t\td.log.Debug(\"parsed IP peer descriptor\")\n\t\t//Checks if AS is above 64512 and below 65536\n\t\tif nextPeer.PeerAs < 64512 || nextPeer.PeerAs > 65536 {\n\t\t\td.log.Errorf(\"Invalid AS Number = %d. AS Number should be above 64512 and below 65536\", nextPeer.PeerAs)\n\t\t\treturn nil, err\n\t\t}\n\t\td.log.Debug(\"parsed AS peer descriptor\")\n\t\tn := &bgpapi.Peer{\n\t\t\tConf: &bgpapi.PeerConf{\n\t\t\t\tNeighborAddress: nextPeer.NeighborAddress,\n\t\t\t\tPeerAs: nextPeer.PeerAs,\n\t\t\t},\n\t\t}\n\t\terr = d.server.AddPeer(context.Background(), &bgpapi.AddPeerRequest{\n\t\t\tPeer: n,\n\t\t})\n\t}\n\n\tif err != nil {\n\t\td.log.Errorf(\"Error creating BgpConf = %s\", err)\n\t\treturn nil, err\n\t}\n\td.hasConfig <- true\n\treturn nil, nil\n}", "title": "" }, { "docid": "19ea9aa827ae45e274a00d9c74525c39", "score": "0.49782705", "text": "func (x *fastReflection_Config) New() protoreflect.Message {\n\treturn new(fastReflection_Config)\n}", "title": "" }, { "docid": "c1eadf886d66ab46e13659562d41cc32", "score": "0.49438977", "text": "func new() (c Config) {\n\tc = Config{\n\t\tfile: defaultConfFile,\n\t\tverbose: defaultVerbose,\n\t\tshowVersion: defaultShowVersion,\n\t\thelp: defaultHelp,\n\t\taddr: defaultAddress,\n\t\treadTimeout: defaultReadTimeout,\n\t\twriteTimeout: defaultWriteTimeout,\n\t\tshutdownTimeout: defaultShutdownTimeout,\n\t\troutes: []Route{\n\t\t\tRoute{\n\t\t\t\tpath: \"/hello-world\",\n\t\t\t\turl: \"https://raw.githubusercontent.com/thetangram/hello-world/master/html/index.html\",\n\t\t\t\ttimeout: 5 * time.Second,\n\t\t\t},\n\t\t},\n\t}\n\treturn\n}", "title": "" }, { "docid": "37f4af0b8ff7962711daf33c3e3815b4", "score": "0.49291936", "text": "func NewFLEET(config configuration_pkg.CONFIGURATION) *FLEET_IMPL {\r\n client := new(FLEET_IMPL)\r\n client.config = config\r\n return client\r\n}", "title": "" }, { "docid": "4068154f7f008a4bd41ae12ff7943f51", "score": "0.49244443", "text": "func New(b []byte) (*Finding, error) {\n\tvar f Finding\n\tif err := json.Unmarshal(b, &f.sshBruteForce); err != nil {\n\t\treturn nil, err\n\t}\n\tif f.sshBruteForce.GetJsonPayload().GetDetectionCategory().GetRuleName() != \"\" {\n\t\treturn &f, nil\n\t}\n\tif err := json.Unmarshal(b, &f.sshBruteForceSCC); err != nil {\n\t\treturn nil, err\n\t}\n\tf.UseCSCC = true\n\treturn &f, nil\n}", "title": "" }, { "docid": "207e8709159f0dff1fc87812408972d9", "score": "0.49004835", "text": "func NewFC(input, output int, opts ...FCOpts) *FC {\n\tfc := &FC{\n\t\tInput: input,\n\t\tOutput: output,\n\t\tdtype: g.Float32,\n\t\tinit: g.GlorotU(1.0),\n\t\tuseBias: true,\n\t\tbiasInit: g.Zeroes(),\n\t}\n\tfor _, opt := range opts {\n\t\topt(fc)\n\t}\n\treturn fc\n}", "title": "" }, { "docid": "681bde6ea8a8906d060505ac9718e3c7", "score": "0.4829323", "text": "func newEdge(id, i int, u, v Node, w float64, f EdgeFlags) Edge {\n\treturn &edge{id: id, i: i, u: u, v: v, weight: w, flags: f}\n}", "title": "" }, { "docid": "01ac63ebbea90b3cf1780f81ff2a3ee6", "score": "0.4824339", "text": "func (svr *NDPServer) CreateNeighborInfo(nbrInfo *config.NeighborConfig) {\n\tdebug.Logger.Debug(\"Calling create ipv6 neighgor for global nbrinfo is\", nbrInfo.IpAddr, nbrInfo.MacAddr,\n\t\tnbrInfo.VlanId, nbrInfo.IfIndex)\n\tif net.ParseIP(nbrInfo.IpAddr).IsLinkLocalUnicast() == false {\n\t\t_, err := svr.SwitchPlugin.CreateIPv6Neighbor(nbrInfo.IpAddr, nbrInfo.MacAddr, nbrInfo.VlanId, nbrInfo.IfIndex)\n\t\tif err != nil {\n\t\t\tdebug.Logger.Err(\"create ipv6 global neigbor failed for\", nbrInfo, \"error is\", err)\n\t\t\t// do not enter that neighbor in our neigbor map\n\t\t\treturn\n\t\t}\n\t}\n\tsvr.SendIPv6CreateNotification(nbrInfo.IpAddr, nbrInfo.IfIndex)\n\tsvr.insertNeigborInfo(nbrInfo)\n}", "title": "" }, { "docid": "48bf4e59fc40f46d9e34a662517ed8be", "score": "0.48167002", "text": "func New(name string, kind metric.Kind, opts Options) (*mackerel.GraphDefsParam, error) {\n\tif opts.Unit == \"\" {\n\t\topts.Unit = unitDimensionless\n\t}\n\tif kind == metric.ValueRecorderKind {\n\t\tname = metricname.Join(name, \"max\") // Anything is fine\n\t}\n\tif opts.Name == \"\" {\n\t\topts.Name = metricname.Prefix(name)\n\t}\n\tr := metricname.Join(opts.Name, \"*\")\n\tif !metricname.Match(name, r) {\n\t\treturn nil, errMismatch\n\t}\n\treturn &mackerel.GraphDefsParam{\n\t\tName: opts.Name,\n\t\tDisplayName: opts.Name,\n\t\tUnit: graphUnit(opts.Unit, opts.Kind),\n\t\tMetrics: []*mackerel.GraphDefsMetric{\n\t\t\t{Name: r, DisplayName: metricDisplayName(r)},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "4981a2ff08562576d4a4be52d51ffd64", "score": "0.48097628", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "4981a2ff08562576d4a4be52d51ffd64", "score": "0.48085317", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "4981a2ff08562576d4a4be52d51ffd64", "score": "0.4807091", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "4981a2ff08562576d4a4be52d51ffd64", "score": "0.48066014", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn) NewNeighbor(MtId uint16, SystemId string) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Neighbor == nil {\n\t\tt.Neighbor = make(map[NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor)\n\t}\n\n\tkey := NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Key{\n\t\tMtId: MtId,\n\t\tSystemId: SystemId,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Neighbor[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Neighbor\", key)\n\t}\n\n\tt.Neighbor[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor{\n\t\tMtId: &MtId,\n\t\tSystemId: &SystemId,\n\t}\n\n\treturn t.Neighbor[key], nil\n}", "title": "" }, { "docid": "cf2d65345a42fc75be51106105e75dc7", "score": "0.48051235", "text": "func (c *ForecastConfig) New() *ForecastConfig {\n\tc.IsAutoSend = 0\n\treturn c\n}", "title": "" }, { "docid": "936057b12f5b00d38b5796a0c301c943", "score": "0.4788835", "text": "func (t *NetworkInstance_Protocol_Bgp) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Bgp_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "936057b12f5b00d38b5796a0c301c943", "score": "0.47880158", "text": "func (t *NetworkInstance_Protocol_Bgp) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Bgp_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "936057b12f5b00d38b5796a0c301c943", "score": "0.47876054", "text": "func (t *NetworkInstance_Protocol_Bgp) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Bgp_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "936057b12f5b00d38b5796a0c301c943", "score": "0.47876054", "text": "func (t *NetworkInstance_Protocol_Bgp) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Bgp_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "34a0f31ce5bb9aa70f6bdb89e05b4348", "score": "0.47829694", "text": "func NewVNFDescriptor() *VNFDescriptor {\n\n\treturn &VNFDescriptor{\n\t\tVisible: true,\n\t\tType: \"FIREWALL\",\n\t}\n}", "title": "" }, { "docid": "e4dc98ce8766e2262f11f902c76f1eb0", "score": "0.47789407", "text": "func (t *NetworkInstance_Protocol_Pim_Interface) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Pim_Interface_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e4dc98ce8766e2262f11f902c76f1eb0", "score": "0.47789377", "text": "func (t *NetworkInstance_Protocol_Pim_Interface) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Pim_Interface_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e4dc98ce8766e2262f11f902c76f1eb0", "score": "0.47789377", "text": "func (t *NetworkInstance_Protocol_Pim_Interface) GetOrCreateNeighbor(NeighborAddress string) *NetworkInstance_Protocol_Pim_Interface_Neighbor {\n\n\tkey := NeighborAddress\n\n\tif v, ok := t.Neighbor[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewNeighbor(NeighborAddress)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateNeighbor got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5069d20905e28668a2b2ba66ce94286e", "score": "0.47692168", "text": "func newParameters() Parameters {\n\treturn Parameters{\n\t\tChannelRules: make(map[lnwire.ShortChannelID]*ThresholdRule),\n\t}\n}", "title": "" }, { "docid": "5b9ea3b98fb0bcbb445c61d3b927063a", "score": "0.4765724", "text": "func (x *fastReflection_QueryClassFeeRequest) New() protoreflect.Message {\n\treturn new(fastReflection_QueryClassFeeRequest)\n}", "title": "" }, { "docid": "402a37f8ce807a41c92680d297ae07ba", "score": "0.47546905", "text": "func newHumanParams(fname,lname string, age int) *Human{\n\thuman:= new(Human);\n\thuman.firstName = fname;\n\thuman.lastName = lname;\n\thuman.age = age;\n\treturn human;\n}", "title": "" }, { "docid": "99a24100a3b747620f1d8ff689bd8fc5", "score": "0.47544464", "text": "func New(uid string, ipcon *ipconnection.IPConnection) (NFCRFIDBricklet, error) {\n\tinternalIPCon := ipcon.GetInternalHandle().(IPConnection)\n\tdev, err := NewDevice([3]uint8{2, 0, 0}, uid, &internalIPCon, 0, DeviceIdentifier, DeviceDisplayName)\n\tif err != nil {\n\t\treturn NFCRFIDBricklet{}, err\n\t}\n\tdev.ResponseExpected[FunctionRequestTagID] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionGetTagID] = ResponseExpectedFlagAlwaysTrue\n\tdev.ResponseExpected[FunctionGetState] = ResponseExpectedFlagAlwaysTrue\n\tdev.ResponseExpected[FunctionAuthenticateMifareClassicPage] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionWritePage] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionRequestPage] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionGetPage] = ResponseExpectedFlagAlwaysTrue\n\tdev.ResponseExpected[FunctionGetIdentity] = ResponseExpectedFlagAlwaysTrue\n\treturn NFCRFIDBricklet{dev}, nil\n}", "title": "" }, { "docid": "03971cbea1b75171b3cbe3a75e5c8f23", "score": "0.4751754", "text": "func New(config Config) (node *RaftNode) {\n\n\t// register object type, so as to send via Inbox\n\tgob.Register(AppendEntriesReqEv{})\n\tgob.Register(AppendEntriesRespEv{})\n\tgob.Register(VoteReqEv{})\n\tgob.Register(VoteRespEv{})\n\n\tvar rnode *RaftNode = new(RaftNode) // objectinstance\n\trnode.nodeId = config.Id // node id\n\trnode.eventCh = make(chan interface{}, 10000) //event channel, get append request from here\n\trnode.timeoutCh = make(chan interface{}, 100000) // timeout channel, get timeout events\n\trnode.commitCh = make(chan CommitInfo, 10000) // commit channel, reply to client\n\n\t// State machine instance\n\trnode.Sm = StateMachine{id: rnode.nodeId,\n\t\tleaderId: -1,\n\t\tState: \"FOLLOWER\",\n\t\tcommitIndex: -1,\n\t\tlastApplied: -1}\n\n\trnode.Sm.currentTerm = 0 // strting term with 0\n\trnode.Sm.votedFor = make(map[int]int) // voted to which node for which term\n\trnode.Sm.nextIndex = make([]int64, 6) // next index of others nodes\n\trnode.Sm.matchedIndex = make([]int64, 6) // matched index to others\n\trnode.Sm.voteCount = make([]int, 2) // success or fail vote count\n\trnode.logDirectory = config.LogDir // my log location\n\trnode.peers = Mcluster.Servers[rnode.nodeId].Peers() // peer id list\n\trnode.electionTimeout = config.ElectionTimeout // timeout\n\trnode.heartbeatTimeout = config.HeartbeatTimeout // timeout\n\trnode.nodeTimer = getNewTimer(rnode.electionTimeout) // handle to timer\n\trnode.server = Mcluster.Servers[rnode.nodeId] // server instance\n\trnode.Sm.log, _ = log.Open(rnode.logDirectory) // node's log\n\trnode.Sm.log.RegisterSampleEntry(Entry{}) // register log entry type\n\terr := rnode.Sm.log.Append(Entry{Term: 0, Command: nil}) // Dummy entry added to log's 0th index\n\t_ = err\n\trnode.Sm.commitIndex = 0 // commit index\n\tfor _, j := range rnode.peers {\n\t\trnode.Sm.nextIndex[j] = rnode.Sm.log.GetLastIndex() + 1 // initializa nextIndex to other node\n\t}\n\treturn rnode // return initialized Raftnode\n}", "title": "" }, { "docid": "033c23c13f26292adee07450d358ece1", "score": "0.474831", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor) NewInstance(Id uint64) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Instance == nil {\n\t\tt.Instance = make(map[uint64]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Instance[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Instance\", key)\n\t}\n\n\tt.Instance[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance{\n\t\tId: &Id,\n\t}\n\n\treturn t.Instance[key], nil\n}", "title": "" }, { "docid": "033c23c13f26292adee07450d358ece1", "score": "0.47461554", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor) NewInstance(Id uint64) (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Instance == nil {\n\t\tt.Instance = make(map[uint64]*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Instance[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Instance\", key)\n\t}\n\n\tt.Instance[key] = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance{\n\t\tId: &Id,\n\t}\n\n\treturn t.Instance[key], nil\n}", "title": "" } ]
8a960316cdb477185e8c9fb6532421cf
IsYANGGoStruct ensures that NetworkInstance_Protocol_Bgp_Global_DefaultRouteDistance implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.
[ { "docid": "aad139eda5becaddbcbae9fdc31f50b4", "score": "0.8966417", "text": "func (*NetworkInstance_Protocol_Bgp_Global_DefaultRouteDistance) IsYANGGoStruct() {}", "title": "" } ]
[ { "docid": "f7b9b768681324de90f960931fb3807a", "score": "0.87418133", "text": "func (*Bgp_Global_DefaultRouteDistance) IsYANGGoStruct() {}", "title": "" }, { "docid": "f7b9b768681324de90f960931fb3807a", "score": "0.8741446", "text": "func (*Bgp_Global_DefaultRouteDistance) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd2aacef01de26a860ec5576bea5f434", "score": "0.7598942", "text": "func (*NetworkInstance_Protocol_Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd2aacef01de26a860ec5576bea5f434", "score": "0.7598942", "text": "func (*NetworkInstance_Protocol_Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "2db7b1e77677998261b3d0aad06c2953", "score": "0.7342779", "text": "func (*Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "2db7b1e77677998261b3d0aad06c2953", "score": "0.7342779", "text": "func (*Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "e3792e21069b6cdb043162c8a741e423", "score": "0.7342736", "text": "func (*Bgp_Neighbor_LoggingOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "e3792e21069b6cdb043162c8a741e423", "score": "0.7341613", "text": "func (*Bgp_Neighbor_LoggingOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "b21461e0a39318979fd92c7828e2624c", "score": "0.7327163", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Subtlv_TeDefaultMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "cf642a56ca997adeb959c5612e1666ce", "score": "0.7327084", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_TeDefaultMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "ff3a0d73fa5fe1496ae71b96959cbfad", "score": "0.72915226", "text": "func (*NetworkInstance_RouteLimit) IsYANGGoStruct() {}", "title": "" }, { "docid": "c87aab6d942a9f8b8a063ba63443b5f4", "score": "0.727226", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_LoggingOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "c87aab6d942a9f8b8a063ba63443b5f4", "score": "0.72693354", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_LoggingOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "ab9b8eab9084aa46267f06f86a8eb81a", "score": "0.7250639", "text": "func (*NetworkInstance_Protocol_Pim_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e7d8589e09bd25ada04518c2d99684a", "score": "0.7248366", "text": "func (*Bgp_Neighbor_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e7d8589e09bd25ada04518c2d99684a", "score": "0.7246062", "text": "func (*Bgp_Neighbor_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.72411245", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.72411245", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "606b00369bd24843d9ec52825cdc7547", "score": "0.72363293", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "606b00369bd24843d9ec52825cdc7547", "score": "0.72363293", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "ed7cd55d3a00c9eed21f34228699b959", "score": "0.72355825", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "ed7cd55d3a00c9eed21f34228699b959", "score": "0.7234879", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "38eb667efab37d30a2cec495f99ce46c", "score": "0.72023827", "text": "func (*Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "38eb667efab37d30a2cec495f99ce46c", "score": "0.72023827", "text": "func (*Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "1c04be2816eb84e6da2c318b3aecb57f", "score": "0.71955377", "text": "func (*LocalRoutes_Static_NextHop) IsYANGGoStruct() {}", "title": "" }, { "docid": "1c04be2816eb84e6da2c318b3aecb57f", "score": "0.7193967", "text": "func (*LocalRoutes_Static_NextHop) IsYANGGoStruct() {}", "title": "" }, { "docid": "035f8b2a428f41346be80a183b573639", "score": "0.71925217", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Subtlv_TeDefaultMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "444e7d3bcc533902c94de580db117966", "score": "0.7192022", "text": "func (*NetworkInstance_Mpls_Global_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "c630f3a2575601269e094960ed066374", "score": "0.7191762", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DefaultMetric) IsYANGGoStruct() {}", "title": "" }, { "docid": "444e7d3bcc533902c94de580db117966", "score": "0.71915954", "text": "func (*NetworkInstance_Mpls_Global_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "efca2a86ca6701d4bd63c80e4e525748", "score": "0.7173654", "text": "func (*NetworkInstance_Protocol_Igmp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "272112fc8bd0faa018093bae8b806ada", "score": "0.7168287", "text": "func (*Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "272112fc8bd0faa018093bae8b806ada", "score": "0.7168287", "text": "func (*Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "45a4b342645d40da5076ac1d3d26f725", "score": "0.71642715", "text": "func (*NetworkInstance_Protocol_Bgp_Global_DynamicNeighborPrefix) IsYANGGoStruct() {}", "title": "" }, { "docid": "45a4b342645d40da5076ac1d3d26f725", "score": "0.71642715", "text": "func (*NetworkInstance_Protocol_Bgp_Global_DynamicNeighborPrefix) IsYANGGoStruct() {}", "title": "" }, { "docid": "a7547c9ac408e1901accd3bb706d2f51", "score": "0.7159987", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_TeDefaultMetric) IsYANGGoStruct() {}", "title": "" }, { "docid": "316297d444c2c3071120146aec5c6321", "score": "0.7155983", "text": "func (*Bgp_Global_DynamicNeighborPrefix) IsYANGGoStruct() {}", "title": "" }, { "docid": "316297d444c2c3071120146aec5c6321", "score": "0.7155983", "text": "func (*Bgp_Global_DynamicNeighborPrefix) IsYANGGoStruct() {}", "title": "" }, { "docid": "addfd82cca454f7cb781ed5c8f3fd21a", "score": "0.7147178", "text": "func (*Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "addfd82cca454f7cb781ed5c8f3fd21a", "score": "0.7147178", "text": "func (*Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "982dae43903841ed0a7c16606bd28a50", "score": "0.71413827", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_TeDefaultMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "2930110976368c8eef233f623079e183", "score": "0.71345806", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DefaultMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "05ffae81bd7623bc21fbfc364e92d861", "score": "0.71317446", "text": "func (*NetworkInstance_Mpls_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "05ffae81bd7623bc21fbfc364e92d861", "score": "0.71316874", "text": "func (*NetworkInstance_Mpls_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "889d94840df1c2846bb4c3d1b9a6956b", "score": "0.7122755", "text": "func (*Bgp_PeerGroup_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "199d5520c4c600e482e4a9fca6e1b8d1", "score": "0.71221155", "text": "func (*Lldp_Interface_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "889d94840df1c2846bb4c3d1b9a6956b", "score": "0.71221066", "text": "func (*Bgp_PeerGroup_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "199d5520c4c600e482e4a9fca6e1b8d1", "score": "0.71219665", "text": "func (*Lldp_Interface_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "604f0bf30bdf05532b7a10e95ce5cebf", "score": "0.7121369", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_TeDefaultMetric) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d726da34702c8f1edb60a153a67af4b", "score": "0.7105811", "text": "func (*LocalRoutes_Static_NextHop_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d726da34702c8f1edb60a153a67af4b", "score": "0.7103575", "text": "func (*LocalRoutes_Static_NextHop_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "b7d4910afec62516d7a346a9ebbd138d", "score": "0.70867324", "text": "func (*NetworkInstance_Protocol_Static_NextHop) IsYANGGoStruct() {}", "title": "" }, { "docid": "b7d4910afec62516d7a346a9ebbd138d", "score": "0.70867324", "text": "func (*NetworkInstance_Protocol_Static_NextHop) IsYANGGoStruct() {}", "title": "" }, { "docid": "57a64c15a890e5a6713bb73913c6e202", "score": "0.70796484", "text": "func (*NetworkInstance_Protocol_Pim_Global_RendezvousPoint) IsYANGGoStruct() {}", "title": "" }, { "docid": "6505990e3078fb7b2c0ecce84af4f055", "score": "0.7073459", "text": "func (*NetworkInstance_Protocol_Bgp_Global_Confederation) IsYANGGoStruct() {}", "title": "" }, { "docid": "6505990e3078fb7b2c0ecce84af4f055", "score": "0.7073459", "text": "func (*NetworkInstance_Protocol_Bgp_Global_Confederation) IsYANGGoStruct() {}", "title": "" }, { "docid": "374a2ec198292f836d59a85f7dcfd4a6", "score": "0.706643", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Mpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "a7758cf4f34a02900a852a4b344a700f", "score": "0.7065541", "text": "func (*Bgp_Global_RouteSelectionOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "a7758cf4f34a02900a852a4b344a700f", "score": "0.7065541", "text": "func (*Bgp_Global_RouteSelectionOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "374a2ec198292f836d59a85f7dcfd4a6", "score": "0.70649", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Mpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "5800bf95c494b746509e9a45f90dd077", "score": "0.7062267", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_TeDefaultMetric) IsYANGGoStruct() {}", "title": "" }, { "docid": "dfc7c9b7077085bd0dc3675023100cd8", "score": "0.7050244", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "dfc7c9b7077085bd0dc3675023100cd8", "score": "0.70497715", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_RouteReflector) IsYANGGoStruct() {}", "title": "" }, { "docid": "306d119784961a66885c95c3b19db91d", "score": "0.70154256", "text": "func (*NetworkInstance_Protocol_Pim_Interface_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "858b53867eeefea92407034c55c8771d", "score": "0.6999043", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "858b53867eeefea92407034c55c8771d", "score": "0.69974303", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "730c6a2cb133a72e090384212a85e92a", "score": "0.6996515", "text": "func (*Bgp_Neighbor_Messages) IsYANGGoStruct() {}", "title": "" }, { "docid": "730c6a2cb133a72e090384212a85e92a", "score": "0.6994548", "text": "func (*Bgp_Neighbor_Messages) IsYANGGoStruct() {}", "title": "" }, { "docid": "741cf372e630e5e05f73042e28583f12", "score": "0.69934785", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "741cf372e630e5e05f73042e28583f12", "score": "0.69934785", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "5c22399995eca98946211d11e0581d0f", "score": "0.6971851", "text": "func (*NetworkInstance_Protocol_Isis_Global_Mpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "5c22399995eca98946211d11e0581d0f", "score": "0.69715124", "text": "func (*NetworkInstance_Protocol_Isis_Global_Mpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "66abf9b5f75ff0450a15b92d29f6c444", "score": "0.6963646", "text": "func (*Bgp_PeerGroup_LoggingOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "66abf9b5f75ff0450a15b92d29f6c444", "score": "0.69609636", "text": "func (*Bgp_PeerGroup_LoggingOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "f485a85e6aad33a6305090e0e546415c", "score": "0.69559115", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_Messages) IsYANGGoStruct() {}", "title": "" }, { "docid": "f485a85e6aad33a6305090e0e546415c", "score": "0.69559115", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_Messages) IsYANGGoStruct() {}", "title": "" }, { "docid": "6586a9c0bc9399a42786ec88cb016134", "score": "0.69542795", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_Transport) IsYANGGoStruct() {}", "title": "" }, { "docid": "6586a9c0bc9399a42786ec88cb016134", "score": "0.69527996", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_Transport) IsYANGGoStruct() {}", "title": "" }, { "docid": "88191940ea7a1b69f9e36476e0b7a73f", "score": "0.69521654", "text": "func (*NetworkInstance_Protocol_Isis_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "88191940ea7a1b69f9e36476e0b7a73f", "score": "0.69507456", "text": "func (*NetworkInstance_Protocol_Isis_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e833c56816f7b8c28408e37cd361572", "score": "0.69445527", "text": "func (*NetworkInstance_Protocol_Static_NextHop_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e833c56816f7b8c28408e37cd361572", "score": "0.69445527", "text": "func (*NetworkInstance_Protocol_Static_NextHop_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "aba8069f4696a1440760716a56cd5da5", "score": "0.6943312", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_TeDefaultMetric) IsYANGGoStruct() {}", "title": "" }, { "docid": "dbd098ee14964a798b5f50f56c2c5197", "score": "0.69422275", "text": "func (*Bgp_Neighbor_Transport) IsYANGGoStruct() {}", "title": "" }, { "docid": "dbd098ee14964a798b5f50f56c2c5197", "score": "0.6942219", "text": "func (*Bgp_Neighbor_Transport) IsYANGGoStruct() {}", "title": "" }, { "docid": "2f3b20091ea92672a1ead556def488d1", "score": "0.69355476", "text": "func (*NetworkInstance_Protocol_Bgp_Global_RouteSelectionOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "2f3b20091ea92672a1ead556def488d1", "score": "0.69355476", "text": "func (*NetworkInstance_Protocol_Bgp_Global_RouteSelectionOptions) IsYANGGoStruct() {}", "title": "" }, { "docid": "ea784761806c7ff77fb8fdfa547ebeaa", "score": "0.69289577", "text": "func (*Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "ea784761806c7ff77fb8fdfa547ebeaa", "score": "0.69289577", "text": "func (*Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "b7884ab359ef392a6a7b80e535a37f2b", "score": "0.69260377", "text": "func (*NetworkInstance_Protocol_Pim_Global_Source) IsYANGGoStruct() {}", "title": "" }, { "docid": "0e53ce038af4d20f0ad785d3a5fb4077", "score": "0.69190764", "text": "func (*NetworkInstance_Protocol_Static) IsYANGGoStruct() {}", "title": "" }, { "docid": "0e53ce038af4d20f0ad785d3a5fb4077", "score": "0.69188607", "text": "func (*NetworkInstance_Protocol_Static) IsYANGGoStruct() {}", "title": "" }, { "docid": "2ca0ec731a45dea4d3053de1aac19697", "score": "0.69121855", "text": "func (*Mpls_Global_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "b7dd939ef2056e53a2e3c7371c3a3aaa", "score": "0.6894434", "text": "func (*Bgp_Global_Confederation) IsYANGGoStruct() {}", "title": "" }, { "docid": "b7dd939ef2056e53a2e3c7371c3a3aaa", "score": "0.6894434", "text": "func (*Bgp_Global_Confederation) IsYANGGoStruct() {}", "title": "" }, { "docid": "5ccd82898f123f03240119791ee774c9", "score": "0.6885967", "text": "func (*NetworkInstance_Protocol_Isis_Global_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "5ccd82898f123f03240119791ee774c9", "score": "0.68846124", "text": "func (*NetworkInstance_Protocol_Isis_Global_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "2b1a1f76b2c70b814e4e3097a26b0bd7", "score": "0.68804187", "text": "func (*NetworkInstance_Afts_NextHopGroup) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d48756bfe820193743d958dada5dc00", "score": "0.68714136", "text": "func (*NetworkInstance_Afts_NextHopGroup_NextHop) IsYANGGoStruct() {}", "title": "" } ]
1d1373f2529d125b0352f89472645635
New creates new blank elements and initializes defaults
[ { "docid": "5e06a2a8f6b32b130bec282426a30959", "score": "0.5199962", "text": "func (ss *Sim) New() {\n\tss.Net = &leabra.Network{}\n\tss.TrnEpcLog = &etable.Table{}\n\tss.TrnTrlLog = &etable.Table{}\n\tss.RewPredInputWts = &etensor.Float32{}\n\tss.Params = ParamSets\n\tss.RndSeed = 1\n\tss.ViewOn = true\n\tss.TrainUpdt = leabra.AlphaCycle\n\tss.TestUpdt = leabra.AlphaCycle\n\tss.TstRecLays = []string{\"Input\"}\n\tss.Defaults()\n}", "title": "" } ]
[ { "docid": "8870a9a7668fefd414f1dbd72ded31be", "score": "0.63095564", "text": "func NewEmpty() Widget { return &Empty{} }", "title": "" }, { "docid": "fbcc655e2cb9739d0cee2fe019ab1c75", "score": "0.58132976", "text": "func New() *List { return new(List).init() }", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.5794043", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.5794043", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "6b115b7d2c372a3a787caa44c5a1bbcf", "score": "0.57884717", "text": "func New() {\n\n}", "title": "" }, { "docid": "6b115b7d2c372a3a787caa44c5a1bbcf", "score": "0.57884717", "text": "func New() {\n\n}", "title": "" }, { "docid": "7b3a300b61f4c6e2b58a7606083251c4", "score": "0.5783742", "text": "func initNew() {\n\t// Initialize random number generator\n\trand.Seed(time.Now().Unix())\n\n\tmodel.InitNew()\n\tview.InitNew()\n}", "title": "" }, { "docid": "a2779f5f49d533ad6c789e7b20c7a1d7", "score": "0.57562655", "text": "func New() list {\n\treturn list{nil, nil, 0}\n}", "title": "" }, { "docid": "54905a947ff5f9e6c04c0bb05981412b", "score": "0.57276314", "text": "func NewEmpty() *I18n {\n\treturn &I18n{\n\t\tdata: make(map[string]*ini.Ini, 0),\n\t\t// init languages\n\t\tlanguages: make(map[string]string, 0),\n\t}\n}", "title": "" }, { "docid": "f40860b7601db376c0156795676071f0", "score": "0.5722217", "text": "func New() *Simple {\r\n\ts := &Simple{}\r\n\ts.List = make([]*SimpleDoc, 0)\r\n\treturn s\r\n}", "title": "" }, { "docid": "15223da8bf682ab6a6ee49333d0aede9", "score": "0.57174456", "text": "func NewElement() *Element {\n\treturn (&Element{}).Zero()\n}", "title": "" }, { "docid": "6a15ada39d353f12d52400515de37e80", "score": "0.56839097", "text": "func newDummy(name string) dummy {\n\td := dummy{name: name}\n\n\td.cards = make([]*decktet.DecktetCard, 0, 7)\n\treturn d\n}", "title": "" }, { "docid": "f09bda35d34385e4a168a8d81fe97dbd", "score": "0.56644875", "text": "func newElement(tag dicomtag.Tag, v interface{}) *dicom.Element {\n\treturn &dicom.Element{\n\t\tTag: tag,\n\t\tVR: \"\", // autodetect\n\t\tUndefinedLength: false,\n\t\tValue: []interface{}{v},\n\t}\n}", "title": "" }, { "docid": "7bd68e7c6ea148e3036aa2938ac308b3", "score": "0.56054395", "text": "func New() *List {\n return &List{\n List: list.New(),\n }\n}", "title": "" }, { "docid": "6c5a4bfd7dff29e4eb439d51060bc621", "score": "0.55808336", "text": "func New(name string, scene string, text string, x float64, y float64, width int, height int, font *common.Font, textColor color.Color, img *common.Image, pressedSliceName string, unpressedSliceName string) (*Element, error) {\n\n\te := &Element{\n\t\tname: name,\n\t\timage: img,\n\t\ttext: text,\n\t\tisEnabled: true,\n\t\tisVisible: true,\n\t\tlerpPosition: new(common.LerpPosition),\n\t\tlerpColor: new(common.LerpColor),\n\t\tcolor: textColor,\n\t\tx: x,\n\t\ty: y,\n\t\twidth: width,\n\t\theight: height,\n\t\tfont: font,\n\t\tpressedSliceName: pressedSliceName,\n\t\tunpressedSliceName: unpressedSliceName,\n\t\tscale: 1,\n\t}\n\n\treturn e, nil\n}", "title": "" }, { "docid": "9aa2fff0bdd9dc57f11800cb6fb80c25", "score": "0.54740286", "text": "func New() *Board {\n\tbrd := Board{\n\t\tgrid: new([13]map[string]interfaces.Owner),\n\t}\n\n\tfor number := 1; number < 13; number++ {\n\t\tbrd.grid[number] = make(map[string]interfaces.Owner)\n\t\tfor _, letter := range letters {\n\t\t\tbrd.grid[number][letter] = Empty{}\n\t\t}\n\t}\n\n\treturn &brd\n}", "title": "" }, { "docid": "54b77b74425c8c4899a848c9e014e1fb", "score": "0.5445547", "text": "func (v *Info) New(template string) *Info {\n\tv.Vars = make(map[string]interface{})\n\tv.templates = append(v.templates, template)\n\tv.base = template\n\n\treturn v\n}", "title": "" }, { "docid": "a7b2f8f66ad36b99ef0d9fdd145044cd", "score": "0.5433335", "text": "func _New[T any]() *_List[T] { return new(_List[T]).Init() }", "title": "" }, { "docid": "94e7cd4250342fd237992499e83fc2c0", "score": "0.541852", "text": "func New() *Tree {\n return &Tree{prepared: false, root: newState(0)}\n}", "title": "" }, { "docid": "4eb698977a90377f07e878c2e1220193", "score": "0.540528", "text": "func New(values ...int) *TreeNode {\n\troot := NewNode(values[0], nil)\n\tfor _, v := range values[1:] {\n\t\tnode := NewNode(v, root)\n\t\troot.InsertNode(node)\n\t}\n\treturn root\n}", "title": "" }, { "docid": "b44bba70f376a5ed49a0925e3402555b", "score": "0.5373794", "text": "func newList() *list {\n\tl := &list{len: 0}\n\tl.root = node{}\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n\treturn l\n}", "title": "" }, { "docid": "62065cc13fbd56745e0ebb2eb09b1318", "score": "0.5328134", "text": "func NewTypeHolderDefault(stringItem string, numberItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderDefault {\n this := TypeHolderDefault{}\n this.StringItem = stringItem\n this.NumberItem = numberItem\n this.IntegerItem = integerItem\n this.BoolItem = boolItem\n this.ArrayItem = arrayItem\n return &this\n}", "title": "" }, { "docid": "0992454a8a365ef187cb9cf9b1a6684b", "score": "0.5321452", "text": "func (mva *MVAWaitList) New(priority, quantity int, product,customerName string){\n\tmva.priority = priority\n\tmva.quantity = quantity\n\tmva.product = product\n\tmva.customerName = customerName\n}", "title": "" }, { "docid": "486b26553037982f28745f751df9a5c4", "score": "0.5315099", "text": "func newEmptyValue(t reflect.Type) (reflect.Value, error) {\n\tt = elemOfType(t)\n\tif t.Kind() == reflect.Struct || t.Kind() == reflect.Slice {\n\t\treturn reflect.New(t), nil // A new Ptr to Struct of this type\n\t}\n\treturn reflect.Value{}, fmt.Errorf(\"Can't create an empty Value for type %s\", t)\n}", "title": "" }, { "docid": "647bae3a98d0cbc6959aed292b17856b", "score": "0.53063107", "text": "func (i InputPhotoEmpty) construct() InputPhotoClass { return &i }", "title": "" }, { "docid": "aa98256e94b29d86d558d2510fa344bb", "score": "0.53030556", "text": "func (ss *Sim) New() {\n\tss.Net = &leabra.Network{}\n\tss.TstCycLog = &etable.Table{}\n\tss.SpikeVsRateLog = &etable.Table{}\n\tss.Params = ParamSets\n\tss.Defaults()\n\tss.SpikeParams.Defaults()\n}", "title": "" }, { "docid": "2b6ce9e0b0bb8eeeaf9a767f81546cd1", "score": "0.5298489", "text": "func newEmptyMap() *Map {\n\treturn &Map{\n\t\tcities: make(map[string]*City),\n\t\taliens: make(map[uint]*Alien),\n\t}\n}", "title": "" }, { "docid": "391304295c4c273b1c5b81cad06c3ac7", "score": "0.5292391", "text": "func (e *Element) Init() (list *List) {\n\treturn New()\n}", "title": "" }, { "docid": "c9dce37f1e56df015d3378d88149e49b", "score": "0.5279983", "text": "func DefaultCreed() *Creed {\n\tcreed := Creed{}\n\tcreed.SetCrawlingEngine(crawler.DefaultEngine())\n\treturn &creed\n}", "title": "" }, { "docid": "521771f26f9cd89fbb46c90a8be3b933", "score": "0.52728033", "text": "func New() Tree {\n\treturn &rbTree{tNil, 0}\n}", "title": "" }, { "docid": "db874691e76b4b7feafb83369d23e922", "score": "0.5265782", "text": "func newEmptyConfigMap() *api.ConfigMap {\n\treturn &api.ConfigMap{\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tName: defaultConfigMapName,\n\t\t\tNamespace: defaultConfigMapNamespace,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "61a919037da5743861f5f43966a79b68", "score": "0.52601707", "text": "func newStructure(n, s string, h int32) myStructure {\n\tif h > 300 {\n\t\th = 0\n\t}\n\treturn myStructure{n, s, h}\n}", "title": "" }, { "docid": "8eb5aa83d677184178156f54e41920b1", "score": "0.52495056", "text": "func NewList() *List { return new(List).Init() }", "title": "" }, { "docid": "909c9afb82e34b5ec286fafc00a4c2cb", "score": "0.5247399", "text": "func New(rows, columns int) *Grid {\n\tg := &Grid{\n\t\trows: rows,\n\t\tcolumns: columns,\n\t\tcells: make([][]cell.Cell, rows),\n\t}\n\tfor i := range g.cells {\n\t\tg.cells[i] = make([]cell.Cell, columns)\n\t}\n\tg.prepareGrid()\n\tg.prepareCells()\n\treturn g\n}", "title": "" }, { "docid": "9d54494c9b76ecf46505d90e82655385", "score": "0.5240607", "text": "func NewBlankNode(value string) *BlankNode { return &BlankNode{value} }", "title": "" }, { "docid": "8253dd9e29f6f9664e64599bec61040c", "score": "0.52287275", "text": "func New() *HTree {\n\treturn &HTree{root: &node{}}\n}", "title": "" }, { "docid": "f0a522816f4e83ed9ec86192e6a71287", "score": "0.52186334", "text": "func New() *List {\n\tl := new(List)\n\tl.root.next = &l.root\n\tl.root.prev = &l.root\n\tl.len = 0\n\n\treturn l\n}", "title": "" }, { "docid": "eef72b3b6eb7be59ea8c51574e375a73", "score": "0.52163255", "text": "func New(root Widget) (UI, error) {\n\treturn newTcellUI(root)\n}", "title": "" }, { "docid": "d943f22c01877c7be59586b68970dd22", "score": "0.52100164", "text": "func new() *InMemoryTodos {\n\ta, _ := uuid.NewV4()\n\tb, _ := uuid.NewV4()\n\tc, _ := uuid.NewV4()\n\treturn &InMemoryTodos{\n\t\ttodos: map[uuid.UUID]*models.Todo{\n\t\t\t*a: &models.Todo{ID: a.String(), Title: \"Walk the dog\"},\n\t\t\t*b: &models.Todo{ID: b.String(), Title: \"Go to Mars\"},\n\t\t\t*c: &models.Todo{ID: c.String(), Title: \"Go outside\"},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "bde368a7274dbd1ec4e4562b2f5a329c", "score": "0.519884", "text": "func newOptions(options ...Option) Options {\n\topts := DefaultOptions\n\n\tfor _, o := range options {\n\t\to(&opts)\n\t}\n\tif opts.ChainName == \"\" {\n\t\topts.ChainName = common.DefaultChainName\n\t}\n\treturn opts\n}", "title": "" }, { "docid": "bba240c8b00f67a87e27560d98f9664a", "score": "0.5196336", "text": "func New(maxlevel int) *List {\n\treturn NewCustom(maxlevel, DefaultProbability, time.Now().Unix())\n}", "title": "" }, { "docid": "bd8737b0c2a54be56d7d970c4385dad3", "score": "0.5184225", "text": "func (i *ImageMap) NewElement() interface{} {\n\treturn &Image{}\n}", "title": "" }, { "docid": "3d6ed815102bf2d0739498c99300fe21", "score": "0.518371", "text": "func New(bx *rice.Box) *Template {\n\tt := &Template{box: bx, tpl: template.New(\"\")}\n\treturn t\n}", "title": "" }, { "docid": "d930afdd5c551ffc554d6b54bd630dcd", "score": "0.5166766", "text": "func New() *Array { return new(Array).Init(10) }", "title": "" }, { "docid": "d930afdd5c551ffc554d6b54bd630dcd", "score": "0.5166766", "text": "func New() *Array { return new(Array).Init(10) }", "title": "" }, { "docid": "0223e90e042d935b10b925dd6cf22b65", "score": "0.5155379", "text": "func init() {\n\t// Register the layout types\n\telement.Register(GridLayoutTypeName,\n\t\treflect.TypeOf((*GridLayout)(nil)).Elem(), NewGridLayout)\n\telement.Register(LinearLayoutTypeName,\n\t\treflect.TypeOf((*LinearLayout)(nil)).Elem(), NewLinearLayout)\n}", "title": "" }, { "docid": "78641d431fc370411bd05839c5ff345c", "score": "0.51539534", "text": "func New() *list {\n\tl := new(list)\n\n\tl.Clear()\n\n\treturn l\n}", "title": "" }, { "docid": "946f8a00aae32090b156239c975f21c5", "score": "0.5153855", "text": "func New() Tables {\n\tt := make([]*Table, 9)\n\tt[0] = NewTable(\"VPORT\")\n\tt[1] = NewTable(\"LTYPE\")\n\tt[1].Add(LT_BYLAYER)\n\tt[1].Add(LT_BYBLOCK)\n\tt[1].Add(LT_CONTINUOUS)\n\tt[1].Add(LT_HIDDEN)\n\tt[1].Add(LT_DASHDOT)\n\tt[2] = NewTable(\"LAYER\")\n\tt[2].Add(LY_0)\n\tt[3] = NewTable(\"STYLE\")\n\tt[3].Add(ST_STANDARD)\n\tt[4] = NewTable(\"VIEW\")\n\tt[5] = NewTable(\"UCS\")\n\tt[6] = NewTable(\"APPID\")\n\tt[6].Add(NewAppID(\"ACAD\"))\n\tt[7] = NewTable(\"DIMSTYLE\")\n\tt[8] = NewTable(\"BLOCK_RECORD\")\n\tt[8].Add(NewBlockRecord(\"*Model_Space\"))\n\tt[8].Add(NewBlockRecord(\"*Paper_Space\"))\n\tt[8].Add(NewBlockRecord(\"*Paper_Space0\"))\n\treturn t\n}", "title": "" }, { "docid": "df5a3d1fcbbf16207fcb95c995705642", "score": "0.5150726", "text": "func New(elems ...interface{}) *Stack {\n\tout := Empty().AsTransient()\n\tfor _, elem := range elems {\n\t\tout = out.Push(elem)\n\t}\n\treturn out.AsPersistent()\n}", "title": "" }, { "docid": "f394c19c9f92e7f90c9ca3dabb504b41", "score": "0.51502615", "text": "func NewDefault() (*Malscraper, error) {\n\treturn New(Config{\n\t\tCacheTime: 24 * time.Hour,\n\t\tCleanImageURL: true,\n\t\tCleanVideoURL: true,\n\t\tLogColor: true,\n\t\tLogLevel: LevelDefault,\n\t})\n}", "title": "" }, { "docid": "3fb47b83237ff3336e1b649507108b00", "score": "0.5147403", "text": "func New() *Data {\n\tdata := &Data{\n\t\tTags: make(map[int]Tag),\n\t}\n\treturn data\n}", "title": "" }, { "docid": "0863f2359a6b243d4c8abab7983bc67b", "score": "0.51456696", "text": "func New(elements []int) *Tree {\n\tif elements == nil || len(elements) == 0 {\n\t\treturn nil\n\t}\n\tsort.Ints(elements)\n\telements = removeDuplicates(elements)\n\troot := &Tree{Value: elements[len(elements)/2]}\n\troot.Left = RecursiveFunc(elements, 0, len(elements)/2)\n\troot.Right = RecursiveFunc(elements, len(elements)/2+1, len(elements))\n\treturn root\n}", "title": "" }, { "docid": "6c230c9c39ce2ea7e37652ade22fba25", "score": "0.51305526", "text": "func New(data url.Values) *Form {\n\n\treturn &Form{\n\t\tdata,\n\t\terrors(map[string][]string{}),\n\t}\n}", "title": "" }, { "docid": "ae5592d0d5ff4c5121bf56188cfa6098", "score": "0.51246554", "text": "func NewTypeHolderDefaultWithDefaults() *TypeHolderDefault {\n this := TypeHolderDefault{}\n var stringItem string = \"what\"\n this.StringItem = stringItem\n var boolItem bool = true\n this.BoolItem = boolItem\n return &this\n}", "title": "" }, { "docid": "8c7d7cad035eb20267213ace3bdc0ce6", "score": "0.5112205", "text": "func New(width, height int) Board {\n\tvar l Board\n\n\tl.width = width\n\tl.height = height\n\tl.cells = make([][]rune, height)\n\tfor row := 0; row < height; row++ {\n\t\tl.cells[row] = make([]rune, width)\n\t}\n\n\tfor cell := range l.Cells() {\n\t\trow, col := cell.Unpack()\n\t\tl.cells[row][col] = common.Empty\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "ccc6b9776b6048b41866899ae45f7975", "score": "0.5110197", "text": "func Constructor() AllOne {\n\tnil_node := &Node{\n\t\tprev: nil,\n\t\tnext: nil,\n\t\tkeys: make(map[string]bool),\n\t\tvalue: 0,\n\t}\n\tnil_node.next = nil_node\n\tnil_node.prev = nil_node\n\treturn AllOne{\n\t\tnil_node: nil_node,\n\t\tnodemap: make(map[string]*Node),\n\t}\n}", "title": "" }, { "docid": "2dc8cafdc2ce005ab7543b6a626a8d94", "score": "0.51075363", "text": "func (ins Inputs) New(i interface{}) Inputs {\n\tdest := Inputs{}\n\tswitch x := i.(type) {\n\tcase []interface{}:\n\t\tfor _, v := range x {\n\t\t\tdest = append(dest, Input{}.New(v))\n\t\t}\n\tcase map[string]interface{}:\n\t\tfor key, v := range x {\n\t\t\tinput := Input{}.New(v)\n\t\t\tinput.ID = key\n\t\t\tdest = append(dest, input)\n\t\t}\n\t}\n\treturn dest\n}", "title": "" }, { "docid": "7ff5b23ee2960d18539853ca9b95c906", "score": "0.5107208", "text": "func New(raw []byte) Boxfile {\n box := Boxfile{\n raw: raw,\n Parsed: make(map[string]interface{}),\n }\n box.parse()\n return box\n}", "title": "" }, { "docid": "ca1a54a394c053e90cc1d6e08d562749", "score": "0.51052016", "text": "func ConstructEmpty(tag uint16, nc bool, fu bool) Constructor {\n\treturn func(t *tlv) error {\n\t\tif t == nil {\n\t\t\treturn errors.New(errors.KsiInvalidArgumentError).AppendMessage(\"Missing TLV base object.\")\n\t\t}\n\n\t\tt.obj.Tag = tag\n\t\tt.obj.NonCritical = nc\n\t\tt.obj.ForwardUnknown = fu\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "cd88b48f05f9ce3738b7cdee3e27142a", "score": "0.5096279", "text": "func (l ListItem) New(params ...string) *ListItem {\n\tn := len(params)\n\n\tl.Title = params[0]\n\tif n >= 2 {\n\t\tl.Desc = params[1]\n\t}\n\tif n >= 3 {\n\t\tl.Image = params[2]\n\t}\n\treturn &l\n}", "title": "" }, { "docid": "f003c310f3109b533bf016f3801a42c8", "score": "0.50916433", "text": "func New() Container {\n\treturn Container{\"wlan0\", wlist.Scan}\n}", "title": "" }, { "docid": "c9ac82bb1ee2dd5210ead3d50bfbffe6", "score": "0.5090198", "text": "func (s *Stack) New() *Stack {\n\ts.items = []Node{}\n\treturn s\n}", "title": "" }, { "docid": "aa590e2e5368481883027da0fbf1114a", "score": "0.5068944", "text": "func (g *Graph) NewElement(c *yatego.CallflowComponent) *Element {\n\tfac, ok := g.factories[c.ClassName]\n\tif !ok {\n\t\tfac = g.factories[\"default\"]\n\t}\n\treturn fac(c)\n}", "title": "" }, { "docid": "4a58666cb981c470084bb878aba13edb", "score": "0.5068617", "text": "func (info *Info) New() Base {\n\treturn info.Constructor()\n}", "title": "" }, { "docid": "f12ef18ff97d95485ad7775fadc7175a", "score": "0.5068511", "text": "func New(data url.Values) *Form {\n\treturn &Form{\n\t\tdata,\n\t\terrors(map[string][]string{}),\n\t}\n}", "title": "" }, { "docid": "1c579bb9e7eca5e454c63d2d45a1cc65", "score": "0.5068271", "text": "func newColumnarBuilds(columns int) columnarBuilds {\n\t// Start the length at 0 because columnarBuilds.currentIndex() relies on the length.\n\treturn columnarBuilds{\n\t\tStarted: make([]int, 0, columns),\n\t\tTestsFailed: make([]int, 0, columns),\n\t\tElapsed: make([]int, 0, columns),\n\t\tTestsRun: make([]int, 0, columns),\n\t\tResult: make([]string, 0, columns),\n\t\tExecutor: make([]string, 0, columns),\n\t\tPR: make([]string, 0, columns),\n\t}\n}", "title": "" }, { "docid": "90c799a6c1638a1b9678340f9424cdd4", "score": "0.5066505", "text": "func initNew() {\r\n\t// Initialize random number generator\r\n\trand.Seed(time.Now().Unix())\r\n\r\n\tfmt.Println(\"Trying to init new\")\r\n\tmodel.InitNew()\r\n\tview.InitNew()\r\n\tmodel.Won = false\r\n}", "title": "" }, { "docid": "4340a21e4d6362bbd1debb90faf74879", "score": "0.5065824", "text": "func Constructor() MyLinkedList {\n\treturn MyLinkedList{dummy: &ListNode{Val: 0}}\n}", "title": "" }, { "docid": "b3cd232ab1b843668cfa59d019596bfa", "score": "0.50621396", "text": "func NewBlank(id string) (Blank, error) {\n\tif len(strings.TrimSpace(id)) == 0 {\n\t\treturn Blank{}, errors.New(\"blank id\")\n\t}\n\treturn Blank{id: \"_:\" + id}, nil\n}", "title": "" }, { "docid": "51f66c0e4ba4793ae63866c12a26e0fa", "score": "0.5061076", "text": "func New(w, h int) Grid {\n\tvar newGrid Grid\n\tnewGrid = make([][]bool, w)\n\tfor index := range newGrid {\n\t\tnewGrid[index] = make([]bool, h)\n\t}\n\treturn Grid(newGrid)\n}", "title": "" }, { "docid": "15a9a11e853bb1ee9298fc50aae8aa55", "score": "0.5058951", "text": "func NewPageWithDefaults() *Page {\n\tthis := Page{}\n\treturn &this\n}", "title": "" }, { "docid": "71e32cd4af65357a9ec8ab7a4b04c92c", "score": "0.50508976", "text": "func NewDefault() *Parser {\n\treturn &Parser{\n\t\tnumOfRetries: RetriesDefaultValue,\n\t\tconvertFunc: converter.DefaultConverted,\n\t}\n}", "title": "" }, { "docid": "c521a682f38a5e418f5ffa66ce605c3c", "score": "0.504482", "text": "func (w AccountWallPapersNotModified) construct() AccountWallPapersClass { return &w }", "title": "" }, { "docid": "6b6d91c9687dea0e0dba82a7a00bc306", "score": "0.50330204", "text": "func NewElement(tagName, label, fieldName string, p interface{}, attrs map[string]string) *Element {\n\treturn &Element{\n\t\tTagName: tagName,\n\t\tAttrs: attrs,\n\t\tName: TagNameFromStructField(fieldName, p),\n\t\tLabel: label,\n\t\tData: ValueFromStructField(fieldName, p),\n\t\tViewBuf: &bytes.Buffer{},\n\t}\n}", "title": "" }, { "docid": "86ccd390b0b542816c0c890a6a2eb9f8", "score": "0.50304097", "text": "func NewElement(client net.Conn, requestData *iso8583.Message, status messageStatus) Message {\n\treturn Message{\n\t\tClientConn: client,\n\t\tRequestTime: time.Now(),\n\t\tResponseTime: time.Now(),\n\t\tRequestData: requestData,\n\t\tStatus: status,\n\t}\n}", "title": "" }, { "docid": "7119423a578202d684c2be31ffd39a70", "score": "0.5025848", "text": "func New(root *Node) *Tree {\n\ttr := &Tree{}\n\troot.Black = true\n\ttr.Root = root\n\treturn tr\n}", "title": "" }, { "docid": "a6a2beb2f469a42664606de6be951788", "score": "0.50240344", "text": "func NewVisualInfo()(*VisualInfo) {\n m := &VisualInfo{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "4b290ddf05281279e490a9942b247660", "score": "0.50231165", "text": "func New[T any](xs ...T) *List[T] {\n\tvar list *List[T] = nil\n\tfor i := len(xs) - 1; i >= 0; i-- {\n\t\tlist = &List[T]{xs[i], list}\n\t}\n\treturn list\n}", "title": "" }, { "docid": "87d06f2a206d3c6132f15459ba86317a", "score": "0.50208217", "text": "func (d *Doc) New(t DocType, data[]byte) error {\n\td.Type = t\n\terr := json.Unmarshal(data, &d)\n\tif err != nil {\n\t\tlog.Println(\"Error: Doc.New()\")\n\t\treturn err\n\t}\n\t// Doc.Gen(DocType, DocCode, Branch)\n\n\treturn nil\n}", "title": "" }, { "docid": "55df20ec02aac2d4c0a2c020df7b5a83", "score": "0.50202847", "text": "func New(data string) Message {\n\tmsg := Message{ID: \"0\", Attr: []Attribute{}, Data: data}\n\n\treturn msg\n}", "title": "" }, { "docid": "16862bd6e3bce507c79387c5d4fed742", "score": "0.5018744", "text": "func New() Interface {\n\treturn &linkedMap{\n\t\tdata: map[interface{}]*element{},\n\t\taccessOrder: false,\n\t\thead: nil,\n\t\ttail: nil,\n\t\tlength: 0,\n\t}\n}", "title": "" }, { "docid": "f29b5fa4a2094a3057f88b19c697f643", "score": "0.50169045", "text": "func newBasicObject() valueBasicObject {\n\tv := valueBasicObject{&basicObjectData{&valueBasicObjectData{extensible: true}}}\n\treturn v\n}", "title": "" }, { "docid": "7ce5f810bf25e54146e2edcca3dbde99", "score": "0.5016904", "text": "func Constructor() RandomizedCollection {\n\treturn RandomizedCollection{make(map[int]map[int]int, 0), make([]int, 0)}\n}", "title": "" }, { "docid": "64a7676131709fe825e42ad0f61e7996", "score": "0.50114644", "text": "func Constructor() RandomizedCollection {\r\n\treturn RandomizedCollection{\r\n\t\tindex: make(map[int][]int),\r\n\t\tnums: []int{},\r\n\t\tcount: 0,\r\n\t}\r\n}", "title": "" }, { "docid": "9b4652c00d6ea142b87d37da0c886312", "score": "0.5008168", "text": "func NewElement(elType, text string) *Element {\n\treturn &Element{\n\t\tParent: nil,\n\t\tText: text,\n\t\tType: elType,\n\t\tElements: []*Element{},\n\t}\n}", "title": "" }, { "docid": "c7d2c3d5feed6c9b348abd0ab1780cf8", "score": "0.50079095", "text": "func New(root *Node) *Tree {\n\t//tr := &Tree{}\n\t//tr.Root = root\n\treturn &Tree{\n\t\tRoot:root,\n\t}\n}", "title": "" }, { "docid": "cddcb27a6ec04733eae0c0758df6952c", "score": "0.50060105", "text": "func (v ZamowieniaResource) New(c buffalo.Context) error {\n c.Set(\"zamowienium\", &models.Zamowienium{})\n\n return c.Render(http.StatusOK, r.HTML(\"/zamowienia/new.plush.html\"))\n}", "title": "" }, { "docid": "37905d77924fbc6e97fd5e12df5e720b", "score": "0.5003358", "text": "func (c MethodsCollection) New() pNew {\n\treturn pNew{\n\t\tMethod: c.MustGet(\"New\"),\n\t}\n}", "title": "" }, { "docid": "c3a92c5bf6e76ffe52c9c34e6984b4c7", "score": "0.4995031", "text": "func NewBasic(langs []string) *Basic {\n\treturn &Basic{langs: langs}\n}", "title": "" }, { "docid": "632c0f1d396677ce0d711d7aee798928", "score": "0.49913493", "text": "func New(value ...Attribute) *Color { return &Color{params: value} }", "title": "" }, { "docid": "aa174c6cc9328828e2c2463d4ce8ed0e", "score": "0.49889457", "text": "func newDefaultGraph() *defaultGraph {\n\treturn &defaultGraph{\n\t\tVertices: make(map[string]struct{}),\n\t\tVertexToChildren: make(map[string]map[string]float64),\n\t\tVertexToParents: make(map[string]map[string]float64),\n\t\t//\n\t\t// without this\n\t\t// panic: assignment to entry in nil map\n\t}\n}", "title": "" }, { "docid": "ef30e160c9847253d71ed9e942d1b58d", "score": "0.498669", "text": "func New(data url.Values) *Form {\n\treturn &Form{\n\t\tdata,\n\t\tmake(errors),\n\t}\n}", "title": "" }, { "docid": "3a77d89a09e3a1e87b27de9c2e746ccb", "score": "0.49805027", "text": "func Constructor() *MyLinkedList {\n\treturn &MyLinkedList{dummyHead: &listNode{}}\n}", "title": "" }, { "docid": "7d9dba9d7f4d67f2623a2e9c92927945", "score": "0.49731243", "text": "func (p *Policy) addDefaultElementsWithoutAttrs() {\n\tp.init()\n\n\tp.setOfElementsAllowedWithoutAttrs[\"abbr\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"acronym\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"address\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"article\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"aside\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"audio\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"b\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"bdi\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"blockquote\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"body\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"br\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"button\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"canvas\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"caption\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"center\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"cite\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"code\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"col\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"colgroup\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"datalist\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"dd\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"del\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"details\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"dfn\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"div\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"dl\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"dt\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"em\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"fieldset\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"figcaption\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"figure\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"footer\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"h1\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"h2\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"h3\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"h4\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"h5\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"h6\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"head\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"header\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"hgroup\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"hr\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"html\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"i\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"ins\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"kbd\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"li\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"mark\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"marquee\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"nav\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"ol\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"optgroup\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"option\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"p\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"picture\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"pre\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"q\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"rp\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"rt\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"ruby\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"s\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"samp\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"script\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"section\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"select\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"small\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"span\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"strike\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"strong\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"style\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"sub\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"summary\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"sup\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"svg\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"table\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"tbody\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"td\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"textarea\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"tfoot\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"th\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"thead\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"title\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"time\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"tr\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"tt\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"u\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"ul\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"var\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"video\"] = struct{}{}\n\tp.setOfElementsAllowedWithoutAttrs[\"wbr\"] = struct{}{}\n\n}", "title": "" }, { "docid": "b3cf0469d04818d9e1ef7e68db925fe9", "score": "0.4971848", "text": "func (uintMap) New() LatticeMap {\n\treturn make(uintMap)\n}", "title": "" }, { "docid": "85bd70d2222032b8651323c3a05b3a96", "score": "0.49698544", "text": "func New() *List {\n\treturn &List{\n\t\tItems: make(map[string][][]byte),\n\t}\n}", "title": "" }, { "docid": "db75db906c7027bd2b78336a86bbab25", "score": "0.49676147", "text": "func newGraph(v int) *Graph {\n\tgraph := &Graph{}\n\tgraph.v = v\n\tgraph.adj = make([]*list.List, v)\n\tfor i := range graph.adj {\n\t\tgraph.adj[i] = list.New()\n\t}\n\n\treturn graph\n}", "title": "" }, { "docid": "101899444e5c2a0d5b7e0c90678dc9de", "score": "0.49659753", "text": "func (this *Asset) basisNew() {\n\tthis.S.Basis.I = -this.S.NetCF.I\n\tthis.L.Basis.I = -this.L.NetCF.I\n}", "title": "" }, { "docid": "477ee4ddd3783064e61044224d79adc6", "score": "0.49630266", "text": "func New(n int) UF {\n\ti := 0\n\tuf := UF{ID: make([]int, n)}\n\tfor ; i < n; i++ {\n\t\tuf.ID[i] = i\n\t}\n\treturn uf\n}", "title": "" }, { "docid": "2341240ffc6dc1940ff7fa2ff0217f79", "score": "0.4962392", "text": "func New() *Millipede {\n\treturn NewWithSize(20)\n}", "title": "" } ]
8e93a4f66cd0a7ced78233c5688650df
Use returns pointer to the storage bucket by name. If bucket doesn't exist it returns nil.
[ { "docid": "b7e0bc24479587c2c061e63c064432c7", "score": "0.78042775", "text": "func (s *Storage) Use(bucketName string) *Bucket {\n\tbucket, ok := s.buckets.Load(bucketName)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn bucket.(*Bucket)\n}", "title": "" } ]
[ { "docid": "c811a15e34ff312d2deb6e5c6a0735f7", "score": "0.65613234", "text": "func (in *Info) Bucket() string { return string(in.bucket) }", "title": "" }, { "docid": "3b7243578b04a027193c923134f0cb73", "score": "0.6368799", "text": "func (tx *Tx) Bucket(name []byte) *Bucket {\n\treturn tx.root.Bucket(name)\n}", "title": "" }, { "docid": "63ddfb345ccf9173a696615b94773308", "score": "0.6290393", "text": "func GetBucket(input string) (string, error) {\n\treturn strings.Split(strings.TrimPrefix(input, \"s3://\"), \"/\")[0], nil\n}", "title": "" }, { "docid": "75a7cc4ac40475680747f81495401406", "score": "0.6250357", "text": "func (s *storageFS) GetBucket(name string) (Bucket, error) {\n\ts.mtx.RLock()\n\tdefer s.mtx.RUnlock()\n\tdirInfo, err := os.Stat(filepath.Join(s.rootDir, url.PathEscape(name)))\n\tif err != nil {\n\t\treturn Bucket{}, err\n\t}\n\treturn Bucket{Name: name, VersioningEnabled: false, TimeCreated: timespecToTime(createTimeFromFileInfo(dirInfo))}, err\n}", "title": "" }, { "docid": "31c7b1910ae48d46cdaed72a7b6b5639", "score": "0.62154335", "text": "func Bucket(name []byte) Option {\n\treturn func(s *Storage) {\n\t\tif len(name) > 0 {\n\t\t\ts.bucket = name\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2d3b0559d89f7e12e9814314b8c42a63", "score": "0.62098885", "text": "func (b *Bucket) Get(name string) (item *Item, err error) {\n\tvar ok bool\n\tif item, ok = b.data[name]; !ok {\n\t\terr = errors.ErrBucketNotExist\n\t}\n\treturn\n}", "title": "" }, { "docid": "64ef8b33076e7029d1ec4dfe22cd6a4e", "score": "0.61760825", "text": "func (o StorageSourcePtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *StorageSource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ff4b1a5852dd3f2a4e527eb5213ccce3", "score": "0.614134", "text": "func (o StorageSourceOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageSource) *string { return v.Bucket }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4d95707396d38031a217deb529ec7374", "score": "0.61174875", "text": "func (s *ConsulBackend) GetBucket() string { return s.bucket }", "title": "" }, { "docid": "521624f86adeae3cf3bd1f40202bab01", "score": "0.603273", "text": "func (c *FakeStorageBuckets) Get(name string, options v1.GetOptions) (result *v1beta1.StorageBucket, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(storagebucketsResource, c.ns, name), &v1beta1.StorageBucket{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1beta1.StorageBucket), err\n}", "title": "" }, { "docid": "6177cf7f3df395a720d78cf04388a5f5", "score": "0.60307646", "text": "func (c *CassandraBackend) bucket(key string) string {\n\tbs := c.buckets(key)\n\treturn bs[len(bs)-1]\n}", "title": "" }, { "docid": "2dc62012764a057dfcebea8017e7fe67", "score": "0.6020391", "text": "func getBucket(tx *bolt.Tx, buckets [][]byte) (*bolt.Bucket, error) {\n\tif len(buckets) < 1 {\n\t\treturn nil, errors.New(errors.Structural, \"At least one bucket name is required\")\n\t}\n\tvar cursor interface {\n\t\tCreateBucketIfNotExists(b []byte) (*bolt.Bucket, error)\n\t\tBucket(b []byte) *bolt.Bucket\n\t}\n\n\tvar err error\n\tcursor = tx\n\tfor _, name := range buckets {\n\t\tnext := cursor.Bucket(name)\n\t\tif next == nil {\n\t\t\tif next, err = cursor.CreateBucketIfNotExists(name); err != nil {\n\t\t\t\treturn nil, errors.New(errors.Operational, err)\n\t\t\t}\n\t\t}\n\t\tcursor = next\n\t}\n\treturn cursor.(*bolt.Bucket), nil\n}", "title": "" }, { "docid": "395d22892e2cad3d398d09f79cfe427f", "score": "0.6017272", "text": "func getBucketHandle(bucketID string) (*storage.BucketHandle, error) {\n\n\tctx := context.Background()\n\n\tclient, err := storage.NewClient(ctx)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client.Bucket(bucketID), nil\n}", "title": "" }, { "docid": "c6898fda31be173d99488b29c3372ccc", "score": "0.6009367", "text": "func (c *CassandraBackend) bucketName(name string) string {\n\tif name == \"\" {\n\t\tname = \".\"\n\t}\n\treturn strings.TrimRight(name, \"/\")\n}", "title": "" }, { "docid": "b5ae69f6ea5478433ca35944bfb74559", "score": "0.6009229", "text": "func (obj *bucket) Bucket() buckets.Bucket {\n\treturn obj.bucket\n}", "title": "" }, { "docid": "8e17219bc603d912466357c91bf94e15", "score": "0.60066915", "text": "func (c *Client) Bucket(name string) *BucketHandle {\n\treturn &BucketHandle{\n\t\tBucketHandle: c.Client.Bucket(name),\n\t\tName: name,\n\t}\n}", "title": "" }, { "docid": "a90e9e297250d09551aaecf588ffa05a", "score": "0.6004236", "text": "func (r *S3Url) Bucket() string {\n\treturn r.keys()[0]\n}", "title": "" }, { "docid": "51a6ae41166ccd6745745a8a61bba917", "score": "0.59920937", "text": "func bucketForHost(host string) string {\n\tif b, ok := config.Buckets[host]; ok {\n\t\treturn b\n\t}\n\treturn config.Buckets[\"default\"]\n}", "title": "" }, { "docid": "521d2dd0bb91748a47452729c9806bb8", "score": "0.5979888", "text": "func openBucket(ctx context.Context, client *gcp.HTTPClient, bucketName string, opts *Options) (*bucket, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"gcsblob.OpenBucket: client is required\")\n\t}\n\tif bucketName == \"\" {\n\t\treturn nil, errors.New(\"gcsblob.OpenBucket: bucketName is required\")\n\t}\n\n\tclientOpts := []option.ClientOption{option.WithHTTPClient(useragent.HTTPClient(&client.Client, \"blob\"))}\n\tif host := os.Getenv(\"STORAGE_EMULATOR_HOST\"); host != \"\" {\n\t\tclientOpts = []option.ClientOption{\n\t\t\toption.WithoutAuthentication(),\n\t\t\toption.WithEndpoint(\"http://\" + host + \"/storage/v1/\"),\n\t\t\toption.WithHTTPClient(http.DefaultClient),\n\t\t}\n\t}\n\n\t// We wrap the provided http.Client to add a Go CDK User-Agent.\n\tc, err := storage.NewClient(ctx, clientOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif opts == nil {\n\t\topts = &Options{}\n\t}\n\treturn &bucket{name: bucketName, client: c, opts: opts}, nil\n}", "title": "" }, { "docid": "2b0a4217e417e45be170a8f351657f62", "score": "0.5932001", "text": "func (f *freezerRemoteStorj) bucketName() string {\n\treturn fmt.Sprintf(\"%s\", f.namespace)\n}", "title": "" }, { "docid": "563f5234dc2cb13c22a0a6b25e44c5a9", "score": "0.59029096", "text": "func LocalBucket(localConnectStr, bucketName string) (*couchbase.Bucket, error) {\n\tlogger_utils.Debugf(\"Getting local bucket name=%v\\n\", bucketName)\n\n\tpool, err := LocalPool(localConnectStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbucket, err := pool.GetBucket(bucketName)\n\tif err != nil {\n\t\treturn nil, NewEnhancedError(fmt.Sprintf(\"Error getting bucket, %v, from pool.\", bucketName), err)\n\t}\n\n\tlogger_utils.Debugf(\"Got local bucket successfully name=%v\\n\", bucket.Name)\n\treturn bucket, err\n}", "title": "" }, { "docid": "3a30c24072c7342df377d772434e7d2e", "score": "0.58689344", "text": "func (c *clientDelegate) Bucket(bucketName string) BucketHandleWrapper {\n\treturn &bucketDelegate{bucket: c.nativeClient.Bucket(bucketName)}\n}", "title": "" }, { "docid": "9f61a14258ba2f7c857eec662262731e", "score": "0.5866832", "text": "func (s *Storage) BucketName() string {\n\treturn s.storage.BucketName()\n}", "title": "" }, { "docid": "a825b703fb40bf75c856ace91d0ad33a", "score": "0.585658", "text": "func localBucket() (*blob.Bucket, error) {\n\treturn fileblob.OpenBucket(viper.GetString(\"local.bucket\"), nil)\n}", "title": "" }, { "docid": "c3a5c6ec82003c7abb1a806aa4359aba", "score": "0.58261997", "text": "func (c *inMemoryCache) getBucket(key string) *cacheBucket {\n\t// hash := utils.MemHashString(key)\n\thash := xxhash.Sum64String(key)\n\tbucketKey := hash % bucketCount\n\treturn c.buckets[bucketKey]\n}", "title": "" }, { "docid": "8bf93a67b71368e2dc156efd97353a7a", "score": "0.57965016", "text": "func (b *UserBucketClient) Name() string { return b.bucket.Name() }", "title": "" }, { "docid": "9f112b2e9604d0311e435eae6cf59ece", "score": "0.57922137", "text": "func New(txn Txn, name []byte) (*Bucket, error) {\n\tif len(name) == 0 {\n\t\treturn nil, ErrEmptyName\n\t}\n\n\tkey := append(nameMapPrefix, name...)\n\n\tprefix, err := txn.Get(key)\n\tif err == nil {\n\t\treturn &Bucket{prefix}, nil\n\t} else if err != ErrKeyNotFound {\n\t\treturn nil, err\n\t}\n\n\tcountData, err := txn.Get(nameMapPrefix)\n\n\tif err == ErrKeyNotFound {\n\t\tcountData = nameMapPrefix\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\n\tcount, _, _ := byframe.DecodeHeader(countData)\n\tcountData = byframe.EncodeHeader(count + 1)\n\n\terr = txn.Set(nameMapPrefix, countData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// count as prefix\n\terr = txn.Set(key, countData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Bucket{countData}, nil\n}", "title": "" }, { "docid": "37c5f0a6901f7042f7600de5d53b9a3b", "score": "0.5790844", "text": "func New(s s3iface.S3API, name string) *Bucket {\n\treturn &Bucket{\n\t\tS3: s,\n\t\tName: aws.String(name),\n\t}\n}", "title": "" }, { "docid": "c99069dd5d87c427583e9f8a63f8e11c", "score": "0.57902247", "text": "func LookupBucket(ctx *pulumi.Context, args *LookupBucketArgs, opts ...pulumi.InvokeOption) (*LookupBucketResult, error) {\n\tvar rv LookupBucketResult\n\terr := ctx.Invoke(\"google-native:storage/v1:getBucket\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "9b9f0e467caae34de8fcf25bccc617c6", "score": "0.5772942", "text": "func (o StorageSourceManifestPtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *StorageSourceManifest) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7fabaaa237264f7934dcf785d7878e12", "score": "0.5697601", "text": "func GetBucket(tx *bolt.Tx, location string) (*bolt.Bucket, error) {\n\tif location == \"\" {\n\t\treturn nil, ErrLocationMustHaveAtLeastOneBucket\n\t}\n\n\t// split the 'bucket' on '.'\n\tbuckets := strings.Split(location, \".\")\n\tif buckets[0] == \"\" {\n\t\treturn nil, ErrInvalidLocationBucket\n\t}\n\n\t// get the first bucket\n\tb := tx.Bucket([]byte(buckets[0]))\n\tif b == nil {\n\t\treturn nil, nil\n\t}\n\n\t// loop through if we have more than 2\n\tif len(buckets) > 1 {\n\t\tfor _, name := range buckets[1:] {\n\t\t\tif name == \"\" {\n\t\t\t\treturn nil, ErrInvalidLocationBucket\n\t\t\t}\n\t\t\tb = b.Bucket([]byte(name))\n\t\t\tif b == nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "596dc68de39c671bf4bf40181473d16c", "score": "0.56936973", "text": "func (o *T) Bucket() *bolt.Bucket {\n\treturn o.db\n}", "title": "" }, { "docid": "7fe7e8a085617d74efa30c097e6b6509", "score": "0.5684722", "text": "func (db *GBucket) bucketHandle(ctx storage.Context) (*api.BucketHandle, error) {\n\tif !ctx.Versioned() || db.version < MULTIBUCKET {\n\t\t// unversioned context should be sent to master bucket\n\t\treturn db.bucket, nil\n\t}\n\n\t// grab root uuid\n\trootuuid, err := ctx.(storage.VersionedCtx).RepoRoot()\n\tif err != nil {\n\t\treturn nil, err\n\n\t}\n\n\t// create bucket if it does not exist\n\tif bucket, ok := db.repo2bucket[string(rootuuid)]; !ok {\n\t\t// !! assume name not previously created\n\n\t\t// choose initial name\n\t\tbucketname := db.bname + REPONAME + string(rootuuid)\n\t\t// create bucket handle\n\t\tbucket = db.client.Bucket(bucketname)\n\n\t\t// check if bucket exists\n\t\tif _, err = bucket.Attrs(db.ctx); err != nil {\n\t\t\t// create bucket and reuse permissions\n\t\t\t// ignore error, assume already created\n\t\t\tbucket.Create(db.ctx, db.projectid, db.bucket_attrs)\n\t\t}\n\n\t\t// if name doesn't exist create new bucket handle and load new key value\n\t\tdb.repo2bucket[string(rootuuid)] = bucket\n\t\treturn bucket, nil\n\t} else {\n\t\treturn bucket, nil\n\t}\n}", "title": "" }, { "docid": "8c0e24bcf5350224446946707ad6268a", "score": "0.56639373", "text": "func GetBucket() string {\n\treturn awsManager.BucketName\n}", "title": "" }, { "docid": "78ba5e0057e436774594873b6ac39fa0", "score": "0.5663403", "text": "func (o StorageSourceManifestOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageSourceManifest) *string { return v.Bucket }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "83cb3c3e8ee60c35a831176e636f72a8", "score": "0.56293875", "text": "func New(name []byte, db *bolt.DB) (*Bucket, error) {\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\tif _, err := tx.CreateBucketIfNotExists(name); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Bucket{name, db}, nil\n}", "title": "" }, { "docid": "9c552b8e7fc571aaf8857e1ef6caefa1", "score": "0.5615664", "text": "func (s *Storage) Default() *Bucket {\n\tbucket, ok := s.buckets.Load(s.defaultBucket)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn bucket.(*Bucket)\n}", "title": "" }, { "docid": "5838d09aadbaf0b702fa08b23543aa9e", "score": "0.5612255", "text": "func (b *bucket) Get(key string) (interface{}, error) {\n\treturn b.getBucket(key).get(key)\n}", "title": "" }, { "docid": "112c2cc27bed0f5d2f1e24b96d0bc3be", "score": "0.5605023", "text": "func (db *MemDB) GetBucket(key string) DB {\n\treturn db.children[key]\n}", "title": "" }, { "docid": "ae1bed3a82ac2030c01578e10cd52fcb", "score": "0.55966276", "text": "func (b *GCSBucket) Name() string {\n\treturn b.GCSBucketName\n}", "title": "" }, { "docid": "c07d89ddb6aaaa08d7ba3d418daef635", "score": "0.5588135", "text": "func getS3Bucket(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {\n\tplugin.Logger(ctx).Trace(\"listS3Buckets\")\n\tdefaultRegion := GetDefaultAwsRegion(d)\n\tname := d.KeyColumnQuals[\"name\"].GetStringValue()\n\n\t// Create Session\n\tsvc, err := S3Service(ctx, d, defaultRegion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// execute list call\n\tinput := &s3.ListBucketsInput{}\n\tbucketsResult, err := svc.ListBuckets(input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, item := range bucketsResult.Buckets {\n\t\tif *item.Name == name {\n\t\t\treturn item, nil\n\t\t}\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "bfdef6053cf9ad7ca3df1b73bf949329", "score": "0.55539083", "text": "func (o StorageSourceResponseOutput) Bucket() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StorageSourceResponse) string { return v.Bucket }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e69ae3e6b57a89af97d43334b338ddc3", "score": "0.5542387", "text": "func New(bucket string) (*Cache, error) {\n\tclient, err := storage.NewClient(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := &Cache{client, bucket}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "19d6e3dba7948be9be2b639db52170b7", "score": "0.5534367", "text": "func (o LinkedDatasetOutput) Bucket() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LinkedDataset) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "987cf4669152e602ed0e5e3a339ba43c", "score": "0.5516298", "text": "func (o WorkflowOnExceptionStepDecryptStepDetailsDestinationFileLocationS3FileLocationPtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WorkflowOnExceptionStepDecryptStepDetailsDestinationFileLocationS3FileLocation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "224ccd5a6149244398bf0cf6490a0e84", "score": "0.5516146", "text": "func (o WorkflowStepDecryptStepDetailsDestinationFileLocationS3FileLocationPtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WorkflowStepDecryptStepDetailsDestinationFileLocationS3FileLocation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cf9a12b31ee17f2a3ccd790d8b5c4224", "score": "0.55034304", "text": "func NewStorage(ctx context.Context, bucket, scope string, key []byte, prefix string) (*Storage, error) {\n\t// key must be JSON-format as {\"project_id\":...}\n\tcredMap := make(map[string]string)\n\tif err := json.Unmarshal(key, &credMap); err != nil {\n\t\treturn nil, err\n\t}\n\tproject, ok := credMap[\"project_id\"]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"key has no project_id\")\n\t}\n\n\tjwt, err := google.JWTConfigFromJSON(key, scope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcli, err := storage.NewClient(ctx, option.WithTokenSource(jwt.TokenSource(ctx)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tglog.Infof(\"creating bucket %q\", bucket)\n\tcctx, cancel := context.WithTimeout(ctx, 30*time.Second)\n\terr = cli.Bucket(bucket).Create(cctx, project, nil)\n\tcancel()\n\tif err != nil {\n\t\t// expects; \"googleapi: Error 409: You already own this bucket. Please select another name., conflict\"\n\t\t// https://cloud.google.com/storage/docs/xml-api/reference-status#409conflict\n\t\tgerr, ok := err.(*googleapi.Error)\n\t\tif !ok {\n\t\t\t// failed to create/receive duplicate bucket\n\t\t\treturn nil, err\n\t\t}\n\t\tif gerr.Code != 409 || gerr.Message != \"You already own this bucket. Please select another name.\" {\n\t\t\treturn nil, err\n\t\t}\n\t\tglog.Infof(\"%q already exists\", bucket)\n\t} else {\n\t\tglog.Infof(\"created bucket %q\", bucket)\n\t}\n\n\treturn &Storage{projectID: project, bucket: bucket, prefix: prefix, ctx: ctx, client: cli}, nil\n}", "title": "" }, { "docid": "88a3de9306ed3cf39d25c588db02530f", "score": "0.54864985", "text": "func (b *UserBucketReaderClient) Get(ctx context.Context, name string) (io.ReadCloser, error) {\n\treturn b.bucket.Get(ctx, b.fullName(name))\n}", "title": "" }, { "docid": "7cc244242b5e6697880aa882196c94c1", "score": "0.54792637", "text": "func (o WorkflowOnExceptionStepCopyStepDetailsDestinationFileLocationS3FileLocationPtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WorkflowOnExceptionStepCopyStepDetailsDestinationFileLocationS3FileLocation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ecb9dc85a45aa1c25727593d483d3093", "score": "0.54709065", "text": "func (o WorkflowStepCopyStepDetailsDestinationFileLocationS3FileLocationPtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WorkflowStepCopyStepDetailsDestinationFileLocationS3FileLocation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "62db9ca83fb1bf368aa8593574c069d0", "score": "0.5470234", "text": "func (ser *MediaRelationService) Bucket() string {\n\treturn \"MediaRelation\"\n}", "title": "" }, { "docid": "50038a53ab825390b5882d913cb15b17", "score": "0.5460913", "text": "func configureStorage(bucketID string) (*storage.BucketHandle, error) {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.Bucket(bucketID), nil\n}", "title": "" }, { "docid": "a6fda2d3a8346da00dd275a63e451e5f", "score": "0.54519343", "text": "func awsBucket(ctx context.Context, cp awsclient.ConfigProvider, flags *cliFlags) (*blob.Bucket, func(), error) {\n\tb, err := s3blob.OpenBucket(ctx, cp, flags.bucket, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn b, func() { b.Close() }, nil\n}", "title": "" }, { "docid": "8896b11c5117ba0577bafc192abd1ec0", "score": "0.54450905", "text": "func (o WorkflowStepDecryptStepDetailsDestinationFileLocationS3FileLocationOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WorkflowStepDecryptStepDetailsDestinationFileLocationS3FileLocation) *string { return v.Bucket }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "17034c5a0442648156a311f7637e4456", "score": "0.54400235", "text": "func Get(bucket *s3.Bucket, path string) (data []byte, er error) {\n\tdata, err := bucket.Get(path)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn data, err\n}", "title": "" }, { "docid": "7a4156b40cb70b28128e2ead5d61888b", "score": "0.5425724", "text": "func UpdateBucket(bucketName, bucketType string) {\n}", "title": "" }, { "docid": "d9df820e53433fb7d2af332d9068533f", "score": "0.5409174", "text": "func (l *Local) BucketName() string {\n\treturn l.config.Bucket\n}", "title": "" }, { "docid": "85d0ac93fd791ca5d07c03d8e53447b7", "score": "0.54077864", "text": "func (b *Bucket) Get(ctx context.Context, name string) (io.ReadCloser, error) {\n\treturn b.getRange(ctx, name, 0, -1)\n}", "title": "" }, { "docid": "7356aae43239c02698f9e3d83906929d", "score": "0.54059756", "text": "func (o WorkflowStepCopyStepDetailsDestinationFileLocationS3FileLocationOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WorkflowStepCopyStepDetailsDestinationFileLocationS3FileLocation) *string { return v.Bucket }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c5bd704387ed8250b01833dd433d6c74", "score": "0.5405213", "text": "func (cfg *TierConfig) Bucket() string {\n\tswitch cfg.Type {\n\tcase S3:\n\t\treturn cfg.S3.Bucket\n\tcase Azure:\n\t\treturn cfg.Azure.Bucket\n\tcase GCS:\n\t\treturn cfg.GCS.Bucket\n\t}\n\tlog.Printf(\"unexpected tier type %s\", cfg.Type)\n\treturn \"\"\n}", "title": "" }, { "docid": "958f350d881c5b917de57fb12ce835c9", "score": "0.54036826", "text": "func (f *FS) Get(ctx context.Context, o string) (cloudstorage.Object, error) {\n\n\tbucket, err := f.client.Bucket(f.bucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcf := cloudstorage.CachePathObj(f.cachepath, o, f.ID)\n\n\tblobRef := &blobRef{fs: f,\n\t\tbucket: bucket,\n\t\tname: o,\n\t\tcachepath: cf,\n\t\tmetadata: map[string]string{cloudstorage.ContentTypeKey: cloudstorage.ContentType(o)},\n\t}\n\n\treturn blobRef, nil\n\n}", "title": "" }, { "docid": "02e61c1b565dc865e5c398729d5bbbbb", "score": "0.5391554", "text": "func (o WorkflowOnExceptionStepDecryptStepDetailsDestinationFileLocationS3FileLocationOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WorkflowOnExceptionStepDecryptStepDetailsDestinationFileLocationS3FileLocation) *string {\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1d5feeac5d3667b9840de935fdfcd105", "score": "0.53680897", "text": "func (o *OCIObjectStore) CheckBucket(name string) error {\n\n\tlog.Info(\"Getting credentials\")\n\toci, err := oci.NewOCI(verify.CreateOCICredential(o.secret.Values))\n\tif err != nil {\n\t\tlog.Errorf(\"Getting credentials failed: %s\", err.Error())\n\t\treturn err\n\t}\n\n\tmanagedBucket := &model.ManagedOracleBucket{}\n\tsearchCriteria := o.newManagedBucketSearchCriteria(name, o.location, oci.CompartmentOCID)\n\n\tlog.Infof(\"Looking up managed bucket: name=%s\", name)\n\tif err := getManagedBucket(searchCriteria, managedBucket); err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\terr = oci.ChangeRegion(managedBucket.Location)\n\tif err != nil {\n\t\tlog.Errorf(\"Bucket creation error: %s\", err)\n\t}\n\n\tclient, err := oci.NewObjectStorageClient()\n\tif err != nil {\n\t\tlog.Errorf(\"Creating Oracle object storage client failed: %s\", err.Error())\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Getting bucket with name: %s\", name)\n\t_, err = client.GetBucket(name)\n\n\treturn err\n}", "title": "" }, { "docid": "7b46c13a233c42e2d4b6ad49b476c2bc", "score": "0.5364303", "text": "func LogBucket() string {\n\treturn bucketDefault\n}", "title": "" }, { "docid": "e11bd550d3713d5bae91f1a277f32b29", "score": "0.53564495", "text": "func (c *Client) BucketByName(name string, createIfNotExists bool) (*BucketInfo, error) {\n\tbs, err := c.Buckets()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, b := range bs {\n\t\tif b.Name == name {\n\t\t\treturn b, nil\n\t\t}\n\t}\n\tif !createIfNotExists {\n\t\treturn nil, errors.New(\"bucket not found: \" + name)\n\t}\n\treturn c.CreateBucket(name, false)\n}", "title": "" }, { "docid": "b94972a3cd7980679bd2762cba01d595", "score": "0.5353468", "text": "func (o WorkflowOnExceptionStepCopyStepDetailsDestinationFileLocationS3FileLocationOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WorkflowOnExceptionStepCopyStepDetailsDestinationFileLocationS3FileLocation) *string {\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1934ef1c118a00d83ca8f256bfad3e66", "score": "0.53526217", "text": "func DeleteBucket(bucketID string) {\n}", "title": "" }, { "docid": "dec8999c9bec7168551ed43bf97141f7", "score": "0.53479934", "text": "func newBucket(p *pool, dir string) (b *bucket, e query.Error) {\n\tb = new(bucket)\n\tb.pool = p\n\tb.name = dir\n\n\tf, err := os.Open(b.path())\n\tif err != nil {\n\t\tif f != nil {\n\t\t\tf.Close()\n\t\t}\n\n\t\treturn nil, query.NewError(err, \"\")\n\t}\n\n\tb.indexes = make(map[string]catalog.Index, 1)\n\tpi := new(primaryIndex)\n\tb.primary = pi\n\tpi.bucket = b\n\tpi.name = \"all_docs\"\n\tb.indexes[pi.name] = pi\n\n\treturn\n}", "title": "" }, { "docid": "9c9ddaeeec1a0c1d848a4a4b3670944f", "score": "0.5346628", "text": "func (r *Registry) Bucket(nodes ...string) (brazier.Bucket, error) {\n\tr.BucketInvoked = true\n\n\t_, err := r.bucket(nodes...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Backend.Bucket(nodes...)\n}", "title": "" }, { "docid": "e26ec9f4a2361bba6f0449357fa56e66", "score": "0.5342718", "text": "func (instance ObjectStorageBucket) GetName() string {\n\treturn instance.Name\n}", "title": "" }, { "docid": "ea29ef70e68cbb83882937135e923277", "score": "0.5342701", "text": "func NewBucket(bucketName, donutName string, nodes map[string]Node) (Bucket, error) {\n\tif bucketName == \"\" {\n\t\treturn nil, errors.New(\"invalid argument\")\n\t}\n\tb := bucket{}\n\tb.name = bucketName\n\tb.donutName = donutName\n\tb.objects = make(map[string]Object)\n\tb.nodes = nodes\n\treturn b, nil\n}", "title": "" }, { "docid": "489418724938812548ae9dc41c2e7a33", "score": "0.53397614", "text": "func sanitizeBucket(s string) string {\n\treturn sanitizeObject(strings.TrimPrefix(s, \"gs://\"))\n}", "title": "" }, { "docid": "08ef5d24334d95a346a5d5319121848d", "score": "0.5337813", "text": "func getBucketRegion(svc s3iface.S3API, bucketName *string) (string, error) {\n\tvar loc string\n\tlocation, err := svc.GetBucketLocation(&s3.GetBucketLocationInput{Bucket: bucketName})\n\tif location.LocationConstraint != nil {\n\t\tloc = *location.LocationConstraint\n\t}\n\treturn s3.NormalizeBucketLocation(loc), err\n}", "title": "" }, { "docid": "6c9d81403b24147457f4c8b91c788b08", "score": "0.53170043", "text": "func (f MetadataFolder) GetBucket() abstract.ObjectStorageBucket {\n\tif f.IsNull() {\n\t\treturn abstract.ObjectStorageBucket{}\n\t}\n\treturn f.service.GetMetadataBucket()\n}", "title": "" }, { "docid": "07b13c290e7e11e111cba5c7b2067116", "score": "0.53158104", "text": "func (ser *UserPersonService) Bucket() string {\n\treturn \"UserPerson\"\n}", "title": "" }, { "docid": "91aa013dea537d068816b4410f8b2bb7", "score": "0.53064805", "text": "func (e *Engine) newGBucket(config dvid.StoreConfig) (*GBucket, bool, error) {\n\tgb, err := parseConfig(config)\n\tif err != nil {\n\t\treturn nil, false, fmt.Errorf(\"Error in newGBucket() %s\\n\", err)\n\t}\n\n\t// NewClient uses Application Default Credentials to authenticate.\n\tcredval := os.Getenv(\"GOOGLE_APPLICATION_CREDENTIALS\")\n\tif credval == \"\" {\n\t\tgb.client, err = api.NewClient(gb.ctx, option.WithHTTPClient(http.DefaultClient))\n\t} else {\n\t\t// use saved credentials\n\t\tgb.client, err = api.NewClient(gb.ctx)\n\n\t\t// grab project_id\n\t\tvar credconfig GCredentials\n\t\trawcred, err := ioutil.ReadFile(credval)\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\tjson.Unmarshal(rawcred, &credconfig)\n\n\t\tgb.projectid = credconfig.ProjectID\n\t}\n\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\t// bucket must already exist -- check existence\n\tgb.bucket = gb.client.Bucket(gb.bname)\n\tgb.bucket_attrs, err = gb.bucket.Attrs(gb.ctx)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tvar created bool\n\tcreated = false\n\n\tval, err := gb.getV(storage.Key(INITKEY), nil)\n\tvar version string\n\t// check if value exists\n\tif val == nil {\n\t\tcreated = true\n\n\t\t// conditional put is probably not necessary since\n\t\t// all workers should be posting same version\n\t\terr = gb.putV(storage.Key(INITKEY), []byte(CURVER), nil)\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\tversion = CURVER\n\t} else if len(val) == 1 {\n\t\t// set default version (versionless original wrote out 1 byte)\n\t\tversion = ORIGVER\n\t} else {\n\t\tversion = string(val)\n\t}\n\n\t// save version as float\n\tif gb.version, err = strconv.ParseFloat(version, 64); err != nil {\n\t\treturn nil, false, err\n\t}\n\n\t// check version enables repo\n\tif gb.version >= MULTIBUCKET {\n\t\tgb.repo2bucket = make(map[string]*api.BucketHandle)\n\t\t// TODO: pre-populate based on custom repo names\n\t}\n\n\t// assume if not newly created that data exists\n\t// 'created' not meaningful if concurrent calls\n\treturn gb, created, nil\n}", "title": "" }, { "docid": "59d886be5a575bb7cfea9f9cbdd477ff", "score": "0.53049743", "text": "func (c *Cache) Put(ctx context.Context, name string, data []byte) error {\n\tw := c.client.Bucket(c.bucket).Object(name).NewWriter(context.Background())\n\tw.Write(data)\n\treturn w.Close()\n}", "title": "" }, { "docid": "ac430cb03411a4ee113c2ce25327e4cb", "score": "0.52945143", "text": "func newBucket(contact *Contact) *MyBucket {\n\tbucket := MyBucket{list.New()}\n\tbucket.list.PushFront(*contact)\n\treturn &bucket\n}", "title": "" }, { "docid": "ef3633158d23dfd318066ee314102ec9", "score": "0.52797973", "text": "func (b *Bucket) Name() string {\n\treturn b.name\n}", "title": "" }, { "docid": "713ec7f64380b717fb231013647129ed", "score": "0.5275182", "text": "func FromBucket(ctx context.Context, bucket *blob.Bucket, root string) Interface {\n\troot = path.Clean(root)\n\treturn &bucketFetcher{\n\t\tbaseFetcher: baseFetcher{\n\t\t\tlatency: fetchLatency.WithLabelValues(\"bucket\", root),\n\t\t},\n\t\tcontext: ctx,\n\t\tbucket: bucket,\n\t\troot: root,\n\t}\n}", "title": "" }, { "docid": "d7148c029ab5c421d01d001ba59f3cae", "score": "0.52708715", "text": "func (o PipelineThumbnailConfigPtrOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PipelineThumbnailConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Bucket\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7e871c85c79dab5f67e603765e98c728", "score": "0.5269203", "text": "func (kv *KVite) bucketSetup(tx *kvite.Tx) (*kvite.Bucket, error) {\n\t// Setup the bucket\n\tbucket, err := tx.Bucket(kviteBucket)\n\tif err != nil {\n\t\tlog.WithFields(kviteLogFields).WithFields(log.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"bucket\": kviteBucket,\n\t\t}).Error(\"failed to retrieve bucket\")\n\t\treturn nil, err\n\t}\n\tif bucket == nil {\n\t\tlog.WithFields(kviteLogFields).WithFields(log.Fields{\n\t\t\t\"bucket\": kviteBucket,\n\t\t}).Info(\"bucket does not exist\")\n\t}\n\treturn bucket, err\n}", "title": "" }, { "docid": "72fbc2b9dfedc6706d861e7e9cf09bd8", "score": "0.52653354", "text": "func (s *Server) Bucket(ctx context.Context, subKey string) *Bucket {\n\tidx := cityhash.CityHash32([]byte(subKey), uint32(len(subKey))) % s.bucketIdx\n\tlog.Bg().Info(fmt.Sprintf(\"\\\"%s\\\" hit channel bucket index: %d use cityhash\", subKey, idx))\n\treturn s.Buckets[idx]\n}", "title": "" }, { "docid": "073be5434ee27ca157f535805360720f", "score": "0.52518994", "text": "func AWSS3Bucket(val string) attribute.KeyValue {\n\treturn AWSS3BucketKey.String(val)\n}", "title": "" }, { "docid": "7a443910cff15b7c868b11bb25b696fb", "score": "0.52460843", "text": "func (o StorageSourceManifestResponseOutput) Bucket() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StorageSourceManifestResponse) string { return v.Bucket }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c87ee9fcb3f482210f6a7aa0fd849716", "score": "0.5240385", "text": "func (o PipelineThumbnailConfigOutput) Bucket() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PipelineThumbnailConfig) *string { return v.Bucket }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "56b13d651953176ae2105864bc2bca1c", "score": "0.52395797", "text": "func (db bucketDB) resetBucket(bucket ddbBucket, expiresIn time.Duration) (*ddbBucket, error) {\n\t// dbMaxVersion is an arbitrary constant to prevent the version field from overflowing\n\tvar dbMaxVersion uint = 2 << 28\n\tnewVersion := bucket.Version + 1\n\tif newVersion > dbMaxVersion {\n\t\tnewVersion = 0\n\t}\n\tupdatedBucket := newDDBBucket(bucket.ddbBucketStatePrimaryKey.Name, expiresIn, db.ttl)\n\tupdatedBucket.Version = newVersion\n\tdata, err := encodeBucket(updatedBucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = db.ddb.PutItem(&dynamodb.PutItemInput{\n\t\tTableName: aws.String(db.tableName),\n\t\tItem: data,\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":v\": {\n\t\t\t\tN: aws.String(fmt.Sprintf(\"%0d\", bucket.Version)),\n\t\t\t},\n\t\t},\n\t\tConditionExpression: aws.String(\"version = :v\"),\n\t})\n\tif err != nil {\n\t\tif !awsErr(err, dynamodb.ErrCodeConditionalCheckFailedException) {\n\t\t\treturn nil, err\n\t\t}\n\t\t// A conditional check failing means another consumer of this bucket reset at the same time.\n\t\t// We can simply swallow the error and re-fetch the bucket\n\t\treturn db.bucket(bucket.Name)\n\t}\n\treturn &updatedBucket, nil\n}", "title": "" }, { "docid": "50d63f75b1e573a4395da2a16678762f", "score": "0.52380306", "text": "func New(cfg Config) (*Storage, error) {\n\tdb, err := bolt.Open(cfg.DBPath, 0600, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not open database: %v\", err)\n\t}\n\n\tbuckets := new(sync.Map)\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tfor i := range cfg.Buckets {\n\t\t\tbucketName := cfg.Buckets[i]\n\n\t\t\t_, err := tx.CreateBucketIfNotExists(wrap(bucketName))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not create `%s` bucket: %v\", bucketName, err)\n\t\t\t}\n\n\t\t\tbuckets.Store(bucketName, &Bucket{\n\t\t\t\tname: bucketName,\n\t\t\t\tdb: db,\n\t\t\t})\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not init storage buckets: %v\", err)\n\t}\n\n\treturn &Storage{\n\t\tdb: db,\n\t\tbuckets: buckets,\n\t\tdefaultBucket: cfg.DefaultBucket,\n\t}, nil\n}", "title": "" }, { "docid": "42f8b9ee657631b2bf0f5a53acff315a", "score": "0.52271", "text": "func NewBucket(logger log.Logger, confFile string, reg *prometheus.Registry, component string) (objstore.Bucket, error) {\n\tlevel.Info(logger).Log(\"msg\", \"loading bucket configuration file\", \"filename\", confFile)\n\n\tvar err error\n\tif confFile == \"\" {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tbucketConf, err := loadFile(confFile)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"parsing objstore.config-file\")\n\t}\n\n\tconfig, err := yaml.Marshal(bucketConf.Config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal content of bucket configuration\")\n\t}\n\n\tvar bucket objstore.Bucket\n\tswitch bucketConf.Type {\n\tcase GCS:\n\t\tbucket, err = gcs.NewBucket(context.Background(), logger, config, reg, component)\n\tcase S3:\n\t\tbucket, err = s3.NewBucket(logger, config, reg, component)\n\tdefault:\n\t\treturn nil, errors.Errorf(\"bucket with type %s is not supported\", bucketConf.Type)\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"create %s client\", bucketConf.Type))\n\t}\n\treturn objstore.BucketWithMetrics(bucket.Name(), bucket, reg), nil\n}", "title": "" }, { "docid": "6bfea4f2401f416cfd3c4f56f7b3be47", "score": "0.52221596", "text": "func HaveBucket(message string) (string, bool) {\n\tout := commander.CmdRunOut(\"aws s3 ls\")\n\tbucket := userinputs.RequestAnswer(message)\n\toutSlice := strings.Split(out, \" \")\n\tfor _, o := range outSlice {\n\t\toSlice := strings.Split(o, \"\\n\")\n\t\tfor _, oo := range oSlice {\n\t\t\tif oo == bucket {\n\t\t\t\tbucket = \"s3://\" + bucket\n\t\t\t\treturn bucket, true\n\t\t\t}\n\t\t}\n\t}\n\tbucket = \"s3://\" + bucket\n\treturn bucket, false\n}", "title": "" }, { "docid": "01fe1977b9c74e807558699b12e0792f", "score": "0.5219438", "text": "func (testSuite *EndToEndSuite) AWSS3BucketName(testName string) string {\n\tif testSuite == nil ||\n\t\ttestSuite.testBucketNames == nil {\n\t\treturn \"\"\n\t}\n\n\treturn testSuite.testBucketNames[testName]\n}", "title": "" }, { "docid": "7b1c48b35802abf472e61871ba2b45c4", "score": "0.5218149", "text": "func (f MetadataFolder) getBucket() abstract.ObjectStorageBucket {\n\treturn f.service.GetMetadataBucket()\n}", "title": "" }, { "docid": "e2e7becf3279a7fd7677feaca046a9f2", "score": "0.5216924", "text": "func deleteMyBucket(svc *s3.S3, bucketName string) {\n fmt.Printf(\"\\nDeleting the bucket named '\" + bucketName + \"'...\\n\\n\")\n\n _, err := svc.DeleteBucket(&s3.DeleteBucketInput{\n Bucket: aws.String(bucketName),\n })\n\n if err != nil {\n exitErrorf(\"Unable to delete bucket, %v\", err)\n }\n \n // Wait until bucket is deleted before finishing\n fmt.Printf(\"Waiting for bucket %q to be deleted...\\n\", bucketName)\n\n err = svc.WaitUntilBucketNotExists(&s3.HeadBucketInput{\n Bucket: aws.String(bucketName),\n })\n}", "title": "" }, { "docid": "5c3216e996389b7971c945c1066de0d8", "score": "0.52132934", "text": "func NewBucket() *Bucket {\n\treturn &Bucket{\n\t\tList: list.New(),\n\t\tmutex: &sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "45aa29510b78556450ab765ab97ebc5f", "score": "0.52129877", "text": "func (b *Bucket) Remove(name string) error {\n\tclient := &client{transport: b.Transport}\n\tu, err := url.Parse(storageBaseURL + \"/b/\" + b.Name + \"/o/\" + name)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn client.Do(\"DELETE\", u, nil, nil)\n}", "title": "" }, { "docid": "6de28cb4542dba83215b3ed6b80cd8d7", "score": "0.5212828", "text": "func makeTestBucket(data []byte) *storage.Bucket {\n\tbucket := new(storage.Bucket)\n\t_ = json.Unmarshal(data, &bucket)\n\treturn bucket\n}", "title": "" }, { "docid": "eb49a795beb71dff94bfaeaa1a8ecb25", "score": "0.5212288", "text": "func newGCS(ctx context.Context, projectID, bucket string, ttl time.Duration, manageBucket bool) (Store, error) {\n\tclient, err := storage.NewClient(ctx, gcsClientOptions()...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &gcsStore{\n\t\tprojectID: projectID,\n\t\tbucket: bucket,\n\t\tttl: ttl,\n\t\tmanageBucket: manageBucket,\n\t\tclient: client,\n\t}, nil\n}", "title": "" }, { "docid": "3743b6f9c9d73ba2c3c0a94451e6b293", "score": "0.5211512", "text": "func (ser *MediaGenreService) Bucket() string {\n\treturn \"MediaGenre\"\n}", "title": "" }, { "docid": "425329f47191b3f6080655b8f4f784f7", "score": "0.5204183", "text": "func NewBucketClient(ctx context.Context, cfg Config, name string, logger log.Logger) (objstore.Bucket, error) {\n\tbucketConfig := gcs.Config{\n\t\tBucket: cfg.BucketName,\n\t\tServiceAccount: cfg.ServiceAccount.Value,\n\t}\n\n\t// Thanos currently doesn't support passing the config as is, but expects a YAML,\n\t// so we're going to serialize it.\n\tserialized, err := yaml.Marshal(bucketConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcs.NewBucket(ctx, logger, serialized, name)\n}", "title": "" }, { "docid": "d1e8752f36ad9f6aa202550c3a304c7e", "score": "0.52021384", "text": "func newBucket(opts RateOpts) *bucket {\n\treturn &bucket{\n\t\topts: opts,\n\t}\n}", "title": "" } ]
57778cd552b20972568c85422d9e172f
getScenes is a get endpoint for querying all available scenes
[ { "docid": "3568400fc2379e7c0784ee6b4f96fd6f", "score": "0.80891824", "text": "func GetScenes(w http.ResponseWriter, r *http.Request) {\n\tif err := json.NewEncoder(w).Encode(scenes); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" } ]
[ { "docid": "02fbe71b4015820e372103374c84dd10", "score": "0.7262749", "text": "func (bridge *Bridge) AllScenes() ([]*Scene, error) {\n\tvar scenes []*Scene\n\tvar results map[string]Scene\n\terr := bridge.get(\"/scenes\", &results)\n\tif err != nil {\n\t\treturn scenes, err\n\t}\n\n\t// and convert them into scenes\n\tfor id, scene := range results {\n\t\tscene := scene\n\t\tscene.Id = id\n\t\tscene.bridge = bridge\n\t\tif err != nil {\n\t\t\treturn scenes, err\n\t\t}\n\t\tscenes = append(scenes, &scene)\n\t}\n\n\treturn scenes, nil\n}", "title": "" }, { "docid": "1b4357461df1d185e1d31515cb93ef54", "score": "0.61262363", "text": "func (h *HueHub) loadScenes() {\n\th.sharedObjects.Lock()\n\tdefer h.sharedObjects.Unlock()\n\n\th.sharedObjects.scenes = make(map[string]hueScene)\n\tscenes, err := h.bridge.GetScenes()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, v := range scenes {\n\t\tscene := hueScene{\n\t\t\tID: v.ID,\n\t\t\tScene: v,\n\t\t}\n\n\t\th.sharedObjects.scenes[scene.ID] = scene\n\t}\n}", "title": "" }, { "docid": "ccc13e32db136536e13ab64de914b871", "score": "0.5475599", "text": "func List(w http.ResponseWriter, r *http.Request) {\n\tdb, err := server.Mongo()\n\tif err != nil {\n\t\thelper.Write(w, err.Error())\n\t\treturn\n\t}\n\n\tvar sceneCount, meshCount, mapCount, materialCount, audioCount, animationCount, particleCount,\n\t\tprefabCount, characterCount, screenshotCount, videoCount int64\n\n\tif server.Config.Authority.Enabled {\n\t\tuser, _ := server.GetCurrentUser(r)\n\n\t\tfilter1 := bson.M{\n\t\t\t\"IsPublic\": true, // public scenes\n\t\t}\n\n\t\tvar filter bson.M\n\t\tif user != nil { // user is login\n\t\t\tfilter2 := bson.M{\n\t\t\t\t\"UserID\": user.ID, // user's scenes\n\t\t\t}\n\t\t\tif user.RoleName == \"Administrator\" { // admin user\n\t\t\t\tfilter3 := bson.M{\n\t\t\t\t\t\"UserID\": bson.M{\n\t\t\t\t\t\t\"$exists\": 0, // scenes without UserID\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tfilter = bson.M{\n\t\t\t\t\t\"$or\": bson.A{\n\t\t\t\t\t\tfilter1,\n\t\t\t\t\t\tfilter2,\n\t\t\t\t\t\tfilter3,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t} else { // ordinary user\n\t\t\t\tfilter = bson.M{\n\t\t\t\t\t\"$or\": bson.A{\n\t\t\t\t\t\tfilter1,\n\t\t\t\t\t\tfilter2,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // guest\n\t\t\tfilter = bson.M{\n\t\t\t\t\"$or\": bson.A{\n\t\t\t\t\tfilter1,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tsceneCount, _ = db.Count(server.SceneCollectionName, filter)\n\t\tmeshCount, _ = db.Count(server.MeshCollectionName, filter)\n\t\tmapCount, _ = db.Count(server.MapCollectionName, filter)\n\t\tmaterialCount, _ = db.Count(server.MaterialCollectionName, filter)\n\t\taudioCount, _ = db.Count(server.AudioCollectionName, filter)\n\t\tanimationCount, _ = db.Count(server.AnimationCollectionName, filter)\n\t\tparticleCount, _ = db.Count(server.ParticleCollectionName, filter)\n\t\tprefabCount, _ = db.Count(server.PrefabCollectionName, filter)\n\t\tcharacterCount, _ = db.Count(server.CharacterCollectionName, filter)\n\t\tscreenshotCount, _ = db.Count(server.ScreenshotCollectionName, filter)\n\t\tvideoCount, _ = db.Count(server.VideoCollectionName, filter)\n\t} else {\n\t\tfilter := bson.M{}\n\n\t\tsceneCount, _ = db.Count(server.SceneCollectionName, filter)\n\t\tmeshCount, _ = db.Count(server.MeshCollectionName, filter)\n\t\tmapCount, _ = db.Count(server.MapCollectionName, filter)\n\t\tmaterialCount, _ = db.Count(server.MaterialCollectionName, filter)\n\t\taudioCount, _ = db.Count(server.AudioCollectionName, filter)\n\t\tanimationCount, _ = db.Count(server.AnimationCollectionName, filter)\n\t\tparticleCount, _ = db.Count(server.ParticleCollectionName, filter)\n\t\tprefabCount, _ = db.Count(server.PrefabCollectionName, filter)\n\t\tcharacterCount, _ = db.Count(server.CharacterCollectionName, filter)\n\t\tscreenshotCount, _ = db.Count(server.ScreenshotCollectionName, filter)\n\t\tvideoCount, _ = db.Count(server.VideoCollectionName, filter)\n\t}\n\n\tresult := Result{\n\t\tSceneCount: sceneCount,\n\t\tMeshCount: meshCount,\n\t\tMapCount: mapCount,\n\t\tMaterialCount: materialCount,\n\t\tAudioCount: audioCount,\n\t\tAnimationCount: animationCount,\n\t\tParticleCount: particleCount,\n\t\tPrefabCount: prefabCount,\n\t\tCharacterCount: characterCount,\n\t\tScreenshotCount: screenshotCount,\n\t\tVideoCount: videoCount,\n\t}\n\tresult.Code = 200\n\tresult.Msg = \"Get Successfully!\"\n\n\thelper.WriteJSON(w, result)\n}", "title": "" }, { "docid": "c15de74058046d3126a3e2fbbc7e8ba4", "score": "0.5128277", "text": "func GetScene(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SceneState, opts ...pulumi.ResourceOption) (*Scene, error) {\n\tvar resource Scene\n\terr := ctx.ReadResource(\"aws-native:iottwinmaker:Scene\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "97fb930a80d8039e1e910660199d9a82", "score": "0.49999955", "text": "func (o *rest) list(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"list available games \"+r.URL.Path, http.StatusNotImplemented)\n}", "title": "" }, { "docid": "57124db2045cd41afd1138b144e91eac", "score": "0.49859247", "text": "func (s *ScenariosService) GetScenarios(params GetScenariosParams) (*GetScenariosReturn, *structure.VError, error) {\n\treq, err := s.client.NewRequest(\"POST\", \"GetScenarios\", params)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tresponse := &GetScenariosReturn{}\n\tverr, err := s.client.MakeResponse(req, response)\n\tif verr != nil || err != nil {\n\t\treturn nil, verr, err\n\t}\n\treturn response, nil, nil\n}", "title": "" }, { "docid": "4073be042b0a9041549331b9e24cf552", "score": "0.49276718", "text": "func (h *Handler) clusterKubesGet(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *SessionContext, site reversetunnel.RemoteSite) (interface{}, error) {\n\tclt, err := ctx.GetUserClient(site)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tresp, err := listResources(clt, r, types.KindKubernetesCluster)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tclusters, err := types.ResourcesWithLabels(resp.Resources).AsKubeClusters()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn listResourcesGetResponse{\n\t\tItems: ui.MakeKubeClusters(clusters),\n\t\tStartKey: resp.NextKey,\n\t\tTotalCount: resp.TotalCount,\n\t}, nil\n}", "title": "" }, { "docid": "8e6d5216044e8996df35cf5d83853a1e", "score": "0.48719144", "text": "func (qs SceneQuerySet) All(ret *[]Scene) error {\n\treturn qs.db.Find(ret).Error\n}", "title": "" }, { "docid": "37826ad764f9d96767be137add565d0e", "score": "0.4826609", "text": "func GetJobs(w http.ResponseWriter, r *http.Request) {\n\trender.JSON(w, r, core.GetEngineInstance().GetJobs())\n}", "title": "" }, { "docid": "feb288c24013b2f39d4d0cd9de2fa23d", "score": "0.47791624", "text": "func GetGames(series string) (r []*Game, err error) {\n\n\t// Fast path: Series codes are always at least 3 characters in length.\n\tif len(series) < 3 {\n\t\treturn\n\t}\n\n\t// Contact XML api at volleyvvb.be\n\tbody, err := get(fmt.Sprintf(epGames, series))\n\tif err != nil || body == nil {\n\t\treturn\n\t}\n\tdefer body.Close()\n\n\tquery := new(gamesQuery)\n\tdec := xml.NewDecoder(body)\n\n\t// Ignore charsets for now\n\tdec.CharsetReader = func(c string, in io.Reader) (io.Reader, error) {\n\t\treturn in, nil\n\t}\n\n\t// Attempt to decode games response\n\tif err = dec.Decode(query); err != nil {\n\t\treturn\n\t}\n\n\treturn query.Results, nil\n\n}", "title": "" }, { "docid": "8c70fbe019c51e9c8a6de0bbd791bea8", "score": "0.47157472", "text": "func getCourses(c *gin.Context) {\n\tc.IndentedJSON(http.StatusOK, courses)\n}", "title": "" }, { "docid": "c42308cbc10ae307aede7933233d7949", "score": "0.4669865", "text": "func (r *Repository) Get() ([]System, error) {\n\tsession := r.driver.NewSession(neo4j.SessionConfig{})\n\tdefer session.Close()\n\n\tallSystems, err := session.ReadTransaction(func(transaction neo4j.Transaction) (interface{}, error) {\n\t\tresult, err := transaction.Run(`MATCH (s:System) RETURN ID(s) as id, s.name`, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar systems []System\n\t\tfor result.Next() {\n\n\t\t\tname, foundName := result.Record().Get(\"s.name\")\n\t\t\tif !foundName {\n\t\t\t\treturn nil, errors.New(\"missing name\")\n\t\t\t}\n\n\t\t\tid, foundID := result.Record().Get(\"id\")\n\t\t\tif !foundID {\n\t\t\t\treturn nil, errors.New(\"missing id\")\n\t\t\t}\n\t\t\tsystem := &System{ID: id.(int64), Name: name.(string)}\n\t\t\tsystems = append(systems, *system)\n\t\t}\n\n\t\treturn systems, result.Err()\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn allSystems.([]System), nil\n}", "title": "" }, { "docid": "aa7ec00d9acf8d778c935a3b57673ef2", "score": "0.4648859", "text": "func (a *App) Scene() *core.Node {\n\n\treturn a.demoScene\n}", "title": "" }, { "docid": "a0325b0cf6d6a0a5f14b3e5a2284c3be", "score": "0.46275583", "text": "func Games(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\t//queryValues := r.URL.Query()\n\t// to construct url for game icon, use:\n\t//\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar x steamapi.Service\n\tga, err := x.Games(params.ByName(\"id\"))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tfmt.Fprint(w, \"failed to fetch games\")\n\t\treturn\n\t}\n\tfor i := 0; i < len(ga.Response.Games); i++ {\n\t\tgame := &ga.Response.Games[i]\n\t\tgame.ImgIconURL = fmt.Sprintf(gameIconURL, game.AppID, game.ImgIconURL)\n\t\tgame.ImgLogoURL = fmt.Sprintf(gameIconURL, game.AppID, game.ImgLogoURL)\n\t}\n\n\tjson.NewEncoder(w).Encode(ga)\n}", "title": "" }, { "docid": "dc9b319849cac07e386e848ce17be4aa", "score": "0.46211138", "text": "func (scene *Scene) Delete() ([]Result, error) {\n\tvar results []Result\n\terr := scene.bridge.delete(\"/scenes/\"+scene.Id, &results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, err\n}", "title": "" }, { "docid": "a0565c0f82aa8acc6686a6eccf9a53b8", "score": "0.45993364", "text": "func GetAssets(w http.ResponseWriter, r *http.Request) {\n\t// load the store\n\tstore := *LoadedStore\n\n\t// return data\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\n\tw.WriteHeader(http.StatusOK)\n\tif err := json.NewEncoder(w).Encode(store); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "942f19153bfe7feda9df9b4a706b5be3", "score": "0.45967102", "text": "func (d *DvrClipExtraction) GetAll() (WSEDVRStores, error) {\n\td.setNoParams()\n\n\td.setRestURI(d.baseURI)\n\n\tvar r WSEDVRStores\n\terr := d.sendRequestSeb(&r, d.preparePropertiesForRequest(), []base.Entity{}, GET, \"\")\n\treturn r, err\n}", "title": "" }, { "docid": "84a618a85cab22b1356a67279514072c", "score": "0.4596555", "text": "func (server *WebServer) GetCameras(ctx *fasthttp.RequestCtx) {\n\tfmt.Println(\"-----------------------------------------\")\n\tfmt.Println(\"API: GET request /get-cameras accepted...\")\n\n\tcameraList := server.application.GetCameras()\n\n\tif len(cameraList) != 0 {\n\t\tvar types []int\n\t\tvar names []string\n\n\t\tfor i := range cameraList {\n\t\t\ttypes = append(types, cameraList[i].Type)\n\t\t\tnames = append(names, cameraList[i].Name)\n\t\t}\n\n\t\ttoEncode := &GetCamerasJSON{\n\t\t\tCameraTypes: types,\n\t\t\tCameraNames: names}\n\n\t\tpayload, _ := json.Marshal(toEncode)\n\t\tfmt.Println(\"Server response for /get-cameras request: \")\n\t\tfmt.Println(string(payload))\n\n\t\tctx.SetContentType(\"application/json\")\n\t\tctx.SetBody(payload)\n\n\t\tfmt.Println(\"Server status for /get-cameras request: OK\")\n\t\tctx.SetStatusCode(fasthttp.StatusOK)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Server status for /get-cameras request: NoContent\")\n\tctx.SetStatusCode(fasthttp.StatusNoContent)\n}", "title": "" }, { "docid": "d63e3cec1b27f11f66600534a3472aa3", "score": "0.45913425", "text": "func (a *Agent) GetGames(limit int, token time.Time) (Games, error) {\n\tg := []Game{}\n\n\ta.log(\"Getting Games\")\n\titer := a.client.Collection(\"games\").\n\t\tWhere(\"active\", \"==\", true).Limit(limit).\n\t\tOrderBy(\"created\", firestore.Desc).\n\t\tStartAfter(token).Documents(a.ctx)\n\tfor {\n\t\tdoc, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn g, fmt.Errorf(\"Failed to iterate: %v\", err)\n\t\t}\n\t\tgame := Game{}\n\t\tdoc.DataTo(&game)\n\t\tgame.ID = doc.Ref.ID\n\n\t\tgame, err = a.loadGameWithRecords(game)\n\t\tif err != nil {\n\t\t\treturn g, fmt.Errorf(\"failed to load records for game: %v\", err)\n\t\t}\n\n\t\tgame, err = a.loadGameWithPlayers(game)\n\t\tif err != nil {\n\t\t\treturn g, fmt.Errorf(\"failed to load players for game: %v\", err)\n\t\t}\n\n\t\tgame, err = a.loadGameWithAdmins(game)\n\t\tif err != nil {\n\t\t\treturn g, fmt.Errorf(\"failed to load admins for game: %v\", err)\n\t\t}\n\n\t\tgame, err = a.loadGameWithBoards(game)\n\t\tif err != nil {\n\t\t\treturn g, fmt.Errorf(\"failed to load boards for game: %v\", err)\n\t\t}\n\n\t\tg = append(g, game)\n\t}\n\n\treturn g, nil\n}", "title": "" }, { "docid": "3b12a1c72bfa2073404490648dbce9f1", "score": "0.45683333", "text": "func GetSessions(w http.ResponseWriter, r *http.Request) {\n\tsessionList := sessions.GetSessionList()\n\tsessionJson, err := json.Marshal(sessionList)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t}\n\t// send session list to client\n\tfmt.Fprintf(w, \"%s\", sessionJson)\n\n\t// display session list on console\n\tdisplay.PrintSessionList(sessionList)\n}", "title": "" }, { "docid": "d133718dcf6d758c230cf6c6559f06af", "score": "0.45614615", "text": "func (c *InstancesApiController) GetInstances(w http.ResponseWriter, r *http.Request) { \n\tparams := mux.Vars(r)\n\ttarget := params[\"target\"]\n\tresult, err := c.service.GetInstances(r.Context(), target)\n\t//If an error occured, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t//If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\t\n}", "title": "" }, { "docid": "88e4cd2f775fceb75138f5432ffccba3", "score": "0.4559268", "text": "func (mh *ApiClient) GetRooms(fromCache bool) ([]Room, error) {\n\tif !fromCache {\n\t\tfimpResponse, err := mh.sendGetRequest([]string{ComponentRoom})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse, err := FimpToResponse(fimpResponse)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn response.GetRooms(), err\n\t} else if mh.isCacheEnabled {\n\t\tif mh.ValidateAndReloadSiteCache() {\n\t\t\treturn mh.siteCache.Rooms, nil\n\t\t}\n\n\t}\n\treturn nil, errors.New(\"cache is empty\")\n}", "title": "" }, { "docid": "350fb98ff7e41809a9a08eb26f8a0c33", "score": "0.45592582", "text": "func getBoardGames(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(boardGames)\n}", "title": "" }, { "docid": "a305cfd449fd476b17350e4fdf793ef6", "score": "0.45590356", "text": "func GetBuilds(sess *session.Session) (*codebuild.BatchGetBuildsOutput, error) {\n // snippet-start:[codebuild.go.list_builds.call]\n svc := codebuild.New(sess)\n // Get the list of builds\n names, err := svc.ListBuilds(&codebuild.ListBuildsInput{\n SortOrder: aws.String(\"ASCENDING\"),\n })\n // snippet-end:[codebuild.go.list_builds.call]\n if err != nil {\n return nil, err\n }\n\n // snippet-start:[codebuild.go.list_builds.batch]\n builds, err := svc.BatchGetBuilds(&codebuild.BatchGetBuildsInput{\n Ids: names.Ids,\n })\n // snippet-end:[codebuild.go.list_builds.batch]\n if err != nil {\n return nil, err\n }\n\n return builds, nil\n}", "title": "" }, { "docid": "bdc09d7d4306137772bdc2f0d15d0785", "score": "0.45577386", "text": "func (c Games) List() revel.Result {\r\n\treturn c.RenderJSON(games)\r\n}", "title": "" }, { "docid": "deea74183eb9e9a3bf6ef1f5ce2678ef", "score": "0.45537227", "text": "func showServers(c *gin.Context) {\r\n\r\n\tservers, err := readServers()\r\n\tif err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n\r\n\tc.JSON(http.StatusOK, servers)\r\n}", "title": "" }, { "docid": "107fac16442839cda291347b4a1361e4", "score": "0.4543867", "text": "func (client BaseClient) GetListOfSupervisors(ctx context.Context, onlyServerState *bool, continuationToken string, pageSize *int32) (result SupervisorListAPIModelPage, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/BaseClient.GetListOfSupervisors\")\n defer func() {\n sc := -1\n if result.slam.Response.Response != nil {\n sc = result.slam.Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n result.fn = client.getListOfSupervisorsNextResults\n req, err := client.GetListOfSupervisorsPreparer(ctx, onlyServerState, continuationToken, pageSize)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"GetListOfSupervisors\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.GetListOfSupervisorsSender(req)\n if err != nil {\n result.slam.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"GetListOfSupervisors\", resp, \"Failure sending request\")\n return\n }\n\n result.slam, err = client.GetListOfSupervisorsResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"GetListOfSupervisors\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "b41dca9aba992f26ad79e79fb12f7aea", "score": "0.45308977", "text": "func (httpAPI *API) Clusters(params martini.Params, r render.Render, req *http.Request) {\n\tclusterNames, err := inst.ReadClusters()\n\n\tif err != nil {\n\t\tRespond(r, &APIResponse{Code: ERROR, Message: fmt.Sprintf(\"%+v\", err)})\n\t\treturn\n\t}\n\n\tr.JSON(http.StatusOK, clusterNames)\n}", "title": "" }, { "docid": "330f98e3abfb1d30e777a3e8b4d60610", "score": "0.45243174", "text": "func GetAllRooms(context echo.Context) error {\n\tlog.L.Debugf(\"%s Starting GetAllRooms...\", helpers.RoomsTag)\n\n\trooms, err := helpers.GetAllRooms()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to get all rooms : %s\", err.Error())\n\t\tlog.L.Errorf(\"%s %s\", helpers.RoomsTag, msg)\n\t\treturn context.JSON(http.StatusBadRequest, err)\n\t}\n\n\tlog.L.Debugf(\"%s Successfully got all rooms!\", helpers.RoomsTag)\n\treturn context.JSON(http.StatusOK, rooms)\n}", "title": "" }, { "docid": "eb798a8800beb054194f62b920b18a13", "score": "0.45069724", "text": "func (c *ServerRootController) Get() {\n\tvar (\n\t\tstart, count string = c.GetString(\"start\"), c.GetString(\"count\")\n\t\tstartInt, countInt int = 0, -1\n\t\tparameterError bool\n\t)\n\tlog.WithFields(log.Fields{\"start\": start, \"count\": count}).Debug(\"Get server collection.\")\n\tif start != \"\" {\n\t\t_startInt, err := strconv.Atoi(start)\n\t\tif err != nil || _startInt < 0 {\n\t\t\tparameterError = true\n\t\t} else {\n\t\t\tstartInt = _startInt\n\t\t}\n\t}\n\tif count != \"\" {\n\t\t_countInt, err := strconv.Atoi(count)\n\t\t// -1 means all.\n\t\tif err != nil || _countInt < -1 {\n\t\t\tparameterError = true\n\t\t} else {\n\t\t\tcountInt = _countInt\n\t\t}\n\t}\n\n\tif parameterError {\n\t\tmessages := []commonMessage.Message{}\n\t\tmessages = append(messages, commonMessage.NewInvalidRequest())\n\t\tc.Data[\"json\"] = commonDto.MessagesToDto(messages)\n\t\tc.Ctx.Output.SetStatus(messages[0].StatusCode)\n\t\tlog.Warn(\"Get server collection failed, parameter error.\")\n\t} else {\n\t\tif serverCollection, messages := service.GetServerCollection(startInt, countInt); messages != nil {\n\t\t\tc.Data[\"json\"] = commonDto.MessagesToDto(messages)\n\t\t\tc.Ctx.Output.SetStatus(messages[0].StatusCode)\n\t\t\tlog.WithFields(log.Fields{\"message\": messages[0].ID}).Warn(\"Get server collection failed\")\n\t\t} else {\n\t\t\tresp := new(dto.GetServerCollectionResponse)\n\t\t\tresp.Load(serverCollection)\n\t\t\tc.Data[\"json\"] = resp\n\t\t\tc.Ctx.Output.SetStatus(http.StatusOK)\n\t\t}\n\t}\n\tc.ServeJSON()\n}", "title": "" }, { "docid": "57f468e183451261489634982f51565f", "score": "0.4503746", "text": "func (j *Job) GetRooms() ([]hipchat.Room, error) {\n\tvar roomList []hipchat.Room\n\tvar response *http.Response\n\tvar err error\n\tstartIndex := 0\n\tmaxResults := 1000\n\n\tfor {\n\t\tvar rooms *hipchat.Rooms\n\t\topt := &hipchat.RoomsListOptions{\n\t\t\tListOptions: hipchat.ListOptions{StartIndex: startIndex, MaxResults: maxResults},\n\t\t\tIncludePrivate: true,\n\t\t\tIncludeArchived: false}\n\n\t\trooms, response, err = j.Client.Room.List(opt)\n\n\t\tif err != nil {\n\t\t\tj.Log.Errorf(\"Client.CreateClient returns an error %v\", response)\n\t\t\tbreak\n\t\t}\n\n\t\troomList = append(roomList, rooms.Items...)\n\n\t\tif rooms.Links.Next == \"\" {\n\t\t\tj.Log.Debugf(\"client.Room.List retreieved all the rooms\")\n\t\t\tbreak\n\t\t} else {\n\t\t\tstartIndex += maxResults\n\t\t}\n\t}\n\n\tj.Log.Infof(\"Retrieved %d rooms\", len(roomList))\n\treturn roomList, err\n}", "title": "" }, { "docid": "8ebb36c470dc8681f31b8efce35f8e11", "score": "0.44979525", "text": "func GetShards(client *mongo.Client) ([]Shard, error) {\n\tctx := context.Background()\n\tvar shardsInfo struct {\n\t\tShards []Shard\n\t}\n\tif err := client.Database(\"admin\").RunCommand(ctx, bson.D{{Key: \"listShards\", Value: 1}}).Decode(&shardsInfo); err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Slice(shardsInfo.Shards, func(i int, j int) bool {\n\t\treturn shardsInfo.Shards[i].ID < shardsInfo.Shards[j].ID\n\t})\n\treturn shardsInfo.Shards, nil\n}", "title": "" }, { "docid": "41c213d25924b2b96fa2aa5085664c67", "score": "0.449764", "text": "func Handle(w http.ResponseWriter, r *http.Request) {\n\tdb, err := server.Mongo()\n\tif err != nil {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tvar scenes []bson.M\n\n\tdb.FindAll(server.SceneCollectionName, &scenes)\n\n\tcollectionNames, err := db.ListCollectionNames()\n\tif err != nil {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tfor _, collectionName := range collectionNames {\n\t\tif !strings.HasPrefix(collectionName, \"Scene\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(collectionName, \"_history\") {\n\t\t\tdb.DropCollection(collectionName)\n\t\t\tcontinue\n\t\t}\n\n\t\tcontains := false\n\t\tfor _, scene := range scenes {\n\t\t\tif scene[\"CollectionName\"].(string) == collectionName {\n\t\t\t\tcontains = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !contains {\n\t\t\tdb.DropCollection(collectionName)\n\t\t}\n\t}\n\n\thelper.WriteJSON(w, server.Result{\n\t\tCode: 200,\n\t\tMsg: \"Execute sucessfully!\",\n\t})\n}", "title": "" }, { "docid": "45d49d6679778a5defabb4b1f4292a60", "score": "0.44918084", "text": "func GetRooms(redisClient interfaces.RedisClient, schedulerName string, mr *MixedMetricsReporter) ([]string, error) {\n\tvar result, redisKeys []string\n\tallStatus := []string{StatusCreating, StatusReady, StatusOccupied, StatusTerminating, StatusTerminated}\n\n\tfor _, status := range allStatus {\n\t\terr := mr.WithSegment(SegmentSMembers, func() error {\n\t\t\tvar err error\n\t\t\tkeys, err := redisClient.SMembers(\n\t\t\t\tGetRoomStatusSetRedisKey(schedulerName, status),\n\t\t\t).Result()\n\t\t\tredisKeys = append(redisKeys, keys...)\n\t\t\treturn err\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor _, redisKey := range redisKeys {\n\t\tr := RoomFromRedisKey(redisKey)\n\t\tif r != \"\" {\n\t\t\tresult = append(result, r)\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "18002a114ef1ffed95949d99db3f6735", "score": "0.44889033", "text": "func (httpAPI *API) AllInstances(params martini.Params, r render.Render, req *http.Request) {\n\tinstances, err := inst.SearchInstances(\"\")\n\n\tif err != nil {\n\t\tRespond(r, &APIResponse{Code: ERROR, Message: fmt.Sprintf(\"%+v\", err)})\n\t\treturn\n\t}\n\n\tr.JSON(http.StatusOK, instances)\n}", "title": "" }, { "docid": "5941f73d22fe9c1ae420c14bef18a5af", "score": "0.44864234", "text": "func GetVirtues(w http.ResponseWriter, r *http.Request) {\n\tfmt.Printf(\"Called GetVirtues\\n\")\n\tkubeClient := virtue_kube.GetKubernetesClient()\n\tfmt.Printf(\"Got Kubernetes client...\\n\")\n\n\tuserIdentityToken := r.PostFormValue(\"token\")\n\tfmt.Printf(\"Got user identity token %+v...\\n\", userIdentityToken)\n\tusername := userMap[userIdentityToken]\n\tvirtues := []VirtueApplication{}\n\tfmt.Printf(\"Got client user %+v...\\n\", username)\n\n\tif username != \"\" {\n\t\tfmt.Printf(\"Finding virtue skeletons for the user: %+v\\n\", username)\n\t\tfileList := EnsureDeployVirtues(kubeClient, username)\n\t\tfor _, v := range fileList {\n\t\t\tvirtueName := ConvertFilenameToVirtue(v)\n\t\t\tserviceName := GetServiceName(config.VirtueConfiguration.VirtueDirectory + \"/\" + username + \"/\" + v)\n\t\t\tport, _ := virtue_kube.GetServiceNodePort(kubeClient, serviceName)\n\n\t\t\tparts := strings.Split(virtueName, \"-\")\n\t\t\trole := parts[0]\n\t\t\tuser := parts[2]\n\t\t\tapp := parts[3]\n\n\t\t\tfmt.Printf(\"------------------------------\\n\")\n\t\t\tfmt.Printf(\"Kubernetes virtue name: %+v\\n\", virtueName)\n\t\t\tfmt.Printf(\"Kubernetes node port: %+v\\n\", port)\n\t\t\tfmt.Printf(\"Virtue role name: %+v\\n\", role)\n\t\t\tfmt.Printf(\"Virtue app name: %+v\\n\", app)\n\t\t\tfmt.Printf(\"User name from virtue skeleton: %+v\\n\", user)\n\t\t\tfmt.Printf(\"------------------------------\\n\")\n\n\t\t\tif username != user {\n\t\t\t\tfmt.Printf(\"User %+v obtained from the virtue skeleton is not the same as the username %+v from the windows service.\\n\", user, username)\n\t\t\t}\n\n\t\t\tvirtues = append(virtues, VirtueApplication{VirtueName: virtueName, Application: app, Hostname: config.VirtueConfiguration.Hostname, Port: fmt.Sprint(port), Command: app})\n\t\t}\n\n\t\tjson.NewEncoder(w).Encode(virtues)\n\t}\n\n}", "title": "" }, { "docid": "0a4d61d8d96ba76e822b408a8dd83491", "score": "0.44794106", "text": "func RegisterSceneHandlers(r *mux.Router, s *Server) {\n\tr.HandleFunc(\"/v1/scenes\", apiScenesHandler(s.system)).Methods(\"GET\")\n\n\tr.HandleFunc(\"/v1/scenes/{ID}\",\n\t\tapiSceneHandlerUpdate(s.systemSavePath, s.system)).Methods(\"PUT\")\n\n\tr.HandleFunc(\"/v1/scenes\",\n\t\tapiSceneHandlerCreate(s.systemSavePath, s.system)).Methods(\"POST\")\n\n\tr.HandleFunc(\"/v1/scenes/{sceneID}/commands/{commandID}\",\n\t\tapiSceneHandlerCommandDelete(s.systemSavePath, s.system)).Methods(\"DELETE\")\n\n\tr.HandleFunc(\"/v1/scenes/{sceneID}/commands\",\n\t\tapiSceneHandlerCommandAdd(s.systemSavePath, s.system)).Methods(\"POST\")\n\n\tr.HandleFunc(\"/v1/scenes/{ID}\",\n\t\tapiSceneHandlerDelete(s.systemSavePath, s.system)).Methods(\"DELETE\")\n\n\tr.HandleFunc(\"/v1/scenes/active\",\n\t\tapiActiveScenesHandler(s.system)).Methods(\"POST\")\n}", "title": "" }, { "docid": "ce8acf6429ce6eeac62f49b76e8a183a", "score": "0.44708124", "text": "func GetElkStaticRooms(index string) ([]statedefinition.StaticRoom, *nerr.E) {\n\tquery := elk.GenericQuery{\n\t\tSize: maxSize,\n\t}\n\n\tb, er := json.Marshal(query)\n\tif er != nil {\n\t\treturn []statedefinition.StaticRoom{}, nerr.Translate(er).Addf(\"Couldn't marshal generic query %v\", query)\n\t}\n\n\tresp, err := elk.MakeELKRequest(\"GET\", fmt.Sprintf(\"/%v/_search\", index), b)\n\tif err != nil {\n\t\treturn []statedefinition.StaticRoom{}, err.Addf(\"Couldn't retrieve static index %v for cache\", index)\n\t}\n\tlog.L.Infof(\"Getting the info for %v\", index)\n\n\tvar queryResp elk.StaticRoomQueryResponse\n\n\ter = json.Unmarshal(resp, &queryResp)\n\tif er != nil {\n\t\treturn []statedefinition.StaticRoom{}, nerr.Translate(er).Addf(\"Couldn't unmarshal response from static index %v.\", index)\n\t}\n\n\tvar toReturn []statedefinition.StaticRoom\n\tfor i := range queryResp.Hits.Wrappers {\n\t\ttoReturn = append(toReturn, queryResp.Hits.Wrappers[i].Room)\n\t}\n\n\treturn toReturn, nil\n\n}", "title": "" }, { "docid": "e2cac3637ea88b53df9a9b3317b30922", "score": "0.44637772", "text": "func GetCatalog(board string) ([]Page, error) {\n\turi := fmt.Sprintf(\"%s/%s/catalog.json\", BASE, board)\n\tresp, err := http.Get(uri)\n\tif err != nil {\n\t\treturn nil, wrap(err)\n\t}\n\tdefer resp.Body.Close()\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, wrap(err)\n\t}\n\tvar catalog []Page\n\terr = json.Unmarshal(data, &catalog)\n\treturn catalog, wrap(err)\n}", "title": "" }, { "docid": "c5c744d6b6ff41c10e7ad8fcde9a2ef0", "score": "0.44594494", "text": "func (o *OCMProvider) Versions() (*spi.VersionList, error) {\n\tvar err error\n\n\tversions := []*spi.Version{}\n\tpage := 1\n\tlog.Printf(\"Querying cluster versions endpoint.\")\n\tfor {\n\t\tvar resp *v1.VersionsListResponse\n\t\terr = retryer().Do(func() error {\n\t\t\tvar err error\n\n\t\t\tresp, err = o.conn.ClustersMgmt().V1().Versions().List().Page(page).Size(PageSize).Send()\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif resp != nil && resp.Error() != nil {\n\t\t\t\treturn errResp(resp.Error())\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"failed getting list of OSD versions: %v\", err)\n\t\t} else if resp != nil {\n\t\t\terr = errResp(resp.Error())\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Print(\"error getting cluster versions from getSemverList.Response\")\n\t\t\tlog.Printf(\"Response Headers: %v\", resp.Header())\n\t\t\tlog.Printf(\"Response Error(s): %v\", resp.Error())\n\t\t\tlog.Printf(\"HTTP Code: %d\", resp.Status())\n\t\t\tlog.Printf(\"Size of response: %d\", resp.Size())\n\n\t\t\treturn nil, fmt.Errorf(\"couldn't retrieve available versions: %v\", err)\n\t\t}\n\n\t\t// parse versions, filter for major+minor nightlies, then sort\n\t\tresp.Items().Each(func(v *v1.Version) bool {\n\t\t\tif version, err := util.OpenshiftVersionToSemver(v.ID()); err != nil {\n\t\t\t\tlog.Printf(\"could not parse version '%s': %v\", v.ID(), err)\n\t\t\t} else if v.Enabled() {\n\t\t\t\tif v.ChannelGroup() == \"stable\" || v.ChannelGroup() == viper.GetString(config.Cluster.Channel) {\n\t\t\t\t\tspiVersion := spi.NewVersionBuilder().\n\t\t\t\t\t\tVersion(version).\n\t\t\t\t\t\tDefault(v.Default()).\n\t\t\t\t\t\tBuild()\n\n\t\t\t\t\tfor _, upgrade := range v.AvailableUpgrades() {\n\t\t\t\t\t\tif version, err := util.OpenshiftVersionToSemver(upgrade); err == nil {\n\t\t\t\t\t\t\tspiVersion.AddUpgradePath(version)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tversions = append(versions, spiVersion)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\n\t\t// If we've looked at all the results, stop collecting them.\n\t\tif page*PageSize >= resp.Total() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tsort.Slice(versions, func(i, j int) bool {\n\t\treturn versions[i].Version().GreaterThan(versions[j].Version())\n\t})\n\n\tvar defaultVersionOverride *semver.Version = nil\n\n\tif o.env != prod {\n\t\tvar versionList *spi.VersionList\n\t\tversionList, err = o.prodProvider.Versions()\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting production default: %v\", err)\n\t\t}\n\n\t\tdefaultVersionOverride = versionList.Default()\n\t}\n\n\treturn spi.NewVersionListBuilder().\n\t\tAvailableVersions(versions).\n\t\tDefaultVersionOverride(defaultVersionOverride).\n\t\tBuild(), nil\n}", "title": "" }, { "docid": "30b92da15d7e89ebc3d3e45c0e331688", "score": "0.44521302", "text": "func NewScene(options *options.Options) *Scene {\n\tobjs, e := object.MakeObjects(options)\n\tif e != nil {\n\t\tlog.Fatalf(\"creating objects: %v\", e)\n\t}\n\tobjects := make([]bvh.Intersector, len(objs))\n\tfor i, obj := range objs {\n\t\tobjects[i] = obj\n\t}\n\n\tvar tex *texture.Texture\n\tif options.Background.Type == \"Uniform\" || options.Global.FastRender {\n\t\toptions.Background.Image = \"\"\n\t}\n\ttex, e = texture.New(options.Background.Image, mgl64.Vec2{}, mgl64.Vec2{1, 1})\n\tif e != nil {\n\t\tlog.Fatalf(\"creating background texture: %v\", e)\n\t}\n\n\tscene := &Scene{\n\t\tOptions: options,\n\t\tCamera: NewCamera(&options.Camera, float64(options.Resolution.W)/float64(options.Resolution.H)),\n\t\tBgColor: color64.Color64{options.Background.Color.R, options.Background.Color.G, options.Background.Color.B},\n\t\tBgTex: tex,\n\t\tLights: makeLights(options.Lights),\n\t\tMaterials: makeMaterials(options.Materials, options.Global.FastRender),\n\t\tbvh: bvh.NewTree(objects),\n\t}\n\n\tscene.genIllumMaps()\n\n\treturn scene\n}", "title": "" }, { "docid": "91b175b76f42bbc231eb3bb12b00dc9a", "score": "0.44508845", "text": "func (h *Handler) clusterDesktopsGet(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *SessionContext, site reversetunnel.RemoteSite) (interface{}, error) {\n\tclt, err := ctx.GetUserClient(site)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tresp, err := listResources(clt, r, types.KindWindowsDesktop)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\twindowsDesktops, err := types.ResourcesWithLabels(resp.Resources).AsWindowsDesktops()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn listResourcesGetResponse{\n\t\tItems: ui.MakeDesktops(windowsDesktops),\n\t\tStartKey: resp.NextKey,\n\t\tTotalCount: resp.TotalCount,\n\t}, nil\n}", "title": "" }, { "docid": "13e8e1397bbd4d0655e00204342f55cd", "score": "0.44499946", "text": "func (s *Service) GetKubes(ctx context.Context, req *api.GetKubesRequest) (*clusters.GetKubesResponse, error) {\n\tcluster, _, err := s.ResolveCluster(req.ClusterUri)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tresponse, err := cluster.GetKubes(ctx, req)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "60da09ed55470b50c17ff771da7590db", "score": "0.4444663", "text": "func list(cmd *cobra.Command, args []string) error {\n\tconffile := cmd.Flag(\"config\").Value.String()\n\tcfg, err := getConfig(conffile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to read config (%v). Run with 'config' to initialize.\", err)\n\t}\n\n\tservice.Path = V3api\n\n\tu, err := url.Parse(service.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\tq := u.Query()\n\n\tif current {\n\t\tq.Set(\"show\", \"current\")\n\t} else if history {\n\t\tq.Set(\"show\", \"history\")\n\t} else if showall {\n\t\tq.Set(\"show\", \"all\")\n\t}\n\n\tq.Set(\"limit\", strconv.Itoa(numres))\n\tq.Set(\"start\", \"0\")\n\tu.RawQuery = q.Encode()\n\n\tvar res []*Reservation\n\n\tfor {\n\t\tr, err := http.NewRequest(http.MethodGet, u.String(), nil)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"new request: %v\", err)\n\t\t}\n\n\t\tif false {\n\t\t\tin, err := httputil.DumpRequest(r, false)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tfmt.Println(string(in))\n\t\t}\n\n\t\tresp, err := client.Do(r)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"http: %v\", err)\n\t\t}\n\t\tif resp == nil {\n\t\t\treturn fmt.Errorf(\"empty response\")\n\t\t}\n\t\tdefer func() {\n\t\t\tio.Copy(ioutil.Discard, io.LimitReader(resp.Body, MaxRead))\n\t\t\tresp.Body.Close()\n\t\t}()\n\n\t\tif false {\n\t\t\tout, err := httputil.DumpResponse(resp, false)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tfmt.Println(string(out))\n\t\t}\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn fmt.Errorf(\"response status: %s\", resp.Status)\n\t\t}\n\n\t\trpy := struct {\n\t\t\tStatus string `json:\"status\"`\n\t\t\tError string `json:\"error\"`\n\t\t\tReservations []*Reservation `json:\"reservations\"`\n\t\t}{}\n\n\t\terr = json.NewDecoder(io.LimitReader(resp.Body, MaxRead)).Decode(&rpy)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"decode: %v\", err)\n\t\t}\n\n\t\tif rpy.Status != \"Success\" {\n\t\t\treturn errors.New(rpy.Error)\n\t\t}\n\n\t\tif rpy.Reservations == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tfor _, r := range rpy.Reservations {\n\t\t\tres = append(res, r)\n\t\t}\n\n\t\tnext := resp.Header.Get(\"X-Next-Reservation\")\n\t\tif next == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tu, err = url.Parse(next)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar filter string\n\tif len(args) > 0 {\n\t\tfilter = args[0]\n\t}\n\n\tdatefmt := \"Jan _2 15:04 2006\"\n\n\tvar (\n\t\treslen = len(\"ID\")\n\t\tmachlen = len(\"Resource\")\n\t\tnamelen = len(\"Name\")\n\t\tdatelen = len(datefmt)\n\t\thasDates = false\n\t\thasShare = false\n\t)\n\n\tif !long && !jsonOutput {\n\t\tfor _, r := range res {\n\t\t\tif !strings.HasPrefix(r.Resource, filter) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif mine && filter == \"\" && r.Name != cfg.Name {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tid := fmt.Sprintf(\"%d\", r.ID)\n\t\t\tif len(id) > reslen {\n\t\t\t\treslen = len(id)\n\t\t\t}\n\t\t\tif len(r.Resource) > machlen {\n\t\t\t\tmachlen = len(r.Resource)\n\t\t\t}\n\t\t\tif len(r.Name) > namelen {\n\t\t\t\tnamelen = len(r.Name)\n\t\t\t}\n\t\t\tif !r.Loan {\n\t\t\t\thasDates = true\n\t\t\t}\n\t\t\tif r.Share {\n\t\t\t\thasShare = true\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch sortby {\n\tcase \"resource\":\n\t\tsort.Sort(byResource(res))\n\tcase \"name\":\n\t\tsort.Sort(byName(res))\n\tcase \"date\":\n\t\tsort.Sort(byDate(res))\n\tcase \"id\":\n\t\tsort.Sort(byID(res))\n\t}\n\n\tif !quiet && !jsonOutput {\n\t\tif long {\n\t\t\tfmt.Println(\"reservation details\")\n\t\t\tfmt.Println(\"----------- -------\")\n\t\t} else {\n\t\t\tif showres {\n\t\t\t\tfmt.Printf(\"%-*s \", reslen, \"ID\")\n\t\t\t}\n\t\t\tfmt.Printf(\"%-*s \", machlen, \"Resource\")\n\t\t\tif hasShare {\n\t\t\t\tfmt.Printf(\"%-5s \", \"Share\")\n\t\t\t}\n\t\t\tfmt.Printf(\"%-*s \", namelen, \"Name\")\n\t\t\tif hasDates {\n\t\t\t\tfmt.Printf(\"%-*s %-*s\\n\", datelen, \"Start\", datelen, \"End\")\n\t\t\t} else {\n\t\t\t\tfmt.Println(\" Loan\")\n\t\t\t}\n\t\t\tif showres {\n\t\t\t\tfmt.Printf(\"%-*s \", reslen, strings.Repeat(\"-\", reslen))\n\t\t\t}\n\t\t\tfmt.Printf(\"%-*s \", machlen, strings.Repeat(\"-\", machlen))\n\t\t\tif hasShare {\n\t\t\t\tfmt.Printf(\"%-5s \", \"-----\")\n\t\t\t}\n\t\t\tfmt.Printf(\"%-*s\", namelen, strings.Repeat(\"-\", namelen))\n\t\t\tif hasDates {\n\t\t\t\tfmt.Printf(\" %-*s %-*s\\n\", datelen, strings.Repeat(\"-\", datelen), datelen, strings.Repeat(\"-\", datelen))\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\" %s\\n\", strings.Repeat(\"-\", len(\"On Loan\")))\n\t\t\t}\n\t\t}\n\t}\n\n\tif jsonOutput {\n\t\tfmt.Print(\"[\")\n\t}\n\n\tvar lastResource string\n\tfor _, r := range res {\n\t\tif !strings.HasPrefix(r.Resource, filter) {\n\t\t\tcontinue\n\t\t}\n\t\tif mine && filter == \"\" && r.Name != cfg.Name {\n\t\t\tcontinue\n\t\t}\n\t\tstart := r.Start.Local().Format(datefmt)\n\t\tend := r.End.Local().Format(datefmt)\n\t\tif long {\n\t\t\tcanshare := \"\"\n\t\t\tif r.Share {\n\t\t\t\tcanshare = \" (can share)\"\n\t\t\t}\n\t\t\tfmt.Printf(\"%5d\\t Resource: %s%s\\n\", r.ID, r.Resource, canshare)\n\t\t\tif r.Loan {\n\t\t\t\tfmt.Printf(\"\\tReservation: On Loan\\n\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"\\tReservation: %s - %s\\n\", start, end)\n\t\t\t}\n\t\t\tfmt.Printf(\"\\t Name: %s\", r.Name)\n\t\t\tif r.Email == \"\" {\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"(%s)\\n\", r.Email)\n\t\t\t}\n\t\t\tif r.Notes != \"\" {\n\t\t\t\tfmt.Printf(\"\\t Notes: %s\\n\", r.Notes)\n\t\t\t}\n\t\t\tfmt.Println()\n\t\t} else if jsonOutput {\n\t\t\tb, err := json.Marshal(&r)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to marshal output %v\", err)\n\t\t\t}\n\n\t\t\tfmt.Println(string(b))\n\t\t} else {\n\t\t\tcanshare := \" \"\n\t\t\tif r.Share {\n\t\t\t\tcanshare = \" yes \"\n\t\t\t}\n\t\t\tif showres {\n\t\t\t\tfmt.Printf(\"%-*d \", reslen, r.ID)\n\t\t\t}\n\t\t\tresource := r.Resource\n\t\t\tif resource == lastResource {\n\t\t\t\tresource = \"\"\n\t\t\t}\n\t\t\tlastResource = r.Resource\n\t\t\tfmt.Printf(\"%-*s \", machlen, resource)\n\t\t\tif hasShare {\n\t\t\t\tfmt.Printf(\"%-5s \", canshare)\n\t\t\t}\n\t\t\tfmt.Printf(\"%-*s \", namelen, r.Name)\n\t\t\tif r.Loan {\n\t\t\t\tfmt.Printf(\"On Loan\\n\")\n\t\t\t} else {\n\t\t\t\t// adjust start/end to more human readable values\n\t\t\t\tfmt.Printf(\"%-*s - %-*s\\n\", datelen, start, datelen, end)\n\t\t\t}\n\t\t}\n\t}\n\n\tif jsonOutput {\n\t\tfmt.Println(\"]\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a959a92d01c0f39818adbbfc1e32686", "score": "0.44412637", "text": "func (game *Game) NextScene() {\n\n\tif game.sceneIndex < len(game.scenes)-1 {\n\t\tgame.sceneIndex++\n\n\t\tgame.scenes[game.sceneIndex].Init()\n\t}\n\n}", "title": "" }, { "docid": "54091b631ca238d4eba20a9fce377357", "score": "0.4436847", "text": "func (h *Handler) GetNodes() martini.Handler {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tnode := h.core.GetAllNodes()\n\n\t\twriteResponse(w, http.StatusOK, node)\n\t}\n}", "title": "" }, { "docid": "c2630f896cb5cebc008f4eb5fdcfa1bb", "score": "0.44299513", "text": "func (service MovieService) Subtitles(key resource.Key, language resource.Language) movie.SubtitleList {\n\treturn service.movieViewer.Subtitles(key, language)\n}", "title": "" }, { "docid": "51bdd800a2c65c4d8532701cded5924d", "score": "0.44191122", "text": "func (r *Renderer) renderScene(iscene core.INode, icam camera.ICamera) error {\n\n\t// Updates world matrices of all scene nodes\n\tiscene.UpdateMatrixWorld()\n\tscene := iscene.GetNode()\n\n\t// Builds RenderInfo calls RenderSetup for all visible nodes\n\ticam.ViewMatrix(&r.rinfo.ViewMatrix)\n\ticam.ProjMatrix(&r.rinfo.ProjMatrix)\n\n\t// Clear scene arrays\n\tr.ambLights = r.ambLights[0:0]\n\tr.dirLights = r.dirLights[0:0]\n\tr.pointLights = r.pointLights[0:0]\n\tr.spotLights = r.spotLights[0:0]\n\tr.others = r.others[0:0]\n\tr.rgraphics = r.rgraphics[0:0]\n\tr.cgraphics = r.cgraphics[0:0]\n\tr.grmatsOpaque = r.grmatsOpaque[0:0]\n\tr.grmatsTransp = r.grmatsTransp[0:0]\n\n\t// Prepare for frustum culling\n\tvar proj math32.Matrix4\n\tproj.MultiplyMatrices(&r.rinfo.ProjMatrix, &r.rinfo.ViewMatrix)\n\tfrustum := math32.NewFrustumFromMatrix(&proj)\n\n\t// Internal function to classify a node and its children\n\tvar classifyNode func(inode core.INode)\n\tclassifyNode = func(inode core.INode) {\n\n\t\t// If node not visible, ignore\n\t\tnode := inode.GetNode()\n\t\tif !node.Visible() {\n\t\t\treturn\n\t\t}\n\n\t\t// Checks if node is a Graphic\n\t\tigr, ok := inode.(graphic.IGraphic)\n\t\tif ok {\n\t\t\tif igr.Renderable() {\n\n\t\t\t\tgr := igr.GetGraphic()\n\n\t\t\t\t// Frustum culling\n\t\t\t\tif igr.Cullable() {\n\t\t\t\t\tmw := gr.MatrixWorld()\n\t\t\t\t\tgeom := igr.GetGeometry()\n\t\t\t\t\tbb := geom.BoundingBox()\n\t\t\t\t\tbb.ApplyMatrix4(&mw)\n\t\t\t\t\tif frustum.IntersectsBox(&bb) {\n\t\t\t\t\t\t// Append graphic to list of graphics to be rendered\n\t\t\t\t\t\tr.rgraphics = append(r.rgraphics, gr)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Append graphic to list of culled graphics\n\t\t\t\t\t\tr.cgraphics = append(r.cgraphics, gr)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Append graphic to list of graphics to be rendered\n\t\t\t\t\tr.rgraphics = append(r.rgraphics, gr)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Node is not a Graphic\n\t\t} else {\n\t\t\t// Checks if node is a Light\n\t\t\til, ok := inode.(light.ILight)\n\t\t\tif ok {\n\t\t\t\tswitch l := il.(type) {\n\t\t\t\tcase *light.Ambient:\n\t\t\t\t\tr.ambLights = append(r.ambLights, l)\n\t\t\t\tcase *light.Directional:\n\t\t\t\t\tr.dirLights = append(r.dirLights, l)\n\t\t\t\tcase *light.Point:\n\t\t\t\t\tr.pointLights = append(r.pointLights, l)\n\t\t\t\tcase *light.Spot:\n\t\t\t\t\tr.spotLights = append(r.spotLights, l)\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(\"Invalid light type\")\n\t\t\t\t}\n\t\t\t\t// Other nodes\n\t\t\t} else {\n\t\t\t\tr.others = append(r.others, inode)\n\t\t\t}\n\t\t}\n\n\t\t// Classify node children\n\t\tfor _, ichild := range node.Children() {\n\t\t\tclassifyNode(ichild)\n\t\t}\n\t}\n\n\t// Classify all scene nodes\n\tclassifyNode(scene)\n\n\t//log.Debug(\"Rendered/Culled: %v/%v\", len(r.grmats), len(r.cgrmats))\n\n\t// Sets lights count in shader specs\n\tr.specs.AmbientLightsMax = len(r.ambLights)\n\tr.specs.DirLightsMax = len(r.dirLights)\n\tr.specs.PointLightsMax = len(r.pointLights)\n\tr.specs.SpotLightsMax = len(r.spotLights)\n\n\t// Pre-calculate MV and MVP matrices and compile lists of opaque and transparent graphic materials\n\tfor _, gr := range r.rgraphics {\n\t\t// Calculate MV and MVP matrices for all graphics to be rendered\n\t\tgr.CalculateMatrices(r.gs, &r.rinfo)\n\n\t\t// Append all graphic materials of this graphic to list of graphic materials to be rendered\n\t\tmaterials := gr.Materials()\n\t\tfor i := 0; i < len(materials); i++ {\n\t\t\tif materials[i].IMaterial().GetMaterial().Transparent() {\n\t\t\t\tr.grmatsTransp = append(r.grmatsTransp, &materials[i])\n\t\t\t} else {\n\t\t\t\tr.grmatsOpaque = append(r.grmatsOpaque, &materials[i])\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: If both GraphicMaterials belong to same Graphic we might want to keep their relative order...\n\n\t// Z-sort graphic materials (opaque front-to-back and transparent back-to-front)\n\tif r.sortObjects {\n\t\t// Internal function to render a list of graphic materials\n\t\tvar zSortGraphicMaterials func(grmats []*graphic.GraphicMaterial, backToFront bool)\n\t\tzSortGraphicMaterials = func(grmats []*graphic.GraphicMaterial, backToFront bool) {\n\t\t\tsort.Slice(grmats, func(i, j int) bool {\n\t\t\t\tgr1 := grmats[i].IGraphic().GetGraphic()\n\t\t\t\tgr2 := grmats[j].IGraphic().GetGraphic()\n\n\t\t\t\t// Check for user-supplied render order\n\t\t\t\trO1 := gr1.RenderOrder()\n\t\t\t\trO2 := gr2.RenderOrder()\n\t\t\t\tif rO1 != rO2 {\n\t\t\t\t\treturn rO1 < rO2\n\t\t\t\t}\n\n\t\t\t\tmvm1 := gr1.ModelViewMatrix()\n\t\t\t\tmvm2 := gr2.ModelViewMatrix()\n\t\t\t\tg1pos := gr1.Position()\n\t\t\t\tg2pos := gr2.Position()\n\t\t\t\tg1pos.ApplyMatrix4(mvm1)\n\t\t\t\tg2pos.ApplyMatrix4(mvm2)\n\n\t\t\t\tif backToFront {\n\t\t\t\t\treturn g1pos.Z < g2pos.Z\n\t\t\t\t}\n\n\t\t\t\treturn g1pos.Z > g2pos.Z\n\t\t\t})\n\t\t}\n\n\t\tzSortGraphicMaterials(r.grmatsOpaque, false) // Sort opaque graphics front to back\n\t\tzSortGraphicMaterials(r.grmatsTransp, true) // Sort transparent graphics back to front\n\t}\n\n\t// Render other nodes (audio players, etc)\n\tfor i := 0; i < len(r.others); i++ {\n\t\tinode := r.others[i]\n\t\tif !inode.GetNode().Visible() {\n\t\t\tcontinue\n\t\t}\n\t\tr.others[i].Render(r.gs)\n\t\tr.stats.Others++\n\t}\n\n\t// If there is graphic material to render or there was in the previous frame\n\t// it is necessary to clear the screen.\n\tif len(r.grmatsOpaque) > 0 || len(r.grmatsTransp) > 0 || r.prevStats.Graphics > 0 {\n\t\t// Clears the area inside the current scissor\n\t\tr.gs.Clear(gls.DEPTH_BUFFER_BIT | gls.STENCIL_BUFFER_BIT | gls.COLOR_BUFFER_BIT)\n\t\tr.rendered = true\n\t}\n\n\terr := error(nil)\n\n\t// Internal function to render a list of graphic materials\n\tvar renderGraphicMaterials func(grmats []*graphic.GraphicMaterial)\n\trenderGraphicMaterials = func(grmats []*graphic.GraphicMaterial) {\n\t\t// For each *GraphicMaterial\n\t\tfor _, grmat := range grmats {\n\t\t\tmat := grmat.IMaterial().GetMaterial()\n\t\t\tgeom := grmat.IGraphic().GetGeometry()\n\t\t\tgr := grmat.IGraphic().GetGraphic()\n\n\t\t\t// Add defines from material and geometry\n\t\t\tr.specs.Defines = *gls.NewShaderDefines()\n\t\t\tr.specs.Defines.Add(&mat.ShaderDefines)\n\t\t\tr.specs.Defines.Add(&geom.ShaderDefines)\n\t\t\tr.specs.Defines.Add(&gr.ShaderDefines)\n\n\t\t\t// Sets the shader specs for this material and sets shader program\n\t\t\tr.specs.Name = mat.Shader()\n\t\t\tr.specs.ShaderUnique = mat.ShaderUnique()\n\t\t\tr.specs.UseLights = mat.UseLights()\n\t\t\tr.specs.MatTexturesMax = mat.TextureCount()\n\n\t\t\t// Set active program and apply shader specs\n\t\t\t_, err = r.shaman.SetProgram(&r.specs)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Setup lights (transfer lights' uniforms)\n\t\t\tfor idx, l := range r.ambLights {\n\t\t\t\tl.RenderSetup(r.gs, &r.rinfo, idx)\n\t\t\t\tr.stats.Lights++\n\t\t\t}\n\t\t\tfor idx, l := range r.dirLights {\n\t\t\t\tl.RenderSetup(r.gs, &r.rinfo, idx)\n\t\t\t\tr.stats.Lights++\n\t\t\t}\n\t\t\tfor idx, l := range r.pointLights {\n\t\t\t\tl.RenderSetup(r.gs, &r.rinfo, idx)\n\t\t\t\tr.stats.Lights++\n\t\t\t}\n\t\t\tfor idx, l := range r.spotLights {\n\t\t\t\tl.RenderSetup(r.gs, &r.rinfo, idx)\n\t\t\t\tr.stats.Lights++\n\t\t\t}\n\n\t\t\t// Render this graphic material\n\t\t\tgrmat.Render(r.gs, &r.rinfo)\n\t\t\tr.stats.Graphics++\n\t\t}\n\t}\n\n\trenderGraphicMaterials(r.grmatsOpaque) // Render opaque objects (front to back)\n\tif err != nil {\n\t\treturn err\n\t}\n\trenderGraphicMaterials(r.grmatsTransp) // Render transparent objects (back to front)\n\n\treturn err\n}", "title": "" }, { "docid": "a888482380b8640a9810e0caab5bf703", "score": "0.44140515", "text": "func GetEvents(w http.ResponseWriter, r *http.Request) {\n\n\t// Add header so that received knows they're receiving JSON\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\n\t// Retrieving name of node from query request\n\tnodeName := r.URL.Query().Get(\"name\")\n\tconfirmation, socket := checkNodeName(nodeName)\n\tif !confirmation {\n\n\t\t// Stop code here no need to establish connection and reply\n\t\tjson.NewEncoder(w).Encode(responses.ErrorResponse{\n\t\t\tError: \"Node name requested doesn't exist\"})\n\t\treturn\n\t}\n\n\t// Retrieving height from query request\n\trecvHeight := r.URL.Query().Get(\"height\")\n\theight := checkHeight(recvHeight)\n\tif height == -1 {\n\n\t\t// Stop code here no need to establish connection and reply\n\t\tjson.NewEncoder(w).Encode(responses.ErrorResponse{\n\t\t\tError: \"Unexpected value found, height needs to be a string representing an int!\"})\n\t\treturn\n\t}\n\n\t// Attempt to load connection with staking client\n\tconnection, so := loadStakingClient(socket)\n\n\t// Close connection once code underneath executes\n\tdefer connection.Close()\n\n\t// If null object was retrieved send response\n\tif so == nil {\n\n\t\t// Stop code here faild to establish connection and reply\n\t\tjson.NewEncoder(w).Encode(responses.ErrorResponse{\n\t\t\tError: \"Failed to establish connection using socket : \" + socket})\n\t\treturn\n\t}\n\n\t// Return accounts from staking client\n\tevents, err := so.GetEvents(context.Background(), height)\n\tif err != nil {\n\t\tjson.NewEncoder(w).Encode(responses.ErrorResponse{\n\t\t\tError: \"Failed to get Events!\"})\n\t\tlgr.Error.Println(\n\t\t\t\"Request at /api/staking/events failed to retrieve Events : \", err)\n\t\treturn\n\t}\n\n\t// Respond with array of all accounts\n\tlgr.Info.Println(\"Request at /api/staking/events responding with\" +\n\t\t\" Events!\")\n\tjson.NewEncoder(w).Encode(responses.StakingEvents{StakingEvents: events})\n}", "title": "" }, { "docid": "00ca0c9f99b19033f22b5161f743a712", "score": "0.44121763", "text": "func (gs *GameService) List(ids []int, opts ...FuncOption) ([]*Game, error) {\n\turl, err := gs.client.multiURL(GameEndpoint, ids, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar g []*Game\n\n\terr = gs.client.get(url, &g)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn g, nil\n}", "title": "" }, { "docid": "dc6dcf9fccac1f9de10b44d96337fbf9", "score": "0.44107106", "text": "func ShowGenres(c *gin.Context) {\n\tvar params []Genre\n\tif Err := db.Find(&params).Error; Err == nil {\n\t\tc.Header(\"access-control-allow-origin\", \"*\")\n\t\tc.JSON(200, params)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5f9c44ad0449366538b1ef7890721041", "score": "0.44095477", "text": "func (e *Example) GetHouses(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\tfmt.Println(\"获取(搜索)房源服务 /api/v1.0/houses GetHouses\")\n\n\t//初始化返回数据\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\n\t//获取数据 获取url上的参数\n\t//地区\n\taid, _ := strconv.Atoi(req.Aid)\n\t//起始时间\n\tsd := req.Sd\n\t//结束时间\n\ted := req.Ed\n\t//第三栏信息\n\tsk := req.Sk\n\t//页码\n\tpage, _ := strconv.Atoi(req.P)\n\n\tfmt.Println(aid, sd, ed, sk, page)\n\n\t//查询相关地域的房屋信息\n\thouses := []models.House{}\n\n\t//创建orm句柄\n\to := orm.NewOrm()\n\t//设置要查找的表\n\tqs := o.QueryTable(\"House\")\n\t//根据地域信息查找房源\n\tnum, err := qs.Filter(\"Area__Id\", aid).All(&houses)\n\tif err != nil {\n\t\tfmt.Println(\"mysql数据库查找数据失败,err:\", err)\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t//计算总页数\n\ttotal_page := int(num) / models.HOUSE_LIST_PAGE_CAPACITY\n\t//当前页数\n\thouse_page := 1\n\n\t//定义容器,承载房屋数据\n\thouse_list := []interface{}{}\n\n\t//循环houses ,补全数据\n\tfor _, house := range houses {\n\t\to.LoadRelated(&house, \"User\")\n\t\to.LoadRelated(&house, \"Area\")\n\t\to.LoadRelated(&house, \"Facilities\")\n\t\to.LoadRelated(&house, \"Images\")\n\t\thouse_list = append(house_list, house)\n\t}\n\n\t//返回数据\n\trsp.Houses, err = json.Marshal(house_list)\n\tif err != nil {\n\t\tfmt.Println(\"数据转json失败,err:\", err)\n\t\trsp.Errno = utils.RECODE_DATAERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\trsp.TotalPage = int64(total_page)\n\trsp.CurrentPage = int64(house_page)\n\n\treturn nil\n}", "title": "" }, { "docid": "607947d7c6f3a62cc099c1e0c6451ad2", "score": "0.44087383", "text": "func GetGames() ([]Game, error) {\n\n\tvar games []Game\n\terr := CGames.Find(bson.M{}).All(&games)\n\tif err != nil {\n\t\tlog.Printf(\"Problem finding games :%s\", err)\n\t\treturn nil, err\n\t}\n\treturn games, nil\n}", "title": "" }, { "docid": "f09356ca869f4e9ab1e69a69662e3897", "score": "0.4406501", "text": "func (bridge *Bridge) SceneByName(name string) (*Scene, error) {\n\tscenes, err := bridge.AllScenes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, scene := range scenes {\n\t\tif scene.Name == name {\n\t\t\treturn bridge.SceneByID(scene.Id) // second request to fill lightstates\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"Unable to find scene with name \" + name)\n}", "title": "" }, { "docid": "85e6b05f8a6a4c680256e31a59b2bb84", "score": "0.4405912", "text": "func (a *Client) GetSpoeAgents(params *GetSpoeAgentsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSpoeAgentsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSpoeAgentsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSpoeAgents\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/services/haproxy/spoe/spoe_agents\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetSpoeAgentsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetSpoeAgentsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetSpoeAgentsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "59551260f4e85c297a81743e004c794d", "score": "0.4402263", "text": "func GetStudios() []models.Studio {\n\tconst table = \"studios\"\n\n\tvar studio []models.Studio\n\tvar aux models.Studio\n\n\trows, err := DbCon.Query(\"SELECT * FROM \" + table + \" WHERE 1=1\")\n\tif err != nil {\n\t\tlog.Println(\"Error Query Out/Select [File getStudios]\", err.Error())\n\t\tpanic(err.Error())\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&aux.ID, &aux.Name)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tstudio = append(studio, aux)\n\t}\n\n\treturn studio\n}", "title": "" }, { "docid": "1e3e311404037418e4837d10612a2fbd", "score": "0.4394111", "text": "func (api *Server) GetGroups(c echo.Context) error {\n\tlog.Debug(\"Get all Groups\")\n\n\tgroups := api.services.groupService.GetAllGroups()\n\treturn c.JSON(http.StatusOK ,groups)\n}", "title": "" }, { "docid": "ee332b56abdcb8dc61e133b7f3d82f3d", "score": "0.43794832", "text": "func GetClientsHandler(ctx iris.Context) {\n\n\tctx.ViewData(\"Title\", \"Index Page\")\n\tctx.View(PathClientList + \".html\")\n}", "title": "" }, { "docid": "d904d1361196fef35c2f21d60264b486", "score": "0.43789065", "text": "func ActivateScene(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tid := params[\"id\"]\n\tusbdali := &daliclient.Usbdali{}\n\tdefer usbdali.Close()\n\n\tfor _, scene := range scenes {\n\t\tif strings.Compare(scene.Id, id) == 0 {\n\n\t\t\tif err := usbdali.Connect(\"localhost\"); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := usbdali.Send(daliclient.MakeBroadcastCmd(scene.sceneId, daliclient.CmdSetScene)); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar resp []byte\n\t\t\tvar err error\n\t\t\tif resp, err = usbdali.Receive(); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfmt.Println(resp)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ab192951037307b014e6a2f280c5828b", "score": "0.43769395", "text": "func GetGameServerRegions(settings *playfab.Settings, postData *GameServerRegionsRequestModel, clientSessionTicket string) (*GameServerRegionsResultModel, error) {\r\n if clientSessionTicket == \"\" {\n return nil, playfab.NewCustomError(\"clientSessionTicket should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Client/GetGameServerRegions\", \"X-Authentication\", clientSessionTicket)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &GameServerRegionsResultModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "b95032e17efc893e8d9b31df3c8494bf", "score": "0.43683997", "text": "func getShowSeasons(showID int, locale string) tv.TvShowDetails {\n\tEXTENDED_URL := \"tv/\" + strconv.Itoa(showID) + \"?api_key=\" + TMDB_API_KEY_v3 + \"&language=\" + locale\n\tvar getShowDetails string = getRequestToTMDB(EXTENDED_URL)\n\tvar tvShowDetails tv.TvShowDetails\n\tjson.Unmarshal([]byte(getShowDetails), &tvShowDetails)\n\treturn tvShowDetails\n}", "title": "" }, { "docid": "26fdbe2b5c988844f4443eebbce24053", "score": "0.43665692", "text": "func (con *Controller) GetAll(w http.ResponseWriter, r *http.Request) {\n\tHelpers.Headers(w)\n\n\tprojects, err := con.DataStore.Get()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tHelpers.Status500(w, err.Error())\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(&projects)\n}", "title": "" }, { "docid": "3089a0e4f00b9a5f2e650465df98de79", "score": "0.43607733", "text": "func (t *EurekaServerApi) QueryAllInstances() ([]ApplicationVo, error) {\n res, err := t.request(http.MethodGet, t.url(\"/apps\"))\n if err != nil {\n log.Errorf(\"Failed to query all instances, err=%s\", err.Error())\n return nil, err\n }\n\n resApps := make(map[string]ApplicationsVo)\n err = json.Unmarshal(res.Body(), &resApps)\n if err != nil {\n log.Errorf(\"Failed to query all instances, json.Unmarshal err=%s\", err.Error())\n return nil, err\n }\n\n return resApps[\"applications\"].Application, nil\n}", "title": "" }, { "docid": "54fdc8e54ec1528c065c9fef255bbad3", "score": "0.4347939", "text": "func (c Games) Show(gameID int) revel.Result {\r\n\tvar res models.Game\r\n\r\n\tfor _, game := range games {\r\n\t\tif game.ID == gameID {\r\n\t\t\tres = game\r\n\t\t}\r\n\t}\r\n\r\n\tif res.ID == 0 {\r\n\t\treturn c.NotFound(\"Could not find game\")\r\n\t}\r\n\treturn c.RenderJSON(res)\r\n}", "title": "" }, { "docid": "c642b12f97e3e01d273ec8a44fdd81d5", "score": "0.43434596", "text": "func (httpAPI *API) Primaries(params martini.Params, r render.Render, req *http.Request) {\n\tinstances, err := inst.ReadWriteableClustersPrimaries()\n\n\tif err != nil {\n\t\tRespond(r, &APIResponse{Code: ERROR, Message: fmt.Sprintf(\"%+v\", err)})\n\t\treturn\n\t}\n\n\tr.JSON(http.StatusOK, instances)\n}", "title": "" }, { "docid": "108717dee0991a107da1834826aad895", "score": "0.4334396", "text": "func extractGames() []*GameSummary {\n\tvar gameSlice []*GameSummary\n\n\tdoc, err := goquery.NewDocument(\"https://unity3d.com/showcase/gallery\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// scrape HTML for video game information\n\tdoc.Find(\".game\").Each(func(index int, item *goquery.Selection) {\n\t\tgame := &GameSummary{}\n\t\tgame.Title = item.Find(\".title\").Text()\n\t\tgame.Developer = item.Find(\".developer\").Text()\n\t\tgame.Description = item.Find(\".description\").Find(\"p\").Text()\n\t\turl, _ := item.Find(\".description\").Find(\"a\").Attr(\"href\")\n\t\tgame.GameURL = url\n\t\tgame.Genre = item.Find(\".genres\").Text()\n\t\timage, _ := item.Find(\".ic\").Attr(\"src\")\n\t\tgame.ImageURL = image\n\t\tgameSlice = append(gameSlice, game)\n\t})\n\treturn gameSlice\n}", "title": "" }, { "docid": "e71a082d637b10f578cf3392ee34c5de", "score": "0.4326583", "text": "func Get(page int, limit int) ([]structs.News, error) {\n\tctx := context.Background()\n\terr = openES()\n\tfail(err)\n\tvar allnews []structs.News\n\n\tvar offset int\n\toffset = (page - 1) * limit\n\n\tsr, err := client.Search().\n\t\tIndex(indexName).\n\t\tSort(\"created\", false).\n\t\tType(docType).\n\t\tFrom(offset).\n\t\tSize(limit).\n\t\tDo(ctx)\n\tfail(err)\n\n\terr = openDB()\n\tfail(err)\n\tdefer db.Close()\n\n\tvar wg sync.WaitGroup\n\tvar srlen = int(len(sr.Hits.Hits))\n\twg.Add(srlen)\n\n\t// retrive all data on DB concurrently, by using goroutine\n\tfor _, hit := range sr.Hits.Hits {\n\t\tgo func(hit *elastic.SearchHit) {\n\t\t\tdefer wg.Done()\n\t\t\tvar n structs.News\n\t\t\terr := json.Unmarshal(*hit.Source, &n)\n\t\t\tfail(err)\n\n\t\t\terr = db.QueryRow(\"SELECT author, body FROM news where id = ?\", n.ID).Scan(&n.Author, &n.Body)\n\t\t\tfail(err)\n\n\t\t\tallnews = append(allnews, n)\n\t\t}(hit)\n\t}\n\twg.Wait()\n\n\t// sort result to make it ordered by Created DESC\n\tsort.Slice(allnews[:], func(i, j int) bool {\n\t\treturn allnews[i].Created.After(allnews[j].Created)\n\t})\n\n\treturn allnews, nil\n}", "title": "" }, { "docid": "1ebf8ca6decde52d506da5a870da981b", "score": "0.4326163", "text": "func WorldsHandler(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, GetAll())\n}", "title": "" }, { "docid": "1e96beaf4146a144882af988e35058f5", "score": "0.43211493", "text": "func (c *Client) GetEnclaves() ([]Enclave, error) {\n\tvar enclaves []Enclave\n\n\turl := fmt.Sprintf(\"%s%s\", c.APIBase, \"enclaves\")\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\n\tif err != nil {\n\t\treturn enclaves, err\n\t}\n\n\tif err = c.SendWithAuth(req, &enclaves); err != nil {\n\t\treturn enclaves, err\n\t}\n\n\treturn enclaves, nil\n}", "title": "" }, { "docid": "f7bb53e7a3eaadb9adca0f7c95f91411", "score": "0.43206435", "text": "func (h *Handler) clusterDatabasesGet(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *SessionContext, site reversetunnel.RemoteSite) (interface{}, error) {\n\tclt, err := ctx.GetUserClient(site)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tresp, err := listResources(clt, r, types.KindDatabaseServer)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tservers, err := types.ResourcesWithLabels(resp.Resources).AsDatabaseServers()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Make a list of all proxied databases.\n\tvar databases []types.Database\n\tfor _, server := range servers {\n\t\tdatabases = append(databases, server.GetDatabase())\n\t}\n\n\treturn listResourcesGetResponse{\n\t\tItems: ui.MakeDatabases(h.auth.clusterName, databases),\n\t\tStartKey: resp.NextKey,\n\t\tTotalCount: resp.TotalCount,\n\t}, nil\n}", "title": "" }, { "docid": "133358cd144e3776ecd3f48c0f2e2fa8", "score": "0.43191862", "text": "func (s *Service) Genesis(ctx context.Context, _ *empty.Empty) (*pb.GenesisResponse, error) {\n\tresult, err := s.client.Genesis()\n\tif err != nil {\n\t\treturn nil, status.Error(codes.FailedPrecondition, err.Error())\n\t}\n\n\tif timeoutStatus := s.checkTimeout(ctx); timeoutStatus != nil {\n\t\treturn nil, timeoutStatus.Err()\n\t}\n\n\tvar appState pb.GenesisResponse_AppState\n\terr = protojson.Unmarshal(result.Genesis.AppState, &appState)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tif timeoutStatus := s.checkTimeout(ctx); timeoutStatus != nil {\n\t\treturn nil, timeoutStatus.Err()\n\t}\n\n\treturn &pb.GenesisResponse{\n\t\tGenesisTime: result.Genesis.GenesisTime.Format(time.RFC3339Nano),\n\t\tChainId: result.Genesis.ChainID,\n\t\tConsensusParams: &pb.GenesisResponse_ConsensusParams{\n\t\t\tBlock: &pb.GenesisResponse_ConsensusParams_Block{\n\t\t\t\tMaxBytes: result.Genesis.ConsensusParams.Block.MaxBytes,\n\t\t\t\tMaxGas: result.Genesis.ConsensusParams.Block.MaxGas,\n\t\t\t\tTimeIotaMs: result.Genesis.ConsensusParams.Block.TimeIotaMs,\n\t\t\t},\n\t\t\tEvidence: &pb.GenesisResponse_ConsensusParams_Evidence{\n\t\t\t\tMaxAgeNumBlocks: result.Genesis.ConsensusParams.Evidence.MaxAgeNumBlocks,\n\t\t\t\tMaxAgeDuration: int64(result.Genesis.ConsensusParams.Evidence.MaxAgeDuration),\n\t\t\t},\n\t\t\tValidator: &pb.GenesisResponse_ConsensusParams_Validator{\n\t\t\t\tPubKeyTypes: result.Genesis.ConsensusParams.Validator.PubKeyTypes,\n\t\t\t},\n\t\t},\n\t\tAppHash: result.Genesis.AppHash.String(),\n\t\tAppState: &appState,\n\t}, nil\n}", "title": "" }, { "docid": "9b0ac1bd58040c2129cd9ad65257f260", "score": "0.431544", "text": "func (cr *cmdRunner) getRegions(sockID int) (Regions, error) {\n\tif err := cr.checkIpmctl(badIpmctlVers); err != nil {\n\t\treturn nil, errors.WithMessage(err, \"checkIpmctl\")\n\t}\n\n\tout, err := cr.runRegionCmd(sockID, cmdShowRegions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tcase strings.Contains(out, outNoCLIPerms):\n\t\treturn nil, errors.Errorf(\"insufficient permissions to run %s\", cmdShowRegions)\n\tcase strings.Contains(out, outNoPMemModules):\n\t\treturn nil, errNoPMemModules\n\tcase strings.Contains(out, outNoPMemRegions):\n\t\treturn Regions{}, nil\n\tcase strings.Contains(out, outNoPMemRegionResults):\n\t\treturn Regions{}, nil\n\t}\n\n\tvar rl RegionList\n\tif err := xml.Unmarshal([]byte(out), &rl); err != nil {\n\t\treturn nil, errors.Wrap(err, \"parse show region cmd output\")\n\t}\n\n\tif len(rl.Regions) == 0 {\n\t\treturn nil, errors.New(\"no app-direct pmem regions parsed\")\n\t}\n\n\treturn Regions(rl.Regions), nil\n}", "title": "" }, { "docid": "2550a7c3c94629e094bf685ce37d9b5a", "score": "0.43128398", "text": "func (bridge *Bridge) CreateScene(scenedata CreateScene) ([]Result, error) {\n\tvar results []Result\n\terr := bridge.post(\"/scenes/\", &scenedata, &results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "1802e0f5c57472c9244443375a1ad6a5", "score": "0.4306974", "text": "func GetClients(resp http.ResponseWriter, req *http.Request, params routing.Params) {\n\n\tlimitOffset := tools.GetLimitOffset(req)\n\n\t/*------*/\n\n\ttotalRows := int64(0)\n\t{\n\t\tSQL := `SELECT COUNT(*) AS \"total\" FROM \"clients\"`\n\t\trows, err := global.DB.Query(SQL, database.QueryParams{})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error in db query: %v\", err)\n\t\t\thttp.Error(resp, \"Internal Server Error: \"+err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\ttotalRows = rows[0][\"total\"].(int64)\n\t}\n\n\ttotalPages := int64(math.Ceil(float64(totalRows) / float64(global.RowsPerPage)))\n\tpagination := map[string]interface{}{\n\t\t\"current_page\": limitOffset.Page,\n\t\t\"total_pages\": totalPages,\n\t\t\"total_entries\": totalRows,\n\t}\n\n\t/*------*/\n\n\tSQL := `SELECT *\n\t\t\tFROM \n\t\t\t\t\"clients\"\n\t\t\tLIMIT $1 OFFSET $2`\n\n\trows, err := global.DB.Query(SQL, database.QueryParams{limitOffset.Limit, limitOffset.Offset})\n\tif err != nil {\n\t\tlog.Printf(\"Error in db query: %v\", err)\n\t\thttp.Error(resp, \"Internal Server Error: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ttools.SendJSON(resp, map[string]interface{}{\"pagination\": pagination, \"rows\": rows})\n}", "title": "" }, { "docid": "853888b1e978b8b47e37fcd86026cf75", "score": "0.4303317", "text": "func (c *client) ListEngines(ctx context.Context, page Page) (data EngineResponse, err error) {\n\terr = c.Call(ctx, page, &data, http.MethodGet, \"engines\")\n\n\treturn data, err\n}", "title": "" }, { "docid": "8b581b77b7957c45d7e4b7394ba67948", "score": "0.430155", "text": "func GetResources() (*http.Response, error) {\n return RequestAcl(\"GET\", \"resources\")\n}", "title": "" }, { "docid": "162da548726ca5afd18ad9a202a33a10", "score": "0.4300677", "text": "func AllVersions(url string, fromView bool, matchString string) []jenkins_types.Pipeline {\n\t// fmt.Println(\"************************************************************************************\")\n\t// fmt.Println(url)\n\tvar vd VersionData\n\n\turlWithOptions := fmt.Sprintf(\"%s?tree=views[name,url]\", url)\n\tresp, err := http.Get(urlWithOptions)\n\n\tutils.CheckError(\"Error Getting All Versions\", err)\n\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\terr = json.Unmarshal(body, &vd)\n\n\tif err != nil {\n\t\tfmt.Println(\"error 1:\", err)\n\t}\n\n\tvar allLines []jenkins_types.Pipeline\n\n\tfor _, v := range vd.Views {\n\t\tre := regexp.MustCompile(`(pe-[0-9]{4}|[0-9]+)\\.[0-9]+\\.x`)\n\t\tif re.MatchString(v.Name) {\n\t\t\tallLines = append(allLines, OneVersion(fmt.Sprintf(\"%sapi/json?depth=2\", v.URL), fromView, matchString))\n\t\t}\n\t}\n\n\treturn allLines\n}", "title": "" }, { "docid": "dea787a87b70eefbf09c571d16bf3b87", "score": "0.42936322", "text": "func GetRoles(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tdb, err := db.Open()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.Close()\n\tdb = util.SetDBPagination(db, r)\n\n\tvar roles types.Roles\n\tif err := roles.Get(db); err != nil {\n\t\tutil.ErrorResponder(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tutil.PaginationResponder(w, r, roles)\n}", "title": "" }, { "docid": "8589c2118ee9b3b715deb3199949fa3c", "score": "0.42909223", "text": "func (service MovieViewerService) Subtitles(key resource.Key, language resource.Language) movie.SubtitleList {\n\tcurrentValue, cacheErr := service.movieCache.Subtitles(key, language)\n\tif cacheErr != nil {\n\t\treturn movie.SubtitleList{}\n\t}\n\treturn currentValue\n}", "title": "" }, { "docid": "77c944bd6743075381db2756b7eef1c7", "score": "0.42885587", "text": "func (c *Client) get(m scrape.Matcher) ([]Article, error) {\n\tnode, err := c.page()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnode, ok := scrape.Find(node, m)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Couldn't find requested section\")\n\t}\n\n\treturn c.collect(node)\n}", "title": "" }, { "docid": "47a1b26ec1bc3f865f5e9200fa458dc9", "score": "0.42830464", "text": "func (s *GamesService) Games(data models.GameFilterModel, headers map[string]string, log logger.Logger) (response models.OperationResponseOfIEnumerableOfGameFront, err error) {\n\terr = s.client.apiReq(http.MethodPost, \"/games\", nil, &data, &response, &headers, log)\n\treturn\n}", "title": "" }, { "docid": "1b9708491e41215107555819ee1c9c41", "score": "0.4280925", "text": "func RevisionsGet(c *gin.Context) {\n\t// Get stream query parameter\n\tstream := c.DefaultQuery(\"stream\", \"\")\n\n\t// Initialise response object\n\tresponse := Revisions{}\n\n\t// Execute operation from the store package\n\terr := store.RevisionsGet(c, &response, stream)\n\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(err.StatusCode(), err)\n\t}\n\n\tc.JSON(200, response)\n}", "title": "" }, { "docid": "51433ddfae76f81357152d3fb0562ddf", "score": "0.427892", "text": "func (c *EstateApiController) GetEstates(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.GetEstates()\n\tif err != nil {\n\t\tw.WriteHeader(HttpStatus(err))\n\t\treturn\n\t}\n\n\tEncodeJSONResponse(result, nil, w)\n}", "title": "" }, { "docid": "9c5c19249da83f837c27c2921f0caffe", "score": "0.4277201", "text": "func (s *RacesService) GetRaces(ctx context.Context, in *common.InvocationEvent) (out *common.Content, err error) {\r\n\tdefer helper.TimeTrack(time.Now(), \"GetRacesHandler()\")\r\n\r\n\tcosmosCfg := cosmosapi.Config{\r\n\t\tMasterKey: s.dbConfig.DbKey,\r\n\t}\r\n\r\n\tclient := cosmosapi.New(s.dbConfig.DbURL, cosmosCfg, nil, nil)\r\n\tlistOps := cosmosapi.ListDocumentsOptions{\r\n\t\tMaxItemCount: 1000,\r\n\t\tAIM: \"\",\r\n\t\tContinuation: \"\",\r\n\t\tIfNoneMatch: \"\",\r\n\t\tPartitionKeyRangeId: \"\",\r\n\t}\r\n\r\n\tvar races []spec.Race\r\n\t_, err = client.ListDocuments(context.Background(), s.dbConfig.DbName, s.dbConfig.DbContainer, &listOps, &races)\r\n\tif err != nil {\r\n\t\terr = errors.WithStack(err)\r\n\t\tlogger.Fatalf(\"error in listResponse: %s\", err.Error())\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tbytArr, err := json.Marshal(races)\r\n\tif err != nil {\r\n\t\tlogger.Print(err.Error())\r\n\t}\r\n\r\n\tout = &common.Content{\r\n\t\tData: bytArr,\r\n\t\tContentType: in.ContentType,\r\n\t\tDataTypeURL: in.DataTypeURL,\r\n\t}\r\n\r\n\treturn out, nil\r\n}", "title": "" }, { "docid": "98f29d3202e969edd9de9ea004dbd48d", "score": "0.42758626", "text": "func (pc RoomController) Index(c *gin.Context) {\n\tvar s room.Service\n\tp, err := s.GetAll()\n\tif err != nil {\n\t\tc.AbortWithStatus(404)\n\t\tfmt.Println(err)\n\t} else {\n\t\tc.JSON(200, p)\n\t}\n}", "title": "" }, { "docid": "514b93b8b9b3511dcf102a268f006b21", "score": "0.4275505", "text": "func (c *Controller) GetRooms(svc service.GetRooms) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tres, err := svc(r.Context(), service.GetRoomsRequest{})\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tjson.NewEncoder(w).Encode(res)\n\t}\n}", "title": "" }, { "docid": "f0ea29e482dc70edfe5f9795141de927", "score": "0.42748702", "text": "func getMagickBoxes() (ms []Machine) {\n resp, err := http.Get(\"http://mmil.ucsd.edu/MagickBox/queryMachines.php\")\n if err != nil {\n println(\"Error: could not query mmil.ucsd.edu\")\n }\n defer resp.Body.Close()\n body, err := ioutil.ReadAll(resp.Body)\n\n // now parse the body\n var f []Machine\n json.Unmarshal(body, &f) // unnamed structure we will print everything that comes back\n\n return f\n}", "title": "" }, { "docid": "769780d77697635836f4d0fa4064599b", "score": "0.42721918", "text": "func (manager *GceManager) GetSnapshots(projectId string) ([]*compute.Snapshot, error) {\n\tlog.Tracef(\"Get snapshots: project[%s]\", projectId)\n\n\tsnapshotService := compute.NewSnapshotsService(manager.Service)\n\tresult, err := snapshotService.List(projectId).Do()\n\tif err != nil {\n\t\treturn nil, gceError(err.Error())\n\t}\n\n\tsnapshots := result.Items\n\tfor _, snapshot := range snapshots {\n\t\tlog.Tracef(\"snapshot: id[%d], name[%s]\", snapshot.Id, snapshot.Name)\n\t}\n\n\treturn snapshots, nil\n}", "title": "" }, { "docid": "bc8036ce7e8c8a0ade59bd72219b408c", "score": "0.4271794", "text": "func (h clusterHandler) getAllHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tproject := vars[\"project-name\"]\n\tlogicalCloud := vars[\"logical-cloud-name\"]\n\tvar ret interface{}\n\tvar err error\n\n\tret, err = h.client.GetAllClusters(project, logicalCloud)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\terr = json.NewEncoder(w).Encode(ret)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "eb93aff94b74ecc7af30ed37f124ffbb", "score": "0.42694366", "text": "func GetExperiences(w http.ResponseWriter, req *http.Request) {\n\n\t// Get session values or redirect to Login\n\tsession, err := sessions.Store.Get(req, \"session\")\n\n\tif err != nil {\n\t\tlog.Println(\"error identifying session\")\n\t\thttp.Redirect(w, req, \"/login/\", 302)\n\t\treturn\n\t\t// in case of error\n\t}\n\n\t// Prep for user authentication\n\tsessionMap := getUserSessionValues(session)\n\n\tusername := sessionMap[\"username\"]\n\tloggedIn := sessionMap[\"loggedin\"]\n\tisAdmin := sessionMap[\"isAdmin\"]\n\n\tfmt.Println(loggedIn, isAdmin, username)\n\n\tfmt.Println(session)\n\n\t/*\n\t\tif username == \"\" {\n\t\t\thttp.Redirect(w, req, \"/\", 302)\n\t\t\treturn\n\t\t}\n\t*/\n\n\texps, err := database.ListExperiences(db)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tjson.NewEncoder(w).Encode(exps)\n}", "title": "" }, { "docid": "8506a37d28cb9b4b9099dba352a4eae6", "score": "0.4268989", "text": "func (o *Object) Scene() *Scene {\n\treturn o.scene\n}", "title": "" }, { "docid": "0f0bee615b73471a0705b289d2c2907b", "score": "0.42678577", "text": "func GetClients(c context.Context, r *http.Request) ([]models.Client, interface{}, int, int, error) {\n\t// Now if user is not querying then check\n\tuser, err := GetCurrentUser(c, r)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn []models.Client{}, nil, 0, 0, err\n\t}\n\n\tif !user.IsAdmin {\n\t\treturn []models.Client{}, nil, 0, 0, errors.New(\"Forbidden\")\n\t}\n\n\tquery := datastore.NewQuery(\"Client\")\n\tquery = ConstructQuery(query, r)\n\tks, err := query.KeysOnly().GetAll(c, nil)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn []models.Client{}, nil, 0, 0, err\n\t}\n\n\tvar clients []models.Client\n\tclients = make([]models.Client, len(ks))\n\terr = nds.GetMulti(c, ks, clients)\n\tif err != nil {\n\t\tlog.Infof(c, \"%v\", err)\n\t\treturn clients, nil, 0, 0, err\n\t}\n\n\tfor i := 0; i < len(clients); i++ {\n\t\tclients[i].Format(ks[i], \"clients\")\n\t}\n\n\treturn clients, nil, len(clients), 0, nil\n}", "title": "" }, { "docid": "8469837b13b9141c6c56e0c11928e84b", "score": "0.4263899", "text": "func GetAllCourses(from int) (allCourses []Course, totalPages int64) {\n\tclient := GetElasticCon(elasticUrl)\n\n\tquery := elastic.NewMatchAllQuery()\n\n\tsearchResult, err := client.Search().\n\t\tIndex(\"courses\").\n\t\tQuery(query).\n\t\tSort(\"timestamp\", false).\n\t\tFrom(from).\n\t\tSize(15).\n\t\tPretty(true).\n\t\tDo(context.Background())\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//testing page count\n\ttotalPages = searchResult.Hits.TotalHits / 15\n\n\tif searchResult.Hits.TotalHits > 0 {\n\n\t\tfor _, hit := range searchResult.Hits.Hits {\n\t\t\tvar course Courses\n\t\t\tjson.Unmarshal(*hit.Source, &course.Course)\n\t\t\tallCourses = append(allCourses, course.Course)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7642dcf2e78c39d654ecc58010632f86", "score": "0.42624798", "text": "func (c *Client) Versions(ctx context.Context) ([]Version, error) {\n\tvar versions []Version\n\terr := c.getJSON(ctx, \"https://ddragon.leagueoflegends.com/api/versions.json\", &versions)\n\treturn versions, err\n}", "title": "" }, { "docid": "d5e44c7db71d6b1683340e72b26461df", "score": "0.42619765", "text": "func (a *Client) GetIndustrySystems(params *GetIndustrySystemsParams) (*GetIndustrySystemsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetIndustrySystemsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_industry_systems\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/industry/systems/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetIndustrySystemsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetIndustrySystemsOK), nil\n\n}", "title": "" }, { "docid": "f94a2583d62ce2454e40831ba4d1765f", "score": "0.42547196", "text": "func clustersHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet {\n\t\tmiddleware.Write(w, r, nil)\n\t}\n\n\tclusters, err := client.Clusters()\n\tif err != nil {\n\t\tmiddleware.Errorf(w, r, err, http.StatusBadRequest, fmt.Sprintf(\"Could not load clusters %s\", err.Error()))\n\t\treturn\n\t}\n\n\tdata := struct {\n\t\tClusters map[string]kube.Cluster `json:\"clusters\"`\n\t}{\n\t\tclusters,\n\t}\n\n\tmiddleware.Write(w, r, data)\n\treturn\n}", "title": "" }, { "docid": "5f49b455ce64217999e05849700abf80", "score": "0.42528", "text": "func GetStates(c *gin.Context) {\n\tif list, err := loadStates(); err != nil {\n\t\tc.AbortWithStatus(404)\n\t\tlog.Print(err)\n\t} else {\n\t\tc.JSON(200, list)\n\t}\n}", "title": "" }, { "docid": "7c42b88f6f0e4723df28aee9b788d9ab", "score": "0.42512184", "text": "func (s *Service) TopSceneQuery() (*model.SceneRes, error) {\n\treturn s.dao.TopSceneQuery()\n}", "title": "" }, { "docid": "b8ea1283376f6488aec36b68a13bda80", "score": "0.42471284", "text": "func (v *Validation) SceneFields() []string {\n\treturn v.scenes[v.scene]\n}", "title": "" }, { "docid": "94b03ae87ff30728edcd791f4bed2f28", "score": "0.42454198", "text": "func (s *KhronosService) GetJobs(r *http.Request) (int, interface{}, error) {\n\tlogrus.Debug(\"Calling GetAllJobs endpoint\")\n\n\t// Page will set the offset\n\tpage := pageFromRequest(r)\n\tlength := s.Storage.JobsLength()\n\tstart, end := s.offsetsFromPage(page, length)\n\n\t// First check if need to query\n\tif (start > length) || length == 0 {\n\t\treturn http.StatusOK, []struct{}{}, nil\n\t}\n\n\tjobs, err := s.Storage.GetJobs(start, end)\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error retrieving all jobs: %v\", err)\n\t\treturn http.StatusInternalServerError, errorRetrievingAllJobsMsg, nil\n\t}\n\n\treturn http.StatusOK, jobs, nil\n}", "title": "" } ]
d5ae7d9535aa15087c05be38e59aff30
ReadResponse reads a server response into the received o.
[ { "docid": "2bdfb5db7f532aabdc17538afaf8aa75", "score": "0.0", "text": "func (o *SubaccountsBySubaccountIDDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 403:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 405:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 429:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewSubaccountsBySubaccountIDDeleteDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" } ]
[ { "docid": "6921b463c9c1b5f4e4dc89080774b072", "score": "0.8197429", "text": "func ReadResponse(r *bufio.Reader, req *Request) (*Response, error) {}", "title": "" }, { "docid": "4a9db7b0ab76cd1677a0c1b4e26e4022", "score": "0.8065155", "text": "func ReadResponse(r io.Reader, v interface{}) error {\n\t_, err := ReadResponsePage(r, v)\n\treturn err\n}", "title": "" }, { "docid": "1bc35d8897912c8d430ac71d340c76e8", "score": "0.77394056", "text": "func (hs *HandlerSocket) readResponse() error {\n\tvar (\n\t\tbuf [1]byte\n\t\terr error\n\t\tn int\n\t)\n\n\ths.in.Reset()\n\n\tfor {\n\t\tif n, err = hs.conn.Read(buf[0:]); err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\t// real error\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\ths.in.Write(buf[0:n])\n\n\t\t// 0x0A at the end signifies end of response\n\t\tif buf[n-1] == _PROT_TERMINATOR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0531cc70f129d8d311c92662f48a650c", "score": "0.77031374", "text": "func (o *UnbindServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUnbindServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewUnbindServerUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewUnbindServerForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewUnbindServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1d42935475fcf2ea144d31f5df26947e", "score": "0.7666639", "text": "func (o *BindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewBindOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewBindNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewBindInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1dbf92c11c9213e740ab82f0e01dae97", "score": "0.7507014", "text": "func (o *UnlinkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUnlinkOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewUnlinkNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 405:\n\t\tresult := NewUnlinkMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1cb2af57cc3a7e3bd8bdf9b2c9762bde", "score": "0.7495526", "text": "func ReadResponse(call tchannel.ArgReadable) (*http.Response, error) {\n\tvar arg2 []byte\n\tif err := tchannel.NewArgReader(call.Arg2Reader()).Read(&arg2); err != nil {\n\t\treturn nil, err\n\t}\n\n\trb := typed.NewReadBuffer(arg2)\n\tstatusCode := rb.ReadUint16()\n\tmessage := readVarintString(rb)\n\n\tresponse := &http.Response{\n\t\tStatusCode: int(statusCode),\n\t\tStatus: fmt.Sprintf(\"%v %v\", statusCode, message),\n\t\tProto: \"HTTP/1.1\",\n\t\tProtoMajor: 1,\n\t\tProtoMinor: 1,\n\t\tHeader: make(http.Header),\n\t}\n\treadHeaders(rb, response.Header)\n\tif err := rb.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\targ3Reader, err := call.Arg3Reader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse.Body = arg3Reader\n\treturn response, nil\n}", "title": "" }, { "docid": "65c1d5554d10ccc0b9f8b346bcae8f94", "score": "0.74392295", "text": "func (o *PostChatroomsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostChatroomsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewPostChatroomsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "4847cb8bb5969001d6c65457cb77e19e", "score": "0.74178743", "text": "func (c *Conn) ReadResponse() (resp interface{}, err error) {\n\tch, err := c.r.ReadByte()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch ch {\n\tcase '+':\n\t\tline, isPrefix, err := c.r.ReadLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif isPrefix {\n\t\t\treturn nil, ErrSize\n\t\t}\n\t\treturn Status(line), nil\n\tcase '-':\n\t\tline, isPrefix, err := c.r.ReadLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif isPrefix {\n\t\t\treturn nil, ErrSize\n\t\t}\n\t\treturn Error(line), nil\n\tcase ':':\n\t\tline, isPrefix, err := c.r.ReadLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif isPrefix {\n\t\t\treturn nil, ErrSize\n\t\t}\n\t\ti, err := strconv.Atoi(string(line))\n\t\tif err != nil {\n\t\t\treturn nil, ErrFormat\n\t\t}\n\t\treturn Integer(i), nil\n\tcase '$':\n\t\tc.r.UnreadByte()\n\t\treturn c.ReadBulk()\n\tcase '*':\n\t\tc.r.UnreadByte()\n\t\treturn c.ReadMultiBulk()\n\t}\n\treturn nil, ErrFormat\n}", "title": "" }, { "docid": "032f650b0585b2de6906e0eb5f722a2e", "score": "0.73881567", "text": "func (c *client) ReadResponse() (*Response, error) {\n\tversion, code, msg, err := c.ReadStatusLine()\n\tvar headers []Header\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ReadStatusLine: %v\", err)\n\t}\n\tfor {\n\t\tvar key, value string\n\t\tvar done bool\n\t\tkey, value, done, err = c.ReadHeader()\n\t\tif err != nil || done {\n\t\t\tbreak\n\t\t}\n\t\tif key == \"\" {\n\t\t\t// empty header values are valid, rfc 2616 s4.2.\n\t\t\terr = errors.New(\"invalid header\")\n\t\t\tbreak\n\t\t}\n\t\theaders = append(headers, Header{key, value})\n\t}\n\tvar resp = Response{\n\t\tVersion: version,\n\t\tStatus: Status{code, msg},\n\t\tHeaders: headers,\n\t\tBody: c.ReadBody(),\n\t}\n\tif l := resp.ContentLength(); l >= 0 {\n\t\tresp.Body = io.LimitReader(resp.Body, l)\n\t} else if resp.TransferEncoding() == \"chunked\" {\n\t\tresp.Body = httputil.NewChunkedReader(resp.Body)\n\t}\n\treturn &resp, err\n}", "title": "" }, { "docid": "fbb321e088b18727fec1dbc7109cd662", "score": "0.73801255", "text": "func (o *VerifyConnection1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewVerifyConnection1NoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewVerifyConnection1BadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewVerifyConnection1Unauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewVerifyConnection1Forbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "bca4db41e05df357d6930f9b1a4bc699", "score": "0.7376496", "text": "func (o *RecordUsageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewRecordUsageOK()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "e5acc07c316d3120348c3da9aff9daf7", "score": "0.73680705", "text": "func (o *AddServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewAddServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewAddServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewAddServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewAddServerConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewAddServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e194e2411109a62e4930865e1f979c7f", "score": "0.7361271", "text": "func (o *JourneyMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewJourneyMetaOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9a5d00377c9585ceaf6b229c013595d8", "score": "0.733168", "text": "func (cli *Client) readResponse(b io.ReadCloser, result interface{}) error {\n\tbody, err := ioutil.ReadAll(b)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"reading response failed\")\n\t}\n\n\terr = json.Unmarshal(body, result)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unmarshal response failed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fe8bb101dd3b4a05d0a782876ee02910", "score": "0.7317528", "text": "func (o *ServeServerInfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewServeServerInfoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "104b63d44087fcf235b710716b689d61", "score": "0.7301894", "text": "func (o *SubtractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSubtractOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewSubtractUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewSubtractForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewSubtractInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "eed2c24f3a2300953c59731bcb1d4c06", "score": "0.72928107", "text": "func (c *client) readResponse(ctx context.Context, resp *ResponsePipe, req *Request) (err error) {\n\n\tvar rec record\n\tdone := make(chan int)\n\n\t// readloop in goroutine\n\tgo func(rwc io.ReadWriteCloser) {\n\treadLoop:\n\t\tfor {\n\t\t\tif err := rec.read(rwc); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// different output type for different stream\n\t\t\tswitch rec.h.Type {\n\t\t\tcase typeStdout:\n\t\t\t\tresp.stdOutWriter.Write(rec.content())\n\t\t\tcase typeStderr:\n\t\t\t\tresp.stdErrWriter.Write(rec.content())\n\t\t\tcase typeEndRequest:\n\t\t\t\tbreak readLoop\n\t\t\tdefault:\n\t\t\t\terr := fmt.Sprintf(\"unexpected type %#v in readLoop\", rec.h.Type)\n\t\t\t\tresp.stdErrWriter.Write([]byte(err))\n\t\t\t}\n\t\t}\n\t\tclose(done)\n\t}(c.conn.rwc)\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t// do nothing, let client.Do handle\n\t\terr = fmt.Errorf(\"gofast: timeout or canceled\")\n\tcase <-done:\n\t\t// do nothing and end the function\n\t}\n\treturn\n}", "title": "" }, { "docid": "c13ea073da5e8b6133aeb33b921e1a4d", "score": "0.72873265", "text": "func (o *CountServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewCountServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewCountServerUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewCountServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /dsmcontroller/admin/namespaces/{namespace}/servers/count returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "title": "" }, { "docid": "a20b8b99d0df86f1628a53477c4b48a6", "score": "0.72773165", "text": "func (o *SetSipgateIoUrlsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 403:\n\t\tresult := NewSetSipgateIoUrlsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "bf185b6507e7ad1b3b0d3ee5daf711e4", "score": "0.7274205", "text": "func (o *ShutdownServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewShutdownServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewShutdownServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewShutdownServerUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewShutdownServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewShutdownServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested POST /dsmcontroller/namespaces/{namespace}/servers/shutdown returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "title": "" }, { "docid": "8ce2a98ed847ae77590f162ba5011247", "score": "0.72675675", "text": "func (o *SendTransaction2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSendTransaction2OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewSendTransaction2Default(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "5711bd7aef23c43d095e5761a2051c59", "score": "0.7262503", "text": "func (o *GetEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetEventsOK(o.writer)\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewGetEventsInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1a4f87be14606b5d60e6fecc3bfa675d", "score": "0.7261559", "text": "func (r response) Read(buffer []byte) (int, error) {\n\treturn r.resp.Body.Read(buffer)\n}", "title": "" }, { "docid": "97c7f9ad3d44860e3a4f17f6874bf941", "score": "0.7259685", "text": "func (o *StatusInspectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewStatusInspectOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewStatusInspectInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "fda51a2281cef33cb6349bc4a152d327", "score": "0.72591066", "text": "func (o *QuerySessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewQuerySessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewQuerySessionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewQuerySessionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /sessionbrowser/namespaces/{namespace}/gamesession returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "title": "" }, { "docid": "e90b0507dd4bd1ab74421339cd59c1c3", "score": "0.7255413", "text": "func (o *GetLiveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetLiveOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 503:\n\t\tresult := NewGetLiveServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewGetLiveDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "f6dfb28f092cb48ebd1c2b8d5aa18d38", "score": "0.72539866", "text": "func (o *PostHyperflexServerModelsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostHyperflexServerModelsMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostHyperflexServerModelsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "a3b994c314c8a6c14603594da8f6747e", "score": "0.7246016", "text": "func execReadResponse(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret, ret1 := http.ReadResponse(args[0].(*bufio.Reader), args[1].(*http.Request))\n\tp.Ret(2, ret, ret1)\n}", "title": "" }, { "docid": "6345529e179d3d2be8528ddfcff9e97d", "score": "0.72330344", "text": "func (o *GetSipgateIoLogsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetSipgateIoLogsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewGetSipgateIoLogsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9b87f0126a48238d1eac628cc44b619a", "score": "0.7228322", "text": "func (o *ListAllTerminatedServersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewListAllTerminatedServersOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewListAllTerminatedServersBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewListAllTerminatedServersUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewListAllTerminatedServersInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /dslogmanager/servers/search returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "title": "" }, { "docid": "cd1a24c2677cfd0027e94ed93915e61e", "score": "0.7226845", "text": "func (o *FrontServeBinaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewFrontServeBinaryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewFrontServeBinaryUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewFrontServeBinaryForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewFrontServeBinaryNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewFrontServeBinaryInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "dbea3e683c1a52e7a2ffe0fcdc51b0ee", "score": "0.72251654", "text": "func (o *DeleteLolPremadeVoiceV1SessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteLolPremadeVoiceV1SessionNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b2da70ad728c072fadaa0fd588f29157", "score": "0.72247726", "text": "func (o *UpdateHTTPCheckReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUpdateHTTPCheckOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "02a23b6a7a8e5734dcd7ee672494e9de", "score": "0.72190636", "text": "func (o *GetUsageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetUsageOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewGetUsageForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7f35b30e2033cc1618bae1ca55067105", "score": "0.72069466", "text": "func (o *CreateChargebackReversalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201, 200:\n\t\tresult := NewCreateChargebackReversalCreated()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "085a74d706f677d79eb7c321e5a01663", "score": "0.72050357", "text": "func (o *GetAboutUserMsgVpnReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetAboutUserMsgVpnOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewGetAboutUserMsgVpnDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "a2a16b1c700c9128bf2299e1662c8b7a", "score": "0.72048676", "text": "func (o *GetEventEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetEventEndpointOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewGetEventEndpointUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetEventEndpointNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 410:\n\t\tresult := NewGetEventEndpointGone()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f76392756d68cf91de47f1e6abd9dd28", "score": "0.72010535", "text": "func (o *GetPacketCaptureLiveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetPacketCaptureLiveOK(o.writer)\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "a11a0cd0a249771b664df7b63baacb9e", "score": "0.71965754", "text": "func (o *GetThingsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetThingsIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewGetThingsIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetThingsIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7a39288fa5b31792f5f27ce77fb71e0b", "score": "0.71959174", "text": "func (o *GetEventLoopReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetEventLoopOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetEventLoopBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetEventLoopNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewGetEventLoopConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetEventLoopInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "ea569ab1013936546566f6113cb9dc48", "score": "0.7194165", "text": "func (o *PostNodesIdentifierObmReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201:\n\t\tresult := NewPostNodesIdentifierObmCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewPostNodesIdentifierObmNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewPostNodesIdentifierObmDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "fa87b73b3f71b0e6431f610b8f52eba7", "score": "0.7187648", "text": "func (o *DeleteHyperflexServerModelsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteHyperflexServerModelsMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDeleteHyperflexServerModelsMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteHyperflexServerModelsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "f6c0c2d8e8dec081ce638ac5c3efeacb", "score": "0.718702", "text": "func (o *IDOfHelloEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewIDOfHelloEndpointOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e9eaba51544a730ffb40baafeda46cc2", "score": "0.7186965", "text": "func (o *PublicGetSlotDataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPublicGetSlotDataOK(o.writer)\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewPublicGetSlotDataNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /public/namespaces/{namespace}/users/{userId}/slots/{slotId} returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "title": "" }, { "docid": "76489ef81d30da51314284ff1c6e28c5", "score": "0.71866065", "text": "func (o *GetTwilioReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetTwilioOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewGetTwilioBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewGetTwilioUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 403:\n\t\tresult := NewGetTwilioForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "27ef761354baea26e417ce7431a00a70", "score": "0.7180265", "text": "func (o *ReplaceMsgVpnReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewReplaceMsgVpnOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewReplaceMsgVpnDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "bce2210f52ac9737d8f04e05fcacbef8", "score": "0.7178924", "text": "func (o *VoidPaymentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewVoidPaymentNoContent()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "c69c349b1843287a0392a81b13711b91", "score": "0.71749794", "text": "func (o *DoResetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 202:\n\t\tresult := NewDoResetAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewDoResetBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewDoResetUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 403:\n\t\tresult := NewDoResetForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewDoResetNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewDoResetInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b189dd21d0b048dbd73e7f0554488465", "score": "0.7173612", "text": "func (o *LslReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewLslOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewLslNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewLslInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "20f629fec2f7b7697df02b53e4105825", "score": "0.7160084", "text": "func (o *GetDeploysConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetDeploysConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetDeploysConnectionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7c1b0aaab24a4cc22503b10379da49e4", "score": "0.7155413", "text": "func (o *AcceptLogoutRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewAcceptLogoutRequestOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewAcceptLogoutRequestNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewAcceptLogoutRequestInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "c3290d8345099a62a89a8535bfcf76fe", "score": "0.7149583", "text": "func (o *HelloPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHelloPostOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewHelloPostBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewHelloPostNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 405:\n\t\tresult := NewHelloPostMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewHelloPostInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "66d1e74ddd9bb40fba56a627e2083a16", "score": "0.7148648", "text": "func (o *ProcessStatsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewProcessStatsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "d200c6949e9cfa262b6f4510a650a0a1", "score": "0.71452874", "text": "func (o *HandleSubtaskReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewHandleSubtaskOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "42ba2480888afa02051fd852694762e7", "score": "0.7144434", "text": "func (r *Response) Read() ([]byte, error) {\n\tvar b []byte\n\tif r.Response == nil {\n\t\treturn nil, errors.New(\"no response exists on interface\")\n\t}\n\n\tif r.Response.Body != nil {\n\t\tb, _ = ioutil.ReadAll(r.Response.Body)\n\t}\n\n\tr.Response.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\n\treturn b, nil\n}", "title": "" }, { "docid": "c22371068f19dbda3a0e3920b308a5f7", "score": "0.71432877", "text": "func (o *GetRiotMessagingServiceV1MessageByAByBByCByDByEByFReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetRiotMessagingServiceV1MessageByAByBByCByDByEByFOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "11cf490f1ebd7ccf7f67257e4e5c5726", "score": "0.7141329", "text": "func (o *RestartMachineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 202:\n\t\tresult := NewRestartMachineAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewRestartMachineForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewRestartMachineNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "a302437abb62459036703a60df9c3175", "score": "0.7140382", "text": "func (r *Redis) ReadResponse() (interface{}, error) {\n\treader := bufio.NewReader(r.conn)\n\treturn readResponse(reader)\n}", "title": "" }, { "docid": "bc9b47b48224047302e5a98246ae4ae7", "score": "0.7137773", "text": "func (o *UploadDriverBinaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewUploadDriverBinaryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewUploadDriverBinaryBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewUploadDriverBinaryNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "cffeb1bbdb697b5723951cc06559847a", "score": "0.7137641", "text": "func (c *SocketConnection) ReadResponse() (*http.Response, error) {\n\t// should add a timeout to readResponse\n\trespCh := make(chan *http.Response)\n\tdefer close(respCh)\n\tvar err error\n\tvar resp *http.Response\n\tgo func() {\n\t\tif resp, err = http.ReadResponse(bufio.NewReader(newResponseReader(c)), nil); err == nil {\n\t\t\trespCh <- resp\n\t\t\treturn\n\t\t}\n\t\tc.log.Printf(\"read response: %v\", err)\n\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\tc.handleFailure()\n\t\t}\n\t}()\n\tselect {\n\tcase <-time.After(readResponseTimeout):\n\t\treturn nil, errors.New(\"time out\")\n\tcase r := <-respCh:\n\t\treturn r, nil\n\t}\n}", "title": "" }, { "docid": "a5713e1f894f00efe4e2501eeefbe636", "score": "0.7133787", "text": "func (o *AllLooksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewAllLooksOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewAllLooksBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewAllLooksNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "da8647c0a9292c7207baa09d73f1a52b", "score": "0.7132881", "text": "func (o *GetEventChannelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetEventChannelOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewGetEventChannelDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "91f01e0cbfa59f42c9aca7109dfed746", "score": "0.7132635", "text": "func (o *GetLolPreEndOfGameV1CurrentSequenceEventReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetLolPreEndOfGameV1CurrentSequenceEventOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "802c1a4d06ce56c462b566ed6a412950", "score": "0.71309906", "text": "func (o *RemoveReceiverReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewRemoveReceiverOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewRemoveReceiverBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewRemoveReceiverNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "140c78bd57a6b55114c16649c0a7509a", "score": "0.712291", "text": "func (o *PostAuthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostAuthOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewPostAuthForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9c11164512d241b56238c35df6ed4858", "score": "0.7120989", "text": "func (o *DeleteLdapServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteLdapServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewDeleteLdapServerUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewDeleteLdapServerForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewDeleteLdapServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "97af1fed3fca00e060d51d6c8c0498b4", "score": "0.7120884", "text": "func (o *DeregisterLocalServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeregisterLocalServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewDeregisterLocalServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewDeregisterLocalServerUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewDeregisterLocalServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested POST /dsmcontroller/namespaces/{namespace}/servers/local/deregister returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "title": "" }, { "docid": "940aab80ab6d415f3054c28a98dacf52", "score": "0.7118977", "text": "func (o *ChangeaspecificReminderReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewChangeaspecificReminderNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "0bf281340405975bf36e6232c61dda33", "score": "0.7117865", "text": "func (o *GetLogoutRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetLogoutRequestOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetLogoutRequestNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetLogoutRequestInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "ec11b2049ca878fdb10b3de7b54561f8", "score": "0.71150196", "text": "func (o *ActionQueryV1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewActionQueryV1OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewActionQueryV1Forbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewActionQueryV1TooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"[GET /iocs/queries/actions/v1] action.query.v1\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9b763c8fd4e0c460a48178c43b35ef9f", "score": "0.7107395", "text": "func (o *SpaceChildrenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSpaceChildrenOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewSpaceChildrenBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewSpaceChildrenNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7c998fed3c1f15f1ffdafc9b8a418778", "score": "0.710621", "text": "func (o *BookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewBookOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewBookNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "babd2b2192c7a1e016b46d2aa2157cc0", "score": "0.71045536", "text": "func (o *ListUsingGETReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewListUsingGETOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewListUsingGETForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "5836e1492262e53885216a41937500da", "score": "0.7101822", "text": "func (o *GetSocks5ServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetSocks5ServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetSocks5ServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetSocks5ServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewGetSocks5ServerConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetSocks5ServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1a9df51cca3d635b5575ef8c858a49a0", "score": "0.70998144", "text": "func (o *UpdateSocks5ServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewUpdateSocks5ServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUpdateSocks5ServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewUpdateSocks5ServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewUpdateSocks5ServerConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUpdateSocks5ServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "5b86b818c78ab73527be45e5da4ce910", "score": "0.70936453", "text": "func (o *GetLinkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetLinkOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetLinkNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9f26e3c1ac897e5a4e1709e362c57238", "score": "0.7091478", "text": "func (o *PostDiscoveryConnectUbntReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPostDiscoveryConnectUbntOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPostDiscoveryConnectUbntBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewPostDiscoveryConnectUbntUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewPostDiscoveryConnectUbntInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b5c42e8d02d91e4e1d55fd4d4878f756", "score": "0.7090326", "text": "func (o *StorageServiceDrainPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewStorageServiceDrainPostOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewStorageServiceDrainPostDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "7ba871920867aaf9bb5c8fb3e7bfe7b7", "score": "0.7087895", "text": "func (o *DeleteStreamReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteStreamNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewDeleteStreamUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewDeleteStreamNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "563d371d6df6af65b3726924eb897db0", "score": "0.70876366", "text": "func (o *RepoTrackedTimesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewRepoTrackedTimesOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1f85b8bf263deb916c2806d97edb220c", "score": "0.7085051", "text": "func (o *TermsAbsoluteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewTermsAbsoluteOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewTermsAbsoluteBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "d4edf6c2b2d29e6e2c7ece29e5ef21fd", "score": "0.70845276", "text": "func (o *GetLolLoginV1SessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetLolLoginV1SessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "8ce384fafff377d2596860a91cacb9ca", "score": "0.7084218", "text": "func (o *FpolicyEventModifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewFpolicyEventModifyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewFpolicyEventModifyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "a8b8f74973cd08b81b658366c26e584b", "score": "0.7084188", "text": "func (o *UploadFileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewUploadFileOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "c063e9b56fc5734744a6ee7c7454e6a2", "score": "0.70832205", "text": "func (o *GetInvoiceTranslationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetInvoiceTranslationOK()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "3e5bde3fd15252e7e3740c0a18598f0a", "score": "0.7081362", "text": "func (o *RegisterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRegisterOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewRegisterInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "c2aafd8d4efd69e11ea814c21db89c32", "score": "0.7080822", "text": "func (o *SendTestTemplateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewSendTestTemplateNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSendTestTemplateBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewSendTestTemplateNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b64ee3e983df2ee49e1bf199e2e4f413", "score": "0.7078587", "text": "func (o *GetNoteDetailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetNoteDetailsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewGetNoteDetailsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 403:\n\t\tresult := NewGetNoteDetailsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetNoteDetailsInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "dc99fb5921b908a9eea7a543fe621148", "score": "0.7077617", "text": "func (o *PostLolHonorV2V1LateRecognitionAckReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostLolHonorV2V1LateRecognitionAckNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7ad3ff93e20d9edfaf1526b7384ae73b", "score": "0.70766944", "text": "func (o *PutPlayerRecordHandlerV1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPutPlayerRecordHandlerV1OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewPutPlayerRecordHandlerV1InternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPutPlayerRecordHandlerV1Default(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn result, nil\n\t}\n}", "title": "" }, { "docid": "2eaa72358a821011128a80011cfa0dac", "score": "0.7074609", "text": "func (o *PostChannelSettleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostChannelSettleOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewPostChannelSettleBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f76b9135a3b33ebae3d77574eadce8d8", "score": "0.70742035", "text": "func (o *DeleteConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 204:\n\t\tresult := NewDeleteConnectionNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewDeleteConnectionForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewDeleteConnectionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteConnectionDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "376216937f24209deb815508528aff16", "score": "0.70722127", "text": "func (o *GetCurrentDRUIDSReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetCurrentDRUIDSOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewGetCurrentDRUIDSInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "fcd2cb1f641dc729669a96cf95847d1a", "score": "0.70719516", "text": "func (o *GetIOCReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetIOCOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewGetIOCForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewGetIOCTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewGetIOCDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "af4ff7d2b44863f197e0da481a90a355", "score": "0.7071068", "text": "func (o *PerformLookupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPerformLookupOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f382576f4aaba2a0f5a2fbb50fadc6b4", "score": "0.70704216", "text": "func (o *TRAAPIODFareStation2146Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTRAAPIODFareStation2146OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewTRAAPIODFareStation2146Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewTRAAPIODFareStation2146NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b215189109e6575eaf4805ca29bbb2ee", "score": "0.7069622", "text": "func (o *FindConfigRPCServerTypeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewFindConfigRPCServerTypeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewFindConfigRPCServerTypeDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "e686b91712d2d92bfa0f6be4bf96a372", "score": "0.7069605", "text": "func (o *GetElfImagesConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetElfImagesConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetElfImagesConnectionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetElfImagesConnectionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetElfImagesConnectionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "acf0011f5a0e073dd4c3497e97a4a66e", "score": "0.7066771", "text": "func (o *SaveKeypairReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewSaveKeypairNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSaveKeypairBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewSaveKeypairUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewSaveKeypairInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "27c2235189cfd47f15bc6b2343300b29", "score": "0.7063862", "text": "func (o *CopyRecipeExactlyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCopyRecipeExactlyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewCopyRecipeExactlyBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" } ]
bcd030086f98ca8a3ca71d62da6ce1e8
Set saves the value for the given keys
[ { "docid": "49f1614094c82666d9bb1f49450dd2dd", "score": "0.0", "text": "func (n NestedServiceMapping) Set(key1, key2 string, value *Service) {\n\tif n[key1] == nil {\n\t\tn[key1] = map[string]*Service{}\n\t}\n\tn[key1][key2] = value\n}", "title": "" } ]
[ { "docid": "bf6cbdf63a174fbb3aa6120d17aeaa7d", "score": "0.7215912", "text": "func (m *Manager) Set(val string, keys ...*Key) error {\n\tm.prepare()\n\treturn m.c.Set(val, keys...)\n}", "title": "" }, { "docid": "a90a1b97a68ecfb8bbce6750eeca1874", "score": "0.70222396", "text": "func SetValue(client *ircutil.Client, keys []string, value string) error {\n\t// Error if number of key parameters is wrong.\n\tif len(keys) != 4 {\n\t\treturn errors.New(\"setting data: invalid number of key parameters\")\n\t}\n\n\t// Set individual key parameters.\n\tclientPrefix, scope, owner, group, key := ircutil.GetClientPrefix(client),\n\t\tkeys[0], keys[1], keys[2], keys[3]\n\n\t// Error if scope is invalid.\n\tif scope != \"user\" && scope != \"channel\" && scope != \"client\" {\n\t\treturn errors.New(\"setting data: invalid scope\")\n\t}\n\n\t// Set value and write data file.\n\tbuildMap(client, keys)\n\tclient.Data[clientPrefix][scope][owner][group][key] = value\n\treturn writeData(client)\n}", "title": "" }, { "docid": "cd48abd3db4eba4fd36a4b84443554a9", "score": "0.66588056", "text": "func (c *Config) Set(keys []string, value string) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tm := c.entries\n\tfor i := 0; i < len(keys)-1; i++ {\n\t\tkey := keys[i]\n\t\tentry, err := m.FindEntry(key)\n\t\tif err != nil {\n\t\t\tentry = yamlmap.MapValue()\n\t\t\tm.AddEntry(key, entry)\n\t\t}\n\t\tm = entry\n\t}\n\tm.SetEntry(keys[len(keys)-1], yamlmap.StringValue(value))\n}", "title": "" }, { "docid": "0724721678ddd8a3b16a95533f564a3c", "score": "0.65086496", "text": "func (s *storage[K, V]) Set(key K, value V) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\ts.md[key] = data[V]{\n\t\tdata: value,\n\t\tcreAt: time.Now().UTC(),\n\t\texpAt: time.Now().UTC().Add(s.defaultTTL),\n\t}\n}", "title": "" }, { "docid": "122dc14bf3b48b6fb48d70f1b76e233a", "score": "0.6373963", "text": "func Set(key, val interface{}) {\n\tGetAll()[key] = val\n}", "title": "" }, { "docid": "88ccaa12ce16ac755d0d5a449a1f2294", "score": "0.6364821", "text": "func (md Metadata) Set(k string, vals ...string) {\n\tif len(vals) == 0 {\n\t\treturn\n\t}\n\tk = strings.ToLower(k)\n\tmd[k] = vals\n}", "title": "" }, { "docid": "6b0044113b7cec7a8208376685693ad7", "score": "0.6362025", "text": "func (r *Rds) Set(key, value interface{}, args ...interface{}) (reply interface{}, err error) {\n\targs2 := mergeKeyAndArgs(value, args...)\n\tnargs := mergeKeyAndArgs(key, args2...)\n\treturn r.Do(\"SET\", nargs...)\n}", "title": "" }, { "docid": "5588b001235474bb5f9be0ff64514fa4", "score": "0.63617474", "text": "func (vs *Values) Set(key, value string) {\n\tvs.data[key] = []string{value}\n}", "title": "" }, { "docid": "258a48a8d7fcee9f4fbe8ab1ee8c6cfb", "score": "0.6340699", "text": "func (ob *SuObject) set(key, val Value) {\n\tif ob.concurrent {\n\t\tkey.SetConcurrent()\n\t\tval.SetConcurrent()\n\t}\n\tdefer ob.endMutate(ob.startMutate())\n\tif i, ok := key.IfInt(); ok {\n\t\tif i == len(ob.list) {\n\t\t\tob.add(val)\n\t\t\treturn\n\t\t} else if 0 <= i && i < len(ob.list) {\n\t\t\tob.list[i] = val\n\t\t\treturn\n\t\t}\n\t}\n\tob.named.Put(key, val)\n}", "title": "" }, { "docid": "4be9fbe6b2e6cadb957111d72e11e257", "score": "0.6331909", "text": "func (v Values) Set(key, value string) {\n\tv[key] = []string{value}\n}", "title": "" }, { "docid": "2b5ed7f6e135bb3f8fa8293b348d9e1a", "score": "0.6327727", "text": "func (m MD) Set(key string, values ...string) {\n\tkey = strings.ToLower(key)\n\tif len(values) == 0 {\n\t\tdelete(m, key)\n\t\treturn\n\t}\n\tm[key] = values\n}", "title": "" }, { "docid": "c650b679f6245ad4b98e15a3a8157b68", "score": "0.6285219", "text": "func (b XattrsBackend) Set(ctx context.Context, path string, key string, val []byte) (err error) {\n\treturn b.SetMultiple(ctx, path, map[string][]byte{key: val}, true)\n}", "title": "" }, { "docid": "64d7ada58acb3e8c1b571bee31c9eda5", "score": "0.62403625", "text": "func Set(key string, value interface{}) {\n\tgid := goid.Goid()\n\tdataLock.RLock()\n\tvalues := data[gid]\n\tdataLock.RUnlock()\n\tif values == nil {\n\t\tdataLock.Lock()\n\t\tvalues = data[gid]\n\t\tif values == nil {\n\t\t\tdata[gid] = Values{}\n\t\t\tvalues = data[gid]\n\t\t}\n\t\tdataLock.Unlock()\n\t}\n\tvalues[key] = value\n}", "title": "" }, { "docid": "790380a08653fc91f8035aae35e0480b", "score": "0.6227404", "text": "func (s *Store) Set(db uint32, args [][]byte) error {\n\tif len(args) < 2 {\n\t\treturn errArguments(\"len(args) = %d, expect >= 2\", len(args))\n\t}\n\n\tkey := args[0]\n\tvalue := args[1]\n\n\texpireat := int64(0)\n\tflag := uint8(0)\n\n\tfor i := 2; i < len(args); {\n\t\tswitch strings.ToUpper(string(args[i])) {\n\t\tcase \"EX\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn errArguments(\"invalid set argument for EX\")\n\t\t\t}\n\t\t\tttls, err := ParseInt(args[i+1])\n\t\t\tif err != nil {\n\t\t\t\treturn errArguments(\"parse EX arg failed %v\", err)\n\t\t\t}\n\n\t\t\tif v, ok := TTLsToExpireAt(ttls); ok && v > 0 {\n\t\t\t\texpireat = v\n\t\t\t} else {\n\t\t\t\treturn errArguments(\"invalid EX seconds = %d\", ttls)\n\t\t\t}\n\t\t\ti += 2\n\t\tcase \"PX\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn errArguments(\"invalid set argument for PX\")\n\t\t\t}\n\t\t\tttlms, err := ParseInt(args[i+1])\n\t\t\tif err != nil {\n\t\t\t\treturn errArguments(\"parse PX arg failed %v\", err)\n\t\t\t}\n\t\t\tif v, ok := TTLmsToExpireAt(ttlms); ok && v > 0 {\n\t\t\t\texpireat = v\n\t\t\t} else {\n\t\t\t\treturn errArguments(\"invalid PX milliseconds = %d\", ttlms)\n\t\t\t}\n\t\t\ti += 2\n\t\tcase \"NX\":\n\t\t\tflag |= setNXFlag\n\t\t\ti++\n\t\tcase \"XX\":\n\t\t\tflag |= setXXFlag\n\t\t\ti++\n\t\tdefault:\n\t\t\treturn errArguments(\"invalid set argument at %d\", i)\n\t\t}\n\t}\n\n\tif err := s.acquire(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tdefer s.release()\n\n\tbt := engine.NewBatch()\n\n\tif o, err := loadStoreRow(s, db, key); err != nil {\n\t\treturn errors.Trace(err)\n\t} else {\n\t\t// handle NX and XX flag\n\t\t// NX: key is nil or expired\n\t\t// XX: key is not nil and not expired\n\t\t// otherwise, abort\n\t\tif (flag&setNXFlag > 0) && (o != nil && !o.IsExpired()) {\n\t\t\treturn ErrSetAborted\n\t\t} else if (flag&setXXFlag > 0) && (o == nil || o.IsExpired()) {\n\t\t\treturn ErrSetAborted\n\t\t}\n\n\t\t// if we are string type, we will overwrite it directly\n\t\t// if not, we may delete it first\n\t\tif o != nil && o.Code() != StringCode {\n\t\t\tif err := o.deleteObject(s, bt); err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t}\n\t}\n\n\tno := newStringRow(db, key)\n\tno.Value = value\n\tno.ExpireAt = expireat\n\tbt.Set(no.DataKey(), no.DataValue())\n\tbt.Set(no.MetaKey(), no.MetaValue())\n\n\tfw := &Forward{DB: db, Op: \"Set\", Args: args}\n\treturn s.commit(bt, fw)\n}", "title": "" }, { "docid": "2eea58ef87d36d7e05866a846743b6d8", "score": "0.6183091", "text": "func (token OpenToken) Set(key, value string) {\n\ttoken[key] = []string{value}\n}", "title": "" }, { "docid": "71676e496ca11633f67e26298b7c6618", "score": "0.6133752", "text": "func (multiCall MultiCall) Set(key string, value interface{}) error {\n\treturn multiCall.Send(\"SET\", key, value)\n}", "title": "" }, { "docid": "6822c9cba6ab9b3aeff954b785ee7fab", "score": "0.61327016", "text": "func (rc *CacherClient) Set(key string, val ...interface{}) error {\n\tif len(val) <= 0 {\n\t\treturn errors.New(\"CacherClient.Set func val param at least have one piece\")\n\t}\n\tvar err error\n\t// 序列化value值\n\tval[0], err = rc.encode(val[0])\n\tif err != nil {\n\t\treturn nil\n\t}\n\tparam := rc.paramMerge(rc.getKey(key), val...)\n\t_, err = rc.Do(\"SET\", param...)\n\treturn err\n}", "title": "" }, { "docid": "a1b43a1223e8eb23af3a02c29c4c9b26", "score": "0.6090594", "text": "func (data dataStore) set(key, value string) {\n\tdata[key] = value\n}", "title": "" }, { "docid": "8270b30d4c0edb86d3129c537476abf0", "score": "0.609018", "text": "func (ps *PostgresStore) Set(key string, value interface{}) error {\n\tj, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not serialize value\")\n\t}\n\n\t_, err = ps.db.Exec(\n\t\tfmt.Sprintf(\n\t\t\t`INSERT INTO %s (key, value) VALUES ($1, $2)\n\t\t\tON CONFLICT (key)\n\t\t\tDO UPDATE SET key = $1, value = $2, updated_at = now()`,\n\t\t\tps.tableName,\n\t\t),\n\t\tkey,\n\t\tstring(j),\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to insert value into postgres store\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b2113c326a526798ab608879f3d73419", "score": "0.60870004", "text": "func (m MD) Set(key string, value string) MD {\n\tk, v := encodeKeyValue(key, value)\n\tm[k] = []string{v}\n\treturn m\n}", "title": "" }, { "docid": "2fa5311ea743677e8165604b5454f547", "score": "0.60867774", "text": "func (v Values) Set(key, value string) Values {\n\tv[key] = []string{value}\n\treturn v\n}", "title": "" }, { "docid": "29c31d80d947f57b71e46679bd3aada8", "score": "0.6060582", "text": "func SetValues(values Values) {\n\tgid := goid.Goid()\n\tdataLock.Lock()\n\tdata[gid] = values\n\tdataLock.Unlock()\n}", "title": "" }, { "docid": "7193138785939654cb19bf281942fd08", "score": "0.6055568", "text": "func (g *gache) set(key string, val interface{}, expire time.Duration) {\n\tvar exp int64\n\tif expire > 0 {\n\t\texp = fastime.Now().Add(expire).UnixNano()\n\t}\n\tg.getShard(key).Store(key, &value{\n\t\texpire: exp,\n\t\tval: &val,\n\t})\n}", "title": "" }, { "docid": "a8fc54f0b9def0cea8a99f281d565413", "score": "0.60553086", "text": "func (cs *configMapKVStore) Set(ctx context.Context, key string, value interface{}) error {\n\tbytes, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to Marshal: %w\", err)\n\t}\n\tif cs.data == nil {\n\t\tcs.data = map[string]string{}\n\t}\n\tcs.data[key] = string(bytes)\n\treturn nil\n}", "title": "" }, { "docid": "9d3e58b234825c5cc643f5fc5fa496fd", "score": "0.6046415", "text": "func (g *game) setKeys(keys []int) {\n\tg.keys = keys\n\tif g.cl != nil {\n\t\tg.cl.updateKeys(g.keys)\n\t}\n}", "title": "" }, { "docid": "c53826da7722ad53a136d1f0eba260dd", "score": "0.60296965", "text": "func (s *CrdtSet) set(values [][]byte) {\n\tfor _, v := range values {\n\t\ts.Values = append(s.Values, string(v))\n\t}\n}", "title": "" }, { "docid": "56381d51e4c1caffb237ccdd5d902eaa", "score": "0.6017747", "text": "func (c *BoltDB) SetMulti(values map[string]any, ttl time.Duration) (err error) {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "8f212d7d0f4588c25749bb6273e21826", "score": "0.6004705", "text": "func (h *consulHandler) Set(key string, value interface{}, args ...interface{}) error {\n\tif len(args) != 0 {\n\t\treturn cfg.ErrArgsNotSupported\n\t}\n\n\tasBytes, err := toBytes(value)\n\tif err != nil {\n\t\treturn cfg.ErrBadType\n\t}\n\n\tkv := &consul.KVPair{\n\t\tKey: key,\n\t\tValue: asBytes,\n\t}\n\n\tif _, err := h.client.KV().Put(kv, nil); err != nil {\n\t\treturn cfg.ErrKeyNotSet\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abe68f11eaafb6714e7c0cb6f145cd96", "score": "0.5977753", "text": "func setKeys(keys []string, bitTracker uint8) uint8 {\n\tfor _, key := range keys {\n\t\tswitch key {\n\t\tcase \"byr\":\n\t\t\tbitTracker = bitTracker + (1 << 0)\n\t\tcase \"iyr\":\n\t\t\tbitTracker = bitTracker + (1 << 1)\n\t\tcase \"eyr\":\n\t\t\tbitTracker = bitTracker + (1 << 2)\n\t\tcase \"hgt\":\n\t\t\tbitTracker = bitTracker + (1 << 3)\n\t\tcase \"hcl\":\n\t\t\tbitTracker = bitTracker + (1 << 4)\n\t\tcase \"ecl\":\n\t\t\tbitTracker = bitTracker + (1 << 5)\n\t\tcase \"pid\":\n\t\t\tbitTracker = bitTracker + (1 << 6)\n\t\tcase \"default\":\n\t\t\tcontinue\n\t\t}\n\t\t// fmt.Println(strconv.FormatInt(int64(bitTracker), 2))\n\t}\n\treturn bitTracker\n}", "title": "" }, { "docid": "1fca641c4e938baa7461d80ccc4199eb", "score": "0.59579414", "text": "func Set(key string, value string, expire time.Duration, serverAddr string) error {\n\targs := StoreArgs{\n\t\tCommand: SET,\n\t\tKey: key,\n\t\tValue: value,\n\t\tExpire: expire,\n\t}\n\treply := StoreReply{}\n\tcall(\"Coordinator.SetVal\", &args, &reply, serverAddr)\n\tif reply.Reply == SUCCESS {\n\t\treturn nil\n\t}\n\treturn errors.New(\"set fail\")\n}", "title": "" }, { "docid": "c553c169f3a09e32a0ce3d94af076b32", "score": "0.5945424", "text": "func (it *chainIter) set(meta metaData, key Value, val Value) {\n\tit.b.meta[it.ib] = meta\n\tit.b.key[it.ib] = key\n\tit.b.val[it.ib] = val\n}", "title": "" }, { "docid": "89b63b98043d7d6767a47da1d9b2ffd3", "score": "0.59447753", "text": "func (c *Client) Set(key string, value map[string]interface{}) error {\n\tvar (\n\t\tpath = c.getGetPath(key)\n\t\tval map[string]interface{}\n\t)\n\n\tif c.kvVersion == 2 {\n\t\tval = map[string]interface{}{\"data\": value}\n\t} else {\n\t\tval = value\n\t}\n\n\tvlt := c.Client.Logical()\n\t_, err := vlt.Write(path, val)\n\treturn err\n}", "title": "" }, { "docid": "49b9fdfed0edc1720f99bf39bbd231e0", "score": "0.5935901", "text": "func (m *GroupPolicyPresentationValueMultiText) SetValues(value []string)() {\n err := m.GetBackingStore().Set(\"values\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4d63e286c658eb1367777e31bfb3b463", "score": "0.5928357", "text": "func (t T) Set(x interface{}, ps ...string) error {\n\tp := t.Path(ps...)\n\terr := mkdir(path.Dir(p))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb, err := json.MarshalIndent(x, \"\", \" \")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(p, b, 0644)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "59fcd7a92b041bbdda233dcb8b979429", "score": "0.5918062", "text": "func (p *Pack) set(key cipher.SHA256, val []byte) {\n\tp.unsaved[key] = val\n}", "title": "" }, { "docid": "7bf626e713145ba4faaa340db1fd6212", "score": "0.5916428", "text": "func (engine *RaftEngine) setData(key string, value []byte) error {\n\tif err := engine.checkState(); err != nil {\n\t\treturn err\n\t}\n\tc := &operation{\n\t\tOp: \"set\",\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tsc, _ := encodeOperation(c)\n\tif err := engine.executeCmd(\"store\", sc); err != nil {\n\t\tengine.logger.Printf(\"[error][RaftEngine.setData] executeCmd err:%s\", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ac8f9d4cdf9251ab5fa2ff413a1114be", "score": "0.59123", "text": "func Set(w io.Writer, svc *ssm.SSM, path string, exprs []string) error {\n\tif len(exprs) < 1 {\n\t\treturn ErrRequireNameAndValue\n\t}\n\n\tvar params []*ssm.Parameter\n\tvar names []*string\n\tfor _, expr := range exprs {\n\t\texprObj, err := parseExpression(expr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tparam, err := exprObj.parameter(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tparams = append(params, param)\n\t\tnames = append(names, param.Name)\n\t}\n\n\treturn updateParameters(svc, params, names, []*string{}, w)\n}", "title": "" }, { "docid": "35cae8aa5ef52b5e987f6df6b74a95d8", "score": "0.5902218", "text": "func (kvms *KVMapStore) Set(key Key, value Value) error {\n\tif len(key) == 0 {\n\t\treturn ErrKeyEmpty\n\t}\n\tkvms.store[string(key)] = value\n\treturn nil\n}", "title": "" }, { "docid": "b4a71eed94eee62d0a3f447c3b8ff487", "score": "0.58755124", "text": "func (fs *FileStore) Set(key, value interface{}) error {\n\tfs.lock.Lock()\n\tdefer fs.lock.Unlock()\n\tfs.value[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "b8ec4b7bf26b6158c919832000fb55bd", "score": "0.5875477", "text": "func (s *Server) Set(ctx context.Context, req *pb.SetRequest) (*pb.Result, error) {\n\tkv := []string{req.Key, req.Value}\n\tkv = util.TrimQuotes(kv)\n\ts.Store[kv[0]] = kv[1]\n\treturn &pb.Result{Result: \"OK\"}, nil\n}", "title": "" }, { "docid": "7cf303eba332154b86e3d51e8356c12a", "score": "0.58635896", "text": "func (s *Store) Set(key, value string) error {\n\tif s.Raft.State() != raft.Leader {\n\t\treturn fmt.Errorf(\"not leader\")\n\t}\n\n\tc := &command{\n\t\tOp: \"set\",\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf := s.Raft.Apply(b, raftTimeout)\n\treturn f.Error()\n}", "title": "" }, { "docid": "47420285bb5508f04b09f20a2a88026e", "score": "0.5859858", "text": "func (h *etcdHandler) Set(key string, value interface{}, args ...interface{}) error {\n\tif len(args) != 0 {\n\t\treturn cfg.ErrArgsNotSupported\n\t}\n\n\tsval, err := cfg.ToString(value)\n\tif err != nil {\n\t\treturn cfg.ErrBadType\n\t}\n\n\tif _, err := h.client.Set(key, sval, 0); err != nil {\n\t\treturn cfg.ErrKeyNotSet\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "37d21e074dd97cba093cc933b129401b", "score": "0.5853823", "text": "func (o *Orm) Set(k string, v ...interface{}) *Orm {\n\tif l := len(v); l == 0 {\n\t\to.update.sets = append(o.update.sets, k)\n\t} else {\n\t\to.update.sets = append(o.update.sets, fmt.Sprintf(\"%s = ?\", k))\n\t\to.update.setArgs = append(o.update.setArgs, v[0])\n\t}\n\treturn o\n}", "title": "" }, { "docid": "ec6cacea762d01a67135e24de9d637eb", "score": "0.585316", "text": "func (sm sharedMapChannel) Set(k int64, v interface{}) {\n\tsm.c <- command{action: set, key: k, value: v}\n}", "title": "" }, { "docid": "99ba70f2b030828402d105740a557656", "score": "0.5837951", "text": "func Set(key string, value string) error {\n\tvar path string\n\n\tpath, err := getPath(key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't retrieve key %s: %s\", key, err)\n\t}\n\n\treturn ioutil.WriteFile(path, []byte(value), 0000)\n}", "title": "" }, { "docid": "c1318b1b30ea197aa4477ba2a1449355", "score": "0.58229905", "text": "func Set(key string, value interface{}, args ...interface{}) error {\n\treturn std.Set(key, value, args...)\n}", "title": "" }, { "docid": "3394d7b68707efbc8b0e40b8dcc7b38e", "score": "0.58229166", "text": "func (settings *Settings) Set(key string, values SettingValues) {\n\tsettings.safe()\n\n\tsettings.valueMap[key] = values\n}", "title": "" }, { "docid": "d736312722cdc9c3a0da9ab74fde1e30", "score": "0.58111", "text": "func (edbs *LeveldbStorage) Set(_, key, value []byte) error {\n\tlog.Info(\"Set a key/value:\", string(key), string(value))\n\treturn edbs.DB.Put(key, value, nil)\n}", "title": "" }, { "docid": "7aa43bf4666748013fe1078703eccbc3", "score": "0.5808074", "text": "func Set(key string, value interface{}) {\n\tkvStore[key] = value\n}", "title": "" }, { "docid": "1bfaf78b03a7833200d1e2510943416f", "score": "0.58028907", "text": "func (s *InMemTranslateStore) set(id uint64, key string) {\n\ts.keys = append(s.keys, key)\n\ts.lookup[key] = id\n\ts.notifyWrite()\n}", "title": "" }, { "docid": "fc30ad41ed5da1c39b547d20fd40f692", "score": "0.5799472", "text": "func (p *PubKeys) Set(list string) error {\n\t*p = PubKeys{}\n\tfor _, s := range strings.Split(list, \",\") {\n\t\tvar pk PubKey\n\t\tif err := pk.Set(strings.TrimSpace(s)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*p = append(*p, pk)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fbbaac90b15be0186531538330e743f1", "score": "0.57976276", "text": "func (r *Service) Set(key string, value interface{}, secondsLifetime int64) error {\n\t// fmt.Printf(\"%#+v. %T. %s\\n\", value, value, value)\n\n\t// if vB, ok := value.([]byte); ok && secondsLifetime <= 0 {\n\t// \treturn r.pool.Do(radix.Cmd(nil, \"MSET\", r.Config.Prefix+key, string(vB)))\n\t// }\n\n\tvar cmd radix.CmdAction\n\t// if has expiration, then use the \"EX\" to delete the key automatically.\n\tif secondsLifetime > 0 {\n\t\tcmd = radix.FlatCmd(nil, \"SETEX\", r.Config.Prefix+key, secondsLifetime, value)\n\t} else {\n\t\tcmd = radix.FlatCmd(nil, \"SET\", r.Config.Prefix+key, value) // MSET same performance...\n\t}\n\n\treturn r.pool.Do(cmd)\n}", "title": "" }, { "docid": "fbdbd558cc9b5759e2081412bbd8d721", "score": "0.5791935", "text": "func (s *Store) Set(key string, value interface{}) error {\n\tif !s.ValidValue(value) {\n\t\treturn fmt.Errorf(\"type of value must being string, []string or map[string]string\")\n\t}\n\ts.Driver.Set(key, value)\n\treturn nil\n}", "title": "" }, { "docid": "afecc41a26afaaa22cbce4a2e3e8212a", "score": "0.57911384", "text": "func (s *Session) set(k string, v interface{}) {\n\ts.Lock()\n\tdefer s.Unlock()\n\ts.vals[k] = v\n}", "title": "" }, { "docid": "fcc7abb8dbf8d0720cc6caa9c5abec70", "score": "0.57862246", "text": "func (dsa Store) Set(key, value []byte) {\n\ttypes.AssertValidKey(key)\n\tif err := dsa.DB.Set(key, value); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "5f092d2f49801e0c26754ef0e8754ff1", "score": "0.5777526", "text": "func (ssm *strSliceMap) Set(key, value string) {\n\tssm.data[key] = []string{value}\n}", "title": "" }, { "docid": "64128ce291a8265c589a5f61d9e47f26", "score": "0.57705843", "text": "func (ht *hashTable) set(key, value string) {\n\tidx := ht._hash(key)\n\t*ht.keyMap[idx] = append(*ht.keyMap[idx], []string{key, value})\n}", "title": "" }, { "docid": "0063bd94f11d2dfb6ade5f9fa54be674", "score": "0.5761431", "text": "func (d *Data) Set(key string, value string) {\n\td.Values.Set(key, value)\n}", "title": "" }, { "docid": "d0418b72d8f04e46534a6fc71d0f2269", "score": "0.57570785", "text": "func (e *Environment) SetMultiple(values map[string]Object) *Environment {\n\tfor key, value := range values {\n\t\te.store[key] = value\n\t}\n\treturn e\n}", "title": "" }, { "docid": "a68dd43c496aa47994c85e9f74b935d1", "score": "0.5751847", "text": "func (mgr *ObjectManager) Set(key []byte, data []byte, referenceList []string) error {\n\tobj := db.NewObject(mgr.namespace, key, mgr.db)\n\tobj.SetData(data)\n\n\tif err := obj.SetReferenceList(referenceList); err != nil {\n\t\treturn err\n\t}\n\n\treturn obj.Save()\n}", "title": "" }, { "docid": "e7146656e8c169f0e3eb9f62a709c23a", "score": "0.5748783", "text": "func (s *Store) Set(key, value string) error {\n\tif s.raft.State() != raft.Leader {\n\t\treturn fmt.Errorf(\"not leader\")\n\t}\n\n\tc := &command{\n\t\tOp: \"set\",\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf := s.raft.Apply(b, raftTimeout)\n\treturn f.Error()\n}", "title": "" }, { "docid": "ced8e743947206dfb7f7d5df0c912349", "score": "0.5748236", "text": "func (o *Object) Set(key string, value *Value) {\n\tif o == nil {\n\t\treturn\n\t}\n\tif value == nil {\n\t\tvalue = valueNull\n\t}\n\to.unescapeKeys()\n\n\t// Try substituting already existing entry with the given key.\n\tfor i := range o.kvs {\n\t\tkv := &o.kvs[i]\n\t\tif kv.k == key {\n\t\t\tkv.v = value\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Add new entry.\n\tkv := o.getKV()\n\tkv.k = key\n\tkv.v = value\n}", "title": "" }, { "docid": "41a2e182c5628624d4a7d30c7a56fbda", "score": "0.5738737", "text": "func Set(c Connection, key string, data interface{}) error {\n\tbs, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.Do(\"SET\", key, bs)\n\treturn err\n}", "title": "" }, { "docid": "9d2b5f6f73889b79ebae454685abe8bd", "score": "0.5735213", "text": "func (c *Context) Set(key string, value interface{}) {\n\tm := strings.Split(key, \".\")\n\tif len(m) > 1 {\n\t\tc.setValue(key, value)\n\t} else {\n\t\tif c.Keys == nil {\n\t\t\tc.Keys = make(map[string]interface{})\n\t\t}\n\t\tc.Keys[key] = value\n\t}\n\n}", "title": "" }, { "docid": "93b3c5c8046af58e83ba227aa372526e", "score": "0.5726822", "text": "func (txn *TransactionStub) Set(k []byte, v []byte) error {\n\t_, err := txn.client.send(fmt.Sprintf(\"/txnkv/txn/%s/set\", txn.id), &TxnRequest{Key: k, Value: v})\n\treturn err\n}", "title": "" }, { "docid": "a763693b3d1a25480691792011dfb26f", "score": "0.5726219", "text": "func (c *fileStorageClient) Set(ctx context.Context, key string, value []byte) error {\n\treturn c.Batch(ctx, storage.SetOperation(key, value))\n}", "title": "" }, { "docid": "e1308ef97b99c807b2a55188c6497661", "score": "0.5718829", "text": "func (ms *MemoryStore) Set(key string, value interface{}) error {\n\tms.lock.Lock()\n\tdefer ms.lock.Unlock()\n\n\tj, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not serialize value\")\n\t}\n\n\tms.db[key] = storeValue{value: j, updatedAt: time.Now().Unix(), seenAt: 0}\n\treturn nil\n}", "title": "" }, { "docid": "9fe24d84621276c5d4791b9187343fa4", "score": "0.5716225", "text": "func (store *dbWrapper) Set(key, value string) error {\n\tdb := store.db\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t b, err := tx.CreateBucketIfNotExists([]byte(\"addresses\"))\n\t if err != nil { return err }\n\t // b := tx.Bucket([]byte(\"a\"))\n\t b.Put([]byte(key), []byte(value))\n\t // b.Put([]byte(\"susy\"), []byte(\"que\"))\n\t return nil\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "57ab22abc3e1127a695b136135628dba", "score": "0.57161325", "text": "func (s *Store) Set(key string, value interface{}) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.data[key] = value\n}", "title": "" }, { "docid": "247cf4b439f828db8def50a4a5b59151", "score": "0.5706643", "text": "func (s *Store) Set(key, value string) error {\n\tif s.raft.State() != raft.Leader {\n\t\treturn raft.ErrNotLeader\n\t}\n\n\tc := &command{\n\t\tOp: \"set\",\n\t\tKey: key,\n\t\tValue: value,\n\t}\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf := s.raft.Apply(b, raftTimeout)\n\treturn f.Error()\n}", "title": "" }, { "docid": "e4b5ec2c272587d41c86011ce3573b81", "score": "0.5704217", "text": "func (tree *BTree) Sets(data map[interface{}]interface{}) {\n\ttree.mu.Lock()\n\tdefer tree.mu.Unlock()\n\tfor k, v := range data {\n\t\ttree.doSet(k, v)\n\t}\n}", "title": "" }, { "docid": "eff0e2671f5bbd37102701da2a01fa40", "score": "0.57007486", "text": "func (k *List) Set(key string, value []byte) (string, []byte, error) {\n\tk.Lock()\n\tdefer k.Unlock()\n\tk.kvs[key] = value\n\treturn key, value, nil\n}", "title": "" }, { "docid": "e8cc3a526b4a5d29d14ff1bbf7b06558", "score": "0.5698729", "text": "func Set(s State, key, val interface{}) {\n\tmutex.Lock()\n\tif data[s] == nil {\n\t\tdatat[s] = time.Now().Unix()\n\t}\n\tdata[s] = val\n\tmutex.Unlock()\n}", "title": "" }, { "docid": "9fda566e5e9492319c6f2132e5d13a98", "score": "0.56904644", "text": "func (multiCall MultiCall) HMSet(key string, values map[string]interface{}) error {\n\treturn multiCall.Send(\"HMSET\", redis.Args{}.Add(key).AddFlat(values)...)\n}", "title": "" }, { "docid": "8962e1d26a33f39d192298a10a7b3dfe", "score": "0.568589", "text": "func (d dataDirectory) SetKeys(k *Keys) error {\n\treturn k.SaveToDirectory(d.keysDir())\n}", "title": "" }, { "docid": "b0c9a1da474dcf72644e0a00a6f1a518", "score": "0.5681444", "text": "func (multiCall MultiCall) MSet(values map[string]interface{}) error {\n\treturn multiCall.Send(\"MSET\", redis.Args{}.AddFlat(values)...)\n}", "title": "" }, { "docid": "1713cb36dd6c1609feab419881cf736a", "score": "0.5677011", "text": "func (t *InmemTemplateResource) setVars(extrakvs map[string]string) error {\n\tvar err error\n\tresult, err := t.storeClient.GetValues(appendPrefix(t.prefix, t.Keys))\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.store.Purge()\n\tfor k, v := range result {\n\t\tt.store.Set(filepath.Join(\"/\", strings.TrimPrefix(k, t.prefix)), v)\n\t}\n\tfor k, v := range extrakvs {\n\t\t// presume empty string of a extrakvs is meaningless,\n\t\t// use it to unset a key\n\t\tif v == \"\" {\n\t\t\tt.store.Del(k)\n\t\t}\n\t\tt.store.Set(k, v) // overwrite\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7a501287bfe78e7583d93464d8b5325", "score": "0.5670298", "text": "func (fc *Cache) Set(key *cache.Key, val []byte) error {\n\tstrURL := fmt.Sprintf(\"%s/%d/%d/%d\", fc.URL, key.Z, key.X, key.Y)\n\tresp, err := http.Post(strURL, \"binary/octet-stream\", bytes.NewReader(val))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\treturn nil\n}", "title": "" }, { "docid": "f7426380294283076628bfcfdc7e427a", "score": "0.56643796", "text": "func (p *Store) Set(key string, val string) {\n\tp.m[key] = val\n}", "title": "" }, { "docid": "13e0e3bae92ec72514b7b44065cdfd99", "score": "0.5661706", "text": "func (d Dict) Set(k string, v interface{}) {\n\td.chSet <- Pair{\n\t\tKey: k,\n\t\tValue: v,\n\t}\n}", "title": "" }, { "docid": "fbebce833c93c05070d3aa1b69e57e2a", "score": "0.5657213", "text": "func (o *Object) Set(key Key, value Noder) error {\n\tname := key.name\n\n\tif _, ok := o.keys[name]; ok {\n\t\treturn errors.Errorf(\"field %q already exists in the object\", name)\n\t}\n\n\to.keys[name] = key\n\to.fields[name] = value\n\to.keyList = append(o.keyList, name)\n\n\treturn nil\n\n}", "title": "" }, { "docid": "2153db6b580f068ee9e2f2740bf3c8ba", "score": "0.5655192", "text": "func (bucket mockDbBucket) Set(key []byte, value []byte) {\n\tbucket.values[string(key)] = value\n}", "title": "" }, { "docid": "1648f9b3e4e2a3342fb34c5fd91367e4", "score": "0.56515926", "text": "func (f *AirshipReader) Set(key, value string) {\n\t// TODO handle empty keys\n\tf.variables[key] = value\n}", "title": "" }, { "docid": "4829afa767efd8812a3c7a4bc83f45fc", "score": "0.56486267", "text": "func (i identifier) Set(val interface{}) UpdateExpression { return set(i, val) }", "title": "" }, { "docid": "ae7bab6e4e7ea4cded08df60380ff444", "score": "0.56476253", "text": "func Sets(m map[string]string) {\n\tfor k, v := range m {\n\t\tSet(k, v)\n\t}\n}", "title": "" }, { "docid": "459f02e810bff4b753a17556dee2c486", "score": "0.5645087", "text": "func (s *Storage) Set(key string, value interface{}) {\n\tif s.data == nil {\n\t\ts.data = make(map[string]interface{})\n\t}\n\n\ts.data[key] = value\n}", "title": "" }, { "docid": "117f3b90b27c0055af65dfb97cf8d9ce", "score": "0.56441116", "text": "func (s *shard) set(key, value []byte, d time.Duration) error {\n\tif len(key) > maxKeySize {\n\t\treturn errKeyTooLarge\n\t}\n\n\tvar buf bytes.Buffer\n\tenc := gob.NewEncoder(&buf)\n\tif err := enc.Encode(&entry{\n\t\tValue: value,\n\t\tTTL: time.Now().UTC().Add(d),\n\t}); err != nil {\n\t\treturn err\n\t}\n\terr := s.store.Set(string(key), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d79c7fcc9be6846d57062da61a322b3b", "score": "0.56440693", "text": "func (jq *JsonQuery) Set(newVal interface{}, s ...string) error {\n\tvar (\n\t\tval interface{}\n\t\terr error\n\t\tcurrent interface{} = jq.Blob\n\t\tprevQ string\n\t)\n\tval = jq.Blob\n\n\tfor _, q := range s {\n\t\tcurrent = val\n\t\tval, err = query(val, q)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprevQ = q\n\n\t}\n\n\tswitch current.(type) {\n\tcase nil:\n\t\treturn fmt.Errorf(\"Nil value found at %s\\n\", s[len(s)-1])\n\tcase []interface{}:\n\t\tarr := current.([]interface{})\n\t\tindex, err := strconv.Atoi(prevQ)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not access %s in array\", prevQ)\n\t\t}\n\t\tif index > len(arr) {\n\t\t\treturn fmt.Errorf(\"Index out of range\")\n\t\t}\n\t\tarr[index] = newVal\n\tcase map[string]interface{}:\n\t\tdict, _ := current.(map[string]interface{})\n\t\tdict[prevQ] = newVal\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid type for object\")\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6ac69885fcd6302b4377760981165d0", "score": "0.56405354", "text": "func (p *Store) Set(key string, val string) {\n\tp.c.Set(key, val, 0).Err()\n}", "title": "" }, { "docid": "35ef56827507df386704e2e8c0c6a5ba", "score": "0.56399196", "text": "func (s *Storage) Set(key string, val []byte, exp time.Duration) error {\n // Ain't Nobody Got Time For That\n if len(key) <= 0 || len(val) <= 0 {\n return nil\n }\n return s.db.Set(context.Background(), key, val, exp).Err()\n}", "title": "" }, { "docid": "800b9b8776a0d508d9e64cda1db973b8", "score": "0.5639908", "text": "func (d *ListString) Set(key string, value interface{}) {\n\tif d != nil {\n\t\tfor i, v := range *d {\n\t\t\tif key == v.GetKey() {\n\t\t\t\t(*d)[i].SetValue(value)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t*d = append(*d, TupleString{K: key, V: value})\n\t}\n}", "title": "" }, { "docid": "2e72810e6e1f9e74e1ad6b1f0e79eaaf", "score": "0.5633323", "text": "func (m TimeMap) Set(key string, value string, timestamp int) {\n\tif _, ok := m[key]; !ok {\n\t\tm[key] = make([]data, 1, 1024)\n\t}\n\tm[key] = append(m[key], data{\n\t\ttime: timestamp,\n\t\tvalue: value,\n\t})\n}", "title": "" }, { "docid": "df6865bc32884ffc8019d1b9d05aafef", "score": "0.56302977", "text": "func (c *BoltDB) Set(key string, val any, _ time.Duration) (err error) {\n\tbts, err := c.MustMarshal(val)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn c.db.Update(func(tx *bbolt.Tx) error {\n\t\tb := tx.Bucket([]byte(c.Bucket))\n\t\terr := b.Put([]byte(key), bts)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "e8a8b4b4948b3f834b7cd0fc5f94450a", "score": "0.56302476", "text": "func (im *Inmem) Set(key string, value string, writer io.Writer) error {\n\tim.setType(key, tString)\n\tim.strings[key] = trimQuotes(value)\n\twriter.Write([]byte(resOK))\n\treturn nil\n}", "title": "" }, { "docid": "e20f10c4675ac516ada3123507fc63b1", "score": "0.5628437", "text": "func (c Client) Set(key string, value interface{}) error {\n\t// Check type of value\n\tvar strValue string\n\tswitch value.(type) {\n\tcase int:\n\t\tstrValue = strconv.Itoa(value.(int))\n\tcase string:\n\t\tstrValue = value.(string)\n\tdefault:\n\t\treturn errors.New(\"replicache: unsupported value type\")\n\t}\n\n\t// Perform set command\n\tres, err := c.command(\"SET \" + key + \" \" + strValue)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check for OK\n\tif res != \"OK\" {\n\t\treturn errCheck(res)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5f0cc70d0add15ef388ffc32ddb1b743", "score": "0.56204903", "text": "func (t *txWriter) Set(ctx context.Context, key []byte, value proto.Message) error {\n\tif value == nil {\n\t\t_, err := t.Tx.Exec(fmt.Sprintf(`DELETE FROM \"%s\" WHERE key = $1`, t.Table), key)\n\t\treturn err\n\t}\n\n\tdata, err := proto.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = t.Tx.Exec(fmt.Sprintf(`INSERT INTO \"%s\" (key, value) VALUES ($1, $2) ON CONFLICT (key) DO UPDATE SET value = $2`, t.Table), key, data)\n\treturn err\n}", "title": "" }, { "docid": "57bf1131939a88f14ec9f04b93370b49", "score": "0.5619275", "text": "func (st *Store) Set(k, v []byte) error {\n\tst.Lock()\n\tdefer st.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "b5e3063037cbbb5f5b6a3bf3d39a2ca1", "score": "0.561678", "text": "func (t *Table) Set(key, value TableItem) error {\n\tbKey, err := key.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbValue, err := value.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn t.module.UpdateElement(t.Map, unsafe.Pointer(&bKey[0]), unsafe.Pointer(&bValue[0]), 0)\n}", "title": "" }, { "docid": "239cef05351cb07fb75c4ef8b54148b7", "score": "0.56121814", "text": "func (p Parameters) Set(key string, v interface{}) error {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to marshal value for parameter %q\")\n\t}\n\tp[key] = b\n\treturn nil\n}", "title": "" }, { "docid": "a90bcbc0c8617bfa63a39df4d096d314", "score": "0.56102896", "text": "func setKeys(keys *keyStrs) func(*globals) {\n\treturn func(g *globals) {\n\t\tg.keys = keys\n\t}\n}", "title": "" }, { "docid": "ab68542c9d28e3f1e30f2f94d023bf7c", "score": "0.5606232", "text": "func (be badgerBackend) Set(key []byte, value []byte) error {\n\treturn be.Put(key, value, false, true)\n}", "title": "" } ]
ee2825b05d32168f6cf10b6e0eb4a81d
NextGlobalAutoID returns the next global autoID. Used by 'show create table', 'alter table auto_increment = xxx'
[ { "docid": "1661ae090c0050b7942c99a2c970c15a", "score": "0.8566019", "text": "func (sp *singlePointAlloc) NextGlobalAutoID() (int64, error) {\n\t_, max, err := sp.Alloc(context.Background(), 0, 1, 1)\n\treturn max + 1, err\n}", "title": "" } ]
[ { "docid": "5e5eb22fb58b34789327125fc34aa697", "score": "0.7336", "text": "func (g *GlobalAllocator) NextID() uint64 {\n\tglobalConnID := g.Allocate()\n\treturn globalConnID.ToConnID()\n}", "title": "" }, { "docid": "3a73c743686cbd60dcf11f07989ae76b", "score": "0.7317014", "text": "func AllocGlobalAutoID(ctx context.Context, n int64, store kv.Storage, dbID int64,\n\ttblInfo *model.TableInfo) (autoIDBase, autoIDMax int64, err error) {\n\tallocators, err := GetGlobalAutoIDAlloc(store, dbID, tblInfo)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\t// there might be 2 allocators when tblInfo.SepAutoInc is true, and in this case\n\t// RowIDAllocType will be the last one.\n\t// we return the value of last Alloc as autoIDBase and autoIDMax, i.e. the value\n\t// either comes from RowIDAllocType or AutoRandomType.\n\tfor _, alloc := range allocators {\n\t\tautoIDBase, autoIDMax, err = alloc.Alloc(ctx, uint64(n), 1, 1)\n\t\tif err != nil {\n\t\t\treturn 0, 0, err\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3bebe50f3bc6a070516f97c1faede313", "score": "0.7008716", "text": "func GetGlobalAutoIDAlloc(store kv.Storage, dbID int64, tblInfo *model.TableInfo) ([]autoid.Allocator, error) {\n\tif store == nil {\n\t\treturn nil, errors.New(\"internal error: kv store should not be nil\")\n\t}\n\tif dbID == 0 {\n\t\treturn nil, errors.New(\"internal error: dbID should not be 0\")\n\t}\n\n\t// We don't need autoid cache here because we allocate all IDs at once.\n\t// The argument for CustomAutoIncCacheOption is the cache step. Step 1 means no cache,\n\t// but step 1 will enable an experimental feature, so we use step 2 here.\n\t//\n\t// See https://github.com/pingcap/tidb/issues/38442 for more details.\n\tnoCache := autoid.CustomAutoIncCacheOption(2)\n\ttblVer := autoid.AllocOptionTableInfoVersion(tblInfo.Version)\n\n\thasRowID := TableHasAutoRowID(tblInfo)\n\thasAutoIncID := tblInfo.GetAutoIncrementColInfo() != nil\n\thasAutoRandID := tblInfo.ContainsAutoRandomBits()\n\n\t// TiDB version <= 6.4.0 has some limitations for auto ID.\n\t// 1. Auto increment ID and auto row ID are using the same RowID allocator.\n\t// See https://github.com/pingcap/tidb/issues/982.\n\t// 2. Auto random column must be a clustered primary key. That is to say,\n\t// there is no implicit row ID for tables with auto random column.\n\t// 3. There is at most one auto column in a table.\n\t// Therefore, we assume there is only one auto column in a table and use RowID allocator if possible.\n\t//\n\t// Since TiDB 6.5.0, row ID and auto ID are using different allocators when tblInfo.SepAutoInc is true\n\tswitch {\n\tcase hasRowID || hasAutoIncID:\n\t\tallocators := make([]autoid.Allocator, 0, 2)\n\t\tif tblInfo.SepAutoInc() && hasAutoIncID {\n\t\t\tallocators = append(allocators, autoid.NewAllocator(store, dbID, tblInfo.ID, tblInfo.IsAutoIncColUnsigned(),\n\t\t\t\tautoid.AutoIncrementType, noCache, tblVer))\n\t\t}\n\t\t// this allocator is NOT used when SepAutoInc=true and auto increment column is clustered.\n\t\tallocators = append(allocators, autoid.NewAllocator(store, dbID, tblInfo.ID, tblInfo.IsAutoIncColUnsigned(),\n\t\t\tautoid.RowIDAllocType, noCache, tblVer))\n\t\treturn allocators, nil\n\tcase hasAutoRandID:\n\t\treturn []autoid.Allocator{autoid.NewAllocator(store, dbID, tblInfo.ID, tblInfo.IsAutoRandomBitColUnsigned(),\n\t\t\tautoid.AutoRandomType, noCache, tblVer)}, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"internal error: table %s has no auto ID\", tblInfo.Name)\n\t}\n}", "title": "" }, { "docid": "345e2a2539149942af8f797cf58640f4", "score": "0.6891375", "text": "func GlobalID() ID {\n\treturn ID(rand.Int63n(maxID)) //nolint:gosec\n}", "title": "" }, { "docid": "c0b92d4d76c1516c86c5dcafc6f72896", "score": "0.68907416", "text": "func RebaseGlobalAutoID(ctx context.Context, newBase int64, store kv.Storage, dbID int64,\n\ttblInfo *model.TableInfo) error {\n\tallocators, err := GetGlobalAutoIDAlloc(store, dbID, tblInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, alloc := range allocators {\n\t\terr = alloc.Rebase(ctx, newBase, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f4bebbd02339de39eefd619ec787834", "score": "0.6702148", "text": "func nextID() uint64 { return uint64(atomic.AddUint32(&lastID, 1)) }", "title": "" }, { "docid": "1c9abe70b858282fde097a1fb6009dfc", "score": "0.6598306", "text": "func NextId() int {\n return getLastId() + 1\n}", "title": "" }, { "docid": "6c60bece69a27e7b0b86d693c7c552a6", "score": "0.64118814", "text": "func NextModelID() ID {\n\treturn ID(common.NextGlobalID())\n}", "title": "" }, { "docid": "54e30fda31995a7e937c8a91452a8526", "score": "0.6360519", "text": "func getNextID() uint64 {\n\tnumHolder := &nextNumber\n\tatomic.AddUint64(numHolder, 1)\n\tnum := atomic.LoadUint64(numHolder)\n\treturn num\n}", "title": "" }, { "docid": "4d1323954d6c32d56be8c988e1f9074b", "score": "0.62831086", "text": "func GetGlobalID() (int64) {\n id, _ := client.Get(\"global:id\")\n int_id, _ := strconv.ParseInt(id, 10, 64)\n return int_id\n}", "title": "" }, { "docid": "195f95a63c0e646fa664452463d0b7f5", "score": "0.62334085", "text": "func autoId() string {\n\n\treturn uuid.Must(uuid.NewV4()).String()\n}", "title": "" }, { "docid": "195f95a63c0e646fa664452463d0b7f5", "score": "0.62334085", "text": "func autoId() string {\n\n\treturn uuid.Must(uuid.NewV4()).String()\n}", "title": "" }, { "docid": "7ea72c9c224274d36deee2cb76a461bb", "score": "0.6167617", "text": "func (d *Store) NextID() int64 {\n\td.gen++\n\treturn d.gen\n}", "title": "" }, { "docid": "51b636b29ccae7e5550a9155f97034d2", "score": "0.6163657", "text": "func getNextUID() (id int16) {\n\tid = 0\n\tfor _, value := range managersUserStorage.UserMap {\n\t\tif(value.UID > id) {\n\t\t\tid = value.UID\n\t\t}\n\t}\n\treturn id+1;\n}", "title": "" }, { "docid": "c291748c3b20ac1efc0ee633717de7fe", "score": "0.61557144", "text": "func (a *SimpleAllocator) NextID() uint64 {\n\tid, _ := a.pool.Get()\n\treturn id\n}", "title": "" }, { "docid": "03009aa91932bd4b941f66b48b2ea146", "score": "0.6115191", "text": "func NextID() uint32 {\n\treturn atomic.AddUint32(&id, 1)\n}", "title": "" }, { "docid": "b2b73b0776cca73b498652355c0da1e0", "score": "0.60791063", "text": "func GlobalMachineID() int {\n\tvar id int\n\tglobalmachineID.RLock()\n\tid = int(globalmachineID.id)\n\tglobalmachineID.RUnlock()\n\treturn id\n}", "title": "" }, { "docid": "8e798437e2bdb0765e5480e8c7cb7d27", "score": "0.6054458", "text": "func (g *generator) NextID() string {\n\tvar id = strconv.FormatUint(rand.Uint64(), 10)\n\tvar time = strconv.FormatInt(time.Now().Unix(), 10)\n\treturn fmt.Sprintf(\"%s-%s-%s-%s\", g.componentName, g.componentID, time, id)\n}", "title": "" }, { "docid": "152c0e54c29b27d9aaad72183bec57c5", "score": "0.59554076", "text": "func Next() uint64 {\n\treturn gid.Next()\n}", "title": "" }, { "docid": "023556391c158f88aa69905e764a8efb", "score": "0.59185374", "text": "func nextGeneration() int64 {\n\treturn atomic.AddInt64(&generation, 1)\n}", "title": "" }, { "docid": "4879c7d2c45dcba7a7fa0ac00c514d49", "score": "0.5916023", "text": "func nextServerConnID() uint32 {\n\treturn atomic.AddUint32(&serverBaseConnID, 1)\n}", "title": "" }, { "docid": "a189ecc9490e0856c6b4288767f37c6c", "score": "0.5886039", "text": "func GenerateID() int {\n\tuniqueID++\n\treturn uniqueID\n}", "title": "" }, { "docid": "274476dae71b308d0cf5c4b4d88ca1d1", "score": "0.58781976", "text": "func (a *idAllocator) nextID() uint64 {\n\ta.id++\n\treturn a.id\n}", "title": "" }, { "docid": "554df8703a14012d430fd381a9b1afa6", "score": "0.585768", "text": "func (m *PolicyManifest) GlobalID() string {\n\treturn fmt.Sprintf(\"%s/%s\", m.Namespace, m.ID)\n}", "title": "" }, { "docid": "8a3d197892fc0407338f9a66006ff98b", "score": "0.5804905", "text": "func getNextID() int {\n\tml := metricsLogList[len(metricsLogList)-1]\n\treturn ml.ID + 1\n}", "title": "" }, { "docid": "737dd6985f0863f4e77ff060c2ff7b6e", "score": "0.5778422", "text": "func (g *IDGen) Next() ID {\n\tg.next++\n\tif g.next > maxID {\n\t\tg.next = 1\n\t}\n\treturn ID(g.next)\n}", "title": "" }, { "docid": "6794754bb8fa014bdb43898c48a6b107", "score": "0.5773864", "text": "func (n *node) genID() {\n\tidCounter++\n\tn.id = \"_auto_id_generate_\" + strconv.Itoa(idCounter)\n}", "title": "" }, { "docid": "7161cd51af138565f4d19073fe2fc49b", "score": "0.5767445", "text": "func (g *SyncIDGen) Next() ID {\n\tg.lock.Lock()\n\tdefer g.lock.Unlock()\n\treturn g.IDGen.Next()\n}", "title": "" }, { "docid": "9149ca40f9477840d760d13b124b25f3", "score": "0.5747064", "text": "func GetNewID(collName string) (int, error) {\n\tdb, closeDB := DB.Get()\n\tdefer closeDB()\n\tdoc := autoincrDoc{}\n\tchange := mgo.Change{\n\t\tUpdate: bson.M{\"$inc\": bson.M{\"n\": 1}},\n\t\tUpsert: true,\n\t\tReturnNew: true,\n\t}\n\t_, err := db.C(\"autoincrements\").Find(bson.M{\"_id\": collName}).Apply(change, &doc)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn doc.N, nil\n}", "title": "" }, { "docid": "ab313bc2cad5e9bbd77c24638f66f0a9", "score": "0.5735792", "text": "func GenerateID() string {\n\n\treturn nuid.Next()\n\n}", "title": "" }, { "docid": "ad76f03970968763b29e6c1173bcf224", "score": "0.5687555", "text": "func GetNextQuotaID() (uint32, error) {\n\treturn GQuotaDriver.GetNextQuotaID()\n}", "title": "" }, { "docid": "8c8a2dbcdb57714e5644e9738d695d74", "score": "0.56858593", "text": "func (self *Record) NextRefID() int {\n\treturn int(self.mtid())\n}", "title": "" }, { "docid": "4735e033373730b748499eeff4831100", "score": "0.5677912", "text": "func (inst *Instance) NextID() int32 {\n\tinst.idCounter++\n\treturn inst.idCounter\n}", "title": "" }, { "docid": "0dedbc0a87338613c749aba658f3a083", "score": "0.56577945", "text": "func (k Keeper) nextID(ctx sdk.Context) dnTypes.ID {\n\tstore := ctx.KVStore(k.storeKey)\n\tif !store.Has(types.LastOrderIDKey) {\n\t\treturn dnTypes.NewIDFromUint64(0)\n\t}\n\n\tlastID := k.getLastOrderID(ctx)\n\n\treturn lastID.Incr()\n}", "title": "" }, { "docid": "e32f12a792237b13a8b7e164893f9e0a", "score": "0.56520844", "text": "func GenerateNewID() (int64, error) {\n\tif sf == nil {\n\t\tinitSonyflake()\n\t}\n\n\ti, err := sf.NextID()\n\n\treturn int64(i), err\n}", "title": "" }, { "docid": "5cda7d2362520f1798e99a9ff3815fbb", "score": "0.564083", "text": "func (p *awsDynamoDBStorager) NextId() (string, error) {\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tcntTotal := _SPIT_ID_CNT_TOTAL\n\tcntInc := r.Intn(cntTotal) + 1\n\tnextId := \"\"\n\tfor i := 1; i <= cntTotal; i++ {\n\t\tdiff := 0\n\t\tif cntInc == i {\n\t\t\tdiff = 1\n\t\t}\n\t\t// increase the counter selected randomly only\n\t\tcntCurrent, err := p.FAI(_TABLE_NAME_SPITS_META, \"key\", _SPIT_ID_CNT_PREFIX+strconv.Itoa(i), \"value\", diff)\n\t\tif err != nil {\n\t\t\treturn \"-_-INVALID-_-\", err\n\t\t}\n\t\t//nextId += SpitIdEncoding.Encode(uint64(cntCurrent))\n\t\tnextId += ids.Encode(uint64(cntCurrent), i-1)\n\t}\n\treturn nextId, nil\n}", "title": "" }, { "docid": "7f0cabcded7a0a45db06d92259b54ef6", "score": "0.55891013", "text": "func (uc *IdCounter) Next() string {\n\treturn strconv.FormatUint(uc.NextInt(), 32)\n}", "title": "" }, { "docid": "6cea69a8ce1e9843cf784d386473dea1", "score": "0.5562013", "text": "func IDGenerator(currTime time.Time, shardID uint64, incrID uint64) int64 {\n\tnum := uint64(0)\n\n\t// add time\n\tt := uint64(currTime.Year() - 1970)\n\tt = (t << 4) + uint64(currTime.Month())\n\tt = (t << 5) + uint64(currTime.Day())\n\tt = (t << 5) + uint64(currTime.Hour())\n\tt = (t << 6) + uint64(currTime.Minute())\n\tt = (t << 6) + uint64(currTime.Second())\n\tnum += (t << (10 + 14))\n\n\t// add shard ID\n\tnum += ((shardID % 1024) << 14)\n\n\t// add auto-incrementing sequence\n\tnum += (incrID % 16384)\n\n\treturn int64(num)\n}", "title": "" }, { "docid": "3fe683118c2c52d1ee50c99d4e00e206", "score": "0.55543476", "text": "func (_Tokenregistry *TokenregistrySession) NextTokenID() (*big.Int, error) {\n\treturn _Tokenregistry.Contract.NextTokenID(&_Tokenregistry.CallOpts)\n}", "title": "" }, { "docid": "e3ae0bf46c4746b631553f00b8b1a5ef", "score": "0.55387384", "text": "func (fs *FileStorage) NextID() string {\n\tfs.lock.Lock()\n\tdefer fs.lock.Unlock()\n\tfiles, err := ioutil.ReadDir(fs.StorageDir)\n\tif err != nil {\n\t\tfmt.Fprintf(fs.Log, \"Error: %s, %s\\n\", err, godebug.LF())\n\t\treturn \"\"\n\t}\n\treturn strconv.FormatUint(uint64(len(files)+1), 36) // Base 36, take count of # of files add 1, this is the ID.\n}", "title": "" }, { "docid": "906e39f131013a0f7f005cab10523568", "score": "0.553576", "text": "func (db *DB) generateID(taxID string) string {\n\tt := time.Now()\n\troot := taxID + \":\" + t.Format(\"20060102150405\")\n\tfor {\n\t\tid := fmt.Sprintf(\"%s-%d\", root, rand.Intn(100000000))\n\t\tif _, ok := db.ids[id]; !ok {\n\t\t\treturn id\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d2c427893e056323f5230c7db37cb084", "score": "0.5501053", "text": "func (_Tokenregistry *TokenregistryCallerSession) NextTokenID() (*big.Int, error) {\n\treturn _Tokenregistry.Contract.NextTokenID(&_Tokenregistry.CallOpts)\n}", "title": "" }, { "docid": "3fbb27f6e838c540b5deeba4deaf71d3", "score": "0.54897785", "text": "func generateUniqueID(existsFn KeyExists) uint32 {\r\n\tnconflict := 0\r\n\tfor i := 0; i < 10000; i++ {\r\n\t\tnextInt := nextRandomNumber()\r\n\t\tif !existsFn(nextInt, i) {\r\n\t\t\treturn nextInt\r\n\t\t}\r\n\r\n\t\tif nconflict++; nconflict > 10 {\r\n\t\t\trandmu.Lock()\r\n\t\t\trand = reseed()\r\n\t\t\trandmu.Unlock()\r\n\t\t}\r\n\t}\r\n\r\n\t// give up after max tries, not much we can do\r\n\treturn nextRandomNumber()\r\n}", "title": "" }, { "docid": "64c3875466fd1424e4817c098380f20f", "score": "0.54895675", "text": "func (w *TableWorker) NextID() (uint64, error) {\n\tw.mux.Lock()\n\tdefer w.mux.Unlock()\n\n\treturn w.nextID()\n}", "title": "" }, { "docid": "05e515fcf11e5f9107b85bc5099783a7", "score": "0.54874873", "text": "func (d *ddl) handleAutoIncID(tbInfo *model.TableInfo, schemaID int64) error {\n\talloc := autoid.NewAllocator(d.store, schemaID)\n\ttbInfo.State = model.StatePublic\n\ttb, err := table.TableFromMeta(alloc, tbInfo)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\t// The operation of the minus 1 to make sure that the current value doesn't be used,\n\t// the next Alloc operation will get this value.\n\t// Its behavior is consistent with MySQL.\n\tif err = tb.RebaseAutoID(tbInfo.AutoIncID-1, false); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4c1be0045d6c81678823f93f86fbf55", "score": "0.54856265", "text": "func nextRunnerID() int32 {\n\treturn atomic.AddInt32(&runnerID, 1)\n}", "title": "" }, { "docid": "98ab28a13b7b593bb1de9900494c202b", "score": "0.5471333", "text": "func(w *worker) nextId() int64 {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\ttimestamp := w.getCurrentTime()\n\tif timestamp < w.laststamp {\n\t\tlog.Fatal(\"can not generate id\")\n\t}\n\tif w.laststamp == timestamp {\n\t\t// 这其实和 <==>\n\t\t// w.sequence++\n\t\t// if w.sequence++ > maxSequence 等价\n\t\tw.sequence = (w.sequence + 1) & maxSequence\n\t\tif w.sequence == 0 {\n\t\t\t// 之前使用 if, 只是没想到 GO 可以在一毫秒以内能生成到最大的 Sequence, 那样就会导致很多重复的\n\t\t\t// 这个地方使用 for 来等待下一毫秒\n\t\t\tfor timestamp <= w.laststamp {\n\t\t\t\t//i++\n\t\t\t\t//fmt.Println(i)\n\t\t\t\ttimestamp = w.getCurrentTime()\n\t\t\t}\n\t\t}\n\t} else {\n\t\tw.sequence = 0\n\t}\n\tw.laststamp = timestamp\n\n\treturn ((timestamp - twepoch) << timeLeft) | (w.datacenterid << dataLeft) | (w.workerid << workLeft) | w.sequence\n}", "title": "" }, { "docid": "fd971547401c38be5ac68c7b9161dde8", "score": "0.546718", "text": "func (b *Bench) nextGateID() int {\n\tb.lastGateID++\n\treturn b.lastGateID - 1\n}", "title": "" }, { "docid": "fa8fc89468b16dcca47fe163a452cfd5", "score": "0.5460254", "text": "func goid() int {\n\tvar buf [64]byte\n\tn := runtime.Stack(buf[:], false)\n\tidField := strings.Fields(strings.TrimPrefix(string(buf[:n]), \"goroutine \"))[0]\n\tid, err := strconv.Atoi(idField)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"cannot get goroutine id: %v\", err))\n\t}\n\treturn id\n}", "title": "" }, { "docid": "32f4b2e6aa0152ce296d25075415fa19", "score": "0.5458562", "text": "func (d *ddl) handleAutoIncID(tbInfo *model.TableInfo, schemaID int64, newEnd int64, tp autoid.AllocatorType) error {\n\tallocs := autoid.NewAllocatorsFromTblInfo(d.store, schemaID, tbInfo)\n\tif alloc := allocs.Get(tp); alloc != nil {\n\t\terr := alloc.Rebase(context.Background(), newEnd, false)\n\t\tif err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fa4f683bc1899fa01b417c73b5188b5e", "score": "0.5436011", "text": "func (r *req) nextID() uint32 {\n\t// The high order bit is \"special\", and must always be set. (This is\n\t// how the peer will detect the end of the backtrace.)\n\tv := r.nextid | 0x80000000\n\tr.nextid++\n\tnano.Debugf(\"nextid: %d: %d\", v, r.nextid)\n\treturn v\n}", "title": "" }, { "docid": "bb05fd33e3d0d9a808845db8bf42fe3c", "score": "0.540501", "text": "func (h High) NextID() string {\n\treturn nextID(h)\n}", "title": "" }, { "docid": "2247fde5e830e16480366be4f53a0fb2", "score": "0.54009", "text": "func (k Keeper) getNextProposalID(ctx sdk.Context) uint64 {\n\tstore := ctx.KVStore(k.storeKey)\n\tif !store.Has(types.GovQueueLastIdKey) {\n\t\treturn 0\n\t}\n\n\tbz := store.Get(types.GovQueueLastIdKey)\n\tid := types.ParseGovQueueStorageKey(bz)\n\n\treturn id + 1\n}", "title": "" }, { "docid": "b76f1680deb93f966fc6c8315fcfe2a7", "score": "0.5397668", "text": "func genID() string {\n\treturn uuid.New().String()\n}", "title": "" }, { "docid": "7f2dfb14414e9350229706ae61eec5bf", "score": "0.539746", "text": "func GenID() (res int64) {\n\tresult := time.Now().UnixNano()\n\treturn result\n}", "title": "" }, { "docid": "4f7d5baf38925e771df4e6cd38543974", "score": "0.53779256", "text": "func (service *Service) GetNextIdentifier() int {\n\treturn service.Connection.GetNextIdentifier(BucketName)\n}", "title": "" }, { "docid": "d3f99346dc8c931c711079b38616d2c5", "score": "0.5370523", "text": "func GenUniqueID() string {\n\tif gCfg.DefaultIdGenerator == \"objectid\" {\n\t\treturn objectid.New().String()\n\t}\n\tu, _ := uuid.NewV4()\n\treturn u.String()\n}", "title": "" }, { "docid": "044b3518d3ba11f715d057c862d304ae", "score": "0.53659093", "text": "func BenchmarkOldGenerateGlobalID(t *testing.B) {\n\tt.RunParallel(func(pb *testing.PB) {\n\t\tfor pb.Next() {\n\t\t\toldGenerateGlobalID()\n\t\t}\n\t})\n}", "title": "" }, { "docid": "4985a5670970366c9735ba9449772ca4", "score": "0.53643185", "text": "func (wss *WSServer) genConId() int {\n\twss.lock.Lock()\n\tdefer wss.lock.Unlock()\n\n\twss.idCounter++\n\treturn wss.idCounter\n}", "title": "" }, { "docid": "1e717f08e009ccd5e33f370daabf53b6", "score": "0.5360304", "text": "func (r *Router) generateBackgroundTaskID() BackgroundTaskID {\n\tid := r.backgroundTaskIDSeed\n\tr.backgroundTaskIDSeed += 1\n\treturn id\n}", "title": "" }, { "docid": "3953bd9cae5d6b844cfeacbd9b88a786", "score": "0.5346768", "text": "func (quota *GrpQuota) GetNextQuatoID() (uint32, error) {\n\tquota.lock.Lock()\n\tdefer quota.lock.Unlock()\n\n\tif quota.quotaLastID == 0 {\n\t\tvar err error\n\t\tquota.quotaLastID, err = quota.loadQuotaIDs()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tid := quota.quotaLastID\n\tfor {\n\t\tif id < QuotaMinID {\n\t\t\tid = QuotaMinID\n\t\t}\n\t\tid++\n\t\tif _, ok := quota.quotaIDs[id]; !ok {\n\t\t\tbreak\n\t\t}\n\t}\n\tquota.quotaIDs[id] = 1\n\tquota.quotaLastID = id\n\n\tlogrus.Debugf(\"get next project quota id: %d\", id)\n\treturn id, nil\n}", "title": "" }, { "docid": "149c406799ba4d1eba107faa60017e7f", "score": "0.534419", "text": "func (service *Service) GetNextIdentifier() int {\n\treturn service.connection.GetNextIdentifier(BucketName)\n}", "title": "" }, { "docid": "4560e3d8474573dbbd33a19d499e7c04", "score": "0.534212", "text": "func GetNextAppSequence(appID string, currentSequence *int64) (int64, error) {\n\tnewSequence := 0\n\tif currentSequence != nil {\n\t\tdb := persistence.MustGetPGSession()\n\t\trow := db.QueryRow(`select max(sequence) from app_version where app_id = $1`, appID)\n\t\tif err := row.Scan(&newSequence); err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"failed to find current max sequence in row\")\n\t\t}\n\t\tnewSequence++\n\t}\n\treturn int64(newSequence), nil\n}", "title": "" }, { "docid": "405500ef397085c4ac8585b76d8b1882", "score": "0.5311901", "text": "func (g *IDGenerator) NextID(source string, offset int64) string {\n\tg.Lock()\n\tdefer g.Unlock()\n\tg.m[source] += offset + 1\n\treturn fmt.Sprintf(\"%s.%d\", source, g.m[source])\n}", "title": "" }, { "docid": "38f62ebb76ec5144180c34348b58dcde", "score": "0.5302547", "text": "func generateAppID(namespace string) string {\n\tns := \"default\"\n\tif namespace != \"\" {\n\t\tns = namespace\n\t}\n\tgeneratedID := fmt.Sprintf(\"%s-%s-%s\", autoGenAppPrefix, ns, autoGenAppSuffix)\n\tappID := fmt.Sprintf(\"%.63s\", generatedID)\n\treturn appID\n}", "title": "" }, { "docid": "3aaf6ded22404e2d00806b472c657928", "score": "0.53023875", "text": "func getNewId() (int, error) {\n var document Document\n\n findErr := mongoCollection.FindOne(\n context.TODO(),\n bson.D{},\n options.FindOne().SetSort(bson.D{{\"id\", -1}}), //sort results by id. -1 = descending order\n ).Decode(&document)\n\n if findErr != nil {\n \t\tif findErr == mongo.ErrNoDocuments { //db collection is empty\n return 0, nil\n }\n\n return -1, findErr\n \t}\n\n return *document.ID + 1, nil\n}", "title": "" }, { "docid": "46864db2c03df08f0d55a8b0115c6254", "score": "0.5297372", "text": "func (pf *PostgresFlavor) GetNextSequenceValue(name string) (int, error) {\n\n\t// determine the column name of the primary key\n\tpKeyQuery := \"SELECT c.column_name, c.ordinal_position FROM information_schema.key_column_usage AS c LEFT JOIN information_schema.table_constraints AS t ON t.constraint_name = c.constraint_name WHERE t.table_name = '\" + name + \"' AND t.constraint_type = 'PRIMARY KEY';\"\n\tvar keyColumn string\n\tvar keyColumnPos int\n\tpf.QsLog(pKeyQuery)\n\n\tpf.db.QueryRow(pKeyQuery).Scan(&keyColumn, &keyColumnPos)\n\tif keyColumn == \"\" {\n\t\treturn 0, fmt.Errorf(\"could not identify primary-key column for table %s\", name)\n\t}\n\n\t// Postgres sequences have format '<tablename>_<keyColumn>_seq'\n\tseqName := name + \"_\" + keyColumn + \"_seq\"\n\n\tif pf.ExistsSequence(seqName) {\n\t\tseq := 0\n\t\tseqQuery := \"SELECT nextval('\" + seqName + \"');\"\n\t\tpf.QsLog(seqQuery)\n\n\t\terr := pf.db.QueryRow(seqQuery).Scan(&seq)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn seq, nil\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "a4d1f383a1cc23a2851e2a8ddb532f05", "score": "0.5292625", "text": "func GenerateID() uint64 {\n\treturn defaultGenerator.Get()\n}", "title": "" }, { "docid": "cdc12ae2f679175ac6b709a171c9d901", "score": "0.52819633", "text": "func randomID() (int64, error) {\n\t// Get a random number within the range [0, 1<<63-1)\n\tn, err := rand.Int(rand.Reader, maxRand)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t// Don't assign 0.\n\treturn n.Int64() + 1, nil\n}", "title": "" }, { "docid": "2d80ecb848cbfcb0e0460b9df6cdd594", "score": "0.52804875", "text": "func (d *ddl) handleAutoIncID(tbInfo *model.TableInfo, schemaID int64) error {\n\ttrace_util_0.Count(_ddl_api_00000, 591)\n\talloc := autoid.NewAllocator(d.store, tbInfo.GetDBID(schemaID), tbInfo.IsAutoIncColUnsigned())\n\ttbInfo.State = model.StatePublic\n\ttb, err := table.TableFromMeta(alloc, tbInfo)\n\tif err != nil {\n\t\ttrace_util_0.Count(_ddl_api_00000, 594)\n\t\treturn errors.Trace(err)\n\t}\n\t// The operation of the minus 1 to make sure that the current value doesn't be used,\n\t// the next Alloc operation will get this value.\n\t// Its behavior is consistent with MySQL.\n\ttrace_util_0.Count(_ddl_api_00000, 592)\n\tif err = tb.RebaseAutoID(nil, tbInfo.AutoIncID-1, false); err != nil {\n\t\ttrace_util_0.Count(_ddl_api_00000, 595)\n\t\treturn errors.Trace(err)\n\t}\n\ttrace_util_0.Count(_ddl_api_00000, 593)\n\treturn nil\n}", "title": "" }, { "docid": "ebce7ee503a478effd24eda3a34cf96e", "score": "0.5265642", "text": "func (d SqliteDialect) AutoIncrStr() string {\n\treturn \"autoincrement\"\n}", "title": "" }, { "docid": "741ba55920e99c3e363a6267e5e215f5", "score": "0.52615035", "text": "func (reqS RequestStatus) GetNextID() (int, error) {\r\n\tquery := \"SELECT StatusCode \" +\r\n\t\t\"FROM RequestStatus\"\r\n\r\n\tresults, err := DB.Query(query)\r\n\tif err != nil {\r\n\t\tpanic(\"error executing sql select\")\r\n\t}\r\n\r\n\tfor results.Next() {\r\n\t\terr := results.Scan(&reqS.StatusCode)\r\n\r\n\t\tif err != nil {\r\n\t\t\tpanic(\"error getting results from sql select\")\r\n\t\t}\r\n\t}\r\n\treturn (reqS.StatusCode + 1), nil\r\n}", "title": "" }, { "docid": "04a9ff468d3a8c4615d69ecfb05b2936", "score": "0.525663", "text": "func (g *GlobalRefMap) GetGlobalRefID(componentID string, localRefID uint64) uint64 {\n\tg.mut.Lock()\n\tdefer g.mut.Unlock()\n\n\tm, found := g.mappings[componentID]\n\tif !found {\n\t\treturn 0\n\t}\n\tglobal := m.localToGlobal[localRefID]\n\treturn global\n}", "title": "" }, { "docid": "3fa11f8f5527370eac3dc85a57a4cca6", "score": "0.5256196", "text": "func (_Tokenregistry *TokenregistryCaller) NextTokenID(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Tokenregistry.contract.Call(opts, out, \"nextTokenID\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a9184aee10bf8f99eee72648cc0895ff", "score": "0.5253124", "text": "func (urlList *Urls) getNextID() int {\n\tif len(urlList.data) == 0 {\n\t\treturn 0\n\t}\n\n\tlast := urlList.data[len(urlList.data)-1]\n\treturn last.ID + 1\n}", "title": "" }, { "docid": "70e69208bc99e24c32c9d1680fd78351", "score": "0.52490115", "text": "func (dict TrainerAppointmentDictionary) GetNextID() int {\n\tnextID := 0\n\n\t// go find the highest ID in our data\n\tfor _, trainerAppointments := range dict {\n\t\tfor _, appointment := range trainerAppointments {\n\t\t\tif appointment.ID > nextID {\n\t\t\t\tnextID = appointment.ID\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nextID + 1\n}", "title": "" }, { "docid": "db4eb7a720c01e3f4a2b0627c16a5d6f", "score": "0.5247811", "text": "func getAutoIncrementValue(ctx *sql.Context, table sql.Table) (interface{}, error) {\n\tif autoTbl, ok := table.(sql.AutoIncrementTable); ok {\n\t\tnext, err := autoTbl.PeekNextAutoIncrementValue(ctx)\n\t\tif errors.Is(err, sql.ErrNoAutoIncrementCol) {\n\t\t\treturn nil, nil\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t} else if next == nil {\n\t\t\treturn nil, nil\n\t\t} else {\n\t\t\tnum := sqlValToInt64(next)\n\t\t\tif ok {\n\t\t\t\treturn num, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "1035d363697ad29f1f389a517f2dc112", "score": "0.52229327", "text": "func (MessageStore) incrGlobalOffset(\n\tctx context.Context,\n\ttx *sql.Tx,\n\tn uint64,\n) (uint64, error) {\n\t// insert or update both cause the row to be locked in tx\n\tres, err := tx.ExecContext(\n\t\tctx,\n\t\t`INSERT INTO messagestore_offset SET\n\t\t\t \tnext = ?\n\t\tON DUPLICATE KEY UPDATE\n\t\t\tnext = next + VALUE(next)`,\n\t\tn,\n\t)\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\n\tar, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\n\tif ar == 1 {\n\t\t// if MySQL reports rows affected as 1, that means an insert occurred\n\t\t// so we know that the offset was 0\n\t\treturn 0, nil\n\t}\n\n\tvar next uint64\n\terr = tx.QueryRowContext(\n\t\tctx,\n\t\t`SELECT\n\t\t\tnext\n\t\tFROM messagestore_offset`,\n\t).Scan(\n\t\t&next,\n\t)\n\n\treturn next - n, err\n}", "title": "" }, { "docid": "ec6b93427a735a0a2b9104c7e5c48d84", "score": "0.52090067", "text": "func (ms *MutableStateImpl) GetNextEventID() int64 {\n\treturn ms.hBuilder.NextEventID()\n}", "title": "" }, { "docid": "df7db545042e5d5caa1c02f1f97efb25", "score": "0.52077144", "text": "func GetNewID() int {\n\tmaxKey := 0\n\tfor key := range cache {\n\t\tif key > maxKey {\n\t\t\tmaxKey = key\n\t\t}\n\t}\n\n\treturn maxKey + 1\n}", "title": "" }, { "docid": "066b2c4141f5a241efd099c80a3fb86f", "score": "0.5188085", "text": "func NewIDGenerator() func() string {\n\tlock := sync.Mutex{}\n\tnextID := 0\n\n\treturn func() string {\n\t\tlock.Lock()\n\t\tdefer lock.Unlock()\n\n\t\tnextID++\n\t\treturn strconv.Itoa(nextID)\n\t}\n}", "title": "" }, { "docid": "a810c769a61a03031d14fca6fcb6bbf1", "score": "0.51853", "text": "func (m *Machine) nextGen() int64 {\n\treturn m.State.Generation + 1\n}", "title": "" }, { "docid": "284c9c7b1d5a59740d2b9cbfea5acfec", "score": "0.51746476", "text": "func GetNextQuatoID() (uint32, error) {\n\treturn Gquota.GetNextQuatoID()\n}", "title": "" }, { "docid": "53b5cdc617eaff4418d73b90f0167770", "score": "0.5168195", "text": "func generateId() (string, error) {\n\n\thash := sha1.New()\n\tio.WriteString(hash, strconv.FormatInt(time.Now().Unix(), 10))\n\n\turan := make([]byte, 1024)\n\tif _, err := io.ReadFull(rand.Reader, uran); err != nil {\n\t\treturn \"\", errors.New(\"simplesession: could not generate random key\")\n\t}\n\n\thash.Write(uran)\n\tid := hex.EncodeToString(hash.Sum(nil))\n\n\tfpath := filepath.Join(sfileDir, \"gosession_\"+id)\n\tif _, err := os.Stat(fpath); err == nil {\n\t\treturn generateId()\n\t} else {\n\t\treturn id[0:sidLength], nil\n\t}\n}", "title": "" }, { "docid": "583aeed80a5ca3033a554f7f0c5e11fe", "score": "0.51657176", "text": "func (m *Model) GenID(res ModelType) uint {\n\treturn uint(atomic.AddUint64(m.NextIDs[res], 1))\n}", "title": "" }, { "docid": "d782659775f5905a6edc887ba0ee6f5c", "score": "0.51654", "text": "func GetUniqueID() int64 {\n\tm.Lock()\n\tdefer m.Unlock()\n\tuniqeID++\n\treturn uniqeID\n}", "title": "" }, { "docid": "8a5e8d3cf6facc890034a5580b5ce96b", "score": "0.5160451", "text": "func GetNextReg() (a int) {\n\tfor a=0; a < len(regs); a++ {\n\t\tif regs[a] {\n\t\t\tregs[a] = false\n\t\t\treturn a\n\t\t}\n\t}\n\n\t// If we are here it means we could not find a single register :( bad !\n\treturn 0\n}", "title": "" }, { "docid": "e4687148fb379477e9af987a717c448c", "score": "0.5157617", "text": "func GenerateID() string {\n\tv := atomic.AddInt32(&idCounter, 1)\n\treturn strconv.Itoa(int(v))\n}", "title": "" }, { "docid": "abe63df06e9bb3ddaa3da1561ce9090e", "score": "0.515522", "text": "func (g *GlobalRefMap) GetOrAddGlobalRefID(l labels.Labels) uint64 {\n\tg.mut.Lock()\n\tdefer g.mut.Unlock()\n\n\t// Guard against bad input.\n\tif l == nil {\n\t\treturn 0\n\t}\n\n\tlabelHash := l.Hash()\n\tglobalID, found := g.labelsHashToGlobal[labelHash]\n\tif found {\n\t\treturn globalID\n\t}\n\tg.globalRefID++\n\tg.labelsHashToGlobal[labelHash] = g.globalRefID\n\treturn g.globalRefID\n}", "title": "" }, { "docid": "80f9c51536d2c3770e3169a2318dfc15", "score": "0.5152835", "text": "func _1818autoIncrementEnd(tls crt.TLS, _pParse uintptr /* *TParse = SParse */) {\n\tvar (\n\t\t_p uintptr // *TAutoincInfo = SAutoincInfo\n\t\t_v uintptr // *TVdbe = SVdbe\n\t\t_db uintptr // *Tsqlite3 = Ssqlite3\n\t\t_aOp uintptr // *TVdbeOp = SVdbeOp\n\t\t_pDb uintptr // *TDb = SDb\n\t\t_iRec int32\n\t\t_memId int32\n\t)\n\t_v = *(*uintptr)(unsafe.Pointer(_pParse + 16))\n\t_db = *(*uintptr)(unsafe.Pointer(_pParse))\n\n\t_p = *(*uintptr)(unsafe.Pointer(_pParse + 152))\n_1:\n\tif _p == 0 {\n\t\tgoto _3\n\t}\n\n\t_pDb = (*(*uintptr)(unsafe.Pointer(_db + 32))) + 32*uintptr(*(*int32)(unsafe.Pointer(_p + 16)))\n\t_memId = *(*int32)(unsafe.Pointer(_p + 20))\n\t_iRec = _1562sqlite3GetTempReg(tls, _pParse)\n\n\t_1647sqlite3OpenTable(tls, _pParse, int32(0), *(*int32)(unsafe.Pointer(_p + 16)), *(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pDb + 24))) + 104)), int32(105))\n\t_aOp = _1073sqlite3VdbeAddOpList(tls, _v, int32(5), _1950autoIncEnd, _1949iLn)\n\tif _aOp != 0 {\n\t\tgoto _4\n\t}\n\n\tgoto _3\n\n_4:\n\t*(*int32)(unsafe.Pointer(_aOp + 4)) = _memId + int32(1)\n\t*(*int32)(unsafe.Pointer((_aOp + 24) + 8)) = _memId + int32(1)\n\t*(*int32)(unsafe.Pointer((_aOp + 48) + 4)) = _memId - int32(1)\n\t*(*int32)(unsafe.Pointer((_aOp + 48) + 12)) = _iRec\n\t*(*int32)(unsafe.Pointer((_aOp + 72) + 8)) = _iRec\n\t*(*int32)(unsafe.Pointer((_aOp + 72) + 12)) = _memId + int32(1)\n\t*(*uint16)(unsafe.Pointer((_aOp + 72) + 2)) = uint16(0x8)\n\t_1563sqlite3ReleaseTempReg(tls, _pParse, _iRec)\n\t_p = *(*uintptr)(unsafe.Pointer(_p))\n\tgoto _1\n\n_3:\n}", "title": "" }, { "docid": "2e148d2c4151b9026a87697d29b990ea", "score": "0.5141948", "text": "func (r *Replica) nextFilesystemId() tree.Filesystem {\n\tr.filesystemIdCounter++\n\treturn r.filesystemIdCounter\n}", "title": "" }, { "docid": "5a40f486b5dd1187ad59ad303d5b9072", "score": "0.51407397", "text": "func (inf Inferno) UniqueID() int64 {\n\treturn inf.uniqueID\n}", "title": "" }, { "docid": "181e0cb71b527e2c8e45ccbfcc847826", "score": "0.513142", "text": "func NextID(e Entity) CID {\n\tidMutex.Lock()\n\thighestID++\n\tcallers = append(callers, e)\n\tid := highestID\n\tidMutex.Unlock()\n\treturn id\n}", "title": "" }, { "docid": "f3360f6a53aa56fbc78d688d0ec3881b", "score": "0.5124475", "text": "func GenerateIDString() string {\n\treturn defaultGenerator.GetString()\n}", "title": "" }, { "docid": "dc1a38befc68f23cb4eb801744bd7f44", "score": "0.5121373", "text": "func (idx *indexer) genNextSessionId(\n\tstreamId common.StreamId,\n\tkeyspaceId string) uint64 {\n\n\tvar sid uint64\n\tvar ok bool\n\n\tif sid, ok = idx.streamKeyspaceIdSessionId[streamId][keyspaceId]; ok {\n\t\tsid++\n\t} else {\n\t\tsid = 1 //start with 1\n\t}\n\tidx.streamKeyspaceIdSessionId[streamId][keyspaceId] = sid\n\treturn sid\n}", "title": "" }, { "docid": "8fb01f8d8db7e008f931a404a5212f8a", "score": "0.51162726", "text": "func nextAvailableFileID(dataDir string) (string, error) {\n\tvar err error\n\tvar fileID int\n\tvar fileIDs []int\n\tvar lastFileID int\n\tvar nextFileID string\n\tvar strFileID string\n\n\tfor _, strFileID = range fileIDsInDataDir(dataDir) {\n\t\tif fileID, err = strconv.Atoi(strFileID); err != nil {\n\t\t\treturn \"\", errors.New(\"(nextAvailableFileID) error doing strconv.Atoi \" + err.Error())\n\t\t}\n\n\t\tfileIDs = append(fileIDs, fileID)\n\t}\n\n\tif len(fileIDs) == 0 {\n\t\tnextFileID = \"1\"\n\t} else {\n\t\tsort.Ints(fileIDs)\n\t\tlastFileID = fileIDs[len(fileIDs)-1]\n\n\t\tnextFileID = strconv.Itoa(lastFileID + 1)\n\t}\n\n\treturn nextFileID, nil\n}", "title": "" }, { "docid": "68c7ca89e6656e8964f87f4cf09cde00", "score": "0.51061785", "text": "func (uc *IdCounter) NextInt() uint64 {\n\treturn atomic.AddUint64(&uc.count, 1)\n}", "title": "" }, { "docid": "9be9e94a1bf4166c1d1a439c3eab523c", "score": "0.50982815", "text": "func (this *IdGen) GenId() int64 {\n\tthis.m.Lock()\n\tdefer this.m.Unlock()\n\tid := int64(0)\n\tfor {\n\t\tid = time.Now().UnixNano() / 10000000\n\t\t// if overflow, sleep 100 millsec\n\t\tif (int64(this.cnt)&IdGenCntMask == 0) && id == this.lastTimeMillS {\n\t\t\t<-time.After(time.Microsecond * 100)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tthis.lastTimeMillS = id\n\tid = (id << IdGenTimeOffset) | ((this.servId << IdGenServOffset) & IdGenServMask) | (int64(this.cnt) & IdGenCntMask)\n\tthis.cnt = this.cnt + 1\n\treturn id\n}", "title": "" }, { "docid": "819b369754f0cad89a91d4cd734aa242", "score": "0.5087835", "text": "func (mysql MySQL) GetNextAgreement() (string, error) {\n\tvar lastAgreement string\n\terr := mysql.db.QueryRow(`SELECT MAX(agreement) FROM users`).Scan(&lastAgreement)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot select max agreement: %v\", err)\n\t}\n\n\tagreementParts := strings.Split(lastAgreement, \"-\")\n\tagreementID, err := strconv.Atoi(agreementParts[1])\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot convert agreement from string to int: %v\", err)\n\t}\n\n\tagreementID += 1\n\treturn fmt.Sprintf(\"%v-%03d\", agreementParts[0], agreementID), nil\n}", "title": "" }, { "docid": "96e4f98c4d0d60c7f7edc19974bcd096", "score": "0.50772136", "text": "func GenerateSessionID() string {\n\trandStr := randStringBytesMaskImprSrc(3)\n\tnowtime := time.Now().Format(\".999\")\n\treturn randStr + nowtime\n}", "title": "" } ]
4f486f189cb143e96fd456dab5c2bb29
UESecurityCapability 9.11.3.54 EEA4 Row, sBit, len = [2, 2], 4 , 1
[ { "docid": "444628ee261f81a90ad498e2203040f0", "score": "0.5029631", "text": "func (a *UESecurityCapability) SetEEA4(eEA4 uint8) {}", "title": "" } ]
[ { "docid": "d70987e56b5b04a847aa8820eb9e9aa6", "score": "0.5778151", "text": "func opcode0xCB4E(c *CPU) int {\n\tc.bit(1, c.memory.Read(c.getHL()))\n\treturn 14\n}", "title": "" }, { "docid": "2877f8232861f339908e3058e9ffbbaf", "score": "0.57606304", "text": "func (a *UESecurityCapability) GetEEA4() (eEA4 uint8) {}", "title": "" }, { "docid": "37864ccf775fc21e30f36d788e062e6d", "score": "0.569504", "text": "func (a *ReplayedUESecurityCapabilities) GetEEA4() (eEA4 uint8) {}", "title": "" }, { "docid": "48e468673ed30c90cc12618d822343ba", "score": "0.565217", "text": "func (a *UESecurityCapability) GetEIA4() (eIA4 uint8) {}", "title": "" }, { "docid": "86d6bca2fe21e86d88894d837a6f0a52", "score": "0.55719256", "text": "func (a *ReplayedUESecurityCapabilities) GetEIA4() (eIA4 uint8) {}", "title": "" }, { "docid": "a3e1974d89bf032e116b04f4c68f166c", "score": "0.5560262", "text": "func (a *ReplayedUESecurityCapabilities) GetEEA7() (eEA7 uint8) {}", "title": "" }, { "docid": "b2a65a72eed6c845b5db45355ef0ab7a", "score": "0.55341244", "text": "func (a *UESecurityCapability) GetEEA6() (eEA6 uint8) {}", "title": "" }, { "docid": "6bf5eba0671a41435a95a84e68702f43", "score": "0.55290633", "text": "func (a *UESecurityCapability) GetEEA7() (eEA7 uint8) {}", "title": "" }, { "docid": "106e6aea36c6624e368150557dd8b489", "score": "0.5454555", "text": "func (a *ReplayedUESecurityCapabilities) GetEEA6() (eEA6 uint8) {}", "title": "" }, { "docid": "f1765763ee154aa8f3eeb9f45a2b5bb2", "score": "0.5453577", "text": "func (a *UESecurityCapability) GetLen() (len uint8) {}", "title": "" }, { "docid": "0051420b58b197214636311bb6c48b98", "score": "0.5373822", "text": "func opcode0xCB6E(c *CPU) int {\n\tc.bit(5, c.memory.Read(c.getHL()))\n\treturn 14\n}", "title": "" }, { "docid": "3989a27aafb2adb2072cec6060939d6f", "score": "0.5358709", "text": "func (a *UESecurityCapability) GetEEA5() (eEA5 uint8) {}", "title": "" }, { "docid": "bcb3f683a6065b30678277ac70bb637d", "score": "0.5350062", "text": "func (a *UESecurityCapability) GetEA4_5G() (eA4_5G uint8) {}", "title": "" }, { "docid": "cc33d02782dbb628823d0cba6b49256c", "score": "0.5335559", "text": "func (a *ReplayedUESecurityCapabilities) GetEA4_5G() (eA4_5G uint8) {}", "title": "" }, { "docid": "8b590a4c9b4a936eaa8c867a82858bbc", "score": "0.53283674", "text": "func (a *S1UENetworkCapability) GetEEA4() (eEA4 uint8) {\n\treturn a.Buffer[0] & GetBitMask(4, 3) >> (3)\n}", "title": "" }, { "docid": "1585e9a7e901cf39a9da57248a92331e", "score": "0.53217185", "text": "func (a *ReplayedUESecurityCapabilities) GetLen() (len uint8) {}", "title": "" }, { "docid": "6c1319cc6e9825fd86e772d93dec7d69", "score": "0.5297374", "text": "func (a *ReplayedUESecurityCapabilities) GetEEA5() (eEA5 uint8) {}", "title": "" }, { "docid": "24eb9bae2175fb394ab84277059fb83c", "score": "0.528917", "text": "func opcode0xCB7E(c *CPU) int {\n\tc.bit(7, c.memory.Read(c.getHL()))\n\treturn 14\n}", "title": "" }, { "docid": "69db535e9ce132fb3435d4ccc86273d9", "score": "0.5262495", "text": "func (a *UESecurityCapability) GetEIA5() (eIA5 uint8) {}", "title": "" }, { "docid": "dc7eb2fa7e1b6efe385cd620d602a07e", "score": "0.5253184", "text": "func (a *UESecurityCapability) GetEIA6() (eIA6 uint8) {}", "title": "" }, { "docid": "ab76743ff4fb8136bee6d2b486e3a2e2", "score": "0.5249222", "text": "func (a *ReplayedUESecurityCapabilities) GetEIA7() (eIA7 uint8) {}", "title": "" }, { "docid": "9a40c04dead137af9f1df1dd43c51645", "score": "0.5219461", "text": "func opcode0xCB5E(c *CPU) int {\n\tc.bit(3, c.memory.Read(c.getHL()))\n\treturn 14\n}", "title": "" }, { "docid": "56765d10c26059e0290af1ee720452b6", "score": "0.52161014", "text": "func (a *ReplayedUESecurityCapabilities) GetEA7_5G() (eA7_5G uint8) {}", "title": "" }, { "docid": "5ea25cc3ce4257653a8da443e30b239b", "score": "0.52026534", "text": "func (a *UESecurityCapability) GetEIA7() (eIA7 uint8) {}", "title": "" }, { "docid": "7747d2a7b20acd5ec5c06b6b2350f4d9", "score": "0.5188803", "text": "func (f *Frame) Row(number int) string{\n\nreturn f.Store[1+number]\n}", "title": "" }, { "docid": "6625223b4326abf925afee42f86c4888", "score": "0.5182674", "text": "func (a *S1UENetworkCapability) GetUEA4() (uEA4 uint8) {\n\treturn a.Buffer[2] & GetBitMask(4, 3) >> (3)\n}", "title": "" }, { "docid": "645cfc7bb86eee364deef43469767826", "score": "0.5182297", "text": "func (a *ReplayedUESecurityCapabilities) GetEIA5() (eIA5 uint8) {}", "title": "" }, { "docid": "8be04356afb6046747e5d9883226f8a1", "score": "0.51814944", "text": "func (a *S1UENetworkCapability) GetEIA4() (eIA4 uint8) {\n\treturn a.Buffer[1] & GetBitMask(4, 3) >> (3)\n}", "title": "" }, { "docid": "dc930b06a54605cdd8f0d9e1e35c6431", "score": "0.51708317", "text": "func (a *ReplayedUESecurityCapabilities) GetEIA6() (eIA6 uint8) {}", "title": "" }, { "docid": "2139b904b0c2aec29f38bd0f450b8f02", "score": "0.5169472", "text": "func (a *UESecurityCapability) GetEA7_5G() (eA7_5G uint8) {}", "title": "" }, { "docid": "7881ded4876d6ffb3574314cf1dc85c3", "score": "0.5115962", "text": "func opcode0xCB4A(c *CPU) int {\n\tc.bit(1, c.d)\n\treturn 4\n}", "title": "" }, { "docid": "40129ebb90bf0978636120daa55a6d74", "score": "0.50929487", "text": "func (a *ReplayedUESecurityCapabilities) GetSpare() (spare [4]uint8) {}", "title": "" }, { "docid": "6438269f0027247730baba3ba782ba79", "score": "0.50926507", "text": "func (a *ReplayedUESecurityCapabilities) GetEEA0() (eEA0 uint8) {}", "title": "" }, { "docid": "ed4c34eb7f32d61d7a3ee87454bc1c6a", "score": "0.50920266", "text": "func (a *UESecurityCapability) GetEA6_5G() (eA6_5G uint8) {}", "title": "" }, { "docid": "826164ce6437579195076e084b2db459", "score": "0.50847954", "text": "func (a *UESecurityCapability) GetEEA0() (eEA0 uint8) {}", "title": "" }, { "docid": "542232cd5abc435a7eda204bed24a847", "score": "0.50779736", "text": "func (a *ReplayedUESecurityCapabilities) GetEA6_5G() (eA6_5G uint8) {}", "title": "" }, { "docid": "ab2dcd8f498a19b3fe7f90fc7779c89b", "score": "0.50665826", "text": "func opcode0xCB6A(c *CPU) int {\n\tc.bit(5, c.d)\n\treturn 4\n}", "title": "" }, { "docid": "419512071a056b1b7350d28c5a2ce479", "score": "0.50268304", "text": "func (fsp *FieldSpecifier) Len() uint16 {\n\tif fsp.E {\n\t\treturn 8 //If the Enterprise Bit is set, we have to add the Enterprise Number\n\t}\n\treturn 4\n}", "title": "" }, { "docid": "39aec5c833aa10abe646f60e36fc705b", "score": "0.50261647", "text": "func (a *ReplayedUESecurityCapabilities) GetEA0_5G() (eA0_5G uint8) {}", "title": "" }, { "docid": "11e5b0182a8d533f9d77f0dacb66ea64", "score": "0.50144726", "text": "func opcode0xCB55(c *CPU) int {\n\tc.bit(2, c.l)\n\treturn 4\n}", "title": "" }, { "docid": "e2cd76ffb5f54ea1f7c10fd06fac1aab", "score": "0.50036156", "text": "func opcode0xCB7A(c *CPU) int {\n\tc.bit(7, c.d)\n\treturn 4\n}", "title": "" }, { "docid": "a108290c7096eb176ccd4d11edca95b2", "score": "0.5000814", "text": "func (a *UESecurityCapability) GetEA0_5G() (eA0_5G uint8) {}", "title": "" }, { "docid": "768ff51f2d7e72656e2ee6156b0e47c2", "score": "0.49860904", "text": "func (a *ReplayedUESecurityCapabilities) GetEA5_5G() (eA5_5G uint8) {}", "title": "" }, { "docid": "3ecd164bb02ebd58f77ce4bd4a95a881", "score": "0.49723667", "text": "func (a *UESecurityCapability) GetEA5_5G() (eA5_5G uint8) {}", "title": "" }, { "docid": "fddac8ccfae829df6e789a6599b928da", "score": "0.49690843", "text": "func opcode0xCB6D(c *CPU) int {\n\tc.bit(5, c.l)\n\treturn 4\n}", "title": "" }, { "docid": "d9ad104f31765c63f46af1611f3ccd8e", "score": "0.4961015", "text": "func (a *ReplayedUESecurityCapabilities) SetEEA4(eEA4 uint8) {}", "title": "" }, { "docid": "7197b45ac2be37c64962b7bf9a3aa3e6", "score": "0.49437228", "text": "func (a *S1UENetworkCapability) GetEEA6() (eEA6 uint8) {\n\treturn a.Buffer[0] & GetBitMask(2, 1) >> (1)\n}", "title": "" }, { "docid": "41b1697465071a2f12d31f8388505281", "score": "0.49411246", "text": "func opcode0xCB9E(c *CPU) int {\n\taddr := c.getHL()\n\tvalue := c.memory.Read(addr)\n\tc.res(3, &value)\n\tc.memory.Write(addr, value)\n\treturn 16\n}", "title": "" }, { "docid": "02be37bcbfde16198a7866886c3229ca", "score": "0.49382052", "text": "func opcode0xCB5A(c *CPU) int {\n\tc.bit(3, c.d)\n\treturn 4\n}", "title": "" }, { "docid": "92a8fce56d8bc09ec382596174994c88", "score": "0.49257126", "text": "func (a *UESecurityCapability) SetLen(len uint8) {}", "title": "" }, { "docid": "5c96e21620bbdc99693735aefccaeabf", "score": "0.49195927", "text": "func (a *UESecurityCapability) GetSpare() (spare [4]uint8) {}", "title": "" }, { "docid": "b19b80877f9ae39e92c23f33973a0436", "score": "0.49191114", "text": "func (a *ReplayedUESecurityCapabilities) GetEA1_128_5G() (eA1_128_5G uint8) {}", "title": "" }, { "docid": "50569de1fadf1f43fec4fc2fe66da090", "score": "0.49037412", "text": "func (a *ReplayedUESecurityCapabilities) GetIA4_5G() (iA4_5G uint8) {}", "title": "" }, { "docid": "c98ba07c40f04ede7ef2d2aec056f090", "score": "0.4903734", "text": "func opcode0xCB75(c *CPU) int {\n\tc.bit(6, c.l)\n\treturn 4\n}", "title": "" }, { "docid": "22b1a8e0842ef20923e41be2dac1527c", "score": "0.4902914", "text": "func get4(b []byte) int {\n\tif len(b) < 4 {\n\t\treturn 0\n\t}\n\treturn int(b[0]) | int(b[1])<<8 | int(b[2])<<16 | int(b[3])<<24\n}", "title": "" }, { "docid": "22b1a8e0842ef20923e41be2dac1527c", "score": "0.4902914", "text": "func get4(b []byte) int {\n\tif len(b) < 4 {\n\t\treturn 0\n\t}\n\treturn int(b[0]) | int(b[1])<<8 | int(b[2])<<16 | int(b[3])<<24\n}", "title": "" }, { "docid": "ac084235d9bfba9cf2cb245db3a628b4", "score": "0.4895461", "text": "func (a *S1UENetworkCapability) GetEEA7() (eEA7 uint8) {\n\treturn a.Buffer[0] & GetBitMask(1, 0)\n}", "title": "" }, { "docid": "ced42b294f5886647a4c2fadde09d051", "score": "0.4892797", "text": "func getRow(x int) int {\n\treturn (x / 8) + 1\n}", "title": "" }, { "docid": "96b8dc4112ed7e8b82b443f4274751a5", "score": "0.48862636", "text": "func (a *ReplayedUESecurityCapabilities) GetEA3_128_5G() (eA3_128_5G uint8) {}", "title": "" }, { "docid": "1a0d330e271da57c7d2afa0b2c0a50a3", "score": "0.4885252", "text": "func opcode0xCB8E(c *CPU) int {\n\taddr := c.getHL()\n\tvalue := c.memory.Read(addr)\n\tc.res(1, &value)\n\tc.memory.Write(addr, value)\n\treturn 16\n}", "title": "" }, { "docid": "723d21b2fd94dfc752348a842ec02e9a", "score": "0.48828647", "text": "func opcode0xCB4D(c *CPU) int {\n\tc.bit(1, c.l)\n\treturn 4\n}", "title": "" }, { "docid": "027e67fc76e1ca993068a5a503eea152", "score": "0.48809925", "text": "func (a *ReplayedUESecurityCapabilities) SetLen(len uint8) {}", "title": "" }, { "docid": "aee8079284db68fb84c4bddcb3e3dac7", "score": "0.48754594", "text": "func (a *UESecurityCapability) GetIA4_5G() (iA4_5G uint8) {}", "title": "" }, { "docid": "c0a51425222bac14044e6a28284a7157", "score": "0.48732895", "text": "func (a *S1UENetworkCapability) SetEEA4(eEA4 uint8) {\n\ta.Buffer[0] = (a.Buffer[0] & 247) + ((eEA4 & 1) << 3)\n}", "title": "" }, { "docid": "f8ff221d117c9892c25bf4614d16b667", "score": "0.48691243", "text": "func opcode0xCB44(c *CPU) int {\n\tc.bit(0, c.h)\n\treturn 4\n}", "title": "" }, { "docid": "c836dad694441650c64ddc57911c8e17", "score": "0.4863335", "text": "func opcode0xCB7D(c *CPU) int {\n\tc.bit(7, c.l)\n\treturn 4\n}", "title": "" }, { "docid": "564b17065df333fc0460c0f0eed6c7cf", "score": "0.48607728", "text": "func (a *AIP1640Driver) DrawRow(row, data byte) {\n\tif row >= 8 {\n\t\treturn\n\t}\n\ta.buffer[7-row] = data\n}", "title": "" }, { "docid": "c924aafdb386af0da9a6dbe14319054d", "score": "0.48553783", "text": "func (a *S1UENetworkCapability) GetEEA5() (eEA5 uint8) {\n\treturn a.Buffer[0] & GetBitMask(3, 2) >> (2)\n}", "title": "" }, { "docid": "6e47aae33611e25efa5b61d6962faa66", "score": "0.48545456", "text": "func (a *UESecurityCapability) SetEIA4(eIA4 uint8) {}", "title": "" }, { "docid": "bc9f2fd51f2b5c14e96333d355f34ad9", "score": "0.4852243", "text": "func opcode0xCB57(c *CPU) int {\n\tc.bit(2, c.a)\n\treturn 4\n}", "title": "" }, { "docid": "88692084447c2a150c92bd256055850f", "score": "0.48494133", "text": "func (a *UESecurityCapability) GetEA1_128_5G() (eA1_128_5G uint8) {}", "title": "" }, { "docid": "e4a7fe97a46cefc143d02d4a8b729e9e", "score": "0.48330972", "text": "func opcode0xCB4C(c *CPU) int {\n\tc.bit(1, c.h)\n\treturn 4\n}", "title": "" }, { "docid": "b8b1a702ae130530590711cbdd68e1bc", "score": "0.48314857", "text": "func (a *ReplayedUESecurityCapabilities) GetEA2_128_5G() (eA2_128_5G uint8) {}", "title": "" }, { "docid": "6262c6420a4d64687a8709aeb03ee163", "score": "0.4822465", "text": "func (a *ReplayedUESecurityCapabilities) GetIA7_5G() (iA7_5G uint8) {}", "title": "" }, { "docid": "8a289492b6cf334961d82433c2e4f2eb", "score": "0.481679", "text": "func (a *UESecurityCapability) GetEIA0() (eIA0 uint8) {}", "title": "" }, { "docid": "23d0e0f9defe78b3ad557df231eea723", "score": "0.48150924", "text": "func opcode0xCB4B(c *CPU) int {\n\tc.bit(1, c.e)\n\treturn 4\n}", "title": "" }, { "docid": "fb55c46236d9384dc5806ba855726de1", "score": "0.48131645", "text": "func opcode0xCB43(c *CPU) int {\n\tc.bit(0, c.e)\n\treturn 4\n}", "title": "" }, { "docid": "d1ff15671c3e032806c43845eb35f75e", "score": "0.4799483", "text": "func (a *S1UENetworkCapability) GetEIA5() (eIA5 uint8) {\n\treturn a.Buffer[1] & GetBitMask(3, 2) >> (2)\n}", "title": "" }, { "docid": "378aa1907de7b09c84163178245e845c", "score": "0.47990543", "text": "func (a *S1UENetworkCapability) SetUEA4(uEA4 uint8) {\n\ta.Buffer[2] = (a.Buffer[2] & 247) + ((uEA4 & 1) << 3)\n}", "title": "" }, { "docid": "c43d39597eb201879eccbd143504b292", "score": "0.4793461", "text": "func (a *UESecurityCapability) GetEA3_128_5G() (eA3_128_5G uint8) {}", "title": "" }, { "docid": "7574cb500da3bbb2ff8405282a3c6d2d", "score": "0.47918358", "text": "func (a *S1UENetworkCapability) SetEIA4(eIA4 uint8) {\n\ta.Buffer[1] = (a.Buffer[1] & 247) + ((eIA4 & 1) << 3)\n}", "title": "" }, { "docid": "466aa92ccc65a8c55c3eec3d44134dc5", "score": "0.4788987", "text": "func (a *S1UENetworkCapability) GetUEA5() (uEA5 uint8) {\n\treturn a.Buffer[2] & GetBitMask(3, 2) >> (2)\n}", "title": "" }, { "docid": "9e00438b6eeaf44ea89e86d477117c58", "score": "0.47889742", "text": "func (a *S1UENetworkCapability) GetUEA7() (uEA7 uint8) {\n\treturn a.Buffer[2] & GetBitMask(1, 0)\n}", "title": "" }, { "docid": "e218314544d44ad6cc118bbb2f01e44a", "score": "0.47851643", "text": "func (a *ReplayedUESecurityCapabilities) SetEIA4(eIA4 uint8) {}", "title": "" }, { "docid": "11e391d7c56f62f600154a5bfab43862", "score": "0.47825685", "text": "func (s Shape) IsRowVec() bool { return len(s) == 2 && (s[0] == 1 && s[1] > 1) }", "title": "" }, { "docid": "db9cba4134adf4313529478dbd38c4a2", "score": "0.47772843", "text": "func (a *ReplayedUESecurityCapabilities) GetEEA3_128() (eEA3_128 uint8) {}", "title": "" }, { "docid": "09d647ee6e3c87d4f40305199668cf5c", "score": "0.4776735", "text": "func (a *ReplayedUESecurityCapabilities) SetEEA7(eEA7 uint8) {}", "title": "" }, { "docid": "57a48c848cbd63933d3b482f5734bc22", "score": "0.4775134", "text": "func opcode0xCB5D(c *CPU) int {\n\tc.bit(3, c.l)\n\treturn 4\n}", "title": "" }, { "docid": "f9e51ebc93fed0cec68a2eccabef5ed6", "score": "0.47725374", "text": "func (c *Cell) Row() uint8 {\n\trow, _ := validateRow(c.Id)\n\treturn row\n}", "title": "" }, { "docid": "81b69fa582903a46bcc65947448be754", "score": "0.47652456", "text": "func (a *UESecurityCapability) GetEA2_128_5G() (eA2_128_5G uint8) {}", "title": "" }, { "docid": "56979d21ba6fb4b611cf9695f02bed10", "score": "0.47616524", "text": "func (a *UESecurityCapability) SetEEA7(eEA7 uint8) {}", "title": "" }, { "docid": "77aedb4cae4fe667087f9c6e88928c9b", "score": "0.47581282", "text": "func (a *ReplayedUESecurityCapabilities) GetEIA0() (eIA0 uint8) {}", "title": "" }, { "docid": "b4195404f9c678afe3f7cfd473865b82", "score": "0.47530115", "text": "func opcode0xCB42(c *CPU) int {\n\tc.bit(0, c.d)\n\treturn 4\n}", "title": "" }, { "docid": "a2206e03dd0847311bfa10b45acfe138", "score": "0.47517318", "text": "func (a *UESecurityCapability) SetEEA6(eEA6 uint8) {}", "title": "" }, { "docid": "44c76f05ddcbe13c60b48adffa6834dc", "score": "0.47457507", "text": "func (a *UESecurityCapability) GetIA7_5G() (iA7_5G uint8) {}", "title": "" }, { "docid": "4ad62e7f61ad20c3e9c3a7e24be5ca56", "score": "0.4738427", "text": "func opcode0xCB6B(c *CPU) int {\n\tc.bit(5, c.e)\n\treturn 4\n}", "title": "" }, { "docid": "50b6ea944e7d748e59bf54142c1735ba", "score": "0.47314712", "text": "func opcode0xCB41(c *CPU) int {\n\tc.bit(0, c.c)\n\treturn 4\n}", "title": "" }, { "docid": "5dd092dd7bb2e6a1275933e03335ed14", "score": "0.4729768", "text": "func (a *UESecurityCapability) GetEEA3_128() (eEA3_128 uint8) {}", "title": "" }, { "docid": "1f92eb39fec6e0f650cbb7923fc56b85", "score": "0.47185043", "text": "func (*SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_Lsdb_LsaTypes_LsaType_Lsas_Lsa_OpaqueLsa_ExtendedLink_LinkData_Union_Uint32) Is_SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_Lsdb_LsaTypes_LsaType_Lsas_Lsa_OpaqueLsa_ExtendedLink_LinkData_Union() {}", "title": "" }, { "docid": "cbe11313261a47c28d4b605555a9db1c", "score": "0.471831", "text": "func (a *S1UENetworkCapability) GetEIA6() (eIA6 uint8) {\n\treturn a.Buffer[1] & GetBitMask(2, 1) >> (1)\n}", "title": "" } ]
ced75fd6190bf585480d3e7b896aef7c
SetUserID sets the user edge to Physician by id.
[ { "docid": "edd070492ccd08bb3cdd85b026b08296", "score": "0.0", "text": "func (m *PositionassingmentMutation) SetUserID(id int) {\n\tm.user = &id\n}", "title": "" } ]
[ { "docid": "4bf719b2726f577e5f72bcee8c1711b5", "score": "0.67390406", "text": "func SetUserID(r *http.Request, id string) {\n\t*r = *r.WithContext(context.WithValue(r.Context(), UserIDKey, id))\n}", "title": "" }, { "docid": "1eee8dfe96beaabd90d856b8cac4e442", "score": "0.6377697", "text": "func (m *DirectRoutingLogRow) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a7c7b9aa89aa3fac231216a30735d346", "score": "0.6367347", "text": "func (tc *TokenCreate) SetUserID(id int) *TokenCreate {\n\tif tc.user == nil {\n\t\ttc.user = make(map[int]struct{})\n\t}\n\ttc.user[id] = struct{}{}\n\treturn tc\n}", "title": "" }, { "docid": "2f30bc77e9194a79dca44ec7d97c072f", "score": "0.6253312", "text": "func SetUserID(ctx context.Context, uid domain.UserID) context.Context {\n\treturn context.WithValue(ctx, ctxUserIDKey, uid)\n}", "title": "" }, { "docid": "a2fc65b252ee3e623dd7b21feabe09b3", "score": "0.61469007", "text": "func (usu *UserSessionUpdate) SetUserID(i int) *UserSessionUpdate {\n\tusu.mutation.ResetUserID()\n\tusu.mutation.SetUserID(i)\n\treturn usu\n}", "title": "" }, { "docid": "30f13a0ffe576c34addf37ad37a4d4d3", "score": "0.6135789", "text": "func (m *AccessReviewInstanceDecisionItemUserTarget) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5f3828990ec0b954b72ed4cc4146818f", "score": "0.61130106", "text": "func (pc *PersonCreate) SetUserID(id int) *PersonCreate {\n\tpc.mutation.SetUserID(id)\n\treturn pc\n}", "title": "" }, { "docid": "c813f8a8257ee0bb236a13c53385ac71", "score": "0.60905933", "text": "func (ic *InfoCreate) SetUserID(id int) *InfoCreate {\n\tic.mutation.SetUserID(id)\n\treturn ic\n}", "title": "" }, { "docid": "672641614418885b54985cdfc338e871", "score": "0.60872364", "text": "func (ac *ArticleCreate) SetUserID(id int) *ArticleCreate {\n\tif ac.user == nil {\n\t\tac.user = make(map[int]struct{})\n\t}\n\tac.user[id] = struct{}{}\n\treturn ac\n}", "title": "" }, { "docid": "5c6dbf51b393a66f573e247d68f635f0", "score": "0.60600543", "text": "func (m *IosVppAppAssignedLicense) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9182f366c2faf090a14e676018404d05", "score": "0.60585296", "text": "func (sc *SessionCreate) SetUserID(id int) *SessionCreate {\n\tsc.mutation.SetUserID(id)\n\treturn sc\n}", "title": "" }, { "docid": "01dde87bb024fa187576fca041a76f59", "score": "0.6015889", "text": "func (m *AadUserNotificationRecipient) SetUserId(value *string)() {\n m.userId = value\n}", "title": "" }, { "docid": "a1fac29a9e0776f28cfc7941202352d5", "score": "0.6014323", "text": "func (rc *RepairinvoiceCreate) SetUserid(i int) *RepairinvoiceCreate {\n\trc.mutation.SetUserid(i)\n\treturn rc\n}", "title": "" }, { "docid": "bb60492308ac5c1c1e60da8168889559", "score": "0.59953094", "text": "func (m *Model) SetUserid(value string) {\n\tm.setupNew()\n\tm.new.Userid = value\n}", "title": "" }, { "docid": "cac2fe7945bfa220b4b2c744d0a13503", "score": "0.598287", "text": "func (p *polar) SetUserID(id uint64) {\n\tp.userID = id\n}", "title": "" }, { "docid": "789e1d7700b592435083cb6e073f3338", "score": "0.5982177", "text": "func (u *User) setUserID(userID string) {\n\tif u.err != nil {\n\t\treturn\n\t}\n\tif err := CheckUserID(userID); err != nil {\n\t\tu.err = err\n\t\treturn\n\t}\n\tu.userID = userID\n}", "title": "" }, { "docid": "e78e14614589ed9139c7644f50cf40d4", "score": "0.59806633", "text": "func (tu *TokenUpdate) SetUserID(id int) *TokenUpdate {\n\tif tu.user == nil {\n\t\ttu.user = make(map[int]struct{})\n\t}\n\ttu.user[id] = struct{}{}\n\treturn tu\n}", "title": "" }, { "docid": "b74b2461da3562c69cfed39fc785864a", "score": "0.5971217", "text": "func (usuo *UserSessionUpdateOne) SetUserID(i int) *UserSessionUpdateOne {\n\tusuo.mutation.ResetUserID()\n\tusuo.mutation.SetUserID(i)\n\treturn usuo\n}", "title": "" }, { "docid": "8937fc3071a0235337c403424ae843ed", "score": "0.5963204", "text": "func (m *MicrosoftAccountUserConversationMember) SetUserId(value *string)() {\n m.userId = value\n}", "title": "" }, { "docid": "98c6fcbd68f59c04ecaea39e593fe1a6", "score": "0.5941873", "text": "func (m *LearningAssignment) SetAssignerUserId(value *string)() {\n err := m.GetBackingStore().Set(\"assignerUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "201d2661ebc745e937c4664edc99e0db", "score": "0.593005", "text": "func (m *ManagedAppRegistration) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f283cb8963d4c305d0256ae1fa7dfc2c", "score": "0.5910616", "text": "func (tuo *TokenUpdateOne) SetUserID(id int) *TokenUpdateOne {\n\tif tuo.user == nil {\n\t\ttuo.user = make(map[int]struct{})\n\t}\n\ttuo.user[id] = struct{}{}\n\treturn tuo\n}", "title": "" }, { "docid": "b46e1abfb4b4e4821fddfe709ce56c17", "score": "0.5877259", "text": "func (m *SignIn) SetUserId(value *string)() {\n m.userId = value\n}", "title": "" }, { "docid": "1ae67ff832babd70bb02a2525798f5f0", "score": "0.586269", "text": "func (p *User) SetID(id int64) { p.ID = id }", "title": "" }, { "docid": "482f7554e2cf5f1b27ef686d2d8cd4ce", "score": "0.583845", "text": "func (kuo *KeyUpdateOne) SetUserID(id int) *KeyUpdateOne {\n\tkuo.mutation.SetUserID(id)\n\treturn kuo\n}", "title": "" }, { "docid": "ebfe9ce75e6bdfda250e813a7ac8ffca", "score": "0.5776545", "text": "func (uac *UserAccountCreate) SetUserID(id int) *UserAccountCreate {\n\tif uac.user == nil {\n\t\tuac.user = make(map[int]struct{})\n\t}\n\tuac.user[id] = struct{}{}\n\treturn uac\n}", "title": "" }, { "docid": "795a8df201d3e0b4d831b226a9af1cd8", "score": "0.57753843", "text": "func (m *ComanagementEligibleDevice) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8cae6fa107e31801c80fca1ca1b2dd0c", "score": "0.57559365", "text": "func (m *SignIn) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7d7b119084e44140bec4e7a1f4ab0976", "score": "0.57511413", "text": "func (c *Client) AssignUserID(userID, clusterName string, opts ...interface{}) (res AssignUserIDRes, err error) {\n\topts = opt.InsertExtraHeader(opts, \"X-Algolia-User-ID\", userID)\n\tbody := map[string]string{\"cluster\": clusterName}\n\terr = c.transport.Request(&res, http.MethodPost, \"/1/clusters/mapping\", body, call.Write, opts...)\n\treturn\n}", "title": "" }, { "docid": "bc208e2b8aefb892b39e923e66efec10", "score": "0.5747805", "text": "func (tuo *TimerUpdateOne) SetUserid(s string) *TimerUpdateOne {\n\ttuo.mutation.SetUserid(s)\n\treturn tuo\n}", "title": "" }, { "docid": "4a155f874e3e7c11438aeb42be19ac18", "score": "0.57457924", "text": "func (rb *RuleBuilder) UserID(userID uint) *RuleBuilder {\n\trb.rule.UserID = &userID\n\treturn rb\n}", "title": "" }, { "docid": "1abb8bfc2b811ffcfef297c80e9c35bc", "score": "0.57194227", "text": "func (rc *RegistrarCreate) SetUserID(id int) *RegistrarCreate {\n\trc.mutation.SetUserID(id)\n\treturn rc\n}", "title": "" }, { "docid": "fbe14df3572ed12b8647d7e690f688e3", "score": "0.57177573", "text": "func (ku *KeyUpdate) SetUserID(id int) *KeyUpdate {\n\tku.mutation.SetUserID(id)\n\treturn ku\n}", "title": "" }, { "docid": "7e755e33ea238b0016a6ebdf1790117b", "score": "0.5675598", "text": "func (uc *UserCreate) SetUserID(i int) *UserCreate {\n\tuc.mutation.SetUserID(i)\n\treturn uc\n}", "title": "" }, { "docid": "ef1939ae4ee0d32bb08bb3b837136821", "score": "0.5657223", "text": "func (m *ManagedTenantAlert) SetAssignedToUserId(value *string)() {\n err := m.GetBackingStore().Set(\"assignedToUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1746d30675444a70cdcab7f342605605", "score": "0.5653272", "text": "func (tu *TimerUpdate) SetUserid(s string) *TimerUpdate {\n\ttu.mutation.SetUserid(s)\n\treturn tu\n}", "title": "" }, { "docid": "968d0038ec9aa9448a807981af811981", "score": "0.5648421", "text": "func (uimc *UserIDMappingCreate) SetUserID(id int) *UserIDMappingCreate {\n\tuimc.mutation.SetUserID(id)\n\treturn uimc\n}", "title": "" }, { "docid": "5765b7bd8e2ce83fb5139a1c24e5e9b9", "score": "0.5647187", "text": "func (s *span) setUser(id string, cfg UserMonitoringConfig) {\n\ttrace := s.context.trace\n\ts.Lock()\n\tdefer s.Unlock()\n\tif cfg.propagateID {\n\t\t// Delete usr.id from the tags since _dd.p.usr.id takes precedence\n\t\tdelete(s.Meta, keyUserID)\n\t\tidenc := base64.StdEncoding.EncodeToString([]byte(id))\n\t\ttrace.setPropagatingTag(keyPropagatedUserID, idenc)\n\t} else {\n\t\t// Unset the propagated user ID so that a propagated user ID coming from upstream won't be propagated anymore.\n\t\ttrace.unsetPropagatingTag(keyPropagatedUserID)\n\t\tdelete(s.Meta, keyPropagatedUserID)\n\t\t// setMeta is used since the span is already locked\n\t\ts.setMeta(keyUserID, id)\n\t}\n\tfor k, v := range map[string]string{\n\t\tkeyUserEmail: cfg.email,\n\t\tkeyUserName: cfg.name,\n\t\tkeyUserScope: cfg.scope,\n\t\tkeyUserRole: cfg.role,\n\t\tkeyUserSessionID: cfg.sessionID,\n\t} {\n\t\tif v != \"\" {\n\t\t\ts.setMeta(k, v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b6ff49d26efad2dcb939bb6a87c0ee9c", "score": "0.56256694", "text": "func (n *TxNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "5762949b8647007d06658aa1c3ed0757", "score": "0.5592125", "text": "func (uauo *UserAccountUpdateOne) SetUserID(id int) *UserAccountUpdateOne {\n\tif uauo.user == nil {\n\t\tuauo.user = make(map[int]struct{})\n\t}\n\tuauo.user[id] = struct{}{}\n\treturn uauo\n}", "title": "" }, { "docid": "adea115c8ae624b075ae40636ae009b2", "score": "0.5586629", "text": "func (n *TxMinedNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "0d3ee8c0621ac875e80b62f1c85b6691", "score": "0.5564507", "text": "func (myPermission *Permission) SetUserID(val string) {\n\tmyPermission.UserIDvar = val\n}", "title": "" }, { "docid": "0e8a7b252ccb631952f6c3462bf00154", "score": "0.55606157", "text": "func (pc *ProjectCreate) SetUserID(id int) *ProjectCreate {\n\tpc.mutation.SetUserID(id)\n\treturn pc\n}", "title": "" }, { "docid": "ac2dbd391c89d879e9557b80f10a70b8", "score": "0.5553234", "text": "func SetCtxUserID(ctx context.Context, v *uuid.UUID) context.Context {\n\treturn context.WithValue(ctx, ctxKeyUserID, v)\n}", "title": "" }, { "docid": "3de7ea45ce19111b355f22df1c5e64cf", "score": "0.5536265", "text": "func AssignUserToVendor(vendorID, userID uuid.UUID, tx *pop.Connection) error {\n\t// Create the initial model\n\tlink := models.VendorUser{\n\t\tVendorID: vendorID,\n\t\tUserID: userID,\n\t}\n\n\t// Get the macaroon from the vendor\n\tvendor := models.Vendor{}\n\n\terr := tx.Select(\"macaroon\").Where(\"id = ?\",\n\t\tvendorID.String()).First(&vendor)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Generate the delegating Macaroon\n\tm, err := macaroons.MacaroonFromBytes(vendor.Macaroon)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add the caveats\n\tuserId := fmt.Sprintf(\"user_id= %s\", userID.String())\n\t// Use a third party caveat, because we need to have other APIs verify the user list.\n\n\tverifyString := fmt.Sprintf(\"http://localhost:8080/api/vendors/%s/verify\", vendorID.String())\n\tdelegated, err := vs.AddThirdPartyCaveat(m, verifyString, []string{userId})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdBinary, err := delegated.M().MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlink.Macaroon = dBinary\n\n\treturn tx.Save(&link)\n}", "title": "" }, { "docid": "20c730b87900d9e45ee7e18fb010ffca", "score": "0.5503286", "text": "func (r *Repo) SetUserID(v int64) {\n\t// return if Repo type is nil\n\tif r == nil {\n\t\treturn\n\t}\n\n\tr.UserID = &v\n}", "title": "" }, { "docid": "24847a05b950a92102819216b4a5588b", "score": "0.54883236", "text": "func (_HoQuStorage *HoQuStorageTransactor) SetUser(opts *bind.TransactOpts, id [16]byte, role string, ownerAddress common.Address, kycLevel uint8, pubKey string, status uint8) (*types.Transaction, error) {\n\treturn _HoQuStorage.contract.Transact(opts, \"setUser\", id, role, ownerAddress, kycLevel, pubKey, status)\n}", "title": "" }, { "docid": "df6276dfeb02bf56dbb8ffb38508394c", "score": "0.5479641", "text": "func (o *DMember) SetUser(exec boil.Executor, insert bool, related *DUser) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"d_members\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"user_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, dMemberPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.UserID, o.GuildID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.UserID = related.ID\n\n\tif o.R == nil {\n\t\to.R = &dMemberR{\n\t\t\tUser: related,\n\t\t}\n\t} else {\n\t\to.R.User = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &dUserR{\n\t\t\tUserDMembers: DMemberSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.UserDMembers = append(related.R.UserDMembers, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7066519ecb47cc273b9201a07ee70a20", "score": "0.547566", "text": "func (t *UserMapping) SetUserID(v string) {\n\tt.UserID = v\n}", "title": "" }, { "docid": "3af5c3add6a114e34eb19bfd5d9a0d52", "score": "0.5459261", "text": "func (uau *UserAccountUpdate) SetUserID(id int) *UserAccountUpdate {\n\tif uau.user == nil {\n\t\tuau.user = make(map[int]struct{})\n\t}\n\tuau.user[id] = struct{}{}\n\treturn uau\n}", "title": "" }, { "docid": "a4395cf3d58e52305c3597f4a1698727", "score": "0.5451752", "text": "func (m *TimerClientMutation) SetUserid(s string) {\n\tm.userid = &s\n}", "title": "" }, { "docid": "9bff518693abefd64cebb24ef25ab0d3", "score": "0.5444389", "text": "func (m *ScholarshipRequestMutation) SetUserID(id int) {\n\tm._User = &id\n}", "title": "" }, { "docid": "1d47c8e5faf9c5a5ff253325d6a615f9", "score": "0.54306394", "text": "func (pvc *PlaylistVideoCreate) SetUserID(id int) *PlaylistVideoCreate {\n\tpvc.mutation.SetUserID(id)\n\treturn pvc\n}", "title": "" }, { "docid": "d3992c8f2938bbcd0094eb8a5eee4a28", "score": "0.542974", "text": "func (n *AllTxNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "b0682cb0e0121fc2204fe5c6b72821f3", "score": "0.5429424", "text": "func (o *Friendship) SetUser(exec boil.Executor, insert bool, related *User) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"friendships\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"user_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, friendshipPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.UserID.Int = related.ID\n\to.UserID.Valid = true\n\n\tif o.R == nil {\n\t\to.R = &friendshipR{\n\t\t\tUser: related,\n\t\t}\n\t} else {\n\t\to.R.User = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &userR{\n\t\t\tFriendships: FriendshipSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.Friendships = append(related.R.Friendships, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "02910e8e1bacfc8e7c13a37b649c354f", "score": "0.54268533", "text": "func (f *Friendship) SetToOneReferenceID(name, ID string) error {\n\ttemp, err := strconv.ParseUint(ID, 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch name {\n\tcase \"user\":\n\t\tf.UserID = uint(temp)\n\tcase \"friend\":\n\t\tf.FriendID = uint(temp)\n\t}\n\n\treturn errors.New(\"There is no to-one relationship with the name \" + name)\n}", "title": "" }, { "docid": "55cb0f75241cd4975db0156ef409aebf", "score": "0.5419967", "text": "func (utc *UserTopicCreate) SetUserID(i int) *UserTopicCreate {\n\tutc.mutation.SetUserID(i)\n\treturn utc\n}", "title": "" }, { "docid": "e316923233ce7a9c18a5e1bce7c87441", "score": "0.54053754", "text": "func SetUserInfo(id string, user_info models.UserInfo, sessCtx *mongo.SessionContext) error {\n\tselector := database.QuerySelector{\n\t\t\"id\": id,\n\t}\n\n\terr := db.Replace(\"info\", selector, user_info, true, sessCtx)\n\n\treturn err\n}", "title": "" }, { "docid": "93a33c1f5e3652b69b50aceb5b22b797", "score": "0.5389756", "text": "func (u *UserManager) Set(userID string, userName string) {\n\tu.mutex.Lock()\n\tu.users[userID] = userName\n\tu.mutex.Unlock()\n}", "title": "" }, { "docid": "1dc78170e1aa2d919781ee9ef6456edd", "score": "0.53891814", "text": "func (bc *BookreturnCreate) SetUserID(id int) *BookreturnCreate {\n\tbc.mutation.SetUserID(id)\n\treturn bc\n}", "title": "" }, { "docid": "956e763be5bddbe502a0f845d0e4f970", "score": "0.5363693", "text": "func (wuo *WarningUpdateOne) SetUserID(id discord.UserID) *WarningUpdateOne {\n\twuo.mutation.SetUserID(id)\n\treturn wuo\n}", "title": "" }, { "docid": "ba8f3e3fb58a40480b9b64ffc5e58b24", "score": "0.5359504", "text": "func (m *ManagedTenantAlert) SetCreatedByUserId(value *string)() {\n err := m.GetBackingStore().Set(\"createdByUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7eafb4dea324d6ac63080858fa282b03", "score": "0.5356233", "text": "func (cc *ClubCreate) SetUserID(id int) *ClubCreate {\n\tcc.mutation.SetUserID(id)\n\treturn cc\n}", "title": "" }, { "docid": "ecb78528882d6095f6001f69d9f7494d", "score": "0.53543925", "text": "func (o *EditCallerIDParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "title": "" }, { "docid": "3987415f5fad5bc6362e835168581e96", "score": "0.5330592", "text": "func (ruo *RegisterstoreUpdateOne) SetUserID(id int) *RegisterstoreUpdateOne {\n\truo.mutation.SetUserID(id)\n\treturn ruo\n}", "title": "" }, { "docid": "6079258de8b9bcead3416c805683ce30", "score": "0.5323421", "text": "func (ruo *RelationshipUpdateOne) SetUserID(i int) *RelationshipUpdateOne {\n\truo.mutation.SetUserID(i)\n\treturn ruo\n}", "title": "" }, { "docid": "d02e93f4b3fb2472823ff0bc07d7803a", "score": "0.5318033", "text": "func (w *Writer) UserID(userid int32) {\n\tp := constants.NewPacket(constants.BanchoLoginReply)\n\tp.SetPacketData(osubinary.Int32(userid))\n\tw.Write(p.ToByteArray())\n}", "title": "" }, { "docid": "ad29d9156505eee669e63ed63f33fea3", "score": "0.53012705", "text": "func (ab *ArticleBuilder) UserID(userID uint) *ArticleBuilder {\n\tab.article.UserID = userID\n\treturn ab\n}", "title": "" }, { "docid": "32e6fd09eb9f9dfc4861f54d44dcb42b", "score": "0.53012526", "text": "func (ru *RelationshipUpdate) SetUserID(i int) *RelationshipUpdate {\n\tru.mutation.SetUserID(i)\n\treturn ru\n}", "title": "" }, { "docid": "be3772cc431e50449a2fd3176c8c44c3", "score": "0.5297208", "text": "func (reu *RawEventUpdate) SetUserID(s string) *RawEventUpdate {\n\treu.mutation.SetUserID(s)\n\treturn reu\n}", "title": "" }, { "docid": "8f52418c680798958fc49b8829b837ad", "score": "0.52869725", "text": "func SetUserInfo(id string, user_info models.UserInfo) error {\n\tselector := database.QuerySelector{\n\t\t\"id\": id,\n\t}\n\n\terr := db.Update(\"info\", selector, &user_info)\n\n\tif err == database.ErrNotFound {\n\t\terr = db.Insert(\"info\", &user_info)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "661e4a537893a58bd0c8b8d033936826", "score": "0.52845865", "text": "func (n *BlockConnectedNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "a7d3c13e5af06eae2e5057a097674b01", "score": "0.52782923", "text": "func (o *Image) SetUser(ctx context.Context, exec boil.ContextExecutor, insert bool, related *User) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE `images` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, []string{\"user_id\"}),\n\t\tstrmangle.WhereClause(\"`\", \"`\", 0, imagePrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, updateQuery)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.UserID = related.ID\n\tif o.R == nil {\n\t\to.R = &imageR{\n\t\t\tUser: related,\n\t\t}\n\t} else {\n\t\to.R.User = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &userR{\n\t\t\tImages: ImageSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.Images = append(related.R.Images, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "99cdb22713ec5873432207f32525b488", "score": "0.5277433", "text": "func (m *UserSettingsMutation) SetUserID(id int) {\n\tm.user = &id\n}", "title": "" }, { "docid": "3d3c000d519e6954d849aa4ce0b88cd4", "score": "0.52712417", "text": "func (o *AddSmsEmailNotificationParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "title": "" }, { "docid": "140768633f7be98ec5eff69845f3f87f", "score": "0.5270717", "text": "func UserID(s string) Option {\n\treturn func(args *Options) {\n\t\targs.UserID = s\n\t}\n}", "title": "" }, { "docid": "d89ed3750c5f6c586a00004e3664c6a2", "score": "0.5267291", "text": "func (o *ServiceBrokerAuthLoginParams) SetUserID(userID *string) {\n\to.UserID = userID\n}", "title": "" }, { "docid": "9b562b14a57a8bc20cab14a4cd4f8e7d", "score": "0.52646923", "text": "func SetUser(store basecoin.KVStore, addr []byte, usr *types.User) {\n\tusrBytes := wire.BinaryBytes(usr)\n\tstore.Set(UserKey(addr), usrBytes)\n}", "title": "" }, { "docid": "d94c5296a656456133e316b6da849582", "score": "0.5263802", "text": "func (fuo *FileUpdateOne) SetUserID(id uuid.UUID) *FileUpdateOne {\n\tfuo.mutation.SetUserID(id)\n\treturn fuo\n}", "title": "" }, { "docid": "c12fb77b208ef7842bf1eb973ccb01a9", "score": "0.52563214", "text": "func (slc *SysLoggingCreate) SetUserID(s string) *SysLoggingCreate {\n\tslc.mutation.SetUserID(s)\n\treturn slc\n}", "title": "" }, { "docid": "2c84c9e59804443b28011963268f0a91", "score": "0.52392614", "text": "func (wu *WarningUpdate) SetUserID(id discord.UserID) *WarningUpdate {\n\twu.mutation.SetUserID(id)\n\treturn wu\n}", "title": "" }, { "docid": "8ca49a6af57f710ad2c22fa29224d8f7", "score": "0.5225229", "text": "func (n *TxSpentNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "637e96189d60f4ca2d3986c14ba43132", "score": "0.5215751", "text": "func (reuo *RawEventUpdateOne) SetUserID(s string) *RawEventUpdateOne {\n\treuo.mutation.SetUserID(s)\n\treturn reuo\n}", "title": "" }, { "docid": "347d8a626f63eb6f29ad7558910ba262", "score": "0.521007", "text": "func (m *DirectRoutingLogRow) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "25abc9bdd0debcc9560078bd8f2b5c57", "score": "0.51967573", "text": "func (_options *MessageStatelessOptions) SetUserID(userID string) *MessageStatelessOptions {\n\t_options.UserID = core.StringPtr(userID)\n\treturn _options\n}", "title": "" }, { "docid": "27e9f0897833c955bbd9979fd9fce5ee", "score": "0.5189704", "text": "func (n *ProcessedTxNtfn) SetId(id interface{}) {}", "title": "" }, { "docid": "4c59ec35c8fb7c89c37f2c1bbd40e415", "score": "0.5175465", "text": "func PutUserByID(wr http.ResponseWriter, req *http.Request, ps httprouter.Params) {\n\n\t//New Obj like Entities.User\n\tvar obj interface{} = new(Entities.User)\n\n\t//Read Body of Form, then convert json binary to Struct previously defined\n\tbody, _ := ioutil.ReadAll(req.Body)\n\tjson.Unmarshal(body, &obj)\n\n\t//Update obj, then return through pointer\n\tDB.UpdateObjByID(\"Users\", ps.ByName(\"id\"), &obj)\n\n\t//Response ok or error\n\tresponse(&wr, &obj)\n}", "title": "" }, { "docid": "e3834360fefebec04d20ce5dce8e9470", "score": "0.51665497", "text": "func (m *EducationUser) SetUser(value Userable)() {\n err := m.GetBackingStore().Set(\"user\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0a16aaf23f7034fb9e26c65afa20f851", "score": "0.5157478", "text": "func (ru *RegisterstoreUpdate) SetUserID(id int) *RegisterstoreUpdate {\n\tru.mutation.SetUserID(id)\n\treturn ru\n}", "title": "" }, { "docid": "7d6339107c2b29c5ad4d08edd3f6aacd", "score": "0.5149798", "text": "func (s *Store) Set(user string, m *fsm.FSM) {\n\ts.C.Set(user, m, 0)\n}", "title": "" }, { "docid": "47a8fa37525b40cdabef3e2449975c87", "score": "0.5140777", "text": "func (pc *ProfileCreate) SetUserID(id uuid.UUID) *ProfileCreate {\n\tpc.mutation.SetUserID(id)\n\treturn pc\n}", "title": "" }, { "docid": "401ff58ab506e25750dde0ebdfb60c7b", "score": "0.5136897", "text": "func SetUser(usr *user.User) (int, error) {\n\terr := store.Update(func(tx *bolt.Tx) error {\n\t\temail := []byte(usr.Email)\n\t\tusers := tx.Bucket([]byte(DB__users))\n\t\tif users == nil {\n\t\t\treturn bolt.ErrBucketNotFound\n\t\t}\n\n\t\t// check if user is found by email, fail if nil\n\t\texists := users.Get(email)\n\t\tif exists != nil {\n\t\t\treturn ErrUserExists\n\t\t}\n\n\t\t// get NextSequence int64 and set it as the User.ID\n\t\tid, err := users.NextSequence()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tusr.ID = int(id)\n\n\t\t// marshal User to json and put into bucket\n\t\tj, err := json.Marshal(usr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = users.Put(email, j)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn usr.ID, nil\n}", "title": "" }, { "docid": "eab31151601d373b7d4e1eafba8abc18", "score": "0.5132763", "text": "func (m *AdminSessionMutation) SetUserID(id int) {\n\tm.user = &id\n}", "title": "" }, { "docid": "7a05ca797359fc7685a0c3408e923deb", "score": "0.5124752", "text": "func (u *Users) Set(key string, user *User) {\n\tu.Lock()\n\tu.inner[key] = user\n\tu.Unlock()\n}", "title": "" }, { "docid": "30ee9a4eac0e7a30f84ba585ef7dd710", "score": "0.5122653", "text": "func SetCurrentUser(next buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\tif uid := c.Session().Get(\"current_user_id\"); uid != nil {\n\t\t\tu := &models.User{}\n\t\t\ttx := c.Value(\"tx\").(*pop.Connection)\n\t\t\tif err := tx.Find(u, uid); err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\t\t\tc.Set(\"current_user\", u)\n\t\t}\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "ddc4bc07beb6520d6f195b112059ee82", "score": "0.511266", "text": "func SetCurrentUser(next buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\tif uid := c.Session().Get(\"current_user_id\"); uid != nil {\n\t\t\tu := &models.User{}\n\t\t\ttx := c.Value(\"tx\").(*pop.Connection)\n\t\t\terr := tx.Find(u, uid)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\t\t\tc.Set(\"current_user\", u)\n\t\t}\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "ddc4bc07beb6520d6f195b112059ee82", "score": "0.511266", "text": "func SetCurrentUser(next buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\tif uid := c.Session().Get(\"current_user_id\"); uid != nil {\n\t\t\tu := &models.User{}\n\t\t\ttx := c.Value(\"tx\").(*pop.Connection)\n\t\t\terr := tx.Find(u, uid)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\t\t\tc.Set(\"current_user\", u)\n\t\t}\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "8bcaec94d3d81c49d598bef4f37d9d1f", "score": "0.5102012", "text": "func (o *UserOrder) SetUser(exec boil.Executor, insert bool, related *UserProfile) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"user_order\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"user_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, userOrderPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.UserID = related.ID\n\tif o.R == nil {\n\t\to.R = &userOrderR{\n\t\t\tUser: related,\n\t\t}\n\t} else {\n\t\to.R.User = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &userProfileR{\n\t\t\tUserUserOrders: UserOrderSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.UserUserOrders = append(related.R.UserUserOrders, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be0972ba1b34e2088d535df8b5b04d3d", "score": "0.50911605", "text": "func (m *AppliedConditionalAccessPolicy) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1c8ad94882630c0d7e55719935537b91", "score": "0.50883937", "text": "func (rc *RecommendationsCreate) SetUserApprobedID(id int) *RecommendationsCreate {\n\trc.mutation.SetUserApprobedID(id)\n\treturn rc\n}", "title": "" }, { "docid": "90703fca012cf69e7fb1859f79d14531", "score": "0.50852656", "text": "func (m *userOperation) SetID(val string) {\n\tm.idField = val\n}", "title": "" } ]
7b5d702373966d0a3beecbe678f9ee93
Path return api path
[ { "docid": "676bee14e36c9c92d915330e7580a9ed", "score": "0.0", "text": "func (d *delAccountTwitterOauth) Path() string {\n\treturn \"/authorization/twitter/user\"\n}", "title": "" } ]
[ { "docid": "c5281f162b1cfc3a20d0c980beb8af9e", "score": "0.8001362", "text": "func (c *Client) apiPath(p string) string {\n\treturn fmt.Sprintf(\"/api/%s/%s\", c.apiVersion, p)\n}", "title": "" }, { "docid": "c5281f162b1cfc3a20d0c980beb8af9e", "score": "0.8001362", "text": "func (c *Client) apiPath(p string) string {\n\treturn fmt.Sprintf(\"/api/%s/%s\", c.apiVersion, p)\n}", "title": "" }, { "docid": "10cdea5475a1fae181dc3787b6575ef1", "score": "0.7859464", "text": "func apiPath(path string) string {\n\tif strings.HasPrefix(path, \"/\") {\n\t\treturn fmt.Sprintf(\"%s\", path)\n\t}\n\treturn fmt.Sprintf(\"/%s\", path)\n}", "title": "" }, { "docid": "c20e845c3fdc9fa9258e4befdff36493", "score": "0.7498475", "text": "func (cli *Client) getAPIPath(p string, query url.Values) string {\n\tvar apiPath string\n\tapiPath = path.Join(cli.basePath, \"/api\", p)\n\n\treturn (&url.URL{Path: apiPath, RawQuery: query.Encode()}).String()\n}", "title": "" }, { "docid": "ec0287800984adb4cf1c45479d48621d", "score": "0.70435566", "text": "func (cl *Client) Path(p string) string {\n\treturn fmt.Sprintf(\"%s%s\", cl.baseURL, p)\n}", "title": "" }, { "docid": "4c09a43b78199b757d9adc9ab4ffdbcf", "score": "0.68748665", "text": "func (e *Endpoint) Path(path string) string {\n\treturn fmt.Sprintf(\"%s/v%d/%s\", e.URL, e.Version, path)\n}", "title": "" }, { "docid": "bf86b46fb912a82baa5db282729b0c2b", "score": "0.6762639", "text": "func (h *PingWeb) Path() string {\n\treturn \"/demo\"\n}", "title": "" }, { "docid": "3421c9c5731c528927afcae44dfa41d1", "score": "0.67278475", "text": "func (r *Client) Path(path string) string {\n\tif strings.HasPrefix(path, \"https:\") {\n\t\treturn path\n\t}\n\treturn fmt.Sprintf(\"%s/slm/webservice/%s/%s\", r.Server, r.APIVersion, path)\n}", "title": "" }, { "docid": "3fde948e42bfea3ed21ed27c9d16702b", "score": "0.6663886", "text": "func InfoAPIPath() string {\n\treturn \"/api/info\"\n}", "title": "" }, { "docid": "4a93f28eeb9c1fec8ee206c2c7d33fee", "score": "0.66517097", "text": "func (c Operation) Path() string {\n\tcmd := c.String()\n\tif len(cmd) == 0 {\n\t\treturn \"\"\n\t}\n\treturn path.Join(\"/paapi5\", strings.ToLower(cmd))\n}", "title": "" }, { "docid": "6d676e9831d565b057a5dc6a93f2b3e7", "score": "0.66300225", "text": "func (*ItfhwRedServers) GetPath() string { return \"/api/objects/itfhw/red_server/\" }", "title": "" }, { "docid": "9a1df6253d125cc23570d560e892793e", "score": "0.65989274", "text": "func (e *endpoint) Path() string {\n\treturn e.path\n}", "title": "" }, { "docid": "257d07d5e2c0804146d3e63afa9eb61b", "score": "0.65987754", "text": "func (h *handler) Path() string {\n\treturn h.endpoint\n}", "title": "" }, { "docid": "d2ac6f110a285c1acca0f31ddf7168fc", "score": "0.659838", "text": "func HomePath(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Rotterdam > CAAS > adapter [HomePath] Returning SwaggerUI path ...\")\n\n\tjson.NewEncoder(w).Encode(structs.ResponseCaaS{\n\t\tResp: \"ok\",\n\t\tMethod: \"HomePath\",\n\t\tMessage: \"UI URL: /swaggerui/\",\n\t\tCaaSVersion: cfg.Config.CaaSVersion})\n}", "title": "" }, { "docid": "12dc624a7af982da5f718fb22da6defd", "score": "0.65764993", "text": "func (p ProbeStruct) Path() string {\n\treturn coreengine.GetFeaturePath(\"service_packs\", \"apim\", \"azure\", p.Name())\n}", "title": "" }, { "docid": "389620eca5e72abecfa56f683b80b2b4", "score": "0.6535116", "text": "func (*ItfhwRedClients) GetPath() string { return \"/api/objects/itfhw/red_client/\" }", "title": "" }, { "docid": "e27a5769e288e57bd09a7c090c50b5b7", "score": "0.6526146", "text": "func APIURL(path string) string {\n\treturn fmt.Sprintf(\"%s%s\", viper.GetString(\"root_url\"), path)\n}", "title": "" }, { "docid": "7a2e129530dd9a649e701548801f1971", "score": "0.6516289", "text": "func (c *Client) BasePath() string {\n\tpath := fmt.Sprintf(\"%s/api\", c.GetURL())\n\tif len(c.APIVersion) > 0 {\n\t\tpath = fmt.Sprintf(\"%s/%s\", path, c.APIVersion)\n\t}\n\treturn path\n}", "title": "" }, { "docid": "c7e21ca0a7ae27b6cd053b5b0e0dd3cb", "score": "0.65070033", "text": "func (e *Endpoint) Path() string {\n\treturn Path\n}", "title": "" }, { "docid": "c7e21ca0a7ae27b6cd053b5b0e0dd3cb", "score": "0.65070033", "text": "func (e *Endpoint) Path() string {\n\treturn Path\n}", "title": "" }, { "docid": "6a216ef9d9f65075389d8b01dda7bc73", "score": "0.64998764", "text": "func (h *TwitterWebDemo) Path() string {\n\treturn \"/demo/twitter\"\n}", "title": "" }, { "docid": "2c197febb2aef312f52d25592d301f8f", "score": "0.6481619", "text": "func (d *BaseDriver) Path(r volume.Request) volume.Response {\n\tlog.WithFields(log.Fields{\"Name\": r.Name}).Info(\"REQUEST: Path\")\n\treturn volume.Response{Err: \"not found\"}\n}", "title": "" }, { "docid": "45dc0d4ffdcd8123684f37fd234e94a9", "score": "0.6481445", "text": "func ConfigAPIPath() string {\n\treturn \"/config\"\n}", "title": "" }, { "docid": "ad46b71ccadb13c27d7413168ba5bea3", "score": "0.647164", "text": "func (hi *HttpInformant) Path() string {\n\treturn hi.path\n}", "title": "" }, { "docid": "2fffdcf5051ec3056eb266cfec9c4a15", "score": "0.64707243", "text": "func (c *Client) Path() string {\n\treturn Path\n}", "title": "" }, { "docid": "10873843c5c699976a891ebda7d10cff", "score": "0.64390576", "text": "func (c *Client) getURL(path string) string {\n\tif strings.HasPrefix(path, \"/rest/v2/\") {\n\t\treturn c.apiRoot + path\n\t}\n\n\treturn strings.Join([]string{c.apiRoot, \"rest\", \"v2\", strings.TrimPrefix(path, \"/\")}, \"/\")\n}", "title": "" }, { "docid": "99d27d343650a431f80be6960541d824", "score": "0.6415166", "text": "func (*AuthenticationAdirectorys) GetPath() string { return \"/api/objects/authentication/adirectory/\" }", "title": "" }, { "docid": "e3137b3d22d3db09215a018d93bf7335", "score": "0.6404118", "text": "func GetShortnerPath(path string) string {\n\tparam0 := path\n\n\treturn fmt.Sprintf(\"/api/s/%s\", param0)\n}", "title": "" }, { "docid": "eb40e4820244935e2543c38187848dd1", "score": "0.63818306", "text": "func (req *ReqStub) Path() string {\n\treturn req.PathString\n}", "title": "" }, { "docid": "00b12a2ab9edef5b4cff6f54be031765", "score": "0.63736606", "text": "func (h *httpHandler) Path() string {\n\treturn h.path\n}", "title": "" }, { "docid": "3dc9cdd4afbe4ea839bb2ccde9f538ae", "score": "0.63632226", "text": "func (a Host) Path(args ...string) string {\n\tvar serviceName, version string\n\tswitch len(args) {\n\tcase 1: // controller\n\t\tserviceName = args[0]\n\tcase 2, 3: // controller, 1, dash [dash is ignored]\n\t\tserviceName = args[0]\n\t\tversion = args[1]\n\t}\n\thost := fmt.Sprintf(\"%s:%d/\", a.Host, a.Port)\n\tif strings.EqualFold(serviceName, \"controller\") {\n\t\thost = fmt.Sprintf(\"%s%s/\", host, serviceName)\n\t\tif _, err := strconv.Atoi(version); err == nil {\n\t\t\thost = fmt.Sprintf(\"%sv%s/\", host, version)\n\t\t}\n\t}\n\treturn host\n}", "title": "" }, { "docid": "718da7a1c607a097d2c91b411e5aa68b", "score": "0.63613534", "text": "func (*PimSmRoutes) GetPath() string { return \"/api/objects/pim_sm/route/\" }", "title": "" }, { "docid": "444ba0b24c553796158184a98dd8d2a0", "score": "0.6354174", "text": "func (b *Baton) Path() string {\n\treturn b.r.URL.Path\n}", "title": "" }, { "docid": "0d89369bcde30404fdf9eba0c161a64b", "score": "0.6346608", "text": "func (r Resource) Path() string {\n\treturn r.ProductName() + \"_\" + r.Name()\n}", "title": "" }, { "docid": "b9c7665236e74494ae9bf4bae97e3638", "score": "0.6335305", "text": "func apiFilepath(filename string) (string, error) {\n\tif !strings.HasSuffix(filename, \"_openapi.json\") {\n\t\terrStr := fmt.Sprintf(\"Unable to parse openapi v3 spec filename: %s\", filename)\n\t\treturn \"\", errors.New(errStr)\n\t}\n\tfilename = strings.TrimSuffix(filename, \"_openapi.json\")\n\tfilepath := strings.ReplaceAll(filename, \"__\", \"/\")\n\treturn filepath, nil\n}", "title": "" }, { "docid": "28eb8b26047c1d65609efffb049f0c6e", "score": "0.6304024", "text": "func (input *Input) Path() string {\n\treturn input.Request.URL.Path\n}", "title": "" }, { "docid": "f500e29e6d3863526e15230dd0dc3a02", "score": "0.6279337", "text": "func (r *Request) Path() string {\n\treturn string(r.path)\n}", "title": "" }, { "docid": "0abac3a8e71f5cb96ad00ce548dbc35d", "score": "0.62663996", "text": "func Path() string {\n\treturn configuration.path\n}", "title": "" }, { "docid": "c838af2f715643ea628410d8c33ab220", "score": "0.6240788", "text": "func apiKeyPath(path, apiKey string) string {\n\tif strings.Contains(path, \"?\") {\n\t\treturn path + \"&key=\" + apiKey\n\t}\n\treturn path + \"?key=\" + apiKey\n}", "title": "" }, { "docid": "032ad66b33c1c73251c8927cc0b56532", "score": "0.6231383", "text": "func (r *RouteDetail) Path() string {\n\treturn r.req.URL.Path\n}", "title": "" }, { "docid": "699b14f68fa1170ba96d262ee4599107", "score": "0.62300557", "text": "func (r *Resource) Path() string {\n\tgenerated := r.path\n\n\tfor _, p := range r.params {\n\t\tif p.In == \"path\" {\n\t\t\tcomponent := \"{\" + p.Name + \"}\"\n\t\t\tif !strings.Contains(generated, component) {\n\t\t\t\tif !strings.HasSuffix(generated, \"/\") {\n\t\t\t\t\tgenerated += \"/\"\n\t\t\t\t}\n\t\t\t\tgenerated += component\n\t\t\t}\n\t\t}\n\t}\n\n\treturn generated\n}", "title": "" }, { "docid": "60e68c1c0803252e89abd8adf0acffa2", "score": "0.6219424", "text": "func (h *HTTPHandler) Path() string {\n\treturn h.path\n}", "title": "" }, { "docid": "6ea711175e521878041cb9c73c8c13a2", "score": "0.62101495", "text": "func ShowStatusPath() string {\n\n\treturn fmt.Sprintf(\"/api/status\")\n}", "title": "" }, { "docid": "a6e97f4bb608e884190fd19d8c8969cd", "score": "0.62098455", "text": "func getAPIEndpoint() string {\n\treturn baseAPIMainURL\n}", "title": "" }, { "docid": "a41ea30809ba1925073604a9f770d731", "score": "0.62056243", "text": "func (ctx *Context) Path() string {\n\treturn ctx.Request.URL.Path\n}", "title": "" }, { "docid": "a41ea30809ba1925073604a9f770d731", "score": "0.62056243", "text": "func (ctx *Context) Path() string {\n\treturn ctx.Request.URL.Path\n}", "title": "" }, { "docid": "515cac2b04b367d29a3fc2b01f88647d", "score": "0.61858916", "text": "func (req *Request) Path() string {\n\treturn req.request.URL.Path\n}", "title": "" }, { "docid": "74c0df136f6a19c0df8336853167465d", "score": "0.61848044", "text": "func Path(router *mux.Router, name string, args ...interface{}) string {\n\troute := router.Get(name)\n\tif route == nil {\n\t\tlogger.Fatal(\"[Route] Route not found: %s\", name)\n\t}\n\n\tvar pairs []string\n\tfor _, arg := range args {\n\t\tswitch param := arg.(type) {\n\t\tcase string:\n\t\t\tpairs = append(pairs, param)\n\t\tcase int64:\n\t\t\tpairs = append(pairs, strconv.FormatInt(param, 10))\n\t\t}\n\t}\n\n\tresult, err := route.URLPath(pairs...)\n\tif err != nil {\n\t\tlogger.Fatal(\"[Route] %v\", err)\n\t}\n\n\treturn result.String()\n}", "title": "" }, { "docid": "9ce27ebb057004f915ba3984f2b06242", "score": "0.6177411", "text": "func resolvePath(api *API, method Method) string {\n\n\tif(strings.HasSuffix(api.BaseURL, \"/\")) {\n\t\treturn api.BaseURL + method.Path\n\t}\n\treturn api.BaseURL + \"/\" + method.Path\n}", "title": "" }, { "docid": "632cadb79138b16311143b1070147460", "score": "0.61759967", "text": "func (s *server) Path() string {\n\treturn s.path\n}", "title": "" }, { "docid": "9df397e429f04b92fdbd5d317695339d", "score": "0.6170637", "text": "func (i *ItfhwRedServer) GetPath() string {\n\treturn fmt.Sprintf(\"/api/objects/itfhw/red_server/%s\", i.Reference)\n}", "title": "" }, { "docid": "47b7118e590638c5fd6aa900a01bc699", "score": "0.6166132", "text": "func DeploymentAPIPath() string {\n\treturn \"/deployment\"\n}", "title": "" }, { "docid": "a6b51a6e16a674f27b26d198d668376a", "score": "0.61652356", "text": "func (i *ItfhwLag) GetPath() string { return fmt.Sprintf(\"/api/objects/itfhw/lag/%s\", i.Reference) }", "title": "" }, { "docid": "dc9e27edff7a289cf080781c09ea6a02", "score": "0.61563253", "text": "func (w *WebCAS) Path() string {\n\treturn fmt.Sprintf(\"/cas/{%s}\", cidPathVariable)\n}", "title": "" }, { "docid": "3473ada84f025ffad0e9e52408e1d918", "score": "0.61520106", "text": "func (pkg *Package) Path() string {}", "title": "" }, { "docid": "3196f9e36895e336bab5785eadcf6c9d", "score": "0.6151795", "text": "func handler(w http.ResponseWriter, req *http.Request) {\n\tfmt.Fprintf(w, \"URL.Path = %q\\n\", req.URL.Path)\n}", "title": "" }, { "docid": "2512e1f7cbcfd1a4635bc749a55fda2c", "score": "0.61517227", "text": "func (i *Index) Path() string { return i.path }", "title": "" }, { "docid": "d7bbeca7109269a77af86e5c209b9c50", "score": "0.61503685", "text": "func (i *info) Path() string {\n\treturn i.path\n}", "title": "" }, { "docid": "a583e5ce7434b457d9c439f95b00888e", "score": "0.61488736", "text": "func (r Request) Path() string {\n\treturn r.Req.URL.Path\n}", "title": "" }, { "docid": "b29c4a4248ca28644773ba0ba50536de", "score": "0.6143868", "text": "func (uh URLHelper) Path(pathname string) string {\n\treturn uh.path(pathname, nil)\n}", "title": "" }, { "docid": "c4e87dffce892ccb6f870aa1106acd3b", "score": "0.6140654", "text": "func echoPathHandler(response http.ResponseWriter, request *http.Request) {\n\tpathBytes := []byte(request.URL.Path)\n\tresponse.Write(pathBytes)\n}", "title": "" }, { "docid": "f677838d061077459d39cfd51a069da3", "score": "0.61374235", "text": "func (handler *WebHandler) Path() string {\n\treturn handler.path\n}", "title": "" }, { "docid": "b939a35abb72ad7deb99a129042944b7", "score": "0.61351043", "text": "func (o HTTPGetActionPatchOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetActionPatch) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3868c44dff10f425db434ca1b2c5bf33", "score": "0.6124258", "text": "func (*AuthenticationEdirectorys) GetPath() string { return \"/api/objects/authentication/edirectory/\" }", "title": "" }, { "docid": "b74553d0dc71bcad296a2dc3f4fc1652", "score": "0.61184555", "text": "func (c *roverController) Path() string {\n\treturn roverPath\n}", "title": "" }, { "docid": "a14e7b1518f5cd7a36a5c0ee9921c31f", "score": "0.60897", "text": "func (o PhoenixLinkedServiceOutput) HttpPath() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v PhoenixLinkedService) interface{} { return v.HttpPath }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "98b565b048b1c968f44b7b66b955ba3b", "score": "0.60802615", "text": "func (o HTTPGetActionOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetAction) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bd10ad0a44ce909975142df9e3d74c29", "score": "0.60651153", "text": "func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {\n\tvar (\n\t\telem = u.Path\n\t\targs = r.args\n\t)\n\tif rawPath := u.RawPath; rawPath != \"\" {\n\t\tif normalized, ok := uri.NormalizeEscapedPath(rawPath); ok {\n\t\t\telem = normalized\n\t\t}\n\t\tdefer func() {\n\t\t\tfor i, arg := range r.args[:r.count] {\n\t\t\t\tif unescaped, err := url.PathUnescape(arg); err == nil {\n\t\t\t\t\tr.args[i] = unescaped\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// Static code generated router with unwrapped path search.\n\tswitch {\n\tdefault:\n\t\tif len(elem) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tswitch elem[0] {\n\t\tcase '/': // Prefix: \"/admin/v1/api/\"\n\t\t\tif l := len(\"/admin/v1/api/\"); len(elem) >= l && elem[0:l] == \"/admin/v1/api/\" {\n\t\t\t\telem = elem[l:]\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif len(elem) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tswitch elem[0] {\n\t\t\tcase 'b': // Prefix: \"blog\"\n\t\t\t\tif l := len(\"blog\"); len(elem) >= l && elem[0:l] == \"blog\" {\n\t\t\t\t\telem = elem[l:]\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\tswitch method {\n\t\t\t\t\tcase \"GET\":\n\t\t\t\t\t\t// Leaf: AdminV1APIBlogGet\n\t\t\t\t\t\tr.name = \"AdminV1APIBlogGet\"\n\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/blog\"\n\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\treturn r, true\n\t\t\t\t\tcase \"PATCH\":\n\t\t\t\t\t\t// Leaf: AdminV1APIBlogPatch\n\t\t\t\t\t\tr.name = \"AdminV1APIBlogPatch\"\n\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/blog\"\n\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\treturn r, true\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 'i': // Prefix: \"image\"\n\t\t\t\tif l := len(\"image\"); len(elem) >= l && elem[0:l] == \"image\" {\n\t\t\t\t\telem = elem[l:]\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\tswitch method {\n\t\t\t\t\tcase \"DELETE\":\n\t\t\t\t\t\tr.name = \"AdminV1APIImageDelete\"\n\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/image\"\n\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\treturn r, true\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tswitch elem[0] {\n\t\t\t\tcase 's': // Prefix: \"s/\"\n\t\t\t\t\tif l := len(\"s/\"); len(elem) >= l && elem[0:l] == \"s/\" {\n\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\t// Param: \"number\"\n\t\t\t\t\t// Leaf parameter\n\t\t\t\t\targs[0] = elem\n\t\t\t\t\telem = \"\"\n\n\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\tcase \"GET\":\n\t\t\t\t\t\t\t// Leaf: AdminV1APIImagesNumberGet\n\t\t\t\t\t\t\tr.name = \"AdminV1APIImagesNumberGet\"\n\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/images/{number}\"\n\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\tr.count = 1\n\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 'p': // Prefix: \"post\"\n\t\t\t\tif l := len(\"post\"); len(elem) >= l && elem[0:l] == \"post\" {\n\t\t\t\t\telem = elem[l:]\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\tswitch method {\n\t\t\t\t\tcase \"PATCH\":\n\t\t\t\t\t\tr.name = \"AdminV1APIPostPatch\"\n\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/post\"\n\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\treturn r, true\n\t\t\t\t\tcase \"POST\":\n\t\t\t\t\t\tr.name = \"AdminV1APIPostPost\"\n\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/post\"\n\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\treturn r, true\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tswitch elem[0] {\n\t\t\t\tcase '/': // Prefix: \"/\"\n\t\t\t\t\tif l := len(\"/\"); len(elem) >= l && elem[0:l] == \"/\" {\n\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\t// Param: \"postId\"\n\t\t\t\t\t// Leaf parameter\n\t\t\t\t\targs[0] = elem\n\t\t\t\t\telem = \"\"\n\n\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\tcase \"DELETE\":\n\t\t\t\t\t\t\t// Leaf: AdminV1APIPostPostIdDelete\n\t\t\t\t\t\t\tr.name = \"AdminV1APIPostPostIdDelete\"\n\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/post/{postId}\"\n\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\tr.count = 1\n\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\tcase \"GET\":\n\t\t\t\t\t\t\t// Leaf: AdminV1APIPostPostIdGet\n\t\t\t\t\t\t\tr.name = \"AdminV1APIPostPostIdGet\"\n\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/post/{postId}\"\n\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\tr.count = 1\n\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase 's': // Prefix: \"s/\"\n\t\t\t\t\tif l := len(\"s/\"); len(elem) >= l && elem[0:l] == \"s/\" {\n\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\t// Param: \"number\"\n\t\t\t\t\t// Leaf parameter\n\t\t\t\t\targs[0] = elem\n\t\t\t\t\telem = \"\"\n\n\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\tcase \"GET\":\n\t\t\t\t\t\t\t// Leaf: AdminV1APIPostsNumberGet\n\t\t\t\t\t\t\tr.name = \"AdminV1APIPostsNumberGet\"\n\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/posts/{number}\"\n\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\tr.count = 1\n\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 'u': // Prefix: \"u\"\n\t\t\t\tif l := len(\"u\"); len(elem) >= l && elem[0:l] == \"u\" {\n\t\t\t\t\telem = elem[l:]\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tswitch elem[0] {\n\t\t\t\tcase 'p': // Prefix: \"pload\"\n\t\t\t\t\tif l := len(\"pload\"); len(elem) >= l && elem[0:l] == \"pload\" {\n\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\tcase \"POST\":\n\t\t\t\t\t\t\t// Leaf: AdminV1APIUploadPost\n\t\t\t\t\t\t\tr.name = \"AdminV1APIUploadPost\"\n\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/upload\"\n\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase 's': // Prefix: \"ser\"\n\t\t\t\t\tif l := len(\"ser\"); len(elem) >= l && elem[0:l] == \"ser\" {\n\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\tcase \"PATCH\":\n\t\t\t\t\t\t\tr.name = \"AdminV1APIUserPatch\"\n\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/user\"\n\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tswitch elem[0] {\n\t\t\t\t\tcase '/': // Prefix: \"/\"\n\t\t\t\t\t\tif l := len(\"/\"); len(elem) >= l && elem[0:l] == \"/\" {\n\t\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Param: \"id\"\n\t\t\t\t\t\t// Leaf parameter\n\t\t\t\t\t\targs[0] = elem\n\t\t\t\t\t\telem = \"\"\n\n\t\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\t\tcase \"GET\":\n\t\t\t\t\t\t\t\t// Leaf: AdminV1APIUserIDGet\n\t\t\t\t\t\t\t\tr.name = \"AdminV1APIUserIDGet\"\n\t\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/user/{id}\"\n\t\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\t\tr.count = 1\n\t\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 'i': // Prefix: \"id\"\n\t\t\t\t\t\tif l := len(\"id\"); len(elem) >= l && elem[0:l] == \"id\" {\n\t\t\t\t\t\t\telem = elem[l:]\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif len(elem) == 0 {\n\t\t\t\t\t\t\tswitch method {\n\t\t\t\t\t\t\tcase \"GET\":\n\t\t\t\t\t\t\t\t// Leaf: AdminV1APIUseridGet\n\t\t\t\t\t\t\t\tr.name = \"AdminV1APIUseridGet\"\n\t\t\t\t\t\t\t\tr.operationID = \"\"\n\t\t\t\t\t\t\t\tr.pathPattern = \"/admin/v1/api/userid\"\n\t\t\t\t\t\t\t\tr.args = args\n\t\t\t\t\t\t\t\tr.count = 0\n\t\t\t\t\t\t\t\treturn r, true\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn r, false\n}", "title": "" }, { "docid": "a534b654a0b5ff19316bb1ce6a63cd93", "score": "0.60645187", "text": "func (r *Router) Path() string {\n\treturn r.path\n}", "title": "" }, { "docid": "36d58dc3e45093b09202270fe806dbb9", "score": "0.6060399", "text": "func (module *SdkLibrary) apiDistPath(apiScope *apiScope) string {\n\tif module.ModuleBase.Owner() != \"\" {\n\t\treturn path.Join(\"apistubs\", module.ModuleBase.Owner(), apiScope.name)\n\t} else if Bool(module.sdkLibraryProperties.Core_lib) {\n\t\treturn path.Join(\"apistubs\", \"core\", apiScope.name)\n\t} else {\n\t\treturn path.Join(\"apistubs\", \"android\", apiScope.name)\n\t}\n}", "title": "" }, { "docid": "801ad7d05d7e0e43fd68cd96bd41ff54", "score": "0.6059132", "text": "func GenerateFullURLByPath(path string) (fullURL string) {\n\trtvl := APIEndpointURL\n\tif (!strings.HasSuffix(rtvl, \"/\") && strings.HasPrefix(path, \"/\")) || (strings.HasPrefix(rtvl, \"/\") && !strings.HasPrefix(path, \"/\")) {\n\t\treturn fmt.Sprintf(\"%s/%s\", rtvl, path)\n\t}\n\n\treturn rtvl\n}", "title": "" }, { "docid": "ab1343e1df40499f62f80cfb8ced3b50", "score": "0.60533303", "text": "func (i *ItfhwRedClient) GetPath() string {\n\treturn fmt.Sprintf(\"/api/objects/itfhw/red_client/%s\", i.Reference)\n}", "title": "" }, { "docid": "cd38712426d3c9baaeba973f51199525", "score": "0.60412925", "text": "func getBasePath() string {\n\n\ttype jsonBasePath struct {\n\t\tBasePath string\n\t}\n\n\tbp := jsonBasePath{}\n\n\te := json.Unmarshal(restapi.SwaggerJSON, &bp)\n\n\tif e != nil {\n\n\t\tl.Warning.Printf(\"Unmarshalling of the basepath failed: %v\\n\", e)\n\n\t}\n\n\treturn bp.BasePath\n\n}", "title": "" }, { "docid": "a9b6084661ea0ecdec9138158d4a7464", "score": "0.6040813", "text": "func Path() string {\n\treturn self.Path()\n}", "title": "" }, { "docid": "45571028a930499ab8555d3149fb2350", "score": "0.60346", "text": "func (o HiveLinkedServiceOutput) HttpPath() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HiveLinkedService) interface{} { return v.HttpPath }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a3c1e1e4a406894e8aea3b52bf82c8f5", "score": "0.60308015", "text": "func (r *AuthorizationRequestOTP) Path() string {\n\treturn \"/administrations/authorization/otp-requests\"\n}", "title": "" }, { "docid": "226f0b3abb66fd2d2997e2499134b0fe", "score": "0.6015403", "text": "func (o SparkLinkedServiceOutput) HttpPath() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SparkLinkedService) interface{} { return v.HttpPath }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "9e4707f4912c79e6e6ea93cebebedddd", "score": "0.6011402", "text": "func (v endpoint) GetPath() string {\n\treturn v.path\n}", "title": "" }, { "docid": "9ffe04d8a1c8f341904311fa1e0e31fe", "score": "0.59906423", "text": "func (v *Defaulter) Path() string {\n\treturn \"/mutate-provisioning-karpenter-sh-v1alpha1-provisioner\"\n}", "title": "" }, { "docid": "d86836a7f1435064139aa9451289a05e", "score": "0.5985402", "text": "func (*ItfhwBridges) GetPath() string { return \"/api/objects/itfhw/bridge/\" }", "title": "" }, { "docid": "c990748176a3456b92f304b8b80a8a63", "score": "0.5984154", "text": "func (i HealthCheckInput) Path() (string, error) {\n\tpath := \"/v1/health/check\"\n\turlVals := url.Values{}\n\n\treturn path + \"?\" + urlVals.Encode(), nil\n}", "title": "" }, { "docid": "4b423200c297f4d70523b44762ed2c1e", "score": "0.59798694", "text": "func (h *HTTPProvider) GetPath() string {\n\treturn h.url.Path\n}", "title": "" }, { "docid": "4b423200c297f4d70523b44762ed2c1e", "score": "0.59798694", "text": "func (h *HTTPProvider) GetPath() string {\n\treturn h.url.Path\n}", "title": "" }, { "docid": "d16772a2d3586718677a9f2f8cd21108", "score": "0.59751654", "text": "func (b *Builder) Path(name string, params map[string]interface{}) string {\n\t// StrictPath is already thread-safe so no need to lock\n\tret, err := b.StrictPath(name, params)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "6abdeea568b07ab7e2ea94f70a7570a7", "score": "0.5969097", "text": "func (*ItfhwVirtuals) GetPath() string { return \"/api/objects/itfhw/virtual/\" }", "title": "" }, { "docid": "70adbe5e7d46383a421ae3dc431f63ba", "score": "0.59678346", "text": "func (e *Engine) Path() string { return e.path }", "title": "" }, { "docid": "70adbe5e7d46383a421ae3dc431f63ba", "score": "0.59678346", "text": "func (e *Engine) Path() string { return e.path }", "title": "" }, { "docid": "baccf5a700e5444515bd8f827476a8cc", "score": "0.59648806", "text": "func (o HBaseLinkedServiceOutput) HttpPath() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HBaseLinkedService) interface{} { return v.HttpPath }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "d3e968173380f09231e44611224fbfae", "score": "0.5963738", "text": "func (*PimSmRpRouters) GetPath() string { return \"/api/objects/pim_sm/rp_router/\" }", "title": "" }, { "docid": "ab2b266ec6e658eacc60cbf01b1874ee", "score": "0.59593606", "text": "func Path(path string) nirvana.Configurer {\n\tif path == \"\" {\n\t\tpath = \"/apidocs\"\n\t}\n\treturn func(c *nirvana.Config) error {\n\t\twrapper(c, func(c *config) {\n\t\t\tc.path = path\n\t\t})\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "4179e59916ea1ecd20f556a9dce19259", "score": "0.59429026", "text": "func (e *Server) Path() string {\n\treturn e.path\n}", "title": "" }, { "docid": "9b51010d9fe4c2597f9d247baec466a1", "score": "0.59364945", "text": "func (c *catalog) Path() string {\n\treturn \"/\"\n}", "title": "" }, { "docid": "84f29f2139485394c6f677a89bbbb0bd", "score": "0.5924098", "text": "func (u *URL) Path() string {\n\treturn string(u.URI.Path())\n}", "title": "" }, { "docid": "beb0e4c0670645e1822e583a1c4e206d", "score": "0.5919148", "text": "func getPath(id string) string {\n\treturn filepath.Join(basePath, id, fmt.Sprintf(\"%s-json.log\", id))\n}", "title": "" }, { "docid": "49e9e4dff65424e28e56871864fc62d8", "score": "0.59189737", "text": "func (a *AuthenticationTacacs) GetPath() string {\n\treturn fmt.Sprintf(\"/api/objects/authentication/tacacs/%s\", a.Reference)\n}", "title": "" }, { "docid": "69dea939508ba7ce227766bf4743fd47", "score": "0.59174824", "text": "func (r BettyRequest) Path() string {\n\tvar filename = fmt.Sprintf(\"%d.%s\", r.Width, r.Format)\n\treturn filepath.Join(GetImageDir(r.Id), r.RatioString, filename)\n}", "title": "" }, { "docid": "fe72d983b9d6958b1c983ed1515805fe", "score": "0.591569", "text": "func (r ARN) Path() string {\n\ti, j := r.path()\n\treturn string(r[i:j])\n}", "title": "" }, { "docid": "433d3a5c488ee1b05e213e334e661bdc", "score": "0.5915177", "text": "func (r Route) Path() string {\n\treturn r.path\n}", "title": "" }, { "docid": "027245b0cb76374e40dd926206b0cd26", "score": "0.5914477", "text": "func GetCompanyHyCompanyPath(companyID int) string {\n\treturn fmt.Sprintf(\"/api/company/%v\", companyID)\n}", "title": "" }, { "docid": "e370f1bc6648941152bcd61de0697a36", "score": "0.5911725", "text": "func (c *Info) Path() string {\n\treturn c.path\n}", "title": "" }, { "docid": "fe86db738c2d201bb69de3f90d3dc740", "score": "0.59040236", "text": "func (r *RightRight) GetPath() string { return fmt.Sprintf(\"/api/objects/right/right/%s\", r.Reference) }", "title": "" } ]
54497b3493b37444f7f43cd76832bd5c
cleanup logger for test
[ { "docid": "0e3dc171635dfd5c760133a8e736fbda", "score": "0.7524177", "text": "func cleanup() {\n\tsingleton = newPlaceHolderLogger()\n\tLog = singleton\n}", "title": "" } ]
[ { "docid": "56f67a396d4b6c865ef4c75245d9db25", "score": "0.7794777", "text": "func teardownLoggerTest(config *models.Config) {\n\tabsLogDir := config.AbsLogDirectory()\n\tif fileutil.LooksSafeToDelete(absLogDir, 12, 3) {\n\t\t// Don't call remove all on \"/\" or \"/usr\" or anything like that.\n\t\tos.RemoveAll(absLogDir)\n\t} else {\n\t\tfmt.Printf(\"Not deleting log dir '%s' because it looks dangerous.\\n\"+\n\t\t\t\"Delete that manually, if you thing it's safe.\\n\", absLogDir)\n\t}\n}", "title": "" }, { "docid": "11f0f9e3036990c26832018fe0dc5b7d", "score": "0.737688", "text": "func (wl *dummyLogger) Clean() {\n}", "title": "" }, { "docid": "c180b4b162e79350ac0f0b052bd9a114", "score": "0.6911063", "text": "func DeinitializeLogging() {\n\tif logFileHandle != nil {\n\t\tlogFileHandle.Close()\n\t}\n}", "title": "" }, { "docid": "d761745f31176e4c59f7aeae8145ea88", "score": "0.6803675", "text": "func init() {\n\tlogrus.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "8d94efb197c27a342fa77aa76442bbce", "score": "0.6746435", "text": "func CleanupWithLogs(t *testing.T, profile string, cancel context.CancelFunc) {\n\tt.Helper()\n\tif !t.Failed() {\n\t\tCleanup(t, profile, cancel)\n\t\treturn\n\t}\n\n\tt.Logf(\"*** %s FAILED at %s\", t.Name(), time.Now())\n\tPostMortemLogs(t, profile)\n\tCleanup(t, profile, cancel)\n}", "title": "" }, { "docid": "364a191294925612d18aaa621203a79a", "score": "0.66693443", "text": "func (s *stdLogger) Cleanup() {\n\tfatal := false\n\tp := recover()\n\n\tif _, ok := p.(fatalLog); ok {\n\t\tfatal = true\n\t\tp = nil\n\t} else if p != nil {\n\t\ts.Println(p)\n\t}\n\n\ts.Close()\n\n\tif p != nil {\n\t\tpanic(p)\n\t} else if fatal {\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "c7d5f6d7f04373f3282e2f7b126119f4", "score": "0.6500702", "text": "func (logger *Logger) clean() {\n\tlogger.log.SetPrefix(\"\")\n\tif logger.buf.Len()/1024 > logger.flushSize {\n\t\tgo logger.Flush()\n\t}\n}", "title": "" }, { "docid": "81af09aea5c6c5210c7d3da078cc2977", "score": "0.64360034", "text": "func (a *AudioLog) Cleanup() error { return nil }", "title": "" }, { "docid": "4647a1a8e13e5dacb79a3872284e4181", "score": "0.64290476", "text": "func AfterSuiteCleanup() {\n\tlogf.Log.Info(\"AfterSuiteCleanup\")\n}", "title": "" }, { "docid": "b186019d8c1289c34853c65aabef5b14", "score": "0.63613224", "text": "func (ot *openTelemetryWrapper) cleanup(logger *zap.Logger) error {\n\treturn globalTracerProvider.cleanupTracerProvider(logger)\n}", "title": "" }, { "docid": "ea270c4a87da70aae061833fe0695c43", "score": "0.6311122", "text": "func initLog(t *testing.T) *logger.Logger {\n\tInfoLevel := int8(3)\n\tlog, err := logger.InitLogger(InfoLevel)\n\tif err != nil {\n\t\tt.Errorf(\"#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s\", err)\n\t}\n\treturn log\n}", "title": "" }, { "docid": "d182dc069c9db9704a5973549f04737e", "score": "0.6255607", "text": "func cleanup() {\n\tif len(tmpDir) > 0 {\n\t\tlogDebug.Printf(\"cleaning up %s\", tmpDir)\n\t\tos.RemoveAll(tmpDir)\n\t}\n}", "title": "" }, { "docid": "d13dc4f1a15450231d45a594e928f77f", "score": "0.6154652", "text": "func WriteLogClean() {\n\n\tRemoveFile(FILELOG)\n}", "title": "" }, { "docid": "ec3dd97035614d0e5b27a43bffe5ed13", "score": "0.61124116", "text": "func (u *Unpackerr) setupLogging() {\n\tu.Logger.debug = u.Config.Debug\n\n\tif u.Logger.Logger.SetFlags(log.LstdFlags); u.Config.Debug {\n\t\tu.Logger.Logger.SetFlags(log.Lshortfile | log.Lmicroseconds | log.Ldate)\n\t}\n\n\tlogFile, err := homedir.Expand(u.Config.LogFile)\n\tif err != nil {\n\t\tlogFile = u.Config.LogFile\n\t}\n\n\tu.Config.LogFile = logFile\n\trotate := &rotatorr.Config{\n\t\tFilepath: u.Config.LogFile, // log file name.\n\t\tFileSize: int64(u.Config.LogFileMb) * megabyte, // megabytes\n\t\tRotatorr: &timerotator.Layout{\n\t\t\tFileCount: u.Config.LogFiles,\n\t\t\tPostRotate: u.postLogRotate,\n\t\t}, // number of files to keep.\n\t\tDirMode: logsDirMode,\n\t}\n\n\tvar writer io.Writer\n\n\tswitch { // only use MultiWriter if we have > 1 writer.\n\tcase !u.Config.Quiet && u.Config.LogFile != \"\":\n\t\tu.rotatorr = rotatorr.NewMust(rotate)\n\t\twriter = io.MultiWriter(u.rotatorr, os.Stdout)\n\t\tlog.SetOutput(writer)\n\tcase !u.Config.Quiet && u.Config.LogFile == \"\":\n\t\twriter = os.Stdout\n\tcase u.Config.LogFile == \"\":\n\t\twriter = ioutil.Discard // default is \"nothing\"\n\tdefault:\n\t\tu.rotatorr = rotatorr.NewMust(rotate)\n\t\twriter = u.rotatorr\n\t\tlog.SetOutput(writer)\n\t}\n\n\tu.Logger.Logger.SetOutput(writer)\n\tu.postLogRotate(\"\", \"\")\n}", "title": "" }, { "docid": "7a68e57b27ec1ce373672d7b99948845", "score": "0.6104753", "text": "func CleanupLogs() error {\n\tcurrentDir := LogDir()\n\tif currentDir == \"\" {\n\t\tglog.Infof(\"Glog's log dir is not set, nothing to clean up\")\n\t\treturn nil\n\t}\n\tglog.Infof(\"Will clean up logs in: %s\", currentDir)\n\treturn removeFiles(currentDir, programName())\n}", "title": "" }, { "docid": "0474cfef313cdf3859cab54e8934245b", "score": "0.60162795", "text": "func ResetLogger() {\n\t*logrus.StandardLogger() = *logrus.New()\n}", "title": "" }, { "docid": "5f283f952d06997d499aa03f64482008", "score": "0.6002816", "text": "func Cleanup() {\n\tif tracer == nil {\n\t\treturn\n\t}\n\ttracer.Cleanup()\n}", "title": "" }, { "docid": "f6e9fc95c0f2f55e48b1369a3a21dbff", "score": "0.59879106", "text": "func (l *Logger) DelLogger(adapter string) error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\tif lg, ok := l.outputs[adapter]; ok {\n\t\tlg.Destroy()\n\t\tdelete(l.outputs, adapter)\n\t} else {\n\t\tpanic(\"log: unknown adapter \\\"\" + adapter + \"\\\" (forgotten register?)\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a12940c550264eb8dc937ea165ca070", "score": "0.5983272", "text": "func Shutdown() {\n std.logger.Output(2, fmt.Sprintln(\"Goodbye\"));\n if (std.logFile != nil) {\n std.logFile.Close()\n }\n}", "title": "" }, { "docid": "c6cd4b78a2ef977bfb649f3d0cc33b33", "score": "0.5967545", "text": "func (tr *TestRecorder) CleanUp() {\n\ttr.Recorder.CleanUp()\n\ttests.ResetHelpers()\n}", "title": "" }, { "docid": "b28bdd05406d62811731a5c8c8d3de44", "score": "0.59547377", "text": "func DisableLogging() {}", "title": "" }, { "docid": "505ce32a676a16d22b37dc48c08f67ec", "score": "0.5938931", "text": "func (l *MockLogger) Flush() {}", "title": "" }, { "docid": "6fd1ae20ce26b895089d2d7c3ba460e5", "score": "0.59149116", "text": "func cleanup(ctx context.Context, fs fs, logger log.FieldLogger, props processorProps) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"cleanup\")\n\tdefer span.Finish()\n\n\terr := fs.DeleteDir(props.WorkDir)\n\tif err != nil {\n\t\tlogger.Errorf(\"%+v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "fc3636aab56a869af52ba573eb12e829", "score": "0.5905108", "text": "func (_m *mockImportSteps) Cleanup(tempdir string) {\n\t_m.Called(tempdir)\n}", "title": "" }, { "docid": "8328a6c1ca50e561a0619e3b5906512a", "score": "0.58969545", "text": "func init() {\n\tDisableLog()\n}", "title": "" }, { "docid": "8328a6c1ca50e561a0619e3b5906512a", "score": "0.58969545", "text": "func init() {\n\tDisableLog()\n}", "title": "" }, { "docid": "8328a6c1ca50e561a0619e3b5906512a", "score": "0.58969545", "text": "func init() {\n\tDisableLog()\n}", "title": "" }, { "docid": "1548bcfb50e4e87eef6a09609468dbf7", "score": "0.588495", "text": "func cleanup() {\n\tos.Remove(dummyPath)\n}", "title": "" }, { "docid": "af2fcdbc43465a861f136fea5dfee02c", "score": "0.58706975", "text": "func FlushLogger() {\n\tif logger != nil {\n\t\t// #nosec\n\t\t// nolint: errcheck\n\t\tlogger.Sync()\n\t}\n\n}", "title": "" }, { "docid": "cdb1df9bedee1707ed68e96063347fc8", "score": "0.5853038", "text": "func cleanup(ctx context.Context, didSignOut bool, tconn *chrome.TestConn) {\n\tif didSignOut {\n\t\treturn\n\t}\n\tif err := signOut(ctx, tconn); err != nil {\n\t\ttesting.ContextLog(ctx, \"Failed to sign out during cleanup: \", err)\n\t\ttesting.ContextLog(ctx, \"The above error is likely caused by an error occurred in test body\")\n\t}\n}", "title": "" }, { "docid": "836d3b486f689cfa3601ae8b0f5a9f47", "score": "0.58384496", "text": "func (_m *ITestCase) CleanupTestCase() {\n\t_m.Called()\n}", "title": "" }, { "docid": "7ec13334bba587e4a9b2a301a16f74b5", "score": "0.5837096", "text": "func Reset() {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tlogger = newLogger()\n}", "title": "" }, { "docid": "8eb368cd26ba0650f4b9d2cf31b49901", "score": "0.5810434", "text": "func TestMain(m *testing.M) {\n\tlog.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "b64d51163a395270c66e1d636c115eeb", "score": "0.5766965", "text": "func Dummy() *log.Logger {\n\treturn log.New(ioutil.Discard, \"\", 0)\n}", "title": "" }, { "docid": "d5bffc1ee203ab82fd3cc099e5a51fd3", "score": "0.5757918", "text": "func (g *GarbageCollectionItem) delLogFile() {\n\tlogrus.Infof(\"service id: %s;delete log file.\", g.ServiceID)\n\t// log generated during service running\n\tdockerLogPath := eventutil.DockerLogFilePath(g.Cfg.LogPath, g.ServiceID)\n\tif err := os.RemoveAll(dockerLogPath); err != nil {\n\t\tlogrus.Warningf(\"remove docker log files: %v\", err)\n\t}\n\t// log generated by the service event\n\teventLogPath := eventutil.EventLogFilePath(g.Cfg.LogPath)\n\tfor _, eventID := range g.EventIDs {\n\t\teventLogFileName := eventutil.EventLogFileName(eventLogPath, eventID)\n\t\tlogrus.Debugf(\"remove event log file: %s\", eventLogFileName)\n\t\tif err := os.RemoveAll(eventLogFileName); err != nil {\n\t\t\tlogrus.Warningf(\"file: %s; remove event log file: %v\", eventLogFileName, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cac88c28b969ddbc8dbd83049f3032ee", "score": "0.575771", "text": "func stopFileLogger() error {\n\tlog.DelLogger(\"file\")\n\n\terr := logFile.Close()\n\tif err != nil {\n\t\tlog.Error(\"error closing log file: %v\", err)\n\t} else {\n\t\tlogFile = nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "d433fda12feb570b25a4bed989f940fe", "score": "0.5723795", "text": "func DelLogger(name string) error {\n\tlogger, _ := NamedLoggers.Load(DEFAULT)\n\tfound, err := logger.DelLogger(name)\n\tif !found {\n\t\tTrace(\"Log %s not found, no need to delete\", name)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "70fe2a3141ba40212f0f6334d206eccb", "score": "0.57197416", "text": "func (inst *MgoInstance) DestroyWithLog() {\n\tinst.killAndCleanup(os.Kill)\n}", "title": "" }, { "docid": "b40f03efb6a037d163c86109aad238d4", "score": "0.56998694", "text": "func (d *FileWriter) CleanUp() {\n\tconst hoursPerDay = 24\n\n\tlogger := log.PrefixedLog(loggerPrefixFileWriter)\n\n\tlogger.Trace(\"starting clean up\")\n\n\tfiles, err := os.ReadDir(d.target)\n\n\tutil.LogOnErrorWithEntry(logger.WithField(\"target\", d.target), \"can't list log directory: \", err)\n\n\t// search for log files, which names starts with date\n\tfor _, f := range files {\n\t\tif strings.HasSuffix(f.Name(), \".log\") && len(f.Name()) > 10 {\n\t\t\tt, err := time.Parse(\"2006-01-02\", f.Name()[:10])\n\t\t\tif err == nil {\n\t\t\t\tdifferenceDays := uint64(time.Since(t).Hours() / hoursPerDay)\n\t\t\t\tif d.logRetentionDays > 0 && differenceDays > d.logRetentionDays {\n\t\t\t\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\t\t\t\"file\": f.Name(),\n\t\t\t\t\t\t\"ageInDays\": differenceDays,\n\t\t\t\t\t\t\"logRetentionDays\": d.logRetentionDays,\n\t\t\t\t\t}).Info(\"existing log file is older than retention time and will be deleted\")\n\n\t\t\t\t\terr := os.Remove(filepath.Join(d.target, f.Name()))\n\t\t\t\t\tutil.LogOnErrorWithEntry(logger.WithField(\"file\", f.Name()), \"can't remove file: \", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "38772e004e69bfad5cb645fd4e5b9f6b", "score": "0.5698984", "text": "func TestLogging(t *testing.T) {\n\ttmpOut := bytes.Buffer{}\n\n\tlogger := log.New()\n\tlogger.Out = &tmpOut\n\tlogger.Level = log.TraceLevel\n\tlogger.Date = \"\"\n\n\tlogger.Printf(\"Prolly worked\")\n\tif tmpOut.String() != \"Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Trace(\"Prolly worked\")\n\tif tmpOut.String() != \"TRACE Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Debug(\"Prolly worked\")\n\tif tmpOut.String() != \"DEBUG Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Info(\"Prolly worked\")\n\tif tmpOut.String() != \" INFO Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Warn(\"Prolly worked\")\n\tif tmpOut.String() != \" WARN Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Error(\"Prolly worked\")\n\tif tmpOut.String() != \"ERROR Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Fatal(\"Prolly worked\")\n\tif tmpOut.String() != \"FATAL Prolly worked\\n\" {\n\t\tt.Errorf(\"Failed to Printf - '%s'\", tmpOut.String())\n\t}\n\ttmpOut.Reset()\n\n\tlogger.Date = \"2006-01-02 15:04:05.00000\"\n\tlogger.Trace(\"Prolly worked\")\n\tlogger.Debug(\"Prolly worked\")\n\tlogger.Info(\"Prolly worked\")\n\tlogger.Warn(\"Prolly worked\")\n\tlogger.Error(\"Prolly worked\")\n\tlogger.Fatal(\"Prolly worked\")\n}", "title": "" }, { "docid": "e9f6a98cb1cedaca57d7905dd6158d3e", "score": "0.5683496", "text": "func (t *tInfo) teardown() {\n\tt.recorders.close()\n\n\tif t.apiClient != nil {\n\t\tt.apiClient.ClusterV1().Version().Delete(context.Background(), &api.ObjectMeta{Name: t.testName})\n\t\tt.apiClient.Close()\n\t\tt.apiClient = nil\n\t}\n\n\tif t.esClient != nil {\n\t\tt.esClient.Close()\n\t}\n\n\ttestutils.StopElasticsearch(t.elasticsearchName, t.elasticsearchDir)\n\n\tif t.mockCitadelQueryServer != nil {\n\t\tt.mockCitadelQueryServer.Stop()\n\t\tt.mockCitadelQueryServer = nil\n\t}\n\n\tif t.evtsMgr != nil {\n\t\tt.evtsMgr.Stop()\n\t\tt.evtsMgr = nil\n\t}\n\n\tt.evtProxyServices.Stop()\n\n\tif t.apiServer != nil {\n\t\tt.apiServer.Stop()\n\t\tt.apiServer = nil\n\t}\n\n\t// stop certificate server\n\ttestutils.CleanupIntegTLSProvider()\n\n\tif t.mockResolver != nil {\n\t\tt.mockResolver.Stop()\n\t\tt.mockResolver = nil\n\t}\n\n\t// remove the local persistent events store\n\tt.logger.Infof(\"removing events store %s\", t.storeConfig.Dir)\n\tos.RemoveAll(t.storeConfig.Dir)\n\n\tt.logger.Infof(\"completed test\")\n}", "title": "" }, { "docid": "1d2bc5804b81b458aad38c3ecab17229", "score": "0.56734794", "text": "func getTestLogger() logging.Logger {\n\treturn logging.ConsoleLogger{SetTimeStamp: false}\n}", "title": "" }, { "docid": "ad3dda3fa72d2d816421d730a71976eb", "score": "0.56537664", "text": "func (b Bucket) DeleteLogging(args ...Params) error {\n\theader, query := getHeaderQuery(args)\n\tquery.Set(\"logging\", \"\")\n\treturn b.Do(\"DELETE\", \"\", nil, nil, header, query)\n}", "title": "" }, { "docid": "ec1fe9a29c34ad5409a2d4298387d6db", "score": "0.5652795", "text": "func (log *Logger) Unwrap() {\n\tlog.Lock()\n\tdefer log.Unlock()\n\tlog.unwrap()\n}", "title": "" }, { "docid": "b3dc6d62237f7821b2942c096207129e", "score": "0.56194586", "text": "func (l prefixer) UnwrapLogger() (Logger, bool) {\n\treturn l.Target, true\n}", "title": "" }, { "docid": "80e9e98a0fe0707dd1f427ef0d66b165", "score": "0.5606568", "text": "func TestMultiLoggers(t *testing.T) {\n\t// New logger for output stderr\n\tlogStd := New(\"\", LevelDebug, os.Stderr)\n\tlogStd.Info(\"a stderr logger\")\n\n\t// New logger for output file\n\tfw, err := FileWriter(\"logs/test.log\")\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\t}\n\tlogFile := New(\"\", LevelDebug, fw)\n\tlogFile.Info(\"a file logger\")\n}", "title": "" }, { "docid": "e1d8775c2496860d1d8b96451b6d798e", "score": "0.5600405", "text": "func (logger *Logger) Close() {\n\tif logger.baseFile != nil {\n\t\t_ = logger.baseFile.Close()\n\t}\n\n\tlogger.baseLogger = nil\n\tlogger.baseFile = nil\n}", "title": "" }, { "docid": "76012ea82cb8432537abe96e2468595c", "score": "0.55949533", "text": "func TestLogsFileRemove(t *testing.T) {\n\tmultilineWaitPeriod = 10 * time.Millisecond\n\tlogEntryString := \"anything\"\n\ttmpfile, err := createTempFile(\"\", \"\")\n\tdefer os.Remove(tmpfile.Name())\n\trequire.NoError(t, err)\n\n\t_, err = tmpfile.WriteString(logEntryString + \"\\n\")\n\trequire.NoError(t, err)\n\n\ttt := NewLogFile()\n\ttt.Log = TestLogger{t}\n\ttt.FileConfig = []FileConfig{{FilePath: tmpfile.Name(), FromBeginning: true}}\n\ttt.FileConfig[0].init()\n\ttt.started = true\n\n\tlsrcs := tt.FindLogSrc()\n\tif len(lsrcs) != 1 {\n\t\tt.Fatalf(\"%v log src was returned when 1 should be available\", len(lsrcs))\n\t}\n\n\tts := lsrcs[0].(*tailerSrc)\n\tts.outputFn = func(e logs.LogEvent) {}\n\n\tgo func() {\n\t\ttime.Sleep(500 * time.Millisecond)\n\t\tif err := os.Remove(tmpfile.Name()); err != nil {\n\t\t\tt.Errorf(\"Failed to remove tmp file '%v': %v\", tmpfile.Name(), err)\n\t\t}\n\t}()\n\n\tstopped := make(chan struct{})\n\tgo func() {\n\t\tts.runTail()\n\t\tclose(stopped)\n\t}()\n\n\tselect {\n\tcase <-time.After(1 * time.Second):\n\t\tt.Errorf(\"tailerSrc should have stopped after tile is removed\")\n\tcase <-stopped:\n\t}\n\n\ttt.Stop()\n}", "title": "" }, { "docid": "b236f3936525b0858ea98869cbfc8da6", "score": "0.5578697", "text": "func ResetLogger(logger ...*logrus.Logger) {\n\tif len(logger) > 0 {\n\t\t*logrus.StandardLogger() = *logger[0]\n\t} else {\n\t\t*logrus.StandardLogger() = *logrus.New()\n\t}\n\tlog.SetOutput(os.Stderr)\n}", "title": "" }, { "docid": "a7dfa2a8027a6db6e6bb70d47ea34783", "score": "0.5576851", "text": "func WithoutContext() Logger {\n\treturn mainLogger\n}", "title": "" }, { "docid": "bae6ec299f47adb784262622052102ca", "score": "0.5573639", "text": "func endLogging() {\n\tif logFile != nil {\n\t\tlogFile.Close()\n\t}\n\tlog.SetOutput(os.Stderr)\n}", "title": "" }, { "docid": "8c3a6719ea358c9568e87830db29d936", "score": "0.5542314", "text": "func (f *FakeMounter) ResetLog() {\n\tf.mutex.Lock()\n\tdefer f.mutex.Unlock()\n\n\tf.log = []FakeAction{}\n}", "title": "" }, { "docid": "fbab73d17e62a4357e453f15a8818cd3", "score": "0.5526486", "text": "func CleanupBuildArtifacts() {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tif tmpDir != \"\" {\n\t\tos.RemoveAll(tmpDir)\n\t\ttmpDir = \"\"\n\t}\n}", "title": "" }, { "docid": "aaafa565603f0556b86ec859c04f5266", "score": "0.5515104", "text": "func TestOneLogger(t *testing.T) {\n\t// Default output to stderr\n\tSetLevel(LevelDebug)\n\tDebug(\"stderr: Debug\")\n\tDebugf(\"stderr: Debug%s\", \"f\")\n\tInfo(\"stderr: Info\")\n\tInfof(\"stderr: Info%s\", \"f\")\n\tWarn(\"stderr: Warn\")\n\tWarnf(\"stderr: Warn%s\", \"f\")\n\tError(\"stderr: Error\")\n\tErrorf(\"stderr: Error%s\", \"f\")\n\t//Panic(\"stderr: Panic\")\n\t//Panicf(\"stderr: Panic%s\", \"f\")\n\t//Fatal(\"stderr: Fatal\")\n\t//Fatalf(\"stderr: Fatal%s\", \"f\")\n\n\t// Change output to file\n\tfw, err := FileWriter(\"logs/test.log\")\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\t}\n\tSetOutput(fw)\n\tSetLevel(LevelDebug)\n\tInfo(\"file: Info\")\n}", "title": "" }, { "docid": "770bb6799ed8db9363866a47a4f31ead", "score": "0.5499424", "text": "func setUp() {\n\tvar logger = apis.Logger\n\tmanager.Logger = logger.WithField(\"hook\", manager.LoggingTag)\n}", "title": "" }, { "docid": "41f99e85794051d24ec060b50a1d5b59", "score": "0.5498622", "text": "func cleanup(t *testing.T, namespace string) {\n\targs := \"delete\"\n\tif namespace != \"\" {\n\t\targs += \" -n \" + namespace\n\t}\n\n\terr, stdout, stderr := runSonobuoyCommand(t, args)\n\n\tif err != nil {\n\t\tt.Logf(\"Error encountered during cleanup: %q\\n\", err)\n\t\tt.Log(stdout.String())\n\t\tt.Log(stderr.String())\n\t}\n}", "title": "" }, { "docid": "73cbf4128f0a6a268f8f9b6eaf34fadf", "score": "0.5490181", "text": "func examLogger() {\n\tvar (\n\t\tbuf bytes.Buffer\n\t\tlogger0 = log.New(&buf, \"logger: \", log.Ltime)\n\t\tlogger1 = log.New(&buf, \"logger: \", log.Lmicroseconds)\n\t\tlogger2 = log.New(&buf, \"logger: \", log.Llongfile)\n\t\tlogger3 = log.New(&buf, \"logger: \", log.Lshortfile)\n\t\tlogger4 = log.New(&buf, \"logger: \", log.LUTC)\n\t\tlogger5 = log.New(&buf, \"logger: \", log.LstdFlags)\n\t\tlogger6 = log.New(&buf, \"logger: \", log.LstdFlags|log.Lshortfile)\n\t)\n\n\tlogger0.Print(\"------------------\")\n\tlogger1.Print(\"------------------\")\n\tlogger2.Print(\"------------------\")\n\tlogger3.Print(\"------------------\")\n\tlogger4.Print(\"------------------\")\n\tlogger5.Print(\"------------------\")\n\tlogger6.Print(\"------------------\")\n\t// logger0.Fatal(\"------------------Fatal------------------\")\n\tfmt.Print(&buf)\n}", "title": "" }, { "docid": "ba84923151fe86385c0563f1c09778bc", "score": "0.54794085", "text": "func mosquitto_auth_plugin_cleanup(cUserData unsafe.Pointer, cOpts *C.struct_mosquitto_opt, cOptCount C.int) C.int {\n\tlogger.Println(\"enter - plugin cleanup\")\n\t// close logfile\n\tif file != nil {\n\t\tfile.Sync()\n\t\tfile.Close()\n\t\tfile = nil\n\t}\n\t// set the client cache to nil so it can be garage collected\n\tclearUserData((*userData)(cUserData))\n\n\tlogger.Println(\"leave - plugin cleanup\")\n\tlogger = nil\n\treturn C.MOSQ_ERR_SUCCESS\n}", "title": "" }, { "docid": "90b807a5ed7fe213db3d4fb7e85d687c", "score": "0.5477491", "text": "func cleanup(config *Config) {\n\twriteErr := config.WriteConfig(configPath)\n\tif writeErr != nil {\n\t\tError.Println(writeErr.Error())\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "1e912203dd14c51ccc79b58e6ca41efb", "score": "0.5462789", "text": "func cleanup(t *testing.T) {\n\tconn := connectAllZk(t)\n\terr := recursiveDelete(conn, zkPrefix)\n\tif err != nil {\n\t\tt.Fatalf(\"cleanup err=%q\", err)\n\t}\n\tconn.Close()\n}", "title": "" }, { "docid": "00a3b4fa98c818cbcd512aae96cbfed8", "score": "0.54620874", "text": "func UnInit() {\n\tif fileLoggerQueue != nil {\n\t\tfileLoggerQueue <- \"\"\n\t}\n\n\tjobWaiter.Wait()\n\n\tif fileLoggerQueue != nil {\n\t\tclose(fileLoggerQueue)\n\t\tfileLoggerQueue = nil\n\t}\n}", "title": "" }, { "docid": "80c9b923f707b93fdd9fbb874d332281", "score": "0.5453938", "text": "func cleanup() {\n\tif integrationType == slackIntegrationType {\n\t\tif err := slack.DeleteState(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t} else {\n\t\tif err := github.DeleteState(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9037779d925663387f68b7f711f614a6", "score": "0.5446274", "text": "func Test_SimpleLogger(t *testing.T) {\n\tdefer b.Reset()\n\n\tt.Run(\"NoFields\", func(t *testing.T) {\n\t\tdefer b.Reset()\n\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\tOutput: b,\n\t\t})\n\n\t\ttests := []struct {\n\t\t\tlevel string\n\t\t\tfile string\n\t\t\tfunction string\n\t\t\tf func(msg string)\n\t\t}{\n\t\t\t{\n\t\t\t\tlevel: \"ERROR\",\n\t\t\t\tfile: \"log_test.go\",\n\t\t\t\tfunction: \"1()\",\n\t\t\t\tf: log.Error,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlevel: \"INFO \",\n\t\t\t\tfile: \"log_test.go\",\n\t\t\t\tfunction: \"1()\",\n\t\t\t\tf: log.Info,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlevel: \"DEBUG\",\n\t\t\t\tfile: \"log_test.go\",\n\t\t\t\tfunction: \"1()\",\n\t\t\t\tf: log.Debug,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlevel: \"WARN \",\n\t\t\t\tfile: \"log_test.go\",\n\t\t\t\tfunction: \"1()\",\n\t\t\t\tf: log.Warn,\n\t\t\t},\n\t\t}\n\n\t\tfor _, test := range tests {\n\t\t\tt.Run(test.level, func(t *testing.T) {\n\t\t\t\ttest.f(\"there was an error\")\n\t\t\t\tdefer b.Reset()\n\n\t\t\t\tout := b.String()\n\n\t\t\t\tassureSingleNewline(out, t)\n\n\t\t\t\tlevel, file, function, _ := splitMessage(out, t)\n\n\t\t\t\tif level != test.level {\n\t\t\t\t\tt.Errorf(\"expected level: '%s'. actual level: '%s'\", test.level, level)\n\t\t\t\t}\n\n\t\t\t\tif file != test.file {\n\t\t\t\t\tt.Errorf(\"expected file: '%s'. actual file: '%s'\", test.file, file)\n\t\t\t\t}\n\n\t\t\t\tif function != test.function {\n\t\t\t\t\tt.Errorf(\"expected function: '%s'. actual function: '%s'\", test.function, function)\n\t\t\t\t}\n\n\t\t\t\tif len(strings.Split(strings.TrimSpace(out), \"\\n\")) > 1 {\n\t\t\t\t\tt.Errorf(\"expected single line log point: '%s\", out)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n\n\tt.Run(\"WithFields\", func(t *testing.T) {\n\t\tdefer b.Reset()\n\t\tt.Run(\"Single Field\", func(t *testing.T) {\n\t\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\t\tOutput: b,\n\t\t\t})\n\n\t\t\ttests := []struct {\n\t\t\t\tlevel string\n\t\t\t\tfile string\n\t\t\t\tfunction string\n\t\t\t\tkey string\n\t\t\t\tvalue interface{}\n\t\t\t\tf func(string)\n\t\t\t}{\n\t\t\t\t{\n\t\t\t\t\tlevel: \"ERROR\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tkey: \"sample\",\n\t\t\t\t\tvalue: \"banana\",\n\t\t\t\t\tf: log.WithFields(log.Fields{\"sample\": \"banana\"}).Error,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"INFO \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tkey: \"text\",\n\t\t\t\t\tvalue: 1,\n\t\t\t\t\tf: log.WithFields(log.Fields{\"text\": 1}).Info,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"DEBUG\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tkey: \"burger\",\n\t\t\t\t\tvalue: []string{\"sorry fellas\"},\n\t\t\t\t\tf: log.WithFields(log.Fields{\"burger\": []string{\"sorry fellas\"}}).Debug,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"WARN \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tkey: \"salad\",\n\t\t\t\t\tvalue: \"fortnite\",\n\t\t\t\t\tf: log.WithFields(log.Fields{\"salad\": \"fortnite\"}).Warn,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfor _, test := range tests {\n\t\t\t\tt.Run(test.level, func(t *testing.T) {\n\t\t\t\t\ttest.f(\"there was an error\")\n\t\t\t\t\tdefer b.Reset()\n\n\t\t\t\t\tout := b.String()\n\n\t\t\t\t\t//t.Log(b.String())\n\n\t\t\t\t\tassureSingleNewline(out, t)\n\n\t\t\t\t\tlevel, file, function, _ := splitMessage(out, t)\n\n\t\t\t\t\tif level != test.level {\n\t\t\t\t\t\tt.Errorf(\"expected level: '%s'. actual level: '%s'\", test.level, level)\n\t\t\t\t\t}\n\n\t\t\t\t\tif file != test.file {\n\t\t\t\t\t\tt.Errorf(\"expected file: '%s'. actual file: '%s'\", test.file, file)\n\t\t\t\t\t}\n\n\t\t\t\t\tif function != test.function {\n\t\t\t\t\t\tt.Errorf(\"expected function: '%s'. actual function: '%s'\", test.function, function)\n\t\t\t\t\t}\n\n\t\t\t\t\tif ok, fields := hasField(test.key, test.value, out, t); !ok {\n\t\t\t\t\t\tt.Errorf(\"expected fields to contain: '%s=%v. actual fields total: %s\", test.key, test.value, fields)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"Multiple Fields\", func(t *testing.T) {\n\t\t\tdefer b.Reset()\n\t\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\t\tOutput: b,\n\t\t\t})\n\n\t\t\ttests := []struct {\n\t\t\t\tlevel string\n\t\t\t\tfile string\n\t\t\t\tfunction string\n\t\t\t\tfields log.Fields\n\t\t\t\tf func(string)\n\t\t\t}{\n\t\t\t\t{\n\t\t\t\t\tlevel: \"ERROR\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"one\": 1,\n\t\t\t\t\t\t\"two\": \"2\",\n\t\t\t\t\t\t\"three\": []string{\"1\", \"2\", \"3\"},\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"one\": 1,\n\t\t\t\t\t\t\"two\": \"2\",\n\t\t\t\t\t\t\"three\": []string{\"1\", \"2\", \"3\"},\n\t\t\t\t\t}).Error,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"INFO \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"sample\": \"this is a long piece of text\",\n\t\t\t\t\t\t\"true\": false,\n\t\t\t\t\t\t\"false\": true,\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"sample\": \"this is a long piece of text\",\n\t\t\t\t\t\t\"true\": false,\n\t\t\t\t\t\t\"false\": true,\n\t\t\t\t\t}).Info,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"WARN \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"one\": nil,\n\t\t\t\t\t\t\"okay but\": \"epic\",\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"one\": nil,\n\t\t\t\t\t\t\"okay but\": \"epic\",\n\t\t\t\t\t}).Warn,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"DEBUG\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"teamwork\": -1,\n\t\t\t\t\t\t\"dreamwork\": []bool{false, true},\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"teamwork\": -1,\n\t\t\t\t\t\t\"dreamwork\": []bool{false, true},\n\t\t\t\t\t}).Debug,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfor _, test := range tests {\n\t\t\t\tt.Run(test.level, func(t *testing.T) {\n\t\t\t\t\ttest.f(\"burger\")\n\n\t\t\t\t\tdefer b.Reset()\n\n\t\t\t\t\tout := b.String()\n\n\t\t\t\t\t//t.Log(b.String())\n\n\t\t\t\t\tassureSingleNewline(out, t)\n\n\t\t\t\t\tlevel, file, function, _ := splitMessage(out, t)\n\n\t\t\t\t\tif level != test.level {\n\t\t\t\t\t\tt.Errorf(\"expected level: '%s'. actual level: '%s'\", test.level, level)\n\t\t\t\t\t}\n\n\t\t\t\t\tif file != test.file {\n\t\t\t\t\t\tt.Errorf(\"expected file: '%s'. actual file: '%s'\", test.file, file)\n\t\t\t\t\t}\n\n\t\t\t\t\tif function != test.function {\n\t\t\t\t\t\tt.Errorf(\"expected function: '%s'. actual function: '%s'\", test.function, function)\n\t\t\t\t\t}\n\n\t\t\t\t\tfor k, v := range test.fields {\n\t\t\t\t\t\tif ok, fields := hasField(k, v, out, t); !ok {\n\t\t\t\t\t\t\tt.Errorf(\"expected fields to contain: '%s=%v. actual fields total: %s\", k, v, fields)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"Append Fields\", func(t *testing.T) {\n\t\t\tdefer b.Reset()\n\t\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\t\tOutput: b,\n\t\t\t})\n\n\t\t\ttests := []struct {\n\t\t\t\tlevel string\n\t\t\t\tfile string\n\t\t\t\tfunction string\n\t\t\t\tfields log.Fields\n\t\t\t\tf func(string)\n\t\t\t}{\n\t\t\t\t{\n\t\t\t\t\tlevel: \"ERROR\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"one\": 1,\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"one\": 1,\n\t\t\t\t\t}).WithFields(log.Fields{}).Error,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"INFO \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"sample\": \"this is a long piece of text\",\n\t\t\t\t\t\t\"true\": false,\n\t\t\t\t\t\t\"false\": true,\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"sample\": \"this is a long piece of text\",\n\t\t\t\t\t}).WithFields(log.Fields{\n\t\t\t\t\t\t\"false\": true,\n\t\t\t\t\t}).WithFields(log.Fields{\n\t\t\t\t\t\t\"true\": false,\n\t\t\t\t\t}).Info,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"WARN \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"one\": nil,\n\t\t\t\t\t\t\"okay but\": \"epic\",\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"one\": nil,\n\t\t\t\t\t}).WithFields(log.Fields{\n\t\t\t\t\t\t\"okay but\": \"epic\",\n\t\t\t\t\t}).Warn,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"DEBUG\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"teamwork\": -1,\n\t\t\t\t\t\t\"dreamwork\": []bool{false, true},\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"teamwork\": -1,\n\t\t\t\t\t}).WithFields(log.Fields{\n\t\t\t\t\t\t\"dreamwork\": []bool{false, true},\n\t\t\t\t\t}).Debug,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfor _, test := range tests {\n\t\t\t\tt.Run(test.level, func(t *testing.T) {\n\t\t\t\t\ttest.f(\"burger\")\n\n\t\t\t\t\tdefer b.Reset()\n\n\t\t\t\t\tout := b.String()\n\n\t\t\t\t\t//t.Log(b.String())\n\n\t\t\t\t\tassureSingleNewline(out, t)\n\n\t\t\t\t\tlevel, file, function, _ := splitMessage(out, t)\n\n\t\t\t\t\tif level != test.level {\n\t\t\t\t\t\tt.Errorf(\"expected level: '%s'. actual level: '%s'\", test.level, level)\n\t\t\t\t\t}\n\n\t\t\t\t\tif file != test.file {\n\t\t\t\t\t\tt.Errorf(\"expected file: '%s'. actual file: '%s'\", test.file, file)\n\t\t\t\t\t}\n\n\t\t\t\t\tif function != test.function {\n\t\t\t\t\t\tt.Errorf(\"expected function: '%s'. actual function: '%s'\", test.function, function)\n\t\t\t\t\t}\n\n\t\t\t\t\tfor k, v := range test.fields {\n\t\t\t\t\t\tif ok, fields := hasField(k, v, out, t); !ok {\n\t\t\t\t\t\t\tt.Errorf(\"expected fields to contain: '%s=%v. actual fields total: %s\", k, v, fields)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"With Error Field\", func(t *testing.T) {\n\t\t\tdefer b.Reset()\n\t\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\t\tOutput: b,\n\t\t\t})\n\n\t\t\ttests := []struct {\n\t\t\t\tlevel string\n\t\t\t\tfile string\n\t\t\t\tfunction string\n\t\t\t\tfields log.Fields\n\t\t\t\tf func(string)\n\t\t\t}{\n\t\t\t\t{\n\t\t\t\t\tlevel: \"ERROR\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"one\": 1,\n\t\t\t\t\t\t\"error\": errors.New(\"sample text\"),\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithError(\n\t\t\t\t\t\terrors.New(\"sample text\"),\n\t\t\t\t\t).WithFields(log.Fields{\n\t\t\t\t\t\t\"one\": 1,\n\t\t\t\t\t}).Error,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"INFO \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"sample\": \"this is a long piece of text\",\n\t\t\t\t\t\t\"error\": errors.New(\"sample text\"),\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"sample\": \"this is a long piece of text\",\n\t\t\t\t\t}).WithError(errors.New(\"sample text\")).Info,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"WARN \",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"one\": nil,\n\t\t\t\t\t\t\"error\": errors.New(\"sample text\"),\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"one\": nil,\n\t\t\t\t\t}).WithError(errors.New(\"sample text\")).Warn,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlevel: \"DEBUG\",\n\t\t\t\t\tfile: \"log_test.go\",\n\t\t\t\t\tfunction: \"1()\",\n\t\t\t\t\tfields: log.Fields{\n\t\t\t\t\t\t\"teamwork\": -1,\n\t\t\t\t\t\t\"error\": errors.New(\"sample text\"),\n\t\t\t\t\t},\n\t\t\t\t\tf: log.WithFields(log.Fields{\n\t\t\t\t\t\t\"teamwork\": -1,\n\t\t\t\t\t}).WithError(errors.New(\"sample text\")).Debug,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfor _, test := range tests {\n\t\t\t\tt.Run(test.level, func(t *testing.T) {\n\t\t\t\t\ttest.f(\"burger\")\n\n\t\t\t\t\tdefer b.Reset()\n\n\t\t\t\t\tout := b.String()\n\n\t\t\t\t\t//t.Log(b.String())\n\n\t\t\t\t\tassureSingleNewline(out, t)\n\n\t\t\t\t\tlevel, file, function, _ := splitMessage(out, t)\n\n\t\t\t\t\tif level != test.level {\n\t\t\t\t\t\tt.Errorf(\"expected level: '%s'. actual level: '%s'\", test.level, level)\n\t\t\t\t\t}\n\n\t\t\t\t\tif file != test.file {\n\t\t\t\t\t\tt.Errorf(\"expected file: '%s'. actual file: '%s'\", test.file, file)\n\t\t\t\t\t}\n\n\t\t\t\t\tif function != test.function {\n\t\t\t\t\t\tt.Errorf(\"expected function: '%s'. actual function: '%s'\", test.function, function)\n\t\t\t\t\t}\n\n\t\t\t\t\tfor k, v := range test.fields {\n\t\t\t\t\t\tif ok, fields := hasField(k, v, out, t); !ok {\n\t\t\t\t\t\t\tt.Errorf(\"expected fields to contain: '%s=%v. actual fields total: %s\", k, v, fields)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tt.Run(\"LogLevel\", func(t *testing.T) {\n\t\ttests := []struct {\n\t\t\tlevelName string\n\t\t\tlevel log.LogLevel\n\t\t\toutput bool\n\t\t\tf func(string)\n\t\t}{\n\t\t\t{\n\t\t\t\tlevelName: \"DEBUG\",\n\t\t\t\tlevel: log.LogDebug,\n\t\t\t\toutput: true,\n\t\t\t\tf: log.Debug,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlevelName: \"ERROR\",\n\t\t\t\tlevel: log.LogInformational,\n\t\t\t\toutput: true,\n\t\t\t\tf: log.Error,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlevelName: \"INFO \",\n\t\t\t\tlevel: log.LogWarning,\n\t\t\t\toutput: false,\n\t\t\t\tf: log.Info,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlevelName: \"WARN \",\n\t\t\t\tlevel: log.LogError,\n\t\t\t\toutput: false,\n\t\t\t\tf: log.Warn,\n\t\t\t},\n\t\t}\n\n\t\tvar b strings.Builder\n\t\tfor _, test := range tests {\n\t\t\tt.Run(test.levelName, func(t *testing.T) {\n\t\t\t\tdefer b.Reset()\n\t\t\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\t\t\tOutput: &b,\n\t\t\t\t\tLogLevel: test.level,\n\t\t\t\t})\n\n\t\t\t\ttest.f(\"sample text\")\n\n\t\t\t\tif b.Len() > 0 && !test.output {\n\t\t\t\t\tt.Errorf(\"expected no output for log level %d, got '%s'\", test.level, b.String())\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n\n\tt.Run(\"Clone\", func(t *testing.T) {\n\t\tdefer b.Reset()\n\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\tOutput: b,\n\t\t})\n\n\t\te := log.WithFields(log.Fields{\n\t\t\t\"sample\": \"text\",\n\t\t})\n\n\t\te1 := e.Clone().WithFields(log.Fields{\n\t\t\t\"fortnite\": \"borger\",\n\t\t})\n\n\t\te = e.WithFields(log.Fields{\n\t\t\t\"hello\": \"world\",\n\t\t})\n\n\t\te.Info(\"e\")\n\n\t\tif ok, fields := hasField(\"fortnite\", \"borger\", b.String(), t); ok {\n\t\t\tt.Errorf(\"expected to not have '%s=%s' but it did: '%s'\", \"fortnite\", \"borger\", fields)\n\t\t}\n\n\t\tb.Reset()\n\t\te1.Info(\"e\")\n\n\t\tif ok, fields := hasField(\"hello\", \"world\", b.String(), t); ok {\n\t\t\tt.Errorf(\"expected to not have '%s=%s' but it did: '%s'\", \"hello\", \"world\", fields)\n\t\t}\n\t})\n\n\tt.Run(\"Context\", func(t *testing.T) {\n\t\tdefer b.Reset()\n\t\tlog.InitSimpleLogger(&log.Config{\n\t\t\tOutput: b,\n\t\t})\n\n\t\tctx := context.WithValue(context.Background(), log.Key, log.Fields{\n\t\t\t\"sample\": \"text\",\n\t\t})\n\n\t\tlog.WithContext(ctx).Info(\"hello epic reddit\")\n\n\t\tif ok, fields := hasField(\"sample\", \"text\", b.String(), t); !ok {\n\t\t\tt.Errorf(\"expected fields to contain: '%s=%v'. actual fields total: %s\", \"sample\", \"text\", fields)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "4838f12a5fd9d1573e0605f5c13fb08a", "score": "0.54452634", "text": "func CleanupTestHarness() {\n\tcleanupCerts()\n}", "title": "" }, { "docid": "3e173108126d68febf88032532eaf455", "score": "0.54386115", "text": "func NewLogger(t mockConstructorTestingTNewLogger) *Logger {\n\tmock := &Logger{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "694ec9a03cecab86b9d2ce5a501d3e70", "score": "0.54370177", "text": "func (*logReporter) Close() error { return nil }", "title": "" }, { "docid": "c933c5f77845de9e26dd6faf5f249dea", "score": "0.5435295", "text": "func LogClose() {\n\t_ = logfile.Close()\n}", "title": "" }, { "docid": "7bb8b1963bfe5875e853ffb58f0e94d8", "score": "0.5428541", "text": "func closeLogFile() {\n\tlog.Println(\"Ending run\")\n\tlogFile.Close()\n}", "title": "" }, { "docid": "38d15a38cb401fedac8296f4366986cd", "score": "0.5421504", "text": "func (r *Redis) Cleanup() {\n\tos.RemoveAll(\"/tmp/go-harness\")\n}", "title": "" }, { "docid": "03cfcbc7ead9bd09d6420347f6beb10e", "score": "0.5411428", "text": "func CloseLogger() error {\n\treturn GlobalLogFile.Close()\n}", "title": "" }, { "docid": "f8f45e4709d54feefb311c3faebc7b41", "score": "0.54092467", "text": "func TestExtendErrorLogger(t *testing.T) {\n\tDefaultCreateErrorLoggerFunc = NewMockLogger\n\tdefer func() {\n\t\tDefaultCreateErrorLoggerFunc = CreateDefaultErrorLogger\n\t}()\n\tlogName := \"/tmp/mosn/test_mock_log.log\"\n\tos.Remove(logName)\n\t// reset for test\n\terrorLoggerManagerInstance.managers = make(map[string]log.ErrorLogger)\n\tlog.ClearAll()\n\tif err := InitDefaultLogger(logName, INFO); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tDefaultLogger.Infof(\"test_%d\", 123) // [mocked] [INFO] [] test_123\n\tProxy.Infof(context.Background(), \"test_%d\", 123) // [mocked] [INFO] [] [connId,traceId] test_123\n\ttime.Sleep(time.Second)\n\tlines, err := readLines(logName)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(lines) != 2 {\n\t\tt.Fatalf(\"logger write lines not expected, writes: %d, expected: %d\", len(lines), 2)\n\t}\n\tfor _, l := range lines {\n\t\tqs := strings.SplitN(l, \" \", 4)\n\t\tif !(len(qs) == 4 &&\n\t\t\tqs[0] == \"[mocked]\" &&\n\t\t\tqs[1] == \"[INFO]\" &&\n\t\t\tqs[2] == \"[]\" &&\n\t\t\tstrings.Contains(qs[3], \"test_123\")) {\n\t\t\tt.Fatalf(\"log output is unexpected: %s\", l)\n\t\t}\n\t}\n\tToggleLogger(logName, true)\n\tDefaultLogger.Infof(\"test_%d\", 123)\n\tProxy.Infof(context.Background(), \"test_%d\", 123)\n\tif lines, err := readLines(logName); err != nil || len(lines) != 2 {\n\t\tt.Fatal(\"disable proxy logger failed\")\n\t}\n}", "title": "" }, { "docid": "480670bb44b92f8cfc7292ab0e373252", "score": "0.5403231", "text": "func PreExit() {\n\tLogger.Close()\n}", "title": "" }, { "docid": "c57c5a6c7641821cc94ebd4bdae08bbb", "score": "0.53941387", "text": "func TestSetupLogging(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\n\treWhitespace := regexp.MustCompile(`(?ms:((\\s|\\n)+))`)\n\treWhitespace2 := regexp.MustCompile(`{\\s+`)\n\n\treSimplify := regexp.MustCompile(`(?ms:^\\s*(auditable: false|redact: false|exit-on-error: true|max-group-size: 100MiB)\\n)`)\n\n\tconst defaultFluentConfig = `fluent-defaults: {` +\n\t\t`filter: INFO, ` +\n\t\t`format: json-fluent-compact, ` +\n\t\t`redactable: true, ` +\n\t\t`exit-on-error: false` +\n\t\t`}`\n\tstdFileDefaultsRe := regexp.MustCompile(\n\t\t`file-defaults: \\{dir: (?P<path>[^,]+), max-file-size: 10MiB, buffered-writes: true, filter: INFO, format: crdb-v2, redactable: true\\}`)\n\tfileDefaultsNoMaxSizeRe := regexp.MustCompile(\n\t\t`file-defaults: \\{dir: (?P<path>[^,]+), buffered-writes: true, filter: INFO, format: crdb-v2, redactable: true\\}`)\n\tconst fileDefaultsNoDir = `file-defaults: {buffered-writes: true, filter: INFO, format: crdb-v2, redactable: true}`\n\tconst defaultLogDir = `PWD/cockroach-data/logs`\n\tstdCaptureFd2Re := regexp.MustCompile(\n\t\t`capture-stray-errors: \\{enable: true, dir: (?P<path>[^}]+)\\}`)\n\tfileCfgRe := regexp.MustCompile(\n\t\t`\\{channels: (?P<chans>all|\\[[^]]*\\]), dir: (?P<path>[^,]+), max-file-size: 10MiB, buffered-writes: (?P<buf>[^,]+), filter: INFO, format: (?P<format>[^,]+), redactable: true\\}`)\n\n\tstderrCfgRe := regexp.MustCompile(\n\t\t`stderr: {channels: all, filter: (?P<level>[^,]+), format: crdb-v2-tty, redactable: (?P<redactable>[^}]+)}`)\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpwd, err := filepath.Abs(wd)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tctx := context.Background()\n\n\tdatadriven.RunTest(t, \"testdata/logflags\", func(t *testing.T, td *datadriven.TestData) string {\n\t\targs := strings.Split(td.Input, \"\\n\")\n\n\t\tinitCLIDefaults()\n\t\tcmd, flags, err := cockroachCmd.Find(args)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif err := cmd.ParseFlags(flags); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tlog.TestingResetActive()\n\t\tif err := setupLogging(ctx, cmd, isServerCmd(cmd), false /* applyConfig */); err != nil {\n\t\t\treturn \"error: \" + err.Error()\n\t\t}\n\n\t\twantAmbiguous := td.HasArg(\"ambiguous\")\n\t\tif cliCtx.ambiguousLogDir != wantAmbiguous {\n\t\t\tt.Errorf(\"%s: config expected as ambiguous=%v for logging directory, got ambiguous=%v\",\n\t\t\t\ttd.Pos,\n\t\t\t\twantAmbiguous, cliCtx.ambiguousLogDir)\n\t\t}\n\n\t\tactual := cliCtx.logConfig.String()\n\t\t// Make the test independent of filesystem location.\n\t\tactual = strings.ReplaceAll(actual, pwd, \"PWD\")\n\t\tactual = strings.ReplaceAll(actual, defaultLogDir, \"<defaultLogDir>\")\n\t\t// Simplify - we don't care about all the configuration details\n\t\t// in this test.\n\t\tactual = reSimplify.ReplaceAllString(actual, \"\")\n\n\t\t// Flow: take the multi-line yaml output and make it \"flowed\".\n\t\tvar h logconfig.Holder\n\t\tif err := h.Set(actual); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tactual = reWhitespace.ReplaceAllString(h.String(), \" \")\n\t\tactual = reWhitespace2.ReplaceAllString(actual, \"{\")\n\n\t\t// Shorten the configuration for legibility during reviews of test changes.\n\t\tactual = strings.ReplaceAll(actual, defaultFluentConfig, \"<fluentDefaults>\")\n\t\tactual = stdFileDefaultsRe.ReplaceAllString(actual, \"<stdFileDefaults($path)>\")\n\t\tactual = fileDefaultsNoMaxSizeRe.ReplaceAllString(actual, \"<fileDefaultsNoMaxSize($path)>\")\n\t\tactual = strings.ReplaceAll(actual, fileDefaultsNoDir, \"<fileDefaultsNoDir>\")\n\t\tactual = stdCaptureFd2Re.ReplaceAllString(actual, \"<stdCaptureFd2($path)>\")\n\t\tactual = fileCfgRe.ReplaceAllString(actual, \"<fileCfg($chans,$path,$buf,$format)>\")\n\t\tactual = stderrCfgRe.ReplaceAllString(actual, \"<stderrCfg($level,$redactable)>\")\n\t\tactual = strings.ReplaceAll(actual, `<stderrCfg(NONE,true)>`, `<stderrDisabled>`)\n\t\tactual = strings.ReplaceAll(actual, `<stderrCfg(INFO,false)>`, `<stderrEnabledInfoNoRedaction>`)\n\t\tactual = strings.ReplaceAll(actual, `<stderrCfg(WARNING,false)>`, `<stderrEnabledWarningNoRedaction>`)\n\n\t\tactual = strings.ReplaceAll(actual, \", \", \",\\n\")\n\n\t\treturn actual\n\t})\n}", "title": "" }, { "docid": "3a1fbcb6b33364167767884f18e754c6", "score": "0.5387248", "text": "func ClearLogConfigInstance() {\n\tonce_lc = sync.Once{}\n}", "title": "" }, { "docid": "0294e198eb7cd9c0f65ca208e74d8863", "score": "0.5379745", "text": "func (tc *testContext) cleanup() {\n\ttc.osdkTestCtx.Cleanup()\n}", "title": "" }, { "docid": "e3d2ceadcd244862feb00b4ca7b39400", "score": "0.5379104", "text": "func (fr *Runner) Cleanup() {\n\tif fr.LocalDataDir != \"\" {\n\t\tos.RemoveAll(fr.LocalDataDir) //nolint:errcheck\n\t}\n}", "title": "" }, { "docid": "8ba41243860ee144abd1a4ba72ebab4a", "score": "0.5363664", "text": "func CleanExit(format string, v ...interface{}) {\n\tDefaultLogger.CleanExit(format, v...)\n}", "title": "" }, { "docid": "90afbd7be7f2fcbf45fa639bed343215", "score": "0.5363315", "text": "func (f *fixture) cleanUp(ctx context.Context, s *testing.FixtState) {\n\tif err := ash.CloseAllWindows(ctx, f.tconn); err != nil {\n\t\ts.Error(\"Failed trying to close all windows: \", err)\n\t}\n\n\tf.tconn = nil\n\n\tif len(f.drivefsOptions) > 0 && f.driveFs != nil {\n\t\tif err := f.driveFs.ClearCommandLineFlags(); err != nil {\n\t\t\ts.Fatal(\"Failed to remove command line args file: \", err)\n\t\t}\n\t}\n\tf.driveFs = nil\n\tf.mountPath = \"\"\n\n\t// Clean up files in this account that are older than 1 hour, files past this\n\t// date are assumed no longer required and were not successfully cleaned up.\n\t// Note this removal can take a while ~1s per file and may end up exceeding\n\t// the timeout, this is not a failure as the next run will try to remove the\n\t// files that weren't deleted in time.\n\tfileList, err := f.APIClient.ListAllFilesOlderThan(ctx, time.Hour)\n\tif err != nil {\n\t\ts.Error(\"Failed to list all my drive files: \", err)\n\t} else {\n\t\ts.Logf(\"Attempting to remove %d files older than 1 hour\", len(fileList.Files))\n\t\tfor _, i := range fileList.Files {\n\t\t\tif err := f.APIClient.RemoveFileByID(ctx, i.Id); err != nil {\n\t\t\t\ts.Logf(\"Failed to remove file %q (%s): %v\", i.Name, i.Id, err)\n\t\t\t} else {\n\t\t\t\ts.Logf(\"Successfully removed file %q (%s, %s)\", i.Name, i.Id, i.ModifiedTime)\n\t\t\t}\n\t\t}\n\t}\n\tf.APIClient = nil\n\tif f.cr != nil {\n\t\tif err := f.cr.Close(ctx); err != nil {\n\t\t\ts.Log(\"Failed closing chrome: \", err)\n\t\t}\n\t\tf.cr = nil\n\t}\n}", "title": "" }, { "docid": "53946e8ddea1382afafcee8df0861373", "score": "0.53517056", "text": "func Test() Logger {\n\treturn Logger{\n\t\tout: &bytes.Buffer{},\n\t\terr: &bytes.Buffer{},\n\t}\n}", "title": "" }, { "docid": "a68aadcce101bf8b9d86c8a98c24d313", "score": "0.5342892", "text": "func TestInitLogger(t *testing.T) {\n\t// Temporary log filename.\n\tconst filename = \"temp-transaction.log\"\n\n\t// Restore to original state after test.\n\tdefer os.Remove(filename)\n\n\t// Create a new file logger.\n\tftl, err := NewFileTransactionLogger(filename)\n\tif err != nil {\n\t\tt.Errorf(\"Error: %w\", err)\n\t}\n\n\t// Check whether a logger was returned from the function.\n\tif ftl == nil {\n\t\tt.Error(\"No logger was returned from NewFileTransactionLogger()\")\n\t}\n\n\t// Check whether the file exists or not.\n\tif !checkFileExists(filename) {\n\t\tt.Errorf(\"File \\\"%s\\\" doesn't exist.\", filename)\n\t}\n}", "title": "" }, { "docid": "f777c80414aaf2c871a6bc8886dc5d9e", "score": "0.53371", "text": "func init() {\n initialiseLogger()\n}", "title": "" }, { "docid": "1fd6fcfd803d0f74262eb82c3342cead", "score": "0.53272897", "text": "func (dl *dummyLogger) Setup() error {\n return nil\n}", "title": "" }, { "docid": "40f30504b24cebf8fdee24d775e2de15", "score": "0.5323796", "text": "func Flush() {\n\tif logger == nil {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b31708e3dbb738afd2d38b797772aeee", "score": "0.5323412", "text": "func (m *mapper) cleanup() {\n\tlevel.Info(m.logger).Log(\"msg\", \"cleaning up mapped rules directory\", \"path\", m.Path)\n\n\tusers, err := m.users()\n\tif err != nil {\n\t\tlevel.Error(m.logger).Log(\"msg\", \"unable to read rules directory\", \"path\", m.Path, \"err\", err)\n\t\treturn\n\t}\n\n\tfor _, u := range users {\n\t\tm.cleanupUser(u)\n\t}\n}", "title": "" }, { "docid": "67dc0b879272c07fd8ade7f0de0a0b23", "score": "0.5322475", "text": "func initFallback() error {\n std.logger = log.New(os.Stdout, \"\", log.LstdFlags | log.Lshortfile)\n std.errorLogger = log.New(os.Stdout, \"ERROR \", log.LstdFlags | log.Lshortfile)\n std.warnLogger = log.New(os.Stdout, \"WARN \", log.LstdFlags | log.Lshortfile)\n\n return nil\n}", "title": "" }, { "docid": "9fcddd682c1f627d7047436423cac129", "score": "0.5320856", "text": "func (logWriter LogWriter) closeFiles(logger *logrus.Logger) {\n\tlogger.Infof(\"Closing all the files in log writer\")\n\tfor testName, file := range logWriter.lookup {\n\t\terr := file.Close()\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Error closing log file for test %s: %s\", testName, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a18d5fbb3ec654347817ee060a9f54d1", "score": "0.5319305", "text": "func (d *Dumper) Cleanup() {\n\td.client.Close()\n\td.adminClient.Close()\n}", "title": "" }, { "docid": "089224b72e64b906a2a6ee6e5a114b4a", "score": "0.5318866", "text": "func CloseLogger() {\n\tif infolog != nil {\n\t\tinfolog.Close()\n\t}\n}", "title": "" }, { "docid": "19f65c172278985faf697cc7c370f723", "score": "0.53170866", "text": "func cleanup(dir string) {\n\tos.RemoveAll(dir)\n}", "title": "" }, { "docid": "c9797550e448cce80ef773041008025a", "score": "0.5316575", "text": "func setup(t *testing.T) {\n\terr := os.RemoveAll(storagePath)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "80354cfb5febbedca94721f214f14011", "score": "0.5315621", "text": "func DelNamedLogger(name string) {\n\tl, ok := NamedLoggers.Load(name)\n\tif ok {\n\t\tNamedLoggers.Delete(name)\n\t\tl.Close()\n\t}\n}", "title": "" }, { "docid": "7585377e1e590be6a36433410d13435e", "score": "0.5313291", "text": "func (ts *TestSetup) Cleanup() {\n\tif ts.Server != nil {\n\t\tts.Server.Stop()\n\t}\n\tif ts.NC != nil {\n\t\tts.NC.Close()\n\t}\n\tif ts.GNATSD != nil {\n\t\tts.GNATSD.Shutdown()\n\t}\n\n\tif ts.SystemUserCredsFile != \"\" {\n\t\tos.Remove(ts.SystemUserCredsFile)\n\t}\n\n\tif ts.SystemAccountJWTFile != \"\" {\n\t\tos.Remove(ts.SystemAccountJWTFile)\n\t}\n\n\tif ts.OperatorJWTFile != \"\" {\n\t\tos.Remove(ts.SystemUserCredsFile)\n\t}\n}", "title": "" }, { "docid": "b73b7fcc707b5f81682d61b7417ddb67", "score": "0.5308647", "text": "func withSuppressedLog(fn func()) {\n\tlog.SetOutput(ioutil.Discard)\n\tfn()\n\tlog.SetOutput(os.Stdout)\n}", "title": "" }, { "docid": "5994c52991d209711e5e83089ed000e2", "score": "0.5305261", "text": "func setupLogging(logWriter io.Writer, debug bool) {\n\toutput := zerolog.ConsoleWriter{Out: logWriter, TimeFormat: time.RFC822}\n\n\tzerolog.SetGlobalLevel(zerolog.WarnLevel)\n\tif debug {\n\t\tzerolog.SetGlobalLevel(zerolog.DebugLevel)\n\t}\n\n\tCtx.Logger = zerolog.New(output).With().Timestamp().Logger()\n}", "title": "" }, { "docid": "d20d7bf374624689fa5cc923f42bcad5", "score": "0.53025466", "text": "func (l *Logger) CleanExit(format string, v ...interface{}) {\n\tl.Info(format, v...)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "1839ed0a725de3796815e8ea766f98c3", "score": "0.528243", "text": "func CleanupSuite() {\n\t// Run on all Ginkgo nodes\n}", "title": "" }, { "docid": "fb56121290271ebd1e8397fee05851ed", "score": "0.52809227", "text": "func AfterSuite(t *testing.T) {\n\tlogger.Logf(t, \"END TEST SUITE %d\", counters.suitesCount)\n}", "title": "" }, { "docid": "bb7e708f31f32051f450f53be4fe7049", "score": "0.52792895", "text": "func TestLogger(t *testing.T) log.Logger {\n\tt.Helper()\n\n\tl := log.NewSyncLogger(log.NewLogfmtLogger(os.Stderr))\n\tl = log.WithPrefix(l,\n\t\t\"test\", t.Name(),\n\t\t\"ts\", log.Valuer(testTimestamp),\n\t)\n\n\treturn l\n}", "title": "" }, { "docid": "b2e029fe109e733554f47a2a6f142a14", "score": "0.5278543", "text": "func afterServeHTTPTest(t *testing.T, webroot string) {\n\tif !strings.Contains(webroot, testDirPrefix) {\n\t\tt.Fatalf(\"Cannot clean up after test because webroot is: %s\", webroot)\n\t}\n\t// cleans up everything under the test dir. No need to clean the individual files.\n\terr := os.RemoveAll(webroot)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to clean up test dir %s. Error was: %v\", webroot, err)\n\t}\n}", "title": "" }, { "docid": "7c0c5d92b2a7938340ec7ed0f99f937c", "score": "0.5278254", "text": "func (h *HealthCheck) cleanup() {\n\tif h.frameworkError != nil && h.namespace != nil {\n\t\tglog.V(4).Infof(\"Cleaning up. Deleting the binding, instance and test namespace %v\", h.namespace.Name)\n\t\th.serviceCatalogClientSet.ServicecatalogV1beta1().ServiceBindings(h.namespace.Name).Delete(h.bindingName, nil)\n\t\th.serviceCatalogClientSet.ServicecatalogV1beta1().ServiceInstances(h.namespace.Name).Delete(h.instanceName, nil)\n\t\tDeleteKubeNamespace(h.kubeClientSet, h.namespace.Name)\n\t\th.namespace = nil\n\t}\n}", "title": "" } ]
a2f82e422b89b4beac682a22f3811631
SexGT applies the GT predicate on the "sex" field.
[ { "docid": "a93a19f20665edd5a9f39fa2e5991494", "score": "0.8265507", "text": "func SexGT(v uint32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSex), v))\n\t})\n}", "title": "" } ]
[ { "docid": "5f70be9acc8490de3120714a7628a317", "score": "0.8000755", "text": "func GenderGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "fdf1ccba9d1b129ad598a41e0fbb3bc0", "score": "0.71187955", "text": "func GenderstatusGT(v string) predicate.Gender {\n\treturn predicate.Gender(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldGenderstatus), v))\n\t})\n}", "title": "" }, { "docid": "5569d5b03528f10d2f3565f290114bea", "score": "0.66643703", "text": "func EthnicityGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEthnicity), v))\n\t})\n}", "title": "" }, { "docid": "4760a7b23b727437a684e139a249ecf4", "score": "0.6602945", "text": "func GenderLTE(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "51ef286506249cae7efd949f78bdbfef", "score": "0.658953", "text": "func BloodGT(v string) predicate.BloodType {\n\treturn predicate.BloodType(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBlood), v))\n\t})\n}", "title": "" }, { "docid": "8cdcb21dfe70820378b1bdd4bc3650b5", "score": "0.6563769", "text": "func (s *Series) Gt(val interface{}) *Series {\n\tnewS := helperCrud(s, val, \"GT\", true)\n\tsetOpFuncName(val, \"gt\", s, newS)\n\tnewS.column.Dtype = base.Bool\n\treturn newS\n}", "title": "" }, { "docid": "e9db8cb478d152e8d04cfb709a7a3432", "score": "0.6436934", "text": "func GenderGTE(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "89589f8e0fc07aa89f06923ea5ad7940", "score": "0.64021474", "text": "func AgeGT(v uint32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "181c38ecc0f81d5e403eb70e9fd26198", "score": "0.64000225", "text": "func AgeGT(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "42856356378b95f269502ba48b236374", "score": "0.63846505", "text": "func AgeGT(v int) predicate.User {\n\treturn predicate.User(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.GT(s.C(FieldAge), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "6c856e300cf37b19a423f97f9ea78e79", "score": "0.62927735", "text": "func ProvinceNameTHGT(v string) predicate.Areahistory {\n\treturn predicate.Areahistory(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldProvinceNameTH), v))\n\t})\n}", "title": "" }, { "docid": "730f3faf79abdb75339286e5fcfeaf84", "score": "0.62489444", "text": "func ExpertNameGT(v string) predicate.Expert {\n\treturn predicate.Expert(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldExpertName), v))\n\t})\n}", "title": "" }, { "docid": "70db7e342f5ebed0d947ead568be8fb5", "score": "0.62253624", "text": "func ProvinceGT(v string) predicate.QccEnterpriseData {\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldProvince), v))\n\t})\n}", "title": "" }, { "docid": "b1c0fdb312cb7182bcad94052a5ad850", "score": "0.6214739", "text": "func StudentIDGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStudentID), v))\n\t})\n}", "title": "" }, { "docid": "6207bbc9f0527a550bdd90b6aae0374c", "score": "0.6211121", "text": "func Gt(rhs interface{}) (desc string, f predicate.PredicateFunc) {\n\treturn IsGreaterThan(rhs)\n}", "title": "" }, { "docid": "ccd642d2cad8af31245719c7d1f4880e", "score": "0.61973697", "text": "func RemedyGT(v string) predicate.Remedy {\n\treturn predicate.Remedy(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRemedy), v))\n\t})\n}", "title": "" }, { "docid": "3905cfbccacaafbd8c20509e4d9750c6", "score": "0.61896706", "text": "func (i identifier) Gt(val interface{}) BooleanExpression { return gt(i, val) }", "title": "" }, { "docid": "8bffaa35019951918d60c4fb59685a75", "score": "0.614455", "text": "func MFGGT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldMFG), v))\n\t})\n}", "title": "" }, { "docid": "edb1b6c3cf38c3e8559b68717ff09929", "score": "0.610366", "text": "func MaximumAgeGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldMaximumAge), v))\n\t})\n}", "title": "" }, { "docid": "c7123295bc541f1feaa3352c61f5a5ba", "score": "0.60711247", "text": "func IDGT(id int) predicate.Gender {\n\treturn predicate.Gender(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "2e898b7a7e493b9840c8988bf915863c", "score": "0.6055655", "text": "func YGT(v int) predicate.Harbor {\n\treturn predicate.Harbor(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldY), v))\n\t})\n}", "title": "" }, { "docid": "359fa0a1d7ffd3a2cf7f7c106c197091", "score": "0.6043955", "text": "func TyperoomGT(v string) predicate.Patientroom {\n\treturn predicate.Patientroom(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTyperoom), v))\n\t})\n}", "title": "" }, { "docid": "d173f3e1dd0eeea8ca684e35d8fad517", "score": "0.6015432", "text": "func SexGTE(v uint32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldSex), v))\n\t})\n}", "title": "" }, { "docid": "d5ebad5b8ec17844cc98b0223b5994fe", "score": "0.6006822", "text": "func (f StringField) Gt(field StringField) Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? > ?\",\n\t\tValues: []interface{}{f, field},\n\t}\n}", "title": "" }, { "docid": "332573f629bf71445ee3a6a24dc68620", "score": "0.5995191", "text": "func OpinionGT(v string) predicate.StatusOpinion {\n\treturn predicate.StatusOpinion(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldOpinion), v))\n\t})\n}", "title": "" }, { "docid": "38c5b96902763575fed1017d4c69d20c", "score": "0.5992963", "text": "func PurposeGT(v string) predicate.Club {\n\treturn predicate.Club(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPurpose), v))\n\t})\n}", "title": "" }, { "docid": "e9610bb122dd75e83168f6ee5908f60e", "score": "0.59515357", "text": "func GenderLT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "1f2ede7fcc51011b7408a994cc49754b", "score": "0.59418225", "text": "func NurseEmailGT(v string) predicate.Nurse {\n\treturn predicate.Nurse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNurseEmail), v))\n\t})\n}", "title": "" }, { "docid": "11c7a9d77637b9a69cc6ea0220cf7464", "score": "0.5928735", "text": "func PhoneGT(v string) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "d493ac9d7511e0c7567d1a53d2eb9410", "score": "0.5895797", "text": "func HealthyVolunteersGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldHealthyVolunteers), v))\n\t})\n}", "title": "" }, { "docid": "98338afc7f2f70b0196710afafe4a0fb", "score": "0.5876435", "text": "func TypeNameGT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTypeName), v))\n\t})\n}", "title": "" }, { "docid": "48a61c8ec287a6f5672039b5854d4a27", "score": "0.58588386", "text": "func SexLTE(v uint32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldSex), v))\n\t})\n}", "title": "" }, { "docid": "3f4bb196a4e306d593b4ba9960d46974", "score": "0.5853702", "text": "func FormatGT(v string) predicate.BinaryItem {\n\treturn predicate.BinaryItem(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldFormat), v))\n\t})\n}", "title": "" }, { "docid": "6dfb7557459bdb32b5541083fc46fdc1", "score": "0.5850506", "text": "func (f ArrayField) Gt(field ArrayField) Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? > ?\",\n\t\tValues: []interface{}{f, field},\n\t}\n}", "title": "" }, { "docid": "0b42d84376d416822e73836e198cf334", "score": "0.58486307", "text": "func RoleGT(v int8) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRole), v))\n\t})\n}", "title": "" }, { "docid": "2f72892df1f57434f5fa9fc549803758", "score": "0.5847858", "text": "func Gender(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "759625022e1a17b97556af66a9161fe7", "score": "0.58323914", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "796647b8c2e4e370e2c66aeace997b65", "score": "0.58295226", "text": "func EligibilityCriteriaGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEligibilityCriteria), v))\n\t})\n}", "title": "" }, { "docid": "e0877e0bc74d471b3617ebd0add8d685", "score": "0.582778", "text": "func SaltGT(v string) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSalt), v))\n\t})\n}", "title": "" }, { "docid": "33d0664f4565656c161fb9ac57074a2e", "score": "0.5825931", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "33d0664f4565656c161fb9ac57074a2e", "score": "0.5825931", "text": "func NameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "7430d4c7c2697341b1254287beb273af", "score": "0.5825731", "text": "func NickGT(v string) predicate.User {\n\treturn predicate.User(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.GT(s.C(FieldNick), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "7dde6b57c6f1b650acfe801eb15d0691", "score": "0.5802206", "text": "func ScoreGT(v int64) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldScore), v))\n\t})\n}", "title": "" }, { "docid": "5d83e839698424dc1293582adfb6f4ea", "score": "0.57714325", "text": "func NameGT(v string) predicate.Club {\n\treturn predicate.Club(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "42aff7cbbfbeadae4bc0ba25943b8fc6", "score": "0.57623446", "text": "func GT(col string, value interface{}) *Predicate {\n\treturn (&Predicate{}).GT(col, value)\n}", "title": "" }, { "docid": "57c8e18617dc404af4a7d5586405f192", "score": "0.57564104", "text": "func EmailGT(v string) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "d764536441a6c9cdeb9c3934ecb6a3ef", "score": "0.57546973", "text": "func TypeGT(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldType), v))\n\t})\n}", "title": "" }, { "docid": "972adce338c7a352786a253245bab881", "score": "0.5754475", "text": "func EmailGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "972adce338c7a352786a253245bab881", "score": "0.5754475", "text": "func EmailGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "edd0c64f47bfad5f8de47520240ade75", "score": "0.57520825", "text": "func LastNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "c35b659957343ceb618a0a06d496e2ac", "score": "0.5750296", "text": "func PhoneGT(v string) predicate.Club {\n\treturn predicate.Club(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "b624b26d771eaca230b344539dec0e4d", "score": "0.5746331", "text": "func USERNAMEGT(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUSERNAME), v))\n\t})\n}", "title": "" }, { "docid": "76e4d66483747f94e4b6f29841e3ef26", "score": "0.5740258", "text": "func NameGT(v string) predicate.People {\n\treturn predicate.People(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "6ddd11b7070a6b845846a28ba96b4671", "score": "0.57348555", "text": "func TrainingplaceGT(v string) predicate.Training {\n\treturn predicate.Training(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTrainingplace), v))\n\t})\n}", "title": "" }, { "docid": "9e4041526c2f1d706ed55182bd6f58a2", "score": "0.57344073", "text": "func StdAgeListGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStdAgeList), v))\n\t})\n}", "title": "" }, { "docid": "4f52e91a3c33448f67dcc1322eb36b62", "score": "0.5730715", "text": "func PatientNameGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPatientName), v))\n\t})\n}", "title": "" }, { "docid": "0fbdd68e3de0046c99d13f8dd53bbd48", "score": "0.5727744", "text": "func SubTypeNameGT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSubTypeName), v))\n\t})\n}", "title": "" }, { "docid": "352e2051d9cf1469c3a4b343145c47ad", "score": "0.57235056", "text": "func FirstNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "b620a810165b0da57d85145ef91a1184", "score": "0.5711536", "text": "func NickNameGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNickName), v))\n\t})\n}", "title": "" }, { "docid": "ef316bda8a8bcc9156683e4dc4f1f238", "score": "0.570736", "text": "func GenderHasSuffix(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "cb32638ad4979b9370f8f6f901c4915b", "score": "0.56991273", "text": "func StatusGT(v int16) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "16b5a7d2767424f59bf8105115b232aa", "score": "0.5698271", "text": "func ValueGT(column string, arg interface{}, opts ...Option) *sql.Predicate {\n\treturn sql.P(func(b *sql.Builder) {\n\t\topts, arg = normalizePG(b, arg, opts)\n\t\tValuePath(b, column, opts...)\n\t\tb.WriteOp(sql.OpGT).Arg(arg)\n\t})\n}", "title": "" }, { "docid": "d200330d03b19f81d2d4f3c89f031964", "score": "0.56968004", "text": "func SubTypeGT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSubType), v))\n\t})\n}", "title": "" }, { "docid": "286a380591e4ac89e8ab6fd0bec3b82f", "score": "0.56922024", "text": "func DrugAllergyGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldDrugAllergy), v))\n\t})\n}", "title": "" }, { "docid": "353dedff8f32ac36975afaff11f606dd", "score": "0.5691084", "text": "func (p *Predicate) GT(col string, arg interface{}) *Predicate {\n\tp.b.Append(col).WriteString(\" > \")\n\tp.b.Arg(arg)\n\treturn p\n}", "title": "" }, { "docid": "2b8a612af683191d3f35c44a70f87ac3", "score": "0.5689246", "text": "func CategoryGT(v string) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCategory), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "a016f2c2b5406f0c7eebb07010d5ba6a", "score": "0.5686775", "text": "func NurseNameGT(v string) predicate.Nurse {\n\treturn predicate.Nurse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNurseName), v))\n\t})\n}", "title": "" }, { "docid": "0baba8263c1c53a1b7243ca1346dd0e8", "score": "0.5686371", "text": "func TypeGT(v string) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldType), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "603fdbce410ec3385552482bfe4ac8f2", "score": "0.56849086", "text": "func LastNameGT(v string) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "0269fdb07725e7040444b961b5d7d7ae", "score": "0.568451", "text": "func PersonalIDGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPersonalID), v))\n\t})\n}", "title": "" }, { "docid": "f06ffe5e16f8e3b250e370395243caee", "score": "0.5680871", "text": "func CountryGT(v string) predicate.Country {\n\treturn predicate.Country(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCountry), v))\n\t})\n}", "title": "" }, { "docid": "917fb2d42df0dabbb853cfe771ba3606", "score": "0.56787163", "text": "func Gt(key string, value interface{}) *WhereExpression {\n\treturn &WhereExpression{\n\t\tExpression: &WhereExpression_Condition{\n\t\t\tCondition: &WhereCondition{\n\t\t\t\tKey: key,\n\t\t\t\tValue: protoutil.WrapValue(value),\n\t\t\t\tCondition: Condition_GT,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6013adc4efe63134cdd694ac3d818deb", "score": "0.56720513", "text": "func AvatarGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAvatar), v))\n\t})\n}", "title": "" }, { "docid": "e1f3962091edf0dc5f02c7bed754d380", "score": "0.5659605", "text": "func (f TimeField) Gt(field TimeField) Predicate {\n\treturn CustomPredicate{\n\t\tFormat: \"? > ?\",\n\t\tValues: []interface{}{f, field},\n\t}\n}", "title": "" }, { "docid": "167778993d5eebd63c45df1e84644edd", "score": "0.5645901", "text": "func SubDistrictGT(v string) predicate.Areahistory {\n\treturn predicate.Areahistory(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSubDistrict), v))\n\t})\n}", "title": "" }, { "docid": "372c5086dcc3ec81d4339b0842ec22b7", "score": "0.56395197", "text": "func NameGT(v string) predicate.Role {\n\treturn predicate.Role(sql.FieldGT(FieldName, v))\n}", "title": "" }, { "docid": "683b5e5fd76e5628d5474d6566eeecf8", "score": "0.5636742", "text": "func NameGT(v string) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "89d717edf3c5a78a668a4ee3e488026d", "score": "0.56272125", "text": "func NameGT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "13b61fd3dc36d0933a49c288ba9093b2", "score": "0.56249994", "text": "func FirstNameGT(v string) predicate.SysUser {\n\treturn predicate.SysUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "ff91e620758e9a39830653d4bde44c50", "score": "0.56168383", "text": "func NursePasswordGT(v string) predicate.Nurse {\n\treturn predicate.Nurse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNursePassword), v))\n\t})\n}", "title": "" }, { "docid": "ce2c89b3720c3f6348b117757c9df00f", "score": "0.56119215", "text": "func AmountGT(v int) predicate.Dentalappointment {\n\treturn predicate.Dentalappointment(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAmount), v))\n\t})\n}", "title": "" }, { "docid": "78cf54234ffee2429eadd77741696584", "score": "0.56117934", "text": "func XGT(v int) predicate.Harbor {\n\treturn predicate.Harbor(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldX), v))\n\t})\n}", "title": "" }, { "docid": "9246bb53577210f938d0912c5df531b9", "score": "0.5605665", "text": "func TitleGT(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "893ad40daebc74ffc987f777a1269440", "score": "0.56016445", "text": "func BOOKNAMEGT(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBOOKNAME), v))\n\t})\n}", "title": "" }, { "docid": "1cc706373b6689c95f3b987103bd992c", "score": "0.56016153", "text": "func (qs ProfitQuerySet) ProfitTypeGt(profitType ProfitType) ProfitQuerySet {\n\treturn qs.w(qs.db.Where(\"profit_type > ?\", profitType))\n}", "title": "" }, { "docid": "bb067343e96c780f7c59ad5d8146548f", "score": "0.5598917", "text": "func applyGT(l, r Expr) (*BooleanLiteral, error) {\n\treturn applyGtLt(l, r, GT)\n}", "title": "" }, { "docid": "315425107928f1cf1b334d47506da643", "score": "0.559841", "text": "func NameGT(v string) predicate.PostAttachment {\n\treturn predicate.PostAttachment(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "1d9ba6685833eafc5ba8c0b463f16940", "score": "0.55982774", "text": "func NameGT(v string) predicate.Task {\n\treturn predicate.Task(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldName, p.GT(v))\n\t})\n}", "title": "" }, { "docid": "39fa507949c4e2bf8cf017522d95f837", "score": "0.55919766", "text": "func NameGT(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "040e928976c20c530de2f08a7a1b3e81", "score": "0.55780697", "text": "func NameGT(v string) predicate.File {\n\treturn predicate.File(sql.FieldGT(FieldName, v))\n}", "title": "" }, { "docid": "3995c6dde1b65f8db42b6a816b713d6f", "score": "0.5577676", "text": "func CcvGT(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCcv), v))\n\t})\n}", "title": "" }, { "docid": "273c4330eaa785dcebc43bd45009e6dd", "score": "0.55758417", "text": "func (f BoolField) Gt(x bool) *GtMatcher {\n\treturn GtBool(f.FieldSelector, x)\n}", "title": "" }, { "docid": "fe205cfaf284b359422aecbc2811e497", "score": "0.55631", "text": "func CountyGT(v string) predicate.QccEnterpriseData {\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCounty), v))\n\t})\n}", "title": "" }, { "docid": "d93d1debb45b43596605ac59f319f883", "score": "0.556192", "text": "func DistrictNameTHGT(v string) predicate.Areahistory {\n\treturn predicate.Areahistory(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldDistrictNameTH), v))\n\t})\n}", "title": "" }, { "docid": "03018cb205ebbf9efc56343dfbb31f1d", "score": "0.55558854", "text": "func MinimumAgeGT(v string) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldMinimumAge), v))\n\t})\n}", "title": "" }, { "docid": "6267360f94d4620927bd58122e261a42", "score": "0.5555538", "text": "func BusinessScopeGT(v string) predicate.QccEnterpriseData {\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBusinessScope), v))\n\t})\n}", "title": "" }, { "docid": "3c6733798524d50b18c54746e2c54cea", "score": "0.555228", "text": "func NameGT(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "b05ce0d23f0d2f472aa637a91c4a30a1", "score": "0.5552252", "text": "func NurseTelGT(v string) predicate.Nurse {\n\treturn predicate.Nurse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNurseTel), v))\n\t})\n}", "title": "" }, { "docid": "89bffa357ebf132e57ab0c6467a3b2e0", "score": "0.5550563", "text": "func TypeGT(v string) predicate.GithubGist {\n\treturn predicate.GithubGist(sql.FieldGT(FieldType, v))\n}", "title": "" }, { "docid": "fc746424625ce56599d63a0e2f99fd31", "score": "0.5545237", "text": "func SprintGoalGT(v string) predicate.Sprint {\n\treturn predicate.Sprint(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSprintGoal), v))\n\t},\n\t)\n}", "title": "" } ]
79f97d6f7d3c2f119c8eeaa441cb7821
removeLoneCanonicalNode will detach and remove the canonical node for specified prefUUID Used when concepts are concorded, and we need to clean up the unnecessary canonical nodes.
[ { "docid": "89ca993d0c02617827780528697aafbb", "score": "0.79469526", "text": "func removeLoneCanonicalNode(prefUUID string) *cmneo4j.Query {\n\tequivQuery := &cmneo4j.Query{\n\t\tCypher: `MATCH (t:Thing {prefUUID:$id}) DETACH DELETE t`,\n\t\tParams: map[string]interface{}{\n\t\t\t\"id\": prefUUID,\n\t\t},\n\t}\n\treturn equivQuery\n}", "title": "" } ]
[ { "docid": "ab23713020742877933fa010d84d306c", "score": "0.63431776", "text": "func deleteLonePrefUUID(prefUUID string) *neoism.CypherQuery {\n\tlogger.WithField(\"UUID\", prefUUID).Debug(\"Deleting orphaned prefUUID node\")\n\tequivQuery := &neoism.CypherQuery{\n\t\tStatement: `MATCH (t:Thing {prefUUID:{id}}) DETACH DELETE t`,\n\t\tParameters: map[string]interface{}{\n\t\t\t\"id\": prefUUID,\n\t\t},\n\t}\n\treturn equivQuery\n}", "title": "" }, { "docid": "dad4878efcf9ee38649c4030fc3e9b32", "score": "0.61304784", "text": "func UncordonNode(client clientset.Interface, node *corev1.Node) error {\n\tcordonHelper := kubectldrain.NewCordonHelper(node)\n\n\t// Check if already uncordoned\n\tif updateRequired := cordonHelper.UpdateIfRequired(false); !updateRequired {\n\t\treturn nil\n\t}\n\n\terr, patchErr := cordonHelper.PatchOrReplace(client, false)\n\tif patchErr != nil {\n\t\treturn errors.Wrap(patchErr, \"creating node patch\")\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"updating node status\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "340b1f598562a968be41a744b4bf9fb7", "score": "0.5957981", "text": "func (b *Bundle) UnCordonNode(req *apistructs.SteveRequest) error {\n\tif req.ClusterName == \"\" || req.Name == \"\" {\n\t\treturn errors.New(\"clusterName and name fields are required\")\n\t}\n\n\tspec := map[string]interface{}{\n\t\t\"spec\": map[string]interface{}{\n\t\t\t\"unschedulable\": false,\n\t\t},\n\t}\n\treq.Obj = &spec\n\treturn b.PatchNode(req)\n}", "title": "" }, { "docid": "09875632ac0be888186d78258f692d74", "score": "0.56524163", "text": "func (hr *HashRing) RemoveNode(node string) {\n\thash := crc32.ChecksumIEEE([]byte(node))\n\tdelete(hr.nodes, hash)\n\tfor i := range hr.sortedNodes {\n\t\tif hr.sortedNodes[i] == hash {\n\t\t\thr.sortedNodes = append(hr.sortedNodes[:i], hr.sortedNodes[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3474a88fdd1ba9f460bc144d79cb11df", "score": "0.5603484", "text": "func (nm *nodeManager) UncordonNode(name string) error {\n\treturn nm.PatchNodeUnschedulable(name, false)\n}", "title": "" }, { "docid": "2b12f541beeb840f66c0ee73d9691856", "score": "0.55474323", "text": "func (dm *DrainManager) unCordonNode(nodeName string) error {\n\tnode, err := dm.client.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cordon get node error: %v\", err)\n\t}\n\tif !node.Spec.Unschedulable {\n\t\treturn nil\n\t}\n\tnode.Spec.Unschedulable = false\n\tif _, err := dm.client.CoreV1().Nodes().Update(node); err != nil {\n\t\treturn fmt.Errorf(\"cordon update node error: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10f567172b06c18914d40f52f5cc7674", "score": "0.55378443", "text": "func (rh *RendezvousHash) RemoveNode(name string) {\n\tfor i, node := range rh.Nodes {\n\t\tif node.Label == name {\n\t\t\trh.Nodes = append(rh.Nodes[:i], rh.Nodes[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "64fe3716bb5e6e655389026595c23503", "score": "0.53838664", "text": "func RemoveRedisNodeFromCluster(cr *redisv1beta1.RedisCluster) {\n\tlogger := generateRedisManagerLogger(cr.Namespace, cr.ObjectMeta.Name)\n\tvar cmd []string\n\tcurrentRedisCount := CheckRedisNodeCount(cr, \"leader\")\n\n\texistingPod := RedisDetails{\n\t\tPodName: cr.ObjectMeta.Name + \"-leader-0\",\n\t\tNamespace: cr.Namespace,\n\t}\n\tremovePod := RedisDetails{\n\t\tPodName: cr.ObjectMeta.Name + \"-leader-\" + strconv.Itoa(int(currentRedisCount)-1),\n\t\tNamespace: cr.Namespace,\n\t}\n\n\tcmd = []string{\"redis-cli\", \"--cluster\", \"del-node\"}\n\n\tif *cr.Spec.ClusterVersion == \"v7\" {\n\t\tcmd = append(cmd, getRedisHostname(existingPod, cr, \"leader\")+\":6379\")\n\t} else {\n\t\tcmd = append(cmd, getRedisServerIP(existingPod)+\":6379\")\n\t}\n\n\tremovePodNodeID := getRedisNodeID(cr, removePod)\n\tcmd = append(cmd, removePodNodeID)\n\n\tif cr.Spec.KubernetesConfig.ExistingPasswordSecret != nil {\n\t\tpass, err := getRedisPassword(cr.Namespace, *cr.Spec.KubernetesConfig.ExistingPasswordSecret.Name, *cr.Spec.KubernetesConfig.ExistingPasswordSecret.Key)\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"Error in getting redis password\")\n\t\t}\n\t\tcmd = append(cmd, \"-a\")\n\t\tcmd = append(cmd, pass)\n\t}\n\n\tcmd = append(cmd, getRedisTLSArgs(cr.Spec.TLS, cr.ObjectMeta.Name+\"-leader-0\")...)\n\n\tlogger.Info(\"Redis cluster leader remove command is\", \"Command\", cmd)\n\tif getRedisClusterSlots(cr, removePodNodeID) != \"0\" {\n\t\tlogger.Info(\"Skipping execution remove leader not empty\", \"cmd\", cmd)\n\t}\n\texecuteCommand(cr, cmd, cr.ObjectMeta.Name+\"-leader-0\")\n}", "title": "" }, { "docid": "c22357628508cffa7480f443d50e86a9", "score": "0.5364721", "text": "func (p *Processor) RemoveNode(node xray.NodeID) {\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\n\tdelete(p.nodes, node)\n}", "title": "" }, { "docid": "ff516bfbafe581f3e2f4476d8a8dca31", "score": "0.5287675", "text": "func (s *ConceptService) writeCanonicalNodeForUnconcordedConcepts(concept Concept) *neoism.CypherQuery {\n\tallProps := setProps(concept, concept.UUID, false)\n\tlogger.WithField(\"UUID\", concept.UUID).Debug(\"Creating prefUUID node for unconcorded concept\")\n\tcreateCanonicalNodeQuery := &neoism.CypherQuery{\n\t\tStatement: fmt.Sprintf(`\n\t\t\t\t\tMATCH (t:Thing{uuid:{prefUUID}})\n\t\t\t\t\tMERGE (n:Thing {prefUUID: {prefUUID}})\n\t\t\t\t\tMERGE (n)<-[:EQUIVALENT_TO]-(t)\n\t\t\t\t\tset n={allprops}\n\t\t\t\t\tset n :%s`, getAllLabels(concept.Type)),\n\t\tParameters: map[string]interface{}{\n\t\t\t\"prefUUID\": concept.UUID,\n\t\t\t\"allprops\": allProps,\n\t\t},\n\t}\n\treturn createCanonicalNodeQuery\n}", "title": "" }, { "docid": "4e0313ef0009c0be7709c6b71a8f7934", "score": "0.5265083", "text": "func (v *vibranium) RemoveNode(ctx context.Context, opts *pb.RemoveNodeOptions) (*pb.Pod, error) {\n\tp, err := v.cluster.RemoveNode(opts.Nodename, opts.Podname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn toRPCPod(p), nil\n}", "title": "" }, { "docid": "f425ad1c2c2eb5397cd0b2fe108f061f", "score": "0.52528256", "text": "func CleanupNode(t *testing.T, pid int, cfg *cmn.Config, daeTy string) {\n\t// Make sure the process is killed\n\texec.Command(\"kill\", \"-9\", strconv.Itoa(pid)).CombinedOutput()\n\n\tif err := os.RemoveAll(cfg.Confdir); err != nil && !os.IsNotExist(err) {\n\t\tt.Error(err.Error())\n\t}\n\n\tif err := os.RemoveAll(cfg.Log.Dir); err != nil && !os.IsNotExist(err) {\n\t\tt.Error(err.Error())\n\t}\n\n\tfsWalkFunc := func(p string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !strings.HasPrefix(info.Name(), \"mp\") {\n\t\t\treturn nil\n\t\t}\n\n\t\tdeletePath := path.Join(p, info.Name(), strconv.Itoa(cfg.TestFSP.Instance))\n\t\tif err := os.RemoveAll(deletePath); err != nil && !os.IsNotExist(err) {\n\t\t\tt.Error(err.Error())\n\t\t}\n\t\treturn nil\n\t}\n\t// Clean mountpaths for targets\n\tif daeTy == cmn.Target {\n\t\tfilepath.Walk(cfg.TestFSP.Root, fsWalkFunc)\n\t}\n}", "title": "" }, { "docid": "42535d7ed690e0f20551b83ca97b8b71", "score": "0.5203921", "text": "func cleanupNode(cs clientset.Interface) {\n\tnodeList, err := cs.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tExpect(err).NotTo(HaveOccurred())\n\n\tfor _, n := range nodeList.Items {\n\t\tvar err error\n\t\tvar node *corev1.Node\n\t\tfor retry := 0; retry < 5; retry++ {\n\t\t\tnode, err = cs.CoreV1().Nodes().Get(context.TODO(), n.Name, metav1.GetOptions{})\n\t\t\tExpect(err).NotTo(HaveOccurred())\n\n\t\t\tupdate := false\n\t\t\t// Remove labels\n\t\t\tfor key := range node.Labels {\n\t\t\t\tif strings.HasPrefix(key, nfdv1alpha1.FeatureLabelNs) {\n\t\t\t\t\tdelete(node.Labels, key)\n\t\t\t\t\tupdate = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove annotations\n\t\t\tfor key := range node.Annotations {\n\t\t\t\tif strings.HasPrefix(key, nfdv1alpha1.AnnotationNs) {\n\t\t\t\t\tdelete(node.Annotations, key)\n\t\t\t\t\tupdate = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove taints\n\t\t\tfor _, taint := range node.Spec.Taints {\n\t\t\t\tif strings.HasPrefix(taint.Key, TestTaintNs) {\n\t\t\t\t\tnewTaints, removed := taintutils.DeleteTaint(node.Spec.Taints, &taint)\n\t\t\t\t\tif removed {\n\t\t\t\t\t\tnode.Spec.Taints = newTaints\n\t\t\t\t\t\tupdate = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !update {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tBy(\"Deleting NFD labels, annotations and taints from node \" + node.Name)\n\t\t\t_, err = cs.CoreV1().Nodes().Update(context.TODO(), node, metav1.UpdateOptions{})\n\t\t\tif err != nil {\n\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t}\n\t\tExpect(err).NotTo(HaveOccurred())\n\t}\n\n}", "title": "" }, { "docid": "a63a20308dd66bb56d246d63028c531b", "score": "0.5183647", "text": "func (g *Graph) RemoveNode(id int64) {\n\tn := g.Node(id).(cfa.Node)\n\tif _, ok := n.Attribute(\"entry\"); ok {\n\t\t// Remove entry node.\n\t\tg.entry = nil\n\t}\n\tdotID := n.DOTID()\n\tdelete(g.nodes, dotID)\n\tg.DirectedGraph.RemoveNode(id)\n}", "title": "" }, { "docid": "972a2dc132a26d26bd59069978c86e93", "score": "0.51747596", "text": "func (g *ExprGraph) RemoveNode(node graph.Node) {\n\tn := node.(*Node)\n\tif n.id == -1 {\n\t\treturn // if it's -1, it was never in the graph to begin with\n\t}\n\n\thash := n.Hashcode()\n\n\tdelete(g.byHash, hash)\n\tdelete(g.to, n)\n\tg.evac[hash] = g.evac[hash].remove(n)\n\tg.all = g.all.remove(n)\n}", "title": "" }, { "docid": "2677a893fafa3b5e65b9d5fa61d3c454", "score": "0.51740515", "text": "func (pdCoord *PDCoordinator) removeNsLearnerFromNode(ns string, pid int, nid string, checkNode bool) error {\n\torigNSInfo, err := pdCoord.register.GetNamespacePartInfo(ns, pid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnsInfo := origNSInfo.GetCopy()\n\tif checkNode {\n\t\tcurrentNodes, _ := pdCoord.getCurrentLearnerNodes()\n\t\tif _, ok := currentNodes[nid]; ok {\n\t\t\tcluster.CoordLog().Infof(\"namespace %v: mark learner node %v removing before stopped\", nsInfo.GetDesp(), nid)\n\t\t\treturn errors.New(\"removing learner node should be stopped first\")\n\t\t}\n\t}\n\trole := pdCoord.learnerRole\n\tcluster.CoordLog().Infof(\"namespace %v: mark learner role %v node %v removing , current : %v\", nsInfo.GetDesp(), role, nid,\n\t\tnsInfo.LearnerNodes)\n\n\tif nsInfo.LearnerNodes == nil {\n\t\tnsInfo.LearnerNodes = make(map[string][]string)\n\t}\n\told := nsInfo.LearnerNodes[role]\n\tnewLrns := make([]string, 0, len(old))\n\tfor _, oid := range old {\n\t\tif oid == nid {\n\t\t\tcontinue\n\t\t}\n\t\tnewLrns = append(newLrns, oid)\n\t}\n\tif len(old) == len(newLrns) {\n\t\treturn errors.New(\"remove node id is not in learners\")\n\t}\n\tnsInfo.LearnerNodes[role] = newLrns\n\tdelete(nsInfo.RaftIDs, nid)\n\n\terr = pdCoord.register.UpdateNamespacePartReplicaInfo(nsInfo.Name, nsInfo.Partition,\n\t\t&nsInfo.PartitionReplicaInfo, nsInfo.PartitionReplicaInfo.Epoch())\n\tif err != nil {\n\t\tcluster.CoordLog().Infof(\"update namespace %v replica info failed: %v\", nsInfo.GetDesp(), err.Error())\n\t\treturn err\n\t} else {\n\t\tcluster.CoordLog().Infof(\"namespace %v: mark learner role %v removing from node:%v done\", nsInfo.GetDesp(),\n\t\t\trole, nid)\n\t\t*origNSInfo = *nsInfo\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c04c9c9e59625535151930a08663470c", "score": "0.51444536", "text": "func (rtable *RoutingTable) removeNode(node *Node) {\n\tnode.inserted = false\n\tdelete(rtable.nodeMap, node.address.String())\n\tdelete(rtable.tokenNodeMap, node.address.String())\n}", "title": "" }, { "docid": "869a61fd03c44f7e2141c6dbc260977c", "score": "0.51394725", "text": "func (cn *CloudNetservice) CleanNode(ctx context.Context, req *pb.CleanNodeReq) (*pb.CleanNodeResp, error) {\n\trtime := time.Now()\n\tblog.V(3).Infof(\"CleanNode seq[%d] input[%+v]\", req.Seq, req)\n\tresponse := &pb.CleanNodeResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_ERROR_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := cn.metricCollector.StatRequest(\"CleanNode\", response.ErrCode, rtime, time.Now())\n\t\tblog.V(3).Infof(\"CleanNode seq[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\tfixedCleanNodeAction := ipAction.NewCleanNodeAction(ctx, req, response, cn.storeIf, cn.cloudIf)\n\taction.NewExecutor().Execute(fixedCleanNodeAction)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "ece39f336fd84cf2233f0ec56bc98380", "score": "0.51393104", "text": "func (c *Calcium) RemoveNode(ctx context.Context, nodename string) error {\n\tlogger := log.WithField(\"Calcium\", \"RemoveNode\").WithField(\"nodename\", nodename)\n\tif nodename == \"\" {\n\t\treturn logger.Err(ctx, errors.WithStack(types.ErrEmptyNodeName))\n\t}\n\treturn c.withNodeLocked(ctx, nodename, func(ctx context.Context, node *types.Node) error {\n\t\tws, err := c.ListNodeWorkloads(ctx, node.Name, nil)\n\t\tif err != nil {\n\t\t\treturn logger.Err(ctx, err)\n\t\t}\n\t\tif len(ws) > 0 {\n\t\t\treturn logger.Err(ctx, errors.WithStack(types.ErrNodeNotEmpty))\n\t\t}\n\t\treturn logger.Err(ctx, errors.WithStack(c.store.RemoveNode(ctx, node)))\n\t})\n}", "title": "" }, { "docid": "a4acb5ade7dc587e043fda99f2f441ae", "score": "0.51219517", "text": "func llDeleteNode(n *Node) {\n\ta := n.Next\n\tb := n.Previ\n\ta.Previ = b\n\tb.Next = a\n\n\tn.N = nil\n\tn.Next = nil\n\tn.Previ = nil\n}", "title": "" }, { "docid": "9d9f9fcf412878d587910a7cfd82a952", "score": "0.51193094", "text": "func (s *server) NodeRemoval(ctx context.Context, node *pb.Node) (*pb.Response, error) {\n\tvar status string\n\tdelete(nodeMap, node.Grpc_IP)\n\tlog.Println(\"Node removed: \", node.Grpc_IP)\n\tif node.GetNotifyOthers() == 1 {\n\t\terr := notifyNodeUpdate(node, false)\n\t\tif err != nil {\n\t\t\tstatus = err.Error()\n\t\t} else {\n\t\t\tstatus = \"ok\"\n\t\t}\n\t}\n\treturn &pb.Response{Status: status}, nil\n}", "title": "" }, { "docid": "41d981092a06f2387b227c71892b773f", "score": "0.51168746", "text": "func (hashRing *HashRing) RemoveNode(node string) error {\n\tvar idx int\n\tfor i := 0; i < len(hashRing.Nodes); i++ {\n\t\tif strings.Compare(hashRing.Nodes[i], node) == 0 {\n\t\t\tidx = i\n\t\t}\n\t}\n\thashRing.Nodes = append(hashRing.Nodes[:idx], hashRing.Nodes[idx+1:]...)\n\n\tkeySlice := sort.StringSlice(hashRing.SortedKeys)\n\tfor i := 0; i < hashRing.Replicas; i++ {\n\t\tmethod, ok := HashMethods[hashRing.HashMethod]\n\t\tif !ok {\n\t\t\treturn errors.New(\"Hash Method not exist\")\n\t\t}\n\t\tringKey := method.(func(string) string)(fmt.Sprintf(\"%s:%d\", node, i))\n\n\t\tdelete(hashRing.Ring, ringKey)\n\n\t\tpos := sort.SearchStrings(keySlice, ringKey)\n\t\tkeySlice = append(keySlice[:pos], keySlice[pos+1:]...)\n\t}\n\thashRing.SortedKeys = keySlice\n\treturn nil\n}", "title": "" }, { "docid": "4cfc76e2fae42a8639690422e4903e53", "score": "0.5105904", "text": "func (rc *raftNode) removeNode(id string) {\n\trc.cluster.RemoveNode(id)\n\traftID := raftID(id)\n\t// check if peerExists before removing the node. Otherwise, when old\n\t// remove node conf-entries are replayed eg. while replaying wal,\n\t// then transport panics as the peer doesn't exists.\n\t// This can happen if AddNode conf change has been snapshotted and\n\t// merged into conf state but remove node conf change is still a part\n\t// of WAL which is replayed.\n\tif rc.transport.PeerExists(raftID) {\n\t\trc.transport.RemovePeer(raftID)\n\t}\n}", "title": "" }, { "docid": "eb30adf8e412281e3db82e8b6a9b236f", "score": "0.5075108", "text": "func RemoveFilesystemMirrorPeer(context *clusterd.Context, clusterInfo *ClusterInfo, peerUUID string) error {\n\tlogger.Infof(\"removing cephfs-mirror peer %q\", peerUUID)\n\n\t// Build command\n\targs := []string{\"fs\", \"snapshot\", \"mirror\", \"peer_remove\", peerUUID}\n\tcmd := NewCephCommand(context, clusterInfo, args)\n\n\t// Run command\n\toutput, err := cmd.Run()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to remove cephfs-mirror peer for filesystem %q. %s\", peerUUID, output)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c2c0b59b3652503c29ce0aa2efc6c608", "score": "0.50737363", "text": "func RemoveMasterNode(nodes []Node) []Node {\n\t// Finder Master Node Index\n\tvar masterIndex int\n\tfor i, v := range nodes {\n\t\tif v.Role == \"master\" {\n\t\t\tmasterIndex = i\n\t\t}\n\t}\n\n\t// remove master from slice\n\tnodes[len(nodes)-1], nodes[masterIndex] = nodes[masterIndex], nodes[len(nodes)-1]\n\treturn nodes[:len(nodes)-1]\n}", "title": "" }, { "docid": "3e795e07bf4baa23a9dd37f860b32a9e", "score": "0.50500137", "text": "func (clusterMap *ClusterMap) RemoveNode(node *User) {\n\t// Lock nodes list for writing\n\tclusterMap.Lock()\n\tdefer clusterMap.Unlock()\n\n\tfor i, n := range clusterMap.nodes {\n\t\tif n == node {\n\t\t\t// Remove node from the list\n\t\t\tclusterMap.nodes, clusterMap.nodes[len(clusterMap.nodes)-1] = append(clusterMap.nodes[:i], clusterMap.nodes[i+1:]...), nil\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a4e0a745eb27c86ae388eb8028df3d35", "score": "0.5049099", "text": "func (app *OpenZWaveApp) ZWaveRemoveNode(notification *goopenzwave.Notification) {\n\tnodeHWID := fmt.Sprint(notification.NodeID)\n\tapp.pub.DeleteNode(nodeHWID)\n\tlogrus.Warningf(\"ZWaveRemoveNode. Node %s removed\", nodeHWID)\n}", "title": "" }, { "docid": "720a52bee0c4fa61a70f56df5748b999", "score": "0.5046602", "text": "func (d *dynamoDBNodeManager) RemoveNode() {\n\td.deleteRecord(d.identity)\n}", "title": "" }, { "docid": "a9cd2654e0c839365a8c7f315cdc8d9f", "score": "0.5044383", "text": "func (p *Probe) unregisterNode(indexer *graph.Indexer, uuid string) {\n\tlogging.GetLogger().Debugf(\"Unregistering OVN object with UUID %s\", uuid)\n\n\tp.graph.Lock()\n\tdefer p.graph.Unlock()\n\n\tnode, _ := indexer.GetNode(uuid)\n\tif node != nil {\n\t\tp.graph.DelNode(node)\n\t\tindexer.Unindex(node.ID, node)\n\t}\n}", "title": "" }, { "docid": "5f40971403ba774b92314d27bcd10764", "score": "0.5027481", "text": "func (hn *hostNode) remove() {\n\thn.weight -= entryWeight(hn.hostEntry)\n\thn.taken = false\n\tcurrent := hn.parent\n\tfor current != nil {\n\t\tcurrent.weight -= entryWeight(hn.hostEntry)\n\t\tcurrent = current.parent\n\t}\n}", "title": "" }, { "docid": "458b43ef6c2df3b514f4101558f75b09", "score": "0.4974495", "text": "func (c *Container) UnsetNode(id string) {\n\tc.Nodes.Remove(id)\n}", "title": "" }, { "docid": "a50f9c1a12be6e6bbb9e87a8dce59bf3", "score": "0.49718207", "text": "func (l *LinkedList) RemoveNode(node *ListNode) {\n\tplace := node.Next\n\tnode.Value = node.Next.Value\n\tnode.Message = node.Next.Message\n\tnode.Next = place.Next\n\n}", "title": "" }, { "docid": "18ba4c0f39eeafcec4772753bbc4802f", "score": "0.4970563", "text": "func (catalog *NodeCatalog) removeNode(nodeID string) {\n\tcatalog.nodes.Delete(nodeID)\n}", "title": "" }, { "docid": "96018d640e8a8871931f01fb4d51b1b2", "score": "0.49624318", "text": "func (op *Operator) RaftRemovePeerByAddress(args *structs.RaftPeerByAddressRequest, reply *struct{}) error {\n\tif done, err := op.srv.forward(\"Operator.RaftRemovePeerByAddress\", args, args, reply); done {\n\t\treturn err\n\t}\n\n\t// Check management permissions\n\tif aclObj, err := op.srv.ResolveToken(args.AuthToken); err != nil {\n\t\treturn err\n\t} else if aclObj != nil && !aclObj.IsManagement() {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\t// Since this is an operation designed for humans to use, we will return\n\t// an error if the supplied address isn't among the peers since it's\n\t// likely they screwed up.\n\t{\n\t\tfuture := op.srv.raft.GetConfiguration()\n\t\tif err := future.Error(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, s := range future.Configuration().Servers {\n\t\t\tif s.Address == args.Address {\n\t\t\t\tgoto REMOVE\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"address %q was not found in the Raft configuration\",\n\t\t\targs.Address)\n\t}\n\nREMOVE:\n\t// The Raft library itself will prevent various forms of foot-shooting,\n\t// like making a configuration with no voters. Some consideration was\n\t// given here to adding more checks, but it was decided to make this as\n\t// low-level and direct as possible. We've got ACL coverage to lock this\n\t// down, and if you are an operator, it's assumed you know what you are\n\t// doing if you are calling this. If you remove a peer that's known to\n\t// Serf, for example, it will come back when the leader does a reconcile\n\t// pass.\n\tfuture := op.srv.raft.RemovePeer(args.Address)\n\tif err := future.Error(); err != nil {\n\t\top.srv.logger.Printf(\"[WARN] nomad.operator: Failed to remove Raft peer %q: %v\",\n\t\t\targs.Address, err)\n\t\treturn err\n\t}\n\n\top.srv.logger.Printf(\"[WARN] nomad.operator: Removed Raft peer %q\", args.Address)\n\treturn nil\n}", "title": "" }, { "docid": "7caa146b1b6f0b7baf750fc2812d5c5d", "score": "0.49558747", "text": "func (c *Controller) removeDeviceFromNode(device *diskv1.BlockDevice) (*diskv1.BlockDevice, error) {\n\tnode, err := c.Nodes.Get(c.Namespace, c.NodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Skip since the node is not there.\n\t\t\treturn device, nil\n\t\t}\n\t\treturn device, err\n\t}\n\n\tif _, ok := node.Spec.Disks[device.Name]; !ok {\n\t\tlogrus.Debugf(\"disk %s not found in disks of longhorn node %s/%s\", device.Name, c.Namespace, c.NodeName)\n\t\tmsg := fmt.Sprintf(\"Disk not found in longhorn node `%s`\", c.NodeName)\n\t\tdiskv1.DiskAddedToNode.SetError(device, \"\", nil)\n\t\tdiskv1.DiskAddedToNode.SetStatusBool(device, false)\n\t\tdiskv1.DiskAddedToNode.Message(device, msg)\n\t\treturn device, nil\n\t}\n\tnodeCpy := node.DeepCopy()\n\tdelete(nodeCpy.Spec.Disks, device.Name)\n\tif _, err := c.Nodes.Update(nodeCpy); err != nil {\n\t\treturn device, err\n\t}\n\t// To prevent user from mistaking unprovisioning from umount, NDM umount\n\t// for the device as well while unprovisioning it.\n\tdevice.Spec.FileSystem.MountPoint = \"\"\n\texistingMount := device.Status.DeviceStatus.FileSystem.MountPoint\n\tif existingMount != \"\" {\n\t\tif err := disk.UmountDisk(existingMount); err != nil {\n\t\t\treturn device, err\n\t\t}\n\t}\n\n\tmsg := fmt.Sprintf(\"Stop provisioning device %s to longhorn node `%s`\", device.Name, c.NodeName)\n\tdiskv1.DiskAddedToNode.SetError(device, \"\", nil)\n\tdiskv1.DiskAddedToNode.SetStatusBool(device, false)\n\tdiskv1.DiskAddedToNode.Message(device, msg)\n\treturn device, nil\n}", "title": "" }, { "docid": "573cca622d0702940556fd5b09631168", "score": "0.49505192", "text": "func (r *Reporter) UncordonNode(req xfer.Request, name string) xfer.Response {\n\treturn xfer.ResponseError(r.client.CordonNode(name, false))\n}", "title": "" }, { "docid": "380e7cf8c4bc92c3b587b826cd3ebae7", "score": "0.49391428", "text": "func (vm *Manager) handleNodeRemove(nodeID string) {\n\t// we just call RemoveNode on every plugin, because it's probably quicker\n\t// than checking if the node was using that plugin.\n\t//\n\t// we don't need to worry about lazy-loading here, because if don't have\n\t// the plugin loaded, there's no need to call remove.\n\tfor _, plugin := range vm.plugins {\n\t\tplugin.RemoveNode(nodeID)\n\t}\n}", "title": "" }, { "docid": "892d1568b324203d640590e79e09efe5", "score": "0.49107996", "text": "func (g *WeightedUndirectedGraph) RemoveNode(id int64) {\n\tif _, ok := g.nodes[id]; !ok {\n\t\treturn\n\t}\n\tdelete(g.nodes, id)\n\n\tfor from := range g.lines[id] {\n\t\tdelete(g.lines[from], id)\n\t}\n\tdelete(g.lines, id)\n\n\tg.nodeIDs.Release(id)\n}", "title": "" }, { "docid": "e69d66613f3f4c94852d85513f56a758", "score": "0.4907537", "text": "func (l *DbLinkedList) RemoveNode(node *Node) {\n\tif node == nil {\n\t\treturn\n\t}\n\tif node == l.Root {\n\t\tl.Root = l.Root.Next\n\t\tnode.Next = nil\n\t\tl.Root.Prev = nil\n\t\tif l.Root == nil {\n\t\t\tl.Tail = nil\n\t\t}\n\t\treturn\n\t}\n\n\tPrev := node.Prev\n\n\tif node == l.Tail {\n\t\tPrev.Next = nil\n\t\tl.Tail.Prev = nil\n\t\tl.Tail = Prev\n\t} else {\n\t\tnode.Prev = nil\n\t\tPrev.Next = Prev.Next.Next\n\t\tPrev.Next.Prev = Prev\n\t}\n\tnode.Next = nil\n}", "title": "" }, { "docid": "a7920dbf7f585a2bbc2f5cfff16994c1", "score": "0.4903614", "text": "func (k *Kubeadm) RemoveNode() error {\n\tstartTime := time.Now()\n\n\tif len(k.WorkerNodes) == 0 {\n\t\treturn errNoWorkerForRemoveNode\n\t}\n\n\tif len(k.MasterNodes) == 0 {\n\t\treturn errNoMasterForRemoveNode\n\t}\n\n\tvar hostnames []string\n\tvar wg sync.WaitGroup\n\n\tfor i, worker := range k.WorkerNodes {\n\n\t\twg.Add(1)\n\n\t\tgo func(worker *WorkerNode, i int, wg *sync.WaitGroup) {\n\t\t\tdefer wg.Done()\n\t\t\thostname, err := worker.drainAndReset()\n\t\t\tif err != nil {\n\t\t\t\tif !k.SkipWorkerFailure {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tif hostname != \"\" {\n\t\t\t\thostnames = append(hostnames, hostname)\n\t\t\t}\n\n\t\t}(worker, i, &wg)\n\t}\n\n\twg.Wait()\n\n\tfor _, hostname := range hostnames {\n\t\tif err := k.MasterNodes[0].deleteNode(hostname); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\n\tlog.Println(\"time taken = \" + time.Since(startTime).String())\n\n\treturn nil\n}", "title": "" }, { "docid": "76b13b591084b943bb6477d9d518cab3", "score": "0.48966974", "text": "func (o *OCMProvider) RemoveUserCABundle(clusterId string) error {\n\tclusterBuilder := cmv1.NewCluster()\n\tclusterBuilder = clusterBuilder.AdditionalTrustBundle(\"\")\n\tclusterSpec, err := clusterBuilder.Build()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn o.updateCluster(clusterId, clusterSpec)\n}", "title": "" }, { "docid": "124fc8d46174085e7709d4708538ae9c", "score": "0.48966834", "text": "func UnlabelNode(nodename string, label string) {\n\tcmd := exec.Command(\"kubectl\", \"label\", \"node\", nodename, label+\"-\")\n\tcmd.Dir = \"\"\n\t_, err := cmd.CombinedOutput()\n\tExpect(err).ToNot(HaveOccurred())\n}", "title": "" }, { "docid": "8967e7f912b8fad1f740c9812ee02a58", "score": "0.48703638", "text": "func (m *Server) removeRaftNode(w http.ResponseWriter, r *http.Request) {\n\tvar msg string\n\tid, addr, err := parseRequestForRaftNode(r)\n\tif err != nil {\n\t\tsendErrReply(w, r, &proto.HTTPReply{Code: proto.ErrCodeParamError, Msg: err.Error()})\n\t\treturn\n\t}\n\terr = m.cluster.removeRaftNode(id, addr)\n\tif err != nil {\n\t\tsendErrReply(w, r, newErrHTTPReply(err))\n\t\treturn\n\t}\n\tmsg = fmt.Sprintf(\"remove raft node id :%v,adr:%v successfully\\n\", id, addr)\n\tsendOkReply(w, r, newSuccessHTTPReply(msg))\n}", "title": "" }, { "docid": "83a92a9c6954ad6ae87dabef59c8fd5b", "score": "0.48646393", "text": "func (h *HashRing) DelNode(n string) {\n\tts, ok := h.ticks.Load().(*tickArray)\n\tif !ok {\n\t\tpanic(\"hash ring has not been initialized\")\n\t}\n\ttmpTs := &tickArray{}\n\tfor i := range ts.nodes {\n\t\tif ts.nodes[i].node == n {\n\t\t\tcontinue\n\t\t}\n\t\ttmpTs.nodes = append(tmpTs.nodes, ts.nodes[i])\n\t}\n\ttmpTs.length = len(tmpTs.nodes)\n\ttmpTs.Sort()\n\th.ticks.Store(tmpTs)\n}", "title": "" }, { "docid": "b0e9ee12ad3430f94c7ada48187fd181", "score": "0.48480055", "text": "func RemoveRedisFollowerNodesFromCluster(cr *redisv1beta1.RedisCluster) {\n\tlogger := generateRedisManagerLogger(cr.Namespace, cr.ObjectMeta.Name)\n\tvar cmd []string\n\tcurrentRedisCount := CheckRedisNodeCount(cr, \"leader\")\n\n\texistingPod := RedisDetails{\n\t\tPodName: cr.ObjectMeta.Name + \"-leader-0\",\n\t\tNamespace: cr.Namespace,\n\t}\n\tlastLeaderPod := RedisDetails{\n\t\tPodName: cr.ObjectMeta.Name + \"-leader-\" + strconv.Itoa(int(currentRedisCount)-1),\n\t\tNamespace: cr.Namespace,\n\t}\n\n\tcmd = []string{\"redis-cli\"}\n\n\tif cr.Spec.KubernetesConfig.ExistingPasswordSecret != nil {\n\t\tpass, err := getRedisPassword(cr.Namespace, *cr.Spec.KubernetesConfig.ExistingPasswordSecret.Name, *cr.Spec.KubernetesConfig.ExistingPasswordSecret.Key)\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"Error in getting redis password\")\n\t\t}\n\t\tcmd = append(cmd, \"-a\")\n\t\tcmd = append(cmd, pass)\n\t}\n\tcmd = append(cmd, getRedisTLSArgs(cr.Spec.TLS, cr.ObjectMeta.Name+\"-leader-0\")...)\n\n\tlastLeaderPodNodeID := getRedisNodeID(cr, lastLeaderPod)\n\tfollowerNodeIDs := getAttachedFollowerNodeIDs(cr, lastLeaderPodNodeID)\n\n\tcmd = append(cmd, \"--cluster\", \"del-node\")\n\tif *cr.Spec.ClusterVersion == \"v7\" {\n\t\tcmd = append(cmd, getRedisHostname(existingPod, cr, \"leader\")+\":6379\")\n\t} else {\n\t\tcmd = append(cmd, getRedisServerIP(existingPod)+\":6379\")\n\t}\n\n\tfor _, followerNodeID := range followerNodeIDs {\n\n\t\tcmd = append(cmd, followerNodeID)\n\t\tlogger.Info(\"Redis cluster follower remove command is\", \"Command\", cmd)\n\t\texecuteCommand(cr, cmd, cr.ObjectMeta.Name+\"-leader-0\")\n\t\tcmd = cmd[:len(cmd)-1]\n\t}\n}", "title": "" }, { "docid": "686e8c6eb30fb50dd2ae869dace2aee6", "score": "0.48475912", "text": "func (ModuleProxy) RemoveCRD(ctx context.Context, crd *unstructured.Unstructured) error {\n\treturn nil\n}", "title": "" }, { "docid": "53bbd6205ab1466afcc2855f6ff68e3d", "score": "0.48463833", "text": "func (c *client) Uncordon(vmName string) error {\n\tcordon := kubectldrain.NewCmdCordon(c.f, c.streams)\n\toptions := kubectldrain.NewDrainCmdOptions(c.f, c.streams)\n\tif err := options.Complete(c.f, cordon, []string{vmName}); err != nil {\n\t\treturn errors.Wrapf(err, \"error setting up cordon\")\n\t}\n\n\tlog.Info(\"Uncordon\", \"VMName\", vmName)\n\tif err := options.RunCordonOrUncordon(false); err != nil {\n\t\treturn errors.Wrapf(err, \"error cordoning node\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6434390c12f6578f9e887311f702ecf7", "score": "0.48429537", "text": "func (p_list *List) remove(p_node *Node) *Node {\n p_node.prev.next = p_node.next\n p_node.next.prev = p_node.prev\n p_node.next = nil // avoid memory leaks\n p_node.prev = nil // avoid memory leaks\n p_node.list = nil\n p_list.len--\n return p_node\n}", "title": "" }, { "docid": "fb634cf6e22e66d3562ed0c3ecd66d80", "score": "0.48418468", "text": "func (c *TestContext) RemoveNode(master, nodeToRemove Gravity) error {\n\n\tc.Logger().WithField(\"node\", nodeToRemove).WithField(\"master\", master).Info(\"Remove.\")\n\n\tctx, cancel := context.WithTimeout(c.ctx, c.timeouts.Leave)\n\tdefer cancel()\n\n\terr := master.Remove(ctx, nodeToRemove.Node().PrivateAddr(), Graceful(!nodeToRemove.Offline()))\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "bfd00087a1f9289473f2bb059cd65ce3", "score": "0.48388338", "text": "func (agent *Service) DeleteNode(ctx context.Context, in *iota.Node) (*iota.Node, error) {\n\n\t/* Check if the node running an instance */\n\tagent.logger.Printf(\"Received delete node :%v\", in)\n\tif agent.node == nil {\n\t\tmsg := fmt.Sprintf(\"Delete Node received with no personality set : %d\", in.Type)\n\t\tagent.logger.Errorf(msg)\n\t\treturn &iota.Node{NodeStatus: &iota.IotaAPIResponse{ApiStatus: iota.APIResponseType_API_BAD_REQUEST, ErrorMsg: msg}}, nil\n\t}\n\n\tagent.logger.Printf(\"Deleting node personality : %d\", agent.node.NodeType())\n\tresp, _ := agent.node.Destroy(in)\n\n\t/* Unset ethe personality */\n\tagent.node = nil\n\treturn resp, nil\n\n}", "title": "" }, { "docid": "0dac476c9b4c1c9c3401795b3685aecb", "score": "0.4836862", "text": "func (op *Operator) RaftRemovePeerByAddress(address string, q *WriteOptions) error {\n\tr := op.c.newRequest(\"DELETE\", \"/v1/operator/raft/peer\")\n\tr.setWriteOptions(q)\n\n\tr.params.Set(\"address\", address)\n\n\t_, resp, err := op.c.doRequest(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer closeResponseBody(resp)\n\tif err := requireOK(resp); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17267c2c3f0e76619bcb136fb2119f19", "score": "0.48164743", "text": "func RemoveOwner(resource *app.M4DBucket, owner types.NamespacedName) {\n\townerID := CreateOwnerID(owner)\n\tnewOwners := make([]string, 0)\n\tfor _, val := range resource.Status.Owners {\n\t\tif val != ownerID {\n\t\t\tnewOwners = append(newOwners, val)\n\t\t}\n\t}\n\tresource.Status.Owners = newOwners\n}", "title": "" }, { "docid": "17f58de075ca849d8f8ea1ab556baf25", "score": "0.4815138", "text": "func (t *TSTableStore) RemoveNode(node *net.UDPAddr) []bucket.ContactIdentifier {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\treturn t.store.RemoveNode(node)\n}", "title": "" }, { "docid": "e89379799a44205d215ceb4a1a92d721", "score": "0.48064446", "text": "func removeNode(node *SinglyLinkedListNode) {\n\tcurrent := node\n\tfor {\n\t\tcurrent.Data = current.Next.Data\n\t\tif current.Next.Next == nil {\n\t\t\tcurrent.Next = nil\n\t\t\tbreak\n\t\t}\n\t\tcurrent = current.Next\n\t}\n}", "title": "" }, { "docid": "a2f981f0ec891f690b82608198d66072", "score": "0.4806348", "text": "func (c Cluster) RemoveNode(node *Node) Cluster {\n\tnodes := []*Node{}\n\tfor _, n := range c {\n\t\tif n.RaftAddr != node.RaftAddr {\n\t\t\tnodes = append(nodes, n)\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "a51bcec354d3506e2ae1205caa3d7bcc", "score": "0.47896928", "text": "func Remove(n *Node, addr string) error {\n\tb, err := json.Marshal(map[string]string{\"addr\": addr})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to remove node from leader.\n\tresp, err := http.Post(\"http://\"+n.APIAddr+\"/remove\", \"application/json\", bytes.NewReader(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"failed to remove node, leader returned: %s\", resp.Status)\n\t}\n\tdefer resp.Body.Close()\n\treturn nil\n}", "title": "" }, { "docid": "206baf0420c31aecd8cbb271c3bcbaec", "score": "0.47679505", "text": "func (l *list) removeNode(c *node) interface{} {\n\tif c == nil || l.len == 0 {\n\t\treturn nil\n\t}\n\n\tif c == l.first {\n\t\tl.first = c.next\n\t\tif c.next != nil {\n\t\t\tc.next.previous = nil\n\t\t}\n\n\t\t// c is the last node\n\t\tif c == l.last {\n\t\t\tl.last = nil\n\t\t}\n\t} else {\n\t\tif c.previous != nil {\n\t\t\tc.previous.next = c.next\n\n\t\t\tif c.next != nil {\n\t\t\t\tc.next.previous = c.previous\n\t\t\t} else if c == l.last {\n\t\t\t\tl.last = c.previous\n\t\t\t}\n\t\t}\n\t}\n\n\tc.next = nil\n\tc.previous = nil\n\n\tl.len--\n\n\treturn c.value\n}", "title": "" }, { "docid": "cc962f93c77fed08636893f12b231331", "score": "0.47587055", "text": "func (n *Node) removePresence(ch string, uid string) error {\n\tif n.presenceManager == nil {\n\t\treturn nil\n\t}\n\tactionCount.WithLabelValues(\"remove_presence\").Inc()\n\treturn n.presenceManager.RemovePresence(ch, uid)\n}", "title": "" }, { "docid": "07f5059e99c8aa01cbe9c4fa0d215f34", "score": "0.4751389", "text": "func (t *TableStore) RemoveNode(node *net.UDPAddr) (ret []bucket.ContactIdentifier) {\n\tfor _, table := range t.tables {\n\t\tret = append(ret, table.RemoveByAddr(node)...)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "9451d7a4092d3b14b5b1ddb5948d4195", "score": "0.47330374", "text": "func removeFromLinkedList(head **BinomialHeapNode, node *BinomialHeapNode) {\n // Assume the node is present in the list.\n leftsib := getLeftsibling(*head, node)\n\n if leftsib == nil {\n // We are removing the head of this list.\n *head = node.rightsibling // this can set to nil.\n } else {\n leftsib.rightsibling = node.rightsibling\n }\n node.rightsibling = nil\n}", "title": "" }, { "docid": "5e368815b22a200b52da9d7a2e815906", "score": "0.4721866", "text": "func remedyRemove(n *Node) {\n\n}", "title": "" }, { "docid": "487d8f7ce5577cd7a08e057dc813477c", "score": "0.47031784", "text": "func CleanupNode(t *testing.T, pid int) {\n\terr := syscall.Kill(pid, syscall.SIGKILL)\n\t// Ignore error if process is not found.\n\tif errors.Is(err, syscall.ESRCH) {\n\t\treturn\n\t}\n\ttassert.CheckError(t, err)\n}", "title": "" }, { "docid": "95759e6d223837729801839a4a37b97f", "score": "0.4698373", "text": "func RemoveFromNodeportSet(nfti *NFTInterface, tableFamily nftables.TableFamily, proto v1.Protocol, port uint16, chain string) error {\n\tsi := nfti.SIv4\n\tif tableFamily == nftables.TableFamilyIPv6 {\n\t\tsi = nfti.SIv6\n\t}\n\tse := []nftables.SetElement{}\n\tra := setActionVerdict(unix.NFT_JUMP, chain)\n\tprotoB := protoByteFromV1Proto(proto)\n\telement, err := nftableslib.MakeConcatElement([]nftables.SetDatatype{nftables.TypeInetProto, nftables.TypeInetService},\n\t\t[]nftableslib.ElementValue{{InetProto: &protoB}, {InetService: &port}}, ra)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create a concat element with error: %+v\", err)\n\t}\n\tse = append(se, *element)\n\n\tif err = si.Sets().SetDelElements(K8sNodeportSet, se); err != nil {\n\t\t// TODO Add logic to retry, for now just error out\n\t\tif errors.Is(err, unix.EBUSY) {\n\t\t\tklog.Warningf(\"RemoveFromNodeportSet for port: %d failed with error: %v\", port, errors.Unwrap(err))\n\t\t\treturn err\n\t\t}\n\t\tif errors.Is(err, unix.ENOENT) {\n\t\t\tklog.Warningf(\"RemoveFromNodeportSet for %s:%d does not exist\", proto, port)\n\t\t\treturn nil\n\t\t}\n\t\tklog.Errorf(\"RemoveFromNodeportSet for port: %d failed with error: %v\", port, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4124fa517deceb087f65978d433669c1", "score": "0.46955907", "text": "func (r *ReactDiff) RemoveNode(val string) bool {\n\tif len(r.NodeSet) == 0 {\n\t\t//fmt.Println(\"Empty tree deletion\")\n\t\treturn false\n\t}\n\n\tif _, exist := r.NodeSet[val]; !exist {\n\t\t//fmt.Println(\"value not exist for deletion\")\n\t\treturn false\n\t}\n\n\t//Remove node and its child nodes\n\tfor index, v := range r.NodeList {\n\t\tif v == val {\n\t\t\tr.deleteNode(index)\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c6866018de9213ff49c8ef93bf10bd10", "score": "0.46886337", "text": "func (lru *LRU) DeleteNode(node *Entry) {\n\tif nil == node {\n\t\treturn\n\t}\n\n\thashValue := hash(node.data, lru.capacity)\n\n\t// delete node from hash collision list\n\tlru.entry[hashValue].Delete(node.data)\n\n\t// delete node from double list\n\tprev := node.prev\n\tnext := node.next\n\n\tprev.next = next\n\tif nil != next {\n\t\tnext.prev = prev\n\t}\n\n\tlru.length--\n\n\t// if the delete node is the last node, update the last node\n\tif node == lru.last {\n\t\tlru.last = prev\n\t}\n}", "title": "" }, { "docid": "199832fc6d13d32f07ae15a13a72ac28", "score": "0.4677794", "text": "func RemoveNodeExample() {\n\tk := kubeadmclient.Kubeadm{\n\t\tClusterName: \"test\",\n\t\tMasterNodes: []*kubeadmclient.MasterNode{\n\t\t\tkubeadmclient.NewMasterNode(\n\t\t\t\t\"ubuntu\",\n\t\t\t\t\"192.168.64.47\",\n\t\t\t\t\"/Users/debarshibasak/.ssh/id_rsa\",\n\t\t\t),\n\t\t},\n\t\tWorkerNodes: []*kubeadmclient.WorkerNode{\n\t\t\tkubeadmclient.NewWorkerNode(\n\t\t\t\t\"ubuntu\",\n\t\t\t\t\"192.168.64.49\",\n\t\t\t\t\"/Users/debarshibasak/.ssh/id_rsa\",\n\t\t\t),\n\t\t\tkubeadmclient.NewWorkerNode(\n\t\t\t\t\"ubuntu\",\n\t\t\t\t\"192.168.64.50\",\n\t\t\t\t\"/Users/debarshibasak/.ssh/id_rsa\",\n\t\t\t),\n\t\t\tkubeadmclient.NewWorkerNode(\n\t\t\t\t\"ubuntu\",\n\t\t\t\t\"192.168.64.51\",\n\t\t\t\t\"/Users/debarshibasak/.ssh/id_rsa\",\n\t\t\t),\n\t\t},\n\n\t\tSkipWorkerFailure: false,\n\t\tNetworking: networking.Flannel,\n\t}\n\n\tif err := k.RemoveNode(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "1640521f35479efb52b08bf20dcec917", "score": "0.46718493", "text": "func (dll *DoublyLinkedList) DeleteNode(node Node) {\n\tif node == nil {\n\t\tlog.Println(\"Node is nil, can't be deleted\")\n\t}\n\n\tleftNode := node.Left()\n\trightNode := node.Right()\n\n\tif node == dll.Head {\n\t\tdll.Head = rightNode\n\t}\n\n\tif leftNode != nil {\n\t\tleftNode.(*DLLNode).RightNode = rightNode\n\t\tif rightNode != nil {\n\t\t\trightNode.(*DLLNode).LeftNode = leftNode\n\t\t}\n\t} else {\n\t\tif rightNode != nil {\n\t\t\trightNode.(*DLLNode).LeftNode = nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68331cdaa192967e85869d62778a374d", "score": "0.46664548", "text": "func (r *ReconcileWindowsMachineConfig) removeWorkerNode(vm types.WindowsVM) error {\n\t// VM is missing credentials, this can occur if there was a failure initially creating it. We can consider the\n\t// actual VM terminated as there is nothing we can do with it.\n\tif vm.GetCredentials() == nil || len(vm.GetCredentials().GetInstanceId()) == 0 {\n\t\tdelete(r.windowsVMs, vm)\n\t\treturn nil\n\t}\n\n\t// Terminate the instance via its instance id\n\tid := vm.GetCredentials().GetInstanceId()\n\tlog.V(1).Info(\"destroying the Windows VM\", \"ID\", id)\n\n\t// Delete the Windows VM from cloud provider\n\tif err := r.cloudProvider.DestroyWindowsVM(id); err != nil {\n\t\treturn errors.Wrapf(err, \"error destroying VM with ID %s\", id)\n\t}\n\n\t// Remove VM from our list of tracked VMs\n\tdelete(r.windowsVMs, vm)\n\tlog.Info(\"Windows worker has been removed from the cluster\", \"ID\", id)\n\n\treturn nil\n}", "title": "" }, { "docid": "8be7114133dcdd23ac608de19cc32f38", "score": "0.4663332", "text": "func (b *Bundle) UnlabelNode(req *apistructs.SteveRequest, labels []string) error {\n\tif req.ClusterName == \"\" || req.Name == \"\" {\n\t\treturn errors.New(\"clusterName and name fields are required\")\n\t}\n\n\tif len(labels) == 0 {\n\t\treturn errors.New(\"labels are required\")\n\t}\n\n\ttoUnlabel := make(map[string]interface{})\n\tfor _, label := range labels {\n\t\ttoUnlabel[label] = nil\n\t}\n\tmetadata := map[string]interface{}{\n\t\t\"metadata\": map[string]interface{}{\n\t\t\t\"labels\": toUnlabel,\n\t\t},\n\t}\n\treq.Obj = &metadata\n\treturn b.PatchNode(req)\n}", "title": "" }, { "docid": "9edebd222a64225d9b20878d7c1efaef", "score": "0.46601245", "text": "func (r *Ring) RemoveNode(id string) error {\n\ti := r.Search(id)\n\n\tr.Nodes = append(r.Nodes[:i], r.Nodes[i+1:]...)\n\n\treturn nil\n}", "title": "" }, { "docid": "f0b287377c647a2d3a6c5bdf248a1ce3", "score": "0.46518272", "text": "func ShutdownNode(node *Node) {\n\tnode.sdLock.Lock()\n\tnode.IsShutdown = true\n\tnode.sdLock.Unlock()\n\n\tnode.sLock.RLock()\n\tsucc := node.Successor\n\tnode.sLock.RUnlock()\n\n\tnode.pLock.RLock()\n\tpred := node.Predecessor\n\tnode.pLock.RUnlock()\n\n\t//Debug.Printf(\"pred id:%v succ id:%v\", pred.Id, succ.Id)\n\tif pred != nil {\n\t\tnode.RemoteSelf.TransferKeysRPC(succ, pred.Id)\n\t\tpred.SetSuccessorIdRPC(succ)\n\t\tif EqualIds(pred.Id, succ.Id) {\n\t\t\tsucc.SetPredecessorIdRPC(nil)\n\t\t\tpredid, _ := succ.GetPredecessorIdRPC()\n\t\t\tDebug.Printf(\"succ id:%v pred id:%v\", succ, predid)\n\t\t} else {\n\t\t\tsucc.SetPredecessorIdRPC(pred)\n\t\t}\n\t\t//newpred, _ := succ.GetPredecessorIdRPC()\n\t\t//if newpred == nil {\n\t\t//\tDebug.Println(\"nil\")\n\t\t//} else {\n\t\t//\tDebug.Printf(\"succ id:%v pred id:%v\", pred.Id, newpred.Id)\n\t\t//}\n\n\t}\n\t// Wait for all go routines to exit.\n\tnode.wg.Wait()\n\tnode.Server.GracefulStop()\n\tnode.Listener.Close()\n}", "title": "" }, { "docid": "e961020d41f947a8ce2a5faa96580112", "score": "0.4647359", "text": "func (r *NodeFeatureDiscoveryReconciler) removeFinalizer(instance *nfdv1.NodeFeatureDiscovery, finalizer string) {\n\n\t// 'finalizers' will contain a list of all the finalizers for\n\t// the NFD operator instance, except for the finalizer that\n\t// is being removed. (The finalizer to remove is defined with\n\t// this function's parameter 'finalizer'.)\n\tvar finalizers []string\n\n\t// The instance will have a list of finalizers under its\n\t// `metav1.ObjectMeta` reference\n\tfor _, f := range instance.Finalizers {\n\n\t\t// If the current finalizer in the list matches the\n\t\t// 'finalizer' parameter, then we want to remove it.\n\t\t// However, rather than delete from the list, it is\n\t\t// more efficient to just create a new list and set\n\t\t// the 'Finalizers' attribute to that new list. Thus,\n\t\t// this part of the loop skips the addition of the\n\t\t// finalizer we want to remove.\n\t\tif f == finalizer {\n\t\t\tcontinue\n\t\t}\n\t\tfinalizers = append(finalizers, f)\n\t}\n\n\t// Update the 'Finalizers' attribute to point to the newly\n\t// updated list.\n\tinstance.Finalizers = finalizers\n}", "title": "" }, { "docid": "58d2c8493cc1072e07beeb03fcdaf671", "score": "0.46431935", "text": "func (c *Controller) RemoveLabelOffNode(nodeName string, labelKeys []string) error {\n\tvar node *v1.Node\n\tvar err error\n\tfor attempt := 0; attempt < retries; attempt++ {\n\t\tnode, err = c.client.Nodes().Get(nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif node.Labels == nil {\n\t\t\treturn nil\n\t\t}\n\t\tfor _, labelKey := range labelKeys {\n\t\t\tif node.Labels == nil || len(node.Labels[labelKey]) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdelete(node.Labels, labelKey)\n\t\t}\n\t\t_, err = c.client.Nodes().Update(node)\n\t\tif err != nil {\n\t\t\tif !apierrs.IsConflict(err) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "847f4a898623791fe6a24d0b21c9ab5d", "score": "0.46428394", "text": "func (rb *rbTree) remove(z *node) {\n\tx, y := tNil, z\n\tyColor := y.color\n\n\tif z.left == tNil {\n\t\tx = z.right\n\t\trb.transplant(z, z.right)\n\t} else if z.right == tNil {\n\t\tx = z.left\n\t\trb.transplant(z, z.left)\n\t} else {\n\t\ty = z.right.min()\n\t\tyColor = y.color\n\t\tx = y.right\n\t\tif y.parent == z {\n\t\t\tx.parent = y\n\t\t} else {\n\t\t\trb.transplant(y, y.right)\n\t\t\ty.right = z.right\n\t\t\ty.right.parent = y\n\t\t}\n\n\t\trb.transplant(z, y)\n\t\ty.left = z.left\n\t\ty.left.parent = y\n\t\ty.color = z.color\n\t}\n\n\tif yColor == black {\n\t\trb.removeFixup(x)\n\t}\n}", "title": "" }, { "docid": "0c047d937bdb72348427e11023f23155", "score": "0.46420366", "text": "func (l *List) RemoveNode(nodeToRemove *Node) {\n\tprevNode := nodeToRemove.prev\n\tnextNode := nodeToRemove.next\n\tif prevNode == nil {\n\t\tl.head = nil\n\t\tl.head = nextNode\n\t\tif l.head != nil {\n\t\t\tl.head.prev = nil\n\t\t}\n\t} else if nextNode == nil {\n\t\tl.tail = nil\n\t\tl.tail = prevNode\n\t\tif l.tail.next != nil {\n\t\t\tl.tail.next = nil\n\t\t}\n\t} else {\n\t\tnodeToRemove = nil\n\t\tprevNode.next = nextNode\n\t\tnextNode.prev = prevNode\n\t}\n\tl.size--\n}", "title": "" }, { "docid": "9933fd4176cfbe5ef63b406884aae489", "score": "0.46415818", "text": "func (o *CommandDeInitOption) removeNodeLabels() error {\n\tnodeClient := o.KubeClientSet.CoreV1().Nodes()\n\tnodes, err := nodeClient.List(context.TODO(), metav1.ListOptions{LabelSelector: karmadaNodeLabel})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(nodes.Items) == 0 {\n\t\tfmt.Printf(\"node not found by label %q\\n\", karmadaNodeLabel)\n\t\treturn nil\n\t}\n\n\tfor v := range nodes.Items {\n\t\tremoveLabels(&nodes.Items[v], karmadaNodeLabel)\n\t\tfmt.Printf(\"remove node %q labels %q\\n\", nodes.Items[v].Name, karmadaNodeLabel)\n\t\tif o.DryRun {\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := nodeClient.Update(context.TODO(), &nodes.Items[v], metav1.UpdateOptions{}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "daddcbce40c82003ab3c70238f8775f7", "score": "0.46405697", "text": "func deleteNode(n *singly_linked_list.Node) {\n\tif n.Next == nil {\n\t\tn = nil\n\t\treturn\n\t}\n\n\tn.Value = n.Next.Value\n\tn.Next = n.Next.Next\n}", "title": "" }, { "docid": "78f52936d757fe801b3c13df20a23ecb", "score": "0.46385854", "text": "func (c *Cluster) RemoveNodePools() error {\n\tif c.ID == 0 {\n\t\treturn nil\n\t}\n\n\tvar nodePools []*NodePool\n\terr := global.DB().Where(NodePool{\n\t\tClusterID: c.ID,\n\t}).Find(&nodePools).Delete(&nodePools).Error\n\tif err != nil {\n\t\tlog.Errorf(\"Error during deleting saved nodepools: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "26fa9d6918549cdb05edfb878d6bea79", "score": "0.46329623", "text": "func (c *Cluster) RemoveLabelOffNode(cs clientset.Interface, nodeName string, labelKeys []string) error {\n\tvar node *v1.Node\n\tvar err error\n\tfor attempt := 0; attempt < labelingRetries; attempt++ {\n\t\tnode, err = cs.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif node.Labels == nil {\n\t\t\treturn nil\n\t\t}\n\t\tfor _, labelKey := range labelKeys {\n\t\t\tif node.Labels == nil || len(node.Labels[labelKey]) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdelete(node.Labels, labelKey)\n\t\t}\n\t\t_, err = cs.CoreV1().Nodes().Update(node)\n\t\tif err != nil {\n\t\t\tif !apierrs.IsConflict(err) {\n\t\t\t\treturn err\n\t\t\t} else {\n\t\t\t\tglog.V(2).Infof(\"Conflict when trying to remove a labels %v from %v\", labelKeys, nodeName)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8cbad987e208426666e4b4c0baa1c328", "score": "0.46282688", "text": "func (network *NeuralNetwork) RemoveNeuralNode(gene *NodeGene) error {\r\n\tnode := network.FindNodeByGene(gene)\r\n\tif node == nil {\r\n\t\treturn errors.New(\"the node is not present\")\r\n\t}\r\n\tnetwork.RemoveNode(node.ID())\r\n\tdelete(network.NodeByGene, gene)\r\n\tswitch gene.TypeInInt() {\r\n\tcase InputNodeBias:\r\n\t\tnetwork.NumBiasNodes--\r\n\t\tfallthrough\r\n\tcase InputNodeNotBias:\r\n\t\tnetwork.NumInputNodes--\r\n\t\tfor i, v := range network.InputNodes {\r\n\t\t\tif v == node {\r\n\t\t\t\tnetwork.InputNodes = append(network.InputNodes[:i], network.InputNodes[i+1:]...)\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t}\r\n\tcase HiddenNode:\r\n\t\tnetwork.NumHiddenNodes--\r\n\tcase OutputNode:\r\n\t\tnetwork.NumOutputNodes--\r\n\t\tfor i, v := range network.OutputNodes {\r\n\t\t\tif v == node {\r\n\t\t\t\tnetwork.OutputNodes = append(network.OutputNodes[:i], network.OutputNodes[i+1:]...)\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "8d3d53110180922c418cda5ce1f29bdd", "score": "0.46252975", "text": "func (l *list) remove(n *node) *node {\n\tif !l.isValidMember(n) {\n\t\treturn nil\n\t}\n\t// remove the node\n\tn.prev.next = n.next\n\tn.next.prev = n.prev\n\tn.next = nil\n\tn.prev = nil\n\tn.list = nil\n\tl.len--\n\treturn n\n}", "title": "" }, { "docid": "935881c70c2afbf2c416a287c19a7c57", "score": "0.46249908", "text": "func (s *state) removeNode(nodeID roachpb.NodeID, g *group) error {\n\tnode, ok := s.nodes[nodeID]\n\tif !ok {\n\t\treturn util.Errorf(\"cannot remove unknown node %s\", nodeID)\n\t}\n\n\tfor i := range g.nodeIDs {\n\t\tif g.nodeIDs[i] == nodeID {\n\t\t\tg.nodeIDs[i] = g.nodeIDs[len(g.nodeIDs)-1]\n\t\t\tg.nodeIDs = g.nodeIDs[:len(g.nodeIDs)-1]\n\t\t\tbreak\n\t\t}\n\t}\n\t// TODO(bdarnell): when a node has no more groups, remove it.\n\tnode.unregisterGroup(g.groupID)\n\n\t// Cancel any outstanding proposals.\n\tif nodeID == s.nodeID {\n\t\tfor _, prop := range g.pending {\n\t\t\ts.removePending(g, prop, ErrGroupDeleted)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6397a572482cdce42cbfc52592d7db2c", "score": "0.46024176", "text": "func (z *Zone) RemoveNodeFromZone(nodeID int) {\n\tif index := z.nodeZoneIndex(nodeID); index != -1 {\n\t\tz.nodes = append(z.nodes[:index], z.nodes[index+1:]...)\n\t}\n}", "title": "" }, { "docid": "1ce67598c0cc7079372f8c4573f990b4", "score": "0.4595867", "text": "func (rs *RouteSet) Remove(node *RouteNode) {\n\tfor i, n := range rs.nodes {\n\t\tif n.ID.Equal(node.ID) {\n\t\t\trs.nodes = append(rs.nodes[:i], rs.nodes[i+1:]...)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa206ed8b64123445d52bd19d0aa54af", "score": "0.4594585", "text": "func (n *Node) Deprovision() {\n\tn.Store.Close(true)\n\tn.Service.Close()\n\tn.Cluster.Close()\n\tos.RemoveAll(n.Dir)\n}", "title": "" }, { "docid": "c7844cb83a3fdc44157e3f29f0d27237", "score": "0.45911646", "text": "func (l *localAdaptor) RemovePrincipal(principal Principal) {\n\tdelete(l.principals, principal.Name())\n\tdelete(l.principalRoles, principal.Name())\n\tdelete(l.principalPermissions, principal.Name())\n}", "title": "" }, { "docid": "bec9807d5dd622e49a0f756934250fe9", "score": "0.4583279", "text": "func (s *hashRingState) removeVirtualNode(node Node, vnid uint16) (int, error) {\n\tdigest := s.hash([]byte(fmt.Sprintf(\"%s-%d\", node, vnid)))\n\ti := sort.Search(len(s.virtualNodes), func(j int) bool {\n\t\tif bytes.Compare(s.virtualNodes[j].name, digest[:]) == -1 {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\tif bytes.Compare(s.virtualNodes[i].name, digest[:]) != 0 {\n\t\treturn -1, fmt.Errorf(\"virtual node {%x (%s, %d)} is not in the ring\", digest, node, vnid)\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "26ccf270c4208929d2779e7727d2355d", "score": "0.457306", "text": "func (v Vacuum) RemoveBlob(dgst string) error {\n\td, err := digest.Parse(dgst)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tblobPath, err := pathFor(blobPathSpec{digest: d})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontext.GetLogger(v.ctx).Infof(\"Deleting blob: %s\", blobPath)\n\n\terr = v.driver.Delete(v.ctx, blobPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5c273540cab271550a2c905aa1d73dea", "score": "0.4546566", "text": "func (s *KubernetesCommandService) RunKubernetesNodePoolDelete(c *CmdConfig) error {\n\tif len(c.Args) != 2 {\n\t\treturn doctl.NewMissingArgsErr(c.NS)\n\t}\n\tclusterID, err := clusterIDize(c, c.Args[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoolID, err := poolIDize(c.Kubernetes(), clusterID, c.Args[1])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tforce, err := c.Doit.GetBool(c.NS, doctl.ArgForce)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif force || AskForConfirmDelete(\"Kubernetes node pool\", 1) == nil {\n\t\tkube := c.Kubernetes()\n\t\tif err := kube.DeleteNodePool(clusterID, poolID); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errOperationAborted\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3688966109185faf164b036b1dcbac05", "score": "0.45463586", "text": "func (n *mentionExtractor) RemoveOwner() *mentionExtractor {\n\tif n.err != nil {\n\t\treturn n\n\t}\n\n\towner, err := socialapimodels.Cache.Account.ById(n.cm.AccountId)\n\tif err != nil {\n\t\tn.err = err\n\t\treturn n\n\t}\n\n\tfor i, username := range n.usernames {\n\t\tif username == owner.Nick {\n\t\t\t// delete username from the list\n\t\t\tn.usernames = append(n.usernames[:i], n.usernames[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tn.log.Debug(\"usernames after RemoveOwner %+v\", n.usernames)\n\treturn n\n}", "title": "" }, { "docid": "5e23488cad61f4012e5b8803ead5c9dd", "score": "0.45420527", "text": "func (h K8sHelpers) DeleteNode(c *k8sclient.Clientset, nodeName string) error {\n\t// Send the deleted node to the apiserver.\n\terr := c.CoreV1().Nodes().Delete(context.Background(), nodeName, metav1.DeleteOptions{\n\t\tTypeMeta: corev1.Node{}.TypeMeta,\n\t})\n\n\t// Node already deleted\n\tif k8serrors.IsNotFound(err) {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\tdefaultLog.Errorf(\"Error while deleting node label:\", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "75c8baf1541b537b819a4846da2488fe", "score": "0.45400015", "text": "func removeCustomChainReference(ipt *iptables.IPTables, table, chain, customChainName string) error {\n\texists, err := ipt.Exists(table, chain, \"-j\", customChainName)\n\tif err == nil && exists {\n\t\treturn ipt.Delete(table, chain, \"-j\", customChainName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07231b26dee37a6fffb8339f06a254ac", "score": "0.4532396", "text": "func (client *ClientImpl) DeleteClassificationNode(ctx context.Context, args DeleteClassificationNodeArgs) error {\n\trouteValues := make(map[string]string)\n\tif args.Project == nil || *args.Project == \"\" {\n\t\treturn &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.Project\"}\n\t}\n\trouteValues[\"project\"] = *args.Project\n\tif args.StructureGroup == nil {\n\t\treturn &azuredevops.ArgumentNilError{ArgumentName: \"args.StructureGroup\"}\n\t}\n\trouteValues[\"structureGroup\"] = string(*args.StructureGroup)\n\tif args.Path != nil && *args.Path != \"\" {\n\t\trouteValues[\"path\"] = *args.Path\n\t}\n\n\tqueryParams := url.Values{}\n\tif args.ReclassifyId != nil {\n\t\tqueryParams.Add(\"$reclassifyId\", strconv.Itoa(*args.ReclassifyId))\n\t}\n\tlocationId, _ := uuid.Parse(\"5a172953-1b41-49d3-840a-33f79c3ce89f\")\n\t_, err := client.Client.Send(ctx, http.MethodDelete, locationId, \"7.1-preview.2\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1b6ec0db4118de8f3c87774c8c2d4fb8", "score": "0.45305508", "text": "func (c *Cluster) removeMemberForNode(ctx context.Context, nodeForEtcdClient, nodeToRemove string) error {\n\tetcdClient, err := c.EtcdClientGenerator.forNode(nodeForEtcdClient)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create etcd Client\")\n\t}\n\n\t// List etcd members. This checks that the member is healthy, because the request goes through consensus.\n\tmembers, err := etcdClient.Members(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to list etcd members using etcd Client\")\n\t}\n\tmember := etcdutil.MemberForName(members, nodeToRemove)\n\n\t// The member has already been removed, return immediately\n\tif member == nil {\n\t\treturn nil\n\t}\n\n\tif err := etcdClient.RemoveMember(ctx, member.ID); err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove member from etcd\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ac976a0701da8f015ddff97a5a6c5c30", "score": "0.4529389", "text": "func (rt *routingTableImpl) remove(p node.RemoteNodeData) {\n\n\tcpl := p.DhtId().CommonPrefixLen(rt.local)\n\tbucketId := cpl\n\tif bucketId >= len(rt.buckets) {\n\t\tbucketId = len(rt.buckets) - 1\n\t}\n\n\tbucket := rt.buckets[bucketId]\n\tbucket.Remove(p)\n\n\tgo func() { rt.peerRemoved <- p }()\n}", "title": "" }, { "docid": "b6353c60c4b4a3e9e0b1e54bee4a97d2", "score": "0.45207757", "text": "func (l *List) Remove(node *Node) {\n\tnode.next.prev = node.prev\n\tnode.prev.next = node.next\n\tnode.next = nil\n\tnode.prev = nil\n\tl.len--\n}", "title": "" }, { "docid": "d28972b5e74176d96e6b180abcb0d436", "score": "0.45188504", "text": "func (cm *rpcConnManager) RemoveByAddr(addr string) error {\n\treplyChan := make(chan error)\n\tcm.server.QueryChannel() <- connection.RemoveNodeMsg{\n\t\tCmp: func(sp *connection.ConnPeer) bool { return sp.Addr() == addr },\n\t\tReply: replyChan,\n\t}\n\treturn <-replyChan\n}", "title": "" }, { "docid": "7152aecd18d87bd32b828f173540d771", "score": "0.45188254", "text": "func DelNode(n linkedlist.Node) linkedlist.Node {\n\n\tnext := *n.Next\n\tprev := *n.Prev\n\n\tnext.Prev = &prev\n\tprev.Next = &next\n\n\treturn next\n\n}", "title": "" }, { "docid": "ebea3f888ed0ea0692c6851e57da3487", "score": "0.45180282", "text": "func (n *trieNode) removeChild(r rune) {\n\tdelete(n.children, r)\n\tupdateMask(n.parent)\n\t// for nd := n.parent; nd != nil; nd = nd.parent {\n\t// \tnd.mask ^= nd.mask\n\t// \tnd.mask |= uint64(1) << uint64(nd.rval-'a')\n\t// \tfor _, c := range nd.children {\n\t// \t\tnd.mask |= c.mask\n\t// \t}\n\t// }\n}", "title": "" }, { "docid": "2f4f04581eb7deee371939214c836046", "score": "0.45168895", "text": "func (data *Data) DeleteMetaNode(id uint64) error {\n\t// Node has to be larger than 0 to be real\n\tif id == 0 {\n\t\treturn ErrNodeIDRequired\n\t}\n\n\tvar nodes []meta.NodeInfo\n\tfor _, n := range data.MetaNodes {\n\t\tif n.ID == id {\n\t\t\tcontinue\n\t\t}\n\t\tnodes = append(nodes, n)\n\t}\n\n\tif len(nodes) == len(data.MetaNodes) {\n\t\treturn ErrNodeNotFound\n\t}\n\n\tdata.MetaNodes = nodes\n\treturn nil\n}", "title": "" } ]
7940ca10dc66881fdec879d1d7f4d847
perimeter of rhombus with sides and height given
[ { "docid": "973fa89b94b796d80346ab11a8f4189e", "score": "0.73192686", "text": "func (q *RhombusSides) PerimeterOfRhombus() float64 {\n\treturn 4 * q.Side\n}", "title": "" } ]
[ { "docid": "f4f81ed2f075cfb00dbdcd8527e2a939", "score": "0.73507357", "text": "func (q *RhombusSides) AreaOfRhombus() float64 {\n\treturn q.Side * q.Height\n}", "title": "" }, { "docid": "ee9a968559c47e407fc225bec5973be1", "score": "0.7285435", "text": "func (q *RhombusDiagonals) PerimeterOfRhombus() float64 {\n\treturn 4 * q.LengthOfRhombusSides()\n}", "title": "" }, { "docid": "40df1407317c4270503be975ac3ee841", "score": "0.72091067", "text": "func Perimeter(width float64, height float64) float64 {\n\treturn 2 * (width + height)\n}", "title": "" }, { "docid": "3ca960ab9e8bb134d950897d8df76f25", "score": "0.7193813", "text": "func Perimeter(width, height float64) float64 {\n\treturn (width + height) * 2\n}", "title": "" }, { "docid": "beef3253943c722625d3b95dde1ff790", "score": "0.7058336", "text": "func (h *Hexagon) Perimeter() float64 {\n\treturn 3 * math.Sqrt(3) / 2 * math.Pow(h.side, 2)\n}", "title": "" }, { "docid": "4360d755e10aac65a7738066abeda138", "score": "0.6973398", "text": "func (q *RhombusDiagonals) LengthOfRhombusSides() float64 {\n\treturn 0.5 * math.Sqrt(math.Pow(q.Diagonal1, 2) + math.Pow(q.Diagonal2, 2))\n}", "title": "" }, { "docid": "c27baf28901abe1ba48aee5e0bff768c", "score": "0.69148356", "text": "func (r rectangle) perimeter() int {\n\treturn 2 * (r.width + r.height)\n}", "title": "" }, { "docid": "5cb1b62e9c7b2334e63027e4f0a36e09", "score": "0.6881507", "text": "func (r *Rectangle) perimeter() float64 {\n\treturn r.w*2 + r.h*2\n}", "title": "" }, { "docid": "eb0beec68748dbec51e40eb5a9cfaa48", "score": "0.67478824", "text": "func (q *RhombusDiagonals) AreaOfRhombus() float64 {\n\treturn 0.5 * q.Diagonal1 * q.Diagonal2\n}", "title": "" }, { "docid": "b9c6a02f9e53838c92ede3bd7baeec04", "score": "0.6714825", "text": "func Perimeter(r Rectangle) float64 {\n\treturn 2*r.Width + 2*r.Height\n}", "title": "" }, { "docid": "480c7741bb8c568454850340097f7bb7", "score": "0.6624883", "text": "func (rect Rectangle) Perimeter() (res float64) {\n\treturn 2 * (rect.Width + rect.Height)\n}", "title": "" }, { "docid": "763c49eaa7ebcdfc827a5381610bd5b0", "score": "0.6612922", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn 2 * (rectangle.Height + rectangle.Width)\n}", "title": "" }, { "docid": "669ee6de673a14a71daf9284f6a0b111", "score": "0.6591466", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn (rectangle.Height + rectangle.Width) * 2\n}", "title": "" }, { "docid": "9ac77d183d94a10637c41af808062288", "score": "0.6590561", "text": "func (r Rectangle) Perimeter() float64 {\n\treturn 2 * (r.Width + r.Height)\n}", "title": "" }, { "docid": "2035c70584f82ccae5e31724fedeca5c", "score": "0.65836823", "text": "func (r Rectangle) Perimeter() float64 {\n\treturn (r.Width + r.Height) * 2\n}", "title": "" }, { "docid": "22d97d6a2a585fccfa83e5215b4761da", "score": "0.6580522", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn 2 * (rectangle.Width + rectangle.Height)\n}", "title": "" }, { "docid": "22d97d6a2a585fccfa83e5215b4761da", "score": "0.6580522", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn 2 * (rectangle.Width + rectangle.Height)\n}", "title": "" }, { "docid": "22d97d6a2a585fccfa83e5215b4761da", "score": "0.6580522", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn 2 * (rectangle.Width + rectangle.Height)\n}", "title": "" }, { "docid": "e0c9c10a072d60aa6b83a9900cd4b8f7", "score": "0.6570623", "text": "func (r Rectangle) Perimeter() float64 {\n\treturn 2*r.Width + 2*r.Height\n}", "title": "" }, { "docid": "f24c2f6a4bba43aa998f5173cadb51cb", "score": "0.6553779", "text": "func (rct Rectangle) Perimeter() float64 {\n\tlength := distance(rct.x1, rct.y1, rct.x1, rct.y2)\n\twidth := distance(rct.x1, rct.y1, rct.x2, rct.y1)\n\treturn 2 * (length + width)\n\n}", "title": "" }, { "docid": "3a3f16fa45fc7d88e430ea6447c5e7ae", "score": "0.65264773", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn 2*rectangle.width + 2*rectangle.height\n}", "title": "" }, { "docid": "626d26a761df2d6087236a162642f617", "score": "0.6525447", "text": "func Perimeter(rectangle Rectangle) float64 {\n\treturn 2 * (rectangle.width + rectangle.height)\n}", "title": "" }, { "docid": "04b14a3add6b2fffc2f5a77df6a58235", "score": "0.65076345", "text": "func (r Rectangle) Perimeter() float64 {\n\treturn 2*r.x + 2*r.y\n}", "title": "" }, { "docid": "40765afa33501a4beae83802492a40f3", "score": "0.64647627", "text": "func (t Triangle) Perimeter() float64 {\n\treturn t.base + math.Sqrt(t.height)\n}", "title": "" }, { "docid": "fa7ea61407ed036fb6a3c590e6d00f7d", "score": "0.6412858", "text": "func rhombusInRectangle() *Statement {\n\tproblem := geom.NewBoard()\n\tpt1 := geom.NewPoint(0, 0)\n\tpt2 := geom.NewPoint(3, 0)\n\tpt3 := geom.NewPoint(3, math.Sqrt(3))\n\tpt4 := geom.NewPoint(0, math.Sqrt(3))\n\ts1 := geom.NewSegment(pt1, pt2)\n\ts2 := geom.NewSegment(pt2, pt3)\n\ts3 := geom.NewSegment(pt3, pt4)\n\ts4 := geom.NewSegment(pt4, pt1)\n\tproblem.AddPoint(pt1)\n\tproblem.AddPoint(pt2)\n\tproblem.AddPoint(pt3)\n\tproblem.AddPoint(pt4)\n\tproblem.AddSegment(s1)\n\tproblem.AddSegment(s2)\n\tproblem.AddSegment(s3)\n\tproblem.AddSegment(s4)\n\n\ttarget := NewTarget()\n\tpt5 := geom.NewPoint(2, 0)\n\tpt6 := geom.NewPoint(1, math.Sqrt(3))\n\tl1 := geom.NewLineFromTwoPoints(pt1, pt6)\n\tl2 := geom.NewLineFromTwoPoints(pt5, pt3)\n\ttarget.Lines.Add(l1)\n\ttarget.Lines.Add(l2)\n\n\tsequences := map[string]string{\"E\": \"+II\"}\n\treturn NewStatement(problem, target, sequences, \"1.5 Rhombus in Rectangle\")\n}", "title": "" }, { "docid": "472959024f23c6837a5aacfdb7bb12f8", "score": "0.63696915", "text": "func Perimeter(rectangle Rectangle) (perimeter float64) {\n\tperimeter = 2 * (rectangle.Width + rectangle.Height)\n\treturn\n}", "title": "" }, { "docid": "12caf03f4be4942c14ff302843fb9500", "score": "0.6239457", "text": "func (c *Circle) perimeter() float64 {\n\treturn 2 * math.Pi * c.r\n}", "title": "" }, { "docid": "e7a7f272fc3a3ad5a9dcd41fd2136d7e", "score": "0.6202182", "text": "func (q *SquareDiagonals) PerimeterOfSquare() float64 {\n\treturn 4 * q.SideOfSquare()\n}", "title": "" }, { "docid": "a7106e909fe87b1cc442c878c1c73a98", "score": "0.619266", "text": "func (t Triangle) Perimeter() float64 {\n\treturn 0\n}", "title": "" }, { "docid": "a7106e909fe87b1cc442c878c1c73a98", "score": "0.619266", "text": "func (t Triangle) Perimeter() float64 {\n\treturn 0\n}", "title": "" }, { "docid": "d3623a1718e23ff11a0a10a1f93a5255", "score": "0.60541123", "text": "func (c ConcavePolygon) Perimeter() float64 { return c.concave.Perimeter() }", "title": "" }, { "docid": "93d31620f6c08191727c3ba2c34fe37a", "score": "0.60357326", "text": "func PerimeterRectangle(rectangle Rectangle) float64 {\n\treturn 2 * (rectangle.Width + rectangle.Width)\n}", "title": "" }, { "docid": "f975e08f816f80d13ad5f4c6f786fac1", "score": "0.59649616", "text": "func (q *ScaleneQuadrilateralSides) PerimeterOfScaleneQuadrilateral() float64 {\n\treturn q.Side1 + q.Side2 + q.Side3 + q.Side4\n}", "title": "" }, { "docid": "a0ae994df3ecdc5ed915ec3658c2800e", "score": "0.59610784", "text": "func (q *SquareSides) PerimeterOfSquare() float64 {\n\treturn 4 * q.Side\n}", "title": "" }, { "docid": "d527252d9be8f2e94014141edc8ff45d", "score": "0.5821075", "text": "func (r Rectangle) Perim() float64 {\r\n\treturn float64(r.Width*2 + r.Height*2)\r\n}", "title": "" }, { "docid": "392778a60f404f3fc10370d86cd9c440", "score": "0.5814118", "text": "func (c Circle) Perimeter() float64 {\n\treturn 2 * math.Pi * c.r\n}", "title": "" }, { "docid": "53a67576fd9323e3b9a623ab4b32b983", "score": "0.5749859", "text": "func (p Polygon) Perimeter() float64 {\n\tvar sum float64\n\tprev := p[0]\n\tfor _, f := range p[1:] {\n\t\tsum += prev.Distance(f)\n\t\tprev = f\n\t}\n\tsum += prev.Distance(p[0])\n\treturn sum\n}", "title": "" }, { "docid": "c9045c11522527013be59c0c0c282792", "score": "0.5741027", "text": "func (c Circle) Perimeter() float64 {\n\treturn 2 * math.Pi * c.Radius\n}", "title": "" }, { "docid": "97e80e5120dff6a9c7ac11f07af3fad9", "score": "0.574094", "text": "func (bb B2AABB) GetPerimeter() float64 {\n\twx := bb.UpperBound.X - bb.LowerBound.X\n\twy := bb.UpperBound.Y - bb.LowerBound.Y\n\treturn 2.0 * (wx + wy)\n}", "title": "" }, { "docid": "7682f4e19b4d2f4bf6e47234dcd4fd1c", "score": "0.5710873", "text": "func (r *rect) perim() int {\n\tr.width = 40\n\treturn 2*r.width + 2*r.heigth\n}", "title": "" }, { "docid": "9b89c23e4de10b9fb20c524123a1edd0", "score": "0.56640136", "text": "func rectangle(width, height int) (int, int) {\n\tarea := width * height\n\tperimeter := (width + height) * 2\n\treturn area, perimeter\n}", "title": "" }, { "docid": "7b7ed8fd24763e0d0d67f2bd27c6abd0", "score": "0.56439275", "text": "func (n *CountAndLengthAndApothemOfAgonSide) PerimeterOfAgon() float64 {\n\treturn float64(n.Side_count) * n.Side_length\n}", "title": "" }, { "docid": "bc050afe64a2baf746cf96a47328985a", "score": "0.5624774", "text": "func Perimiter(r Rectangle) float64 {\n\treturn 2 * (r.Width + r.Height)\n}", "title": "" }, { "docid": "5ad6e1350e51404a1e626fa1255c89d4", "score": "0.56191576", "text": "func (r recta) perim() float64 {\n\treturn 2*r.w + 2*r.h\n}", "title": "" }, { "docid": "d2ec43f0d0f172eded19fe818a9a616c", "score": "0.5607909", "text": "func (r Rectangle) Perimiter() float64 {\n\treturn r.height*2 + r.width*2\n\n}", "title": "" }, { "docid": "5fa1ec488c426a277b5e476da91fe1d0", "score": "0.5596478", "text": "func ( r rect) perim() int {\n\treturn 2 * r.width + 2 * r.height\n}", "title": "" }, { "docid": "c118d709388a88154d3432411e0de771", "score": "0.55890477", "text": "func (r rect) perim() int {\n\treturn 2*r.width + 2*r.height\n}", "title": "" }, { "docid": "c118d709388a88154d3432411e0de771", "score": "0.55890477", "text": "func (r rect) perim() int {\n\treturn 2*r.width + 2*r.height\n}", "title": "" }, { "docid": "c118d709388a88154d3432411e0de771", "score": "0.55890477", "text": "func (r rect) perim() int {\n\treturn 2*r.width + 2*r.height\n}", "title": "" }, { "docid": "c118d709388a88154d3432411e0de771", "score": "0.55890477", "text": "func (r rect) perim() int {\n\treturn 2*r.width + 2*r.height\n}", "title": "" }, { "docid": "1cacb96cb69c3b8bc0fb715ec0b01811", "score": "0.55460525", "text": "func (h *Hexagon) Area() float64 {\n\treturn 6 * h.side\n}", "title": "" }, { "docid": "a26e63da36dfa99f0702ef1bddbfe210", "score": "0.5527572", "text": "func isPerimeter(topLeft Position2D, width int, length int, newTilePos Position2D) bool {\n\treturn newTilePos.Row == topLeft.Row || newTilePos.Col == topLeft.Col ||\n\t\tnewTilePos.Row == topLeft.Row+width-1 || newTilePos.Col == topLeft.Col+length-1\n}", "title": "" }, { "docid": "daf7dbc5aaa96b12ffc3f549ec1e736d", "score": "0.5498465", "text": "func (s square) area() float64 {\n return s.width * s.height\n}", "title": "" }, { "docid": "c2e6b2f5614c023f48889f79b680d38f", "score": "0.5429683", "text": "func R(x0, y0, x1, y1 Length) Rect { return Rect{Point{x0, y0}, Point{x1, y1}} }", "title": "" }, { "docid": "8a7e028894e195421b9ee9cef4149e67", "score": "0.5411526", "text": "func (r rect) area() int {\n return r.height * r.width\n}", "title": "" }, { "docid": "982bb78168086124847a5d936eb0d5e8", "score": "0.5408311", "text": "func (r rect) area() float64 {\n return r.width * r.height\n}", "title": "" }, { "docid": "d47f3b73a22d75181626759696b84e8d", "score": "0.5398583", "text": "func (r *Rectangle) area() float64 {\n\treturn r.w * r.h\n}", "title": "" }, { "docid": "d99191afcfc729f1afa27fa4ec02a2c1", "score": "0.53809226", "text": "func (r *rectiint) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "52212731e07a9ac39dcd821d0464838b", "score": "0.5377319", "text": "func (hcube conwayHypercube) height() int {\n\tif hcube.depth() == 0 {\n\t\treturn 0\n\t}\n\treturn len(hcube[0][0])\n}", "title": "" }, { "docid": "40f218b7ee3d2f00edb8e4b25c8ae3ff", "score": "0.5361667", "text": "func (r *rectangle) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "5dbb23f662583cc4a9c353f88e04de1d", "score": "0.5343067", "text": "func (r *rect) area() int{\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "079403961f4d2cdc31caaae9439c9831", "score": "0.5343002", "text": "func (p Points) Perimeter() float64 {\n\tvar perimeter float64\n\tfor idx, point := range p[:len(p)-1] {\n\t\tperimeter += makeVector(point, p[idx+1]).magnitude()\n\t}\n\n\treturn perimeter\n}", "title": "" }, { "docid": "6f1803675fdaaa1d40bb20118a1c0a54", "score": "0.52827334", "text": "func (z square) area() float64 {\n\treturn z.side * z.side\n}", "title": "" }, { "docid": "2f73a4646b9ec17a90174081e17df7c5", "score": "0.5279132", "text": "func (r *rect) area() int {\r\n\treturn r.width * r.height\r\n}", "title": "" }, { "docid": "d9829f6e90e6cb29c6176cceb8adc288", "score": "0.52787703", "text": "func (s square) area() float64 {\n\tfmt.Println(\"squere area\")\n\treturn s.height * s.width\n}", "title": "" }, { "docid": "f89acae7eabf82dcedd0e31e01033302", "score": "0.5271013", "text": "func (r Rectangle) size() float64 {\n\tn1, n2 := r.neighbors(r.P1)\n\treturn distance(r.P1, n1) * distance(r.P1, n2)\n}", "title": "" }, { "docid": "5d877c69244bdf5f4052abb70b7c4d15", "score": "0.525748", "text": "func (r rectangle) area() float32 {\n\treturn r.length * r.breadth\n}", "title": "" }, { "docid": "918b822633ba27898a14c2e44e1ccdf7", "score": "0.5242919", "text": "func ( r *rect) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "ffff83eb64e4e2e2f6d4d1c0ecc8e244", "score": "0.52397466", "text": "func (r *rect) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "ffff83eb64e4e2e2f6d4d1c0ecc8e244", "score": "0.52397466", "text": "func (r *rect) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "ffff83eb64e4e2e2f6d4d1c0ecc8e244", "score": "0.52397466", "text": "func (r *rect) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "025cf97423d03cc721095031a8d08ebd", "score": "0.52340287", "text": "func (r rect) area() int {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "3a0dc58636d935f90aede4f031b50dc5", "score": "0.5230054", "text": "func (r rect) area() float64 {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "3a0dc58636d935f90aede4f031b50dc5", "score": "0.5230054", "text": "func (r rect) area() float64 {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "3a0dc58636d935f90aede4f031b50dc5", "score": "0.5230054", "text": "func (r rect) area() float64 {\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "6815399bb0e81737a08c07d76d8c60ea", "score": "0.5208022", "text": "func main() {\n\tc := &Circle{Radius: 12}\n\t/* printArea(c)\n\tprintPerimeter(c) */\n\tprintDimension(c)\n\n\tr := &Rectangle{Height: 8, Width: 12}\n\t/* printArea(r)\n\tprintPerimeter(r) */\n\tprintDimension(r)\n}", "title": "" }, { "docid": "ba2bd8187f3f904ac284bc9061c4c055", "score": "0.5194164", "text": "func (s square) area() float64 {\n\treturn s.side * s.side \n}", "title": "" }, { "docid": "7a094e9a880a0f620e2676d629a04a1d", "score": "0.51908714", "text": "func main() {\n\tfmt.Println(\"The program prints the perimeter and the square of a rectangle given the rectangle sides.\")\n\tvar a float64\n\tvar b float64\n\tfmt.Print(\"Enter the length and the breadth of the rectangle: \")\n\tfmt.Scan(&a)\n\tfmt.Scan(&b)\n\tres1 := 2.0 * (a + b)\n\tres2 := a * b\n\tfmt.Printf(\"Perimeter: %.2f, square: %.2f\", res1, res2)\n\n}", "title": "" }, { "docid": "f9b6d129463cd5a247622db8c3158613", "score": "0.5189092", "text": "func (r *rect) area() int {\n\t//both of these are ints, so you'll get an int back\n\treturn r.width * r.height\n}", "title": "" }, { "docid": "be2ef9192d189c4f3a562dc988d067c3", "score": "0.51768553", "text": "func getPerimeter(day int) float64 {\n\tlocations := locations(PlanetarySystem(), day)\n\tvar perimeter float64\n\tfor i, l := range locations {\n\t\tif i+1 < len(locations) {\n\t\t\tperimeter += l.DistanceTo(locations[i+1])\n\t\t} else {\n\t\t\tperimeter += l.DistanceTo(locations[0])\n\t\t}\n\t}\n\treturn perimeter\n}", "title": "" }, { "docid": "f450ba81ae274367e2afc5013e20c4c9", "score": "0.51695716", "text": "func (q *SquareSides) AreaOfSquare() float64 {\n\treturn math.Pow(q.Side,2)\n}", "title": "" }, { "docid": "1fa0936120f8d91c4d6cc8cf52d861a1", "score": "0.5166695", "text": "func (r Triangle) Perim() float64 {\r\n\treturn float64(r.SideA + r.SideB + r.SideC)\r\n}", "title": "" }, { "docid": "99b42ab12c6b432b07bddf225e173e52", "score": "0.5155082", "text": "func RegularPolygonSideLength(center F, sideLength, angle float64, sides int) Polygon {\n\t// A right triangle is formed with the hypotenuse being length r (which we\n\t// want to find), one angle being 360°/(2n) and the opposite side being length\n\t// (s/2). So the sine law gives us:\n\t// r / sin(90°) = (s/2) / sin(180°/n)\n\t// which is gives us\n\t// r = (s*sin(90°)) / (2*sin(180°/n))\n\t// r = (sin(90°)/2) * (r/sin(180°/n))\n\t// so (sin(90°)/2) comes out as a constant, rpclC\n\tao := Pi / float64(sides)\n\tr := (rpclC * sideLength) / math.Sin(ao)\n\t// rotate backwards so the first line is tangent to the X axis\n\tangle -= ao\n\treturn RegularPolygonRadius(center, r, angle, sides)\n}", "title": "" }, { "docid": "0e288878b5d50f1a2360e549bbfd2a98", "score": "0.5140522", "text": "func (r *Rectangle) area() float64 {\n\t//We can access fields by using dot operator\n\treturn r.x * r.y\n}", "title": "" }, { "docid": "5a6a6acd192ac8c9bbdc1c76a63cfa10", "score": "0.51403636", "text": "func (m *VisitMutation) Perimeter() (r int, exists bool) {\n\tv := m.perimeter\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "fbbd77537aa459cbec0f97c203da7304", "score": "0.51166314", "text": "func (c *Circle) area() float64 {\n return math.Pi * c.r*c.r\n}", "title": "" }, { "docid": "1408f31bde44c86f7948de0720cacb5e", "score": "0.50397956", "text": "func (c circle) area() float64 {\n return math.Pi * c.radius * c.radius\n}", "title": "" }, { "docid": "5edcfd63a4281061a8a8d180b5e6ad97", "score": "0.5039296", "text": "func (h *Hmtx) Length() uint32 {\n\treturn uint32(4*len(h.HMetrics) + 2*len(h.LeftSideBearings))\n}", "title": "" }, { "docid": "38e10f3ed11739c0c17eef86c444793c", "score": "0.5031001", "text": "func (r* rect) double() {\n r.height *= 2\n r.width *= 2\n}", "title": "" }, { "docid": "97002d02c9b53a30c7fd13a7ba849a4a", "score": "0.5024994", "text": "func (rec *Rectangle) area() float64 {\n\treturn rec.width * rec.height\n}", "title": "" }, { "docid": "5f9bcded33a2b80c14262928911a8bf2", "score": "0.5024033", "text": "func (c circle) area() float64 {\n return math.Pi * c.radius * c.radius\n}", "title": "" }, { "docid": "b436d9b4caa847c9fd6dbb837a61f9b8", "score": "0.50054216", "text": "func (pCircle Circle) area() float64 {\n return math.Pi * pCircle.radius*pCircle.radius\n}", "title": "" }, { "docid": "9f68eed7300d583c2854ee7e0fac8700", "score": "0.4995352", "text": "func (s *Square) area() float64 {\n\treturn s.side * s.side\n}", "title": "" }, { "docid": "1e12cf2aac338395ba86ce6fb8b69d9e", "score": "0.49867648", "text": "func (ec *earcut) area(p, q, r *node) float64 {\n\treturn (q.y-p.y)*(r.x-q.x) - (q.x-p.x)*(r.y-q.y)\n}", "title": "" }, { "docid": "3d10777fa75ef7a40be2bed8c21671d9", "score": "0.49804825", "text": "func (rect rectangle) area() float64 {\n\treturn rect.width * rect.height\n}", "title": "" }, { "docid": "9dc6cbbeee90b6a717919c3b78b31587", "score": "0.49673003", "text": "func (rect *Rectangle) area() float64 {\n\treturn rect.width * rect.height\n}", "title": "" }, { "docid": "46c14db9cda2318bda294f0db0f1caa6", "score": "0.49596843", "text": "func calculateRectangle(rct map[string]int) map[string]int {\n\tis_square, side := isASquare(rct[\"area\"])\n\tif is_square {\n\t\trct[\"height\"], rct[\"base\"] = int(side), int(side)\n\t} else {\n\t\tfactors := calcPrimeFactors(rct[\"area\"])\n\t\tfounded, base, height := getBaseAndHeight(factors)\n\t\trct[\"base\"], rct[\"height\"] = base, height\n\t\tif founded == false {\n\t\t\trct[\"area\"] = rct[\"area\"] - 1\n\t\t\trct[\"skipped\"] = rct[\"skipped\"] + 1\n\t\t\tcalculateRectangle(rct)\n\t\t}\n\t}\n\treturn rct\n}", "title": "" }, { "docid": "7b565a4325a24abbab0a91350b143d89", "score": "0.49570215", "text": "func (r Rect) H() float64 {\n\treturn r.Size.Y()\n}", "title": "" }, { "docid": "feeaa4b317a77cef7a90d5cfcf6ba3f9", "score": "0.49466294", "text": "func (p *DoomPicture) Height() int { return int(p.height) }", "title": "" }, { "docid": "ea051e77afc1af7b453b92c5883041fe", "score": "0.49439034", "text": "func (rect Retangle) area() float64 {\n\treturn rect.width * rect.height\n}", "title": "" } ]
e20187f71b5685a341668e8b8c3936f4
Last returns the last element or a zero value if there are no elements.
[ { "docid": "c17b4a8d8683dd52498a532c1dd846a4", "score": "0.8175423", "text": "func Last[T any](ss []T) T {\n\tif len(ss) == 0 {\n\t\tvar zeroValue T\n\n\t\treturn zeroValue\n\t}\n\n\treturn ss[len(ss)-1]\n}", "title": "" } ]
[ { "docid": "00ca202e8e0f64e6541f734763fe8cd1", "score": "0.7978091", "text": "func Last(in interface{}) interface{} {\n\tif Len(in) == 0 {\n\t\treturn nil\n\t}\n\n\treturn Get(in, Len(in)-1)\n}", "title": "" }, { "docid": "b5b5bc93510852fd7fdf9be09d5a2785", "score": "0.77807623", "text": "func (lst *List[T]) Last() interface{} {\n\tif lst.Len() > 0 {\n\t\treturn lst.Get(-1)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b77508a9c9b0ecd7acad8b89d61fc9f", "score": "0.76702166", "text": "func (s MessageEmptyArray) Last() (v MessageEmpty, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "21ae6532508d08d01edf18d36374be44", "score": "0.7651221", "text": "func lastValue(arr []float64) float64 {\n\tif len(arr) == 0 {\n\t\treturn 0\n\t}\n\treturn arr[len(arr)-1]\n}", "title": "" }, { "docid": "1863c49cc4b1cc3fa5c4f93b1afdc2aa", "score": "0.76285756", "text": "func Last(l []Item) (last Item) {\n\tn := len(l)\n\tif n == 0 {\n\t\treturn last\n\t}\n\n\treturn l[n-1]\n}", "title": "" }, { "docid": "674e150ef1a309da22341425756af4ee", "score": "0.76095134", "text": "func (T *RedBlackTree) Last() Elem {\n\tif T.Empty() {\n\t\treturn nil\n\t}\n\treturn T.root.findMax().elem\n}", "title": "" }, { "docid": "f1b2196edc052c50fa3639439937bf81", "score": "0.75881386", "text": "func (b *PrestoThriftBigint) Last() interface{} {\n\toffset := len(b.Nulls) - 1\n\tif offset < 0 || b.Nulls[offset] {\n\t\treturn nil\n\t}\n\treturn b.Longs[offset]\n}", "title": "" }, { "docid": "f419b06a7a95862978b1f279338ef778", "score": "0.7541531", "text": "func (c *ImmutableFloat32) Last() float32 {\n\treturn c.Nth(c.Len() - 1)\n}", "title": "" }, { "docid": "3cc30dfad5d1cca6655642797438ebe4", "score": "0.75338787", "text": "func (s HelpTermsOfServiceUpdateEmptyArray) Last() (v HelpTermsOfServiceUpdateEmpty, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "174688384e6dec90e8990147817a6962", "score": "0.75235885", "text": "func (mvl *MetricsList) Last() *MetricValue {\n\tif len(mvl.data) > 0 {\n\t\tmvl.Sort()\n\t\treturn mvl.data[len(mvl.data)-1]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e9f30bd59ff96cae837cfabe9765696", "score": "0.7509377", "text": "func Last(arr interface{}) interface{} {\n\tarrValue := reflect.ValueOf(arr)\n\tarrType := arrValue.Type()\n\tswitch arrType.Kind() {\n\tcase reflect.Slice:\n\t\treturn arrValue.Index(arrValue.Len() - 1).Interface()\n\tdefault:\n\t\treturn arrValue.Interface()\n\t}\n}", "title": "" }, { "docid": "134047bc6596fbfdcd5def8856c3ac3b", "score": "0.742762", "text": "func (ci carouselItems) last() *carouselItem {\n\tif len(ci) == 0 {\n\t\treturn nil\n\t}\n\treturn &ci[len(ci)-1]\n}", "title": "" }, { "docid": "c46e198f3feca800cbbf5870a7529347", "score": "0.7373946", "text": "func (xs U8) Last() uint8 {\n\treturn xs[len(xs)-1]\n}", "title": "" }, { "docid": "26261c0b604295aff7f14b52efb7a486", "score": "0.73676807", "text": "func (s MessageServiceArray) Last() (v MessageService, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "f55d28bd2f28861797d6b496c88b3611", "score": "0.736606", "text": "func (b *PrestoThriftInteger) Last() interface{} {\n\toffset := len(b.Nulls) - 1\n\tif offset < 0 || b.Nulls[offset] {\n\t\treturn nil\n\t}\n\treturn b.Ints[offset]\n}", "title": "" }, { "docid": "b8793968db217a9c6154dbc82459c9a2", "score": "0.7352375", "text": "func (s TextFixedArray) Last() (v TextFixed, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "fdfbf8a50d1eb1fdece45283428e1367", "score": "0.7319484", "text": "func (s AccountSavedRingtonesArray) Last() (v AccountSavedRingtones, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "aa6b1548f58f728d0595612f54e71e0e", "score": "0.72400725", "text": "func (b *PrestoThriftDouble) Last() interface{} {\n\toffset := len(b.Nulls) - 1\n\tif offset < 0 || b.Nulls[offset] {\n\t\treturn nil\n\t}\n\treturn b.Doubles[offset]\n}", "title": "" }, { "docid": "10302865788cb121fd814cbb5f601283", "score": "0.7209144", "text": "func (s HelpDeepLinkInfoClassArray) Last() (v HelpDeepLinkInfoClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "da66ffa062d339d1abd145b77dcff8fd", "score": "0.720112", "text": "func (dll List) Last() *Node {\n\treturn dll.tail\n}", "title": "" }, { "docid": "5f71c0ca61a7bf66c4b1c7226b5f6ca6", "score": "0.7200597", "text": "func (s AccountSavedRingtonesClassArray) Last() (v AccountSavedRingtonesClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "8fe90b308db1cd94b1d9f30ed1af3688", "score": "0.7184854", "text": "func (d *DList) Last() *Item {\n\treturn d.Tail\n}", "title": "" }, { "docid": "0ece7edd8daf65de4cfb6ab94b4ce5ff", "score": "0.7184075", "text": "func (s InputWallPaperNoFileArray) Last() (v InputWallPaperNoFile, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "680656be69fe53519fc5cc7246ef6ec4", "score": "0.7182134", "text": "func (s TextPlainArray) Last() (v TextPlain, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "c713bbd718f115f7e8280229116362a4", "score": "0.71798813", "text": "func (s InputBotInlineResultArray) Last() (v InputBotInlineResult, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "15ceed2bc265873f355255747620c0cb", "score": "0.7170577", "text": "func (s InputStickeredMediaDocumentArray) Last() (v InputStickeredMediaDocument, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "35c55686d2e9094f0c80eab17f261180", "score": "0.7166581", "text": "func (s TextPhoneArray) Last() (v TextPhone, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "0d9d936fb1c3c6798fb7921e57f707c5", "score": "0.716476", "text": "func (s InputWallPaperClassArray) Last() (v InputWallPaperClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "8b3cb3894dbda19ec0fa57c2da5573ca", "score": "0.7160028", "text": "func (s InputWallPaperArray) Last() (v InputWallPaper, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "e8bde43ca5bf0d4e62bb7e9b44274d02", "score": "0.715462", "text": "func (l *LinkedList) GetLast() (interface{}, error) {\n\tif l.size == 0 {\n\t\treturn nil, errors.New(\"NoSuchElementException\")\n\t}\n\treturn l.last.data, nil\n}", "title": "" }, { "docid": "f1a37e6b2a0abd21b28a6386c0c01811", "score": "0.71407723", "text": "func (o Opinions) Last() Opinion {\n\tsort.Sort(o)\n\treturn o[len(o)-1]\n}", "title": "" }, { "docid": "1300b6ffb19ae1dad8471c11a4b153bd", "score": "0.71360224", "text": "func (l *List) Last() *Node {\n\tif l.length == 0 {\n\t\treturn nil\n\t}\n\treturn l.root.prev\n}", "title": "" }, { "docid": "c0dc214c6005445b38619b5fafa1e745", "score": "0.7135177", "text": "func (t Timeseries) Last() (x, y float64) {\n\treturn t.At(t.Len() - 1)\n}", "title": "" }, { "docid": "91075f971489455223308369226690c7", "score": "0.7134244", "text": "func (s MessageArray) Last() (v Message, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "dab3be0af0a1cc5e7c8e8b0a72deeafc", "score": "0.70954347", "text": "func (l List) Last() *Item {\n\treturn l.last\n}", "title": "" }, { "docid": "254366c472ef86aeb78ba5e7fa2f1da5", "score": "0.7081445", "text": "func (s InputStickeredMediaPhotoArray) Last() (v InputStickeredMediaPhoto, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "895b50a7d5a7459000ca4f8d0d0816b7", "score": "0.70812434", "text": "func (s MessageClassArray) Last() (v MessageClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "628bcefc1e4db897e7e679996691aa1b", "score": "0.707603", "text": "func (s HelpTermsOfServiceUpdateClassArray) Last() (v HelpTermsOfServiceUpdateClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "291f2aa22d4771847bdc446717512ba7", "score": "0.7075081", "text": "func (a Args) Last() interface{} {\n\tif len(a) > 0 {\n\t\treturn a[len(a)-1]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "42fee2801b74977fea19f67ea0783d25", "score": "0.7058026", "text": "func (s GeoPointArray) Last() (v GeoPoint, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "240baf4369610b1cb76a60b9d726a286", "score": "0.70493644", "text": "func (p *MediaPlaylist) last() uint {\n\tif p.tail == 0 {\n\t\treturn p.capacity - 1\n\t}\n\treturn p.tail - 1\n}", "title": "" }, { "docid": "173c558fa74bdb3140690c1c29ee6efb", "score": "0.70468545", "text": "func (s InputStickeredMediaClassArray) Last() (v InputStickeredMediaClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "25e16c971d281521a08d9722f76e5c0d", "score": "0.7039063", "text": "func (s HelpTermsOfServiceUpdateArray) Last() (v HelpTermsOfServiceUpdate, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "7763de9d573799a8b6ce276438ce06ca", "score": "0.7033819", "text": "func (s GeoPointClassArray) Last() (v GeoPointClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "3f082b1f13b87047ecde299bac0d2a21", "score": "0.70323807", "text": "func (so *SortedList) Last() {\n\tso.list.Last()\n}", "title": "" }, { "docid": "9c6e0e2e77e050b8a0e43b64e7db3364", "score": "0.70266175", "text": "func (s InputBotInlineResultDocumentArray) Last() (v InputBotInlineResultDocument, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "02a906b82c98b40df14ca852b64e6ea9", "score": "0.7026089", "text": "func (s *store) LastIndex() (uint64, error) { return s.firstIndex(true) }", "title": "" }, { "docid": "45443c1a7250ce7445f6f6f15979de3f", "score": "0.70139015", "text": "func (s InputBotInlineResultClassArray) Last() (v InputBotInlineResultClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "82298b429dcc8c1a82baf5a49518fb0a", "score": "0.7011729", "text": "func (s HelpDeepLinkInfoArray) Last() (v HelpDeepLinkInfo, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "bef46d1b6ad4a62ab77a6d5a5617fab5", "score": "0.7008498", "text": "func (l List) Last() *Item {\n\tif l.tail != nil {\n\t\treturn l.tail\n\t}\n\n\treturn &Item{}\n}", "title": "" }, { "docid": "0cbd4ac83ae492465ca3236733030bd4", "score": "0.70023286", "text": "func Last(array []string) string {\n\treturn Nth(array, len(array)-1)\n}", "title": "" }, { "docid": "17f55b841770acb83298e3c72654cef5", "score": "0.69915295", "text": "func (s RichTextClassArray) Last() (v RichTextClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "7ce9c8fc7645c94dc66788c2c0f94965", "score": "0.69895095", "text": "func (s *Sequential) Last() int64 {\n\treturn atomic.LoadInt64(&s.counter) + 1\n}", "title": "" }, { "docid": "19e446d431f0bec59a548ae6a39d6f9a", "score": "0.6983262", "text": "func (s InputStickerSetDiceArray) Last() (v InputStickerSetDice, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "492ed6f1397a35e505266c970560d751", "score": "0.6983166", "text": "func (r *RadixIterator) Last() {\r\n\tr.trav.last()\r\n}", "title": "" }, { "docid": "ce406f560010e1f8099f492d552b7c3d", "score": "0.6974285", "text": "func (*Int) Last(ints []int) (int, bool) {\n\tn := len(ints)\n\tif n > 0 {\n\t\treturn ints[n-1], true\n\t}\n\n\treturn 0, false\n}", "title": "" }, { "docid": "6b3f039008ad7a3bd2b5df0fa2984d3a", "score": "0.69742846", "text": "func Last(args ...reflect.Value) (interface{}, error) {\n\tvar listv reflect.Value\n\tvar countv reflect.Value\n\n\tswitch len(args) {\n\tcase 0:\n\t\treturn nil, errors.New(\"missing list argument\")\n\tcase 1:\n\t\tcountv = reflect.ValueOf(1)\n\t\tlistv = args[0]\n\tcase 2:\n\t\tcountv = args[0]\n\t\tlistv = args[1]\n\tdefault:\n\t\treturn nil, errors.New(\"too many arguments\")\n\t}\n\n\tswitch listv.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\t// all good, continue\n\tdefault:\n\t\treturn nil, errors.New(\"list is not an array type\")\n\t}\n\n\tcount, err := valueInt(countv, \"count\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlen := listv.Len()\n\tif count > len {\n\t\tcount = len\n\t}\n\tif count < 0 {\n\t\treturn nil, errors.New(\"count must be positive\")\n\t}\n\n\t// we tested the list type above\n\treturn listv.Slice(len-count, len).Interface(), nil\n}", "title": "" }, { "docid": "af612417993f259a86e1c29c865f320d", "score": "0.6970854", "text": "func (d *Dequeue) Last() *Node {\n\tif d.Empty() {\n\t\treturn nil\n\t}\n\treturn d.Node.prev\n}", "title": "" }, { "docid": "74510dd4c793e28ca57a628da4070cd3", "score": "0.6956198", "text": "func (s InputBotInlineMessageMediaGeoArray) Last() (v InputBotInlineMessageMediaGeo, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "eb86d72f64ef50189048da2bf77b1966", "score": "0.69541395", "text": "func (itr *ListIterator[T]) Last() {\n\tif n := itr.list.Len(); n != 0 {\n\t\titr.Seek(n - 1)\n\t}\n}", "title": "" }, { "docid": "5b2db9a03dd1b78daf474427f80f55cc", "score": "0.6944697", "text": "func (s TextImageArray) Last() (v TextImage, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "a9ea9b6540772baf6a7c66049c30b46d", "score": "0.6929177", "text": "func (q *QueueItem) GetLast() (n *ItemInfo){\n\tif (q.Len()>0) {\n\t\tn = (*q)[0]\n\t} else{\n\t\tn = nil\n\t}\n\treturn n\n}", "title": "" }, { "docid": "28d5d2adc2031c1bddfaff7f2c81d6e7", "score": "0.6922852", "text": "func (i *Iterator) Last() {\n\ti.iter.Last()\n}", "title": "" }, { "docid": "c716eed89305f32e0481ff6247f4b5ad", "score": "0.69224954", "text": "func (q *bufferQueue) Last() *bufElement {\n\tq.mux.Lock()\n\tdefer q.mux.Unlock()\n\treturn q.last\n}", "title": "" }, { "docid": "98de41b9bcff39e51ddeef5c2cb69988", "score": "0.6922222", "text": "func (e *errorList) Last() error {\n\tif len(e.recordedErrors) == 0 {\n\t\treturn nil\n\t}\n\treturn e.recordedErrors[len(e.recordedErrors)-1]\n}", "title": "" }, { "docid": "a187fd13687e018571403c4a03b6d060", "score": "0.69135994", "text": "func (obj *VersionedObjects) Last() Object {\n\tif len(obj.Objects) == 0 {\n\t\treturn nil\n\t}\n\treturn obj.Objects[len(obj.Objects)-1]\n}", "title": "" }, { "docid": "acce9e91cd34cdb9e7a9c76382e37811", "score": "0.6912749", "text": "func (n *StringSet) Last() (string, error) {\n\treturn n.GetIndex(n.Length() - 1)\n}", "title": "" }, { "docid": "6be6e1bbbb5dcfb17230b73337a2613a", "score": "0.6894925", "text": "func (s InputWallPaperSlugArray) Last() (v InputWallPaperSlug, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "a6e3c2e41d27ec2dfb46c341c4525e73", "score": "0.68898094", "text": "func (s InputNotifyPeerArray) Last() (v InputNotifyPeer, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "64c15ce9e62d6f18535a68adbfc5a116", "score": "0.6870322", "text": "func (rb *RbTree) Last() *RbNode {\n\treturn rb.last(rb.root)\n}", "title": "" }, { "docid": "eb89743a2556de27f887b1d4c796139d", "score": "0.6868247", "text": "func (market *BFXMarket) GetLastValues() *BFXValues {\n\tcount := market.dataCount\n\treturn &(market.dataArray[count-1])\n}", "title": "" }, { "docid": "a12d4b588fc510e7f7bfbd87798eb60f", "score": "0.6862988", "text": "func (s InputBotInlineResultPhotoArray) Last() (v InputBotInlineResultPhoto, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "64e9d4b1825598e7ed0c746d72c9d0cc", "score": "0.6861437", "text": "func (s InputBotInlineMessageMediaAutoArray) Last() (v InputBotInlineMessageMediaAuto, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "c713627870bde862002b8eadb647eafb", "score": "0.6834215", "text": "func (s DecryptedMessageActionSetMessageTTLArray) Last() (v DecryptedMessageActionSetMessageTTL, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "5c0ed225b13ddf969c15d6fc8db30fd7", "score": "0.6829089", "text": "func (s InputNotifyPeerClassArray) Last() (v InputNotifyPeerClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "af7af8af70c9a8ace0156b2d4e81b1a3", "score": "0.6823247", "text": "func (s TextEmailArray) Last() (v TextEmail, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "dc27b7944e6b147fcc76e4a6086e1f2a", "score": "0.6821671", "text": "func (l *List) GetLast() (result []byte,err error){\n\tif l.name == nil {\n\t\treturn nil,ErrDoesNotExists\n\t}\n\treturn result,l.db.View(func(tx *bolt.Tx) error{\n\t\tbucket := tx.Bucket(l.name)\n\t\tif bucket == nil {\n\t\t\treturn ErrBucketNotFound\n\t\t}\n\t\tcursor := bucket.Cursor()\n\t\t_, result = cursor.Last()\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "292d0ad84c2444c09b797a60d55cf475", "score": "0.6815826", "text": "func (l *LinkedList) Last() *Node {\n\treturn l.tail\n}", "title": "" }, { "docid": "7631da7e323b279f21bf0325044a046d", "score": "0.6806518", "text": "func (s InputStickerSetClassArray) Last() (v InputStickerSetClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "96289c856fe28e88b82699e3cfc405d5", "score": "0.67991894", "text": "func (l LinkedList) GetLast() int {\n\ttail := l.GetTail()\n\tif tail == nil {\n\t\treturn 0\n\t}\n\treturn tail.data\n}", "title": "" }, { "docid": "1e6ac38f20d286f3ccdfd5b7346d63ca", "score": "0.67933387", "text": "func (s *LinkedList) GetLastValue() (interface{}, error) {\n\tif s.IsEmpty() {\n\t\treturn nil, errEmptyList\n\t}\n\treturn s.tail.Value, nil\n}", "title": "" }, { "docid": "a160bda864177744559a0c8221acc4d7", "score": "0.67910993", "text": "func (s persons) Last() (out person) {\n\tif len(s) > 0 {\n\t\tout = s[len(s)-1]\n\t}\n\treturn\n}", "title": "" }, { "docid": "090082f1564667e118dd91bb6a6da19b", "score": "0.67880774", "text": "func (s ChannelParticipantSelfArray) Last() (v ChannelParticipantSelf, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "1e5bf99479ba1dca8905b688ef011a3a", "score": "0.6783679", "text": "func (s AuthSentCodeTypeFlashCallArray) Last() (v AuthSentCodeTypeFlashCall, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "fe2c4bd491eecc5c82d7b22251d30568", "score": "0.67620176", "text": "func (s InputStickerSetIDArray) Last() (v InputStickerSetID, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "a14f3934bcc5f6e92564b351e5cd9e1e", "score": "0.6759452", "text": "func (s ChannelParticipantLeftArray) Last() (v ChannelParticipantLeft, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "662cc4fb5afd2704bb32703c85f441e3", "score": "0.67565686", "text": "func Last(args ...Object) Object {\n\tif len(args) != 1 {\n\t\treturn NewError(\"Error: Expected 1 argument on keys() but got %d\", len(args))\n\t}\n\tarr, k := args[0].(*Array)\n\tif !k {\n\t\treturn NewError(\"Error: Expected Array as first argument on last() but got %s\", args[0].Type())\n\t}\n\tif len(arr.Elements) == 0 {\n\t\treturn nil\n\t}\n\treturn arr.Elements[len(arr.Elements)-1]\n}", "title": "" }, { "docid": "d1b681b6389ac5ac436c8a97db697277", "score": "0.6746669", "text": "func (s InputBotInlineMessageClassArray) Last() (v InputBotInlineMessageClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "bfffec58e9afb6646cd018b855bfb3e2", "score": "0.6742193", "text": "func TakeLast(values []ts.Datapoint) float64 {\n\tfor i := len(values) - 1; i >= 0; i-- {\n\t\tvalue := values[i].Value\n\t\tif !math.IsNaN(value) {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn math.NaN()\n}", "title": "" }, { "docid": "9dfbd53e89fe35a501721bb0cc880a01", "score": "0.6741687", "text": "func (s DecryptedMessageActionNotifyLayerArray) Last() (v DecryptedMessageActionNotifyLayer, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "1e6d4d0ea04352c350e2884fff874263", "score": "0.6734165", "text": "func (s TextMarkedArray) Last() (v TextMarked, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "694da842130ae76956335679a2da117e", "score": "0.6727485", "text": "func (s InputBotInlineResultGameArray) Last() (v InputBotInlineResultGame, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "0e699b8ce0d4ac1f1d56884c0e8aa959", "score": "0.6727195", "text": "func (l *LinkedList) Last() *Node {\n\tlast := l.First\n\tif last == nil {\n\t\treturn nil\n\t}\n\n\tfor last.Next() != nil {\n\t\tlast = last.Next()\n\t}\n\n\treturn last\n}", "title": "" }, { "docid": "63d9ee5115c8130eaceeb2aabde0256c", "score": "0.67214864", "text": "func (d *DummyStore) LastIndex() (uint64, error) {\n\td.mu.RLock()\n\tdefer d.mu.RUnlock()\n\treturn d.lastIndex, nil\n}", "title": "" }, { "docid": "761232911e5262efd38d2a5ff9e3bf0d", "score": "0.6708701", "text": "func (s stream) Last() output {\n\tcurrent := s.run()\n\tif current.err != nil {\n\t\treturn output{nil, current.err}\n\t}\n\treturn (&last{current.items}).run()\n}", "title": "" }, { "docid": "3ec27c5b03a3a8259337feb6a41e9cfd", "score": "0.67041427", "text": "func (s TextConcatArray) Last() (v TextConcat, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "title": "" }, { "docid": "63c3ad5ad6c88355bc47eefbb0c95a7b", "score": "0.669734", "text": "func (r *Reader) Last() (uint64, error) {\n\tvar height uint64\n\terr := r.db.View(storage.RetrieveLast(&height))\n\treturn height, err\n}", "title": "" }, { "docid": "8b6b2f9d0baffa6b04aa5b707a073db6", "score": "0.66912955", "text": "func (cr *Cursor) Last() error {\n\tres := C.unqlite_kv_cursor_last_entry(cr.handle)\n\tif res != C.UNQLITE_OK {\n\t\treturn UnQLiteError(res)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a10c13332bce60652d81d2ffd78cc24a", "score": "0.6684627", "text": "func (ms *MessageStore) Last() int {\n\tms.mu.RLock()\n\tdefer ms.mu.RUnlock()\n\tif len(ms.msgs) == 0 {\n\t\treturn ms.first\n\t} else {\n\t\treturn ms.first + len(ms.msgs) - 1\n\t}\n}", "title": "" }, { "docid": "4dff0a36b5e2df72dbe911c3bf9ba4b1", "score": "0.6681791", "text": "func (c *Counter) Last() int64 {\n\treturn atomic.LoadInt64(&c.counter) - 1\n}", "title": "" } ]
4d3a1e5644517c777eb14067ededea5d
Specifies a list of addresses for which matching should be applied. Omitting this value means allow any.
[ { "docid": "943302d37438b182877fc1080211002b", "score": "0.0", "text": "func (o WindowsFunctionAppSiteConfigScmIpRestrictionHeadersOutput) XForwardedFors() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WindowsFunctionAppSiteConfigScmIpRestrictionHeaders) []string { return v.XForwardedFors }).(pulumi.StringArrayOutput)\n}", "title": "" } ]
[ { "docid": "39e6f421281ac780701da84c4f470730", "score": "0.61502177", "text": "func (f *StopFilter) ByAddresses(addresses ...string) *StopFilter {\n\tf.Addresses = addresses\n\treturn f\n}", "title": "" }, { "docid": "93596145397003db0bd5e0a00a83526c", "score": "0.58751047", "text": "func allowAll(rangeStr string) ipAllowData {\n\treturn ipAllowData{\n\t\tSrc: rangeStr,\n\t\tAction: ActionAllow,\n\t\tMethod: MethodAll,\n\t}\n}", "title": "" }, { "docid": "3904722bb189aa9c40d2312341ea1756", "score": "0.58578974", "text": "func ListenAddrStrings(s ...string) Option {\n\treturn func(cfg *Config) error {\n\t\tfor _, addrstr := range s {\n\t\t\ta, err := ma.NewMultiaddr(addrstr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcfg.ListenAddrs = append(cfg.ListenAddrs, a)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "28cfe6154e42b57fa540a29844413cc2", "score": "0.57922286", "text": "func addrList(addrs ...string) []*mail.Address {\n\tlist := make([]*mail.Address, 0, len(addrs))\n\tfor _, addr := range addrs {\n\t\tlist = append(list, &mail.Address{Address: addr})\n\t}\n\treturn list\n}", "title": "" }, { "docid": "fa556d59db896ad5c065192d97bd12fd", "score": "0.57588387", "text": "func (f *EmailFilter) Allow(vals ...string) *EmailFilter {\r\n\tf.allowVals = append(f.allowVals, vals...)\r\n\treturn f\r\n}", "title": "" }, { "docid": "9c4652d3d28ee476972e9b6d0edc11c0", "score": "0.5714345", "text": "func AddressList(ctx *gin.Context) {\n\tvar msg errors.ErrModel\n\tvar qt accmanage.Qaddress\n\tif err := ctx.ShouldBind(&qt); err != nil {\n\t\tlog.Error(\"Bind Param Error\", err)\n\t\tmsg = errors.ErrModel{Code: errors.ParamsNil, Err: errors.PARAMS_NULL}\n\t} else {\n\t\tmsg = accmanage.AddressList(&qt)\n\t}\n\tmsg.RetErr(ctx)\n}", "title": "" }, { "docid": "da88b2fed40130452c48e6901803a522", "score": "0.56927216", "text": "func (configuration *FirewallRuleConfiguration) MatchSourceAddressList(addressListID string) *FirewallRuleConfiguration {\n\tsourceScope := &configuration.Source\n\tsourceScope.IPAddress = nil\n\tsourceScope.AddressList = nil\n\tsourceScope.AddressListID = &addressListID\n\n\treturn configuration\n}", "title": "" }, { "docid": "2ae96d2843c9a29cb824b02cfcd80948", "score": "0.5594109", "text": "func (al *AddrList) Set(value string) error {\n\tif len(*al) > 0 {\n\t\treturn fmt.Errorf(\"AddrList is already set\")\n\t}\n\tfor _, a := range strings.Split(value, \",\") {\n\t\taddr, err := ma.NewMultiaddr(a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*al = append(*al, addr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f96acc0136197ed1ebca6dc2517aeae9", "score": "0.55517435", "text": "func (configuration *FirewallRuleConfiguration) MatchDestinationAddressList(addressListID string) *FirewallRuleConfiguration {\n\tdestinationScope := &configuration.Destination\n\tdestinationScope.AddressList = nil\n\tdestinationScope.AddressListID = &addressListID\n\n\treturn configuration\n}", "title": "" }, { "docid": "e0e8a9f9a511845b2a11e7817bc70106", "score": "0.5453615", "text": "func address(a Address) []Edit { return []Edit{Set(a, 'a')} }", "title": "" }, { "docid": "382c5472e118f11f54ca99b3b763fdf5", "score": "0.5444194", "text": "func FbyAddresses(addrs []cipher.Address) OutputsFilter {\n\treturn func(outputs coin.UxArray) coin.UxArray {\n\t\taddrMatch := coin.UxArray{}\n\t\taddrMap := newAddrSet(addrs)\n\n\t\tfor _, u := range outputs {\n\t\t\tif _, ok := addrMap[u.Body.Address]; ok {\n\t\t\t\taddrMatch = append(addrMatch, u)\n\t\t\t}\n\t\t}\n\t\treturn addrMatch\n\t}\n}", "title": "" }, { "docid": "5a7fbd6e5e084252d8bd2cea12b0ed8d", "score": "0.54027575", "text": "func (o Origination) Addresses(set *tezos.AddressSet) {\n\tset.AddUnique(o.Source)\n\tif a := o.ManagerAddress(); a.IsValid() {\n\t\tset.AddUnique(a)\n\t}\n\tif o.Delegate != nil {\n\t\tset.AddUnique(*o.Delegate)\n\t}\n\tfor _, vv := range o.Result().OriginatedContracts {\n\t\tset.AddUnique(vv)\n\t}\n}", "title": "" }, { "docid": "7b96c1c83f5a214d0edfe96397a30972", "score": "0.5368423", "text": "func (m *Profile) SetAddresses(value []ItemAddressable)() {\n err := m.GetBackingStore().Set(\"addresses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "04211256c9e121f58f6976e98673cdf3", "score": "0.53067917", "text": "func (m *MessageRulePredicates) SetFromAddresses(value []Recipientable)() {\n err := m.GetBackingStore().Set(\"fromAddresses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4a486c7cb28742238414e9b79b6c38d9", "score": "0.52145976", "text": "func Contacts(contacts []string) Option {\n\treturn func(registration *Registration) error {\n\t\tregistration.request[\"contacts\"] = contacts\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1425869bfe0f6a062667067cecf3a552", "score": "0.51993006", "text": "func (_SousChef *SousChefCaller) AddressList(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SousChef.contract.Call(opts, &out, \"addressList\", arg0)\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "cabff3c6af238120100a0dfbff425a9e", "score": "0.5188354", "text": "func AddressesByAddressStrings(ctx database.Context, addressStrings []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Address, error) {\n\tdb, err := ctx.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(addressStrings) == 0 {\n\t\treturn nil, nil\n\t}\n\tvar addresses []*dbmodels.Address\n\tquery := db.Model(&addresses).\n\t\tWhere(\"address IN (?)\", pg.In(addressStrings))\n\tquery = preloadFields(query, preloadedFields)\n\terr = query.Select()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn addresses, nil\n}", "title": "" }, { "docid": "d9c337006b85421f4580c4d8b366840f", "score": "0.5187909", "text": "func (_SousChef *SousChefCallerSession) AddressList(arg0 *big.Int) (common.Address, error) {\n\treturn _SousChef.Contract.AddressList(&_SousChef.CallOpts, arg0)\n}", "title": "" }, { "docid": "c6242d831dbfa51fb71b978e4932a2d4", "score": "0.51871896", "text": "func Allow(r ...rune) Option {\n\treturn func(d *RegularUseDiscriminator) {\n\t\td.allow = append(d.allow, r...)\n\t}\n}", "title": "" }, { "docid": "76c0fb3516554e2351daaeb600b40fe7", "score": "0.5185796", "text": "func Addr(ad string) []string {\n\tvar addr []string\n\taddr = append(addr, ad)\n\treturn addr\n}", "title": "" }, { "docid": "9af11077147ab4e31df35db97608c7c6", "score": "0.51604986", "text": "func (a *AuthTrustAll) SetRemoteAddress([]string) {\n}", "title": "" }, { "docid": "92797bd5a7087e454a28561111a0c3c6", "score": "0.5154913", "text": "func denyAll(rangeStr string) ipAllowData {\n\treturn ipAllowData{\n\t\tSrc: rangeStr,\n\t\tAction: ActionDeny,\n\t\tMethod: MethodAll,\n\t}\n}", "title": "" }, { "docid": "f0ad75d87ecac8a5a6aeddb1c6df6ccc", "score": "0.51451397", "text": "func (m *MessageRulePredicates) SetSentToAddresses(value []Recipientable)() {\n err := m.GetBackingStore().Set(\"sentToAddresses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "268a5aed543b24ffe6cafc39ffaf32b8", "score": "0.51091766", "text": "func (_SousChef *SousChefSession) AddressList(arg0 *big.Int) (common.Address, error) {\n\treturn _SousChef.Contract.AddressList(&_SousChef.CallOpts, arg0)\n}", "title": "" }, { "docid": "91e0a38dc70825ce49453086b1f34a64", "score": "0.51055014", "text": "func ProcessListAddress(c *gin.Context) (data model.ListAddress, err error) {\n\tdata.Address = make([]model.AddressDetail, 0)\n\t//TODO: create database connection and fetch address details\n\treturn\n}", "title": "" }, { "docid": "d48026ad8d1aba78b1bc23c87c03075d", "score": "0.5089903", "text": "func Addrs(addrs ...string) Option {\n\treturn func(o *Options) {\n\t\to.Addrs = addrs\n\t}\n}", "title": "" }, { "docid": "2a3ea0f6d8813756755aac017c418df2", "score": "0.5084793", "text": "func (p *Provider) Addresses() []string {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tvar result []string\n\tfor _, addrs := range p.resolved {\n\t\tresult = append(result, addrs...)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5bd19899134a2f078f7f8faaf7ae5ab0", "score": "0.50745815", "text": "func (entries randomSelectorEntries) listAddresses() []common.Address {\n\tres := make([]common.Address, 0, len(entries))\n\tfor _, entry := range entries {\n\t\tres = append(res, entry.addr)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "958d137db1ba98aec56c4c86e5ad8ec1", "score": "0.50673014", "text": "func FbyAddressesNotIncluded(addrs []cipher.Address) OutputsFilter {\n\treturn func(outputs coin.UxArray) coin.UxArray {\n\t\taddrMatch := coin.UxArray{}\n\t\taddrMap := newAddrSet(addrs)\n\n\t\tfor _, u := range outputs {\n\t\t\tif _, ok := addrMap[u.Body.Address]; !ok {\n\t\t\t\taddrMatch = append(addrMatch, u)\n\t\t\t}\n\t\t}\n\t\treturn addrMatch\n\t}\n}", "title": "" }, { "docid": "e06c5f1348340ea9ce0508e9cec1a76f", "score": "0.5053742", "text": "func Allowed(cs []string, remote string) bool {\n\tip, _, err := net.SplitHostPort(remote)\n\tif err != nil {\n\t\tlog.Fatal(\"invalid remote address \" + err.Error())\n\t}\n\tr := net.ParseIP(ip)\n\tif r == nil {\n\t\tlog.Fatal(\"invalid remote address \" + remote)\n\t}\n\tfor _, item := range cs {\n\t\tif strings.Contains(item, \"-\") {\n\t\t\tcs = append(cs, strings.Split(item, \"-\")...)\n\t\t}\n\t}\n\tfor _, item := range cs {\n\t\tif !strings.Contains(item, \"/\") {\n\t\t\ta := net.ParseIP(item)\n\t\t\tif a == nil {\n\t\t\t\tlog.Fatal(\"invalid IP address in config file\", item)\n\t\t\t}\n\t\t\tif r.Equal(a) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t_, a, err := net.ParseCIDR(item)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"invalid IP address in config file\", err)\n\t\t}\n\t\tif a.Contains(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b3f8a9cc98a33df411320badbc115a4d", "score": "0.5050326", "text": "func (*checkIPList) MatchString(s string) bool {\n\tfor _, ip := range strings.Split(s, \",\") {\n\t\tif net.ParseIP(strings.TrimSpace(ip)) == nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "90b221a44a471449fc53ce407d6fb739", "score": "0.5042907", "text": "func (et *endpointTranslator) filterAddresses() watcher.AddressSet {\n\tfiltered := make(map[watcher.ID]watcher.Address)\n\n\t// If endpoint filtering is disabled, return all available addresses.\n\tif !et.enableEndpointFiltering {\n\t\tfor k, v := range et.availableEndpoints.Addresses {\n\t\t\tfiltered[k] = v\n\t\t}\n\t\treturn watcher.AddressSet{\n\t\t\tAddresses: filtered,\n\t\t\tLabels: et.availableEndpoints.Labels,\n\t\t}\n\t}\n\n\t// If service.spec.internalTrafficPolicy is set to local, filter and return the addresses\n\t// for local node only\n\tif et.availableEndpoints.LocalTrafficPolicy {\n\t\tet.log.Debugf(\"Filtering through addresses that should be consumed by node %s\", et.nodeName)\n\t\tfor id, address := range et.availableEndpoints.Addresses {\n\t\t\tif address.Pod != nil && address.Pod.Spec.NodeName == et.nodeName {\n\t\t\t\tfiltered[id] = address\n\t\t\t}\n\t\t}\n\t\tet.log.Debugf(\"Filtered from %d to %d addresses\", len(et.availableEndpoints.Addresses), len(filtered))\n\t\treturn watcher.AddressSet{\n\t\t\tAddresses: filtered,\n\t\t\tLabels: et.availableEndpoints.Labels,\n\t\t\tLocalTrafficPolicy: et.availableEndpoints.LocalTrafficPolicy,\n\t\t}\n\t}\n\t// If any address does not have a hint, then all hints are ignored and all\n\t// available addresses are returned. This replicates kube-proxy behavior\n\t// documented in the KEP: https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/2433-topology-aware-hints/README.md#kube-proxy\n\tfor _, address := range et.availableEndpoints.Addresses {\n\t\tif len(address.ForZones) == 0 {\n\t\t\tfor k, v := range et.availableEndpoints.Addresses {\n\t\t\t\tfiltered[k] = v\n\t\t\t}\n\t\t\tet.log.Debugf(\"Hints not available on endpointslice. Zone Filtering disabled. Falling back to routing to all pods\")\n\t\t\treturn watcher.AddressSet{\n\t\t\t\tAddresses: filtered,\n\t\t\t\tLabels: et.availableEndpoints.Labels,\n\t\t\t\tLocalTrafficPolicy: et.availableEndpoints.LocalTrafficPolicy,\n\t\t\t}\n\t\t}\n\t}\n\n\t// Each address that has a hint matching the node's zone should be added\n\t// to the set of addresses that will be returned.\n\tet.log.Debugf(\"Filtering through addresses that should be consumed by zone %s\", et.nodeTopologyZone)\n\tfor id, address := range et.availableEndpoints.Addresses {\n\t\tfor _, zone := range address.ForZones {\n\t\t\tif zone.Name == et.nodeTopologyZone {\n\t\t\t\tfiltered[id] = address\n\t\t\t}\n\t\t}\n\t}\n\tif len(filtered) > 0 {\n\t\tet.log.Debugf(\"Filtered from %d to %d addresses\", len(et.availableEndpoints.Addresses), len(filtered))\n\t\treturn watcher.AddressSet{\n\t\t\tAddresses: filtered,\n\t\t\tLabels: et.availableEndpoints.Labels,\n\t\t\tLocalTrafficPolicy: et.availableEndpoints.LocalTrafficPolicy,\n\t\t}\n\t}\n\n\t// If there were no filtered addresses, then fall to using endpoints from\n\t// all zones.\n\tfor k, v := range et.availableEndpoints.Addresses {\n\t\tfiltered[k] = v\n\t}\n\treturn watcher.AddressSet{\n\t\tAddresses: filtered,\n\t\tLabels: et.availableEndpoints.Labels,\n\t\tLocalTrafficPolicy: et.availableEndpoints.LocalTrafficPolicy,\n\t}\n}", "title": "" }, { "docid": "37d4b6c115e5fd10d955d952b09fc826", "score": "0.50357634", "text": "func (configuration *FirewallRuleConfiguration) MatchAnySourceAddress() *FirewallRuleConfiguration {\n\treturn configuration.MatchSourceAddress(FirewallRuleMatchAny)\n}", "title": "" }, { "docid": "f05b2ad5659de8c7750f943ec0132c95", "score": "0.499681", "text": "func (configuration *FirewallRuleConfiguration) MatchAnyDestinationAddress() *FirewallRuleConfiguration {\n\treturn configuration.MatchDestinationAddress(FirewallRuleMatchAny)\n}", "title": "" }, { "docid": "37a84af92aa66697d579cd4d4c556cb3", "score": "0.49904236", "text": "func ListenAddrs(addrs ...ma.Multiaddr) Option {\n\treturn func(cfg *Config) error {\n\t\tcfg.ListenAddrs = append(cfg.ListenAddrs, addrs...)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "fe0dfbb0b93cab2153fd203c7ecd5bcb", "score": "0.49657023", "text": "func SendsToAddresses(addresses []cipher.Address) func(UnconfirmedTransaction) bool {\n\treturn func(tx UnconfirmedTransaction) (isRelated bool) {\n\t\tfor _, out := range tx.Transaction.Out {\n\t\t\tfor _, address := range addresses {\n\t\t\t\tif out.Address == address {\n\t\t\t\t\tisRelated = true\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "45f8ba2bf936774e2b704ac112f8dcf1", "score": "0.49589548", "text": "func (h Helper) NewBindAddresses(addrs []string) []ConfigValue {\n\treturn []ConfigValue{{Class: \"bind\", Value: addrs}}\n}", "title": "" }, { "docid": "61b2d679eea082f9c9c0393058bf3d62", "score": "0.49447617", "text": "func (_TransferWhitelist *TransferWhitelistTransactor) SetDirectlyWhitelistedAddresses(opts *bind.TransactOpts, _whitelist []common.Address) (*types.Transaction, error) {\n\treturn _TransferWhitelist.contract.Transact(opts, \"setDirectlyWhitelistedAddresses\", _whitelist)\n}", "title": "" }, { "docid": "1378f83ee16accaf98949868e58ff871", "score": "0.4944496", "text": "func (a *AuthTrustLocal) IsAllowed([]byte) bool {\n\tfor _, addr := range a.Addresses {\n\t\tif strings.TrimSpace(addr) == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif !a.IsLocal(addr) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "245d31c6a65645a86fdd712ee986f868", "score": "0.49182695", "text": "func (cfg *Config) ValidateAddrs(ctx context.Context) error {\n\t// Validate the advertise address.\n\tadvHost, advPort, err := validateAdvertiseAddr(ctx,\n\t\tcfg.AdvertiseAddr, cfg.Addr, \"\", cliflags.ListenAddr)\n\tif err != nil {\n\t\treturn invalidFlagErr(err, cliflags.AdvertiseAddr)\n\t}\n\tcfg.AdvertiseAddr = net.JoinHostPort(advHost, advPort)\n\n\t// Validate the RPC listen address.\n\tlistenHost, listenPort, err := validateListenAddr(ctx, cfg.Addr, \"\")\n\tif err != nil {\n\t\treturn invalidFlagErr(err, cliflags.ListenAddr)\n\t}\n\tcfg.Addr = net.JoinHostPort(listenHost, listenPort)\n\n\t// Validate the SQL advertise address. Use the provided advertise\n\t// addr as default.\n\tadvSQLHost, advSQLPort, err := validateAdvertiseAddr(ctx,\n\t\tcfg.SQLAdvertiseAddr, cfg.SQLAddr, advHost, cliflags.ListenSQLAddr)\n\tif err != nil {\n\t\treturn invalidFlagErr(err, cliflags.SQLAdvertiseAddr)\n\t}\n\tcfg.SQLAdvertiseAddr = net.JoinHostPort(advSQLHost, advSQLPort)\n\n\t// Validate the SQL listen address - use the resolved listen addr as default.\n\tsqlHost, sqlPort, err := validateListenAddr(ctx, cfg.SQLAddr, listenHost)\n\tif err != nil {\n\t\treturn invalidFlagErr(err, cliflags.ListenSQLAddr)\n\t}\n\tcfg.SQLAddr = net.JoinHostPort(sqlHost, sqlPort)\n\n\t// Validate the HTTP advertise address. Use the provided advertise\n\t// addr as default.\n\tadvHTTPHost, advHTTPPort, err := validateAdvertiseAddr(ctx,\n\t\tcfg.HTTPAdvertiseAddr, cfg.HTTPAddr, advHost, cliflags.ListenHTTPAddr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot compute public HTTP address\")\n\t}\n\tcfg.HTTPAdvertiseAddr = net.JoinHostPort(advHTTPHost, advHTTPPort)\n\n\t// Validate the HTTP address -- use the resolved listen addr\n\t// as default.\n\thttpHost, httpPort, err := validateListenAddr(ctx, cfg.HTTPAddr, listenHost)\n\tif err != nil {\n\t\treturn invalidFlagErr(err, cliflags.ListenHTTPAddr)\n\t}\n\tcfg.HTTPAddr = net.JoinHostPort(httpHost, httpPort)\n\treturn nil\n}", "title": "" }, { "docid": "413519fde6a1c8e80708b576f237917d", "score": "0.49099255", "text": "func (f *TimeRangeFilter) Allow(vals ...string) *TimeRangeFilter {\r\n\tf.allowVals = append(f.allowVals, vals...)\r\n\treturn f\r\n}", "title": "" }, { "docid": "b5a963d256c5427954edc2a0b8598da4", "score": "0.4907871", "text": "func parseAddresses(addrs []string) (iaddrs []ipfsaddr.IPFSAddr, err error) {\n\tiaddrs = make([]ipfsaddr.IPFSAddr, len(addrs))\n\tfor i, saddr := range addrs {\n\t\tiaddrs[i], err = ipfsaddr.ParseString(saddr)\n\t\tif err != nil {\n\t\t\treturn nil, cmds.ClientError(\"invalid peer address: \" + err.Error())\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "88153666a63a6f2d51ccce3c4dcd51d7", "score": "0.48981962", "text": "func containsAddress(a []common.Address, x common.Address) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d3696941848b44ccdb782a0de62dc943", "score": "0.48958623", "text": "func (self *Peerlist) GetAllAddresses() []string {\n\tvar addrs []string\n\tself.strand(func() {\n\t\taddrs = append(self.getAddresses(false), self.getAddresses(true)...)\n\t}, \"GetAllAddreses\")\n\treturn addrs\n}", "title": "" }, { "docid": "ad6c1ac7b1dcb8dc4ef2a69cffcd9eaf", "score": "0.48940992", "text": "func MakeAllowedAddressPairsSlice() []*AllowedAddressPairs {\n\treturn []*AllowedAddressPairs{}\n}", "title": "" }, { "docid": "722564e984014e80c79d804a8db05e34", "score": "0.4893179", "text": "func (source *Source) Blacklist(addresses ...net.IP) {\n\tadded, err := source.Set.Add(addresses...)\n\tif err != nil {\n\t\tsource.Err(err.Error())\n\t}\n\tsource.Stats.IPAdded += len(added)\n\tfor _, ip := range added {\n\t\tsource.Info(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"added %s to @%s\",\n\t\t\t\tip.String(), source.Set.Name,\n\t\t\t),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "82b0e8834a0ca969178539c4ac8bc446", "score": "0.48568657", "text": "func parseAddresses(addrs interface{}) (addresses []Address) {\n\n\tswitch addrList := addrs.(type) {\n\tcase []interface{}:\n\t\tfor _, addr := range addrList {\n\t\t\ta := Address{\n\t\t\t\tAddr: addr.(string),\n\t\t\t\tAddrType: \"IPv4\",\n\t\t\t}\n\t\t\taddresses = append(addresses, a)\n\t\t}\n\t}\n\treturn addresses\n}", "title": "" }, { "docid": "5d943f66754a15809476c252d569d163", "score": "0.48558375", "text": "func TestTooManyAddresses(t *testing.T) {\n\t// Check that returning more than 2 addresses causes a host to be filtered.\n\tfilter := NewFilter(testTooManyAddressesResolver{})\n\thost := modules.NetAddress(\"any.address:1234\")\n\n\t// Add host to filter.\n\tfilter.Add(host)\n\n\t// Host should be filtered.\n\tif !filter.Filtered(host) {\n\t\tt.Fatal(\"Host with too many addresses should be filtered but wasn't\")\n\t}\n}", "title": "" }, { "docid": "265038bfccafd05749b076c2a82d32af", "score": "0.48547736", "text": "func hostnamesOverlap(alist, blist string) (overlap bool, addr string) {\n\tif alist == \"\" || blist == \"\" {\n\t\treturn\n\t}\n\talistAddrs := strings.Split(alist, \",\")\n\tfor _, a := range alistAddrs {\n\t\ta = strings.TrimSpace(a)\n\t\tif a == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(blist, a) {\n\t\t\treturn true, a\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "10dbd4db0df9e64a0d0c51e22d42417b", "score": "0.4852255", "text": "func validateIPs(sourceWhitelist []string) []string {\n\tfor i := len(sourceWhitelist) - 1; i >= 0; i-- {\n\t\tif sourceWhitelist[i] != \"\" {\n\t\t\t_, _, err := net.ParseCIDR(sourceWhitelist[i])\n\t\t\tif err != nil {\n\t\t\t\tsourceWhitelist[i] += \"/32\"\n\t\t\t\t_, _, err = net.ParseCIDR(sourceWhitelist[i])\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tglog.Warningf(\"The IP '%s' won't be added to the whitelist: %s\", sourceWhitelist[i], err)\n\t\t\t\tsourceWhitelist = append(sourceWhitelist[:i], sourceWhitelist[i+1:]...)\n\t\t\t}\n\t\t}\n\t}\n\treturn sourceWhitelist\n}", "title": "" }, { "docid": "b597153d9dcbfad88fadcb83db7b44b2", "score": "0.4850143", "text": "func (pl *Peerlist) GetAllAddresses() []string {\n\tvar addrs []string\n\tpl.strand(func() {\n\t\taddrs = append(pl.getAddresses(false), pl.getAddresses(true)...)\n\t}, \"GetAllAddreses\")\n\treturn addrs\n}", "title": "" }, { "docid": "a4ccdbba8ab5c7212e3c7d0331139e00", "score": "0.48497885", "text": "func WorkerAddrIn(vs ...string) predicate.Miner {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Miner(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldWorkerAddr), v...))\n\t})\n}", "title": "" }, { "docid": "15c1aa175612fdd8a3c398f74720277e", "score": "0.4843102", "text": "func allowAllP(p []Param) []Param { return p }", "title": "" }, { "docid": "2e4f4ac6b84d9a6291c0d58400d1cb88", "score": "0.48255202", "text": "func WithAddress(a ...string) source.Option {\n\treturn func(o *source.Options) {\n\t\tif o.Context == nil {\n\t\t\to.Context = context.Background()\n\t\t}\n\t\to.Context = context.WithValue(o.Context, addressKey{}, a)\n\t}\n}", "title": "" }, { "docid": "636b7dfde81dca34320acd3bae13d3af", "score": "0.48245212", "text": "func ContainsAddress(addrs []Address, a *Address) bool {\n\tfor _, v := range addrs {\n\t\tif v.Equal(a) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "109ed4529f812b966c7be8d7f533e440", "score": "0.48196456", "text": "func addressSearchInSubnet(d *schema.ResourceData, meta interface{}) ([]addresses.Address, error) {\n\tc := meta.(*ProviderPHPIPAMClient).addressesController\n\ts := meta.(*ProviderPHPIPAMClient).subnetsController\n\tresult := make([]addresses.Address, 0)\n\tv, err := s.GetAddressesInSubnet(d.Get(\"subnet_id\").(int))\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif len(v) == 0 {\n\t\treturn result, errors.New(\"No addresses were found in the supplied subnet\")\n\t}\n\tfor _, r := range v {\n\t\tswitch {\n\t\t// Double-assert that we don't have empty strings in the conditionals\n\t\t// to ensure there there is no edge cases with matching zero values.\n\t\tcase d.Get(\"description\").(string) != \"\" && r.Description == d.Get(\"description\").(string):\n\t\t\tresult = append(result, r)\n\t\tcase d.Get(\"hostname\").(string) != \"\" && r.Hostname == d.Get(\"hostname\").(string):\n\t\t\tresult = append(result, r)\n\t\tcase len(d.Get(\"custom_field_filter\").(map[string]interface{})) > 0:\n\t\t\tfields, err := c.GetAddressCustomFields(r.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tsearch := d.Get(\"custom_field_filter\").(map[string]interface{})\n\t\t\tmatched, err := customFieldFilter(fields, search)\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif matched {\n\t\t\t\tresult = append(result, r)\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6551a4ee1843dbbfd2ee8cd1108e1793", "score": "0.4813054", "text": "func (_WhitelistMock *WhitelistMockTransactor) AddAddressesToWhitelist(opts *bind.TransactOpts, addrs []common.Address) (*types.Transaction, error) {\n\treturn _WhitelistMock.contract.Transact(opts, \"addAddressesToWhitelist\", addrs)\n}", "title": "" }, { "docid": "82b7a2113ee30eb73a210402c44e410e", "score": "0.47932306", "text": "func BlockedAddresses() map[string]bool {\n\tmodAccAddrs := make(map[string]bool)\n\tfor acc := range GetMaccPerms() {\n\t\tmodAccAddrs[authtypes.NewModuleAddress(acc).String()] = true\n\t}\n\n\t// allow the following addresses to receive funds\n\tdelete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String())\n\n\treturn modAccAddrs\n}", "title": "" }, { "docid": "b5e34e3ca9ea317635b2c299bd258a62", "score": "0.47893322", "text": "func (f *JsonFilter) Allow(vals ...string) *JsonFilter {\r\n\tf.allowVals = append(f.allowVals, vals...)\r\n\treturn f\r\n}", "title": "" }, { "docid": "c872311adf1401bcb194a1f285caa3ea", "score": "0.4783506", "text": "func (m *MailgunImpl) ParseAddresses(addresses ...string) ([]string, []string, error) {\n\tr := simplehttp.NewHTTPRequest(generatePublicApiUrl(addressParseEndpoint))\n\tr.SetClient(m.Client())\n\tr.AddParameter(\"addresses\", strings.Join(addresses, \",\"))\n\tr.SetBasicAuth(basicAuthUser, m.PublicApiKey())\n\n\tvar response addressParseResult\n\terr := getResponseFromJSON(r, &response)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn response.Parsed, response.Unparseable, nil\n}", "title": "" }, { "docid": "7d60d03faf68f9eb0fbdb759c817571a", "score": "0.47676516", "text": "func StreetIn(vs ...string) predicate.ReportWallet {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.ReportWallet(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldStreet), v...))\n\t})\n}", "title": "" }, { "docid": "9016272b56b2ab571ca8611d14cad9a2", "score": "0.47588784", "text": "func StreetIn(vs ...string) predicate.Reportwallettb {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldStreet), v...))\n\t})\n}", "title": "" }, { "docid": "710f98457d4b09564a5a24e0d2f905f3", "score": "0.47556072", "text": "func (x *fastReflection_NetAddress) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {\n\tif x.Id != \"\" {\n\t\tvalue := protoreflect.ValueOfString(x.Id)\n\t\tif !f(fd_NetAddress_id, value) {\n\t\t\treturn\n\t\t}\n\t}\n\tif x.Ip != \"\" {\n\t\tvalue := protoreflect.ValueOfString(x.Ip)\n\t\tif !f(fd_NetAddress_ip, value) {\n\t\t\treturn\n\t\t}\n\t}\n\tif x.Port != uint32(0) {\n\t\tvalue := protoreflect.ValueOfUint32(x.Port)\n\t\tif !f(fd_NetAddress_port, value) {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb20c3b32f28a57d9f4520c8f29c856f", "score": "0.47463086", "text": "func SetWhitelist(w []string) {\n\tfor _, v := range w {\n\t\twhitelist[v] = nil\n\t}\n\n\tif len(whitelist) > 0 {\n\t\tenableWhitelist = true\n\t}\n}", "title": "" }, { "docid": "1099290d921d4c49bcc2c73d8cd4ccf1", "score": "0.47451723", "text": "func ContainsAddresses(peers []*Peer, addresses []string) (string, bool) {\n\tpeersSet := make(map[string]struct{})\n\tfor _, peer := range peers {\n\t\tpeersSet[peer.Address] = struct{}{}\n\t}\n\n\tfor _, address := range addresses {\n\t\tif _, ok := peersSet[address]; !ok {\n\t\t\treturn address, false\n\t\t}\n\t}\n\n\treturn \"\", true\n}", "title": "" }, { "docid": "c618dd9f060a2452a4e8c7581bff3d0c", "score": "0.47426954", "text": "func AllowFromMultipleTo(namespace string, fromLabels []map[string]string, targetLabels map[string]string) *networkingv1.NetworkPolicy {\n\tvar froms []networkingv1.NetworkPolicyPeer\n\tfor _, labels := range fromLabels {\n\t\tfroms = append(froms, networkingv1.NetworkPolicyPeer{\n\t\t\tPodSelector: &metav1.LabelSelector{MatchLabels: labels},\n\t\t})\n\t}\n\treturn &networkingv1.NetworkPolicy{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"allow-from-multiple-to-%s\", LabelString(targetLabels)),\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: networkingv1.NetworkPolicySpec{\n\t\t\tPodSelector: metav1.LabelSelector{\n\t\t\t\tMatchLabels: targetLabels,\n\t\t\t},\n\t\t\tIngress: []networkingv1.NetworkPolicyIngressRule{\n\t\t\t\t{From: froms},\n\t\t\t},\n\t\t\tPolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a826032143ed3c61ad42420be7577f3e", "score": "0.47409105", "text": "func AllowlistSchedule(allowlistschedule []string) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Set(\"allowlistschedule\", allowlistschedule)\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "5eea58de46ce2c1bd433be7feee17867", "score": "0.4740512", "text": "func (o SecretBackendRoleOutput) StreetAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecretBackendRole) pulumi.StringArrayOutput { return v.StreetAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "753fe31529b1593e0c55292a25f57057", "score": "0.47329926", "text": "func OwnerAddrIn(vs ...string) predicate.Miner {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Miner(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldOwnerAddr), v...))\n\t})\n}", "title": "" }, { "docid": "5cff27f83ca5deeb516f2f203441bcfd", "score": "0.47325802", "text": "func (s *BasetnsnamesParserListener) EnterAddress_list(ctx *Address_listContext) {}", "title": "" }, { "docid": "cc9ad4827a13d1bc671caf9032aafc07", "score": "0.47290426", "text": "func getValsSet(address string) (valAddrs []sdk.ValAddress, err error) {\n\taddrs := strings.Split(strings.TrimSpace(address), \",\")\n\tlenVals := len(addrs)\n\tvalAddrs = make([]sdk.ValAddress, lenVals)\n\tfor i := 0; i < lenVals; i++ {\n\t\tvalAddrs[i], err = sdk.ValAddressFromBech32(addrs[i])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid target validator address: %s\", addrs[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3cceca078c168f196f915a52e9eb1d1a", "score": "0.47245556", "text": "func (sp *Peer) OnAddr(_ *peer.Peer, msg *wire.MsgAddr) {\n\t// Ignore addresses when running on the simulation test network. This\n\t// helps prevent the network from becoming another public test network\n\t// since it will not be able to learn about other peers that have not\n\t// specifically been provided.\n\tif config.ActiveConfig().Simnet {\n\t\treturn\n\t}\n\n\tif len(msg.AddrList) > addrmgr.GetAddrMax {\n\t\tsp.AddBanScoreAndPushRejectMsg(msg.Command(), wire.RejectInvalid, nil,\n\t\t\tpeer.BanScoreSentTooManyAddresses, 0, fmt.Sprintf(\"address count excceeded %d\", addrmgr.GetAddrMax))\n\t\treturn\n\t}\n\n\tif msg.IncludeAllSubnetworks {\n\t\tsp.AddBanScoreAndPushRejectMsg(msg.Command(), wire.RejectInvalid, nil,\n\t\t\tpeer.BanScoreMsgAddrWithInvalidSubnetwork, 0,\n\t\t\tfmt.Sprintf(\"got unexpected IncludeAllSubnetworks=true in [%s] command\", msg.Command()))\n\t\treturn\n\t} else if !msg.SubnetworkID.IsEqual(config.ActiveConfig().SubnetworkID) && msg.SubnetworkID != nil {\n\t\tpeerLog.Errorf(\"Only full nodes and %s subnetwork IDs are allowed in [%s] command, but got subnetwork ID %s from %s\",\n\t\t\tconfig.ActiveConfig().SubnetworkID, msg.Command(), msg.SubnetworkID, sp.Peer)\n\t\tsp.Disconnect()\n\t\treturn\n\t}\n\n\tfor _, na := range msg.AddrList {\n\t\t// Don't add more address if we're disconnecting.\n\t\tif !sp.Connected() {\n\t\t\treturn\n\t\t}\n\n\t\t// Set the timestamp to 5 days ago if it's more than 24 hours\n\t\t// in the future so this address is one of the first to be\n\t\t// removed when space is needed.\n\t\tnow := time.Now()\n\t\tif na.Timestamp.After(now.Add(time.Minute * 10)) {\n\t\t\tna.Timestamp = now.Add(-1 * time.Hour * 24 * 5)\n\t\t}\n\n\t\t// Add address to known addresses for this peer.\n\t\tsp.addKnownAddresses([]*wire.NetAddress{na})\n\t}\n\n\t// Add addresses to server address manager. The address manager handles\n\t// the details of things such as preventing duplicate addresses, max\n\t// addresses, and last seen updates.\n\tsp.server.AddrManager.AddAddresses(msg.AddrList, sp.NA(), msg.SubnetworkID)\n}", "title": "" }, { "docid": "81a7e109305a64f0e7af30330d5ae718", "score": "0.47238296", "text": "func IsAll(ms ...Matcher) Matcher {\n\treturn func(p *dhcpv4.DHCPv4) bool {\n\t\tfor _, m := range ms {\n\t\t\tif !m(p) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "0ac93acbdb98e91899289feadac693c8", "score": "0.47232696", "text": "func UpdateAddrs(ctx context.Context, addr, advAddr *string, ln net.Addr) error {\n\tdesiredHost, _, err := net.SplitHostPort(*addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update the listen port number and check the actual listen addr is\n\t// the one requested.\n\tlnAddr := ln.String()\n\tlnHost, lnPort, err := net.SplitHostPort(lnAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequestedAll := (desiredHost == \"\" || desiredHost == \"0.0.0.0\" || desiredHost == \"::\")\n\tlistenedAll := (lnHost == \"\" || lnHost == \"0.0.0.0\" || lnHost == \"::\")\n\tif (requestedAll && !listenedAll) || (!requestedAll && desiredHost != lnHost) {\n\t\tlog.Warningf(ctx, \"requested to listen on %q, actually listening on %q\", desiredHost, lnHost)\n\t}\n\t*addr = net.JoinHostPort(lnHost, lnPort)\n\n\t// Update the advertised port number if it wasn't set to start\n\t// with. We don't touch the advertised host, as this may have\n\t// nothing to do with the listen address.\n\tadvHost, advPort, err := net.SplitHostPort(*advAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif advPort == \"\" || advPort == \"0\" {\n\t\tadvPort = lnPort\n\t}\n\t*advAddr = net.JoinHostPort(advHost, advPort)\n\treturn nil\n}", "title": "" }, { "docid": "867b3410a9b4626719691da8c6d9aeb4", "score": "0.4713992", "text": "func (_TransferWhitelist *TransferWhitelistTransactorSession) SetDirectlyWhitelistedAddresses(_whitelist []common.Address) (*types.Transaction, error) {\n\treturn _TransferWhitelist.Contract.SetDirectlyWhitelistedAddresses(&_TransferWhitelist.TransactOpts, _whitelist)\n}", "title": "" }, { "docid": "a3fbc3d732a59132f9cf6541e8831c1b", "score": "0.4684392", "text": "func WithAddrs(addrs ...string) Option {\n\treturn func(c *queue) {\n\t\tc.addrsNsq = addrs\n\t}\n}", "title": "" }, { "docid": "ac83f1997bfb112eb4a8828798038988", "score": "0.46793354", "text": "func (options *CreateSourcesOptions) SetAddresses(addresses []string) *CreateSourcesOptions {\n\toptions.Addresses = addresses\n\treturn options\n}", "title": "" }, { "docid": "fffe8ea27e56c52df31917274f116ac1", "score": "0.46790117", "text": "func (options *UpdateSourcesOptions) SetAddresses(addresses []string) *UpdateSourcesOptions {\n\toptions.Addresses = addresses\n\treturn options\n}", "title": "" }, { "docid": "16cbaa3a105065e70ac1a82d1b0299ef", "score": "0.46744692", "text": "func Address(a string) Option {\n\treturn func(o *Options) {\n\t\to.Address = a\n\t}\n}", "title": "" }, { "docid": "fa4a307b2ec06a6ab2d6a9651d13da5a", "score": "0.46626163", "text": "func (m *MessageRulePredicates) SetRecipientContains(value []string)() {\n err := m.GetBackingStore().Set(\"recipientContains\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "121afac997c14f4a073630908bc7b49d", "score": "0.4659648", "text": "func Disallow(r ...rune) Option {\n\treturn func(d *RegularUseDiscriminator) {\n\t\td.disallow = append(d.disallow, r...)\n\t}\n}", "title": "" }, { "docid": "7a8c072d38d1f01283bf08723629eda1", "score": "0.4658844", "text": "func (c *addressManager) ListAddresses() []net.IP {\n\tc.Lock()\n\tdefer c.Unlock()\n\taddrs := sets.List(c.addresses)\n\tout := make([]net.IP, 0, len(addrs))\n\tfor _, addr := range addrs {\n\t\tip, _, err := net.ParseCIDR(addr)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Failed to parse %s: %v\", addr, err)\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, ip)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "d924ed59610cba2891a0981e67bcf6df", "score": "0.46522152", "text": "func (_options *ReplaceZoneOptions) SetAddresses(addresses []AddressIntf) *ReplaceZoneOptions {\n\t_options.Addresses = addresses\n\treturn _options\n}", "title": "" }, { "docid": "3a5ca72476a378623582e7e4be23e82b", "score": "0.46431795", "text": "func (cfg *DelegationList) Validate() error {\n\tfor proto, list := range *cfg {\n\t\tif _, found := protocol.KnownDerivations[proto]; !found {\n\t\t\treturn serrors.New(\"Configured protocol not found\", \"protocol\", proto)\n\t\t}\n\t\tfor _, ip := range list {\n\t\t\tif h := addr.HostFromIPStr(ip); h == nil {\n\t\t\t\treturn serrors.New(\"Syntax error: not a valid address\", \"ip\", ip)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "633386939da18b83e746261e4a3cb7de", "score": "0.4643106", "text": "func (m IPAddresses) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a21ee996a8aba030660de141461a8d02", "score": "0.46400443", "text": "func EmailAddressIn(vs ...string) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldEmailAddress), v...))\n\t})\n}", "title": "" }, { "docid": "c53cf61b3301bbe4a09548340f9a450c", "score": "0.46372247", "text": "func AllowAll() bascule.ValidatorFunc {\n\treturn func(_ context.Context, _ bascule.Token) error {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7c25b9467556e5c37ab2a7f3d16e0e4f", "score": "0.46322846", "text": "func (_options *CreateZoneOptions) SetAddresses(addresses []AddressIntf) *CreateZoneOptions {\n\t_options.Addresses = addresses\n\treturn _options\n}", "title": "" }, { "docid": "3339e79c7d17ee9527b8fc452e1358a8", "score": "0.46308696", "text": "func (_TransferWhitelist *TransferWhitelistSession) SetDirectlyWhitelistedAddresses(_whitelist []common.Address) (*types.Transaction, error) {\n\treturn _TransferWhitelist.Contract.SetDirectlyWhitelistedAddresses(&_TransferWhitelist.TransactOpts, _whitelist)\n}", "title": "" }, { "docid": "2b25b16227ae460118abec93bbe8bef4", "score": "0.46257225", "text": "func shouldFilterTarget(lbls labels.Labels, host string) bool {\n\tshouldFilterTargetByLabelValue := func(labelValue string) bool {\n\t\tif addr, _, err := net.SplitHostPort(labelValue); err == nil {\n\t\t\tlabelValue = addr\n\t\t}\n\n\t\t// Special case: always allow localhost/127.0.0.1\n\t\tif labelValue == \"localhost\" || labelValue == \"127.0.0.1\" {\n\t\t\treturn false\n\t\t}\n\n\t\treturn labelValue != host\n\t}\n\n\tlset := labels.New(lbls...)\n\taddressLabel := lset.Get(model.AddressLabel)\n\tif addressLabel == \"\" {\n\t\t// No address label. This is invalid and will generate an error by the scrape\n\t\t// manager, so we'll pass it on for now.\n\t\treturn false\n\t}\n\n\t// If the __address__ label matches, we can quit early.\n\tif !shouldFilterTargetByLabelValue(addressLabel) {\n\t\treturn false\n\t}\n\n\t// Fall back to checking metalabels as long as their values are nonempty.\n\tfor _, check := range HostFilterLabelMatchers {\n\t\t// If any of the checked labels match for not being filtered out, we can\n\t\t// return before checking any of the other matchers.\n\t\tif addr := lset.Get(check); addr != \"\" && !shouldFilterTargetByLabelValue(addr) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Nothing matches, filter it out.\n\treturn true\n}", "title": "" }, { "docid": "6ab8f23766f6831c97715d3b35721f79", "score": "0.46251303", "text": "func (ag *NMD) SetVeniceIPs(veniceIPs []string) {\n\n}", "title": "" }, { "docid": "4d2cf96c987296507a4569bb49bb7f3c", "score": "0.4624491", "text": "func (_WhitelistMock *WhitelistMockTransactorSession) AddAddressesToWhitelist(addrs []common.Address) (*types.Transaction, error) {\n\treturn _WhitelistMock.Contract.AddAddressesToWhitelist(&_WhitelistMock.TransactOpts, addrs)\n}", "title": "" }, { "docid": "fc6d5297c279deb565a5680c7337be33", "score": "0.46236852", "text": "func WithStreetAddress(streetAddress []string) func(*Address) {\n\treturn func(a *Address) {\n\t\ta.StreetAddress = streetAddress\n\t}\n}", "title": "" }, { "docid": "d980f5836766f6233c01f6fae1f349bc", "score": "0.4614129", "text": "func NewAddrsFilter(addrs []cipher.Address) TxFilter {\n\treturn AddrsFilter{Addrs: addrs}\n}", "title": "" }, { "docid": "062f4754b3bad4d24dd587babc814098", "score": "0.46117783", "text": "func AllHostsBindAddr(port int) string {\n\treturn fmt.Sprintf(\":%d\", port)\n}", "title": "" }, { "docid": "caafe798d79d0b07dbafd33c8db842b6", "score": "0.46078435", "text": "func (s *BasetnsnamesParserListener) ExitAddress_list(ctx *Address_listContext) {}", "title": "" }, { "docid": "62deeddae69b333ad9c4fb768865bc00", "score": "0.4606861", "text": "func (o *resolveAddr) ApplyOptions(options ...ResolveAddrOption) *resolveAddr {\n\tfor _, opt := range options {\n\t\tif opt == nil {\n\t\t\tcontinue\n\t\t}\n\t\topt.apply(o)\n\t}\n\treturn o\n}", "title": "" }, { "docid": "1ade8907c323a71969f7de47867985a0", "score": "0.46036717", "text": "func (w *ServerInterfaceWrapper) ListByronAddresses(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"walletId\" -------------\n\tvar walletId string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"walletId\", ctx.Param(\"walletId\"), &walletId)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter walletId: %s\", err))\n\t}\n\n\t// Parameter object where we will unmarshal all parameters from the context\n\tvar params ListByronAddressesParams\n\t// ------------- Optional query parameter \"state\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"state\", ctx.QueryParams(), &params.State)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter state: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.ListByronAddresses(ctx, walletId, params)\n\treturn err\n}", "title": "" }, { "docid": "0a5086314722f6c3d5096a6f6704ec94", "score": "0.4599327", "text": "func StringAddressList(addrs []*mail.Address) []string {\n\ts := make([]string, len(addrs))\n\tfor i, a := range addrs {\n\t\ts[i] = StringAddress(a)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "fef8f10582fbcab198ecce7622eb5baa", "score": "0.4593261", "text": "func MultiaddrResolver(rslv *madns.Resolver) Option {\n\treturn func(cfg *Config) error {\n\t\tcfg.MultiaddrResolver = rslv\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a9a505c8de390f9f1db41d11ec21232d", "score": "0.459231", "text": "func (h *Handler) listAllowed(list string) bool {\n\tfor _, l := range h.cfg.Subscribegun.Lists {\n\t\tif l == list {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" } ]
919fcc04ada0fd770863f61dbc4a9ac3
GetMarketCreatorMailbox is a free data retrieval call binding the contract method 0xed23378b. Solidity: function getMarketCreatorMailbox() constant returns(address)
[ { "docid": "5beb8cc3884fb96e8e3e4c22699b8cd6", "score": "0.8347601", "text": "func (_Market *MarketCaller) GetMarketCreatorMailbox(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Market.contract.Call(opts, out, \"getMarketCreatorMailbox\")\n\treturn *ret0, err\n}", "title": "" } ]
[ { "docid": "e22fc18978aa7218105eafb7d78bf352", "score": "0.851404", "text": "func (_IMarket *IMarketCaller) GetMarketCreatorMailbox(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IMarket.contract.Call(opts, out, \"getMarketCreatorMailbox\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "05d4279ba3ee64dde1398e33d6817ee2", "score": "0.78806084", "text": "func (_IMarket *IMarketCallerSession) GetMarketCreatorMailbox() (common.Address, error) {\n\treturn _IMarket.Contract.GetMarketCreatorMailbox(&_IMarket.CallOpts)\n}", "title": "" }, { "docid": "f3b675032bc9fc8ace57e15300f13aaf", "score": "0.7845651", "text": "func (_IMarket *IMarketSession) GetMarketCreatorMailbox() (common.Address, error) {\n\treturn _IMarket.Contract.GetMarketCreatorMailbox(&_IMarket.CallOpts)\n}", "title": "" }, { "docid": "9e2eae22f542ef9de9084e8c2beefb42", "score": "0.77205515", "text": "func (_Market *MarketCallerSession) GetMarketCreatorMailbox() (common.Address, error) {\n\treturn _Market.Contract.GetMarketCreatorMailbox(&_Market.CallOpts)\n}", "title": "" }, { "docid": "6c90ca8fc2da4ace3819d2e10c55ed37", "score": "0.76945496", "text": "func (_Market *MarketSession) GetMarketCreatorMailbox() (common.Address, error) {\n\treturn _Market.Contract.GetMarketCreatorMailbox(&_Market.CallOpts)\n}", "title": "" }, { "docid": "71e62ec6814a07fb3a13c6dc98334516", "score": "0.57371706", "text": "func GetMailbox(user string) string {\n\tlog.Println(\"package/mailboxes:\", \"Queried blind path of mailbox for user <\"+user+\">\")\n\treturn path.Dir(os.Args[0]) + \"/mailboxes/\" + user\n}", "title": "" }, { "docid": "231dea7e8c9d798ef026baf20c20d6b1", "score": "0.5676041", "text": "func (_IShareToken *IShareTokenCaller) GetMarket(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IShareToken.contract.Call(opts, out, \"getMarket\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "63da9b308fa4ca81e6396a0a622bf230", "score": "0.56064165", "text": "func (_ShareToken *ShareTokenCaller) GetMarket(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ShareToken.contract.Call(opts, out, \"getMarket\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "122ba09990e6cc6facca375289e45377", "score": "0.5498327", "text": "func (m *TestMailstore) GetMailbox(path []string) (*Mailbox, error) {\n\treturn &Mailbox{\n\t\tName: \"inbox\",\n\t\tId: \"1\",\n\t}, nil\n}", "title": "" }, { "docid": "7e25226908f82c1ddabe97974e2b687f", "score": "0.5389356", "text": "func (m *MacOsVppAppAssignedLicense) GetUserEmailAddress()(*string) {\n val, err := m.GetBackingStore().Get(\"userEmailAddress\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "a55ae7ad11843172f3cd84ceb0f88f22", "score": "0.5376286", "text": "func (_ClaimableCrowdsale *ClaimableCrowdsaleCaller) GetReceiver(opts *bind.CallOpts, i uint32) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ClaimableCrowdsale.contract.Call(opts, out, \"getReceiver\", i)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9f33b90a2d1a8c4791961dbd9497ded5", "score": "0.53564996", "text": "func (c MailboxController) GetMailbox(mbid string, w http.ResponseWriter, r *http.Request) {\n\tmb, err := c.GetUUID(mbid)\n\tif err != nil {\n\t\tw.WriteHeader(404)\n\t\tfmt.Fprintln(w, \"mailbox not found\")\n\t\treturn\n\t}\n\n\tencoder := json.NewEncoder(w)\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tif err := encoder.Encode(mb); err != nil {\n\t\tw.WriteHeader(500)\n\t\tfmt.Fprintln(w, \"error marshaling json response :(\")\n\t\tlog.Println(\"Error encoding mailbox json:\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "2b3b181f84f19812a30e0eb4a84603da", "score": "0.5226547", "text": "func (result ContractFunctionResult) GetAddress(index uint64) []byte {\n\treturn result.ContractCallResult[(index*32)+12 : (index*32)+32]\n}", "title": "" }, { "docid": "c6b6efe89c8534b52d7b8e9c2036e1c0", "score": "0.5212436", "text": "func (_SoloMargin *SoloMarginCaller) GetMarketTokenAddress(opts *bind.CallOpts, marketId *big.Int) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SoloMargin.contract.Call(opts, out, \"getMarketTokenAddress\", marketId)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0857ddeda60bf2acb9aa409696d333f0", "score": "0.51886576", "text": "func (self *StdTransaction)GetCreator()utils.Addr{\n return self.Creator\n}", "title": "" }, { "docid": "ca93686b932944a6a89dae3af70fd05f", "score": "0.5166701", "text": "func TestGetMessage(t *testing.T) {\n\n\t//Setup simulated block chain\n\tkey, _ := crypto.GenerateKey()\n\tauth := bind.NewKeyedTransactor(key)\n\talloc := make(core.GenesisAlloc)\n\talloc[auth.From] = core.GenesisAccount{Balance: big.NewInt(1000000000)}\n\tblockchain := backends.NewSimulatedBackend(alloc, 0)\n\n\t//Deploy contract\n\t_, _, contract, _ := DeployInbox(\n\t\tauth,\n\t\tblockchain,\n\t\t\"Hello World\",\n\t)\n\n\t// commit all pending transactions\n\tblockchain.Commit()\n\n\tif got, _ := contract.Message(nil); got != \"Hello World\" {\n\t\tt.Errorf(\"Expected message to be: Hello World. Go: %s\", got)\n\t}\n\n}", "title": "" }, { "docid": "cc94c45c95e9eac00087c84b9944c38a", "score": "0.5165282", "text": "func (m *Mailbox) Retrieve() interface{} {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\treturn m.retrieve()\n}", "title": "" }, { "docid": "1a9deeabaee7cb62abebb5933810de31", "score": "0.5150523", "text": "func (_IUniverse *IUniverseCaller) GetForkingMarket(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IUniverse.contract.Call(opts, out, \"getForkingMarket\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "66fc5707dee2a6ffd5b743002a36da79", "score": "0.5142958", "text": "func (m *PurchaseInvoice) GetBuyFromAddress()(PostalAddressTypeable) {\n val, err := m.GetBackingStore().Get(\"buyFromAddress\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(PostalAddressTypeable)\n }\n return nil\n}", "title": "" }, { "docid": "d85e41fff814d21db96ee138fe536341", "score": "0.51026136", "text": "func (_Universe *UniverseCaller) GetForkingMarket(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Universe.contract.Call(opts, out, \"getForkingMarket\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a84f8d83ca2df890e98d88335f7e4ad7", "score": "0.5096956", "text": "func NewMailbox() Storage {\n\treturn Storage{\n\t\tValue: EmptyMailboxValue,\n\t}\n}", "title": "" }, { "docid": "b19ba3328a4d4690eea70b9432295197", "score": "0.5049389", "text": "func (m *PurchaseInvoice) GetShipToAddress()(PostalAddressTypeable) {\n val, err := m.GetBackingStore().Get(\"shipToAddress\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(PostalAddressTypeable)\n }\n return nil\n}", "title": "" }, { "docid": "36440d3afb16f06f8044a496ba4ff87b", "score": "0.50409424", "text": "func (_IShareToken *IShareTokenCallerSession) GetMarket() (common.Address, error) {\n\treturn _IShareToken.Contract.GetMarket(&_IShareToken.CallOpts)\n}", "title": "" }, { "docid": "c17d912264feb16dc25ccf5c6598bdfe", "score": "0.50218004", "text": "func getCreator() string {\n\tserializedIdentity := &mspProtobuf.SerializedIdentity{}\n\teCertBytes, _ := base64.StdEncoding.DecodeString(getTxCreatorECertBase64())\n\tserializedIdentity.IdBytes = []byte(eCertBytes)\n\tserializedIdentity.Mspid = \"Org1MSP\"\n\tserializedIdentityBytes, _ := proto.Marshal(serializedIdentity)\n\n\treturn string(serializedIdentityBytes)\n}", "title": "" }, { "docid": "afd411ff10756d7efd633f5cc4079873", "score": "0.5021645", "text": "func (_IMarket *IMarketCaller) GetForkingMarket(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IMarket.contract.Call(opts, out, \"getForkingMarket\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "212796ff4674a4901403552de56649f0", "score": "0.49935353", "text": "func (_Market *MarketCaller) GetForkingMarket(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Market.contract.Call(opts, out, \"getForkingMarket\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "81aec04ac1d9ffdc9df6bdde9ba999cb", "score": "0.49794525", "text": "func (m *PurchaseInvoice) GetShipToContact()(*string) {\n val, err := m.GetBackingStore().Get(\"shipToContact\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "b1e8041822c78f7678bbc1f54bed2c29", "score": "0.49782032", "text": "func (imapIns *ImapInstance)GetBoxs()(*[]byte, error){\n\tif imapIns.Client == nil{\n\t\treturn nil, fmt.Errorf(\"Client nil!\")\n\t}\n\t// Make a chan\n\tmailboxes := make(chan *imap.MailboxInfo, 10)\n\tdone := make(chan error, 1)\n\t// Fill the chan\n\tgo func () {\n\t\tdone <- imapIns.Client.List(\"\", \"*\", mailboxes)\n\t}()\n\t// Get item from the chan\n\tboxs := make([]string, 0, Maxboxes)\n\tlog.Println(\"Mailboxes:\")\n\ti:=0\n\tfor m := range mailboxes {\n\t\t_, found := utils.StrInSlice(m.Attributes, \"\\\\Noselect\")\n\t\tif found{ continue }\n\t\tlog.Println(\"* \", m.Name, \", Attr:\", m.Attributes)\n\t\tboxs = append(boxs, m.Name)\n\t\t//imapIns.MyBoxs[i] = m\n\t\ti++\n\t}\n\tif err := <-done; err != nil {\n\t\treturn nil, err\n\t}\n\t// Convert to json\n\tjsonstr, err :=json.Marshal(boxs)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\treturn &jsonstr, nil\n}", "title": "" }, { "docid": "7b612a3dcd266a935cb82829435264f6", "score": "0.49770728", "text": "func (m *Machine) GetAddressBook(chainID string) (*store.AddrBookJSON, error) {\n\treturn m.testnetDB.GetAddressBook(chainID)\n}", "title": "" }, { "docid": "ca39ccf0e96bc05bf1136921b49f444a", "score": "0.4975011", "text": "func (api *API) GetMailboxList(addr address.HashAddress) (*MailboxList, error) {\n\tin := &MailboxList{}\n\n\tresp, statusCode, err := api.GetJSON(fmt.Sprintf(\"/account/%s/boxes\", addr.String()), in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif statusCode < 200 || statusCode > 299 {\n\t\treturn nil, getErrorFromResponse(resp)\n\t}\n\n\treturn in, nil\n}", "title": "" }, { "docid": "7616f92beb17117302bc1c88640d08eb", "score": "0.49603906", "text": "func (c *Client) GetMailbox(name string) (*MailboxStatus, error) {\n\tmb, err := c.client.Select(name, true /* Readonly mode */)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer c.client.Close()\n\n\treturn mb, nil\n}", "title": "" }, { "docid": "73be1ab99427279b48da4f5dc3b64762", "score": "0.49481285", "text": "func GetTxCreator(stub shim.ChaincodeStubInterface) (string, error) {\n\tcreator, err := stub.GetCreator()\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsID := &msp.SerializedIdentity{}\n\terr = proto.Unmarshal(creator, sID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn sID.GetMspid(), nil\n}", "title": "" }, { "docid": "cf46b15f8f51b25ee409cd784430618c", "score": "0.49424857", "text": "func (_Market *MarketCaller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Market.contract.Call(opts, out, \"getOwner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a4d8ee7cb5ed853bcfb4a0cbc76c72c5", "score": "0.49349356", "text": "func (m *BookingStaffMember) GetEmailAddress()(*string) {\n return m.emailAddress\n}", "title": "" }, { "docid": "081fba7cd5513692aa288ed144b3d661", "score": "0.4917351", "text": "func (_ShareToken *ShareTokenCallerSession) GetMarket() (common.Address, error) {\n\treturn _ShareToken.Contract.GetMarket(&_ShareToken.CallOpts)\n}", "title": "" }, { "docid": "91f9fe22c0862419724c30c7af6f0a96", "score": "0.4891974", "text": "func (r *mockRepoForTest) GetUserEmail() (string, error) { return \"user@example.com\", nil }", "title": "" }, { "docid": "0042b2641833677846612a6559074b14", "score": "0.48664674", "text": "func (_SoloMargin *SoloMarginCallerSession) GetMarketTokenAddress(marketId *big.Int) (common.Address, error) {\n\treturn _SoloMargin.Contract.GetMarketTokenAddress(&_SoloMargin.CallOpts, marketId)\n}", "title": "" }, { "docid": "b0c9776e0a120d1c9796cfa5c70cacf5", "score": "0.4855711", "text": "func (_IShareToken *IShareTokenSession) GetMarket() (common.Address, error) {\n\treturn _IShareToken.Contract.GetMarket(&_IShareToken.CallOpts)\n}", "title": "" }, { "docid": "8344b5c7880f6c46c7b57dd2bc2c0533", "score": "0.4853673", "text": "func (_MainnetGatewayContract *MainnetGatewayContractCaller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _MainnetGatewayContract.contract.Call(opts, out, \"getOwner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ab0dc03dbde98b7a212e853ca013da94", "score": "0.48265687", "text": "func (s *ChaincodeStub) GetCreator() ([]byte, error) {\n\treturn s.creator, nil\n}", "title": "" }, { "docid": "4ac8d53bc6082e0ca9a88cc75905bd67", "score": "0.4822045", "text": "func (_ChangeableRateCrowdsale *ChangeableRateCrowdsaleCaller) GetReceiver(opts *bind.CallOpts, i uint32) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ChangeableRateCrowdsale.contract.Call(opts, out, \"getReceiver\", i)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e6a7c8c4ff8fcf07cc6a21f80c400d8a", "score": "0.4806372", "text": "func ContractAddr(ctx *gin.Context) {\n\tmsg := accmanage.GetContractAddress()\n\tmsg.RetErr(ctx)\n}", "title": "" }, { "docid": "ce14178eec726e31af847e5827e78e0a", "score": "0.48054922", "text": "func (_UserGroup *UserGroupCaller) Creator(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _UserGroup.contract.Call(opts, out, \"creator\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "808890b3b23bf249d2578721f9fc7f50", "score": "0.4805389", "text": "func (_WTContracts *WTContractsCaller) GetContract(opts *bind.CallOpts, _pos *big.Int) (string, common.Address, string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t\tret1 = new(common.Address)\n\t\tret2 = new(string)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t}\n\terr := _WTContracts.contract.Call(opts, out, \"getContract\", _pos)\n\treturn *ret0, *ret1, *ret2, err\n}", "title": "" }, { "docid": "37753450f9cbc39095ef5009d011ee58", "score": "0.48049694", "text": "func (c *RPCClient) GetMempoolEntry(txID string, includeOrphanPool bool, filterTransactionPool bool) (*appmessage.GetMempoolEntryResponseMessage, error) {\n\terr := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewGetMempoolEntryRequestMessage(txID, includeOrphanPool, filterTransactionPool))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := c.route(appmessage.CmdGetMempoolEntryResponseMessage).DequeueWithTimeout(c.timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgetMempoolEntryResponse := response.(*appmessage.GetMempoolEntryResponseMessage)\n\tif getMempoolEntryResponse.Error != nil {\n\t\treturn nil, c.convertRPCError(getMempoolEntryResponse.Error)\n\t}\n\treturn getMempoolEntryResponse, nil\n}", "title": "" }, { "docid": "bb9c10fe307b306018340c212c578254", "score": "0.48020086", "text": "func (_TicketBroker *TicketBrokerCaller) GetSenderInfo(opts *bind.CallOpts, _sender common.Address) (struct {\n\tSender MixinTicketBrokerCoreSender\n\tReserve MReserveReserveInfo\n}, error) {\n\tvar out []interface{}\n\terr := _TicketBroker.contract.Call(opts, &out, \"getSenderInfo\", _sender)\n\n\toutstruct := new(struct {\n\t\tSender MixinTicketBrokerCoreSender\n\t\tReserve MReserveReserveInfo\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Sender = *abi.ConvertType(out[0], new(MixinTicketBrokerCoreSender)).(*MixinTicketBrokerCoreSender)\n\toutstruct.Reserve = *abi.ConvertType(out[1], new(MReserveReserveInfo)).(*MReserveReserveInfo)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "4f69b53627d78dfc0165bebb71eb0f7b", "score": "0.4796251", "text": "func (_Tokenhub *TokenhubCallerSession) GetContractAddrByBEP2Symbol(bep2Symbol [32]byte) (common.Address, error) {\n\treturn _Tokenhub.Contract.GetContractAddrByBEP2Symbol(&_Tokenhub.CallOpts, bep2Symbol)\n}", "title": "" }, { "docid": "9f1c746ef48746d2ed014744baba5aae", "score": "0.47753218", "text": "func (cs *connectionServer) NewMailbox() (*Address, *Mailbox) {\n\treturn cs.newLocalMailbox()\n}", "title": "" }, { "docid": "73ff0ff10c40217d4e5e2dcb951da59e", "score": "0.47658068", "text": "func GetCmdGetContractStore(queryRoute string, cdc *codec.LegacyAmino) *cobra.Command {\r\n\treturn &cobra.Command{\r\n\t\tUse: \"contract-store [bech32-address] [msg]\",\r\n\t\tShort: \"Query contract store of the address with query data and prints the returned result\",\r\n\t\tLong: \"Query contract store of the address with query data and prints the returned result\",\r\n\t\tArgs: cobra.ExactArgs(2),\r\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\r\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\r\n\r\n\t\t\taddr, err := sdk.AccAddressFromBech32(args[0])\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\r\n\t\t\tmsg := args[1]\r\n\t\t\tmsgBz := []byte(msg)\r\n\t\t\tif !json.Valid(msgBz) {\r\n\t\t\t\treturn errors.New(\"msg must be a json string format\")\r\n\t\t\t}\r\n\r\n\t\t\tparams := types.NewQueryContractParams(addr, msgBz)\r\n\t\t\tbz, err := cliCtx.Codec.MarshalJSON(params)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\r\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", queryRoute, types.QueryContractStore)\r\n\t\t\tres, _, err := cliCtx.QueryWithData(route, bz)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\r\n\t\t\tfmt.Println(string(res))\r\n\t\t\treturn nil\r\n\t\t},\r\n\t}\r\n}", "title": "" }, { "docid": "8b9a7ffdc9c1e03178486f790893878c", "score": "0.4757401", "text": "func (_ShareToken *ShareTokenSession) GetMarket() (common.Address, error) {\n\treturn _ShareToken.Contract.GetMarket(&_ShareToken.CallOpts)\n}", "title": "" }, { "docid": "c12580bd7ea8a5c76f8378bcf5603aad", "score": "0.47519898", "text": "func deriveMinerAddress(creator address.Address, nonce uint64) (address.Address, error) {\n\tbuf := new(bytes.Buffer)\n\n\tif _, err := buf.Write(creator.Bytes()); err != nil {\n\t\treturn address.Undef, err\n\t}\n\n\tif err := binary.Write(buf, binary.BigEndian, nonce); err != nil {\n\t\treturn address.Undef, err\n\t}\n\n\treturn address.NewActorAddress(buf.Bytes())\n}", "title": "" }, { "docid": "89355f4d87b931fabc9258a11f5ae74c", "score": "0.47485477", "text": "func (_Tokenhub *TokenhubSession) GetContractAddrByBEP2Symbol(bep2Symbol [32]byte) (common.Address, error) {\n\treturn _Tokenhub.Contract.GetContractAddrByBEP2Symbol(&_Tokenhub.CallOpts, bep2Symbol)\n}", "title": "" }, { "docid": "ffe62da36a00b2ccf9be30da645bc738", "score": "0.47434512", "text": "func getReceivedByAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {\n\tcmd := icmd.(*btcjson.GetReceivedByAddressCmd)\n\n\taddr, err := decodeAddress(cmd.Address, w.ChainParams())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttotal, err := w.TotalReceivedForAddr(addr, int32(*cmd.MinConf))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn total.ToBTC(), nil\n}", "title": "" }, { "docid": "48d4b16e02997415bbf0870c56df8766", "score": "0.47378096", "text": "func (s *Service) GetSmartContract(addr multivacaddress.Address) *wire.SmartContract {\n\treturn s.actorCtx.SendAndWait(s.actor, message.NewEvent(evtSmartContractByAddress, addr)).(*wire.SmartContract)\n}", "title": "" }, { "docid": "c9ac28df17dcc3abdfac64b2cb497ed3", "score": "0.4736887", "text": "func (_IBEP20 *IBEP20Caller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _IBEP20.contract.Call(opts, &out, \"getOwner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "505e9dc855c178c0433192674479a5f1", "score": "0.4735612", "text": "func (m *Mailbox) retrieve() interface{} {\n\tif len(m.queue) == 0 {\n\t\treturn nil\n\t}\n\tx := m.queue[len(m.queue)-1]\n\tm.queue = m.queue[:len(m.queue)-1]\n\treturn x\n}", "title": "" }, { "docid": "b8d95840a94213696813c1df58848b1a", "score": "0.47348195", "text": "func GetFutureContract(localSymbol string, futExchange string) ibapi.Contract {\n\n\tvar exchange string\n\n\tswitch {\n\tcase futExchange == \"\":\n\t\texchange = futureExchange\n\tdefault:\n\t\texchange = futExchange\n\t}\n\n\treturn ibapi.Contract{\n\t\tLocalSymbol: localSymbol,\n\t\tExchange: exchange,\n\t\tSecurityType: futureSecurityType,\n\t\tCurrency: currency,\n\t}\n}", "title": "" }, { "docid": "38ab12ef1674ca488ad0ccc8b1d00b38", "score": "0.47240883", "text": "func (_Exchange *ExchangeCaller) GetOfferCompact(opts *bind.CallOpts, _offerId [8]byte) (common.Address, common.Address, common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t\tret1 = new(common.Address)\n\t\tret2 = new(common.Address)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t}\n\terr := _Exchange.contract.Call(opts, out, \"getOfferCompact\", _offerId)\n\treturn *ret0, *ret1, *ret2, err\n}", "title": "" }, { "docid": "2d2998e3892e9555067b71c910b38012", "score": "0.47168827", "text": "func (m *Organization) GetStreet()(*string) {\n val, err := m.GetBackingStore().Get(\"street\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "c982082c1063bc1a7c4a4d750cf8e105", "score": "0.46832308", "text": "func(imapIns * ImapInstance)BoxNameAndNum()(string, uint32){\n\tboxsta := imapIns.Client.Mailbox()\n\tif boxsta == nil{\n\t\treturn \"\", 0\n\t}\n\treturn boxsta.Name, boxsta.Messages\n}", "title": "" }, { "docid": "41d28533a3f018b8cd065fe542b3ae05", "score": "0.46770614", "text": "func (m *PurchaseInvoice) GetPayToAddress()(PostalAddressTypeable) {\n val, err := m.GetBackingStore().Get(\"payToAddress\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(PostalAddressTypeable)\n }\n return nil\n}", "title": "" }, { "docid": "15b0c90596b9059c3145d566d72108f3", "score": "0.4671295", "text": "func (_Tokenhub *TokenhubCaller) GetContractAddrByBEP2Symbol(opts *bind.CallOpts, bep2Symbol [32]byte) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Tokenhub.contract.Call(opts, out, \"getContractAddrByBEP2Symbol\", bep2Symbol)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "cfa590c2f3e3ef8ad9df30a5fad31914", "score": "0.4667543", "text": "func (_Cash *CashCaller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Cash.contract.Call(opts, &out, \"get_owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "670b5f30fd034b824be469c6b3f58a3e", "score": "0.4659932", "text": "func (m *Message) Mailbox() string {\n\treturn m.mailbox.name\n}", "title": "" }, { "docid": "7fd0a2d572c3609cf6e716fd818a8e23", "score": "0.46562988", "text": "func (r *ContractRepository) GetWaitingForUser(email string) ([]Contract, error) {\n\tvar res []Contract\n\terr := r.Collection.FindAll(bson.M{\n\t\t\"ready\": false,\n\t\t\"signers\": bson.M{\n\t\t\t\"$elemMatch\": bson.M{\n\t\t\t\t\"email\": bson.M{\"$regex\": bson.RegEx{Pattern: \"^\" + email + \"$\", Options: \"i\"}},\n\t\t\t\t\"hash\": []byte{},\n\t\t\t}},\n\t}, &res)\n\treturn res, err\n}", "title": "" }, { "docid": "274f43c9700b0918e7e1dfa5203f457d", "score": "0.46425", "text": "func (r FutureGetMempoolEntryResult) Receive() (*results.GetMempoolEntryResult, error) {\n\tres, err := ReceiveFuture(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Unmarshal the result as an array of strings.\n\tvar mempoolEntryResult results.GetMempoolEntryResult\n\terr = json.Unmarshal(res, &mempoolEntryResult)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &mempoolEntryResult, nil\n}", "title": "" }, { "docid": "1168a3ca016a4c9e0c1680292dcf1d41", "score": "0.46374813", "text": "func (c *Client) GetMempoolEntry(txHash string) (*model.GetMempoolEntryResult, error) {\n\treturn c.GetMempoolEntryAsync(txHash).Receive()\n}", "title": "" }, { "docid": "3d0458763bde106030476fa5e1eb969c", "score": "0.46273646", "text": "func (c *Client) ListMailbox(name string) (headers []*MessageHeader, err error) {\n\turi := \"/api/v1/mailbox/\" + url.QueryEscape(name)\n\terr = c.doJSON(\"GET\", uri, &headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, h := range headers {\n\t\th.client = c\n\t}\n\treturn\n}", "title": "" }, { "docid": "7df16acded3d2af92371f2e2b23091d5", "score": "0.46223354", "text": "func (_SoloMargin *SoloMarginCaller) GetMarket(opts *bind.CallOpts, marketId *big.Int) (Struct11, error) {\n\tvar (\n\t\tret0 = new(Struct11)\n\t)\n\tout := ret0\n\terr := _SoloMargin.contract.Call(opts, out, \"getMarket\", marketId)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d06228fa6c3f4473f59b67907172abc6", "score": "0.46220714", "text": "func getCreatorInContext(creator string) string {\n\tserializedIdentity := &mspProtobuf.SerializedIdentity{}\n\tvar eCertBytes []byte\n\tif creator == \"locker\" {\n\t\teCertBytes, _ = base64.StdEncoding.DecodeString(getLockerECertBase64())\n\t} else {\n\t\teCertBytes, _ = base64.StdEncoding.DecodeString(getRecipientECertBase64())\n\t}\n\tserializedIdentity.IdBytes = eCertBytes\n\tserializedIdentity.Mspid = \"ca.org1.example.com\"\n\tserializedIdentityBytes, _ := proto.Marshal(serializedIdentity)\n\n\treturn string(serializedIdentityBytes)\n}", "title": "" }, { "docid": "efe33c46cef4f0105ddd0e347043ccc1", "score": "0.46214193", "text": "func (m *PurchaseInvoice) GetPayToContact()(*string) {\n val, err := m.GetBackingStore().Get(\"payToContact\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "97e2cbcde4ea3b2825081f0ff87cba10", "score": "0.46161458", "text": "func (_TokenFactory *TokenFactoryCaller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenFactory.contract.Call(opts, out, \"getOwner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "813b283def81d28c6e63a0a0bcece375", "score": "0.46096206", "text": "func (r FutureGetMempoolEntryResult) Receive() (*model.GetMempoolEntryResult, error) {\n\tres, err := receiveFuture(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Unmarshal the result as an array of strings.\n\tvar mempoolEntryResult model.GetMempoolEntryResult\n\terr = json.Unmarshal(res, &mempoolEntryResult)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"couldn't decode getMempoolEntry response\")\n\t}\n\n\treturn &mempoolEntryResult, nil\n}", "title": "" }, { "docid": "397f338891815e47ed280ce9351a3ecd", "score": "0.46084183", "text": "func (_IUniverse *IUniverseSession) GetForkingMarket() (common.Address, error) {\n\treturn _IUniverse.Contract.GetForkingMarket(&_IUniverse.CallOpts)\n}", "title": "" }, { "docid": "ef6ae16b2154d6d6db4dcb332ef175d8", "score": "0.459783", "text": "func (_IUniverse *IUniverseCallerSession) GetForkingMarket() (common.Address, error) {\n\treturn _IUniverse.Contract.GetForkingMarket(&_IUniverse.CallOpts)\n}", "title": "" }, { "docid": "e70f2b3a2f6fe70f53c761865a58d013", "score": "0.4590838", "text": "func (m *TestMailstore) GetMailboxes(path []string) ([]*Mailbox, error) {\n\tif len(path) == 0 {\n\t\t// Root\n\t\treturn []*Mailbox{\n\t\t\t{\n\t\t\t\tName: \"inbox\",\n\t\t\t\tPath: []string{\"inbox\"},\n\t\t\t\tId: \"1\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"spam\",\n\t\t\t\tPath: []string{\"spam\"},\n\t\t\t\tId: \"2\",\n\t\t\t},\n\t\t}, nil\n\t} else if len(path) == 1 && path[0] == \"inbox\" {\n\t\treturn []*Mailbox{\n\t\t\t{\n\t\t\t\tName: \"starred\",\n\t\t\t\tPath: []string{\"inbox\", \"stared\"},\n\t\t\t\tId: \"3\",\n\t\t\t},\n\t\t}, nil\n\t} else {\n\t\treturn []*Mailbox{}, nil\n\t}\n}", "title": "" }, { "docid": "8bc49699a109b0d45a5aeb4cf7cce0ec", "score": "0.45901123", "text": "func getExchangeCommand(options *globalOptions) *cobra.Command {\n\tgetExchange := &cobra.Command{\n\t\tUse: \"exchange <ADDRESS> <NAME>\",\n\t\tShort: \"Get a single exchange\",\n\t\tArgs: cobra.ExactArgs(2),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn runGetExchanges(options, args)\n\t\t},\n\t}\n\n\treturn getExchange\n}", "title": "" }, { "docid": "96e0afb709d2d9114ae13c3c38564d47", "score": "0.45867434", "text": "func ConsumeXboxEntitlements(settings *playfab.Settings, postData *ConsumeXboxEntitlementsRequestModel, clientSessionTicket string) (*ConsumeXboxEntitlementsResultModel, error) {\r\n if clientSessionTicket == \"\" {\n return nil, playfab.NewCustomError(\"clientSessionTicket should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Client/ConsumeXboxEntitlements\", \"X-Authentication\", clientSessionTicket)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &ConsumeXboxEntitlementsResultModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "588a45672840ca2724f47c959fa7d656", "score": "0.45856026", "text": "func (_Cake *CakeCaller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Cake.contract.Call(opts, &out, \"getOwner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "354e99a43ba2827a13c2275b6487f375", "score": "0.45775715", "text": "func (m *DeviceComplianceSettingState) GetUserEmail()(*string) {\n return m.userEmail\n}", "title": "" }, { "docid": "d6aa30f39a9887d3113d897f61a52acf", "score": "0.4576912", "text": "func (_SoloMargin *SoloMarginSession) GetMarketTokenAddress(marketId *big.Int) (common.Address, error) {\n\treturn _SoloMargin.Contract.GetMarketTokenAddress(&_SoloMargin.CallOpts, marketId)\n}", "title": "" }, { "docid": "f140ad25fcfe1e3d1ae53298d7ca4840", "score": "0.455645", "text": "func (_IMarket *IMarketCaller) GetOwner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IMarket.contract.Call(opts, out, \"getOwner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "010c109f06ab494df30b8d09967b63ec", "score": "0.4543261", "text": "func GetAddress(publicKey []byte) string {\n\thash := crypto.Keccak256(publicKey[1:])\n\taddress := hash[12:] //address is the last 20 bytes of the hash len(hash) = 20\n\treturn hexutil.Encode(address)\n}", "title": "" }, { "docid": "909fbff6bab2468ff67912896146ab93", "score": "0.45405528", "text": "func (_Mooniswap *MooniswapCaller) Factory(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Mooniswap.contract.Call(opts, out, \"factory\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6a958ec309bd57b65ac2e8029b6137ab", "score": "0.4531517", "text": "func (pk *PushKeyAPI) GetOwner(addr string, blockHeight ...uint64) (*api.ResultAccount, error) {\n\n\tvar height uint64\n\tif len(blockHeight) > 0 {\n\t\theight = blockHeight[0]\n\t}\n\n\tout, statusCode, err := pk.c.call(\"pk_getOwner\", util.Map{\"id\": addr, \"height\": height})\n\tif err != nil {\n\t\treturn nil, makeReqErrFromCallErr(statusCode, err)\n\t}\n\n\tr := &api.ResultAccount{Account: state.NewBareAccount()}\n\tif err = r.Account.FromMap(out); err != nil {\n\t\treturn nil, errors.ReqErr(500, ErrCodeDecodeFailed, \"\", err.Error())\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "9f88814eef41b367728c1a396bcb4c0a", "score": "0.4526189", "text": "func GenContractAddr(ctx *gin.Context) {\n\tmsg := accmanage.GenContractAddress()\n\tmsg.RetErr(ctx)\n}", "title": "" }, { "docid": "0e9cd9cd026c3b81fbe45e7e4817cea6", "score": "0.45057645", "text": "func (ef *EnvFunctions) GetContractAddress(proc *exec.WavmProcess) uint64 {\n\tctx := ef.ctx\n\tctx.GasCounter.GasGetContractAddress()\n\taddr := ctx.Contract.Address().Bytes()\n\treturn ef.returnAddress(proc, addr)\n}", "title": "" }, { "docid": "138b34e84f2f3d1fa61b6a599d4a49b2", "score": "0.45055977", "text": "func (_Universe *UniverseCallerSession) GetForkingMarket() (common.Address, error) {\n\treturn _Universe.Contract.GetForkingMarket(&_Universe.CallOpts)\n}", "title": "" }, { "docid": "620767124c5a8b6ea163c962613bea70", "score": "0.45051235", "text": "func (_Tokenhub *TokenhubCaller) GetBep2SymbolByContractAddr(opts *bind.CallOpts, contractAddr common.Address) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _Tokenhub.contract.Call(opts, out, \"getBep2SymbolByContractAddr\", contractAddr)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "dbf5c53af7c9f4d2497a61653851fef6", "score": "0.45046178", "text": "func (m *Calendar) GetOwner()(EmailAddressable) {\n return m.owner\n}", "title": "" }, { "docid": "92871d4c0e23b882b193bd3c9f39a6d4", "score": "0.4502142", "text": "func getWalletAddress(w *wallet.Wallet) ([]string, error) {\n\t//get default addresses\n\taccount := uint32(udb.DefaultAccountNum)\n\taddresses, err := w.FetchAddressesByAccount(account)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//get bliss addresses\n\tblissAccount := uint32(udb.DefaultBlissAccountNum)\n\tblissAddresses, err := w.FetchAddressesByAccount(blissAccount)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taddresses = append(addresses, blissAddresses...)\n\treturn addresses, nil\n}", "title": "" }, { "docid": "496791fda73314df1b1450cdca927db0", "score": "0.44996372", "text": "func (_Exchange *ExchangeCaller) GetOffer(opts *bind.CallOpts, _offerId [8]byte) (common.Address, common.Address, [][20]byte, common.Address, [4]byte, []byte, uint8, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t\tret1 = new(common.Address)\n\t\tret2 = new([][20]byte)\n\t\tret3 = new(common.Address)\n\t\tret4 = new([4]byte)\n\t\tret5 = new([]byte)\n\t\tret6 = new(uint8)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t\tret3,\n\t\tret4,\n\t\tret5,\n\t\tret6,\n\t}\n\terr := _Exchange.contract.Call(opts, out, \"getOffer\", _offerId)\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, *ret5, *ret6, err\n}", "title": "" }, { "docid": "93c822f90f0ccb232961026067b851b5", "score": "0.44922855", "text": "func LinkXboxAccount(settings *playfab.Settings, postData *LinkXboxAccountRequestModel, clientSessionTicket string) (*LinkXboxAccountResultModel, error) {\r\n if clientSessionTicket == \"\" {\n return nil, playfab.NewCustomError(\"clientSessionTicket should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Client/LinkXboxAccount\", \"X-Authentication\", clientSessionTicket)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &LinkXboxAccountResultModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "60e4b49704ac1d12e4b1fdea94db397b", "score": "0.44910282", "text": "func (_Market *MarketCaller) GetUniverse(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Market.contract.Call(opts, out, \"getUniverse\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "70c4f2ff5677b61dfde0ad0281bb94d8", "score": "0.4490949", "text": "func (m *Subscription) GetCreatorId()(*string) {\n return m.creatorId\n}", "title": "" }, { "docid": "d0844ea5d4a841d5609f32cea85ea1ed", "score": "0.44901514", "text": "func (_ClaimableCrowdsale *ClaimableCrowdsaleSession) GetReceiver(i uint32) (common.Address, error) {\n\treturn _ClaimableCrowdsale.Contract.GetReceiver(&_ClaimableCrowdsale.CallOpts, i)\n}", "title": "" }, { "docid": "13a8ad959cbfcd280cc63f4fb1a66e0e", "score": "0.4488755", "text": "func (_Universe *UniverseSession) GetForkingMarket() (common.Address, error) {\n\treturn _Universe.Contract.GetForkingMarket(&_Universe.CallOpts)\n}", "title": "" }, { "docid": "76b8012ae4651eb8c0353286884459cc", "score": "0.44880962", "text": "func (a *EthAdaptor) ObtainTx(chainID string, sequence int64) (*txs.TxQcp, error) {\n\tlog.Infof(\"ObtainTx: %s(%s), %d\", a.GetChainName(), chainID, sequence)\n\t// ignore useless block, 10000000 in kovan\n\tif sequence < 10000000 {\n\t\treturn nil, errors.New(\"invalid sequence\")\n\t}\n\tblock, err := sdk.EthGetBlockByNumber(sequence)\n\tif err != nil {\n\t\tlog.Errorf(\"ethereum rpc error: %v\", err)\n\t\treturn nil, err\n\t}\n\tregisterBlock := &fabsdk.BlockRegister{\n\t\tHeight: block.Number}\n\tvar isReceiver bool\n\tvar addr string\n\tfor _, tx := range block.Transactions {\n\t\tif isReceiver, err = a.Addrs.Exist(tx.To); err != nil {\n\t\t\tlog.Errorf(\"check address book: %s hash: %s error: %v\",\n\t\t\t\ttx.To, tx.Hash, err)\n\t\t\treturn nil, err\n\t\t} else if isReceiver {\n\t\t\taddr = tx.To\n\t\t} else if isReceiver, err = a.Addrs.Exist(tx.From); err != nil {\n\t\t\tlog.Errorf(\"check address book %s hash: %s error: %v\",\n\t\t\t\ttx.From, tx.Hash, err)\n\t\t\treturn nil, err\n\t\t} else if isReceiver {\n\t\t\tisReceiver = false\n\t\t\taddr = tx.From\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Infof(\"check address book is receiver: %t\", isReceiver)\n\t\treceipt, err := sdk.EthGetTransactionReceipt(tx.Hash)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"check tx receipt hash: %s error: %v\",\n\t\t\t\ttx.Hash, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tt := &fabsdk.TxRegister{\n\t\t\tChainName: \"ethereum\",\n\t\t\tTokenName: \"eth\",\n\t\t\tAddr: addr,\n\t\t\tAmount: tx.Value,\n\t\t\tGasUsed: receipt.GasUsed,\n\t\t\tGasPrice: tx.GasPrice,\n\t\t\tInfo: &fabsdk.TxInfo{\n\t\t\t\tFrom: tx.From,\n\t\t\t\tTo: tx.To,\n\t\t\t\tAmount: tx.Value,\n\t\t\t\tGasUsed: receipt.GasUsed,\n\t\t\t\tGasPrice: tx.GasPrice,\n\t\t\t\tHeight: block.Number,\n\t\t\t\tTxHash: tx.Hash,\n\t\t\t\tStatus: receipt.Status}}\n\t\tif isReceiver {\n\t\t\tt.GasUsed = \"\"\n\t\t\tt.GasPrice = \"\"\n\t\t} else {\n\t\t\tt.Amount = fmt.Sprintf(\"0x-%s\", t.Amount[2:])\n\t\t}\n\t\tif !receipt.Success() {\n\t\t\tt.Amount = \"\"\n\t\t\tlog.Warnf(\"ObtainTx: %s(%s) %d check block: %s\",\n\t\t\t\ta.GetChainName(), chainID, sequence,\n\t\t\t\tfmt.Sprintf(\"transaction reverted hash: %s\", tx.Hash))\n\t\t}\n\t\tregisterBlock.Txs = append(registerBlock.Txs, t)\n\t}\n\tbytes, err := json.Marshal(registerBlock)\n\tif err != nil {\n\t\tlog.Errorf(\"check block marshal error: %v\", err)\n\t\treturn nil, err\n\t}\n\tjsonRegisterBlock := string(bytes)\n\tlog.Infof(\"ObtainTx: %s(%s) %d check block: %s\", a.GetChainName(), chainID,\n\t\tsequence, jsonRegisterBlock)\n\ttx := msgtx.NewTxQcp(fmt.Sprintf(\"%s(%s)\", a.GetChainName(), chainID),\n\t\ta.GetChainName(), chainID, int64(1), int64(sequence), jsonRegisterBlock)\n\t// a.outSequence = sequence + 1\n\treturn tx, nil\n}", "title": "" }, { "docid": "b6142d4daf261088a29e16642ca76360", "score": "0.44870448", "text": "func (d *Delivery) Mailbox(name string) error {\n\tif cap(d.mboxes) < len(d.users) {\n\t\td.mboxes = make([]Mailbox, 0, len(d.users))\n\t}\n\n\tfor _, u := range d.users {\n\t\tif mboxName := d.mboxOverrides[u.username]; mboxName != \"\" {\n\t\t\t_, mbox, err := u.GetMailbox(mboxName, true, nil)\n\t\t\tif err == nil {\n\t\t\t\td.mboxes = append(d.mboxes, *mbox.(*Mailbox))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t_, mbox, err := u.GetMailbox(name, true, nil)\n\t\tif err != nil {\n\t\t\tif err != backend.ErrNoSuchMailbox {\n\t\t\t\td.mboxes = nil\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := u.CreateMailbox(name); err != nil && err != backend.ErrMailboxAlreadyExists {\n\t\t\t\td.mboxes = nil\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, mbox, err = u.GetMailbox(name, true, nil)\n\t\t\tif err != nil {\n\t\t\t\td.mboxes = nil\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\td.mboxes = append(d.mboxes, *mbox.(*Mailbox))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84ed9ef11cb3bd80d7203bdc2471659e", "score": "0.4485341", "text": "func (_IMarket *IMarketCaller) GetMarketCreatorSettlementFeeDivisor(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _IMarket.contract.Call(opts, out, \"getMarketCreatorSettlementFeeDivisor\")\n\treturn *ret0, err\n}", "title": "" } ]
1493e2adbf9957bbdb478d95a4478044
Hours set the unit with hours
[ { "docid": "4280a2e6f91fefc6d686f4e320e21ce8", "score": "0.58768463", "text": "func (j *Job) Hours() *Job {\n\treturn j.setUnit(hours)\n}", "title": "" } ]
[ { "docid": "cf8650b79a6a21c1edb7b896cc47d8f0", "score": "0.6844784", "text": "func (a *UniversalTimeAndLocalTimeZone) SetHour(hour uint8) {}", "title": "" }, { "docid": "092fdbd98c1a0d5c87fe000514829aab", "score": "0.67633414", "text": "func (c *Carbon) SetHour(h int) {\n\tc.Time = time.Date(c.Year(), c.Month(), c.Day(), h, c.Minute(), c.Second(), c.Nanosecond(), c.Location())\n}", "title": "" }, { "docid": "48b24b6809593d4cce7a05b8d7d82007", "score": "0.6557429", "text": "func (qt *QuantizedTime) SetHour(hour string) {\n\tcopy(qt.ymdh[8:10], hour)\n}", "title": "" }, { "docid": "0a2707c0c82d0e982c620036b2661f8a", "score": "0.61517155", "text": "func (w *WaitTask) Hours(value int64) *WaitTask {\n\tw.push(duration{\n\t\tmethod: \"hours\",\n\t\tvalue: value,\n\t})\n\n\treturn w\n}", "title": "" }, { "docid": "11f4378f5321a9ce67dd22779c905a65", "score": "0.5693137", "text": "func Hour(t time.Time) time.Time {\n\treturn t.Add(time.Hour).Truncate(time.Hour)\n}", "title": "" }, { "docid": "f790edd87aa992679fe8b7092406087e", "score": "0.56736356", "text": "func (t *Loc) SetHHMM(hs, ms []byte) error {\n\th, err := strconv.Atoi(string(hs))\n\tif err != nil {\n\t\treturn err\n\t}\n\tm, err := strconv.Atoi(string(ms))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif h < 0 {\n\t\th = -h\n\t\treturn t.SetS(-((h*60 + m) * 60))\n\t}\n\treturn t.SetS((h*60 + m) * 60)\n}", "title": "" }, { "docid": "701f46976f047a268f544a5b7225f74e", "score": "0.56583947", "text": "func (o *UsageFargateHour) SetHour(v time.Time) {\n\to.Hour = &v\n}", "title": "" }, { "docid": "93f276d11f527f4e4b50e481c03cf590", "score": "0.56481004", "text": "func (m *ActivityMutation) SetHours(i int) {\n\tm.hours = &i\n\tm.addhours = nil\n}", "title": "" }, { "docid": "e0c8b9fd0eaa1e343e17f1c9324ff5a6", "score": "0.5639254", "text": "func (m *VehicleMutation) SetHours(i int64) {\n\tm.hours = &i\n\tm.addhours = nil\n}", "title": "" }, { "docid": "0ee14b48ba53eaaefcb8ee42e3ba0c30", "score": "0.5609098", "text": "func hourHandler(w http.ResponseWriter, req *http.Request) {\n\tcurrentTime := time.Now()\n\th := currentTime.Hour()\n\tmin := currentTime.Minute()\n\tfmt.Fprintf(w, \"%v%v%v\", h, \"h\", min)\n\n}", "title": "" }, { "docid": "d19852c895cc50b8dd6e4a1fcc992bd1", "score": "0.56013775", "text": "func (a *UniversalTimeAndLocalTimeZone) GetHour() (hour uint8) {}", "title": "" }, { "docid": "0c4fb78a0869368fcf748901ec8e6c05", "score": "0.55556047", "text": "func PerHour(n int) Rate { return Rate{time.Hour / time.Duration(n), n} }", "title": "" }, { "docid": "06e7f5211965b68b385f67502a1bbd1e", "score": "0.5553521", "text": "func (qt *QuantizedTime) Set(t time.Time) {\n\tcopy(qt.ymdh[:], t.Format(\"2006010215\"))\n}", "title": "" }, { "docid": "e7e752d6ec213bfe0c045ca7ddb08916", "score": "0.5530923", "text": "func (time Clock) setTimeInClock(minutes int) Clock {\n\tif minutes < 0 {\n\t\tminutes = MinutesInADay + minutes\n\t}\n\tif minutes >= 1440 {\n\t\tminutes = minutes - 1440\n\t}\n\ttime.hour = minutes / 60\n\ttime.minute = minutes % 60\n\treturn time\n}", "title": "" }, { "docid": "f5bcad5ddafaed97902e9b196f456821", "score": "0.5519841", "text": "func (o *UsageLambdaHour) SetHour(v time.Time) {\n\to.Hour = &v\n}", "title": "" }, { "docid": "f8f78eb71e75e1ed5d35997584b39599", "score": "0.5501851", "text": "func To24H(value time.Time) string {\n\treturn value.Format(\"150405\")\n}", "title": "" }, { "docid": "dbf9ee2805cc36315db75968f15e1c1b", "score": "0.5458313", "text": "func (tv Timespan) Hours() int64 {\n\treturn tv.totalHours() % 24\n}", "title": "" }, { "docid": "5793d8be85633a8ced99ff57c869efd0", "score": "0.5458249", "text": "func (offsetTime OffsetTime) Hour() int {\n\treturn offsetTime.Time().Hour()\n}", "title": "" }, { "docid": "2d12eeb08da9d25a4241dba1c2f07c0b", "score": "0.54486257", "text": "func (c *Carbon) AddHours(h int) *Carbon {\n\td := time.Duration(h) * time.Hour\n\n\treturn NewCarbon(c.Add(d))\n}", "title": "" }, { "docid": "043903c1ce58888b2422549e616b1e15", "score": "0.53732103", "text": "func (c Clock) Hour() int {\n\treturn c.hour\n}", "title": "" }, { "docid": "7f60f079d32959643ad95f409e409c85", "score": "0.53665996", "text": "func (m *CloudPcProvisioningPolicy) SetGracePeriodInHours(value *int32)() {\n err := m.GetBackingStore().Set(\"gracePeriodInHours\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b4cbdfa8160eebb9bad53145ce5eaade", "score": "0.5360708", "text": "func (d Duration) Hour() int {\n\t_, hour, _, _, _ := splitDuration(d.Duration)\n\treturn hour\n}", "title": "" }, { "docid": "77915f8d9b022921291c3b0298db25f2", "score": "0.53482664", "text": "func RoundPartOfHour(num int) time.Time { return findPartMin(time.Now(), num) }", "title": "" }, { "docid": "fb74a1c42e5ba0e3b8b5dc6223af9e0a", "score": "0.5325129", "text": "func Hour() Interval {\n\treturn Interval{SomeSeconds: timeh.NanosecsInSec * timeh.SecsInHour, precision: IntervalGoPrecision}\n}", "title": "" }, { "docid": "756ee5eb4a1d24d30f20ec0834ba61ea", "score": "0.53014106", "text": "func (c *Carbon) SubHours(h int) *Carbon {\n\treturn c.AddHours(-h)\n}", "title": "" }, { "docid": "694d2f5d952543d62d93d10433f63a52", "score": "0.5289095", "text": "func (localTime LocalTime) Hour() int {\n\treturn localTime.Time().Hour()\n}", "title": "" }, { "docid": "0fbab96acef88f27a41bf5c875ace6f7", "score": "0.52826554", "text": "func (db *Invoices) UpdateTaskHours(id int64, h float64) error {\n\tq := \"UPDATE public.tasks SET hours=$2 WHERE id=$1;\"\n\t_, err := db.Exec(q, id, h)\n\treturn err\n}", "title": "" }, { "docid": "d43272ccc8c9c5962c27478ec5016438", "score": "0.5268187", "text": "func RoundPartOfHour(n int) time.Time { return findPartMin(time.Now(), n) }", "title": "" }, { "docid": "e5adbc9e3cdd79fc4ccb235eb1a5e92e", "score": "0.524849", "text": "func incrementHour(day, hour int) (int, int) {\n\tif hour == 23 {\n\t\tday = 20\n\t\thour = 0\n\t} else if hour == 9 && day == 20 {\n\t\thour = 12\n\t\tday = 19\n\t} else {\n\t\thour = hour + 1\n\t}\n\treturn day, hour\n}", "title": "" }, { "docid": "04a8dc01b5b675725f6b20172b6360a8", "score": "0.5225333", "text": "func MinsToHours(mins int) string {\n\treturn fmt.Sprintf(\"%d:%.2d\", mins/60, mins%60)\n}", "title": "" }, { "docid": "79a2860d4f9ecbe760fbfc3b334deb6e", "score": "0.52182615", "text": "func (o DatabaseClusterMaintenanceWindowOutput) Hour() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatabaseClusterMaintenanceWindow) string { return v.Hour }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "89b0598f8d5466ddd158d8b47450e20b", "score": "0.5201489", "text": "func NewHourTimeRange(left, right uint) (*TimeRange, error) {\n\tspec := fmt.Sprintf(\"* %d-%d * * *\", left, right)\n\treturn NewTimeRange(spec)\n}", "title": "" }, { "docid": "4e8f0ab79ddca253a0be44f6db7dbc7b", "score": "0.518644", "text": "func toLitersPerHour(value Value) (float64, error) {\n\tif value.unit != flow {\n\t\treturn 0, ErrConversion\n\t}\n\treturn Flow(value.val).LitersPerHour(), nil\n}", "title": "" }, { "docid": "5cb41e2f19a9ec5680ad0e02935383d1", "score": "0.51788497", "text": "func (a *UniversalTimeAndLocalTimeZone) SetMinute(minute uint8) {}", "title": "" }, { "docid": "5e1ae5f1168d173237ddf66275499f00", "score": "0.5157874", "text": "func (a *UniversalTimeAndLocalTimeZone) SetSecond(second uint8) {}", "title": "" }, { "docid": "3d99c623b7253a61e31d2bae8a7c41ec", "score": "0.51567835", "text": "func (t *TimeOfDay) Add(o *TimeOfDay) {\n\tt.Hours = t.Hours + o.Hours\n\tt.Minutes = t.Minutes + o.Minutes\n\tt.Seconds = t.Seconds + o.Seconds\n\tt.Mod()\n}", "title": "" }, { "docid": "288657194e4e55b176ce6887e2d61fd6", "score": "0.51453084", "text": "func (o *RecoveryBackupScheduleAllOf) SetHours(v int32) {\n\to.Hours = &v\n}", "title": "" }, { "docid": "aa2952a8d8a9c6bfe65716e873dc4d4a", "score": "0.5143517", "text": "func TruncateUTCHour(t time.Time) time.Time {\n\tt = t.UTC()\n\treturn time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "57198c08e4e54708d70e70117a2eef5d", "score": "0.5137074", "text": "func (t *TimeOfDay) Mod() {\n\tif t.Seconds > 59 {\n\t\tt.Minutes += t.Seconds / 60\n\t\tt.Seconds = t.Seconds % 60\n\t}\n\tif t.Minutes > 59 {\n\t\tt.Hours += t.Minutes / 60\n\t\tt.Minutes = t.Minutes % 60\n\t}\n\tif t.Hours > 24 {\n\t\tt.Hours = t.Hours % 24\n\t}\n}", "title": "" }, { "docid": "7f739b2672b2c19a9ee8620b2ba66acd", "score": "0.51248133", "text": "func (s *statsSuite) initHourly() {\n\thour1 := baseHour\n\thour2 := baseHour.Add(time.Hour)\n\thour3 := baseHour.Add(24 * time.Hour)\n\ts.insertHourlyTestStats(\"p1\", \"r1\", \"test1.js\", \"task1\", \"v1\", \"d1\", hour1, 10, 5, 2)\n\ts.insertHourlyTestStats(\"p1\", \"r1\", \"test1.js\", \"task1\", \"v1\", \"d1\", hour2, 20, 0, 5)\n\ts.insertHourlyTestStats(\"p1\", \"r1\", \"test1.js\", \"task1\", \"v1\", \"d1\", hour3, 20, 0, 5)\n}", "title": "" }, { "docid": "b94545de6366994317c7e0e37e4ae0dd", "score": "0.5118201", "text": "func (ival Interval) Hours() int32 {\n\treturn ival.hrs\n}", "title": "" }, { "docid": "324ddd9664258c235fa028d15587c35b", "score": "0.5109352", "text": "func (t RqlTerm) Hours() RqlTerm {\n\treturn newRqlTermFromPrevVal(t, \"Hours\", p.Term_HOURS, []interface{}{}, map[string]interface{}{})\n}", "title": "" }, { "docid": "b1b27cb843f8cff5bb5d578c7afdb43f", "score": "0.51069087", "text": "func CalculateHour(\n\torganizationId int,\n\tholidayRepo rp.HolidayRepository,\n\tleaveRequestType int,\n\tt1 time.Time,\n\tt2 time.Time,\n\tsubtractDayOffType int,\n\textraTime float64,\n) float64 {\n\tvar hour float64\n\tlunchBreakStart := ParseTime(cf.FormatDateNoSec, t2.Format(cf.FormatDateDatabase)+\" \"+cf.BreakLunchStart)\n\tlunchBreakEnd := ParseTime(cf.FormatDateNoSec, t2.Format(cf.FormatDateDatabase)+\" \"+cf.BreakLunchEnd)\n\tc := getCalendar(organizationId, holidayRepo, t1.Year())\n\n\tswitch leaveRequestType {\n\tcase cf.FullDayOff:\n\t\tif !utils.CompareEqualDate(t2, t1) {\n\t\t\tcount := 0\n\t\t\tvar dates []time.Time\n\n\t\t\tdiff := int(t2.Sub(t1).Hours()/24) + 1\n\t\t\tfor i := 0; i < diff; i++ {\n\t\t\t\tdates = append(dates, t1.AddDate(0, 0, i))\n\t\t\t}\n\n\t\t\tfor _, date := range dates {\n\t\t\t\tcld := getCalendar(organizationId, holidayRepo, date.Year())\n\t\t\t\tif !cld.IsHoliday(date) && !IsWeekend(date) {\n\t\t\t\t\tcount++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thour = float64(count * 8)\n\t\t\tbreak\n\t\t}\n\n\t\tif c.IsHoliday(t1) || IsWeekend(t1) {\n\t\t\thour = 0\n\t\t\tbreak\n\t\t}\n\t\thour = 8\n\tcase cf.MorningOff, cf.AfternoonOff:\n\t\tif !c.IsHoliday(t1) && !IsWeekend(t1) {\n\t\t\thour = 4\n\t\t\tbreak\n\t\t}\n\n\t\thour = 0\n\tcase cf.LateForWork:\n\t\tif !c.IsHoliday(t1) && !IsWeekend(t1) {\n\t\t\tif subtractDayOffType == cf.Subtract {\n\t\t\t\tif lunchBreakStart.Sub(t2) >= 0 {\n\t\t\t\t\thour = t2.Sub(t1).Hours()\n\t\t\t\t\tbreak\n\t\t\t\t} else if isBetweenTime(lunchBreakStart, lunchBreakEnd, t2) {\n\t\t\t\t\thour = lunchBreakStart.Sub(t1).Hours()\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\thour = lunchBreakStart.Sub(t1).Hours() + t2.Sub(lunchBreakEnd).Hours()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if subtractDayOffType == cf.ExtraWork {\n\t\t\t\tif lunchBreakStart.Sub(t2) >= 0 {\n\t\t\t\t\thour = t2.Sub(t1).Hours()\n\t\t\t\t} else if isBetweenTime(lunchBreakStart, lunchBreakEnd, t2) {\n\t\t\t\t\thour = lunchBreakStart.Sub(t1).Hours()\n\t\t\t\t} else {\n\t\t\t\t\thour = lunchBreakStart.Sub(t1).Hours() + t2.Sub(lunchBreakEnd).Hours()\n\t\t\t\t}\n\n\t\t\t\thour -= extraTime\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\thour = 0\n\tcase cf.LeaveEarly:\n\t\tif !c.IsHoliday(t1) && !IsWeekend(t1) {\n\t\t\tif t1.Sub(lunchBreakEnd) >= 0 {\n\t\t\t\thour = t2.Sub(t1).Hours()\n\t\t\t\tbreak\n\t\t\t} else if isBetweenTime(lunchBreakStart, lunchBreakEnd, t1) {\n\t\t\t\thour = t2.Sub(lunchBreakEnd).Hours()\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\thour = lunchBreakStart.Sub(t1).Hours() + t2.Sub(lunchBreakEnd).Hours()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\thour = 0\n\tcase cf.GoOutside:\n\t\tif !c.IsHoliday(t1) && !IsWeekend(t1) {\n\t\t\tif subtractDayOffType == cf.Subtract {\n\t\t\t\thour = calculateHourGoOutSide(lunchBreakStart, lunchBreakEnd, t1, t2, cf.NotWorkAtNoon)\n\t\t\t\tbreak\n\t\t\t} else if subtractDayOffType == cf.ExtraWork {\n\t\t\t\thour = calculateHourGoOutSide(lunchBreakStart, lunchBreakEnd, t1, t2, cf.NotWorkAtNoon) - extraTime\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\thour = 0\n\tdefault:\n\t\thour = 0\n\t}\n\n\treturn hour\n}", "title": "" }, { "docid": "06aacbd2dfa189fd44e2674c2e1acc67", "score": "0.5101266", "text": "func (o GetDatabaseClusterMaintenanceWindowOutput) Hour() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDatabaseClusterMaintenanceWindow) string { return v.Hour }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d748edd8b90db7775ffbff8e29a19f77", "score": "0.5100248", "text": "func RoundPartOfDay(num int) time.Time { return findPartHour(time.Now(), num) }", "title": "" }, { "docid": "1c8b68d431cf06136a0eaf059d51aeb2", "score": "0.5099832", "text": "func (o *EarningRelease) SetHour(v string) {\n\to.Hour = &v\n}", "title": "" }, { "docid": "dd268af6de4803f0e8baefe48d1faf56", "score": "0.5098874", "text": "func EveryHourOnTheHour() Schedule {\n\treturn OnTheHourAtUTCSchedule{}\n}", "title": "" }, { "docid": "1a65a9a58b9865680bb044a7a2dbfa38", "score": "0.5095846", "text": "func (m *ActivityMutation) AddHours(i int) {\n\tif m.addhours != nil {\n\t\t*m.addhours += i\n\t} else {\n\t\tm.addhours = &i\n\t}\n}", "title": "" }, { "docid": "6751ae00044c816dd1a518b47e99717c", "score": "0.5082018", "text": "func RoundPartOfDay(n int) time.Time { return findPartHour(time.Now(), n) }", "title": "" }, { "docid": "3997c4135ce6e874af45c612bdbdadb9", "score": "0.5065449", "text": "func hourStamp(t uint64) (hour uint64) {\n\tif t > 0 {\n\t\thour = t - t%AnHour\n\t}\n\treturn\n}", "title": "" }, { "docid": "4b561e6d817dafc5d3ca211069e63e27", "score": "0.5050323", "text": "func (c *Carbon) AddHour() *Carbon {\n\treturn c.AddHours(1)\n}", "title": "" }, { "docid": "5aadb4286bbbdb8064fa49d3eb792a07", "score": "0.50280327", "text": "func (tot TOT) SetTime(t time.Time) {\n\tencodeMJDUTC(tot[3:8], t)\n}", "title": "" }, { "docid": "864a0f4ae8304d8c4514eeb17e958902", "score": "0.50243723", "text": "func (m *VehicleMutation) AddHours(i int64) {\n\tif m.addhours != nil {\n\t\t*m.addhours += i\n\t} else {\n\t\tm.addhours = &i\n\t}\n}", "title": "" }, { "docid": "5347b2272aada5cfbe7ffabba48446ca", "score": "0.5014283", "text": "func Time(hour, minute int) Clock {\n\treturn Clock(convModulo(day + hour*60 + minute))\n}", "title": "" }, { "docid": "e200c93027ef40c0279b7ddc56c3313d", "score": "0.50126815", "text": "func (i Interval) NormalHours() int64 {\n\tpow := mathh.PowInt64(10, int64(i.precision))\n\treturn i.SomeSeconds / (pow * timeh.SecsInHour)\n}", "title": "" }, { "docid": "17ef2ec9a4e05ef1d530ca17a62b6845", "score": "0.5007999", "text": "func (m *ActivityMutation) ResetHours() {\n\tm.hours = nil\n\tm.addhours = nil\n}", "title": "" }, { "docid": "b0d7ecf7bd630dfe13d82d1c0c92fd25", "score": "0.49934873", "text": "func (o *CronJobSchedule) SetHour(v string) {\n\to.Hour = &v\n}", "title": "" }, { "docid": "2ec5fa6ea27bb4b25aa65eb61dbfd576", "score": "0.49763396", "text": "func FromLitersPerHour(val float64) Value {\n\treturn Value{val * float64(LiterPerHour), flow}\n}", "title": "" }, { "docid": "5af2cb171da1877453f02b7bbe485898", "score": "0.49715668", "text": "func (dt DateTime) AddHours(hours int) DateTime {\n\treturn dt.Add(time.Duration(hours) * time.Hour)\n}", "title": "" }, { "docid": "36e16c99f78bc2f91464d000f451d0f3", "score": "0.49615058", "text": "func findPartHour(now time.Time, num int) time.Time {\n\tvar hour int\n\n\tif num > now.Hour() || num > 12 || num <= 0 {\n\t\thour = 0\n\t} else {\n\t\thour = now.Hour() - (now.Hour() % num)\n\t}\n\n\treturn time.Date(now.Year(), now.Month(), now.Day(), hour, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "36e16c99f78bc2f91464d000f451d0f3", "score": "0.49615058", "text": "func findPartHour(now time.Time, num int) time.Time {\n\tvar hour int\n\n\tif num > now.Hour() || num > 12 || num <= 0 {\n\t\thour = 0\n\t} else {\n\t\thour = now.Hour() - (now.Hour() % num)\n\t}\n\n\treturn time.Date(now.Year(), now.Month(), now.Day(), hour, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "1e28642b041d79f06e0f24ff4b437234", "score": "0.49517298", "text": "func (c *Carbon) DiffInHours(d *Carbon, abs bool) int64 {\n\treturn c.DiffInMinutes(d, abs) / minutesPerHour\n}", "title": "" }, { "docid": "0bf35e0115e765ae2de7d5e4343e4964", "score": "0.4948903", "text": "func (c *Carbon) SubHour() *Carbon {\n\treturn c.SubHours(1)\n}", "title": "" }, { "docid": "073860efa946a1276a8797696867f0cd", "score": "0.4942558", "text": "func (localDateTime LocalDateTime) Hour() int {\n\treturn localDateTime.Time().Hour()\n}", "title": "" }, { "docid": "bc9fdd1a8117718b6f49654fb90b2765", "score": "0.49319497", "text": "func (period Period) Hours() int {\n\treturn int(period.HoursFloat())\n}", "title": "" }, { "docid": "85426b45ff41dda221d442140d08b57b", "score": "0.49307933", "text": "func (m *VehicleMutation) ResetHours() {\n\tm.hours = nil\n\tm.addhours = nil\n}", "title": "" }, { "docid": "84fb78366ef4c05f6c9751da74f9f594", "score": "0.49261415", "text": "func (t *TimeOfDay) Sub(o *TimeOfDay) {\n\tt.Hours = t.Hours + 24 - o.Hours\n\tt.Minutes = t.Minutes + 60 - o.Minutes\n\tt.Seconds = t.Seconds + 60 - o.Seconds\n\tt.Mod()\n}", "title": "" }, { "docid": "602ce59f19bf37b5326383e2d136bad8", "score": "0.4916601", "text": "func (clock *Clock) normalize() {\n\tminutes := clock.hour*60 + clock.minute\n\tminutes %= 24 * 60\n\tminutes += 24 * 60\n\n\tclock.minute = minutes % 60\n\tclock.hour = (minutes / 60) % 24\n}", "title": "" }, { "docid": "d4fc1811d193fe8c3cf86dd986652716", "score": "0.49146447", "text": "func (f RelativeTime) Set(s string) error {\n\tif f.T == nil {\n\t\treturn errors.Reason(\"set RelativeTime: nil time pointer\").Err()\n\t}\n\tn, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"set RelativeTime\").Err()\n\t}\n\tif f.now == nil {\n\t\tf.now = time.Now\n\t}\n\t*f.T = f.now().Add(time.Duration(n*24) * time.Hour)\n\treturn nil\n}", "title": "" }, { "docid": "9095f90805765e16a4b71f523d44b37d", "score": "0.48982555", "text": "func HourFloor(t time.Time) time.Time {\n\treturn time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), 0, 0, 0, t.Location())\n}", "title": "" }, { "docid": "daa9b5364d6c17acba504e3317973fd8", "score": "0.48962712", "text": "func (o *ObjectTransitionTimes) Set(key, phase string, t time.Time) {\n\to.lock.Lock()\n\tdefer o.lock.Unlock()\n\tif _, exists := o.times[key]; !exists {\n\t\to.times[key] = make(map[string]time.Time)\n\t}\n\to.times[key][phase] = t\n}", "title": "" }, { "docid": "69f2ec3d3993fe80cbfbb1558d318b36", "score": "0.4894362", "text": "func (m *MockReportFormatter) FormatHours(ctx context.Context, report *types.FullWeatherReport, hours int) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"FormatHours\", ctx, report, hours)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "2e7589a2322d57a3951bb98a413a1eff", "score": "0.4891386", "text": "func (j *Job) Hour() *Job {\n\tj.mustInterval(1)\n\treturn j.Hours()\n}", "title": "" }, { "docid": "229cc37b9ef7483786c890eb89225a22", "score": "0.48856398", "text": "func (o *UsageFargateHour) GetHour() time.Time {\n\tif o == nil || o.Hour == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.Hour\n}", "title": "" }, { "docid": "b4e2874cebeef51cd52a4b7fb3a8793d", "score": "0.48784253", "text": "func New(h, m int) Clock {\n\treturn convert(h*hourMinutes + m)\n}", "title": "" }, { "docid": "371460a858a5f3b9b46c0e3f894c702c", "score": "0.4855091", "text": "func (c *Clock) SetClock() {\n\n}", "title": "" }, { "docid": "217cf050c89d58a208aac7d7fee6f2be", "score": "0.48456252", "text": "func (s *Shift) ProcessHours() {\n\tif s.Duration < time.Minute*30 {\n\t\tif s.Calendar.ScheduleConfig.RoundShiftsUp {\n\t\t\ts.ShiftHours[s.StartDate] = s.Calendar.GetHourTag(s.StartDate)\n\t\t}\n\t\treturn\n\t}\n\tif s.Duration < time.Hour {\n\t\ts.ShiftHours[s.StartDate] = s.Calendar.GetHourTag(s.StartDate)\n\t\treturn\n\t}\n\tstart := s.StartDate.Round(time.Hour)\n\tend := s.EndDate.Add(time.Duration(-31) * time.Minute).Round(time.Hour)\n\ttr := timerange.New(start, end, time.Hour)\n\tfor tr.Next() {\n\t\ts.ShiftHours[tr.Current()] = s.Calendar.GetHourTag(tr.Current())\n\t}\n}", "title": "" }, { "docid": "6023dc4571a251e2a671f00809a90bcd", "score": "0.4843891", "text": "func SetDuration(key string, value time.Duration) {\n SetString(key, value.String())\n}", "title": "" }, { "docid": "1bae298360292a2132d8fb1796fb6e2e", "score": "0.48398682", "text": "func NewUsageRumUnitsHour() *UsageRumUnitsHour {\n\tthis := UsageRumUnitsHour{}\n\treturn &this\n}", "title": "" }, { "docid": "2b19263133e3ebb27a48e676f79c8c96", "score": "0.48332375", "text": "func setTimeOnlyParts(t time.Time, h, m, s, n int) time.Time {\n\treturn time.Date(t.Year(), t.Month(), t.Day(), h, m, s, n, t.Location())\n}", "title": "" }, { "docid": "36e63b34ca955bc14f0a4e03fa6b1978", "score": "0.48330006", "text": "func EndOfHour() Now {\n\treturn MakeTime(time.Now()).EndOfHour()\n}", "title": "" }, { "docid": "5e44c0e92746934c033595ddcf315adf", "score": "0.4828022", "text": "func PutHours(c *gin.Context) {\n\tvar hours PUTHoursSet\n\terr := c.ShouldBindJSON(&hours)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\t// TODO: test / replace with your error format\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t}\n\n\tdata, err := json.Marshal(hours.Set)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t}\n\n\t// determine whether to return 201: Created or 200: OK\n\tfname := hoursFileName(hours.Name)\n\tstatus := http.StatusOK\n\tif _, err := os.Stat(fname); os.IsNotExist(err) {\n\t\t// path/to/whatever does not exist\n\t\tstatus = http.StatusCreated\n\t}\n\n\trw_ := 06\n\tr__ := 04\n\tuserPerms := rw_ << 6\n\tgroupPerms := r__ << 3\n\totherPerms := r__\n\terr = ioutil.WriteFile(fname, data, os.FileMode(userPerms|groupPerms|otherPerms))\n\tif err != nil {\n\t\t// TODO: log the err\n\t\tlog.Println(err)\n\t\t// TODO: better error response?\n\t\tstatus := http.StatusInternalServerError\n\t\tdetail := fmt.Sprintf(INT_SERVR_FMT, c.Request.URL.Path)\n\t\tc.JSON(status, NewError(c, status, detail))\n\t\treturn\n\t}\n\n\tc.Writer.Header().Set(\"Location\", HoursBaseURL+\"/\"+\"findByName/\"+hours.Name)\n\tc.Writer.WriteHeader(status)\n}", "title": "" }, { "docid": "b230053f8b16b3bc80b8e75376d6ecf3", "score": "0.48211455", "text": "func (o *ViewAllocation) SetHoursPerDay(v float32) {\n\to.HoursPerDay = &v\n}", "title": "" }, { "docid": "126de282f3d52996b9263d6540218fdb", "score": "0.48015112", "text": "func Time(hourComponent, minuteComponent int) Clock {\n\tclockObject := new(Clock)\n\n\t// trying to clean up input for negatives & overflows(beyond 24 & 1440)\n\thourComponent = (hourComponent + 24) % 24\n\tminuteComponent = (minuteComponent + MinutesInADay) % MinutesInADay\n\treturn clockObject.setTimeInClock((hourComponent * 60) + minuteComponent)\n}", "title": "" }, { "docid": "8db7ca5904a3c404c4d69b81942b3095", "score": "0.4794468", "text": "func CalculateEXPTime(minutes int) int {\n\treturn minutes * 50\n}", "title": "" }, { "docid": "2b793dcc0c9cf5208bc60dc5414b520c", "score": "0.47940955", "text": "func mysqlTimeFix(t *CoreTime, ctx map[string]int) error {\n\t// Key of the ctx is the format char, such as `%j` `%p` and so on.\n\tif yearOfDay, ok := ctx[\"%j\"]; ok {\n\t\t// TODO: Implement the function that converts day of year to yy:mm:dd.\n\t\t_ = yearOfDay\n\t}\n\tif valueAMorPm, ok := ctx[\"%p\"]; ok {\n\t\tif _, ok := ctx[\"%H\"]; ok {\n\t\t\treturn ErrWrongValue.GenWithStackByArgs(TimeStr, t)\n\t\t}\n\t\tif t.Hour() == 0 {\n\t\t\treturn ErrWrongValue.GenWithStackByArgs(TimeStr, t)\n\t\t}\n\t\tif t.Hour() == 12 {\n\t\t\t// 12 is a special hour.\n\t\t\tswitch valueAMorPm {\n\t\t\tcase constForAM:\n\t\t\t\tt.setHour(0)\n\t\t\tcase constForPM:\n\t\t\t\tt.setHour(12)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif valueAMorPm == constForPM {\n\t\t\tt.setHour(t.getHour() + 12)\n\t\t}\n\t} else {\n\t\tif _, ok := ctx[\"%h\"]; ok && t.Hour() == 12 {\n\t\t\tt.setHour(0)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b6b7c3e9a05d810917c6136baaba669", "score": "0.47925305", "text": "func (c *FixedClock) Set(t time.Time) {\n\tc.t = t.UTC()\n}", "title": "" }, { "docid": "4c1b65c5c416c121170c75646dcdd6d8", "score": "0.47863528", "text": "func (o UsageRumUnitsHour) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.UnparsedObject != nil {\n\t\treturn json.Marshal(o.UnparsedObject)\n\t}\n\tif o.BrowserRumUnits.IsSet() {\n\t\ttoSerialize[\"browser_rum_units\"] = o.BrowserRumUnits.Get()\n\t}\n\tif o.MobileRumUnits.IsSet() {\n\t\ttoSerialize[\"mobile_rum_units\"] = o.MobileRumUnits.Get()\n\t}\n\tif o.OrgName != nil {\n\t\ttoSerialize[\"org_name\"] = o.OrgName\n\t}\n\tif o.PublicId != nil {\n\t\ttoSerialize[\"public_id\"] = o.PublicId\n\t}\n\tif o.RumUnits.IsSet() {\n\t\ttoSerialize[\"rum_units\"] = o.RumUnits.Get()\n\t}\n\n\tfor key, value := range o.AdditionalProperties {\n\t\ttoSerialize[key] = value\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "9cc765129ebbe5e908ed9dc34cee14cc", "score": "0.47823003", "text": "func Add(working time.Time, num int, unit time.Duration) time.Time {\n if num!=0 {\n working = working.Add(time.Duration(num) * unit)\n }\n return working\n}", "title": "" }, { "docid": "24c8886d802262fd7d51ddedb17d8701", "score": "0.47667253", "text": "func (t Time) Unit() *Unit {\n\treturn New(float64(t), Dimensions{\n\t\tTimeDim: 1,\n\t})\n}", "title": "" }, { "docid": "f795e28ab84e20f9b7157422f42c7a3f", "score": "0.47649565", "text": "func (dt DateTime) Hour() int {\n\treturn dt.Time().Hour()\n}", "title": "" }, { "docid": "28cdc8f39d7f0f43aa2746da3bfb9c86", "score": "0.47616634", "text": "func (o *Plano) SetUpd(v time.Time) {\n\to.Upd.Set(&v)\n}", "title": "" }, { "docid": "0d255ba5fb6a2d7d616f36c3d083bce1", "score": "0.47425547", "text": "func setTimespec(sec, nsec int64) Timespec {\n\treturn Timespec{Sec: sec, Nsec: nsec}\n}", "title": "" }, { "docid": "d3fcf71fdffa90b8cb093528cb5e35e8", "score": "0.47361428", "text": "func (period Period) HoursFloat() float32 {\n\treturn float32(period.hours) / 10\n}", "title": "" }, { "docid": "eb214e4dfacc0c319070235ae3d0197e", "score": "0.47358137", "text": "func (c *Carbon) SetMinute(m int) {\n\tc.Time = time.Date(c.Year(), c.Month(), c.Day(), c.Hour(), m, c.Second(), c.Nanosecond(), c.Location())\n}", "title": "" }, { "docid": "a8d39e7b2c4ebb89ee2af1dd45451521", "score": "0.47323477", "text": "func New(h, m int) Clock {\n\n\t// calculate total minutes including the hours\n\tm += h * 60\n\n\t// mintues must be less than a day\n\tm %= 24 * 60\n\n\t// rework out the number of minutes from 24 hour base backwards\n\tif m < 0 {\n\t\tm += 24 * 60\n\t}\n\treturn Clock{m}\n}", "title": "" }, { "docid": "9c95ad889658ae797049b6a236fb15ea", "score": "0.4730908", "text": "func HoursToMinutes(H string) (min string, err error) {\r\n\tvar (\r\n\t\tflStrComps []string\r\n\t\tfPointDot, fPointComma bool\r\n\t\tfPoint string\r\n\t\tintPart, fracPart int\r\n\t\tM int\r\n\t)\r\n\r\n\tdefer func() {\r\n\t\tif rec := recover(); rec != nil {\r\n\t\t\terr = errors.New(kerr.GetRecoverErrorText(rec))\r\n\t\t}\r\n\t}()\r\n\r\n\tif strings.ContainsRune(H, '-') {\r\n\t\tpanic(fmt.Sprintf(\"Плохие часы, со знаком - : %v\", H))\r\n\t}\r\n\r\n\tfPointDot = strings.ContainsRune(H, '.')\r\n\tfPointComma = strings.ContainsRune(H, ',')\r\n\r\n\tif fPointComma && fPointDot {\r\n\t\tpanic(fmt.Sprintf(\"Плохие часы, и с точкой и с зяпятой: %v\", H))\r\n\t}\r\n\r\n\tif fPointDot {\r\n\t\tfPoint = \".\"\r\n\t} else {\r\n\t\tfPoint = \",\"\r\n\t}\r\n\r\n\tflStrComps = strings.Split(H, fPoint)\r\n\r\n\tif len(flStrComps) > 2 {\r\n\t\tpanic(fmt.Sprintf(\"Плохие часы, слишком много отделителей дробной части: %v\", H))\r\n\t}\r\n\r\n\tif intPart, err = strconv.Atoi(flStrComps[0]); err != nil {\r\n\t\tpanic(fmt.Sprintf(\"Беда с целой частью часов: %v\", H))\r\n\t}\r\n\r\n\t//fmt.Printf(\"flStrComps=%v;intPart=%v\\n\", flStrComps, intPart)\r\n\r\n\tif len(flStrComps) == 1 { // no a fractional part\r\n\t\tM = intPart * 60\r\n\t\tmin = strconv.Itoa(M)\r\n\t\treturn\r\n\t}\r\n\r\n\tif fracPart, err = strconv.Atoi(flStrComps[1]); err != nil {\r\n\t\tpanic(fmt.Sprintf(\"Беда с дробной частью часов: %v\", H))\r\n\t}\r\n\r\n\tswitch {\r\n\tcase fracPart < 10:\r\n\t\tfracPart = fracPart * 10\r\n\tcase fracPart > 10:\r\n\t\tfracPart = int(fracPart / 10)\r\n\t}\r\n\r\n\t//fmt.Printf(\"intPart=%v, fracPart=%v, M=%v\\n\", intPart, fracPart, M)\r\n\r\n\tM = intPart*60 + (fracPart*60)/100\r\n\r\n\tmin = strconv.Itoa(M)\r\n\treturn\r\n\r\n}", "title": "" }, { "docid": "7f90a372b0ceb1d65782e7c94de5b98e", "score": "0.47265106", "text": "func (dt DateTime) EndOfHour() DateTime {\n\tdt = dt.StartOfHour()\n\tt := dt.Time().Add(time.Hour - time.Nanosecond)\n\tdt.setTime(t)\n\treturn dt\n}", "title": "" }, { "docid": "1399cb0fd5065b9582b070d783352935", "score": "0.47155315", "text": "func (o KerberosConfigOutput) TgtLifetimeHours() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v KerberosConfig) *int { return v.TgtLifetimeHours }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "70221804d755268db8ddc2c287d8837f", "score": "0.47138306", "text": "func (dt DateTime) StartOfHour() DateTime {\n\ty, m, d := dt.Date()\n\tt := time.Date(y, m, d, dt.Hour(), 0, 0, 0, dt.Location())\n\tdt.setTime(t)\n\treturn dt\n}", "title": "" } ]
ef95f2dde86f8b8f4c280f55021667e0
Size returns the value of the 'size' parameter. Maximum number of items that will be contained in the returned page. Default value is `100`.
[ { "docid": "623c26bfdad669e18fc260c9a7793337", "score": "0.6298731", "text": "func (r *QuotaSummaryListServerRequest) Size() int {\n\tif r != nil && r.size != nil {\n\t\treturn *r.size\n\t}\n\treturn 0\n}", "title": "" } ]
[ { "docid": "1b1232cb0871b3f177dc8b25912fa07c", "score": "0.7295324", "text": "func (it *SubscriptionIterator) PageSize() int {\n\treturn int(it.pageSize)\n}", "title": "" }, { "docid": "45e89d7647a5e4d392ef09322b359eab", "score": "0.7203051", "text": "func (it *MonitoredResourceDescriptorIterator) PageSize() int {\n\treturn int(it.pageSize)\n}", "title": "" }, { "docid": "6f177863847fc898f7e33ecf142797e3", "score": "0.70361495", "text": "func (o CosmosDbSqlApiSourceResponseOutput) PageSize() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbSqlApiSourceResponse) interface{} { return v.PageSize }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b28d0d462db1120916d84e33761604b2", "score": "0.70356905", "text": "func (c *LevelCollection) Size(fetchAllPages bool) int {\n\tlength := len(c.Data)\n\tif c.limit > 0 && length > c.limit {\n\t\tlength = c.limit\n\t}\n\n\t// we have a simple collection if no pagination information is set\n\tif len(c.Pagination.Links) == 0 && c.Pagination.Max == 0 {\n\t\treturn length\n\t}\n\n\t// we have only one page\n\tif c.Pagination.Size < c.Pagination.Max {\n\t\treturn length\n\t}\n\n\tif !fetchAllPages {\n\t\treturn -1\n\t}\n\n\tcount := 0\n\n\tc.Walk(func(item *Level) bool {\n\t\tcount++\n\t\treturn true\n\t})\n\n\treturn count\n}", "title": "" }, { "docid": "05656ee91107db1675287bac0ac1b54c", "score": "0.70183", "text": "func (it *LogEntryIterator) PageSize() int {\n\treturn int(it.pageSize)\n}", "title": "" }, { "docid": "84b7f853aec75e077f77f789315ac59d", "score": "0.6976775", "text": "func (o CosmosDbSqlApiSourceOutput) PageSize() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbSqlApiSource) interface{} { return v.PageSize }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b9e17c2e103457e1f89ff4fd63454aa2", "score": "0.6943761", "text": "func (o *SearchResultPage) GetSize() int64 {\n\tif o == nil || o.Size == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Size\n}", "title": "" }, { "docid": "f5b2b5d8e26af25cfbe598557e13549e", "score": "0.6933561", "text": "func PageSize(n int) ListOption {\n\tif n < 0 {\n\t\tn = 0\n\t}\n\treturn pageSizeOpt(n)\n}", "title": "" }, { "docid": "4820c34aee6f60d44d0f279b722fab3c", "score": "0.6898027", "text": "func (c B64Cursor) PageSize() int32 {\n\treturn c.pageSize\n}", "title": "" }, { "docid": "a1bfafdd2025848ea077bf774bce7e58", "score": "0.6782476", "text": "func (ctrl *sharedController) PageSize() int32 {\n\treturn ctrl.pageSize\n}", "title": "" }, { "docid": "2e4b2e30f4362b0022a06d523abb5805", "score": "0.6768924", "text": "func (_this *StatsReport) Size() int {\n\tvar ret int\n\tvalue := _this.Value_JS.Get(\"size\")\n\tret = (value).Int()\n\treturn ret\n}", "title": "" }, { "docid": "7688f75dee365641b4bda8c04c52743b", "score": "0.67320436", "text": "func (page *PageScore) GetSize() string {\n\treturn page.PageSize\n}", "title": "" }, { "docid": "62a9b020031dfa2e5d96cd588abaf54a", "score": "0.6731463", "text": "func (p *PageMaster) PageSize() *int64 {\n\treturn &p.pageSize\n}", "title": "" }, { "docid": "2ba67b466790a2d56b2b81455599e9ee", "score": "0.6709424", "text": "func (i *item) Size() (int64, error) {\n\treturn *i.properties.Size, nil\n}", "title": "" }, { "docid": "a50acf8bb93ac0d9e520f3ad7e967a8b", "score": "0.6672473", "text": "func (r *QuotaSummaryListServerResponse) Size(value int) *QuotaSummaryListServerResponse {\n\tr.size = &value\n\treturn r\n}", "title": "" }, { "docid": "d4cd5240944b2ed549020482ac5d0132", "score": "0.6646333", "text": "func (m *SearchRequest) GetSize()(*int32) {\n return m.size\n}", "title": "" }, { "docid": "7903f31b4035a99636a7c4a48fec4138", "score": "0.663585", "text": "func Size(n int64, s source.Func) source.Func {\n\treturn func(p string) (string, io.ReadCloser, error) {\n\t\tname, r, err := s.Readfrom(p)\n\t\tif err != nil {\n\t\t\treturn name, r, err\n\t\t}\n\n\t\tvar setName = func(l *Limited) {\n\t\t\tl.Name = name\n\t\t}\n\n\t\treturn name, NewLimited(n, r, setName), nil\n\t}\n}", "title": "" }, { "docid": "eebc276f1c374e926324c9b92319c58f", "score": "0.6631638", "text": "func Size(size uint64) string {\n\treturn units.BytesSize(float64(size))\n}", "title": "" }, { "docid": "f5811949ad2db63943c1bb678c0fb04a", "score": "0.66301703", "text": "func (o FirehoseDeliveryStreamExtendedS3ConfigurationDataFormatConversionConfigurationOutputFormatConfigurationSerializerParquetSerDeOutput) PageSizeBytes() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v FirehoseDeliveryStreamExtendedS3ConfigurationDataFormatConversionConfigurationOutputFormatConfigurationSerializerParquetSerDe) *int {\n\t\treturn v.PageSizeBytes\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "88087915f277ba5b42befbaee7378133", "score": "0.6613037", "text": "func (sum *Summary) Size() int64 {\n\treturn int64(len(sum.entries))\n}", "title": "" }, { "docid": "cc096a164d6c33c2a80cf0be907a6dd8", "score": "0.66055757", "text": "func (r *Response) Size() int64 {\n\treturn r.size\n}", "title": "" }, { "docid": "7287632db6b25e445981f5c7fed3f80f", "score": "0.6603353", "text": "func (c *Collection) Size() int {\n\treturn len(c.items)\n}", "title": "" }, { "docid": "d5a64519be2046b1c4584e9deb4ceff8", "score": "0.6589031", "text": "func (m *AgoutiPage) Size(width, height int) error {\n\treturn m.page.Size(width, height)\n}", "title": "" }, { "docid": "d4682f222e5aca2d84c93433d19d3c39", "score": "0.6579493", "text": "func (s *Service) Size(bytes []byte) ([]byte, error) {\n\treturn proto.Marshal(&SizeResponse{\n\t\tSize_: uint32(len(s.values)),\n\t})\n}", "title": "" }, { "docid": "5a1b1df4f28e0b80fb35edca363694f0", "score": "0.6571414", "text": "func (s *ListSavingsFlexibleProductsService) Size(size int64) *ListSavingsFlexibleProductsService {\n\ts.size = size\n\treturn s\n}", "title": "" }, { "docid": "5f4a9ef0b2be23f0fc9217a92be3e5af", "score": "0.6568494", "text": "func (op *GetDSGroupUsersOp) PageSize(val int) *GetDSGroupUsersOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"page_size\", fmt.Sprintf(\"%d\", val))\n\t}\n\treturn op\n}", "title": "" }, { "docid": "4bb31192cbbf0b73dbfca0609ca116ee", "score": "0.65197545", "text": "func (r *ResponseStats) Size() int64 {\n\treturn r.size\n}", "title": "" }, { "docid": "33e9f28ed1d3b02757644376797b617a", "score": "0.6496897", "text": "func (s *StakingHistoryService) Size(size int32) *StakingHistoryService {\n\ts.size = &size\n\treturn s\n}", "title": "" }, { "docid": "33ea771f1c4ad38e2be4660ff431a8f0", "score": "0.64950514", "text": "func (b BaseStorageAdapter) Size(nameSpace string) int64 {\n\tllen := b.client.LLen(nameSpace)\n\n\tif llen.Err() != nil {\n\t\tlog.Error.Println(llen.Err())\n\t\treturn 0\n\t}\n\n\treturn llen.Val()\n}", "title": "" }, { "docid": "ed68133329ebf2567c809e80f7abec13", "score": "0.64756095", "text": "func (r *File) Size(ctx context.Context) (int, error) {\n\tq := r.q.Select(\"size\")\n\n\tvar response int\n\tq = q.Bind(&response)\n\treturn response, q.Execute(ctx, r.c)\n}", "title": "" }, { "docid": "fac2be85bf7c3fdb5ae6720a9fd3284c", "score": "0.64720273", "text": "func (op *GetDSGroupsOp) PageSize(val int) *GetDSGroupsOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"page_size\", fmt.Sprintf(\"%d\", val))\n\t}\n\treturn op\n}", "title": "" }, { "docid": "5a3f6f8c1b42cd1b11272f57cc7189a0", "score": "0.64694035", "text": "func (o LookupBucketObjectResultOutput) Size() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupBucketObjectResult) string { return v.Size }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "844facbb483ae437d438c8a450e11f81", "score": "0.6466715", "text": "func (s *ItemSet) Size() int {\r\n return len(s.items)\r\n}", "title": "" }, { "docid": "446257bfaa3489b866a10c252b94429d", "score": "0.6465618", "text": "func PageSize(db *sql.DB) (PageSizeValue, error) {\n\treturn noSchema.PageSize(db)\n}", "title": "" }, { "docid": "34d03ee0c39499a5c5159209e93fc3f9", "score": "0.6465577", "text": "func (o FirehoseDeliveryStreamExtendedS3ConfigurationDataFormatConversionConfigurationOutputFormatConfigurationSerializerParquetSerDePtrOutput) PageSizeBytes() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *FirehoseDeliveryStreamExtendedS3ConfigurationDataFormatConversionConfigurationOutputFormatConfigurationSerializerParquetSerDe) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PageSizeBytes\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "98be5370d25e9d38102dd3f574d9a9e4", "score": "0.64649475", "text": "func Size(v interface{}) int", "title": "" }, { "docid": "2a1fc64205c10747a8a6b4e62fc59d15", "score": "0.6464623", "text": "func (p *PageInformationSegment) Size() int {\n\treturn 19\n}", "title": "" }, { "docid": "1b3e9e7723f2b4bf4c0320d02806239a", "score": "0.6450795", "text": "func (s *ScrollService) Size(size int) *ScrollService {\n\ts.size = &size\n\treturn s\n}", "title": "" }, { "docid": "8eaebd4dbbda14a4db055f4b3428d186", "score": "0.64222753", "text": "func (o *ResourceAllOf) GetSize() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Size\n}", "title": "" }, { "docid": "540a8c6258226d43ea7fc45b6aa63951", "score": "0.6420315", "text": "func (s *Set) Size(ctx context.Context) (int, error) {\n\trequest := codec.EncodeSetSizeRequest(s.name)\n\tif response, err := s.invokeOnPartition(ctx, request, s.partitionID); err != nil {\n\t\treturn 0, err\n\t} else {\n\t\treturn int(codec.DecodeSetSizeResponse(response)), nil\n\t}\n}", "title": "" }, { "docid": "942d7f9fcb9f7c4df6085e8c81314542", "score": "0.6395705", "text": "func (b Bitfield) PageSize() int {\n\treturn b.pager.PageSize()\n}", "title": "" }, { "docid": "e198fd1e68d46013123ee9fc42751bfd", "score": "0.63893193", "text": "func (q *Queue) Size(ctx context.Context) (int64, error) {\n\treturn q.collection.CountDocuments(ctx, bson.D{}, options.Count())\n}", "title": "" }, { "docid": "8f3d3f4e630957bf396d12e6dcc39639", "score": "0.63883275", "text": "func Size() (int, error) { return cfg.Size() }", "title": "" }, { "docid": "e2050f496aebc9c6d58170954cbbe28a", "score": "0.63870907", "text": "func (r *SizedReader) Size() int64 { return r.size }", "title": "" }, { "docid": "44f4f42d86e7a4e1ca47a9204ddb6282", "score": "0.63829136", "text": "func (r Jobs) Size() int {\n\treturn len(r.items)\n}", "title": "" }, { "docid": "f244b36d009f705a9fff78edf843e72a", "score": "0.63813484", "text": "func (o StaticWebLayerEbsVolumeOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v StaticWebLayerEbsVolume) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "ac3fe008c3d413e144f92b9c1ea2f198", "score": "0.6377125", "text": "func Size() int {\n\tx := batchSize\n\tif x == nil {\n\t\treturn defaultSize\n\t}\n\treturn *x\n}", "title": "" }, { "docid": "8a751cd0575d47f4b30eb8832ad37c7e", "score": "0.6373623", "text": "func (r *SizeReader) Size() int64 {\n\treturn r.size\n}", "title": "" }, { "docid": "8392c80829c269356753e5115b1979e9", "score": "0.63733554", "text": "func (r *RequestDataRequest) PageSize(v int) *RequestDataRequest {\n\tr.opts[\"pageSize\"] = v\n\treturn r\n}", "title": "" }, { "docid": "b46d69d75bc4bf12bf1424b08629c1f2", "score": "0.6365527", "text": "func (r Response) Size() int {\n\treturn r.size\n}", "title": "" }, { "docid": "9b5e594f53ad1fdd58ac2c2954dc9b82", "score": "0.63604075", "text": "func (s *SeekingHTTP) Size() (int64, error) {\n\tif err := s.init(); err != nil {\n\t\treturn 0, err\n\t}\n\n\treq, err := s.newreq()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treq.Method = \"HEAD\"\n\n\tresp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif resp.ContentLength < 0 {\n\t\treturn 0, errors.New(\"no content length for Size()\")\n\t}\n\n\treturn resp.ContentLength, nil\n}", "title": "" }, { "docid": "0bb2f4e36ac5a67b1b144d02d979d6e0", "score": "0.635237", "text": "func (r *QueryApiKeys) Size(size int) *QueryApiKeys {\n\tr.req.Size = &size\n\n\treturn r\n}", "title": "" }, { "docid": "248081a82e8c31854cbc965a60883649", "score": "0.63481456", "text": "func (o EcsDiskOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *EcsDisk) pulumi.IntOutput { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "a5a245b36ec49491c1c1bf27e61a4e00", "score": "0.63478386", "text": "func (p *Percentile[valueType]) Size() int {\n\treturn p.size\n}", "title": "" }, { "docid": "8deb94b810bb1f05effa49b234d46579", "score": "0.6341093", "text": "func (o LookupShareResultOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupShareResult) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "bd007c6c009997d3cd9973b3c04dc981", "score": "0.6339031", "text": "func (r *UsersListServerResponse) Size(value int) *UsersListServerResponse {\n\tr.size = &value\n\treturn r\n}", "title": "" }, { "docid": "b836fcdc2f73bb3f538e78828b9c3575", "score": "0.63082695", "text": "func (a *archive) Size() string {\n\treturn fmt.Sprintf(\"%.1fMB\", float64(len(a.data))/(1<<20))\n}", "title": "" }, { "docid": "fcf9161db6387d260779b107f9ae89bc", "score": "0.6307802", "text": "func (s *Schema) PageSize(db *sql.DB) (PageSizeValue, error) {\n\tvar dest PageSizeValue\n\treturn dest, s.pragma(db, pageSize, &dest)\n}", "title": "" }, { "docid": "bafe3e38b57909196e4344281a4af0fb", "score": "0.6291247", "text": "func (o *baseObject) Size() int64 {\n\treturn o.bytes\n}", "title": "" }, { "docid": "f0d873c919a1e4986d9344e5df62d282", "score": "0.6285785", "text": "func (s *ReindexService) Size(size int) *ReindexService {\n\ts.size = &size\n\treturn s\n}", "title": "" }, { "docid": "715a586cbe517bc68f999c6a2bfca77f", "score": "0.6281238", "text": "func (c *ReferencesBasesListCall) PageSize(pageSize int64) *ReferencesBasesListCall {\n\tc.urlParams_.Set(\"pageSize\", fmt.Sprint(pageSize))\n\treturn c\n}", "title": "" }, { "docid": "aac273f787ffb3478802e3887035e51f", "score": "0.6276435", "text": "func (d *Response) Size() int {\n\tvar size uint64\n\tsize += 11\n\tsize += 11 + uint64(len(d.Result))\n\tsize += 11 + uint64(len(d.Leader))\n\treturn int(size)\n}", "title": "" }, { "docid": "016da61eb0c292308bdc5eab16bc59c4", "score": "0.6274208", "text": "func (o CompanyOutput) Size() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Company) pulumi.StringOutput { return v.Size }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c3b8db4be209bcec54b68108c37c7ebb", "score": "0.62728316", "text": "func (rl *ResourceList) Size() int {\n\tvar totalSize int\n\tfor _, resource := range *rl {\n\t\ttotalSize += resource.Size()\n\t\ttotalSize += len(deliRes)\n\t}\n\treturn totalSize\n}", "title": "" }, { "docid": "4849cd15864011ca559697098359f1d8", "score": "0.62519866", "text": "func (o LookupRepoResultOutput) Size() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRepoResult) string { return v.Size }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "97ad48f4d76c93af2c9482ec594e61b3", "score": "0.62508297", "text": "func (c *CustomersPolicySchemasListCall) PageSize(pageSize int64) *CustomersPolicySchemasListCall {\n\tc.urlParams_.Set(\"pageSize\", fmt.Sprint(pageSize))\n\treturn c\n}", "title": "" }, { "docid": "5e029da54508ddd8b76f1921f5166112", "score": "0.6246217", "text": "func (o *ReposResponse) GetPageSize() float32 {\n\tif o == nil || o.PageSize == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\treturn *o.PageSize\n}", "title": "" }, { "docid": "9c18c296ce923f0a991afdc6c86ddc39", "score": "0.624362", "text": "func (r *Request) PageSize(size int) *Request {\n\tif size > 0 && size <= 100 {\n\t\tr.pageSize = size\n\t} else {\n\t\tr.pageSize = 50\n\t}\n\treturn r\n}", "title": "" }, { "docid": "6674ea16f92df51a9cafa671661b551c", "score": "0.6242017", "text": "func (o RepoOutput) Size() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Repo) pulumi.StringOutput { return v.Size }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9cbf40b1bd067ba6f8197801a781c268", "score": "0.6233538", "text": "func (cr *DyldSharedCacheReader) Size() int64 { return cr.limit - cr.base }", "title": "" }, { "docid": "b3cb18965c2ba781f38bfe296688e58f", "score": "0.6230447", "text": "func (r *AddOnsListServerResponse) Size(value int) *AddOnsListServerResponse {\n\tr.size = &value\n\treturn r\n}", "title": "" }, { "docid": "5cb6b0cda361441d030aa9a349473070", "score": "0.622698", "text": "func (it *Iterator) Size() int {\n\treturn len(it.data)\n}", "title": "" }, { "docid": "0a6ac8118527e3e917bf46f753796ae0", "score": "0.62077147", "text": "func (o GetDisksDiskOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetDisksDisk) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "81a5b15eb3a9aa6c31c2f0fd8e6c6a08", "score": "0.6205889", "text": "func (q *QueryDocumentSet) Size() int {\n\treturn len(q.documents)\n}", "title": "" }, { "docid": "4f072749fa440a30c6ad54e48d423c05", "score": "0.6204045", "text": "func Size(list []interface{}) int {\n\treturn len(list)\n}", "title": "" }, { "docid": "31a292511d8d7bb46fd9a83696a47ff1", "score": "0.6202791", "text": "func (p *provider) Size(meta objstorage.ObjectMetadata) (int64, error) {\n\tif !meta.IsRemote() {\n\t\treturn p.vfsSize(meta.FileType, meta.DiskFileNum)\n\t}\n\treturn p.remoteSize(meta)\n}", "title": "" }, { "docid": "ab4dfe64ea7c4006101827b8fde46a4c", "score": "0.620137", "text": "func Size(n uint64) uint64 {\n\treturn uint64(math.Floor(float64(n)/Byte)) + 1\n}", "title": "" }, { "docid": "70444f720ee03185bff0bcaa554aa278", "score": "0.61963594", "text": "func (o MysqlLayerEbsVolumeOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v MysqlLayerEbsVolume) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "065a342c005b33cca9ddffc7e0329d38", "score": "0.619622", "text": "func (sl SignedBList) Size() uint {\n\treturn uint(len(sl.Content))\n}", "title": "" }, { "docid": "7e7c3f3c151d5303caaa771345f5f670", "score": "0.61884433", "text": "func (o *Ga4ghSearchReadGroupSetsRequest) GetPageSize() int32 {\n\tif o == nil || o.PageSize == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.PageSize\n}", "title": "" }, { "docid": "cec56e85e47e6f1626a5e3d09e43853e", "score": "0.6182453", "text": "func (o *Object) Size() int64 {\n return o.size\n}", "title": "" }, { "docid": "aa2ee9a0a1280e26a9ae5dbb39f848cb", "score": "0.6173665", "text": "func (r ApiAlertGetRequest) PageSize(pageSize int32) ApiAlertGetRequest {\n\tr.pageSize = &pageSize\n\treturn r\n}", "title": "" }, { "docid": "c6ad9d419cb65c6f64838b079774b8d6", "score": "0.61665446", "text": "func (o SkuResponseOutput) Size() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SkuResponse) *string { return v.Size }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c649f7dec44dda4aa0bf0161a76dffa1", "score": "0.61650485", "text": "func (o JavaAppLayerEbsVolumeOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v JavaAppLayerEbsVolume) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "f499b9968ccab4868bcbd50fe0e7a53f", "score": "0.6156432", "text": "func Size() int64 {\n\treturn bufferSize\n}", "title": "" }, { "docid": "9b6c000ea54943596c32a7f539c797bc", "score": "0.61537683", "text": "func (o WebAclRuleStatementSizeConstraintStatementOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementSizeConstraintStatement) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "e9b7c158a02f401072a484e63868c9de", "score": "0.6146936", "text": "func (l *LinkList) Size() int {\n\treturn l.n\n}", "title": "" }, { "docid": "e5d7e564a3bf1d22bace286e2ff4775b", "score": "0.6144539", "text": "func (q *Q) Size() int {\n\treturn q.list.Len()\n}", "title": "" }, { "docid": "7a43c5df124540093a3e494a32611380", "score": "0.6141688", "text": "func (s *Set) Size() int {\n\tif s == nil {\n\t\treturn 0\n\t}\n\treturn len(s.items)\n}", "title": "" }, { "docid": "112c56eeee42fb244c380ec693dd88e7", "score": "0.6137357", "text": "func (result *QueryResultImpl) TotalSize() int {\n\treturn result.response.TotalSize\n}", "title": "" }, { "docid": "516f745ad1f4e33bc2c3213e77a555b6", "score": "0.61365145", "text": "func (c *ProjectsAgentKnowledgeBasesListCall) PageSize(pageSize int64) *ProjectsAgentKnowledgeBasesListCall {\n\tc.urlParams_.Set(\"pageSize\", fmt.Sprint(pageSize))\n\treturn c\n}", "title": "" }, { "docid": "133d79eed7a91b2f054fbe31c743a3ec", "score": "0.61360264", "text": "func (c *Configuration) Size() int {\n\treturn c.n\n}", "title": "" }, { "docid": "133d79eed7a91b2f054fbe31c743a3ec", "score": "0.61360264", "text": "func (c *Configuration) Size() int {\n\treturn c.n\n}", "title": "" }, { "docid": "133d79eed7a91b2f054fbe31c743a3ec", "score": "0.61360264", "text": "func (c *Configuration) Size() int {\n\treturn c.n\n}", "title": "" }, { "docid": "c919315e4e07c420f9efef7eff334a5d", "score": "0.61329854", "text": "func (a *archive) Size() int64 {\n\treturn a.size\n}", "title": "" }, { "docid": "ae1161f807930904583f4d01f01b4abb", "score": "0.6132776", "text": "func (_Permissioning *PermissioningSession) GetSize() (*big.Int, error) {\n\treturn _Permissioning.Contract.GetSize(&_Permissioning.CallOpts)\n}", "title": "" }, { "docid": "5ac9db2452078b372c2bcb3e84b6bb98", "score": "0.6131494", "text": "func (o LookupNFSResultOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupNFSResult) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "368c922c9d7f2801753c8f55b73f0d5d", "score": "0.61311656", "text": "func (c *TickerResponse) Size() int {\n\treturn len(c.TickerList)\n}", "title": "" }, { "docid": "a8a36c3a7c7f3e6b494cc16f439ba1ac", "score": "0.6130488", "text": "func (wi walkInfoContainer) Size() int64 {\n\treturn wi.FileInfoFields.Size\n}", "title": "" }, { "docid": "dab063dae0591d891ce85658baf6749e", "score": "0.61302704", "text": "func (o LookupArtifactResultOutput) SizeBytes() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupArtifactResult) int { return v.SizeBytes }).(pulumi.IntOutput)\n}", "title": "" } ]
1823e15766513c727bbdd3c4c506bde9
Transact invokes the (paid) contract method with params as input values.
[ { "docid": "547945b175829bce106d15373f5d0afb", "score": "0.0", "text": "func (_EthEvents *EthEventsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _EthEvents.Contract.EthEventsTransactor.contract.Transact(opts, method, params...)\n}", "title": "" } ]
[ { "docid": "78131597a5e3124ebcf39765ff8ba21b", "score": "0.6792731", "text": "func (_Parameters *ParametersTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Parameters.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "a4cd6091f6f02c89e4901954de187f37", "score": "0.6653003", "text": "func (_Parameters *ParametersRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Parameters.Contract.ParametersTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "ee504e0e98a17460bb29ba2b8ca59a7e", "score": "0.6648488", "text": "func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...interface{}) (*types.UnsignedTransaction, *types.Hash, error) {\n\t// Otherwise pack up the parameters and invoke the contract\n\tinput, err := c.abi.Pack(method, params...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// todo(rjl493456442) check the method is payable or not,\n\t// reject invalid transaction at the first place\n\treturn c.transact(opts, &c.address, input)\n}", "title": "" }, { "docid": "3af82fb43b86ff95d6cf0631e9cc95a2", "score": "0.6617447", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\r\n\tfmt.Println(\"Invoke################################################################################\")\r\n\tfmt.Println(\"######################################################################################\")\r\n\t// Retrieve the requested Smart Contract function and arguments\r\n\tfunction, args := APIstub.GetFunctionAndParameters()\r\n\t// Route to the appropriate handler function to interact with the ledger appropriately\r\n\tif function == \"initLedger\" {\r\n\t\treturn s.initLedger(APIstub)\r\n\t} else if function == \"queryPaper\" {\r\n\t\treturn s.queryPaper(APIstub, args)\r\n\t}\r\n\t// } else if function == \"getMyPapers\" {\r\n\t// \treturn s.getMyPapers(APIstub, args)\r\n\t// } else if function == \"releaseEndorseById\" {\r\n\t// \treturn s.releaseEndorseById(APIstub, args)\r\n\t// } else if function == \"releaseAcceptById\" {\r\n\t// \treturn s.releaseAcceptById(APIstub, args)\r\n\t// } else if function == \"releaseDiscountById\" {\r\n\t// \treturn s.releaseDiscountById(APIstub, args)\r\n\t// } else if function == \"revokeDiscountById\" {\r\n\t// \treturn s.revokeDiscountById(APIstub, args)\r\n\t// } else if function == \"releasePressById\" {\r\n\t// \treturn s.releasePressById(APIstub, args)\r\n\t// } else if function == \"drawPaper\" {\r\n\t// \treturn s.drawPaper(APIstub, args)\r\n\t// } else if function == \"getMyPayingPapers\" {\r\n\t// \treturn s.getMyPayingPapers(APIstub, args)\r\n\t// } else if function == \"payPaperById\" {\r\n\t// \treturn s.payPaperById(APIstub, args)\r\n\t// } else if function == \"responseYesPressById\" {\r\n\t// \treturn s.responseYesPressById(APIstub, args)\r\n\t// } else if function == \"getDiscountingPapers\" {\r\n\t// \treturn s.getDiscountingPapers(APIstub, args)\r\n\t// } else if function == \"responseYesDiscountById\" {\r\n\t// \treturn s.responseYesDiscountById(APIstub, args)\r\n\t// } else if function == \"getAcceptingPapers\" {\r\n\t// \treturn s.getAcceptingPapers(APIstub, args)\r\n\t// } else if function == \"responseEndorsingById\" {\r\n\t// \treturn s.responseEndorsingById(APIstub, args)\r\n\t// } else if function == \"getEndorsingPapers\" {\r\n\t// \treturn s.getEndorsingPapers(APIstub, args)\r\n\t// } else if function == \"responseAcceptById\" {\r\n\t// \treturn s.responseAcceptById(APIstub, args)\r\n\t// } else if function == \"releaseAcceptForHonourById\" {\r\n\t// \treturn s.releaseAcceptForHonourById(APIstub, args)\r\n\t// } else if function == \"getAcceptingForHonourPapers\" {\r\n\t// \treturn s.getAcceptingForHonourPapers(APIstub, args)\r\n\t// } else if function == \"responseAcceptForHonourById\" {\r\n\t// \treturn s.responseAcceptForHonourById(APIstub, args)\r\n\t// } else if function == \"responseRankById\" {\r\n\t// \treturn s.responseRankById(APIstub, args)\r\n\t// } else if function == \"getUserPapersById\" {\r\n\t// \treturn s.getUserPapersById(APIstub, args)\r\n\t// } else if function == \"getPaperLogsById\" {\r\n\t// \treturn s.getPaperLogsById(APIstub, args)\r\n\t// } else if function == \"getOperatingLogsById\" {\r\n\t// \treturn s.getOperatingLogsById(APIstub, args)\r\n\t// }\r\n\r\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\r\n}", "title": "" }, { "docid": "1b7329c8198fb83763a148e00dced41a", "score": "0.6579452", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A, B string // Entities\n\tvar Aval, Bval int // Asset holdings\n\tvar X int // Transaction value\n\tvar err error\n\n\tif len(args) != 3 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\n\t}\n\n\tA = args[0]\n\tB = args[1]\n\n\t// Get the state from the ledger\n\t// TODO: will be nice to have a GetAllState call to ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get state\")\n\t}\n\tif Avalbytes == nil {\n\t\treturn shim.Error(\"Entity not found\")\n\t}\n\tAval, _ = strconv.Atoi(string(Avalbytes))\n\n\tBvalbytes, err := stub.GetState(B)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get state\")\n\t}\n\tif Bvalbytes == nil {\n\t\treturn shim.Error(\"Entity not found\")\n\t}\n\tBval, _ = strconv.Atoi(string(Bvalbytes))\n\n\t// Perform the execution\n\tX, err = strconv.Atoi(args[2])\n\tif err != nil {\n\t\treturn shim.Error(\"Invalid transaction amount, expecting a integer value\")\n\t}\n\tAval = Aval - X\n\tBval = Bval + X\n\tfmt.Printf(\"Aval = %d, Bval = %d\\n\", Aval, Bval)\n\n\t// Write the state back to the ledger\n\terr = stub.PutState(A, []byte(strconv.Itoa(Aval)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\terr = stub.PutState(B, []byte(strconv.Itoa(Bval)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "43b0ad8e4ec4f2bccaa01181ccdd17e2", "score": "0.65632695", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"queryCar\" {\n\t\treturn s.queryCar(APIstub, args)\n\t} else if function == \"createCar\" {\n\t\treturn s.createCar(APIstub, args)\n\t} else if function == \"queryCars\" {\n\t\treturn s.queryCars(APIstub)\n\t} else if function == \"changeCar\" {\n\t\treturn s.changeCar(APIstub, args)\n\t} else if function == \"queryAgent\" {\n\t\treturn s.queryAgent(APIstub, args)\n\t} else if function == \"createAgent\" {\n\t\treturn s.createAgent(APIstub, args)\n\t} else if function == \"queryAgents\" {\n\t\treturn s.queryAgents(APIstub)\n\t} else if function == \"changeAgent\" {\n\t\treturn s.changeAgent(APIstub, args)\n\t} else if function == \"queryDiploma\" {\n\t\treturn s.queryDiploma(APIstub, args)\n\t} else if function == \"createDiploma\" {\n\t\treturn s.createDiploma(APIstub, args)\n\t} else if function == \"queryDiplomas\" {\n\t\treturn s.queryDiplomas(APIstub)\n\t} else if function == \"changeDiploma\" {\n\t\treturn s.changeDiploma(APIstub, args)\n\t} else if function == \"querySkill\" {\n\t\treturn s.querySkill(APIstub, args)\n\t} else if function == \"createSkill\" {\n\t\treturn s.createSkill(APIstub, args)\n\t} else if function == \"querySkills\" {\n\t\treturn s.querySkills(APIstub)\n\t} else if function == \"changeSkill\" {\n\t\treturn s.changeSkill(APIstub, args)\n\t} else if function == \"queryProject\" {\n\t\treturn s.queryProject(APIstub, args)\n\t} else if function == \"createProject\" {\n\t\treturn s.createProject(APIstub, args)\n\t} else if function == \"queryProjects\" {\n\t\treturn s.queryProjects(APIstub)\n\t} else if function == \"changeProject\" {\n\t\treturn s.changeProject(APIstub, args)\n\t} else if function == \"queryParticipant\" {\n\t\treturn s.queryParticipant(APIstub, args)\n\t} else if function == \"createParticipant\" {\n\t\treturn s.createParticipant(APIstub, args)\n\t} else if function == \"queryParticipants\" {\n\t\treturn s.queryParticipants(APIstub)\n\t} else if function == \"changeParticipant\" {\n\t\treturn s.changeParticipant(APIstub, args)\n\t} else if function == \"queryProjectskill\" {\n\t\treturn s.queryProjectskill(APIstub, args)\n\t} else if function == \"createProjectskill\" {\n\t\treturn s.createProjectskill(APIstub, args)\n\t} else if function == \"queryProjectskills\" {\n\t\treturn s.queryProjectskills(APIstub)\n\t} else if function == \"changeProjectskill\" {\n\t\treturn s.changeProjectskill(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "15db3a74e02ca067e6aed2f94c45fb7f", "score": "0.6555388", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A, B string // Entities\n\tvar Aval, Bval int // Asset holdings\n\tvar X, Y int // Transaction value\n\tvar err error\n\n\tif len(args) != 4 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 4\")\n\t}\n\n\tA = args[0]\n\tB = args[1]\n\n\t// Get the state from the ledger\n\t// TODO: will be nice to have a GetAllState call to ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get state\")\n\t}\n\tif Avalbytes == nil {\n\t\treturn shim.Error(\"Entity not found\")\n\t}\n\tAval, _ = strconv.Atoi(string(Avalbytes))\n\n\tBvalbytes, err := stub.GetState(B)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get state\")\n\t}\n\tif Bvalbytes == nil {\n\t\treturn shim.Error(\"Entity not found\")\n\t}\n\tBval, _ = strconv.Atoi(string(Bvalbytes))\n\n\t// Perform the execution\n\tX, err = strconv.Atoi(args[2])\n\tif err != nil {\n\t\treturn shim.Error(\"Invalid transaction amount, expecting a integer value\")\n\t}\n\n\tY, err = strconv.Atoi(args[3])\n\tif err != nil {\n\t\treturn shim.Error(\"Invalid transaction amount, expecting a integer value\")\n\t}\n\n\tAval = Aval - X\n\tBval = Bval + Y\n\tfmt.Printf(\"Aval = %d, Bval = %d\\n\", Aval, Bval)\n\n\t// Write the state back to the ledger\n\terr = stub.PutState(A, []byte(strconv.Itoa(Aval)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\terr = stub.PutState(B, []byte(strconv.Itoa(Bval)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success([]byte(\"ok\"))\n}", "title": "" }, { "docid": "663d610c624d7da3c117db2476621f1e", "score": "0.65470976", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A, B string // Entities\n\tvar Aval, Bval int // Asset holdings\n\tvar X int // Transaction value\n\tvar err error\n\n\tif len(args) != 3 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\n\t}\n\n\tA = args[0]\n\tB = args[1]\n\n\t// Get the state from the ledger\n\t// TODO: will be nice to have a GetAllState call to ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get state\")\n\t}\n\tif Avalbytes == nil {\n\t\treturn shim.Error(\"Entity not found\")\n\t}\n\tAval, _ = strconv.Atoi(string(Avalbytes))\n\n\tBvalbytes, err := stub.GetState(B)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get state\")\n\t}\n\tif Bvalbytes == nil {\n\t\treturn shim.Error(\"Entity not found\")\n\t}\n\tBval, _ = strconv.Atoi(string(Bvalbytes))\n\n\t// Perform the execution\n\tX, err = strconv.Atoi(args[2])\n\tif err != nil {\n\t\treturn shim.Error(\"Invalid transaction amount, expecting a integer value\")\n\t}\n\tAval = Aval - X\n\tBval = Bval + X\n\tfmt.Printf(\"Aval = %d, Bval = %d\\n\", Aval, Bval)\n\n\t// Write the state back to the ledger\n\terr = stub.PutState(A, []byte(strconv.Itoa(Aval)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\terr = stub.PutState(B, []byte(strconv.Itoa(Bval)))\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// err = stub.PutState(\"c\", []byte(\"VALID\"))\n\t// if err != nil {\n\t// \treturn shim.Error(err.Error())\n\t// }\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "2c9ccd5cbd60ca11acd43862986a8788", "score": "0.65376294", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n \n\t // Retrieve the requested Smart Contract function and arguments\n\t function, args := APIstub.GetFunctionAndParameters()\n\t var result string\n\t var err error\n\t // Route to the appropriate handler function to interact with the ledger appropriately\n\t if function == \"getCard\" {\n\t\t result,err = getCard(APIstub, args)\n\t } else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t } else if function == \"setCard\" {\n\t\t result,err = setCard(APIstub, args)\n\t } else if function == \"updateCard\" {\n\t\t result,err = updateCard(APIstub, args)\n\t } else if function == \"setAttendance\" {\n\t\tresult,err = setAttendance(APIstub, args)\n\t } else if function == \"getAttendance\" {\n\t\tresult,err = getAttendance(APIstub, args)\n\t } else {\n\t\t return shim.Error(err.Error())\n\t }\n\t if err != nil {\n\t\t return shim.Error(err.Error())\n\t }\n \n\t return shim.Success([]byte(result))\n }", "title": "" }, { "docid": "a5cc3a9ee62a2f730ddc673bfe3fd4d8", "score": "0.6500945", "text": "func (t *shimTestCC) invoke(stub ChaincodeStubInterface, args []string) pb.Response {\n\tvar A, B string // Entities\n\tvar Aval, Bval int // Asset holdings\n\tvar X int // Transaction value\n\tvar err error\n\n\tif len(args) != 3 {\n\t\treturn Error(\"Incorrect number of arguments. Expecting 3\")\n\t}\n\n\tA = args[0]\n\tB = args[1]\n\n\t// Get the state from the ledger\n\t// TODO: will be nice to have a GetAllState call to ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\treturn Error(\"Failed to get state\")\n\t}\n\tif Avalbytes == nil {\n\t\treturn Error(\"Entity not found\")\n\t}\n\tAval, _ = strconv.Atoi(string(Avalbytes))\n\n\tBvalbytes, err := stub.GetState(B)\n\tif err != nil {\n\t\treturn Error(\"Failed to get state\")\n\t}\n\tif Bvalbytes == nil {\n\t\treturn Error(\"Entity not found\")\n\t}\n\tBval, _ = strconv.Atoi(string(Bvalbytes))\n\n\t// Perform the execution\n\tX, err = strconv.Atoi(args[2])\n\tif err != nil {\n\t\treturn Error(\"Invalid transaction amount, expecting a integer value\")\n\t}\n\tAval = Aval - X\n\tBval = Bval + X\n\n\t// Write the state back to the ledger\n\terr = stub.PutState(A, []byte(strconv.Itoa(Aval)))\n\tif err != nil {\n\t\treturn Error(err.Error())\n\t}\n\n\terr = stub.PutState(B, []byte(strconv.Itoa(Bval)))\n\tif err != nil {\n\t\treturn Error(err.Error())\n\t}\n\n\treturn Success(nil)\n}", "title": "" }, { "docid": "1ad1949b39c891196e3c6a45169fc591", "score": "0.64923024", "text": "func (_Pausable *PausableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Pausable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "2e673aa7664945c69c581813cd5943e2", "score": "0.6485845", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) pb.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\tfmt.Println(function)\n\tfmt.Println(args)\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryContract\" {\n\t\treturn s.queryContract(APIstub, args)\n\t} else if function == \"updateContract\" {\n\t\treturn s.updateContract(APIstub, args)\n\t} else if function == \"createContract\" {\n\t\treturn s.createContract(APIstub, args)\n\t}\n\t// If called with different function name\n\tfmt.Println(\"Received unknown invoke function name - \" + function)\n\treturn shim.Error(\"Received unknown invoke function name - '\" + function + \"'\")\n}", "title": "" }, { "docid": "cd6496f47d8c4106736f774671c45aff", "score": "0.64765346", "text": "func (_Plasma *PlasmaTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Plasma.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "b4466de41465a623d5b375401438dbda", "score": "0.64763373", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) peer.Response {\n\n // Retrieve the requested Smart Contract function and arguments\n function, args := APIstub.GetFunctionAndParameters()\n // Route to the appropriate handler function to interact with the ledger appropriately\n if function == \"QueryEvent\" {\n return s.QueryEvent(APIstub, args)\n } else if function == \"CreateLedger\" {\n return s.CreateLedger(APIstub, args)\n } else if function == \"QueryAllEvents\" {\n return s.QueryAllEvents(APIstub, args)\n }\n\n return shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "7b2560e16a3a2470e4ed4dd8114a3417", "score": "0.6451962", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) pb.Response {\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"update\" {\n\t\treturn s.update(APIstub, args)\n\t} else if function == \"transfer\" {\n\t\treturn s.transfer(APIstub, args)\n\t} else if function == \"get\" {\n\t\treturn s.get(APIstub, args)\n\t} else if function == \"prune\" {\n\t\treturn s.prune(APIstub, args)\n\t} else if function == \"delete\" {\n\t\treturn s.delete(APIstub, args)\n\t} else if function == \"putstandard\" {\n\t\treturn s.putStandard(APIstub, args)\n\t} else if function == \"putstandardwithget\" {\n\t\treturn s.putStandardWithGet(APIstub, args)\n\t} else if function == \"getstandard\" {\n\t\treturn s.getStandard(APIstub, args)\n\t} else if function == \"delstandard\" {\n\t\treturn s.delStandard(APIstub, args)\n\t} else if function == \"changeredis\" {\n\t\treturn s.changeredis(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "7360391eedcda13b341db4ba6046ca3b", "score": "0.645057", "text": "func (_VaiComtroller *VaiComtrollerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _VaiComtroller.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "5c752b3dccb6513dc0acaa6ddb15a9c5", "score": "0.64165246", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryClaim\" {\n\t\treturn s.queryClaim(APIstub, args)\n\t} else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"submitClaim\" {\n\t\treturn s.submitClaim(APIstub, args)\n\t} else if function == \"queryAllClaims\" {\n\t\treturn s.queryAllClaims(APIstub)\n\t} else if function == \"approveClaim\" {\n\t\treturn s.approveClaim(APIstub, args)\n\t} else if function == \"transferClaim\" {\n\t\treturn s.transferClaim(APIstub, args)\n\t} else if function == \"transferClaimApprove\" {\n return s.transferClaimApprove(APIstub, args)\n\t} else if function == \"transferClaimReject\" {\n return s.transferClaimReject(APIstub, args)\n\t} else if function == \"rejectClaim\" {\n return s.rejectClaim(APIstub, args)\n\t} else if function == \"queryUser\" {\n\t\treturn s.queryUser(APIstub)\n\t}\n\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "cbce932910a88700ef1a7a2907ebf5b5", "score": "0.6416273", "text": "func (_Paraswap *ParaswapTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Paraswap.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "bf3616b6efc4bf5304b769b3da4cb605", "score": "0.64160967", "text": "func (_Utilities *UtilitiesTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\r\n\treturn _Utilities.Contract.contract.Transact(opts, method, params...)\r\n}", "title": "" }, { "docid": "2482c0f817865f64f3c4772ae7d86740", "score": "0.64154553", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryValue\" {\n\t\treturn s.queryValue(APIstub, args)\n\t} else if function == \"queryAll\" {\n\t\treturn s.queryAll(APIstub)\n\t} else if function == \"invoke\" {\n\t\treturn s.invoke(APIstub, args)\n\t} else if function == \"settle\" {\n\t\treturn s.settle(APIstub)\n\t} else if function == \"settle1\" {\n\t\treturn s.settle1(APIstub)\n\t} else if function == \"settle2\" {\n\t\treturn s.settle2(APIstub)\n\t} else if function == \"createUser\" {\n\t\treturn s.createUser(APIstub, args)\n\t} else if function == \"reset\" {\n\t\treturn s.reset(APIstub)\n\t} else if function == \"initBet\" {\n\t\treturn s.initBet(APIstub)\n\t} else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "a6f0e1d8d101da5cf3cd4a0e366fe831", "score": "0.63948476", "text": "func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n\r\n\t// var Tval, Pval, Tsval string\r\n\tvar err error\r\n\r\n\tif len(args) != 3 {\r\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\r\n\t}\r\n\r\n\tACert := ACertInfo{}\r\n\tACert.Token = args[0]\r\n\tACert.Proof = args[1]\r\n\tACert.PInputs, err = strconv.Atoi(args[2])\r\n\r\n\tTvalbytes, err := stub.GetState(ACert.Token)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif Tvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tPvalbytes, err := stub.GetState(ACert.Proof)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif Pvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tPIsvalbytes, err := stub.GetState(string(ACert.PInputs))\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif PIsvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tTSvalbytes, err := stub.GetState(ACert.Timestamp)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif TSvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\tChvalbytes, err := stub.GetState(ACert.ChID)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get state\")\r\n\t}\r\n\tif Chvalbytes == nil {\r\n\t\treturn shim.Error(\"Entity not found\")\r\n\t}\r\n\r\n\treturn shim.Success(nil)\r\n}", "title": "" }, { "docid": "81874fd69a53974c868427995a5236f7", "score": "0.6391578", "text": "func (_EthCallTester *EthCallTesterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _EthCallTester.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "44d825fd16932fc95ea2da71c6b45297", "score": "0.63886625", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"queryAssetWithKey\" {\n\t\treturn s.queryAssetWithKey(APIstub, args)\n\t} else if function == \"queryAllAssetList\" {\n\t\treturn s.queryAllAssetList(APIstub)\n\t} else if function == \"increaseQuantity\" {\n\t\treturn s.increaseQuantity(APIstub, args)\n\t} else if function == \"decreaseQuantity\" {\n\t\treturn s.decreaseQuantity(APIstub, args)\n\t} else if function == \"increaseMarketPrice\" {\n\t\treturn s.increaseMarketPrice(APIstub, args)\n\t} else if function == \"decreaseMarketPrice\" {\n\t\treturn s.decreaseMarketPrice(APIstub, args)\n\t} else if function == \"assetInfoHistory\" {\n\t\treturn s.assetInfoHistory(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "be953b86db58c5c2da76e5817480bbf6", "score": "0.63829726", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\r\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\r\n}", "title": "" }, { "docid": "8321a3ae10c680752299957c46b51cf6", "score": "0.63804674", "text": "func (_Main *MainTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Main.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "07598a909bf73b28b52211a4765cf47e", "score": "0.6375007", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryValidTransactions\" {\n\t\treturn s.queryValidTransactions(APIstub, args)\n\t} else if function == \"queryInValidTransactions\" {\n\t\treturn s.queryInValidTransactions(APIstub, args)\n\t} else if function == \"queryContract\" {\n\t\treturn s.queryContract(APIstub, args)\n\t} else if function == \"createContract\" {\n\t\treturn s.createContract(APIstub, args)\n\t} else if function == \"executeTransaction\" {\n\t\treturn s.executeTransaction(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "3a586dfcce8904176dd4240ced78f46d", "score": "0.6371505", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryconcept\" {\n\t\t//function == \"queryConcept\"\n\t\treturn s.queryconcept(APIstub, args)\n\t\t//return s.queryConcept(APIstub, args)\n\t}else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t}else if function == \"addconcept\" {\n\t\t\n\t\treturn s.addconcept(APIstub, args)\n\t}else if function == \"addrelation\" {\n\n\t\treturn s.addrelation(APIstub, args)\n\t}else if function == \"deleteconcept\" {\n\t\treturn s.deleteconcept(APIstub, args)\n\t}else if function == \"deleterelation\" {\n\t\treturn s.deleterelation(APIstub, args)\n\t}\n\n\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "1e6f0a7a9b4ce8ac352dd967435ed9cb", "score": "0.6371215", "text": "func (t *SimpleChaincode) transactPurchase(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tif len(args) != 3 {\n\t\treturn shim.Error(\"Incorrect number of arguments\")\n\t}\n\t//get contractID args\n\tmemberId := args[0]\n\tcontractId := args[1]\n\tnewState := args[2]\n\n\t// Get contract from the ledger\n\tcontractAsBytes, err := stub.GetState(contractId)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get contract\")\n\t}\n\tvar contract Contract\n\tjson.Unmarshal(contractAsBytes, &contract)\n\n\t//ensure call is called by authorized user\n\tif memberId != contract.SellerId && memberId != contract.UserId {\n\t\treturn shim.Error(\"Member not authorized to update contract\")\n\t}\n\n\t//if current contract state is pending, then execute transaction\n\tif contract.State == STATE_PENDING {\n\t\tif newState == STATE_COMPLETE && memberId == contract.SellerId {\n\t\t\t//get seller\n\t\t\tvar member Seller\n\t\t\tmemberAsBytes, err := stub.GetState(memberId)\n\t\t\tif err != nil {\n\t\t\t\treturn shim.Error(\"Failed to get member\")\n\t\t\t}\n\t\t\tjson.Unmarshal(memberAsBytes, &member)\n\n\t\t\t//get contract user's current state\n\t\t\tvar contractUser User\n\t\t\tcontractUserAsBytes, err := stub.GetState(contract.UserId)\n\t\t\tif err != nil {\n\t\t\t\treturn shim.Error(\"Failed to get contract owner\")\n\t\t\t}\n\t\t\tjson.Unmarshal(contractUserAsBytes, &contractUser)\n\n\t\t\t//update user's FitcoinsBalance\n\t\t\tif (contractUser.FitcoinsBalance - contract.Cost) >= 0 {\n\t\t\t\tcontractUser.FitcoinsBalance = contractUser.FitcoinsBalance - contract.Cost\n\t\t\t} else {\n\t\t\t\treturn shim.Error(\"Insufficient fitcoins\")\n\t\t\t}\n\n\t\t\t//update seller's product count\n\t\t\tproductFound := false\n\t\t\tfor h := 0; h < len(member.Products); h++ {\n\t\t\t\tif member.Products[h].Id == contract.ProductId {\n\t\t\t\t\tproductFound = true\n\t\t\t\t\tif member.Products[h].Count >= contract.Quantity {\n\t\t\t\t\t\tmember.Products[h].Count = member.Products[h].Count - contract.Quantity\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t//if product not found return error\n\t\t\tif productFound == true {\n\t\t\t\t//update seller's FitcoinsBalance\n\t\t\t\tmember.FitcoinsBalance = member.FitcoinsBalance + contract.Cost\n\t\t\t\t//update user state\n\t\t\t\tupdatedUserAsBytes, _ := json.Marshal(contractUser)\n\t\t\t\terr = stub.PutState(contract.UserId, updatedUserAsBytes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\t\t\t\t//update seller state\n\t\t\t\tupdatedSellerAsBytes, _ := json.Marshal(member)\n\t\t\t\terr = stub.PutState(contract.SellerId, updatedSellerAsBytes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\t\t\t\tcontract.State = STATE_COMPLETE\n\n\t\t\t} else {\n\t\t\t\tcontract.State = STATE_DECLINED\n\t\t\t\tdeclinedContractAsBytes, _ := json.Marshal(contract)\n\t\t\t\terr = stub.PutState(contract.Id, declinedContractAsBytes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\t\t\t\treturn shim.Error(\"Product not available for sale. Cancelling contract.\")\n\t\t\t}\n\t\t} else if newState == STATE_DECLINED {\n\t\t\tcontract.State = STATE_DECLINED\n\t\t} else {\n\t\t\treturn shim.Error(\"Invalid new state\")\n\t\t}\n\n\t\t// update contract state on ledger\n\t\tupdatedContractAsBytes, _ := json.Marshal(contract)\n\t\terr = stub.PutState(contract.Id, updatedContractAsBytes)\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\t//return contract info\n\t\treturn shim.Success(updatedContractAsBytes)\n\t} else {\n\t\treturn shim.Error(\"Contract already Complete or Declined\")\n\t}\n}", "title": "" }, { "docid": "1b0f3a6ea7c7a602962b4297c1f33649", "score": "0.6368453", "text": "func (_BaasFounder *BaasFounderTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _BaasFounder.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "991efedea40ef166d9f49aef95c08689", "score": "0.6353478", "text": "func (_Base_Interface *Base_InterfaceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Base_Interface.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "f3fc0eb1180d1058fe517b63297653e5", "score": "0.6352212", "text": "func (_Plasma *PlasmaRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Plasma.Contract.PlasmaTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7700c21375b7c32ca2717784390ed6ef", "score": "0.63518417", "text": "func (_Pausable *PausableRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Pausable.Contract.PausableTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "98f6f10eebca29b4d200cb0496fb3afd", "score": "0.63288766", "text": "func (_BaasFounder *BaasFounderRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _BaasFounder.Contract.BaasFounderTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "b9561bc0fbfe6fd8e7dea6596b72b68d", "score": "0.6326449", "text": "func (_NPT *NPTRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _NPT.Contract.NPTTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "9af798351e16e35b8923a5a464b36b11", "score": "0.63232464", "text": "func (_Deals *DealsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Deals.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "d6ffe11242fd133d8fbe4f6541683dab", "score": "0.63224894", "text": "func (_Utilities *UtilitiesTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Utilities.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "924e7f42a83f76cc53d0f66b1a139f36", "score": "0.6319784", "text": "func (_SignatureVerification *SignatureVerificationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _SignatureVerification.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "f8d05233df6de144933844cd7ac00378", "score": "0.6313371", "text": "func (_Paraswap *ParaswapRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Paraswap.Contract.ParaswapTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "5e9384edb038584157b3dddddb73e466", "score": "0.63094383", "text": "func (_VaiComtroller *VaiComtrollerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _VaiComtroller.Contract.VaiComtrollerTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "49b5672311aa5dd85910a7829fd0b44a", "score": "0.630614", "text": "func (_ArbosTest *ArbosTestTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _ArbosTest.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "526f9f78dacdced9c49f11220dd819fd", "score": "0.63027346", "text": "func (_ScryProtocol *ScryProtocolTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _ScryProtocol.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "eee9a4a037f5e36e11a2c5026c295b70", "score": "0.63009804", "text": "func (_ArbFactory *ArbFactoryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _ArbFactory.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "6187f01209a1199b045ca89b6ed63245", "score": "0.6296594", "text": "func (_PostDeliveryCrowdsaleImpl *PostDeliveryCrowdsaleImplTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _PostDeliveryCrowdsaleImpl.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "9730828c13fdfa1044eda32de8eacaca", "score": "0.62950736", "text": "func (i service) Execute(ctx context.Context, to common.Address, contractAbi, methodName string, args ...interface{}) (txID id.IDTX, done chan bool, err error) {\n\tabiObj, err := abi.JSON(strings.NewReader(contractAbi))\n\tif err != nil {\n\t\treturn transactions.NilTxID(), nil, err\n\t}\n\n\t// Pack encodes the parameters and additionally checks if the method and arguments are defined correctly\n\tdata, err := abiObj.Pack(methodName, args...)\n\tif err != nil {\n\t\treturn transactions.NilTxID(), nil, err\n\t}\n\treturn i.RawExecute(ctx, to, data)\n}", "title": "" }, { "docid": "66d706126c16bf5c72ea862f28172e18", "score": "0.62923324", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\r\n\t\r\n function, args := APIstub.GetFunctionAndParameters()\r\n fmt.Println(\"invoke is running \" + function)\r\n \r\n // Ledger Initiation \r\n //==================\r\n \r\n if function == \"initLedger\"{\r\n return s.initLedger(APIstub)\r\n }\r\n \r\n // Add new Employee to the db\r\n // ==========================\r\n \r\n if function == \"newEmployee\"{\r\n return s.newEmployee(APIstub,args)\r\n }\r\n\r\n // Get all Employees Info\r\n // ======================\r\n \r\n if function == \"queryAllEmployees\"{\r\n return s.queryAllEmployees(APIstub)\r\n } \r\n \r\n // Get Employee Info by ID\r\n // =======================\r\n \r\n if function == \"queryByID\"{\r\n return s.queryByID(APIstub,args)\r\n }\r\n\r\n // Delete EMPLOYEE data from db\r\n // ============================\r\n \r\n if function == \"DeleteEmployee\"{\r\n return s.DeleteEmployee(APIstub,args)\r\n }\r\n \r\n // Update Employee Phone Number\r\n // ============================\r\n \r\n if function == \"UpdateEmployeePhone\"{\r\n return s.UpdateEmployeePhone(APIstub,args)\r\n }\r\n \r\n // History of Employee\r\n // ===================\r\n \r\n if function == \"HistoryOfEmployees\"{\r\n return s.HistoryOfEmployees(APIstub,args)\r\n }\r\n\r\n // Get Info by range\r\n // =================\r\n \r\n if function == \"GetInfobyRange\"{\r\n return s.GetInfobyRange(APIstub,args)\r\n }\r\n\r\n fmt.Println(\"invoke did not find func: \" + function) //error\r\n\treturn shim.Error(\"Received unknown function invocation\")\r\n}", "title": "" }, { "docid": "f11e2665dca1f09082af0ec8a6c2b016", "score": "0.62919766", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\n\tfmt.Println(\"Invoke is running: \" + function)\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryDoc\" {\t\t\t\t\t\t//query a doc by Id\n\t\treturn s.queryDoc(APIstub, args)\n\t} else if function == \"initLedger\" {\t\t\t//?\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"createDoc\" {\t\t\t\t//create a new doc\n\t\treturn s.createDoc(APIstub, args)\n\t} else if function == \"queryAllDocs\" {\t\t\t//query all docs\n\t\treturn s.queryAllDocs(APIstub)\n\t} else if function == \"changeDocOwner\" {\t\t//owner update\n\t\treturn s.changeDocOwner(APIstub, args)\n\t} else if function == \"setExpiryOnDoc\" {\t\t\t\t//end timestamp the document. no more valid after this.\n\t\treturn s.setExpiryOnDoc(APIstub, args)\n\t} else if function == \"querySchema\" {\t\t\t\t//end timestamp the document. no more valid after this.\n\t\treturn s.querySchema(APIstub, args)\t\t\t\t//returns the empty asset structure to caller \n\t} else if function == \"grantAccess\" {\t\t\t\t//end timestamp the document. no more valid after this.\n\t\treturn s.grantAccess(APIstub, args)\t\t\t\t//returns the empty asset structure to caller \n\t} else if function == \"getDocHistory\" {\t\t\t\t//end timestamp the document. no more valid after this.\n\t\treturn s.getDocHistory(APIstub, args)\t\t\t\t//returns the empty asset structure to caller \n\t} else if function == \"executeRichQuery\" {\t\t\t\t//end timestamp the document. no more valid after this.\n\t\treturn s.executeRichQuery(APIstub, args)\t\t\t\t//returns the empty asset structure to caller \n\t}\n\n\tfmt.Println(function + \" Not found\")\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "775526944413589e1b8343e66bba9479", "score": "0.6288698", "text": "func (_Deals *DealsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Deals.Contract.DealsTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "5394d52c7af8d67f0abf2e3cec027c6a", "score": "0.62883794", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\tfmt.Println(\"INVOKE\")\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger\n\tif function == \"queryAsset\" {\n\t\treturn s.queryAsset(APIstub, args)\n\t} else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"recordAsset\" {\n\t\treturn s.recordAsset(APIstub, args)\n\t} else if function == \"queryAllAsset\" {\n\t\treturn s.queryAllAsset(APIstub)\n\t} else if function == \"changeAssetHolder\" {\n\t\treturn s.changeAssetHolder(APIstub, args)\n\t} else if function == \"getHistory\" {\n\t\treturn s.getHistory(APIstub, args)\n\t} else if function == \"addAsset\" {\n\t\treturn s.addAsset(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "59bef9230fa9c441e08140c6cf7418f5", "score": "0.6286228", "text": "func (_SigUtilsTester *SigUtilsTesterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _SigUtilsTester.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "b334b51fd4edabe5c76e731ac58cee8b", "score": "0.6281085", "text": "func (_PostDeliveryCrowdsaleImpl *PostDeliveryCrowdsaleImplRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _PostDeliveryCrowdsaleImpl.Contract.PostDeliveryCrowdsaleImplTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7f21c8fe0e41d4178dc1ef7df2286175", "score": "0.627795", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7f21c8fe0e41d4178dc1ef7df2286175", "score": "0.627795", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7f21c8fe0e41d4178dc1ef7df2286175", "score": "0.627795", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7f21c8fe0e41d4178dc1ef7df2286175", "score": "0.627795", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7f21c8fe0e41d4178dc1ef7df2286175", "score": "0.627795", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "7f21c8fe0e41d4178dc1ef7df2286175", "score": "0.627795", "text": "func (_Ownable *OwnableTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "a89c9c2f1ed7c824335a0dfa46a977a2", "score": "0.6275743", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryGID\" {\n\t\treturn s.queryGID(APIstub, args)\n\t} else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"createGID\" {\n\t\treturn s.createGID(APIstub, args)\n\t} else if function == \"queryAll\" {\n\t\treturn s.queryAll(APIstub)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function \\\"name\\\".\")\n}", "title": "" }, { "docid": "ffcde6a0448e843b3dd142cb47019a9c", "score": "0.6274261", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryProduce\" {\n\t\treturn s.queryProduce(APIstub, args)\n\t} else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"createProduce\" {\n\t\treturn s.createProduce(APIstub, args)\n\t} else if function == \"queryAllProduces\" {\n\t\treturn s.queryAllProduces(APIstub)\n\t} else if function == \"changeProduceStatus\" {\n\t\treturn s.changeProduceStatus(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "8237c98d0e0ab11a2a7f1639a4f0c621", "score": "0.6273117", "text": "func (_Safemoon *SafemoonTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Safemoon.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "bbeea47a119fbf3d6472567d016dd0ee", "score": "0.62704265", "text": "func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "bbeea47a119fbf3d6472567d016dd0ee", "score": "0.62704265", "text": "func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "bbeea47a119fbf3d6472567d016dd0ee", "score": "0.62704265", "text": "func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "0d4819c1613c44a7f62ebca766d333e0", "score": "0.62700826", "text": "func (t *SmartContract) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\tfunction, args := stub.GetFunctionAndParameters()\n\tbcFunc := bcFunctions[function]\n\tif bcFunc == nil {\n\t\treturn shim.Error(\"Invalid invoke function.\")\n\t}\n\treturn bcFunc(stub, args)\n}", "title": "" }, { "docid": "123d2d622e57d330fe146b6d2c03fe6b", "score": "0.6269262", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"queryAll\" { //return all the assets on the ledger\n\t\treturn s.queryAll(APIstub, args)\n\t} else if function == \"query\" { //single bank or customer or forexPair\n\t\treturn s.query(APIstub, args)\n\t} else if function == \"createBank\" {\n\t\treturn s.createBank(APIstub, args)\n\t} else if function == \"createCustomer\" {\n\t\treturn s.createCustomer(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "3f3969a1fe5651defb71d5ae4bc2eb3d", "score": "0.6265984", "text": "func (_BondingManager *BondingManagerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _BondingManager.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "be654f1a25b05116ec11975668a94a47", "score": "0.62650895", "text": "func (_Main *MainRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Main.Contract.MainTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "b780bf859eaab7a38b1c6764ad01717d", "score": "0.6264941", "text": "func (t *Insurance) Invoke(stub shim.ChaincodeStubInterface, function string, args[] string)([] byte, error) {\n // Extract the function and args from the transaction proposal\n\n if function == \"createPolicy\" {\n return t.createPolicy(stub, args)\n }else if function == \"calculateTokens\" {\n return t.calculateTokens(stub, args)\n }\n fmt.Println(\"invoke did not find func: \" + function)\n errMsg:= \"{ \\\"message\\\" : \\\"Received unknown function invocation\\\", \\\"code\\\" : \\\"503\\\"}\"\n err:= stub.SetEvent(\"errEvent\", [] byte(errMsg))\n if err != nil {\n return nil, err\n }\n return nil, nil //error\n}", "title": "" }, { "docid": "4a8983779defcf6bcf4a547dfd174b04", "score": "0.62595004", "text": "func (t *SimpleChaincode) invokeTransfer(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\ttype AmountTransientInput struct {\n\t\tAmount string `json:\"amount\"`\n\t}\n\n\ttransMap, err := stub.GetTransient()\n\tif err != nil {\n\t\treturn shim.Error(\"Error getting transient: \" + err.Error())\n\t}\n\n\tAmountAsBytes, ok := transMap[\"amount\"]\n\tif !ok {\n\t\treturn shim.Error(\"Amount must be a key in the transient map\")\n\t}\n\n\tif len(AmountAsBytes) == 0 {\n\t\treturn shim.Error(\"Amount value in the transient map must be a non-empty JSON string\")\n\t}\n\n\tvar AmountInput AmountTransientInput\n\terr = json.Unmarshal(AmountAsBytes, &AmountInput)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to decode JSON \" + err.Error())\n\t}\n\n\t// transfer target\n\tReceiverMspId := args[0]\n\tReceiverCertId := args[1]\n\n\t//transfer amount\n\tAmount, _ := strconv.ParseFloat(AmountInput.Amount, 32)\n\n\tSenderMspId := args[2]\n\tSenderCertId := args[3]\n\n\t// Disallow to transfer Receiverken to same account\n\tif SenderMspId == ReceiverMspId && SenderCertId == ReceiverCertId {\n\t\treturn shim.Error(\"forbidden to transfer to same account\")\n\t}\n\n\tReceiverBalance, err := getBalance(stub, ReceiverMspId, ReceiverCertId)\n\tif err != nil {\n\t\treturn shim.Error(\"Can not get Receiver balance\" + err.Error())\n\t\t//return shim.Error(collectionName)\n\t}\n\n\tSenderBalance, err := getBalance(stub, SenderMspId, SenderCertId)\n\tif err != nil {\n\t\treturn shim.Error(\"Can not get Sender balance\")\n\t}\n\tout, _ := json.Marshal(SenderBalance)\n\t// Check the funds sufficiency\n\tif SenderBalance-Amount < 0 {\n\n\t\treturn shim.Error(string(out))\n\t}\n\n\t// Update payer and Receiver balance\n\tif err = setBalance(stub, SenderMspId, SenderCertId, SenderBalance-Amount); err != nil {\n\t\treturn shim.Error(\"Can not update Sender balance\")\n\t}\n\n\tif err = setBalance(stub, ReceiverMspId, ReceiverCertId, ReceiverBalance+Amount); err != nil {\n\t\treturn shim.Error(\"Can not update receipient balance\")\n\t}\n\n\treturn shim.Success([]byte(out))\n}", "title": "" }, { "docid": "e752f879b572aface74ec5f2a839e282", "score": "0.6258675", "text": "func (_Wrapper *WrapperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Wrapper.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "d8026371e066d7ebd585bd9432aef60d", "score": "0.6254295", "text": "func (_Pxc *PxcTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Pxc.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "889e0e7bb7c6ae85e997f67a08b9536a", "score": "0.62502587", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == \"queryRecord\" {\n\t\treturn s.queryRecord(APIstub, args)\n\t} else if function == \"initLedger\" {\n\t\treturn s.initLedger(APIstub)\n\t} else if function == \"createRecord\" {\n\t\treturn s.createRecord(APIstub, args)\n\t} else if function == \"queryAllRecords\" {\n\t\treturn s.queryAllRecords(APIstub)\n\t} else if function == \"changeRecordPatient\" {\n\t\treturn s.changeRecordPatient(APIstub, args)\n\t}\n\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "079d5234fca58f960d01f5a4ee06f2e8", "score": "0.6245519", "text": "func (_NPT *NPTTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _NPT.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "e0348ef03015b6d2a90c3c929df49abb", "score": "0.6240014", "text": "func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "e0348ef03015b6d2a90c3c929df49abb", "score": "0.6240014", "text": "func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "e0348ef03015b6d2a90c3c929df49abb", "score": "0.6240014", "text": "func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "65537d3e749d1d9d54fe3b03120e7763", "score": "0.6236484", "text": "func (_Multishot *MultishotTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Multishot.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "f1d3fc1e89e07f319bd1113d3a3b1b79", "score": "0.6232986", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) peer.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tswitch function {\n\tcase \"createOwner\":\n\t\tfmt.Println(\"add owner\")\n\t\treturn s.createOwner(APIstub, args)\n\tcase \"getOwner\":\n\t\tfmt.Println(\"Get owner\")\n\t\treturn s.getOwner(APIstub, args)\n\tdefault:\n\t\tfmt.Println(\"Invalid Smart Contract function name.\")\n\t\treturn shim.Error(\"Invalid Smart Contract function name.\")\n\t}\n}", "title": "" }, { "docid": "6bcb9038610f960300a02aa154299d03", "score": "0.62321883", "text": "func (_BasMiner *BasMinerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _BasMiner.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "a72ae579a545dccd79e61bc188d8bcc3", "score": "0.62236", "text": "func (_Factory *FactoryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Factory.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "a72ae579a545dccd79e61bc188d8bcc3", "score": "0.62236", "text": "func (_Factory *FactoryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Factory.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "697b0acb60736e4775b7f3bf7c997961", "score": "0.6223431", "text": "func (_HorseyHelper *HorseyHelperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _HorseyHelper.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "d9b2157ed22c5a62d2b7a54afb8c7e64", "score": "0.6214876", "text": "func (_EthCallTester *EthCallTesterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _EthCallTester.Contract.EthCallTesterTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "41100653eac62455b8e4c0fd3feb5bff", "score": "0.6211505", "text": "func (_Value *ValueTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Value.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "41100653eac62455b8e4c0fd3feb5bff", "score": "0.6211505", "text": "func (_Value *ValueTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Value.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "523038908a7832908b9051ac562627c4", "score": "0.6209109", "text": "func (_Spawn *SpawnTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Spawn.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "523038908a7832908b9051ac562627c4", "score": "0.6209109", "text": "func (_Spawn *SpawnTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Spawn.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "bb1fc8847c1fa62266c6eac5f11f2e8b", "score": "0.6208843", "text": "func (_Demo *DemoTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Demo.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "895eb52ce42df39adbacfbba059ef969", "score": "0.6208691", "text": "func (_Boekiproxy *BoekiproxyTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Boekiproxy.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "91b48689e216b4fc1f036cd74efffb13", "score": "0.62058496", "text": "func (_BEP20 *BEP20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _BEP20.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "25c1a033b75d49e0f1326aaf12514c1e", "score": "0.62036353", "text": "func (_Staking *StakingTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Staking.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "fb522b24316fb3b92499635399d58cc2", "score": "0.62014794", "text": "func (_Safemoon *SafemoonRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Safemoon.Contract.SafemoonTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "2089eb814e06304b43ecc754ea2d702e", "score": "0.6195594", "text": "func (_Protocol *ProtocolTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Protocol.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "12696924c413f09227450a4b4539f13a", "score": "0.61954457", "text": "func (_Base_Interface *Base_InterfaceRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Base_Interface.Contract.Base_InterfaceTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "6594a13b80d0ca8c006b735a6a9e3e2a", "score": "0.6192621", "text": "func (_ZapGetters *ZapGettersTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\r\n\treturn _ZapGetters.Contract.contract.Transact(opts, method, params...)\r\n}", "title": "" }, { "docid": "52558fe1ddfa45f62e66d2e734533868", "score": "0.6190448", "text": "func (_Faucet *FaucetTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Faucet.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "0627d57f05e834f420b67dfae703d984", "score": "0.6189014", "text": "func (_BEP20 *BEP20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _BEP20.Contract.BEP20Transactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "99a24515a67c22571adc88c2f9ca13d0", "score": "0.618832", "text": "func (_Airdropper *AirdropperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Airdropper.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "3f84fd3a8c611615d903108f4085ccb9", "score": "0.6187868", "text": "func (_Vrf *VrfTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Vrf.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "3a771f81c2e732019c5f9481cecc522b", "score": "0.6185338", "text": "func (_ScryProtocol *ScryProtocolRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _ScryProtocol.Contract.ScryProtocolTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "f6ba7727dc09be69363f7c45463c2b5a", "score": "0.6182805", "text": "func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\tif function == \"queryCertificate\" {\n\t\treturn s.queryCertificate(APIstub, args)\n\t} else if function == \"queryCertificateHistory\" {\n\t\treturn s.queryCertificateHistory(APIstub, args)\n\t} else if function == \"addCertificate\" {\n\t\treturn s.addCertificate(APIstub, args)\n\t} else if function == \"revokeCertificate\" {\n\t\treturn s.revokeCertificate(APIstub, args)\n\t}\n\treturn shim.Error(\"Invalid Smart Contract function name.\")\n}", "title": "" }, { "docid": "df24c49c4fc08aff29f09ffef5ca8853", "score": "0.61821294", "text": "func (_AggregatorInterface *AggregatorInterfaceTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _AggregatorInterface.Contract.contract.Transact(opts, method, params...)\n}", "title": "" } ]
42617c6f3247045df1547036787d08be
Create a new DOSBotSignatureCategory configuration.
[ { "docid": "bee3623d688eb51b42d563fdf06acb20", "score": "0.7425543", "text": "func (r *DOSBotSignatureCategoryResource) Create(item DOSBotSignatureCategoryConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+DOSBotSignatureCategoryEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "191f7b2d17325a4bcb7e41d835975331", "score": "0.5538988", "text": "func (r *DOSBotSignatureResource) Create(item DOSBotSignatureConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+DOSBotSignatureEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b6827845105ad5d1c56f2750854c72d", "score": "0.55219716", "text": "func (r *DOSBotSignatureCategoryResource) Get(id string) (*DOSBotSignatureCategoryConfig, error) {\n\tvar item DOSBotSignatureCategoryConfig\n\tif err := r.c.ReadQuery(BasePath+DOSBotSignatureCategoryEndpoint, &item); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &item, nil\n}", "title": "" }, { "docid": "c1727bb32446f04f90d0644389fd82b6", "score": "0.5461848", "text": "func (sec Security) DOSBotSignatureCategory() *DOSBotSignatureCategoryResource {\n\treturn &sec.dOSBotSignatureCategory\n}", "title": "" }, { "docid": "0515e3cbf357fc08f555b19e9e38a6a7", "score": "0.5436759", "text": "func (_Controller *ControllerTransactor) CreateCategory(opts *bind.TransactOpts, metadataHash [32]byte, useFullyDilutedMarketCaps bool, minMarketCap *big.Int, maxMarketCap *big.Int) (*types.Transaction, error) {\n\treturn _Controller.contract.Transact(opts, \"createCategory\", metadataHash, useFullyDilutedMarketCaps, minMarketCap, maxMarketCap)\n}", "title": "" }, { "docid": "8febc82bddf588805f7f94e60ce750f0", "score": "0.543436", "text": "func (_Controller *ControllerSession) CreateCategory(metadataHash [32]byte, useFullyDilutedMarketCaps bool, minMarketCap *big.Int, maxMarketCap *big.Int) (*types.Transaction, error) {\n\treturn _Controller.Contract.CreateCategory(&_Controller.TransactOpts, metadataHash, useFullyDilutedMarketCaps, minMarketCap, maxMarketCap)\n}", "title": "" }, { "docid": "dd04d269a92e46632baaa1b7573291b8", "score": "0.54083115", "text": "func (_Controller *ControllerTransactorSession) CreateCategory(metadataHash [32]byte, useFullyDilutedMarketCaps bool, minMarketCap *big.Int, maxMarketCap *big.Int) (*types.Transaction, error) {\n\treturn _Controller.Contract.CreateCategory(&_Controller.TransactOpts, metadataHash, useFullyDilutedMarketCaps, minMarketCap, maxMarketCap)\n}", "title": "" }, { "docid": "9987c3be50c4c53883542fb3b423d671", "score": "0.53391063", "text": "func (m *GroupPolicyCategoriesRequestBuilder) Post(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.GroupPolicyCategoryable, requestConfiguration *GroupPolicyCategoriesRequestBuilderPostRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.GroupPolicyCategoryable, error) {\n requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreateGroupPolicyCategoryFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.GroupPolicyCategoryable), nil\n}", "title": "" }, { "docid": "c3f7bc1be375165204f5993dbfb97828", "score": "0.5201831", "text": "func CreateConfigSignature(ctx context.Context, config []byte) (*common.ConfigSignature, error) {\n\n\tcreator, err := ctx.Identity()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to get user context's identity\")\n\t}\n\n\t// generate a random nonce\n\tnonce, err := crypto.GetRandomNonce()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"nonce creation failed\")\n\t}\n\n\t// signature is across a signature header and the config update\n\tsignatureHeader := &common.SignatureHeader{\n\t\tCreator: creator,\n\t\tNonce: nonce,\n\t}\n\tsignatureHeaderBytes, err := proto.Marshal(signatureHeader)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal signatureHeader failed\")\n\t}\n\n\t// get all the bytes to be signed together, then sign\n\tsigningBytes := fcutils.ConcatenateBytes(signatureHeaderBytes, config)\n\tsigningMgr := ctx.SigningManager()\n\tsignature, err := signingMgr.Sign(signingBytes, ctx.PrivateKey())\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"signing of channel config failed\")\n\t}\n\n\t// build the return object\n\tconfigSignature := common.ConfigSignature{\n\t\tSignatureHeader: signatureHeaderBytes,\n\t\tSignature: signature,\n\t}\n\treturn &configSignature, nil\n}", "title": "" }, { "docid": "90db41fb26976f208281ad0c70f1a283", "score": "0.5194479", "text": "func (s *SigningIdentity) CreateConfigSignature(marshaledUpdate []byte) (*cb.ConfigSignature, error) {\n\tsignatureHeader, err := s.signatureHeader()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating signature header: %v\", err)\n\t}\n\n\theader, err := proto.Marshal(signatureHeader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshaling signature header: %v\", err)\n\t}\n\n\tconfigSignature := &cb.ConfigSignature{\n\t\tSignatureHeader: header,\n\t}\n\n\tconfigSignature.Signature, err = s.Sign(\n\t\trand.Reader,\n\t\tconcatenateBytes(configSignature.SignatureHeader, marshaledUpdate),\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"signing config update: %v\", err)\n\t}\n\n\treturn configSignature, nil\n}", "title": "" }, { "docid": "fad6732f59d596976c6d9c6df91ce3c9", "score": "0.498612", "text": "func (r *IPIntelligenseBlacklistCategoryResource) Create(item IPIntelligenseBlacklistCategoryConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+IPIntelligenseBlacklistCategoryEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b4adbd1ef109bef524db9e37e950eab", "score": "0.49261862", "text": "func NewDeviceManagementTemplateSettingCategory()(*DeviceManagementTemplateSettingCategory) {\n m := &DeviceManagementTemplateSettingCategory{\n DeviceManagementSettingCategory: *NewDeviceManagementSettingCategory(),\n }\n return m\n}", "title": "" }, { "docid": "0db6174723a6c6de22109de25f377de1", "score": "0.4746269", "text": "func (h Handler) CreateCategory(c echo.Context) error {\n\tvar err error\n\tvar xerr xerror.Xerror\n\tvar user auth.User\n\tvar cat model.Category\n\n\tuser = auth.ParseToken(c)\n\tbookID := c.Param(\"id\")\n\tif err = h.jsonValidator.Bind(c.Request(), &cat); err != nil {\n\t\treturn c.JSON(h.httpResponse(xerror.New(-1, err.Error())))\n\t}\n\tif cat, xerr = h.controller.RecordCategory(cat, user.Identifier, bookID); xerr != nil {\n\t\treturn c.JSON(h.httpResponse(xerr))\n\t}\n\treturn c.JSON(http.StatusCreated, &cat)\n}", "title": "" }, { "docid": "fa8d695b98ef56bed2fb80260d638273", "score": "0.47397858", "text": "func CreateCategory(b []byte) ([]byte, error) {\n\n\tvar category Category\n\n\terr := json.Unmarshal(b, &category)\n\n\tif err != nil {\n\t\treturn []byte(\"Something went wrong\"), err\n\t}\n\n\tdb.Save(&category)\n\n\treturn []byte(\"Category successfully created\"), nil\n}", "title": "" }, { "docid": "dfc4800d6a44d6860c2967a71c9950d1", "score": "0.46944374", "text": "func createExtension(_ context.Context, set component.ExtensionCreateSettings, cfg config.Extension) (component.Extension, error) {\n\tawsSDKInfo := fmt.Sprintf(\"%s/%s\", aws.SDKName, aws.SDKVersion)\n\treturn newSigv4Extension(cfg.(*Config), awsSDKInfo, set.Logger), nil\n}", "title": "" }, { "docid": "841fb4a62d980865a5554187b40c6f58", "score": "0.46748978", "text": "func CreateCategory(w http.ResponseWriter, r *http.Request) {\n\tcategory := &sakila.Category{}\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\trender.Render(w, r, MyErrors.Err400)\n\t\treturn\n\t}\n\n\tif err := category.FromJSON(data); err != nil {\n\t\trender.Render(w, r, MyErrors.Err422)\n\t\treturn\n\t}\n\n\tif err := db.AddCategory(category); err != nil {\n\t\trender.Render(w, r, MyErrors.Err403)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "b0f4e6b3e3f4fe2f046448488d900551", "score": "0.46673554", "text": "func CreateDeviceManagementTemplateSettingCategoryFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDeviceManagementTemplateSettingCategory(), nil\n}", "title": "" }, { "docid": "728baf67b39e83f538a8e6e86d986422", "score": "0.4599447", "text": "func (p *PaloAlto) CreateURLCategory(name, urls, description string, devicegroup ...string) error {\n\tvar xpath string\n\tvar reqError requestError\n\tr := rested.NewRequest()\n\tu := strings.Split(urls, \",\")\n\n\txmlBody := \"<list>\"\n\tfor _, m := range u {\n\t\txmlBody += fmt.Sprintf(\"<member>%s</member>\", strings.TrimSpace(m))\n\t}\n\txmlBody += \"</list>\"\n\n\tif description != \"\" {\n\t\txmlBody += fmt.Sprintf(\"<description>%s</description>\", description)\n\t}\n\n\tif p.DeviceType == \"panos\" {\n\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/profiles/custom-url-category/entry[@name='%s']\", name)\n\t}\n\n\tif p.DeviceType == \"panorama\" && len(devicegroup) > 0 {\n\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='%s']/profiles/custom-url-category/entry[@name='%s']\", devicegroup[0], name)\n\t}\n\n\tif p.DeviceType == \"panorama\" && len(devicegroup) <= 0 {\n\t\treturn errors.New(\"you must specify a device-group when connected to a Panorama device\")\n\t}\n\n\tquery := map[string]string{\n\t\t\"type\": \"config\",\n\t\t\"action\": \"set\",\n\t\t\"xpath\": xpath,\n\t\t\"key\": p.Key,\n\t\t\"element\": xmlBody,\n\t}\n\n\tresp := r.Send(\"post\", p.URI, nil, nil, query)\n\tif resp.Error != nil {\n\t\treturn resp.Error\n\t}\n\n\tif err := xml.Unmarshal(resp.Body, &reqError); err != nil {\n\t\treturn err\n\t}\n\n\tif reqError.Status != \"success\" {\n\t\treturn fmt.Errorf(\"error code %s: %s\", reqError.Code, errorCodes[reqError.Code])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "58d612b904b253843ec8a59b2e3b6f54", "score": "0.45749843", "text": "func CreateSignature(cli bce.Client, args *CreateSignatureArgs) (*CreateSignatureResult, error) {\n\tif err := CheckError(args != nil, \"CreateSignatureArgs can not be nil\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := CheckError(len(args.Content) > 0, \"content can not be blank\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := CheckError(len(args.ContentType) > 0, \"contentType can not be blank\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := CheckError(len(args.CountryType) > 0, \"countryType can not be blank\"); err != nil {\n\t\treturn nil, err\n\t}\n\treq := &bce.BceRequest{}\n\treq.SetUri(REQUEST_URI_SIGNATURE)\n\treq.SetMethod(http.POST)\n\treq.SetHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE)\n\treq.SetParam(CLIENT_TOKEN, util.NewUUID())\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.SetBody(body)\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.IsFail() {\n\t\treturn nil, resp.ServiceError()\n\t}\n\tresult := &CreateSignatureResult{}\n\tif err := resp.ParseJsonBody(result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7256ef3ec88a9f14d8bf3811fca1fe12", "score": "0.45745265", "text": "func New() *Signature {\n\treturn &Signature{timer: time.Default, config: config.Default}\n}", "title": "" }, { "docid": "cc65fc9a5340613c91eca9afbaa3f3cd", "score": "0.45178807", "text": "func NewCategory(str string) *TransactionCategory {\n\tarr := strings.Split(str, \": \")\n\n\tbaseCategory := \"\"\n\tif len(arr) > 0 {\n\t\tbaseCategory = strings.TrimSpace(arr[0])\n\t}\n\n\tsubcategory := \"\"\n\tif len(arr) > 1 {\n\t\tsubcategory = strings.TrimSpace(arr[1])\n\t}\n\n\treturn &TransactionCategory{\n\t\tName: baseCategory,\n\t\tSub: subcategory,\n\t\tFullName: strings.TrimSpace(str),\n\t}\n}", "title": "" }, { "docid": "b2b905f77adc3cc29ca34fa6f80c83af", "score": "0.45093617", "text": "func (c *StatementEndingBalancClient) Create() *StatementEndingBalancCreate {\n\tmutation := newStatementEndingBalancMutation(c.config, OpCreate)\n\treturn &StatementEndingBalancCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "a96c718ef9150dce87f651077ce1bf02", "score": "0.44811842", "text": "func (t TopPeerCategoryBotsInline) construct() TopPeerCategoryClass { return &t }", "title": "" }, { "docid": "be0d0cd61e16de88dfc749f1fe307e74", "score": "0.4474987", "text": "func (conf *Configuration) Create() error {\n\n\t// test for camelCase, MixedCase, lowercase\n\tvar jsonBlob = []byte(`{\n\t\t\"asteriskServer\" : \"192.168.0.4\",\n\t\t\"AsteriskUser\" : \"\"\n\t\t\"AsteriskPassword\": \"\"\n\t\t\"AsteriskDatabase\": \"\"\n\t\t\"HelpDeskServer\" : \"192.168.0.1\",\n\t\t\"HelpDeskUser\" : \"\",\n\t\t\"HelpDeskPassword\": \"\",\n\t\t\"HelpDeskDatabase\": \"\",\n\t\t\"redmineserver\" : \"192.168.0.22\",\n\t\t\"RedmineKey\" : \"70d0affd9bc31f5ea60d6cf15483318ca9a2a8db\",\n\t\t\"InputMethod\" : \"CDR\",\n\t\t\"OutputMethod\" : \"API\"\n\t}`)\n\toptimize := true\n\n\terr := json.Unmarshal(jsonBlob, conf)\n\tif err == nil {\n\t\tif optimize {\n\t\t\tjsonBlob, _ = json.Marshal(conf)\n\t\t}\n\t\terr = ioutil.WriteFile(configFile, jsonBlob, 0644)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "0f4c4818824a82f2082d700d9251f9b5", "score": "0.44666913", "text": "func CategoryNew(c *gin.Context) {\r\n\th := DefaultH(c)\r\n\th[\"Title\"] = \"Новая категория товаров\"\r\n\tsession := sessions.Default(c)\r\n\th[\"Flash\"] = session.Flashes()\r\n\tsession.Save()\r\n\r\n\tc.HTML(http.StatusOK, \"categories/form\", h)\r\n}", "title": "" }, { "docid": "0f4c4818824a82f2082d700d9251f9b5", "score": "0.44666913", "text": "func CategoryNew(c *gin.Context) {\r\n\th := DefaultH(c)\r\n\th[\"Title\"] = \"Новая категория товаров\"\r\n\tsession := sessions.Default(c)\r\n\th[\"Flash\"] = session.Flashes()\r\n\tsession.Save()\r\n\r\n\tc.HTML(http.StatusOK, \"categories/form\", h)\r\n}", "title": "" }, { "docid": "a47e19acf25bbef890de2d0f4752b3b4", "score": "0.44570428", "text": "func CreateDeleteWarningConfigRequest() (request *DeleteWarningConfigRequest) {\n\trequest = &DeleteWarningConfigRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Qualitycheck\", \"2019-01-15\", \"DeleteWarningConfig\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "0d49df792107ca89d91e8446279bee0a", "score": "0.4456265", "text": "func (controller TagCertificateController) Create(w http.ResponseWriter, r *http.Request) (interface{}, int, error) {\n\tdefaultLog.Trace(\"controllers/tagcertificate_controller:Create() Entering\")\n\tdefer defaultLog.Trace(\"controllers/tagcertificate_controller:Create() Leaving\")\n\n\tif r.Header.Get(\"Content-Type\") != constants.HTTPMediaTypeJson {\n\t\treturn nil, http.StatusUnsupportedMediaType, &commErr.ResourceError{Message: \"Invalid Content-Type\"}\n\t}\n\n\tif r.ContentLength == 0 {\n\t\tsecLog.Warnf(\"controllers/tagcertificate_controller:Create() %s : The request body is not provided\", commLogMsg.InvalidInputBadParam)\n\t\treturn nil, http.StatusBadRequest, &commErr.ResourceError{Message: \"The request body is not provided\"}\n\t}\n\n\tvar reqTCCriteria models.TagCertificateCreateCriteria\n\n\t// Decode incoming json data\n\tdec := json.NewDecoder(r.Body)\n\tdec.DisallowUnknownFields()\n\n\terr := dec.Decode(&reqTCCriteria)\n\tif err != nil {\n\t\tdefaultLog.WithError(err).Warnf(\"controllers/tagcertificate_controller:Create() %s : Failed to decode request body as TagCertificateCreateCriteria\", commLogMsg.InvalidInputBadEncoding)\n\t\treturn nil, http.StatusBadRequest, &commErr.ResourceError{Message: \"Unable to decode JSON request body\"}\n\t}\n\n\t// validate Tag Certificate creation params\n\tif err := validateTagCertCreateCriteria(reqTCCriteria); err != nil {\n\t\tsecLog.WithError(err).Warnf(\"controllers/tagcertificate_controller:Create() %s : Error during Tag Certificate creation\", commLogMsg.InvalidInputBadParam)\n\t\treturn nil, http.StatusBadRequest, &commErr.ResourceError{Message: \"Error during Tag Certificate creation - \" + err.Error()}\n\t}\n\n\t// get the Tag CA Cert from the certstore\n\ttagCA := controller.CertStore[models.CaCertTypesTagCa.String()]\n\tvar tagCACert = tagCA.Certificates[0]\n\n\t// Initialize the TagCertConfig\n\tnewTCConfig := asset_tag.TagCertConfig{\n\t\tSubjectUUID: reqTCCriteria.HardwareUUID.String(),\n\t\tPrivateKey: tagCA.Key,\n\t\tTagCACert: &tagCACert,\n\t\tTagAttributes: reqTCCriteria.SelectionContent,\n\t\tValidityInSeconds: consts.DefaultTagCertValiditySeconds,\n\t}\n\n\t// build the x509.Certificate\n\tatCreator := asset_tag.NewAssetTag()\n\tnewAssetTagBytes, err := atCreator.CreateAssetTag(newTCConfig)\n\tif err != nil {\n\t\tdefaultLog.Warnf(\"controllers/tagcertificate_controller:Create() %s : Error during Tag Certificate creation: %s\", commLogMsg.AppRuntimeErr, err.Error())\n\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: \"Tag Certificate Creation failure\"}\n\t}\n\n\tnewX509TC, err := x509.ParseCertificate(newAssetTagBytes)\n\tif err != nil {\n\t\tdefaultLog.Warnf(\"controllers/tagcertificate_controller:Create() %s : Error during Tag Certificate creation: %s\", commLogMsg.AppRuntimeErr, err.Error())\n\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: \"Tag Certificate Creation failure\"}\n\t}\n\n\t// put this in an X509AttributeCert to extract the properties easily\n\ttempX509AttrCert, err := model.NewX509AttributeCertificate(newX509TC)\n\tif err != nil {\n\t\tdefaultLog.Warnf(\"controllers/tagcertificate_controller:Create() %s : Error during Tag Certificate creation: %s\", commLogMsg.AppRuntimeErr, err.Error())\n\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: \"Tag Certificate Creation failure\"}\n\t}\n\n\t// convert to a TagCertificate\n\tnewTagCert := hvs.TagCertificate{\n\t\tCertificate: newAssetTagBytes,\n\t\tSubject: tempX509AttrCert.Subject,\n\t\tIssuer: tagCACert.Issuer.String(),\n\t\tNotBefore: newX509TC.NotBefore.UTC(),\n\t\tNotAfter: newX509TC.NotAfter.UTC(),\n\t\tHardwareUUID: reqTCCriteria.HardwareUUID,\n\t}\n\n\t// set TagDigest\n\tnewTagCert.SetAssetTagDigest()\n\n\t// persist to DB\n\tnewTC, err := controller.Store.Create(&newTagCert)\n\tif err != nil {\n\t\tdefaultLog.WithError(err).Warnf(\"controllers/tagcertificate_controller:Create() %s : TagCertificate Creation failed\", commLogMsg.AppRuntimeErr)\n\t\treturn nil, http.StatusInternalServerError, errors.Errorf(\"Error while persisting TagCertificate to DB\")\n\t}\n\tsecLog.WithField(\"Name\", newTC.Subject).Infof(\"%s: TagCertificate created by: %s\", commLogMsg.PrivilegeModified, r.RemoteAddr)\n\treturn newTC, http.StatusCreated, nil\n}", "title": "" }, { "docid": "20cd3791bc23bcff13ea5c4ec130ae8b", "score": "0.44242996", "text": "func (s *secretService) Create(tx interface{}, namespace string, secret *specV1.Secret) (*specV1.Secret, error) {\n\treturn s.secret.CreateSecret(tx, namespace, secret)\n\n}", "title": "" }, { "docid": "2019448cf6a6ee22061c0623155c75a1", "score": "0.4421192", "text": "func createCategoryNTag(ctx context.Context, catName string, tagName string) (string, string) {\n\ttagSpec := tags.Category{Name: catName, Cardinality: \"MULTIPLE\"}\n\tmgr := newTagMgr(ctx, e2eVSphere.Client)\n\tcatID, err := mgr.CreateCategory(ctx, &tagSpec)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\ttagID, err := mgr.CreateTag(ctx, &tags.Tag{Name: tagName, CategoryID: catID})\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\treturn catID, tagID\n}", "title": "" }, { "docid": "be62b1504601f47b30aef33bb2e052ba", "score": "0.44023854", "text": "func New(id types.ID, kind Kind, height int, payload Payload) Signature {\n\treturn Signature{\n\t\tID: id,\n\t\tKind: kind,\n\t\tBlockHeight: height,\n\t\tPayload: payload,\n\t}\n}", "title": "" }, { "docid": "665f2a56f0df3eb0f5d56256c42804fd", "score": "0.4393406", "text": "func (c *Config) Create() *Config {\n\tc = &Config{\n\t\tcfg: Cfg{\n\t\t\tService: Service{\n\t\t\t\tName: \"EVIL_KL\",\n\t\t\t\tID: \"ec871226-7f5b-425b-bad4-f52fb6577d1f\",\n\t\t\t},\n\t\t\tLogger: Logger{\n\t\t\t\tPath: \"C:\\\\temp\\\\evil-kl\\\\servicelogs\\\\logs.txt\",\n\t\t\t\tLevel: 0,\n\t\t\t},\n\t\t\tMail: Mail{\n\t\t\t\tIMAP: IMAP{\n\t\t\t\t\tUsername: \"imapuser@test.ru\",\n\t\t\t\t\tPassword: \"password\",\n\t\t\t\t\tHost: \"localhost\",\n\t\t\t\t\tPort: 993,\n\t\t\t\t\tIncomingBox: \"INBOX\",\n\t\t\t\t\tCheckInterval: 10,\n\t\t\t\t},\n\t\t\t\tSMTP: SMTP{\n\t\t\t\t\tUsername: \"smtpuser@test.ru\",\n\t\t\t\t\tPassword: \"password\",\n\t\t\t\t\tHost: \"localhost\",\n\t\t\t\t\tPort: 25,\n\t\t\t\t\tName: \"some-user-name\",\n\t\t\t\t\tFrom: \"from@mail.ru\",\n\t\t\t\t\tSubject: \"Keylogger result\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tKeylogger: Keylogger{\n\t\t\t\tPath: \"C:\\\\temp\\\\evil-kl\\\\keylogger\\\\keylogger.txt\",\n\t\t\t},\n\t\t\tZipper: Zipper{\n\t\t\t\tPath: \"C:\\\\temp\\\\evil-kl\\\\result.zip\",\n\t\t\t},\n\t\t\tInstaller: Installer{\n\t\t\t\tServicePath: \"C:\\\\temp\\\\evil-kl\\\\evil-kl.exe\",\n\t\t\t\tRegPath: \"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\",\n\t\t\t\tRegName: \"evil-kl\",\n\t\t\t},\n\t\t},\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "67d164364a0ae544f7670ae4f700176f", "score": "0.43907905", "text": "func TestCreateCategory(t *testing.T) {\n\tcreateCategoryTest(t)\n}", "title": "" }, { "docid": "3bbd4444ea001eb0be436734b90354e5", "score": "0.43804896", "text": "func (r *DOSBotSignatureCategoryResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+DOSBotSignatureCategoryEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1cf33ebe78307662fb0d164a5ddfb71", "score": "0.43751043", "text": "func createTagBasedPolicy(ctx context.Context, pbmClient *pbm.Client,\n\tcategoryTagMap map[string]string) (*pbmtypes.PbmProfileId, string) {\n\ts1 := rand.NewSource(time.Now().UnixNano())\n\tr1 := rand.New(s1)\n\tprofileName := fmt.Sprintf(\"shared-ds-policy-%v-%v\", time.Now().UnixNano(), strconv.Itoa(r1.Intn(1000)))\n\n\tpbmCreateSpec := pbm.CapabilityProfileCreateSpec{\n\t\tName: profileName,\n\t\tDescription: \"tag based policy\",\n\t\tCategory: \"REQUIREMENT\",\n\t\tCapabilityList: []pbm.Capability{},\n\t}\n\t//var pbmCreateSpec pbm.CapabilityProfileCreateSpec\n\tfor k, v := range categoryTagMap {\n\t\tpbmCreateSpec.CapabilityList = append(pbmCreateSpec.CapabilityList, pbm.Capability{\n\t\t\tID: k,\n\t\t\tNamespace: \"http://www.vmware.com/storage/tag\",\n\t\t\tPropertyList: []pbm.Property{\n\t\t\t\t{\n\t\t\t\t\tID: \"com.vmware.storage.tag.\" + k + \".property\",\n\t\t\t\t\tValue: v,\n\t\t\t\t\tDataType: \"set\",\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\tcreateTagSpec, err := pbm.CreateCapabilityProfileSpec(pbmCreateSpec)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tprofileID, err := pbmClient.CreateProfile(ctx, *createTagSpec)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tframework.Logf(\"Tag based profile with id: %v and name: '%v' created\", profileID.UniqueId, profileName)\n\n\treturn profileID, profileName\n}", "title": "" }, { "docid": "eacfe6c4e7cdf2fbf4c12b3e35048435", "score": "0.43671587", "text": "func (c *ConfigpointClient) Create() *ConfigpointCreate {\n\tmutation := newConfigpointMutation(c.config, OpCreate)\n\treturn &ConfigpointCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "1f2945aa69553b42928aeecf655252d5", "score": "0.43631303", "text": "func (b *EndorsementBuilder) Signature(value []byte) *EndorsementBuilder {\n\tb.endorsement.Signature = value\n\treturn b\n}", "title": "" }, { "docid": "efa8e21633bfbf6c381cd7283549c08b", "score": "0.43564475", "text": "func createVsanDStoragePolicy(ctx context.Context, pbmClient *pbm.Client, allocationType string,\n\tcategoryTagMap map[string]string) (*pbmtypes.PbmProfileId, string) {\n\ts1 := rand.NewSource(time.Now().UnixNano())\n\tr1 := rand.New(s1)\n\tprofileName := fmt.Sprintf(\"vsand-policy-%v-%v\", time.Now().UnixNano(), strconv.Itoa(r1.Intn(1000)))\n\tpbmCreateSpec := pbm.CapabilityProfileCreateSpec{\n\t\tName: profileName,\n\t\tDescription: \"VSAND test policy\",\n\t\tCategory: \"REQUIREMENT\",\n\t\tCapabilityList: []pbm.Capability{\n\t\t\t{\n\t\t\t\tID: \"vSANDirectVolumeAllocation\",\n\t\t\t\tNamespace: \"vSANDirect\",\n\t\t\t\tPropertyList: []pbm.Property{\n\t\t\t\t\t{\n\t\t\t\t\t\tID: \"vSANDirectVolumeAllocation\",\n\t\t\t\t\t\tValue: allocationType,\n\t\t\t\t\t\tDataType: \"string\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tID: \"vSANDirectType\",\n\t\t\t\tNamespace: \"vSANDirect\",\n\t\t\t\tPropertyList: []pbm.Property{\n\t\t\t\t\t{\n\t\t\t\t\t\tID: \"vSANDirectType\",\n\t\t\t\t\t\tValue: \"vSANDirect\",\n\t\t\t\t\t\tDataType: \"string\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tfor k, v := range categoryTagMap {\n\n\t\tpbmCreateSpec.CapabilityList = append(pbmCreateSpec.CapabilityList, pbm.Capability{\n\t\t\tID: k,\n\t\t\tNamespace: \"http://www.vmware.com/storage/tag\",\n\t\t\tPropertyList: []pbm.Property{\n\t\t\t\t{\n\t\t\t\t\tID: \"com.vmware.storage.tag.\" + k + \".property\",\n\t\t\t\t\tValue: v,\n\t\t\t\t\tDataType: \"set\",\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\tcreateSpecVSAND, err := pbm.CreateCapabilityProfileSpec(pbmCreateSpec)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tprofileID, err := pbmClient.CreateProfile(ctx, *createSpecVSAND)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tframework.Logf(\"VSAND profile with id: %v and name: '%v' created\", profileID.UniqueId, profileName)\n\n\treturn profileID, profileName\n}", "title": "" }, { "docid": "86ff33be4893481b054e756399c1947a", "score": "0.43499655", "text": "func CategoryCreate(c *gin.Context) {\r\n\tdb := models.GetDB()\r\n\tcategory := models.Category{}\r\n\tif err := c.ShouldBind(&category); err != nil {\r\n\t\tsession := sessions.Default(c)\r\n\t\tsession.AddFlash(err.Error())\r\n\t\tsession.Save()\r\n\t\tc.Redirect(http.StatusSeeOther, \"/admin/new_category\")\r\n\t\treturn\r\n\t}\r\n\tif *category.ParentID == 0 {\r\n\t\tcategory.ParentID = nil\r\n\t}\r\n\tif err := db.Create(&category).Error; err != nil {\r\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\r\n\t\tlogrus.Error(err)\r\n\t\treturn\r\n\t}\r\n\tc.Redirect(http.StatusFound, \"/admin/categories\")\r\n}", "title": "" }, { "docid": "86ff33be4893481b054e756399c1947a", "score": "0.43499655", "text": "func CategoryCreate(c *gin.Context) {\r\n\tdb := models.GetDB()\r\n\tcategory := models.Category{}\r\n\tif err := c.ShouldBind(&category); err != nil {\r\n\t\tsession := sessions.Default(c)\r\n\t\tsession.AddFlash(err.Error())\r\n\t\tsession.Save()\r\n\t\tc.Redirect(http.StatusSeeOther, \"/admin/new_category\")\r\n\t\treturn\r\n\t}\r\n\tif *category.ParentID == 0 {\r\n\t\tcategory.ParentID = nil\r\n\t}\r\n\tif err := db.Create(&category).Error; err != nil {\r\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\r\n\t\tlogrus.Error(err)\r\n\t\treturn\r\n\t}\r\n\tc.Redirect(http.StatusFound, \"/admin/categories\")\r\n}", "title": "" }, { "docid": "7740a5fef49272a52b54c404c3096555", "score": "0.4338382", "text": "func CreateDescribeGatewayCategoriesRequest() (request *DescribeGatewayCategoriesRequest) {\n\trequest = &DescribeGatewayCategoriesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"sgw\", \"2018-05-11\", \"DescribeGatewayCategories\", \"hcs_sgw\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "045155c88977323c4125aa41e3ee2e95", "score": "0.43253434", "text": "func (*CreateCategoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_category_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3c8873012a21cab062f22a8d32df528e", "score": "0.42950878", "text": "func (d *DGC) CreateSigStructure() ([]byte, error) {\n\ttoBeSigned, err := cose.Marshal([]interface{}{\n\t\tContextSignature,\n\t\td.V.Protected,\n\t\t[]byte{},\n\t\td.V.Payload,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"Error marshaling structure: %s\", err)\n\t}\n\treturn toBeSigned, nil\n}", "title": "" }, { "docid": "4d69fff75993b1af98ba4bd90cde66c9", "score": "0.42935383", "text": "func NewSignature(secret string) *Signature {\n\tif secret == \"\" {\n\t\tlog.Fatal(\"Failed to create signature: secret key missing\")\n\t}\n\tsignature := new(Signature)\n\tsignature.secret = secret\n\tsignature.timeout = time.Hour * 24 * 365\n\treturn signature\n}", "title": "" }, { "docid": "a0369f32efe7b56ec4191dd3aab710ad", "score": "0.42935064", "text": "func (ca *PlatformCatalog) CreateCategories(body CategoryRequestBody) (CategoryCreateResponse, error){\n \n var (\n rawRequest *RawRequest\n response []byte\n err error\n createCategoriesResponse CategoryCreateResponse\n\t )\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n\n \n\n \n \n \n //Parse req body to map\n var reqBody map[string]interface{}\n reqBodyJSON, err := json.Marshal(body)\n if err != nil {\n \n return CategoryCreateResponse{}, common.NewFDKError(err.Error())\n }\n err = json.Unmarshal([]byte(reqBodyJSON), &reqBody)\n if err != nil {\n \n return CategoryCreateResponse{}, common.NewFDKError(err.Error())\n }\n \n //API call\n rawRequest = NewRequest(\n ca.Config,\n \"post\",\n fmt.Sprintf(\"/service/platform/catalog/v1.0/company/%s/category/\",ca.CompanyID),\n nil,\n nil,\n reqBody)\n response, err = rawRequest.Execute()\n if err != nil {\n return CategoryCreateResponse{}, err\n\t }\n \n err = json.Unmarshal(response, &createCategoriesResponse)\n if err != nil {\n return CategoryCreateResponse{}, common.NewFDKError(err.Error())\n }\n return createCategoriesResponse, nil\n \n }", "title": "" }, { "docid": "4e3449749be33875c1e7362583d41d2b", "score": "0.4291824", "text": "func CreateQuestionCategory(questionCategory *entity.QuestionCategory, client *statsd.Client) (err error) {\n\tt := client.NewTiming()\n\tif err = config.DB.Create(&questionCategory).Error; err != nil {\n\t\treturn err\n\t}\n\tt.Send(\"create_question_category.query_time\")\n\treturn nil\n}", "title": "" }, { "docid": "dbdf202a726e04f19d17d491a2e418dc", "score": "0.4282048", "text": "func Create(input models.Category) (*models.Category, error) {\n\tinput = sanitize(input)\n\t// Did they give us enough to save?\n\terr := validate(input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// prepare the rest of the resource\n\tinput.ID = uuid.NewV4()\n\tinput.SetCreationTimestamp()\n\n\t// save\n\tds := newDatastore()\n\terr = ds.C().Insert(input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &input, nil\n}", "title": "" }, { "docid": "1e4e421bbdab0c3a056138aa962fd70a", "score": "0.4274826", "text": "func Create(secret *corev1.Secret, namespace string, config *rest.Config) (*corev1.Secret, error) {\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclean(secret)\n\n\ts, err := clientset.CoreV1().Secrets(namespace).Create(secret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "c756b2c098a338a3692a006ea828e8bb", "score": "0.4269703", "text": "func newCategoryMutation(c config, op Op, opts ...categoryOption) *CategoryMutation {\n\tm := &CategoryMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeCategory,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "e9df51759b5e8cc46688c4e2e8763031", "score": "0.42671472", "text": "func CreateSecret(parent string, secretId string) (string, error) {\n\t// Build the request.\n\treq := &secretpb.CreateSecretRequest{\n\t\tParent: parent,\n\t\tSecretId: secretId,\n\t\tSecret: &secretpb.Secret{\n\t\t\tReplication: &secretpb.Replication{\n\t\t\t\tReplication: &secretpb.Replication_Automatic_{\n\t\t\t\t\tAutomatic: &secretpb.Replication_Automatic{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Call the API.\n\tsecResp, err := secClient.CreateSecret(types.Ctx, req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn secResp.Name, nil\n}", "title": "" }, { "docid": "6ac5c965a31f497c01f421c4cc90f455", "score": "0.42566347", "text": "func Create(conf string) error {\n\tvar err error\n\terr = loadConfig(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquit.Add(shutdown)\n\tquit.Add(logit.Quit)\n\n\tif Development {\n\t\tlogit.Log(logit.NOTICE, \"Development mode enabled\")\n\t}\n\n\tif HTTPS {\n\t\tFullDomain = \"https://\" + Domain\n\t} else {\n\t\tFullDomain = \"http://\" + Domain\n\t}\n\n\tif Development {\n\t\tlogit.Log(logit.DEBUG, \"Working Domain: \", FullDomain)\n\t}\n\n\tif limiter == nil {\n\t\tlogit.Log(logit.NOTICE, \"Limiter disabled due to configuration\")\n\t} else {\n\t\tAddHandler(1000, limit)\n\t}\n\n\tserver = &http.Server{}\n\n\tisInit = true\n\treturn nil\n}", "title": "" }, { "docid": "d363beca43a25ff2ea582c54128247b0", "score": "0.42540723", "text": "func (r *DOSBotSignatureCategoryResource) ListAll() (*DOSBotSignatureCategoryConfigList, error) {\n\tvar list DOSBotSignatureCategoryConfigList\n\tif err := r.c.ReadQuery(BasePath+DOSBotSignatureCategoryEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "title": "" }, { "docid": "03b2545e726e6b12e80f06e4f0164f25", "score": "0.4249641", "text": "func CreateTransactionCategory(category models.BudgetTransactionCategoryCreationPayload, userID uuid.UUID) (*models.BudgetTransactionCategory, *errors.Error) {\n\n\tif !roleService.IsUserAdmin(category.BudgetID, userID) && !roleService.IsUserOwner(category.BudgetID, userID) {\n\t\treturn nil, &errors.Error{\n\t\t\tStatusCode: http.StatusForbidden,\n\t\t\tMessage: \"You are not authorized to create a transaction category for the given budget\",\n\t\t}\n\t}\n\n\tconnection := database.GetConnection()\n\n\tdefer database.CloseConnection(connection)\n\n\tquery := \"INSERT INTO budget_transaction_categories (budget_id, category_name) VALUES ($1, $2) RETURNING budget_transaction_category_id, budget_id, category_name\"\n\n\tstmt := database.PrepareStatement(connection, query)\n\n\tvar temp models.BudgetTransactionCategory\n\n\tscanErr := stmt.QueryRow(category.BudgetID, category.CategoryName).Scan(&temp.BudgetTransactionCategoryID, &temp.BudgetID, &temp.CategoryName)\n\n\tif scanErr != nil {\n\t\treturn nil, &errors.Error{\n\t\t\tMessage: scanErr.Error(),\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\treturn &temp, nil\n}", "title": "" }, { "docid": "94f3af9697aaf5859c2513d28df065ed", "score": "0.42487758", "text": "func CreateChannel() {\n\theaders := make(map[string]string)\n\theaders[\"Content-Type\"] = \"application/json\"\n\tauthenticator := &core.IamAuthenticator{\n\t\tApiKey: apiKey,\n\t\tURL: url, //use for dev/preprod env\n\t}\n\tservice, _ := notificationsapiv1.NewNotificationsApiV1(&notificationsapiv1.NotificationsApiV1Options{\n\t\tAuthenticator: authenticator,\n\t\tURL: \"https://us-south.secadvisor.cloud.ibm.com/notifications\", //Specify url or use default\n\t})\n\n\tchannelName := \"sdktest_channel_exmpl\"\n\tendpoint := \"https://ss.ss\"\n\tchannelType := \"Webhook\"\n\tseverity := []string{notificationsapiv1.CreateNotificationChannelOptions_Severity_Low, notificationsapiv1.CreateNotificationChannelOptions_Severity_High, notificationsapiv1.CreateNotificationChannelOptions_Severity_Critical}\n\n\tvar alertSource []notificationsapiv1.NotificationChannelAlertSourceItem\n\tsource, _ := service.NewNotificationChannelAlertSourceItem(\"ATA\")\n\tsource.FindingTypes = []string{\"appid\", \"cos\", \"iks\"}\n\talertSource = append(alertSource, *source)\n\n\tcreateOptions := service.NewCreateNotificationChannelOptions(accountID, channelName, channelType, endpoint)\n\n\t//Below set of calls are not required. A channel can be created with just channelName, channelType, endpoint. Rest will saaume default value.\n\tcreateOptions.SetHeaders(headers)\n\tcreateOptions.SetSeverity(severity)\n\tcreateOptions.SetEnabled(true)\n\tcreateOptions.SetDescription(\"this is a test\")\n\tcreateOptions.SetAlertSource(alertSource)\n\n\tresult, response, err := service.CreateNotificationChannel(createOptions)\n\tif err != nil {\n\t\tfmt.Println(response.Result)\n\t\tfmt.Println(\"Failed to create channel: \", err)\n\t\treturn\n\t}\n\tfmt.Println(*result.ChannelID)\n\tfmt.Println(*result.StatusCode)\n\n}", "title": "" }, { "docid": "36e9837beb531c5e305c1770625847b4", "score": "0.42465067", "text": "func NewMacOSGeneralDeviceConfiguration()(*MacOSGeneralDeviceConfiguration) {\n m := &MacOSGeneralDeviceConfiguration{\n DeviceConfiguration: *NewDeviceConfiguration(),\n }\n odataTypeValue := \"#microsoft.graph.macOSGeneralDeviceConfiguration\"\n m.SetOdataType(&odataTypeValue)\n return m\n}", "title": "" }, { "docid": "cbadcb0e996d1c175221ca57e721d462", "score": "0.42385137", "text": "func CreateRoutineCategory(c *gin.Context) {\n\tnewCategory := model.RoutineCategory{}\n\tbodyErr := c.BindJSON(&newCategory)\n\n\terr := service.CreateRoutineCategory(newCategory)\n\n\tif bodyErr == nil {\n\t\tif err != nil {\n\t\t\terror := service.GetGormErrorCode(err.Error())\n\n\t\t\tc.JSON(500, error)\n\t\t} else {\n\t\t\tc.String(200, \"ok\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aade59627d7ba7be897d80f525baad0a", "score": "0.4221699", "text": "func NewDOMAIN(config configuration_pkg.CONFIGURATION) *DOMAIN_IMPL {\r\n client := new(DOMAIN_IMPL)\r\n client.config = config\r\n return client\r\n}", "title": "" }, { "docid": "81b885bed9e03a4b493da48e836075c3", "score": "0.42145592", "text": "func (b *Builder) Create(ctx context.Context, set CreateSettings) (Extension, error) {\n\tcfg, existsCfg := b.cfgs[set.ID]\n\tif !existsCfg {\n\t\treturn nil, fmt.Errorf(\"extension %q is not configured\", set.ID)\n\t}\n\n\tf, existsFactory := b.factories[set.ID.Type()]\n\tif !existsFactory {\n\t\treturn nil, fmt.Errorf(\"extension factory not available for: %q\", set.ID)\n\t}\n\n\tsl := f.ExtensionStability()\n\tif sl >= component.StabilityLevelAlpha {\n\t\tset.Logger.Debug(sl.LogMessage())\n\t} else {\n\t\tset.Logger.Info(sl.LogMessage())\n\t}\n\treturn f.CreateExtension(ctx, set, cfg)\n}", "title": "" }, { "docid": "6687ab37625d7cf3b9a47458d971db58", "score": "0.41969004", "text": "func (client *PetsClient) createCatAPTrueCreateRequest(ctx context.Context, createParameters CatAPTrue, options *PetsClientCreateCatAPTrueOptions) (*policy.Request, error) {\n\turlPath := \"/additionalProperties/true-subclass\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, createParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "cc8174f19c028ad46a99b0eb68deb699", "score": "0.41846788", "text": "func CreateLogger(args ...interface{}) (Logger, error) {\n\tconfig := Config{}\n\tlogger := Logger{}\n\tr := regexp.MustCompile(`bunyan.Config$`)\n\n\tif len(args) == 0 {\n\t\treturn logger, fmt.Errorf(\"Create logger requires either a bunyan.Config or String argument\")\n\t}\n\n\t// get hostname\n\tif hostname, err := os.Hostname(); err != nil {\n\t\treturn logger, err\n\t} else {\n\t\tlogger.hostname = hostname\n\t}\n\n\targ := args[0]\n\targType := typeName(arg)\n\n\tif argType == \"string\" {\n\t\tconfig.Name = arg.(string)\n\t} else if r.MatchString(argType) {\n\t\tconfig = arg.(Config)\n\t\tif config.Name == \"\" {\n\t\t\treturn logger, fmt.Errorf(\"Bunyan Config requires a name, none specified\")\n\t\t}\n\t} else {\n\t\treturn logger, fmt.Errorf(\"Create logger requires either a bunyan.Config or String argument\")\n\t}\n\n\tif config.DefaultKey == \"\" {\n\t\tconfig.DefaultKey=\"msg\"\n\t}\n\n\n\t// add the config to the logger\n\tlogger.config = config\n\tlogger.staticFields = config.StaticFields\n\tlogger.serializers = config.Serializers\n\tlogger.defaultKey = config.DefaultKey\n\n\t// add the streams\n\tif len(config.Streams) != 0 {\n\t\tfor _, stream := range config.Streams {\n\t\t\tlogger.AddStream(stream)\n\t\t}\n\t} else if config.Stream != nil {\n\t\tsimpleStream := Stream{Stream: config.Stream, Name: config.Name}\n\t\tlogger.AddStream(simpleStream)\n\t}\n\n\treturn logger, nil\n}", "title": "" }, { "docid": "3085e2ab40291394e7c419ec6dad20aa", "score": "0.41812015", "text": "func (n NotificationTypeNewSecretChat) construct() NotificationTypeClass { return &n }", "title": "" }, { "docid": "09cee80adfef34cfa9160865ca8a782a", "score": "0.41676503", "text": "func Create(c backend.Config) (connector.Interface, error) {\n\n\tswitch c.Type {\n\tcase backend.WeChatIOT, backend.WeChatUnset:\n\t\treturn newIOT(c)\n\t}\n\n\treturn nil, fmt.Errorf(\"not reach here\")\n}", "title": "" }, { "docid": "7e92e4cfea7ce3c42efbd2cffc0adc46", "score": "0.41642687", "text": "func (format *Delete) Configure(conf core.PluginConfigReader) {\n}", "title": "" }, { "docid": "dc0b2ed0d5c8629d51fbe378469112ef", "score": "0.41640133", "text": "func (kf *KunstructuredFactoryImpl) MakeSecret(args *types.SecretArgs, options *types.GeneratorOptions) (ifc.Kunstructured, error) {\n\tsec, err := kf.secretFactory.MakeSecret(args, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewKunstructuredFromObject(sec)\n}", "title": "" }, { "docid": "d415a89cfc836fbeed1cad332ad0cae1", "score": "0.41576046", "text": "func NewSignedCert(cfg Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer, duration time.Duration) (*x509.Certificate, error) {\n\tserial, err := cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(cfg.CommonName) == 0 {\n\t\treturn nil, errors.New(\"must specify a CommonName\")\n\t}\n\tif len(cfg.Usages) == 0 {\n\t\treturn nil, errors.New(\"must specify at least one ExtKeyUsage\")\n\t}\n\n\tcertTmpl := x509.Certificate{\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: cfg.CommonName,\n\t\t\tOrganization: cfg.Organization,\n\t\t},\n\t\tDNSNames: cfg.AltNames.DNSNames,\n\t\tIPAddresses: cfg.AltNames.IPs,\n\t\tSerialNumber: serial,\n\t\tNotBefore: caCert.NotBefore,\n\t\tNotAfter: time.Now().Add(duration).UTC(),\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: cfg.Usages,\n\t}\n\tif cfg.NotBefore != nil {\n\t\tcertTmpl.NotBefore = *cfg.NotBefore\n\t}\n\tif cfg.NotAfter != nil {\n\t\tcertTmpl.NotAfter = *cfg.NotAfter\n\t}\n\tcertDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &certTmpl, caCert, key.Public(), caKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn x509.ParseCertificate(certDERBytes)\n}", "title": "" }, { "docid": "881095b23fca0f20070f69a3dc375932", "score": "0.41478285", "text": "func (ctl *VppAgentCtl) createDNat() {\n\t// DNat config\n\tdNat := &nat.Nat44DNat_DNatConfig{\n\t\tLabel: \"dnat1\",\n\t\tStMappings: []*nat.Nat44DNat_DNatConfig_StaticMapping{\n\t\t\t{\n\t\t\t\tExternalInterface: \"tap1\",\n\t\t\t\tExternalIp: \"192.168.0.1\",\n\t\t\t\tExternalPort: 8989,\n\t\t\t\tLocalIps: []*nat.Nat44DNat_DNatConfig_StaticMapping_LocalIP{\n\t\t\t\t\t{\n\t\t\t\t\t\tVrfId: 0,\n\t\t\t\t\t\tLocalIp: \"172.124.0.2\",\n\t\t\t\t\t\tLocalPort: 6500,\n\t\t\t\t\t\tProbability: 40,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tVrfId: 0,\n\t\t\t\t\t\tLocalIp: \"172.125.10.5\",\n\t\t\t\t\t\tLocalPort: 2300,\n\t\t\t\t\t\tProbability: 40,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProtocol: 1,\n\t\t\t\tTwiceNat: nat.TwiceNatMode_ENABLED,\n\t\t\t},\n\t\t},\n\t\tIdMappings: []*nat.Nat44DNat_DNatConfig_IdentityMapping{\n\t\t\t{\n\t\t\t\tVrfId: 0,\n\t\t\t\tIpAddress: \"10.10.0.1\",\n\t\t\t\tPort: 2525,\n\t\t\t\tProtocol: 0,\n\t\t\t},\n\t\t},\n\t}\n\n\tctl.Log.Println(dNat)\n\tctl.broker.Put(nat.DNatKey(dNat.Label), dNat)\n}", "title": "" }, { "docid": "667e59c6cb3552b018de21cd622ed9ef", "score": "0.41428864", "text": "func (c *Client) CreateSecret(value string, opts ...Option) (Metadata, error) {\n\tm := Metadata{}\n\tdata := url.Values{\n\t\t\"secret\": {value},\n\t}\n\tapply(data, opts...)\n\terr := c.Do(\"POST\", \"/share\", data, &m)\n\tif err != nil {\n\t\treturn Metadata{}, err\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "6f6c339549bbbf11680f0a9e32fa7509", "score": "0.4135796", "text": "func (fmb *MetadataBackend) Create(ctx *common.PlikContext, upload *common.Upload) (err error) {\n\tdefer ctx.Finalize(err)\n\n\t// Get metadata file path\n\tdirectory := fmb.Config.Directory + \"/\" + upload.ID[:2] + \"/\" + upload.ID\n\tmetadataFile := directory + \"/.config\"\n\n\t// Serialize metadata to json\n\tb, err := json.MarshalIndent(upload, \"\", \" \")\n\tif err != nil {\n\t\terr = ctx.EWarningf(\"Unable to serialize metadata to json : %s\", err)\n\t\treturn\n\t}\n\n\t// Create upload directory if needed\n\tif _, err = os.Stat(directory); err != nil {\n\t\tif err = os.MkdirAll(directory, 0777); err != nil {\n\t\t\terr = ctx.EWarningf(\"Unable to create upload directory %s : %s\", directory, err)\n\t\t\treturn\n\t\t}\n\t\tctx.Infof(\"Upload directory %s successfully created\", directory)\n\t}\n\n\t// Create metadata file\n\tf, err := os.OpenFile(metadataFile, os.O_RDWR|os.O_CREATE, os.FileMode(0666))\n\tif err != nil {\n\t\terr = ctx.EWarningf(\"Unable to create metadata file %s : %s\", metadataFile, err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// Print content\n\t_, err = f.Write(b)\n\tif err != nil {\n\t\terr = ctx.EWarningf(\"Unable to write metadata file %s : %s\", metadataFile, err)\n\t\treturn\n\t}\n\n\t// Sync on disk\n\terr = f.Sync()\n\tif err != nil {\n\t\terr = ctx.EWarningf(\"Unable to sync metadata file %s : %s\", metadataFile, err)\n\t\treturn\n\t}\n\n\tctx.Infof(\"Metadata file successfully saved %s\", metadataFile)\n\treturn\n}", "title": "" }, { "docid": "e525def7f801b6f763075ad3d3e1071d", "score": "0.41284263", "text": "func (client *Client) CreateCategorizationTask(callbackURL, instruction, attachmentType, attachment string, categories []string) (task Task, err error) {\n\tv := url.Values{}\n\tv.Set(\"callback_url\", callbackURL)\n\tv.Set(\"instruction\", instruction)\n\tv.Set(\"attachment_type\", attachmentType)\n\tv.Set(\"attachment\", attachment)\n\n\tfor _, category := range categories {\n\t\tv.Add(\"categories\", category)\n\t}\n\n\tbody := strings.NewReader(v.Encode())\n\treq, err := http.NewRequest(\"POST\", \"https://api.scaleapi.com/v1/task/categorize\", body)\n\tif err != nil {\n\t\treturn task, err\n\t}\n\treq.SetBasicAuth(client.Key, \"\")\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn task, err\n\t}\n\tdefer resp.Body.Close()\n\n\tjson.NewDecoder(resp.Body).Decode(&task)\n\n\treturn task, err\n}", "title": "" }, { "docid": "03b091eac4c2c683637f19760948f8bf", "score": "0.41265208", "text": "func createCategoryTest(t *testing.T) Category {\n\n\t//Category params\n\targ := CreateCategoryParams{\n\t\tCategoryID: strings.ToUpper(uuid.New().String()),\n\t\tCategoryName: util.RandomString(7) + \"Flower - Category Name\",\n\t\tCategoryHtmlDescription: \"some category description\",\n\t\tImage: \"some image category image\",\n\t}\n\n\tres, err := testQueries.CreateCategory(context.Background(), arg)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcategoryId, err := res.LastInsertId()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcategory, err := testQueries.GetCategory(context.Background(), arg.CategoryID)\n\n\tlog.Println(categoryId)\n\trequire.NoError(t, err)\n\trequire.NotEmpty(t, category)\n\n\treturn category\n}", "title": "" }, { "docid": "d921514d527a5c4464ac0aee5f60d4cb", "score": "0.41244498", "text": "func (sca *ServiceCatalogAPI) CreateSecret(secret *v1core.Secret) (*v1core.Secret, error) {\n\treturn sca.K8sClient.CoreV1().Secrets(secret.Namespace).Create(secret)\n}", "title": "" }, { "docid": "4744ccb2c316c16acb5902c5e7af8529", "score": "0.41143417", "text": "func CreateCategory(ctx context.Context, name, alias, description string, position int64) (*Category, error) {\n\talias = strings.TrimSpace(alias)\n\tname = strings.TrimSpace(name)\n\tdescription = strings.TrimSpace(description)\n\tif name == \"\" {\n\t\treturn nil, session.BadDataError(ctx)\n\t}\n\tif alias == \"\" {\n\t\talias = name\n\t}\n\n\tt := time.Now()\n\tcategory := &Category{\n\t\tCategoryID: uuid.Must(uuid.NewV4()).String(),\n\t\tName: name,\n\t\tAlias: alias,\n\t\tDescription: description,\n\t\tTopicsCount: 0,\n\t\tPosition: position,\n\t\tCreatedAt: t,\n\t\tUpdatedAt: t,\n\t}\n\n\terr := session.Database(ctx).RunInTransaction(ctx, func(tx pgx.Tx) error {\n\t\tif position == 0 {\n\t\t\tlast, err := lastCategoryPosition(ctx, tx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcategory.Position = last + 1\n\t\t}\n\n\t\trows := [][]interface{}{\n\t\t\tcategory.values(),\n\t\t}\n\t\t_, err := tx.CopyFrom(ctx, pgx.Identifier{\"categories\"}, categoryColumns, pgx.CopyFromRows(rows))\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, session.TransactionError(ctx, err)\n\t}\n\treturn category, nil\n}", "title": "" }, { "docid": "88478c44c037bd7d5d49acdff6bb1daa", "score": "0.41101247", "text": "func (c *Client) SetCategory(infoHashList []string, category string) (*http.Response, error) {\n\tparams := c.processInfoHashList(infoHashList)\n\tparams[\"category\"] = category\n\treturn c.post(\"command/setLabel\", params)\n}", "title": "" }, { "docid": "246885e955bf2a7fb46159a1e128e1a6", "score": "0.41030464", "text": "func NewAndroidGeneralDeviceConfiguration()(*AndroidGeneralDeviceConfiguration) {\n m := &AndroidGeneralDeviceConfiguration{\n DeviceConfiguration: *NewDeviceConfiguration(),\n }\n odataTypeValue := \"#microsoft.graph.androidGeneralDeviceConfiguration\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "title": "" }, { "docid": "b404bd92ac9a382b76ecd25312aa17a9", "score": "0.41019753", "text": "func Make(namespace string, i int) config.Entry {\n\tname := fmt.Sprintf(\"%s%d\", \"fake-config\", i)\n\treturn config.Entry{\n\t\tMeta: config.Meta{\n\t\t\tType: FakeConfig.Type,\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"key\": name,\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t\"annotationkey\": name,\n\t\t\t},\n\t\t},\n\t\tSpec: &testproto.FakeConfig{\n\t\t\tKey: name,\n\t\t\tPairs: []*testproto.Pair{\n\t\t\t\t{Key: \"key\", Value: strconv.Itoa(i)},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "14b5e9f7147aa87b3efb3b3e7e029216", "score": "0.41018", "text": "func (s *Service) Create(ctx context.Context, f *Form) (*Category, error) {\n\tif err := s.Validater.Validate(ctx, f); err != nil {\n\t\treturn nil, errors.Wrap(err, \"validater validate\")\n\t}\n\n\tvar nc NewCategory\n\tnc.Name = f.Name\n\n\tvar cat Category\n\tif err := s.Repository.Create(ctx, &nc, &cat); err != nil {\n\t\treturn nil, errors.Wrap(err, \"repository create category\")\n\t}\n\n\treturn &cat, nil\n}", "title": "" }, { "docid": "4bba85ef50c3cae986f4dbb5741b4391", "score": "0.40997848", "text": "func CreateEducationIdentityCreationConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewEducationIdentityCreationConfiguration(), nil\n}", "title": "" }, { "docid": "f2923b8f4e8cdc8153f104d138f1ec48", "score": "0.40887964", "text": "func CreateMacOSAzureAdSingleSignOnExtensionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMacOSAzureAdSingleSignOnExtension(), nil\n}", "title": "" }, { "docid": "547b28c657e6e56c0ee89f4f3891daa9", "score": "0.40881005", "text": "func New(opts ...suite.Opt) *Suite {\n\ts := &Suite{}\n\n\tsuite.InitSuiteOptions(&s.SignatureSuite, opts...)\n\n\treturn s\n}", "title": "" }, { "docid": "c83e46b7e13777aa95c851ea7feaa4d4", "score": "0.40746555", "text": "func Create(key string) *corev1.Secret {\n\treturn &corev1.Secret{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Secret\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"tekton-ci-auth\",\n\t\t\tNamespace: \"testing\",\n\t\t},\n\t\tType: corev1.SecretTypeOpaque,\n\t\tData: map[string][]byte{\n\t\t\tkey: []byte(`secret-token`),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2b68956af1c32d2fb6e1b80ec553385f", "score": "0.40668282", "text": "func genConfig() error {\r\n\tconf := fmt.Sprintf(confSkel, \"[OSU TOKEN]\",\r\n\t\t\"[TELEGRAM TOKEN]\", 11111111, 60, 50, \"track.db\", 1, \"[\\\"Cookiezi\\\"]\")\r\n\r\n\terr := ioutil.WriteFile(\"config.sample\", []byte(conf), 0644)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "a7939364af46d0c5dac8b1ef4825485b", "score": "0.40560418", "text": "func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {\n\tc := config.DefaultConfig\n\tif err := cfg.Unpack(&c); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading config file: %v\", err)\n\t}\n\tsess := session.Must(session.NewSession())\n\tsvc := sqs.New(sess)\n\tlogger := logp.NewLogger(\"internal\")\n\tqueueURLResp, err := svc.GetQueueUrl(&sqs.GetQueueUrlInput{\n\t\tQueueName: aws.String(c.SQSQueueName),\n\t\tQueueOwnerAWSAccountId: aws.String(c.AccountID),\n\t})\n\tlogger.Infof(\"SQS URL %s\", queueURLResp.QueueUrl)\n\tif err != nil {\n\t\tlogger.Error(\"Could not get Queue Name\")\n\t\treturn nil, err\n\t}\n\ts3Svc := s3.New(sess)\n\tdownloader := s3manager.NewDownloaderWithClient(s3Svc)\n\tbt := &Cloudtrailbeat{\n\t\tdone: make(chan struct{}),\n\t\tconfig: c,\n\t\tsqs: svc,\n\t\tqueueURL: *queueURLResp.QueueUrl,\n\t\tdownloader: downloader,\n\t\tlogger: *logger,\n\t}\n\treturn bt, nil\n}", "title": "" }, { "docid": "9f47205b56b16d9f3fb1507bde0d18dc", "score": "0.40511516", "text": "func (c *AgentkycClient) Create() *AgentkycCreate {\n\tmutation := newAgentkycMutation(c.config, OpCreate)\n\treturn &AgentkycCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "5e04cd644c53569fbb14786fbcf70c72", "score": "0.40500063", "text": "func (w *Client) MakeSignatureParams() SignatureParams {\n\tp := make(SignatureParams)\n\tp[keyParam] = w.Config.Key\n\tp[tParam] = strconv.FormatInt(time.Now().Unix(), 10)\n\treturn p\n}", "title": "" }, { "docid": "2569108c499ceeefc46f005dc20f42f0", "score": "0.4049177", "text": "func CreatePluginRatelimit(c *gin.Context) {\n\tbody := c.PostForm(\"content\")\n\n\tres := &ratelimit.Config{}\n\terr := yaml.UnmarshalYML([]byte(body), res)\n\tif err != nil {\n\t\tlogger.Warnf(\"read body err, %v\\n\", err)\n\t\tc.JSON(http.StatusOK, controller.WithError(err))\n\t\treturn\n\t}\n\n\tsetErr := logic.BizSetPluginRatelimitInfo(res, true)\n\tif setErr != nil {\n\t\tc.JSON(http.StatusOK, controller.WithError(setErr))\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, controller.WithRet(\"Success\"))\n}", "title": "" }, { "docid": "d4d2cf2377b3eadfb9629aec12ebf005", "score": "0.40455168", "text": "func CreateCat(cat Cat) {\n\t// connect to redis\n\tc := RedisConnect()\n\tdefer c.Close()\n\n\t// set up our data as a blob of json strings\n\tb, err := json.Marshal(cat)\n\tHandleError(err)\n\n\t// save json blob to redis\n\treply, err := c.Do(\"SET\", \"cat:\"+cat.Id, b)\n\tfmt.Println(\"SET\", \"cat:\"+cat.Id, b)\n\tHandleError(err)\n\n\t// get the redis reply\n\tfmt.Println(\"GET \", reply)\n}", "title": "" }, { "docid": "58ced155cdbc60ccaf64284fc550805d", "score": "0.40395153", "text": "func CreateConfig(client Client, actionID, filename string) (Response, error) {\n\treturn send(client, \"CreateConfig\", actionID, map[string]string{\n\t\t\"Filename\": filename,\n\t})\n}", "title": "" }, { "docid": "ec052efcd4ffac06873cc6b58ded28df", "score": "0.403903", "text": "func NewSignedCert(cfg Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error) {\n\tserial, err := rand.Int(rand.Reader, new(big.Int).SetInt64(math.MaxInt64))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(cfg.CommonName) == 0 {\n\t\treturn nil, errors.New(\"must specify a CommonName\")\n\t}\n\tif len(cfg.Usages) == 0 {\n\t\treturn nil, errors.New(\"must specify at least one ExtKeyUsage\")\n\t}\n\n\tvar dnsNames []string\n\tvar ips []net.IP\n\n\tfor _, v := range cfg.AltNames.DNSNames {\n\t\tdnsNames = append(dnsNames, v)\n\t}\n\tfor _, v := range cfg.AltNames.IPs {\n\t\tips = append(ips, v)\n\t}\n\tcertTmpl := x509.Certificate{\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: cfg.CommonName,\n\t\t\tOrganization: cfg.Organization,\n\t\t},\n\t\tDNSNames: dnsNames,\n\t\tIPAddresses: ips,\n\t\tSerialNumber: serial,\n\t\tNotBefore: caCert.NotBefore,\n\t\tNotAfter: time.Now().Add(duration365d * cfg.Year).UTC(),\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: cfg.Usages,\n\t}\n\tcertDERBytes, err := x509.CreateCertificate(rand.Reader, &certTmpl, caCert, key.Public(), caKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn x509.ParseCertificate(certDERBytes)\n}", "title": "" }, { "docid": "e02e4230c5a99d07311e65ca3864adb2", "score": "0.40331548", "text": "func (t TopPeerCategoryChannels) construct() TopPeerCategoryClass { return &t }", "title": "" }, { "docid": "f339770384bf72cc77f4fd0c46128019", "score": "0.4031519", "text": "func NewSetting() {\n //\n appDirectory, err := AppDirectory()\n if err != nil {\n logger.Fatalf(\"Cannot found the app directory => %v\\n\", err)\n }\n\n //\n defaultConfigData, err := config.Files.ReadFile(\"app.ini\")\n if err != nil {\n logger.Fatalf(\"Cannot read the app.ini => %v\\n\", err)\n }\n\n //\n Config, err = ini.LoadSources(ini.LoadOptions{\n IgnoreInlineComment: true,\n }, defaultConfigData)\n if err != nil {\n logger.Fatalf(\"Cannot load the app.ini => %v\\n\", err)\n }\n\n if len(BuildEnv) > 0 && BuildEnv != \"development\" {\n releaseConfigData, err := config.Files.ReadFile(\"app.release.ini\")\n if err != nil {\n logger.Fatalf(\"Cannot read the app.release.ini => %v\\n\", err)\n }\n\n if err := Config.Append(releaseConfigData); err != nil {\n logger.Fatalf(\"Cannot load the app.release.ini => %v\\n\", err)\n }\n }\n\n if len(CustomConfig) != 0 && utils.IsFile(CustomConfig) {\n if err := Config.Append(CustomConfig); err != nil {\n logger.Fatalf(\"Cannot load the custom config file (%s) => %v\\n\", CustomConfig, err)\n }\n }\n\n //\n var section *ini.Section\n\n section = Config.Section(\"server\")\n Address = section.Key(\"ADDRESS\").MustString(\"0.0.0.0\")\n Port = section.Key(\"PORT\").MustString(\"3000\")\n Mode = section.Key(\"MODE\").MustString(\"dev\")\n StoragePath = section.Key(\"STORAGE_PATH\").MustString(\"storage\")\n\n section = Config.Section(\"attachment\")\n AttachmentPath = section.Key(\"PATH\").MustString(path.Join(StoragePath, \"attachments\"))\n AttachmentMaxSize = section.Key(\"MAX_SIZE\").MustInt64(4)\n\n section = Config.Section(\"cors\")\n CrossOriginEnable = section.Key(\"ENABLE\").MustBool(false)\n CrossOriginAllowOrigins = section.Key(\"ALLOW_ORIGINS\").Strings(\",\")\n CrossOriginAllowMethods = section.Key(\"ALLOW_METHODS\").Strings(\",\")\n CrossOriginAllowHeaders = section.Key(\"ALLOW_HEADERS\").Strings(\",\")\n CrossOriginExposeHeaders = section.Key(\"EXPOSE_HEADERS\").Strings(\",\")\n CrossOriginAllowCredentials = section.Key(\"ALLOW_CREDENTIALS\").MustBool(true)\n CrossOriginMaxAge = section.Key(\"MAX_AGE\").MustInt(12)\n\n if !filepath.IsAbs(AttachmentPath) {\n AttachmentPath = path.Join(appDirectory, AttachmentPath)\n }\n}", "title": "" }, { "docid": "af44c936b03e11501b9b1db8710afcb8", "score": "0.40226865", "text": "func CreateCubicConfig(cfg Config) (*cubicpb.RecognitionConfig, error) {\n\tvar audioEncoding cubicpb.RecognitionConfig_Encoding\n\text := strings.ToLower(cfg.Extension)\n\tswitch ext {\n\tcase \".wav\":\n\t\taudioEncoding = cubicpb.RecognitionConfig_WAV\n\tcase \".flac\":\n\t\taudioEncoding = cubicpb.RecognitionConfig_FLAC\n\tcase \".mp3\":\n\t\taudioEncoding = cubicpb.RecognitionConfig_MP3\n\tcase \".vox\":\n\t\taudioEncoding = cubicpb.RecognitionConfig_ULAW8000\n\tcase \".raw\":\n\t\taudioEncoding = cubicpb.RecognitionConfig_RAW_LINEAR16\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported file extension %s\", ext)\n\t}\n\n\treturn &cubicpb.RecognitionConfig{\n\t\tModelId: cfg.Server.ModelID,\n\t\tAudioEncoding: audioEncoding,\n\t\tIdleTimeout: &pbduration.Duration{Seconds: cfg.Server.IdleTimeout},\n\t\tAudioChannels: cfg.Channels,\n\t\tEnableConfusionNetwork: true,\n\t\tEnableRawTranscript: true,\n\t}, nil\n}", "title": "" }, { "docid": "0da8c7d814fb9678f8be4be46d8f09ae", "score": "0.40196222", "text": "func NewSignature(b []byte) Signature {\n\th := Signature{}\n\tcopy(h[:], b)\n\treturn h\n}", "title": "" }, { "docid": "18f43ae05798cf441ae3184d6ea9e470", "score": "0.40187478", "text": "func CreateSignature(verb string, body string, date string, uri string) string {\n\tvar (\n\t\tsignature string\n\t\tbodyHash hash.Hash\n\t\tsigHmac hash.Hash\n\t)\n\n\t// do an MD5 hash of the body\n\tbodyHash = md5.New()\n\tbodyHash.Write([]byte(body))\n\n\t// compute the signature value\n\tsignature += verb + \"\\n\"\n\tsignature += string(bodyHash.Sum(nil)) + \"\\n\"\n\tsignature += date + \"\\n\"\n\tsignature += uri + \"\\n\"\n\n\t// create the hmac\n\tsigHmac = hmac.NewSHA1([]byte(\"password\"))\n\tsigHmac.Write([]byte(signature))\n\n\treturn base64.StdEncoding.EncodeToString(sigHmac.Sum(nil))\n}", "title": "" }, { "docid": "e323ab7c6e0a267bcef532d798a8acb6", "score": "0.40155783", "text": "func NewThing(conf Config) *Thing {\n\n\t// Declare our Thing\n\tvar t Thing\n\t// Set our field\n\tt.Msg = fmt.Sprintf(\"Foo is %s and Baz is %v\", conf.Foo, conf.Baz)\n\t// Return a pointer to our Thing\n\treturn &t\n}", "title": "" }, { "docid": "1efff76b0c19f2d91b0d5cda3857ea3f", "score": "0.4014995", "text": "func New(category interface{}, message string) error {\n\treturn &impl{\n\t\tcategory: category,\n\t\tmessage: message,\n\t}\n}", "title": "" }, { "docid": "0aa0b561566b5b53ef1bc865bcd5934b", "score": "0.4012277", "text": "func (a StorageConfigurationsAPI) Create(mwsAcctID, storageConfigurationName string, bucketName string) (StorageConfiguration, error) {\n\tvar mwsStorageConfigurations StorageConfiguration\n\tstorageConfigurationAPIPath := fmt.Sprintf(\"/accounts/%s/storage-configurations\", mwsAcctID)\n\terr := a.client.Post(storageConfigurationAPIPath, StorageConfiguration{\n\t\tStorageConfigurationName: storageConfigurationName,\n\t\tRootBucketInfo: &RootBucketInfo{\n\t\t\tBucketName: bucketName,\n\t\t},\n\t}, &mwsStorageConfigurations)\n\treturn mwsStorageConfigurations, err\n}", "title": "" }, { "docid": "8f12b5b5cd41e25a6c37c972f159e466", "score": "0.40118", "text": "func HBallotCreateSilent(c *gin.Context) {\n\tdid, err := strconv.Atoi(c.Param(\"decision_id\"))\n\tif err != nil {\n\t\tc.JSON(http.StatusForbidden, gin.H{\"error\": \"Invalid decision_id\"})\n\t\treturn\n\t}\n\n\tvar b Ballot\n\tif err := c.Bind(&b); err != nil {\n\t\tc.JSON(http.StatusForbidden, gin.H{\"error\": \"invalid ballot object\"})\n\t\treturn\n\t}\n\tb.DecisionID = did // inherited\n\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\terr = b.Save()\n\tif err != nil {\n\t\tc.JSON(http.StatusForbidden, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tresult := gin.H{\"ballot\": b}\n\tc.Writer.Header().Set(\"Location\", fmt.Sprintf(\"/ballot/%d\", b.BallotID))\n\tServeResult(c, \"ballot_create.js\", result)\n}", "title": "" }, { "docid": "b0c1aa6854dd87731502b4195608ae6b", "score": "0.40051627", "text": "func (c Cfg) CreateDHCPd() (string, error) {\n\t// Get timestamp\n\ttimeStamp := time.Now()\n\tstrtimeStamp := timeStamp.String()\n\n\tbuf := new(bytes.Buffer)\n\tbuf.Write([]byte(fmt.Sprintf(dhcpdtmpl, strtimeStamp)))\n\tbuf.Write([]byte(fmt.Sprint(\"\\n\")))\n\n\t// Let's deal with the core\n\tcore := c.Core\n\ttcore := reflect.TypeOf(core)\n\n\tfield, _ := tcore.FieldByName(\"DomainName\")\n\tbuf.Write([]byte(field.Tag.Get(\"dhcpd\")))\n\tbuf.Write([]byte(fmt.Sprintf(\"\\\"%s\\\";\\n\", c.Core.DomainName)))\n\n\tfield, _ = tcore.FieldByName(\"DNSServers\")\n\tbuf.Write([]byte(field.Tag.Get(\"dhcpd\")))\n\tfor k, v := range c.Core.DNSServers {\n\t\tif k == 0 {\n\t\t\tbuf.Write([]byte(fmt.Sprintf(\" %s\", v)))\n\t\t} else {\n\t\t\tbuf.Write([]byte(fmt.Sprintf(\", %s\", v)))\n\t\t}\n\t}\n\tbuf.Write([]byte(fmt.Sprint(\";\\n\")))\n\n\tfield, _ = tcore.FieldByName(\"DefaultLease\")\n\tbuf.Write([]byte(field.Tag.Get(\"dhcpd\")))\n\tbuf.Write([]byte(fmt.Sprintf(\"%v;\\n\", c.Core.DefaultLease)))\n\n\tfield, _ = tcore.FieldByName(\"MaxLease\")\n\tbuf.Write([]byte(field.Tag.Get(\"dhcpd\")))\n\tbuf.Write([]byte(fmt.Sprintf(\"%v;\\n\", c.Core.MaxLease)))\n\n\tfield, _ = tcore.FieldByName(\"Subnet\")\n\tsubnetStr := c.MakeSubnet()\n\tbuf.Write(subnetStr.Bytes())\n\n\t// Deal with Group creation\n\tbuf.Write([]byte(\"\\ngroup {\\n\"))\n\n\tfield, _ = tcore.FieldByName(\"FileServer\")\n\tbuf.Write([]byte(fmt.Sprintf(\"\\t%s\", field.Tag.Get(\"dhcpd\"))))\n\tbuf.Write([]byte(fmt.Sprintf(\" %s;\\n\", c.Core.FileServer)))\n\n\tfield, _ = tcore.FieldByName(\"TransferMode\")\n\tbuf.Write([]byte(fmt.Sprintf(\"\\t%s\", field.Tag.Get(\"dhcpd\"))))\n\tbuf.Write([]byte(fmt.Sprintf(\" \\\"%s\\\";\\n\", c.Core.TransferMode)))\n\n\tfield, _ = tcore.FieldByName(\"NTPServers\")\n\tbuf.Write([]byte(fmt.Sprintf(\"\\t%s\", field.Tag.Get(\"dhcpd\"))))\n\tfor k, v := range c.Core.NTPServers {\n\t\tif k == 0 {\n\t\t\tbuf.Write([]byte(fmt.Sprintf(\" %s\", v)))\n\t\t} else {\n\t\t\tbuf.Write([]byte(fmt.Sprintf(\", %s\", v)))\n\t\t}\n\t}\n\tbuf.Write([]byte(fmt.Sprint(\";\\n\")))\n\n\t// Now deal with host creation. We must indent by 2x tabs here.\n\tfor _, v := range c.Hosts {\n\t\tbuf.Write(MakeHost(v, c.Core.DomainName, c.Core.HTTPConfigsLocation, c.Core.HTTPImagesLocation).Bytes())\n\t}\n\t// End Group creation\n\tbuf.Write([]byte(\"}\\n\"))\n\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "d8ad538ccba2042bb0665805cfe4f519", "score": "0.4004708", "text": "func (s SignedCtrlPld) NewSign() (Sign, error) {\n\tss, err := NewSign(s.Struct.Segment())\n\tif err != nil {\n\t\treturn Sign{}, err\n\t}\n\terr = s.Struct.SetPtr(1, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "a1dad15dfa6020cebc748d4437abfb63", "score": "0.40045536", "text": "func createBcsDbPrivConfig(clientset apiextensionsclient.Interface) (bool, error) {\n\tbcsDbPrivConfigPlural := \"bcsdbprivconfigs\"\n\n\tbcsDbPrivConfigFullName := \"bcsdbprivconfigs\" + \".\" + bcsv1.SchemeGroupVersion.Group\n\n\tcrd := &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: bcsDbPrivConfigFullName,\n\t\t},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: bcsv1.SchemeGroupVersion.Group, // BcsDbPrivConfigsGroup,\n\t\t\tVersion: bcsv1.SchemeGroupVersion.Version, // BcsDbPrivConfigsVersion,\n\t\t\tScope: apiextensionsv1beta1.NamespaceScoped,\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tPlural: bcsDbPrivConfigPlural,\n\t\t\t\tKind: reflect.TypeOf(bcsv1.BcsDbPrivConfig{}).Name(),\n\t\t\t\tListKind: reflect.TypeOf(bcsv1.BcsDbPrivConfigList{}).Name(),\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)\n\tif err != nil {\n\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\tblog.Infof(\"crd is already exists: %s\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tblog.Errorf(\"create crd failed: %s\", err)\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "10035d754ad07425eb88a4d258432c44", "score": "0.4003339", "text": "func CreateDeployment(c *gin.Context) {\n\n\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Start create deployment\")\n\n\t// --- [ Get cluster ] --- //\n\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Get cluster\")\n\tcloudCluster, err := cloud.GetClusterFromDB(c)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Get cluster succeeded\")\n\n\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Bind json into DeploymentType struct\")\n\tvar deployment DeploymentType\n\tif err := c.BindJSON(&deployment); err != nil {\n\t\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Bind failed\")\n\t\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Required field is empty.\"+err.Error())\n\t\tcloud.SetResponseBodyJson(c, http.StatusBadRequest, gin.H{\n\t\t\tcloud.JsonKeyStatus: http.StatusBadRequest,\n\t\t\tcloud.JsonKeyMessage: \"Required field is empty\",\n\t\t\tcloud.JsonKeyError: err,\n\t\t})\n\t\treturn\n\t}\n\n\tbanzaiUtils.LogDebug(banzaiConstants.TagCreateDeployment, fmt.Sprintf(\"Creating chart %s with version %s and release name %s\", deployment.Name, deployment.Version, deployment.ReleaseName))\n\n\tvar values []byte = nil\n\tif deployment.Values != \"\" {\n\t\tparsedJSON, err := yaml.Marshal(deployment.Values)\n\t\tif err != nil {\n\t\t\tbanzaiUtils.LogError(banzaiConstants.TagCreateDeployment, \"Can't parse Values:\", err)\n\t\t}\n\t\tvalues, err = yaml.JSONToYAML(parsedJSON)\n\t\tif err != nil {\n\t\t\tbanzaiUtils.LogError(banzaiConstants.TagCreateDeployment, \"Can't convert JSON to YAML:\", err)\n\t\t\treturn\n\t\t}\n\t}\n\t// --- [ Get K8S Config ] --- //\n\tkubeConfig, err := cloud.GetK8SConfig(cloudCluster, c)\n\tif err != nil {\n\t\treturn\n\t}\n\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Getting K8S Config Succeeded\")\n\n\tbanzaiUtils.LogDebug(banzaiConstants.TagCreateDeployment, \"Custom values:\", string(values))\n\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Create deployment\")\n\trelease, err := helm.CreateDeployment(deployment.Name, deployment.ReleaseName, values, kubeConfig, cloudCluster.Name)\n\tif err != nil {\n\t\tbanzaiUtils.LogWarn(banzaiConstants.TagCreateDeployment, \"Error during create deployment.\", err.Error())\n\t\tcloud.SetResponseBodyJson(c, http.StatusNotFound, gin.H{\n\t\t\tcloud.JsonKeyStatus: http.StatusNotFound,\n\t\t\tcloud.JsonKeyMessage: fmt.Sprintf(\"%s\", err),\n\t\t})\n\t\treturn\n\t} else {\n\t\tbanzaiUtils.LogInfo(banzaiConstants.TagCreateDeployment, \"Create deployment succeeded\")\n\t}\n\n\treleaseName := release.Release.Name\n\treleaseNotes := release.Release.Info.Status.Notes\n\n\tbanzaiUtils.LogDebug(banzaiConstants.TagCreateDeployment, \"Release name:\", releaseName)\n\tbanzaiUtils.LogDebug(banzaiConstants.TagCreateDeployment, \"Release notes:\", releaseNotes)\n\n\t//Get ingress with deployment prefix TODO\n\t//Get local ingress address?\n\n\tcloud.SetResponseBodyJson(c, http.StatusCreated, gin.H{\n\t\tcloud.JsonKeyStatus: http.StatusCreated,\n\t\tcloud.JsonKeyReleaseName: releaseName,\n\t\tcloud.JsonKeyNotes: releaseNotes,\n\t})\n\treturn\n}", "title": "" } ]
9604635f78a673b3f82762dcf140dae4
serveFile serves the file to the writer
[ { "docid": "3fb8af2df9b9bd33dc1a6945ae239bbe", "score": "0.86297977", "text": "func serveFile(w io.Writer, name string) error {\n\tcontents, err := ioutil.ReadFile(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.Write(contents)\n\treturn nil\n}", "title": "" } ]
[ { "docid": "3587fbd63174e2b9bed2c5d59f4c3ba4", "score": "0.77564895", "text": "func serveFile(w http.ResponseWriter, fn string) (err error) {\n\tf, err := os.Open(fn)\n\tdefer f.Close() //Close after function return\n\n\tif err != nil {\n\t\t//File not found, send 404\n\t\thttp.Error(w, \"Test File not found.\", 404)\n\t\treturn\n\t}\n\n\tfileHeader := make([]byte, 512)\n\t//Copy the headers into the fileHeader buffer\n\tf.Read(fileHeader)\n\t//Get content type of file\n\tfileContentType := http.DetectContentType(fileHeader)\n\n\t//Get the file size\n\tfileStat, _ := f.Stat() //Get info from file\n\tfileSize := strconv.FormatInt(fileStat.Size(), 10) //Get file size as a string\n\n\t//Send the headers\n\tw.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+fn)\n\tw.Header().Set(\"Content-Type\", fileContentType)\n\tw.Header().Set(\"Content-Length\", fileSize)\n\n\t//Send the file\n\t//We read 512 bytes from the file already so we reset the offset back to 0\n\tf.Seek(0, 0)\n\tio.Copy(w, f) //'Copy' the file to the client\n\treturn\n}", "title": "" }, { "docid": "dd7745acde66b6d1c1ea2b22c3a53550", "score": "0.7393514", "text": "func (h Http) ServeFile(name string) {\r\n\thttp.ServeFile(h.c.Res, h.c.Req, name)\r\n}", "title": "" }, { "docid": "ccd0970ec1286d7379595a73fc2c7c31", "score": "0.7387995", "text": "func (ArcgisElevation) serveFile(w http.ResponseWriter, r *http.Request, path string) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t// w.Header().Set(\"Cache-Control\", \"max-age=86400\")\n\t// w.Header().Set(\"ETag\", \"0od3nd2cbk83\")\n\t// w.Header().Set(\"Server\", \"Apache\")\n\t// w.Header().Set(\"Vary\", \"Accept-Encoding\")\n\t// w.Header().Set(\"X-Robots-Tag:\", \"noindex\")\n\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\tserver.Logger.Errorf(\"%v not found\", path)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tbyts, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tserver.Logger.Error(err.Error())\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(byts)\n}", "title": "" }, { "docid": "8bd474002d495ba22a363c933570b272", "score": "0.7387605", "text": "func serveFile(context router.Context) error {\n\n\t// Try a local path in the public directory\n\tlocalPath := \"./public\" + path.Clean(context.Path())\n\ts, err := os.Stat(localPath)\n\tif err != nil {\n\t\t// If file not found return 404\n\t\tif os.IsNotExist(err) {\n\t\t\treturn router.NotFoundError(err)\n\t\t}\n\n\t\t// For other errors return not authorised\n\t\treturn router.NotAuthorizedError(err)\n\t}\n\n\t// If not a file return immediately\n\tif s.IsDir() {\n\t\treturn nil\n\t}\n\n\t// If the file exists and we can access it, serve it with cache control\n\tcontext.Writer().Header().Set(\"Cache-Control\", \"max-age:3456000, public\")\n\thttp.ServeFile(context, context.Request(), localPath)\n\treturn nil\n}", "title": "" }, { "docid": "6b45a596271ee5068fd9d3a9002b4abc", "score": "0.72941095", "text": "func serveFile(w http.ResponseWriter, r *http.Request, fs http.FileSystem, name string) {\n const indexPage = \"/index.html\"\n\n f, err := fs.Open(name)\n if err != nil {\n // TODO expose actual error?\n http.NotFound(w, r)\n return\n }\n defer f.Close()\n\n d, err1 := f.Stat()\n if err1 != nil {\n // TODO expose actual error?\n http.NotFound(w, r)\n return\n }\n\n // use contents of index.html for directory, if present\n if d.IsDir() {\n index := name + indexPage\n ff, err := fs.Open(index)\n if err == nil {\n defer ff.Close()\n dd, err := ff.Stat()\n if err == nil {\n name = index\n d = dd\n f = ff\n }\n }\n }\n\n // Still a directory? (we didn't find an index.html file)\n if d.IsDir() {\n if checkLastModified(w, r, d.ModTime()) {\n return\n }\n sortedDirList(w, f)\n return\n }\n\n // serverContent will check modification time\n http.ServeContent(w, r, d.Name(), d.ModTime(), f)\n}", "title": "" }, { "docid": "69c1e9df4bc0b848b14b690b6f4e3e2f", "score": "0.7249668", "text": "func (u RequestUtils) ServeFile(\n\tw http.ResponseWriter, r *http.Request, filename string,\n) {\n\thttp.ServeFile(w, r, filename)\n}", "title": "" }, { "docid": "4d7d20b37f0cc071dc59bd6abfc2d478", "score": "0.7104621", "text": "func (fserver *FileServer) serveFile(\n\tlogger termlog.Logger,\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tname string,\n\tredirect bool,\n) {\n\tconst indexPage = \"/index.html\"\n\n\t// redirect .../index.html to .../\n\t// can't use Redirect() because that would make the path absolute,\n\t// which would be a problem running under StripPrefix\n\tif strings.HasSuffix(r.URL.Path, indexPage) {\n\t\tlogger.SayAs(\n\t\t\t\"debug\", \"debug fileserver: redirecting %s -> ./\", indexPage,\n\t\t)\n\t\tlocalRedirect(w, r, \"./\")\n\t\treturn\n\t}\n\n\tf, err := fserver.Root.Open(name)\n\tif err != nil {\n\t\tlogger.WarnAs(\"debug\", \"debug fileserver: %s\", err)\n\t\tif err := notFound(fserver.Inject, fserver.Templates, w); err != nil {\n\t\t\tlogger.Shout(\"Internal error: %s\", err)\n\t\t}\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\td, err1 := f.Stat()\n\tif err1 != nil {\n\t\tlogger.WarnAs(\"debug\", \"debug fileserver: %s\", err)\n\t\tif err := notFound(fserver.Inject, fserver.Templates, w); err != nil {\n\t\t\tlogger.Shout(\"Internal error: %s\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tif redirect {\n\t\t// redirect to canonical path: / at end of directory url\n\t\t// r.URL.Path always begins with /\n\t\turl := r.URL.Path\n\t\tif d.IsDir() {\n\t\t\tif url[len(url)-1] != '/' {\n\t\t\t\tlocalRedirect(w, r, path.Base(url)+\"/\")\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tif url[len(url)-1] == '/' {\n\t\t\t\tlocalRedirect(w, r, \"../\"+path.Base(url))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// use contents of index.html for directory, if present\n\tif d.IsDir() {\n\t\tindex := name + indexPage\n\t\tff, err := fserver.Root.Open(index)\n\t\tif err == nil {\n\t\t\tdefer ff.Close()\n\t\t\tdd, err := ff.Stat()\n\t\t\tif err == nil {\n\t\t\t\tname = index\n\t\t\t\td = dd\n\t\t\t\tf = ff\n\t\t\t}\n\t\t}\n\t}\n\n\t// Still a directory? (we didn't find an index.html file)\n\tif d.IsDir() {\n\t\tif checkLastModified(w, r, d.ModTime()) {\n\t\t\treturn\n\t\t}\n\t\tdirList(fserver.Inject, logger, w, name, f, fserver.Templates)\n\t\treturn\n\t}\n\n\t// serverContent will check modification time\n\tsizeFunc := func() (int64, error) { return d.Size(), nil }\n\terr = serveContent(fserver.Inject, w, r, d.Name(), d.ModTime(), sizeFunc, f)\n\tif err != nil {\n\t\tlogger.Warn(\"Error serving file: %s\", err)\n\t}\n}", "title": "" }, { "docid": "c93f593bbcdc35042a48a76904f00ca3", "score": "0.70418704", "text": "func ServeFile(w http.ResponseWriter, r *http.Request, fs http.FileSystem, path string) {\n\n\t// Open file handle.\n\tf, err := fs.Open(path)\n\tif err != nil {\n\t\thttp.Error(w, \"404 Not Found\", 404)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// Make sure path exists.\n\tfileinfo, err1 := f.Stat()\n\tif err1 != nil {\n\t\thttp.Error(w, \"404 Not Found\", 404)\n\t\treturn\n\t}\n\n\t// Reject directory requests.\n\tif fileinfo.IsDir() {\n\t\thttp.Error(w, \"403 Forbidden\", 403)\n\t\treturn\n\t}\n\n\thttp.ServeContent(w, r, fileinfo.Name(), fileinfo.ModTime(), f)\n\n}", "title": "" }, { "docid": "f2075a9c3c3213b836869cc3ba2a2a63", "score": "0.70281744", "text": "func fileServer(filename string) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw = writeCORS(w)\n\t\thttp.ServeFile(w, r, filename)\n\t}\n}", "title": "" }, { "docid": "509a6d64ba50935654b78e89d48c3103", "score": "0.6931464", "text": "func ServeFile(c context.Context, name string) {\n\tw, r := reqctx.ToRequest(c)\n\thttp.ServeFile(w, r, name)\n}", "title": "" }, { "docid": "b417747c22ffcc242b6563e53abddc2d", "score": "0.68107617", "text": "func (ctx *Context) ServeFile(path string) {\n\thttp.ServeFile(ctx.ResponseWriter, ctx.Request, path)\n}", "title": "" }, { "docid": "80ab50307787e58a7534ae382af42b21", "score": "0.68008417", "text": "func fileserve(w http.ResponseWriter, r *http.Request) {\n\tkey, ok := r.Context().Value(common.ContextKeyPair).(*keystore.Key)\n\tif !ok {\n\t\tfmt.Fprintln(w, \"There was an error getting the key from the context\")\n\t}\n\tuploadDir, ok := r.Context().Value(common.ContextKeyUploadDir).(string)\n\tif !ok {\n\t\tfmt.Fprintln(w, \"There was an error getting the upload path from the context\")\n\t}\n\tfilename, fileHandler := getFileFromRequest(w, r)\n\tdefer fileHandler.Close()\n\tuploaded, hash := checkIfFileUploaded(fileHandler)\n\tif uploaded {\n\t\tmsg := fmt.Sprintf(\"File %s uploaded already\", filename)\n\t\tlog.Println(msg)\n\t\tfmt.Fprint(w, hash)\n\t\treturn\n\t}\n\n\tlog.Printf(\"uploadDir is: %s\", uploadDir)\n\tlog.Printf(\"hash is: %s, filename: %s \", hash, filename)\n\n\tfileHandler.Seek(0, 0)\n\tlocalFile, fullpath, err := createFile(filename, uploadDir, hash)\n\tif err != nil {\n\t\tfmt.Fprint(w, err)\n\t\treturn\n\t}\n\tdefer localFile.Close()\n\t_, err = io.Copy(localFile, fileHandler)\n\tif err != nil {\n\t\tfmt.Fprint(w, err)\n\t\treturn\n\t}\n\t// Rewind the file pointer to the beginning\n\tlocalFile.Seek(0, 0)\n\tlog.Println(\"The file has been successfully uploaded, full path is: \", fullpath)\n\thexHash := storeImageToDB(localFile, key.KeyPair.Private, fullpath)\n\tlog.Println(\"The hash is: \", hexHash)\n\tfmt.Fprint(w, hexHash)\n}", "title": "" }, { "docid": "4b0de3c4b8e3e77cb8e50f02d4cc9779", "score": "0.6796772", "text": "func simpleFileServer(w http.ResponseWriter, r *http.Request) {\n\tu, err := url.Parse(r.URL.String())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(409)\n\t\treturn\n\t}\n\terr = serveFile(w, \"data/\"+path.Base(u.String()))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(409)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "ce6a53d7b6461019bdb2ee1d24d13a65", "score": "0.67967474", "text": "func (c *Context) File(filepath string) {\n\thttp.ServeFile(c.Writer, c.Request, filepath)\n}", "title": "" }, { "docid": "5eee9fa0a1b2faf3d5bca9ac5e76f305", "score": "0.67788357", "text": "func serve(port string, filename string) {\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, filename)\n\t}\n\thttp.HandleFunc(\"/\", handler)\n\tfmt.Println(\"Listening on\", port, \"; serving\", filename, \"...\")\n\terr := http.ListenAndServe(\":\"+port, nil)\n\tif err != nil {\n\t\tabort(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "026d84b3d22c85db5aa96a2e2fa21f2c", "score": "0.6776506", "text": "func ServeFile(ai AI, filename string) {\n\n\tlogger := Logger(nil)\n\tvar fh *os.File\n\tvar err error\n\n\tif filename == \"-\" {\n\t\tfh = os.Stdin\n\t} else {\n\t\tfh, err = os.Open(filename)\n\t\tif err != nil {\n\t\t\tlogger.Println(\"Error opening\", filename, \": \", err)\n\t\t\treturn\n\t\t}\n\t\tdefer fh.Close()\n\t}\n\n\t_, response_json, err := do(ai, fh, logger)\n\tif err != nil {\n\t\tlogger.Println(\"Error processing request:\", err)\n\t\treturn\n\t}\n\tos.Stdout.Write(response_json)\n}", "title": "" }, { "docid": "ad08cd91da910ee4a262633d40ba790f", "score": "0.6772221", "text": "func SimpleFileServer(dir, prefix string) http.Handler{\n in := GetChan()\n writer := FileServerWriter(dir, prefix)\n\n go writer(in)\n return Handler(in)\n}", "title": "" }, { "docid": "795239e3930a8a536975cbd0a766e6a9", "score": "0.67574924", "text": "func serve(file string, w http.ResponseWriter, data interface{}) {\n\n\t// load template\n\tt := template.New(file)\n\n\t// give template an equality function for strings\n\tt = t.Funcs(template.FuncMap{\"eq\": func(a, b string) bool { return a == b }})\n\n\t// parse template, making sure to load header and footer files\n\ttempl, err := t.ParseFiles(tmplPath+\"/\"+file, tmplPath+\"/_header.html\", tmplPath+\"/_footer.html\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// output generated html to REsponseWriter\n\terr = templ.Execute(w, data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f83c9ff756b99d3577ff6f9a148e8505", "score": "0.6715361", "text": "func HandleGenerateFile(w http.ResponseWriter, r *http.Request) {\n\tp = polly.New(sess)\n\tf, err := Generate(r.FormValue(\"ssml\"), r.FormValue(\"voice\"),\n\t\tpath.Join(viper.GetString(\"assets.ttsPath\"), fmt.Sprint(time.Now().Unix())), p)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"400 - Something bad happened!\"))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"400 - Something bad happened!\"))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+fi.Name())\n\tw.Header().Set(\"Content-Type\", \"audio/mpeg\")\n\tw.Header().Set(\"Content-Length\", strconv.Itoa(int(fi.Size())))\n\tw.Header().Set(\"Access-Control-Allow-Origin\", viper.GetString(\"webserver.clientAddr\"))\n\n\thttp.ServeFile(w, r, path.Join(viper.GetString(\"assets.ttsPath\"), fi.Name()))\n}", "title": "" }, { "docid": "901dbd8eba3148a03486d61008f04416", "score": "0.67117137", "text": "func serveStaticFile(w http.ResponseWriter, r *http.Request) {\n\tr.URL.Path = os.Getenv(\"SERVER_PATH\") + r.URL.Path\n\thttp.ServeFile(w, r, r.URL.Path)\n}", "title": "" }, { "docid": "d1e649d95124207cfff2e6a7898d27c4", "score": "0.6690792", "text": "func (ctx *Context) File(name string) error {\n\thttp.ServeFile(ctx.w, ctx.r, name)\n\treturn nil\n}", "title": "" }, { "docid": "37f0fc833a2a85c48363efa17b94600d", "score": "0.66367126", "text": "func serveFile(w http.ResponseWriter, r *http.Request, fh *fileHandler, name string, redirect bool) {\n\tconst indexPage = \"/index.html\"\n\n\tfs := fh.root\n\tconfig := fh.config\n\tdefer func() { fh.config.FirstRequest = false }()\n\n\t// redirect .../index.html to .../\n\t// can't use Redirect() because that would make the path absolute,\n\t// which would be a problem running under StripPrefix\n\tif strings.HasSuffix(r.URL.Path, indexPage) {\n\t\tlocalRedirect(w, r, \"./\")\n\t\treturn\n\t}\n\n\tf, err := fs.Open(name)\n\tif err != nil {\n\t\tmsg, code := toHTTPError(err)\n\t\thttp.Error(w, msg, code)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\td, err := f.Stat()\n\tif err != nil {\n\t\tmsg, code := toHTTPError(err)\n\t\thttp.Error(w, msg, code)\n\t\treturn\n\t}\n\n\tif redirect {\n\t\t// redirect to canonical path: / at end of directory url\n\t\t// r.URL.Path always begins with /\n\t\turl := r.URL.Path\n\t\tif d.IsDir() {\n\t\t\tif url[len(url)-1] != '/' {\n\t\t\t\tlocalRedirect(w, r, path.Base(url)+\"/\")\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tif url[len(url)-1] == '/' {\n\t\t\t\tlocalRedirect(w, r, \"../\"+path.Base(url))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tif d.IsDir() && config.NoIndex {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\t// redirect if the directory name doesn't end in a slash\n\tif d.IsDir() {\n\t\turl := r.URL.Path\n\t\tif url[len(url)-1] != '/' {\n\t\t\tlocalRedirect(w, r, path.Base(url)+\"/\")\n\t\t\treturn\n\t\t}\n\t}\n\n\t// use contents of index.html for directory, if present\n\tif d.IsDir() {\n\t\tindex := strings.TrimSuffix(name, \"/\") + indexPage\n\t\tff, err := fs.Open(index)\n\t\tif err == nil {\n\t\t\tdefer ff.Close()\n\t\t\tdd, err := ff.Stat()\n\t\t\tif err == nil {\n\t\t\t\t// name = index\n\t\t\t\td = dd\n\t\t\t\tf = ff\n\t\t\t}\n\t\t}\n\t}\n\n\t// Still a directory? (we didn't find an index.html file)\n\tif d.IsDir() {\n\t\tif checkIfModifiedSince(r, d.ModTime(), config) == condFalse {\n\t\t\twriteNotModified(w)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Last-Modified\", d.ModTime().UTC().Format(http.TimeFormat))\n\t\tdirList(w, r, f, config)\n\t\treturn\n\t}\n\n\thttp.ServeContent(w, r, d.Name(), d.ModTime(), f)\n}", "title": "" }, { "docid": "02747c94ea8725367fcce2f36a74a6d6", "score": "0.6631168", "text": "func fileHandler(context router.Context) error {\n\n\t// First try serving assets\n\terr := serveAsset(context)\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\t// If assets fail, try to serve file in public\n\treturn serveFile(context)\n}", "title": "" }, { "docid": "b94324b611d4fe404554567824aba0da", "score": "0.6602837", "text": "func FileServer(w http.ResponseWriter, r *http.Request) {\n\textension, _ := regexp.MatchString(\"\\\\.+[a-zA-Z]+\", r.URL.EscapedPath())\n\t// If the url contains an extension, use file server\n\tif extension {\n\t\thttp.FileServer(http.Dir(\"./ui/dist/\")).ServeHTTP(w, r)\n\t} else {\n\t\thttp.ServeFile(w, r, \"./ui/dist/index.html\")\n\t}\n}", "title": "" }, { "docid": "41ea81221bcb2a87ad3c5535251458f9", "score": "0.6567084", "text": "func sendFile(w http.ResponseWriter, fpath string) {\n\tf, err := os.Open(fpath)\n\tdefer f.Close()\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// get header data for file\n\tfheader := make([]byte, 512)\n\tf.Read(fheader)\n\tfcontenttype := http.DetectContentType(fheader)\n\tfstat, _ := f.Stat()\n\tfsize := strconv.FormatInt(fstat.Size(), 10)\n\t_, fname := filepath.Split(fpath)\n\n\t// set HTTP headers\n\tw.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+fname)\n\tw.Header().Set(\"Content-Type\", fcontenttype)\n\tw.Header().Set(\"Content-Length\", fsize)\n\n\t// send the file\n\tf.Seek(0, 0) // reset the offset (read 512 bytes already)\n\tio.Copy(w, f)\n}", "title": "" }, { "docid": "fda177f0e59c84127527ce221e5bcf54", "score": "0.6533153", "text": "func FileServer(file string) fractals.Handler {\n\treturn fractals.SubLift(func(rw *Request, data []byte) (*Request, error) {\n\t\tif _, err := rw.Res.Write(data); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn rw, nil\n\t}, IdentityMiddlewareHandler(), MimeWriterFor(file), fractals.Replay(file),\n\t\tfs.ReadFile())\n}", "title": "" }, { "docid": "0a6bef7df63a1d3e91d5228f1e11d69a", "score": "0.65007144", "text": "func ServeFile(ctx *fasthttp.RequestCtx) {\n\tp := string(ctx.Request.URI().Path())\n\tif len(p) == 0 {\n\t\tServeNotFound(ctx)\n\t\treturn\n\t}\n\n\t// Convert all zero-width characters to normal string\n\tp = utils.ZWSToString(p)\n\n\tfilePath := path.Join(global.Configuration.Storage.Directory, p)\n\n\t// we only need to know if it exists or not\n\tfileInfo, err := os.Stat(filePath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tServeNotFound(ctx)\n\t\t\treturn\n\t\t}\n\t\tresponse.SendTextResponse(ctx, fmt.Sprintf(\"os.Stat() could not be called on the file. %v\", err), fasthttp.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif fileInfo.IsDir() {\n\t\tresponse.SendTextResponse(ctx, \"This is a directory, not a file\", fasthttp.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// We don't need a limited reader because mimetype.DetectReader automatically caps it\n\tfileReader, e := os.OpenFile(filePath, os.O_RDONLY, 0644)\n\tif e != nil {\n\t\tresponse.SendTextResponse(ctx, fmt.Sprintf(\"The file could not be opened. %v\", err), fasthttp.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = fileReader.Close()\n\t}()\n\n\tif global.Configuration.RateLimit.Bandwidth.Download > 0 && global.Configuration.RateLimit.Bandwidth.ResetAfter > 0 {\n\t\tisBandwidthLimitNotReached, err := security.Try(ctx, global.RedisClient, fmt.Sprintf(\"BW_DN_%s\", utils.GetIP(ctx)), global.Configuration.RateLimit.Bandwidth.Download, global.Configuration.RateLimit.Bandwidth.ResetAfter, fileInfo.Size())\n\t\tif err != nil {\n\t\t\tresponse.SendTextResponse(ctx, fmt.Sprintf(\"Bandwidth limit couldn't be checked. %v\", err), fasthttp.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif !isBandwidthLimitNotReached {\n\t\t\tresponse.SendTextResponse(ctx, \"Download bandwidth limit reached; try again later.\", fasthttp.StatusTooManyRequests)\n\t\t\treturn\n\t\t}\n\t}\n\n\tmimeType, e := mimetype.DetectReader(fileReader)\n\tif e != nil {\n\t\tresponse.SendTextResponse(ctx, fmt.Sprintf(\"Cannot detect the mime type of this file retrieved from server. It might be corrupted. %v\", e), fasthttp.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif discordBotRegex.Match(ctx.Request.Header.UserAgent()) && !ctx.QueryArgs().Has(rawParam) {\n\t\tif mimetype.EqualsAny(mimeType.String(), \"image/png\", \"image/jpeg\", \"image/gif\") {\n\t\t\tctx.Response.Header.SetContentType(\"text/html; charset=utf8\")\n\t\t\tctx.Response.Header.Add(\"Cache-Control\", \"no-cache, no-store, must-revalidate\")\n\t\t\tctx.Response.Header.Add(\"Pragma\", \"no-cache\")\n\t\t\tctx.Response.Header.Add(\"Expires\", \"0\")\n\n\t\t\tu := fmt.Sprintf(\"%s/%s?%s=true\", utils.GetServerRoot(ctx), p, rawParam)\n\t\t\t_, _ = fmt.Fprint(ctx.Response.BodyWriter(), strings.Replace(discordHTML, \"{{.}}\", u, 1))\n\t\t\treturn\n\t\t}\n\t}\n\n\tfilterStatus := security.FilterCheck(ctx, mimeType.String())\n\tif filterStatus == security.FilterFail {\n\t\t// already sent a response if filter check failed\n\t\treturn\n\t} else if filterStatus == security.FilterSanitize {\n\t\tctx.Response.Header.Set(\"Content-Type\", \"text/plain\")\n\t} else {\n\t\tctx.Response.Header.Set(\"Content-Type\", mimeType.String())\n\t}\n\tctx.Response.Header.Set(\"Content-Disposition\", fmt.Sprintf(\"inline; filename=\\\"%s\\\"\", p))\n\tctx.Response.Header.Set(\"Content-Length\", strconv.FormatInt(fileInfo.Size(), 10))\n\n\t_, e = fileReader.Seek(0, io.SeekStart)\n\tif e != nil {\n\t\tresponse.SendTextResponse(ctx, fmt.Sprintf(\"Reader could not be reset to its initial position. %v\", e), fasthttp.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t_, copyErr := io.Copy(ctx.Response.BodyWriter(), fileReader)\n\tif copyErr != nil {\n\t\tresponse.SendTextResponse(ctx, fmt.Sprintf(\"File wasn't written to the client successfully. %v\", copyErr), fasthttp.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b0049134757d2916dd2c45376a2e2095", "score": "0.6490849", "text": "func (h *Handler) serveAsset(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\t// Read asset from assets package.\n\tfilename := vars[\"filename\"]\n\tb, _ := assets.Asset(filename)\n\tif b == nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\t// Set content type.\n\tw.Header().Set(\"Content-Type\", mime.TypeByExtension(filepath.Ext(filename)))\n\n\t// Write asset contents.\n\tw.Write(b)\n}", "title": "" }, { "docid": "1caa78deb27b65feb92e83a44e9b19ff", "score": "0.646189", "text": "func FileServer(root http.FileSystem,) http.Handler", "title": "" }, { "docid": "76b5953cfc49a2863d07c9a6554236e6", "score": "0.6458058", "text": "func renderFile(file string, res http.ResponseWriter) {\n\tbs, err := ioutil.ReadFile(file)\n\tif err != nil {\n\t\tres.WriteHeader(500)\n\t\tres.Write([]byte(err.Error() + \"\\n\"))\n\t\treturn\n\t}\n\n\trenderBytes(file, bs, res)\n}", "title": "" }, { "docid": "75a7a09ca8026f6065144167455f77d1", "score": "0.64352196", "text": "func fileHandler(w http.ResponseWriter, r *http.Request) {\n\tuseCache := (strings.ToLower(r.URL.Query().Get(\"cache\")) == \"yes\")\n\tpath := \".\" + r.URL.Path\n\tw.Header().Set(\"Content-Type\", mime.TypeByExtension(filepath.Ext(path)))\n\tif useCache {\n\t\tbytes, ok := cache.GetBytes(path)\n\t\tif ok {\n\t\t\tw.Write(bytes)\n\t\t\tlog.Printf(\"Read from cache for %s\", path)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tcache.Delete(path)\n\t}\n\tcmd, ok := getCmd(path)\n\tbytes := []byte{}\n\terr := error(nil)\n\tif ok {\n\t\tbytes, err = exec.Command(\"bash\", \"-c\", cmd).Output()\n\t\tlog.Printf(\"Ran cmd: %s\", cmd)\n\t} else {\n\t\tbytes, err = ioutil.ReadFile(path)\n\t\tlog.Printf(\"Read file: %s\", path)\n\t}\n\tif err != nil {\n\t\tbytes = []byte(err.Error())\n\t} else if useCache {\n\t\tcache.Put(path, bytes)\n\t\tlog.Printf(\"Cached data for %s\", path)\n\t}\n\tw.Write(bytes)\n}", "title": "" }, { "docid": "4bb3a5c6d6743bff5b3f437db853afa0", "score": "0.6359395", "text": "func (fs *WavFs) Serve() {\n\tfs.server.Serve()\n}", "title": "" }, { "docid": "1f1fe16fc3068c9cb2f7ba7c88b4b281", "score": "0.63238615", "text": "func handler(w http.ResponseWriter, r *http.Request) {\n\thttp.ServeFile(w, r, \"index.html\")\n}", "title": "" }, { "docid": "cb64873e9c47ca9b65464f46d99f6482", "score": "0.63029224", "text": "func fileHandler(entrypoint string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, entrypoint)\n\t}\n}", "title": "" }, { "docid": "dca51aeb935f80ce1e963b7aa234252d", "score": "0.6302147", "text": "func (s UserControllerApi) HandleServeUserFile() func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdir, err := os.Getwd()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tfileId := mux.Vars(r)[\"namaFile\"]\n\t\tfileLocation := filepath.Join(dir, \"fileServer\", \"user\", fileId)\n\n\t\tw.Header().Set(\"Content-Type\", \"image/jpeg\")\n\t\thttp.ServeFile(w, r, fileLocation)\n\t}\n}", "title": "" }, { "docid": "99bcb944675d83ec5092a0d84d91e5b5", "score": "0.6301288", "text": "func fileServer(r chi.Router, url string, path http.FileSystem) {\n\tif strings.ContainsAny(url, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\tfs := http.StripPrefix(url, http.FileServer(path))\n\tif url != \"/\" && url[len(url)-1] != '/' {\n\t\tr.Get(url, http.RedirectHandler(url+\"/\", 301).ServeHTTP)\n\t\turl += \"/\"\n\t}\n\turl += \"*\"\n\tr.Get(url, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "2158b6359724d28dd999b82ed0891489", "score": "0.62693703", "text": "func fileServer(r chi.Router, root http.FileSystem) {\n\tr.Get(\"/*\", func(w http.ResponseWriter, req *http.Request) {\n\t\tisFileName, _ := regexp.MatchString(`^.*/[^./]*\\..*[^/]$`, req.RequestURI)\n\t\tif isFileName || strings.HasSuffix(req.RequestURI, \"/\") {\n\t\t\trctx := chi.RouteContext(req.Context())\n\t\t\tpathPrefix := strings.TrimSuffix(rctx.RoutePattern(), \"/*\")\n\t\t\tfs := http.StripPrefix(pathPrefix, http.FileServer(root))\n\t\t\tfs.ServeHTTP(w, req)\n\t\t} else {\n\t\t\tredirectDest := req.Header.Get(\"X-Original-Uri\")\n\t\t\tif redirectDest == \"\" {\n\t\t\t\tredirectDest = req.RequestURI\n\t\t\t}\n\t\t\thttp.Redirect(w, req, redirectDest+\"/\", http.StatusTemporaryRedirect)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "3572c9d56a1ae0a9fd8f86eba8c4496c", "score": "0.62485653", "text": "func SendFile(context *gorouter.RouteContext, fileName string, content *[]byte) {\n\n\tcontext.W.Header().Set(\"Content-Type\", \"application/octet-stream\")\n\tcontext.W.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+fileName)\n\tcontext.W.Header().Set(\"Content-Transfer-Encoding\", \"binary\")\n\tcontext.W.Header().Set(\"Expires\", \"0\")\n\tcontext.W.Write(*content)\n\tcontext.Handled = true\n\n}", "title": "" }, { "docid": "5fb977107b3e7bf2df2d9610792c3534", "score": "0.6231248", "text": "func (r *Request) SendFile(file string) {\n\thttp.ServeFile(r.writer, r.request, file)\n}", "title": "" }, { "docid": "2bb68da1f5ca2e3af8a1f4ea06d6351f", "score": "0.62214774", "text": "func (c *Context) SendFile(path string) error {\n\tvar file io.ReadSeeker\n\tpath = filepath.FromSlash(path)\n\tif rc := c.App.ResourceSet.Get(path); rc != nil {\n\t\tswitch b := rc.(type) {\n\t\tcase string:\n\t\t\tfile = strings.NewReader(b)\n\t\tcase []byte:\n\t\t\tfile = bytes.NewReader(b)\n\t\t}\n\t}\n\tif file == nil {\n\t\tif !filepath.IsAbs(path) {\n\t\t\tpath = filepath.Join(c.App.Config.AppPath, StaticDir, path)\n\t\t}\n\t\tif _, err := os.Stat(path); err != nil {\n\t\t\tc.Response.StatusCode = http.StatusNotFound\n\t\t\tif err := c.RenderText(\"\"); err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tf, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tdefer f.Close()\n\t\tfile = f\n\t}\n\tc.Response.ContentType = mime.TypeByExtension(filepath.Ext(path))\n\tif c.Response.ContentType == \"\" {\n\t\tct, err := c.detectContentTypeByBody(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.Response.ContentType = ct\n\t}\n\tif err := c.render(file); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db7a4f67c4c2478821eba56d22c75c8e", "score": "0.62119454", "text": "func FileServer(r chi.Router, path string) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.FileServer(files.Assets)\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Vary\", \"Accept-Encoding\")\n\t\tw.Header().Set(\"Cache-Control\", \"public, max-age=7776000\")\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "7420bbade59281aebcf8d058bcba749d", "score": "0.62079006", "text": "func (f *file) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvar buf *bytes.Reader\n\tif v := readerPool.Get(); v == nil {\n\t\tbuf = bytes.NewReader(f.contents)\n\t} else {\n\t\tbuf = v.(*bytes.Reader)\n\t\tbuf.Reset(f.contents)\n\t}\n\thttp.ServeContent(w, r, path.Base(r.URL.Path), modTime, buf)\n}", "title": "" }, { "docid": "3b590b0abb10da65b0a184e2b273f1a0", "score": "0.6191704", "text": "func serve() error {\n\tapi.RegisterFileserverServer(server, &fileserver{})\n\n\tif config.verbose {\n\t\tlog.Printf(\"Listening gRPC server on port %d...\\n\", config.port)\n\t}\n\n\tif config.port <= 0 {\n\t\treturn fmt.Errorf(\"invalid port %d\", config.port)\n\t}\n\n\tlistener, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", config.port))\n\tif err != nil {\n\t\tlog.Fatal(fmt.Errorf(\"failed to listen: %w\", err))\n\t}\n\n\treturn server.Serve(listener)\n}", "title": "" }, { "docid": "d072b593ffbb13bb83b2178fbb4b47c4", "score": "0.6162589", "text": "func serveTs(w http.ResponseWriter, r *http.Request, path string) {\n\n\tw.Header().Add(\"Content-Type\", \"video/MP2T\")\n\thttp.ServeFile(w, r, path)\n}", "title": "" }, { "docid": "de2e08b12132b785957ebc0c91e57c1b", "score": "0.61590815", "text": "func fileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tlog.Printf(\"[INFO] serving static files from %v\", root)\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "bfd7f99782122451d89e1ae3c674542e", "score": "0.6133105", "text": "func (c *conn) serve() {\n\t// read from the client\n\tbuf := make([]byte, maxMessageSize)\n\tn, err := c.srwc.Read(buf)\n\tif err != nil {\n\t\tfmt.Println(\"read error:\", err)\n\t}\n\tbuf = buf[:n]\n\n\t// write to the client connection\n\t_, err = fmt.Fprintf(c.srwc, string(buf))\n\tif err != nil {\n\t\tfmt.Println(\"write error:\", err)\n\t}\n}", "title": "" }, { "docid": "ba6f001c5d4765e9875845034c0135ad", "score": "0.612774", "text": "func MainHandler(w http.ResponseWriter, r *http.Request) {\n\tfs := http.FileServer(http.Dir(\"./public/\"))\n\tfs.ServeHTTP(w, r)\n\n}", "title": "" }, { "docid": "253d2a5203a8f88b3a4b0e60cb131ba3", "score": "0.61149913", "text": "func assetsFileHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet && r.Method != http.MethodHead {\n\t\treturn\n\t}\n\n\tfile := r.URL.Path\n\t//\tlog.Printf(\"Open File '%s'\",file)\n\tif file == \"/\" {\n\t\tfile = \"/index.html\"\n\t}\n\tf, err := assetsDir.Open(file)\n\tif err != nil {\n\t\tlog.Printf(\"can't open file %s: %v\\n\", file, err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\tlog.Printf(\"can't open file %s: %v\\n\", file, err)\n\t\treturn\n\t}\n\thttp.ServeContent(w, r, file, fi.ModTime(), f)\n}", "title": "" }, { "docid": "253d2a5203a8f88b3a4b0e60cb131ba3", "score": "0.61149913", "text": "func assetsFileHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet && r.Method != http.MethodHead {\n\t\treturn\n\t}\n\n\tfile := r.URL.Path\n\t//\tlog.Printf(\"Open File '%s'\",file)\n\tif file == \"/\" {\n\t\tfile = \"/index.html\"\n\t}\n\tf, err := assetsDir.Open(file)\n\tif err != nil {\n\t\tlog.Printf(\"can't open file %s: %v\\n\", file, err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\tlog.Printf(\"can't open file %s: %v\\n\", file, err)\n\t\treturn\n\t}\n\thttp.ServeContent(w, r, file, fi.ModTime(), f)\n}", "title": "" }, { "docid": "be1de971326316ae31d9715ca29b70e4", "score": "0.6097482", "text": "func (d *adapter) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tfilename := d.Dir + r.URL.Path\n\n\tinfo, err := os.Stat(filename)\n\n\tif err != nil {\n\t\tlog.Println(\"[static]\", zadapter.FullURL(r), \"->\", 404)\n\t\thttp.Error(w, \"404 Not Found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tif info.IsDir() {\n\t\tfilename = path.Join(filename, \"index.html\")\n\t\tinfo, err = os.Stat(filename)\n\t\tif err != nil || info.IsDir() {\n\t\t\tlog.Println(\"[static]\", zadapter.FullURL(r), \"->\", 404)\n\t\t\thttp.Error(w, \"404 Not Found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t}\n\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.Println(\"[static]\", zadapter.FullURL(r), \"->\", 500)\n\t\thttp.Error(w, \"500 Internal Server Error\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\tlog.Println(\"[static]\", zadapter.FullURL(r), \"->\", filename)\n\thttp.ServeContent(w, r, filename, time.Now(), file)\n}", "title": "" }, { "docid": "25448a2ce34a575e01801290d9ffae12", "score": "0.6085074", "text": "func (p *HttpPlotter) serve() error {\n\tengine := golib.NewGinEngine()\n\tindex := template.New(\"index\")\n\tindexStr, err := FSString(p.UseLocalStatic, \"/index.html\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := index.Parse(indexStr); err != nil {\n\t\treturn err\n\t}\n\tengine.SetHTMLTemplate(index)\n\n\tengine.GET(\"/\", p.serveMain)\n\tengine.GET(\"/metrics\", p.serveListData)\n\tengine.GET(\"/data\", p.serveData)\n\tengine.StaticFS(\"/static\", FS(p.UseLocalStatic))\n\n\treturn engine.Run(p.Endpoint)\n}", "title": "" }, { "docid": "183da21aa03c711bd6b56cb541d8b955", "score": "0.6066757", "text": "func fileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "186651c57d91670915780ea54165725a", "score": "0.6066369", "text": "func (r *Router) FileServer(path string, root http.Dir) {\n\tr.GET(path, func(w http.ResponseWriter, req *http.Request) {\n\t\tupath := req.URL.Path\n\t\tif !strings.HasPrefix(upath, \"/\") {\n\t\t\tupath = \"/\" + upath\n\t\t\treq.URL.Path = upath\n\t\t}\n\t\tupath = p.Clean(upath)\n\n\t\tf, err := root.Open(upath)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tr.notFoundHandlerFn(w, req)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tdefer f.Close()\n\t\tfullName := filepath.Join(string(root), filepath.FromSlash(p.Clean(\"/\"+upath)))\n\t\thttp.ServeFile(w, req, fullName)\n\t})\n}", "title": "" }, { "docid": "d3dd15ab366d0deb2a9147365ae5fee9", "score": "0.6058074", "text": "func Serve(urlPrefix string, location string, index bool) func(next http.Handler) http.Handler {\n\tfs := LocalFile(location, index)\n\tfileserver := http.FileServer(fs)\n\tif urlPrefix != \"\" {\n\t\tfileserver = http.StripPrefix(urlPrefix, fileserver)\n\t}\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tif fs.Exists(urlPrefix, r.URL.Path) {\n\n\t\t\t\text := filepath.Ext(r.URL.Path)\n\t\t\t\tmime := mime.TypeByExtension(ext)\n\t\t\t\tw.Header().Set(\"Content-Type\", mime)\n\t\t\t\tfmt.Println(mime, ext)\n\t\t\t\tfileserver.ServeHTTP(w, r)\n\n\t\t\t} else {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "aa8aa60dae5c20f491d8a86715604130", "score": "0.6053259", "text": "func (u *fileServer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {\n\tscope := middleware.GetRequestScope(req)\n\t// If scope is nil, this will panic.\n\t// A scope should always be injected before this handler is called.\n\tscope.Upstream = u.upstream\n\n\tu.handler.ServeHTTP(rw, req)\n}", "title": "" }, { "docid": "bd7e3acac8a3b7257d2a7026277fb061", "score": "0.6042356", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Vary\", \"Accept-Encoding\")\n\t\tw.Header().Set(\"Cache-Control\", \"public, max-age=7776000\")\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "6144382448c9ea30309a911bfa3c40b7", "score": "0.60414624", "text": "func serveResource(w http.ResponseWriter, r *http.Request) {\n\thttp.StripPrefix(\"/public/\", http.FileServer(http.Dir(\"public\"))).ServeHTTP(w, r)\n}", "title": "" }, { "docid": "f3645fae1912b6e02158733ff6a713b4", "score": "0.6030526", "text": "func GetFileServer(fulladdress string, port string, dir string) {\n\tfs := http.FileServer(http.Dir(dir))\n\thttp.Handle(fulladdress, fs)\n\n\tlog.Println(\"Listening on :\" + port + \"...\")\n\terr := http.ListenAndServe(\":\"+port, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "1e2af92b9b27ae6d9feea6998b1fe3e3", "score": "0.60057586", "text": "func FileServer(from, to string) (string, Handler) {\n\treturn from, HandlerFunc(func(w ndn.Sender, i *ndn.Interest) error {\n\t\tcontent, err := ioutil.ReadFile(to + filepath.Clean(strings.TrimPrefix(i.Name.String(), from)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn w.SendData(&ndn.Data{\n\t\t\tName: i.Name,\n\t\t\tContent: content,\n\t\t})\n\t})\n}", "title": "" }, { "docid": "c6a0eb47e6b67f5870641397d67315fc", "score": "0.5995611", "text": "func mainHandler(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Content-Type\", \"text/html\")\n w.WriteHeader(http.StatusOK)\n\n _, rootfile, _, _ := runtime.Caller(0)\n filepath := path.Join(path.Dir(rootfile), \"template/index.html\")\n data, err := ioutil.ReadFile(filepath)\n if err != nil {\n log.Fatal(\"ioutil.ReadFile() error: \" + err.Error())\n }\n w.Header().Set(\"Content-Length\", fmt.Sprint(len(data)))\n fmt.Fprint(w, string(data))\n}", "title": "" }, { "docid": "30fd71efa2489af3ef5a85d5970224cc", "score": "0.5987727", "text": "func (s *Service) fileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "b271f28e7ebda780e30a8314b4f65882", "score": "0.5984254", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\treturn\n\t}\n\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "f5ed9de730a6580be6588c38d5ac7167", "score": "0.59838986", "text": "func (a *App) FileServer(path string, dir string) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(path, http.FileServer(http.Dir(dir)))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\ta.mux.Get(path, http.RedirectHandler(path+\"/\", http.StatusMovedPermanently).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\ta.mux.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "0ebc763790ddf88184308821cdbeb917", "score": "0.5981764", "text": "func (w *ResponseWriter) RenderFile(value string) {\n\tcontents, error := ioutil.ReadFile(value)\n\tif error != nil {\n\t\tw.InternalError(\"Cannot read \\\"\" + value + \"\\\": \" + error.Error())\n\t} else {\n\t\tw.Render(string(contents))\n\t}\n}", "title": "" }, { "docid": "57f7f8c724691146b51523874a4f1349", "score": "0.5981237", "text": "func fileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit any URL parameters.\")\n\t}\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\n\tpath += \"*\"\n\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\trctx := chi.RouteContext(r.Context())\n\t\tpathPrefix := strings.TrimSuffix(rctx.RoutePattern(), \"/*\")\n\t\tfs := http.StripPrefix(pathPrefix, http.FileServer(root))\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "cbd618891f5c379c0c992494862395ed", "score": "0.59755", "text": "func serve() {\n\tfs := http.FileServer(http.Dir(\"./build\"))\n\thttp.Handle(\"/\", fs)\n\tlog.Println(\"listening on\", *port, \"...\")\n\terr := http.ListenAndServe(fmt.Sprintf(\":%v\", *port), nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "9d77705c26e7ae72f55c139de8bc014d", "score": "0.59736866", "text": "func serveAsset(w http.ResponseWriter, r *http.Request, name string) {\n\tn, err := AssetInfo(name)\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\ta, err := Asset(name)\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\thttp.ServeContent(w, r, n.Name(), n.ModTime(), bytes.NewReader(a))\n}", "title": "" }, { "docid": "ec06c665614d974bf3868ef0d2abfa1c", "score": "0.59401345", "text": "func ServeData(ctx *context.Context, filePath string, size int64, reader io.Reader) error {\n\tbuf := make([]byte, 1024)\n\tn, err := util.ReadAtMost(reader, buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n >= 0 {\n\t\tbuf = buf[:n]\n\t}\n\n\thttpcache.AddCacheControlToHeader(ctx.Resp.Header(), 5*time.Minute)\n\n\tif size >= 0 {\n\t\tctx.Resp.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", size))\n\t} else {\n\t\tlog.Error(\"ServeData called to serve data: %s with size < 0: %d\", filePath, size)\n\t}\n\n\tfileName := path.Base(filePath)\n\tsniffedType := typesniffer.DetectContentType(buf)\n\tisPlain := sniffedType.IsText() || ctx.FormBool(\"render\")\n\tmimeType := \"\"\n\tcharset := \"\"\n\n\tif setting.MimeTypeMap.Enabled {\n\t\tfileExtension := strings.ToLower(filepath.Ext(fileName))\n\t\tmimeType = setting.MimeTypeMap.Map[fileExtension]\n\t}\n\n\tif mimeType == \"\" {\n\t\tif sniffedType.IsBrowsableBinaryType() {\n\t\t\tmimeType = sniffedType.GetMimeType()\n\t\t} else if isPlain {\n\t\t\tmimeType = \"text/plain\"\n\t\t} else {\n\t\t\tmimeType = typesniffer.ApplicationOctetStream\n\t\t}\n\t}\n\n\tif isPlain {\n\t\tcharset, err = charsetModule.DetectEncoding(buf)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Detect raw file %s charset failed: %v, using by default utf-8\", filePath, err)\n\t\t\tcharset = \"utf-8\"\n\t\t}\n\t}\n\n\tif charset != \"\" {\n\t\tctx.Resp.Header().Set(\"Content-Type\", mimeType+\"; charset=\"+strings.ToLower(charset))\n\t} else {\n\t\tctx.Resp.Header().Set(\"Content-Type\", mimeType)\n\t}\n\tctx.Resp.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\n\tisSVG := sniffedType.IsSvgImage()\n\n\t// serve types that can present a security risk with CSP\n\tif isSVG {\n\t\tctx.Resp.Header().Set(\"Content-Security-Policy\", \"default-src 'none'; style-src 'unsafe-inline'; sandbox\")\n\t} else if sniffedType.IsPDF() {\n\t\t// no sandbox attribute for pdf as it breaks rendering in at least safari. this\n\t\t// should generally be safe as scripts inside PDF can not escape the PDF document\n\t\t// see https://bugs.chromium.org/p/chromium/issues/detail?id=413851 for more discussion\n\t\tctx.Resp.Header().Set(\"Content-Security-Policy\", \"default-src 'none'; style-src 'unsafe-inline'\")\n\t}\n\n\tdisposition := \"inline\"\n\tif isSVG && !setting.UI.SVG.Enabled {\n\t\tdisposition = \"attachment\"\n\t}\n\n\t// encode filename per https://datatracker.ietf.org/doc/html/rfc5987\n\tencodedFileName := `filename*=UTF-8''` + url.PathEscape(fileName)\n\n\tctx.Resp.Header().Set(\"Content-Disposition\", disposition+\"; \"+encodedFileName)\n\tctx.Resp.Header().Set(\"Access-Control-Expose-Headers\", \"Content-Disposition\")\n\n\t_, err = ctx.Resp.Write(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(ctx.Resp, reader)\n\treturn err\n}", "title": "" }, { "docid": "563a92418dbc18afe43c70c5fabd716e", "score": "0.5905582", "text": "func ServeContent(w http.ResponseWriter, req *http.Request, fi os.FileInfo, modtime time.Time, content io.ReadSeeker) {\n\thttp.ServeContent(w, req, fi.Name(), modtime, content)\n}", "title": "" }, { "docid": "31578ae498c009a85c737ef598735f88", "score": "0.58887", "text": "func ServeFiles(w http.ResponseWriter, r *http.Request) {\n if fileExists(r.URL.Path[1:]) {\n http.ServeFile(w, r, r.URL.Path[1:])\n } else {\n http.Error(w, \"Not Found\", 404)\n }\n}", "title": "" }, { "docid": "5e946a2d8497143e58b831ed3db3d09a", "score": "0.5887621", "text": "func CreateFileServer(r chi.Router, path string) {\n\tfs := http.StripPrefix(path, http.FileServer(assetBox))\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "75cd21a3d37605d132447f8a1612a825", "score": "0.5877449", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "a9f591d504f7f6b697ca10bb202265fd", "score": "0.58709574", "text": "func UploadedFileHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Redirect(w, r, \"/\", http.StatusBadRequest)\n\t\treturn\n\t}\n\ttoken := r.URL.Path[len(\"/files/\"):]\n\n\t//file, err := db.GetFileName(token)\n\t//if err != nil {\n\tlog.Println(\"serving file ./files/\" + token)\n\thttp.ServeFile(w, r, \"./files/\"+token)\n\t//}\n}", "title": "" }, { "docid": "2ca75037f717ae7775ba4e37676cf811", "score": "0.58663756", "text": "func FileServer(root http.FileSystem, config Config) http.Handler {\n\treturn &fileHandler{root, config}\n}", "title": "" }, { "docid": "c83aef1cc8e43ad442aadfbb4fd95c14", "score": "0.586208", "text": "func serveFileAsUrl(c *lib.Context, fName, p, host string) {\n\n\tio.WriteString(c.RESP, \"#EXTINF:0 group-title=\\\"\")\n\tio.WriteString(c.RESP, \"Browsefile\")\n\tio.WriteString(c.RESP, \"\\\",\")\n\tio.WriteString(c.RESP, fName)\n\n\tio.WriteString(c.RESP, \"\\r\\n\")\n\tio.WriteString(c.RESP, host)\n\tio.WriteString(c.RESP, p)\n\tio.WriteString(c.RESP, \"?inline=true\")\n\n\tif c.IsExternal {\n\t\tio.WriteString(c.RESP, \"&\")\n\t\tio.WriteString(c.RESP, cnst.P_EXSHARE)\n\t\tio.WriteString(c.RESP, \"=1\")\n\t}\n\tif len(c.Auth) > 0 {\n\t\tio.WriteString(c.RESP, \"&auth=\"+c.Auth)\n\t}\n\n\tio.WriteString(c.RESP, \"\\r\\n\")\n\n}", "title": "" }, { "docid": "3342fa2f7a727926eba1b321977869a6", "score": "0.5862002", "text": "func (s *fakeGCS) serve(w http.ResponseWriter, r *http.Request) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tprintln(r.Method, r.URL.String(), string(valueOf(r)))\n\n\tswitch {\n\tcase r.Method == http.MethodGet && strings.Contains(r.URL.String(), \"/o?\"):\n\t\ts.ListObjects(w, r)\n\tcase r.Method == http.MethodGet:\n\t\ts.GetObject(w, r)\n\tdefault:\n\t\tw.WriteHeader(http.StatusNotImplemented)\n\t}\n}", "title": "" }, { "docid": "68ad125e921a6a33794b62bedbe3fe5d", "score": "0.58569455", "text": "func serve(c *fb.Context) (int, error) {\n\t// Checks if this request is made to the static assets folder. If so, and\n\t// if it is a GET request, returns with the asset. Otherwise, returns\n\t// a status not implemented.\n\tif strings.HasPrefix(c.REQ.URL.Path, \"/static\") {\n\t\tif c.Method != http.MethodGet {\n\t\t\treturn http.StatusNotImplemented, nil\n\t\t}\n\n\t\treturn staticHandler(c)\n\t}\n\tif strings.HasPrefix(c.REQ.URL.Path, cnst.WEB_DAV_URL) {\n\t\tServeDav(c, c.RESP, c.REQ)\n\t\treturn http.StatusOK, nil\n\n\t}\n\n\t// Checks if this request is made to the API and directs to the\n\t// API handler if so.\n\tif strings.HasPrefix(c.REQ.URL.Path, \"/api\") {\n\t\treturn apiHandler(c)\n\t}\n\n\t// Any other request should show the index.html file.\n\tc.RESP.Header().Set(\"x-content-type-options\", \"nosniff\")\n\tc.RESP.Header().Set(\"x-xss-protection\", \"1; mode=block\")\n\n\treturn renderFile(c, \"index.html\")\n}", "title": "" }, { "docid": "b5e044c1ef28fe850d99f415578d243b", "score": "0.5853374", "text": "func sendFile(c *gin.Context) {\n\tconn := NewConnection()\n\tdefer conn.Close()\n\n\tconn.Open(c)\n\tfileMessage := conn.Read()\n\tfileName := fileMessage.File\n\n\tsettingsMutex.Lock()\n\tfilePtr, _ := os.Open(settings.Dir + fileName)\n\tdefer filePtr.Close()\n\tsettingsMutex.Unlock()\n\n\t// Notify the client of the new file\n\tfileStat, _ := filePtr.Stat()\n\tfileSize := fileStat.Size()\n\tnumParts := math.Ceil(float64(fileSize) / float64(BufferSize))\n\n\tnewMessage := &Message{Type: New, File: fileName, Body: strconv.Itoa(int(numParts))}\n\tconn.Write(newMessage)\n\n\tbuffer := bufio.NewReader(filePtr)\n\n\tfor {\n\t\tbuff := make([]byte, BufferSize)\n\t\t_, err := buffer.Read(buff)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\t// Send the current file segment\n\t\tconn.WriteBinary(buff)\n\t}\n\n\t// Send a done message\n\tconn.WriteDone()\n}", "title": "" }, { "docid": "20e3f63d9292e383042f942559f637fb", "score": "0.5850043", "text": "func FileServer(r chi.Router, basePath string, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(basePath+path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\tfmt.Println(basePath, path, root, basePath+path)\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "20e3f63d9292e383042f942559f637fb", "score": "0.5850043", "text": "func FileServer(r chi.Router, basePath string, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\tfs := http.StripPrefix(basePath+path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\tfmt.Println(basePath, path, root, basePath+path)\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "97e0eabef132d44d71b5fb1ca79e9c68", "score": "0.58407253", "text": "func (h *Handler) serveIndex(w http.ResponseWriter, r *http.Request) {\n\t// Get the multipart reader for the request.\n\treader, err := r.MultipartReader()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tmapping := bleve.NewIndexMapping()\n\tindex, _ := bleve.New(\"classics.bleve\")\n\tindex.Index()\n\n\tfmt.Println(reader)\n\n\t// Display success message.\n\tfmt.Println(\"Upload successful\")\n}", "title": "" }, { "docid": "3cd0c913ab97fb1fd9e531cec15e824c", "score": "0.58298904", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\tfs := http.StripPrefix(path, http.FileServer(root))\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\tr.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Println(r.URL)\n\t\tfs.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "65f622e094400dacf5ad417536e69d0d", "score": "0.58169514", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit any URL parameters.\")\n\t}\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", http.StatusMovedPermanently).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\trctx := chi.RouteContext(r.Context())\n\t\tpathPrefix := strings.TrimSuffix(rctx.RoutePattern(), \"/*\")\n\t\tfs := http.StripPrefix(pathPrefix, http.FileServer(root))\n\t\tfs.ServeHTTP(w, r)\n\t})\n\n}", "title": "" }, { "docid": "4b7cbba0cf4675fed1a377a3fa056de6", "score": "0.58151096", "text": "func (fs Fs) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tp := strings.TrimPrefix(r.URL.Path, \"/\")\n\n\tp, err := url.PathUnescape(p)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfs.File(w, r, p)\n}", "title": "" }, { "docid": "8c8502df86411c77585d39802fb6caea", "score": "0.580537", "text": "func handleServeUploadPage(w http.ResponseWriter, r *http.Request) {\n\thttp.ServeFile(w, r, \"./html/upload.html\")\n}", "title": "" }, { "docid": "312093d3d35b8ee7af816c96c5736054", "score": "0.57948834", "text": "func (c *Context) File(name string) error {\n\tfile, err := os.Open(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfi, _ := file.Stat()\n\tc.response.Header().Set(ContentDisposition, \"attachment; filename=\"+fi.Name())\n\t_, err = io.Copy(c.response, file)\n\treturn err\n}", "title": "" }, { "docid": "a5fe78b164c97252a5d3adcd4e81c20c", "score": "0.5781479", "text": "func StartFileServer(port int) http.Handler {\n\tlog.Println(\"Starting file server...\")\n\n\tfs := http.FileServer(http.Dir(\"./static/node_modules\"))\n\thttp.Handle(\"/\", fs)\n\n\tstart := func() {\n\t\tlog.Printf(\"Listening on :%v...\\n\", port)\n\t\terr := http.ListenAndServe(fmt.Sprintf(\":%v\", port), fs)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tgo start()\n\treturn fs\n}", "title": "" }, { "docid": "598236c1e5a0a6c784828e3d4571615e", "score": "0.5773552", "text": "func IndexFile(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Solicitud entrante de \" + r.URL.EscapedPath())\n\tif r.URL.Path != PathInicio {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tif r.Method != http.MethodGet {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\thttp.ServeFile(w, r, \"pages/index.html\")\n}", "title": "" }, { "docid": "34b72cdd103947900cfe3be9516208c2", "score": "0.57734716", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit any URL parameters.\")\n\t}\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\trctx := chi.RouteContext(r.Context())\n\t\tpathPrefix := strings.TrimSuffix(rctx.RoutePattern(), \"/*\")\n\t\tfs := http.StripPrefix(pathPrefix, http.FileServer(root))\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "34b72cdd103947900cfe3be9516208c2", "score": "0.57734716", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit any URL parameters.\")\n\t}\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\trctx := chi.RouteContext(r.Context())\n\t\tpathPrefix := strings.TrimSuffix(rctx.RoutePattern(), \"/*\")\n\t\tfs := http.StripPrefix(pathPrefix, http.FileServer(root))\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "34b72cdd103947900cfe3be9516208c2", "score": "0.57734716", "text": "func FileServer(r chi.Router, path string, root http.FileSystem) {\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(\"FileServer does not permit any URL parameters.\")\n\t}\n\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\tr.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\tr.Get(path, func(w http.ResponseWriter, r *http.Request) {\n\t\trctx := chi.RouteContext(r.Context())\n\t\tpathPrefix := strings.TrimSuffix(rctx.RoutePattern(), \"/*\")\n\t\tfs := http.StripPrefix(pathPrefix, http.FileServer(root))\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "1f836ddd066bba1f0d32fea99ad63328", "score": "0.5769215", "text": "func Serve(urlPrefix string, fs ServeFileSystem) macross.Handler {\n\tfileserver := http.FileServer(fs)\n\tif len(urlPrefix) != 0 {\n\t\tfileserver = http.StripPrefix(urlPrefix, fileserver)\n\t}\n\treturn func(c *macross.Context) error {\n\t\trpath := string(c.Request.URI().Path())\n\t\tif fs.Exists(urlPrefix, rpath) {\n\t\t\tcontent, err := fs.Open(rpath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfi, _ := content.Stat()\n\t\t\terr = c.ServeContent(content, fi.Name(), fi.ModTime())\n\t\t\tc.Abort()\n\t\t\treturn err\n\t\t}\n\t\treturn c.Next()\n\t}\n}", "title": "" }, { "docid": "eb7d7105d28fcbd7e09c0a49a0002e10", "score": "0.576751", "text": "func (app *Application) ServeFiles(path, filename string) error {\n\tif strings.Contains(path, \":\") {\n\t\treturn fmt.Errorf(\"path may only include wildcards that match the entire end of the URL (e.g. *filepath)\")\n\t}\n\tif _, err := os.Stat(filename); err != nil {\n\t\treturn fmt.Errorf(\"ServeFiles: %s\", err)\n\t}\n\trel := filename\n\tif wd, err := os.Getwd(); err == nil {\n\t\tif abs, err := filepath.Abs(filename); err == nil {\n\t\t\tif r, err := filepath.Rel(wd, abs); err == nil {\n\t\t\t\trel = r\n\t\t\t}\n\t\t}\n\t}\n\tInfo(RootContext, \"mount file\", KV{\"filename\", rel}, KV{\"path\", fmt.Sprintf(\"GET %s\", path)})\n\tctrl := app.NewController(\"FileServer\")\n\tvar wc string\n\tif idx := strings.Index(path, \"*\"); idx > -1 && idx < len(path)-1 {\n\t\twc = path[idx+1:]\n\t}\n\thandle := ctrl.HandleFunc(\"Serve\", func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\tfullpath := filename\n\t\tr := Request(ctx)\n\t\tif len(wc) > 0 {\n\t\t\tif m, ok := r.Params[wc]; ok {\n\t\t\t\tfullpath = filepath.Join(fullpath, m[0])\n\t\t\t}\n\t\t}\n\t\tInfo(RootContext, \"serve\", KV{\"path\", r.URL.Path}, KV{\"filename\", fullpath})\n\t\thttp.ServeFile(Response(ctx), r.Request, fullpath)\n\t\treturn nil\n\t}, nil)\n\tapp.ServeMux().Handle(\"GET\", path, handle)\n\treturn nil\n}", "title": "" }, { "docid": "1e6c4f225b0258ff93c4b12a38f2387a", "score": "0.576351", "text": "func (t *RestFile) WriteFile(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestFile\", \"WriteFile\")\n\n\tfileResBody, fileResName, fileResContentType := t.embed.WriteFile()\n\n\tw.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+fileResName)\n\n\tw.Header().Set(\"Content-Type\", fileResContentType)\n\n\tdefer func() {\n\t\tif x, ok := fileResBody.(io.Closer); ok {\n\t\t\tcloseErr := x.Close()\n\n\t\t\tif closeErr != nil {\n\n\t\t\t\tt.Log.Handle(w, r, closeErr, \"res\", \"file\", \"error\", \"RestFile\", \"WriteFile\")\n\t\t\t\thttp.Error(w, closeErr.Error(), http.StatusInternalServerError)\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\t}()\n\n\t_, copyErr := io.Copy(w, fileResBody)\n\n\tif copyErr != nil {\n\n\t\tt.Log.Handle(w, r, copyErr, \"res\", \"file\", \"error\", \"RestFile\", \"WriteFile\")\n\t\thttp.Error(w, copyErr.Error(), http.StatusInternalServerError)\n\n\t\treturn\n\t}\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestFile\", \"WriteFile\")\n\n}", "title": "" }, { "docid": "25b8ff92ccefb65a391bf4edc1a139b4", "score": "0.5733074", "text": "func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tabspath := r.URL.Path\n\trelpath := path.Clean(strings.TrimPrefix(abspath, \"/\"))\n\n\t// Is it a TypeScript file?\n\tif strings.HasSuffix(relpath, \".ts\") {\n\t\ts.serveTypeScript(w, r)\n\t\treturn\n\t}\n\n\t// Is it a page we can generate?\n\tif p, err := s.openPage(relpath); err == nil {\n\t\tif p.url != abspath {\n\t\t\t// Redirect to canonical path.\n\t\t\tstatus := http.StatusMovedPermanently\n\t\t\tif i, ok := p.page[\"status\"].(int); ok {\n\t\t\t\tstatus = i\n\t\t\t}\n\t\t\thttp.Redirect(w, r, p.url, status)\n\t\t\treturn\n\t\t}\n\t\t// Serve from the actual filesystem path.\n\t\ts.serveHTML(w, r, p)\n\t\treturn\n\t}\n\n\t// Is it a directory or file we can serve?\n\tinfo, err := fs.Stat(s.fs, relpath)\n\tif err != nil {\n\t\tstatus := http.StatusInternalServerError\n\t\tif errors.Is(err, fs.ErrNotExist) {\n\t\t\tstatus = http.StatusNotFound\n\t\t}\n\t\ts.ServeErrorStatus(w, r, err, status)\n\t\treturn\n\t}\n\n\t// Serve directory.\n\tif info != nil && info.IsDir() {\n\t\tif _, ok := s.findLayout(relpath, \"dir\"); ok {\n\t\t\tif !maybeRedirect(w, r) {\n\t\t\t\ts.serveDir(w, r, relpath)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Serve text file.\n\tif isTextFile(s.fs, relpath) {\n\t\tif _, ok := s.findLayout(path.Dir(relpath), \"texthtml\"); ok {\n\t\t\tif !maybeRedirectFile(w, r) {\n\t\t\t\ts.serveText(w, r, relpath)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Serve raw bytes.\n\ts.fileServer.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "daedff14619c68057cc7ef8cd17b1456", "score": "0.57316124", "text": "func index(w http.ResponseWriter, r *http.Request){\r\n\t\r\n\r\n\t\r\n\t//insert index.html here\r\n\tstream, err := ioutil.ReadFile(\"static/index.html\")\r\n\r\n\tif err != nil { log.Fatal(err) }\r\n\r\n\tindexFile := string(stream)\r\n\r\n\tfmt.Fprintf(w, indexFile)\r\n\r\n\t//should this be in the main func?\r\n\r\n//\tdefer func() { ioutil.NopCloser(stream) }()\r\n\r\n}", "title": "" }, { "docid": "6aeb8fcbb37d6bba5e0a63837ff1b478", "score": "0.5725368", "text": "func readFileHndl(w http.ResponseWriter, r *http.Request) {\n\tparams, _ := extractParams(r)\n\tpath, pathFound := params[\"path\"]\n\tif !pathFound {\n\t\trespondWithParamMissing(w, \"path\")\n\t\treturn\n\t}\n\n\t// verify path\n\tverifyPathIsUnderZMP(path, w, r)\n\n\tfh, err := NewFileHandle(path)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tcontentType, err := fh.MimeType()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\t// size to string\n\tcontentLength := strconv.FormatInt(fh.Size, 10)\n\tcontentDisposition := \"attachment; filename=\" + fh.UniqueName()\n\n\tw.Header().Set(\"Content-Disposition\", contentDisposition)\n\tw.Header().Set(\"Content-Type\", contentType)\n\tw.Header().Set(\"Content-Length\", contentLength)\n\tfh.CopyTo(w)\n}", "title": "" }, { "docid": "79c28519a8e08de1d58b7523ef2900ee", "score": "0.5722369", "text": "func FileHandler(swaggerPath string) (http.Handler, error) {\n\tdata, err := os.Open(swaggerPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &handler{modTime: time.Now(), body: data}, nil\n}", "title": "" }, { "docid": "8277bef7ae7f6acab24f04560c8c0371", "score": "0.57213134", "text": "func (ac *Config) LoadServeFile(w http.ResponseWriter, req *http.Request, L *lua.LState, filename string) {\n\t// Serve a file in the scriptdir\n\tL.SetGlobal(\"serve\", L.NewFunction(func(L *lua.LState) int {\n\t\tscriptdir := filepath.Dir(filename)\n\t\tserveFilename := filepath.Join(scriptdir, L.ToString(1))\n\t\tdataFilename := filepath.Join(scriptdir, ac.defaultLuaDataFilename)\n\t\tif L.GetTop() >= 2 {\n\t\t\t// Optional argument for using a different file than \"data.lua\"\n\t\t\tdataFilename = filepath.Join(scriptdir, L.ToString(2))\n\t\t}\n\t\tif !ac.fs.Exists(serveFilename) {\n\t\t\tlog.Error(\"Could not serve \" + serveFilename + \". File not found.\")\n\t\t\treturn 0 // Number of results\n\t\t}\n\t\tif ac.fs.IsDir(serveFilename) {\n\t\t\tlog.Error(\"Could not serve \" + serveFilename + \". Not a file.\")\n\t\t\treturn 0 // Number of results\n\t\t}\n\t\tac.FilePage(w, req, serveFilename, dataFilename)\n\t\treturn 0 // Number of results\n\t}))\n\n\t// Output text as rendered Pongo2, using a po2 file and an optional table\n\tL.SetGlobal(\"serve2\", L.NewFunction(func(L *lua.LState) int {\n\t\tscriptdir := filepath.Dir(filename)\n\n\t\t// Use the first argument as the template and the second argument as the data map\n\t\ttemplateFilename := filepath.Join(scriptdir, L.CheckString(1))\n\t\text := filepath.Ext(strings.ToLower(templateFilename))\n\n\t\ttemplateData, err := ac.cache.Read(templateFilename, ac.shouldCache(ext))\n\t\tif err != nil {\n\t\t\tif ac.debugMode {\n\t\t\t\tfmt.Fprintf(w, \"Unable to read %s: %s\", templateFilename, err)\n\t\t\t} else {\n\t\t\t\tlog.Errorf(\"Unable to read %s: %s\", templateFilename, err)\n\t\t\t}\n\t\t\treturn 0 // number of restuls\n\t\t}\n\t\ttemplateString := templateData.String()\n\n\t\t// If a table is given as the second argument, fill pongoMap with keys and values\n\t\tpongoMap := make(pongo2.Context)\n\n\t\tif L.GetTop() == 2 {\n\t\t\tluaTable := L.CheckTable(2)\n\n\t\t\tgoMap := gluamapper.ToGoValue(luaTable, gluamapper.Option{\n\t\t\t\tNameFunc: func(s string) string {\n\t\t\t\t\treturn s\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif interfaceMap, ok := goMap.(map[any]any); ok {\n\t\t\t\t// Try to convert from map[any]any to map[string]any\n\t\t\t\tconvertedMap := make(map[string]any)\n\t\t\t\tfor k, v := range interfaceMap {\n\t\t\t\t\tconvertedMap[k.(string)] = v\n\t\t\t\t}\n\t\t\t\tpongoMap = pongo2.Context(convertedMap)\n\t\t\t} else if m, ok := goMap.(map[string]any); ok {\n\t\t\t\tpongoMap = pongo2.Context(m)\n\t\t\t}\n\n\t\t\t// fmt.Println(\"PONGOMAP\", pongoMap, \"LUA TABLE\", luaTable)\n\t\t} else if L.GetTop() > 2 {\n\t\t\tlog.Error(\"Too many arguments given to the serve2 function\")\n\t\t\treturn 0 // number of restuls\n\t\t}\n\n\t\t// Retrieve all the function arguments as a bytes.Buffer\n\t\tbuf := convert.Arguments2buffer(L, true)\n\t\t// Use the buffer as a template.\n\t\t// Options are \"Pretty printing, but without line numbers.\"\n\t\ttpl, err := pongo2.FromString(templateString)\n\t\tif err != nil {\n\t\t\tif ac.debugMode {\n\t\t\t\tfmt.Fprint(w, \"Could not compile Pongo2 template:\\n\\t\"+err.Error()+\"\\n\\n\"+buf.String())\n\t\t\t} else {\n\t\t\t\tlog.Errorf(\"Could not compile Pongo2 template:\\n%s\\n%s\", err, buf.String())\n\t\t\t}\n\t\t\treturn 0 // number of results\n\t\t}\n\t\t// nil is the template context (variables etc in a map)\n\t\tif err := tpl.ExecuteWriter(pongoMap, w); err != nil {\n\t\t\tif ac.debugMode {\n\t\t\t\tfmt.Fprint(w, \"Could not compile Pongo2:\\n\\t\"+err.Error()+\"\\n\\n\"+buf.String())\n\t\t\t} else {\n\t\t\t\tlog.Errorf(\"Could not compile Pongo2:\\n%s\\n%s\", err, buf.String())\n\t\t\t}\n\t\t}\n\t\treturn 0 // number of results\n\t}))\n\n\t// Get the rendered contents of a file in the scriptdir. Discards HTTP headers.\n\tL.SetGlobal(\"render\", L.NewFunction(func(L *lua.LState) int {\n\t\tscriptdir := filepath.Dir(filename)\n\t\tserveFilename := filepath.Join(scriptdir, L.ToString(1))\n\t\tdataFilename := filepath.Join(scriptdir, ac.defaultLuaDataFilename)\n\t\tif L.GetTop() >= 2 {\n\t\t\t// Optional argument for using a different file than \"data.lua\"\n\t\t\tdataFilename = filepath.Join(scriptdir, L.ToString(2))\n\t\t}\n\t\tif !ac.fs.Exists(serveFilename) {\n\t\t\tlog.Error(\"Could not render \" + serveFilename + \". File not found.\")\n\t\t\treturn 0 // Number of results\n\t\t}\n\t\tif ac.fs.IsDir(serveFilename) {\n\t\t\tlog.Error(\"Could not render \" + serveFilename + \". Not a file.\")\n\t\t\treturn 0 // Number of results\n\t\t}\n\n\t\t// Render the filename to a httptest.Recorder\n\t\trecorder := httptest.NewRecorder()\n\t\tac.FilePage(recorder, req, serveFilename, dataFilename)\n\n\t\t// Return the recorder as a string\n\t\tL.Push(lua.LString(utils.RecorderToString(recorder)))\n\t\treturn 1 // Number of results\n\t}))\n}", "title": "" }, { "docid": "cf0710676347a9c61006367b4c9b5b24", "score": "0.5697469", "text": "func serveAsset(context router.Context) error {\n\tp := path.Clean(context.Path())\n\n\t// It must be under /assets, or we don't serve\n\tif !strings.HasPrefix(p, \"/assets/\") {\n\t\treturn router.NotFoundError(nil)\n\t}\n\n\t// Try to find an asset in our list\n\tf := appAssets.File(path.Base(p))\n\tif f == nil {\n\t\treturn router.NotFoundError(nil)\n\t}\n\n\t// Serve the local file, with cache control\n\tlocalPath := \"./\" + f.LocalPath()\n\tcontext.Writer().Header().Set(\"Cache-Control\", \"max-age:3456000, public\")\n\thttp.ServeFile(context, context.Request(), localPath)\n\treturn nil\n}", "title": "" } ]
19f40ecc335368a9aa4dea7411cd6457
MessageType return the string telegramtype of MessagePassportDataSent
[ { "docid": "191ce1921a72512592dede00d2ff23a4", "score": "0.80519235", "text": "func (messagePassportDataSent *MessagePassportDataSent) MessageType() string {\n\treturn \"messagePassportDataSent\"\n}", "title": "" } ]
[ { "docid": "9f86aed3938db7ffab84fde6572e61e7", "score": "0.7571099", "text": "func (messagePassportDataReceived *MessagePassportDataReceived) MessageType() string {\n\treturn \"messagePassportDataReceived\"\n}", "title": "" }, { "docid": "c50928849641b16528fb7330a9e1afb5", "score": "0.753186", "text": "func (passportElementTypePassport *PassportElementTypePassport) MessageType() string {\n\treturn \"passportElementTypePassport\"\n}", "title": "" }, { "docid": "0547ad7cc218482a9e0bc9b9aac74efb", "score": "0.7200453", "text": "func (passportElementTypePassportRegistration *PassportElementTypePassportRegistration) MessageType() string {\n\treturn \"passportElementTypePassportRegistration\"\n}", "title": "" }, { "docid": "64f00c9177844b45f11394b5fc385649", "score": "0.7180363", "text": "func (passportElementPassport *PassportElementPassport) MessageType() string {\n\treturn \"passportElementPassport\"\n}", "title": "" }, { "docid": "10ff2500b52047c5466a5c0caef0badf", "score": "0.702021", "text": "func (inputPassportElementPassport *InputPassportElementPassport) MessageType() string {\n\treturn \"inputPassportElementPassport\"\n}", "title": "" }, { "docid": "337c9b90864b7362c28f6b1dea0318a3", "score": "0.69224006", "text": "func (passportElementPassportRegistration *PassportElementPassportRegistration) MessageType() string {\n\treturn \"passportElementPassportRegistration\"\n}", "title": "" }, { "docid": "118c17ef5abe44278507ef9193fcb8e6", "score": "0.69193876", "text": "func (passportElementTypeTemporaryRegistration *PassportElementTypeTemporaryRegistration) MessageType() string {\n\treturn \"passportElementTypeTemporaryRegistration\"\n}", "title": "" }, { "docid": "697fea9432ba9d0140664bca53cfa02e", "score": "0.6907083", "text": "func (passportElementTypeInternalPassport *PassportElementTypeInternalPassport) MessageType() string {\n\treturn \"passportElementTypeInternalPassport\"\n}", "title": "" }, { "docid": "cc65a51bda84d212a45c3d4bfab0307b", "score": "0.69034904", "text": "func (passportElementTypePersonalDetails *PassportElementTypePersonalDetails) MessageType() string {\n\treturn \"passportElementTypePersonalDetails\"\n}", "title": "" }, { "docid": "eddade37e00c1822f2d5b37a4a786b8b", "score": "0.6886958", "text": "func (passportElementTypePhoneNumber *PassportElementTypePhoneNumber) MessageType() string {\n\treturn \"passportElementTypePhoneNumber\"\n}", "title": "" }, { "docid": "2098e32ab8e6e7b84b5a8ef068643e97", "score": "0.6746863", "text": "func (passportElements *PassportElements) MessageType() string {\n\treturn \"passportElements\"\n}", "title": "" }, { "docid": "90bed8de6d98d112e0db89247ecfe105", "score": "0.674438", "text": "func (passportElementInternalPassport *PassportElementInternalPassport) MessageType() string {\n\treturn \"passportElementInternalPassport\"\n}", "title": "" }, { "docid": "7b32625e611f5f3840810b2659ac1b67", "score": "0.67225856", "text": "func (passportElementTypeAddress *PassportElementTypeAddress) MessageType() string {\n\treturn \"passportElementTypeAddress\"\n}", "title": "" }, { "docid": "ed8fe292b9f36e8053391e0776295d5f", "score": "0.6720259", "text": "func (inputPassportElementPersonalDetails *InputPassportElementPersonalDetails) MessageType() string {\n\treturn \"inputPassportElementPersonalDetails\"\n}", "title": "" }, { "docid": "4b7f7609cbc812c861ed7f6af84df982", "score": "0.6709533", "text": "func (inputPassportElementPassportRegistration *InputPassportElementPassportRegistration) MessageType() string {\n\treturn \"inputPassportElementPassportRegistration\"\n}", "title": "" }, { "docid": "454a9a5535d6f0607fe45ac39f9a10c9", "score": "0.6652655", "text": "func (passportElementTypeEmailAddress *PassportElementTypeEmailAddress) MessageType() string {\n\treturn \"passportElementTypeEmailAddress\"\n}", "title": "" }, { "docid": "b36604b83bf0b3c6c156967818b13876", "score": "0.6646177", "text": "func (msg MsgSend) Type() string { return MsgSendName }", "title": "" }, { "docid": "e5bc04810a06d2dd4b3b7773746f4c8f", "score": "0.66370153", "text": "func (passportElementTemporaryRegistration *PassportElementTemporaryRegistration) MessageType() string {\n\treturn \"passportElementTemporaryRegistration\"\n}", "title": "" }, { "docid": "2bb9f5b8365ddf2fad0052088add3e30", "score": "0.66151184", "text": "func (inputPassportElementInternalPassport *InputPassportElementInternalPassport) MessageType() string {\n\treturn \"inputPassportElementInternalPassport\"\n}", "title": "" }, { "docid": "ea3c3111bfcc354378667eb68d2f742a", "score": "0.6594935", "text": "func (passportElementPersonalDetails *PassportElementPersonalDetails) MessageType() string {\n\treturn \"passportElementPersonalDetails\"\n}", "title": "" }, { "docid": "0295d6866d54a118c0293fd77db6cb88", "score": "0.654763", "text": "func (inputPassportElementPhoneNumber *InputPassportElementPhoneNumber) MessageType() string {\n\treturn \"inputPassportElementPhoneNumber\"\n}", "title": "" }, { "docid": "617e44c4a449c624d354dd3b4f2453bb", "score": "0.65281296", "text": "func (passportElementPhoneNumber *PassportElementPhoneNumber) MessageType() string {\n\treturn \"passportElementPhoneNumber\"\n}", "title": "" }, { "docid": "dfa1271372ba8fb48dcda8a88ed59a85", "score": "0.6523955", "text": "func (passportElementTypeUtilityBill *PassportElementTypeUtilityBill) MessageType() string {\n\treturn \"passportElementTypeUtilityBill\"\n}", "title": "" }, { "docid": "b96e6623631db054f97d6069b6b36fed", "score": "0.64941204", "text": "func (encryptedPassportElement *EncryptedPassportElement) MessageType() string {\n\treturn \"encryptedPassportElement\"\n}", "title": "" }, { "docid": "ef5b738deb83f5a85b82f0bb37a6d4f9", "score": "0.6477846", "text": "func (passportAuthorizationForm *PassportAuthorizationForm) MessageType() string {\n\treturn \"passportAuthorizationForm\"\n}", "title": "" }, { "docid": "50009fc00bb86ee2221a90081882d64d", "score": "0.6455594", "text": "func (inputPassportElementTemporaryRegistration *InputPassportElementTemporaryRegistration) MessageType() string {\n\treturn \"inputPassportElementTemporaryRegistration\"\n}", "title": "" }, { "docid": "582aeafac9f461e52f903a5176a1bff2", "score": "0.637109", "text": "func (m Tlattach) MessageType() MessageType { return MessageTlattach }", "title": "" }, { "docid": "9aad2eaff2da5fe4098dde8894a5b2f6", "score": "0.63544166", "text": "func (passportRequiredElement *PassportRequiredElement) MessageType() string {\n\treturn \"passportRequiredElement\"\n}", "title": "" }, { "docid": "679f7b36258148600ca4445d17afe2f3", "score": "0.6343607", "text": "func (updateMessageSendFailed *UpdateMessageSendFailed) MessageType() string {\n\treturn \"updateMessageSendFailed\"\n}", "title": "" }, { "docid": "bb22a2fb6df312b48cc6eef00ba0b71e", "score": "0.63424474", "text": "func (passportElementTypeBankStatement *PassportElementTypeBankStatement) MessageType() string {\n\treturn \"passportElementTypeBankStatement\"\n}", "title": "" }, { "docid": "53be39407ea17a1cc236d673620f00c0", "score": "0.6336697", "text": "func (passportElementEmailAddress *PassportElementEmailAddress) MessageType() string {\n\treturn \"passportElementEmailAddress\"\n}", "title": "" }, { "docid": "08182f936b83c29deab7cb7cb0182d97", "score": "0.6336224", "text": "func (passwordState *PasswordState) MessageType() string {\n\treturn \"passwordState\"\n}", "title": "" }, { "docid": "87b35ae477d7c5852e81ff709f589916", "score": "0.6332449", "text": "func (passportElementTypeRentalAgreement *PassportElementTypeRentalAgreement) MessageType() string {\n\treturn \"passportElementTypeRentalAgreement\"\n}", "title": "" }, { "docid": "a49585ccf30af1677c2a248c86c5520d", "score": "0.63314104", "text": "func (passportElementAddress *PassportElementAddress) MessageType() string {\n\treturn \"passportElementAddress\"\n}", "title": "" }, { "docid": "c38a920257422611164ca2cbfad038af", "score": "0.63263166", "text": "func (updateMessageSendSucceeded *UpdateMessageSendSucceeded) MessageType() string {\n\treturn \"updateMessageSendSucceeded\"\n}", "title": "" }, { "docid": "a0ea9a3906db3a26ff1a190d3030f256", "score": "0.6312316", "text": "func (inputPassportElementAddress *InputPassportElementAddress) MessageType() string {\n\treturn \"inputPassportElementAddress\"\n}", "title": "" }, { "docid": "c98bb8a7b4f909d6b72de3dade7b2e59", "score": "0.62952685", "text": "func (messageSendingStateFailed *MessageSendingStateFailed) MessageType() string {\n\treturn \"messageSendingStateFailed\"\n}", "title": "" }, { "docid": "03fbcea5fef947f5f0a4b0b82bb46422", "score": "0.6285279", "text": "func (temporaryPasswordState *TemporaryPasswordState) MessageType() string {\n\treturn \"temporaryPasswordState\"\n}", "title": "" }, { "docid": "41c0ec244b24dea7f7350183ed56ffce", "score": "0.62799925", "text": "func (a *PDUSESSIONESTABLISHMENTREQUESTMessageIdentity) GetMessageType() (messageType uint8) {}", "title": "" }, { "docid": "741204095da0e1e1329819afc3e17aa1", "score": "0.62772816", "text": "func (inputPassportElementEmailAddress *InputPassportElementEmailAddress) MessageType() string {\n\treturn \"inputPassportElementEmailAddress\"\n}", "title": "" }, { "docid": "7c664262291caf42500fc48472065b66", "score": "0.6260732", "text": "func (inputCredentialsSaved *InputCredentialsSaved) MessageType() string {\n\treturn \"inputCredentialsSaved\"\n}", "title": "" }, { "docid": "353a1c86c7c6543943354a0faa455bc0", "score": "0.6228718", "text": "func (m Tlauth) MessageType() MessageType { return MessageTlauth }", "title": "" }, { "docid": "ddf3e9bd8bfe59bc07e3ad42d2f82528", "score": "0.6216272", "text": "func (a *PDUSESSIONRELEASEREQUESTMessageIdentity) GetMessageType() (messageType uint8) {}", "title": "" }, { "docid": "c0d3545cbbf5f7a57223e1bc6d6fe1aa", "score": "0.62085915", "text": "func (proxyTypeMtproto *ProxyTypeMtproto) MessageType() string {\n\treturn \"proxyTypeMtproto\"\n}", "title": "" }, { "docid": "45029afcfcb86f57ea01d3c9f6361049", "score": "0.61989886", "text": "func (secretChatStatePending *SecretChatStatePending) MessageType() string {\n\treturn \"secretChatStatePending\"\n}", "title": "" }, { "docid": "3b097f669c20d5eada1a1bf80b5473ec", "score": "0.61908334", "text": "func (callbackQueryPayloadData *CallbackQueryPayloadData) MessageType() string {\n\treturn \"callbackQueryPayloadData\"\n}", "title": "" }, { "docid": "92658831fd692069b4824fe96e1f4e26", "score": "0.61858463", "text": "func (authenticationCodeTypeTelegramMessage *AuthenticationCodeTypeTelegramMessage) MessageType() string {\n\treturn \"authenticationCodeTypeTelegramMessage\"\n}", "title": "" }, { "docid": "cafd13602bc78a68d673fe852f7a2c85", "score": "0.61808634", "text": "func (passportElementUtilityBill *PassportElementUtilityBill) MessageType() string {\n\treturn \"passportElementUtilityBill\"\n}", "title": "" }, { "docid": "ff63ba3e415666cb7c09bcb2480ab622", "score": "0.61710626", "text": "func (passportSuitableElement *PassportSuitableElement) MessageType() string {\n\treturn \"passportSuitableElement\"\n}", "title": "" }, { "docid": "815586a99dc150652781893ba5728ff3", "score": "0.6130369", "text": "func (callbackQueryPayloadGame *CallbackQueryPayloadGame) MessageType() string {\n\treturn \"callbackQueryPayloadGame\"\n}", "title": "" }, { "docid": "e6e12c923124acfe4c457a73f2c2a624", "score": "0.61119694", "text": "func (updateSendLiteServerQuery *UpdateSendLiteServerQuery) MessageType() string {\n\treturn \"updateSendLiteServerQuery\"\n}", "title": "" }, { "docid": "ce34fcf6360694ae337af12c9bd6f8d1", "score": "0.6101825", "text": "func (passportElementBankStatement *PassportElementBankStatement) MessageType() string {\n\treturn \"passportElementBankStatement\"\n}", "title": "" }, { "docid": "b054b1bdd73ea93e174c8ac59d74f883", "score": "0.60937274", "text": "func (inputPassportElementUtilityBill *InputPassportElementUtilityBill) MessageType() string {\n\treturn \"inputPassportElementUtilityBill\"\n}", "title": "" }, { "docid": "023256f544be6c6c5a51e5f20e30015a", "score": "0.6090469", "text": "func (updateSecretChat *UpdateSecretChat) MessageType() string {\n\treturn \"updateSecretChat\"\n}", "title": "" }, { "docid": "507e475d60e0d9eecc04fb01b823fafa", "score": "0.6085095", "text": "func (inputPassportElementBankStatement *InputPassportElementBankStatement) MessageType() string {\n\treturn \"inputPassportElementBankStatement\"\n}", "title": "" }, { "docid": "308371c92451d9fe2bcf354c8cde4d3e", "score": "0.6083876", "text": "func (msgDataEncryptedText *MsgDataEncryptedText) MessageType() string {\n\treturn \"msg.dataEncryptedText\"\n}", "title": "" }, { "docid": "ac3782406810f12c8eee5fbc9e3fc756", "score": "0.608107", "text": "func (messagePaymentSuccessfulBot *MessagePaymentSuccessfulBot) MessageType() string {\n\treturn \"messagePaymentSuccessfulBot\"\n}", "title": "" }, { "docid": "d7a1bd17f6f507e9eeb029839a15184e", "score": "0.6071173", "text": "func (chatTypeSecret *ChatTypeSecret) MessageType() string {\n\treturn \"chatTypeSecret\"\n}", "title": "" }, { "docid": "9bbcf520f5939464957ede990dc56132", "score": "0.60707444", "text": "func (m Rlauth) MessageType() MessageType { return MessageRlauth }", "title": "" }, { "docid": "24dc5bb641edaa5568c98ac733dddabf", "score": "0.6070206", "text": "func (secretChat *SecretChat) MessageType() string {\n\treturn \"secretChat\"\n}", "title": "" }, { "docid": "ced452951d7d7bcf568fc2a879756e9e", "score": "0.6059774", "text": "func (authorizationStateWaitPhoneNumber *AuthorizationStateWaitPhoneNumber) MessageType() string {\n\treturn \"authorizationStateWaitPhoneNumber\"\n}", "title": "" }, { "docid": "c06fb192b7e51beebe511ff0e8a4e194", "score": "0.60593987", "text": "func (m LoginMessage) Type() uint8 {\n\treturn MessageLoginRequest\n}", "title": "" }, { "docid": "cbf139c048f1a4c276bc55a0b59d0c88", "score": "0.6054949", "text": "func (savedCredentials *SavedCredentials) MessageType() string {\n\treturn \"savedCredentials\"\n}", "title": "" }, { "docid": "5f36d7c8cf3bd4f9591503c9c83f7c46", "score": "0.60483456", "text": "func (shippingOption *ShippingOption) MessageType() string {\n\treturn \"shippingOption\"\n}", "title": "" }, { "docid": "638e123cbf5bc5944f638669ee382a85", "score": "0.604188", "text": "func (messagePaymentSuccessful *MessagePaymentSuccessful) MessageType() string {\n\treturn \"messagePaymentSuccessful\"\n}", "title": "" }, { "docid": "ff4162b2ba0be4f7f9d8a1f333acf88e", "score": "0.6039442", "text": "func (msgDataText *MsgDataText) MessageType() string {\n\treturn \"msg.dataText\"\n}", "title": "" }, { "docid": "50b7f7e03a81d88a84022384b2712bd7", "score": "0.6037025", "text": "func (tMeURLTypeChatInvite *TMeURLTypeChatInvite) MessageType() string {\n\treturn \"tMeUrlTypeChatInvite\"\n}", "title": "" }, { "docid": "6dd250d7d71e806d9bd306e5f0831454", "score": "0.6033261", "text": "func (accountTTL *AccountTTL) MessageType() string {\n\treturn \"accountTtl\"\n}", "title": "" }, { "docid": "e51ff5ba2397f03437bae030c6172442", "score": "0.60277647", "text": "func (messageSendingStatePending *MessageSendingStatePending) MessageType() string {\n\treturn \"messageSendingStatePending\"\n}", "title": "" }, { "docid": "6c6494254141f92243f183e76019902b", "score": "0.6026737", "text": "func (inputPassportElementRentalAgreement *InputPassportElementRentalAgreement) MessageType() string {\n\treturn \"inputPassportElementRentalAgreement\"\n}", "title": "" }, { "docid": "1858b6f9f7ecd442670cbee4185b8209", "score": "0.6026466", "text": "func (updateChatDraftMessage *UpdateChatDraftMessage) MessageType() string {\n\treturn \"updateChatDraftMessage\"\n}", "title": "" }, { "docid": "8c366c78a6a40bc8d9587c6106449922", "score": "0.6017605", "text": "func (call *Call) MessageType() string {\n\treturn \"call\"\n}", "title": "" }, { "docid": "b5265f7bbf8701c61598c60560fe18b3", "score": "0.60161686", "text": "func (chatTypePrivate *ChatTypePrivate) MessageType() string {\n\treturn \"chatTypePrivate\"\n}", "title": "" }, { "docid": "47227dc5b3c396d0e1edfe2334a5db90", "score": "0.6009792", "text": "func (textEntityTypePhoneNumber *TextEntityTypePhoneNumber) MessageType() string {\n\treturn \"textEntityTypePhoneNumber\"\n}", "title": "" }, { "docid": "d59e4b36c01de9c9eacad372d5f5290b", "score": "0.6006022", "text": "func (chatReportSpamState *ChatReportSpamState) MessageType() string {\n\treturn \"chatReportSpamState\"\n}", "title": "" }, { "docid": "40f025ba0c4ac0ce9ee3a8f32cc69841", "score": "0.60000354", "text": "func (updateChatOrder *UpdateChatOrder) MessageType() string {\n\treturn \"updateChatOrder\"\n}", "title": "" }, { "docid": "0ad5a689df1f21eea5da80476f3fd7be", "score": "0.59886545", "text": "func (chatActionTyping *ChatActionTyping) MessageType() string {\n\treturn \"chatActionTyping\"\n}", "title": "" }, { "docid": "bb16fd0650f67dcbb98b784172f26b2e", "score": "0.59881616", "text": "func (updateChatLastMessage *UpdateChatLastMessage) MessageType() string {\n\treturn \"updateChatLastMessage\"\n}", "title": "" }, { "docid": "460c27abb8e801cc041749e6c85b7809", "score": "0.5985666", "text": "func (personalDetails *PersonalDetails) MessageType() string {\n\treturn \"personalDetails\"\n}", "title": "" }, { "docid": "c3c3f53f8a14b5356356e3ccfbd4c76b", "score": "0.59786415", "text": "func (checkChatUsernameResultOk *CheckChatUsernameResultOk) MessageType() string {\n\treturn \"checkChatUsernameResultOk\"\n}", "title": "" }, { "docid": "092c273dd4c2c799d0205cada2a8ab4d", "score": "0.5974597", "text": "func (passportElementRentalAgreement *PassportElementRentalAgreement) MessageType() string {\n\treturn \"passportElementRentalAgreement\"\n}", "title": "" }, { "docid": "3a26c766d2f37c6562dca6a9b964f19e", "score": "0.5970653", "text": "func (authorizationStateWaitPassword *AuthorizationStateWaitPassword) MessageType() string {\n\treturn \"authorizationStateWaitPassword\"\n}", "title": "" }, { "docid": "12d02c2c1dda0a983d74f496f1616839", "score": "0.59688526", "text": "func (m Rlattach) MessageType() MessageType { return MessageRlattach }", "title": "" }, { "docid": "04824cbe815b2adeae5d34ae0cf1b856", "score": "0.5968756", "text": "func (checkChatUsernameResultPublicChatsTooMuch *CheckChatUsernameResultPublicChatsTooMuch) MessageType() string {\n\treturn \"checkChatUsernameResultPublicChatsTooMuch\"\n}", "title": "" }, { "docid": "5151205f7c45c27fb4d1499d82285cb0", "score": "0.5963292", "text": "func getType(msg []byte) string {\n\tvalue, _, _, err := jsonparser.Get(msg, \"message\", \"type\")\n\tif err != nil {\n\t\tLog.Error(err)\n\t\treturn \"\"\n\t}\n\treturn string(value)\n}", "title": "" }, { "docid": "af202c94af2164309f99ae2ca1fdfed0", "score": "0.5942399", "text": "func (messageCall *MessageCall) MessageType() string {\n\treturn \"messageCall\"\n}", "title": "" }, { "docid": "2af5e81f43e400dc971f1f13cb2b0729", "score": "0.5939266", "text": "func (secretChatStateReady *SecretChatStateReady) MessageType() string {\n\treturn \"secretChatStateReady\"\n}", "title": "" }, { "docid": "4360670c3b2aac75e06b3355b7fbc3c5", "score": "0.5939234", "text": "func (userTypeRegular *UserTypeRegular) MessageType() string {\n\treturn \"userTypeRegular\"\n}", "title": "" }, { "docid": "be4c39c3e0830bb7fc567b407f6d4eca", "score": "0.593753", "text": "func (p *SenderKeyMessage) Type() uint32 {\n\treturn SENDERKEY_TYPE\n}", "title": "" }, { "docid": "be7dcc37447d2bcf485ac01adc72715c", "score": "0.5936824", "text": "func (SendChannelChatRequest) Type() string {\n\treturn TypeSendChannelChatRequest\n}", "title": "" }, { "docid": "caba26dd5d4eeaeb6838c8bcfdfaedfa", "score": "0.5933448", "text": "func (msg MsgSendPylons) Type() string { return \"send_pylons\" }", "title": "" }, { "docid": "ccc9cdf3f4c06d895cf5610b419a7274", "score": "0.5927217", "text": "func (updateNewChat *UpdateNewChat) MessageType() string {\n\treturn \"updateNewChat\"\n}", "title": "" }, { "docid": "5784ba7f56d6913645afe40b2b37f5de", "score": "0.5927095", "text": "func (chatReportReasonSpam *ChatReportReasonSpam) MessageType() string {\n\treturn \"chatReportReasonSpam\"\n}", "title": "" }, { "docid": "0b2d97e5be2b0057a7ff63e6490f8a8c", "score": "0.5924448", "text": "func (updateCall *UpdateCall) MessageType() string {\n\treturn \"updateCall\"\n}", "title": "" }, { "docid": "d920667592d5f69775b2a44fdffb1392", "score": "0.59215945", "text": "func (s Telegram) Type() string {\n\treturn TelegramType\n}", "title": "" }, { "docid": "0cf4772495dbf4475f27f5af7bcd4356", "score": "0.59196466", "text": "func (messageSticker *MessageSticker) MessageType() string {\n\treturn \"messageSticker\"\n}", "title": "" }, { "docid": "130ed76dbc18a29a45280d7bf0397cec", "score": "0.5919594", "text": "func (msg MsgBankSendFiats) Type() string { return \"bank\" }", "title": "" }, { "docid": "904da477d7eef2d26971c9b8c7bd77d2", "score": "0.5918959", "text": "func (updateUser *UpdateUser) MessageType() string {\n\treturn \"updateUser\"\n}", "title": "" }, { "docid": "02f76c6b14e011ae793e3da6902be4bd", "score": "0.5918538", "text": "func (sticker *Sticker) MessageType() string {\n\treturn \"sticker\"\n}", "title": "" }, { "docid": "b8054b0d529dae69c19ddabc6cbbf67a", "score": "0.5909171", "text": "func (updateNewShippingQuery *UpdateNewShippingQuery) MessageType() string {\n\treturn \"updateNewShippingQuery\"\n}", "title": "" } ]
53d8273298068e5dd2af8f7d4301bfd3
AddDelegation add a new delegate key to the specified repository target
[ { "docid": "f71256ef1fc86d422d90f824c3db54e1", "score": "0.69039154", "text": "func (s *Service) AddDelegation(ctx context.Context, cmd AddDelegationCommand) error {\n\tif err := cmd.GuardHasGUN(); err != nil {\n\t\treturn err\n\t}\n\tif len(cmd.DelegationKeys) == 0 || len(cmd.Paths) == 0 {\n\t\treturn ErrPublicKeysAndPathsMandatory\n\t}\n\tsanitizedGUN := cmd.SanitizedGUN()\n\n\tfact := ConfigureRepo(s.config, s.retriever, false, readWrite)\n\tnRepo, err := fact(sanitizedGUN)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = nRepo.AddDelegation(DelegationPath(\"releases\"), cmd.DelegationKeys, cmd.Paths)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create delegation: %w\", err)\n\t}\n\terr = nRepo.AddDelegation(cmd.Role, cmd.DelegationKeys, cmd.Paths)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create delegation: %w\", err)\n\t}\n\terr = nRepo.AddDelegation(DelegationPath(\"releases\"), cmd.DelegationKeys, cmd.Paths)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create delegation: %w\", err)\n\t}\n\n\treturn maybeAutoPublish(s.log, cmd.AutoPublish, sanitizedGUN, s.config, s.retriever)\n}", "title": "" } ]
[ { "docid": "396701fd15b2da61f809dd622561a804", "score": "0.66585296", "text": "func (d *delegationCommander) delegationAdd(cmd *cobra.Command, args []string) error {\n\t// We must have at least the gun and role name, and at least one key or path (or the --all-paths flag) to add\n\tif len(args) < 2 || len(args) < 3 && d.paths == nil && !d.allPaths {\n\t\tcmd.Usage()\n\t\treturn fmt.Errorf(\"must specify the Global Unique Name and the role of the delegation along with the public key certificate paths and/or a list of paths to add\")\n\t}\n\n\tconfig, err := d.configGetter()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgun := data.GUN(args[0])\n\trole := data.RoleName(args[1])\n\n\tpubKeys, err := ingestPublicKeys(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcheckAllPaths(d)\n\n\ttrustPin, err := getTrustPinning(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// no online operations are performed by add so the transport argument\n\t// should be nil\n\tnRepo, err := notaryclient.NewFileCachedNotaryRepository(\n\t\tconfig.GetString(\"trust_dir\"), gun, getRemoteTrustServer(config), nil, d.retriever, trustPin)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add the delegation to the repository\n\terr = nRepo.AddDelegation(role, pubKeys, d.paths)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create delegation: %v\", err)\n\t}\n\n\t// Make keyID slice for better CLI print\n\tpubKeyIDs := []string{}\n\tfor _, pubKey := range pubKeys {\n\t\tpubKeyID, err := utils.CanonicalKeyID(pubKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpubKeyIDs = append(pubKeyIDs, pubKeyID)\n\t}\n\n\tcmd.Println(\"\")\n\taddingItems := \"\"\n\tif len(pubKeyIDs) > 0 {\n\t\taddingItems = addingItems + fmt.Sprintf(\"with keys %s, \", pubKeyIDs)\n\t}\n\tif d.paths != nil || d.allPaths {\n\t\taddingItems = addingItems + fmt.Sprintf(\n\t\t\t\"with paths [%s], \",\n\t\t\tstrings.Join(prettyPaths(d.paths), \"\\n\"),\n\t\t)\n\t}\n\tcmd.Printf(\n\t\t\"Addition of delegation role %s %sto repository \\\"%s\\\" staged for next publish.\\n\",\n\t\trole, addingItems, gun)\n\tcmd.Println(\"\")\n\n\treturn maybeAutoPublish(cmd, d.autoPublish, gun, config, d.retriever)\n}", "title": "" }, { "docid": "54e437e19bf53e58dc51f6e51adc3c24", "score": "0.6623594", "text": "func (t *SignedTargets) AddDelegation(role *Role, keys []*PublicKey) error {\n\treturn errors.New(\"Not Implemented\")\n}", "title": "" }, { "docid": "b35562eb1f02bfd21cf6c880890ca6de", "score": "0.6407801", "text": "func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, token sdk.SysCoin) error {\n\n\tdelQuantity, minDelLimit := token.Amount, k.ParamsMinDelegation(ctx)\n\tif delQuantity.LT(minDelLimit) {\n\t\treturn types.ErrInsufficientQuantity(delQuantity.String(), minDelLimit.String())\n\t}\n\n\t// 1.transfer account's okt into bondPool\n\tcoins := sdk.SysCoins{token}\n\tif err := k.supplyKeeper.DelegateCoinsFromAccountToModule(ctx, delAddr, types.BondedPoolName, coins); err != nil {\n\t\treturn err\n\t}\n\n\t// 2.get\n\tdelegator, found := k.GetDelegator(ctx, delAddr)\n\tif !found {\n\t\tdelegator = types.NewDelegator(delAddr)\n\t}\n\n\t// 3.update delegator\n\tdelegator.Tokens = delegator.Tokens.Add(delQuantity)\n\tk.SetDelegator(ctx, delegator)\n\n\tif delegator.HasProxy() {\n\t\t//delegator have bound with some proxy, need update proxy's shares\n\t\treturn k.UpdateProxy(ctx, delegator, delQuantity)\n\n\t}\n\t// 4.update shares when delAddr has added already\n\tfinalTokens := delegator.Tokens\n\t// finalTokens should add TotalDelegatedTokens when delegator is proxy\n\tif delegator.IsProxy {\n\t\tfinalTokens = finalTokens.Add(delegator.TotalDelegatedTokens)\n\t}\n\treturn k.UpdateShares(ctx, delegator.DelegatorAddress, finalTokens)\n}", "title": "" }, { "docid": "30a03e4b9827884874909b37b7ff7cc8", "score": "0.58595574", "text": "func (_Publickeyresolver *PublickeyresolverTransactor) AddPublicKeyDelegated(opts *bind.TransactOpts, associatedAddress common.Address, publicKey []byte, v uint8, r [32]byte, s [32]byte, timestamp *big.Int) (*types.Transaction, error) {\n\treturn _Publickeyresolver.contract.Transact(opts, \"addPublicKeyDelegated\", associatedAddress, publicKey, v, r, s, timestamp)\n}", "title": "" }, { "docid": "8adc37b38bb7fd37e9239c605621a610", "score": "0.57684153", "text": "func (k Keeper) initializeDelegation(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress) {\n\t// period has already been incremented - we want to store the period ended by this delegation action\n\tpreviousPeriod := k.GetValidatorCurrentRewards(ctx, val).Period - 1\n\n\t// increment reference count for the period we're going to track\n\tk.incrementReferenceCount(ctx, val, previousPeriod)\n\n\tvalidator := k.stakingKeeper.Validator(ctx, val)\n\tdelegation := k.stakingKeeper.Delegation(ctx, del, val)\n\n\t// calculate delegation stake in tokens\n\t// we don't store directly, so multiply delegation shares * (tokens per share)\n\t// note: necessary to truncate so we don't allow withdrawing more rewards than owed\n\tstake := delegation.GetShares().MulTruncate(validator.GetDelegatorShareExRate())\n\tk.SetDelegatorStartingInfo(ctx, val, del, types.NewDelegatorStartingInfo(previousPeriod, stake, uint64(ctx.BlockHeight())))\n}", "title": "" }, { "docid": "257960213079e1dd849a2c48f5991b85", "score": "0.56714433", "text": "func (rs *rootResolver) Delegation(args *struct{ Address common.Address }) (*Delegator, error) {\n\t// get the delegator detail from backend\n\td, err := rs.repo.Delegation(args.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewDelegator(d, rs.repo), nil\n}", "title": "" }, { "docid": "eb45b23c96aa029ff40f6ba115c514dd", "score": "0.56153977", "text": "func (_Publickeyresolver *PublickeyresolverTransactorSession) AddPublicKeyDelegated(associatedAddress common.Address, publicKey []byte, v uint8, r [32]byte, s [32]byte, timestamp *big.Int) (*types.Transaction, error) {\n\treturn _Publickeyresolver.Contract.AddPublicKeyDelegated(&_Publickeyresolver.TransactOpts, associatedAddress, publicKey, v, r, s, timestamp)\n}", "title": "" }, { "docid": "7c040e4b8698a663389f0fc50784c807", "score": "0.56062084", "text": "func (_Publickeyresolver *PublickeyresolverSession) AddPublicKeyDelegated(associatedAddress common.Address, publicKey []byte, v uint8, r [32]byte, s [32]byte, timestamp *big.Int) (*types.Transaction, error) {\n\treturn _Publickeyresolver.Contract.AddPublicKeyDelegated(&_Publickeyresolver.TransactOpts, associatedAddress, publicKey, v, r, s, timestamp)\n}", "title": "" }, { "docid": "41dcc29b90a20aa859e4a3e690b5867f", "score": "0.55663764", "text": "func (api *API) Delegate(ctx context.Context, delegator, voter, amount, privKeyHex string) (*model.BroadcastResponse, errors.Error) {\n\tresp, _, err := api.GuaranteeBroadcast(ctx, delegator, func(seq uint64) ([]byte, errors.Error) {\n\t\treturn api.MakeDelegatetMsg(delegator, voter, amount, privKeyHex, seq)\n\t})\n\treturn resp, err\n}", "title": "" }, { "docid": "740f53e756256b6c41187ace8b8ce9f2", "score": "0.5529901", "text": "func (_SfcContract *SfcContractTransactor) WithdrawDelegation(opts *bind.TransactOpts, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.contract.Transact(opts, \"withdrawDelegation\", toStakerID)\n}", "title": "" }, { "docid": "cf6a820e5d1a5f1d3f46bfba350c38de", "score": "0.5520923", "text": "func (r *Reporter) AddDelegate(d Delegate) {\n\tr.delegates = append(r.delegates, d)\n}", "title": "" }, { "docid": "622c846321b94c15904c2adee27bfa10", "score": "0.547537", "text": "func (runner RPCWorkFlowRunner) AddDelegatorToPrimaryNetwork(\n\tdelegateeNodeID string,\n\tpChainAddress string,\n\tstakeAmount uint64,\n) error {\n\tclient := runner.client\n\tdelegatorStartTime := time.Now().Add(DefaultDelegationDelay)\n\tstartTime := uint64(delegatorStartTime.Unix())\n\tendTime := uint64(delegatorStartTime.Add(DefaultDelegationPeriod).Unix())\n\taddDelegatorTxID, err := client.PChainAPI().AddDelegator(\n\t\trunner.userPass,\n\t\tnil, // from addrs\n\t\t\"\", // change addr\n\t\tpChainAddress,\n\t\tdelegateeNodeID,\n\t\tstakeAmount,\n\t\tstartTime,\n\t\tendTime,\n\t)\n\tif err != nil {\n\t\treturn stacktrace.Propagate(err, \"Failed to add delegator %s\", pChainAddress)\n\t}\n\tif err := runner.AwaitPChainTransactionAcceptance(addDelegatorTxID); err != nil {\n\t\treturn stacktrace.Propagate(err, \"Failed to accept AddDelegator tx: %s\", addDelegatorTxID)\n\t}\n\n\t// Sleep until delegator starts validating\n\ttime.Sleep(time.Until(delegatorStartTime) + stakingPeriodSynchronyDelay)\n\treturn nil\n}", "title": "" }, { "docid": "b46a5575edc9b5cb95d1d9a8e2e67875", "score": "0.54532737", "text": "func (_SfcContract *SfcContractTransactorSession) CreateDelegation(to *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.CreateDelegation(&_SfcContract.TransactOpts, to)\n}", "title": "" }, { "docid": "6c81730a16c03d886da190fd46384129", "score": "0.54051274", "text": "func (_SfcContract *SfcContractTransactor) CreateDelegation(opts *bind.TransactOpts, to *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.contract.Transact(opts, \"createDelegation\", to)\n}", "title": "" }, { "docid": "6f765f88e65273691ae221f5c33ab198", "score": "0.5384628", "text": "func (_SfcContract *SfcContractSession) CreateDelegation(to *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.CreateDelegation(&_SfcContract.TransactOpts, to)\n}", "title": "" }, { "docid": "b99152fee62ae4efa7561a9120a0feb4", "score": "0.5348626", "text": "func (pkg *Package) AddTarget(target *BuildTarget) {\n\tpkg.mutex.Lock()\n\tdefer pkg.mutex.Unlock()\n\tpkg.targets[target.Label.Name] = target\n}", "title": "" }, { "docid": "88cfbf6f7c19d644f74ebdb9ac736383", "score": "0.53447443", "text": "func (d componentsDictionary) AddTarget(resource string) {\n\td[apiGroupTargets] = append(d[apiGroupTargets], resource)\n}", "title": "" }, { "docid": "dfa306223da597cd222fffc76397b669", "score": "0.53436726", "text": "func (a *Agent) delegate(action string, domain string, record file.Records) {\n\tvar err error\n\n\tif action == \"update\" {\n\t\terr = a.WebhookClient.UpdateRecord(&hookTypes.DNSRecord{Name: record.Name, Type: record.Type, Value: record.Value})\n\t}\n\n\tif action == \"create\" {\n\t\terr = a.WebhookClient.AddRecord(record.Name, record.Type, record.Value)\n\t}\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error to %v the Domain '%v' from the service '%v': %v\", action, domain, record.Name, err)\n\t}\n\n}", "title": "" }, { "docid": "9969d4c1e877174742fd3d2afb549fd2", "score": "0.53362525", "text": "func (h *handler) setDelegate(d oterror.Handler) {\n\tif h.delegate.Load() != nil {\n\t\t// Delegate already registered\n\t\treturn\n\t}\n\th.delegate.Store(d)\n}", "title": "" }, { "docid": "0920a957a3c9350a3f56046c30dcf1ae", "score": "0.53321755", "text": "func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrDefi sdk.ValAddress) types.DelegationI {\n\tbond, ok := k.GetDelegation(ctx, addrDel, addrDefi)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn bond\n}", "title": "" }, { "docid": "f061ee2c620feecdcb32c3f87189465e", "score": "0.5280744", "text": "func (_KyberNetwork *KyberNetworkTransactor) AddKyberProxy(opts *bind.TransactOpts, kyberProxy common.Address) (*types.Transaction, error) {\n\treturn _KyberNetwork.contract.Transact(opts, \"addKyberProxy\", kyberProxy)\n}", "title": "" }, { "docid": "639144dfb9644365218220a32dd7d404", "score": "0.52639073", "text": "func (s *Service) AddTarget(ctx context.Context, target *influxdb.ScraperTarget, userID influxdb.ID) (err error) {\n\ttarget.ID = s.IDGenerator.ID()\n\tif !target.OrgID.Valid() {\n\t\treturn &influxdb.Error{\n\t\t\tCode: influxdb.EInvalid,\n\t\t\tMsg: \"provided organization ID has invalid format\",\n\t\t\tOp: OpPrefix + influxdb.OpAddTarget,\n\t\t}\n\t}\n\tif !target.BucketID.Valid() {\n\t\treturn &influxdb.Error{\n\t\t\tCode: influxdb.EInvalid,\n\t\t\tMsg: \"provided bucket ID has invalid format\",\n\t\t\tOp: OpPrefix + influxdb.OpAddTarget,\n\t\t}\n\t}\n\tif err := s.PutTarget(ctx, target); err != nil {\n\t\treturn &influxdb.Error{\n\t\t\tOp: OpPrefix + influxdb.OpAddTarget,\n\t\t\tErr: err,\n\t\t}\n\t}\n\turm := &influxdb.UserResourceMapping{\n\t\tResourceID: target.ID,\n\t\tUserID: userID,\n\t\tUserType: influxdb.Owner,\n\t\tResourceType: influxdb.ScraperResourceType,\n\t}\n\tif err := s.CreateUserResourceMapping(ctx, urm); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7070220edf8dc67dbbfa972efa6be48e", "score": "0.5250414", "text": "func (_GovernanceToken *GovernanceTokenTransactor) Delegate(opts *bind.TransactOpts, delegatee common.Address) (*types.Transaction, error) {\n\treturn _GovernanceToken.contract.Transact(opts, \"delegate\", delegatee)\n}", "title": "" }, { "docid": "31d5160ca6bd58e62235709a061ac540", "score": "0.5229652", "text": "func (_SfcContract *SfcContractTransactorSession) WithdrawDelegation(toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.WithdrawDelegation(&_SfcContract.TransactOpts, toStakerID)\n}", "title": "" }, { "docid": "ae07031ae58b93b9e5a62fdba848b8ec", "score": "0.52082974", "text": "func (a *Client) PostIPIPDelegation(params *PostIPIPDelegationParams, authInfo runtime.ClientAuthInfoWriter) (*PostIPIPDelegationOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostIPIPDelegationParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostIPIPDelegation\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/ip/{ip}/delegation\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostIPIPDelegationReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostIPIPDelegationOK), nil\n\n}", "title": "" }, { "docid": "c5be223a2134ba29c147dfeed54b6bf0", "score": "0.5171371", "text": "func (suite *DeterministicTestSuite) createDelegationAndDelegate(t *rapid.T, delegator sdk.AccAddress, validator stakingtypes.Validator) (newShares math.LegacyDec, err error) {\n\tamt := suite.stakingKeeper.TokensFromConsensusPower(suite.ctx, rapid.Int64Range(100, 1000).Draw(t, \"amount\"))\n\treturn suite.fundAccountAndDelegate(delegator, validator, amt)\n}", "title": "" }, { "docid": "a6ce1bda811e263747ccf3b6f40ae6d3", "score": "0.5170995", "text": "func (_SfcContract *SfcContractSession) WithdrawDelegation(toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.WithdrawDelegation(&_SfcContract.TransactOpts, toStakerID)\n}", "title": "" }, { "docid": "a8158f19aff6141a83757f6143499bfd", "score": "0.514096", "text": "func (_GovernanceToken *GovernanceTokenTransactor) DelegateBySig(opts *bind.TransactOpts, delegatee common.Address, nonce *big.Int, expiry *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\treturn _GovernanceToken.contract.Transact(opts, \"delegateBySig\", delegatee, nonce, expiry, v, r, s)\n}", "title": "" }, { "docid": "146b798e15715c5a8c5986e69d5e2540", "score": "0.5135593", "text": "func (t *SignedTargets) AddTarget(path string, meta FileMeta) {\n\tt.Signed.Targets[path] = meta\n\tt.Dirty = true\n}", "title": "" }, { "docid": "111684a17a11112adfbcd562b6b8e2e3", "score": "0.5094905", "text": "func (keeper Keeper) Delegate(ctx sdk.Context, counterpartyBech32Addr string, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin,\n\ttransferSourcePort, transferSourceChannel, iaSourcePort, iaSourceChannel string) error {\n\tiaAccount, err := keeper.GetInterchainAccount(ctx, delAddr, iaSourcePort, iaSourceChannel)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trecipient, err := bech32.ConvertAndEncode(counterpartyBech32Addr, iaAccount)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = keeper.transferKeeper.SendTransfer(ctx, transferSourcePort, transferSourceChannel, math.MaxUint64-transfer.DefaultPacketTimeoutHeight, sdk.Coins{amount}, delAddr, recipient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprefixDenom := transfertypes.GetDenomPrefix(transferSourcePort, transferSourceChannel)\n\tamount = sdk.NewCoin(strings.Replace(amount.Denom, prefixDenom, \"\", 1), amount.Amount)\n\n\terr = keeper.interchainAccountKeeper.RequestRunTx(ctx, iaSourcePort, iaSourceChannel, iatypes.CosmosSdkChainType, staking.NewMsgDelegate(iaAccount, valAddr, amount))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbz := valAddr.Bytes()\n\tmint := sdk.Coins{sdk.NewCoin(fmt.Sprintf(\"%s/%s/%s/stake\", iaSourcePort, iaSourceChannel, hex.EncodeToString(bz[0:4])), amount.Amount)}\n\t// Mint coin as the proof of staking\n\terr = keeper.bankKeeper.MintCoins(ctx, types.ModuleName, mint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Send the minted token to sender when the packet is exeucted successfully.\n\terr = keeper.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, delAddr, mint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a980e1fac86148f99ef7ae3454d75c37", "score": "0.5094127", "text": "func (_SfcContract *SfcContractTransactor) SyncDelegation(opts *bind.TransactOpts, delegator common.Address, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.contract.Transact(opts, \"_syncDelegation\", delegator, toStakerID)\n}", "title": "" }, { "docid": "a83507e49186406396f8dae4645d161b", "score": "0.5051822", "text": "func (k Keeper) SetProxyBinding(ctx sdk.Context, proxyAddress, delegatorAddress sdk.AccAddress, isRemove bool) {\n\tstore := ctx.KVStore(k.storeKey)\n\tkey := types.GetProxyDelegatorKey(proxyAddress, delegatorAddress)\n\n\tif isRemove {\n\t\tstore.Delete(key)\n\t} else {\n\t\tstore.Set(key, []byte(\"\"))\n\t}\n}", "title": "" }, { "docid": "e7ce968b8024dfffbcfba6fb15bac93c", "score": "0.501551", "text": "func (s *Service) RemoveDelegation(ctx context.Context, cmd RemoveDelegationCommand) error {\n\tif err := cmd.GuardHasGUN(); err != nil {\n\t\treturn err\n\t}\n\tsanitizedGUN := cmd.SanitizedGUN()\n\tfact := ConfigureRepo(s.config, s.retriever, false, readWrite)\n\tnRepo, err := fact(sanitizedGUN)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = nRepo.RemoveDelegationKeys(DelegationPath(\"releases\"), []string{cmd.KeyID})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create delegation: %w\", err)\n\t}\n\terr = nRepo.RemoveDelegationKeys(cmd.Role, []string{cmd.KeyID})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create delegation: %w\", err)\n\t}\n\treturn maybeAutoPublish(s.log, cmd.AutoPublish, sanitizedGUN, s.config, s.retriever)\n}", "title": "" }, { "docid": "14aae531314e0e1ceb40b8ec191ff9f2", "score": "0.5010488", "text": "func (b *FlagBuilder) AddTarget(variationIndex int, keys ...string) *FlagBuilder {\n\tb.flag.Targets = append(b.flag.Targets, ldmodel.Target{Values: keys, Variation: variationIndex})\n\treturn b\n}", "title": "" }, { "docid": "f03e1cd0bb0876f504b2358676b5c5c4", "score": "0.49956188", "text": "func (t *TargetLoader) AddTarget(key string, v *TargeObject) {\n\tt.Lock()\n\tdefer t.Unlock()\n\tt.UnAdd(key, v)\n}", "title": "" }, { "docid": "ddd45aeffd6f60f213adf9a74ab565f4", "score": "0.4988459", "text": "func Delegate(w rest.ResponseWriter, r *rest.Request) {\n\tvar err2 error\n\treq := &models.ChannelFor3rd{}\n\tdelegateStr := r.PathParam(\"delegater\")\n\tdelegater := common.HexToAddress(delegateStr)\n\tif delegater == utils.EmptyAddress {\n\t\terr2 = w.WriteJson(\n\t\t\t&delegateResponse{\n\t\t\t\tStatus: delegateError,\n\t\t\t\tError: \"empty delegater\",\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\terr := r.DecodeJsonPayload(req)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\terr2 = w.WriteJson(&delegateResponse{\n\t\t\tStatus: delegateError,\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\t//log.Trace(fmt.Sprintf(\"req=%s\", utils.StringInterface(req, 3)))\n\tif verify != nil {\n\t\terr = verify.VerifyDelegate(req, delegater)\n\t\tif err != nil {\n\t\t\tlog.Error(err.Error())\n\t\t\terr2 = w.WriteJson(&delegateResponse{\n\t\t\t\tStatus: delegateError,\n\t\t\t\tError: err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n\terr = db.ReceiveDelegate(req, delegater)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\terr2 = w.WriteJson(&delegateResponse{\n\t\t\tStatus: delegateError,\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tif db.AccountIsBalanceEnough(delegater) {\n\t\terr2 = w.WriteJson(&delegateResponse{\n\t\t\tStatus: delegateSuccess,\n\t\t})\n\t} else {\n\t\terr2 = w.WriteJson(&delegateResponse{\n\t\t\tStatus: delegateSuccessButNotEnoughBalance,\n\t\t})\n\t}\n\tif err2 != nil {\n\t\tlog.Error(fmt.Sprintf(\"write json err %s\", err2))\n\t}\n\n}", "title": "" }, { "docid": "ff48a8e41c81a249e84b535d1f95fdb0", "score": "0.49869213", "text": "func (c *RemoteServer) Delegate(req core.DelegateRequest) (*core.ResponseData, error) {\n\treqBytes, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trespBytes, err := c.doAction(\"delegate\", reqBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn unmarshalResponseData(respBytes)\n}", "title": "" }, { "docid": "0b25ebbfe93139edc28fa76680d07262", "score": "0.49827957", "text": "func (k BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error {\n\tmoduleAcc := k.ak.GetAccount(ctx, moduleAccAddr)\n\tif moduleAcc == nil {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, \"module account %s does not exist\", moduleAccAddr)\n\t}\n\n\tif !amt.IsValid() {\n\t\treturn sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, amt.String())\n\t}\n\n\tbalances := sdk.NewCoins()\n\n\tfor _, coin := range amt {\n\t\tbalance := k.GetBalance(ctx, delegatorAddr, coin.Denom)\n\t\tif balance.IsLT(coin) {\n\t\t\treturn sdkerrors.Wrapf(\n\t\t\t\tsdkerrors.ErrInsufficientFunds, \"failed to delegate; %s < %s\", balance, amt,\n\t\t\t)\n\t\t}\n\n\t\tbalances = balances.Add(balance)\n\t\tk.SetBalance(ctx, delegatorAddr, balance.Sub(coin))\n\t}\n\n\tif err := k.trackDelegation(ctx, delegatorAddr, ctx.BlockHeader().Time, balances, amt); err != nil {\n\t\treturn sdkerrors.Wrap(err, \"failed to track delegation\")\n\t}\n\n\t_, err := k.AddCoins(ctx, moduleAccAddr, amt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3032fae6d3fba92ce201d375969e4456", "score": "0.49305522", "text": "func (_SfcContract *SfcContractFilterer) WatchIncreasedDelegation(opts *bind.WatchOpts, sink chan<- *SfcContractIncreasedDelegation, delegator []common.Address, stakerID []*big.Int) (event.Subscription, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcContract.contract.WatchLogs(opts, \"IncreasedDelegation\", delegatorRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SfcContractIncreasedDelegation)\n\t\t\t\tif err := _SfcContract.contract.UnpackLog(event, \"IncreasedDelegation\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "743890c1a315b20b627d7502fd1e0ad9", "score": "0.49016732", "text": "func (_SfcContract *SfcContractTransactor) LockUpDelegation(opts *bind.TransactOpts, lockDuration *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.contract.Transact(opts, \"lockUpDelegation\", lockDuration, toStakerID)\n}", "title": "" }, { "docid": "618133173ab2e7c3b9a605cf5b0b2a2f", "score": "0.4896881", "text": "func (rm *RequestManager) SetDelegate(peerHandler PeerHandler) {\n\trm.peerHandler = peerHandler\n}", "title": "" }, { "docid": "a8c6363e0d2061bf90f293d6a2396dc1", "score": "0.48802543", "text": "func (c *jsiiProxy_CfnRepository) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "a90ab079d84af95bd5ec7a534b7eed1d", "score": "0.4837754", "text": "func (c *Line) DefaultAddDelegateToRegister() {\n\t// c.AddDelegateToRegister(<DELEGATE>, nil, <OTHER-Line>, <SIGNATURE>)\n}", "title": "" }, { "docid": "93955b9f10b8116b85783af7c919f8e8", "score": "0.47902182", "text": "func (_GovernanceToken *GovernanceTokenTransactorSession) DelegateBySig(delegatee common.Address, nonce *big.Int, expiry *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\treturn _GovernanceToken.Contract.DelegateBySig(&_GovernanceToken.TransactOpts, delegatee, nonce, expiry, v, r, s)\n}", "title": "" }, { "docid": "25eef1afdcf6e37658ea1ffcf04d1a27", "score": "0.47415113", "text": "func (n *RetrievalMarketNetworkConnector) SetDelegate(network.RetrievalReceiver) error {\n\tpanic(\"TODO: go-fil-markets integration\")\n}", "title": "" }, { "docid": "92b82e387e425ab3a81f17d4ec5975ae", "score": "0.47124127", "text": "func (_KyberNetwork *KyberNetworkTransactorSession) AddKyberProxy(kyberProxy common.Address) (*types.Transaction, error) {\n\treturn _KyberNetwork.Contract.AddKyberProxy(&_KyberNetwork.TransactOpts, kyberProxy)\n}", "title": "" }, { "docid": "0d2a85df668b2091276e12b30d44c55e", "score": "0.4709957", "text": "func GetDelegationKey(delAddr sdk.AccAddress, defiAddr sdk.ValAddress) []byte {\n\treturn append(GetDelegationsKey(delAddr), defiAddr.Bytes()...)\n}", "title": "" }, { "docid": "8a91f884e0cb82091b6d903fb98a2a75", "score": "0.47052726", "text": "func (_GovernanceToken *GovernanceTokenSession) DelegateBySig(delegatee common.Address, nonce *big.Int, expiry *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\treturn _GovernanceToken.Contract.DelegateBySig(&_GovernanceToken.TransactOpts, delegatee, nonce, expiry, v, r, s)\n}", "title": "" }, { "docid": "f18dd29162088821bcc0fdb490c3e058", "score": "0.46935797", "text": "func (_SfcContract *SfcContractTransactorSession) SyncDelegation(delegator common.Address, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.SyncDelegation(&_SfcContract.TransactOpts, delegator, toStakerID)\n}", "title": "" }, { "docid": "1e1a7c1d560db753d9dedbbb6b8fc477", "score": "0.4682042", "text": "func (_SfcContract *SfcContractSession) SyncDelegation(delegator common.Address, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.SyncDelegation(&_SfcContract.TransactOpts, delegator, toStakerID)\n}", "title": "" }, { "docid": "893876233acbafdde6e65ecb56ce0f92", "score": "0.46784097", "text": "func (_GovernanceToken *GovernanceTokenTransactorSession) Delegate(delegatee common.Address) (*types.Transaction, error) {\n\treturn _GovernanceToken.Contract.Delegate(&_GovernanceToken.TransactOpts, delegatee)\n}", "title": "" }, { "docid": "4fe046b09ef3e295a01f0742225339aa", "score": "0.46566433", "text": "func NewDelegator(d *types.Delegator, repo repository.Repository) *Delegator {\n\treturn &Delegator{\n\t\tDelegator: *d,\n\t\trepo: repo,\n\t}\n}", "title": "" }, { "docid": "23da2e6e1ff68be16844d7908a9cfcec", "score": "0.46455592", "text": "func (_SfcContract *SfcContractTransactorSession) LockUpDelegation(lockDuration *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.LockUpDelegation(&_SfcContract.TransactOpts, lockDuration, toStakerID)\n}", "title": "" }, { "docid": "2927fdb15a733b288041d5daebf92956", "score": "0.46398532", "text": "func (_GovernanceToken *GovernanceTokenSession) Delegate(delegatee common.Address) (*types.Transaction, error) {\n\treturn _GovernanceToken.Contract.Delegate(&_GovernanceToken.TransactOpts, delegatee)\n}", "title": "" }, { "docid": "08d9c9f15371db279f6ba460eb9a12a2", "score": "0.46361837", "text": "func (_KyberNetwork *KyberNetworkSession) AddKyberProxy(kyberProxy common.Address) (*types.Transaction, error) {\n\treturn _KyberNetwork.Contract.AddKyberProxy(&_KyberNetwork.TransactOpts, kyberProxy)\n}", "title": "" }, { "docid": "c3220ce3fa3b24d12ef59e90a205b68a", "score": "0.46353525", "text": "func (_SfcContract *SfcContractSession) LockUpDelegation(lockDuration *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.Contract.LockUpDelegation(&_SfcContract.TransactOpts, lockDuration, toStakerID)\n}", "title": "" }, { "docid": "7f08f4127ace09de5b5414138ae416b5", "score": "0.46276805", "text": "func (c *jsiiProxy_CfnRepository) AddDependsOn(target awscdk.CfnResource) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addDependsOn\",\n\t\t[]interface{}{target},\n\t)\n}", "title": "" }, { "docid": "a9c1d351cd651e9bca6590f1f6a030db", "score": "0.46265295", "text": "func (m *AccessPackageAssignment) SetTarget(value AccessPackageSubjectable)() {\n err := m.GetBackingStore().Set(\"target\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a51904d41fac783ac04f72d0cd391c1c", "score": "0.46203038", "text": "func (c *mockAgentClient) Add(key agent.AddedKey) error {\n\treturn errors.New(\"not implemented mockAgentClient Add\")\n}", "title": "" }, { "docid": "3b84d029fc8e5087cdc0a03b3d0084fb", "score": "0.4617297", "text": "func (_EAS *EASTransactor) AttestByDelegation(opts *bind.TransactOpts, delegatedRequest DelegatedAttestationRequest) (*types.Transaction, error) {\n\treturn _EAS.contract.Transact(opts, \"attestByDelegation\", delegatedRequest)\n}", "title": "" }, { "docid": "a3ab6613cf3003baf65ab1693d872e85", "score": "0.4598559", "text": "func (c GenericCommand) AddTargetedRoutine(targetName string, routine string) {\n\tc.Routines[targetName] = routine\n}", "title": "" }, { "docid": "161b478aa38b49ad7ca1fe80dbdde557", "score": "0.45946574", "text": "func (m *Model) SetDelegate(d ItemDelegate) {\n\tm.delegate = d\n\tm.updatePagination()\n}", "title": "" }, { "docid": "c5c8b33a742c63c9e6b461c32106651f", "score": "0.4587993", "text": "func TestAccountsService_Delegate(t *testing.T) {\n\tclient, mux, _, teardown := setupTest()\n\tdefer teardown()\n\n\tmux.HandleFunc(\"/accounts/delegates\", func(writer http.ResponseWriter, request *http.Request) {\n\t\ttestMethod(t, request, \"GET\")\n\t\tfmt.Fprint(writer,\n\t\t\t`{\n\t\t\t \"delegates\": [{\n\t\t\t\t\"username\": \"dummy\",\n\t\t\t\t\"address\": \"dummy\",\n\t\t\t\t\"publicKey\": \"dummy\",\n\t\t\t\t\"vote\": \"dummy\",\n\t\t\t\t\"producedblocks\": 1,\n\t\t\t\t\"missedblocks\": 2,\n\t\t\t\t\"rate\": 3,\n\t\t\t\t\"approval\": 0.5,\n\t\t\t\t\"productivity\": 0.10\n\t\t\t }],\n\t\t\t \"success\": true\n\t\t\t}`)\n\t})\n\n\tresponseStruct, response, err := client.Accounts.Delegate(context.Background(), \"dummy\")\n\ttestGeneralError(t, \"Accounts.Delegate\", err)\n\ttestResponseUrl(t, \"Accounts.Delegate\", response, \"/api/accounts/delegates\")\n\ttestResponseStruct(t, \"Accounts.Delegate\", responseStruct, &AccountDelegates{\n\t\tSuccess: true,\n\t\tDelegates: []Delegate{{\n\t\t\tUsername: \"dummy\",\n\t\t\tAddress: \"dummy\",\n\t\t\tPublicKey: \"dummy\",\n\t\t\tVote: \"dummy\",\n\t\t\tProducedBlocks: 1,\n\t\t\tMissedBlocks: 2,\n\t\t\tRate: 3,\n\t\t\tApproval: 0.5,\n\t\t\tProductivity: 0.10,\n\t\t}},\n\t})\n}", "title": "" }, { "docid": "88f8269d71df1dbb3c9c8665cae4802b", "score": "0.4577692", "text": "func (client DataLakeStoreAccountsClient) AddResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "3e1df9a7f30f6e625f36c84426aefd83", "score": "0.4568106", "text": "func (d *delegationCommander) delegationRemove(cmd *cobra.Command, args []string) error {\n\tconfig, gun, role, keyIDs, err := delegationAddInput(d, cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttrustPin, err := getTrustPinning(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// no online operations are performed by add so the transport argument\n\t// should be nil\n\tnRepo, err := notaryclient.NewFileCachedNotaryRepository(\n\t\tconfig.GetString(\"trust_dir\"), gun, getRemoteTrustServer(config), nil, d.retriever, trustPin)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif d.removeAll {\n\t\tcmd.Println(\"\\nAre you sure you want to remove all data for this delegation? (yes/no)\")\n\t\t// Ask for confirmation before force removing delegation\n\t\tif !d.forceYes {\n\t\t\tconfirmed := askConfirm(os.Stdin)\n\t\t\tif !confirmed {\n\t\t\t\tfatalf(\"Aborting action.\")\n\t\t\t}\n\t\t} else {\n\t\t\tcmd.Println(\"Confirmed `yes` from flag\")\n\t\t}\n\t\t// Delete the entire delegation\n\t\terr = nRepo.RemoveDelegationRole(role)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to remove delegation: %v\", err)\n\t\t}\n\t} else {\n\t\tif d.allPaths {\n\t\t\terr = nRepo.ClearDelegationPaths(role)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to remove delegation: %v\", err)\n\t\t\t}\n\t\t}\n\t\t// Remove any keys or paths that we passed in\n\t\terr = nRepo.RemoveDelegationKeysAndPaths(role, keyIDs, d.paths)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to remove delegation: %v\", err)\n\t\t}\n\t}\n\n\tdelegationRemoveOutput(cmd, d, gun, role, keyIDs)\n\n\treturn maybeAutoPublish(cmd, d.autoPublish, gun, config, d.retriever)\n}", "title": "" }, { "docid": "f416170d4091c4be1cc280b815c425c4", "score": "0.45663944", "text": "func (_SfcContract *SfcContractFilterer) WatchLockingDelegation(opts *bind.WatchOpts, sink chan<- *SfcContractLockingDelegation, delegator []common.Address, stakerID []*big.Int) (event.Subscription, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcContract.contract.WatchLogs(opts, \"LockingDelegation\", delegatorRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SfcContractLockingDelegation)\n\t\t\t\tif err := _SfcContract.contract.UnpackLog(event, \"LockingDelegation\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "3551ed5f920d4b4c61622e0efb7bc743", "score": "0.45528403", "text": "func (m *MockValidatorSet) Delegation(arg0 context.Context, arg1 types.AccAddress, arg2 types.ValAddress) (types0.DelegationI, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Delegation\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(types0.DelegationI)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "766bb2ad9746c49290c95bad2054fd9d", "score": "0.4544552", "text": "func (dht *DHT) AddProxyHost(targetID string) {\n\tdht.proxy.AddProxyHost(targetID)\n}", "title": "" }, { "docid": "51657bad0a3f253a62e02a24ed1377e9", "score": "0.4541516", "text": "func (g *Genesis) KeyGenDelegate() {}", "title": "" }, { "docid": "accdf9470d1cc92efb28ddf269fbe623", "score": "0.4530756", "text": "func (m *Manager) AddTargetByInstance(key interface{}, add *Target) {\n\ttargets := m.LoadTargets(key)\n\tnewTargets := []*Target{}\n\tfound := false\n\tfor _, target := range targets {\n\t\tif target.InstanceId == add.InstanceId {\n\t\t\tfound = true\n\t\t\tnewTargets = append(newTargets, add)\n\t\t} else {\n\t\t\tnewTargets = append(newTargets, target)\n\t\t}\n\t}\n\tif !found {\n\t\tnewTargets = append(newTargets, add)\n\t}\n\tm.SetTargets(key, newTargets)\n}", "title": "" }, { "docid": "dc39cdc4942a2f5ba82b9f183acf6de9", "score": "0.45224988", "text": "func Target(network, addr string) UDPOptionSetter {\n\treturn func(f *UDPHook) {\n\t\tf.clientNet = network\n\t\tf.clientAddr = addr\n\t}\n}", "title": "" }, { "docid": "87599159afb11d57b5846a9edb678bf3", "score": "0.45032218", "text": "func (h *Handler) SetDelegate(delegate protocol.Delegate) {\n\th.delegate = delegate\n}", "title": "" }, { "docid": "87599159afb11d57b5846a9edb678bf3", "score": "0.45032218", "text": "func (h *Handler) SetDelegate(delegate protocol.Delegate) {\n\th.delegate = delegate\n}", "title": "" }, { "docid": "f7370c4a3e85197477d04f3ceac54c53", "score": "0.44974476", "text": "func TestWithdrawDelegationRewardTwoDelegatorsUneven(t *testing.T) {\n\tctx, accMapper, keeper, sk, fck := CreateTestInputAdvanced(t, false, 100, sdk.ZeroDec())\n\tstakeHandler := stake.NewHandler(sk)\n\tdenom := sk.GetParams(ctx).BondDenom\n\n\t//first make a validator with no commission\n\tmsgCreateValidator := stake.NewTestMsgCreateValidatorWithCommission(\n\t\tvalOpAddr1, valConsPk1, 10, sdk.ZeroDec())\n\tgot := stakeHandler(ctx, msgCreateValidator)\n\trequire.True(t, got.IsOK(), \"expected msg to be ok, got %v\", got)\n\t_ = sk.ApplyAndReturnValidatorSetUpdates(ctx)\n\n\t// delegate\n\tmsgDelegate := stake.NewTestMsgDelegate(delAddr1, valOpAddr1, 10)\n\tgot = stakeHandler(ctx, msgDelegate)\n\trequire.True(t, got.IsOK())\n\tamt := accMapper.GetAccount(ctx, delAddr1).GetCoins().AmountOf(denom)\n\trequire.Equal(t, int64(90), amt.Int64())\n\n\tmsgDelegate = stake.NewTestMsgDelegate(delAddr2, valOpAddr1, 10)\n\tgot = stakeHandler(ctx, msgDelegate)\n\trequire.True(t, got.IsOK())\n\tamt = accMapper.GetAccount(ctx, delAddr2).GetCoins().AmountOf(denom)\n\trequire.Equal(t, int64(90), amt.Int64())\n\n\t// allocate 100 denom of fees\n\tfeeInputs := sdk.NewInt(90)\n\tfck.SetCollectedFees(sdk.Coins{sdk.NewCoin(denom, feeInputs)})\n\trequire.Equal(t, feeInputs, fck.GetCollectedFees(ctx).AmountOf(denom))\n\tkeeper.AllocateTokens(ctx, sdk.OneDec(), valConsAddr1)\n\tctx = ctx.WithBlockHeight(1)\n\n\t// delegator 1 withdraw delegation early, delegator 2 just keeps it's accum\n\tkeeper.WithdrawDelegationReward(ctx, delAddr1, valOpAddr1)\n\tamt = accMapper.GetAccount(ctx, delAddr1).GetCoins().AmountOf(denom)\n\n\texpRes1 := sdk.NewDec(90).Add(sdk.NewDec(90).Quo(sdk.NewDec(3))).TruncateInt() // 90 + 100 * 10/30\n\trequire.True(sdk.IntEq(t, expRes1, amt))\n\n\t// allocate 200 denom of fees\n\tfeeInputs = sdk.NewInt(180)\n\tfck.SetCollectedFees(sdk.Coins{sdk.NewCoin(denom, feeInputs)})\n\trequire.Equal(t, feeInputs, fck.GetCollectedFees(ctx).AmountOf(denom))\n\tkeeper.AllocateTokens(ctx, sdk.OneDec(), valConsAddr1)\n\tctx = ctx.WithBlockHeight(2)\n\n\t// delegator 2 now withdraws everything it's entitled to\n\tkeeper.WithdrawDelegationReward(ctx, delAddr2, valOpAddr1)\n\tamt = accMapper.GetAccount(ctx, delAddr2).GetCoins().AmountOf(denom)\n\t// existingTokens + (100+200 * (10/(20+30))\n\twithdrawnFromVal := sdk.NewDec(60 + 180).Mul(sdk.NewDec(2)).Quo(sdk.NewDec(5))\n\texpRes2 := sdk.NewDec(90).Add(withdrawnFromVal).TruncateInt()\n\trequire.True(sdk.IntEq(t, expRes2, amt))\n\n\t// finally delegator 1 withdraws the remainder of its reward\n\tkeeper.WithdrawDelegationReward(ctx, delAddr1, valOpAddr1)\n\tamt = accMapper.GetAccount(ctx, delAddr1).GetCoins().AmountOf(denom)\n\n\tremainingInVal := sdk.NewDec(60 + 180).Sub(withdrawnFromVal)\n\texpRes3 := sdk.NewDecFromInt(expRes1).Add(remainingInVal.Mul(sdk.NewDec(1)).Quo(sdk.NewDec(3))).TruncateInt()\n\trequire.True(sdk.IntEq(t, expRes3, amt))\n\n\t// verify the final withdraw amounts are different\n\trequire.True(t, expRes2.GT(expRes3))\n}", "title": "" }, { "docid": "36e443dc71a591ef0e233f90ec71bc6f", "score": "0.44925338", "text": "func proxyAdd(remote endpoint.Endpoint, logger log.Logger) Add {\n\treturn func(ctx context.Context, a, b int64) int64 {\n\t\tresp, err := remote(ctx, reqrep.AddRequest{A: a, B: b})\n\t\tif err != nil {\n\t\t\tlogger.Log(\"err\", err)\n\t\t\treturn 0\n\t\t}\n\t\taddResp, ok := resp.(reqrep.AddResponse)\n\t\tif !ok {\n\t\t\tlogger.Log(\"err\", endpoint.ErrBadCast)\n\t\t\treturn 0\n\t\t}\n\t\treturn addResp.V\n\t}\n}", "title": "" }, { "docid": "a9cc3df63e6fded16fc81f1df5e449c9", "score": "0.44906628", "text": "func (sys *NotificationSys) AddRemoteTarget(bucketName string, target event.Target, rulesMap event.RulesMap) error {\n\tif err := sys.targetList.Add(target); err != nil {\n\t\treturn err\n\t}\n\n\tsys.Lock()\n\ttargetMap := sys.bucketRemoteTargetRulesMap[bucketName]\n\tif targetMap == nil {\n\t\ttargetMap = make(map[event.TargetID]event.RulesMap)\n\t}\n\n\trulesMap = rulesMap.Clone()\n\ttargetMap[target.ID()] = rulesMap\n\tsys.bucketRemoteTargetRulesMap[bucketName] = targetMap\n\n\trulesMap = rulesMap.Clone()\n\trulesMap.Add(sys.bucketRulesMap[bucketName])\n\tsys.bucketRulesMap[bucketName] = rulesMap\n\n\tsys.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "cfa08f221b54302894edc75b5588285d", "score": "0.448673", "text": "func (rc *RequestCreate) AddTarget(r ...*RequestTarget) *RequestCreate {\n\tids := make([]uuid.UUID, len(r))\n\tfor i := range r {\n\t\tids[i] = r[i].ID\n\t}\n\treturn rc.AddTargetIDs(ids...)\n}", "title": "" }, { "docid": "0fe6aceb1eef897c32f016a48339a4c5", "score": "0.44705498", "text": "func (d *STNDescriptor) Add(key string, stn *stn.Rule) (metadata interface{}, err error) {\n\t// remove mask from IP address if necessary\n\tipParts := strings.Split(stn.IpAddress, \"/\")\n\tif len(ipParts) > 1 {\n\t\td.log.Debugf(\"STN IP address %s is defined with mask, removing it\")\n\t\tstn.IpAddress = ipParts[0]\n\t}\n\n\t// validate the configuration\n\terr = d.validateSTNConfig(stn)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn nil, err\n\t}\n\n\t// add STN rule\n\terr = d.stnHandler.AddSTNRule(stn)\n\tif err != nil {\n\t\td.log.Error(err)\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "877525eeaedea5e4feb722fdaf30e522", "score": "0.4460825", "text": "func TestTargetAdd(t *testing.T) {\n\tvar target3, target5, target10 Target\n\ttarget3[crypto.HashSize-1] = 3\n\ttarget5[crypto.HashSize-1] = 5\n\ttarget10[crypto.HashSize-1] = 10\n\n\texpect5 := target10.AddDifficulties(target10)\n\tif expect5 != target5 {\n\t\tt.Error(\"Target.Add not working as expected\")\n\t}\n\texpect3 := target10.AddDifficulties(target5)\n\tif expect3 != target3 {\n\t\tt.Error(\"Target.Add not working as expected\")\n\t}\n}", "title": "" }, { "docid": "8ebf09a99649c6be9f6f7e56d9475ad1", "score": "0.44522858", "text": "func (p *Panel) AddTarget(t *Target) {\n\tswitch p.OfType {\n\tcase GraphType:\n\t\tp.GraphPanel.Targets = append(p.GraphPanel.Targets, *t)\n\tcase SinglestatType:\n\t\tp.SinglestatPanel.Targets = append(p.SinglestatPanel.Targets, *t)\n\tcase StatType:\n\t\tp.StatPanel.Targets = append(p.StatPanel.Targets, *t)\n\tcase TableType:\n\t\tp.TablePanel.Targets = append(p.TablePanel.Targets, *t)\n\tcase HeatmapType:\n\t\tp.HeatmapPanel.Targets = append(p.HeatmapPanel.Targets, *t)\n\t}\n\t// TODO check for existing refID\n}", "title": "" }, { "docid": "05f319d0bb4013f9e49c8e77f0cdc197", "score": "0.4437568", "text": "func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte {\n\treturn append(GetDelegationsKey(delAddr), address.MustLengthPrefix(valAddr)...)\n}", "title": "" }, { "docid": "cb84a34832af7abdefcb5f6eb270bd06", "score": "0.4432458", "text": "func (dht *DHT) AddReceivedKey(target string, key []byte) {\n\tdht.auth.ReceivedKeys[target] = key\n}", "title": "" }, { "docid": "1b6bb73fa18e6acebc82c370e90a9361", "score": "0.442403", "text": "func (m *MockDelegateInterface) SetupDelegation(arg0 context.Context, arg1 string) (kubernetes.Interface, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetupDelegation\", arg0, arg1)\n\tret0, _ := ret[0].(kubernetes.Interface)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fb8df45d3e4391e952d3538c60d73d38", "score": "0.44183096", "text": "func (c *Client) getTargetFileMetaDelegationPath(target string, snapshot *data.Snapshot) (data.TargetFileMeta, []string, error) {\n\t// delegationsIterator covers 5.6.7\n\t// - pre-order depth-first search starting with the top targets\n\t// - filter delegations with paths or path_hash_prefixes matching searched target\n\t// - 5.6.7.1 cycles protection\n\t// - 5.6.7.2 terminations\n\tdelegations, err := targets.NewDelegationsIterator(target, c.db)\n\tif err != nil {\n\t\treturn data.TargetFileMeta{}, nil, err\n\t}\n\n\ttargetFileMeta := data.TargetFileMeta{}\n\tdelegationRole := \"\"\n\n\tfor i := 0; i < c.MaxDelegations; i++ {\n\t\td, ok := delegations.Next()\n\t\tif !ok {\n\t\t\treturn data.TargetFileMeta{}, nil, ErrUnknownTarget{target, snapshot.Version}\n\t\t}\n\n\t\t// covers 5.6.{1,2,3,4,5,6}\n\t\ttargets, err := c.loadDelegatedTargets(snapshot, d.Delegatee.Name, d.DB)\n\t\tif err != nil {\n\t\t\treturn data.TargetFileMeta{}, nil, err\n\t\t}\n\n\t\t// stop when the searched TargetFileMeta is found\n\t\tif m, ok := targets.Targets[target]; ok {\n\t\t\tdelegationRole = d.Delegatee.Name\n\t\t\ttargetFileMeta = m\n\t\t\tbreak\n\t\t}\n\n\t\tif targets.Delegations != nil {\n\t\t\tdelegationsDB, err := verify.NewDBFromDelegations(targets.Delegations)\n\t\t\tif err != nil {\n\t\t\t\treturn data.TargetFileMeta{}, nil, err\n\t\t\t}\n\t\t\terr = delegations.Add(targets.Delegations.Roles, d.Delegatee.Name, delegationsDB)\n\t\t\tif err != nil {\n\t\t\t\treturn data.TargetFileMeta{}, nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(delegationRole) > 0 {\n\t\treturn targetFileMeta, buildPath(delegations.Parent, delegationRole, \"\"), nil\n\t}\n\n\treturn data.TargetFileMeta{}, nil, ErrMaxDelegations{\n\t\tTarget: target,\n\t\tMaxDelegations: c.MaxDelegations,\n\t\tSnapshotVersion: snapshot.Version,\n\t}\n}", "title": "" }, { "docid": "f6b4306face5be3d3364c392c49e7a80", "score": "0.43924433", "text": "func (_SfcContract *SfcContractFilterer) FilterIncreasedDelegation(opts *bind.FilterOpts, delegator []common.Address, stakerID []*big.Int) (*SfcContractIncreasedDelegationIterator, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcContract.contract.FilterLogs(opts, \"IncreasedDelegation\", delegatorRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SfcContractIncreasedDelegationIterator{contract: _SfcContract.contract, event: \"IncreasedDelegation\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "a7348bfc0532aeaa8cfaab8090182ea4", "score": "0.43870494", "text": "func (_SfcContract *SfcContractFilterer) WatchWithdrawnDelegation(opts *bind.WatchOpts, sink chan<- *SfcContractWithdrawnDelegation, delegator []common.Address, toStakerID []*big.Int) (event.Subscription, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar toStakerIDRule []interface{}\n\tfor _, toStakerIDItem := range toStakerID {\n\t\ttoStakerIDRule = append(toStakerIDRule, toStakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcContract.contract.WatchLogs(opts, \"WithdrawnDelegation\", delegatorRule, toStakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SfcContractWithdrawnDelegation)\n\t\t\t\tif err := _SfcContract.contract.UnpackLog(event, \"WithdrawnDelegation\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "645ca022cdf833b3a38c4da5eae159a2", "score": "0.43569362", "text": "func (c *jsiiProxy_CfnCertificateAuthority) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "c3608c62ab3b0c81b2986455670e7980", "score": "0.43529513", "text": "func (k Keeper) UpdateProxy(ctx sdk.Context, delegator types.Delegator, tokens sdk.Dec) (err error) {\n\tif !delegator.HasProxy() {\n\t\treturn nil\n\t}\n\t// delegator has bound a proxy, need update proxy's shares\n\tif proxy, found := k.GetDelegator(ctx, delegator.ProxyAddress); found {\n\t\t// tokens might be negative\n\t\tproxy.TotalDelegatedTokens = proxy.TotalDelegatedTokens.Add(tokens)\n\t\tif proxy.TotalDelegatedTokens.LT(sdk.ZeroDec()) {\n\t\t\treturn types.ErrInvalidProxyUpdating()\n\t\t}\n\n\t\tfinalTokens := proxy.TotalDelegatedTokens.Add(proxy.Tokens)\n\t\tk.SetDelegator(ctx, proxy)\n\t\treturn k.UpdateShares(ctx, proxy.DelegatorAddress, finalTokens)\n\t}\n\treturn sdk.ErrInvalidAddress(delegator.ProxyAddress.String())\n}", "title": "" }, { "docid": "83712643cbe4cd13bbc0a3fc67151d55", "score": "0.43464512", "text": "func addObjectiveDataManager(stub shim.ChaincodeStubInterface, dataManagerKey string, objectiveKey string) error {\n\tdataManager := DataManager{}\n\tif err := getElementStruct(stub, dataManagerKey, &dataManager); err != nil {\n\t\treturn nil\n\t}\n\tif dataManager.ObjectiveKey != \"\" {\n\t\treturn fmt.Errorf(\"dataManager is already associated with a objective\")\n\t}\n\tdataManager.ObjectiveKey = objectiveKey\n\tdataManagerBytes, _ := json.Marshal(dataManager)\n\treturn stub.PutState(dataManagerKey, dataManagerBytes)\n}", "title": "" }, { "docid": "7de481931e86eaf91fea0ccd7f2d3728", "score": "0.433768", "text": "func Delegate(payload DelegatePayload) (response LoginResponse, err error) {\n\tvar (\n\t\tuser User\n\t\trefreshToken RefreshToken\n\t\tqGet = `\n\t\t\tSELECT * FROM ` + TREFRESHTOKENS + `\n\t\t\tWHERE user_id = $1\n\t\t\t\tAND token = $2;\n\t\t`\n\t)\n\n\t// get the rft\n\tif err = db.Conn.Get(&refreshToken, qGet, payload.UserID, payload.Rft); err != nil {\n\t\treturn\n\t}\n\n\t// Check if rft is expired\n\tif refreshToken.ExpiresIn.Sub(time.Now()) < 0 {\n\t\terr = errors.New(utils.E_SESSION_EXPIRED)\n\t\treturn\n\t}\n\n\t// Get Me By id\n\tme, err := user.GetMeByID(payload.UserID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Generete tokens\n\tresponse, err = GenerateTokens(payload.UserID, me.Role)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse.Me = me\n\n\treturn\n}", "title": "" }, { "docid": "ac0b507c0f58b46883c4ea27f1a0f05b", "score": "0.4331896", "text": "func addTarget() error {\n\tif target == \"\" {\n\t\treturn nil\n\t}\n\n\tres := diff.NewResource()\n\terr := res.Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = res.SetTarget(target)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = res.Write()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff75da2d8749e054d00a9d644e337568", "score": "0.43291917", "text": "func (_m *SbuGuard) AddBindingUsage(key string) {\n\t_m.Called(key)\n}", "title": "" }, { "docid": "719b67f38608a315ed438764b747fd90", "score": "0.43266106", "text": "func (targets *Targets) addNodeTarget(name string, node Node, instanceFilters []string) {\n\tif _, exists := targets.targetMap[name]; !exists {\n\t\t// this is a new target node, so add all of the instances\n\t\tinstances, _ := node.Instances().FilterableInstances()\n\t\ttarget := Target{name: name, node: node, instances: instances}\n\n\t\ttargets.targetMap[name] = &target\n\t\ttargets.targetOrder = append(targets.targetOrder, name)\n\n\t\ttargets.log.Debug(log.VERBOSITY_DEBUG_LOTS, \"Added target\", name, target)\n\t}\n\n\tif instances, ok := targets.targetMap[name].Instances(); ok {\n\t\t// The target node has already been added, so we just need to confirm instances\n\t\tif len(instanceFilters) > 0 {\n\t\t\tinstances.AddFilters(instanceFilters...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "141f0129a2c99e15a198decb41db5834", "score": "0.4323635", "text": "func (_SfcContract *SfcContractFilterer) WatchUpdatedDelegation(opts *bind.WatchOpts, sink chan<- *SfcContractUpdatedDelegation, delegator []common.Address, oldStakerID []*big.Int, newStakerID []*big.Int) (event.Subscription, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar oldStakerIDRule []interface{}\n\tfor _, oldStakerIDItem := range oldStakerID {\n\t\toldStakerIDRule = append(oldStakerIDRule, oldStakerIDItem)\n\t}\n\tvar newStakerIDRule []interface{}\n\tfor _, newStakerIDItem := range newStakerID {\n\t\tnewStakerIDRule = append(newStakerIDRule, newStakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcContract.contract.WatchLogs(opts, \"UpdatedDelegation\", delegatorRule, oldStakerIDRule, newStakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SfcContractUpdatedDelegation)\n\t\t\t\tif err := _SfcContract.contract.UnpackLog(event, \"UpdatedDelegation\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1b51d9021115fc382842f128c22e566a", "score": "0.4321035", "text": "func (c *jsiiProxy_CfnCertificate) AddDependsOn(target awscdk.CfnResource) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addDependsOn\",\n\t\t[]interface{}{target},\n\t)\n}", "title": "" }, { "docid": "280eb2867d4a5748d08ae5eacf902863", "score": "0.430684", "text": "func (r *Route) Delegate(method string, res http.ResponseWriter, req *http.Request, c Collector) {\n\tho, ok := r.method[method]\n\n\tif ok {\n\t\tho(res, req, c)\n\t\treturn\n\t}\n\n\tif r.handler == nil {\n\t\treturn\n\t}\n\n\tr.handler(res, req, c)\n}", "title": "" }, { "docid": "4e6300dd4ae92e3daca274a5722629d8", "score": "0.43045968", "text": "func (r *keyring) Add(key AddedKey) error {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\tif r.locked {\n\t\treturn errLocked\n\t}\n\tsigner, err := ssh.NewSignerFromKey(key.PrivateKey)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif cert := key.Certificate; cert != nil {\n\t\tsigner, err = ssh.NewCertSigner(cert, signer)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tp := privKey{\n\t\tsigner: signer,\n\t\tcomment: key.Comment,\n\t}\n\n\tif key.LifetimeSecs > 0 {\n\t\tt := time.Now().Add(time.Duration(key.LifetimeSecs) * time.Second)\n\t\tp.expire = &t\n\t}\n\n\tr.keys = append(r.keys, p)\n\n\treturn nil\n}", "title": "" }, { "docid": "c77dbab4a80f90d4956192799899b377", "score": "0.4302403", "text": "func (c *jsiiProxy_CfnAccessPoint) AddDependsOn(target awscdk.CfnResource) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addDependsOn\",\n\t\t[]interface{}{target},\n\t)\n}", "title": "" }, { "docid": "2fce201b77852ec9c54635fac6474f3a", "score": "0.42944232", "text": "func (i *WlDataSource) AddTargetHandler(h WlDataSourceTargetHandler) {\n\tif h == nil {\n\t\treturn\n\t}\n\n\ti.mu.Lock()\n\ti.targetHandlers = append(i.targetHandlers, h)\n\ti.mu.Unlock()\n}", "title": "" }, { "docid": "9740c74ee00be087359897c7d9ad5533", "score": "0.4287972", "text": "func (p *Processor) AddTargetToReconcile(t Target) bool {\n\tif !p.isWorthyPolling(t) {\n\t\treturn false\n\t}\n\n\t_, ok := p.voteRecords[t.Hash()]\n\tif ok {\n\t\treturn false\n\t}\n\n\tp.targets[t.Hash()] = t\n\tp.voteRecords[t.Hash()] = NewVoteRecord(t.IsAccepted())\n\treturn true\n}", "title": "" } ]
7530fc9996dcdcb78a456fae1214b621
ExecuteResourceQuery : Run the resource query Run the resource query.
[ { "docid": "0ed01cd46aa75ad44e0bc0393922119f", "score": "0.7546468", "text": "func (schematics *SchematicsV1) ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions) (result *ResourceQueryResponseRecord, response *core.DetailedResponse, err error) {\n\treturn schematics.ExecuteResourceQueryWithContext(context.Background(), executeResourceQueryOptions)\n}", "title": "" } ]
[ { "docid": "a2d431a0d570774ec7a4dd63b535ed18", "score": "0.6544277", "text": "func (vdb *VersionedDB) ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error) {\n\n\t//Get the querylimit from core.yaml\n\tqueryLimit := ledgerconfig.GetQueryLimit()\n\n\tqueryString, err := ApplyQueryWrapper(namespace, query, queryLimit, 0)\n\tif err != nil {\n\t\tlogger.Debugf(\"Error calling ApplyQueryWrapper(): %s\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tqueryResult, err := vdb.db.QueryDocuments(queryString)\n\tif err != nil {\n\t\tlogger.Debugf(\"Error calling QueryDocuments(): %s\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\tlogger.Debugf(\"Exiting ExecuteQuery\")\n\treturn newQueryScanner(*queryResult), nil\n}", "title": "" }, { "docid": "954bd04538c54037950eb7541ed19a3b", "score": "0.6289824", "text": "func (ir *VindaluCore) ExecuteQuery(assetType string, userQuery map[string]interface{}, queryOpts *types.QueryOptions) (rslt interface{}, err error) {\n\tif queryOpts != nil && queryOpts.Size < 1 {\n\t\tqueryOpts.Size = ir.cfg.DefaultResultSize\n\t}\n\treturn ir.datastore.Query(assetType, userQuery, queryOpts, false)\n}", "title": "" }, { "docid": "bf72bf570d93884b21ddb7da7a3b09ca", "score": "0.61391187", "text": "func (r *Resources) Query(ctx context.Context, querier Querier) (*sfdc.Record, error) {\n\tif r.query == nil {\n\t\treturn nil, errors.New(\"salesforce api is not initialized properly\")\n\t}\n\n\tif querier == nil {\n\t\treturn nil, errors.New(\"querier can not be nil\")\n\t}\n\n\treturn r.query.callout(ctx, querier)\n}", "title": "" }, { "docid": "b744e64e78c4999460db7871edbb013d", "score": "0.60742724", "text": "func (bda *BDA) ExecuteQuery(qeID QueryExecID, args ...interface{}) ([]map[string]interface{}, error) { //fmt.Println(args...)\n\terr := WaitForQueryToComplete(bda.svcAthena, qeID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult, err := processResultRows(bda.svcAthena, qeID, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "20348e0892aaf08c7a9e74ce1a46bfb1", "score": "0.60167706", "text": "func (vdb *versionedDB) ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error) {\n\treturn nil, errors.New(\"ExecuteQuery not supported for ustoredb\")\n}", "title": "" }, { "docid": "d886ea1417bc1b2444b14045ce216f99", "score": "0.6008252", "text": "func (c *Controller) executeQuery(q *Query) {\n\tdefer c.waitForQuery(q)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tvar ok bool\n\t\t\terr, ok := e.(error)\n\t\t\tif !ok {\n\t\t\t\terr = fmt.Errorf(\"panic: %v\", e)\n\t\t\t}\n\t\t\tq.setErr(err)\n\t\t\tif entry := c.logger.Check(zapcore.InfoLevel, \"panic during program start\"); entry != nil {\n\t\t\t\tentry.Stack = string(debug.Stack())\n\t\t\t\tentry.Write(zap.Error(err))\n\t\t\t}\n\t\t}\n\t}()\n\n\tctx, ok := q.tryExec()\n\tif !ok {\n\t\t// This may happen if the query was cancelled (either because the\n\t\t// client cancelled it, or because the controller is shutting down)\n\t\t// In the case of cancellation, SetErr() should reset the error to an\n\t\t// appropriate message.\n\t\tq.setErr(&flux.Error{\n\t\t\tCode: codes.Internal,\n\t\t\tMsg: \"impossible state transition\",\n\t\t})\n\t\treturn\n\t}\n\n\tq.c.createAllocator(q)\n\texec, err := q.program.Start(ctx, q.alloc)\n\tif err != nil {\n\t\tq.setErr(err)\n\t\treturn\n\t}\n\tq.exec = exec\n\tq.pump(exec, ctx.Done())\n}", "title": "" }, { "docid": "23050c7458661bb162e19b4a337a74de", "score": "0.5835582", "text": "func (*SchematicsV1) NewExecuteResourceQueryOptions(queryID string) *ExecuteResourceQueryOptions {\n\treturn &ExecuteResourceQueryOptions{\n\t\tQueryID: core.StringPtr(queryID),\n\t}\n}", "title": "" }, { "docid": "47012a91a3ee999adcb9d429e8a2a27f", "score": "0.5803017", "text": "func (db *DB) exec(ctx context.Context, q ql.Querier) (*client.Response, error) {\n\tquery, _ := q.Query()\n\tif query == \"\" {\n\t\treturn nil, errors.New(\"db.exec: given query is empty\")\n\t}\n\n\tif cancelled(ctx) {\n\t\treturn nil, ctx.Err()\n\t}\n\n\tresp, err := db.client.Query(client.NewQuery(query, db.database, \"\"))\n\tif err != nil {\n\t\tlog.Printf(\"db.exec: query: %q\", query)\n\t\treturn nil, fmt.Errorf(\"db.exec: %v\", err)\n\t}\n\tif resp.Error() != nil {\n\t\tlog.Printf(\"db.exec: query: %q\", query)\n\t\treturn nil, fmt.Errorf(\"db.exec: %v\", resp.Error())\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ac0e849c44ad5b4f030669df8f7e5f04", "score": "0.5716125", "text": "func (q *Querier) Execute(query interface{}, opts ...QueryOption) error {\n\topt := q.QueryOptions\n\tif len(opts) > 0 {\n\t\topt = opt.Clone()\n\t\tfor _, f := range opts {\n\t\t\tf.apply(&opt)\n\t\t}\n\t}\n\n\treq, err := q.c.NewQueryRequest(query, opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := q.c.Client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t} else if resp.StatusCode/100 != 2 {\n\t\treturn ReadError(resp)\n\t}\n\n\tformat := resp.Header.Get(\"Content-Type\")\n\tcur, err := NewCursor(resp.Body, format)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn EachResult(cur, func(ResultSet) error { return nil })\n}", "title": "" }, { "docid": "e033cb701ed93d20f1a6799c71d11703", "score": "0.5699016", "text": "func (vdb *versionedDB) ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error) {\n\treturn nil, errors.New(\"ExecuteQuery not supported for leveldb\")\n}", "title": "" }, { "docid": "a0f84d59027ec0ea211577cf18ee047d", "score": "0.56484747", "text": "func ExecuteQuery(ctx context.Context, query string) *graphql.Result {\n\t// Extract author's name from query string and pass it down with the context\n\tre := regexp.MustCompile(`\\(\\s*name:\\s*\"(.*?)\"\\)`)\n\tmatch := re.FindStringSubmatch(query)\n\tif len(match) > 0 {\n\t\t// set context\n\t\tctx = context.WithValue(ctx, \"authorName\", match[1])\n\t}\n\n\t// GraphQL server call\n\tresult := graphql.Do(graphql.Params{\n\t\tSchema: schema,\n\t\tRequestString: query,\n\t\tContext: ctx,\n\t})\n\tif len(result.Errors) > 0 {\n\t\tlogrus.Errorf(\"wrong result, errors: %v\\n\", result.Errors)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c28dd24c4706059ec3ad4532ef99908b", "score": "0.5604158", "text": "func (scQueryProcessor *SCQueryProcessor) ExecuteQuery(query *data.SCQuery) (*vm.VMOutputApi, error) {\n\taddressBytes, err := scQueryProcessor.pubKeyConverter.Decode(query.ScAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tshardID, err := scQueryProcessor.proc.ComputeShardId(addressBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobservers, err := scQueryProcessor.proc.GetObservers(shardID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, observer := range observers {\n\t\trequest := scQueryProcessor.createRequestFromQuery(query)\n\t\tresponse := &data.ResponseVmValue{}\n\n\t\thttpStatus, err := scQueryProcessor.proc.CallPostRestEndPoint(observer.Address, SCQueryServicePath, request, response)\n\t\tisObserverDown := httpStatus == http.StatusNotFound || httpStatus == http.StatusRequestTimeout\n\t\tisOk := httpStatus == http.StatusOK\n\t\tresponseHasExplicitError := len(response.Error) > 0\n\n\t\tif isObserverDown {\n\t\t\tlog.LogIfError(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif isOk {\n\t\t\tlog.Debug(\"SC query sent successfully, received response\", \"observer\", observer.Address, \"shard\", shardID)\n\t\t\treturn response.Data.Data, nil\n\t\t}\n\n\t\tif responseHasExplicitError {\n\t\t\treturn nil, fmt.Errorf(response.Error)\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn nil, ErrSendingRequest\n}", "title": "" }, { "docid": "c487ab341de7eea18a9dd5752e2a3edb", "score": "0.5553404", "text": "func (schematics *SchematicsV1) ExecuteResourceQueryWithContext(ctx context.Context, executeResourceQueryOptions *ExecuteResourceQueryOptions) (result *ResourceQueryResponseRecord, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(executeResourceQueryOptions, \"executeResourceQueryOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(executeResourceQueryOptions, \"executeResourceQueryOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"query_id\": *executeResourceQueryOptions.QueryID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = schematics.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range executeResourceQueryOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"schematics\", \"V1\", \"ExecuteResourceQuery\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = schematics.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalResourceQueryResponseRecord)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0e79bb62e481cf6178d18020bafffc70", "score": "0.55355483", "text": "func (q *QueryExecutor) ExecuteQuery(query *influxql.Query, database string, chunkSize int, closing chan struct{}) (<-chan *influxql.Result, error) {\n\t// Execute each statement. Keep the iterator external so we can\n\t// track how many of the statements were executed\n\tresults := make(chan *influxql.Result)\n\n\tgo func() {\n\t\tdefer close(results)\n\n\t\tvar i int\n\t\tvar stmt influxql.Statement\n\t\tfor i, stmt = range query.Statements {\n\t\t\t// If a default database wasn't passed in by the caller, check the statement.\n\t\t\t// Some types of statements have an associated default database, even if it\n\t\t\t// is not explicitly included.\n\t\t\tdefaultDB := database\n\t\t\tif defaultDB == \"\" {\n\t\t\t\tif s, ok := stmt.(influxql.HasDefaultDatabase); ok {\n\t\t\t\t\tdefaultDB = s.DefaultDatabase()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Normalize each statement.\n\t\t\tif err := q.normalizeStatement(stmt, defaultDB); err != nil {\n\t\t\t\tresults <- &influxql.Result{Err: err}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Log each normalized statement.\n\t\t\tif q.QueryLogEnabled {\n\t\t\t\tq.Logger.Println(stmt.String())\n\t\t\t}\n\n\t\t\tvar res *influxql.Result\n\t\t\tswitch stmt := stmt.(type) {\n\t\t\tcase *influxql.SelectStatement:\n\t\t\t\tif err := q.executeStatement(i, stmt, database, results, chunkSize, closing); err != nil {\n\t\t\t\t\tresults <- &influxql.Result{Err: err}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\tcase *influxql.DropSeriesStatement:\n\t\t\t\t// TODO: handle this in a cluster\n\t\t\t\tres = q.executeDropSeriesStatement(stmt, database)\n\t\t\tcase *influxql.ShowSeriesStatement:\n\t\t\t\tres = q.executeShowSeriesStatement(stmt, database)\n\t\t\tcase *influxql.DropMeasurementStatement:\n\t\t\t\t// TODO: handle this in a cluster\n\t\t\t\tres = q.executeDropMeasurementStatement(stmt, database)\n\t\t\tcase *influxql.ShowMeasurementsStatement:\n\t\t\t\tif err := q.executeStatement(i, stmt, database, results, chunkSize, closing); err != nil {\n\t\t\t\t\tresults <- &influxql.Result{Err: err}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\tcase *influxql.ShowTagKeysStatement:\n\t\t\t\tif err := q.executeStatement(i, stmt, database, results, chunkSize, closing); err != nil {\n\t\t\t\t\tresults <- &influxql.Result{Err: err}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\tcase *influxql.ShowTagValuesStatement:\n\t\t\t\tres = q.executeShowTagValuesStatement(stmt, database)\n\t\t\tcase *influxql.ShowFieldKeysStatement:\n\t\t\t\tres = q.executeShowFieldKeysStatement(stmt, database)\n\t\t\tcase *influxql.DeleteStatement:\n\t\t\t\tres = &influxql.Result{Err: ErrInvalidQuery}\n\t\t\tcase *influxql.DropDatabaseStatement:\n\t\t\t\t// TODO: handle this in a cluster\n\t\t\t\tres = q.executeDropDatabaseStatement(stmt)\n\t\t\tcase *influxql.ShowStatsStatement, *influxql.ShowDiagnosticsStatement:\n\t\t\t\t// Send monitor-related queries to the monitor service.\n\t\t\t\tres = q.MonitorStatementExecutor.ExecuteStatement(stmt)\n\t\t\tdefault:\n\t\t\t\t// Delegate all other meta statements to a separate executor. They don't hit tsdb storage.\n\t\t\t\tres = q.MetaClient.ExecuteStatement(stmt)\n\t\t\t}\n\n\t\t\tif res != nil {\n\t\t\t\t// set the StatementID for the handler on the other side to combine results\n\t\t\t\tres.StatementID = i\n\n\t\t\t\t// If an error occurs then stop processing remaining statements.\n\t\t\t\tresults <- res\n\t\t\t\tif res.Err != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if there was an error send results that the remaining statements weren't executed\n\t\tfor ; i < len(query.Statements)-1; i++ {\n\t\t\tresults <- &influxql.Result{Err: ErrNotExecuted}\n\t\t}\n\t}()\n\n\treturn results, nil\n}", "title": "" }, { "docid": "9d25b2709e0b77365fe5174204f9e179", "score": "0.54942393", "text": "func (d *Database) Execute(q *Query) (*Cursor, error) {\n\tvar cursor Cursor\n\tt0 := time.Now()\n\tdriverCursor, err := d.driverDB.Query(nil, q.Aql, q.BindVars)\n\tcursor.driverCursor = driverCursor\n\tt1 := time.Now()\n\tcursor.max = int(cursor.driverCursor.Count())\n\tcursor.Time = t1.Sub(t0)\n\treturn &cursor, err\n}", "title": "" }, { "docid": "e8ff2f12e0f479b6a650807fe1deb2dc", "score": "0.54902476", "text": "func (pool SetPool) QueryResource(raw RawResourceProps) (*ent.Resource, error) {\n\tquery, err := pool.findResource(raw)\n\tif err != nil {\n\t\tlog.Error(pool.ctx, err, \"Unable to find resource %+v in pool %d\", raw, pool.ID)\n\t\treturn nil, err\n\t}\n\tonly, err2 := query.\n\t\tWhere(resource.StatusEQ(resource.StatusClaimed)).\n\t\tOnly(pool.ctx)\n\n\tif err2 != nil {\n\t\tlog.Error(pool.ctx, err, \"Unable retrieve resources for pool ID %d\", pool.ID)\n\t}\n\n\treturn only, err2\n}", "title": "" }, { "docid": "444b372992d54c35e220cc01f0a56a40", "score": "0.5467094", "text": "func (c *Client) Query(resource string, query *Query) (*Result, error) {\n\tbody, err := c.QueryRaw(resource, query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result *Result\n\tif err := json.Unmarshal(body, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to unserialize ReliefWeb API response %s: %s\", string(body), err)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b9181278e804b4d61f71f05079a716a4", "score": "0.5464673", "text": "func (q *Query) Execute() (*QueryResponse, error) {\n\tqueryResp := &QueryResponse{}\n\n\tparams := map[string]string{}\n\n\tqpType := reflect.TypeOf(q.Params).Elem()\n\tqp := reflect.ValueOf(q.Params).Elem()\n\n\tfor i := 0; i < qpType.NumField(); i++ {\n\t\tif qp.Field(i).String() != \"\" {\n\n\t\t\tif qp.Field(i).Type().String() == \"bool\" {\n\t\t\t\tparams[qpType.Field(i).Tag.Get(\"query\")] = strconv.FormatBool(qp.Field(i).Bool())\n\t\t\t} else {\n\t\t\t\tparams[qpType.Field(i).Tag.Get(\"query\")] = qp.Field(i).String()\n\t\t\t}\n\t\t}\n\t}\n\n\treq, err := q.client.NewRequest(\"GET\", baseQueryPath, &params, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := q.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Close()\n\n\tbody, err := ioutil.ReadAll(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// bytes.Reader implements Seek, which we need to use to 'rewind' the Body below\n\tqueryResp.RawResponse = bytes.NewReader(body)\n\terr = json.Unmarshal(body, queryResp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 'rewind' the raw response\n\tqueryResp.RawResponse.Seek(0, 0)\n\n\treturn queryResp, nil\n}", "title": "" }, { "docid": "42abc77dc39461e1b63dca79f997e943", "score": "0.5450166", "text": "func (r *Resource) Query(ctx context.Context, querier QueryFormatter, qopts ...QueryOptsFunc) (QueryResult, error) {\n\tif querier == nil {\n\t\treturn nil, errors.New(\"soql resource query: querier can not be nil\")\n\t}\n\topts := &queryOpts{}\n\tfor _, opt := range qopts {\n\t\topt(opts)\n\t}\n\n\tvar columnMeta *QueryColumnMetadataResposne\n\tif opts.columnMetadata {\n\t\tcmreq, err := r.queryColumnMetadataRequest(ctx, querier)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcmres, err := r.queryColumnMetadataResponse(cmreq)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcolumnMeta = &cmres\n\t}\n\n\tif opts.noRecords {\n\t\tresult := &QueryResultImpl{}\n\t\tresult.columnMetadata = columnMeta\n\t\treturn result, nil\n\t}\n\n\tif opts.limitOffsetOpts != nil {\n\t\taggQuerier := &AggregationQueryFormatter{\n\t\t\tbaseFormat: querier,\n\t\t\torderBy: opts.limitOffsetOpts.order,\n\t\t\tlimit: opts.limitOffsetOpts.limit,\n\t\t\toffset: opts.limitOffsetOpts.start,\n\t\t}\n\t\trequest, err := r.queryRequest(ctx, aggQuerier, opts.all)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresponse, err := r.queryResponse(request)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult, err := NewQueryOffsetLimitResult(response, r, aggQuerier, opts.all)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult.QueryResultImpl.columnMetadata = columnMeta\n\t\treturn result, nil\n\t}\n\n\t// normal next page querying\n\trequest, err := r.queryRequest(ctx, querier, opts.all)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := r.queryResponse(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := NewQueryResult(response, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult.columnMetadata = columnMeta\n\treturn result, nil\n\n}", "title": "" }, { "docid": "f9bcb05a585532b1d56ab8d95b33f2b0", "score": "0.5444342", "text": "func ExecuteQuery(query string, session *gocql.Session) error {\n\treturn session.Query(query).Exec()\n}", "title": "" }, { "docid": "2b17afb1530d523f81d41942656bffd7", "score": "0.54436177", "text": "func (q *ArangoDbQueryExecutor) Execute(queryText string, bindVars map[string]interface{}) ([]map[string]interface{}, error) {\n\tif q.db == nil {\n\t\tdb, err := initializeArangoDb()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tq.db = db\n\t}\n\n\tctx := driver.WithQueryCount(context.Background())\n\tcursor, err := q.db.Query(ctx, queryText, bindVars)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cursor.Close()\n\n\tcount := cursor.Count()\n\tdata := make([]map[string]interface{}, count)\n\n\tidx := 0\n\tfor {\n\t\tvar doc map[string]interface{}\n\t\t_, err := cursor.ReadDocument(ctx, &doc)\n\t\tif driver.IsNoMoreDocuments(err) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\t// handle other errors\n\t\t}\n\n\t\tdata[idx] = doc\n\t\tidx++\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "6993c32f926a9544a97a327e1a5aafcb", "score": "0.5412708", "text": "func (r *sqlActiveBeaconRepo) execQuery(ctx context.Context, query string, args ...interface{}) (int64, error) {\n\ttx, err := r.DB.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable})\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn 0, err\n\t}\n\n\tresult, err := tx.ExecContext(ctx, query, args...)\n\tif err != nil {\n\t\tif rollbackErr := tx.Rollback(); rollbackErr != nil {\n\t\t\tlogrus.Error(err)\n\t\t}\n\t\tlogrus.Error(err)\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\tlogrus.Error(err)\n\t}\n\trows, err := result.RowsAffected()\n\n\treturn rows, nil\n\n}", "title": "" }, { "docid": "232cd7273dba8c1247fdbcab0e6a2171", "score": "0.5391104", "text": "func (p *PreparedQuery) Execute(args *structs.PreparedQueryExecuteRequest,\n\treply *structs.PreparedQueryExecuteResponse) error {\n\tif done, err := p.srv.forward(\"PreparedQuery.Execute\", args, args, reply); done {\n\t\treturn err\n\t}\n\tdefer metrics.MeasureSince([]string{\"prepared-query\", \"execute\"}, time.Now())\n\n\t// We have to do this ourselves since we are not doing a blocking RPC.\n\tp.srv.setQueryMeta(&reply.QueryMeta)\n\tif args.RequireConsistent {\n\t\tif err := p.srv.consistentRead(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Try to locate the query.\n\tstate := p.srv.fsm.State()\n\t_, query, err := state.PreparedQueryResolve(args.QueryIDOrName, args.Agent)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif query == nil {\n\t\treturn ErrQueryNotFound\n\t}\n\n\t// Execute the query for the local DC.\n\tif err := p.execute(query, reply, args.Connect); err != nil {\n\t\treturn err\n\t}\n\n\t// If they supplied a token with the query, use that, otherwise use the\n\t// token passed in with the request.\n\ttoken := args.QueryOptions.Token\n\tif query.Token != \"\" {\n\t\ttoken = query.Token\n\t}\n\tif err := p.srv.filterACL(token, &reply.Nodes); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO (slackpad) We could add a special case here that will avoid the\n\t// fail over if we filtered everything due to ACLs. This seems like it\n\t// might not be worth the code complexity and behavior differences,\n\t// though, since this is essentially a misconfiguration.\n\n\t// Shuffle the results in case coordinates are not available if they\n\t// requested an RTT sort.\n\treply.Nodes.Shuffle()\n\n\t// Build the query source. This can be provided by the client, or by\n\t// the prepared query. Client-specified takes priority.\n\tqs := args.Source\n\tif qs.Datacenter == \"\" {\n\t\tqs.Datacenter = args.Agent.Datacenter\n\t}\n\tif query.Service.Near != \"\" && qs.Node == \"\" {\n\t\tqs.Node = query.Service.Near\n\t}\n\n\t// Respect the magic \"_agent\" flag.\n\tif qs.Node == \"_agent\" {\n\t\tqs.Node = args.Agent.Node\n\t} else if qs.Node == \"_ip\" {\n\t\tif args.Source.Ip != \"\" {\n\t\t\t_, nodes, err := state.Nodes(nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, node := range nodes {\n\t\t\t\tif args.Source.Ip == node.Address {\n\t\t\t\t\tqs.Node = node.Node\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tp.srv.logger.Printf(\"[WARN] Prepared Query using near=_ip requires \" +\n\t\t\t\t\"the source IP to be set but none was provided. No distance \" +\n\t\t\t\t\"sorting will be done.\")\n\n\t\t}\n\n\t\t// Either a source IP was given but we couldnt find the associated node\n\t\t// or no source ip was given. In both cases we should wipe the Node value\n\t\tif qs.Node == \"_ip\" {\n\t\t\tqs.Node = \"\"\n\t\t}\n\t}\n\n\t// Perform the distance sort\n\terr = p.srv.sortNodesByDistanceFrom(qs, reply.Nodes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If we applied a distance sort, make sure that the node queried for is in\n\t// position 0, provided the results are from the same datacenter.\n\tif qs.Node != \"\" && reply.Datacenter == qs.Datacenter {\n\t\tfor i, node := range reply.Nodes {\n\t\t\tif node.Node.Node == qs.Node {\n\t\t\t\treply.Nodes[0], reply.Nodes[i] = reply.Nodes[i], reply.Nodes[0]\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Put a cap on the depth of the search. The local agent should\n\t\t\t// never be further in than this if distance sorting was applied.\n\t\t\tif i == 9 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// Apply the limit if given.\n\tif args.Limit > 0 && len(reply.Nodes) > args.Limit {\n\t\treply.Nodes = reply.Nodes[:args.Limit]\n\t}\n\n\t// In the happy path where we found some healthy nodes we go with that\n\t// and bail out. Otherwise, we fail over and try remote DCs, as allowed\n\t// by the query setup.\n\tif len(reply.Nodes) == 0 {\n\t\twrapper := &queryServerWrapper{p.srv}\n\t\tif err := queryFailover(wrapper, query, args, reply); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6e418a3f435a70bbd648f181e89c7c83", "score": "0.5339388", "text": "func (a *ResourcesApiService) ResourcesListExecute(r ApiResourcesListRequest) (DataPagingResources, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue DataPagingResources\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ResourcesApiService.ResourcesList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/spaces/{space}/resources/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"space\"+\"}\", _neturl.PathEscape(parameterToString(r.space, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e3a5729e95a4ef48dd64210775b1b7da", "score": "0.5332136", "text": "func (this *Query) Exec() (err error) {\n\n\terr = this.build()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tthis.Result = Result{}\n\n\tfor _, query := range this.built_queries {\n\t\tif query == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tresp, err := http.PostForm(fql_endpoint, url.Values{\n\t\t\t\"format\": []string{\"json\"},\n\t\t\t\"access_token\": []string{this.AccessToken},\n\t\t\t\"query\": []string{query},\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terror_container := Error{}\n\t\terr = json.Unmarshal(buf, &error_container)\n\t\tif err == nil {\n\t\t\treturn error_container\n\t\t} else {\n\t\t\tswitch err.(type) {\n\t\t\tcase *json.UnmarshalTypeError:\n\t\t\t// nothing\n\t\t\tdefault:\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tvar res interface{}\n\t\terr = json.Unmarshal(buf, &res)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif res_arr, ok := res.([]interface{}); ok {\n\t\t\tfor _, _row := range res_arr {\n\t\t\t\tthis.Result.raw_result = append(this.Result.raw_result, _row)\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.Result.Unpack()\n\n\treturn err\n}", "title": "" }, { "docid": "599938805d726dc33fec856df11e57ee", "score": "0.5322496", "text": "func (dg *discoveryGateway) Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64) (qr *sqltypes.Result, err error) {\n\terr = dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn) error {\n\t\tvar innerErr error\n\t\tqr, innerErr = conn.Execute(ctx, query, bindVars, transactionID)\n\t\treturn innerErr\n\t}, transactionID, false)\n\treturn qr, err\n}", "title": "" }, { "docid": "10f9506a34337a33e0f12ab348b7001d", "score": "0.53093463", "text": "func (c Client) Execute(q storage.Query) (storage.Fetcher, error) {\n\tp, err := c.Prepare(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn p.Run()\n}", "title": "" }, { "docid": "e461dbede70cd8be16288a519da7fe7b", "score": "0.53083235", "text": "func (e *cloudWatchExecutor) Query(ctx context.Context, dsInfo *models.DataSource, queryContext *tsdb.TsdbQuery) (*tsdb.Response, error) {\n\te.DataSource = dsInfo\n\n\t/*\n\t\tUnlike many other data sources,\twith Cloudwatch Logs query requests don't receive the results as the response to the query, but rather\n\t\tan ID is first returned. Following this, a client is expected to send requests along with the ID until the status of the query is complete,\n\t\treceiving (possibly partial) results each time. For queries made via dashboards and Explore, the logic of making these repeated queries is handled on\n\t\tthe frontend, but because alerts are executed on the backend the logic needs to be reimplemented here.\n\t*/\n\tqueryParams := queryContext.Queries[0].Model\n\t_, fromAlert := queryContext.Headers[\"FromAlert\"]\n\tisLogAlertQuery := fromAlert && queryParams.Get(\"queryMode\").MustString(\"\") == \"Logs\"\n\n\tif isLogAlertQuery {\n\t\treturn e.executeLogAlertQuery(ctx, queryContext)\n\t}\n\n\tqueryType := queryParams.Get(\"type\").MustString(\"\")\n\n\tvar err error\n\tvar result *tsdb.Response\n\tswitch queryType {\n\tcase \"metricFindQuery\":\n\t\tresult, err = e.executeMetricFindQuery(ctx, queryContext)\n\tcase \"annotationQuery\":\n\t\tresult, err = e.executeAnnotationQuery(ctx, queryContext)\n\tcase \"logAction\":\n\t\tresult, err = e.executeLogActions(ctx, queryContext)\n\tcase \"liveLogAction\":\n\t\tresult, err = e.executeLiveLogQuery(ctx, queryContext)\n\tcase \"timeSeriesQuery\":\n\t\tfallthrough\n\tdefault:\n\t\tresult, err = e.executeTimeSeriesQuery(ctx, queryContext)\n\t}\n\n\treturn result, err\n}", "title": "" }, { "docid": "ea52bb6e983eb1e217d05f98627007f3", "score": "0.52944624", "text": "func (sq *SqlQuery) StreamExecute(ctx context.Context, query *proto.Query, sendReply func(reply interface{}) error) (err error) {\n\tdefer sq.server.HandlePanic(&err)\n\treturn sq.server.StreamExecute(callinfo.RPCWrapCallInfo(ctx), nil, query, func(reply *mproto.QueryResult) error {\n\t\treturn sendReply(reply)\n\t})\n}", "title": "" }, { "docid": "babfc1354d4b3620678c7d8a09d7d49d", "score": "0.5282417", "text": "func (s *statement) Query(args []driver.Value) (driver.Rows, error) {\n\tq := query{s.query, s.conn.context, nil}\n\treturn q.query(context.Background(), s.conn, args)\n}", "title": "" }, { "docid": "3909b387791303cca39f9b1fe57fa076", "score": "0.52787936", "text": "func (must ConnPool) Query(ctx context.Context, cmd *rdb.Command, params ...rdb.Param) Result {\n\tres, err := must.norm.Query(ctx, cmd, params...)\n\tif err != nil {\n\t\tpanic(Error{Err: err})\n\t}\n\treturn Result{\n\t\tnorm: res,\n\t}\n}", "title": "" }, { "docid": "bc796d2fb4cd4341b9e72388fe9dbebe", "score": "0.52687544", "text": "func (stmt *HiveStatement) Query(args []driver.Value) (rows driver.Rows, _ error) {\n\tstmt.lock.Lock()\n\tctx := &hiveExecContext{session: stmt.sessionHandle}\n\tstmt.lock.Unlock()\n\n\tdefer func() {\n\t\tif rows == nil {\n\t\t\tstmt.closeOperation(ctx.operation)\n\t\t}\n\t}()\n\n\tif err := stmt.exec(ctx, args); err != nil {\n\t\treturn nil, err\n\t} else if !ctx.operation.HasResultSet {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"query\": stmt.processQuery,\n\t\t}).Error(\"Hive: Query finished without result set\")\n\t\treturn nil, errors.New(\"query finished without result set\")\n\t} else if r, err := stmt.buildHiveRows(ctx); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\trows = r\n\t\treturn rows, nil\n\t}\n}", "title": "" }, { "docid": "a7a2c5abd7347c041c2448f2d0fc7e83", "score": "0.52572113", "text": "func (q *Query) Query() (*sql.Rows, error) {\n\tquery := q.buildSQL()\n\treturn q.Dal.Connection.Query(query, q.Values...)\n}", "title": "" }, { "docid": "4eb8575a2e7de146b6fbdf015a260b23", "score": "0.52564025", "text": "func ExecuteQuery(query Query, secureTransport *http.Transport) {\n\t// Websocket stuff is handled elsewhere\n\tif query.IsWebsocket() {\n\t\tExecuteWebsocketQuery(query)\n\t\treturn\n\t}\n\n\t// Real gRPC is handled elsewhere\n\tif query.GrpcType() == \"real\" {\n\t\tCallRealGRPC(query)\n\t\treturn\n\t}\n\n\t// Prepare an insecure transport if necessary; otherwise use the normal\n\t// transport that was passed in.\n\tvar transport *http.Transport\n\tif query.Insecure() {\n\t\ttransport = &http.Transport{\n\t\t\tMaxIdleConns: 10,\n\t\t\tIdleConnTimeout: 30 * time.Second,\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\n\t\tcaCert := query.CACert()\n\t\tif len(caCert) > 0 {\n\t\t\tcaCertPool := x509.NewCertPool()\n\t\t\tcaCertPool.AppendCertsFromPEM([]byte(caCert))\n\t\t\tclientCert, err := tls.X509KeyPair([]byte(query.ClientCert()), []byte(query.ClientKey()))\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\ttransport.TLSClientConfig.RootCAs = caCertPool\n\t\t\ttransport.TLSClientConfig.Certificates = []tls.Certificate{clientCert}\n\t\t}\n\t} else {\n\t\ttransport = secureTransport\n\t}\n\tclient := &http.Client{\n\t\tTransport: transport,\n\t\tTimeout: time.Duration(10 * time.Second),\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\n\t// Prepare the HTTP request\n\tvar body io.Reader\n\tmethod := query.Method()\n\tif query.GrpcType() != \"\" {\n\t\t// Perform special handling for gRPC-bridge and gRPC-web\n\t\tbuf, err := GetGRPCReqBody()\n\t\tif query.CheckErr(err) {\n\t\t\tlog.Printf(\"gRPC buffer error: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif query.GrpcType() == \"web\" {\n\t\t\tresult := make([]byte, base64.StdEncoding.EncodedLen(buf.Len()))\n\t\t\tbase64.StdEncoding.Encode(result, buf.Bytes())\n\t\t\tbuf = bytes.NewBuffer(result)\n\t\t}\n\t\tbody = buf\n\t\tmethod = \"POST\"\n\t} else {\n\t\tbody = query.Body()\n\t}\n\treq, err := http.NewRequest(method, query.URL(), body)\n\tif query.CheckErr(err) {\n\t\tlog.Printf(\"request error: %v\", err)\n\t\treturn\n\t}\n\treq.Header = query.Headers()\n\tfor _, cookie := range query.Cookies() {\n\t\treq.AddCookie(&cookie)\n\t}\n\n\t// Save the client's start date.\n\tquery[\"client-start-date\"] = time.Now().Format(time.RFC3339Nano)\n\n\t// Handle host and SNI\n\thost := req.Header.Get(\"Host\")\n\tif host != \"\" {\n\t\tif query.SNI() {\n\t\t\t// Modify the TLS config of the transport.\n\t\t\t// FIXME I'm not sure why it's okay to do this for the global shared\n\t\t\t// transport, but apparently it works. The docs say that mutating an\n\t\t\t// existing tls.Config would be bad too.\n\t\t\tif transport.TLSClientConfig == nil {\n\t\t\t\ttransport.TLSClientConfig = &tls.Config{}\n\t\t\t}\n\n\t\t\ttransport.TLSClientConfig.ServerName = host\n\n\t\t\tif query.MinTLSVersion() != 0 {\n\t\t\t\ttransport.TLSClientConfig.MinVersion = query.MinTLSVersion()\n\t\t\t}\n\n\t\t\tif query.MaxTLSVersion() != 0 {\n\t\t\t\ttransport.TLSClientConfig.MaxVersion = query.MaxTLSVersion()\n\t\t\t}\n\n\t\t\tif len(query.CipherSuites()) > 0 {\n\t\t\t\ttransport.TLSClientConfig.CipherSuites = query.CipherSuites()\n\t\t\t}\n\n\t\t\tif len(query.ECDHCurves()) > 0 {\n\t\t\t\ttransport.TLSClientConfig.CurvePreferences = query.ECDHCurves()\n\t\t\t}\n\t\t}\n\t\treq.Host = host\n\t}\n\n\t// Perform the request and save the results.\n\tresp, err := client.Do(req)\n\tif query.CheckErr(err) {\n\t\treturn\n\t}\n\tquery.AddResponse(resp)\n}", "title": "" }, { "docid": "e319848ce9bceb9257313adbe6597740", "score": "0.5255959", "text": "func executeQuery(ctx context.Context, txn *dgo.Txn, b builder,\n\tdat *DupleNode, decode *queryDecode) error {\n\t// Write a query that finds the marked unique predicates to the builder.\n\tif err := createQuery(b, dat); err != nil {\n\t\treturn err\n\t}\n\n\t// If the query is empty then return nil right away.\n\tif b.String() == emptyQuery {\n\t\treturn nil\n\t}\n\n\t// Execute the query with the given transaction.\n\tresp, err := txn.Query(ctx, b.String())\n\tif err != nil {\n\t\treturn &QueryError{\n\t\t\tFunction: \"executeQuery\",\n\t\t\tQuery: b.String(),\n\t\t\tExtErr: err,\n\t\t}\n\t}\n\n\t// Unmarshal the response into the given decode object.\n\tif err = json.Unmarshal(resp.GetJson(), decode); err != nil {\n\t\treturn &QueryError{\n\t\t\tFunction: \"executeQuery\",\n\t\t\tExtErr: err,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a84745301830185766351d9caaa72cdc", "score": "0.5242012", "text": "func QueryResources(\n\tclient *dynamic.APIHelper,\n\trecorder *QueryRecorder,\n\tresources []schema.GroupVersionResource,\n\tns *string,\n\tcfg *config.Config) error {\n\n\t// Early exit; avoid forming query or creating output directories.\n\tif len(resources) == 0 {\n\t\treturn nil\n\t}\n\n\tif ns != nil {\n\t\tlogrus.Infof(\"Running ns query (%v)\", *ns)\n\t} else {\n\t\tlogrus.Info(\"Running cluster queries\")\n\t}\n\n\t// 1. Create the parent directory we will use to store the results\n\toutdir := path.Join(cfg.OutputDir(), ClusterResourceLocation)\n\tif ns != nil {\n\t\toutdir = path.Join(cfg.OutputDir(), NSResourceLocation, *ns)\n\t}\n\n\tif err := os.MkdirAll(outdir, 0755); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// 2. Setup label filter if there is one.\n\topts := metav1.ListOptions{}\n\tif len(cfg.Filters.LabelSelector) > 0 {\n\t\tif _, err := labels.Parse(cfg.Filters.LabelSelector); err != nil {\n\t\t\tlogrus.Warningf(\"Labelselector %v failed to parse with error %v\", cfg.Filters.LabelSelector, err)\n\t\t} else {\n\t\t\topts.LabelSelector = cfg.Filters.LabelSelector\n\t\t}\n\t}\n\n\tif ns != nil && len(*ns) > 0 {\n\t\topts.FieldSelector = \"metadata.namespace=\" + *ns\n\t}\n\n\t// 3. Execute the query\n\tfor _, gvr := range resources {\n\t\tlister := func() (*unstructured.UnstructuredList, error) {\n\t\t\tresourceClient := client.Client.Resource(gvr)\n\t\t\tresources, err := resourceClient.List(opts)\n\n\t\t\treturn resources, errors.Wrapf(err, \"listing resource %v\", gvr)\n\t\t}\n\n\t\t// The core group is just the empty string but for clarity and consistency, refer to it as core.\n\t\tgroupText := gvr.Group\n\t\tif groupText == \"\" {\n\t\t\tgroupText = \"core\"\n\t\t}\n\n\t\tquery := func() (time.Duration, error) {\n\t\t\treturn timedListQuery(\n\t\t\t\toutdir+\"/\",\n\t\t\t\tgroupText+\"_\"+gvr.Version+\"_\"+gvr.Resource+\".json\",\n\t\t\t\tlister,\n\t\t\t)\n\t\t}\n\n\t\t// Get the pretty-print namespace and avoid dereference issues.\n\t\tnsVal := \"\"\n\t\tif ns != nil {\n\t\t\tnsVal = *ns\n\t\t}\n\n\t\ttimedQuery(recorder, gvr.Resource, nsVal, query)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dcebe7b3bd262ab14eec041ed3d57e49", "score": "0.52407604", "text": "func (a *ResourcesApiService) ResourcesGetExecute(r ApiResourcesGetRequest) (ModelsResourcesResponseShow, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ModelsResourcesResponseShow\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ResourcesApiService.ResourcesGet\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/spaces/{space}/resources/{resourceID}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"space\"+\"}\", _neturl.PathEscape(parameterToString(r.space, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"resourceID\"+\"}\", _neturl.PathEscape(parameterToString(r.resourceID, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4fc346abcaac6c201af4e3e15e474a38", "score": "0.52266705", "text": "func (p *postgres) Query(q *schema.Query, w io.Writer) error {\n\tout := jsonbytes{w: w}\n\tb, err := json.Marshal(q)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr := p.queryPool.QueryRow(\"select arla_query($1::json)\", string(b))\n\tif err := r.Scan(&out); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a335cce1ab5d1179515f8647d6e18cac", "score": "0.52182543", "text": "func (c *Client) Execute(r Query, response interface{}) error {\n\tpayload, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", c.Endpoint, bytes.NewBuffer(payload))\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range c.Headers {\n\t\treq.Header.Set(k, v)\n\t}\n\tres, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\t// check if status code is non 200\n\tif res.StatusCode != 200 {\n\t\t// it's an error response, decode the error\n\t\tvar e Error\n\t\terr = json.NewDecoder(res.Body).Decode(&e)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn e\n\t}\n\n\t// response is 200, decode response into the passed interface\n\terr = json.NewDecoder(res.Body).Decode(&response)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "15613e2f14a2f6bfb4840a65f13beb29", "score": "0.52148044", "text": "func (a *API) RunQuery(path string, params interface{}) ([]byte, error) {\n\tparamBytes, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, _, err := a.apiCtx.QueryWithData(\"/custom/\"+path, paramBytes)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "2ad6e068558557319de6b55701ca8599", "score": "0.52138585", "text": "func (a *ResourcesApiService) ResourceDeleteExecute(r ApiResourceDeleteRequest) (ModelsResourcesDeleteResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ModelsResourcesDeleteResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ResourcesApiService.ResourceDelete\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/spaces/{space}/resources/{resourceID}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"space\"+\"}\", _neturl.PathEscape(parameterToString(r.space, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"resourceID\"+\"}\", _neturl.PathEscape(parameterToString(r.resourceID, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e299c6fd37867b2a3370be7028e90ad1", "score": "0.5213415", "text": "func (op *Operation) Exec(query string, args ...interface{}) *Result {\n\tif op.Err() != nil {\n\t\treturn &Result{nil, op}\n\t}\n\n\tif op.Dbg {\n\t\tlog.Printf(\"DEBUG - Executing: %s, %#v\", query, stringifyArgs(args))\n\t}\n\n\tvar r, err = op.q.Exec(query, args...)\n\top.SetErr(err)\n\treturn &Result{r, op}\n}", "title": "" }, { "docid": "6c162a01ef2d48554b191faea1ede158", "score": "0.5209952", "text": "func (pool SetPool) QueryResources() (ent.Resources, error) {\n\tres, err := pool.findResources().\n\t\tWhere(resource.StatusEQ(resource.StatusClaimed)).\n\t\tAll(pool.ctx)\n\n\tif err != nil {\n\t\tlog.Error(pool.ctx, err, \"Unable retrieve resources for pool ID %d\", pool.ID)\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "9eea681ec96fc2cc47fd4ea7300d104f", "score": "0.5197054", "text": "func (dx *DBX) exec(query string, args ...interface{}) (result sql.Result, err error) {\n\tif DatabaseDisabled() {\n\t\terr = ErrDatabaseUnavailable\n\t\treturn\n\t}\n\n\tconst retryLimit = 10 // TODO: make configurable\n\tdelay := time.Millisecond\n\tfor i := 0; i < retryLimit; i++ {\n\t\tif result, err = dx.db.Exec(query, args...); err == nil {\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"DBX exec (%d/%d::%T) err: %v\\n\", i+1, retryLimit, err, err)\n\t\tif derr, ok := err.(driver.Error); ok {\n\t\t\t// don't retry if its an actual sql failure\n\t\t\tif derr.Code > 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(delay)\n\t\t// back of requests with simple geomtric series\n\t\tdelay += delay\n\n\t}\n\terr = errors.Wrapf(err, \"DBX exec fail\")\n\treturn\n}", "title": "" }, { "docid": "deaf441566482851d264612702591881", "score": "0.51955014", "text": "func (c *Client) Execute(query string, bindings, rebindings map[string]string) (resp interface{}, err error) {\n\tif c.conn.isDisposed() {\n\t\treturn nil, errors.New(\"you cannot write on a disposed connection\")\n\t}\n\tresp, err = c.executeRequest(query, bindings, rebindings)\n\treturn\n}", "title": "" }, { "docid": "e45c983d37b8eaae49a622abb87c0519", "score": "0.5187147", "text": "func (sq *SqlQuery) StreamExecute(context *rpcproto.Context, query *proto.Query, sendReply func(reply interface{}) error) (err error) {\n\tlogStats := newSqlQueryStats(\"StreamExecute\", context)\n\tdefer handleExecError(query, &err, logStats)\n\n\t// check cases we don't handle yet\n\tif query.TransactionId != 0 {\n\t\treturn NewTabletError(FAIL, \"Transactions not supported with streaming\")\n\t}\n\tif query.ConnectionId != 0 {\n\t\treturn NewTabletError(FAIL, \"Persistent connections not supported with streaming\")\n\t}\n\n\tsq.checkState(query.SessionId, false)\n\n\tsq.qe.StreamExecute(logStats, query, func(reply interface{}) error {\n\t\tif sq.state.Get() != SERVING {\n\t\t\treturn NewTabletError(FAIL, \"Query server is in %s state\", stateName[sq.state.Get()])\n\t\t}\n\t\treturn sendReply(reply)\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "ce36dd1d207d4f126bc3c633d7c8b183", "score": "0.5183697", "text": "func (op *Operation) Query(query string, args ...interface{}) *Rows {\n\tif op.Err() != nil {\n\t\treturn &Rows{nil, op}\n\t}\n\n\tif op.Dbg {\n\t\tlog.Printf(\"DEBUG - Querying: %s, %#v\", query, stringifyArgs(args))\n\t}\n\n\tvar r, err = op.q.Query(query, args...)\n\top.SetErr(err)\n\treturn &Rows{r, op}\n}", "title": "" }, { "docid": "2f05f1d767516bd9dfa2b5663537cde3", "score": "0.5174123", "text": "func (q *Q) Exec(ctx context.Context) error {\n\treturn q.query.Exec(ctx)\n}", "title": "" }, { "docid": "3a484dd6f3c432c8c577f57924c6b9f1", "score": "0.51729435", "text": "func (o SecuritySolutionOutput) QueryForResources() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SecuritySolution) pulumi.StringOutput { return v.QueryForResources }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9e5f0455bae3e584e283402010875352", "score": "0.51628655", "text": "func (q *Query) Exec() (sql.Result, error) {\n\tif q.err != nil {\n\t\treturn nil, q.err\n\t}\n\treturn q.execer.ExecContext(q.ctx, q.query, q.args...)\n}", "title": "" }, { "docid": "b508bbc0fe36aea8a2071a67204bd3cd", "score": "0.5160258", "text": "func (c *Client) Query(ctx context.Context, query string, args ...interface{}) (Rows, error) {\n\trows, err := c.node.QueryContext(ctx, query, args...)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"makroud: cannot execute query\")\n\t}\n\treturn wrapRows(rows), nil\n}", "title": "" }, { "docid": "3090aaec73ff1c08ba719106dae6f915", "score": "0.5153859", "text": "func (schematics *SchematicsV1) ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions) (result *ResourceQueryRecordList, response *core.DetailedResponse, err error) {\n\treturn schematics.ListResourceQueryWithContext(context.Background(), listResourceQueryOptions)\n}", "title": "" }, { "docid": "e50ab7f04c20b30c15d9f4e96819f9ad", "score": "0.51491463", "text": "func (d *Datastore) Query(ctx context.Context, q dsq.Query) (dsq.Results, error) {\n\terr := d.Flush(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d.child.Query(ctx, q)\n}", "title": "" }, { "docid": "efe7f81f147442825dc2d1a49ff03054", "score": "0.51486677", "text": "func (db *Database) runQuery(query string, args ...interface{}) (*sql.Rows, error) {\n\treturn db.Db.Query(query, args...)\n}", "title": "" }, { "docid": "0a1c71d3c25b02e108b672a7c15ce054", "score": "0.5138157", "text": "func (q *Query) Exec() (result sql.Result, e error) {\n\tquery := q.buildSQL()\n\tvar stmt *sql.Stmt\n\tstmt, e = q.Dal.Connection.Prepare(query)\n\tif e != nil {\n\t\treturn\n\t}\n\n\tresult, e = stmt.Exec(q.Values...)\n\treturn\n}", "title": "" }, { "docid": "ed3f069f918089b2df1560a5c6a3abb5", "score": "0.51362705", "text": "func (s *ExecutableSchema) Exec(ctx context.Context) graphql.ResponseHandler {\n\treturn s.ExecuteQuery\n}", "title": "" }, { "docid": "2a7daeed5a37d680f99bd42d7fc97097", "score": "0.51328546", "text": "func (phase *WaitForResourcePhase) Execute(\n\tresource common.ComponentResource,\n\tresourceCondition common.ResourceCondition,\n) (ctrl.Result, bool, error) {\n\t// TODO: loop through functions instead of repeating logic\n\t// common wait logic for a resource\n\tready, err := commonWait(resource.GetReconciler(), resource)\n\tif err != nil {\n\t\treturn ctrl.Result{}, false, err\n\t}\n\n\t// return the result if the object is not ready\n\tif !ready {\n\t\treturn Requeue(), false, nil\n\t}\n\n\t// specific wait logic for a resource\n\tmeta := resource.GetObject().(metav1.Object)\n\tready, err = resource.GetReconciler().Wait(&meta)\n\tif err != nil {\n\t\treturn ctrl.Result{}, false, err\n\t}\n\n\t// return the result if the object is not ready\n\tif !ready {\n\t\treturn Requeue(), false, nil\n\t}\n\n\treturn ctrl.Result{}, true, nil\n}", "title": "" }, { "docid": "2a7daeed5a37d680f99bd42d7fc97097", "score": "0.51328546", "text": "func (phase *WaitForResourcePhase) Execute(\n\tresource common.ComponentResource,\n\tresourceCondition common.ResourceCondition,\n) (ctrl.Result, bool, error) {\n\t// TODO: loop through functions instead of repeating logic\n\t// common wait logic for a resource\n\tready, err := commonWait(resource.GetReconciler(), resource)\n\tif err != nil {\n\t\treturn ctrl.Result{}, false, err\n\t}\n\n\t// return the result if the object is not ready\n\tif !ready {\n\t\treturn Requeue(), false, nil\n\t}\n\n\t// specific wait logic for a resource\n\tmeta := resource.GetObject().(metav1.Object)\n\tready, err = resource.GetReconciler().Wait(&meta)\n\tif err != nil {\n\t\treturn ctrl.Result{}, false, err\n\t}\n\n\t// return the result if the object is not ready\n\tif !ready {\n\t\treturn Requeue(), false, nil\n\t}\n\n\treturn ctrl.Result{}, true, nil\n}", "title": "" }, { "docid": "c319273157ce0d6c07da9bdbf268d8de", "score": "0.5129805", "text": "func (e SingleHostQueryExecutor) Exec(stmt string, values ...interface{}) error {\n\treturn e.control.query(stmt, values...).Close()\n}", "title": "" }, { "docid": "57aa8eb4f97166bb6354acb0cf0a70b0", "score": "0.51258504", "text": "func (r *Resources) ExternalQuery(ctx context.Context, querier ExternalQuerier) (*sfdc.Record, error) {\n\tif r.query == nil {\n\t\treturn nil, errors.New(\"salesforce api is not initialized properly\")\n\t}\n\n\tif querier == nil {\n\t\treturn nil, errors.New(\"querier can not be nil\")\n\t}\n\n\treturn r.query.externalCallout(ctx, querier)\n}", "title": "" }, { "docid": "d0eda5395fe60861b9184521bb101cc8", "score": "0.51219916", "text": "func (c *connection) Query(q string, args []driver.Value) (driver.Rows, error) {\n\treturn c.query(q, args)\n}", "title": "" }, { "docid": "957984ba01978d2868c165e87dc43ba4", "score": "0.51139253", "text": "func (ic IntegratedClient) Query(sql string, params ...interface{}) (pgx.Rows, error) {\n\treturn ic.pgxClient.Query(context.Background(), sql, params...)\n}", "title": "" }, { "docid": "bc1094e721564b75684c6165e48ba95f", "score": "0.5105642", "text": "func (g *Gateway) Execute(ctx context.Context, req *thunderpb.ExecuteRequest) (*thunderpb.ExecuteResponse, error) {\n\tquery, err := federation.UnmarshalQuery(req.Query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres,_, err := g.Executor.Execute(ctx, query, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbytes, err := json.Marshal(res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &thunderpb.ExecuteResponse{\n\t\tResult: bytes,\n\t}\n\treturn resp, nil\n\n}", "title": "" }, { "docid": "52aa74b489b3ea87cf319fc40237c355", "score": "0.5105561", "text": "func (must Transaction) Query(ctx context.Context, cmd *rdb.Command, params ...rdb.Param) Result {\n\tres, err := must.norm.Query(ctx, cmd, params...)\n\tif err != nil {\n\t\tpanic(Error{Err: err})\n\t}\n\treturn Result{\n\t\tnorm: res,\n\t}\n}", "title": "" }, { "docid": "699eaebe7d9a63b4bcbfb0a11aae3789", "score": "0.5089551", "text": "func (sq *SqlQuery) Execute(ctx context.Context, query *proto.Query, reply *mproto.QueryResult) (err error) {\n\tdefer sq.server.HandlePanic(&err)\n\ttErr := sq.server.Execute(callinfo.RPCWrapCallInfo(ctx), nil, query, reply)\n\ttabletserver.AddTabletError(tErr, &reply.Err)\n\treturn nil\n}", "title": "" }, { "docid": "ed3380137d454ed4de43affc9bfd3263", "score": "0.5083824", "text": "func (s *stmt) Query(args []driver.Value) (driver.Rows, error) {\n\treturn s.stmt.Query(args)\n}", "title": "" }, { "docid": "be84ba5068abd92912a3cf6816bbe1ef", "score": "0.5081821", "text": "func (e *Engine) Execute(restQuery *RestQuery) (interface{}, error) {\n\tif restQuery.Debug {\n\t\te.Config().InfoLogger().Printf(\"Execution request %v\\n\", restQuery)\n\t}\n\tresource, err := e.getResource(restQuery)\n\tif err != nil {\n\t\treturn nil, &Error{Cause: err}\n\t}\n\tvar entity interface{}\n\tvar elem reflect.Value\n\tif restQuery.Action == Get {\n\t\tif restQuery.Key != \"\" {\n\t\t\telem = reflect.New(resource.ResourceType()).Elem()\n\t\t\tentity = elem.Addr().Interface()\n\t\t\tif err = setPk(resource.ResourceType(), elem, restQuery.Key); err != nil {\n\t\t\t\treturn nil, NewErrorFromCause(restQuery, err)\n\t\t\t}\n\t\t} else {\n\t\t\tsliceType := reflect.MakeSlice(reflect.SliceOf(resource.ResourceType()), 0, 0).Type()\n\t\t\tentity = reflect.New(sliceType).Interface()\n\t\t}\n\t} else if restQuery.Action == Post {\n\t\tif restQuery.Key != \"\" {\n\t\t\treturn nil, NewErrorBadRequest(\"action 'Post': key is forbidden\")\n\t\t}\n\t\telem = reflect.New(resource.ResourceType()).Elem()\n\t\tentity = elem.Addr().Interface()\n\t\tif err = e.Deserialize(restQuery, resource, entity); err != nil {\n\t\t\treturn nil, NewErrorFromCause(restQuery, err)\n\t\t}\n\t} else if restQuery.Action == Put {\n\t\tif restQuery.Key == \"\" {\n\t\t\treturn nil, NewErrorBadRequest(\"action 'Put': key is mandatory\")\n\t\t}\n\t\telem = reflect.New(resource.ResourceType()).Elem()\n\t\tentity = elem.Addr().Interface()\n\t\tif err = e.Deserialize(restQuery, resource, entity); err != nil {\n\t\t\treturn nil, NewErrorFromCause(restQuery, err)\n\t\t}\n\t\tsetPk(resource.ResourceType(), elem, restQuery.Key)\n\t} else if restQuery.Action == Patch {\n\t\tif restQuery.Key == \"\" {\n\t\t\treturn nil, NewErrorBadRequest(\"action 'Patch': key is mandatory\")\n\t\t}\n\t\telem = reflect.New(resource.ResourceType()).Elem()\n\t\tentity = elem.Addr().Interface()\n\t\tif err = setPk(resource.ResourceType(), elem, restQuery.Key); err != nil {\n\t\t\treturn nil, NewErrorFromCause(restQuery, err)\n\t\t}\n\t} else if restQuery.Action == Delete {\n\t\tif restQuery.Key == \"\" {\n\t\t\treturn nil, NewErrorBadRequest(\"action 'Delete': key is mandatory\")\n\t\t}\n\t\telem = reflect.New(resource.ResourceType()).Elem()\n\t\tentity = elem.Addr().Interface()\n\t\tif err = setPk(resource.ResourceType(), elem, restQuery.Key); err != nil {\n\t\t\treturn nil, NewErrorFromCause(restQuery, err)\n\t\t}\n\t} else {\n\t\treturn nil, &Error{Message: fmt.Sprintf(\"unknow action '%v'\", restQuery.Action)}\n\t}\n\n\tvar ctx context.Context\n\tif restQuery.Request != nil {\n\t\tctx = restQuery.Request.Context()\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tctx = transactional.ContextWithDb(ctx, e.Config().DB())\n\n\texecutor := NewExecutor(restQuery, entity)\n\n\tif restQuery.Action == Get {\n\t\tif restQuery.Key != \"\" {\n\t\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.GetOneExecFunc())\n\t\t} else {\n\t\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.GetSliceExecFunc())\n\t\t}\n\t} else if restQuery.Action == Post {\n\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.InsertExecFunc())\n\t} else if restQuery.Action == Put {\n\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.UpdateExecFunc())\n\t} else if restQuery.Action == Patch {\n\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.GetOneExecFunc())\n\t\tif err == nil {\n\t\t\terr = e.Deserialize(restQuery, resource, entity)\n\t\t}\n\t\tif err == nil {\n\t\t\terr = setPk(resource.ResourceType(), elem, restQuery.Key)\n\t\t}\n\t\tif err == nil {\n\t\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.UpdateExecFunc())\n\t\t}\n\t} else if restQuery.Action == Delete {\n\t\terr = executor.ExecuteWithSearchPath(ctx, restQuery.SearchPath, executor.DeleteExecFunc())\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif restQuery.Debug {\n\t\te.Config().InfoLogger().Printf(\"Execution result %v\\n\", entity)\n\t}\n\tif restQuery.Action == Get && restQuery.Key == \"\" {\n\t\treturn NewPage(executor.entity, executor.count, restQuery), nil\n\t}\n\treturn executor.entity, nil\n}", "title": "" }, { "docid": "9c9df1f9a05c8b722fe62c2b51e5cc1f", "score": "0.50739926", "text": "func (sm *shardStreamer) StreamExecute(ctx context.Context, vcursor engine.VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {\n\tfor result := range sm.result {\n\t\tif err := callback(result); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn sm.err\n}", "title": "" }, { "docid": "1e5d697f01468814e5bdaa11cbd1b292", "score": "0.50734496", "text": "func (pd *PrometheusDiagnostic) executePrometheusDiagnosticQuery(ctx *Context) error {\n\tresultCh := ctx.Query(pd.Query)\n\tresult, err := resultCh.Await()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"prometheus diagnostic %s failed with error: %s\", pd.ID, err)\n\t}\n\tif result == nil {\n\t\tresult = []*QueryResult{}\n\t}\n\tpd.Result = result\n\tpd.Passed = len(result) == 0\n\treturn nil\n}", "title": "" }, { "docid": "87c87fae955a6245bc0d2fb0a2904763", "score": "0.5065362", "text": "func (e *Engine) Query(\n\tctx *sql.Context,\n\tquery string,\n) (sql.Schema, sql.RowIter, error) {\n\tspan, ctx := ctx.Span(\"query\", opentracing.Tag{Key: \"query\", Value: query})\n\tdefer span.Finish()\n\n\tlogrus.WithField(\"query\", query).Debug(\"executing query\")\n\n\tparsed, err := parse.Parse(ctx, query)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar typ = sql.QueryProcess\n\tif _, ok := parsed.(*plan.CreateIndex); ok {\n\t\ttyp = sql.CreateIndexProcess\n\t}\n\n\tctx, err = e.Catalog.AddProcess(ctx, typ, query)\n\tdefer func() {\n\t\tif err != nil && ctx != nil {\n\t\t\te.Catalog.Done(ctx.Pid())\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tanalyzed, err := e.Analyzer.Analyze(ctx, parsed)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\titer, err := analyzed.RowIter(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn analyzed.Schema(), iter, nil\n}", "title": "" }, { "docid": "c195829cfb7873f846a7cd6703d1a1e5", "score": "0.50626653", "text": "func (dg *discoveryGateway) StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64) (<-chan *sqltypes.Result, tabletconn.ErrFunc) {\n\tvar usedConn tabletconn.TabletConn\n\tvar erFunc tabletconn.ErrFunc\n\tvar results <-chan *sqltypes.Result\n\terr := dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn) error {\n\t\tvar err error\n\t\tresults, erFunc, err = conn.StreamExecute(ctx, query, bindVars, transactionID)\n\t\tusedConn = conn\n\t\treturn err\n\t}, transactionID, true)\n\tif err != nil {\n\t\treturn results, func() error { return err }\n\t}\n\tinTransaction := (transactionID != 0)\n\treturn results, func() error {\n\t\treturn WrapError(erFunc(), keyspace, shard, tabletType, usedConn.EndPoint(), inTransaction)\n\t}\n}", "title": "" }, { "docid": "e4ee111c6049a9d974a433556d1c9f14", "score": "0.5062662", "text": "func (vdb *versionedDB) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (statedb.QueryResultsIterator, error) {\n\treturn nil, errors.New(\"ExecuteQueryWithMetadata not supported for ustoredb\")\n}", "title": "" }, { "docid": "1e0dcca7ec5932a45714a3303c621bde", "score": "0.50551885", "text": "func (q Query) Exec(t *testing.T, dEnv *env.DoltEnv) {\n\troot, err := dEnv.WorkingRoot(context.Background())\n\trequire.NoError(t, err)\n\tsqlDb := dsqle.NewDatabase(\"dolt\", root, dEnv.DoltDB, nil)\n\tengine, sqlCtx, err := dsqle.NewTestEngine(context.Background(), sqlDb, root)\n\trequire.NoError(t, err)\n\n\t_, _, err = engine.Query(sqlCtx, q.Query)\n\trequire.NoError(t, err)\n\tnewRoot, err := sqlDb.GetRoot(sqlCtx)\n\trequire.NoError(t, err)\n\terr = dEnv.UpdateWorkingRoot(sqlCtx, newRoot)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "5fb5ce2a2b587510845f7db2c0589c15", "score": "0.5038583", "text": "func (phase *CreateResourcesPhase) Execute(\n\tr common.ComponentReconciler,\n) (proceedToNextPhase bool, err error) {\n\t// execute the resource phases against each resource\n\tfor _, resource := range r.GetResources() {\n\t\tresourceCommon := resource.ToCommonResource()\n\t\tresourceCondition := &common.ResourceCondition{}\n\n\t\tfor _, resourcePhase := range createResourcePhases() {\n\t\t\tr.GetLogger().V(7).Info(fmt.Sprintf(\"enter resource phase: %T\", resourcePhase))\n\t\t\t_, proceed, err := resourcePhase.Execute(resource, *resourceCondition)\n\n\t\t\t// set a message, return the error and result on error or when unable to proceed\n\t\t\tif err != nil || !proceed {\n\t\t\t\treturn handleResourcePhaseExit(r, *resourceCommon, *resourceCondition, resourcePhase, proceed, err)\n\t\t\t}\n\n\t\t\t// set attributes on the resource condition before updating the status\n\t\t\tresourceCondition.LastResourcePhase = getResourcePhaseName(resourcePhase)\n\n\t\t\tr.GetLogger().V(5).Info(fmt.Sprintf(\"completed resource phase: %T\", resourcePhase))\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "95e16f14f01d4f50676a79e79f9456f3", "score": "0.503369", "text": "func (sqa *SousQueryArtifacts) Execute(args []string) cmdr.Result {\n\terr := sqa.RegistryDumper.AsTable(sqa.ErrWriter)\n\treturn ProduceResult(err)\n}", "title": "" }, { "docid": "26ad1a2656633f0519a5e036ed2de696", "score": "0.50246704", "text": "func (b *ConnectionBase) Execute(c ICommand, m toolkit.M) (interface{}, error) {\n\tq, err := b.Prepare(c)\n\tif err != nil {\n\t\treturn nil, toolkit.Errorf(\"unable to prepare query. %s\", err.Error())\n\t}\n\tq.SetConnection(b.This())\n\treturn q.Execute(m)\n}", "title": "" }, { "docid": "921bddf5d5d911c2db6a6c30c2588490", "score": "0.5021175", "text": "func Execute(cxt cookoo.Context, params *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\tok, missing := params.Requires(\"statement\", \"dbname\")\n\tif !ok {\n\t\treturn nil, &cookoo.FatalError{fmt.Sprintf(\"Missing params: %s\", strings.Join(missing, \",\"))}\n\t}\n\n\tdbname := params.Get(\"dbname\", nil).(string)\n\tstatement := params.Get(\"statement\", nil).(string)\n\tdb, err := GetDb(cxt, dbname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := db.Exec(statement)\n\tif err != nil {\n\t\treturn fatalError(err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "4cf9441d2b2bea0674584b61e5186655", "score": "0.5019808", "text": "func (d *DB) Query(ctx context.Context, q Query, objs ...interface{}) error {\n\ttxn := d.NewTxn(true)\n\tdefer txn.Discard(context.Background())\n\terr := txn.Query(ctx, q, objs...)\n\t//TODO: Can we do this for readonly?\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a0fa9b682fa157965250a1bf0be1f29c", "score": "0.50158244", "text": "func (ds *redisDatasource) executeCustomQuery(qm queryModel, client ClientInterface) (interface{}, error) {\n\tvar result interface{}\n\tvar err error\n\n\t// Split query\n\tquery, ok := shell.Split(qm.Query)\n\n\t// Check if query is valid\n\tif !ok {\n\t\terr = fmt.Errorf(\"Query is not valid\")\n\t\treturn result, err\n\t}\n\n\t// Separate command from params\n\tcommand, params := query[0], query[1:]\n\n\t// Handle Panic from custom command to catch \"should never get here\"\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.DefaultLogger.Error(\"PANIC\", \"command\", err, \"query\", qm.Query)\n\t\t}\n\t}()\n\n\t// Run command without params\n\tif len(params) == 0 {\n\t\terr = client.Do(radix.Cmd(&result, command))\n\t\treturn result, err\n\t}\n\n\t// Extract key or 1st parameter as required for FlatCmd\n\tkey, params := params[0], params[1:]\n\terr = client.Do(radix.FlatCmd(&result, command, key, params))\n\n\treturn result, err\n}", "title": "" }, { "docid": "53e9b46e8a1171607334c97342ea0ac5", "score": "0.500539", "text": "func runQuery(db dbType,\n\tself string,\n\tqstring string,\n\tivals []interface{}) ([]*KVResponse, error) {\n\tlog.Debugf(\"query = %s\", qstring)\n\tlog.Debugf(\"ivals = %s\", ivals)\n\n\tret := make([]*KVResponse, 0, 1)\n\n\trows, err := db.handle.Query(qstring, ivals...)\n\tif err != nil {\n\t\treturn queryErrorRet(ret, err, \"failure after Query\")\n\t}\n\n\t// ensure rows gets closed at end\n\tdefer rows.Close() // nolint\n\n\tcols, err := rows.Columns()\n\tif err != nil {\n\t\treturn queryErrorRet(ret, err, \"failure after Columns\")\n\t}\n\tlog.Debugf(\"cols = %s\", cols)\n\n\tfor rows.Next() {\n\t\trec, err := queryRow(self, rows, cols)\n\t\tif err != nil {\n\t\t\treturn queryErrorRet(ret, err, \"failure after queryRow\")\n\t\t}\n\t\tret = append(ret, rec)\n\t\tif len(ret) >= maxRecs { // safety check\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn ret, rows.Err()\n}", "title": "" }, { "docid": "4125d8601436e71f99a81e93971c8915", "score": "0.4982168", "text": "func (e *Engine) Query(ctx *sql.Context, query string) (sql.Schema, sql.RowIter, error) {\n\treturn e.QueryWithBindings(ctx, query, nil, nil)\n}", "title": "" }, { "docid": "e7b2e61f3b644aa78917cefc426a6326", "score": "0.49779257", "text": "func (f DBStub) Query(ctx context.Context, query string, bindVars map[string]interface{}) (driver.Cursor, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "5163612c7fbe72c93f5881cd4246a62f", "score": "0.49768907", "text": "func (ec *ExpressionChain) Query(ctx context.Context) (connection.ResultFetch, error) {\n\tif ec.hasErr() {\n\t\treturn nil, ec.getErr()\n\t}\n\tif !ec.queryable() {\n\t\treturn func(interface{}) error { return nil },\n\t\t\terrors.Errorf(\"cannot invoke query with statements other than SELECT, please use Exec\")\n\t}\n\tq, args, err := ec.Render()\n\tif err != nil {\n\t\treturn func(interface{}) error { return nil },\n\t\t\terrors.Wrap(err, \"rendering query to query\")\n\t}\n\treturn ec.db.Query(ctx, q, ec.mainOperation.fields(), args...)\n}", "title": "" }, { "docid": "023f66ef131d697792ad9334633ecd5e", "score": "0.49767596", "text": "func (c *Client) Exec(ctx context.Context, query string, args ...interface{}) error {\n\t_, err := c.node.ExecContext(ctx, query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"makroud: cannot execute query\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d9858ee6e19e1294af7b84c18e9f46f", "score": "0.49705106", "text": "func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {\n\treturn fmt.Errorf(\"ErrorQueryService does not implement any method\")\n}", "title": "" }, { "docid": "90917e4f1fc31adca82e7e1c481b5fb9", "score": "0.49692306", "text": "func (wh *Warehouse) Exec(query string) error {\n\tfail := &errors.Error{\n\t\tMessage: fmt.Sprintf(\"warehouse/%s: Failed to run operation\", wh.options.Name),\n\t\tValidations: []errors.Validation{},\n\t}\n\n\ttx, err := wh.options.DB.Begin()\n\tif err != nil {\n\t\tfail.Validations = append(fail.Validations, errors.Validation{\n\t\t\tMessage: err.Error(),\n\t\t})\n\n\t\treturn fail\n\t}\n\n\tdefer tx.Rollback()\n\n\t_, err = tx.Exec(query)\n\tif err != nil {\n\t\tfail.Validations = append(fail.Validations, errors.Validation{\n\t\t\tMessage: err.Error(),\n\t\t})\n\n\t\treturn fail\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\tfail.Validations = append(fail.Validations, errors.Validation{\n\t\t\tMessage: err.Error(),\n\t\t})\n\n\t\treturn fail\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f36a232f068fa7fd6d87299430654332", "score": "0.49665442", "text": "func (s *smdQueryCmd) Execute(args []string) error {\n\tsmdQuery(s.log, s.conns, s.Devices, s.Pools)\n\treturn nil\n}", "title": "" }, { "docid": "18d1759a968c75dffc373cdd293a41b3", "score": "0.49608278", "text": "func ExecQuery(db *sql.DB, query string, args ...interface{}) {\n\t_, err := db.Exec(query, args...)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "62f6e8fedc0d3dfb55bbf9607f4a1c7c", "score": "0.49551052", "text": "func (c *Connection) Query(query string) (RowSet, error) {\r\n\texecuteReq := tcliservice.NewTExecuteStatementReq()\r\n\texecuteReq.SessionHandle = c.session.SessionHandle\r\n\texecuteReq.Statement = query\r\n\r\n\tresp, err := c.thrift.ExecuteStatement(context.Background(), executeReq)\r\n\tif err != nil {\r\n\t\treturn nil, fmt.Errorf(\"Error in ExecuteStatement: %+v, %v\", resp, err)\r\n\t}\r\n\r\n\tif !isSuccessStatus(resp.Status) {\r\n\t\treturn nil, fmt.Errorf(\"Error from server: %s\", resp.Status.String())\r\n\t}\r\n\r\n\treturn newRowSet(c.thrift, resp.OperationHandle, c.options), nil\r\n}", "title": "" }, { "docid": "4d8e4fe9990c366834ae90c3a3b680ff", "score": "0.49529374", "text": "func (q *Query) Exec() (*sql.Rows, error) {\n\tstmt := q.SelectClause + q.FromClause + q.WhereClause\n\trows, err := q.db.Query(stmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rows, nil\n}", "title": "" }, { "docid": "43fd94985d1b124f928080830b4fe6d6", "score": "0.49398223", "text": "func (t *Transaction) Query(param *Param) (*sql.Rows, error) {\n\treturn t.DB(param).Query(param.Collection, param.Args...)\n}", "title": "" }, { "docid": "e8b54e2d91af3be7b0303880d3923493", "score": "0.49309412", "text": "func (q *query) Exec(ctx context.Context) (logqlmodel.Result, error) {\n\tlog, ctx := spanlogger.New(ctx, \"query.Exec\")\n\tdefer log.Finish()\n\n\trangeType := GetRangeType(q.params)\n\ttimer := prometheus.NewTimer(queryTime.WithLabelValues(string(rangeType)))\n\tdefer timer.ObserveDuration()\n\n\t// records query statistics\n\tvar statResult stats.Result\n\tstart := time.Now()\n\tctx = stats.NewContext(ctx)\n\n\tdata, err := q.Eval(ctx)\n\n\tstatResult = stats.Snapshot(ctx, time.Since(start))\n\tstatResult.Log(level.Debug(log))\n\n\tstatus := \"200\"\n\tif err != nil {\n\t\tstatus = \"500\"\n\t\tif errors.Is(err, logqlmodel.ErrParse) ||\n\t\t\terrors.Is(err, logqlmodel.ErrPipeline) ||\n\t\t\terrors.Is(err, logqlmodel.ErrLimit) ||\n\t\t\terrors.Is(err, context.Canceled) {\n\t\t\tstatus = \"400\"\n\t\t}\n\t}\n\n\tif q.record {\n\t\tRecordMetrics(ctx, q.params, status, statResult, data)\n\t}\n\n\treturn logqlmodel.Result{\n\t\tData: data,\n\t\tStatistics: statResult,\n\t}, err\n}", "title": "" }, { "docid": "8c98552c5f988b73725ba05a0d6fcbe8", "score": "0.49239695", "text": "func (q QueryRunner) RunQuery(query string) {\n\tqueryStringQuery := elastic.NewQueryStringQuery(query)\n\tsearchResult, err := q.client.Search().Index(\"items\").Query(queryStringQuery).Do(q.ctx)\n\tif err != nil {\n\t\tfmt.Print(err)\n\t}\n\tfmt.Printf(\"Hist: %d \\n\", searchResult.TotalHits())\n}", "title": "" }, { "docid": "ae09a9e3e347cb71c865994332bfc185", "score": "0.49235693", "text": "func QueryResourcePath() string {\n\treturn \"/v1/query\"\n}", "title": "" }, { "docid": "cdf79d3b70026de050a9b30cbfad866d", "score": "0.4912557", "text": "func (c gqlClient) Query(name string, q interface{}, variables map[string]interface{}) error {\n\treturn c.QueryWithContext(context.Background(), name, q, variables)\n}", "title": "" }, { "docid": "d9227bab29cead0d6e194adc1a6599aa", "score": "0.49123225", "text": "func (c *Connection) Query(sql string) (*QueryResult, error) {\n\treturn c.QueryContext(nil, sql)\n}", "title": "" }, { "docid": "b1d89f9f5490cf86a0f75a2e53711cff", "score": "0.49097437", "text": "func (p *PreparedQuery) execute(query *structs.PreparedQuery,\n\treply *structs.PreparedQueryExecuteResponse,\n\tforceConnect bool) error {\n\tstate := p.srv.fsm.State()\n\n\t// If we're requesting Connect-capable services, then switch the\n\t// lookup to be the Connect function.\n\tf := state.CheckServiceNodes\n\tif query.Service.Connect || forceConnect {\n\t\tf = state.CheckConnectServiceNodes\n\t}\n\n\t_, nodes, err := f(nil, query.Service.Service)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Filter out any unhealthy nodes.\n\tnodes = nodes.FilterIgnore(query.Service.OnlyPassing,\n\t\tquery.Service.IgnoreCheckIDs)\n\n\t// Apply the node metadata filters, if any.\n\tif len(query.Service.NodeMeta) > 0 {\n\t\tnodes = nodeMetaFilter(query.Service.NodeMeta, nodes)\n\t}\n\n\t// Apply the service metadata filters, if any.\n\tif len(query.Service.ServiceMeta) > 0 {\n\t\tnodes = serviceMetaFilter(query.Service.ServiceMeta, nodes)\n\t}\n\n\t// Apply the tag filters, if any.\n\tif len(query.Service.Tags) > 0 {\n\t\tnodes = tagFilter(query.Service.Tags, nodes)\n\t}\n\n\t// Capture the nodes and pass the DNS information through to the reply.\n\treply.Service = query.Service.Service\n\treply.Nodes = nodes\n\treply.DNS = query.DNS\n\n\t// Stamp the result for this datacenter.\n\treply.Datacenter = p.srv.config.Datacenter\n\n\treturn nil\n}", "title": "" }, { "docid": "0d914cb45da43f746771ad11917ce3a7", "score": "0.49096826", "text": "func (shard *Shard) Exec(query interface{}, params ...interface{}) (*types.Result, error) {\n\tq := shardQuery{\n\t\tquery: query,\n\t\tfmter: shard.fmter,\n\t}\n\treturn shard.DB.Exec(q, params...)\n}", "title": "" }, { "docid": "27c1672f12c5156704bf81cb399de225", "score": "0.49059537", "text": "func runExec(db dbType,\n\tquery string,\n\tvalues []interface{}) (xResult, error) {\n\tlog.Debugf(\"query = %s\", query)\n\tstmt, err := db.handle.Prepare(query)\n\tif err != nil {\n\t\treturn xResult{}, err\n\t}\n\tdefer stmt.Close() // nolint\n\tresult, err := stmt.Exec(values...)\n\tif err != nil {\n\t\treturn xResult{}, err\n\t}\n\treturn getExecResult(result), nil\n}", "title": "" }, { "docid": "d013002349c1a7bf07c8b773a80ca2da", "score": "0.49021998", "text": "func (e *AzureMonitorExecutor) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {\n\tvar err error\n\n\tvar azureMonitorQueries []*tsdb.Query\n\tvar applicationInsightsQueries []*tsdb.Query\n\n\tfor _, query := range tsdbQuery.Queries {\n\t\tqueryType := query.Model.Get(\"queryType\").MustString(\"\")\n\n\t\tswitch queryType {\n\t\tcase \"Azure Monitor\":\n\t\t\tazureMonitorQueries = append(azureMonitorQueries, query)\n\t\tcase \"Application Insights\":\n\t\t\tapplicationInsightsQueries = append(applicationInsightsQueries, query)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Alerting not supported for %s\", queryType)\n\t\t}\n\t}\n\n\tazDatasource := &AzureMonitorDatasource{\n\t\thttpClient: e.httpClient,\n\t\tdsInfo: e.dsInfo,\n\t}\n\n\taiDatasource := &ApplicationInsightsDatasource{\n\t\thttpClient: e.httpClient,\n\t\tdsInfo: e.dsInfo,\n\t}\n\n\tazResult, err := azDatasource.executeTimeSeriesQuery(ctx, azureMonitorQueries, tsdbQuery.TimeRange)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taiResult, err := aiDatasource.executeTimeSeriesQuery(ctx, applicationInsightsQueries, tsdbQuery.TimeRange)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor k, v := range aiResult.Results {\n\t\tazResult.Results[k] = v\n\t}\n\n\treturn azResult, nil\n}", "title": "" } ]
446fdef0125ab505355f1bd044ac6ab1
Key function returns key value.
[ { "docid": "17fc87dcda1afd6bbde63c6a28ce5a09", "score": "0.0", "text": "func (e ProxyProtocolUpstreamTransportValidationError) Key() bool { return e.key }", "title": "" } ]
[ { "docid": "237e5ea3666cb689299b4b70ee6fe271", "score": "0.7397974", "text": "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "title": "" }, { "docid": "803a34d99733371be76d0b776cd0d1f5", "score": "0.703695", "text": "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "19ee60a2c8375ef53fb4cfddcdd2f242", "score": "0.7026126", "text": "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "title": "" }, { "docid": "d03ec8194467a3537c1b69d2b4dc1974", "score": "0.69730234", "text": "func (m *OMap) Key(n int) string {\n\treturn m.keys[n]\n}", "title": "" }, { "docid": "b6f3af8e61ec4d701e7592d28caa12f2", "score": "0.69701165", "text": "func (t *Type) Key() *Type", "title": "" }, { "docid": "b7cf6ad40d56ef06fd49c3d9dbb6ca45", "score": "0.69472975", "text": "func (f nullFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "a49f3ccf876281b265c748057f7f9c42", "score": "0.682121", "text": "func (v Variable) Key() string {\n\treturn (string)(v)\n}", "title": "" }, { "docid": "8a7abaf41e88d6af5f7052c8b1ee56f8", "score": "0.67752403", "text": "func (i GinJwtSignAlgorithm) Key() string {\n\tif val, ok := _GinJwtSignAlgorithmValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "950111b5d8fac5fff8472dcc4ff73561", "score": "0.6702173", "text": "func (g *Generator) GetKey(K string) interface{} {\n\treturn g.data[K]\n}", "title": "" }, { "docid": "bbddac0cad219025f3f20012db1c6346", "score": "0.6691155", "text": "func (m *SearchBucket) GetKey()(*string) {\n return m.key\n}", "title": "" }, { "docid": "22ff881b756cee2db14639398ad29abe", "score": "0.66223186", "text": "func (f *Filter) getKey(key string) string {\n\tif f.HashKeys {\n\t\th := sha1.New()\n\t\ts := h.Sum([]byte(key))\n\t\treturn fmt.Sprintf(\"%x\", s)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "7e47a533c875f35782644c32f2f2cab9", "score": "0.6602185", "text": "func getKey(ing *extensions.Ingress, t *testing.T) string {\n\tkey, err := keyFunc(ing)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error getting key for Ingress %v: %v\", ing.Name, err)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "45bde8ade6c716ba11d9993d12c48f41", "score": "0.66009104", "text": "func (f *field) Key() string {\n\treturn f.k\n}", "title": "" }, { "docid": "5e774bbf94f3dc7158eb32028b43752a", "score": "0.65937275", "text": "func (i GinBindType) Key() string {\n\tif val, ok := _GinBindTypeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "84247105b22685c254c81e9f1dbfae52", "score": "0.65673846", "text": "func (c Node) GetKey() string {\n\treturn c.key\n}", "title": "" }, { "docid": "df83f14eadd00b24165605e7d0883509", "score": "0.6555592", "text": "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "title": "" }, { "docid": "ea26290e8869c1f7fcb00c31e0291440", "score": "0.65304273", "text": "func (akv StringKeyValue) Key() string {\n\treturn akv.orig.Key\n}", "title": "" }, { "docid": "94518e91e595cf11d7efd617090dd7bb", "score": "0.6521155", "text": "func (a AddItem) Key() string { return string(a) }", "title": "" }, { "docid": "ba6afc72c6b99fe92ef81612268a2b5e", "score": "0.6511681", "text": "func (area *MineArea) GetKey() string {\n\treturn GetKey(area.X, area.Y)\n}", "title": "" }, { "docid": "cfc1d014af7d730b8a806b5c438c8c7e", "score": "0.65062934", "text": "func (d *Disk) getKey(p *DiskParams) []byte {\n\treturn []byte(time_util.TimeToName(time.Unix(p.ExicutionTime, 0), fmt.Sprintf(\"%x\", d.hasher.Sum(nil))))\n}", "title": "" }, { "docid": "57bee6250ce3bbfd5d92eb6509270cb6", "score": "0.64982766", "text": "func (e *OrderedMapElement[K, V]) Key() K {\n\treturn e.element.key\n}", "title": "" }, { "docid": "c9540b31c2264eec843e63587a7bfe28", "score": "0.64867014", "text": "func getKey(cluster *clusteroperator.Cluster, t *testing.T) string {\n\tif key, err := controller.KeyFunc(cluster); err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for Cluster %v: %v\", cluster.Name, err)\n\t\treturn \"\"\n\t} else {\n\t\treturn key\n\t}\n}", "title": "" }, { "docid": "41e8185574e4672bb36f9e4c615a3915", "score": "0.6477575", "text": "func cacheKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*cacheEntry).key\n\treturn key, nil\n}", "title": "" }, { "docid": "c1b30a9544ad248c6472dba7c9fc372a", "score": "0.6462233", "text": "func (node *Node) Key() interface{} {\n\treturn fmt.Sprintf(\"%v\", node.contents)\n}", "title": "" }, { "docid": "4cd1fae12489c0eddabd6e6ebec35f93", "score": "0.6456774", "text": "func (s *Mem) Key(key interface{}) string {\n\treturn fmt.Sprintf(\"%v-%v\", s.prefix, key)\n}", "title": "" }, { "docid": "8b9ae8fdf30da95eceab8676b4ed299b", "score": "0.6456152", "text": "func (vrfs *VRFShare) GetKey() datastore.Key {\n\treturn datastore.ToKey(fmt.Sprintf(\"%v\", vrfs.Round))\n}", "title": "" }, { "docid": "8f42856c5526858a3829519858c56546", "score": "0.6448241", "text": "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "title": "" }, { "docid": "0ab65b85ae62582bf3cfad453497098b", "score": "0.6435275", "text": "func (e Enum) GetKey(value any) string {\n\tfor k, v := range e {\n\t\tif reflect.DeepEqual(v, value) {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "67bef58f6e77ca86bd9629dc74cdd3cc", "score": "0.6423325", "text": "func (m *Map) Key() Type { return m.key }", "title": "" }, { "docid": "9545326007d4799e8522c24226a1e51b", "score": "0.6412427", "text": "func getKey(w http.ResponseWriter, ps httprouter.Params) (string, bool){\n\treturn ps.ByName(\"id\"), true\n}", "title": "" }, { "docid": "e31abbef6059cb9fcd34e34edbbb4e15", "score": "0.64096636", "text": "func (v *Value) GetKey() *string {\n\tret := C.zj_GetKey(v.V)\n\tif ret == nil {\n\t\treturn nil\n\t}\n\tretStr := C.GoString(ret)\n\treturn &retStr\n}", "title": "" }, { "docid": "69872c159e0992fec741300e3123ce96", "score": "0.6403262", "text": "func (f *Factor) Key() string { return f.ID }", "title": "" }, { "docid": "3eee1cf616c7a5ad1fa588d75fdb5635", "score": "0.6395327", "text": "func (c *KeyValueChanger) Key() (string, error) {\n\tif c.err != nil {\n\t\treturn \"\", c.err\n\t}\n\treturn c.node.content.key().(string), nil\n}", "title": "" }, { "docid": "407602c455a65254b7647f924bca8635", "score": "0.63929945", "text": "func (a DataNodeKV) Key() string {\n\treturn a.K\n}", "title": "" }, { "docid": "8570ae57c0ab11d1a8cb540852b0e61f", "score": "0.6382585", "text": "func GetKey(allkeys [][]byte, loc Where) []byte {\n\tif loc == Left {\n\t\treturn allkeys[0]\n\t}\n\tif loc == Right {\n\t\treturn allkeys[len(allkeys)-1]\n\t}\n\t// select a random index between 1 and allkeys-2\n\t// nolint:gosec\n\tidx := rand.Int()%(len(allkeys)-2) + 1\n\treturn allkeys[idx]\n}", "title": "" }, { "docid": "eb246715dc9dc9dc8c38dcf6a54180dd", "score": "0.6378694", "text": "func KeyFunc(name, namespace string) string {\n\tif len(namespace) == 0 {\n\t\treturn name\n\t}\n\treturn namespace + \"/\" + name\n}", "title": "" }, { "docid": "52e49acc7a9996ab1ed4fa75dd79b910", "score": "0.63715774", "text": "func (it *Iterator) Key() string { return it.n.k }", "title": "" }, { "docid": "4cfea236fca94ea42af264640ac08559", "score": "0.63671046", "text": "func (s *session) getKey() string {\n\treturn s.uuid\n}", "title": "" }, { "docid": "a4b8f936e27c09f223b71339d041a5a5", "score": "0.635377", "text": "func (o SchedulingNodeAffinityOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SchedulingNodeAffinity) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c05e8f1d7e269c6fca4e703875309fd9", "score": "0.63430053", "text": "func (i SNSProtocol) Key() string {\n\tif val, ok := _SNSProtocolValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "ead3bd833cd777321e9646243794e52f", "score": "0.63418114", "text": "func (it *Iterator) Key() interface{} { return it.n.k }", "title": "" }, { "docid": "bdf38bbc4f4d87c37dbe7d9bbb289e3c", "score": "0.6339266", "text": "func getkey(key ...interface{}) interface{} {\n\tif len(key) > 0 {\n\t\treturn key[0]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "acf23639d5be0415c2671c9be3f510e6", "score": "0.63258415", "text": "func (i SNSSubscribeAttribute) Key() string {\n\tif val, ok := _SNSSubscribeAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "32f74166c14a590f8cad35c12ce5db6f", "score": "0.6319039", "text": "func (it *iterator) Key() []byte {\n\tif len(it.keys) > 0 {\n\t\treturn []byte(it.keys[0])\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01b4827067335cb6b50c638a1b7ba9a1", "score": "0.630293", "text": "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "title": "" }, { "docid": "69867f57f2c7be87c64f5a28aa6e65d9", "score": "0.6300368", "text": "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "title": "" }, { "docid": "0c1b0b6b067b625902cbcb70aeb2b735", "score": "0.6298253", "text": "func (e *EntrySet) Get(key string) string {\n return e.keys[key]\n}", "title": "" }, { "docid": "49dfc0fd086dae1f84a206eb911b648f", "score": "0.6296133", "text": "func (v *V) Key() string {\n\treturn v.key\n}", "title": "" }, { "docid": "a38e472ddf532a0cc11c4a8a56af123e", "score": "0.6295445", "text": "func (it *Iter) Key() byte { return it.top().key }", "title": "" }, { "docid": "d52b6c1e24e6cc1d568383204b0821e1", "score": "0.6281786", "text": "func (s Stash) Key() string {\n\tvals := utils.MapValues(s.payload)\n\tif len(vals) < 1 {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"$%s\", vals[0])\n}", "title": "" }, { "docid": "571c9eaff990cf65d30f0cb1125086af", "score": "0.6279424", "text": "func (i SNSPlatformApplicationAttribute) Key() string {\n\tif val, ok := _SNSPlatformApplicationAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "bd5da7ae2c92f203fe70385309cebd8b", "score": "0.6277453", "text": "func (o Operator) Key() string {\n\treturn fmt.Sprintf(\"operator.%s\", o.Aid)\n}", "title": "" }, { "docid": "164677dc1576aaf3ee7926997220c326", "score": "0.6277033", "text": "func (i *StringIterator) Key() Object {\n\treturn &Int{Value: int64(i.i - 1)}\n}", "title": "" }, { "docid": "5ae5791db648030a0a094b76c707f80e", "score": "0.62735796", "text": "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0e97067e92211369524d4d90782805e", "score": "0.6269087", "text": "func (s *Arena) getKey(offset uint32, size uint16) []byte {\n\treturn s.data[offset : offset+uint32(size)]\n}", "title": "" }, { "docid": "3a15446cf6e42e1f2edbd79ba1dd4ecb", "score": "0.6262938", "text": "func (o ReservationAffinityOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReservationAffinity) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1005e016964ae19c0fd24207710d9eff", "score": "0.62600297", "text": "func (f DefaultField) Key() string {\n\treturn f.K\n}", "title": "" }, { "docid": "58f195b29c13c426b25837bd68000651", "score": "0.6259835", "text": "func Key(v string) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.EQ(s.C(FieldKey), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "49680efa7c553f52346395562464e011", "score": "0.6242855", "text": "func (m Match) Key() string {\n\treturn fmt.Sprintf(\"match:%s\", m.ID())\n}", "title": "" }, { "docid": "5413da883595763c3d9e86cb969b9e92", "score": "0.62427336", "text": "func (d *Activity) KeyVal() string {\n\treturn d.ExteralID\n}", "title": "" }, { "docid": "b6e356bb45ded92f0697be581852e790", "score": "0.6239893", "text": "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "title": "" }, { "docid": "334c6cc61f7315ad6d53235116bcb0b8", "score": "0.6226979", "text": "func getKey(data string) string {\n\tsign := md5.Sum([]byte(data))\n\tsignStr := fmt.Sprintf(\"%x\", sign)\n\treturn signStr[:7]\n}", "title": "" }, { "docid": "697f629e69530e973bd814a20f3599f7", "score": "0.62228185", "text": "func (l *LangPackStringPluralized) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "title": "" }, { "docid": "c16cec578a02cc6531a703c38060c040", "score": "0.6216291", "text": "func (t Task) Key() string {\n\treturn fmt.Sprintf(\"%s:%s\", t.Name, t.ID)\n}", "title": "" }, { "docid": "828aa5d124a00ec9712926f80a21013a", "score": "0.62118614", "text": "func (k Keys) RangeKey() interface{} { return k[1] }", "title": "" }, { "docid": "ea64e79bd0521ef5c1631a2593943889", "score": "0.6209014", "text": "func (d *DStarLite) keyFor(s *dStarLiteNode) key {\n\t/*\n\t procedure CalculateKey(s)\n\t {01”} return [min(g(s), rhs(s)) + h(s_start, s) + k_m; min(g(s), rhs(s))];\n\t*/\n\tk := key{1: math.Min(s.g, s.rhs)}\n\tk[0] = k[1] + d.heuristic(d.s.Node, s.Node) + d.keyModifier\n\treturn k\n}", "title": "" }, { "docid": "c4a820b64655b31548fa55224cbc098b", "score": "0.62075627", "text": "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "title": "" }, { "docid": "520d18e6ea352545ae5568275cc21b67", "score": "0.619765", "text": "func (m *Metric) GetKey() string {\n\tif m == nil || m.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Key\n}", "title": "" }, { "docid": "1c70cc3088e27d7e883f1540acca5330", "score": "0.6197426", "text": "func (u User) Key() interface{} {\n\treturn u.ID\n}", "title": "" }, { "docid": "60f810f86c215dffc869ad6cc2a6c95e", "score": "0.61971486", "text": "func (b *BitSet) Key() string {\n\tif b == nil {\n\t\treturn \"\"\n\t} else {\n\t\treturn string(b.Bits.Bytes())\n\t}\n}", "title": "" }, { "docid": "715f92074e1596760e3ba8dc81ce3594", "score": "0.6196739", "text": "func (e EnumByte) Key() EnumByteKey {\n return EnumByteKey(e)\n}", "title": "" }, { "docid": "62a3ddeaf298c31d91f8ffe7d8285b7d", "score": "0.6192416", "text": "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "title": "" }, { "docid": "786e0023e3574eda7cc422a17a73498f", "score": "0.6191223", "text": "func (p *pv) key() pvKey {\n\treturn newPVKey(p.Cluster, p.Name)\n}", "title": "" }, { "docid": "bb00124ba41c64cb9b85fea692e18383", "score": "0.6183839", "text": "func (i *MapIterator) Key() Object {\n\tk := i.k[i.i-1]\n\treturn &String{Value: k}\n}", "title": "" }, { "docid": "2bb159dec1f2236486062277a6147fe2", "score": "0.6179522", "text": "func (k *KVItem) Key() (interface{}, error) {\n\tvar cKey unsafe.Pointer\n\tvar keySize C.uint64_t\n\tvar keyType C.tiledb_datatype_t\n\tret := C.tiledb_kv_item_get_key(k.context.tiledbContext, k.tiledbKVItem, &cKey, &keyType, &keySize)\n\n\tif ret != C.TILEDB_OK {\n\t\treturn nil, fmt.Errorf(\"Error getting key for KVItem: %s\", k.context.LastError())\n\t}\n\n\tswitch Datatype(keyType) {\n\tcase TILEDB_INT8:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int8_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int8_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int8, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int8(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int8(*(*C.int8_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_INT16:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int16_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int16_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int16, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int16(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int16(*(*C.int16_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_INT32:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int32_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int32_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int32, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int32(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int32(*(*C.int32_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_INT64:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int64_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int64_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int64, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int64(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int64(*(*C.int64_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT8:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint8_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint8_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint8, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint8(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int8(*(*C.uint8_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT16:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint16_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint16_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint16, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint16(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int16(*(*C.uint16_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT32:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint32_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint32_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint32, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint32(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int32(*(*C.uint32_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT64:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint64_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint64_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint64, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint64(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int64(*(*C.uint64_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_FLOAT32:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_float\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.float)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]float32, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = float32(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn float32(*(*C.float)(cKey)), nil\n\t\t}\n\tcase TILEDB_FLOAT64:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_double\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.double)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]float64, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = float64(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn float64(*(*C.double)(cKey)), nil\n\t\t}\n\tcase TILEDB_CHAR:\n\t\telements := int(keySize) / C.sizeof_char\n\t\treturn C.GoStringN((*C.char)(cKey), C.int(elements)), nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported tiledb key type: %v\", keyType)\n\t}\n\n\treturn nil, fmt.Errorf(\"Error getting key for KVItem\")\n}", "title": "" }, { "docid": "d92e93a86c5871d179a757de71cecf45", "score": "0.6177141", "text": "func (u Users) Key(luid *windows.LUID) (int64, error) {\r\n\tif luid == nil {\r\n\t\treturn 0, errors.New(\"got empty LUID pointer\")\r\n\t}\r\n\tkey := int64(int64(luid.HighPart<<32) + int64(luid.LowPart))\r\n\treturn key, nil\r\n}", "title": "" }, { "docid": "eb3153167343c68d258ffcc8e85112d2", "score": "0.6172575", "text": "func (a *Anime) Key() string {\n\treturn fmt.Sprintf(\"anime:%d\", a.ID)\n}", "title": "" }, { "docid": "beb8e789f1940ee28651be2a26cd4a2c", "score": "0.61719537", "text": "func (m MapEntry) Key() interface{} {\n\treturn m.key\n}", "title": "" }, { "docid": "2f1204b7fef938e5693b96c7e3fc32f5", "score": "0.6170614", "text": "func (f KeyMakerFunc) KeyFor(r *http.Request) string {\n\treturn f(r)\n}", "title": "" }, { "docid": "3b8970f5f15b8e0df3b1146342981cb7", "score": "0.6162783", "text": "func (t *TimeSeries) GetKey() string {\n\treturn t.key\n}", "title": "" }, { "docid": "ec0b3d790e2721de271d3fc8161ba99c", "score": "0.61570954", "text": "func (m *Map) Get(key string) string {\n\tif m.IsEmpty() {\n\t\treturn \"\"\n\t}\n\thash := m.hash([]byte(key))\n\tn := node{hash: hash, key: key}\n\titer := floor(&m.nodes.Tree, &n)\n\tif iter == m.nodes.End() {\n\t\titer = m.nodes.Begin()\n\t}\n\treturn iter.Node().Key.(*node).key\n}", "title": "" }, { "docid": "847e4409738eecb63c771e9b08ba5c3f", "score": "0.6154456", "text": "func (t *ScheduledTask) Key() string {\n\treturn fmt.Sprintf(taskKeyFormat, keyPrefixScheduled, t.ID, t.score)\n}", "title": "" }, { "docid": "dd43d6eab39aa52c51887f8b4f346e2d", "score": "0.6152929", "text": "func (it *iterator) Key() []byte {\n\treturn it.current.key\n}", "title": "" }, { "docid": "ba856cb3615da0063622433a2a45dd15", "score": "0.615149", "text": "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "14c241f480e72d0c774d2dc389f60cae", "score": "0.61509156", "text": "func (h dataUsageHash) Key() string {\n\treturn string(h)\n}", "title": "" }, { "docid": "a91f8301bfa9f59b7acb6baf07655def", "score": "0.61395836", "text": "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "title": "" }, { "docid": "338aaaa53d2d107c22be90a109940c44", "score": "0.6138672", "text": "func (c Repository) GetKey(key string) string {\n\tval, err := c.Client.Get(key).Result()\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "797a317d2558388f92ea5aec71779e5f", "score": "0.61365676", "text": "func (f Base) Key() string {\n\treturn f.key\n}", "title": "" }, { "docid": "68566950a31e28bd9576f640e7e3b3d3", "score": "0.613636", "text": "func (o StudioComponentScriptParameterKeyValueOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StudioComponentScriptParameterKeyValue) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7537054a6b01ab85badf3ae1b16f23f9", "score": "0.61338246", "text": "func (o *ResourceDefinitionFilter) GetKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Key\n}", "title": "" }, { "docid": "5d1634771afe6f87079640fe4d79e6ca", "score": "0.6133771", "text": "func (it *KeyAccess_Iterator) Key() interface{} {\n\treturn it.node.key\n}", "title": "" }, { "docid": "3942e016851b31d2fdb0e748320dd538", "score": "0.6129422", "text": "func (b Bucket) Key() interface{} {\n\treturn b[\"key\"]\n}", "title": "" }, { "docid": "e97009b67c5dc93732d00ffc2edbbc88", "score": "0.61284614", "text": "func (m *Map) Get(key string) string {\n\tif m.IsEmpty() {\n\t\treturn \"\"\n\t}\n\n\thash := int(m.hash([]byte(key)))\n\n\t// Binary search for appropriate replica.\n\tidx := sort.Search(len(m.keys), func(i int) bool { return m.keys[i] >= hash })\n\n\t// Means we have cycled back to the first replica.\n\tif idx == len(m.keys) {\n\t\tidx = 0\n\t}\n\n\treturn m.hashMap[m.keys[idx]]\n}", "title": "" }, { "docid": "49069ade2b5f14028a4e0a7207731f84", "score": "0.612092", "text": "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "title": "" }, { "docid": "8e2e2771eee65941c8cf800b2393345d", "score": "0.6119081", "text": "func Key(id string, fallback string) Reference {\n\treturn key{id, fallback}\n}", "title": "" }, { "docid": "dac037cabf1e894cc59b1a9aeab10a77", "score": "0.61121005", "text": "func (a *PositionalAttribute) Key() string {\n\treturn AttrPositionalIndex + strconv.Itoa(a.Index)\n}", "title": "" }, { "docid": "14bf6fcb2165527ff10e33cb86f648c7", "score": "0.611087", "text": "func (n *Node) Key() interface{} {\n\treturn n.key\n}", "title": "" }, { "docid": "657d89748b605628ef978188ac72c989", "score": "0.6106958", "text": "func (e Timing) Key() string {\n\treturn e.Name\n}", "title": "" }, { "docid": "711c88ebf9dae858e7af3fefc1c45810", "score": "0.6106701", "text": "func Key(key string) query.Extractor {\n\treturn &keyExtractor{key}\n}", "title": "" }, { "docid": "d918bbafbe8974c39cc7225c3daf2f5d", "score": "0.61020154", "text": "func (i *Iterator) Key() []byte {\n\treturn i.iterator.Item().KeyCopy(nil)\n}", "title": "" }, { "docid": "294f7d52e97ebefc1e3482637afe2eeb", "score": "0.6100722", "text": "func (m *Metric) Key() string {\n\treturn fmt.Sprintf(\"<%s%d%s>\", m.Name, m.Timestamp, m.Tags)\n}", "title": "" } ]
3485fcfc95ce4969f5ccce9055bd130b
Node return the peer node
[ { "docid": "ff918539721070e23ad88c5c8a9c30a6", "score": "0.6384187", "text": "func (ns *QlcService) Node() *QlcNode {\n\treturn ns.node\n}", "title": "" } ]
[ { "docid": "d41bfe10276db69106a8017b93c4a778", "score": "0.649036", "text": "func (_Contract *ContractCallerSession) Node(addr common.Address) ([32]byte, error) {\n\treturn _Contract.Contract.Node(&_Contract.CallOpts, addr)\n}", "title": "" }, { "docid": "716b24a7661c9338234dc6f79ab99894", "score": "0.64725876", "text": "func (_Contract *ContractSession) Node(addr common.Address) ([32]byte, error) {\n\treturn _Contract.Contract.Node(&_Contract.CallOpts, addr)\n}", "title": "" }, { "docid": "a3d7b7528374c936789f5ea876d833fe", "score": "0.63736486", "text": "func (i *NodeInfo) Node() *v1.Node {\n\ti.lock.RLock()\n\tdefer i.lock.RUnlock()\n\n\treturn i.node\n}", "title": "" }, { "docid": "92753221498a634e9eaebe005ad3dcda", "score": "0.6342358", "text": "func (c *Client) Node() *structs.Node {\n\tc.configLock.RLock()\n\tdefer c.configLock.RUnlock()\n\treturn c.configCopy.Node\n}", "title": "" }, { "docid": "1d3848bf3c4a1e01a9e11274da1c4cad", "score": "0.6254602", "text": "func (snode *SNode) Node() Node{\r\n\tvar node Node\r\n\t\tnode.Id=snode.Id\r\n\t\tnode.Ip = snode.Ip\r\n\t\tnode.Port = snode.Port\r\n\t\tnode.Path = snode.Path\r\n\t\tnode.PKStr = snode.PKStr\r\n\t\tnode.PRKStr = snode.PRKStr\r\n\t\tnode.Address = snode.Address\r\n\t\tnode.WalletId = snode.WalletId\r\n\t\treturn node\r\n}", "title": "" }, { "docid": "f50835ebc10b40619c71a77fdb836b32", "score": "0.61904633", "text": "func (routine *Routine) Peer() (string, string) {\n\taddr := routine.io.RemoteAddr()\n\thost, port, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\tlogutil.Errorf(\"get peer host:port failed. error:%v \", err)\n\t\treturn \"failed\", \"0\"\n\t}\n\treturn host, port\n}", "title": "" }, { "docid": "e394ff8f9bf2496ee786ba0206f95cd1", "score": "0.61766195", "text": "func Peer(ctx context.Context, ip net.IP) (p PeerInfo, err error) {\n\treturn DefaultClient.Peer(ctx, ip)\n}", "title": "" }, { "docid": "8cde004567f4f66d060284a4e352006d", "score": "0.6161662", "text": "func (ec *EtcdClient) LocalNode() *Node {\n\treturn ec.Node\n}", "title": "" }, { "docid": "26c47ae2b31c3841dcf75f995400d270", "score": "0.61292714", "text": "func (n *Nodes) Node() graph.Node {\n\treturn n.curr\n}", "title": "" }, { "docid": "86a9531f07e26b68812c0849502f2d56", "score": "0.6116245", "text": "func (s *SerfNode) Node(nodeID string) SerfMember {\n\ts.mutex.RLock()\n\tdefer s.mutex.RUnlock()\n\treturn s.members[nodeID]\n}", "title": "" }, { "docid": "2044c76c71af42a17030ff9590c74d86", "score": "0.61017984", "text": "func (_Contract *ContractCaller) Node(opts *bind.CallOpts, addr common.Address) ([32]byte, error) {\n\tvar out []interface{}\n\terr := _Contract.contract.Call(opts, &out, \"node\", addr)\n\n\tif err != nil {\n\t\treturn *new([32]byte), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "343296a1c5b7993f5a22494c71b49a67", "score": "0.60430586", "text": "func (s *Source) Node() *srvpb.Node {\n\tfacts := make([]*srvpb.Fact, 0, len(s.Facts))\n\tfor name, value := range s.Facts {\n\t\tfacts = append(facts, &srvpb.Fact{Name: name, Value: value})\n\t}\n\tsort.Sort(ByName(facts))\n\treturn &srvpb.Node{\n\t\tTicket: s.Ticket,\n\t\tFact: facts,\n\t}\n}", "title": "" }, { "docid": "cc755d24b6198960e982ec312591b476", "score": "0.60283494", "text": "func renderPeer(p keppel.Peer) Peer {\n\treturn Peer{\n\t\tHostName: p.HostName,\n\t}\n}", "title": "" }, { "docid": "fe267bff4647ad8970b87ce165917122", "score": "0.6006915", "text": "func InitializePeer(sourcePort int) *PeerNode {\n\tvar r io.Reader\n\tr = rand.Reader\n\tvar result *PeerNode\n\t// Generate a 2018 private key with RSA\n\t// You chould be able to substitue it with other cryptography functions such as\n\t// elliptic curves.\n\tprivateKey, _, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Generate a IP4 TCp multi address and point it to 0.0.0.0 as a way to say that\n\t// It accepts all connections.\n\tsourceMultiAddr, _ := multiaddr.NewMultiaddr(fmt.Sprintf(\"/ip4/0.0.0.0/tcp/%d\", sourcePort))\n\t// Use the current context, generated private key as Identity and attach\n\t// the generated multi address the links to 0.0.0.0 to create a new peer Node\n\t// 0.0.0.0 tells our host to accept all addresses\n\t// <Context package> \t\thttps://golang.org/pkg/context/\n\tnode, err := libp2p.New(\n\t\tcontext.Background(),\n\t\tlibp2p.ListenAddrs(sourceMultiAddr),\n\t\tlibp2p.Identity(privateKey),\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Show the created node properties on display and return a pointer to it.\n\tfmt.Printf(\"Node PeerID:\\t%s\\n\", node.ID())\n\tfmt.Printf(\"\\n%s/ipfs/%s\\n\", node.Addrs()[0].String(), node.ID().Pretty())\n\tresult = &PeerNode{node}\n\n\treturn result\n}", "title": "" }, { "docid": "b1f1799a66537122e81123fce2701cd6", "score": "0.5983824", "text": "func NewNode(mgr *p2p.Manager, mcfg *subConfig) (*Node, error) {\n\n\tcfg := mgr.ChainCfg\n\tnode := &Node{\n\t\toutBound: make(map[string]*Peer),\n\t\tcacheBound: make(map[string]*Peer),\n\t\tpubsub: pubsub.NewPubSub(10200),\n\t\tp2pMgr: mgr,\n\t}\n\t//node.tls = &Tls{serials:make(map[*big.Int]*certInfo)}\n\tnode.listenPort = 13802\n\tif mcfg.Port != 0 && mcfg.Port <= 65535 && mcfg.Port > 1024 {\n\t\tnode.listenPort = int(mcfg.Port)\n\n\t}\n\n\tif mcfg.InnerSeedEnable {\n\t\tseeds := MainNetSeeds\n\t\tif cfg.IsTestNet() {\n\t\t\tseeds = TestNetSeeds\n\t\t}\n\n\t\tfor _, seed := range seeds {\n\t\t\tnode.innerSeeds.Store(seed, \"inner\")\n\t\t}\n\t}\n\n\tfor _, seed := range mcfg.Seeds {\n\t\tnode.cfgSeeds.Store(seed, \"cfg\")\n\t}\n\tnode.nodeInfo = NewNodeInfo(cfg.GetModuleConfig().P2P, mcfg)\n\tnode.chainCfg = cfg\n\tif mcfg.EnableTls { //读取证书,初始化tls客户端\n\t\tvar err error\n\t\tif mcfg.CaCert == \"\" {\n\t\t\t//不需要CA\n\t\t\tnode.nodeInfo.cliCreds, err = credentials.NewClientTLSFromFile(mcfg.CertFile, \"\")\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"NewClientTLSFromFile panic:%v\", err.Error()))\n\t\t\t}\n\t\t\tnode.nodeInfo.servCreds, err = credentials.NewServerTLSFromFile(mcfg.CertFile, mcfg.KeyFile)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"NewServerTLSFromFile panic:%v\", err.Error()))\n\t\t\t}\n\t\t} else {\n\t\t\t//CA\n\t\t\tcert, err := tls.LoadX509KeyPair(mcfg.CertFile, mcfg.KeyFile)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"LoadX509KeyPair panic:%v\", err.Error()))\n\t\t\t}\n\t\t\tcertPool := x509.NewCertPool()\n\t\t\t//添加CA校验\n\t\t\t//把CA证书读进去,动态更新CA中的吊销列表\n\t\t\tca, err := ioutil.ReadFile(mcfg.CaCert)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"readFile ca panic:%v\", err.Error()))\n\t\t\t}\n\n\t\t\tif ok := certPool.AppendCertsFromPEM(ca); !ok {\n\t\t\t\tpanic(\"certPool.AppendCertsFromPEM err\")\n\t\t\t}\n\n\t\t\tnode.nodeInfo.servCreds = newTLS(&tls.Config{\n\t\t\t\tCertificates: []tls.Certificate{cert},\n\t\t\t\tClientAuth: tls.RequireAndVerifyClientCert, //校验客户端证书,用ca.pem校验\n\t\t\t\tClientCAs: certPool,\n\t\t\t})\n\n\t\t\t// 构建基于 TLS 的 TransportCredentials 选项\n\t\t\t// 在 Client 请求 Server 端时,Client 端会使用根证书和 ServerName 去对 Server 端进行校验\n\t\t\tnode.nodeInfo.cliCreds = newTLS(&tls.Config{\n\t\t\t\tCertificates: []tls.Certificate{cert},\n\t\t\t\tServerName: \"\",\n\t\t\t\tRootCAs: certPool,\n\t\t\t})\n\t\t\tnode.nodeInfo.caServer = mcfg.CaServer\n\t\t}\n\n\t}\n\tif mcfg.ServerStart {\n\t\tnode.server = newListener(protocol, node)\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "4bdafce76dbd54ef5a957e74aed2297d", "score": "0.59708375", "text": "func GetNode() swl.Node {\n\treturn node\n}", "title": "" }, { "docid": "f88dcd5290d7badda13da08cef8c60d9", "score": "0.5967024", "text": "func RemoteNode(ctx context.Context) (RemoteNodeInfo, error) {\n\t// If we have a value on the context that marks this as a local\n\t// request, we return the node info from the context.\n\tlocalNodeInfo := ctx.Value(LocalRequestKey)\n\n\tif localNodeInfo != nil {\n\t\tnodeInfo, ok := localNodeInfo.(RemoteNodeInfo)\n\t\tif ok {\n\t\t\treturn nodeInfo, nil\n\t\t}\n\t}\n\n\tcertSubj, err := certSubjectFromContext(ctx)\n\tif err != nil {\n\t\treturn RemoteNodeInfo{}, err\n\t}\n\n\torg := \"\"\n\tif len(certSubj.Organization) > 0 {\n\t\torg = certSubj.Organization[0]\n\t}\n\n\tpeer, ok := peer.FromContext(ctx)\n\tif !ok {\n\t\treturn RemoteNodeInfo{}, status.Errorf(codes.PermissionDenied, \"Permission denied: no peer info\")\n\t}\n\n\tdirectInfo := RemoteNodeInfo{\n\t\tRoles: certSubj.OrganizationalUnit,\n\t\tNodeID: certSubj.CommonName,\n\t\tOrganization: org,\n\t\tRemoteAddr: peer.Addr.String(),\n\t}\n\n\tif isForwardedRequest(ctx) {\n\t\tremoteAddr, cn, org, ous := forwardedTLSInfoFromContext(ctx)\n\t\tif len(ous) == 0 || cn == \"\" || org == \"\" {\n\t\t\treturn RemoteNodeInfo{}, status.Errorf(codes.PermissionDenied, \"Permission denied: missing information in forwarded request\")\n\t\t}\n\t\treturn RemoteNodeInfo{\n\t\t\tRoles: ous,\n\t\t\tNodeID: cn,\n\t\t\tOrganization: org,\n\t\t\tForwardedBy: &directInfo,\n\t\t\tRemoteAddr: remoteAddr,\n\t\t}, nil\n\t}\n\n\treturn directInfo, nil\n}", "title": "" }, { "docid": "1c41f98135ddeb890845987027e7d897", "score": "0.594072", "text": "func (ps *peerSet) Get(node *discover.Node) *Peer {\n\tps.lock.Lock()\n\tdefer ps.lock.Unlock()\n\tif ps.peers == nil {\n\t\treturn nil\n\t}\n\tpeer, ok := ps.peers[node.String()]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn peer\n}", "title": "" }, { "docid": "ffbfe656d7ba4f3f837c34f48feb66f7", "score": "0.5925465", "text": "func (ltm LTM) Node() *NodeResource {\n\treturn &ltm.node\n}", "title": "" }, { "docid": "c38a6b075eccc68629a4937ae894ba54", "score": "0.5907262", "text": "func (s *ImmutableState) Node(ctx context.Context, id signature.PublicKey) (*node.Node, error) {\n\tsignedNodeRaw, err := s.getSignedNodeRaw(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif signedNodeRaw == nil {\n\t\treturn nil, registry.ErrNoSuchNode\n\t}\n\n\tvar signedNode node.MultiSignedNode\n\tif err = cbor.Unmarshal(signedNodeRaw, &signedNode); err != nil {\n\t\treturn nil, abciAPI.UnavailableStateError(err)\n\t}\n\tvar node node.Node\n\tif err = cbor.Unmarshal(signedNode.Blob, &node); err != nil {\n\t\treturn nil, abciAPI.UnavailableStateError(err)\n\t}\n\treturn &node, nil\n}", "title": "" }, { "docid": "957f6a9e697709fdc813d40bdae4ead8", "score": "0.5897523", "text": "func (rn *GrpcRaftNode) GetPeer(pid uint64) (string, bool) {\n\treturn rn.peers.get(pid)\n}", "title": "" }, { "docid": "2fe46bb9bc7752e8d6f307b16199445b", "score": "0.5895585", "text": "func (n Foo) Issue24Node() *Node { return n.Node }", "title": "" }, { "docid": "9b181a4f70628ad5125a14087ebb824a", "score": "0.5876544", "text": "func (g *Graph) Node(id uint64) *Node {\n\treturn g.nodes[id]\n}", "title": "" }, { "docid": "5f161c561a828fc8adf0555e1c57c069", "score": "0.5874776", "text": "func GetNodeDetails(w http.ResponseWriter, r *http.Request) {\n\tpeerJSON := peerNode.GetNodeJSON()\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(peerJSON))\n}", "title": "" }, { "docid": "133f8a5e4fd47a385248ce2bd883e9b7", "score": "0.5847262", "text": "func (b *Builder) Node(nodeID uint64) BuilderNode {\n\tfor _, n := range b.nodes {\n\t\tif n.id == nodeID {\n\t\t\treturn n\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a97aaf88dc4718febd2887020009521", "score": "0.58317435", "text": "func NewNode(ctx context.Context, cfg *localConfig.Config, receive func(msg []byte) error) (*Node, error) {\n\tnode := &Node{\n\t\tReceive: receive,\n\t\tSendMessageChan: make(chan []byte),\n\t}\n\n\ttransports := libp2p.ChainOptions(\n\t\tlibp2p.Transport(tcp.NewTCPTransport),\n\t\tlibp2p.Transport(ws.New),\n\t)\n\n\tmuxers := libp2p.ChainOptions(\n\t\tlibp2p.Muxer(\"/yamux/1.0.0\", yamux.DefaultTransport),\n\t\tlibp2p.Muxer(\"/mplex/6.7.0\", mplex.DefaultTransport),\n\t)\n\n\tsecurity := libp2p.Security(secio.ID, secio.New)\n\n\tlistenAddrs := libp2p.ListenAddrStrings(\n\t\tfmt.Sprintf(\"/ip4/0.0.0.0/tcp/%s\", cfg.Port),\n\t\tfmt.Sprintf(\"/ip4/0.0.0.0/tcp/%s/ws\", cfg.Port),\n\t)\n\n\tvar dht *kaddht.IpfsDHT\n\tnewDHT := func(h host.Host) (routing.PeerRouting, error) {\n\t\tvar err error\n\t\tdht, err = kaddht.New(ctx, h, kaddht.Mode(kaddht.ModeAutoServer))\n\t\treturn dht, err\n\t}\n\trouting := libp2p.Routing(newDHT)\n\n\tpriv := getOrGeneratePrivateKey()\n\n\trelayOption := func() config.Option {\n\t\tif cfg.RelayType == \"hop\" {\n\t\t\treturn libp2p.ChainOptions(libp2p.EnableAutoRelay(), libp2p.EnableRelay(circuit.OptHop), libp2p.AddrsFactory(func(addrs []multiaddr.Multiaddr) []multiaddr.Multiaddr {\n\t\t\t\tfor i, addr0 := range addrs {\n\t\t\t\t\tsaddr := addr0.String()\n\t\t\t\t\tif strings.HasPrefix(saddr, \"/ip4/127.0.0.1\") {\n\t\t\t\t\t\taddrNoIP := strings.TrimPrefix(saddr, \"/ip4/127.0.0.1\")\n\t\t\t\t\t\tlog.Printf(\"result : %d, public: %s \\n\", len(cfg.PublicAddr), cfg.PublicAddr)\n\t\t\t\t\t\tif len(cfg.PublicAddr) == 0 {\n\t\t\t\t\t\t\taddrs[i] = multiaddr.StringCast(\"/dns4/localhost\" + addrNoIP)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taddrs[i] = multiaddr.StringCast(fmt.Sprintf(\"/ip4/%s\", cfg.PublicAddr) + addrNoIP)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn addrs\n\t\t\t}))\n\t\t} else if cfg.RelayType == \"autorelay\" {\n\t\t\treturn libp2p.ChainOptions(libp2p.EnableAutoRelay())\n\t\t}\n\t\treturn func(cfg *config.Config) error { return nil }\n\n\t}\n\n\thost, err := libp2p.New(\n\t\tctx,\n\t\ttransports,\n\t\tlistenAddrs,\n\t\tmuxers,\n\t\tsecurity,\n\t\trouting,\n\t\tlibp2p.Identity(priv),\n\t\trelayOption(),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"my peer is /ip4/127.0.0.1/tcp/%s/ipfs/%s \\n\", cfg.Port, host.ID().Pretty())\n\n\t// 触发搜索autorelay\n\tif cfg.RelayType == \"autorelay\" {\n\t\tgo func() {\n\t\t\tticker := time.NewTicker(time.Second * 5)\n\n\t\t\tfor {\n\t\t\t\trelayHop := make(map[string]struct{})\n\t\t\t\tfor _, p := range host.Peerstore().Peers() {\n\t\t\t\t\taddrs := host.Peerstore().Addrs(p)\n\t\t\t\t\tfor _, addr := range addrs {\n\t\t\t\t\t\tif match, _ := regexp.Match(\"p2p-circuit\", []byte(addr.String())); match {\n\t\t\t\t\t\t\tpeerID := ParseRelayPeerID(addr)\n\t\t\t\t\t\t\trelayHop[peerID] = struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(relayHop) > 0 {\n\t\t\t\t\tlog.Printf(\"Find Relay %v!! \\n\", relayHop)\n\t\t\t\t}\n\t\t\t\tselect {\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\tprivEmitter, _ := host.EventBus().Emitter(new(event.EvtLocalReachabilityChanged))\n\t\t\t\t\tprivEmitter.Emit(event.EvtLocalReachabilityChanged{Reachability: network.ReachabilityPrivate})\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\tps, err := pubsub.NewGossipSub(ctx, host)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsub, err := ps.Subscribe(pubsubTopic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpsh := &PubSubHandler{\n\t\tnode: node,\n\t}\n\tgo psh.pubsubHandler(ctx, sub)\n\n\tfor _, addr := range host.Addrs() {\n\t\tlog.Println(\"Listening on\", addr)\n\t}\n\n\ttargetAddr, err := multiaddr.NewMultiaddr(cfg.Seed)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ttargetInfo, err := peer.AddrInfoFromP2pAddr(targetAddr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = host.Connect(ctx, *targetInfo)\n\tif err != nil {\n\t\tlog.Printf(\"connect to host error: %s \\n\", err)\n\t} else {\n\t\tlog.Println(\"Connected to\", targetInfo.ID)\n\t}\n\n\tmdns, err := discovery.NewMdnsService(ctx, host, time.Second*10, \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmdns.RegisterNotifee(&mdnsNotifee{h: host, ctx: ctx})\n\n\terr = dht.Bootstrap(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprotocol := &StreamNetProtocol{\n\t\tnode: node,\n\t}\n\n\tdonec := make(chan struct{}, 1)\n\tgo protocol.chatInputLoop(ctx, host, ps, donec)\n\n\tstop := make(chan os.Signal, 1)\n\tsignal.Notify(stop, syscall.SIGINT)\n\treturn node, nil\n}", "title": "" }, { "docid": "ec36add5e146edd396cefee0f600914e", "score": "0.5830848", "text": "func (sv *server) peerByNodeId(node_id proto.NodeId) (peer, bool) {\n\tdefer sv.pmtx.RUnlock()\n\tsv.pmtx.RLock()\n\tc, ok := sv.pmap[node_id]\n\treturn c, ok\n}", "title": "" }, { "docid": "97855603daf7e89440e0f3acb9898899", "score": "0.5830066", "text": "func (m *Upstream) GetRRPeer() (*string, error) {\n\tnumTargets := len(m.Targets)\n\n\tif numTargets == 0 {\n\t\treturn nil, errors.New(\"No target present in upstream\")\n\t}\n\n\tpeer := &m.Targets[m.RRcounter % uint(numTargets)]\n\n\t// in case the number of targets got reduced\n\tm.RRcounter++\n\n\treturn peer, nil\n}", "title": "" }, { "docid": "0636b674adaf7b225a96a4c0219c2727", "score": "0.5824522", "text": "func (s *SimulationProtocol) Node(config *onet.SimulationConfig) error {\n\tindex, _ := config.Roster.Search(config.Server.ServerIdentity.ID)\n\tif index < 0 {\n\t\tlog.Fatal(\"Didn't find this node in roster\")\n\t}\n\tlog.Lvl3(\"Initializing node-index\", index)\n\treturn s.SimulationBFTree.Node(config)\n}", "title": "" }, { "docid": "9593c4c9be610d9bc324711347156ef9", "score": "0.5804282", "text": "func (g *dbRoutingTx) sourceNode() route.Vertex {\n\treturn g.source\n}", "title": "" }, { "docid": "d13a0ec8004dd8fc2246eec60821949c", "score": "0.580006", "text": "func (g *Graph) Node(id string) Node {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\tnode := g.node(id)\n\treturn Node{G: G{graph: node}}\n}", "title": "" }, { "docid": "c1c49f475f8d8082800c9973ee4034a7", "score": "0.57690525", "text": "func (_ MutatorEdgeAliases) Node(p graphql.ResolveParams) (interface{}, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\treturn val, err\n}", "title": "" }, { "docid": "2125f755c2b642fbd82d321a74e11aec", "score": "0.5752915", "text": "func (inMsg *inboundMessage) NodeID() ids.ShortID { return inMsg.nodeID }", "title": "" }, { "docid": "c5d7353f493e45b6e1fa7b21aa04e3cf", "score": "0.5743566", "text": "func (p *Plan) Node() bt.Node { return p.bt }", "title": "" }, { "docid": "4f707fc87c0e9d115c0af5f772c1a54c", "score": "0.5734401", "text": "func Node(name string, ipAddress string) *corev1.Node {\n\taddresses := []corev1.NodeAddress{}\n\n\tif ipAddress != \"\" {\n\t\taddresses = append(addresses, corev1.NodeAddress{Type: corev1.NodeExternalIP, Address: ipAddress})\n\t}\n\n\treturn &corev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{Name: name},\n\t\tStatus: corev1.NodeStatus{Addresses: addresses},\n\t}\n}", "title": "" }, { "docid": "fb3cd9354334e7b107b2f3bc410558cd", "score": "0.5732822", "text": "func (mgr *peerManager) getPeer(nodeID int) *Peer {\n\tpeer, ok := mgr.peers[nodeID]\n\tif !ok {\n\t\tutil.Panicln(errorInvalidNodeID)\n\t}\n\n\treturn peer\n}", "title": "" }, { "docid": "297c47b3a4a67ed1072769609124d761", "score": "0.57300586", "text": "func NewNode(listenPort int, priv crypto.PrivKey, pub crypto.PubKey, f *BasicNotifiee) (*NetworkNode, error) {\n\tpid, err := peer.IDFromPublicKey(pub)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstreams := make(map[peer.ID]*BasicStream)\n\n\t// Create a peerstore\n\tstore := peerstore.NewPeerstore()\n\tstore.AddPrivKey(pid, priv)\n\tstore.AddPubKey(pid, pub)\n\n\t// Create multiaddresses. I'm not sure if this is correct in all cases...\n\tuaddrs, err := addrutil.InterfaceAddresses()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taddrs := make([]ma.Multiaddr, len(uaddrs), len(uaddrs))\n\tfor i, uaddr := range uaddrs {\n\t\tportAddr, err := ma.NewMultiaddr(fmt.Sprintf(\"/tcp/%d\", listenPort))\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Error creating portAddr: %v %v\", uaddr, err)\n\t\t\treturn nil, err\n\t\t}\n\t\taddrs[i] = uaddr.Encapsulate(portAddr)\n\t}\n\n\t// Create swarm (implements libP2P Network)\n\tnetwrk, err := swarm.NewNetwork(\n\t\tcontext.Background(),\n\t\taddrs,\n\t\tpid,\n\t\tstore,\n\t\t&BasicReporter{})\n\n\tnetwrk.Notify(f)\n\tbasicHost := bhost.New(netwrk, bhost.NATPortMap)\n\n\tdht, err := constructDHTRouting(context.Background(), basicHost, ds.NewMapDatastore())\n\tif err != nil {\n\t\tglog.Errorf(\"Error constructing DHT: %v\", err)\n\t\treturn nil, err\n\t}\n\trHost := rhost.Wrap(basicHost, dht)\n\n\tglog.V(2).Infof(\"Created node: %v at %v\", peer.IDHexEncode(rHost.ID()), rHost.Addrs())\n\tnn := &NetworkNode{Identity: pid, Kad: dht, PeerHost: rHost, streams: streams}\n\tf.HandleDisconnect(func(pid peer.ID) {\n\t\tnn.RemoveStream(pid)\n\t})\n\n\treturn nn, nil\n}", "title": "" }, { "docid": "af8d0aafee2deee63950c0107bafd445", "score": "0.57297975", "text": "func (d *Dir) Node() Node {\n\treturn d\n}", "title": "" }, { "docid": "c16279fe6ea11f2423d5d4cbf208e100", "score": "0.5715169", "text": "func (b *bucket) findNode(node *node) int {\n\treturn b.peers.IndexOf(node)\n}", "title": "" }, { "docid": "b41b16777a4b38aacc3a514e403a771a", "score": "0.570379", "text": "func (r *Record) Node() uint64 {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn uint64(r.When.UnixNano())\n}", "title": "" }, { "docid": "72e5202762fa583315729a98ee187dd7", "score": "0.569817", "text": "func (r remotePeer) Addr() string {\n\treturn r.addr\n}", "title": "" }, { "docid": "a5d13c8737832546c70630fe905bc390", "score": "0.56824213", "text": "func (_RollupAdminFacet *RollupAdminFacetCallerSession) GetNode(nodeNum *big.Int) (common.Address, error) {\n\treturn _RollupAdminFacet.Contract.GetNode(&_RollupAdminFacet.CallOpts, nodeNum)\n}", "title": "" }, { "docid": "8b98086d45681092b3fedd677596f1de", "score": "0.56492513", "text": "func (s *SimulationCentAuction) Node(config *onet.SimulationConfig) error {\n\tindex, _ := config.Roster.Search(config.Server.ServerIdentity.ID)\n\tif index < 0 {\n\t\tlog.Fatal(\"Didn't find this node in roster\")\n\t}\n\tlog.Lvl3(\"Initializing node-index\", index)\n\treturn s.SimulationBFTree.Node(config)\n}", "title": "" }, { "docid": "93209880de83bc2b84e58c715fb8f5aa", "score": "0.5646004", "text": "func CreateNode(localPort int, remoteAddr *RemoteNode, config *Config) (rp *RaftNode, err error) {\n\tvar r RaftNode\n\trp = &r\n\n\tr.config = config\n\tr.IsShutdown = false\n\n\tvar conn net.Listener\n\t// Initialize network policy\n\tr.NetworkPolicy = NewNetworkPolicy()\n\tr.NetworkPolicy.PauseWorld(false)\n\n\t// Initialize leader specific state\n\tr.commitIndex = 0\n\tr.lastApplied = 0\n\tr.nextIndex = make(map[string]uint64)\n\tr.matchIndex = make(map[string]uint64)\n\n\t// Initialize RPC channels\n\tr.appendEntries = make(chan AppendEntriesMsg)\n\tr.requestVote = make(chan RequestVoteMsg)\n\tr.registerClient = make(chan RegisterClientMsg)\n\tr.clientRequest = make(chan ClientRequestMsg)\n\tr.gracefulExit = make(chan bool)\n\n\t// Initialize state machine (in Puddlestore, you'll switch this with your\n\t// own state machine)\n\tr.stateMachine = new(hashmachine.HashMachine)\n\n\t// Initialize client request cache\n\tr.requestsByCacheId = make(map[string]chan ClientReply)\n\n\t// Open listener on port...\n\tswitch {\n\tcase localPort != 0 && remoteAddr != nil:\n\t\tconn, err = OpenPort(localPort)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\tcase localPort != 0:\n\t\tconn, err = OpenPort(localPort)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\tcase remoteAddr != nil:\n\t\tconn, localPort, err = cs138.OpenListener()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\tconn, localPort, err = cs138.OpenListener()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Create node ID based on listener address\n\tr.Id = AddrToId(conn.Addr().String(), config.NodeIdSize)\n\n\tr.port = localPort\n\tOut.Printf(\"Started node with id:%v, listening at %v\\n\", r.Id, conn.Addr().String())\n\n\t// Initialize stable store\n\tfreshNode, err := r.initStableStore()\n\tif err != nil {\n\t\tError.Printf(\"Error intitializing the stable store: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tr.setRemoteSelf(&RemoteNode{Id: r.Id, Addr: conn.Addr().String()})\n\n\t// Start RPC server\n\tserverOptions := []grpc.ServerOption{}\n\tr.server = grpc.NewServer(serverOptions...)\n\tRegisterRaftRPCServer(r.server, &r)\n\tgo r.server.Serve(conn)\n\n\tif freshNode {\n\t\t// If current node is being newly created (as opposed to being restored\n\t\t// from stable state on disk):\n\t\t// - Connect to remote node if provided and join the cluster\n\t\t// - Else, start a cluster and wait for other nodes to join\n\t\tr.State = JOIN_STATE\n\t\tif remoteAddr != nil {\n\t\t\terr = remoteAddr.JoinRPC(&r)\n\t\t} else {\n\t\t\tOut.Printf(\"Waiting to start cluster until all have joined\\n\")\n\t\t\tgo r.startCluster()\n\t\t}\n\t} else {\n\t\t// If current node is being restored from stable state on disk, start\n\t\t// running it in the follower state.\n\t\tr.State = FOLLOWER_STATE\n\t\tgo r.run()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a490ac18dfa59247d8e522dd3c608666", "score": "0.56454027", "text": "func (o *RemoteTransform) GetRemoteNode() gdnative.NodePath {\n\t//log.Println(\"Calling RemoteTransform.GetRemoteNode()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"RemoteTransform\", \"get_remote_node\")\n\n\t// Call the parent method.\n\t// NodePath\n\tretPtr := gdnative.NewEmptyNodePath()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewNodePathFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "5c4d238b4cdc8885381d6afbd054deb1", "score": "0.56451", "text": "func (a Alias) Node() {}", "title": "" }, { "docid": "d956084ff75a1f592bb9531e3a786667", "score": "0.56444824", "text": "func getNodeForClient(options *ClientOptions) (Node, error) {\n\tif options.Node != nil {\n\t\treturn options.Node, nil\n\t}\n\n\t_ = pq.Driver{}\n\n\tnode, err := Connect(ClientDriver, options.String())\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"makroud: cannot connect to %s server\", ClientDriver)\n\t}\n\n\tnode.SetMaxIdleConns(options.MaxIdleConnections)\n\tnode.SetMaxOpenConns(options.MaxOpenConnections)\n\tnode.EnableSavepoint(options.SavepointEnabled)\n\n\treturn node, nil\n}", "title": "" }, { "docid": "30e171e0cf3bd451d2be0f8921bd8550", "score": "0.5638905", "text": "func randPeer() *Peer {\n\treturn &Peer{\n\t\tKey: cmn.RandStr(12),\n\t\tNodeInfo: &NodeInfo{\n\t\t\tRemoteAddr: cmn.Fmt(\"%v.%v.%v.%v:46656\", rand.Int()%256, rand.Int()%256, rand.Int()%256, rand.Int()%256),\n\t\t\tListenAddr: cmn.Fmt(\"%v.%v.%v.%v:46656\", rand.Int()%256, rand.Int()%256, rand.Int()%256, rand.Int()%256),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "98c4810a93fd551178b722bf28136090", "score": "0.5635258", "text": "func (n Accessor) JsNode() *Node { return n.Node }", "title": "" }, { "docid": "d7ccc69c1ead97b9b32c8515982b2c44", "score": "0.56323427", "text": "func (gc *gethClient) GetNodeURL() *url.URL {\n\treturn gc.host\n}", "title": "" }, { "docid": "f0873067071cd37b95d2def59384b4bc", "score": "0.5625904", "text": "func (s *store) join(n *NodeInfo) (*NodeInfo, error) {\n\ts.mu.RLock()\n\tif s.raftState == nil {\n\t\ts.mu.RUnlock()\n\t\treturn nil, fmt.Errorf(\"store not open\")\n\t}\n\n\tif err := s.raftState.addPeer(n.TCPHost); err != nil {\n\t\ts.mu.RUnlock()\n\t\treturn nil, err\n\t}\n\ts.mu.RUnlock()\n\n\tif err := s.createMetaNode(n.Host, n.TCPHost); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tfor _, node := range s.data.MetaNodes {\n\t\tif node.TCPHost == n.TCPHost && node.Host == n.Host {\n\t\t\treturn &node, nil\n\t\t}\n\t}\n\treturn nil, ErrNodeNotFound\n}", "title": "" }, { "docid": "9b334522c56636ca1ff667d07c46750b", "score": "0.56246847", "text": "func (p *Peer) Addr() string {\n\t// peer.Addr = fmt.Sprintf(\"%s:%d\", peer.Node.Hostname, peer.Node.RPCPort)\n\treturn p.Node.Hostname + \":\" + strconv.Itoa(int(p.Node.RPCPort))\n}", "title": "" }, { "docid": "c97ba0c47091d38b82e13f9c517d25bb", "score": "0.562461", "text": "func (lib *listIteratorBase) Node() *ListNode {\n\treturn lib.node\n}", "title": "" }, { "docid": "b683d053d95b6fa4bd145de07e14a526", "score": "0.56096363", "text": "func (_RollupAdminFacet *RollupAdminFacetCaller) GetNode(opts *bind.CallOpts, nodeNum *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _RollupAdminFacet.contract.Call(opts, &out, \"getNode\", nodeNum)\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "de32f68c8a8525d8d30b27f806ab06f5", "score": "0.5607756", "text": "func (_RollupAdminFacet *RollupAdminFacetSession) GetNode(nodeNum *big.Int) (common.Address, error) {\n\treturn _RollupAdminFacet.Contract.GetNode(&_RollupAdminFacet.CallOpts, nodeNum)\n}", "title": "" }, { "docid": "fbd844459710bc3e874cc1afde17c180", "score": "0.56051046", "text": "func getNode(id uint64) *node {\n\tc := make(chan *node)\n\tnodeReqChan <- nodeRequest{id, c}\n\treturn <-c\n}", "title": "" }, { "docid": "19d75cf18f952cd542b17fd56410b057", "score": "0.5604304", "text": "func (c *Consumer) NodeUUID() string {\n\treturn c.uuid\n}", "title": "" }, { "docid": "6c8f4e97aec80f3a8c92e77dd3abd2fe", "score": "0.5583413", "text": "func (r *Resolver) Node(ctx context.Context, args struct{ ID graphql.ID }) (*NodePayloadResolver, error) {\n\tif err := authenticateUser(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tid, err := stringutils.ToInt32(string(args.ID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnode, err := r.App.GetChains().EVM.GetNode(ctx, id)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn NewNodePayloadResolver(nil, err), nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn NewNodePayloadResolver(&node, nil), nil\n}", "title": "" }, { "docid": "330725a43956eec510229bc8c8c74d48", "score": "0.5576013", "text": "func Node() {\n\t// Use the default test org\n\tclient := Client()\n\n\t// List initial nodes\n\tnodeList, err := client.Nodes.List()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't list nodes: \", err)\n\t}\n\tfmt.Println(\"List initial nodes\", nodeList)\n\n\t// Define a Node object\n\tnode1 := chef.NewNode(\"node1\")\n\tnode1.RunList = []string{\"pwn\"}\n\tnode1.AutomaticAttributes = map[string]interface{}{\n\t\t\"attr\": \"value\",\n\t}\n\tfmt.Printf(\"Define node1 %+v\\n\", node1)\n\n\t// Delete node1 ignoring errors :)\n\terr = client.Nodes.Delete(node1.Name)\n\n\t// Create\n\tnodeResult, err := client.Nodes.Post(node1)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't create node node1. \", err)\n\t}\n\tfmt.Println(\"Added node1\", nodeResult)\n\n\t// List nodes\n\tnodeList, err = client.Nodes.List()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't list nodes: \", err)\n\t}\n\tfmt.Println(\"List nodes after adding node1\", nodeList)\n\n\t// Create a second time\n\tnodeResult, err = client.Nodes.Post(node1)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't recreate node node1. \", err)\n\t}\n\tcerr, err := chef.ChefError(err)\n\tif cerr != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't recreate node node1. \", cerr.StatusCode())\n\t}\n\tfmt.Println(\"Added node1\", nodeResult)\n\n\t// Read node1 information\n\tserverNode, err := client.Nodes.Get(\"node1\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't get node: \", err)\n\t}\n\tfmt.Printf(\"Get node1 %+v\\n\", serverNode)\n\n\t// Check node1 exits\n\terr = client.Nodes.Head(\"node1\")\n\tfmt.Println(\"Head node node1:\", err)\n\n\t// Check nothere exits\n\terr = client.Nodes.Head(\"nothere\")\n\tfmt.Println(\"Head node nothere:\", err)\n\n\t// update node\n\tnode1.RunList = append(node1.RunList, \"recipe[works]\")\n\tnode1.AutomaticAttributes = map[string]interface{}{}\n\tupdateNode, err := client.Nodes.Put(node1)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't update node: \", err)\n\t}\n\tfmt.Println(\"Update node1\", updateNode)\n\n\t// Info after update\n\tserverNode, err = client.Nodes.Get(\"node1\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't get node: \", err)\n\t}\n\tfmt.Printf(\"Get node1 after update %+v\\n\", serverNode)\n\n\t// Delete node ignoring errors :)\n\terr = client.Nodes.Delete(node1.Name)\n\tfmt.Println(\"Delete node1\", err)\n\n\t// List nodes\n\tnodeList, err = client.Nodes.List()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Couldn't list nodes: \", err)\n\t}\n\tfmt.Println(\"List nodes after cleanup\", nodeList)\n}", "title": "" }, { "docid": "aa847a4cdfecc024512b964a97de0d48", "score": "0.55727434", "text": "func (me *ServerNode) GetNodeFor(key Key) *ServerNetworkNode {\n found, _, node := me.Network.Next(key)\n if !found { _, node = me.Network.First() }\n return node.(*ServerNetworkNode)\n}", "title": "" }, { "docid": "2e0fc099a6dbdca19c4328673d5fe00d", "score": "0.55500793", "text": "func NewNode(logger *zap.Logger) *Node {\n\tn := &Node{}\n\n\twhisper := &types.Whispers{}\n\twhisper.PeerOrderChan = make(chan *types.Order)\n\twhisper.ChainOrderChan = make(chan *types.OrderMined)\n\twhisper.EngineOrderChan = make(chan *types.OrderState)\n\n\tn.whisper = whisper\n\tn.logger = logger\n\tn.options = config.LoadConfig()\n\n\tn.registerP2PListener()\n\tn.registerOrderBook()\n\n\treturn n\n}", "title": "" }, { "docid": "74b8f40489f1e0849e5c16700803a65a", "score": "0.55492973", "text": "func (o *NodeDetailsInfoType) NodeOwner() string {\n\tvar r string\n\tif o.NodeOwnerPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.NodeOwnerPtr\n\treturn r\n}", "title": "" }, { "docid": "ac3e620a0136780061b6cde691a0eed9", "score": "0.5546784", "text": "func (n *Node) NodeInfo() p2p.NodeInfo {\n\treturn n.p2pmanager.LocalNodeInfo()\n}", "title": "" }, { "docid": "d85a7ebe2d7e936b79875dede11bbc8a", "score": "0.5545871", "text": "func (c *Cluster) GetNodeId(serverAddr, raftAddr, httpAddr, version string) (*Node, bool, error) {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\tif node := c.FindNodeByAddr(serverAddr); node != nil {\n\t\tlog.Debug(\"node:[%v] start or find\", node)\n\t\t //需要clean up, 然后上线\n\t\tif node.IsLogout() {\n\t\t\treturn node, true, nil\n\t\t}\n\t\treturn node, false, nil\n\t} else {\n\t\tnodeId, err := c.GenId()\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\tn := &metapb.Node{\n\t\t\tId: nodeId,\n\t\t\tServerAddr: serverAddr,\n\t\t\tRaftAddr: raftAddr,\n\t\t\tHttpAddr: httpAddr,\n\t\t\tState: metapb.NodeState_N_Initial,\n\t\t\tVersion: version,\n\t\t}\n\t\tnode = NewNode(n)\n\n\t\terr = c.AddNode(node)\n\t\tif err != nil {\n\t\t\tlog.Error(\"node add err %v\",node)\n\t\t\treturn nil, false, err\n\t\t}\n\t\tlog.Debug(\"node add %v\",node)\n\t\treturn node, false, nil\n\t}\n}", "title": "" }, { "docid": "fb3faa10e42fc29ce47e8ce8185f234b", "score": "0.5539553", "text": "func generateNodeIPAddress() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "43579619c31d594729ae6a2d33b9718d", "score": "0.5534368", "text": "func (p *peer) Name() string {\n\tif !p.hasJoined() {\n\t\treturn \"\"\n\t}\n\n\treturn p.mlist.LocalNode().Name\n}", "title": "" }, { "docid": "b7e505248fc9c24bebd711b0dac51019", "score": "0.5529222", "text": "func getNode() *node {\r\n\r\n\treturn &node{idChild: make([]rune, 0), child: make([]*node, 0), output: make([]string, 0)}\r\n}", "title": "" }, { "docid": "f53ab91e601bf3586dded7a6ebc3d2ca", "score": "0.5523163", "text": "func (n *Node) Parent() *Node { return n.p }", "title": "" }, { "docid": "776e70b757165d56c2f68cca7dc725b7", "score": "0.5502829", "text": "func GetNodePeerList(w http.ResponseWriter, r *http.Request) {\n\tpeerListJSON := peerList.GetPeerListJSON()\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(peerListJSON))\n}", "title": "" }, { "docid": "502c1f1323d5b684d51bb65de7700c04", "score": "0.5502417", "text": "func (s *Self) Node() ast.Node {\n\treturn &ast.Self{}\n}", "title": "" }, { "docid": "76a75ef5d2e9a4c27b3703664180101c", "score": "0.5501777", "text": "func (t *pingRecorder) Self() *qnode.Node { return nullNode }", "title": "" }, { "docid": "7874196ef3135af96e824171c859d66a", "score": "0.5497368", "text": "func (i ID) Node() uint8 {\n\tvar s string\n\tif !strings.Contains(string(i), \".\") {\n\t\tlog.Warningf(\"id %s does not contain \\\".\\\"\\n\", i)\n\t\ts = string(i)\n\t} else {\n\t\ts = strings.Split(string(i), \".\")[1]\n\t}\n\tnode, err := strconv.ParseUint(s, 10, 64)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to convert Node %s to int\\n\", s)\n\t}\n\treturn uint8(node)\n}", "title": "" }, { "docid": "9a9ccbedeeb3b6eb9bebe293255aa237", "score": "0.5483917", "text": "func (ln LocalNode) ToNode() models.Node {\n\treturn models.Node{\n\t\tAddr: ln.Addr,\n\t\tID: ln.ID,\n\t\tPublicKey: ln.server.PrivateKey.Public().(*rsa.PublicKey),\n\t}\n}", "title": "" }, { "docid": "3a50583b46eb21b313bcb61df8fd4869", "score": "0.54758215", "text": "func (l *Log) GetNode() int {\n\treturn l.Node\n}", "title": "" }, { "docid": "d1a16d346017a3497c46bd11f39155ba", "score": "0.547427", "text": "func Node(g *graph.Graph, name string, w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"%s %s\", r.Method, r.URL)\n\n\tn, found := g.Nodes[name]\n\tif name != \"new\" && !found {\n\t\thttp.Error(w, fmt.Sprintf(\"Node %q not found\", name), http.StatusNotFound)\n\t\treturn\n\t}\n\tif n == nil {\n\t\tn = &graph.Node{\n\t\t\tPart: &parts.Code{},\n\t\t}\n\t}\n\n\tvar err error\n\tswitch r.Method {\n\tcase \"POST\":\n\t\terr = handleNodePost(g, n, w, r)\n\tcase \"GET\":\n\t\terr = renderNodeEditor(w, g, n)\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported verb %q\", r.Method)\n\t}\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Could not handle request: %v\", err)\n\t\tlog.Printf(msg)\n\t\thttp.Error(w, msg, http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "8c088ff859c6c1137a06315cad2a7733", "score": "0.5472949", "text": "func (ctx CLIContext) GetNode() (rpcclient.Client, error) {\n\tif ctx.Client == nil {\n\t\treturn nil, errors.New(\"no RPC client defined\")\n\t}\n\n\treturn ctx.Client, nil\n}", "title": "" }, { "docid": "ed0c7e9977891178c037fbd0599078e3", "score": "0.54704547", "text": "func getNodeForRpc(snap *state.StateSnapshot, nodeID string) (*structs.Node, error) {\n\tnode, err := snap.NodeByID(nil, nodeID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif node == nil {\n\t\treturn nil, fmt.Errorf(\"%w %s\", structs.ErrUnknownNode, nodeID)\n\t}\n\n\tif err := nodeSupportsRpc(node); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "d94cef6833a07f2af30db4dc8edbda1f", "score": "0.5464332", "text": "func (s *Store) Node(id string) (uint64, *Node, error) {\n\ttx := s.db.Txn(false)\n\tdefer tx.Abort()\n\n\tidx := maxIndex(tx, \"nodes\")\n\tnode, err := tx.First(\"nodes\", \"id\", id)\n\tif err != nil {\n\t\treturn 0, nil, fmt.Errorf(\"db: node lookup failed: %s\", err)\n\t}\n\tif node != nil {\n\t\treturn idx, node.(*Node), nil\n\t}\n\treturn idx, nil, nil\n}", "title": "" }, { "docid": "320904b2d3753d9ff402221bf5747a1a", "score": "0.54604626", "text": "func (p *pilotClient) node() *core1.Node {\n\treturn &core1.Node{\n\t\tId: makeNodeID(p.options.IP, p.options.AppName, p.options.Namespace),\n\t}\n}", "title": "" }, { "docid": "a93b64bd436ea6503f94f2d87dfc3c1b", "score": "0.545934", "text": "func ActiveNode() string {\n Rip := \"\"\n Nd := ReadSettingFile()\n\n // Looop for nodes\n for _,nd:=range Nd.Nodes{\n if ChekNodeWork(nd.Ip, nd.Port){\n Rip=nd.Ip+\":\"+ nd.Port\n break\n }\n }\n\n return Rip\n}", "title": "" }, { "docid": "a0c4b9f31f98c2ca3efd9b4861ea50c8", "score": "0.5457116", "text": "func (client Client) Node(params *ID) *NodeExec {\n\n\tstack := make([]Instruction, 0)\n\tvar args []GraphQLArg\n\tif params != nil {\n\t\targs = append(args, GraphQLArg{\n\t\t\tName: \"id\",\n\t\t\tKey: \"id\",\n\t\t\tTypeName: \"ID!\",\n\t\t\tValue: *params,\n\t\t})\n\t}\n\n\tstack = append(stack, Instruction{\n\t\tName: \"node\",\n\t\tField: GraphQLField{\n\t\t\tName: \"node\",\n\t\t\tTypeName: \"Node\",\n\t\t\tTypeFields: []string{},\n\t\t},\n\t\tOperation: \"query\",\n\t\tArgs: args,\n\t})\n\n\treturn &NodeExec{\n\t\tclient: client,\n\t\tstack: stack,\n\t}\n}", "title": "" }, { "docid": "61d42da1d87f15ebfd76d8485a72b2fa", "score": "0.5439404", "text": "func (n *Node) Parent() *Node { return n.parent }", "title": "" }, { "docid": "7733647927ddfb64ab36ebbb7f6f334a", "score": "0.5425828", "text": "func (n *node) requirePeer(identity string, endpoint string) (*Peer, error) {\n\tpeer, ok := n.peers[identity]\n\tif !ok {\n\t\t// Purge any previous peer on same endpoint\n\t\tfor _, p := range n.peers {\n\t\t\tpurgePeer(p, endpoint)\n\t\t}\n\n\t\tpeer = NewPeer(n.ctx, identity)\n\t\tn.peers[identity] = peer\n\t\tpeer.origin = n.name\n\t\terr := peer.Connect(n.uuid, endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Handshake discovery by sending HELLO as first message\n\t\tm := NewZreMsg(HelloID)\n\t\tm.Endpoint = n.endpoint\n\t\tm.Status = n.status\n\t\tm.Name = n.name\n\t\tfor key := range n.ownGroups {\n\t\t\tm.Groups = append(m.Groups, key)\n\t\t}\n\t\tfor key, header := range n.headers {\n\t\t\tm.Headers[key] = header\n\t\t}\n\t\tpeer.Send(m)\n\t}\n\treturn peer, nil\n}", "title": "" }, { "docid": "a94252267fed7aac1b7d769e10b85ba6", "score": "0.54211015", "text": "func (n *NodeMsg) toRemoteNode() RemoteNode {\n\tif n == nil {\n\t\treturn RemoteNode{}\n\t}\n\tidVal, err := ParseID(n.Id)\n\tif err != nil {\n\t\treturn RemoteNode{}\n\t}\n\treturn RemoteNode{\n\t\tId: idVal,\n\t\tAddress: n.Address,\n\t}\n}", "title": "" }, { "docid": "1e9b111712d5f9bf56b9d226160aec05", "score": "0.54155767", "text": "func GetNode(csiEndpoint string) (client Node, err error) {\n\tconn, err := util.GetCSIClientConn(csiEndpoint)\n\tif err != nil {\n\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t}\n\n\tc := csi.NewNodeClient(conn)\n\n\treturn Node{client: c}, nil\n}", "title": "" }, { "docid": "297ef55862e71b2c13a9fc9e1acced70", "score": "0.5414348", "text": "func (s *Server) Self() *discover.Node {\n\treturn s.srv.Self()\n}", "title": "" }, { "docid": "56789348fd44c062f57f2bd434eb23a1", "score": "0.5413351", "text": "func (client Client) Node(params ID) *NodeExec {\n\n\tstack := make([]Instruction, 0)\n\tvar args []GraphQLArg\n\n\targs = append(args, GraphQLArg{\n\t\tName: \"id\",\n\t\tKey: \"id\",\n\t\tTypeName: \"ID!\",\n\t\tValue: params,\n\t})\n\n\tstack = append(stack, Instruction{\n\t\tName: \"node\",\n\t\tField: GraphQLField{\n\t\t\tName: \"node\",\n\t\t\tTypeName: \"Node\",\n\t\t\tTypeFields: []string{},\n\t\t},\n\t\tOperation: \"query\",\n\t\tArgs: args,\n\t})\n\n\treturn &NodeExec{\n\t\tclient: client,\n\t\tstack: stack,\n\t}\n}", "title": "" }, { "docid": "c9633c06be2c5e0b5e249985e1f04de6", "score": "0.5404125", "text": "func (ps *peerSet) Peer(id string) *peer {\r\n\tps.lock.RLock()\r\n\tdefer ps.lock.RUnlock()\r\n\r\n\treturn ps.peers[id]\r\n}", "title": "" }, { "docid": "7500508886ab30672ef19163d6e79cb4", "score": "0.5403559", "text": "func (db *nodeDB) node(id NodeID) (node *Node) {\n\t// Start a writable transaction.\n\ttxn := db.lvl.NewTransaction(false)\n\tdefer txn.Discard()\n\n\titem, err := txn.Get(makeKey(id, nodeDBDiscoverRoot))\n\tif err != nil {\n\t\tlog.Error(\"can not find key\", \"key\", item.Key(), \"err\", err)\n\t\treturn nil\n\t}\n\n\tval, err := item.Value()\n\tif err != nil {\n\t\tlog.Error(\"can node find value\", \"key\", item.Key(), \"err\", err)\n\t\treturn nil\n\t}\n\n\tif err := msgpack.Unmarshal(val, node); err != nil {\n\t\tlog.Error(\"Failed to decode node RLP\", \"err\", err)\n\t\treturn nil\n\t}\n\n\tnode.sha = crypto.Keccak256Hash(node.ID[:])\n\treturn node\n}", "title": "" }, { "docid": "1e543e002c0a416fa2b2086196b64c3c", "score": "0.54022676", "text": "func (rn *RemoteNode) GetPredecessor(key *rsa.PrivateKey) (models.Node, error) {\n\t// if connection is nil, create a new connection to the remote node\n\n\tif rn.PublicKey == nil {\n\t\tglog.Infof(\"HERE THE RN HAS NO PUBLIC KEY\")\n\t}\n\n\tif rn.transport == nil {\n\t\tvar err error\n\t\tif rn.transport, err = protocol.NewTransport(\"tcp\", rn.Addr, protocol.NodeType, rn.ID, rn.PublicKey, key); err != nil {\n\t\t\t// we had an error setting up our connection\n\t\t\treturn models.Node{}, errors.Wrap(err, \"failed creating transport: \")\n\t\t}\n\t}\n\t// send request to the remote\n\tresp, err := rn.transport.RoundTrip(&protocol.Request{\n\t\tHeader: protocol.Header{\n\t\t\tFrom: rn.ID,\n\t\t\tFromAddr: rn.Addr,\n\t\t\tType: protocol.NodeType,\n\t\t\tPubKey: rn.PublicKey,\n\t\t},\n\t\tMethod: protocol.GetPredecessorMethod,\n\t})\n\trn.transport.Close()\n\n\tif err != nil {\n\t\treturn models.Node{}, errors.Wrap(err, \"failed round trip: \")\n\t}\n\n\t// decode the response body into a node object\n\tvar (\n\t\tbuf = bytes.NewBuffer(resp.Data)\n\t\tnode = models.Node{}\n\t)\n\tdec := gob.NewDecoder(buf)\n\tif err := dec.Decode(&node); err != nil {\n\t\terrors.Wrap(err, \"failure decoding successor response from body\")\n\t}\n\n\treturn node, nil\n\n}", "title": "" }, { "docid": "698b9780aeb804906b953ea32fd1a685", "score": "0.54006475", "text": "func (n *Node) PeerAdd(pk ppk.PublicKey, addr string) (*peer.Peer, error) {\n\tn.lookup.Lock()\n\tdefer n.lookup.Unlock()\n\n\t// check node is running\n\tif !n.state.isRunning {\n\t\treturn nil, errors.New(\"can't add peer, node is not running\")\n\t}\n\n\t// check if peer already exists\n\tif _, ok := n.lookup.peers[pk]; ok {\n\t\treturn nil, errors.New(\"can't add peer, public key already in use\")\n\t}\n\n\t// create new peer and map it\n\tn.lookup.peers[pk] = peer.NewPeer(pk, addr)\n\n\treturn n.lookup.peers[pk], nil\n}", "title": "" }, { "docid": "3c63d526757d30ef3de9068b0c94e7c4", "score": "0.5398426", "text": "func (s *Server) NodeRPC(w http.ResponseWriter, req *http.Request) {\n\tnode := req.Context().Value(\"node\").(*Node)\n\n\thandler := func(conn *websocket.Conn) {\n\t\tnode.ServeRPC(conn)\n\t}\n\n\twebsocket.Server{Handler: handler}.ServeHTTP(w, req)\n}", "title": "" }, { "docid": "471a9d99ed9aac391e900ada70790ba0", "score": "0.53876454", "text": "func (p *LiqoNodeProvider) GetNode() *corev1.Node {\n\treturn p.node\n}", "title": "" }, { "docid": "d582ca0af8f0ed977948ed4cc3a79e71", "score": "0.5385576", "text": "func (n *Node) Next() *Node {\n return n.next\n}", "title": "" }, { "docid": "1a05a486f886a708bb2cb60e6c43db5f", "score": "0.5382779", "text": "func (n *RemoteNode) toNodeMsg() *NodeMsg {\n\tif n == nil {\n\t\treturn nil\n\t}\n\treturn &NodeMsg{\n\t\tId: n.Id.String(),\n\t\tAddress: n.Address,\n\t}\n}", "title": "" }, { "docid": "b017e7559c5fefb408c11e617000ada8", "score": "0.5380433", "text": "func (c *Card) GetNode() *sprite.Node {\n\treturn c.node\n}", "title": "" }, { "docid": "0101e68f910c2ee309d1696e41bff5f7", "score": "0.5374247", "text": "func Node(n *tree.Node) *StyNode {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tsn, ok := n.Payload.(*StyNode)\n\tif ok {\n\t\treturn sn\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "85f4691173be668df85e4b379449bed7", "score": "0.53729326", "text": "func (c *Client) Peer(ctx context.Context, ip net.IP) (p PeerInfo, err error) {\n\tif err := c.checkInputIP(ip); err != nil {\n\t\treturn p, err\n\t}\n\n\tdat, err := c.lookupTXT(ctx, asLookupString(ip, \"peer\"))\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\tif len(dat) == 5 {\n\t\tp.ASNs = parseASNList(dat[0])\n\t\t_, p.Network, _ = net.ParseCIDR(dat[1])\n\t\tp.Country = dat[2]\n\t\tp.Authority = dat[3]\n\t\tp.Updated, _ = time.Parse(dateFormat, dat[4])\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "2add080f984e893c56921d5b4c66939e", "score": "0.5365414", "text": "func (gc *goslingContext) Node() Node {\n\treturn gc.n\n}", "title": "" }, { "docid": "a01728e1eecc54170e0dcbaf164594fe", "score": "0.5364676", "text": "func peerFromCtx(ctx context.Context) string {\n\tp, ok := peer.FromContext(ctx)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn p.Addr.String()\n}", "title": "" } ]
87e909f48269af49704ed2958492b528
TypeID returns type id in TL schema. See
[ { "docid": "d3128b4401415d0f6cecd36e7745376b", "score": "0.0", "text": "func (*SendMessageGamePlayAction) TypeID() uint32 {\n\treturn SendMessageGamePlayActionTypeID\n}", "title": "" } ]
[ { "docid": "a90e3f3550c8b2fca226452122545c74", "score": "0.76188815", "text": "func (t *Token) TypeID() string {\n return t.Type().ID()\n}", "title": "" }, { "docid": "c1ec67ec92fd49969f38a0d15307e3db", "score": "0.7317309", "text": "func (*LanguagePackInfo) TypeID() uint32 {\n\treturn LanguagePackInfoTypeID\n}", "title": "" }, { "docid": "606ebb9d0423994b14c8debcbdbad1c0", "score": "0.72546583", "text": "func (t *apiType) typeId() string {\n\tt = t.deref()\n\treturn t.Name.String()\n}", "title": "" }, { "docid": "62530e73b5150918016882dc10c90ffa", "score": "0.71942824", "text": "func (*Document) TypeID() uint32 {\n\treturn DocumentTypeID\n}", "title": "" }, { "docid": "7a7ea7da8375f7dae286ee09cc69b823", "score": "0.71701396", "text": "func (*HelpTermsOfService) TypeID() uint32 {\n\treturn HelpTermsOfServiceTypeID\n}", "title": "" }, { "docid": "bfbb2603e98088e2b3f305d844524d0e", "score": "0.7136052", "text": "func TypeNameId(obj *types.TypeName,) string", "title": "" }, { "docid": "e5cbec2cba28b4a60046680ebf442a74", "score": "0.7110531", "text": "func (*InputWallPaperSlug) TypeID() uint32 {\n\treturn InputWallPaperSlugTypeID\n}", "title": "" }, { "docid": "4bea4b8299f4d2175dc19918b8f9eb30", "score": "0.6984721", "text": "func (*LocalizationTargetInfo) TypeID() uint32 {\n\treturn LocalizationTargetInfoTypeID\n}", "title": "" }, { "docid": "7dfd65c62eb8976fa7302572541cd6f0", "score": "0.6943997", "text": "func (t Type) ID() string {\n return TypeToID[t]\n}", "title": "" }, { "docid": "8671c4ac57721afe9fadaeb29d73f593", "score": "0.69253504", "text": "func (b *Block) TypeId() string {\n\treturn b.TypeIdentifier\n}", "title": "" }, { "docid": "31dd642cf61f63c196cb05d881cf0038", "score": "0.6906164", "text": "func (*InputWallPaper) TypeID() uint32 {\n\treturn InputWallPaperTypeID\n}", "title": "" }, { "docid": "656306725a72f1896a791fed1d78aba5", "score": "0.68724096", "text": "func (*LangPackDifference) TypeID() uint32 {\n\treturn LangPackDifferenceTypeID\n}", "title": "" }, { "docid": "891a1c9e00cd4d68425152ae420d26bb", "score": "0.68292254", "text": "func (*Text) TypeID() uint32 {\n\treturn TextTypeID\n}", "title": "" }, { "docid": "aee8f3bf1d3f4d33870c906ca4ae592f", "score": "0.67969316", "text": "func (*StorageStatisticsByFileType) TypeID() uint32 {\n\treturn StorageStatisticsByFileTypeTypeID\n}", "title": "" }, { "docid": "3a0b1a9b7d79f24a180aa99b3eac6a0e", "score": "0.6795763", "text": "func (*Null) TypeID() uint32 {\n\treturn NullTypeID\n}", "title": "" }, { "docid": "8c583e3f105cedae3f53c3e6d3925475", "score": "0.6780236", "text": "func (*InputMessageID) TypeID() uint32 {\n\treturn InputMessageIDTypeID\n}", "title": "" }, { "docid": "19178af884e2385abc25a18302b67490", "score": "0.676557", "text": "func (*CDNPublicKey) TypeID() uint32 {\n\treturn CDNPublicKeyTypeID\n}", "title": "" }, { "docid": "889d3823151244a8f9b9f6b716b74482", "score": "0.67570424", "text": "func (*AuthLoginToken) TypeID() uint32 {\n\treturn AuthLoginTokenTypeID\n}", "title": "" }, { "docid": "d752fdfaade983ab0ca692944d8ede1a", "score": "0.675517", "text": "func (o *ExtendedTransaction) GetTypeId() int32 {\n\tif o == nil || o.TypeId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.TypeId\n}", "title": "" }, { "docid": "ec1f55b493722b55c5a1353e9a7b3661", "score": "0.6738843", "text": "func (m *WatchlisttypeMutation) TypeID() (r int, exists bool) {\n\tv := m._TypeID\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "f1f4101c450724681fe8f8d3ef404323", "score": "0.67166054", "text": "func (o T_Int32) Type() IDType {\r\n\treturn PT__Int32\r\n}", "title": "" }, { "docid": "ba8cf3b19216b1eed350cb6449a037e6", "score": "0.6683293", "text": "func (*AuthSentCodeTypeEmailCode) TypeID() uint32 {\n\treturn AuthSentCodeTypeEmailCodeTypeID\n}", "title": "" }, { "docid": "0db6eb13b907f6581cbcf7d04e19b921", "score": "0.665048", "text": "func (*WebPage) TypeID() uint32 {\n\treturn WebPageTypeID\n}", "title": "" }, { "docid": "0db6eb13b907f6581cbcf7d04e19b921", "score": "0.665048", "text": "func (*WebPage) TypeID() uint32 {\n\treturn WebPageTypeID\n}", "title": "" }, { "docid": "8b842080e798f6a9824804b06d94d7fc", "score": "0.6639428", "text": "func (middleware *CustomMiddlewareProvider) TypeID() amqpmiddleware.ProviderTypeID {\n\treturn \"CustomMiddleware\"\n}", "title": "" }, { "docid": "40c7d17182d6ae43727aa7aab752b66d", "score": "0.66330874", "text": "func (*Call) TypeID() uint32 {\n\treturn CallTypeID\n}", "title": "" }, { "docid": "ba51e88828050c299f4f24f940fa5268", "score": "0.6624499", "text": "func (*SecretChat) TypeID() uint32 {\n\treturn SecretChatTypeID\n}", "title": "" }, { "docid": "366d76fd0f29ba89555f8b2ecd48d371", "score": "0.6619187", "text": "func (*RPCAnswerUnknown) TypeID() uint32 {\n\treturn RPCAnswerUnknownTypeID\n}", "title": "" }, { "docid": "9f3e755b7553f46ce0e4e515fb4227b7", "score": "0.6615453", "text": "func (*DecryptedMessageActionSetMessageTTL) TypeID() uint32 {\n\treturn DecryptedMessageActionSetMessageTTLTypeID\n}", "title": "" }, { "docid": "3d0eb47bcb3775a4c046c43c936c2fe7", "score": "0.65927625", "text": "func (*AuthSentCodeTypeApp) TypeID() uint32 {\n\treturn AuthSentCodeTypeAppTypeID\n}", "title": "" }, { "docid": "3d0eb47bcb3775a4c046c43c936c2fe7", "score": "0.65927625", "text": "func (*AuthSentCodeTypeApp) TypeID() uint32 {\n\treturn AuthSentCodeTypeAppTypeID\n}", "title": "" }, { "docid": "b1460d5c339dd618747b02656eb4fbf4", "score": "0.65885", "text": "func (*StatisticalValue) TypeID() uint32 {\n\treturn StatisticalValueTypeID\n}", "title": "" }, { "docid": "62995da0126c193dd172c0bff7246d93", "score": "0.6586472", "text": "func (*CountryInfo) TypeID() uint32 {\n\treturn CountryInfoTypeID\n}", "title": "" }, { "docid": "59d342d4a9c2ff15986ded22a76670fe", "score": "0.6575948", "text": "func (*ContactsImportedContacts) TypeID() uint32 {\n\treturn ContactsImportedContactsTypeID\n}", "title": "" }, { "docid": "b6d9a1541972c8d219fd385df55c860f", "score": "0.65738314", "text": "func (*File) TypeID() uint32 {\n\treturn FileTypeID\n}", "title": "" }, { "docid": "7ffaaa4829b4b9c0819770526dcfaba4", "score": "0.6564668", "text": "func putAndGetContextTypeID(t *testing.T, store *Store, contextTypeName string) int64 {\n\tt.Helper()\n\n\ttypeID, err := insertContextType(store, &mdpb.ContextType{\n\t\tName: proto.String(contextTypeName),\n\t\tProperties: map[string]mdpb.PropertyType{\"p1\": mdpb.PropertyType_STRING},\n\t})\n\n\tif err != nil {\n\t\tt.Fatalf(\"Cannot create context type: %v\", err)\n\t}\n\n\treturn typeID\n}", "title": "" }, { "docid": "f094c09ee8a09141958e2afa7569cacf", "score": "0.65525067", "text": "func (*True) TypeID() uint32 {\n\treturn TrueTypeID\n}", "title": "" }, { "docid": "c323e87635112adc65547641cf4e655f", "score": "0.6549008", "text": "func (*UserPrivacySettingRuleAllowContacts) TypeID() uint32 {\n\treturn UserPrivacySettingRuleAllowContactsTypeID\n}", "title": "" }, { "docid": "30eed7e062fe8fd33ee7c4b10784dce9", "score": "0.654219", "text": "func (*AuthSentCodeTypeFlashCall) TypeID() uint32 {\n\treturn AuthSentCodeTypeFlashCallTypeID\n}", "title": "" }, { "docid": "30eed7e062fe8fd33ee7c4b10784dce9", "score": "0.654219", "text": "func (*AuthSentCodeTypeFlashCall) TypeID() uint32 {\n\treturn AuthSentCodeTypeFlashCallTypeID\n}", "title": "" }, { "docid": "02ce598196b0a6cfd3d37fc39b338b80", "score": "0.6525789", "text": "func (n NetID) Type() int {\n\treturn int(n[0] >> 5)\n}", "title": "" }, { "docid": "46903c4edb24727299b5889459de6002", "score": "0.65247273", "text": "func (*SendMessageUploadDocumentAction) TypeID() uint32 {\n\treturn SendMessageUploadDocumentActionTypeID\n}", "title": "" }, { "docid": "29381e815c48121669a97a7de618144c", "score": "0.6523729", "text": "func (*MessagesPeerSettings) TypeID() uint32 {\n\treturn MessagesPeerSettingsTypeID\n}", "title": "" }, { "docid": "805fff756f22117cb54f2c04c6334058", "score": "0.6523727", "text": "func (*False) TypeID() uint32 {\n\treturn FalseTypeID\n}", "title": "" }, { "docid": "49701829b0dec4451cb8af507ec2b9e9", "score": "0.65152013", "text": "func (*AuthSentCodeTypeCall) TypeID() uint32 {\n\treturn AuthSentCodeTypeCallTypeID\n}", "title": "" }, { "docid": "49701829b0dec4451cb8af507ec2b9e9", "score": "0.65152013", "text": "func (*AuthSentCodeTypeCall) TypeID() uint32 {\n\treturn AuthSentCodeTypeCallTypeID\n}", "title": "" }, { "docid": "78a86b1f35b09f9a72eec9e7a2686d6c", "score": "0.6512867", "text": "func (*VideoNote) TypeID() uint32 {\n\treturn VideoNoteTypeID\n}", "title": "" }, { "docid": "8ea597341ae1dc3d184a951c401bec67", "score": "0.65086466", "text": "func (o *ViewCalendarEvent) GetTypeId() int32 {\n\tif o == nil || o.TypeId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.TypeId\n}", "title": "" }, { "docid": "8bf37663854d6e87dd0befbc5657026f", "score": "0.65022933", "text": "func (*VideoChat) TypeID() uint32 {\n\treturn VideoChatTypeID\n}", "title": "" }, { "docid": "e1bc410cbd7d0f06d4d6d97a030e5135", "score": "0.64899755", "text": "func (*AccountPasswordSettings) TypeID() uint32 {\n\treturn AccountPasswordSettingsTypeID\n}", "title": "" }, { "docid": "557747b1f6d4e60bfd9ebd915640c712", "score": "0.64810294", "text": "func (*StoryViewers) TypeID() uint32 {\n\treturn StoryViewersTypeID\n}", "title": "" }, { "docid": "06bb0bfbec9c8847376779fc9c994f40", "score": "0.6474358", "text": "func (*AccountThemes) TypeID() uint32 {\n\treturn AccountThemesTypeID\n}", "title": "" }, { "docid": "5b171ad9272543f7f2d2b3c294dc1855", "score": "0.64711624", "text": "func (x *X509Identity) idType() string {\n\treturn x509Type\n}", "title": "" }, { "docid": "85b7a6e7dffe0b6843f23262dc5b3bf1", "score": "0.64660054", "text": "func (*MessagesHistoryImportParsed) TypeID() uint32 {\n\treturn MessagesHistoryImportParsedTypeID\n}", "title": "" }, { "docid": "5b6882d8b372e68c13e41560ee8959c4", "score": "0.645917", "text": "func (*SetTdlibParametersRequest) TypeID() uint32 {\n\treturn SetTdlibParametersRequestTypeID\n}", "title": "" }, { "docid": "009fb1d6a6443b4c53a95178ab3e1fdc", "score": "0.6454047", "text": "func (*PaymentsSavedInfo) TypeID() uint32 {\n\treturn PaymentsSavedInfoTypeID\n}", "title": "" }, { "docid": "7349450be04772b4f18d9110b0d707c4", "score": "0.64522266", "text": "func TypeStringToPhysicalID(tp string) int {\n\tswitch tp {\n\tcase TypeSel:\n\t\treturn typeSelID\n\tcase TypeSet:\n\t\treturn typeSetID\n\tcase TypeProj:\n\t\treturn typeProjID\n\tcase TypeAgg:\n\t\treturn typeAggID\n\tcase TypeStreamAgg:\n\t\treturn typeStreamAggID\n\tcase TypeHashAgg:\n\t\treturn typeHashAggID\n\tcase TypeShow:\n\t\treturn typeShowID\n\tcase TypeJoin:\n\t\treturn typeJoinID\n\tcase TypeUnion:\n\t\treturn typeUnionID\n\tcase TypePartitionUnion:\n\t\treturn typePartitionUnionID\n\tcase TypeTableScan:\n\t\treturn typeTableScanID\n\tcase TypeMemTableScan:\n\t\treturn typeMemTableScanID\n\tcase TypeUnionScan:\n\t\treturn typeUnionScanID\n\tcase TypeIdxScan:\n\t\treturn typeIdxScanID\n\tcase TypeSort:\n\t\treturn typeSortID\n\tcase TypeTopN:\n\t\treturn typeTopNID\n\tcase TypeLimit:\n\t\treturn typeLimitID\n\tcase TypeHashJoin:\n\t\treturn typeHashJoinID\n\tcase TypeMergeJoin:\n\t\treturn typeMergeJoinID\n\tcase TypeIndexJoin:\n\t\treturn typeIndexJoinID\n\tcase TypeIndexMergeJoin:\n\t\treturn typeIndexMergeJoinID\n\tcase TypeIndexHashJoin:\n\t\treturn typeIndexHashJoinID\n\tcase TypeApply:\n\t\treturn typeApplyID\n\tcase TypeMaxOneRow:\n\t\treturn typeMaxOneRowID\n\tcase TypeExists:\n\t\treturn typeExistsID\n\tcase TypeDual:\n\t\treturn typeDualID\n\tcase TypeLock:\n\t\treturn typeLockID\n\tcase TypeInsert:\n\t\treturn typeInsertID\n\tcase TypeUpdate:\n\t\treturn typeUpdateID\n\tcase TypeDelete:\n\t\treturn typeDeleteID\n\tcase TypeIndexLookUp:\n\t\treturn typeIndexLookUpID\n\tcase TypeTableReader:\n\t\treturn typeTableReaderID\n\tcase TypeIndexReader:\n\t\treturn typeIndexReaderID\n\tcase TypeWindow:\n\t\treturn typeWindowID\n\tcase TypeShuffle:\n\t\treturn typeShuffleID\n\tcase TypeShuffleReceiver:\n\t\treturn typeShuffleReceiverID\n\tcase TypeTiKVSingleGather:\n\t\treturn typeTiKVSingleGatherID\n\tcase TypeIndexMerge:\n\t\treturn typeIndexMergeID\n\tcase TypePointGet:\n\t\treturn typePointGet\n\tcase TypeShowDDLJobs:\n\t\treturn typeShowDDLJobs\n\tcase TypeBatchPointGet:\n\t\treturn typeBatchPointGet\n\tcase TypeClusterMemTableReader:\n\t\treturn typeClusterMemTableReader\n\tcase TypeDataSource:\n\t\treturn typeDataSourceID\n\tcase TypeLoadData:\n\t\treturn typeLoadDataID\n\tcase TypeTableSample:\n\t\treturn typeTableSampleID\n\tcase TypeTableFullScan:\n\t\treturn typeTableFullScanID\n\tcase TypeTableRangeScan:\n\t\treturn typeTableRangeScanID\n\tcase TypeTableRowIDScan:\n\t\treturn typeTableRowIDScanID\n\tcase TypeIndexFullScan:\n\t\treturn typeIndexFullScanID\n\tcase TypeIndexRangeScan:\n\t\treturn typeIndexRangeScanID\n\tcase TypeExchangeReceiver:\n\t\treturn typeExchangeReceiverID\n\tcase TypeExchangeSender:\n\t\treturn typeExchangeSenderID\n\tcase TypeCTE:\n\t\treturn typeCTEID\n\tcase TypeCTEDefinition:\n\t\treturn typeCTEDefinitionID\n\tcase TypeCTETable:\n\t\treturn typeCTETableID\n\tcase TypeForeignKeyCheck:\n\t\treturn typeForeignKeyCheck\n\tcase TypeForeignKeyCascade:\n\t\treturn typeForeignKeyCascade\n\tcase TypeExpand:\n\t\treturn typeExpandID\n\tcase TypeImportInto:\n\t\treturn typeImportIntoID\n\tcase TypeScalarSubQuery:\n\t\treturn TypeScalarSubQueryID\n\t}\n\t// Should never reach here.\n\treturn 0\n}", "title": "" }, { "docid": "020f7b88bb8e66912a34e032c50c46c6", "score": "0.64472306", "text": "func (*InputWallPaperNoFile) TypeID() uint32 {\n\treturn InputWallPaperNoFileTypeID\n}", "title": "" }, { "docid": "1ce9ccc00db63515d6943f049fb21873", "score": "0.6439205", "text": "func (*DocumentEmpty) TypeID() uint32 {\n\treturn DocumentEmptyTypeID\n}", "title": "" }, { "docid": "c15303d8ee4675928c01b298cba7557d", "score": "0.643384", "text": "func (*MessageCalendar) TypeID() uint32 {\n\treturn MessageCalendarTypeID\n}", "title": "" }, { "docid": "700fe99062d9c13730b5bbb37a6a814f", "score": "0.64319843", "text": "func (*SetChatDescriptionRequest) TypeID() uint32 {\n\treturn SetChatDescriptionRequestTypeID\n}", "title": "" }, { "docid": "fbe52bfcc09b2757b688f7911a6a4851", "score": "0.641779", "text": "func (*StoryArea) TypeID() uint32 {\n\treturn StoryAreaTypeID\n}", "title": "" }, { "docid": "11da763721df56dde9e3afe0a45af528", "score": "0.6406407", "text": "func (*InputChatPhotoStatic) TypeID() uint32 {\n\treturn InputChatPhotoStaticTypeID\n}", "title": "" }, { "docid": "5fc74b14239b1ca399ffb4493e191646", "score": "0.6401148", "text": "func (tr *TypeRegistry) ID() Type {\n\treturn tr.MustGet(T_ID)\n}", "title": "" }, { "docid": "09da723da8ef8d1f11a53699228a2dbd", "score": "0.6400498", "text": "func (*SendMessageTypingAction) TypeID() uint32 {\n\treturn SendMessageTypingActionTypeID\n}", "title": "" }, { "docid": "3a6385cfcc52fff86355beb2a60f159b", "score": "0.6396943", "text": "func (node *TInt) TypeName() string { return node.Name }", "title": "" }, { "docid": "519d7fca4a4322cf9020e1fe2235d3b1", "score": "0.63939995", "text": "func (*HelpCountriesList) TypeID() uint32 {\n\treturn HelpCountriesListTypeID\n}", "title": "" }, { "docid": "f0833a0d6ea60b7c8a4ca07db7d68533", "score": "0.6385528", "text": "func (m *FileMutation) TypeID() (id string, exists bool) {\n\tif m._type != nil {\n\t\treturn *m._type, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "fdf11d9685edc65372834ce106d015a8", "score": "0.63834184", "text": "func (*FilePart) TypeID() uint32 {\n\treturn FilePartTypeID\n}", "title": "" }, { "docid": "fa523fc773ef01c65215108db9890de4", "score": "0.6378466", "text": "func (*AuthLoginTokenSuccess) TypeID() uint32 {\n\treturn AuthLoginTokenSuccessTypeID\n}", "title": "" }, { "docid": "71a8818810aa7ddd36b1f0b049460962", "score": "0.6378062", "text": "func (*AuthSentCodeTypeFirebaseSMS) TypeID() uint32 {\n\treturn AuthSentCodeTypeFirebaseSMSTypeID\n}", "title": "" }, { "docid": "8f6b41a0f3e327ff364d1d327300b3af", "score": "0.6361752", "text": "func (*AuthLoginTokenMigrateTo) TypeID() uint32 {\n\treturn AuthLoginTokenMigrateToTypeID\n}", "title": "" }, { "docid": "75042ef13e7830b1741f514005243e4c", "score": "0.6359747", "text": "func (*IPPortSecret) TypeID() uint32 {\n\treturn IPPortSecretTypeID\n}", "title": "" }, { "docid": "69bf50bd1765f6d4764f9f99fbe4da43", "score": "0.6353952", "text": "func (*InputMessageID) TypeName() string {\n\treturn \"inputMessageID\"\n}", "title": "" }, { "docid": "4a18f3a963a7019d3d0891b4fdecfbae", "score": "0.6346029", "text": "func TypeId(v uint) predicate.K8sMetric {\n\treturn predicate.K8sMetric(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTypeId), v))\n\t})\n}", "title": "" }, { "docid": "c1a5879a72ed12853879d5bbe8d527bd", "score": "0.6343322", "text": "func (*DownloadedFileCounts) TypeID() uint32 {\n\treturn DownloadedFileCountsTypeID\n}", "title": "" }, { "docid": "8ade15335f676aa59ee33bd94074f967", "score": "0.63290393", "text": "func (*LogStreamFile) TypeID() uint32 {\n\treturn LogStreamFileTypeID\n}", "title": "" }, { "docid": "e5a7e7fd839f8362068e44ec2f4ba6d7", "score": "0.6326922", "text": "func (*AuthenticationCodeTypeFlashCall) TypeID() uint32 {\n\treturn AuthenticationCodeTypeFlashCallTypeID\n}", "title": "" }, { "docid": "6f4f711e344ee1a6d731e3cd6766712b", "score": "0.63249415", "text": "func (*LangpackGetDifferenceRequest) TypeID() uint32 {\n\treturn LangpackGetDifferenceRequestTypeID\n}", "title": "" }, { "docid": "a767bd9f24766a71045a14e966b298ee", "score": "0.63232344", "text": "func (*ChatEventLogFilters) TypeID() uint32 {\n\treturn ChatEventLogFiltersTypeID\n}", "title": "" }, { "docid": "9f0ef5261252853ff6e31335bd31ff18", "score": "0.6322452", "text": "func (*DecryptedMessageActionTyping) TypeID() uint32 {\n\treturn DecryptedMessageActionTypingTypeID\n}", "title": "" }, { "docid": "1612b823db5c84985157409bd6bcf77e", "score": "0.6321647", "text": "func (*ChatMembersFilterContacts) TypeID() uint32 {\n\treturn ChatMembersFilterContactsTypeID\n}", "title": "" }, { "docid": "acffab8a895870c0c85ee17325a6e449", "score": "0.6315145", "text": "func (*AuthenticationCodeTypeSMS) TypeID() uint32 {\n\treturn AuthenticationCodeTypeSMSTypeID\n}", "title": "" }, { "docid": "d06662a2bc3fc8909abd3c55738c3854", "score": "0.631425", "text": "func (*AuthenticationCodeTypeFragment) TypeID() uint32 {\n\treturn AuthenticationCodeTypeFragmentTypeID\n}", "title": "" }, { "docid": "714680426d36c80a21b8dcf0bcc8a1bd", "score": "0.6312623", "text": "func (*AuthCancelCodeRequest) TypeID() uint32 {\n\treturn AuthCancelCodeRequestTypeID\n}", "title": "" }, { "docid": "0d710a978575f6e56c480fda13262f90", "score": "0.6312063", "text": "func (*AuthSentCodeTypeSMS) TypeID() uint32 {\n\treturn AuthSentCodeTypeSMSTypeID\n}", "title": "" }, { "docid": "0d710a978575f6e56c480fda13262f90", "score": "0.6312063", "text": "func (*AuthSentCodeTypeSMS) TypeID() uint32 {\n\treturn AuthSentCodeTypeSMSTypeID\n}", "title": "" }, { "docid": "b2d5e70a1708ee39931d0ba72af76bc9", "score": "0.6310231", "text": "func (*AuthSentCodeTypeSetUpEmailRequired) TypeID() uint32 {\n\treturn AuthSentCodeTypeSetUpEmailRequiredTypeID\n}", "title": "" }, { "docid": "fc7d37bc9fca0ffafb62c84251c4ca79", "score": "0.6306248", "text": "func (t *OpenconfigSystem_System_Alarms_Alarm_State) GetTypeId() OpenconfigSystem_System_Alarms_Alarm_State_TypeId_Union {\n\tif t == nil || t.TypeId == nil {\n\t\treturn nil\n\t}\n\treturn t.TypeId\n}", "title": "" }, { "docid": "b59e9476aeaabdbc152a5928e7e9be9a", "score": "0.63035977", "text": "func (*StoriesUserStories) TypeID() uint32 {\n\treturn StoriesUserStoriesTypeID\n}", "title": "" }, { "docid": "9668872cf93d059915af76205d699335", "score": "0.63009316", "text": "func (*AccountThemesNotModified) TypeID() uint32 {\n\treturn AccountThemesNotModifiedTypeID\n}", "title": "" }, { "docid": "5a3539ce7332e9e6115e353096d13f0a", "score": "0.6295295", "text": "func (*ChannelAdminLogEventActionPinTopic) TypeID() uint32 {\n\treturn ChannelAdminLogEventActionPinTopicTypeID\n}", "title": "" }, { "docid": "f482e1667177351dafcbd0395e05d519", "score": "0.6291349", "text": "func (*RPCAnswerDroppedRunning) TypeID() uint32 {\n\treturn RPCAnswerDroppedRunningTypeID\n}", "title": "" }, { "docid": "19fbee0936557524ecaea023b2c7f3bb", "score": "0.6290786", "text": "func (*BankCardOpenURL) TypeID() uint32 {\n\treturn BankCardOpenURLTypeID\n}", "title": "" }, { "docid": "e4d679cf05ae42c22b6e75be1c8db815", "score": "0.6286816", "text": "func (*PasswordKdfAlgoUnknown) TypeID() uint32 {\n\treturn PasswordKdfAlgoUnknownTypeID\n}", "title": "" }, { "docid": "7995997c9a278c990d2fd99955b2c53c", "score": "0.62853944", "text": "func (*HelpCountriesListNotModified) TypeID() uint32 {\n\treturn HelpCountriesListNotModifiedTypeID\n}", "title": "" }, { "docid": "d06270468b75135d01a8ad08692489ad", "score": "0.6276459", "text": "func (*TestUseConfigSimpleRequest) TypeID() uint32 {\n\treturn TestUseConfigSimpleRequestTypeID\n}", "title": "" }, { "docid": "750838cd347fe0a49245f84701bc44c0", "score": "0.62595546", "text": "func (*UserPrivacySettingRuleRestrictContacts) TypeID() uint32 {\n\treturn UserPrivacySettingRuleRestrictContactsTypeID\n}", "title": "" }, { "docid": "00916d4118e43ac614bab0098dc36442", "score": "0.625349", "text": "func (*SetUserPrivacySettingRulesRequest) TypeID() uint32 {\n\treturn SetUserPrivacySettingRulesRequestTypeID\n}", "title": "" }, { "docid": "a38200a12ef5eecfbffc963b386ac625", "score": "0.62510926", "text": "func (*ChatEvent) TypeID() uint32 {\n\treturn ChatEventTypeID\n}", "title": "" }, { "docid": "12b83448da275ff1edec8ee4012a0a1d", "score": "0.62503713", "text": "func (*GetMessageLinkRequest) TypeID() uint32 {\n\treturn GetMessageLinkRequestTypeID\n}", "title": "" } ]
e07774efd4d1a239a2d60abc55d9dc90
promoteCatalog swaps the labels on the update pod so that the update pod is now reachable by the catalog service. By updating the catalog on cluster it promotes the update pod to act as the new version of the catalog oncluster.
[ { "docid": "c2fe9788882eb039eb87a2dc3285f176", "score": "0.79548377", "text": "func (c *GrpcRegistryReconciler) promoteCatalog(updatePod *corev1.Pod, key string) error {\n\t// Update the update pod to promote it to serving pod via the SSA client\n\terr := c.SSAClient.Apply(context.TODO(), updatePod, func(p *corev1.Pod) error {\n\t\tp.Labels[CatalogSourceLabelKey] = key\n\t\tp.Labels[CatalogSourceUpdateKey] = \"\"\n\t\treturn nil\n\t})()\n\n\treturn err\n}", "title": "" } ]
[ { "docid": "3bb7fc731669b57a56566384504d67f2", "score": "0.5811799", "text": "func Promote(rolloutName string, namespace string) (string, error) {\n\treturn executeCommand(\"kubectl\",\n\t\t[]string{\"argo\", \"rollouts\", \"promote\", rolloutName, \"-n\", namespace})\n}", "title": "" }, { "docid": "b8285316868adc55b9e05913fbf54a11", "score": "0.5338856", "text": "func (c *GrpcRegistryReconciler) ensureUpdatePod(source grpcCatalogSourceDecorator, saName string) error {\n\tif !source.Poll() {\n\t\treturn nil\n\t}\n\n\tcurrentLivePods := c.currentPods(source)\n\tcurrentUpdatePods := c.currentUpdatePods(source)\n\n\tif source.Update() && len(currentUpdatePods) == 0 {\n\t\tlogrus.WithField(\"CatalogSource\", source.GetName()).Debugf(\"catalog update required at %s\", time.Now().String())\n\t\tpod, err := c.createUpdatePod(source, saName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"creating update catalog source pod\")\n\t\t}\n\t\tsource.SetLastUpdateTime()\n\t\treturn UpdateNotReadyErr{catalogName: source.GetName(), podName: pod.GetName()}\n\t}\n\n\t// check if update pod is ready - if not requeue the sync\n\t// if update pod failed (potentially due to a bad catalog image) delete it\n\tfor _, p := range currentUpdatePods {\n\t\tfail, err := c.podFailed(p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif fail {\n\t\t\treturn fmt.Errorf(\"update pod %s in a %s state: deleted update pod\", p.GetName(), p.Status.Phase)\n\t\t}\n\t\tif !podReady(p) {\n\t\t\treturn UpdateNotReadyErr{catalogName: source.GetName(), podName: p.GetName()}\n\t\t}\n\t}\n\n\tfor _, updatePod := range currentUpdatePods {\n\t\t// if container imageID IDs are different, switch the serving pods\n\t\tif imageChanged(updatePod, currentLivePods) {\n\t\t\terr := c.promoteCatalog(updatePod, source.GetName())\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"detected imageID change: error during update: %s\", err)\n\t\t\t}\n\t\t\t// remove old catalog source pod\n\t\t\terr = c.removePods(currentLivePods, source.GetNamespace())\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"detected imageID change: error deleting old catalog source pod\")\n\t\t\t}\n\t\t\t// done syncing\n\t\t\tlogrus.WithField(\"CatalogSource\", source.GetName()).Infof(\"detected imageID change: catalogsource pod updated at %s\", time.Now().String())\n\t\t\treturn nil\n\t\t}\n\t\t// delete update pod right away, since the digest match, to prevent long-lived duplicate catalog pods\n\t\tlogrus.WithField(\"CatalogSource\", source.GetName()).Debug(\"catalog polling result: no update\")\n\t\terr := c.removePods([]*corev1.Pod{updatePod}, source.GetNamespace())\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"error deleting duplicate catalog polling pod: %s\", updatePod.GetName())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a48ddd3e6702105fa532cbc6b479dd20", "score": "0.5196006", "text": "func UpdateCatalogTest(olmClient *olmclient.Clientset, f *framework.Framework, ctx *framework.TestCtx) error {\n\tnamespace, err := ctx.GetNamespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\tmetaOperatorInstance := &operator.ManagementIngressOperatorCatalog{}\n\tfmt.Println(\"--- UPDATE: ManagementIngressOperator\")\n\n\t// Get ManagementIngressOperatorCatalog instance\n\terr = f.Client.Get(goctx.TODO(), types.NamespacedName{Name: config.CatalogCrName, Namespace: namespace}, metaOperatorInstance)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmetaOperatorInstance.Spec.Operators[0].Channel = \"clusterwide-alpha\"\n\terr = f.Client.Update(goctx.TODO(), metaOperatorInstance)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// wait for updated csv ready\n\toptMap, err := GetOperators(f, namespace)\n\tif err != nil {\n\t\treturn err\n\t}\n\topt := optMap[metaOperatorInstance.Spec.Operators[0].Name]\n\terr = WaitForSubCsvReady(olmClient, metav1.ObjectMeta{Name: opt.Name, Namespace: opt.Namespace})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e8d04db4424cbdcc788529882f5709f", "score": "0.50673705", "text": "func catalogToUpdate(consul BigIp, bigip BigIp) BigIp{\n\tbigipUpd := BigIp{}\n\tfor _, key := range consul.Pools {\n\t\tif bigip.existsPool(key.Name){ \n\t \tbigipUpd.AddPoolItem(key)\n\t\t}\n\t}\n\treturn bigipUpd\n}", "title": "" }, { "docid": "e24ab4e211413724195c46c91286827c", "score": "0.5067136", "text": "func (svc *Service) UpdateCatalog(_ context.Context, req *orchestrator.UpdateCatalogRequest) (res *orchestrator.Catalog, err error) {\n\t// Validate request\n\terr = service.ValidateRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres = req.Catalog\n\n\terr = svc.storage.Update(res, \"id = ?\", res.Id)\n\n\tif err != nil && errors.Is(err, persistence.ErrRecordNotFound) {\n\t\treturn nil, status.Error(codes.NotFound, \"catalog not found\")\n\t} else if err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"database error: %v\", err)\n\t}\n\n\tlogging.LogRequest(log, logrus.DebugLevel, logging.Update, req)\n\n\treturn\n}", "title": "" }, { "docid": "e62c5e448afc17b5d7dc59e5a2904ea2", "score": "0.5029196", "text": "func (m *Main) Promote() error {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tm.logger.Printf(\"attempting promotion\")\n\n\t// Request the leader joins us to the cluster.\n\tm.logger.Println(\"requesting leader join us to cluster\")\n\ttargetLogIndex, err := discoverd.DefaultClient.RaftAddPeer(m.advertiseAddr)\n\tif err != nil {\n\t\tm.logger.Println(\"error requesting leader to join us to cluster:\", err)\n\t\treturn err\n\t}\n\n\t// Open the store.\n\tif m.store == nil {\n\t\tif err := m.openStore(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Wait for leadership.\n\t\tif err := m.waitForLeader(60 * time.Second); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Wait for store to catchup\n\t\tfor m.store.LastIndex() < targetLogIndex.LastIndex {\n\t\t\tm.logger.Println(\"Waiting for store to catchup, current:\", m.store.LastIndex(), \"target:\", targetLogIndex.LastIndex)\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t}\n\t}\n\n\t// Update the DNS server to use the local store.\n\tif m.dnsServer != nil {\n\t\tm.dnsServer.SetStore(m.store)\n\t}\n\n\t// Update the HTTP server to use the local store.\n\tm.handler.Store = m.store\n\tm.handler.Proxy.Store(false)\n\n\tm.logger.Println(\"promoted successfully\")\n\treturn nil\n}", "title": "" }, { "docid": "6ae42d9557e9d90afd1d0becff15a09a", "score": "0.49641463", "text": "func (provisioner *KopsProvisioner) UpgradeCluster(cluster *model.Cluster) error {\n\tlogger := provisioner.logger.WithField(\"cluster\", cluster.ID)\n\n\tkopsMetadata := cluster.ProvisionerMetadataKops\n\n\terr := kopsMetadata.ValidateChangeRequest()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"KopsMetadata ChangeRequest failed validation\")\n\t}\n\n\tif kopsMetadata.ChangeRequest.AMI != \"\" && kopsMetadata.ChangeRequest.AMI != \"latest\" {\n\t\tvar isAMIValid bool\n\t\tisAMIValid, err = provisioner.awsClient.IsValidAMI(kopsMetadata.ChangeRequest.AMI, logger)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"error checking the AWS AMI image %s\", kopsMetadata.ChangeRequest.AMI)\n\t\t}\n\t\tif !isAMIValid {\n\t\t\treturn errors.Errorf(\"invalid AWS AMI image %s\", kopsMetadata.ChangeRequest.AMI)\n\t\t}\n\t}\n\n\tkops, err := kops.New(provisioner.params.S3StateStore, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create kops wrapper\")\n\t}\n\tdefer kops.Close()\n\n\tswitch kopsMetadata.ChangeRequest.Version {\n\tcase \"\":\n\t\tlogger.Info(\"Skipping kubernetes cluster version update\")\n\tcase \"latest\":\n\t\tlogger.Info(\"Updating kubernetes to latest stable version\")\n\t\terr = kops.UpgradeCluster(kopsMetadata.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\tlogger.Infof(\"Updating kubernetes to version %s\", kopsMetadata.ChangeRequest.Version)\n\t\tsetValue := fmt.Sprintf(\"spec.kubernetesVersion=%s\", kopsMetadata.ChangeRequest.Version)\n\t\terr = kops.SetCluster(kopsMetadata.Name, setValue)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = updateKopsInstanceGroupAMIs(kops, kopsMetadata, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to update kops instance group AMIs\")\n\t}\n\n\t// TODO: read from config file\n\t// TODO: check if those configs are already or remove this when we update all clusters\n\tlogger.Info(\"Updating kubelet options\")\n\n\tsetValue := \"spec.kubelet.authenticationTokenWebhook=true\"\n\terr = kops.SetCluster(kopsMetadata.Name, setValue)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to set %s\", setValue)\n\t}\n\tsetValue = \"spec.kubelet.authorizationMode=Webhook\"\n\terr = kops.SetCluster(kopsMetadata.Name, setValue)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to set %s\", setValue)\n\t}\n\tif kopsMetadata.ChangeRequest.MaxPodsPerNode != 0 {\n\t\tlogger.Infof(\"Updating max pods per node to %d\", kopsMetadata.ChangeRequest.MaxPodsPerNode)\n\t\tsetValue = fmt.Sprintf(\"spec.kubelet.maxPods=%d\", kopsMetadata.ChangeRequest.MaxPodsPerNode)\n\t\terr = kops.SetCluster(kopsMetadata.Name, setValue)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to set %s\", setValue)\n\t\t}\n\t}\n\n\terr = kops.UpdateCluster(kopsMetadata.Name, kops.GetOutputDirectory())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = provisioner.awsClient.FixSubnetTagsForVPC(kopsMetadata.VPC, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tterraformClient, err := terraform.New(kops.GetOutputDirectory(), provisioner.params.S3StateStore, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer terraformClient.Close()\n\n\terr = terraformClient.Init(kopsMetadata.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = verifyTerraformAndKopsMatch(kopsMetadata.Name, terraformClient, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Info(\"Upgrading cluster\")\n\n\terr = terraformClient.Plan()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = terraformClient.Apply()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif cluster.ProvisionerMetadataKops.RotatorRequest.Config != nil {\n\t\tif *cluster.ProvisionerMetadataKops.RotatorRequest.Config.UseRotator {\n\t\t\tlogger.Info(\"Using node rotator for node upgrade\")\n\t\t\terr = provisioner.RotateClusterNodes(cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\terr = kops.RollingUpdateCluster(kopsMetadata.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = attachPolicyRoles(cluster, provisioner.awsClient, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to attach policy roles to cluster\")\n\t}\n\n\t// TODO: Rework this as we make the API calls asynchronous.\n\twait := 1000\n\tif wait > 0 {\n\t\tlogger.Infof(\"Waiting up to %d seconds for k8s cluster to become ready...\", wait)\n\t\terr = kops.WaitForKubernetesReadiness(kopsMetadata.Name, wait)\n\t\tif err != nil {\n\t\t\t// Run non-silent validate one more time to log final cluster state\n\t\t\t// and return original timeout error.\n\t\t\tkops.ValidateCluster(kopsMetadata.Name, false)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlogger.Info(\"Successfully upgraded cluster\")\n\n\treturn nil\n}", "title": "" }, { "docid": "31db7b68ed961ed69be652460e4f0441", "score": "0.49413407", "text": "func (c *GrpcRegistryReconciler) createUpdatePod(source grpcCatalogSourceDecorator, saName string) (*corev1.Pod, error) {\n\t// remove label from pod to ensure service does not accidentally route traffic to the pod\n\tp := source.Pod(saName)\n\tp = swapLabels(p, \"\", source.Name)\n\n\tpod, err := c.OpClient.KubernetesInterface().CoreV1().Pods(source.GetNamespace()).Create(context.TODO(), p, metav1.CreateOptions{})\n\tif err != nil {\n\t\tlogrus.WithField(\"pod\", source.Pod(saName).GetName()).Warn(\"couldn't create new catalogsource pod\")\n\t\treturn nil, err\n\t}\n\n\treturn pod, nil\n}", "title": "" }, { "docid": "99cef3a3602a80ac668041936cfc8538", "score": "0.49407056", "text": "func (c *CVCController) updateCVCWithScaledUpInfo(cvc *apis.CStorVolumeConfig,\n\tcvObj *apis.CStorVolume) (*apis.CStorVolumeConfig, error) {\n\tpvName := cvc.GetAnnotations()[volumeID]\n\tdesiredPoolNames := cvc.GetDesiredReplicaPoolNames()\n\tnewPoolNames := util.ListDiff(desiredPoolNames, cvc.Status.PoolInfo)\n\treplicaPoolMap := map[string]bool{}\n\n\treplicaPoolNames, err := GetVolumeReplicaPoolNames(c.clientset, pvName, openebsNamespace)\n\tif err != nil {\n\t\treturn cvc, errors.Wrapf(err, \"failed to get current replica pool information\")\n\t}\n\n\tfor _, poolName := range replicaPoolNames {\n\t\treplicaPoolMap[poolName] = true\n\t}\n\tfor _, poolName := range newPoolNames {\n\t\tif _, ok := replicaPoolMap[poolName]; !ok {\n\t\t\treturn cvc, errors.Errorf(\n\t\t\t\t\"scaling replicas from %d to %d in progress\",\n\t\t\t\tlen(cvc.Status.PoolInfo),\n\t\t\t\tlen(cvc.Spec.Policy.ReplicaPoolInfo),\n\t\t\t)\n\t\t}\n\t}\n\tcvcCopy := cvc.DeepCopy()\n\t// store volume replica pool names in currentRPNames\n\tcvc.Status.PoolInfo = append(cvc.Status.PoolInfo, newPoolNames...)\n\t// updatePDBForScaledVolume will handle updating PDB and CVC status\n\tcvc, err = c.updatePDBForScaledVolume(cvc)\n\tif err != nil {\n\t\treturn cvcCopy, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle post volume replicas scale up process\",\n\t\t)\n\t}\n\treturn cvc, nil\n}", "title": "" }, { "docid": "8d4e2fbf238ddb64aaef85b7ae706ee9", "score": "0.48592222", "text": "func updateDeployment(e Expose, client kubernetes.Interface) error {\n\t_, err := client.AppsV1().Deployments(e.NameSpace).Get(context.TODO(), getNameDeployment(e.Name), metav1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeployment := getDeployment(e)\n\t_, err = client.AppsV1().Deployments(e.NameSpace).Update(context.TODO(), deployment, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient.AutoscalingV1().HorizontalPodAutoscalers(e.NameSpace).Get(context.TODO(), getNameHPA(e.Name), metav1.GetOptions{})\n\thpa := getHortizontalAutoScale(e)\n\t_, err = client.AutoscalingV1().HorizontalPodAutoscalers(e.NameSpace).Update(context.TODO(), hpa, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1d19c87138babc08fe4ecd9fe21ed373", "score": "0.48540902", "text": "func (n *nginxProxy) CatalogChange(instances []client.ServiceInstance) error {\n\tn.mutex.Lock()\n\tdefer n.mutex.Unlock()\n\n\tn.instances = instances\n\treturn n.updateNGINX()\n}", "title": "" }, { "docid": "e24b24bbc90c00192deeffdca83d6782", "score": "0.48489395", "text": "func (r *ReconcilePodManager) updateDeployment(podManager *extensionsv1alpha1.PodManager, deployment *appsv1.Deployment, podUpgradeCount int) error {\n\t// add annotation to deployment and update deployment container\n\tdeployment.Annotations[GrayscaleAnnotation] = fmt.Sprintf(\"%d\", podUpgradeCount)\n\n\t// update the container image, env and resource\n\tcontainers := deployment.Spec.Template.Spec.Containers\n\tfor i := range containers {\n\t\tfor _, resourceContainer := range podManager.Spec.Resources.Containers {\n\t\t\tif containers[i].Name != resourceContainer.ContainerName {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(resourceContainer.Image) > 0 {\n\t\t\t\tcontainers[i].Image = resourceContainer.Image\n\t\t\t}\n\t\t\tif len(resourceContainer.Env) != 0 {\n\t\t\t\tcontainers[i].Env = resourceContainer.Env\n\t\t\t}\n\t\t\tif resourceContainer.Resources != nil {\n\t\t\t\tcontainers[i].Resources = *resourceContainer.Resources\n\t\t\t}\n\t\t}\n\t}\n\tdeployment.Spec.Template.Spec.Containers = containers\n\n\terr := r.Update(context.TODO(), deployment)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// if deployment is updated, update podManager status\n\tmessage := fmt.Sprintf(\"Deployment \\\"%s/%s\\\" is updated.\", deployment.Namespace, deployment.Name)\n\terr = r.updatePodManagerCondition(podManager, message, \"DeploymentUpdated\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8eac127d9462f51e505485114390321", "score": "0.48421264", "text": "func (provisioner *KopsProvisioner) ResizeCluster(cluster *model.Cluster) error {\n\tlogger := provisioner.logger.WithField(\"cluster\", cluster.ID)\n\n\tkopsMetadata := cluster.ProvisionerMetadataKops\n\n\terr := kopsMetadata.ValidateChangeRequest()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"KopsMetadata ChangeRequest failed validation\")\n\t}\n\n\tkops, err := kops.New(provisioner.params.S3StateStore, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create kops wrapper\")\n\t}\n\tdefer kops.Close()\n\n\terr = kops.UpdateCluster(kopsMetadata.Name, kops.GetOutputDirectory())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = provisioner.awsClient.FixSubnetTagsForVPC(kopsMetadata.VPC, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tterraformClient, err := terraform.New(kops.GetOutputDirectory(), provisioner.params.S3StateStore, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer terraformClient.Close()\n\n\terr = terraformClient.Init(kopsMetadata.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = verifyTerraformAndKopsMatch(kopsMetadata.Name, terraformClient, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Info(\"Resizing cluster\")\n\n\tfor igName, changeMetadata := range kopsMetadata.GetWorkerNodesResizeChanges() {\n\t\tkopsSetActions := kopsMetadata.GetKopsResizeSetActionsFromChanges(changeMetadata, igName)\n\t\tfor _, action := range kopsSetActions {\n\t\t\tlogger.Debugf(\"Updating instance group %s with kops set %s\", igName, action)\n\t\t\terr = kops.SetInstanceGroup(kopsMetadata.Name, igName, action)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"failed to update instance group with %s\", action)\n\t\t\t}\n\t\t}\n\t}\n\n\terr = kops.UpdateCluster(kopsMetadata.Name, kops.GetOutputDirectory())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = provisioner.awsClient.FixSubnetTagsForVPC(kopsMetadata.VPC, logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = terraformClient.Plan()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = terraformClient.Apply()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequiresClusterRotation, err := kops.RollingUpdateClusterRequired(kopsMetadata.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif requiresClusterRotation {\n\t\tlogger.Info(\"Rolling update is required\")\n\t\tif cluster.ProvisionerMetadataKops.RotatorRequest.Config != nil {\n\t\t\tif *cluster.ProvisionerMetadataKops.RotatorRequest.Config.UseRotator {\n\t\t\t\tlogger.Info(\"Using node rotator for node resize\")\n\t\t\t\terr = provisioner.RotateClusterNodes(cluster)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\terr = kops.RollingUpdateCluster(kopsMetadata.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = attachPolicyRoles(cluster, provisioner.awsClient, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to attach policy roles to cluster\")\n\t}\n\n\t// TODO: Rework this as we make the API calls asynchronous.\n\twait := 1000\n\tif wait > 0 {\n\t\tlogger.Infof(\"Waiting up to %d seconds for k8s cluster to become ready...\", wait)\n\t\terr = kops.WaitForKubernetesReadiness(kopsMetadata.Name, wait)\n\t\tif err != nil {\n\t\t\t// Run non-silent validate one more time to log final cluster state\n\t\t\t// and return original timeout error.\n\t\t\tkops.ValidateCluster(kopsMetadata.Name, false)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlogger.Info(\"Successfully resized cluster\")\n\n\treturn nil\n}", "title": "" }, { "docid": "098a4fb0fe8a437a7a13c7b6e335ce5b", "score": "0.48242018", "text": "func (podStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n\tnewPod := obj.(*api.Pod)\n\toldPod := old.(*api.Pod)\n\tnewPod.Status = oldPod.Status\n\n\tif utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {\n\t\t// With support for in-place pod resizing, container resources are now mutable.\n\t\t// If container resources are updated with new resource requests values, a pod resize is\n\t\t// desired. The status of this request is reflected by setting Resize field to \"Proposed\"\n\t\t// as a signal to the caller that the request is being considered.\n\t\tpodutil.MarkPodProposedForResize(oldPod, newPod)\n\t}\n\n\tpodutil.DropDisabledPodFields(newPod, oldPod)\n}", "title": "" }, { "docid": "bb46b14ccdcfb7bab2318cd3d8d0afe8", "score": "0.48150727", "text": "func (f *cFactory) updatePodLabels() error {\n\tmasterHost := f.getMasterHost()\n\n\tfor _, ns := range f.cluster.Status.Nodes {\n\t\tpod, err := getPodForHostname(f.client, f.namespace, f.getLabels(map[string]string{}), ns.Name)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to update pod labels: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tlabels := pod.GetLabels()\n\t\tval, desiredVal := \"replica\", \"replica\"\n\t\texists := false\n\t\tval, exists = labels[\"role\"]\n\n\t\tif strings.Contains(masterHost, pod.Name) {\n\t\t\tdesiredVal = \"master\"\n\t\t}\n\n\t\tglog.V(2).Infof(\"Inspecting pod: %s, label: %s, desired: %s\", pod.Name, val, desiredVal)\n\n\t\tif !exists || val != desiredVal {\n\t\t\tglog.Infof(\"Updating labels for Pod: %s\", pod.Name)\n\n\t\t\tmeta := metav1.ObjectMeta{\n\t\t\t\tName: pod.Name,\n\t\t\t\tLabels: labels,\n\t\t\t\tOwnerReferences: pod.GetOwnerReferences(),\n\t\t\t\tNamespace: pod.GetNamespace(),\n\t\t\t}\n\n\t\t\t_, act, err := kcore.CreateOrPatchPod(f.client, meta,\n\t\t\t\tfunc(in *core.Pod) *core.Pod {\n\t\t\t\t\tin.Labels[\"role\"] = desiredVal\n\t\t\t\t\treturn in\n\t\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Error while updating pod label: %s\", err)\n\t\t\t}\n\n\t\t\tglog.Infof(\"Pod %s was %s\", pod.Name, getStatusFromKVerb(act))\n\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c6eaf68bf5878cf1a0d91e2eae3fb62", "score": "0.481136", "text": "func LxcPromote(name string) {\n\tcheckSanity(name)\n\n\t// check: start container if it is not running already\n\tif container.State(name) != \"RUNNING\" {\n\t\tLxcStart(name)\n\t\t// log.Info(\"Container \" + name + \" is started\")\n\t}\n\n\t// check: write package list to packages\n\tpkgCmdResult, _ := container.AttachExec(name, []string{\"timeout\", \"60\", \"dpkg\", \"-l\"})\n\tstrCmdRes := strings.Join(pkgCmdResult, \"\\n\")\n\tlog.Check(log.FatalLevel, \"Write packages\",\n\t\tioutil.WriteFile(config.Agent.LxcPrefix+name+\"/packages\",\n\t\t\t[]byte(strCmdRes), 0755))\n\tif container.State(name) == \"RUNNING\" {\n\t\tcontainer.Stop(name)\n\t}\n\tnet.RemoveDefaultGW(name)\n\n\tcleanupFS(config.Agent.LxcPrefix+name+\"/rootfs/.git\", 0000)\n\tcleanupFS(config.Agent.LxcPrefix+name+\"/var/log/\", 0775)\n\tcleanupFS(config.Agent.LxcPrefix+name+\"/var/cache\", 0775)\n\tcleanupFS(config.Agent.LxcPrefix+name+\"/var/lib/apt/lists/\", 0000)\n\n\tmakeDiff(name)\n\n\tiface := container.GetConfigItem(config.Agent.LxcPrefix+name+\"/config\", \"lxc.network.veth.pair\")\n\tnet.ConfigureOVS(iface)\n\tcontainer.ResetNet(name)\n\tfs.ReadOnly(name, true)\n\tlog.Info(name + \" promoted\")\n}", "title": "" }, { "docid": "50584cbbfbbedbf5b229c8bb73747e12", "score": "0.47848037", "text": "func (deploymentStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n\tnewDeployment := obj.(*apps.Deployment)\n\toldDeployment := old.(*apps.Deployment)\n\tnewDeployment.Status = oldDeployment.Status\n\n\tpod.DropDisabledTemplateFields(&newDeployment.Spec.Template, &oldDeployment.Spec.Template)\n\n\t// Spec updates bump the generation so that we can distinguish between\n\t// scaling events and template changes, annotation updates bump the generation\n\t// because annotations are copied from deployments to their replica sets.\n\tif !apiequality.Semantic.DeepEqual(newDeployment.Spec, oldDeployment.Spec) ||\n\t\t!apiequality.Semantic.DeepEqual(newDeployment.Annotations, oldDeployment.Annotations) {\n\t\tnewDeployment.Generation = oldDeployment.Generation + 1\n\t}\n}", "title": "" }, { "docid": "26508adae11d1200a9d3c33adbdeea04", "score": "0.4776947", "text": "func (deploymentStatusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n\tnewDeployment := obj.(*apps.Deployment)\n\toldDeployment := old.(*apps.Deployment)\n\tnewDeployment.Spec = oldDeployment.Spec\n\tnewDeployment.Labels = oldDeployment.Labels\n}", "title": "" }, { "docid": "c33f2b2bddf8555910e82b981ef5ecfb", "score": "0.47623825", "text": "func TestClusterDeploymentUpdate(t *testing.T) {\n\tolder := clusterDeploymentWithOldSpec()\n\tnewer := clusterDeploymentWithNewSpec()\n\n\tclusterDeploymentRESTStrategies.PrepareForUpdate(nil, newer, older)\n}", "title": "" }, { "docid": "027e01b5640f7579504364128034b586", "score": "0.47184384", "text": "func (gc *GaleraController) updatePod(old, cur interface{}) {\n\toldPod := old.(*corev1.Pod)\n\tcurPod := cur.(*corev1.Pod)\n\n\tif curPod.ResourceVersion == oldPod.ResourceVersion {\n\t\t// Periodic resync will send update events for all known pods\n\t\t// Two different versions of the same pod will always have different RVs\n\t\treturn\n\t}\n\n\tlabelChanged := !reflect.DeepEqual(curPod.Labels, oldPod.Labels)\n\n\tcurControllerRef := metav1.GetControllerOf(curPod)\n\toldControllerRef := metav1.GetControllerOf(oldPod)\n\tcontrollerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef)\n\tif controllerRefChanged && oldControllerRef != nil {\n\t\t// The ControllerRef was changed. Sync the old controller, if any\n\t\tif galera := gc.resolveControllerRef(oldPod.Namespace, oldControllerRef); galera != nil {\n\t\t\tgc.enqueueGalera(galera)\n\t\t}\n\t}\n\n\t// If it has a ControllerRef, that's all that matters\n\tif curControllerRef != nil {\n\t\tgalera := gc.resolveControllerRef(curPod.Namespace, curControllerRef)\n\t\tif galera == nil {\n\t\t\treturn\n\t\t}\n\t\tgc.logger.Infof(\"Pod %s updated, objectMeta %+v -> %+v.\", curPod.Name, oldPod.ObjectMeta, curPod.ObjectMeta)\n\t\tgc.enqueueGalera(galera)\n\t\treturn\n\t}\n\n\t// Otherwise, it's an orphan. If anything changed, sync matching controllers\n\t// to see if anyone wants to adopt it now\n\tif labelChanged || controllerRefChanged {\n\t\tgaleras := gc.getGalerasForPod(curPod)\n\t\tif len(galeras) == 0 {\n\t\t\treturn\n\t\t}\n\t\tgc.logger.Infof(\"Orphan Pod %s updated, objectMeta %+v -> %+v.\", curPod.Name, oldPod.ObjectMeta, curPod.ObjectMeta)\n\t\tfor _, galera := range galeras {\n\t\t\tgc.enqueueGalera(galera)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3ece8c184fe0094042ccace17c8791e5", "score": "0.46782148", "text": "func (r *AppCatalogsRequest) Update(ctx context.Context, reqObj *AppCatalogs) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "a71aec34f79c262a80e9a786432d6cae", "score": "0.4665514", "text": "func (h *handler) deployK3sBasedUpgradeController(clusterName, updateVersion string, isK3s, isRke2 bool) error {\n\tuserCtx, err := h.manager.UserContextNoControllers(clusterName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojectLister := userCtx.Management.Management.Projects(\"\").Controller().Lister()\n\tsystemProject, err := project.GetSystemProject(clusterName, projectLister)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttemplateID := k3sUpgraderCatalogName\n\ttemplate, err := h.templateLister.Get(namespace.GlobalNamespace, templateID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlatestTemplateVersion, err := h.catalogManager.LatestAvailableTemplateVersion(template, clusterName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcreator, err := h.systemAccountManager.GetSystemUser(clusterName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsystemProjectID := ref.Ref(systemProject)\n\t_, systemProjectName := ref.Parse(systemProjectID)\n\n\tnsClient := userCtx.Core.Namespaces(\"\")\n\tappProjectName, err := app2.EnsureAppProjectName(nsClient, systemProjectName, clusterName, systemUpgradeNS, creator.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// determine what version of Kubernetes we are updating to\n\tis125OrAbove, err := Is125OrAbove(updateVersion)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// if we are using a version above or equal to 1.25 we need to explicitly disable PSPs\n\tenablePSPInChart := \"false\"\n\tif !is125OrAbove {\n\t\tenablePSPInChart = \"true\"\n\t}\n\n\tappLister := userCtx.Management.Project.Apps(\"\").Controller().Lister()\n\tappClient := userCtx.Management.Project.Apps(\"\")\n\n\tlatestVersionID := latestTemplateVersion.ExternalID\n\tvar appname string\n\tswitch {\n\tcase isK3s:\n\t\tappname = \"rancher-k3s-upgrader\"\n\tcase isRke2:\n\t\tappname = \"rancher-rke2-upgrader\"\n\t}\n\tapp, err := appLister.Get(systemProjectName, appname)\n\tif err != nil {\n\t\tif !errors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t\tdesiredApp := &v33.App{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: appname,\n\t\t\t\tNamespace: systemProjectName,\n\t\t\t\tAnnotations: map[string]string{\n\t\t\t\t\t\"field.cattle.io/creatorId\": creator.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: v33.AppSpec{\n\t\t\t\tDescription: \"Upgrade controller for k3s based clusters\",\n\t\t\t\tExternalID: latestVersionID,\n\t\t\t\tProjectName: appProjectName,\n\t\t\t\tAnswers: make(map[string]string),\n\t\t\t\tTargetNamespace: systemUpgradeNS,\n\t\t\t},\n\t\t}\n\n\t\tdesiredApp.Spec.Answers[PSPAnswersField] = enablePSPInChart\n\n\t\t// k3s upgrader doesn't exist yet, so it will need to be created\n\t\tif _, err = appClient.Create(desiredApp); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif !checkDeployed(app) {\n\t\t\tif !v33.AppConditionForceUpgrade.IsUnknown(app) {\n\t\t\t\tv33.AppConditionForceUpgrade.Unknown(app)\n\t\t\t}\n\t\t\tlogrus.Warnln(\"force redeploying system-upgrade-controller\")\n\t\t\tif _, err = appClient.Update(app); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\texternalIDIsCorrect := app.Spec.ExternalID == latestVersionID\n\t\tpspValuesHaveBeenSet := false\n\t\tif app.Spec.Answers != nil {\n\t\t\tpspValuesHaveBeenSet = app.Spec.Answers[PSPAnswersField] == enablePSPInChart\n\t\t}\n\n\t\t// everything is up-to-date and PSP attributes are set up properly, no need to update.\n\t\tif externalIDIsCorrect && pspValuesHaveBeenSet {\n\t\t\treturn nil\n\t\t}\n\n\t\tdesiredApp := app.DeepCopy()\n\t\tif desiredApp.Spec.Answers == nil {\n\t\t\tdesiredApp.Spec.Answers = make(map[string]string)\n\t\t}\n\t\tdesiredApp.Spec.Answers[PSPAnswersField] = enablePSPInChart\n\t\tdesiredApp.Spec.ExternalID = latestVersionID\n\t\t// new version of k3s upgrade available, or the valuesYaml have changed, update app\n\t\tif _, err = appClient.Update(desiredApp); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d8086a4f3c0931d66e12a9e2fdb00c2d", "score": "0.46470985", "text": "func (c *Config) Upgrade(log log.Logger) (config.Config, error) {\n\tnextConfig := &next.Config{}\n\terr := util.Convert(c, nextConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert deployments\n\tif c.DevSpace != nil && c.DevSpace.Deployments != nil {\n\t\tnewConfigDeployments := []*next.DeploymentConfig{}\n\n\t\tfor _, deploy := range *c.DevSpace.Deployments {\n\t\t\tnewDeployment := &next.DeploymentConfig{\n\t\t\t\tName: deploy.Name,\n\t\t\t\tNamespace: deploy.Namespace,\n\t\t\t}\n\n\t\t\t// Add auto reload\n\t\t\tif deploy.AutoReload == nil || deploy.AutoReload.Disabled == nil || *deploy.AutoReload.Disabled {\n\t\t\t\tif nextConfig.Dev == nil {\n\t\t\t\t\tnextConfig.Dev = &next.DevConfig{}\n\t\t\t\t}\n\t\t\t\tif nextConfig.Dev.AutoReload == nil {\n\t\t\t\t\tnextConfig.Dev.AutoReload = &next.AutoReloadConfig{}\n\t\t\t\t}\n\t\t\t\tif nextConfig.Dev.AutoReload.Deployments == nil {\n\t\t\t\t\tnextConfig.Dev.AutoReload.Deployments = &[]*string{}\n\t\t\t\t}\n\n\t\t\t\t(*nextConfig.Dev.AutoReload.Deployments) = append((*nextConfig.Dev.AutoReload.Deployments), deploy.Name)\n\t\t\t}\n\n\t\t\t// Convert kubectl\n\t\t\tif deploy.Kubectl != nil {\n\t\t\t\tnewDeployment.Kubectl = &next.KubectlConfig{\n\t\t\t\t\tCmdPath: deploy.Kubectl.CmdPath,\n\t\t\t\t\tManifests: deploy.Kubectl.Manifests,\n\t\t\t\t}\n\t\t\t} else if deploy.Helm != nil {\n\t\t\t\tnewDeployment.Helm = &next.HelmConfig{\n\t\t\t\t\tChartPath: deploy.Helm.ChartPath,\n\t\t\t\t\tWait: deploy.Helm.Wait,\n\t\t\t\t\tOverrideValues: deploy.Helm.OverrideValues,\n\t\t\t\t}\n\n\t\t\t\tif deploy.Helm.DevOverwrite != nil {\n\t\t\t\t\tnewDeployment.Helm.Overrides = &[]*string{deploy.Helm.DevOverwrite}\n\t\t\t\t}\n\t\t\t\tif deploy.Helm.Override != nil {\n\t\t\t\t\tnewDeployment.Helm.Overrides = &[]*string{deploy.Helm.Override}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewConfigDeployments = append(newConfigDeployments, newDeployment)\n\t\t}\n\n\t\tnextConfig.Deployments = &newConfigDeployments\n\t}\n\n\t// Fill dev config\n\tif nextConfig.Dev == nil {\n\t\tnextConfig.Dev = &next.DevConfig{}\n\t}\n\n\t// Convert devspace to dev\n\tif c.DevSpace != nil {\n\t\t// Convert sync paths\n\t\tif c.DevSpace.Sync != nil {\n\t\t\tnewSyncPaths := []*next.SyncConfig{}\n\n\t\t\tfor _, sync := range *c.DevSpace.Sync {\n\t\t\t\tnewSyncPaths = append(newSyncPaths, &next.SyncConfig{\n\t\t\t\t\tSelector: sync.Service,\n\t\t\t\t\tNamespace: sync.Namespace,\n\t\t\t\t\tLabelSelector: sync.LabelSelector,\n\t\t\t\t\tLocalSubPath: sync.LocalSubPath,\n\t\t\t\t\tContainerName: sync.ContainerName,\n\t\t\t\t\tContainerPath: sync.ContainerPath,\n\t\t\t\t\tExcludePaths: sync.ExcludePaths,\n\t\t\t\t\tDownloadExcludePaths: sync.DownloadExcludePaths,\n\t\t\t\t\tUploadExcludePaths: sync.UploadExcludePaths,\n\t\t\t\t})\n\n\t\t\t\tif sync.BandwidthLimits != nil {\n\t\t\t\t\tnewSyncPaths[len(newSyncPaths)-1].BandwidthLimits = &next.BandwidthLimits{\n\t\t\t\t\t\tDownload: sync.BandwidthLimits.Download,\n\t\t\t\t\t\tUpload: sync.BandwidthLimits.Upload,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnextConfig.Dev.Sync = &newSyncPaths\n\t\t}\n\n\t\t// Convert ports\n\t\tif c.DevSpace.Ports != nil {\n\t\t\tnewPorts := []*next.PortForwardingConfig{}\n\n\t\t\tfor _, port := range *c.DevSpace.Ports {\n\t\t\t\tnewPorts = append(newPorts, &next.PortForwardingConfig{\n\t\t\t\t\tSelector: port.Service,\n\t\t\t\t\tNamespace: port.Namespace,\n\t\t\t\t\tLabelSelector: port.LabelSelector,\n\t\t\t\t})\n\n\t\t\t\tif port.PortMappings != nil {\n\t\t\t\t\tnewPortMappings := []*next.PortMapping{}\n\n\t\t\t\t\tfor _, portMapping := range *port.PortMappings {\n\t\t\t\t\t\tnewPortMappings = append(newPortMappings, &next.PortMapping{\n\t\t\t\t\t\t\tLocalPort: portMapping.LocalPort,\n\t\t\t\t\t\t\tRemotePort: portMapping.RemotePort,\n\t\t\t\t\t\t\tBindAddress: portMapping.BindAddress,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\n\t\t\t\t\tnewPorts[len(newPorts)-1].PortMappings = &newPortMappings\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnextConfig.Dev.Ports = &newPorts\n\t\t}\n\n\t\t// Convert terminal\n\t\tif c.DevSpace.Terminal != nil {\n\t\t\tnextConfig.Dev.Terminal = &next.Terminal{\n\t\t\t\tDisabled: c.DevSpace.Terminal.Disabled,\n\t\t\t\tSelector: c.DevSpace.Terminal.Service,\n\t\t\t\tLabelSelector: c.DevSpace.Terminal.LabelSelector,\n\t\t\t\tNamespace: c.DevSpace.Terminal.Namespace,\n\t\t\t\tContainerName: c.DevSpace.Terminal.ContainerName,\n\t\t\t\tCommand: c.DevSpace.Terminal.Command,\n\t\t\t}\n\t\t}\n\n\t\t// Convert services\n\t\tif c.DevSpace.Services != nil {\n\t\t\tselectors := []*next.SelectorConfig{}\n\n\t\t\t// Convert each service\n\t\t\tfor _, service := range *c.DevSpace.Services {\n\t\t\t\tselectors = append(selectors, &next.SelectorConfig{\n\t\t\t\t\tName: service.Name,\n\t\t\t\t\tNamespace: service.Namespace,\n\t\t\t\t\tLabelSelector: service.LabelSelector,\n\t\t\t\t\tContainerName: service.ContainerName,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tnextConfig.Dev.Selectors = &selectors\n\t\t}\n\n\t\t// Convert auto reaload\n\t\tif c.DevSpace.AutoReload != nil {\n\t\t\tif nextConfig.Dev.AutoReload == nil {\n\t\t\t\tnextConfig.Dev.AutoReload = &next.AutoReloadConfig{}\n\t\t\t}\n\n\t\t\tif c.DevSpace.AutoReload.Paths != nil && len(*c.DevSpace.AutoReload.Paths) > 0 {\n\t\t\t\tnextConfig.Dev.AutoReload.Paths = c.DevSpace.AutoReload.Paths\n\t\t\t}\n\t\t}\n\t}\n\n\t// Convert images with registries\n\tif c.Images != nil {\n\t\tfor key, image := range *c.Images {\n\t\t\t(*nextConfig.Images)[key].Image = image.Name\n\n\t\t\tif image.Registry != nil {\n\t\t\t\tif c.Registries == nil {\n\t\t\t\t\treturn nil, errors.Errorf(\"Registries is nil in config\")\n\t\t\t\t}\n\n\t\t\t\t// Get registry\n\t\t\t\tregistry, ok := (*c.Registries)[*image.Registry]\n\t\t\t\tif ok == false {\n\t\t\t\t\treturn nil, errors.Errorf(\"Couldn't find registry %s in registries\", *image.Registry)\n\t\t\t\t}\n\t\t\t\tif registry.Auth != nil {\n\t\t\t\t\tlog.Warnf(\"Registry authentication is not supported any longer (Registry %s). Please use docker login [registry] instead\", *image.Registry)\n\t\t\t\t}\n\t\t\t\tif registry.URL == nil || image.Name == nil {\n\t\t\t\t\treturn nil, errors.Errorf(\"Registry url or image name is nil for image %s\", key)\n\t\t\t\t}\n\n\t\t\t\t(*nextConfig.Images)[key].Image = ptr.String(*registry.URL + \"/\" + *image.Name)\n\t\t\t}\n\n\t\t\tif image.AutoReload == nil || image.AutoReload.Disabled == nil || *image.AutoReload.Disabled == false {\n\t\t\t\tif nextConfig.Dev == nil {\n\t\t\t\t\tnextConfig.Dev = &next.DevConfig{}\n\t\t\t\t}\n\t\t\t\tif nextConfig.Dev.AutoReload == nil {\n\t\t\t\t\tnextConfig.Dev.AutoReload = &next.AutoReloadConfig{}\n\t\t\t\t}\n\t\t\t\tif nextConfig.Dev.AutoReload.Images == nil {\n\t\t\t\t\tnextConfig.Dev.AutoReload.Images = &[]*string{}\n\t\t\t\t}\n\n\t\t\t\t// Assign this because otherwise we get the same value multiple times\n\t\t\t\timageName := key\n\t\t\t\t(*nextConfig.Dev.AutoReload.Images) = append((*nextConfig.Dev.AutoReload.Images), &imageName)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Convert tiller namespace\n\tif c.Tiller != nil && c.Tiller.Namespace != nil {\n\t\tif nextConfig.Deployments != nil {\n\t\t\tfor _, deploy := range *nextConfig.Deployments {\n\t\t\t\tif deploy.Helm != nil {\n\t\t\t\t\tdeploy.Helm.TillerNamespace = c.Tiller.Namespace\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Convert internal registry\n\tif c.InternalRegistry != nil {\n\t\tlog.Warnf(\"internalRegistry deployment is not supported anymore\")\n\t}\n\n\treturn nextConfig, nil\n}", "title": "" }, { "docid": "8223de45a0a8c596ceca480f847f2b4b", "score": "0.4638093", "text": "func upgradeCoreDNS(\n\tkubectlOptions *kubectl.KubectlOptions,\n\tclientset *kubernetes.Clientset,\n\tawsRegion string,\n\tcoreDNSVersion string,\n\tshouldWait bool,\n\twaitTimeout string,\n) error {\n\tlogger := logging.GetProjectLogger()\n\n\ttargetImage := fmt.Sprintf(\"602401143452.dkr.ecr.%s.amazonaws.com/eks/coredns:v%s\", awsRegion, coreDNSVersion)\n\tcurrentImage, err := getCurrentDeployedCoreDNSImage(clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif currentImage == targetImage {\n\t\tlogger.Info(\"Current deployed version matches expected version. Skipping coredns update.\")\n\t\treturn nil\n\t}\n\n\tlogger.Infof(\"Upgrading current deployed version of coredns (%s) to match expected version (%s).\", currentImage, targetImage)\n\tif err := updateCoreDNSDeploymentImage(clientset, targetImage); err != nil {\n\t\treturn err\n\t}\n\tif shouldWait {\n\t\tlogger.Info(\"Waiting until new image for coredns is rolled out.\")\n\t\t// Ideally we will implement the following routine using the raw client-go library, but implementing this\n\t\t// functionality directly on the API is fairly complex, and thus we rely on the built in mechanism in kubectl\n\t\t// instead.\n\t\targs := []string{\n\t\t\t\"rollout\",\n\t\t\t\"status\",\n\t\t\tfmt.Sprintf(\"deployment/%s\", corednsDeploymentName),\n\t\t\t\"-n\", componentNamespace,\n\t\t\t\"--timeout\", waitTimeout,\n\t\t}\n\t\treturn kubectl.RunKubectl(kubectlOptions, args...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e65769353bda75b8fe718e6b6d4df367", "score": "0.46363842", "text": "func (server *Server) ReplaceCatalog(catalog CatalogWireFormat) (*CommandResponse, error) {\n\tcommandResponse, error := server.SubmitCommand(\"replace catalog\", 3, catalog)\n\treturn commandResponse, error\n}", "title": "" }, { "docid": "82d373c6e9bc4215de48bb70836445bd", "score": "0.46288562", "text": "func (c *Cluster) MigrateMasterPod(podName spec.NamespacedName) error {\n\tvar (\n\t\terr error\n\t\teol bool\n\t)\n\n\toldMaster, err := c.KubeClient.Pods(podName.Namespace).Get(context.TODO(), podName.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get master pod: %v\", err)\n\t}\n\n\tc.logger.Infof(\"starting process to migrate master pod %q\", podName)\n\tif eol, err = c.podIsEndOfLife(oldMaster); err != nil {\n\t\treturn fmt.Errorf(\"could not get node %q: %v\", oldMaster.Spec.NodeName, err)\n\t}\n\tif !eol {\n\t\tc.logger.Debugf(\"no action needed: master pod is already on a live node\")\n\t\treturn nil\n\t}\n\n\tif role := PostgresRole(oldMaster.Labels[c.OpConfig.PodRoleLabel]); role != Master {\n\t\tc.logger.Warningf(\"no action needed: pod %q is not the master (anymore)\", podName)\n\t\treturn nil\n\t}\n\t// we must have a statefulset in the cluster for the migration to work\n\tif c.Statefulset == nil {\n\t\tvar sset *appsv1.StatefulSet\n\t\tif sset, err = c.KubeClient.StatefulSets(c.Namespace).Get(\n\t\t\tcontext.TODO(),\n\t\t\tc.statefulSetName(),\n\t\t\tmetav1.GetOptions{}); err != nil {\n\t\t\treturn fmt.Errorf(\"could not retrieve cluster statefulset: %v\", err)\n\t\t}\n\t\tc.Statefulset = sset\n\t}\n\t// we may not have a cached statefulset if the initial cluster sync has aborted, revert to the spec in that case\n\tmasterCandidateName := podName\n\tmasterCandidatePod := oldMaster\n\tif *c.Statefulset.Spec.Replicas > 1 {\n\t\tif masterCandidateName, err = c.getSwitchoverCandidate(oldMaster); err != nil {\n\t\t\treturn fmt.Errorf(\"could not find suitable replica pod as candidate for failover: %v\", err)\n\t\t}\n\t\tmasterCandidatePod, err = c.KubeClient.Pods(masterCandidateName.Namespace).Get(context.TODO(), masterCandidateName.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not get master candidate pod: %v\", err)\n\t\t}\n\t} else {\n\t\tc.logger.Warningf(\"migrating single pod cluster %q, this will cause downtime of the Postgres cluster until pod is back\", c.clusterName())\n\t}\n\n\t// there are two cases for each postgres cluster that has its master pod on the node to migrate from:\n\t// - the cluster has some replicas - migrate one of those if necessary and failover to it\n\t// - there are no replicas - just terminate the master and wait until it respawns\n\t// in both cases the result is the new master up and running on a new node.\n\n\tif masterCandidatePod == nil {\n\t\tif _, err = c.movePodFromEndOfLifeNode(oldMaster); err != nil {\n\t\t\treturn fmt.Errorf(\"could not move pod: %v\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif _, err = c.movePodFromEndOfLifeNode(masterCandidatePod); err != nil {\n\t\treturn fmt.Errorf(\"could not move pod: %v\", err)\n\t}\n\n\terr = retryutil.Retry(1*time.Minute, 5*time.Minute,\n\t\tfunc() (bool, error) {\n\t\t\terr := c.Switchover(oldMaster, masterCandidateName)\n\t\t\tif err != nil {\n\t\t\t\tc.logger.Errorf(\"could not failover to pod %q: %v\", masterCandidateName, err)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn true, nil\n\t\t},\n\t)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not migrate master pod: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9502c6eb0af5166845949839d2b4dfb4", "score": "0.46236277", "text": "func (a *Autopilot) promoteServers() error {\n\tconf := a.delegate.AutopilotConfig()\n\tif conf == nil {\n\t\treturn nil\n\t}\n\n\t// Skip the non-voter promotions unless all servers support the new APIs\n\tminRaftProtocol, err := a.MinRaftProtocol()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting server raft protocol versions: %s\", err)\n\t}\n\tif minRaftProtocol >= 3 {\n\t\tpromotions, err := a.delegate.PromoteNonVoters(conf, a.GetClusterHealth())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error checking for non-voters to promote: %s\", err)\n\t\t}\n\t\tif err := a.handlePromotions(promotions); err != nil {\n\t\t\treturn fmt.Errorf(\"error handling promotions: %s\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "54d3dbb182071974e944b421223f21c0", "score": "0.46204862", "text": "func updateDeployment(w http.ResponseWriter, r *http.Request) {\n\n\tpathVars := mux.Vars(r)\n\n\tif os.Getenv(\"DEPLOY_STATE\") == \"PROD\" {\n\t\tif !helper.ValidAdmin(pathVars[\"org\"], w, r) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t//Get the old namespace first so we can fail quickly if it's not there\n\tgetDep, err := client.Deployments(pathVars[\"org\"] + \"-\" + pathVars[\"env\"]).Get(pathVars[\"deployment\"])\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error getting existing deployment: %s\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusNotFound)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\t//Decode passed JSON body\n\tvar tempJSON deploymentPatch\n\terr = json.NewDecoder(r.Body).Decode(&tempJSON)\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error decoding JSON Body: %v\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\n\ttempPTS := api.PodTemplateSpec{}\n\n\t//Check if we got a URL\n\tif tempJSON.PtsURL == \"\" {\n\t\t//No URL so error\n\t\terrorMessage := fmt.Sprintf(\"No ptsURL or PTS given\\n\")\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\n\ttempPTS, err = helper.GetPTSFromURL(tempJSON.PtsURL, r)\n\tif err != nil {\n\t\thelper.LogError.Printf(err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\t//If annotations map is empty then we need to make it\n\tif len(tempPTS.Annotations) == 0 {\n\t\ttempPTS.Annotations = make(map[string]string)\n\t}\n\n\t//If labels map is empty then we need to make it\n\tif len(tempPTS.Labels) == 0 {\n\t\ttempPTS.Labels = make(map[string]string)\n\t}\n\n\t//Need to cache the previous annotations\n\tcacheAnnotations := getDep.Spec.Template.Annotations\n\n\t//Only set the replica count if the passed variable\n\tif tempJSON.Replicas != nil {\n\t\tgetDep.Spec.Replicas = *tempJSON.Replicas\n\t}\n\tgetDep.Spec.Template = tempPTS\n\n\t//Replace the privateHosts and publicHosts annotations with cached ones\n\tgetDep.Spec.Template.Annotations[\"publicHosts\"] = cacheAnnotations[\"publicHosts\"]\n\tgetDep.Spec.Template.Annotations[\"privateHosts\"] = cacheAnnotations[\"privateHosts\"]\n\n\tif tempJSON.PrivateHosts != nil {\n\t\tgetDep.Spec.Template.Annotations[\"privateHosts\"] = *tempJSON.PrivateHosts\n\t}\n\n\tif tempJSON.PublicHosts != nil {\n\t\tgetDep.Spec.Template.Annotations[\"publicHosts\"] = *tempJSON.PublicHosts\n\t}\n\n\tgetDep.Spec.Template.Spec.Containers[0].Env = helper.CacheEnvVars(getDep.Spec.Template.Spec.Containers[0].Env, tempJSON.EnvVars)\n\n\t//Add routable label\n\tgetDep.Spec.Template.Labels[\"routable\"] = \"true\"\n\n\tdep, err := client.Deployments(pathVars[\"org\"] + \"-\" + pathVars[\"env\"]).Update(getDep)\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error updating deployment: %v\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t\treturn\n\t}\n\n\tjs, err := json.Marshal(dep)\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Error marshalling deployment: %v\\n\", err)\n\t\thttp.Error(w, errorMessage, http.StatusInternalServerError)\n\t\thelper.LogError.Printf(errorMessage)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tw.Write(js)\n\thelper.LogInfo.Printf(\"Updated Deployment: %s\\n\", dep.GetName())\n}", "title": "" }, { "docid": "73e4ec129c485b106de765e20969c64c", "score": "0.46202087", "text": "func UpgradeSSHCluster(clusterName, k8sVersion string) error {\n\tif clusterName == \"\" {\n\t\treturn errors.New(\"clusterName can not be nil\")\n\t}\n\n\tcmdName := kubectlCmd\n\tcmdArgs := []string{\"--help\"}\n\tcmdTimeout := time.Duration(maxApplyTimeout) * time.Second\n\n\t// Get a list of all machines.\n\tcmdArgs = []string{\"get\", \"machines\", \"-n\", clusterName, \"-o\", \"jsonpath={.items[*].metadata.name}\"}\n\tmachineNames, err := RunCommand(cmdName, cmdArgs, \"\", cmdTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update control plane.\n\tvar controlPlaneMachines, workerMachines []string\n\tfor _, machineName := range strings.Split(string(machineNames.Bytes()), \" \") {\n\t\t// Determine which machines are masters by looking for non-empty\n\t\t// controlPlane fields.\n\t\tcmdArgs = []string{\"get\", \"machine\", machineName, \"-n\", clusterName, \"-o\", \"jsonpath={.spec.versions.controlPlane}\"}\n\t\tcontrolPlaneVersionBuffer, err := RunCommand(cmdName, cmdArgs, \"\", cmdTimeout)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcontrolPlaneVersion := string(controlPlaneVersionBuffer.Bytes())\n\t\tif controlPlaneVersion != \"\" {\n\t\t\tcontrolPlaneMachines = append(controlPlaneMachines, machineName)\n\n\t\t\terr = patchMachineVersions(clusterName, machineName, k8sVersion, k8sVersion)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Wait for node to be updated before proceeding to the\n\t\t\t// next one. This ensures the control plane is available\n\t\t\t// while the workers are upgraded.\n\t\t\terr = waitForKubeletVersion(clusterName, machineName, k8sVersion)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\t// Remeber worker machines for later.\n\t\t\tworkerMachines = append(workerMachines, machineName)\n\t\t}\n\t}\n\n\t// Update workers.\n\tfor _, machineName := range workerMachines {\n\t\terr = patchMachineVersions(clusterName, machineName, \"\", k8sVersion)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Wait for node to be updated before proceeding to the next\n\t\t// one.\n\t\terr = waitForKubeletVersion(clusterName, machineName, k8sVersion)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "20d040b12a6faa66e605e116b3d6ecda", "score": "0.461441", "text": "func (d *Deployments) PromoteGroups(deploymentID string, groups []string, q *WriteOptions) (*DeploymentUpdateResponse, *WriteMeta, error) {\n\tvar resp DeploymentUpdateResponse\n\treq := &DeploymentPromoteRequest{\n\t\tDeploymentID: deploymentID,\n\t\tGroups: groups,\n\t}\n\twm, err := d.client.write(\"/v1/deployment/promote/\"+deploymentID, req, &resp, q)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn &resp, wm, nil\n}", "title": "" }, { "docid": "115152577f8dafb7ab4ab5668798a4ed", "score": "0.46014193", "text": "func (r *Reconciler) UpdateAutoscaler(ca *autoscalingv1.ClusterAutoscaler) error {\n\texistingDeployment, err := r.GetAutoscaler(ca)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update the cluster provider type.\n\tplatformType, err := r.getPlatformType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.config.platformType = platformType\n\n\texistingSpec := existingDeployment.Spec.Template.Spec\n\texpectedSpec := r.AutoscalerPodSpec(ca)\n\n\t// Only comparing podSpec and release version for now.\n\tif equality.Semantic.DeepEqual(existingSpec, expectedSpec) &&\n\t\tutil.ReleaseVersionMatches(ca, r.config.ReleaseVersion) {\n\t\treturn nil\n\t}\n\n\texistingDeployment.Spec.Template.Spec = *expectedSpec\n\n\tr.UpdateAnnotations(existingDeployment)\n\tr.UpdateAnnotations(&existingDeployment.Spec.Template)\n\n\treturn r.client.Update(context.TODO(), existingDeployment)\n}", "title": "" }, { "docid": "8c15d54f41c48e4a13ef6672d35a1714", "score": "0.45849866", "text": "func (m *migrator) updateSubscriptions() ([]types.NamespacedName, []error) {\n\tvar installedCscs []types.NamespacedName\n\tvar errors []error\n\toptions := &client.ListOptions{}\n\toptions.SetLabelSelector(fmt.Sprintf(builders.CscOwnerNameLabel))\n\n\tsubscriptions := &olm.SubscriptionList{}\n\t// Get the list of existing Subscriptions that have the label \"csc-owner-name\"\n\t// which is a label added to Subscriptions in the 4.1 UI\n\terr := m.client.List(context.TODO(), options, subscriptions)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"[migration] Client error: %s\", err.Error())\n\t\terrors = append(errors, fmt.Errorf(msg))\n\t\tm.logger.Errorf(msg)\n\t\treturn []types.NamespacedName{}, errors\n\t}\n\tfor _, subscription := range subscriptions.Items {\n\t\tif builders.HasOwnerLabels(subscription.GetLabels(), v2.CatalogSourceConfigKind) {\n\t\t\t// Try to infer the datastore CatalogSource from the Subscription\n\t\t\tdatastoreCs, err := findCatalogSource(&subscription, m.client)\n\t\t\tif err != nil {\n\t\t\t\t// Infer the CatalogSource from the OperatorSource that has the package\n\t\t\t\tdatastoreCs, err = findCsFromOpsrc(&subscription, m.client)\n\t\t\t\tif err != nil {\n\t\t\t\t\tmsg := fmt.Sprintf(\"[migration] Could not infer datastore CatalogSource for Subscription %s: %v\", subscription.GetName(), err)\n\t\t\t\t\tm.logger.Warnf(msg)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update the Subscription to reference the datastore CatalogSource\n\t\t\tsubscription.Spec.CatalogSource = datastoreCs.GetName()\n\t\t\tsubscription.Spec.CatalogSourceNamespace = datastoreCs.GetNamespace()\n\t\t\t// Get the name and namespace of the InstalledCsc\n\t\t\tinstalledCscName := subscription.GetLabels()[builders.CscOwnerNameLabel]\n\t\t\tinstalledCscNamespace := subscription.GetLabels()[builders.CscOwnerNamespaceLabel]\n\t\t\t// Remove the owner labels from the subscription\n\t\t\tsubscription.Labels = labelsutil.CloneAndRemoveLabel(\n\t\t\t\tlabelsutil.CloneAndRemoveLabel(subscription.GetLabels(), builders.CscOwnerNameLabel),\n\t\t\t\tbuilders.CscOwnerNamespaceLabel)\n\t\t\terr = m.client.Update(context.TODO(), &subscription)\n\t\t\tif err != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"[migration] Error updating subscription %s. Error: %s\", subscription.GetName(), err.Error())\n\t\t\t\terrors = append(errors, fmt.Errorf(msg))\n\t\t\t\tm.logger.Errorf(msg)\n\t\t\t} else {\n\t\t\t\tm.logger.Infof(\"[migration] Successfully updated Subscription %s\", subscription.GetName())\n\t\t\t\tinstalledCscs = append(\n\t\t\t\t\tinstalledCscs,\n\t\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\t\tName: installedCscName,\n\t\t\t\t\t\tNamespace: installedCscNamespace})\n\t\t\t}\n\t\t}\n\t}\n\treturn installedCscs, errors\n}", "title": "" }, { "docid": "dbccf1c94c50d9b21293c8d262b5ac8e", "score": "0.45796993", "text": "func UpScaleCluster(nodeId, namespace, clusterName string) (v1alpha1.ActionStep, string, error) {\n\tactionStep := v1alpha1.ConnectNodeAction\n\tcurrentTime := time.Now()\n\tstartTimeStamp := currentTime.Format(nifiutil.TimeStampLayout)\n\treturn actionStep, startTimeStamp, nil\n}", "title": "" }, { "docid": "e793501cf14d77f5ce91e9554b774893", "score": "0.45760265", "text": "func (clusterStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {\n\tcluster := obj.(*federation.Cluster)\n\toldCluster := old.(*federation.Cluster)\n\tcluster.Status = oldCluster.Status\n}", "title": "" }, { "docid": "c2c378379cd4bf4eb52df8e56f5434eb", "score": "0.45756024", "text": "func Convert(convertOptions ConvertOptions, kubeConfig common.KubeConfig) error {\n\tif convertOptions.DryRun {\n\t\tlog.Println(\"NOTE: This is in dry-run mode, the following actions will not be executed.\")\n\t\tlog.Println(\"Run without --dry-run to take the actions described below:\")\n\t\tlog.Println()\n\t}\n\n\tlog.Printf(\"Release \\\"%s\\\" will be converted from Helm v2 to Helm v3.\\n\", convertOptions.ReleaseName)\n\n\tlog.Printf(\"[Helm 3] Release \\\"%s\\\" will be created.\\n\", convertOptions.ReleaseName)\n\n\tretrieveOptions := v2.RetrieveOptions{\n\t\tReleaseName: convertOptions.ReleaseName,\n\t\tTillerNamespace: convertOptions.TillerNamespace,\n\t\tTillerLabel: convertOptions.TillerLabel,\n\t\tTillerOutCluster: convertOptions.TillerOutCluster,\n\t\tStorageType: convertOptions.StorageType,\n\t}\n\tv2Releases, err := v2.GetReleaseVersions(retrieveOptions, kubeConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Limit release versions to migrate.\n\t// Limit is based on newest versions.\n\tv2RelVerLen := len(v2Releases)\n\tstartIndex := 0\n\tif convertOptions.MaxReleaseVersions > 0 && convertOptions.MaxReleaseVersions < v2RelVerLen {\n\t\tlog.Println()\n\t\tlog.Printf(\"NOTE: The max release versions \\\"%d\\\" is less than the actual release versions \\\"%d\\\".\", convertOptions.MaxReleaseVersions, v2RelVerLen)\n\t\tlog.Printf(\"This means only \\\"%d\\\" of the latest release versions will be converted.\", convertOptions.MaxReleaseVersions)\n\t\tif convertOptions.DeleteRelease {\n\t\t\tlog.Println(\"This also means some versions will remain in Helm v2 storage that will no longer be visible to Helm v2 commands like 'helm list'. Plugin 'cleanup' command will remove them from storage.\")\n\t\t}\n\t\tlog.Println()\n\t\tstartIndex = v2RelVerLen - convertOptions.MaxReleaseVersions\n\t}\n\n\tversions := []int32{}\n\tfor i := startIndex; i < v2RelVerLen; i++ {\n\t\tv2Release := v2Releases[i]\n\t\trelVerName := v2.GetReleaseVersionName(convertOptions.ReleaseName, v2Release.Version)\n\t\tlog.Printf(\"[Helm 3] ReleaseVersion \\\"%s\\\" will be created.\\n\", relVerName)\n\t\tif !convertOptions.DryRun {\n\t\t\tif err := createV3ReleaseVersion(v2Release, kubeConfig); err != nil {\n\n\t\t\t\tif convertOptions.IgnoreAlreadyMigrated {\n\t\t\t\t\tif driver.ErrReleaseExists.Error() == err.Error() {\n\t\t\t\t\t\tlog.Printf(\"[Helm 3] ReleaseVersion \\\"%s\\\" already exists.\\n\", relVerName)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Printf(\"[Helm 3] ReleaseVersion \\\"%s\\\" created.\\n\", relVerName)\n\t\t}\n\t\tversions = append(versions, v2Release.Version)\n\t}\n\tif !convertOptions.DryRun {\n\t\tlog.Printf(\"[Helm 3] Release \\\"%s\\\" created.\\n\", convertOptions.ReleaseName)\n\t}\n\n\tif convertOptions.DeleteRelease {\n\t\tlog.Printf(\"[Helm 2] Release \\\"%s\\\" will be deleted.\\n\", convertOptions.ReleaseName)\n\t\tdeleteOptions := v2.DeleteOptions{\n\t\t\tDryRun: convertOptions.DryRun,\n\t\t\tVersions: versions,\n\t\t}\n\t\tif err := v2.DeleteReleaseVersions(retrieveOptions, deleteOptions, kubeConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !convertOptions.DryRun {\n\t\t\tlog.Printf(\"[Helm 2] Release \\\"%s\\\" deleted.\\n\", convertOptions.ReleaseName)\n\n\t\t\tlog.Printf(\"Release \\\"%s\\\" was converted successfully from Helm v2 to Helm v3.\\n\", convertOptions.ReleaseName)\n\t\t}\n\t} else {\n\t\tif !convertOptions.DryRun {\n\t\t\tlog.Printf(\"Release \\\"%s\\\" was converted successfully from Helm v2 to Helm v3.\\n\", convertOptions.ReleaseName)\n\t\t\tlog.Println(\"Note: The v2 release information still remains and should be removed to avoid conflicts with the migrated v3 release.\")\n\t\t\tlog.Println(\"v2 release information should only be removed using `helm 2to3` cleanup and when all releases have been migrated over.\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1b0f79fe73150640b940608cdc87a8ee", "score": "0.45739514", "text": "func (e *ensurer) EnsureClusterAutoscalerDeployment(ctx context.Context, gctx gcontext.GardenContext, new, _ *appsv1.Deployment) error {\n\ttemplate := &new.Spec.Template\n\tps := &template.Spec\n\n\tcluster, err := gctx.GetCluster(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// cluster-autoscaler supports the \"--feature-gates\" flag starting 1.20.\n\t// Exit early and do not add the \"--feature-gates\" flag for K8s < 1.20 Shoots.\n\tk8sLessThan120, err := versionutils.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, \"<\", \"1.20\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif k8sLessThan120 {\n\t\treturn nil\n\t}\n\n\t// At this point K8s >= 1.20. As CSIMigrationKubernetesVersion is 1.19, we can assume that CSI is enabled and CSI migration is complete.\n\tcsiMigrationCompleteFeatureGate, err := computeCSIMigrationCompleteFeatureGate(cluster.Shoot.Spec.Kubernetes.Version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c := extensionswebhook.ContainerWithName(ps.Containers, \"cluster-autoscaler\"); c != nil {\n\t\tensureClusterAutoscalerCommandLineArgs(c, csiMigrationCompleteFeatureGate)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c1e8960b03ceda358ed8a4c44099307", "score": "0.45491296", "text": "func (vs *ViewServer) promote() {\n\t// promote backup to primary\n\tif vs.view.Backup != \"\" {\n\t\tvs.view.Viewnum++\n\t\tvs.view.Primary = vs.view.Backup\n\t\tvs.view.Backup = \"\"\n\t}\n}", "title": "" }, { "docid": "3820f3377852f9fd1fbdf783c41efedd", "score": "0.45352504", "text": "func (vc *Provisioner) updateAnnotations(cluster *clusterv1.Cluster, machine *clusterv1.Machine, vmIP string, vm *object.VirtualMachine) error {\n\tnmachine := machine.DeepCopy()\n\tif nmachine.ObjectMeta.Annotations == nil {\n\t\tnmachine.ObjectMeta.Annotations = make(map[string]string)\n\t}\n\tnmachine.ObjectMeta.Annotations[constants.VmIpAnnotationKey] = vmIP\n\tnmachine.ObjectMeta.Annotations[constants.ControlPlaneVersionAnnotationKey] = nmachine.Spec.Versions.ControlPlane\n\tnmachine.ObjectMeta.Annotations[constants.KubeletVersionAnnotationKey] = nmachine.Spec.Versions.Kubelet\n\tnmachine.ObjectMeta.Annotations[constants.VirtualMachineRef] = vm.Reference().Value\n\n\t_, err := vc.clusterV1alpha1.Machines(nmachine.Namespace).Update(nmachine)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Update the cluster status with updated time stamp for tracking purposes\n\tncluster := cluster.DeepCopy()\n\tstatus := &vsphereconfig.VsphereClusterProviderStatus{LastUpdated: time.Now().UTC().String()}\n\tout, err := json.Marshal(status)\n\tif err != nil {\n\t\treturn err\n\t}\n\tncluster.Status.ProviderStatus = &runtime.RawExtension{Raw: out}\n\t_, err = vc.clusterV1alpha1.Clusters(ncluster.Namespace).UpdateStatus(ncluster)\n\tif err != nil {\n\t\tglog.Infof(\"Error in updating the status: %s\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8b10079b45c5aac05a71d9fe5de65585", "score": "0.45346925", "text": "func getDesiredCatalogConfigMap(\n\tprestocluster *prestooperatorv1alpha1.PrestoCluster) *corev1.ConfigMap {\n\tvar propertiesJmx = map[string]string{\n\t\t\"connector.name\": \"jmx\",\n\t}\n\tvar propertiesMemory = map[string]string{\n\t\t\"connector.name\": \"memory\",\n\t}\n\tvar propertiesTpcds = map[string]string{\n\t\t\"connector.name\": \"tpcds\",\n\t}\n\tvar propertiesTpch = map[string]string{\n\t\t\"connector.name\": \"tpch\",\n\t\t\"tpch.splits-per-node\": \"4\",\n\t}\n\tvar propertiesHive = map[string]string{\n\t\t\"connector.name\": \"hive-hadoop2\",\n\t\t\"hive.metastore.uri\": \"thrift://\" + prestocluster.Spec.CatalogConfig.HiveMetastoreIP + \":\" + prestocluster.Spec.CatalogConfig.HiveMetastorePort,\n\t\t\"hive.config.resources\": \"/tmp/core-site.xml\",\n\t\t\"hive.non-managed-table-writes-enabled\": \"true\",\n\t\t\"hive.allow-add-column\": \"true\",\n\t\t\"hive.allow-drop-column\": \"true\",\n\t\t\"hive.allow-drop-table\": \"true\",\n\t\t\"hive.allow-rename-table\": \"true\",\n\t\t\"hive.allow-rename-column\": \"true\",\n\t}\n\tvar coresite = fmt.Sprintf(coreSite,\n\t\tprestocluster.Spec.CatalogConfig.FsDefaultFS,\n\t\tprestocluster.Spec.CatalogConfig.CosnSecretID,\n\t\tprestocluster.Spec.CatalogConfig.CosnSecretKey,\n\t\tprestocluster.Spec.CatalogConfig.CosnRegion,\n\t)\n\n\tvar data = map[string]string{\n\t\t\"jmx.properties\": getProperties(propertiesJmx),\n\t\t\"memory.properties\": getProperties(propertiesMemory),\n\t\t\"tpcds.properties\": getProperties(propertiesTpcds),\n\t\t\"tpch.properties\": getProperties(propertiesTpch),\n\t\t\"hive.properties\": getProperties(propertiesHive),\n\t\t\"core-site.xml\": getPropertiesStrings(coresite),\n\t}\n\t// dynimic config name\n\tdynamicConfigs := prestocluster.Spec.CatalogConfig.DynamicConfigs\n\tfor _, dynamicConfig := range dynamicConfigs {\n\t\tconfigName, configValue, err := splitDynamicConfigs(dynamicConfig)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Failed to convert dynamicConfig for %s, err: %v\", dynamicConfig, err)\n\t\t\tcontinue\n\t\t}\n\t\tdanamicConfigsArgs := splitDynamicConfigsArgs(configValue)\n\t\tif len(danamicConfigsArgs) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tvar dynamicArgs = map[string]string{}\n\t\tfor _, danamicConfigsArg := range danamicConfigsArgs {\n\t\t\targsKey, argsValue, err := splitDynamicArgs(danamicConfigsArg)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to convert args for dynamicConfig %s, err: %v\", dynamicConfig, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdynamicArgs[argsKey] = argsValue\n\t\t}\n\t\tif value, exist := data[configName]; exist {\n\t\t\tdata[configName] = getProperties(dynamicArgs) + value\n\t\t} else {\n\t\t\tdata[configName] = getProperties(dynamicArgs)\n\t\t}\n\t}\n\n\tvar clusterName = prestocluster.Name\n\treturn newConfigmap(prestocluster, getCatalogConfigMapName(clusterName), data)\n\n}", "title": "" }, { "docid": "3aaafc26c6037f963eaaa869c6d451b6", "score": "0.4532856", "text": "func (strategy) PrepareForUpdate(obj, old runtime.Object) {\n\t_ = obj.(*api.DeploymentConfig)\n\t// TODO: need to ensure status.latestVersion is not set out of order\n}", "title": "" }, { "docid": "21234f6d8ed07488a4bb7f3f1f2bda8e", "score": "0.45049015", "text": "func (cc *clusters) update(c storage.Cluster) {\n\tcc.Lock()\n\tdefer cc.Unlock()\n\n\tcw := cc.cw[c.Name()]\n\tif cw == nil {\n\t\t// This is a new cluster - create a watch for it and set the initial value\n\t\tcc.log.Debugf(\"registering new cluster %s@%d\", c.Name(), c.Config().Version())\n\t\tcw = &clusterWatchable{\n\t\t\tw: xwatch.NewWatchable(),\n\t\t\tv: c.Config().Version(),\n\t\t}\n\t\tcc.cw[c.Name()] = cw\n\t\tcw.w.Update(c)\n\t\treturn\n\t}\n\n\t// This is an existing cluster and the version has updated, notify watches\n\tif cw.v < c.Config().Version() {\n\t\tcc.log.Debugf(\"update config for cluster %s from %d to %d\", c.Name(), cw.v, c.Config().Version())\n\t\tcw.v = c.Config().Version()\n\t\tcw.w.Update(c)\n\t}\n}", "title": "" }, { "docid": "b774a119315ce5fe1364ce2160121aad", "score": "0.44916293", "text": "func updateConfigMap(configMap *v1.ConfigMap, clientset kubernetes.Interface, newServiceObject *v1.Service, ingressHost string, namespace string) {\n\tif configMap.Data == nil {\n\t\tconfigMap.Data = make(map[string]string)\n\t}\n\tconfigMap.Data[newServiceObject.Name+\"-\"+newServiceObject.Namespace] = ingressHost\n\t_, err := clientset.CoreV1().ConfigMaps(namespace).Update(configMap)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Can not update config map in namespace: %v, with error: %v\", namespace, err)\n\t}\n\n\tlogrus.Infof(\"Configmap updated in namespace: %v\", namespace)\n}", "title": "" }, { "docid": "40e0d58b2b8de045f16da186a534a460", "score": "0.4491586", "text": "func PromoteService(ctx *clicontext.CLIContext, resource types.Resource, rolloutConfig *riov1.RolloutConfig, promoteWeight int) error {\n\tvar allErrors []error\n\tsvcs, err := util.ListAppServicesFromAppName(ctx, resource.Namespace, resource.App)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(svcs) == 0 {\n\t\treturn errors.New(\"no services found\")\n\t}\n\tfor _, s := range svcs {\n\t\tapp, version := services.AppAndVersion(&s)\n\t\tif (version == resource.Version && promotedSvcNeedsUpdate(&s, promoteWeight, rolloutConfig) == true) || (version != resource.Version && s.Status.ComputedWeight != nil && *s.Status.ComputedWeight > 0) {\n\t\t\terr := ctx.UpdateResource(types.Resource{\n\t\t\t\tNamespace: s.Namespace,\n\t\t\t\tName: s.Name,\n\t\t\t\tApp: app,\n\t\t\t\tVersion: version,\n\t\t\t\tType: types.ServiceType,\n\t\t\t}, func(obj runtime.Object) error {\n\t\t\t\ts := obj.(*riov1.Service)\n\t\t\t\ts.Spec.RolloutConfig = rolloutConfig\n\t\t\t\tif s.Spec.Weight == nil {\n\t\t\t\t\ts.Spec.Weight = new(int)\n\t\t\t\t}\n\t\t\t\tif version == resource.Version {\n\t\t\t\t\t*s.Spec.Weight = promoteWeight\n\t\t\t\t} else {\n\t\t\t\t\t*s.Spec.Weight = 0\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tallErrors = append(allErrors, err)\n\t\t}\n\t}\n\treturn merr.NewErrors(allErrors...)\n}", "title": "" }, { "docid": "0abb6ef9134ad17a44ce86b821dfca32", "score": "0.44879937", "text": "func (strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n\tnewDc := obj.(*appsapi.DeploymentConfig)\n\toldDc := old.(*appsapi.DeploymentConfig)\n\n\t// Allow the status fields that need to be updated in every instantiation.\n\toldStatus := oldDc.Status\n\toldStatus.LatestVersion = newDc.Status.LatestVersion\n\toldStatus.Details = newDc.Status.Details\n\tnewDc.Status = oldStatus\n\n\tif !reflect.DeepEqual(oldDc.Spec, newDc.Spec) || newDc.Status.LatestVersion != oldDc.Status.LatestVersion {\n\t\tnewDc.Generation = oldDc.Generation + 1\n\t}\n}", "title": "" }, { "docid": "4c28a6809393cb3312a997b6b2d397b2", "score": "0.44864002", "text": "func deploymentPodProvision(ss *ServiceState, d *types.Deployment) (err error) {\n\n\tt := d.Meta.Updated\n\n\tvar (\n\t\tprovision = false\n\t)\n\n\tdefer func() {\n\t\tif err == nil {\n\t\t\terr = deploymentUpdate(d, t)\n\t\t}\n\t}()\n\n\tvar (\n\t\tst = []string{\n\t\t\ttypes.StateError,\n\t\t\ttypes.StateWarning,\n\t\t\ttypes.StateCreated,\n\t\t\ttypes.StateProvision,\n\t\t\ttypes.StateReady,\n\t\t}\n\t\tpm = distribution.NewPodModel(context.Background(), envs.Get().GetStorage())\n\t)\n\n\tpods, ok := ss.pod.list[d.SelfLink()]\n\tif !ok {\n\t\tpods = make(map[string]*types.Pod, 0)\n\t}\n\n\tfor {\n\n\t\tvar (\n\t\t\ttotal int\n\t\t\tstate = make(map[string][]*types.Pod)\n\t\t)\n\n\t\tfor _, p := range pods {\n\n\t\t\tif p.Status.State != types.StateDestroy && p.Status.State != types.StateDestroyed {\n\n\t\t\t\tif p.Meta.Node != types.EmptyString {\n\n\t\t\t\t\tm, e := pm.ManifestGet(p.Meta.Node, p.SelfLink())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terr = e\n\t\t\t\t\t\treturn e\n\t\t\t\t\t}\n\n\t\t\t\t\tif m == nil {\n\t\t\t\t\t\tif err = podManifestPut(p); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\ttotal++\n\t\t\t}\n\n\t\t\tif _, ok := state[p.Status.State]; !ok {\n\t\t\t\tstate[p.Status.State] = make([]*types.Pod, 0)\n\t\t\t}\n\n\t\t\tstate[p.Status.State] = append(state[p.Status.State], p)\n\t\t}\n\n\t\tif d.Spec.Replicas == total {\n\t\t\tbreak\n\t\t}\n\n\t\tif d.Spec.Replicas > total {\n\t\t\tlog.V(logLevel).Debugf(\"create additional replica: %d -> %d\", total, d.Spec.Replicas)\n\t\t\tp, err := podCreate(d)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"%s\", err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpods[p.SelfLink()] = p\n\t\t\tprovision = true\n\t\t\tcontinue\n\t\t}\n\n\t\tif d.Spec.Replicas < total {\n\t\t\tlog.V(logLevel).Debugf(\"remove unneeded replica: %d -> %d\", total, d.Spec.Replicas)\n\t\t\tfor _, s := range st {\n\n\t\t\t\tif len(state[s]) > 0 {\n\n\t\t\t\t\tp := state[s][0]\n\n\t\t\t\t\tif err := podDestroy(ss, p); err != nil {\n\t\t\t\t\t\tlog.Errorf(\"%s\", err.Error())\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\tprovision = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif provision {\n\t\tif d.Status.State != types.StateProvision {\n\t\t\td.Status.State = types.StateProvision\n\t\t\td.Meta.Updated = time.Now()\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a0f350f4e7ce08a59b0dee70d8c8970d", "score": "0.44853836", "text": "func (a *AgentClusterInstallValidatingAdmissionHook) validateUpdate(admissionSpec *admissionv1.AdmissionRequest) *admissionv1.AdmissionResponse {\n\tcontextLogger := log.WithFields(log.Fields{\n\t\t\"operation\": admissionSpec.Operation,\n\t\t\"group\": admissionSpec.Resource.Group,\n\t\t\"version\": admissionSpec.Resource.Version,\n\t\t\"resource\": admissionSpec.Resource.Resource,\n\t\t\"method\": \"validateUpdate\",\n\t})\n\n\tnewObject := &hiveext.AgentClusterInstall{}\n\tif err := a.decoder.DecodeRaw(admissionSpec.Object, newObject); err != nil {\n\t\tcontextLogger.Errorf(\"Failed unmarshaling Object: %v\", err.Error())\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: false,\n\t\t\tResult: &metav1.Status{\n\t\t\t\tStatus: metav1.StatusFailure, Code: http.StatusBadRequest, Reason: metav1.StatusReasonBadRequest,\n\t\t\t\tMessage: err.Error(),\n\t\t\t},\n\t\t}\n\t}\n\n\t// Add the new data to the contextLogger\n\tcontextLogger.Data[\"object.Name\"] = newObject.Name\n\n\toldObject := &hiveext.AgentClusterInstall{}\n\tif err := a.decoder.DecodeRaw(admissionSpec.OldObject, oldObject); err != nil {\n\t\tcontextLogger.Errorf(\"Failed unmarshaling OldObject: %v\", err.Error())\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: false,\n\t\t\tResult: &metav1.Status{\n\t\t\t\tStatus: metav1.StatusFailure, Code: http.StatusBadRequest, Reason: metav1.StatusReasonBadRequest,\n\t\t\t\tMessage: err.Error(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif !areImageSetRefsEqual(oldObject.Spec.ImageSetRef, newObject.Spec.ImageSetRef) {\n\t\tmessage := \"Attempted to change AgentClusterInstall.ImageSetRef which is immutable\"\n\t\tcontextLogger.Errorf(\"Failed validation: %v\", message)\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: false,\n\t\t\tResult: &metav1.Status{\n\t\t\t\tStatus: metav1.StatusFailure, Code: http.StatusBadRequest, Reason: metav1.StatusReasonBadRequest,\n\t\t\t\tMessage: message,\n\t\t\t},\n\t\t}\n\t}\n\n\tif isUserManagedNetworkingSetToFalseWithSNO(newObject) {\n\t\tmessage := \"UserManagedNetworking must be set to true with SNO\"\n\t\tcontextLogger.Errorf(\"Failed validation: %v\", message)\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: false,\n\t\t\tResult: &metav1.Status{\n\t\t\t\tStatus: metav1.StatusFailure, Code: http.StatusConflict, Reason: metav1.StatusReasonConflict,\n\t\t\t\tMessage: message,\n\t\t\t},\n\t\t}\n\t}\n\n\tif err := validateUpdatePlatformAndUMNUpdate(oldObject, newObject); err != nil {\n\t\tcontextLogger.Errorf(\"Failed validation: %s\", err.Error())\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: false,\n\t\t\tResult: &metav1.Status{\n\t\t\t\tStatus: metav1.StatusFailure, Code: http.StatusConflict, Reason: metav1.StatusReasonConflict,\n\t\t\t\tMessage: err.Error(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif installAlreadyStarted(newObject.Status.Conditions) {\n\t\tignoreChanges := mutableFields\n\t\t// MGMT-12794 This function returns true if the ProvisionRequirements field\n\t\t// has changed after installation completion. A change to this section has no effect\n\t\t// at this stage, but it is needed to serve some CI/CD gitops flows.\n\t\tif installCompleted(newObject.Status.Conditions) {\n\t\t\tignoreChanges = append(ignoreChanges, \"ProvisionRequirements\")\n\t\t}\n\t\thasChangedImmutableField, unsupportedDiff := hasChangedImmutableField(&oldObject.Spec, &newObject.Spec, ignoreChanges)\n\t\tif hasChangedImmutableField {\n\t\t\tmessage := fmt.Sprintf(\"Attempted to change AgentClusterInstall.Spec which is immutable after install started, except for %s fields. Unsupported change: \\n%s\", strings.Join(mutableFields, \",\"), unsupportedDiff)\n\t\t\tcontextLogger.Infof(\"Failed validation: %v\", message)\n\t\t\tcontextLogger.Error(message)\n\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\tAllowed: false,\n\t\t\t\tResult: &metav1.Status{\n\t\t\t\t\tStatus: metav1.StatusFailure, Code: http.StatusBadRequest, Reason: metav1.StatusReasonBadRequest,\n\t\t\t\t\tMessage: message,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we get here, then all checks passed, so the object is valid.\n\tcontextLogger.Info(\"Successful validation\")\n\treturn &admissionv1.AdmissionResponse{\n\t\tAllowed: true,\n\t}\n}", "title": "" }, { "docid": "8153dc606ac1c150cfa2881a3a9b89ca", "score": "0.44625857", "text": "func (d *pmemCSIDeployment) redeploy(ctx context.Context, r *ReconcileDeployment, ro redeployObject) (finalObj client.Object, finalErr error) {\n\tl := klog.FromContext(ctx).WithName(\"redeploy\")\n\n\t// Get an instance with right type and meta data, prepare for logging.\n\to := ro.object(d)\n\tif o == nil {\n\t\treturn nil, fmt.Errorf(\"nil object\")\n\t}\n\tl = l.WithValues(\"object\", pmemlog.KObj(o))\n\tctx = klog.NewContext(ctx, l)\n\n\t// Retrieve actual object from APIserver, it it exists.\n\tif err := d.getSubObject(ctx, r, o); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The underlying object should implement client.Object, but\n\t// DeepCopyObject doesn't return a typed pointer, so we have\n\t// to cast explicitly.\n\tclone := o.DeepCopyObject()\n\tclientObject, ok := clone.(client.Object)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"internal error: %T does not implement client.Object\", clone)\n\t}\n\n\t// Prepare for patching by remembering the base object.\n\tpatch := client.MergeFrom(clientObject)\n\n\t// Now set all values that we care about...\n\tif err := ro.modify(d, o); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// ... and also the labels.\n\tlabels := o.GetLabels()\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\tfor key, value := range d.Spec.Labels {\n\t\tlabels[key] = value\n\t}\n\to.SetLabels(labels)\n\n\t// Now create or patch the object. If we have a resource\n\t// version, then the object was retrieved from the apiserver\n\t// and can be patched.\n\tdoPatch := o.GetResourceVersion() != \"\"\n\tif doPatch {\n\t\tdata, err := patch.Data(o)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"generate patch: %v\", err)\n\t\t}\n\t\t// Check whether we really need to patch.\n\t\tif string(data) != \"{}\" && len(data) >= 0 {\n\t\t\tl.V(5).Info(\"patch\", \"diff\", string(data))\n\t\t\tif ro.immutable {\n\t\t\t\t// Delete and re-create below.\n\t\t\t\tdoPatch = false\n\t\t\t\to.SetResourceVersion(\"\")\n\t\t\t\tl.V(5).Info(\"immutable -> delete and re-create\")\n\t\t\t\tif err := r.client.Delete(ctx, o); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"delete object: %v\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Patch() will modify the object, which is an object that was\n\t\t\t\t// generated from our PmemCSIDeployment object and shares some\n\t\t\t\t// data structure with it. We don't want those to be modified,\n\t\t\t\t// so here we have to do a deep copy first.\n\t\t\t\tcopy, err := cloneObject(o)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"internal error: %v\", err)\n\t\t\t\t}\n\t\t\t\tl.V(3).Info(\"update\", \"patch\", string(data))\n\t\t\t\tif err := r.client.Patch(ctx, copy, patch); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"patch object: %v\", err)\n\t\t\t\t}\n\t\t\t\tif err := metrics.SetSubResourceUpdateMetric(o); err != nil {\n\t\t\t\t\tl.V(3).Error(err, \"failed to set sub-resource metrics\", \"object\", o)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif !doPatch {\n\t\t// For unknown reason client.Create() clearing off the\n\t\t// GVK on obj, so restore it manually.\n\t\tgvk := o.GetObjectKind().GroupVersionKind()\n\t\tl.V(3).Info(\"create\")\n\t\tif err := r.client.Create(ctx, o); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"create object: %v\", err)\n\t\t}\n\t\to.GetObjectKind().SetGroupVersionKind(gvk)\n\t\tif err := metrics.SetSubResourceCreateMetric(o); err != nil {\n\t\t\tl.V(3).Error(err, \"failed to set sub-resource metrics\", \"object\", o)\n\t\t}\n\t}\n\n\t// Final per-object changes, like emitting events or setting status.\n\tif ro.postUpdate != nil {\n\t\tif err := ro.postUpdate(d, o); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn o, nil\n}", "title": "" }, { "docid": "e5620bf09fa157533fe8af254f17f6d7", "score": "0.44570184", "text": "func Scale_yarn_cluster(clustername string, numInstances int) {\n\tlogger := utils.Logger()\n\tfmt.Println(\"Scaling yarn cluster\", clustername, \"with\", numInstances, \"containers...\")\n\tvar (\n\t\terrChan = make(chan (error))\n\t\tresChan = make(chan (string))\n\t\tresult = ScaleResult{Scaled: make([]string, 0), Errors: make([]string, 0)}\n\t\tlock sync.Mutex // when set container affinities to swarm cluster, must use mutex\n\t)\n\tswarm_master_ip := viper.GetString(\"clusters.swarm_master_ip\")\n\tswarm_master_port := viper.GetString(\"clusters.swarm_master_port\")\n\tendpoint := \"tcp://\" + swarm_master_ip + \":\" + swarm_master_port\n\tclient, err := dockerclient.NewDockerClient(endpoint, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err != nil {\n\t\tfmt.Println(\"Cannot connect to the swarm master.\")\n\t}\n\tname := viper.GetString(\"base_container.\" + clustername)\n\tid := Convert_name2ID(name)\n\tif id == \"\" {\n\t\tfmt.Println(\"The base container \", name, \" does not exist.\")\n\t\tos.Exit(1)\n\t}\n\tlogger.WithFields(logrus.Fields{\"Time\": time.Now(), \"ContainerID\": id, \"Action\": \"SCALE\"}).Info(\"Scale yarn clsuter \" + clustername + \" with base container \" + id + \" to \" + strconv.Itoa(numInstances) + \" nodemanagers\")\n\tcontainerInfo, err := client.InspectContainer(id)\n\tif err != nil {\n\t\tresult.Errors = append(result.Errors, err.Error())\n\t}\n\t//from shipyard\n\tnodes, err := ParseClusterNodes()\n\tcontainers := Get_all_yarn_containers()\n\tvar hostname = \"\"\n\tvar cpuNum int64\n\tfor i := range containers {\n\t\tif containers[i].Name == name {\n\t\t\thostname = containers[i].Host\n\t\t}\n\t}\n\t//Get the swarm node cpu number, for example 12 or 25\n\tfor _, node := range nodes {\n\t\tif node.Name == hostname {\n\t\t\tcpuNum, err = strconv.ParseInt(strings.Split(node.ReservedCPUs, \" \")[2], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n\tfor i := 0; i < numInstances; i++ {\n\t\tgo func(instance int) {\n\t\t\t//log.Debugf(\"scaling: id=%s #=%d\", containerInfo.ID, instance)\n\t\t\tconfig := containerInfo.Config\n\t\t\t// clear hostname to get a newly generated\n\t\t\tconfig.Hostname = \"\"\n\t\t\thostConfig := *containerInfo.HostConfig\n\t\t\thostConfig.CpuShares = containerInfo.HostConfig.CpuShares * cpuNum / 1024.0\n\t\t\tconfig.HostConfig = hostConfig\n\t\t\tlock.Lock()\n\t\t\tdefer lock.Unlock()\n\t\t\tid, err := client.CreateContainer(config, \"\", nil)\n\t\t\tfmt.Println(\"New container created\", id)\n\t\t\tlogger.WithFields(logrus.Fields{\"Time\": time.Now(), \"ContainerID\": id, \"Action\": \"CREATE\"}).Info(\"Create container \" + id)\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := client.StartContainer(id, nil); err != nil {\n\t\t\t\terrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresChan <- id\n\t\t}(i)\n\t}\n\n\tfor i := 0; i < numInstances; i++ {\n\t\tselect {\n\t\tcase id := <-resChan:\n\t\t\tresult.Scaled = append(result.Scaled, id)\n\t\tcase err := <-errChan:\n\t\t\tresult.Errors = append(result.Errors, strings.TrimSpace(err.Error()))\n\t\t}\n\t}\n\t//Rename new containers\n\t//New name format like: yarn2-20161017132558-7\n\tif len(result.Errors) == 0 {\n\t\tcontainers := result.Scaled\n\t\tfor i, c := range containers {\n\t\t\toldname := c[0:12]\n\t\t\tvar newname string\n\t\t\tnewname = clustername + \"-\" + time.Now().Format(\"20060102150405\") + \"-\" + strconv.Itoa(i)\n\t\t\tfmt.Println(\"Rename container\", oldname, \"as\", newname)\n\t\t\tlogger.WithFields(logrus.Fields{\"Time\": time.Now(), \"ContainerID\": id, \"Action\": \"RENAME\"}).Info(\"Rename container \" + oldname + \" to \" + newname)\n\t\t\tclient.RenameContainer(oldname, newname)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "31d2b2636fd602c9e5b6ce10a4ffadff", "score": "0.4454527", "text": "func (r *Reconciler) scaleChildResources(ctx context.Context, mLog logr.Logger,\n\tmanualScalar oamv1alpha2.ManualScalerTrait, resources []*unstructured.Unstructured) (ctrl.Result, error) {\n\t// scale all the child resources that is of kind deployment\n\tisController := false\n\tbod := true\n\tfound := false\n\t// Update owner references\n\townerRef := metav1.OwnerReference{\n\t\tAPIVersion: manualScalar.APIVersion,\n\t\tKind: manualScalar.Kind,\n\t\tName: manualScalar.Name,\n\t\tUID: manualScalar.UID,\n\t\tController: &isController,\n\t\tBlockOwnerDeletion: &bod,\n\t}\n\tfor _, res := range resources {\n\t\tif res.GetKind() == util.KindDeployment && res.GetAPIVersion() == appsv1.SchemeGroupVersion.String() {\n\t\t\tfound = true\n\t\t\tresPatch := client.MergeFrom(res.DeepCopyObject())\n\t\t\tmLog.Info(\"Get the deployment the trait is going to modify\",\n\t\t\t\t\"deploy name\", res.GetName(), \"UID\", res.GetUID())\n\t\t\tcpmeta.AddOwnerReference(res, ownerRef)\n\t\t\tunstructured.SetNestedField(res.Object, int64(manualScalar.Spec.ReplicaCount), \"spec\", \"replicas\")\n\t\t\t// merge patch to scale the deployment\n\t\t\tif err := r.Patch(ctx, res, resPatch, client.FieldOwner(manualScalar.GetUID())); err != nil {\n\t\t\t\tmLog.Error(err, \"Failed to scale a deployment\")\n\t\t\t\treturn util.ReconcileWaitResult,\n\t\t\t\t\tutil.PatchCondition(ctx, r, &manualScalar, cpv1alpha1.ReconcileError(errors.Wrap(err, errScaleDeployment)))\n\t\t\t}\n\t\t\tmLog.Info(\"Successfully scaled a deployment\", \"UID\", res.GetUID(), \"target replica\",\n\t\t\t\tmanualScalar.Spec.ReplicaCount)\n\t\t}\n\t}\n\tif !found {\n\t\tmLog.Info(\"Cannot locate any deployment\", \"total resources\", len(resources))\n\t\treturn util.ReconcileWaitResult,\n\t\t\tutil.PatchCondition(ctx, r, &manualScalar, cpv1alpha1.ReconcileError(fmt.Errorf(errLocateDeployment)))\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "8c4f0829d556af82ec2576a75283ccbf", "score": "0.44467616", "text": "func (w *Watcher) PromoteDeployment(req *structs.DeploymentPromoteRequest, resp *structs.DeploymentUpdateResponse) error {\n\twatcher, err := w.getOrCreateWatcher(req.DeploymentID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn watcher.PromoteDeployment(req, resp)\n}", "title": "" }, { "docid": "a4d35411a9b2523b6460274b5534946a", "score": "0.44457135", "text": "func resourceVolterraOriginPoolUpdate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tupdateMeta := &ves_io_schema.ObjectReplaceMetaType{}\n\tupdateSpec := &ves_io_schema_views_origin_pool.ReplaceSpecType{}\n\tupdateReq := &ves_io_schema_views_origin_pool.ReplaceRequest{\n\t\tMetadata: updateMeta,\n\t\tSpec: updateSpec,\n\t}\n\tif v, ok := d.GetOk(\"annotations\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tupdateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Disable =\n\t\t\tv.(bool)\n\t}\n\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tupdateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"advanced_options\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tadvancedOptions := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions{}\n\t\tupdateSpec.AdvancedOptions = advancedOptions\n\t\tfor _, set := range sl {\n\t\t\tadvancedOptionsMapStrToI := set.(map[string]interface{})\n\n\t\t\tcircuitBreakerChoiceTypeFound := false\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"circuit_breaker\"]; ok && !isIntfNil(v) && !circuitBreakerChoiceTypeFound {\n\n\t\t\t\tcircuitBreakerChoiceTypeFound = true\n\t\t\t\tcircuitBreakerChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_CircuitBreaker{}\n\t\t\t\tcircuitBreakerChoiceInt.CircuitBreaker = &ves_io_schema_cluster.CircuitBreaker{}\n\t\t\t\tadvancedOptions.CircuitBreakerChoice = circuitBreakerChoiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"connection_limit\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tcircuitBreakerChoiceInt.CircuitBreaker.ConnectionLimit = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"max_requests\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tcircuitBreakerChoiceInt.CircuitBreaker.MaxRequests = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"pending_requests\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tcircuitBreakerChoiceInt.CircuitBreaker.PendingRequests = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"priority\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tcircuitBreakerChoiceInt.CircuitBreaker.Priority = ves_io_schema.RoutingPriority(ves_io_schema.RoutingPriority_value[v.(string)])\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"retries\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tcircuitBreakerChoiceInt.CircuitBreaker.Retries = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"default_circuit_breaker\"]; ok && !isIntfNil(v) && !circuitBreakerChoiceTypeFound {\n\n\t\t\t\tcircuitBreakerChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tcircuitBreakerChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_DefaultCircuitBreaker{}\n\t\t\t\t\tcircuitBreakerChoiceInt.DefaultCircuitBreaker = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.CircuitBreakerChoice = circuitBreakerChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"disable_circuit_breaker\"]; ok && !isIntfNil(v) && !circuitBreakerChoiceTypeFound {\n\n\t\t\t\tcircuitBreakerChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tcircuitBreakerChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_DisableCircuitBreaker{}\n\t\t\t\t\tcircuitBreakerChoiceInt.DisableCircuitBreaker = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.CircuitBreakerChoice = circuitBreakerChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif w, ok := advancedOptionsMapStrToI[\"connection_timeout\"]; ok && !isIntfNil(w) {\n\t\t\t\tadvancedOptions.ConnectionTimeout = uint32(w.(int))\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"header_transformation_type\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\theaderTransformationType := &ves_io_schema.HeaderTransformationType{}\n\t\t\t\tadvancedOptions.HeaderTransformationType = headerTransformationType\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\theaderTransformationTypeMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\theaderTransformationChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := headerTransformationTypeMapStrToI[\"default_header_transformation\"]; ok && !isIntfNil(v) && !headerTransformationChoiceTypeFound {\n\n\t\t\t\t\t\theaderTransformationChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\theaderTransformationChoiceInt := &ves_io_schema.HeaderTransformationType_DefaultHeaderTransformation{}\n\t\t\t\t\t\t\theaderTransformationChoiceInt.DefaultHeaderTransformation = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\theaderTransformationType.HeaderTransformationChoice = headerTransformationChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := headerTransformationTypeMapStrToI[\"proper_case_header_transformation\"]; ok && !isIntfNil(v) && !headerTransformationChoiceTypeFound {\n\n\t\t\t\t\t\theaderTransformationChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\theaderTransformationChoiceInt := &ves_io_schema.HeaderTransformationType_ProperCaseHeaderTransformation{}\n\t\t\t\t\t\t\theaderTransformationChoiceInt.ProperCaseHeaderTransformation = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\theaderTransformationType.HeaderTransformationChoice = headerTransformationChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif w, ok := advancedOptionsMapStrToI[\"http_idle_timeout\"]; ok && !isIntfNil(w) {\n\t\t\t\tadvancedOptions.HttpIdleTimeout = uint32(w.(int))\n\t\t\t}\n\n\t\t\thttpProtocolTypeTypeFound := false\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"auto_http_config\"]; ok && !isIntfNil(v) && !httpProtocolTypeTypeFound {\n\n\t\t\t\thttpProtocolTypeTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\thttpProtocolTypeInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_AutoHttpConfig{}\n\t\t\t\t\thttpProtocolTypeInt.AutoHttpConfig = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.HttpProtocolType = httpProtocolTypeInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"http1_config\"]; ok && !isIntfNil(v) && !httpProtocolTypeTypeFound {\n\n\t\t\t\thttpProtocolTypeTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\thttpProtocolTypeInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_Http1Config{}\n\t\t\t\t\thttpProtocolTypeInt.Http1Config = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.HttpProtocolType = httpProtocolTypeInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"http2_options\"]; ok && !isIntfNil(v) && !httpProtocolTypeTypeFound {\n\n\t\t\t\thttpProtocolTypeTypeFound = true\n\t\t\t\thttpProtocolTypeInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_Http2Options{}\n\t\t\t\thttpProtocolTypeInt.Http2Options = &ves_io_schema_cluster.Http2ProtocolOptions{}\n\t\t\t\tadvancedOptions.HttpProtocolType = httpProtocolTypeInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"enabled\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\thttpProtocolTypeInt.Http2Options.Enabled = v.(bool)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\toutlierDetectionChoiceTypeFound := false\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"disable_outlier_detection\"]; ok && !isIntfNil(v) && !outlierDetectionChoiceTypeFound {\n\n\t\t\t\toutlierDetectionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\toutlierDetectionChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_DisableOutlierDetection{}\n\t\t\t\t\toutlierDetectionChoiceInt.DisableOutlierDetection = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.OutlierDetectionChoice = outlierDetectionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"outlier_detection\"]; ok && !isIntfNil(v) && !outlierDetectionChoiceTypeFound {\n\n\t\t\t\toutlierDetectionChoiceTypeFound = true\n\t\t\t\toutlierDetectionChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_OutlierDetection{}\n\t\t\t\toutlierDetectionChoiceInt.OutlierDetection = &ves_io_schema_cluster.OutlierDetectionType{}\n\t\t\t\tadvancedOptions.OutlierDetectionChoice = outlierDetectionChoiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"base_ejection_time\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\toutlierDetectionChoiceInt.OutlierDetection.BaseEjectionTime = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"consecutive_5xx\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\toutlierDetectionChoiceInt.OutlierDetection.Consecutive_5Xx = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"consecutive_gateway_failure\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\toutlierDetectionChoiceInt.OutlierDetection.ConsecutiveGatewayFailure = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"interval\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\toutlierDetectionChoiceInt.OutlierDetection.Interval = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"max_ejection_percent\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\toutlierDetectionChoiceInt.OutlierDetection.MaxEjectionPercent = uint32(v.(int))\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tpanicThresholdTypeTypeFound := false\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"no_panic_threshold\"]; ok && !isIntfNil(v) && !panicThresholdTypeTypeFound {\n\n\t\t\t\tpanicThresholdTypeTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tpanicThresholdTypeInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_NoPanicThreshold{}\n\t\t\t\t\tpanicThresholdTypeInt.NoPanicThreshold = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.PanicThresholdType = panicThresholdTypeInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"panic_threshold\"]; ok && !isIntfNil(v) && !panicThresholdTypeTypeFound {\n\n\t\t\t\tpanicThresholdTypeTypeFound = true\n\t\t\t\tpanicThresholdTypeInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_PanicThreshold{}\n\n\t\t\t\tadvancedOptions.PanicThresholdType = panicThresholdTypeInt\n\n\t\t\t\tpanicThresholdTypeInt.PanicThreshold = uint32(v.(int))\n\n\t\t\t}\n\n\t\t\tsubsetChoiceTypeFound := false\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"disable_subsets\"]; ok && !isIntfNil(v) && !subsetChoiceTypeFound {\n\n\t\t\t\tsubsetChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tsubsetChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_DisableSubsets{}\n\t\t\t\t\tsubsetChoiceInt.DisableSubsets = &ves_io_schema.Empty{}\n\t\t\t\t\tadvancedOptions.SubsetChoice = subsetChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := advancedOptionsMapStrToI[\"enable_subsets\"]; ok && !isIntfNil(v) && !subsetChoiceTypeFound {\n\n\t\t\t\tsubsetChoiceTypeFound = true\n\t\t\t\tsubsetChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolAdvancedOptions_EnableSubsets{}\n\t\t\t\tsubsetChoiceInt.EnableSubsets = &ves_io_schema_views_origin_pool.OriginPoolSubsets{}\n\t\t\t\tadvancedOptions.SubsetChoice = subsetChoiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"endpoint_subsets\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.([]interface{})\n\t\t\t\t\t\tendpointSubsets := make([]*ves_io_schema_cluster.EndpointSubsetSelectorType, len(sl))\n\t\t\t\t\t\tsubsetChoiceInt.EnableSubsets.EndpointSubsets = endpointSubsets\n\t\t\t\t\t\tfor i, set := range sl {\n\t\t\t\t\t\t\tendpointSubsets[i] = &ves_io_schema_cluster.EndpointSubsetSelectorType{}\n\t\t\t\t\t\t\tendpointSubsetsMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif w, ok := endpointSubsetsMapStrToI[\"keys\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tendpointSubsets[i].Keys = ls\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfallbackPolicyChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"any_endpoint\"]; ok && !isIntfNil(v) && !fallbackPolicyChoiceTypeFound {\n\n\t\t\t\t\t\tfallbackPolicyChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tfallbackPolicyChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolSubsets_AnyEndpoint{}\n\t\t\t\t\t\t\tfallbackPolicyChoiceInt.AnyEndpoint = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tsubsetChoiceInt.EnableSubsets.FallbackPolicyChoice = fallbackPolicyChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"default_subset\"]; ok && !isIntfNil(v) && !fallbackPolicyChoiceTypeFound {\n\n\t\t\t\t\t\tfallbackPolicyChoiceTypeFound = true\n\t\t\t\t\t\tfallbackPolicyChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolSubsets_DefaultSubset{}\n\t\t\t\t\t\tfallbackPolicyChoiceInt.DefaultSubset = &ves_io_schema_views_origin_pool.OriginPoolDefaultSubset{}\n\t\t\t\t\t\tsubsetChoiceInt.EnableSubsets.FallbackPolicyChoice = fallbackPolicyChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"default_subset\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tms := map[string]string{}\n\t\t\t\t\t\t\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\t\t\t\t\t\t\tms[k] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfallbackPolicyChoiceInt.DefaultSubset.DefaultSubset = ms\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"fail_request\"]; ok && !isIntfNil(v) && !fallbackPolicyChoiceTypeFound {\n\n\t\t\t\t\t\tfallbackPolicyChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tfallbackPolicyChoiceInt := &ves_io_schema_views_origin_pool.OriginPoolSubsets_FailRequest{}\n\t\t\t\t\t\t\tfallbackPolicyChoiceInt.FailRequest = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tsubsetChoiceInt.EnableSubsets.FallbackPolicyChoice = fallbackPolicyChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"endpoint_selection\"); ok && !isIntfNil(v) {\n\n\t\tupdateSpec.EndpointSelection = ves_io_schema_cluster.EndpointSelectionPolicy(ves_io_schema_cluster.EndpointSelectionPolicy_value[v.(string)])\n\n\t}\n\n\thealthCheckPortChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"health_check_port\"); ok && !healthCheckPortChoiceTypeFound {\n\n\t\thealthCheckPortChoiceTypeFound = true\n\t\thealthCheckPortChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_HealthCheckPort{}\n\n\t\tupdateSpec.HealthCheckPortChoice = healthCheckPortChoiceInt\n\n\t\thealthCheckPortChoiceInt.HealthCheckPort = uint32(v.(int))\n\n\t}\n\n\tif v, ok := d.GetOk(\"same_as_endpoint_port\"); ok && !healthCheckPortChoiceTypeFound {\n\n\t\thealthCheckPortChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\thealthCheckPortChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_SameAsEndpointPort{}\n\t\t\thealthCheckPortChoiceInt.SameAsEndpointPort = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.HealthCheckPortChoice = healthCheckPortChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"healthcheck\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.([]interface{})\n\t\thealthcheckInt := make([]*ves_io_schema_views.ObjectRefType, len(sl))\n\t\tupdateSpec.Healthcheck = healthcheckInt\n\t\tfor i, ps := range sl {\n\n\t\t\thMapToStrVal := ps.(map[string]interface{})\n\t\t\thealthcheckInt[i] = &ves_io_schema_views.ObjectRefType{}\n\n\t\t\tif v, ok := hMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\thealthcheckInt[i].Name = v.(string)\n\t\t\t}\n\n\t\t\tif v, ok := hMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\thealthcheckInt[i].Namespace = v.(string)\n\t\t\t}\n\n\t\t\tif v, ok := hMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\thealthcheckInt[i].Tenant = v.(string)\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"loadbalancer_algorithm\"); ok && !isIntfNil(v) {\n\n\t\tupdateSpec.LoadbalancerAlgorithm = ves_io_schema_cluster.LoadbalancerAlgorithm(ves_io_schema_cluster.LoadbalancerAlgorithm_value[v.(string)])\n\n\t}\n\n\tif v, ok := d.GetOk(\"origin_servers\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.([]interface{})\n\t\toriginServers := make([]*ves_io_schema_views_origin_pool.OriginServerType, len(sl))\n\t\tupdateSpec.OriginServers = originServers\n\t\tfor i, set := range sl {\n\t\t\toriginServers[i] = &ves_io_schema_views_origin_pool.OriginServerType{}\n\t\t\toriginServersMapStrToI := set.(map[string]interface{})\n\n\t\t\tchoiceTypeFound := false\n\n\t\t\tif v, ok := originServersMapStrToI[\"consul_service\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_ConsulService{}\n\t\t\t\tchoiceInt.ConsulService = &ves_io_schema_views_origin_pool.OriginServerConsulService{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tnetworkChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"inside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerConsulService_InsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.InsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.ConsulService.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"outside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerConsulService_OutsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.OutsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.ConsulService.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"service_name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tchoiceInt.ConsulService.ServiceName = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"site_locator\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tsiteLocator := &ves_io_schema_views.SiteLocator{}\n\t\t\t\t\t\tchoiceInt.ConsulService.SiteLocator = siteLocator\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tsiteLocatorMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tchoiceTypeFound := false\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_Site{}\n\t\t\t\t\t\t\t\tchoiceInt.Site = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"virtual_site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_VirtualSite{}\n\t\t\t\t\t\t\t\tchoiceInt.VirtualSite = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"custom_endpoint_object\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_CustomEndpointObject{}\n\t\t\t\tchoiceInt.CustomEndpointObject = &ves_io_schema_views_origin_pool.OriginServerCustomEndpoint{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"endpoint\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tendpointInt := &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\tchoiceInt.CustomEndpointObject.Endpoint = endpointInt\n\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\teMapToStrVal := set.(map[string]interface{})\n\t\t\t\t\t\t\tif val, ok := eMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tendpointInt.Name = val.(string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif val, ok := eMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tendpointInt.Namespace = val.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif val, ok := eMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tendpointInt.Tenant = val.(string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"k8s_service\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_K8SService{}\n\t\t\t\tchoiceInt.K8SService = &ves_io_schema_views_origin_pool.OriginServerK8SService{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tnetworkChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"inside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerK8SService_InsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.InsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.K8SService.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"outside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerK8SService_OutsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.OutsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.K8SService.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"vk8s_networks\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerK8SService_Vk8SNetworks{}\n\t\t\t\t\t\t\tnetworkChoiceInt.Vk8SNetworks = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.K8SService.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tserviceInfoTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"service_name\"]; ok && !isIntfNil(v) && !serviceInfoTypeFound {\n\n\t\t\t\t\t\tserviceInfoTypeFound = true\n\t\t\t\t\t\tserviceInfoInt := &ves_io_schema_views_origin_pool.OriginServerK8SService_ServiceName{}\n\n\t\t\t\t\t\tchoiceInt.K8SService.ServiceInfo = serviceInfoInt\n\n\t\t\t\t\t\tserviceInfoInt.ServiceName = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"service_selector\"]; ok && !isIntfNil(v) && !serviceInfoTypeFound {\n\n\t\t\t\t\t\tserviceInfoTypeFound = true\n\t\t\t\t\t\tserviceInfoInt := &ves_io_schema_views_origin_pool.OriginServerK8SService_ServiceSelector{}\n\t\t\t\t\t\tserviceInfoInt.ServiceSelector = &ves_io_schema.LabelSelectorType{}\n\t\t\t\t\t\tchoiceInt.K8SService.ServiceInfo = serviceInfoInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tserviceInfoInt.ServiceSelector.Expressions = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"site_locator\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tsiteLocator := &ves_io_schema_views.SiteLocator{}\n\t\t\t\t\t\tchoiceInt.K8SService.SiteLocator = siteLocator\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tsiteLocatorMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tchoiceTypeFound := false\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_Site{}\n\t\t\t\t\t\t\t\tchoiceInt.Site = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"virtual_site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_VirtualSite{}\n\t\t\t\t\t\t\t\tchoiceInt.VirtualSite = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"private_ip\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_PrivateIp{}\n\t\t\t\tchoiceInt.PrivateIp = &ves_io_schema_views_origin_pool.OriginServerPrivateIP{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tnetworkChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"inside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPrivateIP_InsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.InsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.PrivateIp.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"outside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPrivateIP_OutsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.OutsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.PrivateIp.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tprivateIpChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"ip\"]; ok && !isIntfNil(v) && !privateIpChoiceTypeFound {\n\n\t\t\t\t\t\tprivateIpChoiceTypeFound = true\n\t\t\t\t\t\tprivateIpChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPrivateIP_Ip{}\n\n\t\t\t\t\t\tchoiceInt.PrivateIp.PrivateIpChoice = privateIpChoiceInt\n\n\t\t\t\t\t\tprivateIpChoiceInt.Ip = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"ipv6\"]; ok && !isIntfNil(v) && !privateIpChoiceTypeFound {\n\n\t\t\t\t\t\tprivateIpChoiceTypeFound = true\n\t\t\t\t\t\tprivateIpChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPrivateIP_Ipv6{}\n\n\t\t\t\t\t\tchoiceInt.PrivateIp.PrivateIpChoice = privateIpChoiceInt\n\n\t\t\t\t\t\tprivateIpChoiceInt.Ipv6 = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"site_locator\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tsiteLocator := &ves_io_schema_views.SiteLocator{}\n\t\t\t\t\t\tchoiceInt.PrivateIp.SiteLocator = siteLocator\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tsiteLocatorMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tchoiceTypeFound := false\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_Site{}\n\t\t\t\t\t\t\t\tchoiceInt.Site = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"virtual_site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_VirtualSite{}\n\t\t\t\t\t\t\t\tchoiceInt.VirtualSite = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"private_name\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_PrivateName{}\n\t\t\t\tchoiceInt.PrivateName = &ves_io_schema_views_origin_pool.OriginServerPrivateName{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"dns_name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tchoiceInt.PrivateName.DnsName = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tnetworkChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"inside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPrivateName_InsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.InsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.PrivateName.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"outside_network\"]; ok && !isIntfNil(v) && !networkChoiceTypeFound {\n\n\t\t\t\t\t\tnetworkChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tnetworkChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPrivateName_OutsideNetwork{}\n\t\t\t\t\t\t\tnetworkChoiceInt.OutsideNetwork = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\tchoiceInt.PrivateName.NetworkChoice = networkChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"site_locator\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tsiteLocator := &ves_io_schema_views.SiteLocator{}\n\t\t\t\t\t\tchoiceInt.PrivateName.SiteLocator = siteLocator\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tsiteLocatorMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tchoiceTypeFound := false\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_Site{}\n\t\t\t\t\t\t\t\tchoiceInt.Site = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.Site.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := siteLocatorMapStrToI[\"virtual_site\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.SiteLocator_VirtualSite{}\n\t\t\t\t\t\t\t\tchoiceInt.VirtualSite = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\t\t\tsiteLocator.Choice = choiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Namespace = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tchoiceInt.VirtualSite.Tenant = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"public_ip\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_PublicIp{}\n\t\t\t\tchoiceInt.PublicIp = &ves_io_schema_views_origin_pool.OriginServerPublicIP{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tpublicIpChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"ip\"]; ok && !isIntfNil(v) && !publicIpChoiceTypeFound {\n\n\t\t\t\t\t\tpublicIpChoiceTypeFound = true\n\t\t\t\t\t\tpublicIpChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPublicIP_Ip{}\n\n\t\t\t\t\t\tchoiceInt.PublicIp.PublicIpChoice = publicIpChoiceInt\n\n\t\t\t\t\t\tpublicIpChoiceInt.Ip = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"ipv6\"]; ok && !isIntfNil(v) && !publicIpChoiceTypeFound {\n\n\t\t\t\t\t\tpublicIpChoiceTypeFound = true\n\t\t\t\t\t\tpublicIpChoiceInt := &ves_io_schema_views_origin_pool.OriginServerPublicIP_Ipv6{}\n\n\t\t\t\t\t\tchoiceInt.PublicIp.PublicIpChoice = publicIpChoiceInt\n\n\t\t\t\t\t\tpublicIpChoiceInt.Ipv6 = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"public_name\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_PublicName{}\n\t\t\t\tchoiceInt.PublicName = &ves_io_schema_views_origin_pool.OriginServerPublicName{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"dns_name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tchoiceInt.PublicName.DnsName = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"vn_private_ip\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_VnPrivateIp{}\n\t\t\t\tchoiceInt.VnPrivateIp = &ves_io_schema_views_origin_pool.OriginServerVirtualNetworkIP{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"virtual_network\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tvirtualNetworkInt := &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\tchoiceInt.VnPrivateIp.VirtualNetwork = virtualNetworkInt\n\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tvnMapToStrVal := set.(map[string]interface{})\n\t\t\t\t\t\t\tif val, ok := vnMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tvirtualNetworkInt.Name = val.(string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif val, ok := vnMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tvirtualNetworkInt.Namespace = val.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif val, ok := vnMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tvirtualNetworkInt.Tenant = val.(string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tvirtualNetworkIpChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"ip\"]; ok && !isIntfNil(v) && !virtualNetworkIpChoiceTypeFound {\n\n\t\t\t\t\t\tvirtualNetworkIpChoiceTypeFound = true\n\t\t\t\t\t\tvirtualNetworkIpChoiceInt := &ves_io_schema_views_origin_pool.OriginServerVirtualNetworkIP_Ip{}\n\n\t\t\t\t\t\tchoiceInt.VnPrivateIp.VirtualNetworkIpChoice = virtualNetworkIpChoiceInt\n\n\t\t\t\t\t\tvirtualNetworkIpChoiceInt.Ip = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"ipv6\"]; ok && !isIntfNil(v) && !virtualNetworkIpChoiceTypeFound {\n\n\t\t\t\t\t\tvirtualNetworkIpChoiceTypeFound = true\n\t\t\t\t\t\tvirtualNetworkIpChoiceInt := &ves_io_schema_views_origin_pool.OriginServerVirtualNetworkIP_Ipv6{}\n\n\t\t\t\t\t\tchoiceInt.VnPrivateIp.VirtualNetworkIpChoice = virtualNetworkIpChoiceInt\n\n\t\t\t\t\t\tvirtualNetworkIpChoiceInt.Ipv6 = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := originServersMapStrToI[\"vn_private_name\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\tchoiceTypeFound = true\n\t\t\t\tchoiceInt := &ves_io_schema_views_origin_pool.OriginServerType_VnPrivateName{}\n\t\t\t\tchoiceInt.VnPrivateName = &ves_io_schema_views_origin_pool.OriginServerVirtualNetworkName{}\n\t\t\t\toriginServers[i].Choice = choiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"dns_name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tchoiceInt.VnPrivateName.DnsName = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"private_network\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tprivateNetworkInt := &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\tchoiceInt.VnPrivateName.PrivateNetwork = privateNetworkInt\n\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tpnMapToStrVal := set.(map[string]interface{})\n\t\t\t\t\t\t\tif val, ok := pnMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tprivateNetworkInt.Name = val.(string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif val, ok := pnMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tprivateNetworkInt.Namespace = val.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif val, ok := pnMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\t\t\tprivateNetworkInt.Tenant = val.(string)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif w, ok := originServersMapStrToI[\"labels\"]; ok && !isIntfNil(w) {\n\t\t\t\tms := map[string]string{}\n\t\t\t\tfor k, v := range w.(map[string]interface{}) {\n\t\t\t\t\tms[k] = v.(string)\n\t\t\t\t}\n\t\t\t\toriginServers[i].Labels = ms\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tportChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"automatic_port\"); ok && !portChoiceTypeFound {\n\n\t\tportChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\tportChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_AutomaticPort{}\n\t\t\tportChoiceInt.AutomaticPort = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.PortChoice = portChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"lb_port\"); ok && !portChoiceTypeFound {\n\n\t\tportChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\tportChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_LbPort{}\n\t\t\tportChoiceInt.LbPort = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.PortChoice = portChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"port\"); ok && !portChoiceTypeFound {\n\n\t\tportChoiceTypeFound = true\n\t\tportChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_Port{}\n\n\t\tupdateSpec.PortChoice = portChoiceInt\n\n\t\tportChoiceInt.Port = uint32(v.(int))\n\n\t}\n\n\ttlsChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"no_tls\"); ok && !tlsChoiceTypeFound {\n\n\t\ttlsChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\ttlsChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_NoTls{}\n\t\t\ttlsChoiceInt.NoTls = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.TlsChoice = tlsChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"use_tls\"); ok && !tlsChoiceTypeFound {\n\n\t\ttlsChoiceTypeFound = true\n\t\ttlsChoiceInt := &ves_io_schema_views_origin_pool.ReplaceSpecType_UseTls{}\n\t\ttlsChoiceInt.UseTls = &ves_io_schema_views_origin_pool.UpstreamTlsParameters{}\n\t\tupdateSpec.TlsChoice = tlsChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tmtlsChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"no_mtls\"]; ok && !isIntfNil(v) && !mtlsChoiceTypeFound {\n\n\t\t\t\tmtlsChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tmtlsChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_NoMtls{}\n\t\t\t\t\tmtlsChoiceInt.NoMtls = &ves_io_schema.Empty{}\n\t\t\t\t\ttlsChoiceInt.UseTls.MtlsChoice = mtlsChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"use_mtls\"]; ok && !isIntfNil(v) && !mtlsChoiceTypeFound {\n\n\t\t\t\tmtlsChoiceTypeFound = true\n\t\t\t\tmtlsChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_UseMtls{}\n\t\t\t\tmtlsChoiceInt.UseMtls = &ves_io_schema_views_origin_pool.TlsCertificatesType{}\n\t\t\t\ttlsChoiceInt.UseTls.MtlsChoice = mtlsChoiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"tls_certificates\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.([]interface{})\n\t\t\t\t\t\ttlsCertificates := make([]*ves_io_schema.TlsCertificateType, len(sl))\n\t\t\t\t\t\tmtlsChoiceInt.UseMtls.TlsCertificates = tlsCertificates\n\t\t\t\t\t\tfor i, set := range sl {\n\t\t\t\t\t\t\ttlsCertificates[i] = &ves_io_schema.TlsCertificateType{}\n\t\t\t\t\t\t\ttlsCertificatesMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif w, ok := tlsCertificatesMapStrToI[\"certificate_url\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\ttlsCertificates[i].CertificateUrl = w.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif w, ok := tlsCertificatesMapStrToI[\"description\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\ttlsCertificates[i].Description = w.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tocspStaplingChoiceTypeFound := false\n\n\t\t\t\t\t\t\tif v, ok := tlsCertificatesMapStrToI[\"custom_hash_algorithms\"]; ok && !isIntfNil(v) && !ocspStaplingChoiceTypeFound {\n\n\t\t\t\t\t\t\t\tocspStaplingChoiceTypeFound = true\n\t\t\t\t\t\t\t\tocspStaplingChoiceInt := &ves_io_schema.TlsCertificateType_CustomHashAlgorithms{}\n\t\t\t\t\t\t\t\tocspStaplingChoiceInt.CustomHashAlgorithms = &ves_io_schema.HashAlgorithms{}\n\t\t\t\t\t\t\t\ttlsCertificates[i].OcspStaplingChoice = ocspStaplingChoiceInt\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := cs[\"hash_algorithms\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\thash_algorithmsList := []ves_io_schema.HashAlgorithm{}\n\t\t\t\t\t\t\t\t\t\tfor _, j := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\t\t\thash_algorithmsList = append(hash_algorithmsList, ves_io_schema.HashAlgorithm(ves_io_schema.HashAlgorithm_value[j.(string)]))\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tocspStaplingChoiceInt.CustomHashAlgorithms.HashAlgorithms = hash_algorithmsList\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := tlsCertificatesMapStrToI[\"disable_ocsp_stapling\"]; ok && !isIntfNil(v) && !ocspStaplingChoiceTypeFound {\n\n\t\t\t\t\t\t\t\tocspStaplingChoiceTypeFound = true\n\t\t\t\t\t\t\t\t_ = v\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := tlsCertificatesMapStrToI[\"use_system_defaults\"]; ok && !isIntfNil(v) && !ocspStaplingChoiceTypeFound {\n\n\t\t\t\t\t\t\t\tocspStaplingChoiceTypeFound = true\n\t\t\t\t\t\t\t\t_ = v\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := tlsCertificatesMapStrToI[\"private_key\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\tprivateKey := &ves_io_schema.SecretType{}\n\t\t\t\t\t\t\t\ttlsCertificates[i].PrivateKey = privateKey\n\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\tprivateKeyMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tif v, ok := privateKeyMapStrToI[\"blindfold_secret_info_internal\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\t\t\tblindfoldSecretInfoInternal := &ves_io_schema.BlindfoldSecretInfoType{}\n\t\t\t\t\t\t\t\t\t\tprivateKey.BlindfoldSecretInfoInternal = blindfoldSecretInfoInternal\n\t\t\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\t\t\tblindfoldSecretInfoInternalMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\t\t\tif w, ok := blindfoldSecretInfoInternalMapStrToI[\"decryption_provider\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\t\t\t\t\tblindfoldSecretInfoInternal.DecryptionProvider = w.(string)\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif w, ok := blindfoldSecretInfoInternalMapStrToI[\"location\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\t\t\t\t\tblindfoldSecretInfoInternal.Location = w.(string)\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif w, ok := blindfoldSecretInfoInternalMapStrToI[\"store_provider\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\t\t\t\t\tblindfoldSecretInfoInternal.StoreProvider = w.(string)\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := privateKeyMapStrToI[\"secret_encoding_type\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\tprivateKey.SecretEncodingType = ves_io_schema.SecretEncodingType(ves_io_schema.SecretEncodingType_value[v.(string)])\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tsecretInfoOneofTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := privateKeyMapStrToI[\"blindfold_secret_info\"]; ok && !isIntfNil(v) && !secretInfoOneofTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofTypeFound = true\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt := &ves_io_schema.SecretType_BlindfoldSecretInfo{}\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.BlindfoldSecretInfo = &ves_io_schema.BlindfoldSecretInfoType{}\n\t\t\t\t\t\t\t\t\t\tprivateKey.SecretInfoOneof = secretInfoOneofInt\n\n\t\t\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"decryption_provider\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.BlindfoldSecretInfo.DecryptionProvider = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"location\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.BlindfoldSecretInfo.Location = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"store_provider\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.BlindfoldSecretInfo.StoreProvider = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := privateKeyMapStrToI[\"clear_secret_info\"]; ok && !isIntfNil(v) && !secretInfoOneofTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofTypeFound = true\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt := &ves_io_schema.SecretType_ClearSecretInfo{}\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.ClearSecretInfo = &ves_io_schema.ClearSecretInfoType{}\n\t\t\t\t\t\t\t\t\t\tprivateKey.SecretInfoOneof = secretInfoOneofInt\n\n\t\t\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"provider\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.ClearSecretInfo.Provider = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"url\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.ClearSecretInfo.Url = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := privateKeyMapStrToI[\"vault_secret_info\"]; ok && !isIntfNil(v) && !secretInfoOneofTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofTypeFound = true\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt := &ves_io_schema.SecretType_VaultSecretInfo{}\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.VaultSecretInfo = &ves_io_schema.VaultSecretInfoType{}\n\t\t\t\t\t\t\t\t\t\tprivateKey.SecretInfoOneof = secretInfoOneofInt\n\n\t\t\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"key\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.VaultSecretInfo.Key = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"location\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.VaultSecretInfo.Location = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"provider\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.VaultSecretInfo.Provider = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"secret_encoding\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.VaultSecretInfo.SecretEncoding = ves_io_schema.SecretEncodingType(ves_io_schema.SecretEncodingType_value[v.(string)])\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"version\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.VaultSecretInfo.Version = uint32(v.(int))\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := privateKeyMapStrToI[\"wingman_secret_info\"]; ok && !isIntfNil(v) && !secretInfoOneofTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofTypeFound = true\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt := &ves_io_schema.SecretType_WingmanSecretInfo{}\n\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.WingmanSecretInfo = &ves_io_schema.WingmanSecretInfoType{}\n\t\t\t\t\t\t\t\t\t\tprivateKey.SecretInfoOneof = secretInfoOneofInt\n\n\t\t\t\t\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tsecretInfoOneofInt.WingmanSecretInfo.Name = v.(string)\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"use_mtls_obj\"]; ok && !isIntfNil(v) && !mtlsChoiceTypeFound {\n\n\t\t\t\tmtlsChoiceTypeFound = true\n\t\t\t\tmtlsChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_UseMtlsObj{}\n\t\t\t\tmtlsChoiceInt.UseMtlsObj = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\ttlsChoiceInt.UseTls.MtlsChoice = mtlsChoiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tmtlsChoiceInt.UseMtlsObj.Name = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tmtlsChoiceInt.UseMtlsObj.Namespace = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tmtlsChoiceInt.UseMtlsObj.Tenant = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tserverValidationChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"skip_server_verification\"]; ok && !isIntfNil(v) && !serverValidationChoiceTypeFound {\n\n\t\t\t\tserverValidationChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tserverValidationChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_SkipServerVerification{}\n\t\t\t\t\tserverValidationChoiceInt.SkipServerVerification = &ves_io_schema.Empty{}\n\t\t\t\t\ttlsChoiceInt.UseTls.ServerValidationChoice = serverValidationChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"use_server_verification\"]; ok && !isIntfNil(v) && !serverValidationChoiceTypeFound {\n\n\t\t\t\tserverValidationChoiceTypeFound = true\n\t\t\t\tserverValidationChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_UseServerVerification{}\n\t\t\t\tserverValidationChoiceInt.UseServerVerification = &ves_io_schema_views_origin_pool.UpstreamTlsValidationContext{}\n\t\t\t\ttlsChoiceInt.UseTls.ServerValidationChoice = serverValidationChoiceInt\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\ttrustedCaChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := cs[\"trusted_ca\"]; ok && !isIntfNil(v) && !trustedCaChoiceTypeFound {\n\n\t\t\t\t\t\ttrustedCaChoiceTypeFound = true\n\t\t\t\t\t\ttrustedCaChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsValidationContext_TrustedCa{}\n\t\t\t\t\t\ttrustedCaChoiceInt.TrustedCa = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\tserverValidationChoiceInt.UseServerVerification.TrustedCaChoice = trustedCaChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\ttrustedCaChoiceInt.TrustedCa.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\ttrustedCaChoiceInt.TrustedCa.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\ttrustedCaChoiceInt.TrustedCa.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := cs[\"trusted_ca_url\"]; ok && !isIntfNil(v) && !trustedCaChoiceTypeFound {\n\n\t\t\t\t\t\ttrustedCaChoiceTypeFound = true\n\t\t\t\t\t\ttrustedCaChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsValidationContext_TrustedCaUrl{}\n\n\t\t\t\t\t\tserverValidationChoiceInt.UseServerVerification.TrustedCaChoice = trustedCaChoiceInt\n\n\t\t\t\t\t\ttrustedCaChoiceInt.TrustedCaUrl = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"volterra_trusted_ca\"]; ok && !isIntfNil(v) && !serverValidationChoiceTypeFound {\n\n\t\t\t\tserverValidationChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tserverValidationChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_VolterraTrustedCa{}\n\t\t\t\t\tserverValidationChoiceInt.VolterraTrustedCa = &ves_io_schema.Empty{}\n\t\t\t\t\ttlsChoiceInt.UseTls.ServerValidationChoice = serverValidationChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tsniChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"disable_sni\"]; ok && !isIntfNil(v) && !sniChoiceTypeFound {\n\n\t\t\t\tsniChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tsniChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_DisableSni{}\n\t\t\t\t\tsniChoiceInt.DisableSni = &ves_io_schema.Empty{}\n\t\t\t\t\ttlsChoiceInt.UseTls.SniChoice = sniChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"sni\"]; ok && !isIntfNil(v) && !sniChoiceTypeFound {\n\n\t\t\t\tsniChoiceTypeFound = true\n\t\t\t\tsniChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_Sni{}\n\n\t\t\t\ttlsChoiceInt.UseTls.SniChoice = sniChoiceInt\n\n\t\t\t\tsniChoiceInt.Sni = v.(string)\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"use_host_header_as_sni\"]; ok && !isIntfNil(v) && !sniChoiceTypeFound {\n\n\t\t\t\tsniChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tsniChoiceInt := &ves_io_schema_views_origin_pool.UpstreamTlsParameters_UseHostHeaderAsSni{}\n\t\t\t\t\tsniChoiceInt.UseHostHeaderAsSni = &ves_io_schema.Empty{}\n\t\t\t\t\ttlsChoiceInt.UseTls.SniChoice = sniChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tls_config\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\ttlsConfig := &ves_io_schema_views.TlsConfig{}\n\t\t\t\ttlsChoiceInt.UseTls.TlsConfig = tlsConfig\n\t\t\t\tfor _, set := range sl {\n\t\t\t\t\ttlsConfigMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tchoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := tlsConfigMapStrToI[\"custom_security\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\tchoiceTypeFound = true\n\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.TlsConfig_CustomSecurity{}\n\t\t\t\t\t\tchoiceInt.CustomSecurity = &ves_io_schema_views.CustomCiphers{}\n\t\t\t\t\t\ttlsConfig.Choice = choiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"cipher_suites\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchoiceInt.CustomSecurity.CipherSuites = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"max_version\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tchoiceInt.CustomSecurity.MaxVersion = ves_io_schema.TlsProtocol(ves_io_schema.TlsProtocol_value[v.(string)])\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"min_version\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tchoiceInt.CustomSecurity.MinVersion = ves_io_schema.TlsProtocol(ves_io_schema.TlsProtocol_value[v.(string)])\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsConfigMapStrToI[\"default_security\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\tchoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.TlsConfig_DefaultSecurity{}\n\t\t\t\t\t\t\tchoiceInt.DefaultSecurity = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\ttlsConfig.Choice = choiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsConfigMapStrToI[\"low_security\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\tchoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.TlsConfig_LowSecurity{}\n\t\t\t\t\t\t\tchoiceInt.LowSecurity = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\ttlsConfig.Choice = choiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsConfigMapStrToI[\"medium_security\"]; ok && !isIntfNil(v) && !choiceTypeFound {\n\n\t\t\t\t\t\tchoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tchoiceInt := &ves_io_schema_views.TlsConfig_MediumSecurity{}\n\t\t\t\t\t\t\tchoiceInt.MediumSecurity = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\ttlsConfig.Choice = choiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Updating Volterra OriginPool obj with struct: %+v\", updateReq)\n\n\terr := client.ReplaceObject(context.Background(), ves_io_schema_views_origin_pool.ObjectType, updateReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error updating OriginPool: %s\", err)\n\t}\n\n\treturn resourceVolterraOriginPoolRead(d, meta)\n}", "title": "" }, { "docid": "cd47a30a4c5c42519226af5c8a5c616e", "score": "0.44446424", "text": "func upgradeCoreDNS(\n\tkubectlOptions *kubectl.KubectlOptions,\n\tclientset *kubernetes.Clientset,\n\tawsRegion string,\n\tcoreDNSVersion string,\n\tshouldWait bool,\n\twaitTimeout string,\n) error {\n\tlogger := logging.GetProjectLogger()\n\n\tlogger.Info(\"Confirming compatibility of coredns configuration with latest version.\")\n\t// Need to check config for backwards incompatibility if updating to version >= 1.7.0. The keyword `upstream` was\n\t// removed in 1.7 series of coredns, but is used in earlier versions.\n\tcompareVal170, err := semverStringCompare(coreDNSVersion, \"1.7.0-eksbuild.1\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Looking for 1 or 0 here, since we want to know when coreDNSVersion is >= 1.7.0\n\tif compareVal170 >= 0 {\n\t\tif err := updateCorednsConfigMapFor170Compatibility(clientset); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlogger.Info(\"Configuration for coredns is up to date. Skipping configuration reformat.\")\n\t}\n\n\tlogger.Info(\"Confirming compatibility of coredns permissions with latest version.\")\n\t// Need to check permissions compatibility if updating to version >= 1.8.3. Starting with 1.8.3, coredns requires\n\t// permissions to list and watch endpoint slices.\n\tcompareVal183, err := semverStringCompare(coreDNSVersion, \"1.8.3-eksbuild.1\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif compareVal183 >= 0 {\n\t\tif err := updateCorednsPermissionsFor183Compatibility(clientset); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlogger.Info(\"ClusterRole permissions for coredns is up to date. Skipping adjusting ClusterRole permissions.\")\n\t}\n\n\ttargetImage := fmt.Sprintf(\"%s/%s:v%s\", getRepoDomain(awsRegion), coreDNSRepoPath, coreDNSVersion)\n\tcurrentImage, err := getCurrentDeployedCoreDNSImage(clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif currentImage == targetImage {\n\t\tlogger.Info(\"Current deployed version matches expected version. Skipping coredns update.\")\n\t\treturn nil\n\t}\n\n\tlogger.Infof(\"Upgrading current deployed version of coredns (%s) to match expected version (%s).\", currentImage, targetImage)\n\tif err := updateCoreDNSDeploymentImage(clientset, targetImage); err != nil {\n\t\treturn err\n\t}\n\n\tif shouldWait {\n\t\tlogger.Info(\"Waiting until new image for coredns is rolled out.\")\n\t\t// Ideally we will implement the following routine using the raw client-go library, but implementing this\n\t\t// functionality directly on the API is fairly complex, and thus we rely on the built in mechanism in kubectl\n\t\t// instead.\n\t\targs := []string{\n\t\t\t\"rollout\",\n\t\t\t\"status\",\n\t\t\tfmt.Sprintf(\"deployment/%s\", corednsDeploymentName),\n\t\t\t\"-n\", componentNamespace,\n\t\t\t\"--timeout\", waitTimeout,\n\t\t}\n\t\treturn kubectl.RunKubectl(kubectlOptions, args...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "816a716f06e97d15d20b377c18e9fdfa", "score": "0.4444202", "text": "func Upgrade(ctx context.Context) error {\n\tlogger := logging.FromContext(ctx)\n\n\tnsClient := kubeclient.Get(ctx).CoreV1().Namespaces()\n\tnamespaces, err := nsClient.List(metav1.ListOptions{})\n\tif err != nil {\n\t\tlogger.Warnf(\"Failed to list namespaces: %v\", err)\n\t\treturn err\n\t}\n\tfor _, ns := range namespaces.Items {\n\t\terr = processNamespace(ctx, ns.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25d25ec9d4d001e52e273e22163071e7", "score": "0.4431455", "text": "func resourceVolterraCloudSiteLabelsUpdate(d *schema.ResourceData, meta interface{}) error {\n\t//fmt.Printf(\"Foo update\\n\")\n\tclient := meta.(*APIClient)\n\tvar name, siteType string\n\tvar labels map[string]interface{}\n\tname = d.Get(\"name\").(string)\n\tif v, ok := d.GetOk(\"site_type\"); ok {\n\t\tsiteType = v.(string)\n\t}\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\t\tlabels = v.(map[string]interface{})\n\t}\n\tresp, _, err := getVolterraCloudSite(client, name, getCloudObjType(siteType), server.ReplaceRequestForm)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"status code 404\") {\n\t\t\tlog.Println(\"[INFO] Site doesn't exist, retrying\")\n\t\t\td.SetId(\"\")\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\t//fmt.Printf(\"Foo update getting cloud replace\\n\")\n\tupdateReq := getCloudSiteReplaceForm(siteType, labels, false, resp)\n\tlog.Printf(\"[DEBUG] Updating Volterra %s obj with struct: %+v\", siteType, updateReq)\n\n\terr = client.ReplaceObject(context.Background(), getCloudObjType(siteType), updateReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error updating %s: %s\", siteType, err.Error())\n\t}\n\treturn resourceVolterraCloudSiteLabelsRead(d, meta)\n}", "title": "" }, { "docid": "6aa87b8f1e4c9f5448e473a052e616a7", "score": "0.44159266", "text": "func UpdateResources(clientset kubernetes.Interface, cluster *crv1.Pgcluster) error {\n\t// get a list of all of the instance deployments for the cluster\n\tdeployment, err := operator.GetBackrestDeployment(clientset, cluster)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// first, initialize the requests/limits resource to empty Resource Lists\n\tdeployment.Spec.Template.Spec.Containers[0].Resources.Requests = v1.ResourceList{}\n\tdeployment.Spec.Template.Spec.Containers[0].Resources.Limits = v1.ResourceList{}\n\n\t// now, simply deep copy the values from the CRD\n\tif cluster.Spec.BackrestResources != nil {\n\t\tdeployment.Spec.Template.Spec.Containers[0].Resources.Requests = cluster.Spec.BackrestResources.DeepCopy()\n\t}\n\n\tif cluster.Spec.BackrestLimits != nil {\n\t\tdeployment.Spec.Template.Spec.Containers[0].Resources.Limits = cluster.Spec.BackrestLimits.DeepCopy()\n\t}\n\n\t// update the deployment with the new values\n\tif _, err := clientset.AppsV1().Deployments(deployment.Namespace).Update(deployment); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "07b7c18b5989921afdefe2dab1bfe960", "score": "0.4411229", "text": "func (d *Deployments) PromoteAll(deploymentID string, q *WriteOptions) (*DeploymentUpdateResponse, *WriteMeta, error) {\n\tvar resp DeploymentUpdateResponse\n\treq := &DeploymentPromoteRequest{\n\t\tDeploymentID: deploymentID,\n\t\tAll: true,\n\t}\n\twm, err := d.client.write(\"/v1/deployment/promote/\"+deploymentID, req, &resp, q)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn &resp, wm, nil\n}", "title": "" }, { "docid": "bb8df56ccdfaeba81c92fa84ec78ca28", "score": "0.44029254", "text": "func (c *FakeCamelCatalogs) Update(ctx context.Context, camelCatalog *camelv1.CamelCatalog, opts v1.UpdateOptions) (result *camelv1.CamelCatalog, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(camelcatalogsResource, c.ns, camelCatalog), &camelv1.CamelCatalog{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*camelv1.CamelCatalog), err\n}", "title": "" }, { "docid": "5e03cd3acba04f35790158a7c2f6648e", "score": "0.4394981", "text": "func updateResourceNamespace(obj client.Object, newNamespace string) client.Object {\n\tobj.(*corev1.ConfigMap).SetNamespace(newNamespace)\n\n\treturn obj\n}", "title": "" }, { "docid": "e46e9a03b403c7f696922b9604cd2875", "score": "0.43946093", "text": "func (r *ReconcileCoherenceRole) updateRole(cluster *coh.CoherenceCluster, role *coh.CoherenceRole, helmValues *unstructured.Unstructured) (reconcile.Result, error) {\n\tlogger := log.WithValues(\"Namespace\", role.Namespace, \"Name\", role.Name)\n\tlogger.Info(\"Reconciling existing Coherence Role\")\n\n\tclusterRole := cluster.GetRole(role.Spec.GetRoleName())\n\tclusterReplicas := clusterRole.GetReplicas()\n\troleReplicas := role.Spec.GetReplicas()\n\t// Get the effective role - what the role spec should be according to the Cluster spec\n\teffectiveRole := clusterRole.DeepCopyWithDefaults(&cluster.Spec.CoherenceRoleSpec)\n\teffectiveRole.SetReplicas(effectiveRole.GetReplicas())\n\n\tif !reflect.DeepEqual(effectiveRole, &role.Spec) {\n\t\t// Role spec is not the same as the cluster's role spec - likely caused by a scale but could have\n\t\t// been caused by a direct update to the CoherenceRole, even though we really discourage that.\n\n\t\tif clusterReplicas == roleReplicas {\n\t\t\t// Something other than the Replicas has been changed so reset the role back to what is should be.\n\t\t\tdiff := deep.Equal(effectiveRole, &role.Spec)\n\t\t\tlogger.Info(\"CoherenceCluster role spec is different to CoherenceRole spec and will be reset to match the cluster - diff:\\n\" + strings.Join(diff, \"\\n\"))\n\t\t\teffectiveRole.DeepCopyInto(&role.Spec)\n\t\t} else {\n\t\t\t// Update the cluster's Replicas count to match the role, which will cause this update to come around again.\n\t\t\tclusterRole.SetReplicas(roleReplicas)\n\t\t\tcluster.SetRole(clusterRole)\n\t\t\tlogger.Info(fmt.Sprintf(\"Reconciling existing Coherence Role - updating cluster's role Replicas from %d to %d\", clusterReplicas, clusterRole.GetReplicas()))\n\t\t\terr := r.client.Update(context.TODO(), cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn r.handleErrAndRequeue(err, nil, fmt.Sprintf(updateFailedMessage, helmValues.GetName(), role.Name, err), logger)\n\t\t\t}\n\t\t}\n\t}\n\n\tdesiredReplicas := role.Spec.GetReplicas()\n\n\t// convert the unstructured data to a CoherenceInternal that we can deal with better\n\texisting, err := r.toCoherenceInternal(helmValues)\n\tif err != nil {\n\t\treturn r.handleErrAndRequeue(err, nil, fmt.Sprintf(updateFailedMessage, helmValues.GetName(), role.Name, err), logger)\n\t}\n\n\tsts, err := r.findStatefulSet(role)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn r.handleErrAndRequeue(err, role, fmt.Sprintf(updateFailedMessage, helmValues.GetName(), role.Name, err), logger)\n\t}\n\n\tif errors.IsNotFound(err) {\n\t\t// The StatefulSet is not found, it could be being created or recovered\n\t\tlogger.Info(fmt.Sprintf(\"Re-queing update request. Could not find StatefulSet for CoherenceRole %s\", role.Name))\n\t\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second * 10}, nil\n\t}\n\n\tcurrentReplicas := existing.Spec.GetReplicas()\n\tdesiredRole := r.CreateDesiredRole(cluster, role, &existing.Spec, sts)\n\tisUpgrade := r.isUpgrade(&existing.Spec, desiredRole)\n\n\tswitch {\n\tcase currentReplicas < desiredReplicas:\n\t\tlogger.Info(\"Reconciling existing Coherence Role: case currentReplicas < desiredReplicas\")\n\t\t// Scaling UP\n\n\t\t// if scaling up and upgrading then upgrade first and scale second\n\t\t// otherwise we'd have to upgrade all the scaled up members\n\t\tif isUpgrade {\n\t\t\terr := r.upgrade(role, helmValues, currentReplicas, desiredRole)\n\t\t\tif err == nil {\n\t\t\t\t// Requeue so that we then scale up after the upgrade.\n\t\t\t\t// We do things this way because the upgrade is still happening asynchronously\n\t\t\t\t// and could take time. By re-queuing the request it will come back around to\n\t\t\t\t// the reconcile method keep being re-queued until the cluster is once again\n\t\t\t\t// in a stable state when the scale up will then happen.\n\t\t\t\treturn reconcile.Result{Requeue: true}, nil\n\t\t\t}\n\t\t\treturn r.handleErrAndRequeue(err, nil, fmt.Sprintf(updateFailedMessage, helmValues.GetName(), role.Name, err), logger)\n\t\t}\n\n\t\tlogger.Info(fmt.Sprintf(\"Request to scale up from %d to %d\", currentReplicas, desiredReplicas))\n\t\treturn r.scale(role, helmValues, existing, desiredReplicas, currentReplicas, sts)\n\tcase currentReplicas > desiredReplicas:\n\t\tlogger.Info(\"Reconciling existing Coherence Role: case currentReplicas > desiredReplicas\")\n\t\t// Scaling DOWN\n\n\t\t// if scaling down and upgrading then scale down first and upgrade second\n\t\t// so that we do not have to upgrade the members we are scaling down\n\t\tlogger.Info(fmt.Sprintf(\"Request to scale down from %d to %d\", currentReplicas, desiredReplicas))\n\t\tresult, err := r.scale(role, helmValues, existing, desiredReplicas, currentReplicas, sts)\n\n\t\tif err == nil && isUpgrade {\n\t\t\t// requeue the request so that we then upgrade\n\t\t\t// We do things this way because the scale down is still happening asynchronously\n\t\t\t// and could take time. By re-queuing the request it will come back around to\n\t\t\t// the reconcile method keep being re-queued until the cluster is once again\n\t\t\t// in a stable state when the upgrade will then happen.\n\t\t\treturn reconcile.Result{Requeue: true}, nil\n\t\t}\n\t\treturn result, err\n\tcase isUpgrade:\n\t\tlogger.Info(\"Reconciling existing Coherence Role: case isUpgrade\")\n\t\t// no scaling, just a rolling upgrade\n\t\tif err := r.upgrade(role, helmValues, currentReplicas, desiredRole); err != nil {\n\t\t\treturn r.handleErrAndRequeue(err, nil, fmt.Sprintf(updateFailedMessage, helmValues.GetName(), role.Name, err), logger)\n\t\t}\n\t\treturn reconcile.Result{Requeue: false}, nil\n\tcase sts != nil:\n\t\tlogger.Info(\"Reconciling existing Coherence Role: case sts != nil\")\n\t\t// nothing to do to update or scale\n\t\t// We probably arrived here due to a change in the StatefulSet for a role\n\t\t// In this case we can potentially update the role's status based on what changed in the StatefulSet\n\t\terr = r.updateStatus(role, sts, cluster)\n\t\tif err != nil {\n\t\t\t// failed to update the CoherenceRole's status\n\t\t\tlog.Error(err, \"failed to update role status\", \"Namespace\", role.Namespace, \"Name\", role.Name)\n\t\t\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second * 5}, nil\n\t\t}\n\t}\n\n\tlogger.Info(\"Finished reconciling existing Coherence Role\")\n\treturn reconcile.Result{Requeue: false}, nil\n}", "title": "" }, { "docid": "75dfe5637b555381dde181383b18b4f4", "score": "0.4387152", "text": "func scaleCluster(args Arguments) (*Result, error) {\n\tclientWrapper, err := client.NewWithConfig(args.APIEndpoint, args.UserProvidedToken)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tauxParams := clientWrapper.DefaultAuxiliaryParams()\n\tauxParams.ActivityName = scaleClusterActivityName\n\n\tif args.Verbose {\n\t\tfmt.Println(color.WhiteString(\"Fetching v4 cluster details\"))\n\t}\n\tclusterDetails, err := clientWrapper.GetClusterV4(args.ClusterNameOrID, auxParams)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tscalingMin := int64(0)\n\tif clusterDetails.Payload.Scaling.Min != nil {\n\t\tscalingMin = *clusterDetails.Payload.Scaling.Min\n\t}\n\n\tscalingResult := &Result{\n\t\tNumWorkersBefore: int(len(clusterDetails.Payload.Workers)),\n\t\tScalingMaxBefore: int(clusterDetails.Payload.Scaling.Max),\n\t\tScalingMinBefore: int(scalingMin),\n\t}\n\n\tvar statusWorkers int\n\n\tif args.Verbose {\n\t\tfmt.Println(color.WhiteString(\"Fetching v4 cluster status\"))\n\t}\n\n\tstatus, err := clientWrapper.GetClusterStatus(args.ClusterNameOrID, auxParams)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tif len(status.Cluster.Nodes) >= 1 {\n\t\t// Count all nodes as workers which are not explicitly marked as master.\n\t\tfor _, node := range status.Cluster.Nodes {\n\t\t\tval, ok := node.Labels[\"role\"]\n\t\t\tif ok && val == \"master\" {\n\t\t\t\t// don't count this\n\t\t\t} else {\n\t\t\t\tstatusWorkers++\n\t\t\t}\n\t\t}\n\t}\n\n\t// Preparing API call.\n\tvar reqBody *models.V4ModifyClusterRequest\n\t{\n\t\tminWorkers := int64(scalingResult.ScalingMinBefore)\n\t\tif args.WorkersMinSet {\n\t\t\tminWorkers = int64(args.WorkersMin)\n\t\t} else if args.WorkersSet {\n\t\t\tminWorkers = int64(args.Workers)\n\t\t}\n\n\t\tmaxWorkers := int64(scalingResult.ScalingMaxBefore)\n\t\tif args.WorkersMaxSet {\n\t\t\tmaxWorkers = args.WorkersMax\n\t\t} else if args.WorkersSet {\n\t\t\tmaxWorkers = int64(args.Workers)\n\t\t}\n\n\t\t// Preparing API call.\n\t\treqBody = &models.V4ModifyClusterRequest{\n\t\t\tScaling: &models.V4ModifyClusterRequestScaling{\n\t\t\t\tMax: maxWorkers,\n\t\t\t\tMin: &minWorkers,\n\t\t\t},\n\t\t}\n\t}\n\n\t// Ask for confirmation for the scaling action.\n\tif !args.OppressConfirmation {\n\t\t// get confirmation and handle result\n\t\terr = getConfirmation(args, int(reqBody.Scaling.Max), int(*reqBody.Scaling.Min), statusWorkers)\n\t\tif err != nil {\n\t\t\tfmt.Println(color.GreenString(\"Scaling cancelled\"))\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n\n\t// perform API call\n\tif args.Verbose {\n\t\tfmt.Println(color.WhiteString(\"Sending API request to modify cluster\"))\n\t}\n\t_, err = clientWrapper.ModifyClusterV4(args.ClusterNameOrID, reqBody, auxParams)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tscalingResult.ScalingMinAfter = int(*reqBody.Scaling.Min)\n\tscalingResult.ScalingMaxAfter = int(reqBody.Scaling.Max)\n\n\treturn scalingResult, nil\n}", "title": "" }, { "docid": "212df3005895d46210a3d4106ecca4f2", "score": "0.43818584", "text": "func (m *externalPolicyManager) processUpdatePod(updatedPod *v1.Pod, oldTargetNs sets.Set[string]) error {\n\n\t// find the policies that apply to this new pod. Unless there are changes to the labels, they should be identical.\n\tnewPodPolicies, err := m.findMatchingDynamicPolicies(updatedPod)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkey := ktypes.NamespacedName{Namespace: updatedPod.Namespace, Name: updatedPod.Name}\n\t// aggregate the expected target namespaces based on the new pod's labels and current policies\n\t// if the labels have not changed, the new targeted namespaces and the old ones should be identical\n\tnewTargetNs, err := m.aggregateTargetNamespacesByPolicies(key, newPodPolicies)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif oldTargetNs.Equal(newTargetNs) {\n\t\t// targeting the same namespaces. Nothing to do\n\t\treturn nil\n\t}\n\t// the pods have changed and they don't target the same sets of namespaces, delete its reference on the ones that don't apply\n\t// and add to the new ones, if necessary\n\tnsToRemove := oldTargetNs.Difference(newTargetNs)\n\tnsToAdd := newTargetNs.Difference(oldTargetNs)\n\tklog.Infof(\"Removing pod gateway %s/%s from namespace(s): %s\", updatedPod.Namespace, updatedPod.Name, strings.Join(sets.List(nsToRemove), \",\"))\n\tklog.Infof(\"Adding pod gateway %s/%s to namespace(s): %s\", updatedPod.Namespace, updatedPod.Name, strings.Join(sets.List(nsToAdd), \",\"))\n\t// retrieve the gateway information for the pod\n\tfor ns := range nsToRemove {\n\t\terr = m.removePodGatewayFromNamespace(ns, ktypes.NamespacedName{Namespace: updatedPod.Namespace, Name: updatedPod.Name})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// pre-process the policies so we can apply them this process extracts from the CR the contents of the policies\n\t// into an internal structure that contains the static and dynamic hops information.\n\tpp, err := m.processExternalRoutePolicies(newPodPolicies)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor ns := range nsToAdd {\n\t\terr = m.addPodGatewayToNamespace(ktypes.NamespacedName{Namespace: updatedPod.Namespace, Name: updatedPod.Name}, ns, pp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a9aa8a1f7c096c397063568f27801208", "score": "0.4380753", "text": "func (ctrl *PVController) pvcInMasterUpdated(old, new interface{}) {\n\tnewPVC := new.(*v1.PersistentVolumeClaim)\n\tif ctrl.shouldEnqueue(&newPVC.ObjectMeta) {\n\t\tkey, err := cache.MetaNamespaceKeyFunc(new)\n\t\tif err != nil {\n\t\t\truntime.HandleError(err)\n\t\t\treturn\n\t\t}\n\t\tctrl.pvcMasterQueue.Add(key)\n\t\tklog.V(6).Info(\"PVC update in master\", \"key \", key)\n\t} else {\n\t\tklog.V(6).Infof(\"Ignoring pvc %q change\", newPVC.Name)\n\t}\n}", "title": "" }, { "docid": "3ad2299a94859d842401f4e0e1012a47", "score": "0.43794063", "text": "func UpdateNamespace(clientset *kubernetes.Clientset, installationName, pgoNamespace,\n\tupdatedBy, ns string) error {\n\n\tlog.Debugf(\"UpdateNamespace %s %s %s %s\", installationName, pgoNamespace, updatedBy, ns)\n\n\ttheNs, _, err := kubeapi.GetNamespace(clientset, ns)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif theNs.ObjectMeta.Labels == nil {\n\t\ttheNs.ObjectMeta.Labels = make(map[string]string)\n\t}\n\ttheNs.ObjectMeta.Labels[config.LABEL_VENDOR] = config.LABEL_CRUNCHY\n\ttheNs.ObjectMeta.Labels[config.LABEL_PGO_INSTALLATION_NAME] = installationName\n\tif err := kubeapi.UpdateNamespace(clientset, theNs); err != nil {\n\t\treturn err\n\t}\n\n\t//publish event\n\ttopics := make([]string, 1)\n\ttopics[0] = events.EventTopicPGO\n\n\tf := events.EventPGOCreateNamespaceFormat{\n\t\tEventHeader: events.EventHeader{\n\t\t\tNamespace: pgoNamespace,\n\t\t\tUsername: updatedBy,\n\t\t\tTopic: topics,\n\t\t\tTimestamp: time.Now(),\n\t\t\tEventType: events.EventPGOCreateNamespace,\n\t\t},\n\t\tCreatedNamespace: ns,\n\t}\n\n\treturn events.Publish(f)\n}", "title": "" }, { "docid": "7b8654c2ef1691aaa8771bf2cda11762", "score": "0.43727198", "text": "func Upgrade(ctx context.Context, input UpgradeInput) {\n\tif len(input.ClusterctlVariables) > 0 {\n\t\toutputPath := filepath.Join(filepath.Dir(input.ClusterctlConfigPath), fmt.Sprintf(\"clusterctl-upgrade-config-%s.yaml\", input.ClusterName))\n\t\tcopyAndAmendClusterctlConfig(ctx, copyAndAmendClusterctlConfigInput{\n\t\t\tClusterctlConfigPath: input.ClusterctlConfigPath,\n\t\t\tOutputPath: outputPath,\n\t\t\tVariables: input.ClusterctlVariables,\n\t\t})\n\t\tinput.ClusterctlConfigPath = outputPath\n\t}\n\n\t// Check if the user want a custom upgrade\n\tisCustomUpgrade := input.CoreProvider != \"\" ||\n\t\tlen(input.BootstrapProviders) > 0 ||\n\t\tlen(input.ControlPlaneProviders) > 0 ||\n\t\tlen(input.InfrastructureProviders) > 0 ||\n\t\tlen(input.IPAMProviders) > 0 ||\n\t\tlen(input.RuntimeExtensionProviders) > 0 ||\n\t\tlen(input.AddonProviders) > 0\n\n\tExpect((input.Contract != \"\" && !isCustomUpgrade) || (input.Contract == \"\" && isCustomUpgrade)).To(BeTrue(), `Invalid arguments. Either the input.Contract parameter or at least one of the following providers has to be set:\n\t\tinput.CoreProvider, input.BootstrapProviders, input.ControlPlaneProviders, input.InfrastructureProviders, input.IPAMProviders, input.RuntimeExtensionProviders, input.AddonProviders`)\n\n\tif isCustomUpgrade {\n\t\tlog.Logf(\"clusterctl upgrade apply --core %s --bootstrap %s --control-plane %s --infrastructure %s --ipam %s --runtime-extension %s --addon %s --config %s --kubeconfig %s\",\n\t\t\tinput.CoreProvider,\n\t\t\tstrings.Join(input.BootstrapProviders, \",\"),\n\t\t\tstrings.Join(input.ControlPlaneProviders, \",\"),\n\t\t\tstrings.Join(input.InfrastructureProviders, \",\"),\n\t\t\tstrings.Join(input.IPAMProviders, \",\"),\n\t\t\tstrings.Join(input.RuntimeExtensionProviders, \",\"),\n\t\t\tstrings.Join(input.AddonProviders, \",\"),\n\t\t\tinput.ClusterctlConfigPath,\n\t\t\tinput.KubeconfigPath,\n\t\t)\n\t} else {\n\t\tlog.Logf(\"clusterctl upgrade apply --contract %s --config %s --kubeconfig %s\",\n\t\t\tinput.Contract,\n\t\t\tinput.ClusterctlConfigPath,\n\t\t\tinput.KubeconfigPath,\n\t\t)\n\t}\n\n\tupgradeOpt := clusterctlclient.ApplyUpgradeOptions{\n\t\tKubeconfig: clusterctlclient.Kubeconfig{\n\t\t\tPath: input.KubeconfigPath,\n\t\t\tContext: \"\",\n\t\t},\n\t\tContract: input.Contract,\n\t\tCoreProvider: input.CoreProvider,\n\t\tBootstrapProviders: input.BootstrapProviders,\n\t\tControlPlaneProviders: input.ControlPlaneProviders,\n\t\tInfrastructureProviders: input.InfrastructureProviders,\n\t\tIPAMProviders: input.IPAMProviders,\n\t\tRuntimeExtensionProviders: input.RuntimeExtensionProviders,\n\t\tAddonProviders: input.AddonProviders,\n\t\tWaitProviders: true,\n\t}\n\n\tclusterctlClient, log := getClusterctlClientWithLogger(ctx, input.ClusterctlConfigPath, \"clusterctl-upgrade.log\", input.LogFolder)\n\tdefer log.Close()\n\n\terr := clusterctlClient.ApplyUpgrade(ctx, upgradeOpt)\n\tExpect(err).ToNot(HaveOccurred(), \"failed to run clusterctl upgrade\")\n}", "title": "" }, { "docid": "724ff8b2746ed4e1009977d3f052e716", "score": "0.43726882", "text": "func UpgradeRelease(o UpgradeReleaseOptions) error {\n\tcmd := []string{\"helm\"}\n\tkubeContextFlag := \"--kube-context\"\n\tif o.Inject {\n\t\tkubeContextFlag = \"--kubecontext\"\n\t\tcmd = append(cmd, \"inject\")\n\t}\n\tcmd = append(cmd, \"upgrade\", \"-i\", o.ReleaseName, fmt.Sprintf(\"%s/%s\", o.Dir, o.Name))\n\tif o.KubeContext != \"\" {\n\t\tcmd = append(cmd, kubeContextFlag, o.KubeContext)\n\t}\n\tif o.Namespace != \"\" {\n\t\tcmd = append(cmd, \"--namespace\", o.Namespace)\n\t}\n\tcmd = append(cmd, o.Values...)\n\tcmd = append(cmd, o.Set...)\n\tcmd = append(cmd, \"--timeout\", fmt.Sprintf(\"%d\", o.Timeout))\n\tcmd = append(cmd, getTLS(o.TLS, o.KubeContext, o.HelmTLSStore)...)\n\terr := PrintExec(cmd, o.Print)\n\n\treturn err\n}", "title": "" }, { "docid": "026f43b42b8e6c7d469c1e4d5c51ee80", "score": "0.43631393", "text": "func (k *Bootstrapper) UpdateCluster(cfg config.MachineConfig) error {\n\timages, err := images.Kubeadm(cfg.KubernetesConfig.ImageRepository, cfg.KubernetesConfig.KubernetesVersion)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"kic images\")\n\t}\n\n\tif cfg.KubernetesConfig.ShouldLoadCachedImages {\n\t\tif err := machine.LoadImages(&cfg, k.c, images, constants.ImageCacheDir); err != nil {\n\t\t\tout.FailureT(\"Unable to load cached images: {{.error}}\", out.V{\"error\": err})\n\t\t}\n\t}\n\tr, err := cruntime.New(cruntime.Config{Type: cfg.ContainerRuntime, Socket: cfg.KubernetesConfig.CRISocket, Runner: k.c})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"runtime\")\n\t}\n\tkubeadmCfg, err := bsutil.GenerateKubeadmYAML(cfg.KubernetesConfig, r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"generating kubeadm cfg\")\n\t}\n\n\tkubeletCfg, err := bsutil.NewKubeletConfig(cfg.KubernetesConfig, r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"generating kubelet config\")\n\t}\n\n\tkubeletService, err := bsutil.NewKubeletService(cfg.KubernetesConfig)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"generating kubelet service\")\n\t}\n\n\tglog.Infof(\"kubelet %s config:\\n%+v\", kubeletCfg, cfg.KubernetesConfig)\n\n\tstopCmd := exec.Command(\"/bin/bash\", \"-c\", \"pgrep kubelet && sudo systemctl stop kubelet\")\n\t// stop kubelet to avoid \"Text File Busy\" error\n\tif rr, err := k.c.RunCmd(stopCmd); err != nil {\n\t\tglog.Warningf(\"unable to stop kubelet: %s command: %q output: %q\", err, rr.Command(), rr.Output())\n\t}\n\n\tif err := bsutil.TransferBinaries(cfg.KubernetesConfig, k.c); err != nil {\n\t\treturn errors.Wrap(err, \"downloading binaries\")\n\t}\n\n\tcniFile := []byte(defaultCNIManifest)\n\n\tfiles := bsutil.ConfigFileAssets(cfg.KubernetesConfig, kubeadmCfg, kubeletCfg, kubeletService, cniFile)\n\n\tif err := bsutil.AddAddons(&files, assets.GenerateTemplateData(cfg.KubernetesConfig)); err != nil {\n\t\treturn errors.Wrap(err, \"adding addons\")\n\t}\n\n\tfor _, f := range files {\n\t\tif err := k.c.Copy(f); err != nil {\n\t\t\treturn errors.Wrapf(err, \"copy\")\n\t\t}\n\t}\n\n\tif _, err := k.c.RunCmd(exec.Command(\"/bin/bash\", \"-c\", \"sudo systemctl daemon-reload && sudo systemctl start kubelet\")); err != nil {\n\t\treturn errors.Wrap(err, \"starting kubelet\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19997fa4b2220401cfd11147994dca79", "score": "0.43537143", "text": "func (s *CatalogService) SyncCatalog(c echo.Context) error {\n\tcatalogName := c.Param(\"catalogName\")\n\n\tcapabilities := []*model.Capability{\n\t\t{\n\t\t\tName: catalogName + \"-foo\",\n\t\t\tDesc: \"Just a placeholder\",\n\t\t\tUpdatedAt: time.Now().Unix(),\n\t\t\tCatalogName: catalogName,\n\t\t\tJsonSchema: \"{}\",\n\t\t},\n\t\t{\n\t\t\tName: catalogName + \"-bar\",\n\t\t\tDesc: \"Just a placeholder\",\n\t\t\tUpdatedAt: time.Now().Unix(),\n\t\t\tCatalogName: catalogName,\n\t\t\tJsonSchema: \"{}\",\n\t\t},\n\t}\n\n\tcurrentInStore, err := s.capStore.ListCapabilitiesByCatalog(catalogName)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"list capabilities by catalog error\")\n\t}\n\tmapCurrentInStore := make(map[string]*model.Capability)\n\tfor _, capability := range currentInStore {\n\t\tmapCurrentInStore[capability.Name] = capability\n\t}\n\n\tfor _, capability := range capabilities {\n\t\tif _, ok := mapCurrentInStore[capability.Name]; ok {\n\t\t\tif err := s.capStore.PutCapability(capability); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdelete(mapCurrentInStore, capability.Name)\n\t\t} else {\n\t\t\tif err := s.capStore.AddCapability(capability); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// in store, but no longer in catalog\n\tfor name := range mapCurrentInStore {\n\t\tif err := s.capStore.DelCapability(name); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn c.JSON(http.StatusOK, true)\n}", "title": "" }, { "docid": "eb602fb4e6fc05eada60a437dbee57af", "score": "0.43440366", "text": "func (m *podManager) update(req *cniserver.PodRequest) error {\n\t// Updates may come at startup and thus we may not have the pod's\n\t// netns from kubelet (since kubelet doesn't have UPDATE actions).\n\t// Read the missing netns from the pod's file.\n\tif req.Netns == \"\" {\n\t\tnetns, err := m.getContainerNetnsPath(req.ContainerId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Netns = netns\n\t}\n\n\tpodConfig, _, err := m.getPodConfig(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thostVethName, contVethMac, podIP, err := getVethInfo(req.Netns, podInterfaceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvnidStr := vnidToString(podConfig.vnid)\n\tout, err := exec.Command(sdnScript, updateCmd, hostVethName, contVethMac, podIP, vnidStr, podConfig.ingressBandwidth, podConfig.egressBandwidth).CombinedOutput()\n\tglog.V(5).Infof(\"UpdatePod network plugin output: %s, %v\", string(out), err)\n\n\tif isScriptError(err) {\n\t\treturn fmt.Errorf(\"error running network update script: %s\", getScriptError(out))\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb602fb4e6fc05eada60a437dbee57af", "score": "0.43440366", "text": "func (m *podManager) update(req *cniserver.PodRequest) error {\n\t// Updates may come at startup and thus we may not have the pod's\n\t// netns from kubelet (since kubelet doesn't have UPDATE actions).\n\t// Read the missing netns from the pod's file.\n\tif req.Netns == \"\" {\n\t\tnetns, err := m.getContainerNetnsPath(req.ContainerId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Netns = netns\n\t}\n\n\tpodConfig, _, err := m.getPodConfig(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thostVethName, contVethMac, podIP, err := getVethInfo(req.Netns, podInterfaceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvnidStr := vnidToString(podConfig.vnid)\n\tout, err := exec.Command(sdnScript, updateCmd, hostVethName, contVethMac, podIP, vnidStr, podConfig.ingressBandwidth, podConfig.egressBandwidth).CombinedOutput()\n\tglog.V(5).Infof(\"UpdatePod network plugin output: %s, %v\", string(out), err)\n\n\tif isScriptError(err) {\n\t\treturn fmt.Errorf(\"error running network update script: %s\", getScriptError(out))\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "508900264eb3a112d2c67cb84c0594d3", "score": "0.4332886", "text": "func (s *StretchedNetworkPolicyController) processPodUpdate(old, cur interface{}) {\n\toldPod, _ := old.(*v1.Pod)\n\tcurPod, _ := cur.(*v1.Pod)\n\tif curPod.Spec.HostNetwork {\n\t\tklog.V(5).InfoS(\"Skipped processing hostNetwork Pod update event\", \"name\", curPod.Name, \"namespace\", curPod.Namespace)\n\t\treturn\n\t}\n\tif reflect.DeepEqual(oldPod.Labels, curPod.Labels) {\n\t\tklog.V(5).InfoS(\"Pod UpdateFunc received a Pod update event, \"+\n\t\t\t\"but labels are the same. Skip it\", \"name\", curPod.Name, \"namespace\", curPod.Namespace)\n\t\treturn\n\t}\n\ts.queue.Add(getPodReference(curPod))\n}", "title": "" }, { "docid": "22f8b4a3cfee5c8e7f6a8c7c5de470fe", "score": "0.43290964", "text": "func (u labelUpdater) update(dutID string, old *inventory.SchedulableLabels, new *inventory.SchedulableLabels) error {\n\tif u.botInfo.AdminService == \"\" || !u.updateLabels {\n\t\tlog.Printf(\"Skipping label update since no admin service was provided\")\n\t\treturn nil\n\t}\n\tlog.Printf(\"Calling admin service to update labels\")\n\tctx, err := swmbot.WithTaskAccount(u.ctx)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"update inventory labels\").Err()\n\t}\n\tclient, err := swmbot.InventoryClient(ctx, u.botInfo)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"update inventory labels\").Err()\n\t}\n\treq, err := u.makeRequest(dutID, old, new)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"update inventory labels\").Err()\n\t}\n\tresp, err := client.UpdateDutLabels(ctx, req)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"update inventory labels\").Err()\n\t}\n\tif url := resp.GetUrl(); url != \"\" {\n\t\tlog.Printf(\"Updated DUT labels at %s\", url)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "847173c38b79e40c3be67e7c8e47eeea", "score": "0.43284675", "text": "func convertToCatalog(catalogReq *apis.CatalogRequest) model.Catalog {\n\treturn model.Catalog{\n\t\tName: catalogReq.Name,\n\t\tDesc: catalogReq.Desc,\n\t\tUpdatedAt: time.Now().Unix(),\n\t\tType: catalogReq.Type,\n\t\tUrl: catalogReq.Url,\n\t\tToken: catalogReq.Token,\n\t}\n}", "title": "" }, { "docid": "98f77ccaff99990c72fefbdb8db3a405", "score": "0.43271437", "text": "func defaultPatchUpdateSpecToPod(pod *v1.Pod, spec *UpdateSpec, state *appspub.InPlaceUpdateState) (*v1.Pod, error) {\n\n\tklog.V(5).Infof(\"Begin to in-place update pod %s/%s with update spec %v, state %v\", pod.Namespace, pod.Name, util.DumpJSON(spec), util.DumpJSON(state))\n\n\tstate.NextContainerImages = make(map[string]string)\n\tstate.NextContainerRefMetadata = make(map[string]metav1.ObjectMeta)\n\n\tif spec.MetaDataPatch != nil {\n\t\tcloneBytes, _ := json.Marshal(pod)\n\t\tmodified, err := strategicpatch.StrategicMergePatch(cloneBytes, spec.MetaDataPatch, &v1.Pod{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpod = &v1.Pod{}\n\t\tif err = json.Unmarshal(modified, pod); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif pod.Labels == nil {\n\t\tpod.Labels = make(map[string]string)\n\t}\n\tif pod.Annotations == nil {\n\t\tpod.Annotations = make(map[string]string)\n\t}\n\n\t// prepare containers that should update this time and next time, according to their priorities\n\tcontainersToUpdate := sets.NewString()\n\tvar highestPriority *int\n\tvar containersWithHighestPriority []string\n\tfor i := range pod.Spec.Containers {\n\t\tc := &pod.Spec.Containers[i]\n\t\t_, existImage := spec.ContainerImages[c.Name]\n\t\t_, existMetadata := spec.ContainerRefMetadata[c.Name]\n\t\tif !existImage && !existMetadata {\n\t\t\tcontinue\n\t\t}\n\t\tpriority := utilcontainerlaunchpriority.GetContainerPriority(c)\n\t\tif priority == nil {\n\t\t\tcontainersToUpdate.Insert(c.Name)\n\t\t} else if highestPriority == nil || *highestPriority < *priority {\n\t\t\thighestPriority = priority\n\t\t\tcontainersWithHighestPriority = []string{c.Name}\n\t\t} else if *highestPriority == *priority {\n\t\t\tcontainersWithHighestPriority = append(containersWithHighestPriority, c.Name)\n\t\t}\n\t}\n\tfor _, cName := range containersWithHighestPriority {\n\t\tcontainersToUpdate.Insert(cName)\n\t}\n\taddMetadataSharedContainersToUpdate(pod, containersToUpdate, spec.ContainerRefMetadata)\n\n\t// DO NOT modify the fields in spec for it may have to retry on conflict in updatePodInPlace\n\n\t// update images and record current imageIDs for the containers to update\n\tcontainersImageChanged := sets.NewString()\n\tfor i := range pod.Spec.Containers {\n\t\tc := &pod.Spec.Containers[i]\n\t\tnewImage, exists := spec.ContainerImages[c.Name]\n\t\tif !exists {\n\t\t\tcontinue\n\t\t}\n\t\tif containersToUpdate.Has(c.Name) {\n\t\t\tpod.Spec.Containers[i].Image = newImage\n\t\t\tcontainersImageChanged.Insert(c.Name)\n\t\t} else {\n\t\t\tstate.NextContainerImages[c.Name] = newImage\n\t\t}\n\t}\n\tfor _, c := range pod.Status.ContainerStatuses {\n\t\tif containersImageChanged.Has(c.Name) {\n\t\t\tif state.LastContainerStatuses == nil {\n\t\t\t\tstate.LastContainerStatuses = map[string]appspub.InPlaceUpdateContainerStatus{}\n\t\t\t}\n\t\t\tstate.LastContainerStatuses[c.Name] = appspub.InPlaceUpdateContainerStatus{ImageID: c.ImageID}\n\t\t}\n\t}\n\n\t// update annotations and labels for the containers to update\n\tfor cName, objMeta := range spec.ContainerRefMetadata {\n\t\tif containersToUpdate.Has(cName) {\n\t\t\tfor k, v := range objMeta.Labels {\n\t\t\t\tpod.Labels[k] = v\n\t\t\t}\n\t\t\tfor k, v := range objMeta.Annotations {\n\t\t\t\tpod.Annotations[k] = v\n\t\t\t}\n\t\t} else {\n\t\t\tstate.NextContainerRefMetadata[cName] = objMeta\n\t\t}\n\t}\n\n\t// add the containers that update this time into PreCheckBeforeNext, so that next containers can only\n\t// start to update when these containers have updated ready\n\t// TODO: currently we only support ContainersRequiredReady, not sure if we have to add ContainersPreferredReady in future\n\tif len(state.NextContainerImages) > 0 || len(state.NextContainerRefMetadata) > 0 {\n\t\tstate.PreCheckBeforeNext = &appspub.InPlaceUpdatePreCheckBeforeNext{ContainersRequiredReady: containersToUpdate.List()}\n\t} else {\n\t\tstate.PreCheckBeforeNext = nil\n\t}\n\n\tstate.ContainerBatchesRecord = append(state.ContainerBatchesRecord, appspub.InPlaceUpdateContainerBatch{\n\t\tTimestamp: metav1.NewTime(Clock.Now()),\n\t\tContainers: containersToUpdate.List(),\n\t})\n\n\tklog.V(5).Infof(\"Decide to in-place update pod %s/%s with state %v\", pod.Namespace, pod.Name, util.DumpJSON(state))\n\n\tinPlaceUpdateStateJSON, _ := json.Marshal(state)\n\tpod.Annotations[appspub.InPlaceUpdateStateKey] = string(inPlaceUpdateStateJSON)\n\treturn pod, nil\n}", "title": "" }, { "docid": "6160c5ad5e3c43bd326f0b2df28fc2d6", "score": "0.43226394", "text": "func (cluster *Cluster) updateConfig(configUpdate *ConfigUpdateMessage) {\n\tlog.Debugf(\"Received config update message from '%s', version %d\", configUpdate.Node, configUpdate.Version)\n\tif member, ok := cluster.Members[configUpdate.Node]; ok {\n\t\tif configUpdate.Version > member.ServicesVersion {\n\t\t\tmember.Services = configUpdate.Services\n\t\t\tcluster.ServicesUpdates <- cluster.Services()\n\t\t}\n\t} else {\n\t\tcluster.Members[configUpdate.Node] = &ClusterMember{\n\t\t\tServicesVersion: configUpdate.Version,\n\t\t\tServices: configUpdate.Services,\n\t\t}\n\t\tcluster.ServicesUpdates <- cluster.Services()\n\t}\n}", "title": "" }, { "docid": "af30bcef2675ff484e922541abf53d41", "score": "0.43193588", "text": "func (c *Cluster) updateCluster() error {\n\t// Apply idempotent update to the server configuration,\n\t// which may cause a reload if config has changed.\n\terr := c.updateConfigSecret()\n\tif err != nil {\n\t\tc.logger.Errorf(\"failed to update cluster secret: %v\", err)\n\t}\n\n\tif reflect.DeepEqual(c.originalCluster, c.cluster) {\n\t\treturn nil\n\t}\n\tpatchBytes, err := kubernetesutil.CreatePatch(c.originalCluster, c.cluster, &v1alpha2.NatsCluster{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Patch the NatsCluster resource.\n\t_, err = c.config.OperatorCli.NatsClusters(c.cluster.Namespace).Patch(c.cluster.Name, types.MergePatchType, patchBytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to update status: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27b8ef198e2c2c4bce61284679cba4f9", "score": "0.4318044", "text": "func UpdateCatalogConfig(settings *playfab.Settings, postData *UpdateCatalogConfigRequestModel, entityToken string) (*UpdateCatalogConfigResponseModel, error) {\r\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Catalog/UpdateCatalogConfig\", \"X-EntityToken\", entityToken)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &UpdateCatalogConfigResponseModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "b75ff886699077ab0fc87d52be94183f", "score": "0.43171445", "text": "func (d *Dataset) Promote() (err error) {\n\tif d.list == nil {\n\t\terr = errors.New(msgDatasetIsNil)\n\t\treturn\n\t}\n\tif errc := C.dataset_promote(d.list); errc != 0 {\n\t\terr = LastError()\n\t\treturn\n\t}\n\td.ReloadProperties()\n\treturn\n}", "title": "" }, { "docid": "b75ff886699077ab0fc87d52be94183f", "score": "0.43171445", "text": "func (d *Dataset) Promote() (err error) {\n\tif d.list == nil {\n\t\terr = errors.New(msgDatasetIsNil)\n\t\treturn\n\t}\n\tif errc := C.dataset_promote(d.list); errc != 0 {\n\t\terr = LastError()\n\t\treturn\n\t}\n\td.ReloadProperties()\n\treturn\n}", "title": "" }, { "docid": "70919dda701e6f77c778c2f061dd2410", "score": "0.43169013", "text": "func upgradeKubeProxy(\n\tkubectlOptions *kubectl.KubectlOptions,\n\tclientset *kubernetes.Clientset,\n\tawsRegion string,\n\tkubeProxyVersion string,\n\tshouldWait bool,\n\twaitTimeout string,\n) error {\n\tlogger := logging.GetProjectLogger()\n\n\ttargetImage := fmt.Sprintf(\"%s/%s:v%s\", getRepoDomain(awsRegion), kubeProxyRepoPath, kubeProxyVersion)\n\tcurrentImage, err := getCurrentDeployedKubeProxyImage(clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif currentImage == targetImage {\n\t\tlogger.Info(\"Current deployed version matches expected version. Skipping kube-proxy update.\")\n\t\treturn nil\n\t}\n\n\tlogger.Infof(\"Upgrading current deployed version of kube-proxy (%s) to match expected version (%s).\", currentImage, targetImage)\n\tif err := updateKubeProxyDaemonsetImage(clientset, targetImage); err != nil {\n\t\treturn err\n\t}\n\tif shouldWait {\n\t\tlogger.Info(\"Waiting until new image for kube-proxy is rolled out.\")\n\t\t// Ideally we will implement the following routine using the raw client-go library, but implementing this\n\t\t// functionality directly on the API is fairly complex, and thus we rely on the built in mechanism in kubectl\n\t\t// instead.\n\t\targs := []string{\n\t\t\t\"rollout\",\n\t\t\t\"status\",\n\t\t\tfmt.Sprintf(\"daemonset/%s\", kubeProxyDaemonSetName),\n\t\t\t\"-n\", componentNamespace,\n\t\t\t\"--timeout\", waitTimeout,\n\t\t}\n\t\treturn kubectl.RunKubectl(kubectlOptions, args...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2d26d5f3bec923699ae71f9af32a0a23", "score": "0.4306061", "text": "func upgradeKubeProxy(\n\tkubectlOptions *kubectl.KubectlOptions,\n\tclientset *kubernetes.Clientset,\n\tawsRegion string,\n\tkubeProxyVersion string,\n\tshouldWait bool,\n\twaitTimeout string,\n) error {\n\tlogger := logging.GetProjectLogger()\n\n\ttargetImage := fmt.Sprintf(\"602401143452.dkr.ecr.%s.amazonaws.com/eks/kube-proxy:v%s\", awsRegion, kubeProxyVersion)\n\tcurrentImage, err := getCurrentDeployedKubeProxyImage(clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif currentImage == targetImage {\n\t\tlogger.Info(\"Current deployed version matches expected version. Skipping kube-proxy update.\")\n\t\treturn nil\n\t}\n\n\tlogger.Infof(\"Upgrading current deployed version of kube-proxy (%s) to match expected version (%s).\", currentImage, targetImage)\n\tif err := updateKubeProxyDaemonsetImage(clientset, targetImage); err != nil {\n\t\treturn err\n\t}\n\tif shouldWait {\n\t\tlogger.Info(\"Waiting until new image for kube-proxy is rolled out.\")\n\t\t// Ideally we will implement the following routine using the raw client-go library, but implementing this\n\t\t// functionality directly on the API is fairly complex, and thus we rely on the built in mechanism in kubectl\n\t\t// instead.\n\t\targs := []string{\n\t\t\t\"rollout\",\n\t\t\t\"status\",\n\t\t\tfmt.Sprintf(\"daemonset/%s\", kubeProxyDaemonSetName),\n\t\t\t\"-n\", componentNamespace,\n\t\t\t\"--timeout\", waitTimeout,\n\t\t}\n\t\treturn kubectl.RunKubectl(kubectlOptions, args...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de8d232580865c7d21511023b6fa6f85", "score": "0.43042356", "text": "func PullConfigUpdate(\n\tctx context.Context,\n\tkongConfig sendconfig.Kong,\n\tlog logr.Logger,\n\tkubeConfig *rest.Config,\n\tpublishService string,\n\tpublishAddresses []string,\n) {\n\tvar hostname string\n\tvar ips []string\n\tfor {\n\t\tvar err error\n\t\tips, hostname, err = RunningAddresses(ctx, kubeConfig, publishService, publishAddresses)\n\t\tif err != nil {\n\t\t\t// in the case that a LoadBalancer type service is being used for the Kong Proxy\n\t\t\t// we must wait until the IP address if fully provisioned before we will be able\n\t\t\t// to use the reference IPs/Hosts from that LoadBalancer to update resource status addresses.\n\t\t\tif err.Error() == proxyLBNotReadyMessage {\n\t\t\t\tlog.V(util.InfoLevel).Info(\"LoadBalancer type Service for the Kong proxy is not yet provisioned, waiting...\", \"service\", publishService)\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Error(err, \"failed to determine kong proxy external ips/hostnames.\")\n\t\t\treturn\n\t\t}\n\t\tbreak\n\t}\n\n\tcli, err := clientset.NewForConfig(kubeConfig)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to create k8s client.\")\n\t\treturn\n\t}\n\n\tversionInfo, err := cli.ServerVersion()\n\tif err != nil {\n\t\tlog.Error(err, \"failed to retrieve cluster version\")\n\t\treturn\n\t}\n\n\tkubernetesVersion, err := semver.Parse(strings.TrimPrefix(versionInfo.String(), \"v\"))\n\tif err != nil {\n\t\tlog.Error(err, \"could not parse cluster version\")\n\t\treturn\n\t}\n\n\tkiccli, err := kicclientset.NewForConfig(kubeConfig)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to create kong ingress client.\")\n\t\treturn\n\t}\n\n\tvar wg sync.WaitGroup\n\tfor {\n\t\tselect {\n\t\tcase updateDone := <-kongConfig.ConfigDone:\n\t\t\tlog.V(util.DebugLevel).Info(\"data-plane updates completed, updating resource statuses\")\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tif err := UpdateStatuses(ctx, &updateDone, log, cli, kiccli, &wg, ips, hostname, kubeConfig, kubernetesVersion); err != nil {\n\t\t\t\t\tlog.Error(err, \"failed to update resource statuses\")\n\t\t\t\t}\n\t\t\t}()\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"stop status update channel.\")\n\t\t\twg.Wait()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3cd47c6076da64de9e5910c4313be3f9", "score": "0.42967218", "text": "func (deployer *InClusterK8SDeployer) UpdateDeployment(deployment *apis.Deployment) error {\n\tdeployer.Deployment = deployment\n\tlog := deployer.GetLog().Logger\n\n\tlog.Info(\"Updating in-cluster kubernetes deployment\")\n\tk8sClient, err := k8s.NewForConfig(deployer.KubeConfig)\n\tif err != nil {\n\t\treturn errors.New(\"Unable to connect to kubernetes during delete: \" + err.Error())\n\t}\n\n\tnamespace := deployer.getNamespace()\n\tif err := k8sUtil.DeleteK8S([]string{namespace}, deployer.KubeConfig, log); err != nil {\n\t\tlog.Warningf(\"Unable to delete k8s objects in update: \" + err.Error())\n\t}\n\n\tk8sUtil.DeleteNodeReaderClusterRoleBindingToNamespace(k8sClient, namespace, log)\n\n\tif err := deployer.deployKubernetesObjects(k8sClient); err != nil {\n\t\tlog.Warningf(\"Unable to deploy k8s objects in update: \" + err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a9e1b96f419c7d761e42191b57aee59", "score": "0.4293581", "text": "func (ic *IngressController) reconcileConfigMap(cluster *federationapi.Cluster, configMap *v1.ConfigMap) {\n\tic.Lock() // TODO: Reduce the scope of this master election lock.\n\tdefer ic.Unlock()\n\n\tconfigMapNsName := types.NamespacedName{Name: configMap.Name, Namespace: configMap.Namespace}\n\tglog.V(4).Infof(\"Reconciling ConfigMap %q in cluster %q\", configMapNsName, cluster.Name)\n\n\tclusterIngressUID, clusterIngressUIDExists := cluster.ObjectMeta.Annotations[uidAnnotationKey]\n\tconfigMapUID, ok := configMap.Data[uidKey]\n\n\tif !ok {\n\t\tglog.Errorf(\"Warning: ConfigMap %q in cluster %q does not contain data key %q. Therefore it cannot become the master.\", configMapNsName, cluster.Name, uidKey)\n\t}\n\n\tif !clusterIngressUIDExists || clusterIngressUID == \"\" {\n\t\tglog.V(4).Infof(\"Cluster %q is the only master\", cluster.Name)\n\t\t// Second argument is the fallback, in case this is the only cluster, in which case it becomes the master\n\t\tvar err error\n\t\tif clusterIngressUID, err = ic.updateClusterIngressUIDToMasters(cluster, configMapUID); err != nil {\n\t\t\treturn\n\t\t}\n\t\t// If we successfully update the Cluster Object, fallthrough and update the configMap.\n\t}\n\n\t// Figure out providerUid.\n\tproviderUid := getProviderUid(cluster.Name)\n\tconfigMapProviderUid := configMap.Data[providerUidKey]\n\n\tif configMapUID == clusterIngressUID && configMapProviderUid == providerUid {\n\t\tglog.V(4).Infof(\"Ingress configMap update is not required: UID %q and ProviderUid %q are equal\", configMapUID, providerUid)\n\t} else {\n\t\tif configMapUID != clusterIngressUID {\n\t\t\tglog.V(4).Infof(\"Ingress configMap update is required for UID: configMapUID %q not equal to clusterIngressUID %q\", configMapUID, clusterIngressUID)\n\t\t} else if configMapProviderUid != providerUid {\n\t\t\tglog.V(4).Infof(\"Ingress configMap update is required: configMapProviderUid %q not equal to providerUid %q\", configMapProviderUid, providerUid)\n\t\t}\n\t\tconfigMap.Data[uidKey] = clusterIngressUID\n\t\tconfigMap.Data[providerUidKey] = providerUid\n\t\toperations := []util.FederatedOperation{{\n\t\t\tType: util.OperationTypeUpdate,\n\t\t\tObj: configMap,\n\t\t\tClusterName: cluster.Name,\n\t\t\tKey: configMapNsName.String(),\n\t\t}}\n\t\tglog.V(4).Infof(\"Calling federatedConfigMapUpdater.Update() - operations: %v\", operations)\n\t\terr := ic.federatedConfigMapUpdater.Update(operations)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to execute update of ConfigMap %q on cluster %q: %v\", configMapNsName, cluster.Name, err)\n\t\t\tic.configMapDeliverer.DeliverAfter(cluster.Name, nil, ic.configMapReviewDelay)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cc00f6aecc7c00c3c30649c4bda7bfdc", "score": "0.42914897", "text": "func ResizeCluster(project string, zone string, environment string, targetSize int) {\n\tclusterName := fmt.Sprintf(\"%s-%s\", project, environment)\n\taction := \"container clusters resize\"\n\n\tnodePools := ListClusterNodePools(project, zone, environment)\n\tnodePoolResizeTpl := \"--node-pool %s --num-nodes %s\"\n\n\tfor _, np := range nodePools {\n\t\tnodePoolName := np[\"name\"]\n\t\tnodePoolNameStr, _ := nodePoolName.(string)\n\t\tfmt.Printf(\"Resizing node pool %s to %d\\n\", nodePoolName, targetSize)\n\t\ttargetSizeStr := strconv.Itoa(targetSize)\n\t\tnodePoolResizeArray := util.StringTemplateToArgsArray(nodePoolResizeTpl, nodePoolNameStr, targetSizeStr)\n\t\tnodePoolResizePart := strings.Join(nodePoolResizeArray, \" \")\n\n\t\tcmdTpl := \"%s %s %s --zone %s --project %s -q\"\n\t\targsArray := util.StringTemplateToArgsArray(cmdTpl, action, clusterName, nodePoolResizePart, zone, project)\n\t\tcmd := commandline.New(\"gcloud\", argsArray)\n\t\tcmd.Run()\n\t\tfmt.Printf(\"Node Pool %s resized\", nodePoolName)\n\t}\n\tfmt.Println(\"Cluster resized\")\n}", "title": "" }, { "docid": "5cfbbacd41072c167c3091ff25b52027", "score": "0.42914245", "text": "func updateManagedClusterAddon(\n\taddon addons.KlusterletAddon,\n\tklusterletaddonconfig *agentv1.KlusterletAddonConfig,\n\tclient client.Client,\n\tscheme *runtime.Scheme,\n) error {\n\tmanagedClusterAddon := &addonv1alpha1.ManagedClusterAddOn{}\n\t// check if it exists\n\tif err := client.Get(\n\t\tcontext.TODO(),\n\t\ttypes.NamespacedName{\n\t\t\tName: addon.GetManagedClusterAddOnName(),\n\t\t\tNamespace: klusterletaddonconfig.Namespace,\n\t\t},\n\t\tmanagedClusterAddon,\n\t); err != nil && errors.IsNotFound(err) {\n\t\t// create new\n\t\tnewManagedClusterAddon := &addonv1alpha1.ManagedClusterAddOn{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: addonv1alpha1.SchemeGroupVersion.String(),\n\t\t\t\tKind: \"ManagedClusterAddOn\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: addon.GetManagedClusterAddOnName(),\n\t\t\t\tNamespace: klusterletaddonconfig.Namespace,\n\t\t\t},\n\t\t\tSpec: addonv1alpha1.ManagedClusterAddOnSpec{\n\t\t\t\tInstallNamespace: addonoperator.KlusterletAddonNamespace,\n\t\t\t},\n\t\t}\n\n\t\tif err := controllerutil.SetControllerReference(klusterletaddonconfig, newManagedClusterAddon, scheme); err != nil {\n\t\t\tlog.Error(err, \"failed to set controller of ManagedClusterAddOn \"+addon.GetManagedClusterAddOnName())\n\t\t\treturn err\n\t\t}\n\t\tif err := client.Create(context.TODO(), newManagedClusterAddon); err != nil {\n\t\t\tlog.Error(err, \"\")\n\t\t\treturn err\n\t\t}\n\t\tmanagedClusterAddon = newManagedClusterAddon\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tref := []addonv1alpha1.ObjectReference{\n\t\taddonv1alpha1.ObjectReference{\n\t\t\tGroup: agentv1.SchemeGroupVersion.Group,\n\t\t\tResource: \"klusterletaddonconfigs\",\n\t\t\tName: klusterletaddonconfig.Name,\n\t\t},\n\t}\n\taddonMeta := addonv1alpha1.AddOnMeta{}\n\taddonConf := addonv1alpha1.ConfigCoordinates{}\n\tif addonMap, ok := clustermanagementaddon.ClusterManagementAddOnMap[addon.GetManagedClusterAddOnName()]; ok {\n\t\taddonMeta.Description = addonMap.Description\n\t\taddonMeta.DisplayName = addonMap.DisplayName\n\t\taddonConf.CRDName = addonMap.CRDName\n\t\taddonConf.CRName = klusterletaddonconfig.Name\n\t}\n\n\tif !reflect.DeepEqual(managedClusterAddon.Status.RelatedObjects, ref) ||\n\t\t!reflect.DeepEqual(managedClusterAddon.Status.AddOnMeta, addonMeta) ||\n\t\t!reflect.DeepEqual(managedClusterAddon.Status.AddOnConfiguration, addonConf) {\n\t\tmanagedClusterAddon.Status.RelatedObjects = ref\n\t\tmanagedClusterAddon.Status.AddOnMeta = addonMeta\n\t\tmanagedClusterAddon.Status.AddOnConfiguration = addonConf\n\n\t\tif err := client.Status().Update(context.TODO(), managedClusterAddon); err != nil {\n\t\t\tlog.Error(err, fmt.Sprintf(\"Failed to update ManagedClusterAddon %s status\", managedClusterAddon.Name))\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca458b3e18eea3b0b21485852b7a5a68", "score": "0.42885715", "text": "func (gdc *GameDeploymentController) updatePod(old, cur interface{}) {\n\tcurPod := cur.(*v1.Pod)\n\toldPod := old.(*v1.Pod)\n\tif curPod.ResourceVersion == oldPod.ResourceVersion {\n\t\t// Periodic resync will send update events for all known pods.\n\t\t// Two different versions of the same pod will always have different RVs.\n\t\tklog.V(4).Infof(\"Pod %s/%s update event trigger, but nothing changed, ResourceVersion: %s\", curPod.Namespace, curPod.Name, curPod.ResourceVersion)\n\t\treturn\n\t}\n\n\tlabelChanged := !reflect.DeepEqual(curPod.Labels, oldPod.Labels)\n\tif curPod.DeletionTimestamp != nil {\n\t\t// when a pod is deleted gracefully it's deletion timestamp is first modified to reflect a grace period,\n\t\t// and after such time has passed, the kubelet actually deletes it from the store. We receive an update\n\t\t// for modification of the deletion timestamp and expect an rs to create more replicas asap, not wait\n\t\t// until the kubelet actually deletes the pod. This is different from the Phase of a pod changing, because\n\t\t// an rs never initiates a phase change, and so is never asleep waiting for the same.\n\t\tgdc.deletePod(curPod)\n\t\tif labelChanged {\n\t\t\t// we don't need to check the oldPod.DeletionTimestamp because DeletionTimestamp cannot be unset.\n\t\t\tgdc.deletePod(oldPod)\n\t\t}\n\t\treturn\n\t}\n\n\tcurControllerRef := metav1.GetControllerOf(curPod)\n\toldControllerRef := metav1.GetControllerOf(oldPod)\n\tcontrollerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef)\n\tif controllerRefChanged && oldControllerRef != nil {\n\t\t// The ControllerRef was changed. Sync the old controller, if any.\n\t\tif deploy := gdc.resolveControllerRef(oldPod.Namespace, oldControllerRef); deploy != nil {\n\t\t\tgdc.enqueueGameDeployment(deploy)\n\t\t}\n\t}\n\n\t// If it has a ControllerRef, that's all that matters.\n\tif curControllerRef != nil {\n\t\tdeploy := gdc.resolveControllerRef(curPod.Namespace, curControllerRef)\n\t\tif deploy == nil {\n\t\t\treturn\n\t\t}\n\t\tkey := fmt.Sprintf(\"%s/%s\", deploy.Namespace, deploy.Name)\n\t\tklog.V(4).Infof(\"Pod %s updated, objectMeta %+v -> %+v, owner: %s.\", curPod.Name, oldPod.ObjectMeta, curPod.ObjectMeta, key)\n\t\tgdc.enqueueGameDeployment(deploy)\n\t\treturn\n\t}\n\n\t// Otherwise, it's an orphan. If anything changed, sync matching controllers\n\t// to see if anyone wants to adopt it now.\n\tif labelChanged || controllerRefChanged {\n\t\tdeploys := gdc.getDeploymentsForPod(curPod)\n\t\tif len(deploys) == 0 {\n\t\t\tklog.V(4).Infof(\"Pod %s/%s is orphan in updated, but not controlled by GameDeployment-Operator\", curPod.Namespace, curPod.Name)\n\t\t\treturn\n\t\t}\n\t\tklog.Infof(\"Orphan Pod %s/%s updated, objectMeta %+v -> %+v.\", curPod.Namespace, curPod.Name, oldPod.ObjectMeta, curPod.ObjectMeta)\n\t\tfor _, deploy := range deploys {\n\t\t\tgdc.enqueueGameDeployment(deploy)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4a6606b65f750342977c82486f4a195c", "score": "0.4285873", "text": "func updateManagedClusterAddon(\n\taddon addons.KlusterletAddon,\n\tklusterletaddonconfig *agentv1.KlusterletAddonConfig,\n\tclient client.Client,\n\tscheme *runtime.Scheme,\n) error {\n\tmanagedClusterAddon := &addonv1alpha1.ManagedClusterAddOn{}\n\t// check if it exists\n\tif err := client.Get(\n\t\tcontext.TODO(),\n\t\ttypes.NamespacedName{\n\t\t\tName: addon.GetManagedClusterAddOnName(),\n\t\t\tNamespace: klusterletaddonconfig.Namespace,\n\t\t},\n\t\tmanagedClusterAddon,\n\t); err != nil && errors.IsNotFound(err) {\n\t\t// create new\n\t\tnewManagedClusterAddon := &addonv1alpha1.ManagedClusterAddOn{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: addonv1alpha1.SchemeGroupVersion.String(),\n\t\t\t\tKind: \"ManagedClusterAddOn\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: addon.GetManagedClusterAddOnName(),\n\t\t\t\tNamespace: klusterletaddonconfig.Namespace,\n\t\t\t},\n\t\t}\n\t\tif err := controllerutil.SetControllerReference(klusterletaddonconfig, newManagedClusterAddon, scheme); err != nil {\n\t\t\tlog.Error(err, \"failed to set controller of ManagedClusterAddOn \"+addon.GetManagedClusterAddOnName())\n\t\t\treturn err\n\t\t}\n\t\tif err := client.Create(context.TODO(), newManagedClusterAddon); err != nil {\n\t\t\tlog.Error(err, \"\")\n\t\t\treturn err\n\t\t}\n\t\tmanagedClusterAddon = newManagedClusterAddon\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tref := []addonv1alpha1.ObjectReference{\n\t\taddonv1alpha1.ObjectReference{\n\t\t\tGroup: agentv1.SchemeGroupVersion.Group,\n\t\t\tResource: \"klusterletaddonconfigs\",\n\t\t\tName: klusterletaddonconfig.Name,\n\t\t},\n\t}\n\taddonMeta := addonv1alpha1.AddOnMeta{}\n\taddonConf := addonv1alpha1.ConfigCoordinates{}\n\tif addonMap, ok := clustermanagementaddon.ClusterManagementAddOnMap[addon.GetManagedClusterAddOnName()]; ok {\n\t\taddonMeta.Description = addonMap.Description\n\t\taddonMeta.DisplayName = addonMap.DisplayName\n\t\taddonConf.CRDName = addonMap.CRDName\n\t\taddonConf.CRName = klusterletaddonconfig.Name\n\t}\n\n\tif !reflect.DeepEqual(managedClusterAddon.Status.RelatedObjects, ref) ||\n\t\t!reflect.DeepEqual(managedClusterAddon.Status.AddOnMeta, addonMeta) ||\n\t\t!reflect.DeepEqual(managedClusterAddon.Status.AddOnConfiguration, addonConf) {\n\t\tmanagedClusterAddon.Status.RelatedObjects = ref\n\t\tmanagedClusterAddon.Status.AddOnMeta = addonMeta\n\t\tmanagedClusterAddon.Status.AddOnConfiguration = addonConf\n\n\t\tif err := client.Status().Update(context.TODO(), managedClusterAddon); err != nil {\n\t\t\tlog.Error(err, fmt.Sprintf(\"Failed to update ManagedClusterAddon %s status\", managedClusterAddon.Name))\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d9b0c199d1d72efb3e19ccc2194100fc", "score": "0.4282013", "text": "func SyncClusterComponents(\n\teksClusterArn string,\n\tshouldWait bool,\n\twaitTimeout string,\n) error {\n\tlogger := logging.GetProjectLogger()\n\n\tlogger.Info(\"Looking up deployed Kubernetes version\")\n\tclusterInfo, err := eksawshelper.GetClusterByArn(eksClusterArn)\n\tif err != nil {\n\t\treturn err\n\t}\n\tk8sVersion := aws.StringValue(clusterInfo.Version)\n\n\tif !collections.ListContainsElement(supportedVersions, k8sVersion) {\n\t\treturn errors.WithStackTrace(UnsupportedEKSVersion{k8sVersion})\n\t}\n\n\tkubeProxyVersion := kubeProxyVersionLookupTable[k8sVersion]\n\tcoreDNSVersion := coreDNSVersionLookupTable[k8sVersion]\n\tamznVPCCNIVersion := amazonVPCCNIVersionLookupTable[k8sVersion]\n\tlogger.Info(\"Syncing Kubernetes Applications to:\")\n\tlogger.Infof(\"\\tkube-proxy:\\t%s\", kubeProxyVersion)\n\tlogger.Infof(\"\\tcoredns:\\t%s\", coreDNSVersion)\n\tlogger.Infof(\"\\tVPC CNI Plugin:\\t%s\", amznVPCCNIVersion)\n\n\tkubectlOptions := &kubectl.KubectlOptions{EKSClusterArn: eksClusterArn}\n\tclientset, err := kubectl.GetKubernetesClientFromOptions(kubectlOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tawsRegion, err := eksawshelper.GetRegionFromArn(eksClusterArn)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := upgradeKubeProxy(kubectlOptions, clientset, awsRegion, kubeProxyVersion, shouldWait, waitTimeout); err != nil {\n\t\treturn err\n\t}\n\tif err := upgradeCoreDNS(kubectlOptions, clientset, awsRegion, coreDNSVersion, shouldWait, waitTimeout); err != nil {\n\t\treturn err\n\t}\n\tif err := updateVPCCNI(kubectlOptions, awsRegion, amznVPCCNIVersion); err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Info(\"Successfully updated core components.\")\n\treturn nil\n}", "title": "" }, { "docid": "3ba9b55637a5668e74f8687884a9fc71", "score": "0.42803353", "text": "func (e *enqueForScalingWatermarksSelectingNodeHostingPod) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {\n\tpod, ok := evt.ObjectNew.(*corev1.Pod)\n\tif !ok {\n\t\te.log.Info(\"unable convert event object to pod,\", \"event\", evt)\n\t\treturn\n\t}\n\te.processReferringNodeScalingWatemarks(pod, q)\n}", "title": "" }, { "docid": "fcfcb59ada87abf677579648ff817e83", "score": "0.42770836", "text": "func (r *ClusterPeerReconciler) updateLabels(peer *ipfsv1alpha1.ClusterPeer) {\n\tif peer.Labels == nil {\n\t\tpeer.Labels = map[string]string{}\n\t}\n\n\tpeer.Labels[\"app.kubernetes.io/name\"] = \"ipfs-cluster-service\"\n\tpeer.Labels[\"app.kubernetes.io/instance\"] = peer.Name\n\tpeer.Labels[\"app.kubernetes.io/component\"] = \"ipfs-cluster-peer\"\n\tpeer.Labels[\"app.kubernetes.io/managed-by\"] = \"kotal\"\n\tpeer.Labels[\"app.kubernetes.io/created-by\"] = \"ipfs-cluster-peer-controller\"\n}", "title": "" }, { "docid": "077f236689170ab017bb47637781afee", "score": "0.42719185", "text": "func updateLabel(obj interface{}, newLabels map[string]string) error {\n\tobjm, err := runtime.GetObjectMeta(obj)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to fetch object meta from the object: %+v\", obj)\n\t}\n\n\treturn updateMetaLabel(objm, newLabels)\n}", "title": "" }, { "docid": "e26523cd591ccf6d51f04de4c80c185a", "score": "0.42709777", "text": "func migrateEncryptionConfig(ctx context.Context, restConfig *rest.Config) error {\n\tdynamicClient, err := k8dynamic.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclusterDynamicClient := dynamicClient.Resource(mgmntv3.ClusterGroupVersionResource)\n\n\tclusters, err := clusterDynamicClient.List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\tif !k8serror.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t\t// IsNotFound error means the CRD type doesn't exist in the cluster, indicating this is the first Rancher startup\n\t\treturn nil\n\t}\n\n\tvar allErrors error\n\n\tfor _, c := range clusters.Items {\n\t\terr := wait.PollImmediateInfinite(100*time.Millisecond, func() (bool, error) {\n\t\t\trawDynamicCluster, err := clusterDynamicClient.Get(ctx, c.GetName(), metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\tannotations := rawDynamicCluster.GetAnnotations()\n\t\t\tif annotations != nil && annotations[encryptionConfigUpdate] == \"true\" {\n\t\t\t\treturn true, nil\n\t\t\t}\n\n\t\t\tclusterBytes, err := rawDynamicCluster.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn false, errors.Wrap(err, \"error trying to Marshal dynamic cluster\")\n\t\t\t}\n\n\t\t\tvar cluster *v3.Cluster\n\n\t\t\tif err := json.Unmarshal(clusterBytes, &cluster); err != nil {\n\t\t\t\treturn false, errors.Wrap(err, \"error trying to Unmarshal dynamicCluster into v3 cluster\")\n\t\t\t}\n\n\t\t\tif cluster.Annotations == nil {\n\t\t\t\tcluster.Annotations = make(map[string]string)\n\t\t\t}\n\t\t\tcluster.Annotations[encryptionConfigUpdate] = \"true\"\n\n\t\t\tu, err := unstructured.ToUnstructured(cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\t_, err = clusterDynamicClient.Update(ctx, u, metav1.UpdateOptions{})\n\t\t\tif err == nil {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tif k8serror.IsConflict(err) || k8serror.IsServiceUnavailable(err) || k8serror.IsInternalError(err) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t})\n\t\tif err != nil {\n\t\t\tallErrors = multierror.Append(err, allErrors)\n\t\t}\n\t}\n\treturn allErrors\n}", "title": "" }, { "docid": "e013650e84b28e30b370225fa9bc00a7", "score": "0.42706925", "text": "func setUpdateProvisioningState(doc *api.OpenShiftClusterDocument, apiVersion string) {\n\tswitch apiVersion {\n\tcase admin.APIVersion:\n\t\t// For PUCM pending update, we don't want to set ProvisioningStateAdminUpdating\n\t\t// The cluster monitoring stack uses that value to determine if PUCM is ongoing\n\t\tif doc.OpenShiftCluster.Properties.MaintenanceTask != api.MaintenanceTaskPucmPending {\n\t\t\tdoc.OpenShiftCluster.Properties.ProvisioningState = api.ProvisioningStateAdminUpdating\n\t\t\tdoc.OpenShiftCluster.Properties.LastAdminUpdateError = \"\"\n\t\t} else {\n\t\t\tdoc.OpenShiftCluster.Properties.PucmPending = true\n\t\t\tdoc.OpenShiftCluster.Properties.ProvisioningState = api.ProvisioningStateUpdating\n\t\t}\n\tdefault:\n\t\t// Non-admin update (ex: customer cluster update)\n\t\tdoc.OpenShiftCluster.Properties.ProvisioningState = api.ProvisioningStateUpdating\n\t}\n}", "title": "" }, { "docid": "f4d5c86e04300b2037ba0e576932878d", "score": "0.42614296", "text": "func (s *scale) scale() (err error) {\n\tvar replicas int32\n\tvar dcs = []string{\"syndesis-meta\", \"syndesis-server\"}\n\n\tif s.dir == up {\n\t\treplicas = 1\n\t}\n\n\trtClient, err := s.clientTools.RuntimeClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Scale up or down\n\ts.log.Info(\"scale DeploymentConfig\", \"direction\", dirToS(s.dir), \"deployments\", dcs)\n\tfor _, dn := range dcs {\n\t\tdc := &appsv1.DeploymentConfig{}\n\t\tif err = rtClient.Get(s.context, types.NamespacedName{Namespace: s.namespace, Name: dn}, dc); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif dc.Spec.Replicas != replicas {\n\t\t\ts.log.Info(\"scaling DeploymentConfigs\", \"name\", dn, \"desired replicas\", replicas, \"replicas\", dc.Spec.Replicas)\n\t\t\tdc.Spec.Replicas = replicas\n\t\t\tif err = rtClient.Update(s.context, dc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Wait for DeploymentConfigs to correctly scale\n\ts.log.Info(\"waiting for DeploymentConfig to scale\", \"direction\", dirToS(s.dir), \"deployments\", dcs)\n\terr = wait.Poll(s.interval, s.timeout, func() (done bool, err error) {\n\t\tfor i, dn := range dcs {\n\t\t\tdc := &appsv1.DeploymentConfig{}\n\t\t\tif err = rtClient.Get(s.context, types.NamespacedName{Namespace: s.namespace, Name: dn}, dc); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\tif dc.Status.AvailableReplicas == replicas {\n\t\t\t\ts.log.Info(\"deploymentConfig successfully scaled\", \"name\", dn, \"desired replicas\", replicas, \"available replicas\", dc.Status.AvailableReplicas)\n\t\t\t\tif len(dcs) == 1 {\n\t\t\t\t\tdcs = dcs[:len(dcs)-1]\n\t\t\t\t} else {\n\t\t\t\t\tdcs = append(dcs[:i], dcs[i+1:]...)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ts.log.Info(\"waiting for DeploymentConfig to reach desired number of replicas\", \"name\", dn, \"desired replicas\", replicas, \"available replicas\", dc.Status.AvailableReplicas)\n\t\t\t}\n\n\t\t\tif len(dcs) == 0 {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\n\t\treturn false, nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "865e0b6d9dc9c5e78bbde960e5f5e792", "score": "0.42606193", "text": "func (w *Workload) updateCoreDNSDeployment(ctx context.Context, info *coreDNSInfo, kubernetesVersion semver.Version) error {\n\thelper, err := patch.NewHelper(info.Deployment, w.Client)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Form the final image before issuing the patch.\n\tpatchCoreDNSDeploymentImage(info.Deployment, info.ToImage)\n\n\t// Flip the deployment volume back to Corefile (from the backup key).\n\tpatchCoreDNSDeploymentVolume(info.Deployment, corefileBackupKey, corefileKey)\n\n\t// Patch the tolerations according to the Kubernetes Version.\n\tpatchCoreDNSDeploymentTolerations(info.Deployment, kubernetesVersion)\n\treturn helper.Patch(ctx, info.Deployment)\n}", "title": "" }, { "docid": "ad576040e59de2dac91dcef7b6b017b0", "score": "0.42601326", "text": "func (h *WebHandler) updateClusterCert(w http.ResponseWriter, r *http.Request, p httprouter.Params, context *HandlerContext) error {\n\tvar req ops.UpdateCertificateRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\treturn trace.BadParameter(err.Error())\n\t}\n\tcert, err := context.Operator.UpdateClusterCertificate(r.Context(), req)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\troundtrip.ReplyJSON(w, http.StatusOK, cert)\n\treturn nil\n}", "title": "" }, { "docid": "7173117a5cebc0f198668c94ad1ef6cc", "score": "0.4255788", "text": "func (c *Controller) populateVersion(cspc *cstor.CStorPoolCluster) (*cstor.CStorPoolCluster, error) {\n\tif cspc.VersionDetails.Status.Current == \"\" {\n\t\tvar err error\n\t\tvar v string\n\t\tvar obj *cstor.CStorPoolCluster\n\t\tv, err = c.EstimateCSPCVersion(cspc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcspc.VersionDetails.Status.Current = v\n\t\t// For newly created spc Desired field will also be empty.\n\t\tcspc.VersionDetails.Desired = v\n\t\tcspc.VersionDetails.Status.DependentsUpgraded = true\n\t\tobj, err = c.GetStoredCStorVersionClient().\n\t\t\tCStorPoolClusters(cspc.Namespace).\n\t\t\tUpdate(context.TODO(), cspc, metav1.UpdateOptions{})\n\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(\n\t\t\t\terr,\n\t\t\t\t\"failed to update cspc %s while adding versiondetails\",\n\t\t\t\tcspc.Name,\n\t\t\t)\n\t\t}\n\t\tklog.Infof(\"Version %s added on cspc %s\", v, cspc.Name)\n\t\treturn obj, nil\n\t}\n\treturn cspc, nil\n}", "title": "" }, { "docid": "8c4225249fe60ae7f1487ebac1e62b5c", "score": "0.4249132", "text": "func ReplaceObject(ctx context.Context, clientset *kubernetes.Clientset, obj runtime.Object, namespace string) (string, string, error) {\n\tvar name, kind string\n\tvar err error\n\tswitch objT := obj.(type) {\n\n\tcase *appsv1.DaemonSet:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.AppsV1().DaemonSets(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *appsv1.Deployment:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.AppsV1().Deployments(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *batchv1.Job:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.BatchV1().Jobs(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *batchv1beta1.CronJob:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.BatchV1beta1().CronJobs(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *netv1.Ingress:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.NetworkingV1().Ingresses(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1.ClusterRole:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1().ClusterRoles().Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1.ClusterRoleBinding:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1().ClusterRoleBindings().Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1.Role:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1().Roles(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1.RoleBinding:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1().RoleBindings(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1beta1.ClusterRole:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1beta1().ClusterRoles().Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1beta1.ClusterRoleBinding:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1beta1().ClusterRoleBindings().Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1beta1.Role:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1beta1().Roles(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *rbacv1beta1.RoleBinding:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.RbacV1beta1().RoleBindings(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *storagev1.StorageClass:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.StorageV1().StorageClasses().Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.ConfigMap:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().ConfigMaps(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.PersistentVolume:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().PersistentVolumes().Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.PersistentVolumeClaim:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().PersistentVolumeClaims(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.Pod:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().Pods(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.Secret:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().Secrets(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.Service:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().Services(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1.ServiceAccount:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.CoreV1().ServiceAccounts(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1beta1.DaemonSet:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.ExtensionsV1beta1().DaemonSets(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tcase *v1beta1.Deployment:\n\t\tname = objT.ObjectMeta.Name\n\t\tkind = objT.TypeMeta.Kind\n\t\t_, err = clientset.ExtensionsV1beta1().Deployments(namespace).Update(ctx, objT, metav1.UpdateOptions{})\n\n\tdefault:\n\t\treturn \"\", \"\", fmt.Errorf(\"Unknown object type %T\\n \", objT)\n\t}\n\treturn name, kind, err\n}", "title": "" }, { "docid": "24dd95a72362461de12c6391a98bb9df", "score": "0.4247497", "text": "func (d *Driver) Update() error {\n\tsvc, err := d.getServiceClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogrus.Debugf(\"Updating config. MasterVersion: %s, NodeVersion: %s, NodeCount: %v\", d.MasterVersion, d.NodeVersion, d.NodeCount)\n\tif d.NodePoolID == \"\" {\n\t\tcluster, err := svc.Projects.Zones.Clusters.Get(d.ProjectID, d.Zone, d.Name).Context(context.Background()).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.NodePoolID = cluster.NodePools[0].Name\n\t}\n\n\tif d.MasterVersion != \"\" {\n\t\tlogrus.Infof(\"Updating master to %v\", d.MasterVersion)\n\t\toperation, err := svc.Projects.Zones.Clusters.Update(d.ProjectID, d.Zone, d.Name, &raw.UpdateClusterRequest{\n\t\t\tUpdate: &raw.ClusterUpdate{\n\t\t\t\tDesiredMasterVersion: d.MasterVersion,\n\t\t\t},\n\t\t}).Context(context.Background()).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlogrus.Debugf(\"Cluster %s update is called for project %s and zone %s. Status Code %v\", d.Name, d.ProjectID, d.Zone, operation.HTTPStatusCode)\n\t\tif err := d.waitCluster(svc); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif d.NodeVersion != \"\" {\n\t\tlogrus.Infof(\"Updating node version to %v\", d.NodeVersion)\n\t\toperation, err := svc.Projects.Zones.Clusters.NodePools.Update(d.ProjectID, d.Zone, d.Name, d.NodePoolID, &raw.UpdateNodePoolRequest{\n\t\t\tNodeVersion: d.NodeVersion,\n\t\t}).Context(context.Background()).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlogrus.Debugf(\"Nodepool %s update is called for project %s, zone %s and cluster %s. Status Code %v\", d.NodePoolID, d.ProjectID, d.Zone, d.Name, operation.HTTPStatusCode)\n\t\tif err := d.waitNodePool(svc); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif d.NodeCount != 0 {\n\t\tlogrus.Infof(\"Updating node number to %v\", d.NodeCount)\n\t\toperation, err := svc.Projects.Zones.Clusters.NodePools.SetSize(d.ProjectID, d.Zone, d.Name, d.NodePoolID, &raw.SetNodePoolSizeRequest{\n\t\t\tNodeCount: d.NodeCount,\n\t\t}).Context(context.Background()).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlogrus.Debugf(\"Nodepool %s setSize is called for project %s, zone %s and cluster %s. Status Code %v\", d.NodePoolID, d.ProjectID, d.Zone, d.Name, operation.HTTPStatusCode)\n\t\tif err := d.waitCluster(svc); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7e9f98f196fc10dc663b8963c95c5d4", "score": "0.4244748", "text": "func (c *Config) Upgrade(log log.Logger) (config.Config, error) {\n\tnextConfig := &next.Config{}\n\terr := util.Convert(c, nextConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// dependencies\n\tfor i, d := range c.Dependencies {\n\t\tif d.OverwriteVars == nil || *d.OverwriteVars {\n\t\t\tnextConfig.Dependencies[i].OverwriteVars = true\n\t\t}\n\t}\n\n\t// commands\n\tfor i, c := range c.Commands {\n\t\tif c.AppendArgs == nil || *c.AppendArgs {\n\t\t\tnextConfig.Commands[i].AppendArgs = true\n\t\t}\n\t}\n\n\t// replace pod\n\tfor i, rp := range c.Dev.ReplacePods {\n\t\tif rp.ImageName != \"\" {\n\t\t\tnextConfig.Dev.ReplacePods[i].ImageSelector = fmt.Sprintf(\"image(%s):tag(%s)\", rp.ImageName, rp.ImageName)\n\t\t}\n\t}\n\n\t// port forwarding\n\tfor i, rp := range c.Dev.Ports {\n\t\tif rp.ImageName != \"\" {\n\t\t\tnextConfig.Dev.Ports[i].ImageSelector = fmt.Sprintf(\"image(%s):tag(%s)\", rp.ImageName, rp.ImageName)\n\t\t}\n\t}\n\n\t// sync\n\tfor i, rp := range c.Dev.Sync {\n\t\tif rp.ImageName != \"\" {\n\t\t\tnextConfig.Dev.Sync[i].ImageSelector = fmt.Sprintf(\"image(%s):tag(%s)\", rp.ImageName, rp.ImageName)\n\t\t}\n\t}\n\n\t// logs\n\tif c.Dev.Logs != nil {\n\t\tfor _, rp := range c.Dev.Logs.Images {\n\t\t\tif nextConfig.Dev.Logs == nil {\n\t\t\t\tnextConfig.Dev.Logs = &next.LogsConfig{}\n\t\t\t}\n\t\t\tif nextConfig.Dev.Logs.Selectors == nil {\n\t\t\t\tnextConfig.Dev.Logs.Selectors = []next.LogsSelector{}\n\t\t\t}\n\n\t\t\tnextConfig.Dev.Logs.Selectors = append(nextConfig.Dev.Logs.Selectors, next.LogsSelector{\n\t\t\t\tImageSelector: fmt.Sprintf(\"image(%s):tag(%s)\", rp, rp),\n\t\t\t})\n\t\t}\n\t}\n\n\t// terminal\n\tif c.Dev.Terminal != nil && c.Dev.Terminal.ImageName != \"\" {\n\t\tif nextConfig.Dev.Terminal == nil {\n\t\t\tnextConfig.Dev.Terminal = &next.Terminal{}\n\t\t}\n\n\t\tnextConfig.Dev.Terminal.ImageSelector = fmt.Sprintf(\"image(%s):tag(%s)\", c.Dev.Terminal.ImageName, c.Dev.Terminal.ImageName)\n\t}\n\n\t// hooks\n\tfor i, h := range c.Hooks {\n\t\tif h.Where.Container != nil {\n\t\t\tnewContainer := &next.HookContainer{}\n\t\t\terr = util.Convert(h.Where.Container, newContainer)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tnextConfig.Hooks[i].Container = newContainer\n\t\t}\n\n\t\tevents := []string{}\n\t\tif h.When != nil {\n\t\t\tif h.When.After != nil {\n\t\t\t\tevents = append(events, getEventsFrom(\"after:build\", h.When.After.Images, false)...)\n\t\t\t\tevents = append(events, getEventsFrom(\"after:deploy\", h.When.After.Deployments, false)...)\n\t\t\t\tevents = append(events, getEventsFrom(\"after:purge\", h.When.After.PurgeDeployments, false)...)\n\t\t\t\tif h.When.After.PullSecrets != \"\" {\n\t\t\t\t\tevents = append(events, \"after:createPullSecrets\")\n\t\t\t\t}\n\t\t\t\tif h.When.After.Dependencies != \"\" {\n\t\t\t\t\tevents = append(events, \"after:deployDependencies\")\n\t\t\t\t}\n\t\t\t\tevents = append(events, getEventsFrom(\"after:initialSync\", h.When.After.InitialSync, true)...)\n\t\t\t}\n\t\t\tif h.When.Before != nil {\n\t\t\t\tevents = append(events, getEventsFrom(\"before:build\", h.When.Before.Images, false)...)\n\t\t\t\tevents = append(events, getEventsFrom(\"before:deploy\", h.When.Before.Deployments, false)...)\n\t\t\t\tevents = append(events, getEventsFrom(\"before:purge\", h.When.Before.PurgeDeployments, false)...)\n\t\t\t\tif h.When.Before.PullSecrets != \"\" {\n\t\t\t\t\tevents = append(events, \"before:createPullSecrets\")\n\t\t\t\t}\n\t\t\t\tif h.When.Before.Dependencies != \"\" {\n\t\t\t\t\tevents = append(events, \"before:deployDependencies\")\n\t\t\t\t}\n\t\t\t\tevents = append(events, getEventsFrom(\"before:initialSync\", h.When.Before.InitialSync, true)...)\n\t\t\t}\n\t\t\tif h.When.OnError != nil {\n\t\t\t\tevents = append(events, getEventsFrom(\"error:build\", h.When.OnError.Images, true)...)\n\t\t\t\tevents = append(events, getEventsFrom(\"error:deploy\", h.When.OnError.Deployments, true)...)\n\t\t\t\tevents = append(events, getEventsFrom(\"error:purge\", h.When.OnError.PurgeDeployments, true)...)\n\t\t\t\tif h.When.OnError.PullSecrets != \"\" {\n\t\t\t\t\tevents = append(events, \"error:createPullSecrets\")\n\t\t\t\t}\n\t\t\t\tif h.When.OnError.Dependencies != \"\" {\n\t\t\t\t\tevents = append(events, \"error:deployDependencies\")\n\t\t\t\t}\n\t\t\t\tevents = append(events, getEventsFrom(\"error:initialSync\", h.When.OnError.InitialSync, true)...)\n\t\t\t}\n\t\t}\n\t\tnextConfig.Hooks[i].Events = events\n\t}\n\n\treturn nextConfig, nil\n}", "title": "" } ]
ff00194176753a44d55acdb2bd6ea0cb
HasDisplayName returns a boolean if a field has been set.
[ { "docid": "1ec6f14b15bd5a2917ad9cc4d95da196", "score": "0.7915426", "text": "func (o *TelecomExpenseManagementPartner) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "c4d21c3aa1a4468d7a7cc6426fbe233e", "score": "0.8050077", "text": "func (o *Item) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a9173de5cdc1911638b575bd7d70be68", "score": "0.77818054", "text": "func (o *MicrosoftGraphPerson) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d30e74d960b4780933c814914d17036a", "score": "0.7767493", "text": "func (o *PatchUserRequest) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c5f51b95ef0a44ff0f8d4005e1e729d9", "score": "0.7733", "text": "func (o *OffersAndOptionsReqWeb) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d9ced24c2c65048f41503654b106681b", "score": "0.7694617", "text": "func (o *EnumType) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "97a1577620924ed5a2a43cd6c70eb9a2", "score": "0.7669684", "text": "func (o *SchemaStub) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "70321ccfb42e20322fb717b01f437993", "score": "0.7622271", "text": "func (o *ViewFileversion) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4e0bb580ba0224417065c6a741d2ccff", "score": "0.747557", "text": "func (o *CreateHostOut) HasDisplayName() bool {\n\tif o != nil && o.DisplayName.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "38e78634e9e9fc6c1723c347e1e9f019", "score": "0.71696216", "text": "func (o *MicrosoftGraphWindowsPhone81GeneralConfiguration) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bf3f74554c2b51cda4bbd0e5c1f152c1", "score": "0.7120679", "text": "func (o *MicrosoftGraphManagedDeviceMobileAppConfiguration) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2765fb7adfa43de918311aef33deb13a", "score": "0.6941202", "text": "func (o *MicrosoftGraphAndroidGeneralDeviceConfiguration) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c9b211a0634ce76e61bd0cb73f2c0d3b", "score": "0.6380052", "text": "func (o *MicrosoftGraphManagedDevice) HasUserDisplayName() bool {\n\tif o != nil && o.UserDisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "989a6d1e63974249ef38838edce3e595", "score": "0.6357134", "text": "func (o *User) HasFirstName() bool {\n\tif o != nil && o.FirstName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ff434525a95debb95add8dd810ae3636", "score": "0.6240286", "text": "func (o *ManagedDeviceMobileAppConfigurationDeviceStatus) HasDeviceDisplayName() bool {\n\tif o != nil && o.DeviceDisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "df5b2d3b22302fe6f4d17a0bd1ab7512", "score": "0.6240155", "text": "func (o *CreateHostOut) GetDisplayNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName.Get(), o.DisplayName.IsSet()\n}", "title": "" }, { "docid": "67bed325e3f093ff245857955d06890b", "score": "0.62198734", "text": "func (o *UserDetail) GetDisplayNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DisplayName, true\n}", "title": "" }, { "docid": "0d75b55ee56534f498259a3f877ecce3", "score": "0.61844444", "text": "func (o *Local) HasNome() bool {\n\tif o != nil && o.Nome.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8be6e494827512bbd7d42dc3ebf5870c", "score": "0.61433583", "text": "func (o *Entidade) HasNome() bool {\n\tif o != nil && o.Nome.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "78d760e1c19219eaf2f314b47d5732de", "score": "0.61424565", "text": "func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasWebauthnRegisterDisplayname() bool {\n\tif o != nil && o.WebauthnRegisterDisplayname != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "80db3b7f85c03ed58055222ad4d3d83d", "score": "0.6121931", "text": "func (o *PerfilSeguranca) HasNome() bool {\n\tif o != nil && o.Nome.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e85d39090aea6b3c7ee54677044f8436", "score": "0.6093304", "text": "func (o *Item) GetDisplayNameOk() (*string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName, true\n}", "title": "" }, { "docid": "1675db50024855afbd44fbcef7a5ad91", "score": "0.6037069", "text": "func (o *OffersAndOptionsReqWeb) GetDisplayNameOk() (*string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName, true\n}", "title": "" }, { "docid": "dde0ff713cf7aac33dd05b951393a15d", "score": "0.602072", "text": "func (o *MicrosoftGraphPerson) HasGivenName() bool {\n\tif o != nil && o.GivenName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "da43cbab83ae4a966432955873cc9900", "score": "0.6014778", "text": "func (o *Subscriber) HasDisplayPhoneNumber() bool {\n\tif o != nil && o.DisplayPhoneNumber != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6230fefb4f792482e4f0f1a76a273f48", "score": "0.6003907", "text": "func (o *SchemaStub) GetDisplayNameOk() (*string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName, true\n}", "title": "" }, { "docid": "de97b2831a3e472279e64c7fe9605b27", "score": "0.59467125", "text": "func (o *SubmitSelfServiceFlowWithWebAuthnRegistrationMethod) HasWebauthnRegisterDisplayname() bool {\n\tif o != nil && o.WebauthnRegisterDisplayname != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "92d529f9a1cdb79d8d7bbb29513aa0e8", "score": "0.5930999", "text": "func (o *ModelsResourcesResponseShow) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fb76ecb7ae92c8077700bcec9bdb27d1", "score": "0.59076995", "text": "func (o *TelecomExpenseManagementPartner) GetDisplayNameOk() (string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DisplayName, true\n}", "title": "" }, { "docid": "d9b78c9e03472f4233b578b4ca324137", "score": "0.59038734", "text": "func HasField(object *astext.Object, name string) bool {\n\tfor _, f := range object.Fields {\n\t\tid, err := FieldID(f)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\tif id == name {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e0a156f3eb7f22cf88c04c6946db4eef", "score": "0.5903375", "text": "func (o *ViewFileversion) GetDisplayNameOk() (*string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName, true\n}", "title": "" }, { "docid": "04b9aa1b3035a7d92a80afd64bfd9b90", "score": "0.59021", "text": "func (o *InlineResponse200105Reminders) HasUserFirstname() bool {\n\tif o != nil && o.UserFirstname != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dcfae8c75b5be72397ec40a79a87c3c8", "score": "0.5876447", "text": "func (m *UserMutation) DisplayName() (r string, exists bool) {\n\tv := m.display_name\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "79b82e90dc96fc84c53f98cbd997c20f", "score": "0.5875971", "text": "func (o *MicrosoftGraphWindowsPhone81GeneralConfiguration) GetDisplayNameOk() (string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DisplayName, true\n}", "title": "" }, { "docid": "57c7007edad41aba1e97916b94937bfb", "score": "0.5872589", "text": "func (m *action) SetDisplayName(val string) {\n\tm.displayNameField = val\n}", "title": "" }, { "docid": "d0e1af19c3e2ddbd72963eaf39047ccf", "score": "0.5865594", "text": "func (o *MicrosoftGraphPerson) GetDisplayNameOk() (string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DisplayName, true\n}", "title": "" }, { "docid": "26306efbe588aa91f4892225959acd18", "score": "0.58497745", "text": "func (o *EnumType) GetDisplayNameOk() (*string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName, true\n}", "title": "" }, { "docid": "408252e71712ef37fb9c0f84b08e72cf", "score": "0.58478266", "text": "func (o *HyperflexSummary) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c91dc05c05f33e2a1905d6d2432f5d83", "score": "0.5841398", "text": "func (m *UnifiedRoleDefinition) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "6b59a2d96d4106604e2aa6168994b8cd", "score": "0.584015", "text": "func (m *ChecklistItem) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "907b02185da39702b36a3a276b6ea03f", "score": "0.5813859", "text": "func (o *MicrosoftGraphDeviceInstallState) HasUserName() bool {\n\tif o != nil && o.UserName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8c5cfca66455e9ba4b2ef90810ced9e2", "score": "0.5791921", "text": "func (o *PatchUserRequest) GetDisplayNameOk() (*string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayName, true\n}", "title": "" }, { "docid": "193966a6383fcc3c866490f5864458f4", "score": "0.5784144", "text": "func (o *DatacenterProperties) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "07e7d2b0bc145e6090fae7d9f6228aef", "score": "0.57419205", "text": "func (o *LoginResponseUser) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "396170894c5c61704473cba9eaf0d678", "score": "0.57318306", "text": "func (m *TelecomExpenseManagementPartner) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "cb62346dcbd873633d7b4460dd5bd2c8", "score": "0.57294434", "text": "func (o *User) HasFullName() bool {\n\tif o != nil && o.FullName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "32be4a84a84bbfb56eca90fc8e88dee9", "score": "0.5727017", "text": "func (m *AddTokenSigningCertificatePostRequestBody) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "61850e9be18d8523760bfc08224f5c33", "score": "0.57241404", "text": "func (o *Tarefa) HasNomeUtilizador() bool {\n\tif o != nil && o.NomeUtilizador.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "052ebf55905d04cd04f533b40637cb0c", "score": "0.57017833", "text": "func has(input object, fieldName string) bool {\n\tfor _, field := range input.Fields {\n\t\tif field.Name == fieldName {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cc0dea943bf5c47f460f5e3ab63a3881", "score": "0.56975484", "text": "func (o *User) HasLastName() bool {\n\tif o != nil && o.LastName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8f7045086ff919411d976eefdefd3093", "score": "0.5693019", "text": "func (o *ViewIndustry) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f9745f3a1a7abc13e6fc628746bbb082", "score": "0.56818825", "text": "func (m *InsightIdentity) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "3536058f930f336aa4c97ad2a2caa807", "score": "0.56735665", "text": "func (m *TeamworkTag) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "25ff0ce30f75441bed71ec23d81aefe8", "score": "0.5662897", "text": "func (m *tileInfo) SetDisplayName(val string) {\n\tm.displayNameField = val\n}", "title": "" }, { "docid": "abc8cba9fbb2931b30c75d0915b2f02d", "score": "0.5661413", "text": "func (m *Tag) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "ba9720ec949ccf75d1dbd7e29dd7d9fc", "score": "0.56601554", "text": "func (user *User) DisplayName() string {\n\tif user.Name.Valid {\n\t\treturn user.Name.String\n\t}\n\tif user.Email.Valid {\n\t\treturn user.Email.String\n\t}\n\tif user.Phone.Valid {\n\t\treturn user.Phone.String\n\t}\n\tif user.DisplayNameOld != \"\" {\n\t\treturn user.DisplayNameOld\n\t}\n\treturn user.PublicID()\n}", "title": "" }, { "docid": "a768842d0aef806c318c2cbc55ef9822", "score": "0.56533974", "text": "func (m *GroupSettingTemplate) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "7ba38e75266b1a143de5e19bd702a011", "score": "0.5652815", "text": "func (o *MicrosoftGraphManagedDeviceMobileAppConfiguration) GetDisplayNameOk() (string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DisplayName, true\n}", "title": "" }, { "docid": "8d94850cbaa701ca96112ec9f97a2aec", "score": "0.564578", "text": "func (o *RegisterDetails) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d0a61c60d2bc6b537d321dbd32a93cd6", "score": "0.5641883", "text": "func (r *UserCreate) HasName() bool {\n\treturn r.hasName\n}", "title": "" }, { "docid": "24a1fbea7549e463a89cdd1376268d77", "score": "0.56394964", "text": "func (o *RequestLinkRowFieldUpdateField) HasName() bool {\n\tif o != nil && !IsNil(o.Name) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b785f63ebffec17e88836d101af8a7b3", "score": "0.56359315", "text": "func (o *HPAMetric) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "025a149e06061128bd08ed5db018ead5", "score": "0.5632925", "text": "func (o *Retro) HasBusinessName() bool {\n\tif o != nil && o.BusinessName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9f873280caef375012a78a34e203e4f4", "score": "0.56235754", "text": "func (o *ServerProperties) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "013d03bd2d34bd61107e7e21e1792c9a", "score": "0.56218785", "text": "func (o *InlineResponse2002People12345) HasFirstName() bool {\n\tif o != nil && o.FirstName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cbcff470ece0cc729adceb820a0a56f9", "score": "0.56174046", "text": "func (m *DirectoryRoleTemplate) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "b313c2267365afd6e60a58a0e87e4255", "score": "0.55983794", "text": "func (m *DeviceEnrollmentConfiguration) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "84d6c61c4c0cc46fc599a0edcac8a44f", "score": "0.5594467", "text": "func (o *DetailedSegmentEffort) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "50ec7c82f1198aa7e8e3d3cd4113a312", "score": "0.55942935", "text": "func (o *InlineResponse200105Reminders) HasUserLastname() bool {\n\tif o != nil && o.UserLastname != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c56592140df50605c646ca1b5c7a9f56", "score": "0.5577145", "text": "func (o *InlineResponse20023InvoiceLineItems) HasUserFirstName() bool {\n\tif o != nil && o.UserFirstName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c2df8a5d37ea9bfeeaa12cb3e488e127", "score": "0.55739135", "text": "func (m *RubricLevel) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "f844d804d4faeff2a90859c2c2f1c6a0", "score": "0.5562229", "text": "func (o *HyperflexHealthCheckDefinition) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c0f35a93e325fc2159c001f0a0860226", "score": "0.5561682", "text": "func (o *BranchingModelSettingsDevelopment) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d3fb32363bb602132e2fa66d55b3c120", "score": "0.5560789", "text": "func (m *TermsAndConditions) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7d30b6646e824d7a2ae8554fe5b0b922", "score": "0.5555063", "text": "func (o *ComponentSearchResultDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6f225b2349d12b4369822b2cd5b0ce97", "score": "0.555457", "text": "func (o *DataScalarColumn) HasName() bool {\n\treturn o != nil && o.Name != nil\n}", "title": "" }, { "docid": "a3f297bf1faf9b4b4d4cef170ddea352", "score": "0.55542827", "text": "func (o *ProcessorDTO) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5817547761e00231b4dca92236a7e387", "score": "0.55514765", "text": "func (o *RowComment) HasFirstName() bool {\n\tif o != nil && !IsNil(o.FirstName) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5ac00d336152a9e340e3cb711fdf87e3", "score": "0.5545789", "text": "func (o *ClusterAuthorizationRequest) GetDisplayName() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&128 != 0\n\tif ok {\n\t\tvalue = o.displayName\n\t}\n\treturn\n}", "title": "" }, { "docid": "7d3505e7d23d2717ac5d25b7b99a3c4c", "score": "0.5536458", "text": "func (o *StorageRemoteKeySettingAllOf) HasUsername() bool {\n\tif o != nil && o.Username != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "eedc0c5b74d770ddabded21deb2c4e2a", "score": "0.5517519", "text": "func (o *QuotaAuthorizationRequest) GetDisplayName() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&4 != 0\n\tif ok {\n\t\tvalue = o.displayName\n\t}\n\treturn\n}", "title": "" }, { "docid": "aecd11079e19e9233ce3742c187fc156", "score": "0.55154485", "text": "func (o *Flavor) HasName() bool {\n\tif o != nil && !IsNil(o.Name) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "70f6a25038b9c111b6da798a4e132a48", "score": "0.55067325", "text": "func Has(obj interface{}, fieldName string) (bool, error) {\n\tobjValue, err := getReflectValue(obj)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tstructType := objValue.Type()\n\t_, found := structType.FieldByName(fieldName)\n\treturn found, nil\n}", "title": "" }, { "docid": "c361f64b3c8e5675508eeb6eea73f316", "score": "0.5482472", "text": "func (o *AppMetaData) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1bbe7c308a093d1b2f38523a83c7bc50", "score": "0.54821473", "text": "func (o *MicrosoftGraphAndroidGeneralDeviceConfiguration) GetDisplayNameOk() (string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DisplayName, true\n}", "title": "" }, { "docid": "6f0f4257a8a62aa0765301d3192be530", "score": "0.54789275", "text": "func (o *MicrosoftGraphManagedDevice) HasDeviceCategoryDisplayName() bool {\n\tif o != nil && o.DeviceCategoryDisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dbb34397e9645a9d344086a0b8486861", "score": "0.54711884", "text": "func (m *Office365ActiveUserDetail) SetDisplayName(value *string)() {\n err := m.GetBackingStore().Set(\"displayName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d97ee57bcad943d3adf1d444c4fd8e93", "score": "0.54692644", "text": "func (o *AdditionalGroup) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2a708a0f7909402f290ccd230ba1bbb5", "score": "0.54644734", "text": "func (o *ManagedDeviceMobileAppConfigurationDeviceStatus) HasUserName() bool {\n\tif o != nil && o.UserName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e7d017aa692597f04a5a66ed6a490645", "score": "0.54638094", "text": "func (m *LinkedResource) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" }, { "docid": "64010af74788bff25e1916a278a336d0", "score": "0.54584956", "text": "func (o *DatabaseEditRequest) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5f31f06e7ea0d9ad04483d96c09d8529", "score": "0.5455423", "text": "func (o *EmbeddedUnitGroupModel) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "96bcf7af96ab5e19fbdbb7c3af65e3bc", "score": "0.5454796", "text": "func (o *Ga4ghPatient) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c18900ee7c23c2bb6a3a9150a5e88c7a", "score": "0.54547894", "text": "func (o *ForexSymbol) HasDisplaySymbol() bool {\n\tif o != nil && o.DisplaySymbol != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b40c32c34537cc683ed3cb9cc6db2c3", "score": "0.5452444", "text": "func (o *UserDetail) GetDisplayName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.DisplayName\n}", "title": "" }, { "docid": "46eb7ef7e689688fd6c47aaf5a660c8a", "score": "0.5445218", "text": "func (t *Translator) HasField(field string) bool {\n\t_, ok := t.fieldMap[field]\n\treturn ok\n}", "title": "" }, { "docid": "2ac4e22f066d503b5a6075e287de1006", "score": "0.54378736", "text": "func (o *Component) HasShowcase() bool {\n\tif o != nil && o.Showcase != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c10db01832f54d1a12ba34f2e3d271c6", "score": "0.5434962", "text": "func (o *MicrosoftGraphUserSecurityState) HasUserPrincipalName() bool {\n\tif o != nil && o.UserPrincipalName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a8584163ba039fb4dc831bb4adf85b13", "score": "0.5430531", "text": "func (o *CampaignAllOf) HasName() bool {\n\tif o != nil && o.Name != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "46e14af27cc0237b5f7815db3fe027bd", "score": "0.5426795", "text": "func (u *User) HasNickname(nick string) bool {\n\tfor _, v := range u.Nicknames {\n\t\tif strings.ToLower(v) == strings.ToLower(nick) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7393561497fc9814f558d63bd6765d12", "score": "0.54259175", "text": "func (m *TeamsApp) SetDisplayName(value *string)() {\n m.displayName = value\n}", "title": "" } ]
9f6686a871725e8b1bda0ab90c961cdb
UnmarshalJSON supports json.Unmarshaler interface
[ { "docid": "8369a69605880c0b3ae4681eb89a5806", "score": "0.0", "text": "func (v *StatsData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComKamaiuIbCpGoClientV1RestModel4(&r, v)\n\treturn r.Error()\n}", "title": "" } ]
[ { "docid": "3acff9f1c8654be1c2b1c74a467825bf", "score": "0.7153473", "text": "func unmarshalJSON(data []byte, v interface{}) error {\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "7db93200f4aeff50b12daa63b3463d6a", "score": "0.70875424", "text": "func JsonUnmarshal(b []byte, v interface{}) error {\n\treturn json.Unmarshal(b, v)\n}", "title": "" }, { "docid": "175df90d4ee9105d0c7c546f94464c45", "score": "0.7055901", "text": "func UnmarshalJSON(t *testing.T, raw []byte, dest interface{}) {\n\terr := json.Unmarshal(raw, dest)\n\tif err != nil {\n\t\tt.Fatalf(`unmarshaling: %s`, err)\n\t}\n}", "title": "" }, { "docid": "5f39b01fa986a7efa570b22f7dcb2be7", "score": "0.7047176", "text": "func (j *Postback) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "eb6d90a729dc868eea946b5f558fa0b5", "score": "0.6948608", "text": "func (j *jsonDeal) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "644c16583c5b9add761d5937b84fdb1d", "score": "0.6933722", "text": "func (j *Handtekening) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "3d7c2dcb58d44626b41d28899848ed87", "score": "0.6900426", "text": "func (j JSON) Unmarshal(b []byte, v interface{}) error {\n\treturn json.Unmarshal(b, v)\n}", "title": "" }, { "docid": "30dc0cb22099d68960966d6edfecc862", "score": "0.6865936", "text": "func (j *Sender) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "2fcef00000626a3f1b3a749c4a5e42c4", "score": "0.683438", "text": "func (j *Payload) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "8e0317f932759a9fed862aafbe4004cb", "score": "0.6828434", "text": "func (j *Example) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "803c752e82703b4d3813656a30cd2101", "score": "0.6745911", "text": "func (s *Suite) JSONUnmarshal(data []byte, v interface{}) {\n\ts.Require().NoError(json.Unmarshal(data, v))\n}", "title": "" }, { "docid": "3d997adc88569af3543f6370f3cde94d", "score": "0.6712358", "text": "func (j *Messaging) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "b94637058f4760f71af3bd80122c7504", "score": "0.666497", "text": "func (j *FBook) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "781af51e23837b7f94fd96bdf50f9768", "score": "0.6663884", "text": "func Unmarshal(j []byte, o interface{}, opts ...JSONOpt) error {\n\td := json.NewDecoder(bytes.NewReader(j))\n\tfor _, opt := range opts {\n\t\td = opt(d)\n\t}\n\treturn d.Decode(&o)\n}", "title": "" }, { "docid": "787b265c9adfc372e945cdeac78db4ec", "score": "0.66311216", "text": "func (j *Book) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "7eadb6b74535459e99b2ded3b6404068", "score": "0.66202", "text": "func (j *Entry) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "3591f29250250c85d91e038b1194c86e", "score": "0.6615772", "text": "func (um *jsonUnmarshaler) Unmarshal(data []byte, v interface{}) error {\n\td := json.NewDecoder(bytes.NewReader(data))\n\td.UseNumber()\n\treturn d.Decode(v)\n}", "title": "" }, { "docid": "9a53cf74e96baf7e06c5364538cd8722", "score": "0.6614574", "text": "func Unmarshal(data []byte, v Unmarshaler) error {\n\treturn UnmarshalCustom(data, v, \"json\")\n}", "title": "" }, { "docid": "f8ae8df9d1e267a514fa6be1c0d9912a", "score": "0.65862674", "text": "func (j *AssetFeedInfo) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "6c92e57ab6c1e68ec44339fb411734cf", "score": "0.6584423", "text": "func (j *ReceivedMessage) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "65ac1f5a16f3894dd429f1f91bed9e63", "score": "0.65824324", "text": "func UnmarshalJSON(b []byte) (dgo.Value, error) {\n\treturn internal.UnmarshalJSON(b)\n}", "title": "" }, { "docid": "d0ec5f126c3e81e56417822a0c306d88", "score": "0.65799326", "text": "func (j *Delivery) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "87011b3af441ed52f58632e7ae047052", "score": "0.6577624", "text": "func (j *JSON) UnmarshalJSON(b []byte) error {\n\treturn (*json.RawMessage)(j).UnmarshalJSON(b)\n}", "title": "" }, { "docid": "9c109bb2afd21cd31487c16fe2e58d89", "score": "0.6577189", "text": "func (j *SendMessage) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "111f415c9d0f3461d3ac699d7e6c1ed5", "score": "0.6575721", "text": "func (j *Actor) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "8e5778ea14653c6e7d2d95a2055a33ca", "score": "0.65462464", "text": "func (v *Payload) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson7c82d03DecodeLearbGoTestBaseStruct2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "e62a006a0331f46c98906fbb7ae0bdf7", "score": "0.6546126", "text": "func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {\n\t// bs := f.dd.DecodeStringAsBytes()\n\t// grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.\n\tfnerr := tm.UnmarshalJSON(f.d.nextValueBytes())\n\tif fnerr != nil {\n\t\tpanic(fnerr)\n\t}\n}", "title": "" }, { "docid": "2875039691c068171c598ca472de1a51", "score": "0.6533322", "text": "func (j *Message) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "21d281199301aad038b4940bb19cf726", "score": "0.65317947", "text": "func (j *Recipient) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "da91179ab6f6503ddf9c0ea6367752d3", "score": "0.6525003", "text": "func (j *jsonVideo) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "41eda51ccb2a4087476c34f40d8a0a9a", "score": "0.65083563", "text": "func JSONUnmarshal() {\n\tvar p1 NewPerson\n\tbs := []byte(`{\"First\":\"Harsh\",\"Last\":\"Maur\",\"Age\":21,\"Middle\":\"None\",\"wisdom score\":\"9899901974\"}`)\n\tjson.Unmarshal(bs, &p1)\n\tfmt.Println(p1)\n}", "title": "" }, { "docid": "e96a5207459acdcad0858f0e4fa36495", "score": "0.6506885", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tif m, ok := v.(json.Unmarshaler); ok {\n\t\treturn m.UnmarshalJSON(data)\n\t}\n\n\treturn jsonAdapter.Unmarshal(data, v)\n}", "title": "" }, { "docid": "61ade30869d23b4d6a34356ca234da5d", "score": "0.6483397", "text": "func (v *ResData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson7c82d03DecodeLearbGoTestBaseStruct(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "50b947b6e0680dc59e23f191cc53d9dc", "score": "0.6480259", "text": "func (s *Sink) UnmarshalJson(v interface{}) error {\n\treturn json.Unmarshal(s.b, v)\n}", "title": "" }, { "docid": "ad6b1694a8fc06bc9eaa6e32deee6ee8", "score": "0.6476649", "text": "func (v *Generic) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson692db02bDecodeGithubComMailgunMailgunGoEvents11(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ad6b1694a8fc06bc9eaa6e32deee6ee8", "score": "0.6476649", "text": "func (v *Generic) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson692db02bDecodeGithubComMailgunMailgunGoEvents11(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5e424e2bc1eca75eef02507a84ea9782", "score": "0.64670885", "text": "func (j *Pmp) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "232096ba0a31b7b4fa257ea13a5f3b5c", "score": "0.64616144", "text": "func (f *FeatureValidationResponseBase) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &f.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e3a1d874c0ed8c2f7d500dc06f48d0d", "score": "0.6458204", "text": "func (f *Feed) UnmarshalJSON(b []byte) error {\n\ttype t Feed // get rid of method UnmarshalJSON to avoid recursion\n\terr := json.Unmarshal(b, (*t)(f))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn validFeed(f)\n}", "title": "" }, { "docid": "e260368b09f2063d920d362a948a7988", "score": "0.6418536", "text": "func Unmarshal(resp *httptest.ResponseRecorder) (obj interface{}) {\n\tjson.Unmarshal(resp.Body.Bytes(), &obj)\n\treturn\n}", "title": "" }, { "docid": "02b18a9871871633a81d5e86300fa2e6", "score": "0.63962066", "text": "func (u *RelocationBatchResultData) UnmarshalJSON(b []byte) error {\n\ttype wrap struct {\n\t\t// Metadata : Metadata of the relocated object.\n\t\tMetadata json.RawMessage `json:\"metadata\"`\n\t}\n\tvar w wrap\n\tif err := json.Unmarshal(b, &w); err != nil {\n\t\treturn err\n\t}\n\tMetadata, err := IsMetadataFromJSON(w.Metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Metadata = Metadata\n\treturn nil\n}", "title": "" }, { "docid": "ddd35632bd78d2d98af9163cd3fa528a", "score": "0.6386786", "text": "func (j *Event) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "33491c70a4262fb136027b85dae2a30d", "score": "0.6382741", "text": "func (v *VisitContainer) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComUrakozzHighloadcampEntities1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "0adb0dcc7396943af93c9d8ee8b1c6da", "score": "0.63796014", "text": "func unmarshalJSON(data []byte, config interface{}, errorOnUnmatchedKeys bool) error {\n\treader := strings.NewReader(string(data))\n\tdecoder := json.NewDecoder(reader)\n\n\tif errorOnUnmatchedKeys {\n\t\tdecoder.DisallowUnknownFields()\n\t}\n\n\terr := decoder.Decode(config)\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f6a2c7afae7ee59242b8f523c45a31d", "score": "0.63687557", "text": "func (j *Attachment) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "8f8bd2744a25dab207618e1ac7046391", "score": "0.63619024", "text": "func unmarshal(v interface{}, data []byte, err error) error {\n\tif err != nil {\n\t\treturn err\n\t} else if v == nil {\n\t\treturn fmt.Errorf(\"this is a code bug: %w\", ErrNilInterface)\n\t} else if err = json.Unmarshal(data, v); err != nil {\n\t\treturn fmt.Errorf(\"json parse error: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "25ab983ac936bdbecb6076a6138ef3c0", "score": "0.63611954", "text": "func unmarshal(body *http.Response, target interface{}) error {\n\tdefer body.Body.Close()\n\treturn json.NewDecoder(body.Body).Decode(target)\n}", "title": "" }, { "docid": "8fc960336d720829ccbc973961e0ca5d", "score": "0.63609755", "text": "func decodeViaJSON(data interface{}, v interface{}) error {\n\t// Perform the task by simply marshalling the input into JSON,\n\t// then unmarshalling it into target native Go struct.\n\tb, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(b, v)\n}", "title": "" }, { "docid": "f1be607ac5b84a24091ec9b5762a53f8", "score": "0.63588774", "text": "func (v *Visit) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson794297d0DecodeGithubComSeralexeevHlcupGoApp3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "b27a51c75ec2afabf09f0feb3fbb9b75", "score": "0.63430864", "text": "func Unmarshal(data []byte, v interface{}) error {\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "2134040cfbb4128c2f15110bf42bbd42", "score": "0.6335457", "text": "func (firelens *FirelensResource) UnmarshalJSON(b []byte) error {\n\treturn errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "4f2df53eacb0d7feb87e6f23fe68d439", "score": "0.63330716", "text": "func (v *VisitResult) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson794297d0DecodeGithubComSeralexeevHlcupGoApp2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "8033a08eeee6aab4debdf55b7a7a27e4", "score": "0.63324064", "text": "func decodeJSON(s []byte) Paste {\n\tvar paste Paste\n\n\tif err := json.Unmarshal(s, &paste); err != nil {\n\t\tpanic(err)\n\t\tfmt.Printf(\"Hmm.. problem\")\n\t\tos.Exit(1)\n\t}\n\treturn paste\n}", "title": "" }, { "docid": "13b128c00ea1d59c8bc236b80ce54378", "score": "0.63281155", "text": "func Unmarshal(y []byte, o interface{}) error {\n\treturn json.Unmarshal(y, o)\n}", "title": "" }, { "docid": "045343d5bd07ed69636ec3a6949522d4", "score": "0.6325648", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tbuf, ok := bufs.Get(len(data))\n\tif ok {\n\t\tdefer bufs.Put(buf)\n\t}\n\tret := int(C.tm_json_parse(unsafe.Pointer(&data[0]), C.size_t((len(data))), unsafe.Pointer(&buf[0])))\n\n\tif ret == 0 {\n\t\treturn ErrBad\n\t}\n\treturn convertValue(buf, ret, v)\n}", "title": "" }, { "docid": "35d075d3ad2a79eb7cea49a39b5b4ea8", "score": "0.6323368", "text": "func (v *GotMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson85f0d656DecodeGameGame6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "b4b3ef123545ab2e6c8178638bf5f416", "score": "0.6317865", "text": "func (v *Visit) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComUrakozzHighloadcampEntities2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "091965afb790e8d4bf42e1de945b8f40", "score": "0.63158244", "text": "func (v *Response) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson9e1087fdDecodeAppConstructorBackendModel2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ac68bf6c5bda2eb350935a3cd953f81f", "score": "0.628937", "text": "func (t *Tag) UnmarshalJSON(b []byte) (err error) {\n\treturn json.Unmarshal(b, &t.name)\n}", "title": "" }, { "docid": "7ed69881fc5b302cfaf297d0aea97140", "score": "0.6287101", "text": "func Unmarshal(data []byte, v interface{}) error {\n\t// See https://github.com/json-iterator/go/blob/master/example_test.go#L69-L88\n\titer := jcf.BorrowIterator(data)\n\tdefer jcf.ReturnIterator(iter)\n\n\titer.ReadVal(v)\n\tif iter.Error != nil {\n\t\treturn errors.Wrap(iter.Error, \"jsonutil: unmarshal using jsoniter failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "351582136a4d80a5160b52bf4bc21777", "score": "0.6284506", "text": "func (this *Tracing) UnmarshalJSON(b []byte) error {\n\treturn ProxyUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "title": "" }, { "docid": "6f1348baecc0f4c7bb087f99d0cdd84f", "score": "0.6279838", "text": "func JSONUnmarshal(constructor coldcall.Constructor) coldcall.Producer {\n\treturn coldcall.Produce(constructor, json.Unmarshal)\n}", "title": "" }, { "docid": "536c73ba310cfa83e0fceb97d225e7c6", "score": "0.6271162", "text": "func (gjf *GenericJSONField) UnmarshalJSON(d []byte) error {\n\ttmp := make(map[string]interface{})\n\terr := json.Unmarshal(d, &tmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*gjf = tmp\n\treturn nil\n}", "title": "" }, { "docid": "cfa7ca90fcd0c6f40e4d5336567e72cc", "score": "0.6268386", "text": "func UnmarshalJSON(data []byte) (v Value, err error) {\n\tswitch ParseType(data) {\n\tcase TypeObject:\n\t\treturn unmarshalObject(data)\n\tcase TypeArray:\n\t\treturn unmarshalArray(data)\n\tcase TypeString:\n\t\ts := String(\"\")\n\t\tv = &s\n\tcase TypeInteger:\n\t\ti := Integer(0)\n\t\tv = &i\n\tcase TypeNumber:\n\t\tn := Number(0)\n\t\tv = &n\n\tcase TypeBoolean:\n\t\tb := Boolean(false)\n\t\tv = &b\n\tcase TypeNull:\n\t\tn := Null(true)\n\t\tv = &n\n\t}\n\n\terr = json.Unmarshal(data, v)\n\treturn\n}", "title": "" }, { "docid": "7fe6ac1a0015f7937a5816a82adf5a2b", "score": "0.6260537", "text": "func (j JSON) Unmarshal(data []byte, v interface{}) (err error) {\n\tv.(*Reply).res = data\n\treturn nil\n}", "title": "" }, { "docid": "fb6a82bc9d02318e049c16bc9a682e6f", "score": "0.6254329", "text": "func (j *CommiteeMember) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "ad5616636a4845afab058128604c6ced", "score": "0.62503815", "text": "func UnmarshalJSON(s string, t interface{}) error {\n\tif len(s) == 0 {\n\t\treturn errors.New(\"Cannot unmarshal empty string\")\n\t}\n\n\tif t == nil {\n\t\treturn errors.New(\"UnmarshalJSON needs a non-nil interface to unmarshal into\")\n\t}\n\n\terr := json.Unmarshal([]byte(s), &t)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Could not unmarshal string %v\", s)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1a8923d5be75db36ad116b2e2bb5cc2f", "score": "0.6244708", "text": "func unmarshalJSON(i *big.Int, bz []byte) error {\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn i.UnmarshalText([]byte(text))\n}", "title": "" }, { "docid": "0e466f744c0eda1cfc0eb73f700b4f63", "score": "0.6241709", "text": "func JsonDecode(json []byte, v interface{}) error {\n\tvar parser = jsoniter.ConfigCompatibleWithStandardLibrary\n\n\treturn parser.Unmarshal(json, v)\n}", "title": "" }, { "docid": "0b810e14bec9079a07c691dfaf39199d", "score": "0.62375957", "text": "func (u *DeleteBatchResultData) UnmarshalJSON(b []byte) error {\n\ttype wrap struct {\n\t\t// Metadata : Metadata of the deleted object.\n\t\tMetadata json.RawMessage `json:\"metadata\"`\n\t}\n\tvar w wrap\n\tif err := json.Unmarshal(b, &w); err != nil {\n\t\treturn err\n\t}\n\tMetadata, err := IsMetadataFromJSON(w.Metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Metadata = Metadata\n\treturn nil\n}", "title": "" }, { "docid": "fa7df26be6c7458978f1deb2e163ef5f", "score": "0.6235312", "text": "func (j *MythicJSONText) Unmarshal(v interface{}) error {\n\tif len(*j) == 0 {\n\t\t*j = emptyJSON\n\t}\n\treturn json.Unmarshal([]byte(*j), v)\n}", "title": "" }, { "docid": "838956acdd2332cd51f1c9e6d25f1fc0", "score": "0.62220186", "text": "func Unmarshal(r io.Reader, result interface{}) error {\n\treturn json.NewDecoder(r).Decode(&result)\n}", "title": "" }, { "docid": "cbe715a47d087565a60564075495be52", "score": "0.62219065", "text": "func (j *Json) UnmarshalJSON(p []byte) error {\n\tdec := json.NewDecoder(bytes.NewBuffer(p))\n\tdec.UseNumber()\n\treturn dec.Decode(&j.data)\n}", "title": "" }, { "docid": "7777ba38ecd14090f1670244b1bffc91", "score": "0.62208325", "text": "func (v *additionalDataStringInterface) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD7b6309cDecodeGoLog1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "d3a79e2d3c1f2d3e997a01fde76d50a5", "score": "0.621095", "text": "func (c *JSONCodec) Unmarshal(data []byte, v interface{}) error {\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "069dd83d714d6d4de5cacd577a1249bc", "score": "0.6209577", "text": "func jsonDecode(src []byte, obj interface{}) error {\n\tdec := json.NewDecoder(bytes.NewReader(src))\n\tdec.UseNumber()\n\terr := dec.Decode(&obj)\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8f38ae84a25fe17b6beaa283083bfef", "score": "0.6206029", "text": "func (f *StateEx) UnmarshalJSON(buffer []byte) error {\n var result byte\n err := fbe.Json.Unmarshal(buffer, &result)\n if err != nil {\n return err\n }\n *f = StateEx(result)\n return nil\n}", "title": "" }, { "docid": "2d24675a990f7fd986e1dcf6f3fc6908", "score": "0.6205984", "text": "func (m *RawMessage) UnmarshalJSON(data []byte) error", "title": "" }, { "docid": "2a44b61f970e7547c8a064c5c73af056", "score": "0.6196754", "text": "func (c *EncryptedCompressedJSON) Unmarshal(data []byte, s interface{}) error {\n\t// convert base64 string value to bytes\n\tciphertext, err := base64.RawURLEncoding.DecodeString(string(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\t// decrypt the bytes\n\tcompressed, err := cryptutil.Decrypt(c.aead, ciphertext, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// decompress the unencrypted bytes\n\tplaintext, err := decompress(compressed)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// unmarshal the unencrypted bytes\n\terr = json.Unmarshal(plaintext, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "908332abd1a5c9f7a2a69bad35dc8e09", "score": "0.61950606", "text": "func (j *Record) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "5c9f5ab91f5d2ed33642e2b4fb00ee71", "score": "0.6191216", "text": "func (i *target) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"target should be a string, got %s\", data)\n\t}\n\n\tvar err error\n\t*i, err = targetString(s)\n\treturn err\n}", "title": "" }, { "docid": "a1664c80a7d48846002635e585003960", "score": "0.6187681", "text": "func (u *MetadataV2) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t\t// Metadata : has no documentation (yet)\n\t\tMetadata json.RawMessage `json:\"metadata,omitempty\"`\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"metadata\":\n\t\tif u.Metadata, err = IsMetadataFromJSON(w.Metadata); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1735ea1c726d8bfd7f0fbce752268fc6", "score": "0.6186657", "text": "func (compositionservice *CompositionService) UnmarshalJSON(b []byte) error {\n\ttype temp CompositionService\n\tvar t struct {\n\t\ttemp\n\t\tResourceBlocks common.Link\n\t\tResourceZones common.Link\n\t}\n\n\terr := json.Unmarshal(b, &t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Extract the links to other entities for later\n\t*compositionservice = CompositionService(t.temp)\n\tcompositionservice.resourceBlocks = t.ResourceBlocks.String()\n\tcompositionservice.resourceZones = t.ResourceZones.String()\n\n\t// This is a read/write object, so we need to save the raw object data for later\n\tcompositionservice.rawData = b\n\n\treturn nil\n}", "title": "" }, { "docid": "fcd7064f9697cf6f1dc42520c9755b70", "score": "0.6186232", "text": "func (v *PostInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeDataBaseModels3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "057391e723b26a99431454270f6426ee", "score": "0.6184496", "text": "func (v *Any) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComKamaiuIbCpGoClientV1RestModel19(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "93cc1cb329e83d7e4f5bcc2ebe92d108", "score": "0.6182548", "text": "func (v *person) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson89aae3efDecodeOcContestGoServerP31(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "b9bcf98b56ee53f48b19f0beb98fe8fa", "score": "0.6181014", "text": "func (u *Tag) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"user_generated_tag\":\n\t\tif err = json.Unmarshal(body, &u.UserGeneratedTag); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aca65a0e2a84b5f3de36cf08cdb87745", "score": "0.6163658", "text": "func fromJSON(output interface{}, jsonMessage []byte) error {\n\tdecoder := json.NewDecoder(strings.NewReader(string(jsonMessage)))\n\tdecoder.UseNumber()\n\tlog.Debugf(\"Decoding into output %T ...\", output)\n\terr := decoder.Decode(&output)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c8cb4120dbcaaf0562e511e42d127ac", "score": "0.61598366", "text": "func (v *Student1) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6fdb3c5bDecodeGithubComPubgoBenchEncode(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3eff4dcae4c5985d391614d04b02774c", "score": "0.61589205", "text": "func (v *Post) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeDataBaseModels4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "e3c98aa00ba4d96decafc36fbf77b9fe", "score": "0.61566794", "text": "func (ai *AdditionalItems) UnmarshalJSON(data []byte) error {\n\tsch := &Schema{}\n\tif err := json.Unmarshal(data, sch); err != nil {\n\t\treturn err\n\t}\n\t*ai = (AdditionalItems)(*sch)\n\treturn nil\n}", "title": "" }, { "docid": "0ae782e50736ff598b33c4fd41c13b83", "score": "0.61499244", "text": "func (j *JSONInput) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &j.ID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed6cda71b2f8c18be1d54a11c48df58a", "score": "0.614657", "text": "func JSONDecoder(r io.Reader, c *ResponseContext) error {\n\tvar target map[string]interface{}\n\tdecoder := json.NewDecoder(r)\n\tdecoder.UseNumber()\n\tif err := decoder.Decode(&target); err != nil {\n\t\treturn err\n\t}\n\tc.Data = target\n\treturn nil\n}", "title": "" }, { "docid": "5a35c50c1860244c78ec7a897b8cfa63", "score": "0.61338013", "text": "func (v *Item) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6afd136DecodeCourseraWeek3PerfEasyjsontut1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "de2c1f6429fe6670fca95d3fbf568aa5", "score": "0.61326426", "text": "func UnmarshallJson(b []byte, m *sysl.Module) error {\n\tif m == nil {\n\t\treturn fmt.Errorf(\"module is nil\")\n\t}\n\tma := protojson.UnmarshalOptions{}\n\terr := ma.Unmarshal(b, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5b29d20806d0f79c5d184eacd0475584", "score": "0.61299264", "text": "func (e *Encoding) UnmarshalJSON(b []byte) error {\n\tvar encString string\n\terr := json.Unmarshal(b, &encString)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*e, err = ParseEncoding(encString)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ed7eecfe279190117a1897426d58bc48", "score": "0.6124901", "text": "func JSONToUnstructured(stub, namespace string, mapping *meta.RESTMapping, dynamicClient dynamic.Interface) (dynamic.ResourceInterface, *unstructured.Unstructured, error) {\n\ttypeMetaAdder := map[string]interface{}{}\n\tif err := json.Unmarshal([]byte(stub), &typeMetaAdder); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// we don't require GVK on the data we provide, so we fill it in here. We could, but that seems extraneous.\n\ttypeMetaAdder[\"apiVersion\"] = mapping.GroupVersionKind.GroupVersion().String()\n\ttypeMetaAdder[\"kind\"] = mapping.GroupVersionKind.Kind\n\n\tif mapping.Scope == meta.RESTScopeRoot {\n\t\tnamespace = \"\"\n\t}\n\n\treturn dynamicClient.Resource(mapping.Resource).Namespace(namespace), &unstructured.Unstructured{Object: typeMetaAdder}, nil\n}", "title": "" }, { "docid": "2e17a702afb16c614357949d23f91a19", "score": "0.61191374", "text": "func (w *JSONBWrapper) UnmarshalJSON(b []byte) error {\n\tif w.inner == nil {\n\t\ttmp := make(GenericJSONField)\n\t\tw.inner = &tmp\n\t}\n\treturn json.Unmarshal(b, w.inner)\n}", "title": "" }, { "docid": "cc5b6a34871ed74455c8b3250e25c043", "score": "0.6116958", "text": "func (data *Data) unmarshal(buf []byte) error {\n\tvar js DataJson\n\terr := json.Unmarshal(buf, &js)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata.MetaNodes = js.MetaNodes\n\tdata.DataNodes = js.DataNodes\n\tdata.MaxNodeID = js.MaxNodeID\n\treturn data.Data.UnmarshalBinary(js.Data)\n}", "title": "" }, { "docid": "2ad9be4efb1aa4d34fb8fd14bd4684fb", "score": "0.6112589", "text": "func SetJSONUnmarshal(fn JSONUnmarshal) {\n\tjsonUnmarshal = fn\n}", "title": "" }, { "docid": "448844d432880648cef27860bff127b2", "score": "0.6112198", "text": "func (v *Tickle_POST_200) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComKamaiuIbCpGoClientV1RestModelTicklePOST(&r, v)\n\treturn r.Error()\n}", "title": "" } ]
a65671950d03875ca7974ac7aec09c10
Supplementary function to check a if an identifier has only legal terminal symbol letters and/or digits
[ { "docid": "946787d1018938312f326c75ed270e74", "score": "0.7314341", "text": "func identifierCheck(identifier string, outputFile *os.File) bool {\n\tcharIndex := 0\n\tsuccess := true\n\tfor charIndex < len(identifier) {\n\t\tif !((strings.Contains(letter, string(identifier[charIndex]))) ||\n\t\t(strings.Contains(digit, string(identifier[charIndex])))) {\n\t\t\tsuccess = false\n\t\t}\n\t\tcharIndex++\n\t}\n\t// Report lexical error in output file with failed lexeme\n\tif !(success) {\n\t\tfmt.Fprintf(outputFile, (\"Lexical Error, unrecognized symbol \"+\n\t\t\tidentifier+\"\\n\"))\n\t}\n\treturn success\n}", "title": "" } ]
[ { "docid": "61f65fc64ac4626120f271aded218427", "score": "0.7711665", "text": "func identifierValidRuneFunc(r rune, idLen int) bool {\n if idLen == 0 {\n return r == '_' || r == '#' || unicode.IsLetter(r)\n } else if r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) {\n return true\n }\n return false\n}", "title": "" }, { "docid": "f465ee7a3a137ae0ca4b430511b7cd0d", "score": "0.750565", "text": "func isValidIdent(r rune) bool {\n\treturn unicode.IsDigit(r) || unicode.IsLetter(r) || r == '_'\n}", "title": "" }, { "docid": "397e2b39be61dc6739e30fc0d672bd08", "score": "0.7484703", "text": "func isValidIdentifierChar(r rune) bool {\n\treturn ((r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || (r == '_'))\n}", "title": "" }, { "docid": "5bd75f985cbf4a2944d6fe5ba71dec43", "score": "0.7388556", "text": "func isIdentChar(ch rune) bool { return isLetter(ch) || isDigit(ch) || ch == '_' }", "title": "" }, { "docid": "04590caf485f62f14bbbfb97ff4d189b", "score": "0.7142134", "text": "func isIdentifierChar(ch rune) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch) ||\n\t\t'0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch)\n}", "title": "" }, { "docid": "48fd5535b7000cbce972fdcf8ea6b910", "score": "0.70572543", "text": "func isIdentifier(ch rune) bool {\n\n\tif unicode.IsLetter(ch) || unicode.IsDigit(ch) || ch == '.' || ch == '?' || ch == '$' || ch == '_' {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bbf7da3a951806f7d400d7a7ea542c65", "score": "0.7024599", "text": "func IsValidIdentifierRune(r rune) bool {\n\treturn unicode.IsLetter(r) || unicode.IsDigit(r) || r == '-' || r == '_'\n}", "title": "" }, { "docid": "cc3e80fc3df176b7e954050687a5914d", "score": "0.6992403", "text": "func isNotLetterOrUnderscore(symbol int32) bool {\n\treturn symbol < 65 || (symbol != 95 && symbol > 90 && symbol < 97) || symbol > 122\n}", "title": "" }, { "docid": "99e395400fe10b7c03c2bba94d5f6388", "score": "0.6987976", "text": "func ValidIdentifier(n string) error {\n\tr := []rune(n)\n\trlen := len(r)\n\tif rlen < 1 {\n\t\treturn text.ErrInvalidIdentifier\n\t}\n\tfor i := 0; i < rlen; i++ {\n\t\tif c := r[i]; c != '_' && !unicode.IsLetter(c) && !unicode.IsNumber(c) {\n\t\t\treturn text.ErrInvalidIdentifier\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54e57c34254b78a814b8c6c77ea7bc99", "score": "0.68410045", "text": "func isValidIdentifier(id string) bool {\n\tif id == \"\" || id == \"root\" {\n\t\treturn false // Reserved.\n\t}\n\treturn strings.IndexFunc(id, func(r rune) bool {\n\t\treturn !isValidIdentifierChar(r)\n\t}) == -1\n}", "title": "" }, { "docid": "d955b754aca2bbfd720f0d180474753d", "score": "0.6782094", "text": "func isIdentFirstChar(ch rune) bool { return isLetter(ch) || ch == '_' }", "title": "" }, { "docid": "8858255c1afdf5c6c934a868584c82d3", "score": "0.67266095", "text": "func IsIdent( r rune ) bool {\n return r=='=' || r=='<' || r=='>' ||\n r=='^' || r=='&' ||\n r=='%' || r=='!' ||\n r==':' || r==';'\n}", "title": "" }, { "docid": "33f3b59a0196546c75ab6cfd472013c0", "score": "0.66687095", "text": "func IsIdentifier(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tfor _, ch := range s {\n\t\tif ch != '_' && !unicode.IsLetter(ch) && !unicode.IsDigit(ch) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "fc7bc5b7fbaab60f6d918e67c871de0c", "score": "0.6667273", "text": "func IsValidIdentifier(idstr string) bool {\n\tif idstr[0] == '_' || ('a' <= idstr[0] && idstr[0] <= 'z') || ('A' <= idstr[0] && idstr[0] <= 'Z') {\n\t\tfor _, c := range idstr[1:] {\n\t\t\tif c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f433ca91bbb4685e28198aa957f00b4b", "score": "0.66337734", "text": "func IsValidIdentifierStartRune(r rune) bool {\n\treturn unicode.IsLetter(r) || r == '_'\n}", "title": "" }, { "docid": "d48d9e74b9293cfcf3a30ad1aecb1993", "score": "0.65799135", "text": "func IsValidCss3Identifier(val string) bool {\n\n\tif len(val) == 0 {\n\t\treturn false\n\t}\n\n\tvar first, second rune\n\tvar wasSlash, inEscape bool\n\tvar hexCount int\n\n\tfor i, char := range val {\n\t\tif i == 0 {\n\t\t\tfirst = char\n\t\t\t// \"they cannot start with a digit\" TODO Alternative Unicode digits?\n\t\t\tif first >= '0' && first <= '9' {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tif i == 1 {\n\t\t\tsecond = char\n\n\t\t\t// \"they cannot start with ... two hyphens, or a hyphen followed by\n\t\t\t// a digit.\"\n\t\t\tif first == '-' {\n\t\t\t\tif second == '-' || (second >= '0' && second <= '9') {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif hexCount > 6 {\n\t\t\tinEscape = false\n\t\t}\n\n\t\t// \"can contain ... ISO 10646 characters U+00A0 and higher\"\n\n\t\tif char >= '\\u00A0' {\n\t\t\tinEscape = false\n\t\t\twasSlash = false\n\t\t\tcontinue\n\t\t}\n\n\t\t// \"can contain ... the hyphen and the underscore\"\n\n\t\tif char == '-' || char == '_' {\n\t\t\tinEscape = false\n\t\t\twasSlash = false\n\t\t\tcontinue\n\t\t}\n\n\t\t// \"can contain ... the characters [a-zA-Z0-9]\"\n\n\t\tif char >= 'a' && char <= 'z' {\n\t\t\twasSlash = false\n\t\t\tif char > 'f' {\n\t\t\t\tinEscape = false\n\t\t\t} else {\n\t\t\t\thexCount++\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// \"can contain ... the characters [a-zA-Z0-9]\"\n\n\t\tif char >= 'A' && char <= 'Z' {\n\t\t\twasSlash = false\n\t\t\tif char > 'F' {\n\t\t\t\tinEscape = false\n\t\t\t} else {\n\t\t\t\thexCount++\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// \"can contain ... the characters [a-zA-Z0-9]\"\n\n\t\tif char >= '0' && char <= '9' {\n\t\t\twasSlash = false\n\t\t\thexCount++\n\t\t\tcontinue\n\t\t}\n\n\t\t// \"backslash escapes allow authors to refer to characters they cannot\n\t\t// easily put in a document\"\n\n\t\tif char == '\\\\' {\n\t\t\thexCount = 0\n\t\t\twasSlash = true\n\t\t\tinEscape = true\n\t\t\tcontinue\n\t\t}\n\n\t\t// \"the backslash is followed by at most six hexadecimal digits\"\n\t\t//\n\t\t// \"If a character in the range [0-9a-fA-F] follows the hexadecimal\n\t\t// number, the end of the number needs to be made clear ... with a space\n\t\t// (or other white space character) ... [or] by providing exactly 6\n\t\t// hexadecimal digits\".\n\n\t\tif inEscape && (char == '\\u0020' || char == '\\u0009' || char == '\\u000A' || char == '\\u000D' || char == '\\u000C') {\n\t\t\tinEscape = false\n\t\t\twasSlash = false\n\t\t\tcontinue\n\t\t}\n\n\t\tif wasSlash {\n\t\t\twasSlash = false\n\t\t\tinEscape = false\n\t\t\tcontinue\n\t\t}\n\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c132dbf976776dd33c9ccf9afb1962a4", "score": "0.65786994", "text": "func ValidIdentifier(s string) bool {\n\t// This is a kinda-expensive way to do something pretty simple, but it\n\t// is easiest to do with our existing scanner-related infrastructure here\n\t// and nobody should be validating identifiers in a tight loop.\n\ttokens := scanTokens([]byte(s), \"\", hcl.Pos{}, scanIdentOnly)\n\treturn len(tokens) == 2 && tokens[0].Type == TokenIdent && tokens[1].Type == TokenEOF\n}", "title": "" }, { "docid": "c0455fc5e3fc6e0ab9bafdf21b2b59a4", "score": "0.6539923", "text": "func isalnum(c byte) bool {\n\treturn (c >= '0' && c <= '9') || isletter(c)\n}", "title": "" }, { "docid": "024f37d3ba8efe10fd5e08e8f303a972", "score": "0.64520895", "text": "func isValidKprobeSymbol(s string) bool {\n\tif len(s) < 1 {\n\t\treturn false\n\t}\n\n\tfor i, c := range []byte(s) {\n\t\tswitch {\n\t\tcase c >= 'a' && c <= 'z':\n\t\tcase c >= 'A' && c <= 'Z':\n\t\tcase c == '_':\n\t\tcase i > 0 && c >= '0' && c <= '9':\n\n\t\t// Allow `.` in symbol name. GCC-compiled kernel may change symbol name\n\t\t// to have a `.isra.$n` suffix, like `udp_send_skb.isra.52`.\n\t\t// See: https://gcc.gnu.org/gcc-10/changes.html\n\t\tcase i > 0 && c == '.':\n\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ad5b84f658a5d5196eda5c54736e5b41", "score": "0.63740164", "text": "func IsValid(id string) bool {\n\tfor i, c := range id {\n\t\tif !unicode.IsLetter(c) && c != '_' && (i == 0 || !unicode.IsDigit(c)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn id != \"\"\n}", "title": "" }, { "docid": "9d4e1cc2eb0ced0f0956df54bf8c313e", "score": "0.6360752", "text": "func isJSIdentPart(r rune) bool {\n\tswitch {\n\tcase r == '$':\n\t\treturn true\n\tcase '0' <= r && r <= '9':\n\t\treturn true\n\tcase 'A' <= r && r <= 'Z':\n\t\treturn true\n\tcase r == '_':\n\t\treturn true\n\tcase 'a' <= r && r <= 'z':\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e16017ae22809c445f19f8c35b404c04", "score": "0.62870324", "text": "func isValidShellVariableName(s string) bool {\n\tfor i := 0; i < len(s); i++ {\n\t\tb := s[i]\n\t\tswitch {\n\t\tcase (b >= 'A' && b <= 'Z'): // ok\n\t\tcase (b >= 'a' && b <= 'z'): // ok\n\t\tcase (b >= '0' && b <= '9'): // ok\n\t\tcase b == '_': // ok\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\treturn len(s) > 0\n}", "title": "" }, { "docid": "b87b0f5ff4623235c9bf972987e07b1f", "score": "0.6278142", "text": "func Valid(r rune) bool {\n\tunicode.IsLetter(r) || unicode.IsNumber(r)\n}", "title": "" }, { "docid": "85771336fff19de7e5d092373959ea08", "score": "0.6239656", "text": "func scanSymbol(cur *utfstrings.Cursor) bool {\n\trunes := []rune{}\n\tfor {\n\t\tru := cur.Next()\n\t\tif ru == utfstrings.EOS {\n\t\t\tbreak\n\t\t} else if isSepratingChar(ru) {\n\t\t\tcur.Backup()\n\t\t\tbreak\n\t\t} else if !utf8.ValidRune(ru) {\n\t\t\treturn false\n\t\t}\n\t\trunes = append(runes, ru)\n\t}\n\n\tif unicode.IsDigit(runes[0]) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "5dc0be1b9930264ea5cf123f08773c0c", "score": "0.62330616", "text": "func isAlphaNumeric(ch byte) bool {\n\treturn isLetter(ch) || ('0' <= ch && ch <= '9') || (ch == '_')\n}", "title": "" }, { "docid": "d621dc14a2f802f40c2f9f67a6ae28b6", "score": "0.6229801", "text": "func checkIdentifier(i string) string {\n\tnn, reserved := goEquivTypes[i]\n\tif reserved {\n\t\treturn nn\n\t}\n\treturn i\n}", "title": "" }, { "docid": "d621dc14a2f802f40c2f9f67a6ae28b6", "score": "0.6229801", "text": "func checkIdentifier(i string) string {\n\tnn, reserved := goEquivTypes[i]\n\tif reserved {\n\t\treturn nn\n\t}\n\treturn i\n}", "title": "" }, { "docid": "cb8c9b75618b26d6b677b8a973e2f7c9", "score": "0.6225681", "text": "func isAlNum(c uint8) bool {\n\treturn c >= 'a' && c <= 'z' || c >= '0' && c <= '9'\n}", "title": "" }, { "docid": "256a66209a08550a100ef07952e38ebb", "score": "0.62187713", "text": "func isNameChar(r rune) bool {\n\tif !unicode.IsLetter(r) && !unicode.IsPunct(r) && !unicode.IsSpace(r) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0056477ef1c33016fbab3a530d74dd84", "score": "0.6200204", "text": "func Invalid(str string) bool {\n\tfor _, char := range str {\n\n\t\t//if it's *, or not a valid ASCII character, it isn't allowed\n\t\tif char > 126 || char == 42 || char < 32 {\n\t\t\treturn true\n\t\t}\n\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8cebe0124c0a3c7f1661007addfe387a", "score": "0.6186433", "text": "func isShellSpecialVar(c uint8) bool {\n\tswitch c {\n\tcase '*', '#', '$', '@', '!', '?', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "229624c74f24e67f103edbc2c4489867", "score": "0.61681324", "text": "func validKeyRune(r rune) error {\n\tif unicode.IsLetter(r) || unicode.IsNumber(r) || r == '-' || r == '_' || r == '.' {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"invalid character in variable key: %s\", string(r))\n}", "title": "" }, { "docid": "3ce9845e3f9ef7e174c2a25a88f36477", "score": "0.61219645", "text": "func (id Identifier) Validate() (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"invalid identifier '%s': %w\", id, err)\n\t\t}\n\t}()\n\tif len(id) == 0 {\n\t\treturn fmt.Errorf(\"zero-length\")\n\t}\n\tif len(id) > maxIdentifierLength {\n\t\treturn fmt.Errorf(\"length %v exceeds max length %v\", len(id), maxIdentifierLength)\n\t}\n\tfor i, r := range id {\n\t\tif i == 0 && r != '_' && !identifiers.IsAlphaChar(r) { // first char\n\t\t\treturn fmt.Errorf(\"invalid first char: '%v'\", r)\n\t\t} else if i > 0 && r != '_' && !identifiers.IsAlphaChar(r) && !identifiers.IsNumChar(r) {\n\t\t\treturn fmt.Errorf(\"invalid char: '%v'\", r)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f6a709da671519263e449e60d8153eb", "score": "0.6083241", "text": "func IsIdentifierName(tt TokenType) bool {\n\treturn tt&0x1800 != 0\n}", "title": "" }, { "docid": "439c4d043ec7e257a09d9a6c21afe87d", "score": "0.60634345", "text": "func IsIdentifier(tt TokenType) bool {\n\treturn tt&0x1000 != 0\n}", "title": "" }, { "docid": "7c4cb77a3e6e78b19119500a295fb856", "score": "0.6056106", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || r == '-' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.60546064", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.60546064", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.60546064", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.60546064", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.60546064", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.60546064", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "7e366e5e628d2cb6aa7fbab6109c9aec", "score": "0.6042884", "text": "func shouldEscape(c byte) bool {\n\t// §2.3 Unreserved characters (alphanum)\n\tif 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' {\n\t\treturn false\n\t}\n\tswitch c {\n\tcase '-', '_', '.', '~': // §2.3 Unreserved characters (mark)\n\t\treturn false\n\t}\n\t// Everything else must be escaped.\n\treturn true\n}", "title": "" }, { "docid": "0ba6e731a9f5d074347406ba1e581382", "score": "0.6035763", "text": "func validName(name string) bool {\n\tconst allowed = \"abcdefghijklmnopqrstuvwxyz1234567890 \"\n\tif len(name) <= 0 {\n\t\treturn false\n\t}\n\tfor _, char := range name {\n\t\tif !strings.Contains(allowed, strings.ToLower(string(char))) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d1d46dab6da9c7b0d32860b26d8a0973", "score": "0.60349363", "text": "func sanitizeIdentifier(token string) (identfier string) {\n\t// First, replace all the spaces and dots with underscores.\n\tforbiddenUnderscore := regexp.MustCompile(\"[\\\\./, ]\")\n\ttoken = forbiddenUnderscore.ReplaceAllString(token, \"_\")\n\n\t// Then, remove known invalid characters.\n\tforbiddenStrip := regexp.MustCompile(`[\\\\(\\\\)\\\\?]`)\n\ttoken = forbiddenStrip.ReplaceAllString(token, \"\")\n\n\treturn token\n}", "title": "" }, { "docid": "3cb1efb1e17abf54a206c20c11626058", "score": "0.6010791", "text": "func SanitizeACIdentifier(s string) (string, error) {\n\ts = strings.ToLower(s)\n\ts = invalidACIdentifierChars.ReplaceAllString(s, \"_\")\n\ts = invalidACIdentifierEdges.ReplaceAllString(s, \"\")\n\n\tif s == \"\" {\n\t\treturn \"\", errors.New(\"must contain at least one valid character\")\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "3de04a1d0d1933d2ee3915c0416b1ff8", "score": "0.5991164", "text": "func IsShellSpecialVar(c uint8) bool {\n\tswitch c {\n\tcase '*', '#', '$', '@', '!', '?', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5430f0b4c290055e6b59c390bb088072", "score": "0.5977486", "text": "func isAlphanum(r rune) bool {\n\treturn r == '_' || r == '.' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "abd5924a8b62f9a39eac24e2db1f3fc8", "score": "0.59751636", "text": "func OnlyEngCharacters(someString string) bool {\n\tvar valid = regexp.MustCompile(`^[a-zA-Z]+$`)\n\treturn valid.MatchString(someString)\n}", "title": "" }, { "docid": "4a6e4c711125d352d3b85e7a25264048", "score": "0.5971805", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) || r == '.'\n}", "title": "" }, { "docid": "31917a02c5baa038257ec3890a51d23b", "score": "0.59661806", "text": "func isOnlyChars(txt string, valid string) bool {\n\tfor _, x := range txt {\n\t\tb := false\n\t\tfor _, y := range valid {\n\t\t\tif x == y {\n\t\t\t\tb = true\n\t\t\t}\n\t\t}\n\t\tif !b {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e2615579b9122f45e374d7ee90b58ea7", "score": "0.59626025", "text": "func isLetterOrDigit(c byte) bool {\n\treturn isUpper(c) || isLower(c) || isDigit(c)\n}", "title": "" }, { "docid": "eab6f159029b21a5d376b7a6fb6c72cd", "score": "0.59611803", "text": "func containsIllegal(line string) bool {\n\t// if the word contains non alphabetical characters, then ignore it\n\treg, err := regexp.Compile(\"[^a-zA-Z[:space:]-]+\")\n\tif err != nil {\n\t\treturn true\n\t}\n\n\tpw := reg.FindAllIndex([]byte(line), -1)\n\tif pw != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.5928728", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.5928728", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.5928728", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.5928728", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.5928728", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "c3ecde8b13555503838325594996fc6d", "score": "0.5928728", "text": "func isLetter(ch byte) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "9ab2ab33ef6e235d738fdb45fb0fb9bf", "score": "0.5921133", "text": "func goodName(name string) bool {\n\tif name == \"\" {\n\t\treturn false\n\t}\n\tfor i, r := range name {\n\t\tswitch {\n\t\tcase r == '_':\n\t\tcase i == 0 && !unicode.IsLetter(r):\n\t\t\treturn false\n\t\tcase !unicode.IsLetter(r) && !unicode.IsDigit(r):\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9ab2ab33ef6e235d738fdb45fb0fb9bf", "score": "0.5921133", "text": "func goodName(name string) bool {\n\tif name == \"\" {\n\t\treturn false\n\t}\n\tfor i, r := range name {\n\t\tswitch {\n\t\tcase r == '_':\n\t\tcase i == 0 && !unicode.IsLetter(r):\n\t\t\treturn false\n\t\tcase !unicode.IsLetter(r) && !unicode.IsDigit(r):\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "961168564e9ef77a704d7f835780243d", "score": "0.5908949", "text": "func istchar(b byte) bool {\n\t// DIGIT / ALPHA\n\tif '0' <= b && b <= '9' || 'a' <= b && b <= 'z' || 'A' <= b && b <= 'Z' {\n\t\treturn true\n\t}\n\n\tswitch b {\n\t// the set of symbols allowed\n\tcase '!', '#', '$', '%', '&', '\\'', '*', '+', '-', '.', '^', '_', '`', '|', '~':\n\t\treturn true\n\t}\n\n\t// otherwise, just verify that it is visible\n\treturn isvchar(b) && !isdelim(b)\n}", "title": "" }, { "docid": "4a6e9bd61e8f207875a5e6e0558e510a", "score": "0.58956695", "text": "func isAlphaOrNumber(r rune) bool {\n\treturn 'a' <= r && r <= 'z' || 'A' <= r && r <= 'Z' || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "47bdf78e66b9ae452d0a4b561ad4371c", "score": "0.58447844", "text": "func ValidateSymbol(sym UnitSymbol) bool {\n\tstr := fmt.Sprintf(\"%d %s\", 0, sym)\n\tif _, err := Parse(str); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e80e7db318703831f04309a13fe538d7", "score": "0.58418286", "text": "func isLetter(ch rune) bool {\n\treturn 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'\n}", "title": "" }, { "docid": "7266e86e456b87d413697c3870c5ea8f", "score": "0.5840219", "text": "func IsValid(token string) bool {\n\tchars := []byte(alphabet)\n\n\tfor _, c := range []byte(token) {\n\t\tif bytes.IndexByte(chars, c) == -1 {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "title": "" }, { "docid": "c39f0fc7fab46eeaf7d08b05bda97168", "score": "0.5822885", "text": "func validateAheuiChar(c rune) bool {\n\treturn c >= 0xAC00 && c <= 0xD7A3\n}", "title": "" }, { "docid": "13d34a797bc8bda97782e2559583dd48", "score": "0.58219945", "text": "func isLetter(ch rune) bool {\n\treturn unicode.IsLetter(rune(ch)) || ch == '_' || ch == '?'\n}", "title": "" }, { "docid": "0f75f3f802eddc740a97aa55880897e8", "score": "0.58176464", "text": "func isAlpha(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r)\n}", "title": "" }, { "docid": "4957f685f67c2a07bed300ed8e621541", "score": "0.5805986", "text": "func isAlphaNum(c uint8) bool {\n\treturn c == '_' || '0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z'\n}", "title": "" }, { "docid": "17edf6c6492d9533b75043173bfbff76", "score": "0.57905537", "text": "func isDigit(ch rune) bool {\n\t// unicode class n includes junk we don't want\n\treturn (ch >= '0' && ch <= '9')\n}", "title": "" }, { "docid": "81351e86cab0f9017ccd1a709fd35810", "score": "0.57876813", "text": "func stringStartsWithIdentifier(s string) bool {\n\tif len(s) == 0 {\n\t\treturn false\n\t}\n\n\tfirst := s[0]\n\n\t// Easy ASCII cases first\n\tif (first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z') || first == '_' {\n\t\treturn true\n\t}\n\n\t// If our first byte begins a UTF-8 sequence then the sequence might\n\t// be a unicode letter.\n\tif utf8.RuneStart(first) {\n\t\tfirstRune, _ := utf8.DecodeRuneInString(s)\n\t\tif unicode.IsLetter(firstRune) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "03436fe4a1549364704c2ff21651538c", "score": "0.57851076", "text": "func TestContainsSpecialCharacter(t *testing.T) {\n\tresult := helpers.ContainsSpecialCharacter(\"@./,*£\")\n\n\tif !result {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "738843fb07bcfb5c549ae521b546d491", "score": "0.57830834", "text": "func (p *genParser) parseIdent() (str string, ok bool) {\n\tp.white()\n\tj := p.i\n\nloop:\n\tfor first := true; ; {\n\t\tr, w := p.peek()\n\t\tswitch {\n\t\tcase !first && '0' <= r && r <= '9':\n\t\tcase 'a' <= r && r <= 'z':\n\t\tcase 'A' <= r && r <= 'Z':\n\t\tcase r == '_':\n\t\tdefault:\n\t\t\tbreak loop\n\t\t}\n\t\tp.inc(w)\n\t\tfirst = false\n\t}\n\treturn p.s[j:p.i], true\n}", "title": "" }, { "docid": "3b517de3291b982c8eb51656ca0e456e", "score": "0.57799184", "text": "func Valid(id string) bool {\n\tvar length, sum int\n\troons := []rune(id)\n\tfor i := len(roons) - 1; i >= 0; i-- {\n\t\troon := roons[i]\n\t\tswitch {\n\t\tcase unicode.IsSpace(roon):\n\t\t\tcontinue\n\t\tcase !unicode.IsDigit(roon):\n\t\t\treturn false\n\t\tdefault:\n\t\t\tdigit := int(roon) - '0'\n\t\t\tif length&1 == 1 {\n\t\t\t\tdigit *= 2\n\t\t\t}\n\t\t\tif digit > 9 {\n\t\t\t\tdigit -= 9\n\t\t\t}\n\t\t\tsum += digit\n\t\t\tlength++\n\t\t}\n\t}\n\treturn length > 1 && sum%10 == 0\n}", "title": "" }, { "docid": "dd37f1446695b02c63f306b668e22e09", "score": "0.5778573", "text": "func isNotNumberOrDollar(symbol int32) bool {\n\treturn symbol != 36 && (symbol < 48 || symbol > 57)\n}", "title": "" }, { "docid": "ed7568da63a8da551acf9f366f0b6c27", "score": "0.5765122", "text": "func verifyName(name string) error {\r\n\tvar myRegex string = `^[\\w]+$`\r\n\tmatch, _ := regexp.MatchString(myRegex, name)\r\n\tif !match {\r\n\t\treturn errors.New(fmt.Sprintf(\"Name must only contain alphanums and underscores < %s >\", name))\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "306042031ce32d1aa3885864c7e0b63b", "score": "0.5757656", "text": "func lexIdentifier(l *lexer) stateFn {\n\tfor {\n\t\tr := l.next()\n\t\tif isAlphaNumeric(r) {\n\t\t\t// consume and keep going\n\t\t\tcontinue\n\t\t}\n\t\tl.backup()\n\t\tword := string(l.input[l.start:l.pos])\n\t\tif !l.atTerminator() {\n\t\t\treturn l.errorf(\"bad character %#U in identifier\", r)\n\t\t}\n\t\t// Check if it matches a keyword\n\t\tswitch word {\n\t\tcase \"null\":\n\t\t\tl.emit(tokenNull)\n\t\tcase \"true\", \"false\":\n\t\t\tl.emit(tokenBool)\n\t\tdefault:\n\t\t\tl.emit(tokenIdentifier)\n\t\t}\n\t\tbreak\n\t}\n\tl.insertComma = true\n\treturn lexText\n}", "title": "" }, { "docid": "7e05bc3e10807471fc28e4d1ad33416b", "score": "0.5750643", "text": "func isLetter(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '\"' }", "title": "" }, { "docid": "5ab439e131303bb6c9129d309ca8e62d", "score": "0.57491887", "text": "func HasCharType(s string, wantUpper, wantLower, wantDigit, wantPunc, wantSymbol bool) bool {\n\tvar hasUpper, hasLower, hasDigit, hasPunc, hasSymbol bool\n\n\tfor _, c := range s {\n\t\tif !hasUpper && wantUpper && unicode.IsUpper(c) {\n\t\t\thasUpper = true\n\t\t} else if !hasLower && wantLower && unicode.IsLower(c) {\n\t\t\thasLower = true\n\t\t} else if !hasDigit && wantDigit && unicode.IsDigit(c) {\n\t\t\thasDigit = true\n\t\t} else if !hasPunc && wantPunc && unicode.IsPunct(c) {\n\t\t\thasPunc = true\n\t\t} else if !hasSymbol && wantSymbol && unicode.IsSymbol(c) {\n\t\t\thasSymbol = true\n\t\t}\n\n\t\tif (!wantUpper || hasUpper) &&\n\t\t\t(!wantLower || hasLower) &&\n\t\t\t(!wantDigit || hasDigit) &&\n\t\t\t(!wantPunc || hasPunc) &&\n\t\t\t(!wantSymbol || hasSymbol) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5f6a14cd59668b9fbb2db4c3678d4dd0", "score": "0.5749113", "text": "func checkForbiddenCharacters(path string) error {\n\tif runtime.GOOS == windows {\n\t\tif windowsForbiddenRegex.MatchString(path) {\n\t\t\treturn errors.New(\n\t\t\t\tstrings.Join(\n\t\t\t\t\twindowsForbiddenRegex.FindAllString(path, -1),\n\t\t\t\t\t\",\",\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tif runtime.GOOS == darwin {\n\t\tif strings.Contains(path, \":\") {\n\t\t\treturn fmt.Errorf(\"%s\", \":\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f8e2216b20e471a07314293c175ea00a", "score": "0.5741945", "text": "func isDigit(ru1, _ rune) bool {\n\treturn unicode.IsDigit(ru1)\n}", "title": "" }, { "docid": "2feffb21d191df6cc9906d2bcafac6d3", "score": "0.5734935", "text": "func isLetterNumber(r rune) bool {\n\treturn unicode.IsLetter(r) || unicode.IsNumber(r)\n}", "title": "" }, { "docid": "3633b1db35928f12b28af30817f12052", "score": "0.573322", "text": "func verifyCardName(card *Card) error {\n\tvar err error\n\tspaces := false\n\n\tmax := len(card.Name)\n\tif max > 8 {\n\t\tmax = 8\n\t}\n\n\tfor idx, c := range card.Name {\n\t\tswitch {\n\t\tcase (c >= 'A' && c <= 'Z') ||\n\t\t\t(c >= '0' && c <= '9') ||\n\t\t\tc == '-' || c == '_':\n\t\t\tif spaces {\n\t\t\t\treturn fmt.Errorf(\"fitsio: card name contains embedded space(s): %q\", card.Name)\n\t\t\t}\n\t\tcase c == ' ':\n\t\t\tspaces = true\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"fitsio: card name contains illegal character %q (idx=%d)\",\n\t\t\t\tcard.Name, idx,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1eb291cfcc2df391f7918b687f3b523a", "score": "0.5728902", "text": "func scanIdentifier(s string) (string, int) {\n\tbyteLen := 0\n\truneLen := 0\n\tfor {\n\t\tif byteLen >= len(s) {\n\t\t\tbreak\n\t\t}\n\n\t\tnextRune, size := utf8.DecodeRuneInString(s[byteLen:])\n\t\tif !(nextRune == '_' ||\n\t\t\tnextRune == '-' ||\n\t\t\tnextRune == '.' ||\n\t\t\tnextRune == '*' ||\n\t\t\tunicode.IsNumber(nextRune) ||\n\t\t\tunicode.IsLetter(nextRune) ||\n\t\t\tunicode.IsMark(nextRune)) {\n\t\t\tbreak\n\t\t}\n\n\t\t// If we reach a star, it must be between periods to be part\n\t\t// of the same identifier.\n\t\tif nextRune == '*' && s[byteLen-1] != '.' {\n\t\t\tbreak\n\t\t}\n\n\t\t// If our previous character was a star, then the current must\n\t\t// be period. Otherwise, undo that and exit.\n\t\tif byteLen > 0 && s[byteLen-1] == '*' && nextRune != '.' {\n\t\t\tbyteLen--\n\t\t\tif s[byteLen-1] == '.' {\n\t\t\t\tbyteLen--\n\t\t\t}\n\n\t\t\tbreak\n\t\t}\n\n\t\tbyteLen = byteLen + size\n\t\truneLen = runeLen + 1\n\t}\n\n\treturn s[:byteLen], runeLen\n}", "title": "" }, { "docid": "6a7d0833b86c8ebd8da982fa18910ae7", "score": "0.57173", "text": "func isUnicodeIDStart(ch rune) bool {\n\tif unicode.In(ch, unicode.Lu, unicode.Ll,\n\t\tunicode.Lt, unicode.Lm, unicode.Lo,\n\t\tunicode.Nl, unicode.Other_ID_Start) {\n\t\treturn !unicode.In(ch, unicode.Pattern_Syntax,\n\t\t\tunicode.Pattern_White_Space)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3ca77c366bc528fa0921ebc9c552b409", "score": "0.5709651", "text": "func (ap *ArgParser) check(c rune) interface{} {\n\tif c == ap.escaper {\n\t\treturn esc\n\t}\n\n\ti := strings.IndexRune(ap.symbols, c)\n\tif i == -1 {\n\t\treturn nil\n\t} else if i < ap.boundary {\n\t\treturn qut\n\t}\n\treturn spl\n}", "title": "" }, { "docid": "25c355d6b30c99d887f5338d6e08d2a1", "score": "0.5708789", "text": "func isCharacter(val string) (erg bool) {\n\tfor i := 0; i < len(val); i++ {\n\t\terg = false\n\t\tif val[i] >= 48 && val[i] <= 57 {\n\t\t\terg = true\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "fb23585d2028b42a85faf39dea3a1097", "score": "0.5686149", "text": "func isASCII(s string) bool {\n\tfor _, c := range s {\n\t\tif c > unicode.MaxASCII {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "129c8bb63d0c39cc148fbc6a07ece4d4", "score": "0.5679078", "text": "func (s *Scanner) scanIdentifier() string {\n var id string\n \n for {\n r, w := s.peek()\n if (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '_' {\n id += string(r)\n s.inc(r, w)\n }else{\n return id\n }\n }\n \n}", "title": "" }, { "docid": "bb7aeddc4872c3c9fc3f265ae8684a25", "score": "0.56722873", "text": "func makeIdentifier(format string, a ...interface{}) string {\n\ts := fmt.Sprintf(format, a...)\n\tvar r []rune\n\tfor _, c := range s {\n\t\tc = unicode.ToLower(c)\n\t\tif isValidIdentifierChar(c) {\n\t\t\tr = append(r, c)\n\t\t\tcontinue\n\t\t}\n\t\tif unicode.IsSpace(c) || unicode.IsSymbol(c) {\n\t\t\tr = append(r, '_')\n\t\t\tcontinue\n\t\t}\n\t\t// Other characters are simply omitted.\n\t}\n\treturn string(r)\n}", "title": "" }, { "docid": "cb7b35fb13fb0b4a18b644a14ff82403", "score": "0.56686", "text": "func IsOnlyChars(txt string, valid string) bool {\n\tfor _, x := range txt {\n\t\tb := false\n\t\tfor _, y := range valid {\n\t\t\tif x == y {\n\t\t\t\tb = true\n\t\t\t}\n\t\t}\n\t\tif !b {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "998234a4bba1e7076826590a5c430f37", "score": "0.5659938", "text": "func ValidName(candidate string) bool {\n\tif !hclsyntax.ValidIdentifier(candidate) {\n\t\treturn false\n\t}\n\tif strings.Contains(candidate, \"-\") {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "919cffa7cd36438f5361792afff222eb", "score": "0.56541586", "text": "func Alphanumeric(s string) bool {\n\tif len(s) == 0 {\n\t\treturn false\n\t}\n\n\tfor _, v := range s {\n\t\tif ('Z' < v || v < 'A') && ('z' < v || v < 'a') && ('9' < v || v < '0') {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ef1713e36bd12a797bcb38bcf1d2f413", "score": "0.56524813", "text": "func TestBeneficiaryFIIdentifierAlphaNumeric(t *testing.T) {\n\tbfi := mockBeneficiaryFI()\n\tbfi.FinancialInstitution.Identifier = \"®\"\n\n\terr := bfi.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"Identifier\", ErrNonAlphanumeric, bfi.FinancialInstitution.Identifier).Error())\n}", "title": "" }, { "docid": "3f2bec385cdf84df27a57babfb8dc7e0", "score": "0.56487787", "text": "func isHexChar(ch rune) bool {\n\treturn 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F' || '0' <= ch && ch <= '9'\n}", "title": "" }, { "docid": "f3425244d3b0e967e1c536e43c6f6fe9", "score": "0.5631507", "text": "func isNumberChar(chr byte) bool {\n\treturn chr == '0' || chr == '1' || chr == '2' || chr == '3' || chr == '4' || chr == '5' || chr == '6' || chr == '7' || chr == '8' || chr == '9'\n}", "title": "" }, { "docid": "f060a38f4996b904e7d95600f22747cb", "score": "0.56276333", "text": "func (me TalignType) IsChar() bool { return me.String() == \"CHAR\" }", "title": "" }, { "docid": "703c371ed05d7d00b158ba2fd108ac04", "score": "0.5623318", "text": "func IsPrintable(a string) bool {\n\tfor i := range a {\n\t\tif a[i] <= 31 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "818f83ec033e1c2ce22a8ff909e3205f", "score": "0.5621575", "text": "func isHexCharacter(c byte) bool {\n\treturn ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')\n}", "title": "" } ]
89a1002478b6cf95376022990d747877
LastDateOfMonth gets the last date of the month which the given time is in
[ { "docid": "ab319d18a4a96aa13768876cb0fdfa19", "score": "0.82889694", "text": "func LastDateOfMonth(t time.Time) time.Time {\n\tt2 := FirstDateOfNextMonth(t)\n\treturn time.Unix(t2.Unix()-86400, 0)\n}", "title": "" } ]
[ { "docid": "ad990bf9291ecaf031eaca31af084390", "score": "0.7722048", "text": "func EndOfMonth(date time.Time) time.Time {\n\t// go to the next month, then a day of 0 removes a day leaving us\n\t// at the last day of dates month.\n\treturn time.Date(date.Year(), date.Month()+1, 0, 0, 0, 0, 0, date.Location())\n}", "title": "" }, { "docid": "06464ae054733739e760d06f39843b77", "score": "0.7574066", "text": "func EndOfMonth(t time.Time) time.Time {\n\tt2 := t.AddDate(0, 1, 0) // add a month\n\tt3 := time.Date(t2.Year(), t2.Month(), 1, 00, 00, 00, 00, t.Location()) // move to YY-MM-01 00:00.00\n\tt4 := t3.Add(-time.Nanosecond) // subtract (1) nanosecond\n\treturn t4\n}", "title": "" }, { "docid": "be6c707dc5d9b93c94b1a29d886e95bd", "score": "0.7381916", "text": "func (te *TimeEx) EndOfMonth() *TimeEx {\n t := te.Time\n te.Time = time.Date(t.Year(), t.Month()+1, 1, t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), t.Location()).AddDate(0, 0, -1)\n return te\n}", "title": "" }, { "docid": "0b22bc587fded298bae7598384ee787a", "score": "0.7289935", "text": "func (t Time) LastMonthDay() Time {\n\ti := 0\n\tif t.IsLeap() {\n\t\ti = 1\n\t}\n\n\tm := t.month - 1\n\tif m < 0 {\n\t\tm = 0\n\t} else if m > 11 {\n\t\tm = 11\n\t}\n\n\tld := pMonthCount[m][i]\n\tif ld == t.day {\n\t\treturn t\n\t}\n\treturn Date(t.year, t.month, ld, t.hour, t.min, t.sec, t.nsec, t.loc)\n}", "title": "" }, { "docid": "5ec868960ffc5f8482fcc843e85670d9", "score": "0.70219046", "text": "func (d Date) EndOfMonth() Date {\n\treturn d.StartOfMonth().AddMonths(1).AddDays(-1)\n}", "title": "" }, { "docid": "383b2ba7ea083dacc0addc3b5fc2565e", "score": "0.7008741", "text": "func MonthEnd(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\thour, min, sec := t.Clock()\n\treturn time.Date(year, month+1, 0, hour, min, sec, t.Nanosecond(), t.Location())\n}", "title": "" }, { "docid": "1aadeffa5b3205fa388c316a9b301281", "score": "0.6957861", "text": "func lastDate(year int, month time.Month) int {\n\treturn time.Date(year, month+1, 1, 0, 0, 0, 0, time.UTC).Add(-time.Hour).Day()\n}", "title": "" }, { "docid": "e505d035bb946567e20e604ee4224657", "score": "0.68948454", "text": "func FirstDateOfLastMonth(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\tif month == time.January {\n\t\tyear--\n\t\tmonth = time.December\n\t} else {\n\t\tmonth--\n\t}\n\treturn time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "e505d035bb946567e20e604ee4224657", "score": "0.68948454", "text": "func FirstDateOfLastMonth(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\tif month == time.January {\n\t\tyear--\n\t\tmonth = time.December\n\t} else {\n\t\tmonth--\n\t}\n\treturn time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "c697ebdf2e1b4ed6443b6ffe75048a2d", "score": "0.6771766", "text": "func LastMonth() string {\n\treturn MonthsAgo(1)\n}", "title": "" }, { "docid": "bb8f71823c6a37ebac7de04925273d11", "score": "0.6215723", "text": "func isLastWeekdayInMonth(t time.Time) bool {\n\t// try a week from now, if it's still the same month then t.Weekday() is\n\t// not last\n\treturn t.Month() != t.Add(7*24*time.Hour).Month()\n}", "title": "" }, { "docid": "151ea4b35332060dc609cd888cb3b28d", "score": "0.60177267", "text": "func LastWeekdayOf(dow time.Weekday, month time.Month) DateCalculation {\n\tinitFunc := NthWeekdayOf(1, dow, month)\n\n\treturn func(year int) time.Time {\n\t\tlwdo := initFunc(year)\n\t\tadjLastDayOfMonth := time.Date(year, month+1, 1, 0, 0, 0, 0, time.UTC).AddDate(0, 0, -7)\n\n\t\tfor lwdo.Before(adjLastDayOfMonth) {\n\t\t\tlwdo = lwdo.AddDate(0, 0, 7)\n\t\t}\n\t\treturn lwdo\n\t}\n}", "title": "" }, { "docid": "4e2c4e9537b8ed53c18a2c78dc89b485", "score": "0.5868795", "text": "func LastWeekday(year int, month time.Month, day time.Weekday) time.Time {\n\tt := FirstWeekday(year, month, day)\n\n\tfor {\n\t\tt = t.Add(24 * 7 * time.Hour)\n\t\tif t.Day() > 24 { // This will catch 31-day months\n\t\t\tbreak\n\t\t}\n\t\tif t.Month() != month { // This will catch the rest\n\t\t\tt = t.Add(-24 * 7 * time.Hour)\n\t\t\tbreak\n\t\t}\n\t}\n\treturn t\n}", "title": "" }, { "docid": "c86feca1d8853ddb38bbb5b2a5dfae90", "score": "0.5689714", "text": "func FirstDateOfMonth(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\treturn time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "c86feca1d8853ddb38bbb5b2a5dfae90", "score": "0.5689714", "text": "func FirstDateOfMonth(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\treturn time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "c6af184be8fd0fb7a7f2229be62444d7", "score": "0.563465", "text": "func getLastMidnight(start time.Time) time.Time {\n\treturn time.Date(start.Year(), start.Month(), start.Day(), 0, 0, 0, 0, start.Location())\n}", "title": "" }, { "docid": "a4ded80f855d8a43f00ad50113bb0928", "score": "0.54879993", "text": "func lastWeekDay(weekday time.Weekday, month time.Month, year int) int {\n\tfor day := daysInMonth(month, year); day >= 1; day-- {\n\t\tdate := time.Date(year, month, day, 0, 0, 0, 0, time.UTC)\n\t\tif date.Weekday() == weekday {\n\t\t\treturn day\n\t\t}\n\t}\n\tpanic(\"Unreachable code\")\n}", "title": "" }, { "docid": "cee929643117fd7b31657edb8948d46d", "score": "0.54622257", "text": "func (o AlertProcessingRuleActionGroupScheduleRecurrenceMonthlyOutput) EndTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleActionGroupScheduleRecurrenceMonthly) *string { return v.EndTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7929f6351dcd4ab792bfb1931ef61d30", "score": "0.54471153", "text": "func daysFromEndOfMonth(t time.Time) int {\n\treturn tempus.DaysInMonth(t) - t.Day()\n}", "title": "" }, { "docid": "4f4410529d2cb46841740be1c976d57a", "score": "0.5411268", "text": "func (o AlertProcessingRuleSuppressionScheduleRecurrenceMonthlyOutput) EndTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionScheduleRecurrenceMonthly) *string { return v.EndTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "945bfe396f2c8bd5a1570e47770d14b1", "score": "0.54013187", "text": "func StartOfMonth(date time.Time) time.Time {\n\treturn time.Date(date.Year(), date.Month(), 1, 0, 0, 0, 0, date.Location())\n}", "title": "" }, { "docid": "b8e02bc3a10d2bb64035b4a7ebe4a1c4", "score": "0.5335697", "text": "func StartOfMonth(reference time.Time) time.Time {\n\treturn time.Date(reference.Year(), reference.Month(), 1, reference.Hour(), reference.Minute(), reference.Second(), reference.Nanosecond(), reference.Location())\n}", "title": "" }, { "docid": "5ddacd8523ce91c83e29d57738925a4f", "score": "0.5295611", "text": "func (r Network_Storage_Schedule) GetDayOfMonth() (resp string, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Schedule\", \"getDayOfMonth\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "eba7e8e63a8834eacda9143bd04df8c8", "score": "0.52650356", "text": "func (o BudgetManagementGroupTimePeriodPtrOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BudgetManagementGroupTimePeriod) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.EndDate\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f7d33dd4d56c8c52c0caa5db5f68e1be", "score": "0.5256565", "text": "func (t Time) BeginningOfMonth() Time {\n\treturn Date(t.year, t.month, 1, 0, 0, 0, 0, t.loc)\n}", "title": "" }, { "docid": "0bc180e2fd8df5c0ac1ed2281e549bbd", "score": "0.5241259", "text": "func (calendar *Calendar) Month() (month Month) {\n\tbeginningOfMonth := calendar.Now.BeginningOfMonth()\n\tendOfMonth := calendar.Now.EndOfMonth()\n\tweek := New(beginningOfMonth).Week()\n\tlastWeek := New(endOfMonth).Week()\n\n\tfor !reflect.DeepEqual(lastWeek, week) {\n\t\tmonth = append(month, week)\n\t\tweek = week.Next()\n\t}\n\tmonth = append(month, lastWeek)\n\treturn\n}", "title": "" }, { "docid": "d575f577adf4cd7acd5bc3b7e8833084", "score": "0.5230265", "text": "func (s *BarTimeRangeGroupsList) GetLast() time.Time {\n\treturn s.Last\n}", "title": "" }, { "docid": "8543d60e1f5cbe55aa0483dc39b070a9", "score": "0.5221783", "text": "func CalcDayOfMonth(h *Holiday, year int) time.Time {\n\treturn time.Date(year, h.Month, h.Day, 0, 0, 0, 0, DefaultLoc)\n}", "title": "" }, { "docid": "f12a3dfac26cec9c55c19c10c9be8dda", "score": "0.52103966", "text": "func (t Time) LastWeekday() Time {\n\tif t.wday == Jomeh {\n\t\treturn t\n\t}\n\treturn t.AddDate(0, 0, int(Jomeh-t.wday))\n}", "title": "" }, { "docid": "da9e84b4009bf03a21cc6f0afa13e5cd", "score": "0.517622", "text": "func (o BudgetManagementGroupTimePeriodOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BudgetManagementGroupTimePeriod) *string { return v.EndDate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8e56b2ed0c7d71d5c6ff04c3ca3af4a5", "score": "0.51563257", "text": "func (o PatchDeploymentRecurringScheduleOutput) LastExecuteTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PatchDeploymentRecurringSchedule) *string { return v.LastExecuteTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eeaf6f1060c155f18b901a708c68c7ef", "score": "0.51399094", "text": "func (o GetBudgetResourceGroupTimePeriodOutput) EndDate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetBudgetResourceGroupTimePeriod) string { return v.EndDate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e160877561aba6c5404987d6eec75762", "score": "0.5133357", "text": "func (m *ManagementTemplateStepDeployment) GetLastActionDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastActionDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "1773b15bcd9cdf3aa4e82a40da694835", "score": "0.51057804", "text": "func (o GetWindowsWebAppBackupScheduleOutput) LastExecutionTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetWindowsWebAppBackupSchedule) string { return v.LastExecutionTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "819d318b2fec881b1f70363fa0a70cce", "score": "0.5100493", "text": "func (o BudgetResourceGroupTimePeriodPtrOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BudgetResourceGroupTimePeriod) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.EndDate\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "010a0e1b4bae10bfe5d4921e8c096c02", "score": "0.50788456", "text": "func dateToGoMonth(month int) tme.Month {\n\treturn tme.Month(month + 1)\n}", "title": "" }, { "docid": "3a110c1d500f84b03adaa994bbc80e11", "score": "0.50703377", "text": "func (o PatchDeploymentRecurringSchedulePtrOutput) LastExecuteTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PatchDeploymentRecurringSchedule) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.LastExecuteTime\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "027561bf72461b8d6ba932ac033eece8", "score": "0.50449115", "text": "func addMonth(t time.Time, interval int, location *time.Location) time.Time {\n\tfirstDay := time.Date(t.Year(), t.Month()+1, 1, roundHour(t), 0, 0, 0, location)\n\treturn firstDay.AddDate(0, interval, -1)\n}", "title": "" }, { "docid": "3d1dff6f9602cc65d264fa74d078dfe8", "score": "0.50400984", "text": "func FirstDateOfNextMonth(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\tif month == time.December {\n\t\tyear++\n\t\tmonth = time.January\n\t} else {\n\t\tmonth++\n\t}\n\treturn time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "3d1dff6f9602cc65d264fa74d078dfe8", "score": "0.50400984", "text": "func FirstDateOfNextMonth(t time.Time) time.Time {\n\tyear, month, _ := t.Date()\n\tif month == time.December {\n\t\tyear++\n\t\tmonth = time.January\n\t} else {\n\t\tmonth++\n\t}\n\treturn time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "a764bc43f0d1eab77a953456b48c591a", "score": "0.503043", "text": "func (euo *EmployeeUpdateOne) SetLastTime(t time.Time) *EmployeeUpdateOne {\n\teuo.mutation.SetLastTime(t)\n\treturn euo\n}", "title": "" }, { "docid": "6aa3ee6271cbf0ab5bf0a358b9d6a1e3", "score": "0.5015498", "text": "func MonthlyExpiration(startTime time.Time) time.Time {\n\treturn startTime.AddDate(0, 2, 0)\n}", "title": "" }, { "docid": "ce58814f1992ac8f211ae80afcdc75f4", "score": "0.5000648", "text": "func (o *UsageAttributionBody) GetMonth() time.Time {\n\tif o == nil || o.Month == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.Month\n}", "title": "" }, { "docid": "b627ca48527e7038c51503c1180ec245", "score": "0.4992687", "text": "func DayEnd(t time.Time) time.Time {\n\tyear, month, day := t.Date()\n\treturn time.Date(year, month, day, 23, 59, 59, 999999999, t.Location())\n}", "title": "" }, { "docid": "ff3a812243f8d104876659af2f8f9cb0", "score": "0.49599773", "text": "func (m *UnifiedRoleAssignmentScheduleInstance) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.endDateTime\n}", "title": "" }, { "docid": "35ee94c1dfe2d2615006e30b7d2ef499", "score": "0.4954809", "text": "func LastLoginDate(v time.Time) predicate.Entity {\n\treturn predicate.Entity(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldLastLoginDate), v))\n\t})\n}", "title": "" }, { "docid": "effa55d8c51dc8234749f94cf9655a64", "score": "0.49455377", "text": "func EndOfTheDay(t time.Time) time.Time {\n\tyear, month, day := t.Date()\n\treturn time.Date(year, month, day, 23, 59, 59, 0, t.Location())\n}", "title": "" }, { "docid": "2c4a9a5c4ee600bd70a7e3e7e3cf0798", "score": "0.49445918", "text": "func (o BudgetResourceGroupTimePeriodOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BudgetResourceGroupTimePeriod) *string { return v.EndDate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fb7325327165faf21e5420a07b5a2a37", "score": "0.49390948", "text": "func MaxTime() (t time.Time) { return Time(MaxTimestamp) }", "title": "" }, { "docid": "24af5754c8e3e65e40b298e0b349bbcf", "score": "0.49245235", "text": "func addMonth(t time.Time) time.Time {\n\tif t.Day() > 28 {\n\t\tt = time.Date(t.Year(), t.Month(), 1, t.Hour(), 0, 0, 0, t.Location())\n\t}\n\tt = t.AddDate(0, 1, 0)\n\treturn t\n}", "title": "" }, { "docid": "6d8885d08b1b36a6f8510e385c70a8cc", "score": "0.49108198", "text": "func getDateOfLastSaturday() time.Time {\n\tcurrentTime := time.Now()\n\n\tif(currentTime.Weekday() == 6){\n\t\treturn currentTime\n\t} else {\n\t\t//6 is the max day of week, so simply subtract the current day's number + 1 to get last saturday\n\t\treturn currentTime.AddDate(0,0,-(int(currentTime.Weekday())+1))\n\t}\n}", "title": "" }, { "docid": "f3e40f49e30173ee2f35a6071ebbdce6", "score": "0.4908625", "text": "func (p Period) EndTime() time.Time {\n\treturn p.Weeks[len(p.Weeks)-1].EndTime\n}", "title": "" }, { "docid": "e52fa0b32bce307948e2a465579d55ac", "score": "0.48972502", "text": "func (anime *Anime) EndDateTime() time.Time {\n\tformat := validate.DateFormat\n\n\tswitch {\n\tcase len(anime.EndDate) >= len(validate.DateFormat):\n\t\t// ...\n\tcase len(anime.EndDate) >= len(\"2006-01\"):\n\t\tformat = \"2006-01\"\n\tcase len(anime.EndDate) >= len(\"2006\"):\n\t\tformat = \"2006\"\n\t}\n\n\tt, _ := time.Parse(format, anime.EndDate)\n\treturn t\n}", "title": "" }, { "docid": "bcb9779286a2f3b7c596673171f13e30", "score": "0.48944414", "text": "func (o BudgetTimePeriodPtrOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BudgetTimePeriod) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.EndDate\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "af57325368947e9481ce4b41219a6509", "score": "0.48844165", "text": "func (m *RetireScheduledManagedDevice) GetRetireAfterDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"retireAfterDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "fb0d571c3a76add4ac978f1e3fa71e2d", "score": "0.48753443", "text": "func (s *BarGroupList) GetLast() time.Time {\n\treturn s.Last\n}", "title": "" }, { "docid": "edb1ecc2dc83ba458992bce92c5ad980", "score": "0.48738354", "text": "func (o PatchDeploymentRecurringSchedulePtrOutput) EndTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PatchDeploymentRecurringSchedule) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.EndTime\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b0b6e2c2a8a6c92d6f7fb87469584c51", "score": "0.48707616", "text": "func (o BudgetSubscriptionTimePeriodPtrOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BudgetSubscriptionTimePeriod) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.EndDate\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c7a737580725192c97099edd0a063b0a", "score": "0.48548084", "text": "func (d Date) StartOfMonth() Date {\n\tt := d.Time()\n\treturn FromTime(time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, time.UTC))\n}", "title": "" }, { "docid": "2d87ce950342fd577bf2cd335d5d723f", "score": "0.48525074", "text": "func (m *ManagementTemplateCollection) GetLastActionDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastActionDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "fd324d9d48dcbfee109ea8f3bc92de60", "score": "0.48464945", "text": "func MaxDate(day Day) Date{\n return Date{\n Day: day,\n Hour: 24,\n Minute: 00,\n }\n}", "title": "" }, { "docid": "9cd1c33e3353330d23b448e0432a3b01", "score": "0.48450994", "text": "func (m *Session) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"endDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "96dc3597564d49ed8148da3e0a05808a", "score": "0.48419178", "text": "func (s *BarGroupCreate) GetLast() time.Time {\n\treturn s.Last\n}", "title": "" }, { "docid": "91eeeca64ed1b8af2be3f1804695e34a", "score": "0.48316178", "text": "func (o LookupDatasetResultOutput) LastMigrateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupDatasetResult) string { return v.LastMigrateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2f23757c7f71acffb5cf0923cf1cff64", "score": "0.48308858", "text": "func (t Time) Month() int {\n\t_, mon, _, _ := t.Date()\n\treturn mon\n}", "title": "" }, { "docid": "01c1e3726c1eb4a88759948df74abd29", "score": "0.48265398", "text": "func MaxTime(ts ...time.Time) time.Time {\n\tr := time.Time{}\n\tfor _, t := range ts {\n\t\tif t.After(r) {\n\t\t\tr = t\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "26ce20a3347fd7fdbc3306f7dad31f19", "score": "0.48258078", "text": "func (o BudgetTimePeriodOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BudgetTimePeriod) *string { return v.EndDate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e37eb085477f8129b28d6b1debc11046", "score": "0.48112687", "text": "func (o PatchDeploymentRecurringScheduleOutput) EndTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PatchDeploymentRecurringSchedule) *string { return v.EndTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "217d4484595e28f586f709e35480374b", "score": "0.48081475", "text": "func MonthToTime(month string) time.Time {\n\tstartTime, err := time.Parse(DateLayout, fmt.Sprintf(\"%v-01\", month))\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn startTime\n}", "title": "" }, { "docid": "71bb05b299ca2c7cf759a0791e6be681", "score": "0.4797804", "text": "func (eu *EmployeeUpdate) SetLastTime(t time.Time) *EmployeeUpdate {\n\teu.mutation.SetLastTime(t)\n\treturn eu\n}", "title": "" }, { "docid": "332f65c14fdc6f5a3bd2bed5cbec5faa", "score": "0.47910312", "text": "func (te *TimeEx) StartOfMonth() *TimeEx {\n t := te.Time\n // return time.Date(t.Year(), t.Month(), 1, t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), t.Location())\n te.Time = time.Date(t.Year(), t.Month(), 1, t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), t.Location())\n return te\n}", "title": "" }, { "docid": "a82c456e6d5291d5e88eb91e3b12bc98", "score": "0.47888407", "text": "func (f *Fetcher) GetLastDate(buildServer BuildServer, now time.Time) (time.Time, error) {\n\tlastDate, err := f.ElasticSearchProvider.GetStat(fmt.Sprintf(\"%s-raw\", buildServer.Index), \"metadata__updated_on\", \"max\", nil, nil)\n\tif err != nil {\n\t\treturn DefaultTime, err\n\t}\n\n\treturn lastDate, nil\n}", "title": "" }, { "docid": "ff78788f480a7e10f3294ac81905db83", "score": "0.47886485", "text": "func (o *IamOAuthTokenAllOf) GetLastLoginTime() time.Time {\n\tif o == nil || o.LastLoginTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.LastLoginTime\n}", "title": "" }, { "docid": "bbddef29f1619d0cac7c5f7930e5a0a0", "score": "0.4787554", "text": "func (o FleetMetricOutput) LastModifiedDate() pulumi.Float64Output {\n\treturn o.ApplyT(func(v *FleetMetric) pulumi.Float64Output { return v.LastModifiedDate }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "2ebbbae91254f8d627d718c89d7d7fa3", "score": "0.4784271", "text": "func (m *DeviceConfigurationDeviceStatus) GetLastReportedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastReportedDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "d3aebaaff876bc03f482da4e0627d62d", "score": "0.47837284", "text": "func (o ApplicationStatusWorkflowStepsSubstepsOutput) LastExecuteTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusWorkflowStepsSubsteps) *string { return v.LastExecuteTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c827b6f5835c59b6c6277d9af6151022", "score": "0.4775431", "text": "func GetMonthBorders(t time.Time) (time.Time, time.Time) {\n\treturn time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location()),\n\t\ttime.Date(t.Year(), t.Month()+1, 1, 0, 0, 0, 0, t.Location()).Add(-time.Second)\n}", "title": "" }, { "docid": "b5f3884a04dd0ba4e863d3a2ec5947fd", "score": "0.47725534", "text": "func MonthToDate() (month, startDate, endDate string) {\n\tyesterday := time.Now().AddDate(0, 0, -1)\n\tmonth = yesterday.Format(monthLayout)\n\tstartDate = fmt.Sprintf(\"%v-01\", month)\n\tendDate = yesterday.Format(DateLayout)\n\treturn\n}", "title": "" }, { "docid": "1426a331f668c6af52d6d70b249d250a", "score": "0.47654194", "text": "func (ec *EmployeeCreate) SetLastTime(t time.Time) *EmployeeCreate {\n\tec.mutation.SetLastTime(t)\n\treturn ec\n}", "title": "" }, { "docid": "e2bb0b4868c2abb28ba8bcfcd8171408", "score": "0.47562355", "text": "func (o ApplicationStatusWorkflowStepsOutput) LastExecuteTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationStatusWorkflowSteps) *string { return v.LastExecuteTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d216b68d8c3c9f286a509399655d5b65", "score": "0.47498387", "text": "func daysFromStartOfMonth(t time.Time) int {\n\treturn t.Day() - 1\n}", "title": "" }, { "docid": "92d1bdc74e499dafc9ecadcca93d5c60", "score": "0.47494245", "text": "func (tuo *TrainingUpdateOne) SetLastday(t time.Time) *TrainingUpdateOne {\n\ttuo.mutation.SetLastday(t)\n\treturn tuo\n}", "title": "" }, { "docid": "28414b077103aa35e8a67467009bae3b", "score": "0.47486317", "text": "func (o GetBudgetSubscriptionTimePeriodOutput) EndDate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetBudgetSubscriptionTimePeriod) string { return v.EndDate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "de7a339aafbc53766c8a1f32f5cf5d63", "score": "0.47428522", "text": "func (o BudgetSubscriptionTimePeriodOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BudgetSubscriptionTimePeriod) *string { return v.EndDate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "33488326a079ab87bc4d6c88f9547d04", "score": "0.4739793", "text": "func (s *BarGroupUpdate) GetLast() time.Time {\n\treturn s.Last\n}", "title": "" }, { "docid": "1114d63075493c132d83c210f785dfe0", "score": "0.4736378", "text": "func (o RecurringScheduleResponseOutput) LastExecuteTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RecurringScheduleResponse) string { return v.LastExecuteTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "02f64373945e6aa6ef4a905489f5f8b1", "score": "0.47350252", "text": "func (o SuppressionScheduleOutput) EndDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SuppressionSchedule) *string { return v.EndDate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4a2ef65ecccffbb59efe96d8cb1b76ff", "score": "0.47334132", "text": "func (g *Goment) Month() int {\n\treturn int(g.ToTime().Month())\n}", "title": "" }, { "docid": "032808c282f31e922eb560dd3b9fbe09", "score": "0.47227314", "text": "func (t Time) LastYearDay() Time {\n\ti := 0\n\tif t.IsLeap() {\n\t\ti = 1\n\t}\n\tld := pMonthCount[Esfand-1][i]\n\tif t.month == Esfand && t.day == ld {\n\t\treturn t\n\t}\n\treturn Date(t.year, Esfand, ld, t.hour, t.min, t.sec, t.nsec, t.loc)\n}", "title": "" }, { "docid": "16f28023eb62e225707b83be6fdb37f1", "score": "0.4714793", "text": "func (d DateTime) StartOfMonth() DateTime {\n\treturn DateTime{\n\t\tTime: time.Date(d.Year(), d.Month(), 1, 0, 0, 0, 0, d.Location()),\n\t}\n}", "title": "" }, { "docid": "df4a52c2cd69451331f6dee5847308ad", "score": "0.470565", "text": "func (r Rule) EndTime(t time.Time) time.Time {\n\tstart := r.StartTime(t)\n\tif start.IsZero() {\n\t\treturn start\n\t}\n\n\tif r.Start < r.End {\n\t\treturn r.End.LastOfDay(start)\n\t}\n\tif r.Start > r.End {\n\t\t// always the day after the start\n\t\treturn r.End.LastOfDay(start.AddDate(0, 0, 1))\n\t}\n\n\t// 24-hour rule, end time of the next inactive day\n\treturn r.End.LastOfDay(r.WeekdayFilter.NextInactive(start))\n}", "title": "" }, { "docid": "d5cf7b6f59d78da93d8331f032893f66", "score": "0.46903455", "text": "func (o *NotebookAbsoluteTime) GetEnd() time.Time {\n\tif o == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn o.End\n}", "title": "" }, { "docid": "5a241c51fcc9e5457e1b43596308b4f1", "score": "0.46639824", "text": "func (o *AssetDeviceContractNotification) GetLastDateOfSupport() time.Time {\n\tif o == nil || o.LastDateOfSupport == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.LastDateOfSupport\n}", "title": "" }, { "docid": "eff577d5c5f31b56b9579a5a9b5220e8", "score": "0.46485078", "text": "func (s *BarTimeRangeGroupsList) SetLast(val time.Time) {\n\ts.Last = val\n}", "title": "" }, { "docid": "ea9c62560b38424bcad23d4f01f4b16b", "score": "0.4647174", "text": "func (m *Dimension) GetLastModifiedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastModifiedDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "e5778b131bb4ee7ead8ef9163a583d85", "score": "0.46458012", "text": "func (t SchedulableTask) LastScheduled() time.Time {\n\ttm, _ := t.LatestCompletedTime()\n\treturn tm\n}", "title": "" }, { "docid": "d143f589a2a43ca57360a02a06e13391", "score": "0.46203434", "text": "func (o PatchDeploymentRecurringScheduleMonthlyOutput) MonthDay() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v PatchDeploymentRecurringScheduleMonthly) *int { return v.MonthDay }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "17ea5e14dc88f20f2d330ee729a7d199", "score": "0.46188018", "text": "func (s *CreateBarGroupReq) GetLast() time.Time {\n\treturn s.Last\n}", "title": "" }, { "docid": "a7cb1357840efb9b08befb00b94336c5", "score": "0.4617398", "text": "func (te *TimeEx) EndOfWeek() *TimeEx {\n t := te.Time\n daysOffset := (6 - int(t.Weekday()) + int(te.beginningWeekday)) % 7\n te.Time = t.AddDate(0, 0, daysOffset)\n return te\n}", "title": "" } ]
98494a02195d83474edbc72b0aebb52a
NewSigninEndpoint returns an endpoint function that calls the method "signin" of service "secured_service".
[ { "docid": "c8c131ce9ab523e3a8d9bc0df05da8cf", "score": "0.75315744", "text": "func NewSigninEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req any) (any, error) {\n\t\tp := req.(*SigninPayload)\n\t\tvar err error\n\t\tsc := security.BasicScheme{\n\t\t\tName: \"basic\",\n\t\t\tScopes: []string{\"api:read\"},\n\t\t\tRequiredScopes: []string{},\n\t\t}\n\t\tctx, err = authBasicFn(ctx, p.Username, p.Password, &sc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn s.Signin(ctx, p)\n\t}\n}", "title": "" } ]
[ { "docid": "be42317bb494e618b274f2c0dc421b4b", "score": "0.69190705", "text": "func MakeSignInEndpoint(s service.IcartService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(SignInRequest)\n\t\trs, err := s.SignIn(ctx, req.Username, req.Psw)\n\t\treturn SignInResponse{\n\t\t\tErr: err,\n\t\t\tRs: rs,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "b71ca198d471f4771377e9988888993b", "score": "0.6857281", "text": "func SecureSignin(ep goa.Endpoint, authBasicAuthFn security.AuthorizeBasicAuthFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*SigninPayload)\n\t\tvar err error\n\t\tbasicAuthSch := security.BasicAuthScheme{\n\t\t\tName: \"basic\",\n\t\t}\n\t\tctx, err = authBasicAuthFn(ctx, *p.Username, *p.Password, &basicAuthSch)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn ep(ctx, req)\n\t}\n}", "title": "" }, { "docid": "dee3bcd9acb0810bbfa28643a5306851", "score": "0.6645573", "text": "func (s *securedserviceSvc) Signin(ctx context.Context, p *securedservice.SigninPayload) (string, error) {\n\tvar res string\n\ts.logger.Print(\"secured_service.signin\")\n\treturn res, nil\n}", "title": "" }, { "docid": "77ed3e61d2b60c2a8d0f33f5a2650fe3", "score": "0.61213446", "text": "func (c *Client) SignIn() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeSignInRequest(c.encoder)\n\t\tdecodeResponse = DecodeSignInResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildSignInRequest(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = encodeRequest(req, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := c.SignInDoer.Do(req)\n\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"userquery\", \"SignIn\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "title": "" }, { "docid": "a7e69390abc42f27efb00a50ea681342", "score": "0.6104755", "text": "func makeSignInHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.SignInEndpoint, decodeSignInRequest, encodeSignInResponse, options...)\n}", "title": "" }, { "docid": "768d899b9787ce8cedeabc9833df05f1", "score": "0.6061026", "text": "func NewSigninPayload() *securedservice.SigninPayload {\n\treturn &securedservice.SigninPayload{}\n}", "title": "" }, { "docid": "8d635feab46fac9588a081a3cfdd0ae4", "score": "0.58423656", "text": "func (e Endpoints) SignIn(ctx context.Context, username string, psw string) (rs string, err error) {\n\trequest := SignInRequest{\n\t\tPsw: psw,\n\t\tUsername: username,\n\t}\n\tresponse, err := e.SignInEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(SignInResponse).Rs, response.(SignInResponse).Err\n}", "title": "" }, { "docid": "ad259432f4741506470ff53a1f14d6f8", "score": "0.5773586", "text": "func NewSignInHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decoder,\n\tencoder func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\terrhandler func(context.Context, http.ResponseWriter, error),\n\tformatter func(err error) goahttp.Statuser,\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeSignInRequest(mux, decoder)\n\t\tencodeResponse = EncodeSignInResponse(encoder)\n\t\tencodeError = EncodeSignInError(encoder, formatter)\n\t)\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tr.Header.Set(\"Host\", r.Host)\n\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"SignIn\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"userquery\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tres, err := endpoint(ctx, payload)\n\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "fe5d94985e9e5d92c68d9c2038b94669", "score": "0.5763916", "text": "func (c *Client) Signin(ctx context.Context, p *SigninPayload) (res *Creds, err error) {\n\tvar ires any\n\tires, err = c.SigninEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*Creds), nil\n}", "title": "" }, { "docid": "ae43c62f651dd1bd1bb7716e5ee5cbe5", "score": "0.57145005", "text": "func (c *Client) SamlSignIn() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeSamlSignInRequest(c.encoder)\n\t\tdecodeResponse = DecodeSamlSignInResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildSamlSignInRequest(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = encodeRequest(req, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := c.SamlSignInDoer.Do(req)\n\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"userquery\", \"SamlSignIn\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "title": "" }, { "docid": "03199407e37015132944469cc42126f7", "score": "0.5691851", "text": "func NewSecureEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req any) (any, error) {\n\t\tp := req.(*SecurePayload)\n\t\tvar err error\n\t\tsc := security.JWTScheme{\n\t\t\tName: \"jwt\",\n\t\t\tScopes: []string{\"api:read\", \"api:write\"},\n\t\t\tRequiredScopes: []string{\"api:read\"},\n\t\t}\n\t\tctx, err = authJWTFn(ctx, p.Token, &sc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn s.Secure(ctx, p)\n\t}\n}", "title": "" }, { "docid": "767615b7fb2eb64afea363c026aa7c90", "score": "0.5685427", "text": "func NewSignInHandler(service Signer, logger log.FieldLogger) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger.Info(\"received requests\")\n\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", r.Header.Get(\"Origin\"))\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\n\t\tvar credentials Credentials\n\t\terr := json.NewDecoder(r.Body).Decode(&credentials)\n\t\tif err != nil {\n\t\t\tlogger.Warn(\"bad request with error \", err)\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tlogger.Info(\"requests from user - \", credentials.Username)\n\n\t\ttoken, expiration, err := service.SignIn(credentials)\n\t\tif err != nil {\n\t\t\tif err.Error() == AuthenticateError {\n\t\t\t\tlogger.Warn(\"authentication failed for user - \", credentials.Username)\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tlogger.Error(\"error while trying to authenticate \", err)\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tlogger.Info(fmt.Sprintf(\"setting up token for \"+\n\t\t\t\"user %s for %v time\", credentials.Username, expiration))\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: config.TokenName,\n\t\t\tValue: token,\n\t\t\tExpires: expiration,\n\t\t})\n\t}\n\n}", "title": "" }, { "docid": "e59b4469071524d0ee5eb3323ac86ad6", "score": "0.5618044", "text": "func (c *Client) BuildSigninRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: SigninSecuredServicePath()}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"secured_service\", \"signin\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "fc4874c1f3348a1d282b37c61f340fe2", "score": "0.56042045", "text": "func (ep *WebEndpoint) SignIn(w http.ResponseWriter, r *http.Request, userData map[string]string) {\n\tep.SetSecCookieVals(w, r, userData)\n}", "title": "" }, { "docid": "3f4fa95cf161061d15800bb9b02b3423", "score": "0.5576782", "text": "func (server *Server) SignIn(w http.ResponseWriter, r *http.Request) {\n\tresponses.JSON(w, http.StatusOK, \"Use login endpoint and provide credentials\")\n}", "title": "" }, { "docid": "b80f4c8bcb1f537dea48f06ca6128f9a", "score": "0.5399627", "text": "func (p Provider) SignIn(context *auth.Context) {\r\n\tcontext.Auth.SignInHandler(context, p.authenticateHandler)\r\n}", "title": "" }, { "docid": "9c474f67d1416dddee39a799f8f12535", "score": "0.53305864", "text": "func SignIn(email, password, address string) error {\n\tctx := context.Background()\n\n\tclient, err := openidc.RegisterClient(ctx, address, email, password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcsrfToken, err := randomValue()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed getting random value for CSRF token\")\n\t}\n\n\tnonce, err := randomValue()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed getting random value for ID Token nonce\")\n\t}\n\n\treq := &api.SignInRequest{\n\t\tUsername: email,\n\t\tPassword: password,\n\t\tScope: []string{\"openid\", \"name\", \"email\", \"offline_access\", \"admin\"},\n\t\tResponseType: []string{\"token\", \"id_token\"},\n\t\tAudience: []string{\n\t\t\t// To be able to publish and unpublish Lift plugins from Lift registry.\n\t\t\t\"https://lift.hooklift.io\",\n\t\t\t// To be able to interact with Hooklift's Platform API to deploy apps,\n\t\t\t// tail logs, manage apps configurations, etc.\n\t\t\t\"https://api.hooklift.io\",\n\t\t\t// To be able to interactively deploy using Lift CLI\n\t\t\t\"https://git.hooklift.io\",\n\t\t},\n\t\tState: csrfToken,\n\t\tNonce: nonce,\n\t}\n\n\tgrpcConn, err := grpcutil.Connection(address, \"lift-auth\", client.ClientId, client.ClientSecret)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed connecting to openid provider.\")\n\t}\n\tdefer grpcConn.Close()\n\n\tauthz := api.NewAuthzClient(grpcConn)\n\tresp, err := authz.SignIn(ctx, req)\n\tif err != nil {\n\t\tgcode := grpc.Code(err)\n\t\tif gcode == codes.Unauthenticated || gcode == codes.NotFound {\n\t\t\treturn errors.New(\"Email or password is not valid\")\n\t\t}\n\n\t\tui.Debug(\"%+v\", errors.Wrap(err, \"failed signing user in\"))\n\t\treturn errors.New(\"We failed signing you in. Please try again\")\n\t}\n\n\tif resp.State != csrfToken {\n\t\treturn errors.New(\"CSRF token received does not match value sent\")\n\t}\n\n\t// Discovers OpenID Connect configuration for the given provider address and refreshes cached\n\t// configuration and signing keys.\n\tif err := discovery.Run(address); err != nil {\n\t\treturn errors.Wrapf(err, \"failed discovering identity config from %q\", address)\n\t}\n\n\ttokens := &tokens.Tokens{\n\t\tIssuer: address,\n\t\tID: resp.IdToken,\n\t\tAccess: resp.AccessToken,\n\t\tRefresh: resp.RefreshToken,\n\t}\n\n\t// Verifies that ID token hasn't been tampared by checking its signature and relationship\n\t// with the Access token.\n\tif err := tokens.Verify(client.ClientId, nonce); err != nil {\n\t\treturn errors.Wrap(err, \"failed validating received tokens\")\n\t}\n\n\treturn tokens.Write()\n}", "title": "" }, { "docid": "a6d50b180575170f566bbab39695e98c", "score": "0.5269141", "text": "func EncodeSigninRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*securedservice.SigninPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"secured_service\", \"signin\", \"*securedservice.SigninPayload\", v)\n\t\t}\n\t\tbody := NewSigninRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"secured_service\", \"signin\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7f63d2b9b6ca2d5640162106418153cb", "score": "0.5248008", "text": "func Signin(bus command.Bus) gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tvar req signinRequest\n\t\tif err := ctx.BindJSON(&req); err != nil {\n\t\t\tctx.JSON(http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := bus.Dispatch(ctx, signin.NewSigninCommand(req.Email, req.Password)); err != nil {\n\t\t\tctx.JSON(http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx.JSON(http.StatusOK, nil)\n\t}\n}", "title": "" }, { "docid": "f719b8a1ab5cd4aa8039d2f8fd077b39", "score": "0.5210433", "text": "func NewSamlSignInHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decoder,\n\tencoder func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\terrhandler func(context.Context, http.ResponseWriter, error),\n\tformatter func(err error) goahttp.Statuser,\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeSamlSignInRequest(mux, decoder)\n\t\tencodeResponse = EncodeSamlSignInResponse(encoder)\n\t\tencodeError = EncodeSamlSignInError(encoder, formatter)\n\t)\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tr.Header.Set(\"Host\", r.Host)\n\t\t// We force the content type to plain text\n\t\tr.Header.Set(\"Content-Type\", \"text/plain\")\n\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"SamlSignIn\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"userquery\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tres, err := endpoint(ctx, payload)\n\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "1c0796828f82fcfe78cbae0dbb828edb", "score": "0.5179947", "text": "func (h *Auth) Signin(c echo.Context) (err error) {\n\tservice := new(services.Auth)\n\tform := &models.Signin{}\n\t// skip checking bind errors.\n\tif err := c.Bind(form); err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, bson.M{\"message\": err.Error()})\n\t}\n\n\t// Validate our data:\n\tif err := c.Validate(form); err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, bson.M{\"message\": err.Error()})\n\t}\n\n\tdata, err := service.Signin(form)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, bson.M{\"message\": err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, data)\n}", "title": "" }, { "docid": "63ab4ac2b0822eb421b708cc1454acc4", "score": "0.51697266", "text": "func SecureEncodeSigninRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\trawEncoder := EncodeSigninRequest(encoder)\n\treturn func(req *http.Request, v interface{}) error {\n\t\tif err := rawEncoder(req, v); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpayload := v.(*securedservice.SigninPayload)\n\t\treq.SetBasicAuth(*payload.Username, *payload.Password)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e310fcf2a033eb367476107fd2834b89", "score": "0.515359", "text": "func (h *Handler) SignIn(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tdefer r.Body.Close()\n\n\trb := pkgRest.SignInRequest{}\n\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlogging.Error(ctx, \"Can't read body\", zap.Error(err))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(b, &rb)\n\tif err != nil {\n\t\tlogging.Error(ctx, \"Can't unmarshall body\", zap.Error(err))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t_, err = mail.ParseAddress(rb.Email)\n\tif err != nil {\n\t\tlogging.Error(ctx, \"Email failed validation\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tid, err := h.s.GetUser(ctx, rb.Email)\n\tif errors.Is(err, store.ErrUserNotFound) {\n\t\tlogging.Info(ctx, \"User not found\")\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tif err != nil {\n\t\tlogging.Error(ctx, \"Failed to retrieve user from the store\", zap.Error(err))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// TODO: Check for temporary behaviour errors and retry in the store itself\n\trespB := pkgRest.SignInResponse{UserID: id}\n\tb, err = json.Marshal(respB)\n\tif err != nil {\n\t\tlogging.Error(ctx, \"failed to marshall sign in response\", zap.Error(err))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\t_, err = w.Write(b)\n\tif err != nil {\n\t\tlogging.Error(ctx, \"failed to write sign in response\", zap.Error(err))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlogging.Info(ctx, \"User signed in\", zap.String(\"userId\", id))\n}", "title": "" }, { "docid": "fc0baa301798edc48d742513b5a0e0c2", "score": "0.5151388", "text": "func (s *MockAuthenticationService) SignIn(string) error {\n\treturn s.SignInErrorToReturn\n}", "title": "" }, { "docid": "4331f947aa9e38df6b00122742436775", "score": "0.51182705", "text": "func MakeAuthenticateEndpoint(s service.AuthenticationService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\terror := s.Authenticate(ctx)\n\t\treturn AuthenticateResponse{Error: error}, nil\n\t}\n}", "title": "" }, { "docid": "461c5e41008e3d4137c71c3d2793231c", "score": "0.5116438", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tSignin: NewSigninEndpoint(s, a.BasicAuth),\n\t\tSecure: NewSecureEndpoint(s, a.JWTAuth),\n\t\tDoublySecure: NewDoublySecureEndpoint(s, a.JWTAuth, a.APIKeyAuth),\n\t\tAlsoDoublySecure: NewAlsoDoublySecureEndpoint(s, a.JWTAuth, a.APIKeyAuth, a.OAuth2Auth, a.BasicAuth),\n\t}\n}", "title": "" }, { "docid": "89b4cdca46553ccf918bf3b1170ff44c", "score": "0.5104892", "text": "func Signin(w http.ResponseWriter, r *http.Request) {\n\tvar req signinRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\tutils.Log.Error(\"Unable to decode request body\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tutils.Log.WithFields(log.Fields{\n\t\t\"email\": req.Email,\n\t\t\"password\": strings.Repeat(\"*\", len(req.Password)),\n\t}).Debugf(\"controllers/auth.go - Signin() -\")\n\n\tvalErrors := utils.ValidateStruct(req)\n\tif len(valErrors) != 0 {\n\t\tutils.Log.Errorf(\"Validation errors: %s\", valErrors)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(map[string][]string{\n\t\t\t\"errors\": valErrors,\n\t\t})\n\t\treturn\n\t}\n\n\tcount, err := db.DB.EmailExists(r.Context(), req.Email)\n\tif err != nil {\n\t\tutils.Log.Error(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t} else if count == 0 {\n\t\tutils.Log.Errorf(\"Email: %s does not exists!\", req.Email)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tjson.NewEncoder(w).Encode(map[string]string{\n\t\t\t\"errors\": \"Email does not exist!\",\n\t\t})\n\t\treturn\n\t}\n\n\tuser, err := db.DB.GetUserByEmail(r.Context(), req.Email)\n\tif err != nil {\n\t\tutils.Log.Error(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = utils.ComparePassword(req.Password, user.Password)\n\tif err != nil {\n\t\tutils.Log.Error(err)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\taccessToken, err := utils.CreateToken(user.Username, time.Minute*5, \"keys/private-key.pem\")\n\tif err != nil {\n\t\tutils.Log.Error(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(map[string]string{\n\t\t\"token\": accessToken,\n\t})\n}", "title": "" }, { "docid": "68edeec7eaaa39adac1239ff79024a0e", "score": "0.5087515", "text": "func SignInGet(c *gin.Context) {\n\th := DefaultH(c)\n\th[\"Title\"] = \"Sign in\"\n\tsession := sessions.Default(c)\n\th[\"Flash\"] = session.Flashes()\n\tsession.Save()\n\tc.HTML(http.StatusOK, \"auth/signin\", h)\n}", "title": "" }, { "docid": "3bc46e66d81f7a6bfdfe2eaa6ca36eea", "score": "0.50606453", "text": "func NewSecureEndpoints(s Service, authBasicAuthFn security.AuthorizeBasicAuthFunc, authJWTFn security.AuthorizeJWTFunc, authAPIKeyFn security.AuthorizeAPIKeyFunc, authOAuth2Fn security.AuthorizeOAuth2Func) *Endpoints {\n\treturn &Endpoints{\n\t\tSignin: SecureSignin(NewSigninEndpoint(s), authBasicAuthFn),\n\t\tSecure: SecureSecure(NewSecureEndpoint(s), authJWTFn),\n\t\tDoublySecure: SecureDoublySecure(NewDoublySecureEndpoint(s), authJWTFn, authAPIKeyFn),\n\t\tAlsoDoublySecure: SecureAlsoDoublySecure(NewAlsoDoublySecureEndpoint(s), authJWTFn, authAPIKeyFn, authOAuth2Fn, authBasicAuthFn),\n\t}\n}", "title": "" }, { "docid": "201f3186dd1c8f678648d76c9da543c8", "score": "0.5035148", "text": "func NewClient(signin, secure, doublySecure, alsoDoublySecure goa.Endpoint) *Client {\n\treturn &Client{\n\t\tSigninEndpoint: signin,\n\t\tSecureEndpoint: secure,\n\t\tDoublySecureEndpoint: doublySecure,\n\t\tAlsoDoublySecureEndpoint: alsoDoublySecure,\n\t}\n}", "title": "" }, { "docid": "e6d33a3dfcbbe2f6b78be1fab8517baf", "score": "0.50164104", "text": "func (a *Auth) SignIn(ctx *apiserv.Context) apiserv.Response {\n\ttok := jwt.NewWithClaims(a.SigningMethod, a.NewClaims())\n\textra, key, err := a.AuthToken(ctx, Token{Token: tok})\n\tif err != nil {\n\t\treturn apiserv.NewJSONErrorResponse(http.StatusUnauthorized, err)\n\t}\n\n\tsigned, err := a.signAndSetHeaders(ctx, Token{Token: tok}, key)\n\tif err != nil {\n\t\t// only reason this would return an error is if there's something wrong with internal.Marshal\n\t\treturn apiserv.NewJSONErrorResponse(http.StatusInternalServerError, err)\n\t}\n\n\tif extra == nil {\n\t\textra = apiserv.M{}\n\t}\n\n\textra[\"access_token\"] = signed\n\n\treturn apiserv.NewJSONResponse(extra)\n}", "title": "" }, { "docid": "95157b3c3f09406239394f7d85460d85", "score": "0.49464554", "text": "func NewSigninPayload() *account.SigninPayload {\n\treturn &account.SigninPayload{}\n}", "title": "" }, { "docid": "743b7b1c538288ff2749874ccfe7ce97", "score": "0.49350873", "text": "func postSignin(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotImplemented)\n}", "title": "" }, { "docid": "1eaa89edb1a9c4916fff98f7adf20f61", "score": "0.4931736", "text": "func SignIn(w http.ResponseWriter, r *http.Request){\n\tvar cred Credentials\n\n\terr:= json.NewDecoder(r.Body).Decode(&cred)\n\tif err != nil{\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcorrectPass,ok := users[cred.Username]\n\n\tif !ok || correctPass != cred.Password{\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\texpirationTime := time.Now().Add(5 * time.Minute)\n\t// Create the JWT claims, which includes the username and expiry time\n\tclaims := &Claims{\n\t\tUsername: cred.Username,\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\t// In JWT, the expiry time is expressed as unix milliseconds\n\t\t\tExpiresAt: expirationTime.Unix(),\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttokenString, err := token.SignedString(jwtKey)\n\n\tif err != nil{\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\thttp.SetCookie(w, &http.Cookie{\n\t\tName: \"token\",\n\t\tValue: tokenString,\n\t\tExpires: expirationTime,\n\t})\n\n}", "title": "" }, { "docid": "3c19c003e3caf47316b4ca4d4785b6b1", "score": "0.48788553", "text": "func NewSigninResponseBody(res *securedservice.Creds) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tJWT: res.JWT,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "ca9e1d2d4b4f8e476e83cdb57337eb80", "score": "0.48762763", "text": "func SignIn() {\n\t// WIP\n}", "title": "" }, { "docid": "2a95c3ce503420551817404b89538ebf", "score": "0.486708", "text": "func SignIn(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"Content-type\", \"application/json\")\n\n\tvar user models.User\n\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\tif err != nil {\n\t\thttp.Error(w, \"Content Invalid\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif len(user.Email) == 0 {\n\t\thttp.Error(w, \"Email is required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcurrentUser, exists := models.CheckSignIn(user.Email, user.Password)\n\tif exists == false {\n\t\thttp.Error(w, \"Incorrect user or password\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tpayload := jwt.MapClaims{\n\t\t\"_id\": currentUser.ID.Hex(),\n\t\t\"name\": currentUser.Name,\n\t\t\"lastName\": currentUser.LastName,\n\t\t\"birthDate\": currentUser.BirthDate,\n\t\t\"email\": currentUser.Email,\n\t\t\"avatar\": currentUser.Avatar,\n\t\t\"banner\": currentUser.Banner,\n\t\t\"biography\": currentUser.Biography,\n\t\t\"location\": currentUser.Location,\n\t\t\"webSite\": currentUser.WebSite,\n\t\t\"exp\": time.Now().Add(time.Hour * 24).Unix(),\n\t}\n\n\tjwtKey, err := jwtServices.GenerateJWT(payload)\n\tif err != nil {\n\t\thttp.Error(w, \"the request could not be processed\", http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tdataResponse := structs.ReponseSignIn{\n\t\tToken: jwtKey,\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(dataResponse)\n\n\texpirateTime := time.Now().Add(24 * time.Hour)\n\thttp.SetCookie(w, &http.Cookie{\n\t\tName: \"token\",\n\t\tValue: jwtKey,\n\t\tExpires: expirateTime,\n\t})\n}", "title": "" }, { "docid": "8f15064d3fa9179110d7705036e8bd6f", "score": "0.48592752", "text": "func (c *Client) NewSigninJWTRequest(ctx context.Context, path string, payload *Credentials) (*http.Request, error) {\n\tvar body bytes.Buffer\n\terr := c.Encoder.Encode(payload, &body, \"*/*\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"POST\", u.String(), &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treturn req, nil\n}", "title": "" }, { "docid": "4c640bd6f2eeea2817d3ed01eaf7f711", "score": "0.48570362", "text": "func (app *UserApp) SignInHandler(w http.ResponseWriter, r *http.Request) (int, interface{}, error) {\n\tvar param schema.ArtiefactUserSignInRequest\n\n\t// Validate the JSON coming in with the appropriate JSON-Schema Validator\n\tres, err := schema.Validate(&param, schema.ArtiefactUserSignInValidator, r)\n\tfmt.Println(res)\n\tif err != nil {\n\t\te := c.ErrorInternalServer()\n\t\te.AddDetail(c.ErrorAction(\"validating\", \"request\"))\n\t\tfmt.Println(err.Error())\n\t\treturn e.GenerateResponse()\n\t}\n\n\t// Begin Database\n\ttx, err := app.DB.Begin()\n\tif err != nil {\n\t\te := c.ErrorDatabaseBeginFailure()\n\t\tfmt.Println(err.Error())\n\t\treturn e.GenerateResponse()\n\t}\n\tdefer tx.Rollback()\n\n\tau, err := model.GetArtiefactUserByUsername(tx, param.Username)\n\tif err != nil {\n\t\te := c.ErrorInternalServer()\n\t\te.AddDetail(c.ErrorAction(\"querying\", \"artiefact_user\"))\n\t\tfmt.Println(err.Error())\n\t\treturn e.GenerateResponse()\n\t}\n\tif au == nil {\n\t\te := c.ErrorObjectNotFound(\"artiefact_user\")\n\t\treturn e.GenerateResponse()\n\t}\n\n\tmatch, err := service.AuthenticatePassword(param.Password, au.Password, app.Config.PasswordPepper)\n\tif err != nil {\n\t\te := c.ErrorInternalServer()\n\t\te.AddDetail(c.ErrorAction(\"authenticating\", \"password\"))\n\t\tfmt.Println(err.Error())\n\t\treturn e.GenerateResponse()\n\t}\n\tif !match {\n\t\te := c.ErrorAuthenticationFailure()\n\t\treturn e.GenerateResponse()\n\t}\n\n\t// Generate Token\n\ttokenGeneratedDatetime := time.Now()\n\ttokenExpiryDatetime := tokenGeneratedDatetime.AddDate(1, 0, 0)\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"user_id\": au.ID,\n\t\t\"expiry_datetime\": tokenExpiryDatetime,\n\t\t\"obtained_by\": c.TokenObtainedBySignup,\n\t\t\"tokenType\": c.TokenTypeLogin,\n\t})\n\n\t// Sign and get the complete encoded token as a string using the secret\n\ttokenString, err := token.SignedString([]byte(app.Config.TokenSecret))\n\n\tnewToken := model.AccessToken{\n\t\tToken: tokenString,\n\t\tUserID: au.ID,\n\t\tGeneratedDatetime: tokenGeneratedDatetime,\n\t\tExpiryDatetime: tokenExpiryDatetime,\n\t\tObtainedBy: c.TokenObtainedBySignup,\n\t\tActive: true,\n\t}\n\n\terr = newToken.Create(tx)\n\tif err != nil {\n\t\te := c.ErrorInternalServer()\n\t\te.AddDetail(c.ErrorAction(\"creating\", \"token\"))\n\t\tfmt.Println(err.Error())\n\t\treturn e.GenerateResponse()\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\te := c.ErrorDatabaseCommitFailure()\n\t\tfmt.Println(err.Error())\n\t\treturn e.GenerateResponse()\n\t}\n\n\t// Create Response\n\tresToken := schema.AccessToken{\n\t\tToken: newToken.Token,\n\t\tUserID: newToken.UserID,\n\t\tGeneratedDatetime: newToken.GeneratedDatetime,\n\t\tExpiryDatetime: newToken.ExpiryDatetime,\n\t\tObtainedBy: newToken.ObtainedBy,\n\t\tActive: newToken.Active,\n\t}\n\n\tresUser := schema.ArtiefactUser{\n\t\tID: au.ID,\n\t\tBirthday: au.Birthday.Format(c.DateFormat),\n\t\tRegisterDatetime: au.RegisterDatetime,\n\t\tStatus: au.Status,\n\t\tUsername: param.Username,\n\t}\n\n\tresponse := schema.ArtiefactUserSignUpResponse{\n\t\tAccessToken: &resToken,\n\t\tArtiefactUser: &resUser,\n\t}\n\n\treturn http.StatusOK, response, nil\n}", "title": "" }, { "docid": "8f59db59527992dbf3517eeec83a3727", "score": "0.4843397", "text": "func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CognitoIdentity {\n\tsvc := &CognitoIdentity{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: ServiceName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-06-30\",\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"AWSCognitoIdentityService\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\t// Run custom client initialization if present\n\tif initClient != nil {\n\t\tinitClient(svc.Client)\n\t}\n\n\treturn svc\n}", "title": "" }, { "docid": "ab55de458e40ba144e4faacae343b270", "score": "0.482342", "text": "func (u *Users) signIn(w http.ResponseWriter, user *models.User) (string, error) {\n\ttoken, err := u.createToken(user)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "a680fbf738261d641839fa2f1a78a2ca", "score": "0.48212057", "text": "func SignInGet(c *gin.Context) {\r\n\th := DefaultH(c)\r\n\th[\"Title\"] = \"Вход в систему\"\r\n\tsession := sessions.Default(c)\r\n\th[\"Flash\"] = session.Flashes()\r\n\tsession.Save()\r\n\tc.HTML(http.StatusOK, \"auth/signin\", h)\r\n}", "title": "" }, { "docid": "09b5544630634b6321590d2ab31f0069", "score": "0.48135698", "text": "func (p *Authenticate) SignIn(w http.ResponseWriter, r *http.Request) {\n\t// We attempt to authenticate the user. If they cannot be authenticated, we render a sign-in\n\t// page.\n\t//\n\t// If the user is authenticated, we redirect back to the proxy application\n\t// at the `redirect_uri`, with a temporary token.\n\t//\n\t// TODO: It is possible for a user to visit this page without a redirect destination.\n\t// Should we allow the user to authenticate? If not, what should be the proposed workflow?\n\n\tsession, err := p.authenticate(w, r)\n\tswitch err {\n\tcase nil:\n\t\t// User is authenticated, redirect back to the proxy application\n\t\t// with the necessary state\n\t\tp.ProxyOAuthRedirect(w, r, session)\n\tcase http.ErrNoCookie:\n\t\tlog.Error().Err(err).Msg(\"authenticate.SignIn : err no cookie\")\n\t\tif p.skipProviderButton {\n\t\t\tp.skipButtonOAuthStart(w, r)\n\t\t} else {\n\t\t\tp.SignInPage(w, r)\n\t\t}\n\tcase sessions.ErrLifetimeExpired, sessions.ErrInvalidSession:\n\t\tlog.Error().Err(err).Msg(\"authenticate.SignIn\")\n\t\tp.sessionStore.ClearSession(w, r)\n\t\tif p.skipProviderButton {\n\t\t\tp.skipButtonOAuthStart(w, r)\n\t\t} else {\n\t\t\tp.SignInPage(w, r)\n\t\t}\n\tdefault:\n\t\tlog.Error().Err(err).Msg(\"authenticate.SignIn : unknown error cookie\")\n\t\thttputil.ErrorResponse(w, r, err.Error(), httputil.CodeForError(err))\n\t}\n}", "title": "" }, { "docid": "b234d9b5237f6b0aa741cf163fc2b8c2", "score": "0.48066956", "text": "func NewAdminSigninHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdec func(*http.Request) goahttp.Decoder,\n\tenc func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\teh func(context.Context, http.ResponseWriter, error),\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeAdminSigninRequest(mux, dec)\n\t\tencodeResponse = EncodeAdminSigninResponse(enc)\n\t\tencodeError = EncodeAdminSigninError(enc)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"admin signin\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"Admin\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\teh(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tres, err := endpoint(ctx, payload)\n\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\teh(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\teh(ctx, w, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "0a1b1b5e382c239a1af298ed30858947", "score": "0.4805685", "text": "func (ag *AuthGroup) SignIn(w http.ResponseWriter, r *http.Request) error {\n\tctx := r.Context()\n\n\tvar decodedUser entity.User\n\terr := json.NewDecoder(r.Body).Decode(&decodedUser)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttokenPair, err := ag.AuthService.SignIn(ctx, decodedUser)\n\tif err != nil {\n\t\t// Check error if tokens already issued\n\t\tif strings.Contains(err.Error(), \"duplicate\") {\n\t\t\treturn nil\n\t\t}\n\t\treturn nil\n\t}\n\n\treturn respond(ctx, w, tokenPair, http.StatusOK)\n}", "title": "" }, { "docid": "6510c68a3855416a2c2cf489700ac5f9", "score": "0.4755558", "text": "func (s *service) OIDCEndpoints(router gin.IRouter) error {\n\tctx := context.Background()\n\n\t// Get configuration\n\tcfg := s.cfgManager.GetConfig()\n\n\t// Create provider\n\tprovider, err := oidc.NewProvider(ctx, cfg.OIDCAuthentication.IssuerURL)\n\t// Check error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create provider endpoints claims\n\tpec := &providerEndpointsClaims{}\n\t// Get claims\n\terr = provider.Claims(pec)\n\t// Check error\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse logout endpoint\n\teseURL, err := url.Parse(pec.EndSessionEndpoint)\n\t// Check error\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Save url\n\tpec.EndSessionEndpointURL = eseURL\n\n\toidcConfig := &oidc.Config{\n\t\tClientID: cfg.OIDCAuthentication.ClientID,\n\t}\n\tverifier := provider.Verifier(oidcConfig)\n\n\t// Build redirect url\n\tmainRedirectURLObject, err := url.Parse(cfg.OIDCAuthentication.RedirectURL)\n\t// Check if error exists\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Continue to build redirect url\n\tmainRedirectURLObject.Path = path.Join(mainRedirectURLObject.Path, callbackPath)\n\tmainRedirectURLStr := mainRedirectURLObject.String()\n\n\t// Create OIDC configuration\n\tconfig := oauth2.Config{\n\t\tClientID: cfg.OIDCAuthentication.ClientID,\n\t\tEndpoint: provider.Endpoint(),\n\t\tScopes: cfg.OIDCAuthentication.Scopes,\n\t\tRedirectURL: mainRedirectURLStr,\n\t}\n\tif cfg.OIDCAuthentication.ClientSecret != nil {\n\t\tconfig.ClientSecret = cfg.OIDCAuthentication.ClientSecret.Value\n\t}\n\n\t// Store state\n\tstate := cfg.OIDCAuthentication.State\n\n\t// Store provider verifier in map\n\ts.verifier = verifier\n\n\t// Login mount point\n\trouter.GET(loginPath, func(c *gin.Context) {\n\t\t// Get redirect query from query params\n\t\trdVal := c.Query(redirectQueryKey)\n\t\t// Build new state with redirect value\n\t\t// Same solution as here: https://github.com/oauth2-proxy/oauth2-proxy/blob/3fa42edb7350219d317c4bd47faf5da6192dc70f/oauthproxy.go#L751\n\t\tnewState := state + stateRedirectSeparator + rdVal\n\n\t\tc.Redirect(http.StatusFound, config.AuthCodeURL(newState))\n\t\tc.Abort()\n\t})\n\n\t// Logout mount point\n\trouter.GET(logoutPath, func(c *gin.Context) {\n\t\t// Initialize redirect to\n\t\trdTo := \"/\"\n\t\t// Check if logout url exists and logout redirect url exists\n\t\tif pec.EndSessionEndpoint != \"\" && cfg.OIDCAuthentication.LogoutRedirectURL != \"\" {\n\t\t\t// Parse logout url\n\t\t\tlgURL := *pec.EndSessionEndpointURL\n\t\t\t// Get params\n\t\t\tqs := lgURL.Query()\n\t\t\t// Add param\n\t\t\tqs.Add(\"redirect_uri\", cfg.OIDCAuthentication.LogoutRedirectURL)\n\t\t\t// Save them\n\t\t\tlgURL.RawQuery = qs.Encode()\n\t\t\t// Encode\n\t\t\trdTo = lgURL.String()\n\t\t}\n\n\t\t// Flush auth cookie\n\t\tflushAuthCookie(c, cfg)\n\t\t// Redirect\n\t\tc.Redirect(http.StatusFound, rdTo)\n\t\tc.Abort()\n\t})\n\n\t// Redirect mount point\n\trouter.GET(mainRedirectURLObject.Path, func(c *gin.Context) {\n\t\t// Get logger from request\n\t\tlogger := log.GetLoggerFromGin(c)\n\n\t\t// Get state from request\n\t\treqQueryState := c.Query(\"state\")\n\t\t// Check if state exists\n\t\tif reqQueryState == \"\" {\n\t\t\terr := cerrors.NewInvalidInputError(\"state not found in request\")\n\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\n\t\t// Split request query state to get redirect url and original state\n\t\tsplit := strings.SplitN(reqQueryState, stateRedirectSeparator, stateLength)\n\t\t// Prepare and affect values\n\t\treqState := split[0]\n\t\trdVal := \"\"\n\t\t// Check if length is ok to include a redirect url\n\t\tif len(split) == stateLength {\n\t\t\trdVal = split[1]\n\t\t}\n\n\t\t// Check state\n\t\tif reqState != state {\n\t\t\terr := cerrors.NewInvalidInputError(\"state did not match\")\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\n\t\t// Check if rdVal exists and that redirect url value is valid\n\t\tif rdVal != \"\" && !isValidRedirect(rdVal) {\n\t\t\terr := cerrors.NewInvalidInputError(\"redirect url is invalid\")\n\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\n\t\toauth2Token, err := config.Exchange(ctx, c.Query(\"code\"))\n\t\tif err != nil {\n\t\t\terr = cerrors.NewInternalServerError(\"failed to exchange token: \" + err.Error())\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\n\t\trawIDToken, ok := oauth2Token.Extra(\"id_token\").(string)\n\t\tif !ok {\n\t\t\terr = cerrors.NewInternalServerError(\"no id_token field in token\")\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\n\t\tidToken, err := verifier.Verify(ctx, rawIDToken)\n\t\tif err != nil {\n\t\t\terr = cerrors.NewInternalServerError(\"failed to verify ID Token: \" + err.Error())\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\n\t\tvar resp models.OIDCUser\n\n\t\t// Try to open JWT token in order to verify that we can open it\n\t\terr = idToken.Claims(&resp)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\tutils.AnswerWithError(c, err)\n\n\t\t\treturn\n\t\t}\n\t\tresp.OriginalToken = rawIDToken\n\t\t// Now, we know that we can open jwt token to get claims\n\n\t\t// Build cookie\n\t\tcookie := &http.Cookie{\n\t\t\tExpires: oauth2Token.Expiry,\n\t\t\tName: cfg.OIDCAuthentication.CookieName,\n\t\t\tValue: rawIDToken,\n\t\t\tHttpOnly: true,\n\t\t\tSecure: cfg.OIDCAuthentication.CookieSecure,\n\t\t\tPath: \"/\",\n\t\t}\n\n\t\t// Set cookie\n\t\thttp.SetCookie(c.Writer, cookie)\n\n\t\t// Manage default redirect case\n\t\tif rdVal == \"\" {\n\t\t\trdVal = \"/\"\n\t\t}\n\n\t\tlogger.Info(\"Successful authentication detected\")\n\t\tc.Redirect(http.StatusTemporaryRedirect, rdVal)\n\t\tc.Abort()\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "a3ea25dbdf36452e9558825fe6a31264", "score": "0.47526538", "text": "func SignIn(w http.ResponseWriter, r *http.Request) {\n\tif GlobalCorsEnabled {\n\t\tenableCors(&w)\n\t}\n\n\tvar credentials Credentials\n\t// Get the JSON body and decode into credentials\n\terr := json.NewDecoder(r.Body).Decode(&credentials)\n\tif err != nil {\n\t\t// If the structure of the body is wrong, return an HTTP error\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Get the expected password from our in memory map\n\texpectedPassword, ok := users.Users[credentials.Username]\n\n\t// If a password exists for the given user\n\t// AND, if it is the same as the password we received, the we can move ahead\n\t// if NOT, then we return an \"Unauthorized\" status\n\tif !ok || !comparePasswords(expectedPassword, []byte(credentials.Password)) {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Declare the expiration time of the token\n\t// here, we have kept it as 5 minutes\n\texpirationTime := time.Now().Add(time.Duration(JwtTokenLifeInMinutes) * time.Minute)\n\n\t// Create the JWT token and claims, which includes the username and expiry time\n\ttoken := lestjwt.New()\n\tclaims := MaClaims{\n\t\tUsername: credentials.Username,\n\t\tRoles: users.UserRoles[credentials.Username],\n\t\tExpiresAt: expirationTime.Unix(),\n\t}\n\n\t// set the claims into the token\n\taddClaims(&token, &claims)\n\n\t// Sign the token and generate a payload\n\tsigned, err := lestjwt.Sign(token, jwa.HS256, jwtKey)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to generate signed payload: %s\\n\", err)\n\t\treturn\n\t}\n\n\twhiteListTokens = append(whiteListTokens, string(signed))\n\n\t// This is what you typically get as a signed JWT from a server\n\t_, _ = w.Write([]byte(fmt.Sprintf(\"%s\", string(signed))))\n}", "title": "" }, { "docid": "15a1b25b311ec99fdcdbf2608e84b9d8", "score": "0.4752293", "text": "func introspectionEndpoint(rw http.ResponseWriter, req *http.Request) {\n\tlog.Println(\"introspectionEndpoint called\")\n\tctx := req.Context()\n\tmySessionData := newSession(\"\")\n\tir, err := oauth2.NewIntrospectionRequest(ctx, req, mySessionData)\n\tif err != nil {\n\t\tlog.Printf(\"Error occurred in NewIntrospectionRequest: %+v\", err)\n\t\toauth2.WriteIntrospectionError(rw, err)\n\t\treturn\n\t}\n\n\toauth2.WriteIntrospectionResponse(rw, ir)\n}", "title": "" }, { "docid": "3e30a738f76de247008e6936e2123e6c", "score": "0.47223714", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tDefault: NewDefaultEndpoint(s, a.BasicAuth),\n\t}\n}", "title": "" }, { "docid": "7b363764859b3567c0f6afaae442f0d1", "score": "0.47098896", "text": "func NewSigninJWTContext(ctx context.Context, r *http.Request, service *goa.Service) (*SigninJWTContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := SigninJWTContext{Context: ctx, ResponseData: resp, RequestData: req}\n\treturn &rctx, err\n}", "title": "" }, { "docid": "7b363764859b3567c0f6afaae442f0d1", "score": "0.47098896", "text": "func NewSigninJWTContext(ctx context.Context, r *http.Request, service *goa.Service) (*SigninJWTContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := SigninJWTContext{Context: ctx, ResponseData: resp, RequestData: req}\n\treturn &rctx, err\n}", "title": "" }, { "docid": "47af954186431aa833ea00c9cb7943d3", "score": "0.4708578", "text": "func (p *Authenticate) SignInPage(w http.ResponseWriter, r *http.Request) {\n\tredirectURL := p.RedirectURL.ResolveReference(r.URL)\n\tdestinationURL, _ := url.Parse(redirectURL.Query().Get(\"redirect_uri\")) // checked by middleware\n\tt := struct {\n\t\tProviderName string\n\t\tAllowedDomains []string\n\t\tRedirect string\n\t\tDestination string\n\t\tVersion string\n\t}{\n\t\tProviderName: p.provider.Data().ProviderName,\n\t\tAllowedDomains: p.AllowedDomains,\n\t\tRedirect: redirectURL.String(),\n\t\tDestination: destinationURL.Host,\n\t\tVersion: version.FullVersion(),\n\t}\n\tlog.FromRequest(r).Debug().\n\t\tStr(\"ProviderName\", p.provider.Data().ProviderName).\n\t\tStr(\"Redirect\", redirectURL.String()).\n\t\tStr(\"Destination\", destinationURL.Host).\n\t\tStr(\"AllowedDomains\", strings.Join(p.AllowedDomains, \", \")).\n\t\tMsg(\"authenticate: SignInPage\")\n\tw.WriteHeader(http.StatusOK)\n\tp.templates.ExecuteTemplate(w, \"sign_in.html\", t)\n}", "title": "" }, { "docid": "705662f60b96912d54980290f4d4089a", "score": "0.46988386", "text": "func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *DirectConnect {\n\tsvc := &DirectConnect{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: ServiceName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2012-10-25\",\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"OvertureService\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\t// Run custom client initialization if present\n\tif initClient != nil {\n\t\tinitClient(svc.Client)\n\t}\n\n\treturn svc\n}", "title": "" }, { "docid": "88d7ecf35f95fc6dd0bd510cfbe9bc49", "score": "0.46961322", "text": "func Sign(keys *Keys, r *http.Request) error {\n\tparts := strings.Split(r.Host, \".\")\n\tif len(parts) < 4 {\n\t\treturn fmt.Errorf(\"Invalid AWS Endpoint: %s\", r.Host)\n\t}\n\tsv := new(Service)\n\tsv.Name = parts[0]\n\tsv.Region = parts[1]\n\tsv.Sign(keys, r)\n\treturn nil\n}", "title": "" }, { "docid": "e67a6d5f5273f29e8e0cd61869d5e276", "score": "0.46823597", "text": "func NewAlsoDoublySecureEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc, authOAuth2Fn security.AuthOAuth2Func, authBasicFn security.AuthBasicFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req any) (any, error) {\n\t\tp := req.(*AlsoDoublySecurePayload)\n\t\tvar err error\n\t\tsc := security.JWTScheme{\n\t\t\tName: \"jwt\",\n\t\t\tScopes: []string{\"api:read\", \"api:write\"},\n\t\t\tRequiredScopes: []string{\"api:read\", \"api:write\"},\n\t\t}\n\t\tvar token string\n\t\tif p.Token != nil {\n\t\t\ttoken = *p.Token\n\t\t}\n\t\tctx, err = authJWTFn(ctx, token, &sc)\n\t\tif err == nil {\n\t\t\tsc := security.APIKeyScheme{\n\t\t\t\tName: \"api_key\",\n\t\t\t\tScopes: []string{},\n\t\t\t\tRequiredScopes: []string{\"api:read\", \"api:write\"},\n\t\t\t}\n\t\t\tvar key string\n\t\t\tif p.Key != nil {\n\t\t\t\tkey = *p.Key\n\t\t\t}\n\t\t\tctx, err = authAPIKeyFn(ctx, key, &sc)\n\t\t}\n\t\tif err != nil {\n\t\t\tsc := security.OAuth2Scheme{\n\t\t\t\tName: \"oauth2\",\n\t\t\t\tScopes: []string{\"api:read\", \"api:write\"},\n\t\t\t\tRequiredScopes: []string{\"api:read\", \"api:write\"},\n\t\t\t\tFlows: []*security.OAuthFlow{\n\t\t\t\t\t&security.OAuthFlow{\n\t\t\t\t\t\tType: \"authorization_code\",\n\t\t\t\t\t\tAuthorizationURL: \"http://goa.design/authorization\",\n\t\t\t\t\t\tTokenURL: \"http://goa.design/token\",\n\t\t\t\t\t\tRefreshURL: \"http://goa.design/refresh\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tvar token string\n\t\t\tif p.OauthToken != nil {\n\t\t\t\ttoken = *p.OauthToken\n\t\t\t}\n\t\t\tctx, err = authOAuth2Fn(ctx, token, &sc)\n\t\t\tif err == nil {\n\t\t\t\tsc := security.BasicScheme{\n\t\t\t\t\tName: \"basic\",\n\t\t\t\t\tScopes: []string{\"api:read\"},\n\t\t\t\t\tRequiredScopes: []string{\"api:read\", \"api:write\"},\n\t\t\t\t}\n\t\t\t\tvar user string\n\t\t\t\tif p.Username != nil {\n\t\t\t\t\tuser = *p.Username\n\t\t\t\t}\n\t\t\t\tvar pass string\n\t\t\t\tif p.Password != nil {\n\t\t\t\t\tpass = *p.Password\n\t\t\t\t}\n\t\t\t\tctx, err = authBasicFn(ctx, user, pass, &sc)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn s.AlsoDoublySecure(ctx, p)\n\t}\n}", "title": "" }, { "docid": "72ded08b4e3f183af7ef85d01d72739c", "score": "0.46816844", "text": "func pubsubSignin(key []byte) (*pubsub.Service, error) {\n\n\t// Create JWT from key file\n\tconfig, err := google.JWTConfigFromJSON(key)\n\tif err != nil {\n\t\treturn nil, errors.New(\"JWTConfigFromJSON: \" + err.Error())\n\t}\n\n\t// Access scope\n\tconfig.Scopes = []string{pubsub.PubsubScope}\n\n\t// Create service client.\n\tclient := config.Client(oauth2.NoContext)\n\n\t// Connect to Google Pubsub\n\tsvc, err := pubsub.New(client)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Create client: \" + err.Error())\n\t}\n\n\treturn svc, nil\n\n}", "title": "" }, { "docid": "c01e294c7ff36ef0ee59d273a11d2d9b", "score": "0.46815592", "text": "func SignIn(w http.ResponseWriter, r *http.Request) *models.User {\n\tr.ParseForm()\n\tu := newUser(\"\", r.FormValue(\"email\"), r.FormValue(\"password\"))\n\tif len(u.Email) == 0 || len(u.Password) == 0 {\n\t\tutils.Respond(1, \"Invalid submission\", http.StatusBadRequest, w, r)\n\t\treturn nil\n\t}\n\n\tif ok, _ := regexp.MatchString(`^([\\w\\.\\_]{2,10})@(\\w{1,}).([a-z]{2,4})$`, u.Email); !ok {\n\t\tutils.Respond(1, \"Invalid email\", http.StatusBadRequest, w, r)\n\t\treturn nil\n\t}\n\n\tuser, err := getUserByEmail(u.Email)\n\tif err != nil {\n\t\tutils.Respond(1, \"Error\", http.StatusInternalServerError, w, r)\n\t\treturn nil\n\t}\n\n\tif err := bcrypt.CompareHashAndPassword(user.Password, u.Password); err != nil {\n\t\tutils.Respond(1, \"Authentication failed\", http.StatusOK, w, r)\n\t\treturn nil\n\t}\n\n\treturn user\n}", "title": "" }, { "docid": "d5a7061b4b1e1b39185754b08512f04a", "score": "0.46801373", "text": "func NewAuthenticationAPI(postgresUrl, tokenRedirectUrl string) *gin.Engine {\n // set global configuration for module\n cfg = &AuthConfig{\n TokenRedirectURL: tokenRedirectUrl,\n }\n // generate new instance of gin router and add routes\n router := gin.Default()\n router.Use(TimerMiddleware())\n\n // generate new jaeger config\n config := jaeger.Config(\"jaeger-agent\", \"identity-provider\", 6831)\n jaeger.NewTracer(config)\n router.Use(jaeger.JaegerNegroni(config))\n\n router.GET(\"/health_check\", healthCheckHandler)\n // define POST routes\n router.POST(\"/signup\", PostgresSessionMiddleware(postgresUrl),\n signUpHandler)\n router.POST(\"/token\", PostgresSessionMiddleware(postgresUrl),\n loginHandler)\n\n return router\n}", "title": "" }, { "docid": "b26232e24b755596359b86a99ba3ecec", "score": "0.46682626", "text": "func NewSigninJWTContext(ctx context.Context, r *http.Request, service *goa.Service) (*SigninJWTContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := SigninJWTContext{Context: ctx, ResponseData: resp, RequestData: req}\n\theaderAuthorization := req.Header[\"Authorization\"]\n\tif len(headerAuthorization) == 0 {\n\t\terr = goa.MergeErrors(err, goa.MissingHeaderError(\"Authorization\"))\n\t} else {\n\t\trawAuthorization := headerAuthorization[0]\n\t\treq.Params[\"Authorization\"] = []string{rawAuthorization}\n\t\trctx.Authorization = rawAuthorization\n\t}\n\tparamIsMember := req.Params[\"is_member\"]\n\tif len(paramIsMember) == 0 {\n\t\terr = goa.MergeErrors(err, goa.MissingParamError(\"is_member\"))\n\t} else {\n\t\trawIsMember := paramIsMember[0]\n\t\tif isMember, err2 := strconv.ParseBool(rawIsMember); err2 == nil {\n\t\t\trctx.IsMember = isMember\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"is_member\", rawIsMember, \"boolean\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "title": "" }, { "docid": "ea7227c4f4fb4e09acab1ac9160fdfde", "score": "0.46587816", "text": "func (p *SSOProvider) GetSignInURL(redirectURL *url.URL, state string) *url.URL {\n\ta := *p.Data().SignInURL\n\tnow := time.Now()\n\trawRedirect := redirectURL.String()\n\tparams, _ := url.ParseQuery(a.RawQuery)\n\tparams.Set(\"redirect_uri\", rawRedirect)\n\tparams.Add(\"scope\", p.Scope)\n\tparams.Set(\"client_id\", p.ClientID)\n\tparams.Set(\"response_type\", \"code\")\n\tparams.Add(\"state\", state)\n\tparams.Set(\"ts\", fmt.Sprint(now.Unix()))\n\tparams.Set(\"sig\", p.signRedirectURL(rawRedirect, now))\n\ta.RawQuery = params.Encode()\n\treturn &a\n}", "title": "" }, { "docid": "444629489b488b934287635623bc4aba", "score": "0.4653329", "text": "func New(s service.AuthService, mdw map[string][]endpoint.Middleware) Endpoints {\n\teps := Endpoints{\n\t\tAccessEndpoint: MakeAccessEndpoint(s),\n\t\tBlockUserEndpoint: MakeBlockUserEndpoint(s),\n\t\tFetchUsersEndpoint: MakeFetchUsersEndpoint(s),\n\t\tLoginEndpoint: MakeLoginEndpoint(s),\n\t\tLogoutEndpoint: MakeLogoutEndpoint(s),\n\t\tRegisterEndpoint: MakeRegisterEndpoint(s),\n\t\tUnblockUserEndpoint: MakeUnblockUserEndpoint(s),\n\t\tUserRegistrationAttemptEndpoint: MakeUserRegistrationAttemptEndpoint(s),\n\t\tSearchUsersEndpoint: MakeSearchUsersEndpoint(s),\n\t\tDropUserEndpoint: MakeDropUserEndpoint(s),\n\t\tUpdateUserEndpoint: MakeUpdateUserEndpoint(s),\n\t}\n\tfor _, m := range mdw[\"Register\"] {\n\t\teps.RegisterEndpoint = m(eps.RegisterEndpoint)\n\t}\n\tfor _, m := range mdw[\"Login\"] {\n\t\teps.LoginEndpoint = m(eps.LoginEndpoint)\n\t}\n\tfor _, m := range mdw[\"Access\"] {\n\t\teps.AccessEndpoint = m(eps.AccessEndpoint)\n\t}\n\tfor _, m := range mdw[\"Logout\"] {\n\t\teps.LogoutEndpoint = m(eps.LogoutEndpoint)\n\t}\n\tfor _, m := range mdw[\"UserRegistrationAttempt\"] {\n\t\teps.UserRegistrationAttemptEndpoint = m(eps.UserRegistrationAttemptEndpoint)\n\t}\n\tfor _, m := range mdw[\"FetchUsers\"] {\n\t\teps.FetchUsersEndpoint = m(eps.FetchUsersEndpoint)\n\t}\n\tfor _, m := range mdw[\"BlockUser\"] {\n\t\teps.BlockUserEndpoint = m(eps.BlockUserEndpoint)\n\t}\n\tfor _, m := range mdw[\"UnblockUser\"] {\n\t\teps.UnblockUserEndpoint = m(eps.UnblockUserEndpoint)\n\t}\n\tfor _, m := range mdw[\"SearchUsers\"] {\n\t\teps.SearchUsersEndpoint = m(eps.SearchUsersEndpoint)\n\t}\n\tfor _, m := range mdw[\"DropUser\"] {\n\t\teps.DropUserEndpoint = m(eps.DropUserEndpoint)\n\t}\n\tfor _, m := range mdw[\"UpdateUser\"] {\n\t\teps.UpdateUserEndpoint = m(eps.UpdateUserEndpoint)\n\t}\n\treturn eps\n}", "title": "" }, { "docid": "4bac4d2e3c2f6c69cfeac2997d8dda3a", "score": "0.46422622", "text": "func NewStopEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\treturn nil, s.Stop(ctx)\n\t}\n}", "title": "" }, { "docid": "2c1d0fad3d26fef5de16b7b8633de5e9", "score": "0.4630078", "text": "func NewDoublySecureEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req any) (any, error) {\n\t\tp := req.(*DoublySecurePayload)\n\t\tvar err error\n\t\tsc := security.JWTScheme{\n\t\t\tName: \"jwt\",\n\t\t\tScopes: []string{\"api:read\", \"api:write\"},\n\t\t\tRequiredScopes: []string{\"api:read\", \"api:write\"},\n\t\t}\n\t\tctx, err = authJWTFn(ctx, p.Token, &sc)\n\t\tif err == nil {\n\t\t\tsc := security.APIKeyScheme{\n\t\t\t\tName: \"api_key\",\n\t\t\t\tScopes: []string{},\n\t\t\t\tRequiredScopes: []string{\"api:read\", \"api:write\"},\n\t\t\t}\n\t\t\tctx, err = authAPIKeyFn(ctx, p.Key, &sc)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn s.DoublySecure(ctx, p)\n\t}\n}", "title": "" }, { "docid": "c2c53cf79b032b8323e71a4eb0c9fec5", "score": "0.4627858", "text": "func NewInsecureReceiver(ctx context.Context, uri string) (webhookd.WebhookReceiver, error) {\n\n\twh := InsecureReceiver{}\n\treturn wh, nil\n}", "title": "" }, { "docid": "03f2b358d8df6bebcbe48986ca6190e2", "score": "0.46171403", "text": "func (server *Server) ShopSignIn(admin_email, password string) (string, error) {\n\n\tvar err error\n\n\tshop := models.Shop{}\n\n\terr = server.DB.Debug().Model(models.Shop{}).Where(\"admin_email = ?\", admin_email).Take(&shop).Error\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\terr = models.VerifyPasswordShop(shop.Password, password)\n\tif err != nil && err == bcrypt.ErrMismatchedHashAndPassword {\n\t\treturn \"\", err\n\t}\n\treturn auth.CreateToken(shop.ID)\n}", "title": "" }, { "docid": "447674451f3c520c60fd28df3d450c4e", "score": "0.46135592", "text": "func makeGetEndpoint(svc Loan) endpoint.Endpoint {\n\treturn func(_ context.Context, request interface{}) (interface{}, error) {\n\n\t\treq := request.(models.GetRequest)\n\n\t\treturn svc.Get(req)\n\t}\n}", "title": "" }, { "docid": "6533f3dbfba970dc9466ba9781bb8204", "score": "0.4610225", "text": "func SigninAccountPath() string {\n\treturn \"/signin\"\n}", "title": "" }, { "docid": "fac23c33332f57d6d34f2ed0c9b4de25", "score": "0.4610116", "text": "func newIdentity(prefix, ns, sa string) string {\n\treturn prefix + \"spiffe://\" + trustDomain + \"/ns/\" + ns + \"/sa/\" + sa\n}", "title": "" }, { "docid": "3b5f3f71d9b043b904bbf2c29c8e7eba", "score": "0.45901957", "text": "func NewSecuredService(logger *log.Logger) securedservice.Service {\n\treturn &securedserviceSvc{logger}\n}", "title": "" }, { "docid": "77498a1dbd21e08f0fb008462803e58d", "score": "0.457043", "text": "func NewIdentityService(vm *duktape.Context, context *Context, stub shim.ChaincodeStubInterface) (result *IdentityService) {\n\tlogger.Debug(\"Entering NewIdentityService\", vm, context, &stub)\n\tdefer func() { logger.Debug(\"Exiting NewIdentityService\", result) }()\n\n\t// Ensure the JavaScript stack is reset.\n\tdefer vm.SetTop(vm.GetTop())\n\n\t// Create the new identity service.\n\tresult = &IdentityService{VM: vm, Stub: stub}\n\n\t// Create a new instance of the JavaScript IdentityService class.\n\tvm.PushGlobalObject() // [ global ]\n\tvm.GetPropString(-1, \"composer\") // [ global composer ]\n\tvm.GetPropString(-1, \"IdentityService\") // [ global composer IdentityService ]\n\terr := vm.Pnew(0) // [ global composer theIdentityService ]\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Store the identity service into the global stash.\n\tvm.PushGlobalStash() // [ global composer theIdentityService stash ]\n\tvm.Dup(-2) // [ global composer theIdentityService stash theIdentityService ]\n\tvm.PutPropString(-2, \"identityService\") // [ global composer theIdentityService stash ]\n\tvm.Pop() // [ global composer theIdentityService ]\n\n\t// Bind the methods into the JavaScript object.\n\tvm.PushGoFunction(result.getIdentifier) // [ global composer theIdentityService getIdentifier ]\n\tvm.PutPropString(-2, \"getIdentifier\") // [ global composer theIdentityService ]\n\tvm.PushGoFunction(result.getName) // [ global composer theIdentityService getName ]\n\tvm.PutPropString(-2, \"getName\") // [ global composer theIdentityService ]\n\tvm.PushGoFunction(result.getIssuer) // [ global composer theIdentityService getIssuer ]\n\tvm.PutPropString(-2, \"getIssuer\") // [ global composer theIdentityService ]\n\tvm.PushGoFunction(result.getCertificate) // [ global composer theIdentityService getCertificate ]\n\tvm.PutPropString(-2, \"getCertificate\") // [ global composer theIdentityService ]\n\n\t// Return the new identity service.\n\treturn result\n}", "title": "" }, { "docid": "0ec86a58e16202d97d27ef1fdb66f2f0", "score": "0.45681882", "text": "func MakeGetEndpoint(s service.AuthenticationService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tt, error := s.Get(ctx)\n\t\treturn GetResponse{\n\t\t\tError: error,\n\t\t\tT: t,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "0ec86a58e16202d97d27ef1fdb66f2f0", "score": "0.45681882", "text": "func MakeGetEndpoint(s service.AuthenticationService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tt, error := s.Get(ctx)\n\t\treturn GetResponse{\n\t\t\tError: error,\n\t\t\tT: t,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "d5bb738e44d5b5f260270e5bf7a3c65d", "score": "0.45556396", "text": "func New(opts config.Options) (*Authenticate, error) {\n\tif err := ValidateOptions(opts); err != nil {\n\t\treturn nil, err\n\t}\n\tdecodedCookieSecret, _ := base64.StdEncoding.DecodeString(opts.CookieSecret)\n\tcipher, err := cryptutil.NewCipher(decodedCookieSecret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif opts.CookieDomain == \"\" {\n\t\topts.CookieDomain = sessions.ParentSubdomain(opts.AuthenticateURL.String())\n\t}\n\tcookieStore, err := sessions.NewCookieStore(\n\t\t&sessions.CookieStoreOptions{\n\t\t\tName: opts.CookieName,\n\t\t\tCookieDomain: opts.CookieDomain,\n\t\t\tCookieSecure: opts.CookieSecure,\n\t\t\tCookieHTTPOnly: opts.CookieHTTPOnly,\n\t\t\tCookieExpire: opts.CookieExpire,\n\t\t\tCookieCipher: cipher,\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tredirectURL, _ := urlutil.DeepCopy(opts.AuthenticateURL)\n\tredirectURL.Path = callbackPath\n\tprovider, err := identity.New(\n\t\topts.Provider,\n\t\t&identity.Provider{\n\t\t\tRedirectURL: redirectURL,\n\t\t\tProviderName: opts.Provider,\n\t\t\tProviderURL: opts.ProviderURL,\n\t\t\tClientID: opts.ClientID,\n\t\t\tClientSecret: opts.ClientSecret,\n\t\t\tScopes: opts.Scopes,\n\t\t\tServiceAccount: opts.ServiceAccount,\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Authenticate{\n\t\tSharedKey: opts.SharedKey,\n\t\tRedirectURL: redirectURL,\n\t\ttemplates: templates.New(),\n\t\tsessionStore: cookieStore,\n\t\tcipher: cipher,\n\t\tprovider: provider,\n\t\tcookieSecret: decodedCookieSecret,\n\t\tcookieName: opts.CookieName,\n\t\tcookieDomain: opts.CookieDomain,\n\t}, nil\n}", "title": "" }, { "docid": "fdda0df0e06bb598222407fc5ccdd147", "score": "0.45532748", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tListMine: NewListMineEndpoint(s, a.JWTAuth),\n\t\tStatus: NewStatusEndpoint(s, a.JWTAuth),\n\t\tDownload: NewDownloadEndpoint(s),\n\t\tCsv: NewCsvEndpoint(s, a.JWTAuth),\n\t\tJSONLines: NewJSONLinesEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "f7a1d32c596ba68e4a8988940fa6f331", "score": "0.45477667", "text": "func signIn(resp http.ResponseWriter, req *http.Request) {\n\tenc := json.NewEncoder(resp)\n\n\tresponse, err := persona.VerifyAssertion(\"http://localhost:8080/\", req.FormValue(\"assertion\"))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif response.OK() {\n\t\tsetSessionCookie(resp, response.Email, response.Expires)\n\n\t\tif !userExists(response.Email) {\n\t\t\taddUser(response.Email)\n\t\t}\n\n\t\tresp.WriteHeader(http.StatusOK)\n\t\tlog.Println(\"sign in :\", response.Email)\n\t} else {\n\t\tresp.WriteHeader(http.StatusUnauthorized)\n\t}\n\n\tenc.Encode(response)\n}", "title": "" }, { "docid": "142da5ff590f75ae5ab8fe56bfd289d2", "score": "0.45392454", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tGet: NewGetEndpoint(s, a.JWTAuth),\n\t\tList: NewListEndpoint(s, a.JWTAuth),\n\t\tUpdate: NewUpdateEndpoint(s, a.JWTAuth),\n\t\tCreate: NewCreateEndpoint(s, a.JWTAuth),\n\t\tDelete: NewDeleteEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "1e4daab01346c3c6e8496fb84d0816ee", "score": "0.45225638", "text": "func New(logger *cl.CustomLogger, mws []Middleware, SvcConfs ...SvcConf) IAuthNService {\n\tsvc := NewBasicAuthNService()\n\tsvc.cl = logger\n\tfor _, configure := range SvcConfs {\n\t\tif configure != nil {\n\t\t\tif err := configure(svc); err != nil {\n\t\t\t\tlogger.Error(context.TODO(), fmt.Sprintf(\"svc err: %v\", err))\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\n\tvar s IAuthNService\n\ts = svc\n\tvar counter int = 0\n\tfor _, m := range mws {\n\t\ts = m(s)\n\t\tcounter++\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "2c3ce82b87f6697c8b29a6c953d72c30", "score": "0.45211706", "text": "func NewSignerListenerEndpoint(\n\tlogger log.Logger,\n\tlistener net.Listener,\n) *SignerListenerEndpoint {\n\tsc := &SignerListenerEndpoint{\n\t\tlistener: listener,\n\t\ttimeoutAccept: defaultTimeoutAcceptSeconds * time.Second,\n\t}\n\n\tsc.BaseService = *cmn.NewBaseService(logger, \"SignerListenerEndpoint\", sc)\n\tsc.signerEndpoint.timeoutReadWrite = defaultTimeoutReadWriteSeconds * time.Second\n\treturn sc\n}", "title": "" }, { "docid": "c37aab13110dcd6a8254a6edd5beb4ff", "score": "0.45142764", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tRoles: NewRolesEndpoint(s, a.JWTAuth),\n\t\tDelete: NewDeleteEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "74183dbaea3853ccf063f419dbfc9120", "score": "0.45123586", "text": "func NewGetEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*GetPayload)\n\t\tvar err error\n\t\tsc := security.JWTScheme{\n\t\t\tName: \"jwt\",\n\t\t\tScopes: []string{\"role:user\", \"role:admin\"},\n\t\t\tRequiredScopes: []string{\"role:user\"},\n\t\t}\n\t\tctx, err = authJWTFn(ctx, p.Token, &sc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres, err := s.Get(ctx, p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvres := NewViewedProduct(res, \"default\")\n\t\treturn vres, nil\n\t}\n}", "title": "" }, { "docid": "bde34b925c70b629c10d2bd2695feb36", "score": "0.45066863", "text": "func NewEndpointIn(url string, version int32, ) *EndpointIn {\n\tthis := EndpointIn{}\n\tthis.Url = url\n\tthis.Version = version\n\tvar description string = \"\"\n\tthis.Description = &description\n\treturn &this\n}", "title": "" }, { "docid": "cf7691f6bc95bb527b1b30f4870a6071", "score": "0.4505856", "text": "func New(s service.AccountsService, mdw map[string][]endpoint.Middleware) Endpoints {\n\teps := Endpoints{\n\t\tCreateUserEndpoint: MakeCreateUserEndpoint(s),\n\t\tGetUserEndpoint: MakeGetUserEndpoint(s),\n\t}\n\tfor _, m := range mdw[\"CreateUser\"] {\n\t\teps.CreateUserEndpoint = m(eps.CreateUserEndpoint)\n\t}\n\tfor _, m := range mdw[\"GetUser\"] {\n\t\teps.GetUserEndpoint = m(eps.GetUserEndpoint)\n\t}\n\treturn eps\n}", "title": "" }, { "docid": "a1de0b3f965f950d349182b9440c4244", "score": "0.44964683", "text": "func NewStartEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\treturn nil, s.Start(ctx)\n\t}\n}", "title": "" }, { "docid": "77b78142a309497bf19b19dd91adb9d9", "score": "0.4477571", "text": "func (a *Authenticate) SignIn(w http.ResponseWriter, r *http.Request) {\n\tsession, err := a.sessionStore.LoadSession(r)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase http.ErrNoCookie, sessions.ErrLifetimeExpired, sessions.ErrInvalidSession:\n\t\t\tlog.FromRequest(r).Debug().Err(err).Msg(\"proxy: invalid session\")\n\t\t\ta.sessionStore.ClearSession(w, r)\n\t\t\ta.OAuthStart(w, r)\n\t\t\treturn\n\t\tdefault:\n\t\t\tlog.FromRequest(r).Error().Err(err).Msg(\"proxy: unexpected error\")\n\t\t\thttputil.ErrorResponse(w, r, \"An unexpected error occurred\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\terr = a.authenticate(w, r, session)\n\tif err != nil {\n\t\thttputil.ErrorResponse(w, r, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\ta.ProxyCallback(w, r, session)\n}", "title": "" }, { "docid": "37fde614652b51a8c9a24baf789e8497", "score": "0.446674", "text": "func makeCreateEndpoint(svc Loan) endpoint.Endpoint {\n\treturn func(_ context.Context, request interface{}) (interface{}, error) {\n\n\t\treq := request.(models.LoanRequest)\n\t\tsvc.Create(req)\n\n\t\treturn nil, nil\n\t}\n}", "title": "" }, { "docid": "c4341cc874a7dcb6799bd6139c197d9f", "score": "0.44314706", "text": "func MakeCreateEndpoint(s service.AuthenticationService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateRequest)\n\t\tt, error := s.Create(ctx, req.User)\n\t\treturn CreateResponse{\n\t\t\tError: error,\n\t\t\tT: t,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "b0bd5153f4a0acdcceb4fcbf7d47b685", "score": "0.4430267", "text": "func SigninUserPath() string {\n\treturn \"/user/signin\"\n}", "title": "" }, { "docid": "d1a8d51fc7cc4aec8fb80ea3f4da70ed", "score": "0.44205517", "text": "func newSNSClient(cli coreclientv1.SecretInterface,\n\tregion string, creds *v1alpha1.AWSSecurityCredentials) (*sns.SNS, error) {\n\n\tcredsValue, err := awsCredentials(cli, creds)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading AWS security credentials: %w\", err)\n\t}\n\n\tcfg := session.Must(session.NewSession(aws.NewConfig().\n\t\tWithRegion(region).\n\t\tWithCredentials(credentials.NewStaticCredentialsFromCreds(*credsValue)),\n\t))\n\n\treturn sns.New(cfg), nil\n}", "title": "" }, { "docid": "f82d7b6416612672e4f6947ac73ddf70", "score": "0.44181028", "text": "func (o *OauthHandler) TokenSignIn(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\tvar data tokenSignInData\n\terr := decoder.Decode(&data)\n\thelpers.Must(err)\n\n\tctx := stdCtx.TODO()\n\tpayload, err := idtoken.Validate(ctx, data.IDToken, o.config.ClientID)\n\t// TODO: we should check expiry ourselves\n\tif err != nil {\n\t\t// Not a Google ID token.\n\t\thttp.Error(w, fmt.Sprintf(\"bad stuff happened mate: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tname := fmt.Sprintf(\"%v\", payload.Claims[\"name\"])\n\tprofile_image_url := fmt.Sprintf(\"%v\", payload.Claims[\"picture\"])\n\temail := fmt.Sprintf(\"%v\", payload.Claims[\"email\"])\n\n\tvar user *models.User\n\tuser, err = o.us.ByEmail(email)\n\n\tswitch err {\n\tcase models.ErrorEntityNotFound:\n\t\tuser, err = o.us.Create(email, name, profile_image_url)\n\t\thelpers.Must(err)\n\tcase nil:\n\n\tdefault:\n\t\tpanic(err)\n\t}\n\n\ttoken, err := o.us.SignIn(user)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"bad stuff happened mate: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tsignInCookie := http.Cookie{Name: models.AuthCookieName, Value: token, Path: \"/\", HttpOnly: true}\n\thttp.SetCookie(w, &signInCookie)\n\tw.WriteHeader(http.StatusOK)\n\treturn\n}", "title": "" }, { "docid": "7099965fed445e9ac94e180646d1b2f9", "score": "0.44156763", "text": "func (c *Client) SignOut() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeSignOutRequest(c.encoder)\n\t\tdecodeResponse = DecodeSignOutResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildSignOutRequest(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = encodeRequest(req, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := c.SignOutDoer.Do(req)\n\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"userquery\", \"SignOut\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "title": "" }, { "docid": "5321bb0084162605797d759009e2fda8", "score": "0.44087192", "text": "func NewSubmitEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req any) (any, error) {\n\t\tp := req.(*SubmitPayload)\n\t\treturn s.Submit(ctx, p)\n\t}\n}", "title": "" }, { "docid": "707852e5c7d2c04136405c2975a66343", "score": "0.44002074", "text": "func NewDefaultEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint {\n\treturn func(ctx context.Context, req any) (any, error) {\n\t\tp := req.(*DefaultPayload)\n\t\tvar err error\n\t\tsc := security.BasicScheme{\n\t\t\tName: \"basic\",\n\t\t\tScopes: []string{},\n\t\t\tRequiredScopes: []string{},\n\t\t}\n\t\tctx, err = authBasicFn(ctx, p.Username, p.Password, &sc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, s.Default(ctx, p)\n\t}\n}", "title": "" }, { "docid": "9609b465b4bc2a5fc00d187b1e6818c0", "score": "0.43991786", "text": "func MountSignInHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := h.(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"POST\", \"/signin\", f)\n}", "title": "" }, { "docid": "7996c3f8db45701caed6cdb6b323b5c8", "score": "0.4395585", "text": "func SignIn(ctx context.Context, username, password string) (tokens Tokens, err error) {\n\tvar resp SignInResponse\n\n\tif resp, err = initiateSignIn(ctx, username, password); err != nil {\n\t\terr = errors.Wrap(err, \"failed to initiate sign in\")\n\t\treturn\n\t}\n\n\tif resp.Data.Challenge.Type == \"\" {\n\t\ttokens = resp.Data.Tokens\n\t\treturn\n\t}\n\n\tif resp, err = completeSignIn(ctx, resp.Data.Challenge, username, password); err != nil {\n\t\terr = errors.Wrap(err, \"failed to complete sign in\")\n\t\treturn\n\t}\n\n\treturn resp.Data.Tokens, nil\n}", "title": "" }, { "docid": "64555c7c13d6cee5d22f38b466122d2c", "score": "0.43830085", "text": "func InitLocalSignIn(e *echo.Group) {\n\t// Login Route\n\te.POST(\"/login\", Login)\n\t// SignUp Route\n\te.POST(\"/signup\", Signup)\n\t// Profile Route\n\teditProfile := e.Group(\"/profile\")\n\teditProfile.Use(middleware.JWTWithConfig(middleware.JWTConfig{\n\t\tSigningKey: []byte(config.UserSecret),\n\t\tSigningMethod: \"HS512\",\n\t}))\n\teditProfile.Use(authMiddleware.EchoUserContextMiddleware())\n\t// Avatar Upload Route\n\teditProfile.POST(\"/upload\", UploadAvatar)\n\t// Edit Profile Route\n\teditProfile.PUT(\"\", EditProfile)\n}", "title": "" }, { "docid": "2bcce19bdc2d3be90cfeefa6da69938f", "score": "0.43786323", "text": "func makeApproveEndpoint(svc Loan) endpoint.Endpoint {\n\treturn func(_ context.Context, request interface{}) (interface{}, error) {\n\n\t\treq := request.(models.ApproveRequest)\n\n\t\treturn svc.Approve(req)\n\t}\n}", "title": "" }, { "docid": "a371c7c6ee3dd90d76e1581ada7d0946", "score": "0.43766063", "text": "func makeVotingEndpoint(svc VoteService) endpoint.Endpoint {\r\n\treturn func(_ context.Context, request interface{}) (interface{}, error) {\r\n\t\treq := request.(voteRequest)\r\n\t\tresp, err := svc.CanVote(req.Name, req.Age)\r\n\t\tif err != nil {\r\n\t\t\treturn voteResponse{resp, err.Error()}, nil\r\n\t\t}\r\n\t\treturn voteResponse{resp, \"\"}, nil\r\n\t}\r\n}", "title": "" }, { "docid": "07453b3f10e560285bc226ecf8aa30b0", "score": "0.43689886", "text": "func (p *OicdProvider) Endpoint() oauth2.Endpoint {\n\treturn oauth2.Endpoint{AuthURL: p.authURL, TokenURL: p.tokenURL}\n}", "title": "" }, { "docid": "d0f55a139bbe9e52bca9334ad1b77f77", "score": "0.43658647", "text": "func Login(c *gin.Context) {\n\n}", "title": "" }, { "docid": "662fcad1d7045d12bb3e2fbf8d83f1ba", "score": "0.4365467", "text": "func UserCreateEndpoint(creator creating.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tvar user model.User\n\t\terr := json.NewDecoder(r.Body).Decode(&user)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error decoding request body: %v: %s\", r, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tcreated, err := creator.UserCreate(user)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating user:\", user, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tjson.NewEncoder(w).Encode(created)\n\t}\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "9eb59a39fd6631dadddb6668da6defa0", "score": "0.0", "text": "func (in *Nfs) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f78c9f046733cb7c9a86653b7a174677", "score": "0.7164136", "text": "func (in *DimseProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62ed13fdf917a508fe9406cd6ed526e7", "score": "0.7120743", "text": "func (in *JVMChaos) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6cf361172e2241cf4d904f6f03f23593", "score": "0.7117203", "text": "func (in *AlluxioRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3347ef85eeed487752f2af5ad6f8cccc", "score": "0.7099557", "text": "func (in *Run) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d95684bc63983d1bfb148e13fe8e67c6", "score": "0.7073776", "text": "func (in *MyPI) DeepCopyObject() runtime.Object {\n\treturn in\n}", "title": "" }, { "docid": "47cfd60c2e3320c421dd9e7f5a813e27", "score": "0.70299745", "text": "func (in *Cmd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f82cbb18ecc648b8722882c9e19f2c8e", "score": "0.7017781", "text": "func (b BenchInfo) DeepCopyObject() runtime.Object {\n\treturn b\n}", "title": "" }, { "docid": "42599add04d36968bccaf1410ce188cd", "score": "0.700203", "text": "func (in *Jupyter) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9f8ca7de41e83792669b70131c01133e", "score": "0.69993705", "text": "func (in *DimseProxyList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "508d951ccc9a87c01b02ea294dec1374", "score": "0.6996289", "text": "func (in *CmdList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7467977c617b199ff0c444b5394f7648", "score": "0.69962853", "text": "func (in *Fluentbit) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48d796d4a8734a130c47f8b2fc0e5ebb", "score": "0.698144", "text": "func (in *VirtualApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0259175fc24715ebdbd2ea4493cf0768", "score": "0.6973474", "text": "func (in *Generator) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3d9f4f6b02c085d446192b0de87ac4c", "score": "0.6970284", "text": "func (in *KernelChaos) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1d4c6527b916e54ba0777a054d7629a", "score": "0.6968264", "text": "func (in *Extension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ef71fcd10151012303a1cf479c0dc15", "score": "0.6965186", "text": "func (in *Pachyderm) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "012f23a720b42d0cc64ffe3d13cc2d1b", "score": "0.696081", "text": "func (in *JVMChaosList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bde395ade772c32b35a7a9267d2fee3e", "score": "0.69586694", "text": "func (in *EventBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5f21354f4e062d8731cdcb8cbf355bf", "score": "0.6957529", "text": "func (in *CmdImage) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5493fce4cbcb91eae4e43a7136c1f2ea", "score": "0.6946198", "text": "func (in *LastPass) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c20982b79499b9c224fa873c5ee795b2", "score": "0.6942588", "text": "func (in *KubevirtAddon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a64803078af294246a4d1e95697f494", "score": "0.6941067", "text": "func (in *SWIFT) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d1d51851554e1dfdacd8f3fd5eada24f", "score": "0.69260484", "text": "func (in *Binding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7acb3346a026b58df2d3ddb142188b07", "score": "0.6919967", "text": "func (in *Kubefate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcaad3d7fada9b01996672d6c4ceb1d0", "score": "0.69167316", "text": "func (in *RemoteServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a883db5a7c29e9bc605c75894201aa28", "score": "0.6913768", "text": "func (in *Command) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed706b58977aa63c361930e2e8cf5eb0", "score": "0.69136435", "text": "func (in *KoupletBuild) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "140d2dbc57c4084831d9dbebf472398e", "score": "0.69058144", "text": "func (in *NodeDaemon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e614df0235ae5867c8436368148c5098", "score": "0.6887375", "text": "func (in *Daemon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "336ab76d8cd618ef49515f49dbb88277", "score": "0.68833905", "text": "func (in *Dataplane) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f56aaea352195ba624fcd45cd636b4c", "score": "0.688189", "text": "func (in *Garden) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27331ed45a6ffd21fc86e203e455c3f4", "score": "0.6876728", "text": "func (in *Host) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3bc6557d3db1dd0a2945dac1eadada28", "score": "0.68731433", "text": "func (in *DicomInstanceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e03f012900d4dd0cb4c2504ce98755bc", "score": "0.6869059", "text": "func (in *ServiceDiscovery) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "699f0069b953e871b4a09e2992ac26c0", "score": "0.68653595", "text": "func (in *Launcher) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76ac275799620c2619962a28c9c11460", "score": "0.6857087", "text": "func (in *Minecraft) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79598a398e4177e4a969313ad59c41ba", "score": "0.68551475", "text": "func (d *Driver) DeepCopyObject() runtime.Object {\n\treturn d.DeepCopy()\n}", "title": "" }, { "docid": "0b440cb829b3900423549539de3a36fb", "score": "0.68497205", "text": "func (in *VirtualAppList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8930b1fdd2549ccb6fc862dbe87945f2", "score": "0.6845263", "text": "func (in *Receiver) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12a86097592ea25ef26a8085437c155c", "score": "0.68428123", "text": "func (in *MyDemoBackend) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47873f0593624111dc977964e679e6b1", "score": "0.6837139", "text": "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "481742939809cbd8004acee92686e5e8", "score": "0.68362427", "text": "func (in *AlluxioRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "686ff00b62204806d68c9301afec2fbd", "score": "0.6834671", "text": "func (in *Fluentd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6828011", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6828011", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43e56e8718833d6c7d02a9403f0ec041", "score": "0.68271756", "text": "func (in *GeneratorList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e37a824b91ce1e6a932cc46ed01ff8b4", "score": "0.6826855", "text": "func (in *GraphFinder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82606957ed775937482f8f7678fb8ef2", "score": "0.6826262", "text": "func (in *Dcreater) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe23113b6735f6d23368bab2a071efec", "score": "0.6820091", "text": "func (in *Blueprint) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe23113b6735f6d23368bab2a071efec", "score": "0.6820091", "text": "func (in *Blueprint) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c82d684701ffeae1e10fc4b0640ecaf", "score": "0.68146425", "text": "func (in *LiveUpdate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8885e2e184fbb794edd2f1a673261a25", "score": "0.68139887", "text": "func (in *Vip) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "517cb7efedd20437e63fbbe453cc1ef4", "score": "0.68135685", "text": "func (in *KubemarkMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fd35c37c295ffbc3ec13403bed099e1", "score": "0.6812937", "text": "func (in *DaisyInstallation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "81ec9c7e50e902721ad3bf36f4c935cd", "score": "0.6812687", "text": "func (in *RunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f5f9cdc0c436532a786cef09dc9ed62", "score": "0.68126124", "text": "func (in *Debug) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c437e20373e7b09b8c2af864f894c903", "score": "0.68111926", "text": "func (in *FluentbitList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20cbe326359b6bac56eec046752685ab", "score": "0.6808465", "text": "func (in *CommandList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fa04844517b927e6432dbd5f452b50b", "score": "0.6803644", "text": "func (in *Installer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "607d2477a46ae69633afe36f8d727ae3", "score": "0.6797432", "text": "func (in *KernelChaosList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5af341b1d05970ff7e121c7846549d1", "score": "0.67955774", "text": "func (in *TfInference) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "796bbdfd1293b157ed16f34ae1a6dd34", "score": "0.67944974", "text": "func (in *VitessKeyspace) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5cf6803eed6ddbb81acf03bcc7384e30", "score": "0.6792103", "text": "func (in *PropagatedVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2c3d62f91dfb2c52bcbacf4c854e7b5", "score": "0.6789913", "text": "func (in *Flow) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8d3edbc4aafe3a0e94ec1c46a354361", "score": "0.67896837", "text": "func (in *ExtensionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "932da846ba0b858f9f7ee39c38c0ab12", "score": "0.6788554", "text": "func (in *ServiceClass) DeepCopyObject() runtime.Object {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "6bba529c437c45cfe4a96f73a11f136a", "score": "0.6788551", "text": "func (in *Proxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "269d6d6ded99a4fb32894042b6e09906", "score": "0.67885435", "text": "func (in *ArgoCD) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bb5eaaaf35491cce6cf275243e4c854", "score": "0.67874604", "text": "func (in *NetworkChaos) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f897de37b82cd41e1aa2520de2c4da7", "score": "0.6786091", "text": "func (in *DockerComposeService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84c10982127f52eb5de4193b2f52bfb9", "score": "0.6784547", "text": "func (in *Growi) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6453af700e734f19a99ddc476a46a07", "score": "0.67842096", "text": "func (in *HTTPChaos) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f6385e72355fbaa8cb620488489d711", "score": "0.6782483", "text": "func (in *ArgoCDExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1a05a2d8a759ccfc28a0bee2a3f0f56", "score": "0.678179", "text": "func (in *KunInstallation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76f1e54550c239312aded69671699b83", "score": "0.67796296", "text": "func (in *ActiveMQArtemis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25a155b2a12099e23ed2847a7c8cff50", "score": "0.67779684", "text": "func (in *Addon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82c8936d5a296b83933646cece6b16f2", "score": "0.6776535", "text": "func (in *HookList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60df090abf1d373ecc29b49c141fb597", "score": "0.6773026", "text": "func (in *LibertyApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "96979cc2b69e7fc30dc6757cc7bc2a27", "score": "0.67692655", "text": "func (in *PachydermList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dac031c9311477d6fd4902546c4c29e5", "score": "0.67687804", "text": "func (in *PortForward) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1eb80a8539b35674f9c203120e467032", "score": "0.67687416", "text": "func (in *Idler) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6768069", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6768069", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ed0103cc745185178096a80d4451454", "score": "0.67671305", "text": "func (in *DockerImage) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3a4d8d4270fd44d6bb11e24e14292aa", "score": "0.6766969", "text": "func (in *GitStar) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b228233c0afc4edbd29c821f1d6018eb", "score": "0.67635137", "text": "func (in *CmdImageList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a058a4e0b3f9e8272738bea1d47ab8d9", "score": "0.6761341", "text": "func (in *OracleTarget) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "edc26a8bc9a3f6ba3bf9e7343629b65d", "score": "0.67578864", "text": "func (in *VirtualHost) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "34cdf8fbee1d5488b8bf47de48e4a2d0", "score": "0.67557395", "text": "func (in *NodeDaemonList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c78f75caaa730c54594a38a4c529cf7f", "score": "0.67496175", "text": "func (in *Builder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97141b6382c9489a4970b1c866bb1273", "score": "0.67468494", "text": "func (in *Pgreplica) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3438f3a569d3513863c8c5ff9d7b8a6", "score": "0.67460996", "text": "func (in *Webctl) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1e8788e32f94a6ee9d8e0ce8223c5b0e", "score": "0.6744841", "text": "func (in *KoupletTest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58701b7a2ba2668ca181e448807a227f", "score": "0.67435354", "text": "func (in *DaemonList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9fabb9629d125248dd790d5ff41df552", "score": "0.6739945", "text": "func (in *CSIPowerMaxRevProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5b526d453435784b318193773f5d178", "score": "0.67386335", "text": "func (in *PathFinder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f72db4f50be20f654f8ffbaf17ad2fa", "score": "0.6737675", "text": "func (in *ArgoCDList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6be26e37966a11a875daad874aa8157", "score": "0.6735459", "text": "func (in *Play) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
8357356322480e16172d2285266d972e
Proto returns BlockHeader proto.
[ { "docid": "c363eec06e1f95d004ddcfc7a39b4834", "score": "0.81109977", "text": "func (h *Header) Proto() *iotextypes.BlockHeader {\n\theader := iotextypes.BlockHeader{\n\t\tCore: h.BlockHeaderCoreProto(),\n\t}\n\n\tif h.height > 0 {\n\t\theader.ProducerPubkey = h.pubkey.Bytes()\n\t\theader.Signature = h.blockSig\n\t}\n\treturn &header\n}", "title": "" } ]
[ { "docid": "91dfbf323c9b547b2c6832689dcab1f7", "score": "0.752526", "text": "func (h *BlockHeader) ToProto() *wirepb.BlockHeader {\n\tbanList := make([]*wirepb.PublicKey, len(h.BanList))\n\tfor i, pub := range h.BanList {\n\t\tbanList[i] = wirepb.PublicKeyToProto(pub)\n\t}\n\n\treturn &wirepb.BlockHeader{\n\t\tChainID: h.ChainID.ToProto(),\n\t\tVersion: h.Version,\n\t\tHeight: h.Height,\n\t\tTimestamp: uint64(h.Timestamp.Unix()),\n\t\tPrevious: h.Previous.ToProto(),\n\t\tTransactionRoot: h.TransactionRoot.ToProto(),\n\t\tWitnessRoot: h.WitnessRoot.ToProto(),\n\t\tProposalRoot: h.ProposalRoot.ToProto(),\n\t\tTarget: wirepb.BigIntToProto(h.Target),\n\t\tChallenge: h.Challenge.ToProto(),\n\t\tPubKey: wirepb.PublicKeyToProto(h.PubKey),\n\t\tProof: wirepb.ProofToProto(h.Proof),\n\t\tSignature: wirepb.SignatureToProto(h.Signature),\n\t\tBanList: banList,\n\t}\n}", "title": "" }, { "docid": "8652187f66f56570c0e7dc769294d81c", "score": "0.71643955", "text": "func (h *Header) BlockHeaderCoreProto() *iotextypes.BlockHeaderCore {\n\tts := timestamppb.New(h.timestamp)\n\theader := iotextypes.BlockHeaderCore{\n\t\tVersion: h.version,\n\t\tHeight: h.height,\n\t\tTimestamp: ts,\n\t\tPrevBlockHash: h.prevBlockHash[:],\n\t\tTxRoot: h.txRoot[:],\n\t\tDeltaStateDigest: h.deltaStateDigest[:],\n\t\tReceiptRoot: h.receiptRoot[:],\n\t}\n\tif h.logsBloom != nil {\n\t\theader.LogsBloom = h.logsBloom.Bytes()\n\t}\n\treturn &header\n}", "title": "" }, { "docid": "ff4ef424daa277391945f70d50cd625f", "score": "0.69715613", "text": "func (*BlockHeader) Descriptor() ([]byte, []int) {\n\treturn file_Common_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "1af58b9b134d9122782f6f2cec5fc262", "score": "0.6829245", "text": "func (b Block) Header() BlockHeader {\n\treturn BlockHeader{\n\t\tParentID: b.ParentID,\n\t\tTimestamp: b.Timestamp,\n\t\tPOBSOutput: b.POBSOutput,\n\t\tMerkleRoot: b.MerkleRoot(),\n\t}\n}", "title": "" }, { "docid": "e0515dfb87ae13bdd1a65e73ec65559c", "score": "0.67530036", "text": "func (*HeaderBlock) Descriptor() ([]byte, []int) {\n\treturn file_osmformat_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c4ca056f8d7e8d5db0e0264aa068ac2b", "score": "0.66190696", "text": "func (bh *BlockHeader) Serialize() []byte {\n\tbytes, _ := proto.Marshal(bh)\n\treturn bytes\n}", "title": "" }, { "docid": "3d336c334e5feb69184116d4f80d8be6", "score": "0.6534383", "text": "func (*CMsgProtoBufHeader) Descriptor() ([]byte, []int) {\n\treturn file_artifact_steam_steammessages_base_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "75a30d2d0e5765e5d07295a632764c61", "score": "0.65320146", "text": "func (h *BlockHeader) FromProto(pb *wirepb.BlockHeader) error {\n\tif pb == nil {\n\t\treturn errors.New(\"nil proto block_header\")\n\t}\n\tvar unmarshalHash = func(h []*Hash, pb []*wirepb.Hash) (err error) {\n\t\tfor i := range h {\n\t\t\tif err = h[i].FromProto(pb[i]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tchainID, previous, transactionRoot, witnessRoot, proposalRoot, challenge := new(Hash), new(Hash), new(Hash), new(Hash), new(Hash), new(Hash)\n\tvar err error\n\tif err = unmarshalHash([]*Hash{chainID, previous, transactionRoot, witnessRoot, proposalRoot, challenge},\n\t\t[]*wirepb.Hash{pb.ChainID, pb.Previous, pb.TransactionRoot, pb.WitnessRoot, pb.ProposalRoot, pb.Challenge}); err != nil {\n\t\treturn err\n\t}\n\ttarget := new(big.Int)\n\tif err = wirepb.ProtoToBigInt(pb.Target, target); err != nil {\n\t\treturn err\n\t}\n\tpub := new(pocec.PublicKey)\n\tif err = wirepb.ProtoToPublicKey(pb.PubKey, pub); err != nil {\n\t\treturn err\n\t}\n\tproof := new(poc.Proof)\n\tif err = wirepb.ProtoToProof(pb.Proof, proof); err != nil {\n\t\treturn err\n\t}\n\tsig := new(pocec.Signature)\n\tif err = wirepb.ProtoToSignature(pb.Signature, sig); err != nil {\n\t\treturn err\n\t}\n\tbanList := make([]*pocec.PublicKey, len(pb.BanList))\n\tfor i, pk := range pb.BanList {\n\t\tpub := new(pocec.PublicKey)\n\t\tif err = wirepb.ProtoToPublicKey(pk, pub); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbanList[i] = pub\n\t}\n\n\th.ChainID = *chainID\n\th.Version = pb.Version\n\th.Height = pb.Height\n\th.Timestamp = time.Unix(int64(pb.Timestamp), 0)\n\th.Previous = *previous\n\th.TransactionRoot = *transactionRoot\n\th.WitnessRoot = *witnessRoot\n\th.ProposalRoot = *proposalRoot\n\th.Target = target\n\th.Challenge = *challenge\n\th.PubKey = pub\n\th.Proof = proof\n\th.Signature = sig\n\th.BanList = banList\n\n\treturn nil\n}", "title": "" }, { "docid": "2cff6acf2749f781b3c2a6249405da94", "score": "0.6480363", "text": "func NewBlockHeaderFromProto(pb *wirepb.BlockHeader) (*BlockHeader, error) {\n\th := new(BlockHeader)\n\terr := h.FromProto(pb)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "348fea4215315fb2e50e2844d4fd673c", "score": "0.6434177", "text": "func (block *Block) Header() (*BlockHeader, error) {\n\tif err := block.EnsureHead(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BlockHeader{\n\t\tHeight: block.height,\n\t\tTimestamp: block.timestamp,\n\t\tHeadHash: block.headHash,\n\t\tPrevHash: block.prevHash,\n\t\tExecHash: block.execHash,\n\t\tStateHash: block.stateHash,\n\t}, nil\n}", "title": "" }, { "docid": "161cbcd4cb32d0decc4bb25d3fca9c3e", "score": "0.6398063", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_base_tendermint_v1beta1_types_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "bf37e3ded0a96269d36b5d0bd56fae2e", "score": "0.6383125", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "f40022be5eadda12968e2dde64dc5b56", "score": "0.63623357", "text": "func (node *blockNode) Header() *domainmessage.BlockHeader {\n\t// No lock is needed because all accessed fields are immutable.\n\treturn &domainmessage.BlockHeader{\n\t\tVersion: node.version,\n\t\tParentHashes: node.ParentHashes(),\n\t\tHashMerkleRoot: node.hashMerkleRoot,\n\t\tAcceptedIDMerkleRoot: node.acceptedIDMerkleRoot,\n\t\tUTXOCommitment: node.utxoCommitment,\n\t\tTimestamp: node.time(),\n\t\tBits: node.bits,\n\t\tNonce: node.nonce,\n\t}\n}", "title": "" }, { "docid": "315c50c883348539b1c33754feedc9fc", "score": "0.6359085", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "dccf9f6eb17bbbb74f48cc9035e3e1fb", "score": "0.63566035", "text": "func (b *Block) ProtoMarshal() ([]byte, error) {\n\tvar bf proto.Buffer\n\tbf.SetDeterministic(true)\n\tif err := bf.Marshal(b); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bf.Bytes(), nil\n}", "title": "" }, { "docid": "51d0c3a783c03f93916f4f3346b644eb", "score": "0.6312415", "text": "func (_BTCRelay *BTCRelayCaller) GetBlockHeader(opts *bind.CallOpts, blockHeaderHash [32]byte) (struct {\n\tVersion uint32\n\tTime uint32\n\tNonce uint32\n\tPrevBlockHash [32]byte\n\tMerkleRoot [32]byte\n\tTarget *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _BTCRelay.contract.Call(opts, &out, \"getBlockHeader\", blockHeaderHash)\n\n\toutstruct := new(struct {\n\t\tVersion uint32\n\t\tTime uint32\n\t\tNonce uint32\n\t\tPrevBlockHash [32]byte\n\t\tMerkleRoot [32]byte\n\t\tTarget *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Version = out[0].(uint32)\n\toutstruct.Time = out[1].(uint32)\n\toutstruct.Nonce = out[2].(uint32)\n\toutstruct.PrevBlockHash = out[3].([32]byte)\n\toutstruct.MerkleRoot = out[4].([32]byte)\n\toutstruct.Target = out[5].(*big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "a94b03c7230cda2d5c5c87b40e79c729", "score": "0.6298955", "text": "func (bb *BlockBody) ProtoMarshal() ([]byte, error) {\n\tvar bf proto.Buffer\n\tbf.SetDeterministic(true)\n\tif err := bf.Marshal(bb); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bf.Bytes(), nil\n}", "title": "" }, { "docid": "9911392d12a8698e333287ef985d05ad", "score": "0.62935853", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_protos_hclspec_v1_hcl_spec_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "bcd445ced0edef4104ebf7cbdac476c5", "score": "0.62818545", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3667aa3b9d24d2a72e0291a2a8b35374", "score": "0.62251514", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "40cdd9fd3b87dd4c9bb042cf536bba56", "score": "0.62062097", "text": "func (*BlockHeaderResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "58bcedc29aea67ab64fd322e6a89581b", "score": "0.6181393", "text": "func (*BlockHeaderContainer) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "db3dc78ceef1a5fad40de3843427ada8", "score": "0.61757934", "text": "func (*BlockParams) Descriptor() ([]byte, []int) {\n\treturn file_types_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "b4173433994933a62b0637ca51606be4", "score": "0.61688715", "text": "func (*BlockHeadersRequest) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "3bd7c8ce351f74c3689a07252959158c", "score": "0.6162534", "text": "func (b Block) GetHeader() BlockHeader {\n\treturn b.Header\n}", "title": "" }, { "docid": "dcb270f60df5512aa475caea1ff002b2", "score": "0.6145486", "text": "func (b BlockHeader) Json() []byte {\n\theaderJson, err := json.Marshal(b)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tpanic(\"Unable to marshal block header\")\n\t}\n\n\treturn headerJson\n}", "title": "" }, { "docid": "759d94bb595729b16bdeb4feb6c5d062", "score": "0.6121074", "text": "func (*Header) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_base_tendermint_v1beta1_types_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e2ce1dc691fa1d5dcfba73761e00f3b1", "score": "0.61194223", "text": "func (*PrimitiveBlock) Descriptor() ([]byte, []int) {\n\treturn file_osmformat_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f2fccbfe2d3f65bfc4d08ebe1542cc30", "score": "0.61164176", "text": "func (h *Header) LoadFromBlockHeaderProto(pb *iotextypes.BlockHeader) error {\n\tif err := h.loadFromBlockHeaderCoreProto(pb.GetCore()); err != nil {\n\t\treturn err\n\t}\n\tsig := pb.GetSignature()\n\th.blockSig = make([]byte, len(sig))\n\tcopy(h.blockSig, sig)\n\tpubKey, err := crypto.BytesToPublicKey(pb.GetProducerPubkey())\n\tif err != nil {\n\t\treturn err\n\t}\n\th.pubkey = pubKey\n\treturn nil\n}", "title": "" }, { "docid": "cf598082a44d3abfa04dfa955641693a", "score": "0.6115919", "text": "func (bh *BlockHeader) Deserialize(data []byte) error {\n\treturn proto.Unmarshal(data, bh)\n}", "title": "" }, { "docid": "8450846fe6ecb8e80f304382532e05e6", "score": "0.610738", "text": "func (b *EvmBlock) Header() *EvmHeader {\n\tif b == nil {\n\t\treturn nil\n\t}\n\t// copy values\n\th := b.EvmHeader\n\t// copy refs\n\th.Number = new(big.Int).Set(b.Number)\n\n\treturn &h\n}", "title": "" }, { "docid": "b94beaca316b70db6bc094899a12a993", "score": "0.6103853", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_hotstuff_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "710df701ba7fa28137c89855eab0cc6d", "score": "0.60996735", "text": "func (*GetRawBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{188}\n}", "title": "" }, { "docid": "d5f82bd7a820c2ead2ff60b076094794", "score": "0.6078548", "text": "func (*BlockRecordPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_fs_fs_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2e0270cbb68e743b2268ff3b490f8e55", "score": "0.60722053", "text": "func (_BTCRelay *BTCRelayCallerSession) GetBlockHeader(blockHeaderHash [32]byte) (struct {\n\tVersion uint32\n\tTime uint32\n\tNonce uint32\n\tPrevBlockHash [32]byte\n\tMerkleRoot [32]byte\n\tTarget *big.Int\n}, error) {\n\treturn _BTCRelay.Contract.GetBlockHeader(&_BTCRelay.CallOpts, blockHeaderHash)\n}", "title": "" }, { "docid": "5e6af1e310f31780c6ee2cab880440ea", "score": "0.606444", "text": "func (_BTCRelay *BTCRelaySession) GetBlockHeader(blockHeaderHash [32]byte) (struct {\n\tVersion uint32\n\tTime uint32\n\tNonce uint32\n\tPrevBlockHash [32]byte\n\tMerkleRoot [32]byte\n\tTarget *big.Int\n}, error) {\n\treturn _BTCRelay.Contract.GetBlockHeader(&_BTCRelay.CallOpts, blockHeaderHash)\n}", "title": "" }, { "docid": "fe33361471c5cd61baefe2128e734b75", "score": "0.6054544", "text": "func (*CreateBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e2dccdcd2672ca5138435dc1bce7112e", "score": "0.6041336", "text": "func (h *Header) HashBlock() hash.Hash256 { return h.HashHeader() }", "title": "" }, { "docid": "cd87147b03fcbc33175a0d1d54a5a5e1", "score": "0.6037406", "text": "func (*BlockHeadersResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "206e95f726a6cb43b86a980a379d48db", "score": "0.60305405", "text": "func (*BlockHash) Descriptor() ([]byte, []int) {\n\treturn file_Common_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "1280dc141c985cb72c0bf7506b8225ff", "score": "0.6029169", "text": "func (b *Blockchain) Header() *types.Header {\n\thash := b.db.ReadHeadHash()\n\tif hash == nil {\n\t\treturn nil\n\t}\n\theader := b.db.ReadHeader(*hash)\n\treturn header\n}", "title": "" }, { "docid": "5c297507d89b216798a6adf4cbe7d197", "score": "0.60286564", "text": "func (*Header) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "f2e1616d4cef43de5284b9bdb2bf2897", "score": "0.6025127", "text": "func (dec *Decoder) BlockHeaderSchema() hcl.BlockHeaderSchema {\n\treturn hcl.BlockHeaderSchema{\n\t\tType: BlockMongo,\n\t\tLabelNames: []string{labelOperation},\n\t}\n}", "title": "" }, { "docid": "c9091daa9152023e19fcc570b2e701ea", "score": "0.60189086", "text": "func (*GetRawBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "a45b1785d9e8665e2485c851fee2fd25", "score": "0.6012811", "text": "func (pkt *ConnectPacket) Header() *FixedHeader {\n\t// Protocol + Version + Flags + KeepAlive + ClientID\n\tlength := 2 + len(pkt.Protocol) + 1 + 1 + 2 + 2 + len(pkt.ClientID)\n\tif pkt.Will != nil {\n\t\tlength += 2 + len(pkt.Will.Topic) + 2 + len(pkt.Will.Data)\n\t}\n\tif pkt.Auth != nil {\n\t\tlength += 2 + len(pkt.Auth.Username) + 2 + len(pkt.Auth.Password)\n\t}\n\tpkt.header.Length = length\n\treturn pkt.header\n}", "title": "" }, { "docid": "80b5e30354f3d0a43afa6a96e2166c1a", "score": "0.6005793", "text": "func (*CreateBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a8a8456b16e66e86451207b2cad82e5c", "score": "0.60037714", "text": "func (*Block) Descriptor() ([]byte, []int) {\n\treturn file_maobft_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "034b6f634cae1f0e64a2068469afb1c9", "score": "0.5994811", "text": "func (bs *BlockSignature) ProtoMarshal() ([]byte, error) {\n\tvar bf proto.Buffer\n\tbf.SetDeterministic(true)\n\tif err := bf.Marshal(bs); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bf.Bytes(), nil\n}", "title": "" }, { "docid": "3105a76aa1de77b57807e237deef5625", "score": "0.5950083", "text": "func (*Header) Descriptor() ([]byte, []int) {\n\treturn file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "2013fb03c0d36e59a1b3ad4766a2f226", "score": "0.5948911", "text": "func (*BlockInfo) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "aa8a7c6eded1564e6c3f9458ff4e321c", "score": "0.59418607", "text": "func (*GetRawBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{189}\n}", "title": "" }, { "docid": "fc96f15f8c5baeed876bf2ea5189a6df", "score": "0.5923951", "text": "func NewBlockHeader(version int32, prevHash, merkleRootHash chainhash.Hash,\n\tmmr chainhash.Hash,\n\ttimestamp time.Time,\n\tbits uint32, nonce uint32) *header {\n\n\t// Limit the timestamp to one second precision since the protocol\n\t// doesn't support better.\n\treturn &header{\n\t\tversion: version,\n\t\tprevBlock: prevHash,\n\t\tmerkleRoot: merkleRootHash,\n\t\tmerkleMountainRange: mmr,\n\t\ttimestamp: timestamp, //time.Unix(time.Now().Unix(), 0),\n\t\tbits: bits,\n\t\tnonce: nonce,\n\t}\n}", "title": "" }, { "docid": "c669ea833b3176ac020559989b439033", "score": "0.59225154", "text": "func TestBlockHeader(t *testing.T) {\n\tnonce := uint64(0xba4d87a69924a93d)\n\n\thashes := []*externalapi.DomainHash{mainnetGenesisHash, simnetGenesisHash}\n\n\tmerkleHash := mainnetGenesisMerkleRoot\n\tacceptedIDMerkleRoot := exampleAcceptedIDMerkleRoot\n\tbits := uint32(0x1d00ffff)\n\tbh := NewBlockHeader(1, hashes, merkleHash, acceptedIDMerkleRoot, exampleUTXOCommitment, bits, nonce)\n\n\t// Ensure we get the same data back out.\n\tif !reflect.DeepEqual(bh.ParentHashes, hashes) {\n\t\tt.Errorf(\"NewBlockHeader: wrong prev hashes - got %v, want %v\",\n\t\t\tspew.Sprint(bh.ParentHashes), spew.Sprint(hashes))\n\t}\n\tif bh.HashMerkleRoot != merkleHash {\n\t\tt.Errorf(\"NewBlockHeader: wrong merkle root - got %v, want %v\",\n\t\t\tspew.Sprint(bh.HashMerkleRoot), spew.Sprint(merkleHash))\n\t}\n\tif bh.Bits != bits {\n\t\tt.Errorf(\"NewBlockHeader: wrong bits - got %v, want %v\",\n\t\t\tbh.Bits, bits)\n\t}\n\tif bh.Nonce != nonce {\n\t\tt.Errorf(\"NewBlockHeader: wrong nonce - got %v, want %v\",\n\t\t\tbh.Nonce, nonce)\n\t}\n}", "title": "" }, { "docid": "f37735dfaf6f8f897327428524583adf", "score": "0.5921295", "text": "func (*BlockList) Descriptor() ([]byte, []int) {\n\treturn file_protos_hclspec_v1_hcl_spec_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f3b7db0322cbfe86096c5d3f1413831c", "score": "0.59183097", "text": "func (*BlockIdPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_fs_fs_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b922bee0ef3cbbbfa3bc4bc825abdb97", "score": "0.5912408", "text": "func (*BlockDetails) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1e655f93fd7e62cac023c9a251cf81cb", "score": "0.58699906", "text": "func (self *peerMessage) Header() PeerMessageHeader {\n\treturn self.header\n}", "title": "" }, { "docid": "3b85dbfd47decde79a36e93ce9ff4890", "score": "0.58659", "text": "func (*BlockID) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ce2bc0e7a58c4228be821d28d059cac8", "score": "0.5849688", "text": "func (*GetRawBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "e7e661b3d9062ea38ec0499985e8bc0c", "score": "0.5830488", "text": "func (*ClientBlockGetResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "a7b3a218c994daa540b38d485347af18", "score": "0.58247304", "text": "func keyBlockHeader(blockHash *chainhash.Hash) []byte { return blockHash[:] }", "title": "" }, { "docid": "00bd2469622983840159f71e2e578130", "score": "0.5821575", "text": "func (c *Client) GetBlockHeaderVerbose(hash util.Uint256) (*result.Header, error) {\n\tvar (\n\t\tparams = request.NewRawParams(hash.StringLE(), 1)\n\t\tresp = &result.Header{}\n\t)\n\tif err := c.performRequest(\"getblockheader\", params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "82bed0052cf69642f8c5bb1ed0745147", "score": "0.58168656", "text": "func (*ClientBlockListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "33b2af67807f3400afe00207453ab008", "score": "0.581602", "text": "func (dec *Decoder) BlockHeaderSchema() hcl.BlockHeaderSchema {\n\treturn hcl.BlockHeaderSchema{\n\t\tType: BlockPrint,\n\t\tLabelNames: nil,\n\t}\n}", "title": "" }, { "docid": "4c8f25c2442125a10cf5f5e01ad5a17e", "score": "0.5810456", "text": "func (*RequestBeginBlock) Descriptor() ([]byte, []int) {\n\treturn file_types_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "f4b972e90faa27f9899a8f0e8bc391fe", "score": "0.5808143", "text": "func (msg *MsgBlock) ToProto() (*wirepb.Block, error) {\n\tpa, err := msg.Proposals.ToProto()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\th := msg.Header.ToProto()\n\ttxs := make([]*wirepb.Tx, len(msg.Transactions))\n\tfor i, tx := range msg.Transactions {\n\t\ttxs[i] = tx.ToProto()\n\t}\n\n\treturn &wirepb.Block{\n\t\tHeader: h,\n\t\tProposals: pa,\n\t\tTransactions: txs,\n\t}, nil\n}", "title": "" }, { "docid": "ec5b661cd13e52fbad97600001d02d65", "score": "0.5802603", "text": "func (*BlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_showcase_v1beta1_echo_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "65fe2096291322d0d01bc6b9eb14e050", "score": "0.58023393", "text": "func (*BlockAttrs) Descriptor() ([]byte, []int) {\n\treturn file_protos_hclspec_v1_hcl_spec_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b64345d75427928c116bb787aa6648a7", "score": "0.5774696", "text": "func (n *Connected) Header() wire.BlockHeader {\n\treturn n.header\n}", "title": "" }, { "docid": "257c7826896abf09d2954606db7dd79e", "score": "0.57684046", "text": "func (*ResponseBeginBlock) Descriptor() ([]byte, []int) {\n\treturn file_types_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "bb0fcf498848424c52092f6da2d3f6af", "score": "0.57646304", "text": "func (h *Header) Deserialize(buf []byte) error {\n\tpb := &iotextypes.BlockHeader{}\n\tif err := proto.Unmarshal(buf, pb); err != nil {\n\t\treturn err\n\t}\n\treturn h.LoadFromBlockHeaderProto(pb)\n}", "title": "" }, { "docid": "d2395af27772a18f866dafd3050628d0", "score": "0.5754837", "text": "func (x *fastReflection_Header) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.base.tendermint.v1beta1.Header.version\":\n\t\tvalue := x.Version\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.base.tendermint.v1beta1.Header.chain_id\":\n\t\tvalue := x.ChainId\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.height\":\n\t\tvalue := x.Height\n\t\treturn protoreflect.ValueOfInt64(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.time\":\n\t\tvalue := x.Time\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.base.tendermint.v1beta1.Header.last_block_id\":\n\t\tvalue := x.LastBlockId\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"cosmos.base.tendermint.v1beta1.Header.last_commit_hash\":\n\t\tvalue := x.LastCommitHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.data_hash\":\n\t\tvalue := x.DataHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.validators_hash\":\n\t\tvalue := x.ValidatorsHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.next_validators_hash\":\n\t\tvalue := x.NextValidatorsHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.consensus_hash\":\n\t\tvalue := x.ConsensusHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.app_hash\":\n\t\tvalue := x.AppHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.last_results_hash\":\n\t\tvalue := x.LastResultsHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.evidence_hash\":\n\t\tvalue := x.EvidenceHash\n\t\treturn protoreflect.ValueOfBytes(value)\n\tcase \"cosmos.base.tendermint.v1beta1.Header.proposer_address\":\n\t\tvalue := x.ProposerAddress\n\t\treturn protoreflect.ValueOfString(value)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.base.tendermint.v1beta1.Header\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.base.tendermint.v1beta1.Header does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "ae4107bfa14e8c6821c81af167cbcc00", "score": "0.57515657", "text": "func (s Block) NewHeader() (Header, error) {\n\tss, err := NewHeader(s.Struct.Segment())\n\tif err != nil {\n\t\treturn Header{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "899efcafb179423bc92a85fab7df2d65", "score": "0.57513297", "text": "func (*ClientBlockGetByNumRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e90d8bdc3852fe6a59b794f7ad278ef6", "score": "0.5742958", "text": "func (*GetBlockByHashRequest) Descriptor() ([]byte, []int) {\n\treturn file_qscc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "96a1229a2c8f55893cc0df6b3c567c0f", "score": "0.57395697", "text": "func (*NamedHeader) Descriptor() ([]byte, []int) {\n\treturn file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "eb95d161ded767c1898b5530ee8d9578", "score": "0.5736177", "text": "func (lw *LoginInWorldPacket) Header() *HeaderPacket {\n\treturn &lw.HeaderPacket\n}", "title": "" }, { "docid": "a718e2aba116320a3039298c0d8a52e1", "score": "0.5735635", "text": "func (*BlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "c777ecfb11f35dba10ecdcba1d6fd9c4", "score": "0.57316774", "text": "func (clr *ClientLoginRequestPacket) Header() *HeaderPacket {\n\treturn &clr.HeaderPacket\n}", "title": "" }, { "docid": "d030b2f65d17102d1dd4793738fe36c8", "score": "0.5725004", "text": "func (*MineBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "4aba1a0083d4c2c7baaf3c3045fa88f4", "score": "0.57202655", "text": "func hashBlockHeader(header *Header) []byte {\n\tb := make([]byte, 0)\n\th := sha256.New()\n\n\tid, _ := hex.DecodeString(header.ParentID)\n\tb = append(b, id[:]...)\n\n\troot, _ := hex.DecodeString(header.Root)\n\tb = append(b, root[:]...)\n\n\tdiffBuf := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(diffBuf, header.Difficulty)\n\tb = append(b, diffBuf[:]...)\n\n\ttsBuf := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(tsBuf, header.Timestamp)\n\tb = append(b, tsBuf[:]...)\n\n\tfor i := 0; i < 3; i++ {\n\t\tnonceBuf := make([]byte, 8)\n\t\tbinary.BigEndian.PutUint64(nonceBuf, header.Nonces[i])\n\t\tb = append(b, nonceBuf[:]...)\n\t}\n\n\tb = append(b, byte(header.Version))\n\n\th.Write(b)\n\tsum := h.Sum(nil)\n\n\treturn sum\n}", "title": "" }, { "docid": "bc9b099b90fd4a1e921be8900a350940", "score": "0.5717977", "text": "func Proto(h http.Header) string {\n\treturn strategy.Proto(h)\n}", "title": "" }, { "docid": "a4851168b42fc39cb46f1e1a931d57ed", "score": "0.5712877", "text": "func (pkt *PubCompPacket) Header() *FixedHeader {\n\treturn pkt.header\n}", "title": "" }, { "docid": "8852b546ff930e8c272fd3c0b949e7e0", "score": "0.5708715", "text": "func (b *block) V7() *headerV7 { return (*headerV7)(b) }", "title": "" }, { "docid": "76900ea742305d635a5a9167ac07761d", "score": "0.5707559", "text": "func (f *Frame) Header() []byte {\n\treturn f.header\n}", "title": "" }, { "docid": "798f52a8534353f2deccecffad8aaa11", "score": "0.570714", "text": "func (bh *blockHeader) Marshal(dst []byte) []byte {\n\tdst = bh.TSID.Marshal(dst)\n\tdst = encoding.MarshalInt64(dst, bh.MinTimestamp)\n\tdst = encoding.MarshalInt64(dst, bh.MaxTimestamp)\n\tdst = encoding.MarshalInt64(dst, bh.FirstValue)\n\tdst = encoding.MarshalUint64(dst, bh.TimestampsBlockOffset)\n\tdst = encoding.MarshalUint64(dst, bh.ValuesBlockOffset)\n\tdst = encoding.MarshalUint32(dst, bh.TimestampsBlockSize)\n\tdst = encoding.MarshalUint32(dst, bh.ValuesBlockSize)\n\tdst = encoding.MarshalUint32(dst, bh.RowsCount)\n\tdst = encoding.MarshalInt16(dst, bh.Scale)\n\tdst = append(dst, byte(bh.TimestampsMarshalType), byte(bh.ValuesMarshalType), bh.PrecisionBits)\n\treturn dst\n}", "title": "" }, { "docid": "497a934cbb5a58a9394f53fd0a1cf000", "score": "0.5705101", "text": "func (*BlockContent) Descriptor() ([]byte, []int) {\n\treturn file_maobft_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "e431c2989b7bc948b6a6460096029b1d", "score": "0.56944466", "text": "func (*GetBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "bc50668df7e6b612ed35e678f4bce099", "score": "0.5694062", "text": "func (*ClientBlockGetByTransactionIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "88dee02e21c6f893fa841206d50eee61", "score": "0.5693276", "text": "func (*BeaconBlockHeaderContainer) Descriptor() ([]byte, []int) {\n\treturn file_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "078f9cb2e972dc2f4832eaa413ff746b", "score": "0.5692706", "text": "func newBlockFromProto(blockProto *consensus_pb2.ConsensusBlock) Block {\n\treturn &block{\n\t\tblockId: NewBlockIdFromBytes(blockProto.GetBlockId()),\n\t\tpreviousId: NewBlockIdFromBytes(blockProto.GetPreviousId()),\n\t\tsignerId: NewPeerIdFromSlice(blockProto.GetSignerId()),\n\t\tblockNum: blockProto.GetBlockNum(),\n\t\tpayload: blockProto.GetPayload(),\n\t\tsummary: blockProto.GetSummary(),\n\t}\n}", "title": "" }, { "docid": "c358324f6ac0a9316138fe09e104460f", "score": "0.5689391", "text": "func (*GetHeadersRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "ed801e9f2454c0eabce6d5fd019fd4d7", "score": "0.5663469", "text": "func (c *Client) Header(ctx context.Context, height int64) (*Header, error) {\n\t// TODO: add context timeout here\n\tinfo, err := c.conn.BlockchainInfo(height, height)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(errors.ErrNetwork, \"status: %s\", err.Error())\n\t}\n\tif len(info.BlockMetas) == 0 {\n\t\treturn nil, errors.Wrapf(errors.ErrInput, \"no headers for height %d\", height)\n\t}\n\treturn &info.BlockMetas[0].Header, nil\n}", "title": "" }, { "docid": "5f976420c49fc2bd894cf4762cf37a2a", "score": "0.5648484", "text": "func (*Header) Descriptor() ([]byte, []int) {\n\treturn file_proto_services_gateway_saver_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "041723c099c762366784599af7ffeb00", "score": "0.56407183", "text": "func (*GetBlocksRequest) Descriptor() ([]byte, []int) {\n\treturn file_blockchain_blockchainpb_blockchain_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "14e7cbeabd4fcbee790ba77813fd9d1c", "score": "0.56391203", "text": "func (*BlockMetadata) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_store_v1beta1_listening_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "14e7cbeabd4fcbee790ba77813fd9d1c", "score": "0.56391203", "text": "func (*BlockMetadata) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_store_v1beta1_listening_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "14792f09a83688d90d29b6d731379b30", "score": "0.56347966", "text": "func (*Act3Message) Descriptor() ([]byte, []int) {\n\treturn file_pkg_net_gen_pb_handshake_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "dcbdb43bebe8c4ea198186cc80562d3c", "score": "0.56335765", "text": "func (*BlockInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{49}\n}", "title": "" }, { "docid": "8b66265c37e7c7543a1a962a3a8530eb", "score": "0.56331366", "text": "func (*ClientBlockListResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_block_pb2_client_block_proto_rawDescGZIP(), []int{1}\n}", "title": "" } ]
98ecc9bee0989fdd46d30a91e3293d97
Commit the database transaction after calling this, methods on this instance of InMemClient can no longer be called.
[ { "docid": "72d90b014ddf24c831873d921ce0d961", "score": "0.67004424", "text": "func (client *InMemClient) commit() error {\n\tclient.resetTransactionCache()\n\tif client.Persistence.InMemoryOnly {\n\t\treturn nil\n\t} else {\n\t\treturn client.txn.commit()\n\t}\n}", "title": "" } ]
[ { "docid": "dc29e32b13f680d7286e8144fdceb61a", "score": "0.6670043", "text": "func (db *Database) Commit() {\n\tdb.mutex.Lock()\n\tdefer db.mutex.Unlock()\n\n\tif db.tx == nil {\n\t\treturn\n\t}\n\tcheck(db.tx.Commit())\n\tdb.tx = nil\n\tdb.commits++\n\tdb.updateCurrentSlot()\n}", "title": "" }, { "docid": "aec6de2abcc3f4411df518f1f8a2d6d7", "score": "0.6550324", "text": "func (this *MySqlConnection) Commit() error {\n\tif !this.IsInTransaction() {\n\t\treturn nil\n\t}\n\tdefer this.resetTx()\n\terr := this.tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9aaa92f659d6770b4b6b25dcfb29927f", "score": "0.65475523", "text": "func (tx *Tx) Commit() error {\n\tif tx.mdb.globalLock == nil {\n\t\treturn errors.New(\"attempt to commit a transaction of a closed DB\")\n\t}\n\ttx.mdb.globalLock.Lock()\n\tdefer tx.mdb.globalLock.Unlock()\n\ttx.mdb.tx = tx.prev\n\tif tx.prev == nil {\n\t\t//fmt.Println(\"*** real commit\")\n\t\treturn tx.tx.Commit()\n\t}\n\tif tx.released {\n\t\treturn errors.New(\"nested transaction has already been rolled back or commmitted\")\n\t}\n\t_, err := tx.tx.Exec(fmt.Sprintf(\"RELEASE SP%d;\", tx.savePoint))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"minidb commit transaction failed, %s\", err)\n\t}\n\t//fmt.Printf(\"*** release savepoint SP%d\\n\", savePoint)\n\ttx.released = true\n\treturn nil\n}", "title": "" }, { "docid": "c18918b6b98358f43dce0cc06481c132", "score": "0.6496163", "text": "func (t *DBTx) Commit() error {\n\treturn t.tx.Commit()\n}", "title": "" }, { "docid": "25a862f9777ad634473f5d9da23d04c6", "score": "0.64752734", "text": "func (c *GormController) Commit() revel.Result {\n\tif c.Txn == nil {\n\t\treturn nil\n\t}\n\tc.Txn.Commit()\n\tif err := c.Txn.Error; err != nil && err != sql.ErrTxDone {\n\t\tpanic(err)\n\t}\n\tc.Txn = nil\n\treturn nil\n}", "title": "" }, { "docid": "be103b4df1a81bde0fa9da1e5538c26d", "score": "0.646409", "text": "func (svr *SQLite) Commit() error {\n\t// verify if the database connection is good\n\tif err := svr.Ping(); err != nil {\n\t\treturn err\n\t}\n\n\t// does transaction already exist\n\tif svr.tx == nil {\n\t\treturn errors.New(\"Transaction Does Not Exist\")\n\t}\n\n\t// perform tx commit\n\tif err := svr.tx.Commit(); err != nil {\n\t\treturn err\n\t}\n\n\t// commit successful\n\tsvr.tx = nil\n\treturn nil\n}", "title": "" }, { "docid": "e04f7fb3d3cfce0a95d0960f69d5e85b", "score": "0.64559555", "text": "func (t *GenmaiTransaction) Commit() error {\n\treturn t.tx.Commit()\n}", "title": "" }, { "docid": "a16c69d4b6208beee9d26d9015a8e1f9", "score": "0.6449799", "text": "func (c *Client) Commit() {\n\tif err := c.tx.Commit(c.ctx); err != nil {\n\t\terr = errors.WithStack(err)\n\t\tlogger.Error(err)\n\t}\n}", "title": "" }, { "docid": "4069a8b7eddba8af4fead9d7106e311a", "score": "0.64086723", "text": "func (self *ActiveTxPool) Commit(transactionId int64, schemaInfo *SchemaInfo) {\n\tconn := self.Get(transactionId)\n\tdefer conn.discard()\n\tself.txStats.Add(\"Completed\", time.Now().Sub(conn.startTime))\n\tdefer func() {\n\t\tfor tableName, invalidList := range conn.dirtyTables {\n\t\t\ttableInfo := schemaInfo.GetTable(tableName)\n\t\t\tfor key := range invalidList {\n\t\t\t\ttableInfo.RowCache.Delete(key)\n\t\t\t}\n\t\t\tschemaInfo.Put(tableInfo)\n\t\t}\n\t}()\n\tif _, err := conn.ExecuteFetch(COMMIT, 10000); err != nil {\n\t\tconn.Close()\n\t\tpanic(NewTabletErrorSql(FAIL, err))\n\t}\n}", "title": "" }, { "docid": "488ffe6d447a5a16b2796179303edd39", "score": "0.63743705", "text": "func (tx *writeTransaction) Commit() error {\n\ttx.reader.check()\n\ttx.reader.alive = false\n\ttx.partition.rwLock.Unlock();\n\treturn nil;\n}", "title": "" }, { "docid": "3890ade6e9a3eff336fd294322f651a6", "score": "0.6331842", "text": "func (a *Adapter) Commit(ctx context.Context) error {\n\tvar err error\n\n\tfinish := a.Instrumenter.Observe(ctx, \"adapter-commit\", \"commit transaction\")\n\n\tif a.Tx == nil {\n\t\terr = errors.New(\"unable to commit outside transaction\")\n\t} else if a.savepoint > 0 {\n\t\t_, _, err = a.Exec(ctx, \"RELEASE SAVEPOINT s\"+strconv.Itoa(a.savepoint)+\";\", []interface{}{})\n\t} else {\n\t\terr = a.Tx.Commit()\n\t}\n\n\tfinish(err)\n\n\treturn a.Config.ErrorFunc(err)\n}", "title": "" }, { "docid": "34c64403dae6dd9bf9640bd765a20c3b", "score": "0.6314891", "text": "func (tx *DBTx) Commit() error {\n\tif tx.isClosed {\n\t\tpanic(\"dbtx is closed\")\n\t}\n\tif tx.OnCommit != nil {\n\t\tif err := tx.OnCommit(); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\ttx.isClosed = true\n\ttx.mtx.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "361b616734349a7067158022adc0d0e5", "score": "0.6300249", "text": "func (*QueryCtxImpl) CommitTxn(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "1509bb2172e928fc877fb22c8132aa71", "score": "0.6292537", "text": "func (s *DbHelper) Commit(ctx context.Context, txid db.TransactionID) {\n\tc := s.getContext(ctx)\n\tif c == nil {\n\t\tpanic(\"Can't use transactions without pre-loading a context\")\n\t}\n\n\tif c.txCount != int(txid) {\n\t\tpanic(\"Missing Rollback after previous Begin\")\n\t}\n\n\tif c.txCount == 0 {\n\t\tpanic(\"Called Commit without a matching Begin\")\n\t}\n\tif c.txCount == 1 {\n\t\terr := c.tx.Commit()\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tc.tx = nil\n\t}\n\tc.txCount--\n}", "title": "" }, { "docid": "f9acfa4ecdd7bc7c5ec59fea5ebc4f80", "score": "0.6280273", "text": "func (t *txn) Commit() error {\n\tif err := t.ctx.Err(); err != nil {\n\t\tif rbErr := t.Rollback(); rbErr != nil {\n\t\t\terr = fmt.Errorf(\"%v, Rollback(): %v\", err, rbErr)\n\t\t}\n\t\treturn err\n\t}\n\n\t// Commit the database transaction. On failure, we lose the mutation.\n\tif err := t.dbTxn.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"db.Commit(): %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95501560c550cad9baa9ad6991b1c1f0", "score": "0.62802565", "text": "func (t *Transaction) Commit() error {\n\treturn t.tx.Commit()\n}", "title": "" }, { "docid": "c8c5ce66f98216878e535668020b69e3", "score": "0.6268935", "text": "func (r *Tx) Commit() (err error) {\n\tif r.ended {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tr.dbMutex.Unlock()\n\t\tr.ended = true\n\t}()\n\terr = r.real.Commit()\n\tif err != nil {\n\t\terr = liberr.Wrap(err)\n\t\treturn\n\t}\n\n\tr.journal.Commit()\n\n\treturn\n}", "title": "" }, { "docid": "ff31e682502679ef8b66cff7428d8ea0", "score": "0.62660354", "text": "func (db *BaseDB) Commit() error {\n\tpanic(\"Commit not impl\")\n}", "title": "" }, { "docid": "12359d7e14075b5d8a707de4af6ca21a", "score": "0.62387615", "text": "func (sdt *SQLxTx) Commit() error {\n\treturn sdt.DB.Commit()\n}", "title": "" }, { "docid": "a821052a173546a915b9f767483bd87e", "score": "0.62223715", "text": "func (t *transaction) Commit() error {\n\tif !t.writable {\n\t\treturn errors.New(\"read-only transaction cannot commit changes\")\n\t}\n\n\tif t.closed {\n\t\treturn errors.New(\"already closed transaction cannot commit changes\")\n\t}\n\n\treturn t.db.storage.Write(t.batch, writeOptions)\n}", "title": "" }, { "docid": "df5d3e672baf83622855479ad0426cea", "score": "0.62111276", "text": "func (s *singleton) Commit() error {\n\treturn s.tx.Commit()\n}", "title": "" }, { "docid": "558ebe4962b72a4562c1d3de72f93c0f", "score": "0.6194079", "text": "func (t *Transaction) Commit() error {\n\tif !t.closed {\n\t\tt.closed = true\n\t\tif t.dbmap.logger != nil {\n\t\t\tnow := time.Now()\n\t\t\tdefer t.dbmap.trace(now, \"commit;\")\n\t\t}\n\t\treturn t.tx.Commit()\n\t}\n\n\treturn sql.ErrTxDone\n}", "title": "" }, { "docid": "ea9a588504c8fa587bc865ef69a5a7af", "score": "0.61774087", "text": "func Commit(c context.Context) error {\n\ttx := c.Value(\"transaction\").(*xorm.Session)\n\tif tx == nil {\n\t\treturn nil\n\t}\n\n\terr := tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc = context.WithValue(c, \"transaction\", nil)\n\ttx.Close()\n\treturn nil\n}", "title": "" }, { "docid": "8abe3e3e8e8f432b3e943149cb332672", "score": "0.61009336", "text": "func (tx *Tx) Commit() error {\n\tif tx.funcd {\n\t\tpanic(\"managed tx commit not allowed\")\n\t}\n\tif tx.db == nil {\n\t\treturn ErrTxClosed\n\t} else if !tx.writable {\n\t\treturn ErrTxNotWritable\n\t}\n\t// Unlock the database and allow for another writable transaction.\n\ttx.unlock()\n\t// Clear the db field to disable this transaction from future use.\n\ttx.db = nil\n\treturn nil\n}", "title": "" }, { "docid": "0ef2015afbcf5057b2eb5b494db4f46a", "score": "0.6099037", "text": "func Commit(tx db.Tx) {\n\tif err := tx.Commit(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "3598f646c016a87cfecef028803cc43f", "score": "0.60319865", "text": "func (r *Tx) End() (err error) {\n\tif r.ended {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tr.dbMutex.Unlock()\n\t\tr.ended = true\n\t}()\n\terr = r.real.Rollback()\n\tif err != nil {\n\t\terr = liberr.Wrap(err)\n\t\treturn\n\t}\n\n\tr.journal.Unstage()\n\n\treturn\n}", "title": "" }, { "docid": "5dc47878ca52551847d3d71840aedac9", "score": "0.6027868", "text": "func (ndb *nodeDB) Commit() error {\n\tndb.mtx.Lock()\n\tdefer ndb.mtx.Unlock()\n\n\tvar err error\n\tif ndb.opts.KeepEvery != 0 {\n\t\tif ndb.opts.Sync {\n\t\t\terr = ndb.snapshotBatch.WriteSync()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"error in snapShotBatch writesync\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = ndb.snapshotBatch.Write()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"error in snapShotBatch write\")\n\t\t\t}\n\t\t}\n\t\tndb.snapshotBatch.Close()\n\t}\n\tif ndb.opts.KeepRecent != 0 {\n\t\tif ndb.opts.Sync {\n\t\t\terr = ndb.recentBatch.WriteSync()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"error in recentBatch writesync\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = ndb.recentBatch.Write()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"error in recentBatch write\")\n\t\t\t}\n\t\t}\n\t\tndb.recentBatch.Close()\n\t}\n\tndb.snapshotBatch = ndb.snapshotDB.NewBatch()\n\tndb.recentBatch = ndb.recentDB.NewBatch()\n\treturn nil\n}", "title": "" }, { "docid": "ee8b633da8026805a779b32c42bd2651", "score": "0.6017574", "text": "func (qe *QueryEngine) Commit(ctx context.Context, logStats *LogStats, transactionID int64) {\n\tdirtyTables, err := qe.txPool.SafeCommit(ctx, transactionID)\n\tfor tableName, invalidList := range dirtyTables {\n\t\ttableInfo := qe.schemaInfo.GetTable(tableName)\n\t\tif tableInfo == nil {\n\t\t\tcontinue\n\t\t}\n\t\tinvalidations := int64(0)\n\t\tfor key := range invalidList {\n\t\t\t// Use context.Background, becaause we don't want to fail\n\t\t\t// these deletes.\n\t\t\ttableInfo.Cache.Delete(context.Background(), key)\n\t\t\tinvalidations++\n\t\t}\n\t\tlogStats.CacheInvalidations += invalidations\n\t\ttableInfo.invalidations.Add(invalidations)\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "7912e301ab08795ae1087edc0192dbca", "score": "0.5995449", "text": "func (c *conn) Commit() error {\n\tif c.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\terr := c.checktx(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.status == statusInBadTx {\n\t\tif err := c.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ErrInFailedTransaction\n\t}\n\treturn c.transac(commit)\n}", "title": "" }, { "docid": "bc7d442549a0bb32b0489befcf4e7577", "score": "0.5973614", "text": "func (m *Model) Commit() (err error) {\n\tif m.Tx != nil {\n\t\terr = m.Tx.Commit()\n\t}\n\treturn\n}", "title": "" }, { "docid": "4d9285afaa4c4fc6ad8484ffd53b1828", "score": "0.5958441", "text": "func (*QueryCtxImpl) RollbackTxn() {\n\treturn\n}", "title": "" }, { "docid": "2d18bd8df94a975f195ec66a3e333bf2", "score": "0.594108", "text": "func (p Populator) Commit() error {\n\treturn p.tx.Commit()\n}", "title": "" }, { "docid": "0ec26cfd9cb935e8f1e11407202423e7", "score": "0.59346294", "text": "func (b *SqlBrickTx) Commit() error {\n\tif b.tx == nil {\n\t\treturn errors.New(\"the Begin func must be invoked first\")\n\t}\n\n\treturn b.tx.Commit()\n}", "title": "" }, { "docid": "93e4dc4c98c55e17bb0403d561267409", "score": "0.59240746", "text": "func (t *Transaction) Commit() error {\n\tif !t.closed {\n\t\tt.closed = true\n\t\tt.dbmap.trace(\"commit;\")\n\t\terr := t.tx.Commit()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// run post commit hooks\n\t\tfor _, o := range *t.insertList {\n\t\t\tif v, ok := o.(HasPostInsertCommitted); ok {\n\t\t\t\tv.PostInsertCommitted(t.dbmap)\n\t\t\t}\n\t\t}\n\t\tfor _, o := range *t.updateList {\n\t\t\tif v, ok := o.(HasPostUpdateCommitted); ok {\n\t\t\t\tv.PostUpdateCommitted(t.dbmap)\n\t\t\t}\n\t\t}\n\t\tfor _, o := range *t.deleteList {\n\t\t\tif v, ok := o.(HasPostDeleteCommitted); ok {\n\t\t\t\tv.PostDeleteCommitted(t.dbmap)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treturn sql.ErrTxDone\n}", "title": "" }, { "docid": "d5d8962db3388e484bb1cc904dbb6c1b", "score": "0.59228414", "text": "func (m *Finalizer) Commit() error {\n\tvar status string\n\terr := m.TX.QueryRow(\"SELECT txid_status($1)\", m.serverTXID).Scan(&status)\n\tif err != nil {\n\t\treturn txmanager.WrapError(err, \"Commit() failed to get txid_status()\")\n\t}\n\tm.Trace(\"transaction status at Commit() '%s'\", status)\n\tif status != \"in progress\" {\n\t\treturn fmt.Errorf(\"Commit on TX in status '%s'\", status)\n\t}\n\terr = m.TX.Commit()\n\tif err != nil {\n\t\treturn txmanager.WrapError(err, \"Failed to commit\")\n\t}\n\tm.Trace(\"Transaction committed\")\n\treturn nil\n}", "title": "" }, { "docid": "897e8f4942f5551f56b7baae29273bbe", "score": "0.59223443", "text": "func (repo *_repository) Commit() error {\n\tif repo.db == nil {\n\t\treturn errors.Wrap(errors.ErrInternalError, \"repo.db is nil\")\n\t}\n\tdefer func() {\n\t\trepo.isInTransaction = true\n\t}()\n\terr := repo.db.Commit().Error\n\tif err != nil {\n\t\treturn errors.Wrapf(errors.ErrInternalError, \"%+v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70b35848c989198496d9b8bba702dd64", "score": "0.59099996", "text": "func (slot *Slot) Commit() {\n\tslot.inTransaction = false\n\tslot.touched = false\n\tslot.update()\n}", "title": "" }, { "docid": "ec2fed0d6aa8486a48ece063a42d20fb", "score": "0.59002024", "text": "func commit(b *backends.SimulatedBackend) {\n\tb.Commit()\n\tblockNumber++\n}", "title": "" }, { "docid": "23c0efe622ad8974c51814a4feb15e43", "score": "0.58845913", "text": "func commit(b *backends.SimulatedBackend) {\n\tb.Commit()\n}", "title": "" }, { "docid": "32d869450b958a639ffa0226fc2750f1", "score": "0.5881922", "text": "func (b *Batch) Commit() error {\n\tfor _, row := range *b.Rows {\n\t\tPutRow(row)\n\t}\n\tPutRows(b.Rows)\n\tb.Rows = nil\n\tatomic.AddInt32(&b.Group.PendWrite, -1)\n\treturn b.Group.Sys.TryCommit()\n}", "title": "" }, { "docid": "f9042c888215c41622de26a7be72f9bd", "score": "0.5879333", "text": "func (c *Client) Commit() error {\n\treturn c.channel.TxCommit()\n}", "title": "" }, { "docid": "70029d4915e468b9597a4aeb23911ea1", "score": "0.58728063", "text": "func (e *EVMEmulator) Commit() {\n\tif len(e.pending.txs) == 0 {\n\t\treturn\n\t}\n\tif _, err := e.blockchain.InsertChain([]*types.Block{e.finalizeBlock()}); err != nil {\n\t\tpanic(err)\n\t}\n\te.Rollback(e.pending.header.Time + timeDelta)\n}", "title": "" }, { "docid": "17908a06919ceb67b97f99257ecab442", "score": "0.58692145", "text": "func (tran *Transaction) Commit() {\n\tlastKV:=make(map[string]interface{})\n\tSET:=make(map[interface{}]interface{})\n\tHSET:=make(map[interface{}]interface{})\n\tlastKV[\"HSET\"]=HSET\n\tlastKV[\"SET\"]=SET\n\tfmt.Println(\"commit a transaction done\")\n\ttran.LastKV = lastKV\n}", "title": "" }, { "docid": "b8e0d447f64355449e2d4f6416768ab6", "score": "0.58691025", "text": "func (tx *Transaction) Commit() error {\n\terr := tx.tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif tx.attached {\n\t\ttx.db.attachedTxMu.Lock()\n\t\tdefer tx.db.attachedTxMu.Unlock()\n\n\t\tif tx.db.attachedTransaction != nil {\n\t\t\ttx.db.attachedTransaction = nil\n\t\t}\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "b980561af375b57d99965b02b19d4621", "score": "0.58687234", "text": "func (txn *Transaction) Commit() error {\n\ttxn.mut.Lock()\n\tdefer txn.mut.Unlock()\n\tif err := txn.unsafeCheckState(); err != nil {\n\t\treturn err\n\t}\n\t// Right before we commit, we need to update the count with txn.internalCount.\n\tif err := updateCountWithTransaction(txn.colInfo, txn.readWriter, int(txn.internalCount)); err != nil {\n\t\t_ = txn.Discard()\n\t\treturn err\n\t}\n\tif err := txn.batchWriter.Write(txn.readWriter.batch, nil); err != nil {\n\t\t_ = txn.Discard()\n\t\treturn err\n\t}\n\ttxn.committed = true\n\ttxn.colInfo.writeMut.Unlock()\n\ttxn.db.globalWriteLock.RUnlock()\n\treturn nil\n}", "title": "" }, { "docid": "dc0121989c8069e98c149277d3595f3e", "score": "0.5838003", "text": "func (tx *EsTx) Commit() error {\n\treturn errors.New(\"Not implemented yet\")\n}", "title": "" }, { "docid": "3178012f71d9a256b1bdc1b2d1f95309", "score": "0.5808851", "text": "func (t *transaction) Close() {\n\tt.snapshot.Release()\n\n\tif t.batch != nil {\n\t\tt.batch.Reset()\n\t}\n\n\tt.closed = true\n}", "title": "" }, { "docid": "064ba8000f6503297f4d1761b5069230", "score": "0.5805476", "text": "func (tx Tx) Commit() error {\n\treturn tx.Tx.Commit()\n}", "title": "" }, { "docid": "59a47ffb1ac676096a08eaa6d16f6a4b", "score": "0.5803227", "text": "func (db *Database) Transaction(run func(db *Database) error) error {\n\terr := db.Client.Transaction(func(client *Client) error {\n\t\tnewDB := *db\n\t\tnewDB.Client = client\n\n\t\treturn run(&newDB)\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd98b4b00f044009af4d81f3b0ed25db", "score": "0.57878983", "text": "func CommittTransaction (db *sql.DB) (error) {\n\t_, err := db.Exec (\"COMMIT\");\n\treturn err;\n}", "title": "" }, { "docid": "5a89bf19549ecdfbea6d94be5b18e32a", "score": "0.5782239", "text": "func (c *Store) Commit(){\n\tjsonString, _ := json.Marshal(store.database)\n\tioutil.WriteFile(\"db.json\", jsonString, os.ModePerm)\n}", "title": "" }, { "docid": "0b0013be663a2033c683fa4992009e05", "score": "0.5780694", "text": "func (gs *GeneralStore) EndTransaction(ctx context.Context) error {\n\tif rid, err := gs.getRequestID(ctx); err != nil {\n\t\treturn err\n\n\t} else if tx := gs.sqliteTxs[rid]; tx != nil {\n\t\terr := tx.Commit()\n\t\tgs.sqliteTxs[rid] = nil\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fabc2c3a9c8fe29d594f9fe9deef9dab", "score": "0.5776783", "text": "func (self *NestedTransactions) Commit() error {\n\tif len(self.transactions) == 0 {\n\t\treturn ErrNoTransaction\n\t}\n\tself.transactions = []*Transaction{}\n\treturn nil\n}", "title": "" }, { "docid": "644a68af4c9310b51f90c398f9554fc4", "score": "0.5766431", "text": "func (bs *BlockStore) Close() (err error) {\n\tif err = bs.db.Update(func(txn *badger.Txn) error {\n\t\treturn txn.Set(headKey, bs.head)\n\t}); err != nil {\n\t\treturn err\n\t}\n\treturn bs.db.Close()\n}", "title": "" }, { "docid": "f02fb37c75d0e4715fb86e24a2d51270", "score": "0.57647", "text": "func (tx *TxHandle) Commit() error {\n\treturn tx.T.Commit()\n}", "title": "" }, { "docid": "c95663aaa605abcf7e8cc687dda21c01", "score": "0.57637256", "text": "func (c *Conn) Close() error {\n\tif c.tx != nil {\n\t\tc.tx.Rollback()\n\t\tc.tx = nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d95bad192c4b409636f103d86730e20d", "score": "0.5754925", "text": "func (db *Database) Commit() error {\n\te := C.sp_commit(db.Pointer)\n\tif 0 != e {\n\t\treturn db.Error()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d2f86b77ca6e2059790e43800c63c5a", "score": "0.5751056", "text": "func (m *GenBlockModule) Commit() {\n\tm.block.State().Trie.Sync()\n}", "title": "" }, { "docid": "903b3f1ac1be1f334fb875b4111dbb76", "score": "0.57482874", "text": "func (b *Batch) Commit() error {\n\t_assert(!b.managed, \"managed batch commit not allowed\")\n\tb.db.closeW.Add(1)\n\tdefer func() {\n\t\tclose(b.commitComplete)\n\t\tb.db.closeW.Done()\n\t\tb.Abort()\n\t}()\n\n\t// Write if any pending entries in batch\n\tif err := b.Write(); err != nil {\n\t\treturn err\n\t}\n\tfor timeID, tinyBatch := range b.tinyBatchGroup {\n\t\t<-tinyBatch.doneChan\n\t\tb.db.releaseTimeID(timeID)\n\t}\n\n\tb.tinyBatchGroup = make(map[int64]*tinyBatch)\n\treturn nil\n}", "title": "" }, { "docid": "1f267d8ba824931a81261067f46b76f8", "score": "0.57253534", "text": "func (tx *Transaction) Commit() error {\n\terr := tx.Tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif tx.Writable {\n\t\t\ttx.DBMu.Unlock()\n\t\t} else {\n\t\t\ttx.DBMu.RUnlock()\n\t\t}\n\t}()\n\n\tfor i := len(tx.OnCommitHooks) - 1; i >= 0; i-- {\n\t\ttx.OnCommitHooks[i]()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e035bf19530e95941db8fd10b278df91", "score": "0.57084024", "text": "func (t *instrumentedTx) Commit() error {\n\tif t.span != nil {\n\t\tdefer t.span.Finish()\n\t}\n\treturn t.tx.Commit()\n}", "title": "" }, { "docid": "349ae5f9b8ca4ab9d1fcd7586445c56b", "score": "0.57069796", "text": "func (vs *virtualState) CommitToDb(b Block) error {\n\tbatchData, err := util.Bytes(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbatchDbKey := dbkeyBatch(b.StateIndex())\n\n\tvarStateData, err := util.Bytes(vs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvarStateDbkey := dbprovider.MakeKey(dbprovider.ObjectTypeSolidState)\n\n\tsolidStateValue := util.Uint32To4Bytes(vs.BlockIndex())\n\tsolidStateKey := dbprovider.MakeKey(dbprovider.ObjectTypeSolidStateIndex)\n\n\tkeys := [][]byte{varStateDbkey, batchDbKey, solidStateKey}\n\tvalues := [][]byte{varStateData, batchData, solidStateValue}\n\n\t// store processed request IDs\n\t// TODO store request IDs in the 'log' contract\n\tfor _, rid := range b.RequestIDs() {\n\t\tkeys = append(keys, dbkeyRequest(rid))\n\t\tvalues = append(values, []byte{0})\n\t}\n\n\t// store uncommitted mutations\n\tvs.variables.Mutations().IterateLatest(func(k kv.Key, mut buffered.Mutation) bool {\n\t\tkeys = append(keys, dbkeyStateVariable(k))\n\n\t\t// if mutation is MutationDel, mut.Value() = nil and the key is deleted\n\t\tvalues = append(values, mut.Value())\n\t\treturn true\n\t})\n\n\terr = util.DbSetMulti(vs.db, keys, values)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvs.variables.ClearMutations()\n\treturn nil\n}", "title": "" }, { "docid": "ab73bfa4e0f82c4d7b96a473bbe05988", "score": "0.56828153", "text": "func (bc *blockchain) Close() error {\n\treturn bc.blockDb.Close()\n}", "title": "" }, { "docid": "5ca72af1a7fab4ad6d7cee6da66bb3f0", "score": "0.56805676", "text": "func (tx *ogonoriTx) Commit() error {\n\tif tx.conn == nil {\n\t\treturn oerror.ErrInvalidConn{Msg: \"ogonoriConn not initialized in ogonoriTx#Commit\"}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5504340864b30e82f1c924cc2cb582e6", "score": "0.56793946", "text": "func (s *DB) Commit() *DB {\n\tvar emptySQLTx *sql.Tx\n\tif db, ok := s.db.(sqlTx); ok && db != nil && db != emptySQLTx {\n\t\ts.AddError(db.Commit())\n\t} else {\n\t\ts.AddError(ErrInvalidTransaction)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "72a0b1809f89401f32e6f32ca70d8ab2", "score": "0.56790423", "text": "func (db *Writer) Commit() error {\n\tif db.fresh != true {\n\t\treturn ErrAlreadyCommitted\n\t}\n\tdb.fresh = false\n\t_, err := db.box.Write(dibbaHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, val := range db.files {\n\t\terr := val.MarshalTo(db.box)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = db.box.Write(dibbaEnder)\n\treturn err\n}", "title": "" }, { "docid": "7bac0523dca133a7473af196d932d536", "score": "0.56762576", "text": "func (b *Batch) Commit() error {\n\treturn b.leveldb.Write(b.batch, nil)\n}", "title": "" }, { "docid": "439d62eaf0ce3846af72504f813771c4", "score": "0.56664234", "text": "func (inf *APIInfo) Close() {\n\tdefer inf.CancelTx()\n\tif err := inf.Tx.Tx.Commit(); err != nil && err != sql.ErrTxDone {\n\t\tlog.Errorln(\"committing transaction: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "57aa13b1fea8befb367aed7854a48395", "score": "0.5657157", "text": "func Commit(tx *sql.Tx) error {\n\tfnc := \"Commit\"\n\n\tif tx == nil {\n\t\terr := Err{Fix: \"LIVEDB:no transaction to commit\"}\n\t\treturn fmt.Errorf(fnc+\":%w\", err)\n\t}\n\n\terr := tx.Commit()\n\tif err != nil {\n\t\te := Err{Fix: \"LIVEDB:commit transaction failed\"}\n\t\treturn fmt.Errorf(fnc+\":%w:\"+err.Error(), e)\n\t}\n\n\tLog(\"commit transaction\")\n\n\treturn nil\n}", "title": "" }, { "docid": "7eccd0801f75e1135d92f968bdeb38a6", "score": "0.5630279", "text": "func (db *IndexerDb) CommitBlock(round uint64, timestamp int64, rewardslevel uint64, headerbytes []byte) error {\n\tf := func(ctx context.Context, tx *sql.Tx) error {\n\t\treturn db.commitBlock(tx, round, timestamp, rewardslevel, headerbytes)\n\t}\n\terr := db.txWithRetry(context.Background(), serializable, f)\n\n\tdb.txrows = nil\n\tdb.txprows = nil\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CommitBlock(): %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55833d36fc803bde02cfad4bd8415b37", "score": "0.5628571", "text": "func (x *blockIndexer) commit() error {\n\tvar commitErr error\n\tfor k, v := range x.dirtyAddr {\n\t\tif commitErr == nil {\n\t\t\tif err := v.Finalize(); err != nil {\n\t\t\t\tcommitErr = err\n\t\t\t}\n\t\t}\n\t\tdelete(x.dirtyAddr, k)\n\t}\n\tif commitErr != nil {\n\t\treturn commitErr\n\t}\n\t// total block and total action index\n\tif err := x.tbk.Finalize(); err != nil {\n\t\treturn err\n\t}\n\tif err := x.tac.Finalize(); err != nil {\n\t\treturn err\n\t}\n\tif err := x.kvStore.WriteBatch(x.batch); err != nil {\n\t\treturn err\n\t}\n\tx.batch.Clear()\n\treturn nil\n}", "title": "" }, { "docid": "8835973b25ecbe4fc5d8543f6513c4e6", "score": "0.5626414", "text": "func (b *Backend) commit() error {\n\tlog := b.log.WithField(\"pid\", b.pidCounter)\n\n\tb.inTx = false\n\tlog.Debug(\"commit\")\n\tif err := b.pager.Flush(); err != nil {\n\t\tlog.WithError(err).Error(\"commit failed\")\n\t\tb.rollback()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9001e90a3e5a4ecca6ac5b845909a334", "score": "0.5624176", "text": "func (t *Tx) Commit() error {\n\tlog.Info(\"Commit(%p)\", t.tx)\n\t_, err := t.tx.Commit()\n\treturn err\n}", "title": "" }, { "docid": "2674267ad6e3f72527ed3b86919c24f0", "score": "0.5617481", "text": "func (c *conn) endTx(commit bool) error {\n\tif !c.tx {\n\t\treturn errors.New(\"database/sql/driver: [asifjalil][CLI Driver]: commit/rollback when not in a transaction\")\n\t}\n\tc.tx = false\n\n\tvar howToEnd C.SQLSMALLINT\n\n\tif commit {\n\t\thowToEnd = C.SQL_COMMIT\n\t} else {\n\t\thowToEnd = C.SQL_ROLLBACK\n\t}\n\n\tret := C.SQLEndTran(C.SQL_HANDLE_DBC, c.hdbc, howToEnd)\n\tif !success(ret) {\n\t\treturn formatError(C.SQL_HANDLE_DBC, c.hdbc)\n\t}\n\terr := c.setAutoCommitAttr(C.SQL_AUTOCOMMIT_ON)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "167946aa4e8ed297c13448ce8124c791", "score": "0.5617431", "text": "func (c *Combine) Commit() {\n\terr := c.tx.Commit()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tc.tx = nil\n}", "title": "" }, { "docid": "2062a79078200877fdb4199d2ca60c94", "score": "0.5613413", "text": "func (gmtx *Transaction) Commit() (cm *datastore.Commit, err error) {\n\tcm, err = gmtx.Transaction.Commit()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, pending := range gmtx.gonm.pending {\n\t\tkey := cm.Key(pending.pkey)\n\t\tif err := setStructKey(pending.dst, key); err != nil {\n\t\t\treturn cm, gmtx.gonm.stackError(err)\n\t\t}\n\t}\n\treturn cm, nil\n}", "title": "" }, { "docid": "1943bd4c51986eb7b5ee4abdd7d51477", "score": "0.5612997", "text": "func (b *Batch) Commit() {\n\tif nil != b {\n\t\tincrBatch(b.c, b.counts)\n\t\tb.counts = make(map[string]int64)\n\t}\n}", "title": "" }, { "docid": "0d37f1f86fbec8a83e8d4b2f27c825af", "score": "0.56059074", "text": "func (u *Upload) Commit() error {\n\tif err := u.flush(); err != nil {\n\t\treturn err\n\t}\n\treturn u.tx.Commit()\n}", "title": "" }, { "docid": "2d9ff0e958c3a58fc668b2494661d358", "score": "0.56058925", "text": "func (b boltClient) Close() error {\n\treturn b.db.Close()\n}", "title": "" }, { "docid": "2ae624f4fd45649e6cf0e32cccf1da45", "score": "0.5599653", "text": "func (c *Client) CommitTransaction() error {\n\terr := c.CheckCommitTransaction()\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.TransactionState = Committed\n\treturn nil\n}", "title": "" }, { "docid": "5cc21e2aee91beaef5cda1505ce1805d", "score": "0.5594939", "text": "func (tc *TiDBContext) CommitTxn(ctx context.Context) error {\n\treturn tc.session.CommitTxn(ctx)\n}", "title": "" }, { "docid": "028b9e02b12e354e6ed249550c615dd7", "score": "0.55932593", "text": "func (s *Transaction) Commit() error {\n\tif s.Closed() {\n\t\tlogrus.Panic(\"You cannot commit a closed transaction\")\n\t}\n\n\tif err := s.tx.Commit(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.commitCb(s); err != nil {\n\t\treturn err\n\t}\n\ts.close()\n\n\treturn nil\n}", "title": "" }, { "docid": "74cd17da8ce55c5bbba0dfed8dce5b57", "score": "0.55821425", "text": "func (tx *AddressPoolTx) Commit() {\n\ttx.m.Lock()\n\tdefer tx.m.Unlock()\n\ttx.mustNotFinished()\n}", "title": "" }, { "docid": "0ae2a74d422f3a8b6f8e41c29b00db67", "score": "0.5572536", "text": "func (tx *DBTx) Rollback() error {\n\tif tx.isClosed {\n\t\tpanic(\"dbtx is closed\")\n\t}\n\ttx.OnCommit = nil\n\ttx.isClosed = true\n\ttx.mtx.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "d228d1470993a4a3a2c77f698859f67c", "score": "0.55708504", "text": "func (s *ServiceAppenderAdapter) Commit() error {\n\treturn nil\n}", "title": "" }, { "docid": "52877e2dd07c5365d963f0c403025907", "score": "0.556369", "text": "func Commit(tx *sqlx.Tx, resource string) error {\n\tif err := tx.Commit(); err != nil {\n\t\treturn Rollback(tx, resource, Err(resource, err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6da730d6b5681bc2201acda3db03c1b3", "score": "0.5555635", "text": "func (tx *Transaction) Commit() error {\n\tif tx.aborted {\n\t\treturn MakeError(\"Transaction already aborted\")\n\t}\n\tif tx.committed {\n\t\treturn MakeError(\"Transaction already comitted\")\n\t}\n\tfor _, f := range tx.handlers {\n\t\te := f.Finalize()\n\t\tif e != nil {\n\t\t\ttx.Abort(e.Error())\n\t\t\treturn e\n\t\t}\n\t}\n\tfor _, f := range tx.handlers {\n\t\te := f.Commit()\n\t\tif e != nil {\n\t\t\ttx.Abort(e.Error())\n\t\t\treturn e\n\t\t}\n\t}\n\ttx.committed = true\n\treturn nil\n}", "title": "" }, { "docid": "88dd35ba9d79101e5a23dd7145d8a4e5", "score": "0.5544899", "text": "func (t *Txn) Commit() error {\n\tif t.vppTxn == nil {\n\t\treturn nil\n\t}\n\tctx := context.Background()\n\tif t.isResync {\n\t\tctx = scheduler.WithResync(ctx, scheduler.FullResync, true)\n\t}\n\t_, err := t.vppTxn.Commit(ctx)\n\tt.vppTxn = nil\n\treturn err\n}", "title": "" }, { "docid": "88dd35ba9d79101e5a23dd7145d8a4e5", "score": "0.5544899", "text": "func (t *Txn) Commit() error {\n\tif t.vppTxn == nil {\n\t\treturn nil\n\t}\n\tctx := context.Background()\n\tif t.isResync {\n\t\tctx = scheduler.WithResync(ctx, scheduler.FullResync, true)\n\t}\n\t_, err := t.vppTxn.Commit(ctx)\n\tt.vppTxn = nil\n\treturn err\n}", "title": "" }, { "docid": "0b048186a273dc79de23c3cb49140fff", "score": "0.5542852", "text": "func (b *Batch) Commit(o *WriteOptions) error {\n\treturn b.db.Apply(b, o)\n}", "title": "" }, { "docid": "4b95f09cd37975654c0379b779dceea3", "score": "0.5539699", "text": "func (ot *IndexDB) Commit(f fs.AtomicFileWriter, hsh string, shard int, timestamp int64, method string, metadata map[string]string, nursery bool, shardhash string) error {\n\thsh, _, dbPart, _, err := ValidateHash(hsh, ot.RingPartPower, ot.dbPartPower, ot.subdirs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmetabytes := []byte{}\n\tmetahash := \"\"\n\texpires := (*string)(nil)\n\n\tif len(metadata) > 0 {\n\t\tmetabytes, err = json.Marshal(metadata)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error marshalling metadata: %v\", err)\n\t\t}\n\t\tmetahash = MetadataHash(metadata)\n\t\tif xda, ok := metadata[\"X-Delete-At\"]; ok {\n\t\t\texpires = &xda\n\t\t}\n\t}\n\n\tif f != nil {\n\t\tif err = f.Sync(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar tx *sql.Tx\n\tvar rows *sql.Rows\n\t// Single defer so we can control the order of the tear down.\n\tdefer func() {\n\t\tif rows != nil {\n\t\t\trows.Close()\n\t\t}\n\t\tif tx != nil {\n\t\t\t// If tx.Commit() was already called, this is a No-Op.\n\t\t\ttx.Rollback()\n\t\t}\n\t\tif f != nil {\n\t\t\t// If f.Save() was already called, this is a No-Op.\n\t\t\tf.Abandon()\n\t\t}\n\t}()\n\tdb := ot.dbs[dbPart]\n\ttx, err = db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdeletion := method == \"DELETE\"\n\trows, err = tx.Query(`\n SELECT timestamp, metahash, metadata, shardhash\n FROM objects\n WHERE hash = ? AND shard = ? AND nursery = ?\n ORDER BY timestamp DESC\n `, hsh, shard, nursery)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar dbWholeObjectPath string\n\tvar dbTimestamp int64\n\tif !rows.Next() {\n\t\trows.Close()\n\t\tif err = rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif f == nil && !deletion {\n\t\t\treturn common.ErrNotFound\n\t\t}\n\t} else {\n\t\tvar dbMetahash, dbShardHash string\n\t\tvar dbMetadata []byte\n\t\tif err = rows.Scan(&dbTimestamp, &dbMetahash, &dbMetadata, &dbShardHash); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif f == nil && !deletion {\n\t\t\t// We keep the original file's timestamp if just committing new metadata. (not the x-timestamp header)\n\t\t\ttimestamp = dbTimestamp\n\t\t}\n\t\tdbWholeObjectPath, err = ot.WholeObjectPath(hsh, shard, dbTimestamp, nursery)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif metahash == dbMetahash && ((f == nil && !deletion) || dbTimestamp > timestamp) {\n\t\t\treturn common.ErrConflict\n\t\t}\n\t\tif shardhash == \"\" {\n\t\t\tshardhash = dbShardHash\n\t\t}\n\t\tif metahash != dbMetahash {\n\t\t\tdbMetadataMap := map[string]string{}\n\t\t\tif err = json.Unmarshal(dbMetadata, &dbMetadataMap); err != nil {\n\t\t\t\tot.logger.Error(\n\t\t\t\t\t\"error decoding metadata from db; discarding\",\n\t\t\t\t\tzap.Error(err),\n\t\t\t\t\tzap.String(\"hsh\", hsh),\n\t\t\t\t\tzap.Int(\"shard\", shard),\n\t\t\t\t\tzap.Int64(\"dbTimestamp\", dbTimestamp),\n\t\t\t\t\tzap.String(\"dbMetahash\", dbMetahash),\n\t\t\t\t\tzap.Binary(\"dbMetadata\", dbMetadata),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tif f == nil {\n\t\t\t\t\tdelete(metadata, \"Content-Length\")\n\t\t\t\t\tdelete(metadata, \"ETag\")\n\t\t\t\t}\n\t\t\t\tmetadata = MetadataMerge(metadata, dbMetadataMap)\n\t\t\t\tvar newMetabytes []byte\n\t\t\t\tif newMetabytes, err = json.Marshal(metadata); err != nil {\n\t\t\t\t\tif _, err2 := json.Marshal(dbMetadataMap); err2 != nil {\n\t\t\t\t\t\tot.logger.Error(\n\t\t\t\t\t\t\t\"error reencoding metadata from db; discarding\",\n\t\t\t\t\t\t\tzap.Error(err2),\n\t\t\t\t\t\t\tzap.String(\"hsh\", hsh),\n\t\t\t\t\t\t\tzap.Int(\"shard\", shard),\n\t\t\t\t\t\t\tzap.Int64(\"dbTimestamp\", dbTimestamp),\n\t\t\t\t\t\t\tzap.String(\"dbMetahash\", dbMetahash),\n\t\t\t\t\t\t\tzap.Binary(\"dbMetadata\", dbMetadata),\n\t\t\t\t\t\t\tzap.String(\"metahash\", metahash),\n\t\t\t\t\t\t\tzap.Binary(\"metadata\", metabytes),\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We return this error because the caller (presumably)\n\t\t\t\t\t\t// gave us bad metadata.\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmetahash = MetadataHash(metadata)\n\t\t\t\t\tmetabytes = newMetabytes\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\trows.Close()\n\tvar pth string\n\tpth, err = ot.WholeObjectPath(hsh, shard, timestamp, nursery)\n\tif err != nil {\n\t\treturn err\n\t}\n\trestabilize := false\n\tif dbWholeObjectPath == \"\" {\n\t\t_, err = tx.Exec(`\n INSERT INTO objects (hash, shard, timestamp, deletion, metahash, metadata, nursery, shardhash, restabilize, expires)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n `, hsh, shard, timestamp, deletion, metahash, metabytes, nursery, shardhash, restabilize, expires)\n\t} else {\n\t\tif !nursery && method == \"POST\" {\n\t\t\trestabilize = true\n\t\t}\n\t\t_, err = tx.Exec(`\n UPDATE objects\n SET timestamp = ?, deletion = ?, metahash = ?, metadata = ?, nursery = ?, shardhash = ?, restabilize = ?, expires = ?\n WHERE hash = ? AND shard = ? AND nursery = ?\n `, timestamp, deletion, metahash, metabytes, nursery, shardhash, restabilize, expires, hsh, shard, nursery)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif f != nil {\n\t\tif err = f.Finalize(pth); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err == nil {\n\t\terr = tx.Commit()\n\t}\n\tif err == nil && dbWholeObjectPath != \"\" && (f != nil || deletion) && timestamp > dbTimestamp {\n\t\tif err2 := os.Remove(dbWholeObjectPath); err2 != nil {\n\t\t\tot.logger.Error(\n\t\t\t\t\"error removing older file\",\n\t\t\t\tzap.Error(err2),\n\t\t\t\tzap.String(\"dbWholeObjectPath\", dbWholeObjectPath),\n\t\t\t)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "160e8c591c50487dd31e1bff41ed95e4", "score": "0.5536554", "text": "func (txExt *TxExt) Commit() {\n\terr := ((*sql.Tx)(txExt)).Commit()\n\tPanicIfError(utils.BuildErrorWithCaller(err))\n}", "title": "" }, { "docid": "011f0ea7143238d581f2947d9a245e2f", "score": "0.5530964", "text": "func (pdb *PebbleDriverBatch) Commit() error {\n\treturn pdb.Commit()\n}", "title": "" }, { "docid": "79511dfad06caa37ef3858890bf51edf", "score": "0.5523726", "text": "func (b BoltDb) Close() error {\n\treturn b.conn.Close()\n}", "title": "" }, { "docid": "d71d46a8cfcbdfe7a59edc2e79f0d9b4", "score": "0.5511965", "text": "func (repo *_repository) Close() error {\n\tdefer func() {\n\t\trepo.isInTransaction = true\n\t}()\n\n\tsqlDB, err := repo.db.DB()\n\tif err != nil {\n\t\treturn errors.Wrapf(errors.ErrInternalError, \"%+v\", err)\n\t}\n\n\terr = sqlDB.Close()\n\tif err != nil {\n\t\treturn errors.Wrapf(errors.ErrInternalError, \"%+v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43633f4c0aed91270fbb2bd91279abc4", "score": "0.55039054", "text": "func (s *store) Done(err error) error {\n\tif tx, ok := s.db.(dbutil.Tx); ok {\n\t\tif err != nil {\n\t\t\tif rollErr := tx.Rollback(); rollErr != nil {\n\t\t\t\terr = multierror.Append(err, rollErr)\n\t\t\t}\n\t\t} else {\n\t\t\tif commitErr := tx.Commit(); commitErr != nil {\n\t\t\t\terr = multierror.Append(err, commitErr)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "b09c93749846574f52595b8e2afbb8c5", "score": "0.55030537", "text": "func (z *TaskDB) Close() {\n\tz.conn.Close()\n}", "title": "" }, { "docid": "71531117937a1de12be5be9866b9de3b", "score": "0.5499509", "text": "func (db *DB) CommitTx() error {\n\tdefer func() {\n\t\tdb.tx = nil\n\t}()\n\terr := db.tx.Commit()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"commit transaction\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0401c960e2813d5df5be07730773a42", "score": "0.5453907", "text": "func (tx *Transaction) Close() {\n\ttx.pool.ReleaseConn(tx.conn)\n}", "title": "" }, { "docid": "934fdf2f9fefd17f660dac1351d5667e", "score": "0.5453807", "text": "func (db *BaseDB) Rollback() {\n\tpanic(\"Rollback not impl\")\n}", "title": "" } ]
59db4e144b376d00a8381f9ac6844269
FailByHystrix returns whether the fails causing by Hystrix
[ { "docid": "62cfa1edcf3668f15f9d1200fbb32f77", "score": "0.7749361", "text": "func (hfError *FilterError) FailByHystrix() bool {\n\treturn hfError.failByHystrix\n}", "title": "" } ]
[ { "docid": "2b8608ae089d0773fdc8572e474ff373", "score": "0.56436574", "text": "func responseFail(res pb.Response) func() bool {\n\treturn func() bool { return res.Status >= shim.ERRORTHRESHOLD }\n}", "title": "" }, { "docid": "d27b801c76a83f960874db4a9d9bb10b", "score": "0.55855244", "text": "func (r *DB) callBreaker(fn func() error) error {\n var err error\n if r.commandName == nil {\n return fn()\n }\n cn := *r.commandName\n for i := 0; i <= r.retryCount; i++ {\n err = hystrix.Do(cn, func() error {\n return fn()\n }, r.fallbackFunc)\n if err != nil {\n var backOffTime time.Duration\n if i <= 0 {\n backOffTime = 0 * time.Millisecond\n } else {\n // rand.Int63n(nc.interval*1000)\n backOffTime = (time.Duration(int64(2/time.Millisecond)) * time.Millisecond) + (time.Duration(rand.Int63n(5*1000)) * time.Millisecond)\n }\n time.Sleep(backOffTime)\n continue\n }\n break\n }\n return err\n}", "title": "" }, { "docid": "f858386c571a2ff7390762e2cd95eb39", "score": "0.53539175", "text": "func (cb *TimeoutBreaker) Fail() {\n}", "title": "" }, { "docid": "9c4b86ae5811198fe0fff6a1dd66f091", "score": "0.5191357", "text": "func (NilHealthcheck) Unhealthy(error) {}", "title": "" }, { "docid": "2735f529b148d120f914e68b6b8a71c1", "score": "0.5069967", "text": "func (cb *ThresholdBreaker) Fail() {\n\tif cb.Tripped() {\n\t\treturn\n\t}\n\n\tcb.ResettingBreaker.Fail()\n\tfailures := atomic.AddInt64(&cb.failures, 1)\n\tif failures == cb.Threshold {\n\t\tcb.Trip()\n\t\tif cb.BreakerTripped != nil {\n\t\t\tcb.BreakerTripped()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "baca52ed9bbbd45fb4550b6b26dad724", "score": "0.50484407", "text": "func (_class PoolClass) GetHaHostFailuresToTolerate(sessionID SessionRef, self PoolRef) (_retval int, _err error) {\n\tif IsMock {\n\t\treturn _class.GetHaHostFailuresToTolerateMock(sessionID, self)\n\t}\t\n\t_method := \"pool.get_ha_host_failures_to_tolerate\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPoolRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertIntToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "409501ba4a4e500de6652c30a4114aca", "score": "0.50250065", "text": "func InjectFailure(skip int) bool { return false }", "title": "" }, { "docid": "13827e4b845aa8a5156c5dd16e8cfee3", "score": "0.50114226", "text": "func (c *pingServiceClientReRPC) Fail(ctx context.Context, req *FailRequest, opts ...rerpc.CallOption) (*FailResponse, error) {\n\tres, err := c.fail.Call(ctx, req, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.(*FailResponse), nil\n}", "title": "" }, { "docid": "a458b109340f2f2630d5b7c3d8558d9d", "score": "0.4932186", "text": "func InduceFailure(failure string, ns string) {\n\tisResiliencyConditionset := <-ResiliencyCondition\n\tif isResiliencyConditionset {\n\t\tFailureType.Method()\n\t} else {\n\t\tCapturedErrors <- errors.New(\"Resiliency Condition did not meet. Failing this test case.\")\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "53862de63abd4c4e03084928b885618b", "score": "0.48997957", "text": "func (s *SMTestSuite) TestComplexFailover() {\n\ts.monitor.IsHealthy = true\n\ts.zkRunner.\n\t\tOn(\"Create\", \"/hailo-2-api-az-failover\", []byte(\"test\"), int32(gozk.FlagEphemeral), gozk.WorldACL(gozk.PermAll)).\n\t\tReturn(\"/hailo-2-api-az-failover\", nil).\n\t\tOnce()\n\n\tisConnected := false\n\ts.monitor.interpretRavenStatus(isConnected)\n\ts.Equal(s.monitor.IsHealthy, false)\n\ts.Equal(s.monitor.FailureType, ConnectivityFailure)\n\n\t// Recover Connectivity but report AZ failure\n\ts.zkRunner.\n\t\tOn(\"Delete\", \"/hailo-2-api-az-failover\", int32(0)).\n\t\tReturn(nil).\n\t\tOnce()\n\tisConnected = true\n\ts.monitor.interpretRavenStatus(isConnected)\n\n\ts.zkRunner.\n\t\tOn(\"Create\", \"/hailo-2-api-az-failover\", []byte(\"test\"), int32(gozk.FlagEphemeral), gozk.WorldACL(gozk.PermAll)).\n\t\tReturn(\"/hailo-2-api-az-failover\", nil).\n\t\tOnce()\n\tazStatus := false\n\ts.monitor.interpretAZStatus(azStatus)\n\ts.Equal(s.monitor.IsHealthy, false)\n\ts.Equal(s.monitor.FailureType, MonitoringFailure)\n}", "title": "" }, { "docid": "016ed9a29b9d5b1aff533d0a003a7aab", "score": "0.48923615", "text": "func (task *Task) IsFail() bool {\n\treturn task.GetStatus() == TaskStatusFail\n}", "title": "" }, { "docid": "c6c3317d454ad94d6758a47be59c9080", "score": "0.4886898", "text": "func TestConditionalBackoffConditionNonExecution(t *testing.T) {\n\tattempts := 3\n\tcounter := 0\n\n\tretryErr := Backoff(func() (*Response, error) {\n\t\tcounter++\n\t\treturn nil, nil\n\t}, RetryConditions([]RetryConditionFunc{filler}))\n\n\tassertError(t, retryErr)\n\tassertNotEqual(t, counter, attempts)\n}", "title": "" }, { "docid": "708977f6b96bdc660d13d3379fe235d7", "score": "0.48725957", "text": "func preflightCheckSucceedsOrFails(configNameOverrideIfSkipped string, execute preflightCheckFunc, message string, configNameOverrideIfWarning string, errorMessage string) {\n\tfmt.Printf(\"-- %s ... \", message)\n\n\tisConfiguredToSkip := viper.GetBool(configNameOverrideIfSkipped)\n\tisConfiguredToWarn := viper.GetBool(configNameOverrideIfWarning)\n\n\tif isConfiguredToSkip {\n\t\tfmt.Println(\"SKIP\")\n\t\treturn\n\t}\n\n\tif execute() {\n\t\tfmt.Println(\"OK\")\n\t\treturn\n\t}\n\n\tfmt.Println(\"FAIL\")\n\terrorMessage = fmt.Sprintf(\" %s\", errorMessage)\n\tif isConfiguredToWarn {\n\t\tfmt.Println(errorMessage)\n\t} else {\n\t\tatexit.ExitWithMessage(1, errorMessage)\n\t}\n}", "title": "" }, { "docid": "ff5b965a857ad27edf132c85ffe9dea8", "score": "0.48462522", "text": "func Fail(c codes.Code, msg string) *triggersv1beta1.InterceptorResponse {\n\treturn &triggersv1beta1.InterceptorResponse{\n\t\tContinue: false,\n\t\tStatus: triggersv1beta1.Status{\n\t\t\tCode: c,\n\t\t\tMessage: msg,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "23707fefb63c81d575e5ac782e68d5bb", "score": "0.483455", "text": "func TestFail(t *testing.T) {\n\tconfigStr := `\nformat_version: 1.0.0\ndefault_step_lib_source: \"https://github.com/bitrise-io/bitrise-steplib.git\"\n\nworkflows:\n target:\n steps:\n - script:\n title: Should success\n - script:\n title: Should fail, but skippable\n is_skippable: true\n inputs:\n - content: |\n #!/bin/bash\n set -v\n exit 2\n - script:\n title: Should success\n - script:\n title: Should fail\n inputs:\n - content: |\n #!/bin/bash\n set -v\n exit 1\n - script:\n title: Should skipped\n - script:\n title: Should success\n is_always_run: true\n `\n\tconfig, err := bitrise.ConfigModelFromYAMLBytes([]byte(configStr))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, found := config.Workflows[\"target\"]\n\tif !found {\n\t\tt.Fatal(\"No workflow found with ID (target)\")\n\t}\n\tif err := config.Validate(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tbuildRunResults, err := runWorkflowWithConfiguration(time.Now(), \"target\", config, []envmanModels.EnvironmentItemModel{})\n\tt.Log(\"Err: \", err)\n\tt.Log(\"Build run results:\", buildRunResults)\n\tif len(buildRunResults.SuccessSteps) != 3 {\n\t\tt.Fatalf(\"Success step count (%d), should be (3)\", len(buildRunResults.SuccessSteps))\n\t}\n\tif len(buildRunResults.FailedSteps) != 1 {\n\t\tt.Fatalf(\"Failed step count (%d), should be (1)\", len(buildRunResults.FailedSteps))\n\t}\n\tif len(buildRunResults.FailedSkippableSteps) != 1 {\n\t\tt.Fatalf(\"FailedSkippable step count (%d), should be (1)\", len(buildRunResults.FailedSkippableSteps))\n\t}\n\tif len(buildRunResults.SkippedSteps) != 1 {\n\t\tt.Fatalf(\"Skipped step count (%d), should be (1)\", len(buildRunResults.SkippedSteps))\n\t}\n\n\tif status := os.Getenv(\"BITRISE_BUILD_STATUS\"); status != \"1\" {\n\t\tt.Log(\"BITRISE_BUILD_STATUS:\", status)\n\t\tt.Fatal(\"BUILD_STATUS envs are incorrect\")\n\t}\n\tif status := os.Getenv(\"STEPLIB_BUILD_STATUS\"); status != \"1\" {\n\t\tt.Log(\"STEPLIB_BUILD_STATUS:\", status)\n\t\tt.Fatal(\"STEPLIB_BUILD_STATUS envs are incorrect\")\n\t}\n}", "title": "" }, { "docid": "23707fefb63c81d575e5ac782e68d5bb", "score": "0.483455", "text": "func TestFail(t *testing.T) {\n\tconfigStr := `\nformat_version: 1.0.0\ndefault_step_lib_source: \"https://github.com/bitrise-io/bitrise-steplib.git\"\n\nworkflows:\n target:\n steps:\n - script:\n title: Should success\n - script:\n title: Should fail, but skippable\n is_skippable: true\n inputs:\n - content: |\n #!/bin/bash\n set -v\n exit 2\n - script:\n title: Should success\n - script:\n title: Should fail\n inputs:\n - content: |\n #!/bin/bash\n set -v\n exit 1\n - script:\n title: Should skipped\n - script:\n title: Should success\n is_always_run: true\n `\n\tconfig, err := bitrise.ConfigModelFromYAMLBytes([]byte(configStr))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, found := config.Workflows[\"target\"]\n\tif !found {\n\t\tt.Fatal(\"No workflow found with ID (target)\")\n\t}\n\tif err := config.Validate(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tbuildRunResults, err := runWorkflowWithConfiguration(time.Now(), \"target\", config, []envmanModels.EnvironmentItemModel{})\n\tt.Log(\"Err: \", err)\n\tt.Log(\"Build run results:\", buildRunResults)\n\tif len(buildRunResults.SuccessSteps) != 3 {\n\t\tt.Fatalf(\"Success step count (%d), should be (3)\", len(buildRunResults.SuccessSteps))\n\t}\n\tif len(buildRunResults.FailedSteps) != 1 {\n\t\tt.Fatalf(\"Failed step count (%d), should be (1)\", len(buildRunResults.FailedSteps))\n\t}\n\tif len(buildRunResults.FailedSkippableSteps) != 1 {\n\t\tt.Fatalf(\"FailedSkippable step count (%d), should be (1)\", len(buildRunResults.FailedSkippableSteps))\n\t}\n\tif len(buildRunResults.SkippedSteps) != 1 {\n\t\tt.Fatalf(\"Skipped step count (%d), should be (1)\", len(buildRunResults.SkippedSteps))\n\t}\n\n\tif status := os.Getenv(\"BITRISE_BUILD_STATUS\"); status != \"1\" {\n\t\tt.Log(\"BITRISE_BUILD_STATUS:\", status)\n\t\tt.Fatal(\"BUILD_STATUS envs are incorrect\")\n\t}\n\tif status := os.Getenv(\"STEPLIB_BUILD_STATUS\"); status != \"1\" {\n\t\tt.Log(\"STEPLIB_BUILD_STATUS:\", status)\n\t\tt.Fatal(\"STEPLIB_BUILD_STATUS envs are incorrect\")\n\t}\n}", "title": "" }, { "docid": "a7a77b1f68585126a23cd7755d17813e", "score": "0.48267323", "text": "func isFailed(t *testing.T, taskRunName string, conds duckv1beta1.Conditions) bool {\n\tfor _, c := range conds {\n\t\tif c.Type == apis.ConditionSucceeded {\n\t\t\tif c.Status != corev1.ConditionFalse {\n\t\t\t\tt.Errorf(\"TaskRun status %q is not failed, got %q\", taskRunName, c.Status)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n\tt.Errorf(\"TaskRun status %q had no Succeeded condition\", taskRunName)\n\treturn false\n}", "title": "" }, { "docid": "85e65c253228dcac9710309831cd7b9e", "score": "0.48181614", "text": "func testProxyInterNodeHairpinCases(data *TestData, t *testing.T, hostNetwork bool, expectedClientIP, node, clusterIPUrl, nodePortClusterUrl, lbClusterUrl string) {\n\tskipIfAntreaIPAMTest(t)\n\tcurrentEncapMode, err := data.GetEncapMode()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to get encap mode: %v\", err)\n\t}\n\tif !hostNetwork {\n\t\tif testOptions.providerName == \"kind\" && (currentEncapMode == config.TrafficEncapModeEncap || currentEncapMode == config.TrafficEncapModeHybrid) {\n\t\t\tt.Skipf(\"Skipping test because inter-Node Pod traffic is encapsulated when testbed is Kind and traffic mode is encap/hybrid\")\n\t\t} else if currentEncapMode == config.TrafficEncapModeEncap {\n\t\t\tt.Skipf(\"Skipping test because inter-Node Pod traffic is encapsulated when testbed is not Kind and traffic mode encap\")\n\t\t}\n\t}\n\n\tt.Run(\"InterNode/ClusterIP\", func(t *testing.T) {\n\t\tclientIP, err := probeClientIPFromNode(node, clusterIPUrl, data)\n\t\trequire.NoError(t, err, \"ClusterIP hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n\tt.Run(\"InterNode/NodePort/ExternalTrafficPolicy:Cluster\", func(t *testing.T) {\n\t\tskipIfProxyAllDisabled(t, data)\n\t\tif !hostNetwork && currentEncapMode == config.TrafficEncapModeNoEncap {\n\t\t\tskipIfHasWindowsNodes(t)\n\t\t}\n\t\tclientIP, err := probeClientIPFromNode(node, nodePortClusterUrl, data)\n\t\trequire.NoError(t, err, \"NodePort whose externalTrafficPolicy is Cluster hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n\tt.Run(\"InterNode/LoadBalancer/ExternalTrafficPolicy:Cluster\", func(t *testing.T) {\n\t\tskipIfProxyAllDisabled(t, data)\n\t\tif !hostNetwork && currentEncapMode == config.TrafficEncapModeNoEncap {\n\t\t\tskipIfHasWindowsNodes(t)\n\t\t}\n\t\tclientIP, err := probeClientIPFromNode(node, lbClusterUrl, data)\n\t\trequire.NoError(t, err, \"LoadBalancer whose externalTrafficPolicy is Cluster hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n}", "title": "" }, { "docid": "1b694a0c3b2f0d6c2ccac3c0937a9dd4", "score": "0.4810792", "text": "func shouldClearStartFailure(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance) bool {\n\n\tif wasVMIInRunningPhase(vmi) {\n\t\treturn true\n\t}\n\n\trunStrategy, err := vm.RunStrategy()\n\tif err != nil {\n\t\tlog.Log.Object(vm).Errorf(fetchingRunStrategyErrFmt, err)\n\t\treturn false\n\t}\n\n\tif runStrategy != virtv1.RunStrategyAlways &&\n\t\trunStrategy != virtv1.RunStrategyRerunOnFailure &&\n\t\trunStrategy != virtv1.RunStrategyOnce {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "20a7ddabeb8d2c5598b85fe9e499250c", "score": "0.47910142", "text": "func ShouldRetryOnResponse(tr1Resp interface{}, _ error) (retry bool) {\n\ttr1Response := tr1Resp.(*Tr1d1umResponse)\n\tretry = tr1Response.Code == Tr1StatusTimeout\n\treturn\n}", "title": "" }, { "docid": "4027bae71e334d79262abe36aa862a80", "score": "0.4790511", "text": "func reportKHFailure(errorMessage string) error {\n\terr := checkclient.ReportFailure([]string{errorMessage})\n\tif err != nil {\n\t\tlog.Println(\"Error reporting failure to Kuberhealthy servers:\", err)\n\t\treturn err\n\t}\n\tlog.Println(\"Successfully reported failure to Kuberhealthy servers\")\n\treturn err\n}", "title": "" }, { "docid": "4027bae71e334d79262abe36aa862a80", "score": "0.4790511", "text": "func reportKHFailure(errorMessage string) error {\n\terr := checkclient.ReportFailure([]string{errorMessage})\n\tif err != nil {\n\t\tlog.Println(\"Error reporting failure to Kuberhealthy servers:\", err)\n\t\treturn err\n\t}\n\tlog.Println(\"Successfully reported failure to Kuberhealthy servers\")\n\treturn err\n}", "title": "" }, { "docid": "502a4bbbf215fe8f9d83a94ae8046599", "score": "0.47888628", "text": "func notRetryable(err error) error { return err }", "title": "" }, { "docid": "233c9b3030e21931711b624ca00608e7", "score": "0.4766555", "text": "func reportKHFailure(errorMessage string) error {\n\terr := checkclient.ReportFailure([]string{errorMessage})\n\tif err != nil {\n\t\tlog.Error(\"Error reporting failure status to Kuberhealthy servers:\", err)\n\t\treturn err\n\t}\n\tlog.Info(\"Successfully reported failure status to Kuberhealthy servers\")\n\treturn err\n}", "title": "" }, { "docid": "fbff23e62e084276b022d745f3d9de26", "score": "0.47637433", "text": "func (r *backupRetryer) ShouldRetry(ctx context.Context, err error, callTimes int, request interface{}, cbKey string) (string, bool) {\n\tr.RLock()\n\tdefer r.RUnlock()\n\tif !r.enable {\n\t\treturn \"\", false\n\t}\n\tif stop, msg := circuitBreakerStop(ctx, r.policy.StopPolicy, r.cbContainer, request, cbKey); stop {\n\t\treturn msg, false\n\t}\n\treturn \"\", true\n}", "title": "" }, { "docid": "ebf705916570c58992562bc8cd4bc977", "score": "0.47633502", "text": "func (cb *CircuitBreaker) Fail() {\n\tcb.mu.Lock()\n\tdefer cb.mu.Unlock()\n\tcb.cnt.incrementFailures()\n\tcb.state.onFail(cb)\n}", "title": "" }, { "docid": "0dc5e2558a7e8497680e7ec1b9931ace", "score": "0.47546074", "text": "func TestFailWhenCatalogNotFound(t *testing.T) {\n\tctx := context.Background()\n\n\tvar err error\n\n\tapp := &v1alpha1.App{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: appName,\n\t\t\tNamespace: \"giantswarm\",\n\t\t\tLabels: map[string]string{\n\t\t\t\tlabel.AppOperatorVersion: \"3.0.0\",\n\t\t\t},\n\t\t},\n\t\tSpec: v1alpha1.AppSpec{\n\t\t\tCatalog: \"missing\",\n\t\t\tName: appName,\n\t\t\tNamespace: \"giantswarm\",\n\t\t\tKubeConfig: v1alpha1.AppSpecKubeConfig{\n\t\t\t\tInCluster: true,\n\t\t\t},\n\t\t\tVersion: \"1.2.2\",\n\t\t},\n\t}\n\texpectedError := \"validation error: catalog `missing` not found\"\n\n\tlogger.Debugf(ctx, \"waiting for failed app creation\")\n\n\to := func() error {\n\t\terr = appTest.CtrlClient().Create(ctx, app)\n\t\tif err == nil {\n\t\t\treturn microerror.Maskf(executionFailedError, \"expected error but got nil\")\n\t\t}\n\t\tif !strings.Contains(err.Error(), expectedError) {\n\t\t\treturn microerror.Maskf(executionFailedError, \"error == %#v, want %#v \", err.Error(), expectedError)\n\t\t}\n\n\t\treturn nil\n\t}\n\tb := backoff.NewConstant(5*time.Minute, 10*time.Second)\n\tn := backoff.NewNotifier(logger, ctx)\n\n\terr = backoff.RetryNotify(o, b, n)\n\tif err != nil {\n\t\tt.Fatalf(\"expected nil but got error %#v\", err)\n\t}\n\n\tlogger.Debugf(ctx, \"waited for failed app creation\")\n}", "title": "" }, { "docid": "8c311461ace362547429f1a34a54e334", "score": "0.47516793", "text": "func (c *bazClient) TestUUID(\n\tctx context.Context,\n\treqHeaders map[string]string,\n) (context.Context, map[string]string, error) {\n\tvar result clientsIDlClientsBazBaz.SimpleService_TestUuid_Result\n\n\tlogger := c.client.ContextLogger\n\n\targs := &clientsIDlClientsBazBaz.SimpleService_TestUuid_Args{}\n\tvar success bool\n\trespHeaders := make(map[string]string)\n\tvar err error\n\tif c.circuitBreakerDisabled {\n\t\tsuccess, respHeaders, err = c.client.Call(\n\t\t\tctx, \"SimpleService\", \"testUuid\", reqHeaders, args, &result)\n\t} else {\n\t\t// We want hystrix ckt-breaker to count errors only for system issues\n\t\tvar clientErr error\n\t\tscope := c.defaultDeps.Scope.Tagged(map[string]string{\n\t\t\t\"client\": \"baz\",\n\t\t\t\"methodName\": \"TestUUID\",\n\t\t})\n\t\tstart := time.Now()\n\t\tcircuitBreakerName := \"baz\" + \"-\" + \"TestUUID\"\n\t\terr = hystrix.DoC(ctx, circuitBreakerName, func(ctx context.Context) error {\n\t\t\telapsed := time.Now().Sub(start)\n\t\t\tscope.Timer(\"hystrix-timer\").Record(elapsed)\n\t\t\tsuccess, respHeaders, clientErr = c.client.Call(\n\t\t\t\tctx, \"SimpleService\", \"testUuid\", reqHeaders, args, &result)\n\t\t\tif _, isSysErr := clientErr.(tchannel.SystemError); !isSysErr {\n\t\t\t\t// Declare ok if it is not a system-error\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientErr\n\t\t}, nil)\n\t\tif err == nil {\n\t\t\t// ckt-breaker was ok, bubble up client error if set\n\t\t\terr = clientErr\n\t\t}\n\t}\n\tif err != nil {\n\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.String(\"error\", fmt.Sprintf(\"error making tchannel call: %s\", err)), logFieldErrLocation)\n\t}\n\n\tif err == nil && !success {\n\t\tswitch {\n\t\tdefault:\n\t\t\terr = errors.New(\"bazClient received no result or unknown exception for TestUuid\")\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), logFieldErrLocation)\n\t\t}\n\t}\n\tif err != nil {\n\t\tctx = logger.WarnZ(ctx, \"Client failure: TChannel client call returned error\")\n\t\treturn ctx, respHeaders, err\n\t}\n\n\treturn ctx, respHeaders, err\n}", "title": "" }, { "docid": "4a8e1fd482e16ddccc1e3dccc14ae7ef", "score": "0.4739544", "text": "func (r *Reconciler) fail(instance *computev1alpha1.Workload, reason, msg string) (reconcile.Result, error) {\n\tinstance.Status.SetDeprecatedCondition(corev1alpha1.NewDeprecatedCondition(corev1alpha1.DeprecatedFailed, reason, msg))\n\treturn resultRequeue, r.Status().Update(ctx, instance)\n}", "title": "" }, { "docid": "30a3a744386e21cf26483742169530a2", "score": "0.47329724", "text": "func preflightCheckSucceedsOrFailsWithDriver(configNameOverrideIfSkipped string, execute preflightCheckWithDriverFunc, driver drivers.Driver, message string, configNameOverrideIfWarning string, errorMessage string) {\n\tfmt.Printf(\"-- %s ... \", message)\n\n\tisConfiguredToSkip := viper.GetBool(configNameOverrideIfSkipped)\n\tisConfiguredToWarn := viper.GetBool(configNameOverrideIfWarning)\n\n\tif isConfiguredToSkip {\n\t\tfmt.Println(\"SKIP\")\n\t\treturn\n\t}\n\n\tif execute(driver) {\n\t\tfmt.Println(\"OK\")\n\t\treturn\n\t}\n\n\tfmt.Println(\"FAIL\")\n\terrorMessage = fmt.Sprintf(\" %s\", errorMessage)\n\tif isConfiguredToWarn {\n\t\tfmt.Println(errorMessage)\n\t} else {\n\t\tatexit.ExitWithMessage(1, errorMessage)\n\t}\n}", "title": "" }, { "docid": "0b4254dd31b65c83e7764c598f4d8393", "score": "0.47107106", "text": "func (b *Breaker) Fail() error {\n\terr := b.State.OnFail(b.storageService)\n\n\treturn errors.Wrap(err, \"Fail\")\n}", "title": "" }, { "docid": "e840b89434f456178db23418ae3a7b66", "score": "0.46921015", "text": "func isFailure(statusCode int) bool {\n\treturn statusCode < http.StatusOK /* 200 */ ||\n\t\tstatusCode >= http.StatusMultipleChoices /* 300 */\n}", "title": "" }, { "docid": "e840b89434f456178db23418ae3a7b66", "score": "0.46921015", "text": "func isFailure(statusCode int) bool {\n\treturn statusCode < http.StatusOK /* 200 */ ||\n\t\tstatusCode >= http.StatusMultipleChoices /* 300 */\n}", "title": "" }, { "docid": "c37e37cb7f02d33f584b5175ff78d61f", "score": "0.46885034", "text": "func (c *bazClient) DeliberateDiffNoop(\n\tctx context.Context,\n\treqHeaders map[string]string,\n) (context.Context, map[string]string, error) {\n\tvar result clientsIDlClientsBazBaz.SimpleService_SillyNoop_Result\n\n\tlogger := c.client.ContextLogger\n\n\targs := &clientsIDlClientsBazBaz.SimpleService_SillyNoop_Args{}\n\tvar success bool\n\trespHeaders := make(map[string]string)\n\tvar err error\n\tif c.circuitBreakerDisabled {\n\t\tsuccess, respHeaders, err = c.client.Call(\n\t\t\tctx, \"SimpleService\", \"sillyNoop\", reqHeaders, args, &result)\n\t} else {\n\t\t// We want hystrix ckt-breaker to count errors only for system issues\n\t\tvar clientErr error\n\t\tscope := c.defaultDeps.Scope.Tagged(map[string]string{\n\t\t\t\"client\": \"baz\",\n\t\t\t\"methodName\": \"DeliberateDiffNoop\",\n\t\t})\n\t\tstart := time.Now()\n\t\tcircuitBreakerName := \"baz\" + \"-\" + \"DeliberateDiffNoop\"\n\t\terr = hystrix.DoC(ctx, circuitBreakerName, func(ctx context.Context) error {\n\t\t\telapsed := time.Now().Sub(start)\n\t\t\tscope.Timer(\"hystrix-timer\").Record(elapsed)\n\t\t\tsuccess, respHeaders, clientErr = c.client.Call(\n\t\t\t\tctx, \"SimpleService\", \"sillyNoop\", reqHeaders, args, &result)\n\t\t\tif _, isSysErr := clientErr.(tchannel.SystemError); !isSysErr {\n\t\t\t\t// Declare ok if it is not a system-error\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientErr\n\t\t}, nil)\n\t\tif err == nil {\n\t\t\t// ckt-breaker was ok, bubble up client error if set\n\t\t\terr = clientErr\n\t\t}\n\t}\n\tif err != nil {\n\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.String(\"error\", fmt.Sprintf(\"error making tchannel call: %s\", err)), logFieldErrLocation)\n\t}\n\n\tif err == nil && !success {\n\t\tswitch {\n\t\tcase result.AuthErr != nil:\n\t\t\terr = result.AuthErr\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), zanzibar.LogFieldErrTypeClientException, logFieldErrLocation)\n\t\tcase result.ServerErr != nil:\n\t\t\terr = result.ServerErr\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), zanzibar.LogFieldErrTypeClientException, logFieldErrLocation)\n\t\tdefault:\n\t\t\terr = errors.New(\"bazClient received no result or unknown exception for SillyNoop\")\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), logFieldErrLocation)\n\t\t}\n\t}\n\tif err != nil {\n\t\tctx = logger.WarnZ(ctx, \"Client failure: TChannel client call returned error\")\n\t\treturn ctx, respHeaders, err\n\t}\n\n\treturn ctx, respHeaders, err\n}", "title": "" }, { "docid": "b6602f2b64e856e8c34ad0ca8d3ebd46", "score": "0.46807566", "text": "func (o OutlierDetectionResponseOutput) EnforcingConsecutiveGatewayFailure() pulumi.IntOutput {\n\treturn o.ApplyT(func(v OutlierDetectionResponse) int { return v.EnforcingConsecutiveGatewayFailure }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "988a86590082914bfdf246c158b70dc9", "score": "0.46749556", "text": "func (tc *TestCase) ShouldFail() *TestCase {\n\ttc.shouldFail = true\n\ttc.Checks = append(tc.Checks, func() error {\n\t\tk := \"error\"\n\t\tif t, ok := tc.resMap[k]; !ok || t == nil {\n\t\t\treturn fmt.Errorf(\"expected response to have key '%s' but got %v\", k, tc.resString)\n\t\t}\n\t\treturn nil\n\t})\n\treturn tc\n}", "title": "" }, { "docid": "9433be332254c7e6dbc5a785a300ad56", "score": "0.46731326", "text": "func (r rpcError) CanRetry() bool { return true }", "title": "" }, { "docid": "ba52fcfea07f368959c073634069ffe1", "score": "0.4661562", "text": "func (t *task) Fail() error {\n\tt.mu.Lock()\n\tt.status = models.AttackResponseStatusFailed\n\tt.mu.Unlock()\n\n\tt.SendUpdate()\n\n\tt.log(nil).Error(\"failed\")\n\treturn nil\n}", "title": "" }, { "docid": "64fedb650a5b3a7a102abcbbff165560", "score": "0.46576074", "text": "func TestFailureConditions(t *testing.T) {\n\ttype testCase struct {\n\t\tname string\n\t\tcsv string\n\t\tfail bool\n\t\tintOutOfRange bool\n\t\tdecimalOutOfRange bool\n\t\ttimestampOutOfRange bool\n\t}\n\n\ttestCases := []testCase{\n\t\t{name: \"too small\", csv: `id__ID,ts1__Timestamp_s_2006-01-02T15:04:05Z07:00_0000-01-01T00:00:00Z_h\n0,0\n`, fail: true, intOutOfRange: true, timestampOutOfRange: true, decimalOutOfRange: true},\n\t\t{name: \"just right\", csv: `id__ID,ts1__Timestamp_s_2006-01-02T15:04:05Z07:00_2200-12-31T15:04:05Z_h\n0,0\n`, fail: false, intOutOfRange: true, timestampOutOfRange: true, decimalOutOfRange: true},\n\t\t{name: \"too big\", csv: `id__ID,ts1__Timestamp_s_2006-01-02T15:04:05Z07:00_9999-12-31T23:59:60Z_h\n0,0\n`, fail: true, intOutOfRange: true, timestampOutOfRange: true, decimalOutOfRange: true},\n\t\t{name: \"intOutOfRange not allowed\", csv: `id__ID,pospos__Int_5_10\n0,4\n`, fail: true, intOutOfRange: false, timestampOutOfRange: true, decimalOutOfRange: true},\n\t\t{name: \"intOutOfRange not allowed-2\", csv: `id__ID,pospos__Int_5_10\n0,11\n`, fail: true, intOutOfRange: false, timestampOutOfRange: true, decimalOutOfRange: true},\n\t\t{name: \"timestampOutOfRange not allowed\", csv: `id__ID,ts1__Timestamp_s_2006-01-02 15:04:05.999\n0,-0001-01-03 08:00:00.000\n`, fail: true, intOutOfRange: true, timestampOutOfRange: false, decimalOutOfRange: true},\n\t\t{name: \"timestampOutOfRange not allowed-2\", csv: `id__ID,ts2__Timestamp_s_2006-01-02T15:04:05Z07:00_9999-12-31T23:59:59Z_h\n0,2433\n`, fail: true, intOutOfRange: true, timestampOutOfRange: false, decimalOutOfRange: true},\n\t\t{name: \"decimalOutOfRange not allowed\", csv: `id__ID,price__Decimal_2\n0,994492233720368547758.0892233720368547758\n`, fail: true, intOutOfRange: true, timestampOutOfRange: true, decimalOutOfRange: false},\n\t\t{name: \"intOverflow\", csv: `id__ID,pospos__Int\n0,89273948723984729387492387492987\n\t\t`, fail: true, intOutOfRange: false, timestampOutOfRange: false, decimalOutOfRange: false},\n\n\t\t{name: \"int string overflow\", csv: `id__ID,pospos__Int\n0,\"89273948723984729387492387492987\"\n`, fail: true, intOutOfRange: false, timestampOutOfRange: false, decimalOutOfRange: false},\n\t}\n\n\tfor _, test := range testCases {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tm := newMainOORFactory(t, test.csv, test.intOutOfRange, test.decimalOutOfRange, test.timestampOutOfRange)\n\t\t\tm.BatchSize = 1\n\t\t\tdefer testDeleteIndex(t, m)\n\n\t\t\terr := m.Run()\n\t\t\tif test.fail {\n\t\t\t\tif err == nil {\n\t\t\t\t\tt.Fatal(\"expected error, got nil\")\n\t\t\t\t}\n\t\t\t} else if err != nil {\n\t\t\t\tt.Fatalf(\"%s: %v\", idktest.ErrRunningIngest, err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "0cbecdb1ce103f50914a68ecc504d6b1", "score": "0.46514848", "text": "func (c ConvoyAWSRetryer) shouldThrottle(r *request.Request) bool {\n\tswitch r.HTTPResponse.StatusCode {\n\tcase http.StatusTooManyRequests:\n\tcase http.StatusBadGateway:\n\tcase http.StatusServiceUnavailable:\n\tcase http.StatusGatewayTimeout:\n\tdefault:\n\t\treturn r.IsErrorThrottle()\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "faf716f389acfffabf575700ae7dae6b", "score": "0.46485484", "text": "func (d *DefaultFailureDetector) IsFailure(res *http.Response, err error) bool {\n\treturn err != nil && err != context.Canceled || res != nil && res.StatusCode >= 500\n}", "title": "" }, { "docid": "5b7546c7b54e1b2cf9ff7dabcba46efe", "score": "0.46407515", "text": "func (r *Reconciler) fail(instance *databasev1alpha1.MysqlServer, reason, msg string) (reconcile.Result, error) {\n\tctx := context.Background()\n\n\tlog.Printf(\"instance %s failed: '%s': %s\", instance.Name, reason, msg)\n\tinstance.Status.SetCondition(corev1alpha1.NewCondition(corev1alpha1.Failed, reason, msg))\n\treturn reconcile.Result{Requeue: true}, r.Update(ctx, instance)\n}", "title": "" }, { "docid": "9e3e6b933c0ef23e22187e01a0200636", "score": "0.4639931", "text": "func errShouldBackoff(err error) bool {\n\treturn status.Code(err) != codes.OK && err != io.EOF\n}", "title": "" }, { "docid": "9b3e2b176711d88da97d6689afa6a77d", "score": "0.46300024", "text": "func fail(ctx context.Context, kube client.StatusClient, i *v1alpha1.ExtensionRequest, reason, msg string) (reconcile.Result, error) {\n\tlog.V(logging.Debug).Info(\"failed extension request\", \"i\", i.Name, \"reason\", reason, \"message\", msg)\n\ti.Status.SetFailed(reason, msg)\n\ti.Status.UnsetDeprecatedCondition(corev1alpha1.DeprecatedReady)\n\treturn resultRequeue, kube.Status().Update(ctx, i)\n}", "title": "" }, { "docid": "be87b1fee263a476aaee5d1c2884985d", "score": "0.46210566", "text": "func (m *PingMessage) Fail() {}", "title": "" }, { "docid": "2e1a2f6f0b1a0cda9a27ab45ae082891", "score": "0.4618648", "text": "func (_class PoolClass) HaComputeHypotheticalMaxHostFailuresToTolerate(sessionID SessionRef, configuration map[VMRef]string) (_retval int, _err error) {\n\tif IsMock {\n\t\treturn _class.HaComputeHypotheticalMaxHostFailuresToTolerateMock(sessionID, configuration)\n\t}\t\n\t_method := \"pool.ha_compute_hypothetical_max_host_failures_to_tolerate\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_configurationArg, _err := convertVMRefToStringMapToXen(fmt.Sprintf(\"%s(%s)\", _method, \"configuration\"), configuration)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _configurationArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertIntToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "df2a6e748b059b41ff7b95e2cfd9157d", "score": "0.46107277", "text": "func (o BackendResponseOutput) Failover() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v BackendResponse) bool { return v.Failover }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "7a3bb79369579099bb193225c68097d4", "score": "0.46051913", "text": "func (_class PoolClass) HaComputeMaxHostFailuresToTolerate(sessionID SessionRef) (_retval int, _err error) {\n\tif IsMock {\n\t\treturn _class.HaComputeMaxHostFailuresToTolerateMock(sessionID)\n\t}\t\n\t_method := \"pool.ha_compute_max_host_failures_to_tolerate\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertIntToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "7756f4db4d439cb4c14ad5d3d1b7d787", "score": "0.4604693", "text": "func (_m *MetricCollector) IncrementFallbackFailures() {\n\t_m.Called()\n}", "title": "" }, { "docid": "c0cce10f3a9b5b1573ea9b601331e4be", "score": "0.4595421", "text": "func (c *bazClient) Call(\n\tctx context.Context,\n\treqHeaders map[string]string,\n\targs *clientsIDlClientsBazBaz.SimpleService_Call_Args,\n) (context.Context, map[string]string, error) {\n\tvar result clientsIDlClientsBazBaz.SimpleService_Call_Result\n\n\tlogger := c.client.ContextLogger\n\n\tvar success bool\n\trespHeaders := make(map[string]string)\n\tvar err error\n\tif c.circuitBreakerDisabled {\n\t\tsuccess, respHeaders, err = c.client.Call(\n\t\t\tctx, \"SimpleService\", \"call\", reqHeaders, args, &result)\n\t} else {\n\t\t// We want hystrix ckt-breaker to count errors only for system issues\n\t\tvar clientErr error\n\t\tscope := c.defaultDeps.Scope.Tagged(map[string]string{\n\t\t\t\"client\": \"baz\",\n\t\t\t\"methodName\": \"Call\",\n\t\t})\n\t\tstart := time.Now()\n\t\tcircuitBreakerName := \"baz\" + \"-\" + \"Call\"\n\t\terr = hystrix.DoC(ctx, circuitBreakerName, func(ctx context.Context) error {\n\t\t\telapsed := time.Now().Sub(start)\n\t\t\tscope.Timer(\"hystrix-timer\").Record(elapsed)\n\t\t\tsuccess, respHeaders, clientErr = c.client.Call(\n\t\t\t\tctx, \"SimpleService\", \"call\", reqHeaders, args, &result)\n\t\t\tif _, isSysErr := clientErr.(tchannel.SystemError); !isSysErr {\n\t\t\t\t// Declare ok if it is not a system-error\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientErr\n\t\t}, nil)\n\t\tif err == nil {\n\t\t\t// ckt-breaker was ok, bubble up client error if set\n\t\t\terr = clientErr\n\t\t}\n\t}\n\tif err != nil {\n\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.String(\"error\", fmt.Sprintf(\"error making tchannel call: %s\", err)), logFieldErrLocation)\n\t}\n\n\tif err == nil && !success {\n\t\tswitch {\n\t\tcase result.AuthErr != nil:\n\t\t\terr = result.AuthErr\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), zanzibar.LogFieldErrTypeClientException, logFieldErrLocation)\n\t\tdefault:\n\t\t\terr = errors.New(\"bazClient received no result or unknown exception for Call\")\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), logFieldErrLocation)\n\t\t}\n\t}\n\tif err != nil {\n\t\tctx = logger.WarnZ(ctx, \"Client failure: TChannel client call returned error\")\n\t\treturn ctx, respHeaders, err\n\t}\n\n\treturn ctx, respHeaders, err\n}", "title": "" }, { "docid": "1253c36900b20cc0e55e4f14ef3a7077", "score": "0.45906407", "text": "func (c *bazClient) URLTest(\n\tctx context.Context,\n\treqHeaders map[string]string,\n) (context.Context, map[string]string, error) {\n\tvar result clientsIDlClientsBazBaz.SimpleService_UrlTest_Result\n\n\tlogger := c.client.ContextLogger\n\n\targs := &clientsIDlClientsBazBaz.SimpleService_UrlTest_Args{}\n\tvar success bool\n\trespHeaders := make(map[string]string)\n\tvar err error\n\tif c.circuitBreakerDisabled {\n\t\tsuccess, respHeaders, err = c.client.Call(\n\t\t\tctx, \"SimpleService\", \"urlTest\", reqHeaders, args, &result)\n\t} else {\n\t\t// We want hystrix ckt-breaker to count errors only for system issues\n\t\tvar clientErr error\n\t\tscope := c.defaultDeps.Scope.Tagged(map[string]string{\n\t\t\t\"client\": \"baz\",\n\t\t\t\"methodName\": \"URLTest\",\n\t\t})\n\t\tstart := time.Now()\n\t\tcircuitBreakerName := \"baz\" + \"-\" + \"URLTest\"\n\t\terr = hystrix.DoC(ctx, circuitBreakerName, func(ctx context.Context) error {\n\t\t\telapsed := time.Now().Sub(start)\n\t\t\tscope.Timer(\"hystrix-timer\").Record(elapsed)\n\t\t\tsuccess, respHeaders, clientErr = c.client.Call(\n\t\t\t\tctx, \"SimpleService\", \"urlTest\", reqHeaders, args, &result)\n\t\t\tif _, isSysErr := clientErr.(tchannel.SystemError); !isSysErr {\n\t\t\t\t// Declare ok if it is not a system-error\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientErr\n\t\t}, nil)\n\t\tif err == nil {\n\t\t\t// ckt-breaker was ok, bubble up client error if set\n\t\t\terr = clientErr\n\t\t}\n\t}\n\tif err != nil {\n\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.String(\"error\", fmt.Sprintf(\"error making tchannel call: %s\", err)), logFieldErrLocation)\n\t}\n\n\tif err == nil && !success {\n\t\tswitch {\n\t\tdefault:\n\t\t\terr = errors.New(\"bazClient received no result or unknown exception for UrlTest\")\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), logFieldErrLocation)\n\t\t}\n\t}\n\tif err != nil {\n\t\tctx = logger.WarnZ(ctx, \"Client failure: TChannel client call returned error\")\n\t\treturn ctx, respHeaders, err\n\t}\n\n\treturn ctx, respHeaders, err\n}", "title": "" }, { "docid": "982e0ebeef1b0e109023a63962e7fd71", "score": "0.4588023", "text": "func (r *Reconciler) fail(instance *v1alpha1.Provider, reason, msg string) (reconcile.Result, error) {\n\tinstance.Status.UnsetAllDeprecatedConditions()\n\tinstance.Status.SetFailed(reason, msg)\n\treturn resultRequeue, r.Update(context.TODO(), instance)\n}", "title": "" }, { "docid": "f0c1b04395875a61630656410b7ecdab", "score": "0.45867768", "text": "func (self *Tester) Fail(description ...interface{}) bool {\n\treturn self.fail(description...)\n}", "title": "" }, { "docid": "a454c5d83ae23b5ef4b2e657754169d6", "score": "0.45853102", "text": "func ignoreHealthEndpoint(urlPath string) bool {\n\treturn urlPath == EndpointPath\n}", "title": "" }, { "docid": "5e6311d831d902420cb3d4fa1e2ce929", "score": "0.45783973", "text": "func failoverDeploymentTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) error {\n\tnamespace, err := ctx.GetNamespace()\n\tif err != nil {\n\t\tt.Fatalf(\"could not get namespace: %v\", err)\n\t}\n\n\t// create SiddhiProcess custom resource\n\texampleSiddhi := &siddhiv1alpha2.SiddhiProcess{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"SiddhiProcess\",\n\t\t\tAPIVersion: \"siddhi.io/v1alpha1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"failover-app\",\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: siddhiv1alpha2.SiddhiProcessSpec{\n\t\t\tApps: []siddhiv1alpha2.Apps{\n\t\t\t\tsiddhiv1alpha2.Apps{\n\t\t\t\t\tScript: script2,\n\t\t\t\t},\n\t\t\t},\n\t\t\tContainer: corev1.Container{\n\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\tName: \"RECEIVER_URL\",\n\t\t\t\t\t\tValue: \"http://0.0.0.0:8280/example\",\n\t\t\t\t\t},\n\t\t\t\t\tcorev1.EnvVar{\n\t\t\t\t\t\tName: \"BASIC_AUTH_ENABLED\",\n\t\t\t\t\t\tValue: \"false\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tMessagingSystem: siddhiv1alpha2.MessagingSystem{\n\t\t\t\tType: \"nats\",\n\t\t\t},\n\t\t},\n\t}\n\n\terr = f.Client.Create(goctx.TODO(), exampleSiddhi, &framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e2eutil.WaitForDeployment(t, f.KubeClient, namespace, \"failover-app-0\", 1, retryInterval, timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e2eutil.WaitForDeployment(t, f.KubeClient, namespace, \"failover-app-1\", 1, retryInterval, timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = f.KubeClient.CoreV1().Services(namespace).Get(\"siddhi-nats\", metav1.GetOptions{IncludeUninitialized: true})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = f.KubeClient.CoreV1().Services(namespace).Get(\"failover-app-0\", metav1.GetOptions{IncludeUninitialized: true})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = f.KubeClient.ExtensionsV1beta1().Ingresses(namespace).Get(\"siddhi\", metav1.GetOptions{IncludeUninitialized: true})\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = f.Client.Delete(goctx.TODO(), exampleSiddhi)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e05db1ae0916508f5c50a4630df52d4b", "score": "0.45566183", "text": "func (c *DefaultHealthChecker) isCircuitBreakerTripped(status *protocol.RPCStatus) bool {\n\tcircuitBreakerTimeout := c.getCircuitBreakerTimeout(status)\n\tcurrentTime := protocol.CurrentTimeMillis()\n\tif circuitBreakerTimeout <= 0 {\n\t\treturn false\n\t}\n\treturn circuitBreakerTimeout > currentTime\n}", "title": "" }, { "docid": "492b2c3993bb088d8f76400e65cf1282", "score": "0.45502198", "text": "func (c *FallbackMetricsCollector) ErrFailure(now time.Time, duration time.Duration) {\n\tc.check(c.Inc(\"err_failure\", 1, c.SampleRate))\n}", "title": "" }, { "docid": "a33e8c7b6620eed8c58b93078ac28f1c", "score": "0.45459443", "text": "func (proxy *Proxy) shouldRetryUpstreamAttempt() bool {\n\n\t// part one is checking for repeatable methods. we don't retry i.e. POST\n\tretry := false\nRetry:\n\tfor _, method := range httpRepeatableMethods {\n\t\tif proxy.Dwn.Method == method {\n\t\t\tif proxy.Up.Atmpt.Count < Runner.Connection.Upstream.MaxAttempts {\n\t\t\t\tretry = true\n\t\t\t\tbreak Retry\n\t\t\t}\n\t\t\tretry = false\n\t\t}\n\t}\n\n\t// once downstream context has signalled, do not re-attempt upstream\n\tif proxy.hasDownstreamAborted() {\n\t\tretry = false\n\t}\n\n\tif !retry {\n\t\tscaffoldUpAttemptLog(proxy).\n\t\t\tMsg(\"upstream retries stopped after upstream attempt\")\n\t}\n\n\treturn retry\n}", "title": "" }, { "docid": "a33e8c7b6620eed8c58b93078ac28f1c", "score": "0.45459443", "text": "func (proxy *Proxy) shouldRetryUpstreamAttempt() bool {\n\n\t// part one is checking for repeatable methods. we don't retry i.e. POST\n\tretry := false\nRetry:\n\tfor _, method := range httpRepeatableMethods {\n\t\tif proxy.Dwn.Method == method {\n\t\t\tif proxy.Up.Atmpt.Count < Runner.Connection.Upstream.MaxAttempts {\n\t\t\t\tretry = true\n\t\t\t\tbreak Retry\n\t\t\t}\n\t\t\tretry = false\n\t\t}\n\t}\n\n\t// once downstream context has signalled, do not re-attempt upstream\n\tif proxy.hasDownstreamAborted() {\n\t\tretry = false\n\t}\n\n\tif !retry {\n\t\tscaffoldUpAttemptLog(proxy).\n\t\t\tMsg(\"upstream retries stopped after upstream attempt\")\n\t}\n\n\treturn retry\n}", "title": "" }, { "docid": "bdbc9083b634ebb5960d0184dad40886", "score": "0.45393023", "text": "func shouldIgnore(metricName string) bool {\n\tfor i := range exceptionMetrics {\n\t\tif metricName == exceptionMetrics[i] {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8a3b64c0e56b26b6d37deb4134d9d7df", "score": "0.45389253", "text": "func TestClient_OnfailureServerDown(t *testing.T) {\n\tcategory := \"testing\"\n\n\t// NOTE: not creating testServer here.\n\tu, err := url.Parse(\"http://127.0.0.1:5974/nope\")\n\tif err != nil {\n\t\tt.Fatalf(\"Error parsing test url: %v\", err)\n\t}\n\n\topts := ClientOptions{\n\t\tSubscribeUrl: *u,\n\t\tCategory: category,\n\t\tPollTimeoutSeconds: 1,\n\t\tReattemptWaitSeconds: 1,\n\t\tLoggingEnabled: true,\n\t\tOnFailure: getOnFailureTestHandler(),\n\t}\n\tc, err := NewClient(opts)\n\n\tif err != nil {\n\t\tt.Fatalf(\"Error creating client: %v\", err)\n\t}\n\n\tonFailureTestCase(t, c)\n}", "title": "" }, { "docid": "014a21076342dec77822ea7846374c4e", "score": "0.45367604", "text": "func isHaltErr(ctx context.Context, err error) bool {\n\tif ctx != nil && ctx.Err() != nil {\n\t\treturn true\n\t}\n\tif err == nil {\n\t\treturn false\n\t}\n\tcode := grpc.Code(err)\n\t// Unavailable codes mean the system will be right back.\n\t// (e.g., can't connect, lost leader)\n\t// Treat Internal codes as if something failed, leaving the\n\t// system in an inconsistent state, but retrying could make progress.\n\t// (e.g., failed in middle of send, corrupted frame)\n\t// TODO: are permanent Internal errors possible from grpc?\n\treturn code != codes.Unavailable && code != codes.Internal\n}", "title": "" }, { "docid": "26afd0499ec6d8b8c86ed278621f2d44", "score": "0.45332196", "text": "func isFailure(code int, validCodes []int) bool {\n\tfor _, item := range validCodes {\n\t\tif item == code {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "26afd0499ec6d8b8c86ed278621f2d44", "score": "0.45332196", "text": "func isFailure(code int, validCodes []int) bool {\n\tfor _, item := range validCodes {\n\t\tif item == code {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f8f9ff0d7e76ab44a7504e0d67dba447", "score": "0.45107108", "text": "func OnRetryInternalFailure() (result interface{}) {\n\ttr1Resp := Tr1d1umResponse{}.New()\n\ttr1Resp.Code = http.StatusInternalServerError\n\treturn tr1Resp\n}", "title": "" }, { "docid": "aa39a28ffeab9af80b592f096c378d17", "score": "0.45080513", "text": "func (s *SMTestSuite) TestConnectivityFailover() {\n\ts.monitor.IsHealthy = true\n\ts.zkRunner.\n\t\tOn(\"Create\", \"/hailo-2-api-az-failover\", []byte(\"test\"), int32(gozk.FlagEphemeral), gozk.WorldACL(gozk.PermAll)).\n\t\tReturn(\"/hailo-2-api-az-failover\", nil).\n\t\tOnce()\n\n\tisConnected := false\n\ts.monitor.interpretRavenStatus(isConnected)\n\ts.Equal(s.monitor.IsHealthy, false)\n\ts.Equal(s.monitor.FailureType, ConnectivityFailure)\n\n\t// Recover\n\ts.zkRunner.\n\t\tOn(\"Delete\", \"/hailo-2-api-az-failover\", int32(0)).\n\t\tReturn(nil).\n\t\tOnce()\n\tisConnected = true\n\ts.monitor.interpretRavenStatus(isConnected)\n\ts.Equal(s.monitor.IsHealthy, true)\n\ts.Equal(s.monitor.FailureType, NoFailure)\n}", "title": "" }, { "docid": "0e7fd5b9a33198c99a3f9f49c5d0eb83", "score": "0.45073837", "text": "func (suite *PostManagerTestSuite) TestLinoDonateExternalFailure() {}", "title": "" }, { "docid": "dc6c3ae5d0c6a70ad920fcdb76211895", "score": "0.45047408", "text": "func Failure() bool {\n\tpkgCmd.t.Helper()\n\treturn pkgCmd.Failure()\n}", "title": "" }, { "docid": "ea26576f66e3bbecef3e97e77065e702", "score": "0.45037863", "text": "func (o OutlierDetectionOutput) EnforcingConsecutiveGatewayFailure() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v OutlierDetection) *int { return v.EnforcingConsecutiveGatewayFailure }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "d7716c0f40e518ad2bebbde2f8630ff6", "score": "0.45025367", "text": "func (o BackendServiceFailoverPolicyResponseOutput) DropTrafficIfUnhealthy() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v BackendServiceFailoverPolicyResponse) bool { return v.DropTrafficIfUnhealthy }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "15393645542b1cf6bdc1bbf94469d01e", "score": "0.44987607", "text": "func Fail(err error) Result {\n\treturn Result{\n\t\tRetry: true,\n\t\tErr: err,\n\t}\n}", "title": "" }, { "docid": "0b2a10660f3190a5c1d8456fc6b89b57", "score": "0.4496214", "text": "func testProxyIntraNodeHairpinCases(data *TestData, t *testing.T, expectedClientIP, pod, clusterIPUrl, nodePortClusterUrl, nodePortLocalUrl, lbClusterUrl, lbLocalUrl string) {\n\tt.Run(\"IntraNode/ClusterIP\", func(t *testing.T) {\n\t\tclientIP, err := probeClientIPFromPod(data, pod, agnhostContainerName, clusterIPUrl)\n\t\trequire.NoError(t, err, \"ClusterIP hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n\tt.Run(\"IntraNode/NodePort/ExternalTrafficPolicy:Cluster\", func(t *testing.T) {\n\t\tskipIfProxyAllDisabled(t, data)\n\t\tclientIP, err := probeClientIPFromPod(data, pod, agnhostContainerName, nodePortClusterUrl)\n\t\trequire.NoError(t, err, \"NodePort whose externalTrafficPolicy is Cluster hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n\tt.Run(\"IntraNode/NodePort/ExternalTrafficPolicy:Local\", func(t *testing.T) {\n\t\tskipIfProxyAllDisabled(t, data)\n\t\tclientIP, err := probeClientIPFromPod(data, pod, agnhostContainerName, nodePortLocalUrl)\n\t\trequire.NoError(t, err, \"NodePort whose externalTrafficPolicy is Local hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n\tt.Run(\"IntraNode/LoadBalancer/ExternalTrafficPolicy:Cluster\", func(t *testing.T) {\n\t\tclientIP, err := probeClientIPFromPod(data, pod, agnhostContainerName, lbClusterUrl)\n\t\trequire.NoError(t, err, \"LoadBalancer whose externalTrafficPolicy is Cluster hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n\tt.Run(\"IntraNode/LoadBalancer/ExternalTrafficPolicy:Local\", func(t *testing.T) {\n\t\tclientIP, err := probeClientIPFromPod(data, pod, agnhostContainerName, lbLocalUrl)\n\t\trequire.NoError(t, err, \"LoadBalancer whose externalTrafficPolicy is Local hairpin should be able to be connected\")\n\t\trequire.Equal(t, expectedClientIP, clientIP)\n\t})\n}", "title": "" }, { "docid": "43eae056957aafcc76b14d0ac7a814ab", "score": "0.44920605", "text": "func (c *bazClient) EchoBool(\n\tctx context.Context,\n\treqHeaders map[string]string,\n\targs *clientsIDlClientsBazBaz.SecondService_EchoBool_Args,\n) (context.Context, bool, map[string]string, error) {\n\tvar result clientsIDlClientsBazBaz.SecondService_EchoBool_Result\n\tvar resp bool\n\n\tlogger := c.client.ContextLogger\n\n\tvar success bool\n\trespHeaders := make(map[string]string)\n\tvar err error\n\tif c.circuitBreakerDisabled {\n\t\tsuccess, respHeaders, err = c.client.Call(\n\t\t\tctx, \"SecondService\", \"echoBool\", reqHeaders, args, &result)\n\t} else {\n\t\t// We want hystrix ckt-breaker to count errors only for system issues\n\t\tvar clientErr error\n\t\tscope := c.defaultDeps.Scope.Tagged(map[string]string{\n\t\t\t\"client\": \"baz\",\n\t\t\t\"methodName\": \"EchoBool\",\n\t\t})\n\t\tstart := time.Now()\n\t\tcircuitBreakerName := \"baz\" + \"-\" + \"EchoBool\"\n\t\terr = hystrix.DoC(ctx, circuitBreakerName, func(ctx context.Context) error {\n\t\t\telapsed := time.Now().Sub(start)\n\t\t\tscope.Timer(\"hystrix-timer\").Record(elapsed)\n\t\t\tsuccess, respHeaders, clientErr = c.client.Call(\n\t\t\t\tctx, \"SecondService\", \"echoBool\", reqHeaders, args, &result)\n\t\t\tif _, isSysErr := clientErr.(tchannel.SystemError); !isSysErr {\n\t\t\t\t// Declare ok if it is not a system-error\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientErr\n\t\t}, nil)\n\t\tif err == nil {\n\t\t\t// ckt-breaker was ok, bubble up client error if set\n\t\t\terr = clientErr\n\t\t}\n\t}\n\tif err != nil {\n\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.String(\"error\", fmt.Sprintf(\"error making tchannel call: %s\", err)), logFieldErrLocation)\n\t}\n\n\tif err == nil && !success {\n\t\tswitch {\n\t\tcase result.Success != nil:\n\t\t\tctx = logger.WarnZ(ctx, \"Internal error. Success flag is not set for EchoBool. Overriding\")\n\t\t\tsuccess = true\n\t\tdefault:\n\t\t\terr = errors.New(\"bazClient received no result or unknown exception for EchoBool\")\n\t\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), logFieldErrLocation)\n\t\t}\n\t}\n\tif err != nil {\n\t\tctx = logger.WarnZ(ctx, \"Client failure: TChannel client call returned error\")\n\t\treturn ctx, resp, respHeaders, err\n\t}\n\n\tresp, err = clientsIDlClientsBazBaz.SecondService_EchoBool_Helper.UnwrapResponse(&result)\n\tif err != nil {\n\t\tzanzibar.AppendLogFieldsToContext(ctx, zap.Error(err), logFieldErrLocation)\n\t\tctx = logger.WarnZ(ctx, \"Client failure: unable to unwrap client response\")\n\t}\n\treturn ctx, resp, respHeaders, err\n}", "title": "" }, { "docid": "8aa551962d5f4fe77238d15c761ee80c", "score": "0.44914043", "text": "func (meta ProxyMeta) Ignore() bool {\n\treturn len(meta.Error) == 0\n}", "title": "" }, { "docid": "aad2d67a6375b6bcdb26ae040948fbf2", "score": "0.44891983", "text": "func ExampleMustTrytesToTrits() {}", "title": "" }, { "docid": "a029c2e0bff7ecc2d25e6d7cecf1a83a", "score": "0.44878486", "text": "func isExpectedLoadBalancer(ing *v1alpha1.Ingress) bool {\n\texternal, internal := config.ServiceHostnames()\n\tif ing.Status.PublicLoadBalancer == nil || len(ing.Status.PublicLoadBalancer.Ingress) < 1 ||\n\t\ting.Status.PublicLoadBalancer.Ingress[0].DomainInternal != external {\n\t\treturn false\n\t}\n\tif ing.Status.PrivateLoadBalancer == nil || len(ing.Status.PrivateLoadBalancer.Ingress) < 1 ||\n\t\ting.Status.PrivateLoadBalancer.Ingress[0].DomainInternal != internal {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c37ba342687e90919c4d659c2cae6604", "score": "0.4486991", "text": "func (b BackoffError) Backoff() bool {\n\treturn b.shouldBackoff\n}", "title": "" }, { "docid": "5c932a493cf80e31947d5831f90bf17a", "score": "0.4485726", "text": "func TestRetryPolicy_NonRetriable(t *testing.T) {\n\tsrv, close := mock.NewTLSServer()\n\tdefer close()\n\tsrv.AppendResponse(mock.WithStatusCode(http.StatusUnauthorized))\n\tsrv.AppendResponse(mock.WithStatusCode(http.StatusOK))\n\toptions := ClientSecretCredentialOptions{}\n\toptions.AuthorityHost = srv.URL()\n\toptions.HTTPClient = srv\n\tcred, err := NewClientSecretCredential(tenantID, clientID, wrongSecret, &options)\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to create credential. Received: %v\", err)\n\t}\n\tpipeline := defaultTestPipeline(srv, cred, scope)\n\treq, err := azcore.NewRequest(context.Background(), http.MethodGet, srv.URL())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = pipeline.Do(req)\n\tvar afe *AuthenticationFailedError\n\tif !errors.As(err, &afe) {\n\t\tt.Fatalf(\"unexpected error type %v\", err)\n\t}\n}", "title": "" }, { "docid": "c607db2de093c514fc4ccac57392afe4", "score": "0.4483295", "text": "func Fail(description ...interface{}) bool {\n\treturn terstTester().Fail(description...)\n}", "title": "" }, { "docid": "6a3af14d7596e39f97dc935d5dc9d53c", "score": "0.44823277", "text": "func (r *Reconciler) fail(instance *gcpcomputev1alpha1.GKECluster, reason, msg string) (reconcile.Result, error) {\n\tinstance.Status.UnsetAllDeprecatedConditions()\n\tinstance.Status.SetFailed(reason, msg)\n\treturn resultRequeue, r.Update(context.TODO(), instance)\n}", "title": "" }, { "docid": "03a99b6a4143415c73b6e64299b95627", "score": "0.44800532", "text": "func executeCheckAndRecoverFunction(analysisEntry inst.ReplicationAnalysis, skipFilters bool) (bool, error) {\n\tvar checkAndRecoverFunction func(analysisEntry inst.ReplicationAnalysis, skipFilters bool) (bool, error) = nil\n\n\tswitch analysisEntry.Analysis {\n\tcase inst.DeadMaster:\n\t\tcheckAndRecoverFunction = checkAndRecoverDeadMaster\n\tcase inst.DeadIntermediateMaster:\n\t\tcheckAndRecoverFunction = checkAndRecoverDeadIntermediateMaster\n\tcase inst.DeadIntermediateMasterAndSomeSlaves:\n\t\tcheckAndRecoverFunction = checkAndRecoverDeadIntermediateMaster\n\tcase inst.DeadCoMaster:\n\t\tcheckAndRecoverFunction = checkAndRecoverDeadIntermediateMaster\n\t}\n\n\tif checkAndRecoverFunction == nil {\n\t\t// Unhandled problem type\n\t\treturn false, nil\n\t}\n\t// we have a recovery function; its execution still depends on filters if not disabled.\n\n\t// Execute general pre-processes\n\t{\n\t\tvar preProcessesFailures []error = []error{}\n\t\tbarrier := make(chan error)\n\t\tfor _, command := range config.Config.PreFailoverProcesses {\n\t\t\tcommand := command\n\n\t\t\tcommand = strings.Replace(command, \"{failureType}\", string(analysisEntry.Analysis), -1)\n\t\t\tcommand = strings.Replace(command, \"{failureDescription}\", analysisEntry.Description, -1)\n\t\t\tcommand = strings.Replace(command, \"{failedHost}\", analysisEntry.AnalyzedInstanceKey.Hostname, -1)\n\t\t\tcommand = strings.Replace(command, \"{failedPort}\", fmt.Sprintf(\"%d\", analysisEntry.AnalyzedInstanceKey.Port), -1)\n\t\t\tcommand = strings.Replace(command, \"{failureCluster}\", analysisEntry.ClusterName, -1)\n\n\t\t\tvar cmdErr error = nil\n\t\t\tgo func() {\n\t\t\t\tdefer func() { barrier <- cmdErr }()\n\t\t\t\tcmdErr = os.CommandRun(command)\n\t\t\t}()\n\t\t}\n\t\tfor _, _ = range config.Config.PreFailoverProcesses {\n\t\t\tif cmdErr := <-barrier; cmdErr != nil {\n\t\t\t\tpreProcessesFailures = append(preProcessesFailures, cmdErr)\n\t\t\t}\n\t\t}\n\t\tif len(preProcessesFailures) > 0 {\n\t\t\treturn false, preProcessesFailures[0]\n\t\t}\n\t}\n\n\treturn checkAndRecoverFunction(analysisEntry, skipFilters)\n}", "title": "" }, { "docid": "2060327b8a3578a514bbfc98f8dff88c", "score": "0.4478274", "text": "func TestCommandFailedRun(t *testing.T) {\n\tt.Parallel()\n\n\tconfig := fluent.NewFluentBitConfig(\"/iamrootandunabletodoanything\", \"invalidconfig\", \"/i/do/not/exist\")\n\tfluent.Start(config)\n\n\tif config.IsCleanStart() {\n\t\tt.Error(\"Incorrectly started with invalid configuration\")\n\t}\n}", "title": "" }, { "docid": "67fcaa6ba3afbe663129b24dcda1e992", "score": "0.4477432", "text": "func (cmd *Dev) RunFail(c *cli.Context) error {\n\tcmd.out.Spin(\"Abandon all hope...\")\n\ttime.Sleep(3 * time.Second)\n\tcmd.out.Warning(\"Hope slipping...\")\n\tcmd.out.Spin(\"Is the sky painted black?\")\n\ttime.Sleep(3 * time.Second)\n\treturn cmd.Failure(\"Hope abandoned :(\", \"ABANDON-HOPE\", 418)\n}", "title": "" }, { "docid": "72788bdebcc16e370a55ebfc1c9f8090", "score": "0.44770965", "text": "func (r *Reconciler) fail(instance *computev1alpha1.AKSCluster, reason, msg string) (reconcile.Result, error) {\n\tinstance.Status.UnsetAllDeprecatedConditions()\n\tinstance.Status.SetFailed(reason, msg)\n\treturn resultRequeue, r.Update(ctx, instance)\n}", "title": "" }, { "docid": "56fa7a474eb08abf811dceb3c3a07001", "score": "0.4470006", "text": "func (self *Tester) FailNow(description ...interface{}) bool {\n\treturn self.failNow(description...)\n}", "title": "" }, { "docid": "923880749d64bedddd6e66f6a7fc8d70", "score": "0.44647673", "text": "func (s *SMTestSuite) TestOnlyOnceAZFailover() {\n\ts.monitor.IsHealthy = true\n\ts.zkRunner.\n\t\tOn(\"Create\", \"/hailo-2-api-az-failover\", []byte(\"test\"), int32(gozk.FlagEphemeral), gozk.WorldACL(gozk.PermAll)).\n\t\tReturn(\"\", fmt.Errorf(\"Already exists\")).\n\t\tOnce()\n\ts.zkRunner.\n\t\tOn(\"Get\", \"/hailo-2-api-az-failover\").\n\t\tReturn([]byte(\"test2\"), new(gozk.Stat), nil).\n\t\tOnce()\n\n\t// Currently we expect to abort the AZ failover in case we can't process it\n\tazStatus := false\n\ts.monitor.interpretAZStatus(azStatus)\n\ts.Equal(s.monitor.FailureType, NoFailure)\n\ts.Equal(s.monitor.IsHealthy, true)\n}", "title": "" }, { "docid": "565ef6fc65feca2d16516f0c5e32e2aa", "score": "0.44582608", "text": "func (o HostPortGroupOutput) Failback() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *HostPortGroup) pulumi.BoolPtrOutput { return v.Failback }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "8d055f4097fa73f43ba3ef3732849c8b", "score": "0.44569442", "text": "func TestGinsiderMustDieAfterInsolardError(t *testing.T) {\n\t// can't kill LR in launch.sh from functest\n}", "title": "" }, { "docid": "7dde503718e08c7a2e790d3011cafdc4", "score": "0.44537702", "text": "func InFailureDomains(failureDomains ...*string) Func {\n\treturn func(machine *clusterv1.Machine) bool {\n\t\tif machine == nil {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range failureDomains {\n\t\t\tfd := failureDomains[i]\n\t\t\tif fd == nil {\n\t\t\t\tif fd == machine.Spec.FailureDomain {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif machine.Spec.FailureDomain == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif *fd == *machine.Spec.FailureDomain {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "7a0c97a2eb102c0c546247c794234b7e", "score": "0.44424158", "text": "func TestValidatePanicHandling(t *testing.T) {\n\ttestServer := webhooktesting.NewTestServer(t)\n\ttestServer.StartTLS()\n\tdefer testServer.Close()\n\n\tobjectInterfaces := webhooktesting.NewObjectInterfacesForTest()\n\n\tserverURL, err := url.ParseRequestURI(testServer.URL)\n\tif err != nil {\n\t\tt.Fatalf(\"this should never happen? %v\", err)\n\t}\n\n\tstopCh := make(chan struct{})\n\tdefer close(stopCh)\n\n\tfor _, tt := range webhooktesting.NewNonMutatingPanicTestCases(serverURL) {\n\t\twh, err := NewValidatingAdmissionWebhook(nil)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: failed to create validating webhook: %v\", tt.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tns := \"webhook-test\"\n\t\tclient, informer := webhooktesting.NewFakeValidatingDataSource(ns, tt.Webhooks, stopCh)\n\n\t\twh.SetAuthenticationInfoResolverWrapper(webhooktesting.Wrapper(webhooktesting.NewPanickingAuthenticationInfoResolver(\"Start panicking!\"))) // see Aladdin, it's awesome\n\t\twh.SetServiceResolver(webhooktesting.NewServiceResolver(*serverURL))\n\t\twh.SetExternalKubeClientSet(client)\n\t\twh.SetExternalKubeInformerFactory(informer)\n\n\t\tinformer.Start(stopCh)\n\t\tinformer.WaitForCacheSync(stopCh)\n\n\t\tif err = wh.ValidateInitialization(); err != nil {\n\t\t\tt.Errorf(\"%s: failed to validate initialization: %v\", tt.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tattr := webhooktesting.NewAttribute(ns, nil, tt.IsDryRun)\n\t\terr = wh.Validate(context.TODO(), attr, objectInterfaces)\n\t\tif tt.ExpectAllow != (err == nil) {\n\t\t\tt.Errorf(\"%s: expected allowed=%v, but got err=%v\", tt.Name, tt.ExpectAllow, err)\n\t\t}\n\t\t// ErrWebhookRejected is not an error for our purposes\n\t\tif tt.ErrorContains != \"\" {\n\t\t\tif err == nil || !strings.Contains(err.Error(), tt.ErrorContains) {\n\t\t\t\tt.Errorf(\"%s: expected an error saying %q, but got %v\", tt.Name, tt.ErrorContains, err)\n\t\t\t}\n\t\t}\n\t\tif _, isStatusErr := err.(*errors.StatusError); err != nil && !isStatusErr {\n\t\t\tt.Errorf(\"%s: expected a StatusError, got %T\", tt.Name, err)\n\t\t}\n\t\tfakeAttr, ok := attr.(*webhooktesting.FakeAttributes)\n\t\tif !ok {\n\t\t\tt.Errorf(\"Unexpected error, failed to convert attr to webhooktesting.FakeAttributes\")\n\t\t\tcontinue\n\t\t}\n\t\tif len(tt.ExpectAnnotations) == 0 {\n\t\t\tassert.Empty(t, fakeAttr.GetAnnotations(auditinternal.LevelMetadata), tt.Name+\": annotations not set as expected.\")\n\t\t} else {\n\t\t\tassert.Equal(t, tt.ExpectAnnotations, fakeAttr.GetAnnotations(auditinternal.LevelMetadata), tt.Name+\": annotations not set as expected.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fef87ed9d46856a2ec999dfd6f2c33ff", "score": "0.4440484", "text": "func TestAdyenServerFailed(t *testing.T) {\n\tft := &fakeTransport{}\n\thttpClient := http.Client{Transport: ft}\n\n\tclient := adyen.NewWithHTTPClient(getEnv(\"ADYEN_ACCOUNT\"), getEnv(\"ADYEN_KEY\"), \"\", common.Sandbox, &httpClient)\n\trequest := adyenBaseAuthRequest()\n\tauth, _ := client.Authorize(request)\n\n\tif auth.ResultType != sleet.ResultTypeServerError {\n\t\tt.Errorf(\"ResultType should be ServerError, got %s\", auth.ResultType)\n\t}\n}", "title": "" }, { "docid": "65b1b7dc8958d1e2eeb9adf402797649", "score": "0.4440258", "text": "func (h *Helper) runFail(args ...string) {\n\tif status := h.DoRun(args); status == nil {\n\t\th.t.Fatalf(\"%+v\", errors.New(\"testgo succeeded unexpectedly\"))\n\t} else {\n\t\th.t.Log(\"testgo failed as expected:\", status)\n\t}\n}", "title": "" }, { "docid": "ebaedf123f4ad2254e15eb3bcfba5acf", "score": "0.44394696", "text": "func (l *Linter) shouldIgnore(metricName string) bool {\n\tfor i := range exceptionMetrics {\n\t\tif metricName == exceptionMetrics[i] {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ab13740b51a44cf136bc75b3f3b4b317", "score": "0.44293135", "text": "func TestOnRetryBackoff(t *testing.T) {\n\tattempts := 3\n\tcounter := 0\n\n\thook := func(r *Response, err error) {\n\t\tcounter++\n\t}\n\n\tretryErr := Backoff(func() (*Response, error) {\n\t\treturn nil, nil\n\t}, RetryHooks([]OnRetryFunc{hook}))\n\n\tassertError(t, retryErr)\n\tassertNotEqual(t, counter, attempts)\n}", "title": "" }, { "docid": "9203e17042dc54277aa34a278905c251", "score": "0.4429124", "text": "func TestFailingOnCreationReturnsClients(t *testing.T) {\n\tintegration.BeforeTestExternal(t)\n\ttestServer := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3})\n\tdefer testServer.Terminate(t)\n\n\tpoolRecorder := newTestPool(testServer)\n\t// this should already happen at maxNumOpenClients/numRetries, so we're testing this is working pretty well here.\n\tfor i := 0; i < maxNumOpenClients; i++ {\n\t\t// this error should fail the first retry consistently\n\t\tpoolRecorder.newFuncErrReturn = fmt.Errorf(\"constant error\")\n\t\tclient, err := poolRecorder.pool.Get()\n\t\trequire.NoError(t, err)\n\t\tassert.NotNil(t, client)\n\t}\n\n\t// replenish the maxNumCachedClients that were closed earlier\n\tassert.Equal(t, maxNumOpenClients*2, poolRecorder.numNewCalls)\n\tassert.Equal(t, maxNumOpenClients, poolRecorder.numEndpointCalls)\n\tassert.Equal(t, maxNumOpenClients, poolRecorder.numHealthCalls)\n\tassert.Equal(t, 0, poolRecorder.numCloseCalls)\n}", "title": "" }, { "docid": "52550ebd1741316a976379ac272b13c1", "score": "0.4425952", "text": "func (c *Client) Fail(ctx context.Context, id string) error {\n\treturn c.get(ctx, fmt.Sprintf(\"%s/fail\", c.createURL(id)))\n}", "title": "" }, { "docid": "07217bb2e00d727515a8b16fe957e032", "score": "0.44246957", "text": "func (s *Service) throw(event int, ctx interface{}) {\n\tfor _, l := range s.lsns {\n\t\tl(event, ctx)\n\t}\n\n\tif event == roadrunner.EventServerFailure {\n\t\t// underlying rr server is dead\n\t\ts.Stop()\n\t}\n}", "title": "" }, { "docid": "24ebed34444c42ea9f537a88746dadcb", "score": "0.44209468", "text": "func (o *BindHostServiceUnavailable) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "70e98379eb42f6bcaaf36854f58ee977", "score": "0.44203734", "text": "func (m *MockAPI) IgnoreFailure(sender, owner, repo string, run *github.CheckRun, installation *github.Installation) error {\n\tret := m.ctrl.Call(m, \"IgnoreFailure\", sender, owner, repo, run, installation)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6becdaad2ebb5be528865c8478ba97c3", "score": "0.44147283", "text": "func (_ *Crawler) errorShouldInterruptExecution(err error) bool {\n\tif err != nil && err != ErrPackageInvalid {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" } ]
aeea756e3d084efd1ffdae8dbb5462c4
NewDirectoryAuditReportsClient returns a new DirectoryAuditReportsClient.
[ { "docid": "7bb8f29d68773b0f3f8ee24f2f756fa0", "score": "0.8254976", "text": "func NewDirectoryAuditReportsClient(tenantId string) *DirectoryAuditReportsClient {\n\treturn &DirectoryAuditReportsClient{\n\t\tBaseClient: NewClient(VersionBeta, tenantId),\n\t}\n}", "title": "" } ]
[ { "docid": "07582d58d680c9671203f1ea12ba454c", "score": "0.5721034", "text": "func NewReportsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReportsClient, error) {\n\tcl, err := arm.NewClient(moduleName+\".ReportsClient\", moduleVersion, credential, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &ReportsClient{\n\t\tsubscriptionID: subscriptionID,\n\t\tinternal: cl,\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "ebe31f831202969a7b79f4678aec17b0", "score": "0.5612571", "text": "func (c *DirectoryAuditReportsClient) Get(ctx context.Context, id string, query odata.Query) (*DirectoryAudit, int, error) {\n\tresp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{\n\t\tConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc,\n\t\tOData: query,\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: Uri{\n\t\t\tEntity: fmt.Sprintf(\"/auditLogs/directoryAudits/%s\", id),\n\t\t\tHasTenantId: true,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, status, fmt.Errorf(\"DirectoryAuditReportsClient.BaseClient.Get(): %v\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\trespBody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, status, fmt.Errorf(\"io.ReadAll(): %v\", err)\n\t}\n\n\tvar directoryAuditReport DirectoryAudit\n\tif err := json.Unmarshal(respBody, &directoryAuditReport); err != nil {\n\t\treturn nil, status, fmt.Errorf(\"json.Unmarshal(): %v\", err)\n\t}\n\n\treturn &directoryAuditReport, status, nil\n}", "title": "" }, { "docid": "63657ce05feef1b4fab105c96e1fc9eb", "score": "0.5568405", "text": "func NewSignInReportsClient(tenantId string) *SignInReportsClient {\n\treturn &SignInReportsClient{\n\t\tBaseClient: NewClient(VersionBeta, tenantId),\n\t}\n}", "title": "" }, { "docid": "fac1323309d120720cd0dc745daa1ae1", "score": "0.5270815", "text": "func New(options *Options, db string) (Client, error) {\n\tclient := &ReportingClient{options: options}\n\n\tif options.GitHub != nil {\n\t\toptions.GitHub.HttpClient = options.HttpClient\n\t\ttracker, err := github.New(options.GitHub)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrReportingClientCreation)\n\t\t}\n\t\tclient.trackers = append(client.trackers, tracker)\n\t}\n\tif options.GitLab != nil {\n\t\toptions.GitLab.HttpClient = options.HttpClient\n\t\ttracker, err := gitlab.New(options.GitLab)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrReportingClientCreation)\n\t\t}\n\t\tclient.trackers = append(client.trackers, tracker)\n\t}\n\tif options.Jira != nil {\n\t\toptions.Jira.HttpClient = options.HttpClient\n\t\ttracker, err := jira.New(options.Jira)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrReportingClientCreation)\n\t\t}\n\t\tclient.trackers = append(client.trackers, tracker)\n\t}\n\tif options.MarkdownExporter != nil {\n\t\texporter, err := markdown.New(options.MarkdownExporter)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrExportClientCreation)\n\t\t}\n\t\tclient.exporters = append(client.exporters, exporter)\n\t}\n\tif options.SarifExporter != nil {\n\t\texporter, err := sarif.New(options.SarifExporter)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrExportClientCreation)\n\t\t}\n\t\tclient.exporters = append(client.exporters, exporter)\n\t}\n\tif options.JSONExporter != nil {\n\t\texporter, err := json_exporter.New(options.JSONExporter)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrExportClientCreation)\n\t\t}\n\t\tclient.exporters = append(client.exporters, exporter)\n\t}\n\tif options.JSONLExporter != nil {\n\t\texporter, err := jsonl.New(options.JSONLExporter)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrExportClientCreation)\n\t\t}\n\t\tclient.exporters = append(client.exporters, exporter)\n\t}\n\tif options.ElasticsearchExporter != nil {\n\t\toptions.ElasticsearchExporter.HttpClient = options.HttpClient\n\t\texporter, err := es.New(options.ElasticsearchExporter)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrExportClientCreation)\n\t\t}\n\t\tclient.exporters = append(client.exporters, exporter)\n\t}\n\tif options.SplunkExporter != nil {\n\t\toptions.SplunkExporter.HttpClient = options.HttpClient\n\t\texporter, err := splunk.New(options.SplunkExporter)\n\t\tif err != nil {\n\t\t\treturn nil, errorutil.NewWithErr(err).Wrap(ErrExportClientCreation)\n\t\t}\n\t\tclient.exporters = append(client.exporters, exporter)\n\t}\n\n\tstorage, err := dedupe.New(db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.dedupe = storage\n\treturn client, nil\n}", "title": "" }, { "docid": "fdc76ebccccab1890434dcd1e45c4289", "score": "0.5266866", "text": "func (c *DirectoryAuditReportsClient) List(ctx context.Context, query odata.Query) (*[]DirectoryAudit, int, error) {\n\tresp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{\n\t\tDisablePaging: query.Top > 0,\n\t\tOData: query,\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: Uri{\n\t\t\tEntity: \"/auditLogs/directoryAudits\",\n\t\t\tHasTenantId: true,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, status, fmt.Errorf(\"DirectoryAuditReportsClient.BaseClient.Get(): %v\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\trespBody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, status, fmt.Errorf(\"io.ReadAll(): %v\", err)\n\t}\n\n\tvar data struct {\n\t\tDirectoryAuditReports []DirectoryAudit `json:\"value\"`\n\t}\n\tif err := json.Unmarshal(respBody, &data); err != nil {\n\t\treturn nil, status, fmt.Errorf(\"json.Unmarshal(): %v\", err)\n\t}\n\n\treturn &data.DirectoryAuditReports, status, nil\n}", "title": "" }, { "docid": "a2719c704d776ef28ea939512d15fdb7", "score": "0.51316047", "text": "func NewConnectReportingServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ConnectReportingServiceClient {\n\tbaseURL = strings.TrimRight(baseURL, \"/\")\n\treturn &connectReportingServiceClient{\n\t\tsubmitConnectEvent: connect_go.NewClient[v1alpha.SubmitConnectEventRequest, v1alpha.SubmitConnectEventResponse](\n\t\t\thttpClient,\n\t\t\tbaseURL+\"/prehog.v1alpha.ConnectReportingService/SubmitConnectEvent\",\n\t\t\topts...,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a556c6beb5059d6ed1128a876c93c5bf", "score": "0.5035196", "text": "func NewClient(ctx context.Context) (*errorreporting.Client, error) {\n\tcred, err := gaccount.GlobalCredential(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := errorreporting.NewClient(ctx,\n\t\tcred.ProjectID,\n\t\terrorreporting.Config{\n\t\t\tServiceName: env.AppName,\n\t\t\tOnError: func(err error) {\n\t\t\t\tlogger.Error(ctx, errors.Wrap(err, \"error report write\").Error())\n\t\t\t},\n\t\t},\n\t\toption.WithCredentials(cred))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "57f497136b53ff911e8cefe3c44de3f0", "score": "0.4919893", "text": "func NewDeviceManagementReports()(*DeviceManagementReports) {\n m := &DeviceManagementReports{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "c19a3b7de879b116a9157ee01a622c62", "score": "0.48815867", "text": "func NewDomainClient(logger *zap.Logger, appName string, config Config) (client.DomainClient, error) {\n\tsvc, err := serviceClient(logger, appName, config.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\topts := &client.Options{\n\t\tMetricsScope: tally.NoopScope,\n\t}\n\treturn client.NewDomainClient(svc, opts), nil\n}", "title": "" }, { "docid": "19566b526b88c202e027e7a5232a5804", "score": "0.47399542", "text": "func NewReports(r repositories.TaskFetcher) *Reports {\n\treturn &Reports{\n\t\trepo: r,\n\t}\n}", "title": "" }, { "docid": "1eff82c5db2b3e66c7cc1f349aa11873", "score": "0.46305904", "text": "func NewClient(logsApiBaseUrl string) (*Client, error) {\n\treturn &Client{\n\t\thttpClient: &http.Client{},\n\t\tlogsApiBaseUrl: logsApiBaseUrl,\n\t}, nil\n}", "title": "" }, { "docid": "577caff87b9d1436c1923dead7e4c26f", "score": "0.46071684", "text": "func NewReportsAPI(cli *AmazonClient) *ReportsAPI {\n\tapi := &ReportsAPI{client: cli}\n\tapi.endpoint = api.client.Region.Endpoint + \"Reports/\" + reportsAPIversion\n\treturn api\n}", "title": "" }, { "docid": "2200949b2016a77c3125d7501a913881", "score": "0.457628", "text": "func NewClient(api cloudwatchlogsiface.CloudWatchLogsAPI) *Client {\n\treturn &Client{\n\t\tapi,\n\t}\n}", "title": "" }, { "docid": "574fe83dd0b2a61179dfcbd4aa8a18c4", "score": "0.4555938", "text": "func NewHealthCheckClient(db *mgo.Session) *HealthCheckClient {\n\treturn &HealthCheckClient{\n\t\tmongo: db,\n\t\tserviceName: \"mongodb\",\n\t}\n}", "title": "" }, { "docid": "42f52bce4c0e4b0b3a02662b4f1f41bb", "score": "0.45503747", "text": "func NewClient(baseURL string, companyName string, userName string, password string) *Client {\n\n\tauthString := companyName + \"\\\\\" + userName + \":\" + password\n\tencodedAuth := base64.StdEncoding.EncodeToString([]byte(authString))\n\n\tc := &Client{\n\t\tclient: http.DefaultClient,\n\t\tBaseURL: strings.Trim(baseURL, \" /\"),\n\t\tcompanyName: companyName,\n\t\tuserName: userName,\n\t\tpassword: password,\n\t\tauthHeader: \"Basic \" + encodedAuth,\n\t}\n\n\t// Create services\n\tc.Accounts = &AccountService{client: c}\n\tc.Activities = &ActivityService{client: c}\n\tc.Campaigns = &CampaignService{client: c}\n\tc.Contacts = &ContactService{client: c}\n\tc.ContactFields = &ContactFieldService{client: c}\n\tc.ContactLists = &ContactListService{client: c}\n\tc.ContactSegments = &ContactSegmentService{client: c}\n\tc.ContentSections = &ContentSectionService{client: c}\n\tc.CustomObjects = &CustomObjectService{client: c}\n\tc.CustomObjectData = &CustomObjectDataService{client: c}\n\tc.Emails = &EmailService{client: c}\n\tc.EmailFolders = &EmailFolderService{client: c}\n\tc.EmailGroups = &EmailGroupService{client: c}\n\tc.EmailHeaders = &EmailHeaderService{client: c}\n\tc.EmailFooters = &EmailFooterService{client: c}\n\tc.ExternalActivity = &ExternalActivityService{client: c}\n\tc.ExternalAssets = &ExternalAssetService{client: c}\n\tc.ExternalAssetTypes = &ExternalAssetTypeService{client: c}\n\tc.Forms = &FormService{client: c}\n\tc.FormData = &FormDataService{client: c}\n\tc.Images = &ImageService{client: c}\n\tc.LandingPages = &LandingPageService{client: c}\n\tc.Microsites = &MicrositeService{client: c}\n\tc.OptionLists = &OptionListService{client: c}\n\tc.Users = &UserService{client: c}\n\tc.Visitors = &VisitorService{client: c}\n\n\treturn c\n}", "title": "" }, { "docid": "78310dc53f45588ac8d5e64334afa428", "score": "0.45439956", "text": "func NewClient(overridesLogger *logrus.Logger, maxHistory int, driver string, debug bool) *Client {\n\n\tlogFn := func(format string, v ...interface{}) {\n\t\tif debug {\n\t\t\tformat = fmt.Sprintf(\"[debug] %s\\n\", format)\n\t\t\tlog.Output(2, fmt.Sprintf(format, v...))\n\t\t}\n\t}\n\n\treturn &Client{\n\t\toverridesLogger: overridesLogger,\n\t\tmaxHistory: maxHistory,\n\t\tdriver: driver,\n\t\tlogFn: logFn,\n\t}\n}", "title": "" }, { "docid": "7d056f162b745d276daf07285a32878e", "score": "0.45347214", "text": "func ExampleReportsClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewReportsClient().NewListPager(&armappcomplianceautomation.ReportsClientListOptions{SkipToken: to.Ptr(\"1\"),\n\t\tTop: to.Ptr[int32](100),\n\t\tSelect: nil,\n\t\tOfferGUID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\tReportCreatorTenantID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t})\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.ReportResourceList = armappcomplianceautomation.ReportResourceList{\n\t\t// \tValue: []*armappcomplianceautomation.ReportResource{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"testReportName\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsfot.AppComplianceAutomation/reports\"),\n\t\t// \t\t\tID: to.Ptr(\"/provider/Microsfot.AppComplianceAutomation/reports/testReportName\"),\n\t\t// \t\t\tSystemData: &armappcomplianceautomation.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-05-14T22:34:55.4499903Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-05-14T22:34:55.4499903Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armappcomplianceautomation.ReportProperties{\n\t\t// \t\t\t\tComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{\n\t\t// \t\t\t\t\tM365: &armappcomplianceautomation.OverviewStatus{\n\t\t// \t\t\t\t\t\tFailedCount: to.Ptr[int32](0),\n\t\t// \t\t\t\t\t\tManualCount: to.Ptr[int32](0),\n\t\t// \t\t\t\t\t\tPassedCount: to.Ptr[int32](0),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\tLastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-02T05:17:23.922Z\"); return t}()),\n\t\t// \t\t\t\tNextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-02T05:17:23.922Z\"); return t}()),\n\t\t// \t\t\t\tOfferGUID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded),\n\t\t// \t\t\t\tReportName: to.Ptr(\"testReportName\"),\n\t\t// \t\t\t\tResources: []*armappcomplianceautomation.ResourceMetadata{\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tResourceID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService\"),\n\t\t// \t\t\t\t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\t\t\t\"key1\": to.Ptr(\"value1\"),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t}},\n\t\t// \t\t\t\tStatus: to.Ptr(armappcomplianceautomation.ReportStatusActive),\n\t\t// \t\t\t\tSubscriptions: []*string{\n\t\t// \t\t\t\t\tto.Ptr(\"00000000-0000-0000-0000-000000000000\")},\n\t\t// \t\t\t\t\tTenantID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\t\tTimeZone: to.Ptr(\"GMT Standard Time\"),\n\t\t// \t\t\t\t\tTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-02T05:17:23.922Z\"); return t}()),\n\t\t// \t\t\t\t},\n\t\t// \t\t}},\n\t\t// \t}\n\t}\n}", "title": "" }, { "docid": "b77f02d46cc19621c6e92dc641d45b50", "score": "0.45241573", "text": "func NewClient(protocol string, controllerHost string, port int, username string, password string, account string) (*Client, error) {\n\n\t// TODO: Let the consumer define the http.Client\n\ttimeout := time.Duration(60 * time.Second)\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\thttpClient := &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: tr,\n\t}\n\tbaseURL, err := url.Parse(fmt.Sprintf(\"%s://%s:%d/\", protocol, controllerHost, port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trestUserName := fmt.Sprintf(\"%s@%s\", username, account)\n\tcontroller := &Controller{\n\t\tProtocol: protocol,\n\t\tHost: controllerHost,\n\t\tPort: port,\n\t\tUser: restUserName,\n\t\tPassword: password,\n\t\tAccount: account,\n\t\tBaseURL: baseURL,\n\t}\n\n\tc := &Client{client: httpClient,\n\t\tController: controller,\n\t}\n\n\tbackend1 := logging.NewLogBackend(os.Stdout, \"\", 0)\n\tbackend1Formatter := logging.NewBackendFormatter(backend1, format)\n\tbackend1Leveled := logging.AddModuleLevel(backend1Formatter)\n\tbackend1Leveled.SetLevel(logging.WARNING, \"\")\n\n\tlogging.SetBackend(backend1Leveled)\n\n\t// TODO: Let the consumer define the logger\n\tc.log = log\n\tc.common.client = c\n\n\tc.Account = (*AccountService)(&c.common)\n\tc.Analytics = (*AnalyticsService)(&c.common)\n\tc.Application = (*ApplicationService)(&c.common)\n\tc.BusinessTransaction = (*BusinessTransactionService)(&c.common)\n\tc.MetricData = (*MetricDataService)(&c.common)\n\tc.Snapshot = (*SnapshotService)(&c.common)\n\tc.Tier = (*TierService)(&c.common)\n\tc.Dashboard = (*DashboardService)(&c.common)\n\tc.Node = (*NodeService)(&c.common)\n\tc.TimeRange = (*TimeRangeService)(&c.common)\n\tc.Configuration = (*Configuration)(&c.common)\n\n\tc.log.Debug(\"Created client successfully\")\n\treturn c, nil\n}", "title": "" }, { "docid": "21bff87e223d4bfa721096f004ccf4b4", "score": "0.44470415", "text": "func (r *ReportRepoImpl) DailyReports(ctx context.Context, startDate, endDate, ruleID string) (list []*DailyReport, err error) {\n\tvar rows *sql.Rows\n\n\tquery := `\n\tWITH range_date AS (\n\t\tSELECT generate_series($1::date, $2::date, '1 day') as date\n\t),\n\tcount_per_day AS (\n\t\tselect date(time), count(is_matched) from metrics_rule_matching\n\t\tWHERE is_matched = 1 AND (\n\t\t\tCASE WHEN $3 != '' THEN\n\t\t\t\trule_id = $3::int\n\t\t\tELSE true\n\t\t\tEND\n\t\t)\n\t\tGROUP BY date(time)\n\t)\n\tselect rd.date, coalesce(cpd.count, 0) as count from range_date rd\n\tleft join count_per_day cpd on rd.date = cpd.date\n\t`\n\n\tif rows, err = r.DB.Query(query, startDate, endDate, ruleID); err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tlist = make([]*DailyReport, 0)\n\tfor rows.Next() {\n\t\tvar report DailyReport\n\t\tif err = rows.Scan(&report.Date, &report.HitCount); err != nil {\n\t\t\treturn\n\t\t}\n\t\tlist = append(list, &report)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1657f69f319ff98cdb4ea5531d1fa5ea", "score": "0.44416183", "text": "func NewGetDedupeReportsDefault(code int) *GetDedupeReportsDefault {\n\treturn &GetDedupeReportsDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "2ce34f5524e1a3772a4a1274d2b930e8", "score": "0.43872175", "text": "func GetAPIMgmtLoggerClient(creds config.Credentials) (apim.LoggerClient, error) {\n\tclient := apim.NewLoggerClientWithBaseURI(config.BaseURI(), creds.SubscriptionID())\n\ta, err := iam.GetResourceManagementAuthorizer(creds)\n\tif err != nil {\n\t\tclient = apim.LoggerClient{}\n\t} else {\n\t\tclient.Authorizer = a\n\t\tclient.AddToUserAgent(config.UserAgent())\n\t}\n\treturn client, err\n}", "title": "" }, { "docid": "4645725cadd23180451b1cec73ea26be", "score": "0.43779683", "text": "func NewClient(check, report goa.Endpoint) *Client {\n\treturn &Client{\n\t\tCheckEndpoint: check,\n\t\tReportEndpoint: report,\n\t}\n}", "title": "" }, { "docid": "0d5de03230ef594162faa6b5eb71a657", "score": "0.43629205", "text": "func NewAuditLogs(sdl lgrpcpb.LoggingServiceV2Client, projectID, serviceName string) *AuditLogs {\n\treturn &AuditLogs{sdl: sdl, projectID: projectID, serviceName: serviceName}\n}", "title": "" }, { "docid": "27eafad6f2ec156de9ff9b17a42e1934", "score": "0.43394282", "text": "func NewFakeReportingClient() *FakeReportingClient {\n\tc := FakeReportingClient{}\n\tc.reporter = log.New(&c.reportBuffer, \"FAKE-REPORT\", log.LstdFlags)\n\n\treturn &c\n}", "title": "" }, { "docid": "9956ed507638c19716eca98372a7f86d", "score": "0.4337731", "text": "func NewLoggingClient(subID string, authorizer auth.Authorizer) (*client, error) {\n\tc, err := wssdclient.GetLogClient(&subID, authorizer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &client{c}, nil\n}", "title": "" }, { "docid": "cb8c8d3520aa7109cc0055f2c8fcf990", "score": "0.43350723", "text": "func NewClient(ctx context.Context, cli *containerd.Client, stateDir, ns string, b libcontainerdtypes.Backend) (libcontainerdtypes.Client, error) {\n\tc := &client{\n\t\tclient: cli,\n\t\tstateDir: stateDir,\n\t\tlogger: log.G(ctx).WithField(\"module\", \"libcontainerd\").WithField(\"namespace\", ns),\n\t\tns: ns,\n\t\tbackend: b,\n\t}\n\n\tgo c.processEventStream(ctx, ns)\n\n\treturn c, nil\n}", "title": "" }, { "docid": "008d8f537de2cd76a3299dc97348c80f", "score": "0.43266842", "text": "func NewLoggingClient(c Client) Client {\n\treturn &loggingClient{c, \"cockroachdb\"}\n}", "title": "" }, { "docid": "e80b37eb0482ad207f0fb674d2204e11", "score": "0.43240622", "text": "func (m *OrgContactItemRequestBuilder) DirectReports()(*ItemDirectReportsRequestBuilder) {\n return NewItemDirectReportsRequestBuilderInternal(m.pathParameters, m.requestAdapter)\n}", "title": "" }, { "docid": "4218f156cede30e913e3a45b78c8ddb3", "score": "0.43230596", "text": "func newDcrtimeClient(host, certPath string) (*dcrtimeClient, error) {\n\tc, err := util.NewHTTPClient(false, certPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &dcrtimeClient{\n\t\thost: host,\n\t\tcertPath: certPath,\n\t\thttp: c,\n\t}, nil\n}", "title": "" }, { "docid": "bc1f1f383ea73aca6ce63e8283e5b8d6", "score": "0.43218854", "text": "func NewCRDsClient(c *rest.Config) (*clientset.Clientset, error) {\n\treturn clientset.NewForConfig(c)\n}", "title": "" }, { "docid": "f52e5376f83e75262ee84081378948ba", "score": "0.43136844", "text": "func newRecordSetsClient(auth azure.Authorizer) *azureRecordsClient {\n\trecordsClient := privatedns.NewRecordSetsClientWithBaseURI(auth.BaseURI(), auth.SubscriptionID())\n\tazure.SetAutoRestClientDefaults(&recordsClient.Client, auth.Authorizer())\n\treturn &azureRecordsClient{\n\t\trecordsets: recordsClient,\n\t}\n}", "title": "" }, { "docid": "d3220288a0944e6caa9bdae84e3e9cef", "score": "0.42890397", "text": "func NewClient(ctx context.Context, hostPort string, opts ...Option) (*Client, error) {\n\tmo := &mfcOpts{\n\t\tinputTranslator: DefaultPathTranslator,\n\t\toutputTranslator: DefaultPathTranslator,\n\t}\n\tfor _, opt := range opts {\n\t\tif err := opt(mo); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"option error\")\n\t\t}\n\t}\n\tconn, err := grpc.DialContext(ctx, hostPort, mo.GRPCDialOptions()...)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"dial analytic\")\n\t}\n\tc := &Client{\n\t\tconn: conn,\n\t\thealth: healthpb.NewHealthClient(conn),\n\t\tanalytic: pb.NewAnalyticClient(conn),\n\t\tinputTranslator: mo.inputTranslator,\n\t\toutputTranslator: mo.outputTranslator,\n\t}\n\n\tif mo.requireHealthy {\n\t\tresp, err := c.Health(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"health check for creation\")\n\t\t}\n\t\tif resp.Status != healthpb.HealthCheckResponse_SERVING {\n\t\t\treturn nil, errors.Errorf(\"status SERVING required for client creation, but got %s\", resp.Status)\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "cce2f044697773a86434a811eb491fba", "score": "0.42581075", "text": "func New(c rest.Interface) *DatadoghqV1alpha1Client {\n\treturn &DatadoghqV1alpha1Client{c}\n}", "title": "" }, { "docid": "9d4c1703994489ce54742fa6f7b06e05", "score": "0.42438936", "text": "func NewClient() *Client {\n\tc := &Client{\n\t\tlogger: log.WithFields(log.Fields{\"package\": \"files\"}),\n\t}\n\n\tc.service.client = c\n\treturn c\n}", "title": "" }, { "docid": "6aaae8a15dabca245426c777c76ed4b1", "score": "0.4241486", "text": "func NewDaemonClient(endpoint string) *DaemonClient {\n\treturn &DaemonClient{NewCallClient(endpoint, \"\", \"\")}\n}", "title": "" }, { "docid": "e47b6f677dd9619d6536528ba2c8bd18", "score": "0.42335805", "text": "func NewClient(directoryURL string, options ...OptionFunc) (Client, error) {\n\t// Set a default http timeout of 60 seconds, this can be overridden\n\t// via an OptionFunc eg: acme.NewClient(url, WithHTTPTimeout(10 * time.Second))\n\thttpClient := &http.Client{\n\t\tTimeout: 60 * time.Second,\n\t}\n\n\tacmeClient := Client{\n\t\thttpClient: httpClient,\n\t\tnonces: &nonceStack{},\n\t\tretryCount: 5,\n\t}\n\n\tacmeClient.dir.URL = directoryURL\n\n\tfor _, opt := range options {\n\t\tif err := opt(&acmeClient); err != nil {\n\t\t\treturn acmeClient, fmt.Errorf(\"acme: error setting option: %v\", err)\n\t\t}\n\t}\n\n\tif _, err := acmeClient.get(directoryURL, &acmeClient.dir, http.StatusOK); err != nil {\n\t\treturn acmeClient, err\n\t}\n\n\treturn acmeClient, nil\n}", "title": "" }, { "docid": "2fc563156f65c2b248212b526a4d7530", "score": "0.42330393", "text": "func NewAccessLogger(logDir string, serviceName string, useScribe bool) *logs.Logger {\n\tfilename := filepath.Join(logDir, serviceName+\".access.log\")\n\tcategory := serviceName + \"_access\"\n\treturn newFrameLogger(filename, useScribe, category)\n}", "title": "" }, { "docid": "efe4fa5d8c050688d1e4df8b2905b31c", "score": "0.42251432", "text": "func NewClient() (dclient.APIClient, error) {\n\thost := DaemonHost()\n\thttpClient, err := NewHTTPClient(host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dclient.NewClient(host, api.DefaultVersion, httpClient, nil)\n}", "title": "" }, { "docid": "ca5631fe0b043fd04a518e7a0ec5f076", "score": "0.42169553", "text": "func (o *ListReportsRequest) WithHTTPClient(client *http.Client) *ListReportsRequest {\n\to.HTTPClient = client\n\treturn o\n}", "title": "" }, { "docid": "86f9fc30652654e3fa3e56c48841ff6a", "score": "0.4208888", "text": "func GetDirectorydClient() (protos.DirectoryServiceClient, error) {\n\tconn, err := cloud_registry.New().GetCloudConnection(ServiceName)\n\tif err != nil {\n\t\tinitErr := errors.NewInitError(err, ServiceName)\n\t\tglog.Error(initErr)\n\t\treturn nil, initErr\n\t}\n\treturn protos.NewDirectoryServiceClient(conn), nil\n}", "title": "" }, { "docid": "b22d46be467d24cbe9b4477bb8ecc707", "score": "0.41930062", "text": "func NewClient(ch *tchannel.Channel, monitor membership.Monitor, numberOfShards int) (Client, error) {\n\tsResolver, err := monitor.GetResolver(common.HistoryServiceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &clientImpl{\n\t\tconnection: ch,\n\t\tresolver: sResolver,\n\t\ttokenSerializer: common.NewJSONTaskTokenSerializer(),\n\t\tnumberOfShards: numberOfShards,\n\t\tthriftCache: make(map[string]h.TChanHistoryService),\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "861c7dcf75e6a502399ad19b1c5aac84", "score": "0.4185178", "text": "func (m *ManagedTenantsRequestBuilder) ManagedTenantAlertLogs()(*ManagedTenantsManagedTenantAlertLogsRequestBuilder) {\n return NewManagedTenantsManagedTenantAlertLogsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "45ac5ae39f73a2b2dfdcef6efbaca242", "score": "0.41833526", "text": "func NewReporter(cri client.RuntimeServiceClient) *Reporter {\n\treporter := &Reporter{\n\t\tcri: cri,\n\t}\n\n\treturn reporter\n}", "title": "" }, { "docid": "d7c2df9a7589b6cefd0c57f898374bca", "score": "0.4176003", "text": "func newDeploymentLogs(c *Client, namespace string) *deploymentLogs {\n\treturn &deploymentLogs{\n\t\tr: c,\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "9ac18e31d5e4d54b5a6525e3c0fd8235", "score": "0.4175113", "text": "func (c *ChartClientFactory) New(repoType, userAgent string) chartUtils.ChartClient {\n\treturn &ChartClient{}\n}", "title": "" }, { "docid": "d7f056c9e77fc82f9341d0eb403c154a", "score": "0.41548583", "text": "func NewClient(conf *Config, serviceID string) (*Client, error) {\n\tif serviceID == \"\" {\n\t\treturn nil, errors.New(\"service id must be set\")\n\t}\n\n\tif conf == nil {\n\t\tc := DefaultConfig()\n\t\tconf = &c\n\t}\n\n\tvar logger *zap.Logger\n\tvar loglevel zapcore.Level\n\tencoderCfg := zap.NewProductionEncoderConfig()\n\n\tswitch conf.LogLevel {\n\tcase \"info\":\n\t\tloglevel = zap.InfoLevel\n\tcase \"error\":\n\t\tloglevel = zap.ErrorLevel\n\tcase \"warn\":\n\t\tloglevel = zap.WarnLevel\n\tdefault:\n\t\tloglevel = zap.DebugLevel\n\t}\n\n\tswitch conf.Method {\n\tcase \"console\":\n\t\tencoderCfg.EncodeLevel = zapcore.CapitalLevelEncoder\n\t\tif conf.ConsoleColour == true {\n\t\t\tencoderCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder\n\t\t}\n\t\tencoderCfg.EncodeTime = stdTimeEncoder\n\n\t\tcore := zapcore.NewCore(zapcore.NewConsoleEncoder(encoderCfg), os.Stderr, loglevel)\n\t\tlogger = zap.New(core).WithOptions(zap.Fields(zap.String(\"service_id\", serviceID)))\n\n\tcase \"file\":\n\t\tif conf.Filename == \"\" {\n\t\t\treturn nil, errors.New(\"file logging can not log to an empty filename\")\n\t\t}\n\t\tif conf.FileMaxAge < 1 || conf.FileMaxBackup < 1 || conf.FileMaxSize < 1 {\n\t\t\treturn nil, errors.New(\"additional file options can not be 0 or less\")\n\t\t}\n\n\t\tencoderCfg.TimeKey = \"datetime\"\n\t\tencoderCfg.EncodeLevel = zapcore.CapitalLevelEncoder\n\t\tencoderCfg.EncodeTime = stdTimeEncoder\n\n\t\tw := zapcore.AddSync(&lumberjack.Logger{\n\t\t\tFilename: conf.Filename,\n\t\t\tMaxSize: conf.FileMaxSize,\n\t\t\tMaxBackups: conf.FileMaxBackup,\n\t\t\tMaxAge: conf.FileMaxAge,\n\t\t})\n\n\t\tcore := zapcore.NewCore(zapcore.NewConsoleEncoder(encoderCfg), w, loglevel)\n\t\tlogger = zap.New(core).WithOptions(zap.Fields(zap.String(\"service_id\", serviceID)))\n\n\tcase \"gelf\":\n\t\tif conf.GELFhost == \"\" {\n\t\t\treturn nil, errors.New(\"gelf logging can not log to an empty host\")\n\t\t}\n\t\tif conf.GELFport < 1 {\n\t\t\treturn nil, errors.New(\"gelf port can not be 0 or less\")\n\t\t}\n\t\tif conf.GELFmaxChunkSize < 1 {\n\t\t\treturn nil, errors.New(\"gelf chunk size can not be 0 or less\")\n\t\t}\n\t\tif conf.GELFappID == \"\" {\n\t\t\treturn nil, errors.New(\"gelf logging can not log with an empty appid\")\n\t\t}\n\n\t\tvar compression int\n\t\tswitch conf.GELFcompression {\n\t\tcase \"gzip\":\n\t\t\tcompression = gelf.CompressionGZip\n\t\tcase \"zlib\":\n\t\t\tcompression = gelf.CompressionZLib\n\t\tdefault:\n\t\t\tcompression = gelf.CompressionNone\n\t\t}\n\n\t\tencoderCfg.TimeKey = gelf.TimeKey\n\t\tencoderCfg.MessageKey = gelf.MessageKey\n\t\tencoderCfg.EncodeLevel = gelfLevelEncoder\n\t\tencoderCfg.EncodeName = gelfNameEncoder\n\n\t\tw := zapcore.AddSync(gelf.New(gelf.Config{\n\t\t\tHost: conf.GELFhost,\n\t\t\tPort: conf.GELFport,\n\t\t\tMaxChunkSize: conf.GELFmaxChunkSize,\n\t\t\tCompression: compression,\n\t\t}))\n\n\t\tcore := zapcore.NewCore(zapcore.NewJSONEncoder(encoderCfg), w, loglevel)\n\t\tlogger = zap.New(core).WithOptions(zap.Fields(\n\t\t\tzap.String(gelf.VersionTag, gelf.Version),\n\t\t\tzap.String(gelf.HostTag, conf.GELFappID),\n\t\t\tzap.String(\"service_id\", serviceID),\n\t\t))\n\n\tdefault:\n\t\treturn nil, errors.New(\"log method is not supported\")\n\t}\n\n\tif conf.StackTrace == true {\n\t\tvar stacktracelevel zapcore.Level\n\n\t\tswitch conf.StackTraceLevel {\n\t\tcase \"info\":\n\t\t\tstacktracelevel = zap.InfoLevel\n\t\tcase \"error\":\n\t\t\tstacktracelevel = zap.ErrorLevel\n\t\tcase \"warn\":\n\t\t\tstacktracelevel = zap.WarnLevel\n\t\tdefault:\n\t\t\tstacktracelevel = zap.DebugLevel\n\t\t}\n\n\t\tlogger = logger.WithOptions(zap.AddStacktrace(stacktracelevel))\n\t}\n\n\tclient := Client{logger, conf}\n\n\treturn &client, nil\n}", "title": "" }, { "docid": "dc20ce2d6a0fdf49aa8f6db3f3407e04", "score": "0.41519558", "text": "func (m *OrgContactItemRequestBuilder) DirectReportsById(id string)(*ItemDirectReportsDirectoryObjectItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"directoryObject%2Did\"] = id\n }\n return NewItemDirectReportsDirectoryObjectItemRequestBuilderInternal(urlTplParams, m.requestAdapter)\n}", "title": "" }, { "docid": "885ab06ed137b7a0902c4ee8879be367", "score": "0.4147682", "text": "func NewClient(deadlineRead, deadlineWrite, sleepDuration time.Duration, channelSize, bufferSize int) *Client {\n\treturn &Client{deadlineRead, deadlineWrite, sleepDuration, channelSize, bufferSize, nil, sync.WaitGroup{}}\n}", "title": "" }, { "docid": "5ace22cb08b8f0c5b591ac761265f822", "score": "0.41377825", "text": "func NewClient(url, user, password string, l logger) Client {\n\treturn Client{\n\t\turl,\n\t\tuser,\n\t\tpassword,\n\t\tl,\n\t}\n}", "title": "" }, { "docid": "51fbf1c988071a54b740cf75b361abf9", "score": "0.41363102", "text": "func NewReportServer(client activitycomm.ActivitySvcClient, repo storage.Repository) reportcomm.ReportSvcServer {\n\treturn &reportServer{\n\t\tactivityCli: client,\n\t\trepo: repo,\n\t}\n}", "title": "" }, { "docid": "2bffc27099d0ea6dba3de9c44ada8059", "score": "0.4132965", "text": "func NewClient(username, password string, baseURL *url.URL) JiraClient {\n\treturn JiraClient{\n\t\tusername: username,\n\t\tpassword: password,\n\t\tbaseURL: baseURL,\n\t\thttpClient: &http.Client{Timeout: 10 * time.Second},\n\t}\n}", "title": "" }, { "docid": "38d9b5669315e63b3f1806dfb2531886", "score": "0.41259712", "text": "func NewClient(addr string, opts ...ClientOption) (*Client, error) {\n\tclient := &Client{\n\t\ttags: make(map[string]string),\n\t\tpulseInterval: 5 * time.Second,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(client)\n\t}\n\n\tconn, err := grpc.Dial(addr, client.dialOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.ingressClient = loggregator_v2.NewIngressClient(conn)\n\n\treturn client, nil\n}", "title": "" }, { "docid": "05c5936dcfb9ca008c3c46d8e55215ae", "score": "0.4125713", "text": "func New(db database.Storer, cli *http.Client) *Clients {\n\tclients := &Clients{\n\t\tdb: db,\n\t\thttpClient: cli,\n\t\tclients: make(map[string]clientEntry), // user_id => clientEntry\n\t}\n\treturn clients\n}", "title": "" }, { "docid": "c8e03aa664a49d8090695964c05d3c15", "score": "0.41226864", "text": "func NewCollectorServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) CollectorServiceClient {\n\tbaseURL = strings.TrimRight(baseURL, \"/\")\n\treturn &collectorServiceClient{\n\t\trecord: connect_go.NewClient[v1.RecordRequest, v1.RecordResponse](\n\t\t\thttpClient,\n\t\t\tbaseURL+CollectorServiceRecordProcedure,\n\t\t\topts...,\n\t\t),\n\t\tsession: connect_go.NewClient[v1.SessionRequest, v1.SessionResponse](\n\t\t\thttpClient,\n\t\t\tbaseURL+CollectorServiceSessionProcedure,\n\t\t\topts...,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d51669bfbdc18ef337327c862b4d6290", "score": "0.4114671", "text": "func NewClient(store store.UserKeyMapper) *Client {\n\treturn &Client{Store: store, Jira: &Requester{}}\n}", "title": "" }, { "docid": "8f2b2406d4c9a84f821967367d1e2306", "score": "0.41142362", "text": "func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudWatchLogs {\n\tsvc := &CloudWatchLogs{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: ServiceName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-03-28\",\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"Logs_20140328\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\t// Run custom client initialization if present\n\tif initClient != nil {\n\t\tinitClient(svc.Client)\n\t}\n\n\treturn svc\n}", "title": "" }, { "docid": "2afdb3f9def0e2137f8794472edb3edc", "score": "0.41138026", "text": "func NewClient(baseURL string, bearerToken string, logger *logrus.Logger) Client {\n\treturn &defaultClient{baseURL, bearerToken, logger}\n}", "title": "" }, { "docid": "a1a59c1c66c8eaffc2b00206e75459b7", "score": "0.41119492", "text": "func NewClient(clientID shared.ClientID) baseclient.Client {\n\treturn &client{\n\t\tBaseClient: baseclient.NewClient(clientID),\n\t\tcommonPoolHistory: CommonPoolHistory{},\n\t\tresourceLevelHistory: ResourcesLevelHistory{},\n\t\topinionHist: OpinionHist{},\n\t\tpredictionHist: PredictionsHist{},\n\t\tforagingReturnsHist: ForagingReturnsHist{},\n\t\tgiftHist: GiftHist{},\n\t\tislandEmpathies: IslandEmpathies{},\n\t\tdisasterHistory: DisasterHistory{},\n\n\t\t//TODO: implement config to gather all changeable parameters in one place\n\t}\n}", "title": "" }, { "docid": "2e1fe17f2648490cd3f91f5872161f2a", "score": "0.41109014", "text": "func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient {\n\treturn NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID)\n}", "title": "" }, { "docid": "088f2ef5e7ebc4f40e48d913a5934aaa", "score": "0.4110387", "text": "func NewDirectorClient(oauthClient OauthClient, gqlClient GraphQLClient, log logrus.FieldLogger) *Client {\n\treturn &Client{\n\t\tgraphQLClient: gqlClient,\n\t\toauthClient: oauthClient,\n\t\tqueryProvider: queryProvider{},\n\t\ttoken: oauth.Token{},\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "c1892084f51dca3f6f975afbe7d49b92", "score": "0.4108725", "text": "func newClientAliases() *clientAliases {\n\tcas := &clientAliases{\n\t\talias2path: make(map[string]*aliasEntry),\n\t\tpath2alias: make(map[string]*aliasEntry),\n\t\tmutex: &sync.RWMutex{},\n\t}\n\treturn cas\n}", "title": "" }, { "docid": "2eecadf59f174fc68e36e78cf4157b02", "score": "0.41067836", "text": "func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (*grpc.ClientConn, error) {\n\tclient := warden.NewClient(cfg, opts...)\n\tvar AppID string = \"jim\"\n\t// 这里使用etcd scheme\n\tconn, err := client.Dial(context.Background(), \"etcd://default/\"+AppID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// 注意替换这里:\n\t// NewDemoClient方法是在\"api\"目录下代码生成的\n\t// 对应proto文件内自定义的service名字,请使用正确方法名替换\n\treturn conn, nil\n}", "title": "" }, { "docid": "3da5982600627c2d175fedbaa399b11a", "score": "0.41062504", "text": "func NewReport(t string, message string, user sdk.AccAddress) Report {\n\treturn Report{\n\t\tType: t,\n\t\tMessage: message,\n\t\tUser: user,\n\t}\n}", "title": "" }, { "docid": "53af4519f864c27d05cb5683a4475e09", "score": "0.40998256", "text": "func newClient(webhook string) *slackhook.Client {\n\tc := slackhook.New(webhook)\n\treturn c\n}", "title": "" }, { "docid": "e6861588a19076984b007d5e6ada20d7", "score": "0.40959054", "text": "func New(mgr manager.Manager, deps *Dependencies) (*Manager, error) {\n\treporter, err := newStatsReporter()\n\tif err != nil {\n\t\tlog.Error(err, \"StatsReporter could not start\")\n\t\treturn nil, err\n\t}\n\teventBroadcaster := record.NewBroadcaster()\n\tkubeClient := kubernetes.NewForConfigOrDie(mgr.GetConfig())\n\teventBroadcaster.StartRecordingToSink(&clientcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events(\"\")})\n\trecorder := eventBroadcaster.NewRecorder(\n\t\tscheme.Scheme,\n\t\tcorev1.EventSource{Component: \"gatekeeper-audit\"})\n\n\tam := &Manager{\n\t\topa: deps.Client,\n\t\tstopper: make(chan struct{}),\n\t\tstopped: make(chan struct{}),\n\t\tmgr: mgr,\n\t\treporter: reporter,\n\t\tprocessExcluder: deps.ProcessExcluder,\n\t\teventRecorder: recorder,\n\t\tgkNamespace: util.GetNamespace(),\n\t\tauditCache: deps.CacheLister,\n\t\texpansionSystem: deps.ExpansionSystem,\n\t\tpubsubSystem: deps.PubSubSystem,\n\t}\n\treturn am, nil\n}", "title": "" }, { "docid": "614e00d5b09078764885896f296d9570", "score": "0.40943554", "text": "func New() *AnalyticsClient {\n\tac := new(AnalyticsClient)\n\tac.client = new(http.Client)\n\tac.userIDs = make(map[string]string)\n\treturn ac\n}", "title": "" }, { "docid": "39815ae1ec0126c5d50c6245bc09dc30", "score": "0.4093704", "text": "func NewClient(httpClient *http.Client, baseURL string, tenant string, username string, password string, skipRealtimeClient bool) *Client {\n\tif httpClient == nil {\n\t\t// Default client ignores self signed certificates (to enable compatibility to the edge which uses self signed certs)\n\t\tdefaultTransport := http.DefaultTransport.(*http.Transport)\n\t\ttr := &http.Transport{\n\t\t\tProxy: defaultTransport.Proxy,\n\t\t\tDialContext: defaultTransport.DialContext,\n\t\t\tMaxIdleConns: defaultTransport.MaxIdleConns,\n\t\t\tIdleConnTimeout: defaultTransport.IdleConnTimeout,\n\t\t\tExpectContinueTimeout: defaultTransport.ExpectContinueTimeout,\n\t\t\tTLSHandshakeTimeout: defaultTransport.TLSHandshakeTimeout,\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t},\n\t\t}\n\n\t\thttpClient = &http.Client{\n\t\t\tTransport: tr,\n\t\t}\n\t}\n\n\tvar fmtURL string\n\tif !strings.HasSuffix(baseURL, \"/\") {\n\t\tfmtURL = baseURL + \"/\"\n\t} else {\n\t\tfmtURL = baseURL\n\t}\n\ttargetBaseURL, _ := url.Parse(fmtURL)\n\n\tvar realtimeClient *RealtimeClient\n\tif !skipRealtimeClient {\n\t\tLogger.Infof(\"Creating realtime client %s\", fmtURL)\n\t\trealtimeClient = NewRealtimeClient(fmtURL, nil, tenant, username, password)\n\t}\n\n\tuserAgent := defaultUserAgent\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: targetBaseURL,\n\t\tUserAgent: userAgent,\n\t\tRealtime: realtimeClient,\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tTenantName: tenant,\n\t\tUseTenantInUsername: true,\n\t}\n\tc.common.client = c\n\tc.Alarm = (*AlarmService)(&c.common)\n\tc.Audit = (*AuditService)(&c.common)\n\tc.DeviceCertificate = (*DeviceCertificateService)(&c.common)\n\tc.DeviceCredentials = (*DeviceCredentialsService)(&c.common)\n\tc.Measurement = (*MeasurementService)(&c.common)\n\tc.Operation = (*OperationService)(&c.common)\n\tc.Tenant = (*TenantService)(&c.common)\n\tc.Event = (*EventService)(&c.common)\n\tc.Inventory = (*InventoryService)(&c.common)\n\tc.Application = (*ApplicationService)(&c.common)\n\tc.Identity = (*IdentityService)(&c.common)\n\tc.Microservice = (*MicroserviceService)(&c.common)\n\tc.Notification2 = (*Notification2Service)(&c.common)\n\tc.Context = (*ContextService)(&c.common)\n\tc.Retention = (*RetentionRuleService)(&c.common)\n\tc.TenantOptions = (*TenantOptionsService)(&c.common)\n\tc.Software = (*InventorySoftwareService)(&c.common)\n\tc.Firmware = (*InventoryFirmwareService)(&c.common)\n\tc.User = (*UserService)(&c.common)\n\treturn c\n}", "title": "" }, { "docid": "790d61bb117cd2df34162fe2ecfedc45", "score": "0.4089554", "text": "func NewReportRepository(db *sql.DB) (report.Repository, error) {\n\t// fmt.Println(1)\n\tpdb, err := mysql.New(db)\n\tif err != nil {\n\t\tlogg.Error(err.Error())\n\t\treturn nil, err\n\t}\n\tdbx := sqlx.NewDb(db, \"mysql\")\n\t// fmt.Println(1)\n\tr := reportRepository{pdb, dbx}\n\t// fmt.Println(1)\n\treturn &r, nil\n}", "title": "" }, { "docid": "4389a127cb7745ac7c41145741bd89bf", "score": "0.4086958", "text": "func NewAccessLogBuilder() *accessLogBuilder { //nolint: revive // unexported-return\n\treturn &accessLogBuilder{}\n}", "title": "" }, { "docid": "7b62263bca6439eb3267190ac0abcfeb", "score": "0.40804365", "text": "func NewClient(indexURL string) (Repository, error) {\n\trsp, err := httpClient.Get(indexURL)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rsp.Body.Close()\n\n\tidx := &ServiceIndex{}\n\tif err = json.NewDecoder(rsp.Body).Decode(idx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources := map[ResourceType]string{}\n\tfor _, x := range idx.Resources {\n\t\tresources[x.Type] = x.ID\n\t}\n\n\treturn &client{resources}, nil\n}", "title": "" }, { "docid": "146e6ced5c111c318adaa82a8c6d8e5b", "score": "0.4079796", "text": "func NewLogger() Logger {\n\tl := logri.GetLogger(\"audit\")\n\treturn &logger{loggeri: l}\n}", "title": "" }, { "docid": "bbb0090b3c449778ae1bf43d73d477b4", "score": "0.4078963", "text": "func NewClient(cfg *rest.Config) (*rest.RESTClient, *runtime.Scheme, error) {\n\tscheme := runtime.NewScheme()\n\tif err := AddToScheme(scheme); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tconfig := *cfg\n\tconfig.GroupVersion = &schema.GroupVersion{Group: CRDGroupName, Version: CRDVersion}\n\tconfig.APIPath = \"/apis\"\n\tconfig.ContentType = runtime.ContentTypeJSON\n\tconfig.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}\n\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn client, scheme, nil\n}", "title": "" }, { "docid": "5ef524988c7cd6eaca79ca8cec613e84", "score": "0.40754917", "text": "func (gscanner) newClient(ctx context.Context) (*containeranalysis.Client, error) {\n\treturn containeranalysis.NewClient(ctx)\n}", "title": "" }, { "docid": "9cffc7f9bce1e9ebef637f7de30dcee6", "score": "0.4074533", "text": "func New(cli *thriftauth.AuthServiceClient, logger log.Logger) service.AuthService {\n\treturn &client{cli, logger}\n}", "title": "" }, { "docid": "3599f2c6cb215a91810ed121a931b954", "score": "0.40742373", "text": "func NewAttachedContainer(client dockeradapter.Client, opts types.ClientOptions, reportID string) *AttachedContainer {\n\n\thostname, _ := os.Hostname()\n\n\tattachedContainer := &AttachedContainer{\n\t\tstart: utils.GetTimestamp(),\n\t\tname: utils.GetRandomName(\"lumogon_\"),\n\t\tclient: client,\n\t\treportID: reportID,\n\t\tschedulerHostname: hostname,\n\t\tkeepHarvester: opts.KeepHarvesters,\n\t\tctx: context.Background(),\n\t}\n\n\treturn attachedContainer\n}", "title": "" }, { "docid": "e0382f5d186fe1603d2523969e8457a0", "score": "0.40627015", "text": "func New(c *client.Client) *Domain {\n\treturn &Domain{c}\n}", "title": "" }, { "docid": "4aef6fc662e5df0e77db5ccf917a13d8", "score": "0.40615103", "text": "func NewAudit(info AppInfo, logger Logger, next http.Handler) *Audit {\n\tbasePath := info.BasePath\n\tif basePath == \"\" {\n\t\tbasePath = \"/\"\n\t}\n\treturn &Audit{\n\t\tLogger: logger,\n\t\tbasePath: basePath,\n\t\tnext: next,\n\t\tinfo: info,\n\t}\n}", "title": "" }, { "docid": "52a25cc48a40cda06c8cd5b0a397b925", "score": "0.40507072", "text": "func NewDogStatsDClient(dogstatsdAddress string, namespace string, tags []string) (*statsd.Client, error) {\n\tclient, err := statsd.New(dogstatsdAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.Namespace = fmt.Sprintf(\"%s.\", namespace)\n\tclient.Tags = tags\n\n\tlog.WithFields(log.Fields{\"namespace\": namespace, \"tags\": tags}).Debug(\"configured dogstatsd client\")\n\n\treturn client, nil\n}", "title": "" }, { "docid": "295dc98fc19e4ec67943aee17c3d970f", "score": "0.40476158", "text": "func NewClient(log logging.Logger, config *rest.Config, namespace string) (Client, error) {\n\trg := newRESTClientGetter(config, namespace)\n\n\tactionConfig := new(action.Configuration)\n\t// Always store helm state in the same cluster/namespace where chart is deployed\n\tif err := actionConfig.Init(rg, namespace, helmDriverSecret, func(format string, v ...interface{}) {\n\t\tlog.Debug(fmt.Sprintf(format, v))\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpc := action.NewPull()\n\tif _, err := os.Stat(chartCache); os.IsNotExist(err) {\n\t\terr = os.Mkdir(chartCache, 0750)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpc.DestDir = chartCache\n\tpc.Settings = &cli.EnvSettings{}\n\n\tgc := action.NewGet(actionConfig)\n\n\tic := action.NewInstall(actionConfig)\n\tic.Namespace = namespace\n\tic.CreateNamespace = true\n\n\tuc := action.NewUpgrade(actionConfig)\n\tuic := action.NewUninstall(actionConfig)\n\n\trb := action.NewRollback(actionConfig)\n\n\treturn &client{\n\t\tlog: log,\n\t\tpullClient: pc,\n\t\tgetClient: gc,\n\t\tinstallClient: ic,\n\t\tupgradeClient: uc,\n\t\trollbackClient: rb,\n\t\tuninstallClient: uic,\n\t}, nil\n}", "title": "" }, { "docid": "d58f4be29b3665539e2229253988db01", "score": "0.4047358", "text": "func (c *Connection) ServiceLogs() *servicelogs.Client {\n\treturn servicelogs.NewClient(c, \"/api/service_logs\", \"/api/service_logs\")\n}", "title": "" }, { "docid": "9734a39122b2239338b1fb8b94c727b4", "score": "0.40470117", "text": "func NewAuditClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client AuditClient, err error) {\n\tbaseClient, err := common.NewClientWithConfig(configProvider)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tclient = AuditClient{BaseClient: baseClient}\n\tclient.BasePath = \"20160918\"\n\terr = client.setConfigurationProvider(configProvider)\n\treturn\n}", "title": "" }, { "docid": "be84f425e915db608a9359bc53c5b88a", "score": "0.40410993", "text": "func NewClient(httpClient HTTPClient, tenantID TenantID) *Client {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tbaseURL, _ := url.Parse(baseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, TenantID: tenantID}\n\tc.common.client = c\n\n\t// Available Xero API resources\n\tc.Invoices = (*InvoicesService)(&c.common)\n\tc.Accounts = (*AccountsService)(&c.common)\n\n\treturn c\n}", "title": "" }, { "docid": "6fa4afe786789f7c5970e47e94e7e148", "score": "0.40391716", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Reports = NewReportsService(s)\n\ts.UserActivity = NewUserActivityService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "8d9e2126c8f8b03f4ac1a1209d39ff27", "score": "0.4038385", "text": "func NewClient(httpClient *http.Client) *Client {\n\trestClient := api.NewClient(httpClient)\n\n\tc := &Client{client: restClient}\n\n\t// Services setup\n\tc.HRM = hrm.NewHRMService(c.client)\n\tc.VAT = vat.NewVATService(c.client)\n\tc.Webhooks = webhooks.NewWebhooksService(c.client)\n\tc.Activities = activities.NewActivitiesService(c.client)\n\tc.Documents = documents.NewDocumentsService(c.client)\n\tc.Payroll = payroll.NewPayrollService(c.client)\n\tc.Bulk = bulk.NewBulkService(c.client)\n\tc.FinancialTransaction = financialtransaction.NewFinancialTransactionService(c.client)\n\tc.GeneralJournalEntry = generaljournalentry.NewGeneralJournalEntryService(c.client)\n\tc.Manufacturing = manufacturing.NewManufacturingService(c.client)\n\tc.Workflow = workflow.NewWorkflowService(c.client)\n\tc.ContinuousMonitoring = continuousmonitoring.NewContinuousMonitoringService(c.client)\n\tc.Financial = financial.NewFinancialService(c.client)\n\tc.OpeningBalance = openingbalance.NewOpeningBalanceService(c.client)\n\tc.Project = project.NewProjectService(c.client)\n\tc.PurchaseEntry = purchaseentry.NewPurchaseEntryService(c.client)\n\tc.PurchaseOrder = purchaseorder.NewPurchaseOrderService(c.client)\n\tc.Subscription = subscription.NewSubscriptionService(c.client)\n\tc.Cashflow = cashflow.NewCashflowService(c.client)\n\tc.Mailbox = mailbox.NewMailboxService(c.client)\n\tc.Purchase = purchase.NewPurchaseService(c.client)\n\tc.Sales = sales.NewSalesService(c.client)\n\tc.System = system.NewSystemService(c.client)\n\tc.CRM = crm.NewCRMService(c.client)\n\tc.Logistics = logistics.NewLogisticsService(c.client)\n\tc.General = general.NewGeneralService(c.client)\n\tc.SalesInvoice = salesinvoice.NewSalesInvoiceService(c.client)\n\tc.SalesOrder = salesorder.NewSalesOrderService(c.client)\n\tc.Users = users.NewUsersService(c.client)\n\tc.Inventory = inventory.NewInventoryService(c.client)\n\tc.SalesEntry = salesentry.NewSalesEntryService(c.client)\n\tc.Budget = budget.NewBudgetService(c.client)\n\tc.Accountancy = accountancy.NewAccountancyService(c.client)\n\tc.Assets = assets.NewAssetsService(c.client)\n\n\treturn c\n}", "title": "" }, { "docid": "29af942149ff342451b086b0117dbefb", "score": "0.40345165", "text": "func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (DemoClient, error) {\n\tclient := warden.NewClient(cfg, opts...)\n\tclient = client.Use(grpc.UnaryClientInterceptor(jaegerGrpcClientInterceptor))\n\tcc, err := client.Dial(context.Background(), fmt.Sprintf(\"direct://default/%s\", AppID))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewDemoClient(cc), nil\n}", "title": "" }, { "docid": "3b3f96c118df701206604cdc2ad8a060", "score": "0.4033031", "text": "func (o *ListReportsParams) WithHTTPClient(client *http.Client) *ListReportsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "64779efa86a67806afbeab496652e984", "score": "0.40226352", "text": "func NewDraftoJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Drafto {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(clientOpts.PathPrefix(), \"patrickwhite256.drafto\", \"Drafto\")\n\turls := [6]string{\n\t\tserviceURL + \"NewDraft\",\n\t\tserviceURL + \"GetSeat\",\n\t\tserviceURL + \"MakeSelection\",\n\t\tserviceURL + \"GetDraftStatus\",\n\t\tserviceURL + \"TakeSeat\",\n\t\tserviceURL + \"GetCurrentUser\",\n\t}\n\n\treturn &draftoJSONClient{\n\t\tclient: client,\n\t\turls: urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts: clientOpts,\n\t}\n}", "title": "" }, { "docid": "ff4246f1e8ecff37f936b4c3119ce0a4", "score": "0.40134966", "text": "func NewClient(httpClient *http.Client, baseURL string) (client *Client) {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tuserBaseURL, _ := url.Parse(baseURL)\n\tclient = &Client{httpClient: httpClient, BaseURL: userBaseURL, UserAgent: defaultUserAgent}\n\n\tclient.AccountService = &AccountService{client}\n\n\treturn client\n}", "title": "" }, { "docid": "70a9bf04d6ad879aba6572cf2650c9f7", "score": "0.40124777", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.GroupItems = NewGroupItemsService(s)\n\ts.Groups = NewGroupsService(s)\n\ts.Reports = NewReportsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "2bc2411a113845fd4845d7a53f2ba82f", "score": "0.40113172", "text": "func NewClient(httpClient *http.Client, dataloopOrg, dataloopRestApiKey string) *Client {\n\n\tbase := sling.New().Client(httpClient).Base(DataloopAPI + \"/orgs/\" + dataloopOrg + \"/\").Set(\"Authorization\", \"Bearer \" + dataloopRestApiKey).Set(\"content-type\", \"multipart/form-data\").Set(\"boundary\", \"---011000010111000001101001\")\n\n\treturn &Client{\n\t\tAccounts: NewAccountService(base.New()),\n\t}\n}", "title": "" }, { "docid": "85ef26d4ad85a656d1f5990307ff02c3", "score": "0.40072715", "text": "func New(cli *thriftcontact.ContactServiceClient, logger log.Logger) service.ContactService {\n\treturn &client{cli, logger}\n}", "title": "" }, { "docid": "493774f758319a8339d26e8bf2c56ad1", "score": "0.40029457", "text": "func NewClient(d Doer) (*Client, error) {\n\treturn &Client{d}, nil\n}", "title": "" }, { "docid": "4544ecec31dbe212c6a32e940d43721c", "score": "0.400271", "text": "func NewAdministratorClient(c config) *AdministratorClient {\n\treturn &AdministratorClient{config: c}\n}", "title": "" }, { "docid": "caeabadde0ab81dcad25fa4c662a2f6c", "score": "0.40007788", "text": "func NewDiagnosticsPackagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticsPackagesClient, error) {\n\tcl, err := arm.NewClient(moduleName+\".DiagnosticsPackagesClient\", moduleVersion, credential, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &DiagnosticsPackagesClient{\n\t\tsubscriptionID: subscriptionID,\n\t\tinternal: cl,\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "bb2c0b560b1a073d73d8ac74567dcb8d", "score": "0.39931694", "text": "func newAccessLogsManager() Manager {\n\treturn accessLogsManager{}\n}", "title": "" }, { "docid": "c18cb519694a90a5ef03fe0ada0da41c", "score": "0.39906287", "text": "func NewGroupPolicyMigrationReport()(*GroupPolicyMigrationReport) {\n m := &GroupPolicyMigrationReport{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "21bebfc8591559db240066247e98cd35", "score": "0.39863148", "text": "func MealEntryReportsGet(response http.ResponseWriter, request *http.Request) {\n\treports, err := repo.MealEntriesAggregateReports(context.TODO())\n\tif err != nil {\n\t\thttpError := util.NewStatus(http.StatusInternalServerError, err.Error())\n\t\tutil.Response(response, struct{}{}, httpError)\n\t\treturn\n\t}\n\tutil.Response(response, reports, util.NewStatus(http.StatusOK, \"\"))\n}", "title": "" }, { "docid": "dcaec4957330622591f693506ff4e160", "score": "0.3983887", "text": "func NewAlertDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertDefinitionsClient, error) {\n\tcl, err := arm.NewClient(moduleName+\".AlertDefinitionsClient\", moduleVersion, credential, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &AlertDefinitionsClient{\n\t\tinternal: cl,\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "791e72c961bc37f1d80c5584e0ec4aa9", "score": "0.39836097", "text": "func NewClient(config Config) Client {\n\treturn &client{\n\t\tinfluxdb2.NewClient(config.Address, config.Token),\n\t\tconfig,\n\t}\n}", "title": "" }, { "docid": "28e5ae0d0b9fdf9b4ac5217c2d3307be", "score": "0.39835984", "text": "func (o *GetJobReportsParams) WithHTTPClient(client *http.Client) *GetJobReportsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" } ]
f7d402dfdb136badf3fb834822a2b0e2
HasCik returns a boolean if a field has been set.
[ { "docid": "0bea243d5ac9b8985c47bb0385b9beb4", "score": "0.7381559", "text": "func (o *FinancialsAsReported) HasCik() bool {\n\tif o != nil && o.Cik != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "b6a734b16277a44c08818e0fbf1c4998", "score": "0.63427013", "text": "func (o *CustconfAuthUrlSignAliCloudC) HasExpireField() bool {\n\tif o != nil && o.ExpireField != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6e05eed50659a35a230d263b166e4305", "score": "0.62626135", "text": "func (cf *CustomFields) Has(key string) bool {\n\treturn cf.TypeOf(key) != CFNoneType\n}", "title": "" }, { "docid": "f084c7047922b5319c31986d1f122402", "score": "0.60497105", "text": "func HasField(j JSONToken, path string) (bool, error) {\n\tobj, err := GetField(j, path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn obj != nil, err\n}", "title": "" }, { "docid": "6d68a3793b6f688e75b1e2457fb878f1", "score": "0.60458666", "text": "func (o *CompanyProfile) HasCusip() bool {\n\tif o != nil && o.Cusip != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "37a41b57884fe8b6ea58bd0998cab3bd", "score": "0.5958503", "text": "func (x *fastReflection_C) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"testpb.C.id\":\n\t\treturn x.Id != uint64(0)\n\tcase \"testpb.C.x\":\n\t\treturn x.X != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.C\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.C does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "e8fff942e31aec1709bf3c435996ba3c", "score": "0.5950907", "text": "func (self Object) HasField(field string) bool {\n\t_, ok := self[field]\n\treturn ok\n}", "title": "" }, { "docid": "5458b9797c002e9d03944e6f3c21e6e6", "score": "0.58884287", "text": "func (d Document) HasField(field string) bool {\n\treturn d.hasField(field, true)\n}", "title": "" }, { "docid": "13819b768e305126619d0facf1ba3839", "score": "0.5888163", "text": "func (o *Fechadura) HasRefCompartimento() bool {\n\tif o != nil && o.RefCompartimento.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dc40c86e8d297c36ffc86fdf01d57f34", "score": "0.5886313", "text": "func (t *InterfaceType) HasField(name string) bool {\n\treturn t.fields[name] != nil\n}", "title": "" }, { "docid": "ec877388ea266ad9adb7b6eff181d5a2", "score": "0.5882358", "text": "func (sd SolrSearchDocument) HasField(fieldName string) bool {\n\tif _, ok := sd[fieldName]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e72f7e0a8677bb57988e9c5a4f264f04", "score": "0.5812455", "text": "func (x *fastReflection_ProjectInfo) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.ProjectInfo.id\":\n\t\treturn x.Id != \"\"\n\tcase \"regen.ecocredit.v1.ProjectInfo.admin\":\n\t\treturn x.Admin != \"\"\n\tcase \"regen.ecocredit.v1.ProjectInfo.class_id\":\n\t\treturn x.ClassId != \"\"\n\tcase \"regen.ecocredit.v1.ProjectInfo.jurisdiction\":\n\t\treturn x.Jurisdiction != \"\"\n\tcase \"regen.ecocredit.v1.ProjectInfo.metadata\":\n\t\treturn x.Metadata != \"\"\n\tcase \"regen.ecocredit.v1.ProjectInfo.reference_id\":\n\t\treturn x.ReferenceId != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.ProjectInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.ProjectInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "027d82d6824bb57f7f7336398ccb276e", "score": "0.5804839", "text": "func (o *Fechadura) HasCompartimento() bool {\n\tif o != nil && o.Compartimento != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cb558ab406b7c464545db44dfc52da99", "score": "0.5804201", "text": "func (t Transaction) HasField(name string) bool {\n\tfor _, f := range t.Fields {\n\t\tif f.Name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b5ae7cab065cd3e5562d2b41ea69a382", "score": "0.5792739", "text": "func (cf clientFlag) isSet(c clientFlag) bool {\n\treturn cf&c != 0\n}", "title": "" }, { "docid": "b631155ad024408d3458b6c2c69d62c1", "score": "0.5791557", "text": "func (o *MutualFundHoldingsData) HasCusip() bool {\n\tif o != nil && o.Cusip != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "625c8450e5b575a84c73dfc02c62881f", "score": "0.57739633", "text": "func (o *Fechadura) HasCanal() bool {\n\tif o != nil && o.Canal.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3df2635c0b1e9a5bee3052129a0e2f76", "score": "0.57469755", "text": "func (field Field) Exists() bool {\n\treturn field.Name != \"\"\n}", "title": "" }, { "docid": "69f4c3d104193b8016303fb2f47c466f", "score": "0.574027", "text": "func (x *fastReflection_CreditType) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.CreditType.name\":\n\t\treturn x.Name != \"\"\n\tcase \"regen.ecocredit.v1alpha1.CreditType.abbreviation\":\n\t\treturn x.Abbreviation != \"\"\n\tcase \"regen.ecocredit.v1alpha1.CreditType.unit\":\n\t\treturn x.Unit != \"\"\n\tcase \"regen.ecocredit.v1alpha1.CreditType.precision\":\n\t\treturn x.Precision != uint32(0)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.CreditType\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.CreditType does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "7496320284386c426ac4e65ca8418721", "score": "0.57308465", "text": "func (o *CustomProfileField) HasFieldData() bool {\n\tif o != nil && o.FieldData != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "52c043b850b71f4960c702f8235897f5", "score": "0.57163817", "text": "func (f *Form) Has(field string) bool {\n\tx := f.Get(field)\n\tif x == \"\" {\n\t\tf.Errors.Add(field, \"This field is mandatory\")\n\t\tfmt.Println(field, \" is mandatory\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "dd16a43e0832693e07c5b9fcb7704485", "score": "0.5703064", "text": "func (o *DeletedBlacklistRuleResponse) HasField() bool {\n\tif o != nil && !IsNil(o.Field) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aa419778c6f76ab6fdb391f34bfde813", "score": "0.5699932", "text": "func (o *ErrorObject) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3beb745aa868e770a90493e3054807fa", "score": "0.56972474", "text": "func Has(msg proto.Message, fld string) bool {\n\tval := extractVal(msg)\n\treturn val.IsValid() &&\n\t\tval.FieldByName(fld).IsValid()\n}", "title": "" }, { "docid": "2638579a0db26501a9628bbde1ddc87e", "score": "0.569094", "text": "func (x *fastReflection_ClassInfo) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.ClassInfo.id\":\n\t\treturn x.Id != \"\"\n\tcase \"regen.ecocredit.v1.ClassInfo.admin\":\n\t\treturn x.Admin != \"\"\n\tcase \"regen.ecocredit.v1.ClassInfo.metadata\":\n\t\treturn x.Metadata != \"\"\n\tcase \"regen.ecocredit.v1.ClassInfo.credit_type_abbrev\":\n\t\treturn x.CreditTypeAbbrev != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.ClassInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.ClassInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "8150712bdc9b5464d55a49e883fd4343", "score": "0.5679366", "text": "func (f CallFlag) Has(cf CallFlag) bool {\n\treturn f&cf == cf\n}", "title": "" }, { "docid": "1038c82e371e37ad6641990e6ed60065", "score": "0.5672602", "text": "func (o *ProcessGroupMetadata) HasCloudfoundryMetadata() bool {\n\tif o != nil && o.CloudfoundryMetadata != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d21f1377535ff6cb9b87175d823d8981", "score": "0.56650984", "text": "func (x *fastReflection_QueryProjectsByClassRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsByClassRequest.class_id\":\n\t\treturn x.ClassId != \"\"\n\tcase \"regen.ecocredit.v1.QueryProjectsByClassRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsByClassRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsByClassRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b388554604ac2717ee0415934407f177", "score": "0.56606305", "text": "func (x *fastReflection_ClassInfo) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.ClassInfo.class_id\":\n\t\treturn x.ClassId != \"\"\n\tcase \"regen.ecocredit.v1alpha1.ClassInfo.admin\":\n\t\treturn x.Admin != \"\"\n\tcase \"regen.ecocredit.v1alpha1.ClassInfo.issuers\":\n\t\treturn len(x.Issuers) != 0\n\tcase \"regen.ecocredit.v1alpha1.ClassInfo.metadata\":\n\t\treturn len(x.Metadata) != 0\n\tcase \"regen.ecocredit.v1alpha1.ClassInfo.credit_type\":\n\t\treturn x.CreditType != nil\n\tcase \"regen.ecocredit.v1alpha1.ClassInfo.num_batches\":\n\t\treturn x.NumBatches != uint64(0)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.ClassInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.ClassInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "e1fbbee9a3296829d213002654699a7a", "score": "0.5643423", "text": "func (c *Config) Has(prop string) bool {\n\tif c == nil || prop == \"\" {\n\t\treturn false\n\t}\n\n\t_, ok := c.Data[prop]\n\n\treturn ok\n}", "title": "" }, { "docid": "34f3658c4d66d751702fa2d85c3d7723", "score": "0.56219375", "text": "func (x *fastReflection_QueryProjectRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectRequest.project_id\":\n\t\treturn x.ProjectId != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "99dde14bfc3828800acbecac80b9c848", "score": "0.5619547", "text": "func (c *cloud) HasClusterID() bool {\n\tklog.V(5).Info(\"called HasClusterID\")\n\treturn false\n}", "title": "" }, { "docid": "8582ac2e92288da1a25484d96152611e", "score": "0.56190413", "text": "func Has(c CacheInterface) (bool, error) {\n\treturn c.Has()\n}", "title": "" }, { "docid": "d2647e25eb3f80dce9b253a2918485be", "score": "0.5617671", "text": "func (f ImplementationRevisionQueryFields) Has(flag ImplementationRevisionQueryFields) bool {\n\treturn f&flag != 0\n}", "title": "" }, { "docid": "005a32897911d451d32986d7e6da808d", "score": "0.56171227", "text": "func (f TypeInstancesQueryFields) Has(flag TypeInstancesQueryFields) bool { return f&flag != 0 }", "title": "" }, { "docid": "bf41789207422056c442f182fdd3f271", "score": "0.5616331", "text": "func (f *Field) isComputedField() bool {\n\treturn f.compute != \"\"\n}", "title": "" }, { "docid": "7169b70356e847a3167a2a2fc56f0ed2", "score": "0.5613934", "text": "func (x *fastReflection_QueryProjectsRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "c9a51c5156d80aa59545c305eff56ea0", "score": "0.5607989", "text": "func (d FormData) HasField(key string) bool {\n\t_, found := d.Form[key]\n\treturn found\n}", "title": "" }, { "docid": "898a611e9b9c505ef3a9f50bba03cf47", "score": "0.56045115", "text": "func (o *CustconfAuthUrlSignAliCloudC) HasTokenField() bool {\n\tif o != nil && o.TokenField != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "17fb532408258c89d02e47b273728f3b", "score": "0.5600876", "text": "func (x *fastReflection_QueryConstitutionResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.QueryConstitutionResponse.constitution\":\n\t\treturn x.Constitution != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.QueryConstitutionResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.QueryConstitutionResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "4054769850e3c0c22d875161ac36a46b", "score": "0.5599722", "text": "func (g *Generator) genHas(c *fieldNames) {\n\tg.P(`func (m *`, c.typeName, `) Has`, CamelCase(c.fieldName), `() (isSet bool) {`)\n\tg.In()\n\tg.P(`if m != nil && m.`, SetterName(c.fieldName), ` {`)\n\tg.In()\n\tg.P(`return true`)\n\tg.Out()\n\tg.P(`}`)\n\tg.P(`return false`)\n\tg.Out()\n\tg.P(`}`)\n\tg.P()\n}", "title": "" }, { "docid": "9f0d43ee840357567a00eab83a58c51f", "score": "0.5595381", "text": "func (o *CityMetric) HasCountry() bool {\n\tif o != nil && o.Country != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e6fd8030abf45009012fc23bb905aaf1", "score": "0.5594988", "text": "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := f.Get(field)\n\tif x == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a53a65721050aef68e2705bb6911413f", "score": "0.5587497", "text": "func (o *BackupOperationRequest) HasDc() bool {\n\tif o != nil && o.Dc != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a1b781d0425a0f66336ff259cff4815e", "score": "0.5587011", "text": "func (x *fastReflection_QueryProjectsResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsResponse.projects\":\n\t\treturn len(x.Projects) != 0\n\tcase \"regen.ecocredit.v1.QueryProjectsResponse.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "5ded4d040e532ba2818d95a8e82b6a82", "score": "0.55826753", "text": "func (x *fastReflection_Config) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.app.v1alpha1.Config.modules\":\n\t\treturn len(x.Modules) != 0\n\tcase \"cosmos.app.v1alpha1.Config.golang_bindings\":\n\t\treturn len(x.GolangBindings) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.app.v1alpha1.Config\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.app.v1alpha1.Config does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "34bb27c23f71e122cdf2e316c977562e", "score": "0.5570053", "text": "func (x *fastReflection_QueryProjectsByClassResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsByClassResponse.projects\":\n\t\treturn len(x.Projects) != 0\n\tcase \"regen.ecocredit.v1.QueryProjectsByClassResponse.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsByClassResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsByClassResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "7ed8e7493a7f3bfa5473a7125fd7beb4", "score": "0.55597854", "text": "func (g *GraphApmOrLogQueryCompute) HasFacet() bool {\n\tif g != nil && g.Facet != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "113767a41a618e445b148b98814f49f3", "score": "0.55532897", "text": "func (o *LicenseIncLicenseCount) HasPremier100GfxCount() bool {\n\tif o != nil && o.Premier100GfxCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b2f407ab2db6c5c3fe8728a21005ae8c", "score": "0.5544109", "text": "func (o *UserGroupDTO) HasConfigurable() bool {\n\tif o != nil && o.Configurable != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a7c11b7a46ed6352a382a08164f594d2", "score": "0.55438244", "text": "func (x *fastReflection_QueryProjectsByReferenceIdRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsByReferenceIdRequest.reference_id\":\n\t\treturn x.ReferenceId != \"\"\n\tcase \"regen.ecocredit.v1.QueryProjectsByReferenceIdRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsByReferenceIdRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsByReferenceIdRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b7175bb30e3046c46f9d28109c595e86", "score": "0.5539519", "text": "func (o *PeoplePersonOfPeople) HasIsClockedIn() bool {\n\tif o != nil && o.IsClockedIn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b88cd1284cfe1035dbba6c781b223414", "score": "0.5532842", "text": "func Has(key string) bool {\n\treturn def.Has(key)\n}", "title": "" }, { "docid": "dbadc07c7e91b3630fcbe67a8fb1beb8", "score": "0.55299264", "text": "func (x *fastReflection_MsgCreateProject) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.MsgCreateProject.admin\":\n\t\treturn x.Admin != \"\"\n\tcase \"regen.ecocredit.v1.MsgCreateProject.class_id\":\n\t\treturn x.ClassId != \"\"\n\tcase \"regen.ecocredit.v1.MsgCreateProject.metadata\":\n\t\treturn x.Metadata != \"\"\n\tcase \"regen.ecocredit.v1.MsgCreateProject.jurisdiction\":\n\t\treturn x.Jurisdiction != \"\"\n\tcase \"regen.ecocredit.v1.MsgCreateProject.reference_id\":\n\t\treturn x.ReferenceId != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.MsgCreateProject\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.MsgCreateProject does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "cf599441dc5e4a3a845fd675096f2436", "score": "0.55274457", "text": "func (o *AccountStore) HasBic() bool {\n\tif o != nil && o.Bic.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1566a9c689d9d792781ce94c256a9310", "score": "0.5511276", "text": "func (cp *Provider) HasClusterID() bool {\n\treturn true\n}", "title": "" }, { "docid": "9b5c20b710a056de38754372c814514c", "score": "0.55075175", "text": "func (o *CompanyProfile) HasGsector() bool {\n\tif o != nil && o.Gsector != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c6c9c817f4bda3c21ea4b8bc720a8b89", "score": "0.55060565", "text": "func (x *fastReflection_QueryProjectResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectResponse.project\":\n\t\treturn x.Project != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b295c00dd913111bc83d27cf38144170", "score": "0.5505747", "text": "func (o *Account) HasBic() bool {\n\tif o != nil && o.Bic.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "03d1d0c783d161a8461019dec734f346", "score": "0.5502782", "text": "func (x *fastReflection_MsgBridgeReceive_Project) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.MsgBridgeReceive.Project.reference_id\":\n\t\treturn x.ReferenceId != \"\"\n\tcase \"regen.ecocredit.v1.MsgBridgeReceive.Project.jurisdiction\":\n\t\treturn x.Jurisdiction != \"\"\n\tcase \"regen.ecocredit.v1.MsgBridgeReceive.Project.metadata\":\n\t\treturn x.Metadata != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.MsgBridgeReceive.Project\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.MsgBridgeReceive.Project does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "ca6c8be60080eb4ec62c8f37e081adf3", "score": "0.55000436", "text": "func (x *fastReflection_MsgUpdateProjectMetadata) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.MsgUpdateProjectMetadata.admin\":\n\t\treturn x.Admin != \"\"\n\tcase \"regen.ecocredit.v1.MsgUpdateProjectMetadata.project_id\":\n\t\treturn x.ProjectId != \"\"\n\tcase \"regen.ecocredit.v1.MsgUpdateProjectMetadata.new_metadata\":\n\t\treturn x.NewMetadata != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.MsgUpdateProjectMetadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.MsgUpdateProjectMetadata does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "c7a17f439abb72ac9f8c402aae2cd056", "score": "0.54983246", "text": "func (o *SyntheticsAPIStep) HasIsCritical() bool {\n\tif o != nil && o.IsCritical != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e9124e6d25f7405e23efe6f153efa35f", "score": "0.54943544", "text": "func (rc *BaseContributors) Has(pushKeyID string) bool {\n\t_, ok := (*rc)[pushKeyID]\n\treturn ok\n}", "title": "" }, { "docid": "5bbaa2aa054ccdc3992d0ac42c252e63", "score": "0.54924005", "text": "func (o *Disk) HasProject() bool {\n\tif o != nil && o.Project != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0e92289c7dd1fb00288e4b3fbfeccaf8", "score": "0.54895616", "text": "func (c *cloud) HasClusterID() bool {\n\treturn false\n}", "title": "" }, { "docid": "6bea3655b22a9ee10367ac06759a6b3f", "score": "0.5485608", "text": "func (a *ApmOrLogQueryCompute) HasFacet() bool {\n\tif a != nil && a.Facet != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "334fbc1ed7370207fabf9486e099b47c", "score": "0.54800457", "text": "func (t *TileDefApmOrLogQueryCompute) HasFacet() bool {\n\tif t != nil && t.Facet != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b0322eb918886f27569646beee1a115a", "score": "0.54750663", "text": "func (x *fastReflection_QueryBatchesByProjectRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryBatchesByProjectRequest.project_id\":\n\t\treturn x.ProjectId != \"\"\n\tcase \"regen.ecocredit.v1.QueryBatchesByProjectRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryBatchesByProjectRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryBatchesByProjectRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "bdd00b55661dcfd764e825a01aeac0f4", "score": "0.54731274", "text": "func (d *StructData) HasField(field string) bool {\n\tif _, ok := d.fieldNames[field]; ok {\n\t\treturn true\n\t}\n\n\t// has field, cache it\n\tif _, ok := d.valueTpy.FieldByName(field); ok {\n\t\td.fieldNames[field] = fieldAtTopStruct\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "459a819ec16a2e6e1ea5b498e5a84f96", "score": "0.54703283", "text": "func (fields MarcFields) HasMarc() bool {\n\tfor _, field := range fields {\n\t\tif field.MarcTag != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "69c9f7d3d6f60d71abe3ba2ad1fc1dc5", "score": "0.5469984", "text": "func (c CacheFlags) Has(bit CacheFlags) bool {\n\treturn (c & bit) == bit\n}", "title": "" }, { "docid": "fba8a8af64e0a897dfd4cb10635e7a75", "score": "0.54584044", "text": "func (o *FieldPartition) HasKeys() bool {\n\tif o != nil && !IsNil(o.Keys) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3f8af4814e85687fa530ea7177ed9c46", "score": "0.54559135", "text": "func (a Analyzer) isComputedField(stateRes resource.Resource, change Change) bool {\n\tif field, ok := a.getField(reflect.TypeOf(stateRes), change.Path); ok {\n\t\treturn field.Tag.Get(\"computed\") == \"true\"\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c55076fb61e778bed93bd8ea76b788bb", "score": "0.5454093", "text": "func (o *FieldPartition) HasFieldName() bool {\n\tif o != nil && !IsNil(o.FieldName) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "366b7924027d75b1eeecdce43f668492", "score": "0.54499024", "text": "func (x *fastReflection_QueryCreditTypeResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryCreditTypeResponse.credit_type\":\n\t\treturn x.CreditType != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryCreditTypeResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryCreditTypeResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "9d06b1cef311a76a18f595385efbc7c5", "score": "0.5447801", "text": "func (x *fastReflection_QueryVoteRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.QueryVoteRequest.proposal_id\":\n\t\treturn x.ProposalId != uint64(0)\n\tcase \"cosmos.gov.v1.QueryVoteRequest.voter\":\n\t\treturn x.Voter != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.QueryVoteRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.QueryVoteRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "326dbac0a612e16bf266ac78cf556688", "score": "0.5447615", "text": "func (s *Set) Has(c CidChannelPair) bool {\n\t_, ok := s.set[c]\n\treturn ok\n}", "title": "" }, { "docid": "b90503e221841b737b75c29ac9db3bf1", "score": "0.54462427", "text": "func (x *fastReflection_StoreKeyConfig) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.app.runtime.v1alpha1.StoreKeyConfig.module_name\":\n\t\treturn x.ModuleName != \"\"\n\tcase \"cosmos.app.runtime.v1alpha1.StoreKeyConfig.kv_store_key\":\n\t\treturn x.KvStoreKey != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.app.runtime.v1alpha1.StoreKeyConfig\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.app.runtime.v1alpha1.StoreKeyConfig does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "45b1dea908a8256275c82aa1a7ce7443", "score": "0.54444736", "text": "func (f *Field) isSettable() bool {\n\tif f.isComputedField() && f.inverse == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7d173704f4e7be70c90f4d20f3c7d308", "score": "0.544406", "text": "func (p *cloudProvider) HasClusterID() bool {\n\treturn false\n}", "title": "" }, { "docid": "e6f411ae33027f4d921aeca8f8ddca3c", "score": "0.5443751", "text": "func (x *fastReflection_QueryCreditTypeRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryCreditTypeRequest.abbreviation\":\n\t\treturn x.Abbreviation != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryCreditTypeRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryCreditTypeRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "a349a33e066c69f574c9d3f387dd2ef1", "score": "0.5437518", "text": "func (i *IntegrationGCP) HasProjectID() bool {\n\tif i != nil && i.ProjectID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "efb731b15d543c728622db0c6acb0f7c", "score": "0.5434465", "text": "func (field *Field) HasChildren() bool {\n\treturn len(field.fields) > 0\n}", "title": "" }, { "docid": "d266802f9e08cdc82b14baabb231723f", "score": "0.5430213", "text": "func (n NodeID) isSet() bool {\n\treturn int32(n) != 0\n}", "title": "" }, { "docid": "babaa56eb57ffa5c228539aacdcca41f", "score": "0.54281795", "text": "func (x *fastReflection_QueryDepositRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.QueryDepositRequest.proposal_id\":\n\t\treturn x.ProposalId != uint64(0)\n\tcase \"cosmos.gov.v1.QueryDepositRequest.depositor\":\n\t\treturn x.Depositor != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.QueryDepositRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.QueryDepositRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "161a980ca5771da70862ac400a325df2", "score": "0.54242176", "text": "func (o *PkixDistinguishedName) HasCountry() bool {\n\tif o != nil && o.Country != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cd61301cc6eddf8ff1804476c943c8dd", "score": "0.54149944", "text": "func (f *Form) Has(field string, r *http.Request) bool {\n\treturn r.Form.Get(field) != \"\"\n}", "title": "" }, { "docid": "a6a018f267de248576dccda2ed986201", "score": "0.5414437", "text": "func IsSet(key string) bool { return conf.IsSet(key) }", "title": "" }, { "docid": "55a4e38b88e60f7b31c5808d33a1d0b6", "score": "0.5411152", "text": "func (rc *RepoContributors) Has(pushKeyID string) bool {\n\t_, ok := (*rc)[pushKeyID]\n\treturn ok\n}", "title": "" }, { "docid": "45627d5fae545a0651af3b82d5c0f0e8", "score": "0.5409568", "text": "func (x *fastReflection_QueryProjectsByAdminRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsByAdminRequest.admin\":\n\t\treturn x.Admin != \"\"\n\tcase \"regen.ecocredit.v1.QueryProjectsByAdminRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsByAdminRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsByAdminRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b0de5b023e3482306e4c43ec9f96b8c7", "score": "0.54051274", "text": "func (x *fastReflection_Record) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.crypto.keyring.v1.Record.name\":\n\t\treturn x.Name != \"\"\n\tcase \"cosmos.crypto.keyring.v1.Record.pub_key\":\n\t\treturn x.PubKey != nil\n\tcase \"cosmos.crypto.keyring.v1.Record.local\":\n\t\tif x.Item == nil {\n\t\t\treturn false\n\t\t} else if _, ok := x.Item.(*Record_Local_); ok {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\tcase \"cosmos.crypto.keyring.v1.Record.ledger\":\n\t\tif x.Item == nil {\n\t\t\treturn false\n\t\t} else if _, ok := x.Item.(*Record_Ledger_); ok {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\tcase \"cosmos.crypto.keyring.v1.Record.multi\":\n\t\tif x.Item == nil {\n\t\t\treturn false\n\t\t} else if _, ok := x.Item.(*Record_Multi_); ok {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\tcase \"cosmos.crypto.keyring.v1.Record.offline\":\n\t\tif x.Item == nil {\n\t\t\treturn false\n\t\t} else if _, ok := x.Item.(*Record_Offline_); ok {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.crypto.keyring.v1.Record\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.crypto.keyring.v1.Record does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "c81f5be69f28c163d9d0bc4b84106f99", "score": "0.54009056", "text": "func (o *CustconfAuthUrlSignAliCloudC) HasEnabled() bool {\n\tif o != nil && o.Enabled != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aa2b4a7a58e114bc63078f41fffeb7dd", "score": "0.5398301", "text": "func (o *PatchedUpdateViewSort) HasField() bool {\n\tif o != nil && !IsNil(o.Field) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fbf2e0fd998e2bc65819004446cbcb94", "score": "0.53960466", "text": "func resHasField(res *resource.Resource, path string) bool {\n\treturn true\n\t// fld := strings.Join(utils.PathSplitter(path), \".\")\n\t// _, e := res.GetFieldValue(fld)\n\t// return e == nil\n}", "title": "" }, { "docid": "c0846b52bfa6d4ff489e5953c5ca57e0", "score": "0.5395375", "text": "func (c *Config) Has(key string) bool {\n\treturn c.real().Has(key)\n}", "title": "" }, { "docid": "5c0713a2c6bce65a5c3516e9c25b3733", "score": "0.5392251", "text": "func (f *Form) Has(field string, r *http.Request) bool {\n\t// Check if the request has the field\n\tx := r.Form.Get(field)\n\t// Because its a required field, check if its empty\n\tif x != \"\" {\n\t\treturn true\n\t}\n\t// f.Errors.Add(field, \"This field is required\")\n\treturn false\n}", "title": "" }, { "docid": "6a5ed7fbee463ca231c48ddf6e394611", "score": "0.53900605", "text": "func (o *RecurrenceTransaction) HasPiggyBankId() bool {\n\tif o != nil && o.PiggyBankId.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0da4617567cafad1ea3cc8d8865c0cc0", "score": "0.53852046", "text": "func (o *CustomProfileField) HasHint() bool {\n\tif o != nil && o.Hint != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "10a33d4b1f1180028d9b2fcc4b0d49fa", "score": "0.538468", "text": "func (x *fastReflection_QueryProjectsByReferenceIdResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.QueryProjectsByReferenceIdResponse.projects\":\n\t\treturn len(x.Projects) != 0\n\tcase \"regen.ecocredit.v1.QueryProjectsByReferenceIdResponse.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.QueryProjectsByReferenceIdResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.QueryProjectsByReferenceIdResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "500f802f2163d3313e92433332a8e22f", "score": "0.53770506", "text": "func (x *fastReflection_MsgCreateProjectResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.MsgCreateProjectResponse.project_id\":\n\t\treturn x.ProjectId != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.MsgCreateProjectResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.MsgCreateProjectResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "142aaf2dbc99bc1a44eb9367bb5f024d", "score": "0.53761405", "text": "func (x *fastReflection_QueryProposalsRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.gov.v1.QueryProposalsRequest.proposal_status\":\n\t\treturn x.ProposalStatus != 0\n\tcase \"cosmos.gov.v1.QueryProposalsRequest.voter\":\n\t\treturn x.Voter != \"\"\n\tcase \"cosmos.gov.v1.QueryProposalsRequest.depositor\":\n\t\treturn x.Depositor != \"\"\n\tcase \"cosmos.gov.v1.QueryProposalsRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.gov.v1.QueryProposalsRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.gov.v1.QueryProposalsRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" } ]
19db97f42ac1c4715abc59a0941f007c
Ptr returns reference to LogsMetricResponseComputeAggregationType value.
[ { "docid": "9a027b5efc5026ffc17db015b709029e", "score": "0.7593406", "text": "func (v LogsMetricResponseComputeAggregationType) Ptr() *LogsMetricResponseComputeAggregationType {\n\treturn &v\n}", "title": "" } ]
[ { "docid": "f1029503748ce38d48a1620e578aa356", "score": "0.5724949", "text": "func NewLogsMetricResponseComputeAggregationTypeFromValue(v string) (*LogsMetricResponseComputeAggregationType, error) {\n\tev := LogsMetricResponseComputeAggregationType(v)\n\tif ev.IsValid() {\n\t\treturn &ev, nil\n\t}\n\treturn nil, fmt.Errorf(\"invalid value '%v' for LogsMetricResponseComputeAggregationType: valid values are %v\", v, allowedLogsMetricResponseComputeAggregationTypeEnumValues)\n}", "title": "" }, { "docid": "b1cafd286f7df76e624103146ae5b611", "score": "0.554787", "text": "func (o *LogsMetricCompute) GetAggregationType() LogsMetricComputeAggregationType {\n\tif o == nil {\n\t\tvar ret LogsMetricComputeAggregationType\n\t\treturn ret\n\t}\n\treturn o.AggregationType\n}", "title": "" }, { "docid": "ca1777c044cbca2c9693e108a038d480", "score": "0.5486551", "text": "func (o *LogsMetricCompute) GetAggregationTypeOk() (*LogsMetricComputeAggregationType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.AggregationType, true\n}", "title": "" }, { "docid": "a542554a183e074e1e3fe5d1422bad26", "score": "0.53048486", "text": "func (v *LogsMetricResponseComputeAggregationType) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = LogsMetricResponseComputeAggregationType(value)\n\treturn nil\n}", "title": "" }, { "docid": "fd4bda05cb07bda1808f09891e95e0a3", "score": "0.51574445", "text": "func (m *RuleThreshold) GetAggregation()(*AggregationType) {\n val, err := m.GetBackingStore().Get(\"aggregation\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*AggregationType)\n }\n return nil\n}", "title": "" }, { "docid": "45939b858d443a9f5abd1485efdde817", "score": "0.5102209", "text": "func (c *AggCounter) GetType() *io_prometheus_client.MetricType {\n\treturn c.g.GetType()\n}", "title": "" }, { "docid": "05e0a9d509303544d727a3eb8517feaf", "score": "0.4954415", "text": "func (o RegionAutoscalerAutoscalingPolicyMetricOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegionAutoscalerAutoscalingPolicyMetric) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "af67a7b87f7173fdc11f74b147248cc8", "score": "0.4867815", "text": "func (pa *PodAggregationRest) Kind() string {\n\treturn \"PodAggregationRest\"\n}", "title": "" }, { "docid": "dafe7970b93932b7577dbee38ae42cf6", "score": "0.48660317", "text": "func aggregatorResponse() responseType {\n\treturn func(r *response) error {\n\t\tif r == nil {\n\t\t\treturn errors.New(errors.KsiInvalidArgumentError)\n\t\t}\n\t\tr.aggrResp = &pdu.AggregatorResp{}\n\n\t\tr.decode = func(b []byte) error { return r.aggrResp.Decode(b) }\n\t\tr.verify = func(a hash.Algorithm, k string) error { return r.aggrResp.Verify(a, k) }\n\t\tr.verifyReqId = func(req *request) error { return verifyAggrRequestId(req.aggrReq, r.aggrResp) }\n\t\tr.config = func() (*pdu.Config, error) { return r.aggrResp.Config() }\n\t\tr.setConfig = func(c *pdu.Config) error { return r.aggrResp.SetConfig(c) }\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "98deaf69a7c1556527613f89a599a802", "score": "0.48427278", "text": "func (o GoogleCloudDialogflowCxV3beta1ExperimentResultMetricOutput) Type() GoogleCloudDialogflowCxV3beta1ExperimentResultMetricTypePtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3beta1ExperimentResultMetric) *GoogleCloudDialogflowCxV3beta1ExperimentResultMetricType {\n\t\treturn v.Type\n\t}).(GoogleCloudDialogflowCxV3beta1ExperimentResultMetricTypePtrOutput)\n}", "title": "" }, { "docid": "0dfd1bff97ad6706026c2c011ec12aaf", "score": "0.48122963", "text": "func (v *LogsMetricResponseComputeAggregationType) GetAllowedValues() []LogsMetricResponseComputeAggregationType {\n\treturn allowedLogsMetricResponseComputeAggregationTypeEnumValues\n}", "title": "" }, { "docid": "adc6831f121b3539fe945c94de96c8fd", "score": "0.4811238", "text": "func (o GoogleCloudDialogflowCxV3beta1ExperimentResultMetricResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3beta1ExperimentResultMetricResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "55673dca83ce6a47b05ddba392647247", "score": "0.48107627", "text": "func (o RegionInstanceGroupManagerUpdatePolicyPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionInstanceGroupManagerUpdatePolicy) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "22f8d01f8ceafd2417627a6da253a58f", "score": "0.47647965", "text": "func (o BaseImageDependencyResponseOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BaseImageDependencyResponse) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a25c8b07da96c8ce5a86889bd0927a2c", "score": "0.47520772", "text": "func (o AutoscalarAutoscalingPolicyMetricOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AutoscalarAutoscalingPolicyMetric) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8079f5f9900a03498d74b02ce61b6b1f", "score": "0.4740265", "text": "func (o ManagementGroupChildInfoResponseOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ManagementGroupChildInfoResponse) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "629970c956c2146dcf650f4687b32b46", "score": "0.47278762", "text": "func (o ProvisioningArtifactOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ProvisioningArtifact) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "696e3d0f0fa75024d6c40afa3642c738", "score": "0.46974194", "text": "func (o AutoscalerAutoscalingPolicyMetricOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AutoscalerAutoscalingPolicyMetric) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4229125bdf875948be5c0a00ced98314", "score": "0.4689296", "text": "func (o QueryDatasetResponsePtrOutput) Aggregation() QueryAggregationResponseMapOutput {\n\treturn o.ApplyT(func(v *QueryDatasetResponse) map[string]QueryAggregationResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Aggregation\n\t}).(QueryAggregationResponseMapOutput)\n}", "title": "" }, { "docid": "2f01e7a1caf15ef0599172a58b7b1e73", "score": "0.4687658", "text": "func (o ManagedIdentityResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ManagedIdentityResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bcbfdea3b1c76b53767f08a69a0cb4f6", "score": "0.4668557", "text": "func (o PostgreSqlConnectionInfoResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PostgreSqlConnectionInfoResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bc74ecbc8c21fac253a4f4a9d083a167", "score": "0.46619362", "text": "func (o HostingEnvironmentProfileResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HostingEnvironmentProfileResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9c75be118fc79fa221de8dfc6f547ca3", "score": "0.46505097", "text": "func (m *Metric) Type() prometheus.ValueType {\n\treturn m._type\n}", "title": "" }, { "docid": "6add8d68495ceb74e4c42dd84d5c514f", "score": "0.46466482", "text": "func (o QueryGroupingResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QueryGroupingResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae6b98214508049fdd6d38386a84c239", "score": "0.46369314", "text": "func (o DaemonSetConditionPatchOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DaemonSetConditionPatch) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b2bc1be7dae116a86eeaf32bbed99676", "score": "0.46197814", "text": "func (o InstanceGroupManagerUpdatePolicyPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InstanceGroupManagerUpdatePolicy) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "37d019ef86e9c1a3d7034dbbc30f412e", "score": "0.46086738", "text": "func (o ManagedServiceIdentityResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ManagedServiceIdentityResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "26e37c6cb7c4231e9f84b9f83429e672", "score": "0.4596328", "text": "func (x *fastReflection_QueryPoolResponse) Type() protoreflect.MessageType {\n\treturn _fastReflection_QueryPoolResponse_messageType\n}", "title": "" }, { "docid": "c1a06ec658a9b92435c9524370f891ae", "score": "0.45706373", "text": "func (o ReleaseResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ReleaseResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e380d8d021927ba4df0ecf71c0f5f938", "score": "0.4568929", "text": "func (rv *ReturnValue) Type() ObjectType {\n\treturn RETURN_VALUE_OBJ\n}", "title": "" }, { "docid": "79d3ae048a73db8b3b9793b6bbffe3d7", "score": "0.4563773", "text": "func (o GroupOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Group) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5246cd5ee133a6cabbae5f1b0b02423d", "score": "0.45510125", "text": "func (o ManagedIdentityResponseOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ManagedIdentityResponse) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "694d1f8becf015a7f14f3d27295bd798", "score": "0.45496684", "text": "func (s ProductViewAggregationValue) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "3a059972ee2e672125b7fb8652604fb5", "score": "0.45453712", "text": "func (o DeviceGroupOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DeviceGroup) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eb8447edd5083396b057dd1d7c77b65d", "score": "0.45429906", "text": "func (JoinDefaultChannelResponse) Type() string {\n\treturn TypeJoinDefaultChannelResponse\n}", "title": "" }, { "docid": "daa6371d74fa88ea4455581e59ffd494", "score": "0.45382053", "text": "func (o RegionCommitmentResourceOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegionCommitmentResource) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "93a485daa65ace0eba15b76474bacdf7", "score": "0.45378643", "text": "func (o ReplicaSetConditionPatchOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReplicaSetConditionPatch) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9af116f1bed9c1a4a3b31aaf42fbadc6", "score": "0.4523246", "text": "func (o ReferenceDataSetKeyPropertyResponseOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReferenceDataSetKeyPropertyResponse) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3aae14e301ce4bbb74f00ed51066e6ef", "score": "0.45224848", "text": "func (o SslConfigResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslConfigResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "15fb648642eeed7504281386b4af0fb0", "score": "0.45218053", "text": "func (o MiSqlConnectionInfoResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MiSqlConnectionInfoResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2cdf3bce715200aaf389d3db9fe391de", "score": "0.44966716", "text": "func (o QueryDefinitionResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *QueryDefinitionResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5d279a931feba7fc45af0185f03bd899", "score": "0.44940934", "text": "func (s *Wrapper) Type() string {\n\treturn wrapping.GCPCKMS\n}", "title": "" }, { "docid": "dcb310baa2829176163e06de79e85592", "score": "0.4492171", "text": "func (o DockerBuildStepResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DockerBuildStepResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f32fe7bd238df3cd03096900f9e06c5c", "score": "0.4482877", "text": "func (o PrometheusSpecVolumesHostPathOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpecVolumesHostPath) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c65cb37ee3321b9d3966c41bbc32c5d4", "score": "0.4478887", "text": "func (rv *ReturnValue) Type() ObjectType {\n\treturn ReturnValueOBJ\n}", "title": "" }, { "docid": "10551cf00a8d2fed2594279eb7b7cbe5", "score": "0.44623864", "text": "func (c ODataAADServicePrincipalCredentialType) ToPtr() *ODataAADServicePrincipalCredentialType {\n\treturn &c\n}", "title": "" }, { "docid": "558dcc7a9aab7eb88dad253728eeb0cf", "score": "0.44536224", "text": "func (o PrometheusSpecVolumesHostPathPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PrometheusSpecVolumesHostPath) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "31312cf4e6d6de385e28faa5638f5c68", "score": "0.44481713", "text": "func (o EndpointResponseOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EndpointResponse) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0f0a212248132d6297cb4f53b7dea64c", "score": "0.4445104", "text": "func (o *RegistryCredential) Kind() string {\n\tif o == nil {\n\t\treturn RegistryCredentialNilKind\n\t}\n\tif o.bitmap_&1 != 0 {\n\t\treturn RegistryCredentialLinkKind\n\t}\n\treturn RegistryCredentialKind\n}", "title": "" }, { "docid": "9b72b1e1cc5ec0b418de690d72038568", "score": "0.44415346", "text": "func (o EdgeKubernetesLogConfigPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EdgeKubernetesLogConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c04bdcf228ee4c79e2525a852a7d3813", "score": "0.44394743", "text": "func (c ArcSQLManagedInstanceLicenseType) ToPtr() *ArcSQLManagedInstanceLicenseType {\n\treturn &c\n}", "title": "" }, { "docid": "887a2f9e3f7376e9bf9900edd48e6840", "score": "0.4431858", "text": "func (this *RatioToReport) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "cf65c3ec38136865567cc62e3a1fd869", "score": "0.44301465", "text": "func (E_OpenconfigIfAggregate_AggregationType) IsYANGGoEnum() {}", "title": "" }, { "docid": "cf65c3ec38136865567cc62e3a1fd869", "score": "0.44301465", "text": "func (E_OpenconfigIfAggregate_AggregationType) IsYANGGoEnum() {}", "title": "" }, { "docid": "cf65c3ec38136865567cc62e3a1fd869", "score": "0.44301465", "text": "func (E_OpenconfigIfAggregate_AggregationType) IsYANGGoEnum() {}", "title": "" }, { "docid": "9ba2cd440b1d7c0f05c704f2c3c5f677", "score": "0.44255444", "text": "func (c DataFlowComputeType) ToPtr() *DataFlowComputeType {\n\treturn &c\n}", "title": "" }, { "docid": "47a941e134c1e6884185f94c226f03fc", "score": "0.44248608", "text": "func (o *LogsLookupProcessor) GetType() LogsLookupProcessorType {\n\tif o == nil {\n\t\tvar ret LogsLookupProcessorType\n\t\treturn ret\n\t}\n\treturn o.Type\n}", "title": "" }, { "docid": "108228544c7af659338b0c92ae3f3e59", "score": "0.44240412", "text": "func (o PrivateEndpointConnectionResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PrivateEndpointConnectionResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "108228544c7af659338b0c92ae3f3e59", "score": "0.44240412", "text": "func (o PrivateEndpointConnectionResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PrivateEndpointConnectionResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4c1486d06f37b98bee0b0209c8e796ce", "score": "0.4417959", "text": "func (v SensitiveDataScannerGroupType) Ptr() *SensitiveDataScannerGroupType {\n\treturn &v\n}", "title": "" }, { "docid": "9dba835fe6e8a892d4b53091138c4c30", "score": "0.4414191", "text": "func (o RegionInstanceGroupManagerUpdatePolicyOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RegionInstanceGroupManagerUpdatePolicy) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0502f59036fe3e355148d9b3cdef374b", "score": "0.4411623", "text": "func (o VirtualClusterContainerProviderPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VirtualClusterContainerProvider) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2943757cdd2ed41404a18c07a4629c13", "score": "0.4408231", "text": "func (p *PhotoCachedSize) GetType() (value string) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.Type\n}", "title": "" }, { "docid": "d77ea7ad9f64b0c47429091a334987ef", "score": "0.44075012", "text": "func (v MonitorFormulaAndFunctionEventAggregation) Ptr() *MonitorFormulaAndFunctionEventAggregation {\n\treturn &v\n}", "title": "" }, { "docid": "a3ef02f9bdefcbe9550429962ee8537f", "score": "0.43992656", "text": "func (o InstanceReservationAffinityPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InstanceReservationAffinity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "59a534cb0a6a602f5744450509db92cd", "score": "0.4391675", "text": "func (c DynamicsServicePrincipalCredentialType) ToPtr() *DynamicsServicePrincipalCredentialType {\n\treturn &c\n}", "title": "" }, { "docid": "4d40f12beb4cc44e0da62b3a75c0da0c", "score": "0.43914565", "text": "func (o AlertmanagerSpecVolumesHostPathPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AlertmanagerSpecVolumesHostPath) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "80fc3068a589bd542a8dcb9f62b97922", "score": "0.43886763", "text": "func (o DeploymentConditionPatchOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DeploymentConditionPatch) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f46b2cdc44d09271698cea1cb0ae07c7", "score": "0.43885425", "text": "func (v CIAppAggregationFunction) Ptr() *CIAppAggregationFunction {\n\treturn &v\n}", "title": "" }, { "docid": "b7b97ea67c30f7be61877fd8fb8fffdb", "score": "0.43848154", "text": "func (c RestServiceAuthenticationType) ToPtr() *RestServiceAuthenticationType {\n\treturn &c\n}", "title": "" }, { "docid": "5a19a3a55c012ab1965b5f6a9813dc9c", "score": "0.43797284", "text": "func (cluster *ManagedCluster_Spec_ARM) GetType() string {\n\treturn \"Microsoft.ContainerService/managedClusters\"\n}", "title": "" }, { "docid": "d763f462c0babbed640db30b15ce8a54", "score": "0.43796697", "text": "func (c MongoDbAuthenticationType) ToPtr() *MongoDbAuthenticationType {\n\treturn &c\n}", "title": "" }, { "docid": "84b8b9dc502f2f8b23cd9760d576b638", "score": "0.43783748", "text": "func UnmarshalQueryAggregation(m map[string]json.RawMessage, result interface{}) (err error) {\n\t// Retrieve discriminator value to determine correct \"subclass\".\n\tvar discValue string\n\terr = core.UnmarshalPrimitive(m, \"type\", &discValue)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"error unmarshalling discriminator property 'type': %s\", err.Error())\n\t\treturn\n\t}\n\tif discValue == \"\" {\n\t\terr = fmt.Errorf(\"required discriminator property 'type' not found in JSON object\")\n\t\treturn\n\t}\n\tif discValue == \"term\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryTermAggregation)\n\t} else if discValue == \"histogram\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryHistogramAggregation)\n\t} else if discValue == \"timeslice\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryTimesliceAggregation)\n\t} else if discValue == \"nested\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryNestedAggregation)\n\t} else if discValue == \"filter\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryFilterAggregation)\n\t} else if discValue == \"min\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryCalculationAggregation)\n\t} else if discValue == \"max\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryCalculationAggregation)\n\t} else if discValue == \"sum\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryCalculationAggregation)\n\t} else if discValue == \"average\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryCalculationAggregation)\n\t} else if discValue == \"unique_count\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryCalculationAggregation)\n\t} else if discValue == \"top_hits\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryTopHitsAggregation)\n\t} else if discValue == \"group_by\" {\n\t\terr = core.UnmarshalModel(m, \"\", result, UnmarshalQueryGroupByAggregation)\n\t} else {\n\t\terr = fmt.Errorf(\"unrecognized value for discriminator property 'type': %s\", discValue)\n\t}\n\treturn\n}", "title": "" }, { "docid": "092ac22aca44eafcc4de315900e462c9", "score": "0.4374925", "text": "func (o MySqlConnectionInfoResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MySqlConnectionInfoResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "954b0d5cc0b4c26b331cc41b53e92e94", "score": "0.43651015", "text": "func (s *QueryStruct) OutputRelType() RelType {\n\tif s.Result != nil {\n\t\treturn s.Result.Type\n\t}\n\treturn s.Rel.Type\n}", "title": "" }, { "docid": "9ad503ff6e2bdee2b9578441a00ce783", "score": "0.43551955", "text": "func (x *fastReflection_MsgAuthorizeCircuitBreakerResponse) Type() protoreflect.MessageType {\n\treturn _fastReflection_MsgAuthorizeCircuitBreakerResponse_messageType\n}", "title": "" }, { "docid": "bdb6d1cd23034f50c4f7cc00eff1b4bd", "score": "0.43509656", "text": "func (o SqlConnectionInfoResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SqlConnectionInfoResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b16ab73514bd7881565501b8eb2b52a6", "score": "0.4348248", "text": "func (o NodePoolScalingConfigPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodePoolScalingConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "84f77270f609471fdf10b16b20ce9107", "score": "0.43466228", "text": "func (o SharedPrivateLinkResourceResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SharedPrivateLinkResourceResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8f30db9f9b7fa5019a7a8d4b0a12c700", "score": "0.43456507", "text": "func (o AlertmanagerSpecVolumesHostPathOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertmanagerSpecVolumesHostPath) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0b2e631e53e29d3ddd2302cadf8bc8f0", "score": "0.43408582", "text": "func (o SubjectAccessReviewTypeOutput) Kind() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SubjectAccessReviewType) *string { return v.Kind }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bc7dd8cb82df874082d3f996140030c8", "score": "0.43393654", "text": "func (o PostgreSqlConnectionInfoResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PostgreSqlConnectionInfoResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "952062bc44149cf88a535b83792ab9bb", "score": "0.43320918", "text": "func (o NodePoolScalingConfigOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodePoolScalingConfig) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "46b4c0725e8beeca1929a9902c1c6ea9", "score": "0.4328643", "text": "func (x *fastReflection_MsgResetCircuitBreakerResponse) Type() protoreflect.MessageType {\n\treturn _fastReflection_MsgResetCircuitBreakerResponse_messageType\n}", "title": "" }, { "docid": "b6da206a3791c48cd3d96e10839c2580", "score": "0.43272126", "text": "func (o LookupCustomerGatewayResultOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupCustomerGatewayResult) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "dfb2a5a25a45457f930a0b685767baff", "score": "0.43244326", "text": "func (o RegionInstanceTemplateReservationAffinityPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionInstanceTemplateReservationAffinity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "39e5c646ac5d1aae3e5adb885f9085ca", "score": "0.4308206", "text": "func (o ManagementServerOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ManagementServer) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ecb49522fa7d1aa07408111a6a781769", "score": "0.43040824", "text": "func (o GoogleCloudApigeeV1GraphQLOperationGroupResponsePtrOutput) OperationConfigType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudApigeeV1GraphQLOperationGroupResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.OperationConfigType\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9e503af2bf1b0a7f2ff3f4bc1303d514", "score": "0.43015265", "text": "func (c ODataAuthenticationType) ToPtr() *ODataAuthenticationType {\n\treturn &c\n}", "title": "" }, { "docid": "8bef6da130cd873b4ce2cf647415482c", "score": "0.4297971", "text": "func (o GoogleCloudDialogflowCxV3beta1ExperimentResultMetricResponseOutput) CountType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3beta1ExperimentResultMetricResponse) string { return v.CountType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "68b5a50a22ed3decbadc57e225a00b66", "score": "0.4295012", "text": "func (e *DerefAssign) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "728272235a2df8891151102003e5ab43", "score": "0.42939255", "text": "func (o GetVirtualClusterContainerProviderOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetVirtualClusterContainerProvider) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a16affafff3babe2f3001231547743c2", "score": "0.42907014", "text": "func (c GoogleBigQueryAuthenticationType) ToPtr() *GoogleBigQueryAuthenticationType {\n\treturn &c\n}", "title": "" }, { "docid": "786114e9e5115462d3d745a23de84365", "score": "0.42891595", "text": "func (e *Match) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "4ae23e9076a410cf931054d98bb5d798", "score": "0.42885593", "text": "func (pool *ManagedClustersAgentPool) GetType() string {\n\treturn \"Microsoft.ContainerService/managedClusters/agentPools\"\n}", "title": "" }, { "docid": "c9adad55d77207d7c94891d970ceccb9", "score": "0.42858547", "text": "func (a *TestAggregate) AggregateType() string {\n\treturn \"mock.TestAggregate\"\n}", "title": "" }, { "docid": "31a3388b47fdc2cc7361025891553e3b", "score": "0.42840588", "text": "func TestGetMatchType(t *testing.T) {\n\tm := Match{Description: \"type test\", MatchType: BodyJSONCount}\n\tgettype := m.GetType()\n\tassert.Equal(t, m.MatchType, gettype)\n}", "title": "" }, { "docid": "1471094e9baaa84530963c93b6cae198", "score": "0.42839557", "text": "func (o InstanceGroupManagerUpdatePolicyOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v InstanceGroupManagerUpdatePolicy) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1a03088e1d187d2dbe14d425a4218187", "score": "0.4281978", "text": "func (o UpstreamAuthSettingsResponsePtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UpstreamAuthSettingsResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4bf883b20889fc1e24a3c6d9d1208866", "score": "0.4280517", "text": "func (c HiveAuthenticationType) ToPtr() *HiveAuthenticationType {\n\treturn &c\n}", "title": "" } ]
9cdd4af42b96692cc834240ae77300b3
Indicates name of the webhook.
[ { "docid": "c67b70ad5344e86d267608ae5095d038", "score": "0.0", "text": "func (o AutomationRunbookReceiverResponseOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AutomationRunbookReceiverResponse) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
[ { "docid": "32f96f7823800d4ffaf708985b457f72", "score": "0.853629", "text": "func (s *RegularuserWebhook) Name() string { return WebhookName }", "title": "" }, { "docid": "2ad62845c904c02d27ee7545d5a9385a", "score": "0.79089236", "text": "func (s *serviceAccountWebhook) Name() string {\n\treturn WebhookName\n}", "title": "" }, { "docid": "61e445e2cd62990e90985ddb1cc66f14", "score": "0.7587298", "text": "func (s *SCCWebHook) Name() string {\n\treturn WebhookName\n}", "title": "" }, { "docid": "2d9eb6f17b0fd1d025d4bdc1f85d9401", "score": "0.73731244", "text": "func (o *Webhook) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "title": "" }, { "docid": "edfa29082256cf331b23f591ffa54938", "score": "0.72293967", "text": "func getWebhookName(wh admit_v1.MutatingWebhookConfiguration) (string, error) {\n\tif tagName, ok := wh.ObjectMeta.Labels[istioTagLabel]; ok {\n\t\treturn tagName, nil\n\t}\n\treturn \"\", fmt.Errorf(\"could not extract tag name from webhook\")\n}", "title": "" }, { "docid": "04cf19fc8a4f64431648789e31e0df0e", "score": "0.7221935", "text": "func (w *Webhook) GetName() string {\n\tw.once.Do(w.setDefaults)\n\treturn w.Name\n}", "title": "" }, { "docid": "8c53a0d357d6f2d40677f21423a2b1a5", "score": "0.67664933", "text": "func (o NotificationPolicyWebhooksOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NotificationPolicyWebhooks) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e853c36692e64a91e09fdd260a346a97", "score": "0.6635089", "text": "func (sender *HTTPSender) Name() string {\n\treturn httpName\n}", "title": "" }, { "docid": "131cfbed12cf948de16bfa91acf7cfd3", "score": "0.6569352", "text": "func (t HookContentType) Name() string {\n\tswitch t {\n\tcase ContentTypeJSON:\n\t\treturn \"json\"\n\tcase ContentTypeForm:\n\t\treturn \"form\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a07045c9e9415b0b6766b2d37ef40e46", "score": "0.6501837", "text": "func (o WebhookReceiverOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebhookReceiver) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a07045c9e9415b0b6766b2d37ef40e46", "score": "0.6501837", "text": "func (o WebhookReceiverOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebhookReceiver) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fa247c45b9cd8e45f17e93413b573e80", "score": "0.6478824", "text": "func getWebhookNameForWebApp(output integration.TerraformOutput, webAppName string) string {\n\treturn regexp.MustCompile(\"[-]\").ReplaceAllString(webAppName+\"cdhook\", \"\")\n}", "title": "" }, { "docid": "dc6959dfbe971e3bd044af9e00ad435a", "score": "0.6452148", "text": "func (e *Extension) Name() string {\n\treturn \"JSON Web Tokens\"\n}", "title": "" }, { "docid": "07c38640909350ed3cee2a7d9f42cf6a", "score": "0.6435037", "text": "func (b *WebhookBuilder) Name(name string) *WebhookBuilder {\n\tb.name = name\n\treturn b\n}", "title": "" }, { "docid": "e7241543ed02284677837a21416de696", "score": "0.6339482", "text": "func (o EventHookOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EventHook) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "33e98e994de4b76ac13c1344ef5b2aa5", "score": "0.6281918", "text": "func (e *ServerEvent) GetName() string { return e.Metadata.Name }", "title": "" }, { "docid": "d83c2dea1578954ebcb1217738b2c3fd", "score": "0.6237902", "text": "func (o WebhookReceiverResponseOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebhookReceiverResponse) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d83c2dea1578954ebcb1217738b2c3fd", "score": "0.6237902", "text": "func (o WebhookReceiverResponseOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebhookReceiverResponse) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "930099c7894f1a9fb22da03d9da14229", "score": "0.62092257", "text": "func HookName(hookFunc Hook) string {\n\thookFuncName := goruntime.FuncForPC(reflect.ValueOf(hookFunc).Pointer()).Name()\n\thookName := hookFuncName[strings.LastIndex(hookFuncName, \".\")+1:]\n\treturn hookName\n}", "title": "" }, { "docid": "686a2215af1148fdbd37957e80636a5a", "score": "0.62088907", "text": "func (e *UserEvent) GetName() string { return e.Metadata.Name }", "title": "" }, { "docid": "47aef2297983ae8f6555c319f8fef0a4", "score": "0.61862606", "text": "func (req *LogEntry) Name() string {\n\treturn \"LogEntry\"\n}", "title": "" }, { "docid": "47aef2297983ae8f6555c319f8fef0a4", "score": "0.61862606", "text": "func (req *LogEntry) Name() string {\n\treturn \"LogEntry\"\n}", "title": "" }, { "docid": "569d028f09ccb9047f4db78a60e42d6c", "score": "0.61262345", "text": "func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "title": "" }, { "docid": "ba513575319ac4638abd8d4344d680f6", "score": "0.6124564", "text": "func (a *BloomHandler) GetName() string {\n\treturn \"Bloom filter handler\"\n}", "title": "" }, { "docid": "2873c634ed10a4e619b8c8461a83130d", "score": "0.61214215", "text": "func (caller *Caller) Name() string {\n\treturn \"http\"\n}", "title": "" }, { "docid": "cca27f59736e0f3c68a19ea50324c1e2", "score": "0.61144644", "text": "func (r *LifecycleHook) Name() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"name\"])\n}", "title": "" }, { "docid": "b4c0719a9e2bd9a3d40d690be19adac7", "score": "0.6108374", "text": "func (w *Webhook) AddressName() string {\n\treturn w.cfg.AddressName\n}", "title": "" }, { "docid": "b28f68aefce57af98ada20d830014a5e", "score": "0.6082832", "text": "func (h *Target) Name() string {\n\treturn \"minio-kafka-audit\"\n}", "title": "" }, { "docid": "ca80c01a8d647a83fe266da8bb1564d6", "score": "0.6077473", "text": "func (hs *HMACSHA) Name() string {\n\treturn hs.name\n}", "title": "" }, { "docid": "f05fce381039695cb773b587885c258a", "score": "0.60584706", "text": "func (_this *SpeechSynthesisEvent) Name() string {\n\tvar ret string\n\tvalue := _this.Value_JS.Get(\"name\")\n\tret = (value).String()\n\treturn ret\n}", "title": "" }, { "docid": "30fa541b2868e59dfae7e24e3770540b", "score": "0.6057205", "text": "func (o LifecycleHookOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LifecycleHook) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ce5d81c2d68a120ba00860d50dee21aa", "score": "0.6028813", "text": "func (ah *AppleHandler) Name() string { return ah.name }", "title": "" }, { "docid": "2bb9aae8438780b340117bb9787d9c06", "score": "0.6023472", "text": "func (this *event) Name() string {\n\treturn \"sys.mock.Input.Event\"\n}", "title": "" }, { "docid": "4ce448e6137c917adf9c78f28aceebdb", "score": "0.5994511", "text": "func (_this *AdvertisingEvent) Name() *string {\n\tvar ret *string\n\tvalue := _this.Value_JS.Get(\"name\")\n\tif value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {\n\t\t__tmp := (value).String()\n\t\tret = &__tmp\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "1a73b22096d13d5cd980e58cd8b22dd1", "score": "0.5972113", "text": "func (jwt JsonWebToken) GetName() string {\n\treturn jwt.parse().Payload.Name\n}", "title": "" }, { "docid": "5a770238c5069aa42e1e4739f521244e", "score": "0.5966314", "text": "func (e *Endpoint) GetName() string {\n\treturn e.Name\n}", "title": "" }, { "docid": "9d800527f9e16ed08bc197d47cc42422", "score": "0.5941566", "text": "func (e *Endpoint) Name() string {\n\treturn Name\n}", "title": "" }, { "docid": "9d800527f9e16ed08bc197d47cc42422", "score": "0.5941566", "text": "func (e *Endpoint) Name() string {\n\treturn Name\n}", "title": "" }, { "docid": "33baa14a0d9068b75180dd0decb21cbe", "score": "0.5938517", "text": "func (h *Handler) Name() string {\n\treturn name\n}", "title": "" }, { "docid": "deda98211633216475c86a1e526e9b83", "score": "0.59013534", "text": "func (o StreamInputEventHubOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StreamInputEventHub) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "096cf1766dc092faf571b300314962a7", "score": "0.5899986", "text": "func (c *Client) GetName() string {\n\treturn \"Firehose\"\n}", "title": "" }, { "docid": "896b0c548479f37e4d85e226fafdca21", "score": "0.5894381", "text": "func (op *CreateTriggerOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "0edd1a453c19e4e91caca0a6b98ae816", "score": "0.58932", "text": "func (s *ForwarderService) Name() string {\n\treturn s.forwarder.Listener\n}", "title": "" }, { "docid": "9ce83b8476bc9d55f378e5d481fb7ae8", "score": "0.58894545", "text": "func (s *WebService) Name() string {\n\treturn \"web\"\n}", "title": "" }, { "docid": "94a0dd2076cf6a504ecdd70de9f5a768", "score": "0.58835936", "text": "func (n *FlowNotifier) GetName() string {\n\treturn \"Flow notifier\"\n}", "title": "" }, { "docid": "0e3d3cde2757b0470725fa3e1da42267", "score": "0.5870092", "text": "func (op *UpdateTriggerOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "be4d960ec51ed9a87af8d46b23a95f16", "score": "0.586184", "text": "func (o *Webhook) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Name, true\n}", "title": "" }, { "docid": "6424ebaba57a4306d4c14309f3c07619", "score": "0.58570904", "text": "func (h *Handler) Name() string {\n\treturn \"signal\"\n}", "title": "" }, { "docid": "ded3e02435668dac7f40e72891a1ed1d", "score": "0.58545643", "text": "func (o AzureAppPushReceiverOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AzureAppPushReceiver) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ded3e02435668dac7f40e72891a1ed1d", "score": "0.58545643", "text": "func (o AzureAppPushReceiverOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AzureAppPushReceiver) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0e47bb279eea76a62f54037151be60bb", "score": "0.58511794", "text": "func (plugin *wf) Name() string {\n\treturn \"Workflow\"\n}", "title": "" }, { "docid": "b092434c84211abb765c4a4adf95a18d", "score": "0.58446866", "text": "func (t AzureBlobTransmitter) GetName() string {\n\treturn \"AzureBlob\"\n}", "title": "" }, { "docid": "dbcbc13acbe7aaf238149446c9f395eb", "score": "0.58374995", "text": "func (w *Websocket) GetName() string {\n\treturn w.exchangeName\n}", "title": "" }, { "docid": "2b911df79d2406d4c298e4bbf3653a52", "score": "0.5834209", "text": "func (ev *KubeStateChange) GetName() string {\n\treturn \"Kubernetes State Change\"\n}", "title": "" }, { "docid": "03ff8c1ac178684f5d55bf9a2d5f02a8", "score": "0.58315027", "text": "func (t Tracing) Name() string {\n\treturn tracingAddOn\n}", "title": "" }, { "docid": "f2e33987a33d6c4ae803df71016e19ca", "score": "0.5822277", "text": "func (o *RawEventMaximumContentLength) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "title": "" }, { "docid": "b4a48ddf8484e278eaece32ed994ccf1", "score": "0.5799331", "text": "func (E Event) GetName() string {\n\treturn E.name\n}", "title": "" }, { "docid": "a10de34c9baf1b54bba37bfc83802b66", "score": "0.5793465", "text": "func (r *XactTCObjs) Name() string {\n\treturn fmt.Sprintf(\"%s => %s\", r.streamingX.Name(), r.args.BckTo)\n}", "title": "" }, { "docid": "8289d2b1780f211c3d5ee19ff242a785", "score": "0.5790919", "text": "func (ata *AuthenticationTypeAPIKey) Name() string {\n\treturn ata.name\n}", "title": "" }, { "docid": "de6d9d322c4f3470a4a6dc980521668a", "score": "0.5789777", "text": "func (e *BobExtension) Name() string {\n\treturn BobExtensionName\n}", "title": "" }, { "docid": "b32935fc4911e7b23f5d254a979602ca", "score": "0.5784433", "text": "func webhookToString(hook Webhook) (string, error) {\n\tswitch hook {\n\tcase 1:\n\t\treturn \"start\", nil\n\tcase 2:\n\t\treturn \"success\", nil\n\tcase 3:\n\t\treturn \"fail\", nil\n\tdefault:\n\t\treturn \"\", ErrUnknownWebhook\n\t}\n}", "title": "" }, { "docid": "2b95bf534406bc759b9ae10e35331c31", "score": "0.5775661", "text": "func (s *StatusNotifierItem_NewTitleSignal) Name() string {\n\treturn \"NewTitle\"\n}", "title": "" }, { "docid": "6e6c1473e3d9b4c89738f10f4ddaaddc", "score": "0.57710046", "text": "func (e *FavoriteAdd) Name() string {\n\treturn \"FavoriteAdd\"\n}", "title": "" }, { "docid": "ea590a8cc0a5d888e0df55be0ca4d53a", "score": "0.57546014", "text": "func (o AzureAppPushReceiverResponseOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AzureAppPushReceiverResponse) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ea590a8cc0a5d888e0df55be0ca4d53a", "score": "0.57546014", "text": "func (o AzureAppPushReceiverResponseOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AzureAppPushReceiverResponse) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae24c008b274eff94b020fafc97e67c3", "score": "0.57535255", "text": "func (s *DeployLambda) Name() string {\n\treturn fmt.Sprintf(\"Deploy lambda %s\", s.name)\n}", "title": "" }, { "docid": "c648690d70400a0b43db96674189592e", "score": "0.57439595", "text": "func (t *TracingProviderHandler) Name() string {\n\treturn TracingProvider\n}", "title": "" }, { "docid": "2017ae10167f2d1e2fc57ea4704df77a", "score": "0.5741607", "text": "func (o TriggerHttpRequestOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TriggerHttpRequest) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1d46423bfb238280e4e586b5e8500a87", "score": "0.5737845", "text": "func (v endpoint) GetName() string {\n\treturn v.name\n}", "title": "" }, { "docid": "f67e291fe6de5fecf81dc07910f8a6d4", "score": "0.5734803", "text": "func (f *JSON) Name() string {\n\treturn jsonName\n}", "title": "" }, { "docid": "2ffc991a20d7e23a5ceb286dc92ebc5d", "score": "0.573361", "text": "func (o *HealthCheck) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "title": "" }, { "docid": "f8a6358c493dac60a5437a25ec49e540", "score": "0.57248473", "text": "func (h *Consumer) Name() string {\n\treturn \"httpapi\"\n}", "title": "" }, { "docid": "c65296c76181ad9c0aa57b86c04545ce", "score": "0.5723574", "text": "func (handler *BaseHandler) Name() string {\n\treturn handler.name\n}", "title": "" }, { "docid": "d96096aa2ce8302dc69c15f4324dc019", "score": "0.5719378", "text": "func (h *Exechook) Name() string {\n\treturn \"exechook\"\n}", "title": "" }, { "docid": "d5c8aa71247f41b122bc3324894858b8", "score": "0.57156235", "text": "func (o StreamInputEventHubV2Output) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StreamInputEventHubV2) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "75262a08a5d78395198f99428ec0e88c", "score": "0.5715443", "text": "func (t *TracingConsumerHandler) Name() string {\n\treturn TracingConsumer\n}", "title": "" }, { "docid": "708ab52389430be553ab1053a6b636b9", "score": "0.57084405", "text": "func (n *SQSNotify) Name() string {\n\treturn n.name\n}", "title": "" }, { "docid": "2b5d60110b1193d3aec35d983fafb68e", "score": "0.57042575", "text": "func (f *Frame) Name() string { return f.name }", "title": "" }, { "docid": "da20adc2ae4e2dbe4fee7b46b8adabe6", "score": "0.57024497", "text": "func (ev *ExternalConfigChange) GetName() string {\n\treturn \"External Config Change\"\n}", "title": "" }, { "docid": "969781284c4a75125c2256501b5d1403", "score": "0.5700044", "text": "func (eventhub *Namespaces_Eventhub_Spec_ARM) GetName() string {\n\treturn eventhub.Name\n}", "title": "" }, { "docid": "612757f60df4a13dd70b89fbbb682b11", "score": "0.56929475", "text": "func (module *HTTPNotifier) GetName() string {\n\treturn module.name\n}", "title": "" }, { "docid": "ebcca79876fd943c48baaabe4d2d8a7b", "score": "0.5684988", "text": "func (req *Vote) Name() string {\n\treturn \"Vote\"\n}", "title": "" }, { "docid": "ebcca79876fd943c48baaabe4d2d8a7b", "score": "0.5684988", "text": "func (req *Vote) Name() string {\n\treturn \"Vote\"\n}", "title": "" }, { "docid": "daf78b87556ad5e0a53e029266ffbf10", "score": "0.5684124", "text": "func GetUserName(body *WebhookReqBody) {\n msg := \"Hi I am chat bot, please enter your name after @\"+\"\\n\"+\"for example @YourName\"\n if err := reply(body.Message.Chat.ID, msg); err != nil {\n fmt.Println(\"error in sending reply:\", err)\n return\n }\n}", "title": "" }, { "docid": "8e1b37214be610bc5d83e319a92fad0a", "score": "0.5678146", "text": "func (event *ParamsEvent) Name() string {\n\treturn event.name\n}", "title": "" }, { "docid": "68fd8e1aa38be73a8b47096761608c1d", "score": "0.56756216", "text": "func Name(pb proto.Message) string {\n\tif pb == nil {\n\t\treturn \"\"\n\t}\n\n\tif v, ok := pb.(Namer); ok {\n\t\treturn v.ResourceName()\n\t}\n\n\tname := proto.MessageName(pb)\n\n\tv := strings.Split(name, \".\")\n\tname = util.CamelToSnake(v[len(v)-1])\n\tif Plural() {\n\t\tname += \"s\"\n\t}\n\treturn name\n}", "title": "" }, { "docid": "8cdf50494094f6a0540184cf8905a0f7", "score": "0.5672688", "text": "func (o AzureFunctionReceiverOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AzureFunctionReceiver) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8cdf50494094f6a0540184cf8905a0f7", "score": "0.5672688", "text": "func (o AzureFunctionReceiverOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AzureFunctionReceiver) string { return v.Name }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3c6148f185cdfc008a767d10b6461b8e", "score": "0.5671035", "text": "func (recv *Action) GetName() string {\n\tretC := C.gtk_action_get_name((*C.GtkAction)(recv.native))\n\tretGo := C.GoString(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "aff8b40e05ce4b35e2dddb74ddbd6a55", "score": "0.5670533", "text": "func (h *TokenFilterHunspell) Name() string {\n\treturn h.name\n}", "title": "" }, { "docid": "4bcf60c6d8cbc9250f5884f1b03d2e8f", "score": "0.56693333", "text": "func (h *Handler) Name() (string, error) {\n\treturn \"Example ADR plugin\", nil\n}", "title": "" }, { "docid": "f8b97f97fa6687a15913a8d02cc89c45", "score": "0.5666997", "text": "func (module *Telegram) Name() string {\n\treturn Name\n}", "title": "" }, { "docid": "da36349a9edaa0445d85668020138381", "score": "0.56661636", "text": "func (wc *WatchedContract) Name() string {\n\treturn wc.name\n}", "title": "" }, { "docid": "a1937368718a6bb2f611ca706f448901", "score": "0.56651556", "text": "func (h *Heroku) Name() string {\n\treturn \"heroku\"\n}", "title": "" }, { "docid": "bacd0b5dd28f6b831febb20ec068765e", "score": "0.56607646", "text": "func SetUserName(body *WebhookReqBody) {\n name := after(body.Message.Text, \"@\")\n SetUser(body.Message.Chat.ID, name)\n AskLocation(body, name)\n}", "title": "" }, { "docid": "08218e9bb486c529a964036dff95042a", "score": "0.5658934", "text": "func (b *Binding) GetName() string {\n\treturn strings.Join(\n\t\t[]string{b.Queue, b.Exchange, b.RoutingKey},\n\t\t\"_\",\n\t)\n}", "title": "" }, { "docid": "7d2b4587435527bad57016db25b62ea3", "score": "0.5658452", "text": "func (op *UpdateDeploymentOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "046ec7d60a9dca7481d9f2207f0dae58", "score": "0.5650469", "text": "func (los ListOfSpeakers) Name() string {\n\treturn \"list_of_speakers\"\n}", "title": "" }, { "docid": "777410279706aa376e9b59cee7b8e5fe", "score": "0.5647907", "text": "func (p *python) GetName() string {\n\treturn \"python\"\n}", "title": "" }, { "docid": "777410279706aa376e9b59cee7b8e5fe", "score": "0.5647907", "text": "func (p *python) GetName() string {\n\treturn \"python\"\n}", "title": "" }, { "docid": "777410279706aa376e9b59cee7b8e5fe", "score": "0.5647907", "text": "func (p *python) GetName() string {\n\treturn \"python\"\n}", "title": "" } ]
ad8e8468b60113e0e0ab706656de1934
Pause pauses playback if pause is true; resumes playback otherwise.
[ { "docid": "cb3e160213ffa007c4383fbc3c139c72", "score": "0.6431561", "text": "func (cl *CommandList) Pause(pause bool) {\n\tif pause {\n\t\tcl.cmdQ.PushBack(&command{\"pause 1\", nil, cmdNoReturn})\n\t} else {\n\t\tcl.cmdQ.PushBack(&command{\"pause 0\", nil, cmdNoReturn})\n\t}\n}", "title": "" } ]
[ { "docid": "a5b435cb63d77d6bb6228b81d5a92f5d", "score": "0.70507115", "text": "func (p *player) pause() {\n\tp.mtx.Lock()\n\tdefer p.mtx.Unlock()\n\tp.ctrl.Paused = true\n\tgo p.callOnChange()\n}", "title": "" }, { "docid": "2399493b061c21a41c18d0edd2a57832", "score": "0.69463146", "text": "func (p *Player) TogglePause() error {\n\tif err := p.assertInit(); err != nil {\n\t\treturn err\n\t}\n\n\tC.libvlc_media_player_pause(p.player)\n\treturn getError()\n}", "title": "" }, { "docid": "b66bcc8d9294c4a621bd42e0a5dac2f2", "score": "0.68041617", "text": "func (p *Player) SetPause(pause bool) error {\n\tif err := p.assertInit(); err != nil {\n\t\treturn err\n\t}\n\n\tC.libvlc_media_player_set_pause(p.player, C.int(boolToInt(pause)))\n\treturn getError()\n}", "title": "" }, { "docid": "ee94c97afc3b858534d2d298e41e6030", "score": "0.6716772", "text": "func (ui *UserInterface) playPause(g *gocui.Gui, v *gocui.View) error {\n\tif ui.paused {\n\t\tlogrus.Info(\"Play\")\n\t\tui.app.Unpause()\n\t\tui.paused = false\n\t} else {\n\t\tlogrus.Info(\"Pause\")\n\t\tui.app.Pause()\n\t\tui.paused = true\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a6b2d5e249ead8769f8fcb6ad72dc03", "score": "0.67129636", "text": "func (player *omxPlaying) TogglePause() {\n\tplayer.Paused = !player.Paused\n\tplayer.position = player.position.Absolute(player.Paused)\n}", "title": "" }, { "docid": "af5a9bb874aa8218824b39a82d2759bf", "score": "0.67011386", "text": "func (s *Subscriber) Pause() error {\n\tbody := jwsapi.Message{\n\t\tjwsapi.AttrRequest: \"pause\",\n\t}\n\n\t_, err := s.handle.Message(body)\n\treturn err\n}", "title": "" }, { "docid": "505680b809166977c76deeeb4023f595", "score": "0.6684811", "text": "func Pause(conf *Config) {\n\tvar opts spotify.PlayOptions\n\topts.DeviceID = &conf.DeviceID\n\tif err := conf.Client.PauseOpt(&opts); err != nil {\n\t\tglog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "d8e34d6c7273dc421ab650bfc068cbad", "score": "0.66679114", "text": "func (p *Player) Pause() {\n\tspeaker.Lock()\n\tp.c.Paused = true\n\tspeaker.Unlock()\n}", "title": "" }, { "docid": "8f9b6412c9e0c4b53ede81b03859e264", "score": "0.66481364", "text": "func (w *pauseWriter) pause() {\n\tw.pauseC <- struct{}{}\n}", "title": "" }, { "docid": "acc00609f469192590a2fbaa2b247e9f", "score": "0.6633204", "text": "func (m BaseModule) Pause(on bool) {\n\tif on {\n\t\tm.control <- EngineTypes.PAUSE // pause\n\t} else {\n\t\tm.control <- EngineTypes.START // unpouse\n\t}\n}", "title": "" }, { "docid": "26d13f551f4df1b7aaefc3f6f61c6398", "score": "0.6628767", "text": "func (p *Player) Pause() {\n\tp.call(\"Player.Pause\")\n}", "title": "" }, { "docid": "582c80f4d2c05e350dd4492ddef1b482", "score": "0.6582435", "text": "func (vid *VideoPlayer) Pause() {\n\tif Config.Debug {\n\t\tdefer log.Println(\"camera-id: \", vid.Camstr, \" recording: \", \" Stop StreamVideo\")\n\t}\n\tvid.Recording = false\n}", "title": "" }, { "docid": "3d48e5cf210ff0b95fa3721d7b43974a", "score": "0.65333766", "text": "func (instance *VLC) ForcePause() (err error) {\n\t_, err = instance.RequestMaker(\"/requests/status.json?command=pl_forcepause\")\n\treturn\n}", "title": "" }, { "docid": "2c82ce89c89d52164e36ed3ad98df023", "score": "0.646527", "text": "func (s *StatusbarWidget) SetPause(pause bool) {\n\ts.pause = pause\n}", "title": "" }, { "docid": "310bb4a7c21424ff03b6868c4ff49045", "score": "0.64496887", "text": "func (v *Video) Pause(ctx context.Context) error {\n\tif err := v.conn.Call(ctx, nil, v.generateExpr(pauseVideo)); err != nil {\n\t\treturn errors.Wrap(err, \"failed to pause video\")\n\t}\n\n\tif isPlaying, err := v.IsPlaying(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to check if video is playing\")\n\t} else if isPlaying {\n\t\treturn errors.New(\"video is not paused\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3f22a28a6eb39bccd7122038158f004a", "score": "0.64324087", "text": "func (p *Player) Pause() {\n\tp.pause <- struct{}{}\n}", "title": "" }, { "docid": "3fbfce223995b0d18abfbc8fe1f0e5dd", "score": "0.641416", "text": "func (o *ImageCommitParams) SetPause(pause *bool) {\n\to.Pause = pause\n}", "title": "" }, { "docid": "706e56dcfe2ae21bbce3d4d0de630dbf", "score": "0.63526446", "text": "func (instance *VLC) Pause(itemID ...int) (err error) {\n\t// Check variadic arguments and form urlSegment\n\tif len(itemID) > 1 {\n\t\terr = errors.New(\"please provide only up to one ID\")\n\t\treturn\n\t}\n\turlSegment := \"/requests/status.json?command=pl_pause\"\n\tif len(itemID) == 1 {\n\t\turlSegment = urlSegment + \"&id=\" + strconv.Itoa(itemID[0])\n\t}\n\t_, err = instance.RequestMaker(urlSegment)\n\treturn\n}", "title": "" }, { "docid": "4bd3cd41b5cbe73826e1981af3f726e2", "score": "0.6338066", "text": "func (c *ipamController) pause() func() {\n\tdoneChan := make(chan struct{})\n\tpauseConfirmed := make(chan struct{})\n\tc.pauseRequestChannel <- pauseRequest{doneChan: doneChan, pauseConfirmed: pauseConfirmed}\n\t<-pauseConfirmed\n\treturn func() {\n\t\tdoneChan <- struct{}{}\n\t}\n}", "title": "" }, { "docid": "0f8aff3778e1628b581d644975fa9c40", "score": "0.6304123", "text": "func (*HTMLAudioElement) Pause() {\n\tmacro.Rewrite(\"$_.pause()\")\n}", "title": "" }, { "docid": "0c056624a5c03cb31b45e050b5376232", "score": "0.62888116", "text": "func (o *HintedHandoffPausePostParams) SetPause(pause bool) {\n\to.Pause = pause\n}", "title": "" }, { "docid": "e65f251149529f6e5eb65c3905c5d9e1", "score": "0.6286758", "text": "func (_Lendingpool *LendingpoolSession) SetPause(val bool) (*types.Transaction, error) {\n\treturn _Lendingpool.Contract.SetPause(&_Lendingpool.TransactOpts, val)\n}", "title": "" }, { "docid": "1c0a890458a3c16f9db7e9153146a6ce", "score": "0.6229263", "text": "func (ad *ActivityDump) pause() error {\n\tif ad.state <= Paused {\n\t\t// nothing to do\n\t\treturn nil\n\t}\n\tad.state = Paused\n\n\tad.LoadConfig.Paused = 1\n\tif err := ad.adm.activityDumpsConfigMap.Put(ad.LoadConfigCookie, ad.LoadConfig); err != nil {\n\t\treturn fmt.Errorf(\"failed to pause activity dump [%s]: %w\", ad.getSelectorStr(), err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d08d8341e60deb0ce01a9ab5d7922b0d", "score": "0.6221978", "text": "func Pause()", "title": "" }, { "docid": "da193a95e241172c69b7b724922f5521", "score": "0.6206244", "text": "func (_Lendingpool *LendingpoolTransactorSession) SetPause(val bool) (*types.Transaction, error) {\n\treturn _Lendingpool.Contract.SetPause(&_Lendingpool.TransactOpts, val)\n}", "title": "" }, { "docid": "d207689e81945cae039673924be9b78b", "score": "0.61815214", "text": "func (t *Timer) Pause() {\n\tif t.Paused {\n\t\treturn\n\t}\n\tt.Elapsed = t.Elapse()\n\tt.Then = time.Now().UTC().UnixNano()\n\tt.Paused = true\n}", "title": "" }, { "docid": "079b2434275939084972e1ce180a0260", "score": "0.6174603", "text": "func PlayPause(ctx context.Context) error {\n\treturn audObj.CallWithContext(ctx, \"org.atheme.audacious.PlayPause\", 0).Err\n}", "title": "" }, { "docid": "e47bd314de2a1f7b6ab62b5d5b6f2a40", "score": "0.61633843", "text": "func (tv *LgTv) Pause() error {\n\treturn tv.doRequest(uriPause, nil, nil)\n}", "title": "" }, { "docid": "6ee8e36069225df625f14b2410a1e2e5", "score": "0.6161519", "text": "func (i *Info) Pause() {\n\ti.lastTime = time.Now()\n\ti.Status = statPause\n\tinfos.Store(i.taskName, *i)\n}", "title": "" }, { "docid": "cb13f3e54735bdb358d4ff19bc67b213", "score": "0.61467165", "text": "func (_Controller *ControllerTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Controller.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "4bf6b717359c993b4243854a99b62266", "score": "0.6146111", "text": "func (me *MultiExecutor) Pause() {\n\tme.Start(kPauseTask)\n}", "title": "" }, { "docid": "29efb04789afc7e99579b6b3ea6dc856", "score": "0.6133305", "text": "func (anim *Animation) Pause() {\n\tanim.playing = false\n}", "title": "" }, { "docid": "c27ff3fae7bbeb82a535cef088c0926c", "score": "0.61293906", "text": "func (p *audioPool) pause(source *Source) {\n\tif source == nil {\n\t\tfor _, source := range p.playing {\n\t\t\tsource.Pause()\n\t\t}\n\t} else {\n\t\tsource.Pause()\n\t}\n}", "title": "" }, { "docid": "80ef33766e0a43209ae6e29622659370", "score": "0.6120001", "text": "func (a *Adminz) doPause() bool {\n\twas := a.running\n\tif a.running {\n\t\tif a.onpause != nil {\n\t\t\ta.onpause()\n\t\t}\n\t\ta.running = false\n\t}\n\treturn was\n}", "title": "" }, { "docid": "3210d9ecb1168df83bb4f47f94614c6d", "score": "0.61198", "text": "func (_Staking *StakingTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Staking.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "2b74ded79b552f818c057427f08171fc", "score": "0.6114653", "text": "func (rc *Revision) Pause() {\n\trc.mu.Lock()\n\trc.paused = true\n\trc.mu.Unlock()\n}", "title": "" }, { "docid": "4ed25c96702e10c887cfe8282fb74e34", "score": "0.6100205", "text": "func Pause() {\n\tif !serverPaused {\n\t\tserverPaused = true\n\t}\n}", "title": "" }, { "docid": "dfd5423bd540656460b71bad34cb0722", "score": "0.6093012", "text": "func (_IOTX *IOTXTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IOTX.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "1f001ffd05070bc849b4c9c4e49ae3a6", "score": "0.6039875", "text": "func (_Staking *StakingSession) Pause() (*types.Transaction, error) {\n\treturn _Staking.Contract.Pause(&_Staking.TransactOpts)\n}", "title": "" }, { "docid": "d1355f7acd633d2d9fb80838be5ce674", "score": "0.60353553", "text": "func Pause(fx trees.EventHandler, selectorOverride string) *trees.Event {\n\treturn trees.NewEvent(\"pause\", selectorOverride, fx)\n}", "title": "" }, { "docid": "024be510b4941ffe5bf6e9f1c767a8ee", "score": "0.60346633", "text": "func (c *actionImp) SetPaused(b bool) {\n\tc.Set(\"paused\", b)\n}", "title": "" }, { "docid": "02bf8bef344765838c7ef8798edf0bfb", "score": "0.6023679", "text": "func pause() tea.Msg {\n\ttime.Sleep(time.Millisecond * 600)\n\treturn DoneMsg{}\n}", "title": "" }, { "docid": "b4f0e836768bc8bdd44dc166d5ac8dd7", "score": "0.60082155", "text": "func (_Identity *IdentityTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Identity.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "2435db998117dc83811806a4a904b7e8", "score": "0.60041595", "text": "func (p *player) resume() {\n\tp.mtx.Lock()\n\tdefer p.mtx.Unlock()\n\tp.ctrl.Paused = false\n\tgo p.callOnChange()\n}", "title": "" }, { "docid": "842b5d4cb63a97bf88b422c9ac57e143", "score": "0.5986531", "text": "func Pause() {\n\tpaused = true\n\n\tif console.IsTTY {\n\t\tupdate()\n\t}\n}", "title": "" }, { "docid": "09020ab12ab8a98d32943692e8410a01", "score": "0.5986002", "text": "func (_BaasToken *BaasTokenSession) SetPause(pause bool) (*types.Transaction, error) {\n\treturn _BaasToken.Contract.SetPause(&_BaasToken.TransactOpts, pause)\n}", "title": "" }, { "docid": "64861c6f054ae8fe1bff11dbb03145ff", "score": "0.59556836", "text": "func (_Lendingpool *LendingpoolTransactor) SetPause(opts *bind.TransactOpts, val bool) (*types.Transaction, error) {\n\treturn _Lendingpool.contract.Transact(opts, \"setPause\", val)\n}", "title": "" }, { "docid": "bf90247df9ba28e6af18c296ad6e56f9", "score": "0.59487396", "text": "func (_BaasToken *BaasTokenTransactorSession) SetPause(pause bool) (*types.Transaction, error) {\n\treturn _BaasToken.Contract.SetPause(&_BaasToken.TransactOpts, pause)\n}", "title": "" }, { "docid": "7a2eca97d19b202cdb1dbe5470944e39", "score": "0.5942435", "text": "func (s *FFMPEGSession) SetPaused(p bool) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\t// paused == true will break the stream loop\n\ts.paused = p\n\tif p == false {\n\t\tgo s.StartStream()\n\t}\n}", "title": "" }, { "docid": "cc23640def813991253a41a547935375", "score": "0.59214693", "text": "func (_Controller *ControllerSession) Pause() (*types.Transaction, error) {\n\treturn _Controller.Contract.Pause(&_Controller.TransactOpts)\n}", "title": "" }, { "docid": "b3aa797d3a720dbb356037e44b6aa838", "score": "0.59179145", "text": "func (c *DockerContainer) Pause() error {\n\tst, err := c.State()\n\tif err != nil {\n\t\treturn err\n\t} else if st == Paused {\n\t\treturn nil\n\t}\n\n\tif err := c.client.PauseContainer(c.container.ID); err != nil {\n\t\tlog.Printf(\"failed to pause container with error %v\\n\", err)\n\t\treturn c.dockerError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "872f67204914d35d4dd85a4f43694a92", "score": "0.5912199", "text": "func (_Staking *StakingTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _Staking.Contract.Pause(&_Staking.TransactOpts)\n}", "title": "" }, { "docid": "6ecc71e5633e01fa9950044783f12483", "score": "0.59057426", "text": "func (_RollupAdminFacet *RollupAdminFacetTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupAdminFacet.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "329031393fdaad2c41220697c3382b2f", "score": "0.59036183", "text": "func (gid *GID) Pause() error {\n\treturn gid.client.Pause(gid.GID)\n}", "title": "" }, { "docid": "14f308e11deed5e7827d71ad3ec389e5", "score": "0.5874165", "text": "func (_Identity *IdentitySession) Pause() (*types.Transaction, error) {\n\treturn _Identity.Contract.Pause(&_Identity.TransactOpts)\n}", "title": "" }, { "docid": "4f689dc588881aaeaa967b99683f4ec6", "score": "0.58546644", "text": "func (a *Adminz) Pause() bool {\n\ta.Lock()\n\tdefer a.Unlock()\n\treturn a.doPause()\n}", "title": "" }, { "docid": "f24ab88282759a6e6bd383154ddf501f", "score": "0.5843798", "text": "func (_IOTX *IOTXSession) Pause() (*types.Transaction, error) {\n\treturn _IOTX.Contract.Pause(&_IOTX.TransactOpts)\n}", "title": "" }, { "docid": "3dedde41470a9f9b937ace649ee7db8e", "score": "0.58429354", "text": "func (wm *WatchManager) Pause() error {\n\twm.startedMux.Lock()\n\tdefer wm.startedMux.Unlock()\n\tif wm.started {\n\t\tclose(wm.stopper)\n\t\twm.stopper = make(chan struct{})\n\t\tselect {\n\t\tcase <-wm.stopped:\n\t\tcase <-time.After(10 * time.Second):\n\t\t\treturn errors.New(\"timeout waiting for watch manager to pause\")\n\t\t}\n\t}\n\twm.paused = true\n\treturn nil\n}", "title": "" }, { "docid": "ca2ff60313a7824e00d287a01427198b", "score": "0.5816113", "text": "func (p *Player) Resume() {\n\tspeaker.Lock()\n\tp.c.Paused = false\n\tspeaker.Unlock()\n}", "title": "" }, { "docid": "83b4dee3886b9eb4a3e52d7844f80f02", "score": "0.58099", "text": "func c_pause() _C_int", "title": "" }, { "docid": "cee7047b2225f492f292574f88548859", "score": "0.5807759", "text": "func PauseText() {\n\ttext.paused = true\n}", "title": "" }, { "docid": "66ab9b5e1362b64d150b48cdad4ff5be", "score": "0.57985616", "text": "func (_LifCrowdsale *LifCrowdsaleTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _LifCrowdsale.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "5c7fc2619a6b2a22ebcb329597808e01", "score": "0.5789283", "text": "func (_Identity *IdentityTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _Identity.Contract.Pause(&_Identity.TransactOpts)\n}", "title": "" }, { "docid": "8acb22e087865aa48d137b99e6a5d1c4", "score": "0.5784924", "text": "func (_BaasToken *BaasTokenTransactor) SetPause(opts *bind.TransactOpts, pause bool) (*types.Transaction, error) {\n\treturn _BaasToken.contract.Transact(opts, \"setPause\", pause)\n}", "title": "" }, { "docid": "16af788add3d44751303681c0d00e002", "score": "0.578442", "text": "func (m *MonitoringCheck) SetPaused(val bool) {\n\tm.pausedField = val\n}", "title": "" }, { "docid": "a99c7e9d5ec237c8a92de3bc7524bf1d", "score": "0.577544", "text": "func (e *Engine) Pause() {\n\te.server.Pause.RLock()\n}", "title": "" }, { "docid": "2f5b4b3740fa5c819c631ee84795011c", "score": "0.57718396", "text": "func (_Controller *ControllerTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _Controller.Contract.Pause(&_Controller.TransactOpts)\n}", "title": "" }, { "docid": "d503b1295cd7bd7a46f4b1846d6dc760", "score": "0.5769834", "text": "func (m *MultiChannelledLog) Pause() {\n\tm.paused <- true\n}", "title": "" }, { "docid": "cd89eddafee7ed150f9628b1602b703f", "score": "0.5769649", "text": "func (k *KafkaBroker) Pause(ctx context.Context, request PauseOnTopicRequest) error {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"Kafka.Pause\")\n\tdefer span.Finish()\n\n\tmessageBrokerOperationCount.WithLabelValues(env, Kafka, \"Pause\").Inc()\n\n\tstartTime := time.Now()\n\tdefer func() {\n\t\tmessageBrokerOperationTimeTaken.WithLabelValues(env, Kafka, \"Pause\").Observe(time.Now().Sub(startTime).Seconds())\n\t}()\n\n\ttp := kafkapkg.TopicPartition{\n\t\tTopic: &request.Topic,\n\t\tPartition: request.Partition,\n\t}\n\n\ttps := make([]kafkapkg.TopicPartition, 0)\n\ttps = append(tps, tp)\n\n\treturn k.Consumer.Pause(tps)\n}", "title": "" }, { "docid": "7c3b83060d3e2f29f8970793930ab5be", "score": "0.5743373", "text": "func (_IOTX *IOTXTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _IOTX.Contract.Pause(&_IOTX.TransactOpts)\n}", "title": "" }, { "docid": "d732245c77820a25b10f995f4a5f3dd8", "score": "0.5728853", "text": "func (lt *LTimer) Pause() {\n\t//If the timer is running and isn't already paused\n\tif lt.mStarted && !lt.mPaused {\n\t\t//Pause the timer\n\t\tlt.mPaused = true\n\n\t\t//Calculate the paused ticks\n\t\tlt.mPausedTicks = sdl.GetTicks() - lt.mStartTicks\n\t\tlt.mStartTicks = 0\n\t}\n}", "title": "" }, { "docid": "15035ac4b44a7bb9086064f84b7a7937", "score": "0.5723411", "text": "func (this *BeanstalkdClient) PauseTube(tube string, delay int) error {\n\tcmd := fmt.Sprintf(\"pause-tube %s %d\\r\\n\", tube, delay)\n\t_, reply, err := this.sendReply(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = fmt.Sscanf(reply, \"PAUSED\\r\\n\")\n\tif err != nil {\n\t\treturn errors.New(reply)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5da841a129a8c99419d4da00038be754", "score": "0.57192445", "text": "func (p *Player) Resume() {\n\tp.play <- struct{}{}\n}", "title": "" }, { "docid": "f8fb6090caab34e1737363ce8691bdda", "score": "0.5718128", "text": "func (_LifCrowdsale *LifCrowdsaleSession) Pause() (*types.Transaction, error) {\n\treturn _LifCrowdsale.Contract.Pause(&_LifCrowdsale.TransactOpts)\n}", "title": "" }, { "docid": "edc52b0a68ff22b77e1a01e5df635f02", "score": "0.57078546", "text": "func (t *Tokens) PauseUsersPlayback() error {\n\t/**\n\thttps://developer.spotify.com/web-api/pause-a-users-playback/\n\t*/\n\n\tendpoint := \"https://api.spotify.com/v1/me/player/pause\"\n\n\tres, err := extensions.PutRequest(endpoint, t.AccessToken)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res != values.NoContent {\n\t\treturn fmt.Errorf(\"%d\", res)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4b25905149372143305e1e90368a79ce", "score": "0.5698203", "text": "func (r *Relay) Pause() {\n\tif r.IsClosed() {\n\t\tr.logger.Warn(\"try to pause, but already closed\")\n\t\treturn\n\t}\n\n\tr.stopSync()\n}", "title": "" }, { "docid": "c1967f8742dbdf7c4323f89de3c717e2", "score": "0.5691392", "text": "func (tm *Metric) Pause() {\n\ttm.mtx.Lock()\n\tdefer tm.mtx.Unlock()\n\n\t// Pause the metric for now\n\ttm.paused = true\n}", "title": "" }, { "docid": "cb60c43f3db8603797b410a2a01e7971", "score": "0.56797993", "text": "func (suite *PouchPauseSuite) TestPauseWorks(c *check.C) {\n\tname := \"pause-normal\"\n\tres := command.PouchRun(\"create\", \"--name\", name, busyboxImage, \"top\")\n\tdefer DelContainerForceMultyTime(c, name)\n\tres.Assert(c, icmd.Success)\n\n\tcommand.PouchRun(\"start\", name).Assert(c, icmd.Success)\n\n\tcommand.PouchRun(\"pause\", name).Assert(c, icmd.Success)\n}", "title": "" }, { "docid": "213073e866554061a7af122825b550aa", "score": "0.5671972", "text": "func Pause(c Client) error {\n\tn := ConfigValue(SPOTIFY_DEVICE_NAME)\n\tds, err := c.PlayerDevices()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tactiveID := activePlayerId(&ds)\n\tif activeID == \"\" {\n\t\treturn nil\n\t}\n\n\tplayerID := diskplayerId(&ds, n)\n\tif playerID == \"\" {\n\t\treturn fmt.Errorf(\"client identified by %s not found\", n)\n\t}\n\n\tif activeID == playerID {\n\t\terr := c.Pause()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9b9fdc04e31b08830fdf33778444791d", "score": "0.5668283", "text": "func Pause(f dom.Listener) dom.Aspect {\n\treturn dom.Event(\"pause\", f)\n}", "title": "" }, { "docid": "c4e42db6d263b1c123a7c0e0d3d4f391", "score": "0.56674165", "text": "func testPause(ctx context.Context, t *testing.T, profile string) {\n\tt.Helper()\n\tdefer PostMortemLogs(t, profile)\n\n\trr, err := Run(t, exec.CommandContext(ctx, Target(), \"pause\", \"-p\", profile, \"--alsologtostderr\", \"-v=1\"))\n\tif err != nil {\n\t\tt.Fatalf(\"%s failed: %v\", rr.Command(), err)\n\t}\n\n\tgot := Status(ctx, t, Target(), profile, \"APIServer\", profile)\n\tif got != state.Paused.String() {\n\t\tt.Errorf(\"post-pause apiserver status = %q; want = %q\", got, state.Paused)\n\t}\n\n\tgot = Status(ctx, t, Target(), profile, \"Kubelet\", profile)\n\tif got != state.Stopped.String() {\n\t\tt.Errorf(\"post-pause kubelet status = %q; want = %q\", got, state.Stopped)\n\t}\n\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), \"unpause\", \"-p\", profile, \"--alsologtostderr\", \"-v=1\"))\n\tif err != nil {\n\t\tt.Fatalf(\"%s failed: %v\", rr.Command(), err)\n\t}\n\n\tgot = Status(ctx, t, Target(), profile, \"APIServer\", profile)\n\tif got != state.Running.String() {\n\t\tt.Errorf(\"post-unpause apiserver status = %q; want = %q\", got, state.Running)\n\t}\n\n\tgot = Status(ctx, t, Target(), profile, \"Kubelet\", profile)\n\tif got != state.Running.String() {\n\t\tt.Errorf(\"post-unpause kubelet status = %q; want = %q\", got, state.Running)\n\t}\n\n}", "title": "" }, { "docid": "0e8efb68bf3ed108def0e10f882f144f", "score": "0.5666157", "text": "func (s *Service) Pause() error {\n\treturn s.eachContainer(func(c *Container) error {\n\t\treturn c.Pause()\n\t})\n}", "title": "" }, { "docid": "b0a153b7d216feb163fec07ebc80e4dc", "score": "0.5658164", "text": "func (s *Store) Pause() error {\n\ts.RWMutex.Lock()\n\tdefer s.RWMutex.Unlock()\n\n\ts.paused = true\n\t// stop dump job\n\tsch.SVC.RemoveFunc(syncJobName)\n\n\treturn nil\n}", "title": "" }, { "docid": "434634e80f83067cff3060db2c4a85c2", "score": "0.56369203", "text": "func (r *RuncDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error) {\n\treturn utils.ExecTimedCmd(ctx, r.runcBinary, \"pause \"+ctr.Name())\n}", "title": "" }, { "docid": "c2fdb4c773d22cd2a79a3e47e871f163", "score": "0.56097025", "text": "func (_RollupAdminFacet *RollupAdminFacetSession) Pause() (*types.Transaction, error) {\n\treturn _RollupAdminFacet.Contract.Pause(&_RollupAdminFacet.TransactOpts)\n}", "title": "" }, { "docid": "19e9205083bcb951d0f69242b2e964df", "score": "0.56085324", "text": "func (sched0 *sched[R, T]) Pause() {\n\tatomic.AddUint64(&sched0.pausing, 1)\n\tsched0.pause()\n}", "title": "" }, { "docid": "4dca40e192ff234193e6b748c7ce2705", "score": "0.5607418", "text": "func (_RollupAdminFacet *RollupAdminFacetTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _RollupAdminFacet.Contract.Pause(&_RollupAdminFacet.TransactOpts)\n}", "title": "" }, { "docid": "81262e18fbf639e62d088a57cc29c6ae", "score": "0.56022215", "text": "func (_LifCrowdsale *LifCrowdsaleTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _LifCrowdsale.Contract.Pause(&_LifCrowdsale.TransactOpts)\n}", "title": "" }, { "docid": "e4d6c77c38366099a89dfa06564d884d", "score": "0.5595576", "text": "func (c *container) pause(vm *VirtualMachine) {\n\tif c.id == \"\" {\n\t\treturn\n\t}\n\n\tcmd := exec.Command(\"docker\", \"pause\", c.id)\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Printf(\"%s %s: %s\", vm.Name, cmd.Args, err)\n\t}\n}", "title": "" }, { "docid": "1b258ea6fe4a8af742cbd8251181c824", "score": "0.5583243", "text": "func (se *SingleExecutor) Pause() {\n\t(*MultiExecutor)(se).Pause()\n}", "title": "" }, { "docid": "1bbbfde33381f9915c5cf24c6fab9632", "score": "0.55741954", "text": "func (mr *MockEngineMockRecorder) Pause() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Pause\", reflect.TypeOf((*MockEngine)(nil).Pause))\n}", "title": "" }, { "docid": "8e824c8db66f6fcb49fe491ffb6c6d2b", "score": "0.55641955", "text": "func IsPaused(annotations map[string]string) bool {\n\tif annotations == nil {\n\t\treturn false\n\t}\n\n\tif annotations[AnnotationMCOPause] != \"\" &&\n\t\tstrings.EqualFold(annotations[AnnotationMCOPause], \"true\") {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8a4f38c9f8950064ec0edd4bcdeed331", "score": "0.55549425", "text": "func (s *DockerSandbox) Pause() error {\n\tif err := s.client.PauseContainer(s.container.ID); err != nil {\n\t\tlog.Printf(\"failed to pause container with error %v\\n\", err)\n\t\treturn s.dockerError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0a2d3799f0fa2a440959f41036a9c26a", "score": "0.55441624", "text": "func Pause(cmd *cobra.Command, _ []string) error {\n\tvar r *rpc.PauseResponse\n\tvar err error\n\terr = withDaemon(func(d rpc.DaemonClient) error {\n\t\tr, err = d.Pause(context.Background(), &rpc.Empty{})\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tstderr := cmd.OutOrStderr()\n\tswitch r.Error {\n\tcase rpc.PauseResponse_Ok:\n\t\tstdout := cmd.OutOrStdout()\n\t\tfmt.Fprintln(stdout, \"Network overrides paused.\")\n\t\tfmt.Fprintln(stdout, `Use \"edgectl resume\" to reestablish network overrides.`)\n\t\treturn nil\n\tcase rpc.PauseResponse_AlreadyPaused:\n\t\tfmt.Fprintln(stderr, \"Network overrides are already paused\")\n\tcase rpc.PauseResponse_ConnectedToCluster:\n\t\tfmt.Fprintln(stderr, \"Edge Control is connected to a cluster.\")\n\t\tfmt.Fprintln(stderr, \"See \\\"edgectl status\\\" for details.\")\n\t\tfmt.Fprintln(stderr, \"Please disconnect before pausing.\")\n\tdefault:\n\t\tfmt.Fprintf(stderr, \"Unexpected error while pausing: %v\\n\", r.ErrorText)\n\t}\n\tos.Exit(1)\n\treturn nil\n}", "title": "" }, { "docid": "0a954c33e31ffdf5d9bc430bce2b8364", "score": "0.55369276", "text": "func Pause(listener gr.Listener) *gr.EventListener {\n\treturn gr.NewEventListener(\"onPause\", listener)\n}", "title": "" }, { "docid": "37595f5cb88bb1903544d14a8961709d", "score": "0.55339384", "text": "func (*HTMLAudioElement) Paused() (paused bool) {\n\tmacro.Rewrite(\"$_.paused\")\n\treturn paused\n}", "title": "" }, { "docid": "e35742df7b92fa7abd8efd7f93fa9c2a", "score": "0.55198723", "text": "func (s *sched[R, T]) pause() {\n\told := atomic.LoadPointer(&s.timer)\n\t// if old is nil then there is someone who tries to stop the timer.\n\tif old != nil {\n\t\t(*time.Timer)(old).Stop()\n\t}\n}", "title": "" }, { "docid": "84ce63d07136fd9b2d4f9f66e16491d2", "score": "0.5506044", "text": "func (p *Player) TogglePlayback() {\n\tspeaker.Lock()\n\tp.c.Paused = !p.c.Paused\n\tspeaker.Unlock()\n}", "title": "" }, { "docid": "b8b7f6ebf8d90706ef4870f2202faff5", "score": "0.5491476", "text": "func (c *Container) Pause() error {\n\tlog.Debugf(\"Pausing container %q\", c.ID)\n\tif err := c.Saver.lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer c.Saver.unlock()\n\n\tif c.Status != Created && c.Status != Running {\n\t\treturn fmt.Errorf(\"cannot pause container %q in state %v\", c.ID, c.Status)\n\t}\n\n\tif err := c.Sandbox.Pause(c.ID); err != nil {\n\t\treturn fmt.Errorf(\"pausing container: %v\", err)\n\t}\n\tc.changeStatus(Paused)\n\treturn c.saveLocked()\n}", "title": "" }, { "docid": "7ddb2ee41392673061519f3c23d2bbdc", "score": "0.5487742", "text": "func (a *Animation) Resume() {\n\ta.paused = false\n}", "title": "" } ]
42c706bb0478938bcee9653970f55ddc
ToSnake maps from CamelCase to snake_case.
[ { "docid": "e1befc99f0a05b93a31a567d0cb68b7b", "score": "0.7934217", "text": "func ToSnake(s string) string {\n\tvar res []string\n\trunes := []rune(s)\n\tfor start := len(runes) - 1; start >= 0; start-- {\n\t\tend := start\n\t\tlower := unicode.IsLower(runes[end])\n\t\tfor start > 0 && lower == unicode.IsLower(runes[start-1]) {\n\t\t\tstart--\n\t\t}\n\t\tif start > 0 && lower {\n\t\t\tstart--\n\t\t}\n\t\tres = append(res, string(runes[start:end+1]))\n\t}\n\tfor i := range res[:len(res)/2] {\n\t\tres[i], res[len(res)-1-i] = res[len(res)-1-i], res[i]\n\t}\n\treturn strings.ToLower(strings.Join(res, \"_\"))\n}", "title": "" } ]
[ { "docid": "3621184364ed152afab009b278030300", "score": "0.8110677", "text": "func (c *Caser) ToSnake(s string) string {\n\treturn convert(s, c.splitFn, '_', LowerCase, c.initialisms)\n}", "title": "" }, { "docid": "e3e5f7743244b821ecaceecdc97aec77", "score": "0.801258", "text": "func ToSnakeCase(s string) string {\n\treturn snakeCaseRegex.ReplaceAllString(s, \"_\")\n}", "title": "" }, { "docid": "2da5cc51035d113283f3158af0faf401", "score": "0.7975348", "text": "func ToSnakeCase(s string) string {\n\treturn strcase.SnakeCase(s)\n}", "title": "" }, { "docid": "8afb8be8f77c03682a5541c99353c2ba", "score": "0.7904334", "text": "func ToSnakeCase(str string) string {\n\tmatchFirstCap := regexp.MustCompile(\"(.)([A-Z][a-z]+)\")\n\tmatchAllCap := regexp.MustCompile(\"([a-z0-9])([A-Z])\")\n\tmatchAllSpaces := regexp.MustCompile(\"(\\\\s)\")\n\tcleanUpHack := regexp.MustCompile(\"i_ds\")\n\n\tsnake := matchFirstCap.ReplaceAllString(str, \"${1}_${2}\")\n\tsnake = matchAllCap.ReplaceAllString(snake, \"${1}_${2}\")\n\tsnake = matchAllSpaces.ReplaceAllString(snake, \"_\")\n\tsnake = strings.ToLower(snake)\n\tsnake = cleanUpHack.ReplaceAllString(snake, \"ids\")\n\n\treturn snake\n}", "title": "" }, { "docid": "7ce41bc15715776d4ee3842196d40cbc", "score": "0.78843457", "text": "func ToSnake(in string) string {\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tout = append(out, unicode.ToLower(runes[i]))\n\t}\n\n\treturn string(out)\n}", "title": "" }, { "docid": "7ce41bc15715776d4ee3842196d40cbc", "score": "0.78843457", "text": "func ToSnake(in string) string {\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tout = append(out, unicode.ToLower(runes[i]))\n\t}\n\n\treturn string(out)\n}", "title": "" }, { "docid": "7ce41bc15715776d4ee3842196d40cbc", "score": "0.78843457", "text": "func ToSnake(in string) string {\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tout = append(out, unicode.ToLower(runes[i]))\n\t}\n\n\treturn string(out)\n}", "title": "" }, { "docid": "7ce41bc15715776d4ee3842196d40cbc", "score": "0.78843457", "text": "func ToSnake(in string) string {\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tout = append(out, unicode.ToLower(runes[i]))\n\t}\n\n\treturn string(out)\n}", "title": "" }, { "docid": "8f96c460788e9763b42cab7a4d6d8902", "score": "0.78659105", "text": "func ToSnakeCase(s string) string {\n\tif len(s) == 0 {\n\t\treturn s\n\t}\n\tvar runes = []rune(s)\n\tvar str = []rune{unicode.ToLower(runes[0])}\n\tif len(runes) == 1 {\n\t\treturn string(str)\n\t}\n\tfor i := 1; i < len(runes)-1; i++ {\n\t\tprevious := runes[i-1]\n\t\tcurrent := runes[i]\n\t\tnext := runes[i+1]\n\t\tif unicode.IsUpper(current) {\n\t\t\tif !unicode.IsUpper(next) || !unicode.IsUpper(previous) {\n\t\t\t\tstr = append(str, '_')\n\t\t\t}\n\t\t\tstr = append(str, unicode.ToLower(current))\n\t\t} else {\n\t\t\tstr = append(str, runes[i])\n\t\t}\n\t}\n\tstr = append(str, unicode.ToLower(runes[len(runes)-1]))\n\treturn string(str)\n}", "title": "" }, { "docid": "2775a56e034d9f2419e935179bf560f6", "score": "0.7851002", "text": "func ToSnakeCase(s string) string {\n\n\t// Convert.\n\t\tresult := strings.Map(\n\t\t\tfunc(r rune) rune {\n\n\t\t\t\tif whitespace.IsWhitespace(r) || '-' == r {\n\t\t\t\t\treturn '_'\n\t\t\t\t} else {\n\t\t\t\t\treturn unicode.ToLower(r)\n\t\t\t\t}\n\t\t\t},\n\t\t\ts)\n\n\t// Return\n\t\treturn result\n}", "title": "" }, { "docid": "f8c94cc555ecba0159eef30b5bf5cc44", "score": "0.7785869", "text": "func toSnakeCase(input string) string {\n\toutput := rxMatchFirstCap.ReplaceAllString(input, \"${1}_${2}\")\n\toutput = rxMatchAllCap.ReplaceAllString(output, \"${1}_${2}\")\n\toutput = strings.ReplaceAll(output, \"-\", \"_\")\n\treturn strings.ToLower(output)\n}", "title": "" }, { "docid": "8501512702ee67766fd6e9fc4b8d5709", "score": "0.7776233", "text": "func ToSnake(in string) string {\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tif unicode.IsLetter(runes[i]) || unicode.IsDigit(runes[i]) {\n\t\t\tout = append(out, unicode.ToLower(runes[i]))\n\t\t} else {\n\t\t\tout = append(out, '_')\n\t\t}\n\t}\n\n\treturn string(out)\n}", "title": "" }, { "docid": "d69546eb8eb9bcf10f48f9043cb81bdc", "score": "0.7756991", "text": "func ToSnakeCase(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tvar result bytes.Buffer\n\tresult.WriteRune(unicode.ToLower(rune(s[0])))\n\tfor _, c := range s[1:] {\n\t\tif unicode.IsUpper(c) {\n\t\t\tresult.WriteRune('_')\n\t\t}\n\t\tresult.WriteRune(unicode.ToLower(c))\n\t}\n\treturn result.String()\n}", "title": "" }, { "docid": "a38d4c3482ba1f5602a6b611624d5641", "score": "0.77568763", "text": "func toLowerSnakeCase(s string) string {\n\treturn strings.ToLower(strcase.SnakeCase(s))\n}", "title": "" }, { "docid": "064982861bead41667adb001efb77c19", "score": "0.7754466", "text": "func ToSnakeCase(s string) string {\n\tif !utf8.ValidString(s) {\n\t\treturn s\n\t}\n\ts = strings.TrimFunc(s, unicode.IsSpace)\n\tout := strings.Builder{}\n\tfor i := 0; i < len(s); i++ {\n\t\tswitch {\n\t\tcase unicode.IsUpper(rune(s[i])):\n\t\t\t// If the previous letter is lowercase, add '_' letter before the current letter\n\t\t\tif i > 0 {\n\t\t\t\tif unicode.IsLower(rune(s[i-1])) {\n\t\t\t\t\tout.WriteRune(SnakeDelimiter)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If the previous letter and the next letter are uppercase and lowercase, respectively, add '_' letter before the current letter\n\t\t\tif i > 0 && i < len(s)-1 {\n\t\t\t\tif unicode.IsUpper(rune(s[i-1])) && unicode.IsLower(rune(s[i+1])) {\n\t\t\t\t\tout.WriteRune(SnakeDelimiter)\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.WriteRune(unicode.ToLower(rune(s[i])))\n\t\tcase isSeparator(rune(s[i])):\n\t\t\tout.WriteRune(SnakeDelimiter)\n\t\tdefault:\n\t\t\tout.WriteByte(s[i])\n\t\t}\n\t}\n\treturn out.String()\n}", "title": "" }, { "docid": "5929eca64dda6e33f05c10ce3898101b", "score": "0.7746925", "text": "func ToSnake(s string) string {\n\tin := []rune(s)\n\tisLower := func(idx int) bool {\n\t\treturn idx >= 0 && idx < len(in) &&\n\t\t\tunicode.IsLower(in[idx])\n\t}\n\tout := make([]rune, 0, len(in)+len(in)/2)\n\tfor i, r := range in {\n\t\tif unicode.IsUpper(r) {\n\t\t\tr = unicode.ToLower(r)\n\t\t\tif i > 0 && in[i-1] != '_' && (isLower(i-1) || isLower(i+1)) {\n\t\t\t\tout = append(out, '_')\n\t\t\t}\n\t\t}\n\t\tout = append(out, r)\n\t}\n\treturn string(out)\n}", "title": "" }, { "docid": "fac3c15ef86154d8d6f74d61712b163e", "score": "0.7744475", "text": "func ToLowerSnakeCase(s string) string {\n\treturn strings.ToLower(toSnake(s))\n}", "title": "" }, { "docid": "8c5d91d532ca5821d2c5590a396138e1", "score": "0.77225095", "text": "func CamelToSnake(camelCase string) string {\n\tsnakeCase := make([]rune, 0, len(camelCase))\n\tfor _, c := range camelCase {\n\t\tif !unicode.IsLower(c) {\n\t\t\tif len(snakeCase) > 0 {\n\t\t\t\tsnakeCase = append(snakeCase, '_')\n\t\t\t}\n\t\t}\n\t\tsnakeCase = append(snakeCase, unicode.ToLower(c))\n\t}\n\treturn string(snakeCase)\n}", "title": "" }, { "docid": "93644cbfb67b001e66ebf65568024fc9", "score": "0.77141786", "text": "func ToSnake(s string) string {\n\ts = strings.Trim(s, \" \")\n\tn := \"\"\n\tfor i, v := range s {\n\t\t// treat acronyms as words, eg for JSONData -> JSON is a whole word\n\t\tnextCaseIsChanged := false\n\t\tif i+1 < len(s) {\n\t\t\tnext := s[i+1]\n\t\t\tif (isUpperLetter(v) && isLowerLetter(int32(next))) || (isLowerLetter(v) && isUpperLetter(int32(next))) {\n\t\t\t\tnextCaseIsChanged = true\n\t\t\t}\n\t\t}\n\n\t\tif i > 0 && n[len(n)-1] != '_' && nextCaseIsChanged {\n\t\t\t// add underscore if next letter case type is changed\n\t\t\tif isUpperLetter(v) {\n\t\t\t\tn += \"_\" + string(v)\n\t\t\t} else if isLowerLetter(v) {\n\t\t\t\tn += string(v) + \"_\"\n\t\t\t}\n\t\t} else if v == ' ' || v == '-' {\n\t\t\t// replace spaces and dashes with underscores\n\t\t\tn += \"_\"\n\t\t} else {\n\t\t\tn = n + string(v)\n\t\t}\n\t}\n\tn = strings.ToLower(n)\n\treturn n\n}", "title": "" }, { "docid": "74be322a92e690df78a6f9dc89fe1e82", "score": "0.76699215", "text": "func ToSnake(s string) string {\n\treturn ToDelimited(s, '_')\n}", "title": "" }, { "docid": "5dccc6e5aff776c3c784ff0661a8729d", "score": "0.76323575", "text": "func camelToSnake(input string) (output string) {\n\tfor k, v := range input {\n\t\tif unicode.IsUpper(v) {\n\t\t\tformatString := \"%c\"\n\n\t\t\tif k != 0 {\n\t\t\t\tformatString = \"_\" + formatString\n\t\t\t}\n\n\t\t\toutput += fmt.Sprintf(formatString, unicode.ToLower(v))\n\t\t} else {\n\t\t\toutput += string(v)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c55f0d0d046bdf0feb0e6cf70fa003d0", "score": "0.76233387", "text": "func ToSnake(in string) string {\n\tif len(in) == 0 {\n\t\treturn \"\"\n\t}\n\n\tout := make([]rune, 0, len(in))\n\tfoundUpper := false\n\tr := []rune(in)\n\n\tfor i := 0; i < len(r); i++ {\n\t\tch := r[i]\n\t\tif unicode.IsUpper(ch) {\n\t\t\tif i > 0 && i < len(in)-1 && !unicode.IsUpper(r[i+1]) {\n\t\t\t\tout = append(out, '_', unicode.ToLower(ch), r[i+1])\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t\tfoundUpper = false\n\t\t\t}\n\t\t\tif i > 0 && !foundUpper {\n\t\t\t\tout = append(out, '_')\n\t\t\t}\n\t\t\tout = append(out, unicode.ToLower(ch))\n\t\t\tfoundUpper = true\n\t\t} else {\n\t\t\tfoundUpper = false\n\t\t\tout = append(out, ch)\n\t\t}\n\t}\n\treturn string(out)\n}", "title": "" }, { "docid": "e0e6a67700b3b8d407a151bab0085fbc", "score": "0.754229", "text": "func SnakeToLowerCamel(s string) string {\n\tif len(s) == 0 {\n\t\treturn s\n\t}\n\tcamel := SnakeToCamel(s)\n\treturn strings.ToLower(camel[:1]) + camel[1:]\n}", "title": "" }, { "docid": "b6fcaa677eec3f610e59d15f50f3c160", "score": "0.7522181", "text": "func ToSnake(s string) string {\n\ts = addWordBoundariesToNumbers(s)\n\ts = strings.Trim(s, \" \")\n\tvar prefix string\n\tchar1 := []rune(s)[0]\n\tif char1 >= 'A' && char1 <= 'Z' {\n\t\tprefix = \"_\"\n\t} else {\n\t\tprefix = \"\"\n\t}\n\tbits := []string{}\n\tn := \"\"\n\treal_i := -1\n\n\tfor i, v := range s {\n\t\treal_i += 1\n\t\t// treat acronyms as words, eg for JSONData -> JSON is a whole word\n\t\tnextCaseIsChanged := false\n\t\tif i+1 < len(s) {\n\t\t\tnext := s[i+1]\n\t\t\tif (v >= 'A' && v <= 'Z' && next >= 'a' && next <= 'z') || (v >= 'a' && v <= 'z' && next >= 'A' && next <= 'Z') {\n\t\t\t\tnextCaseIsChanged = true\n\t\t\t}\n\t\t}\n\n\t\tif real_i > 0 && n[len(n)-1] != '_' && nextCaseIsChanged {\n\t\t\t// add underscore if next letter case type is changed\n\t\t\tif v >= 'A' && v <= 'Z' {\n\t\t\t\tbits = append(bits, strings.ToLower(n))\n\t\t\t\tn = string(v)\n\t\t\t\treal_i = 0\n\t\t\t} else if v >= 'a' && v <= 'z' {\n\t\t\t\tbits = append(bits, strings.ToLower(n+string(v)))\n\t\t\t\tn = \"\"\n\t\t\t\treal_i = -1\n\t\t\t}\n\t\t} else if v == ' ' || v == '_' || v == '-' {\n\t\t\t// replace spaces/underscores with delimiters\n\t\t\tbits = append(bits, strings.ToLower(n))\n\t\t\tn = \"\"\n\t\t\treal_i = -1\n\t\t} else {\n\t\t\tn = n + string(v)\n\t\t}\n\t}\n\tbits = append(bits, strings.ToLower(n))\n\tjoined := strings.Join(bits, \"_\")\n\tif _, ok := wordMapping[bits[0]]; !ok {\n\t\treturn prefix + joined\n\t}\n\treturn joined\n}", "title": "" }, { "docid": "b6fcaa677eec3f610e59d15f50f3c160", "score": "0.7522181", "text": "func ToSnake(s string) string {\n\ts = addWordBoundariesToNumbers(s)\n\ts = strings.Trim(s, \" \")\n\tvar prefix string\n\tchar1 := []rune(s)[0]\n\tif char1 >= 'A' && char1 <= 'Z' {\n\t\tprefix = \"_\"\n\t} else {\n\t\tprefix = \"\"\n\t}\n\tbits := []string{}\n\tn := \"\"\n\treal_i := -1\n\n\tfor i, v := range s {\n\t\treal_i += 1\n\t\t// treat acronyms as words, eg for JSONData -> JSON is a whole word\n\t\tnextCaseIsChanged := false\n\t\tif i+1 < len(s) {\n\t\t\tnext := s[i+1]\n\t\t\tif (v >= 'A' && v <= 'Z' && next >= 'a' && next <= 'z') || (v >= 'a' && v <= 'z' && next >= 'A' && next <= 'Z') {\n\t\t\t\tnextCaseIsChanged = true\n\t\t\t}\n\t\t}\n\n\t\tif real_i > 0 && n[len(n)-1] != '_' && nextCaseIsChanged {\n\t\t\t// add underscore if next letter case type is changed\n\t\t\tif v >= 'A' && v <= 'Z' {\n\t\t\t\tbits = append(bits, strings.ToLower(n))\n\t\t\t\tn = string(v)\n\t\t\t\treal_i = 0\n\t\t\t} else if v >= 'a' && v <= 'z' {\n\t\t\t\tbits = append(bits, strings.ToLower(n+string(v)))\n\t\t\t\tn = \"\"\n\t\t\t\treal_i = -1\n\t\t\t}\n\t\t} else if v == ' ' || v == '_' || v == '-' {\n\t\t\t// replace spaces/underscores with delimiters\n\t\t\tbits = append(bits, strings.ToLower(n))\n\t\t\tn = \"\"\n\t\t\treal_i = -1\n\t\t} else {\n\t\t\tn = n + string(v)\n\t\t}\n\t}\n\tbits = append(bits, strings.ToLower(n))\n\tjoined := strings.Join(bits, \"_\")\n\tif _, ok := wordMapping[bits[0]]; !ok {\n\t\treturn prefix + joined\n\t}\n\treturn joined\n}", "title": "" }, { "docid": "ad6c96ee160beb5c20bd5f3fcd92d2b7", "score": "0.7501098", "text": "func toSnake(s string) string {\n\toutput := \"\"\n\ts = strings.TrimSpace(s)\n\tfor i, c := range s {\n\t\tif i > 0 && isUpper(c) && output[len(output)-1] != '_' && ((i < len(s)-1 && !isUpper(rune(s[i+1]))) || (isLower(rune(s[i-1])))) {\n\t\t\toutput += \"_\" + string(c)\n\t\t} else {\n\t\t\toutput += string(c)\n\t\t}\n\t}\n\treturn output\n}", "title": "" }, { "docid": "cae6aeca9a44e55cb44992b6ba67a700", "score": "0.7497578", "text": "func (e *SnakeCaller) Snake(from string, s string) (string, error) {\n\tswitch from {\n\tcase \"from_camel\":\n\t\tvar firstCap = regexp.MustCompile(\"(.)([A-Z][a-z]+)\")\n\t\tvar otherCap = regexp.MustCompile(\"([a-z0-9])([A-Z])\")\n\n\t\ts = firstCap.ReplaceAllString(s, \"${1}_${2}\")\n\t\ts = otherCap.ReplaceAllString(s, \"${1}_${2}\")\n\tdefault:\n\t\treturn \"\", errors.Errorf(\"unknown convention %s\", from)\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "c6e07572529d3790d349054afbb20644", "score": "0.74151474", "text": "func (*FnWrap) ToSnakeString(s string) string {\n\tdata := make([]byte, 0, len(s)*2)\n\tj := false\n\tnum := len(s)\n\tfor i := 0; i < num; i++ {\n\t\td := s[i]\n\t\tif i > 0 && d >= 'A' && d <= 'Z' && j {\n\t\t\tdata = append(data, '_')\n\t\t}\n\t\tif d != '_' {\n\t\t\tj = true\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\treturn strings.ToLower(string(data[:]))\n}", "title": "" }, { "docid": "54d8a0784851ead1e959a4176144ae7d", "score": "0.7309427", "text": "func snakeToPascalCase(s string) string {\n\treturn tpgresource.SnakeToPascalCase(s)\n}", "title": "" }, { "docid": "48f4a994b7bbf7d84a2c9f11be104127", "score": "0.7085865", "text": "func SnakeToCamel(snakeCase string) string {\n\tcamelCase := make([]rune, 0, len(snakeCase))\n\tupper := true\n\tfor _, c := range snakeCase {\n\t\tif c == '_' {\n\t\t\tupper = true\n\t\t} else if upper {\n\t\t\tupper = false\n\t\t\tcamelCase = append(camelCase, unicode.ToUpper(c))\n\t\t} else {\n\t\t\tcamelCase = append(camelCase, unicode.ToLower(c))\n\t\t}\n\t}\n\treturn string(camelCase)\n}", "title": "" }, { "docid": "59438502dd59c41d811a4f159e9be654", "score": "0.70786536", "text": "func SnakeCase(s string) string {\n\tin := []rune(s)\n\tisLower := func(idx int) bool {\n\t\treturn idx >= 0 && idx < len(in) && unicode.IsLower(in[idx])\n\t}\n\n\tout := make([]rune, 0, len(in)+len(in)/2)\n\tfor i, r := range in {\n\t\tif unicode.IsUpper(r) {\n\t\t\tr = unicode.ToLower(r)\n\t\t\tif i > 0 && in[i-1] != '_' && (isLower(i-1) || isLower(i+1)) {\n\t\t\t\tout = append(out, '_')\n\t\t\t}\n\t\t}\n\t\tout = append(out, r)\n\t}\n\n\treturn string(out)\n}", "title": "" }, { "docid": "d5720b349e47260357ee842f3a099ea2", "score": "0.7071788", "text": "func SnakeCase(str string) string {\n\tstr = regexFirstUpper.ReplaceAllString(str, \"${1}_${2}\")\n\tstr = regexAllUpper.ReplaceAllString(str, \"${1}_${2}\")\n\tstr = strings.ToLower(str)\n\treturn strings.Replace(str, \"__\", \"_\", -1)\n}", "title": "" }, { "docid": "6fe725bbc2d12b5f61361e333ff4a3f2", "score": "0.704622", "text": "func Format2Snake(s string) string {\n\tdata := make([]byte, 0, len(s)*2)\n\tj := false\n\tnum := len(s)\n\tfor i := 0; i < num; i++ {\n\t\td := s[i]\n\t\tif i > 0 && d >= 'A' && d <= 'Z' && j {\n\t\t\tdata = append(data, '_')\n\t\t}\n\t\tif d != '_' {\n\t\t\tj = true\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\treturn strings.ToLower(string(data[:]))\n}", "title": "" }, { "docid": "11b134d1c74d73256e7297a0cf7d2b3a", "score": "0.7035702", "text": "func ToScreamingSnake(s string) string {\n\treturn ToScreamingDelimited(s, '_', true)\n}", "title": "" }, { "docid": "487f1bc4af21457be91fc23545dccffa", "score": "0.7016111", "text": "func SnakeCase(buf []byte) []byte {\n\tbuilder := createBuilder()\n\tresult := gjson.ParseBytes(buf)\n\tconvertJSON(result, strcase.ToSnake, builder)\n\treturn []byte(builder.String())\n}", "title": "" }, { "docid": "bf3cd250d2ae047791d472b4b5de41d7", "score": "0.69960886", "text": "func CamelSnake(s string) string {\n\thead, tail := headTailCount(s, '_')\n\treturn strings.Repeat(\"_\", head) + strings.Join(camel(words(s), 0), \"_\") + strings.Repeat(\"_\", tail)\n}", "title": "" }, { "docid": "49da7f969d8272524c9f90a8df456853", "score": "0.6982183", "text": "func SnakeCase(s string) string {\n\tvar buf bytes.Buffer\n\tfor i := 0; i < len(s); i++ {\n\t\tif 'A' <= rune(s[i]) && rune(s[i]) <= 'Z' {\n\t\t\t// just convert [A-Z] to _[a-z]\n\t\t\tif i > 0 && 'a' <= rune(s[i-1]) && rune(s[i-1]) <= 'z' {\n\t\t\t\tbuf.WriteRune('_')\n\t\t\t}\n\t\t\tbuf.WriteRune(rune(s[i]) - 'A' + 'a')\n\t\t} else {\n\t\t\tbuf.WriteRune(rune(s[i]))\n\t\t}\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "8e32a07f6d307b09cd075e298612db5b", "score": "0.6978033", "text": "func SnakeCase(ctx context.Context, t *mold.Transformer, v reflect.Value, param string) error {\n\ts, ok := v.Interface().(string)\n\tif !ok {\n\t\treturn nil\n\t}\n\tv.SetString(snakecase.Snakecase(s))\n\treturn nil\n}", "title": "" }, { "docid": "3172359185552f733ffdde802573ccc2", "score": "0.69598323", "text": "func SnakeCase(text string) string {\n\tresult := snakeRegexp.ReplaceAllStringFunc(text, func(match string) string {\n\t\treturn \"_\" + match\n\t})\n\n\treturn ParameterizeString(result)\n}", "title": "" }, { "docid": "24a1fef5f227b21e7ec25df2d9d2462d", "score": "0.69145614", "text": "func ToSnakeCase(str string) string {\n\tif len(str) == 0 {\n\t\treturn \"\"\n\t}\n\n\tbuf := &bytes.Buffer{}\n\tvar prev, r0, r1 rune\n\tvar size int\n\n\tr0 = '_'\n\n\tfor len(str) > 0 {\n\t\tprev = r0\n\t\tr0, size = utf8.DecodeRuneInString(str)\n\t\tstr = str[size:]\n\n\t\tswitch {\n\t\tcase r0 == utf8.RuneError:\n\t\t\tbuf.WriteByte(byte(str[0]))\n\n\t\tcase unicode.IsUpper(r0):\n\t\t\tif prev != '_' {\n\t\t\t\tbuf.WriteRune('_')\n\t\t\t}\n\n\t\t\tbuf.WriteRune(unicode.ToLower(r0))\n\n\t\t\tif len(str) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tr0, size = utf8.DecodeRuneInString(str)\n\t\t\tstr = str[size:]\n\n\t\t\tif !unicode.IsUpper(r0) {\n\t\t\t\tbuf.WriteRune(r0)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// find next non-upper-case character and insert `_` properly.\n\t\t\t// it's designed to convert `HTTPServer` to `http_server`.\n\t\t\t// if there are more than 2 adjacent upper case characters in a word,\n\t\t\t// treat them as an abbreviation plus a normal word.\n\t\t\tfor len(str) > 0 {\n\t\t\t\tr1 = r0\n\t\t\t\tr0, size = utf8.DecodeRuneInString(str)\n\t\t\t\tstr = str[size:]\n\n\t\t\t\tif r0 == utf8.RuneError {\n\t\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t\t\tbuf.WriteByte(byte(str[0]))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif !unicode.IsUpper(r0) {\n\t\t\t\t\tif r0 == '_' || r0 == ' ' || r0 == '-' {\n\t\t\t\t\t\tr0 = '_'\n\n\t\t\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuf.WriteRune('_')\n\t\t\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t\t\t\tbuf.WriteRune(r0)\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t}\n\n\t\t\tif len(str) == 0 || r0 == '_' {\n\t\t\t\tbuf.WriteRune(unicode.ToLower(r0))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif r0 == ' ' || r0 == '-' {\n\t\t\t\tr0 = '_'\n\t\t\t}\n\n\t\t\tbuf.WriteRune(r0)\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "24a1fef5f227b21e7ec25df2d9d2462d", "score": "0.69145614", "text": "func ToSnakeCase(str string) string {\n\tif len(str) == 0 {\n\t\treturn \"\"\n\t}\n\n\tbuf := &bytes.Buffer{}\n\tvar prev, r0, r1 rune\n\tvar size int\n\n\tr0 = '_'\n\n\tfor len(str) > 0 {\n\t\tprev = r0\n\t\tr0, size = utf8.DecodeRuneInString(str)\n\t\tstr = str[size:]\n\n\t\tswitch {\n\t\tcase r0 == utf8.RuneError:\n\t\t\tbuf.WriteByte(byte(str[0]))\n\n\t\tcase unicode.IsUpper(r0):\n\t\t\tif prev != '_' {\n\t\t\t\tbuf.WriteRune('_')\n\t\t\t}\n\n\t\t\tbuf.WriteRune(unicode.ToLower(r0))\n\n\t\t\tif len(str) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tr0, size = utf8.DecodeRuneInString(str)\n\t\t\tstr = str[size:]\n\n\t\t\tif !unicode.IsUpper(r0) {\n\t\t\t\tbuf.WriteRune(r0)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// find next non-upper-case character and insert `_` properly.\n\t\t\t// it's designed to convert `HTTPServer` to `http_server`.\n\t\t\t// if there are more than 2 adjacent upper case characters in a word,\n\t\t\t// treat them as an abbreviation plus a normal word.\n\t\t\tfor len(str) > 0 {\n\t\t\t\tr1 = r0\n\t\t\t\tr0, size = utf8.DecodeRuneInString(str)\n\t\t\t\tstr = str[size:]\n\n\t\t\t\tif r0 == utf8.RuneError {\n\t\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t\t\tbuf.WriteByte(byte(str[0]))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif !unicode.IsUpper(r0) {\n\t\t\t\t\tif r0 == '_' || r0 == ' ' || r0 == '-' {\n\t\t\t\t\t\tr0 = '_'\n\n\t\t\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuf.WriteRune('_')\n\t\t\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t\t\t\tbuf.WriteRune(r0)\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tbuf.WriteRune(unicode.ToLower(r1))\n\t\t\t}\n\n\t\t\tif len(str) == 0 || r0 == '_' {\n\t\t\t\tbuf.WriteRune(unicode.ToLower(r0))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif r0 == ' ' || r0 == '-' {\n\t\t\t\tr0 = '_'\n\t\t\t}\n\n\t\t\tbuf.WriteRune(r0)\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "91fa40e3b80c9917f3c2e3a32f538400", "score": "0.689616", "text": "func camelSnake(filename string) string {\n\tbuild := new(strings.Builder)\n\n\tvar upper bool\n\n\tin := []rune(filename)\n\tfor i, r := range []rune(in) {\n\t\tif !unicode.IsLetter(r) {\n\t\t\tupper = false\n\t\t\tbuild.WriteRune(r)\n\t\t\tcontinue\n\t\t}\n\n\t\tif !unicode.IsUpper(r) {\n\t\t\tupper = false\n\t\t\tbuild.WriteRune(r)\n\t\t\tcontinue\n\t\t}\n\n\t\taddUnderscore := false\n\t\tif upper {\n\t\t\tif i+1 < len(in) && unicode.IsLower(in[i+1]) {\n\t\t\t\taddUnderscore = true\n\t\t\t}\n\t\t} else {\n\t\t\tif i-1 > 0 && unicode.IsLetter(in[i-1]) {\n\t\t\t\taddUnderscore = true\n\t\t\t}\n\t\t}\n\n\t\tif addUnderscore {\n\t\t\tbuild.WriteByte('_')\n\t\t}\n\n\t\tupper = true\n\t\tbuild.WriteRune(unicode.ToLower(r))\n\t}\n\n\treturn build.String()\n}", "title": "" }, { "docid": "2a7d09f49f47741cea90555a181e465f", "score": "0.68852156", "text": "func SnakeCase(s string) string {\n\treturn Delimit(s, '_')\n}", "title": "" }, { "docid": "2a7d09f49f47741cea90555a181e465f", "score": "0.68852156", "text": "func SnakeCase(s string) string {\n\treturn Delimit(s, '_')\n}", "title": "" }, { "docid": "35468e5f4bfb549f1ec0e6cc5df4a35e", "score": "0.6678516", "text": "func jsonToSnakeCase(s string) miscellaneousNameSnakeCase {\n\tfor _, v := range initialisms {\n\t\ts = strings.ReplaceAll(s, v, v[0:1]+strings.ToLower(v[1:]))\n\t}\n\tresult := regexp.MustCompile(\"(.)([A-Z][^A-Z]+)\").ReplaceAllString(s, \"${1}_${2}\")\n\treturn miscellaneousNameSnakeCase(strings.ToLower(regexp.MustCompile(\"([a-z0-9])([A-Z])\").ReplaceAllString(result, \"${1}_${2}\")))\n}", "title": "" }, { "docid": "2d515d42d3e9e65928ee51ef9b4647c1", "score": "0.66604763", "text": "func snakeCase(s string) string {\n\tout := &strings.Builder{}\n\tprevUpper := true\n\tfor _, r := range s {\n\t\tif unicode.IsUpper(r) {\n\t\t\tif !prevUpper {\n\t\t\t\tout.WriteRune('_')\n\t\t\t}\n\t\t\tout.WriteRune(unicode.ToLower(r))\n\t\t\tprevUpper = true\n\t\t} else {\n\t\t\tout.WriteRune(r)\n\t\t\tprevUpper = false\n\t\t}\n\t}\n\treturn out.String()\n}", "title": "" }, { "docid": "22b80fdb0f08dd572fcf82f4753c3bac", "score": "0.66473997", "text": "func (c *Caser) ToSNAKE(s string) string {\n\treturn convert(s, c.splitFn, '_', UpperCase, c.initialisms)\n}", "title": "" }, { "docid": "fc1dcfd7f25099c6e7bd5aaeddd1bf1b", "score": "0.65909815", "text": "func snakeToParts(s snakeCaseName, titleCase bool) []string {\n\tparts := []string{}\n\tsegments := strings.Split(s.snakecase(), \"_\")\n\tfor _, seg := range segments {\n\t\tif v, ok := initialisms[seg]; ok {\n\t\t\tparts = append(parts, v)\n\t\t} else {\n\t\t\tvar newPart string = seg\n\t\t\tif titleCase && len(newPart) > 0 {\n\t\t\t\tnewPart = strings.ToUpper(newPart[0:1]) + newPart[1:]\n\t\t\t}\n\t\t\tparts = append(parts, newPart)\n\t\t}\n\t}\n\n\treturn parts\n}", "title": "" }, { "docid": "186bd51fab4219297b6c81148458dd79", "score": "0.6515642", "text": "func ToUpperSnake(s string) string {\n\tif s == \"\" {\n\t\treturn s\n\t}\n\tss := SplitIntoWords(s)\n\tfor i, s := range ss {\n\t\tss[i] = strings.ToUpper(s)\n\t}\n\treturn strings.Join(ss, \"_\")\n}", "title": "" }, { "docid": "0f2a7a9e69c3fb892e66720250a640d0", "score": "0.6510808", "text": "func SnakeString(s string) string {\n\tdata := make([]byte, 0, len(s)*2)\n\tj := false\n\tfor _, d := range StringToBytes(s) {\n\t\tif d >= 'A' && d <= 'Z' {\n\t\t\tif j {\n\t\t\t\tdata = append(data, '_')\n\t\t\t\tj = false\n\t\t\t}\n\t\t} else if d != '_' {\n\t\t\tj = true\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\treturn strings.ToLower(BytesToString(data))\n}", "title": "" }, { "docid": "7f617a6c8fbd5cef1abafc8f3133579f", "score": "0.6510727", "text": "func SnakeCase(fieldName string) string {\n\tfieldName = strings.Trim(fieldName, \" \")\n\tn := \"\"\n\tfor i, v := range fieldName {\n\t\t// treat acronyms as words, eg for JSONData -> JSON is a whole word\n\t\tnextCaseIsChanged := false\n\t\tif i+1 < len(fieldName) {\n\t\t\tnext := fieldName[i+1]\n\t\t\tif (v >= 'A' && v <= 'Z' && next >= 'a' && next <= 'z') || (v >= 'a' && v <= 'z' && next >= 'A' && next <= 'Z') {\n\t\t\t\tnextCaseIsChanged = true\n\t\t\t}\n\t\t}\n\n\t\tif i > 0 && n[len(n)-1] != '_' && nextCaseIsChanged {\n\t\t\t// add underscore if next letter case type is changed\n\t\t\tif v >= 'A' && v <= 'Z' {\n\t\t\t\tn += \"_\" + string(v)\n\t\t\t} else if v >= 'a' && v <= 'z' {\n\t\t\t\tn += string(v) + \"_\"\n\t\t\t}\n\t\t} else if v == ' ' {\n\t\t\t// replace spaces with underscores\n\t\t\tn += \"_\"\n\t\t} else {\n\t\t\tn = n + string(v)\n\t\t}\n\t}\n\tn = strings.ToLower(n)\n\t// special case\n\tn = strings.Replace(n, \"httpuri\", \"http_uri\", -1)\n\treturn n\n}", "title": "" }, { "docid": "9a10d877eb17e48e8771ede735a1cc8f", "score": "0.65044975", "text": "func ToUpperSnakeCase(s string) string {\n\treturn strings.ToUpper(toSnake(s))\n}", "title": "" }, { "docid": "8a38b08d366e58bd92b9a3a6e9506cd4", "score": "0.64901894", "text": "func Snake(s string) string {\n\thead, tail := headTailCount(s, '_')\n\treturn strings.Repeat(\"_\", head) + strings.Join(words(s), \"_\") + strings.Repeat(\"_\", tail)\n}", "title": "" }, { "docid": "ceb59ce1aefbc722403dd602c0dfe66f", "score": "0.64335006", "text": "func snakeString(s string) string {\n\tdata := make([]byte, 0, len(s)*2)\n\tj := false\n\tnum := len(s)\n\tfor i := 0; i < num; i++ {\n\t\td := s[i]\n\t\tif i > 0 && d >= 'A' && d <= 'Z' && j {\n\t\t\tdata = append(data, '_')\n\t\t}\n\t\tif d != '_' {\n\t\t\tj = true\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\treturn strings.ToLower(string(data[:]))\n}", "title": "" }, { "docid": "6a6b0f823676453d5c17f4e1c2b3eac4", "score": "0.64198244", "text": "func SnakeString(s string) string {\n\tdata := make([]byte, 0, len(s)*2)\n\tj := false\n\tnum := len(s)\n\tfor i := 0; i < num; i++ {\n\t\td := s[i]\n\t\tif i > 0 && d >= 'A' && d <= 'Z' && j {\n\t\t\tdata = append(data, '_')\n\t\t}\n\t\tif d != '_' {\n\t\t\tj = true\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\treturn strings.ToLower(string(data[:]))\n}", "title": "" }, { "docid": "6a6b0f823676453d5c17f4e1c2b3eac4", "score": "0.64198244", "text": "func SnakeString(s string) string {\n\tdata := make([]byte, 0, len(s)*2)\n\tj := false\n\tnum := len(s)\n\tfor i := 0; i < num; i++ {\n\t\td := s[i]\n\t\tif i > 0 && d >= 'A' && d <= 'Z' && j {\n\t\t\tdata = append(data, '_')\n\t\t}\n\t\tif d != '_' {\n\t\t\tj = true\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\treturn strings.ToLower(string(data[:]))\n}", "title": "" }, { "docid": "fabf1e6e5f5c01c358764167449dd31f", "score": "0.6413317", "text": "func ConvertDefaultsToSnakeCase(chartClient *helm.HelmChartClient, roleDirectory string) *map[string]string {\n\tdefaultsFile := getAnsibleRoleDefaultsFileName(roleDirectory)\n\tlogrus.Infof(\"Attempting to convert keys to snake_case: %s\", defaultsFile)\n\tinput, err := ioutil.ReadFile(defaultsFile)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Skipping snake_case substitution, couldn't read file: %s\", defaultsFile)\n\t\treturn nil\n\t}\n\n\tlines := strings.Split(string(input), \"\\n\")\n\tkeysForConversion := getTargetedReplacementKeys(chartClient)\n\n\tfor keyForConversion := range *keysForConversion {\n\t\tconversionLocations := []int{}\n\t\tsnakeKey := paramconv.ToSnake(keyForConversion)\n\t\tfor i, line := range lines {\n\t\t\tif strings.Contains(line, keyForConversion) {\n\t\t\t\tlines[i] = strings.ReplaceAll(lines[i], keyForConversion, snakeKey)\n\t\t\t\tconversionLocations = append(conversionLocations, i)\n\t\t\t}\n\t\t}\n\t\tlogrus.Infof(\"converting defaults/main.yaml: %s -> %s lines: %d\", keyForConversion, snakeKey,\n\t\t\tconversionLocations)\n\t}\n\toutput := strings.Join(lines, \"\\n\")\n\terr = ioutil.WriteFile(defaultsFile, []byte(output), defaultPermissions)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Skipping defaults/main.yaml snake_case conversion, couldn't write file: %s\", defaultsFile)\n\t} else {\n\t\tlogrus.Infof(\"Successfully performed snake_case conversion: %s\", defaultsFile)\n\t}\n\treturn keysForConversion\n}", "title": "" }, { "docid": "e3453fb80aaaac2ff212de3cc1b90106", "score": "0.63108426", "text": "func ToLowerCamelCase(value interface{}) string {\n\ta := []rune(ToCamelCase(value))\n\tif len(a) > 0 {\n\t\ta[0] = unicode.ToLower(a[0])\n\t}\n\treturn string(a)\n}", "title": "" }, { "docid": "665f4d9a79b07fba625b7ccb1e445af3", "score": "0.6235487", "text": "func camel(snakeCase string) string {\n\tprev := 'x'\n\treturn strings.Map(\n\t\tfunc(r rune) rune {\n\t\t\tif prev == '_' {\n\t\t\t\tprev = r\n\t\t\t\treturn unicode.ToTitle(r)\n\t\t\t}\n\t\t\tprev = r\n\t\t\tif r == '_' {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t\treturn r\n\t\t}, snakeCase)\n}", "title": "" }, { "docid": "5c47159bf48ebdb27e344cc60b662873", "score": "0.6171522", "text": "func (s Strings) SnakeCasedName() string {\n\tnewstr := make([]rune, 0)\n\tfirstTime := true\n\n\tfor _, chr := range string(s) {\n\t\tif isUpper := 'A' <= chr && chr <= 'Z'; isUpper {\n\t\t\tif firstTime == true {\n\t\t\t\tfirstTime = false\n\t\t\t} else {\n\t\t\t\tnewstr = append(newstr, '_')\n\t\t\t}\n\t\t\tchr -= ('A' - 'a')\n\t\t}\n\t\tnewstr = append(newstr, chr)\n\t}\n\n\treturn string(newstr)\n}", "title": "" }, { "docid": "788b7d03f645a128dd439765a03ce8ad", "score": "0.60921425", "text": "func ToLowerCamel(s string) string {\n\tif s == \"\" {\n\t\treturn s\n\t}\n\tif r := rune(s[0]); r >= 'A' && r <= 'Z' {\n\t\ts = strings.ToLower(string(r)) + s[1:]\n\t}\n\treturn toCamelInitCase(s, false)\n}", "title": "" }, { "docid": "9e7820600c47d1c83d896eb7e2721780", "score": "0.6022188", "text": "func ToCamel(s string) string {\n\t// Use a closure here to remember state.\n\t// Hackish but effective. Depends on Map scanning in order and calling\n\t// the closure once per rune.\n\tprev := ' '\n\treturn strings.Map(\n\t\tfunc(r rune) rune {\n\t\t\tif unicode.IsSpace(prev) {\n\t\t\t\tprev = r\n\t\t\t\treturn unicode.ToLower(r)\n\t\t\t}\n\t\t\tprev = r\n\t\t\treturn r\n\t\t},\n\t\ts)\n}", "title": "" }, { "docid": "44c4f3f400b13a3538c2cf5c67a45790", "score": "0.5947206", "text": "func LowerCamel(s string) string {\n\treturn Camel(s)\n}", "title": "" }, { "docid": "b7417827a3b5a7e54076cde3defd00ea", "score": "0.59460396", "text": "func (j Join) Snake() Join {\n\tvar join Join\n\tfor _, each := range j {\n\t\tjoin = append(join, stringx.From(each).ToSnake())\n\t}\n\n\treturn join\n}", "title": "" }, { "docid": "b2be9bbbcf07ed3694cedd2b00304b1e", "score": "0.5886769", "text": "func ToCamel(s string) string {\n\treturn toCamelInitCase(s, true)\n}", "title": "" }, { "docid": "0d61dcbc86d47f43edd998bd90b29aca", "score": "0.58551145", "text": "func ToCamelCase(str string) string {\n\treturn strings.Title(strings.ToLower(str))\n}", "title": "" }, { "docid": "a111b646556023fbfb572bc80db4c4fe", "score": "0.58550704", "text": "func ToLower(s string) string", "title": "" }, { "docid": "a111b646556023fbfb572bc80db4c4fe", "score": "0.58550704", "text": "func ToLower(s string) string", "title": "" }, { "docid": "531f8ac6856112c38200d7dc15640a1f", "score": "0.5832947", "text": "func ScreamingSnake(s string) string {\n\thead, tail := headTailCount(s, '_')\n\treturn strings.Repeat(\"_\", head) + strings.Join(scream(words(s)), \"_\") + strings.Repeat(\"_\", tail)\n}", "title": "" }, { "docid": "5f51ae29ef295f316a19759a1b8178e0", "score": "0.5767926", "text": "func toLower(s string, args ...string) string {\n\treturn strings.ToLower(s)\n}", "title": "" }, { "docid": "5f51ae29ef295f316a19759a1b8178e0", "score": "0.5767926", "text": "func toLower(s string, args ...string) string {\n\treturn strings.ToLower(s)\n}", "title": "" }, { "docid": "fc94ef0af1b425721a6a376a87ccbf45", "score": "0.5761246", "text": "func toCamelCase(str string) string {\n\tvar b strings.Builder\n\n\tb.WriteString(strings.ToLower(string(str[0])))\n\tb.WriteString(str[1:])\n\n\treturn b.String()\n}", "title": "" }, { "docid": "b4a28fa3a31a140323613b81dc91c74b", "score": "0.575555", "text": "func ToLowerCase(str string) string {\n\tlower := strings.ToLower(str)\n\treturn lower\n}", "title": "" }, { "docid": "53c4e424dc31775a597cc6759e8ed0af", "score": "0.5745957", "text": "func UnderscoreToLowerCamelCase(s string) string {\n\ts = strings.ToLower(s)\n\ts = strings.Replace(s, \"_\", \" \", -1)\n\ts = strings.Title(s)\n\ts = strings.Replace(s, \" \", \"\", -1)\n\tfirstChar := string(s[0])\n\ts = strings.Replace(s, firstChar, strings.ToLower(firstChar), 1)\n\treturn s\n}", "title": "" }, { "docid": "e58736a5f30b290f9c5b346a6de8079d", "score": "0.57326084", "text": "func ToLower(s string) string\t{ return Map(unicode.ToLower, s) }", "title": "" }, { "docid": "fb9ec4813ddb0b6e91e4b33f51ab166a", "score": "0.5726713", "text": "func ToCamelInitCaseKeepAll(s string, initCase bool) string {\n\ts = addWordBoundariesToNumbers(s)\n\ts = strings.Trim(s, \" \")\n\tn := \"\"\n\tcapNext := initCase\n\tfor _, v := range s {\n\t\tif v >= 'A' && v <= 'Z' {\n\t\t\tn += string(v)\n\t\t}\n\t\tif v >= '0' && v <= '9' {\n\t\t\tn += string(v)\n\t\t}\n\n\t\tif v == '_' || v == ' ' || v == '-' {\n\t\t\tcapNext = true\n\t\t} else {\n\t\t\tif capNext {\n\t\t\t\tn += strings.ToUpper(string(v))\n\t\t\t} else {\n\t\t\t\tn += string(v)\n\t\t\t}\n\t\t\tcapNext = false\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "0528b8408804d14661cbe20c468f3e48", "score": "0.572404", "text": "func awsKeyCase(input string) string {\n\treturn strings.ToLower(input)\n}", "title": "" }, { "docid": "bb57be51a2beeab51ba2487de5af0b05", "score": "0.5693228", "text": "func IsLowerSnakeCase(s string) bool {\n\tif s == \"\" || s[0] == '_' || s[len(s)-1] == '_' {\n\t\treturn false\n\t}\n\tfor _, r := range s {\n\t\tif !(isLower(r) || isDigit(r) || r == '_') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "677f0ccf9db4fc5e205ea69a81ded669", "score": "0.56363565", "text": "func toLowerCase(str string) string {\n \n}", "title": "" }, { "docid": "9cdcec027c15108119aa8b219f1eaee6", "score": "0.5619393", "text": "func ToCaseFor(c, s string) (string, error) {\n\tswitch c {\n\tcase \"upper\":\n\t\treturn ToUpperCase(s), nil\n\tcase \"lower\":\n\t\treturn ToLowerCase(s), nil\n\tcase \"title\":\n\t\treturn ToTitleCase(s), nil\n\tcase \"camel\":\n\t\treturn ToCamelCase(s), nil\n\tcase \"pascal\":\n\t\treturn ToPascalCase(s), nil\n\tcase \"snake\":\n\t\treturn ToSnakeCase(s), nil\n\tcase \"kebab\", \"lisp\":\n\t\treturn ToKebabCase(s), nil\n\t}\n\treturn \"\", errors.New(cfmt.Serrorf(\"%s is not valid case\", c))\n}", "title": "" }, { "docid": "bffe27347410bc5deaaef7ff52e55dea", "score": "0.56057763", "text": "func ToCamelCase(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tresult := make([]rune, 0, len(s))\n\tupper := false\n\tfor _, r := range s {\n\t\tif r == '_' {\n\t\t\tupper = true\n\t\t\tcontinue\n\t\t}\n\t\tif upper {\n\t\t\tresult = append(result, unicode.ToUpper(r))\n\t\t\tupper = false\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, r)\n\t}\n\tresult[0] = unicode.ToUpper(result[0])\n\treturn string(result)\n}", "title": "" }, { "docid": "1e20d9711576469ea79ae47acedc3c7a", "score": "0.5598578", "text": "func toCamelInitCase(s string, initCase bool) string {\n\ts = addWordBoundariesToNumbers(s)\n\ts = strings.Trim(s, \" \")\n\tn := \"\"\n\tcapNext := initCase\n\tfor _, v := range s {\n\t\tif v >= 'A' && v <= 'Z' {\n\t\t\tn += string(v)\n\t\t}\n\t\tif v >= '0' && v <= '9' {\n\t\t\tn += string(v)\n\t\t}\n\t\tif v >= 'a' && v <= 'z' {\n\t\t\tif capNext {\n\t\t\t\tn += strings.ToUpper(string(v))\n\t\t\t} else {\n\t\t\t\tn += string(v)\n\t\t\t}\n\t\t}\n\t\tif v == '_' || v == ' ' || v == '-' {\n\t\t\tcapNext = true\n\t\t} else {\n\t\t\tcapNext = false\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "ca4f65db293fa0ccb9793f314307bc11", "score": "0.55973446", "text": "func ToCamelCase(value interface{}) string {\n\ts := ToString(value)\n\treturn strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), \"_\", \" \", -1)), \" \", \"\", -1)\n}", "title": "" }, { "docid": "e598b48466585c8f76e50cf729ab0d61", "score": "0.5576366", "text": "func ToCamelCase(s string) string {\n\tif !utf8.ValidString(s) {\n\t\treturn s\n\t}\n\ts = strings.TrimFunc(s, unicode.IsSpace)\n\tout := strings.Builder{}\n\tprev := rune(-1)\n\tfor _, r := range s {\n\t\tswitch {\n\t\tcase prev < 0:\n\t\t\tout.WriteRune(unicode.ToLower(r))\n\t\tcase isSeparator(prev):\n\t\t\tout.WriteRune(unicode.ToTitle(r))\n\t\tcase !isSeparator(r):\n\t\t\tout.WriteRune(r)\n\t\t}\n\t\tprev = r\n\t}\n\treturn out.String()\n}", "title": "" }, { "docid": "f8ea78d9115129961837b08b014af88c", "score": "0.5562267", "text": "func ToCamelCase(s string) string {\n\tsb := strings.Builder{}\n\n\tf := func(c rune) bool {\n\t\treturn c == '_' || c == '-'\n\t}\n\tstrArr := strings.FieldsFunc(s, f)\n\tsb.WriteString(strArr[0])\n\n\tfor i := 1; i < len(strArr); i++ {\n\t\tsb.WriteString(strings.Title(strArr[i]))\n\t}\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "0695441605774d2710c8efc653552525", "score": "0.5555207", "text": "func ToLowerCase(s string) string {\n\tvar buffer bytes.Buffer\n\tfor _, r := range s {\n\t\tif 'A' <= r && r <= 'Z' {\n\n\t\t\tbuffer.WriteRune(r + 32)\n\t\t\tcontinue\n\t\t}\n\t\tbuffer.WriteRune(r)\n\t}\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "badbe10a746e53db89ef7cffe4550566", "score": "0.5513156", "text": "func toLowerCase(str string) string {\n\tbs := []byte(str)\n\tfor i := 0; i < len(bs); i++ {\n\t\tif bs[i] >= 'A' && bs[i] <= 'Z' {\n\t\t\tbs[i] = bs[i] - 'A' + 'a'\n\t\t}\n\t}\n\treturn string(bs)\n}", "title": "" }, { "docid": "d1150be8a2c832c3a444b4d2f6f18b67", "score": "0.5504717", "text": "func camelToPascal(camelCase string) (pascalCase string) {\n\n\tif len(camelCase) <= 0 {\n\t\treturn \"\"\n\t}\n\n\tpascalCase = strings.ToUpper(string(camelCase[0])) + camelCase[1:]\n\treturn\n}", "title": "" }, { "docid": "16054d499329dacd3dc42e863b6e74bd", "score": "0.54932475", "text": "func ToLowerCase(s string) string {\n\tif !utf8.ValidString(s) {\n\t\treturn s\n\t}\n\ts = strings.TrimFunc(s, unicode.IsSpace)\n\treturn strings.ToLower(s)\n}", "title": "" }, { "docid": "0e4b8a976556ca12e7d7f8a8e12f3968", "score": "0.5489099", "text": "func Convert(s string) string {\r\n\treturn strings.ToLower(s)\r\n}", "title": "" }, { "docid": "a55f232e7f6cfcefef06d2aa0f1e037c", "score": "0.54755247", "text": "func (ob StringsModule) ToLower(s string) string {\n\treturn _strings.ToLower(s)\n}", "title": "" }, { "docid": "ebc5b7dece3a1a2af8bacd0222c86862", "score": "0.54679996", "text": "func CamelCaseToUnderscore(str string) string {\n\tvar output []rune\n\tvar segment []rune\n\tfor _, r := range str {\n\t\tif !unicode.IsLower(r) {\n\t\t\toutput = addSegment(output, segment)\n\t\t\tsegment = nil\n\t\t}\n\t\tsegment = append(segment, unicode.ToLower(r))\n\t}\n\toutput = addSegment(output, segment)\n\treturn string(output)\n}", "title": "" }, { "docid": "3adf1648039f69283325cc2dfc981944", "score": "0.545213", "text": "func (c *Caser) ToCamel(s string) string {\n\treturn convert(s, c.splitFn, '\\x00', CamelCase, c.initialisms)\n}", "title": "" }, { "docid": "f2bedffe6ff2133e2a5d7557aacb90e8", "score": "0.54242337", "text": "func pascalToCamel(input string) (camelCase string) {\n\tif input == \"\" {\n\t\treturn \"\"\n\t}\n\n\tcamelCase = strings.ToLower(string(input[0]))\n\tcamelCase += string(input[1:])\n\treturn camelCase\n}", "title": "" }, { "docid": "d4abb53b28ccae4b29cf39ba0c90e3ce", "score": "0.5397855", "text": "func Titlecase(s string) (ret string) {\n\tif len(s) > 0 {\n\t\tret = inflect.Titleize(s)\n\t}\n\treturn\n}", "title": "" }, { "docid": "984db1d0caac9b7e8aedf081209962e6", "score": "0.5378301", "text": "func CamelCase(in string) string {\n\ttokens := strings.Split(in, \"_\")\n\tfor i := range tokens {\n\t\ttokens[i] = strings.Title(strings.Trim(tokens[i], \" \"))\n\t}\n\treturn strings.Join(tokens, \"\")\n}", "title": "" }, { "docid": "c111516d52268c8ea62d57d14e33c4f9", "score": "0.5366456", "text": "func ToLower(str string) string {\n\ts, _ := to(unicode.ToLower, str)\n\treturn s\n}", "title": "" }, { "docid": "ff053df12c5157c8886d285b87ea231a", "score": "0.5296551", "text": "func (edit Editor) ToLowerCase() {\n\tedit.Call(\"toLowerCase\")\n}", "title": "" }, { "docid": "31becb06ba8dd88856861eb5e245fcbe", "score": "0.5290299", "text": "func ToLower(value interface{}) string {\n\treturn strings.ToLower(ToString(value))\n}", "title": "" }, { "docid": "ae880f97208c5fe56110cb3fbd3cf1ed", "score": "0.5282518", "text": "func ToPascalCase(value string) string {\n\tb := strings.Builder{}\n\n\tvar toUpper bool\n\n\tfor i, rune := range value {\n\t\t// Always upper the first character\n\t\tif i == 0 {\n\t\t\ttoUpper = true\n\t\t}\n\t\t// Always upper the character after non-letter/non-digit skipping the character\n\t\tif !unicode.IsLetter(rune) && !unicode.IsDigit(rune) {\n\t\t\ttoUpper = true\n\t\t\tcontinue\n\t\t}\n\t\t// If the flag was set by one of the previous steps\n\t\tif toUpper {\n\t\t\trune = unicode.ToUpper(rune)\n\t\t\ttoUpper = false\n\t\t}\n\n\t\tb.WriteRune(rune)\n\t}\n\n\treturn b.String()\n}", "title": "" } ]
4be502e986a6f788f43a255ef7dfc4da
TransformForTag performs the neccessary transformation on img that will facilitate removal of the orientation tag.
[ { "docid": "fe7ed7cf7af8b90f39bca47c361d9a73", "score": "0.81328547", "text": "func TransformForTag(img image.Image, tag uint16) image.Image {\n\tswitch tag {\n\tdefault:\n\t\treturn img\n\tcase 2:\n\t\treturn imaging.FlipH(img)\n\tcase 3:\n\t\treturn imaging.Rotate180(img)\n\tcase 4:\n\t\treturn imaging.FlipH(imaging.Rotate180(img))\n\tcase 5:\n\t\treturn imaging.FlipH(imaging.Rotate270(img))\n\tcase 6:\n\t\treturn imaging.Rotate270(img)\n\tcase 7:\n\t\treturn imaging.FlipH(imaging.Rotate90(img))\n\tcase 8:\n\t\treturn imaging.Rotate90(img)\n\t}\n}", "title": "" } ]
[ { "docid": "90caf99917845a7b16d3ea41fbcd6bf1", "score": "0.60753804", "text": "func (pt *imageTagTransformer) Transform(resources resmap.ResMap) error {\n\tif len(pt.imageTags) == 0 {\n\t\treturn nil\n\t}\n\tfor _, res := range resources {\n\t\terr := pt.findAndReplaceTag(res.Map())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d54f8b0e245f3b5a8dfda34eaeaa501a", "score": "0.5433636", "text": "func Normalize(r io.ReadSeeker, w io.Writer) error {\n\ttag, err := GetOrientationTag(r)\n\tif err == NoExifError {\n\t\t_, err = io.Copy(w, r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\timg1, err := jpeg.Decode(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\timg2 := TransformForTag(img1, tag)\n\terr = jpeg.Encode(w, img2, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "07a74be0cf13076f6591890b105b8d95", "score": "0.53522855", "text": "func (img *Image) Transform(ctx *context.Context) error {\n\tvar err error\n\tvar blob []byte\n\tif blob, err = img.transformer.Transform(ctx, img.blob); err == nil {\n\t\timg.blob = blob\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e670f9619bbb0467238684d5212ca941", "score": "0.50315076", "text": "func Transform(img []byte, opt Options, url string) ([]byte, error) {\n\n\timgSize := imageSizes{initial: len(img)}\n\n\tops := opt.transformOpts()\n\tsendToStatsd(Statsd, ops)\n\n\tif !opt.transform() {\n\t\t// bail if no transformation was requested\n\t\treturn img, nil\n\t}\n\n\tStatsd.Increment(\"transform.request\")\n\n\tvar timerTransform statsd.Timinger\n\ttimerTransform = Statsd.NewTiming()\n\tdefer timerTransform.Send(\"transform.time.total\")\n\n\t// decode image\n\tvar timerDecode statsd.Timinger\n\ttimerDecode = Statsd.NewTiming()\n\n\tm, format, err := image.Decode(bytes.NewReader(img))\n\ttimerDecode.Send(\"transform.time.decode\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// apply EXIF orientation for jpeg and tiff source images. Read at most\n\t// up to maxExifSize looking for EXIF tags.\n\tif format == \"jpeg\" || format == \"tiff\" {\n\t\tr := io.LimitReader(bytes.NewReader(img), maxExifSize)\n\t\tif exifOpt := exifOrientation(r); exifOpt.transform() {\n\t\t\tm = transformImage(m, exifOpt)\n\t\t}\n\t}\n\n\t// encode webp and tiff as jpeg by default\n\tif format == \"tiff\" || format == \"webp\" {\n\t\tformat = \"jpeg\"\n\t}\n\n\tif opt.Format != \"\" {\n\t\tformat = opt.Format\n\t}\n\n\t// transform and encode image\n\tbuf := new(bytes.Buffer)\n\tswitch format {\n\tcase \"gif\":\n\t\tfn := func(img image.Image) image.Image {\n\t\t\treturn transformImage(img, opt)\n\t\t}\n\t\terr = gifresize.Process(buf, bytes.NewReader(img), fn)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"jpeg\":\n\t\tquality := opt.Quality\n\t\tif quality == 0 {\n\t\t\tquality = defaultQuality\n\t\t}\n\n\t\tm = transformImage(m, opt)\n\t\terr = jpeg.Encode(buf, m, &jpeg.Options{Quality: quality})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"png\":\n\t\tm = transformImage(m, opt)\n\t\terr = png.Encode(buf, m)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"tiff\":\n\t\tm = transformImage(m, opt)\n\t\terr = tiff.Encode(buf, m, &tiff.Options{Compression: tiff.Deflate, Predictor: true})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported format: %v\", format)\n\t}\n\n\timgSize.transformed = len(buf.Bytes())\n\n\tglog.Infof(\"transform: name: %s, initial size: %d, transformed: %d, sum: %d\", url, imgSize.initial, imgSize.transformed, imgSize.initial+imgSize.transformed)\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "37778bede52660eb9dea622f6dd5f819", "score": "0.4913445", "text": "func ImageTransform(overrideMap map[string]string, log logr.Logger) mf.Transformer {\n\trit := &registryImageTransformer{\n\t\toverrideMap: overrideMap,\n\t}\n\treturn ResourceImageTransformer(rit, log)\n}", "title": "" }, { "docid": "bb4c26e0b96d5268a10a0b33a69dd84b", "score": "0.48157012", "text": "func (doc *Document) ApplyTransform(transform *Matrix4) {\n\tfor _, o := range doc.Objects {\n\t\to.ApplyTransform(transform)\n\t}\n\tfor _, p := range doc.Plugins {\n\t\tif tr, ok := p.(transformable); ok {\n\t\t\ttr.ApplyTransform(transform)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e91b0e83af6bcaa3ed0987d499d05fec", "score": "0.4795993", "text": "func (p *MetadataOperator) Transform(entry *entry.Entry) error {\n\tif err := p.Attribute(entry); err != nil {\n\t\treturn errors.Wrap(err, \"failed to add attributes to entry\")\n\t}\n\n\tif err := p.Identify(entry); err != nil {\n\t\treturn errors.Wrap(err, \"failed to add resource keys to entry\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b592bd2f088f3d296341b41425117095", "score": "0.47903198", "text": "func CreateImageTagPairsFromTransform(images []*Image, transform func(Image) *Image) []ImageTagPair {\n\tret := make([]ImageTagPair, len(images))\n\tfor i, img := range images {\n\t\tret[i] = ImageTagPair{Source: img, Target: transform(*img)}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "4c6b1dd36ca4896bd2238db66e4b7935", "score": "0.47860274", "text": "func NormalizeTag(tag language.Tag) string {\n\tbase, _ := tag.Base()\n\tregion, _ := tag.Region()\n\treturn fmt.Sprintf(\"%v_%v\", base, region)\n}", "title": "" }, { "docid": "6207ffdb32867eea4900709977736915", "score": "0.478551", "text": "func Transform(image io.Reader,numShapes int,opts ...func() []string) io.Reader{\n\tin,err:=ioutil.TempFile(\"\",\"in_\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// a better option would be to handle the error insted of\n\t// just returning it.\n\tdefer os.Remove(in.Name())\n\t// removes the created temp file in case there is an error.\n\tout,err:=ioutil.TempFile(\"\",\"out_\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer os.Remove(out.Name())\n// read image into input file\n_,err= io.Copy(in,image)\nif err != nil {\n\treturn nil, err\n}\n\n// Run primitive w/ -i in.Name() -o out.Name()\nstdCombo,err:=primitive(in.Name(),out.Name(),numShapes,ModeCombo)\nif err != nil {\n\treturn nil, err\n}\nfmt.Println(stdCombo)\n// read out into a reader, return reader, delete out\nb:=bytes.NewBuffer(nil)\n_,err:=io.Copy(b,out)\nif err != nil {\n\treturn nil, err\n}\nreturn b,nil\n\n}", "title": "" }, { "docid": "413ae54e27300583ae4483ee8a45d11a", "score": "0.47278872", "text": "func (p *MetadataOperator) Transform(entry *entry.Entry) (*entry.Entry, error) {\n\terr := p.labeler.Label(entry)\n\tif err != nil {\n\t\treturn entry, err\n\t}\n\n\terr = p.tagger.Tag(entry)\n\tif err != nil {\n\t\treturn entry, err\n\t}\n\n\treturn entry, nil\n}", "title": "" }, { "docid": "12719c46fb2b1ad62ca053656eb40ca8", "score": "0.472622", "text": "func transformImage(m image.Image, opt Options) image.Image {\n\n\tvar timerTransform statsd.Timinger\n\ttimerTransform = Statsd.NewTiming()\n\tdefer timerTransform.Send(\"transform.time.transform_image\")\n\n\t// crop if needed\n\tif x0, y0, x1, y1, crop := cropParams(m, opt); crop {\n\t\tm = imaging.Crop(m, image.Rect(x0, y0, x1, y1))\n\t}\n\t// resize if needed\n\tif w, h, resize := resizeParams(m, opt); resize {\n\t\tif opt.Fit {\n\t\t\tm = imaging.Fit(m, w, h, resampleFilter)\n\t\t} else {\n\t\t\tif w == 0 || h == 0 {\n\t\t\t\tm = imaging.Resize(m, w, h, resampleFilter)\n\t\t\t} else {\n\t\t\t\tm = imaging.Thumbnail(m, w, h, resampleFilter)\n\t\t\t}\n\t\t}\n\t}\n\n\t// rotate\n\trotate := float64(opt.Rotate) - math.Floor(float64(opt.Rotate)/360)*360\n\tswitch rotate {\n\tcase 90:\n\t\tm = imaging.Rotate90(m)\n\tcase 180:\n\t\tm = imaging.Rotate180(m)\n\tcase 270:\n\t\tm = imaging.Rotate270(m)\n\t}\n\n\t// flip\n\tif opt.FlipVertical {\n\t\tm = imaging.FlipV(m)\n\t}\n\tif opt.FlipHorizontal {\n\t\tm = imaging.FlipH(m)\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "3273196d83603a9abda488e349b075e2", "score": "0.4676423", "text": "func Transform(filepath string, mode int, number int, ext string) (*os.File, error) {\n\thDir, _ := homedir.Dir()\n\tdst, err := filehandle.TempFile(hDir+\"/go/src/gophercises/transform/output\", ext)\n\tif err == nil {\n\t\tcmdDir := hDir + \"/go/bin/primitive\"\n\t\tcmd := cmdExecuteFunc(cmdDir, strings.Split(fmt.Sprintf(\"-i %s -o %s -n %d -m %d\", filepath, dst.Name(), number, mode), \" \")...)\n\t\t_, err = cmd.CombinedOutput()\n\t\tfmt.Println(strings.Split(fmt.Sprintf(\"-i %s -o %s -n %d -m %d\", filepath, dst.Name(), number, mode), \" \"))\n\t}\n\treturn dst, err\n}", "title": "" }, { "docid": "c63cb7548a796e70fa579dfd60325da2", "score": "0.46762833", "text": "func (r *ImageRef) RemoveOrientation() error {\n\tout, err := vipsCopyImage(r.image)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvipsRemoveMetaOrientation(out)\n\n\tr.setImage(out)\n\treturn nil\n}", "title": "" }, { "docid": "190c07a12757f76a1766586b946eddd5", "score": "0.4664289", "text": "func (doc *Document) ApplyTransform(transform *Matrix4) {\n\tfor _, o := range doc.Objects {\n\t\to.SetLocalTransform(transform.Mul(o.GetLocalTransform()))\n\t\to.ApplyTransform(transform)\n\t}\n\tfor _, p := range doc.Plugins {\n\t\tif tr, ok := p.(transformable); ok {\n\t\t\ttr.ApplyTransform(transform)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "84f5a77ed512c6408f3bb015944b3bc6", "score": "0.46126035", "text": "func (i *Image) UntagImage(tag string) error {\n\ti.reloadImage()\n\tvar newTags []string\n\ttags := i.Names()\n\tif !util.StringInSlice(tag, tags) {\n\t\treturn nil\n\t}\n\tfor _, t := range tags {\n\t\tif tag != t {\n\t\t\tnewTags = append(newTags, t)\n\t\t}\n\t}\n\tif err := i.imageruntime.store.SetNames(i.ID(), newTags); err != nil {\n\t\treturn err\n\t}\n\ti.reloadImage()\n\tdefer i.newImageEvent(events.Untag)\n\treturn nil\n}", "title": "" }, { "docid": "8a0c0aa31c1ac473f2964846a0909177", "score": "0.46086335", "text": "func (a *Augment) Transform(image *ts.Tensor) *ts.Tensor {\n\tout := a.augments.Forward(image)\n\treturn out\n}", "title": "" }, { "docid": "10ae6cba6eb3243de630ecb515cf45d3", "score": "0.45913398", "text": "func (in *ImageRef) IccTransform(outputProfile string, options ...*Option) error {\n\tout, err := IccTransform(in.image, outputProfile, options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tin.SetImage(out)\n\treturn nil\n}", "title": "" }, { "docid": "961e2b797c7ff7160dd7cead543707c1", "score": "0.4551987", "text": "func RotateImageWithOrientation(ctx context.Context, im image.Image, orientation string) (image.Image, error) {\n\n\tswitch orientation {\n\tcase \"1\":\n\t\t// pass\n\tcase \"2\":\n\t\tim = imaging.FlipV(im)\n\tcase \"3\":\n\t\tim = imaging.Rotate180(im)\n\tcase \"4\":\n\t\tim = imaging.Rotate180(imaging.FlipV(im))\n\tcase \"5\":\n\t\tim = imaging.Rotate270(imaging.FlipV(im))\n\tcase \"6\":\n\t\tim = imaging.Rotate270(im)\n\tcase \"7\":\n\t\tim = imaging.Rotate90(imaging.FlipV(im))\n\tcase \"8\":\n\t\tim = imaging.Rotate90(im)\n\t}\n\n\treturn im, nil\n}", "title": "" }, { "docid": "14ac2ba73bf327b9abdf46d04056eeab", "score": "0.453713", "text": "func (self *BitmapText) UpdateTransformI(args ...interface{}) {\n self.Object.Call(\"updateTransform\", args)\n}", "title": "" }, { "docid": "b311ef1089fe3aa43070448eda05a128", "score": "0.45119625", "text": "func Transform(image io.Reader, ext string, numShapes int, opts ...func() []string) (io.Reader, error) {\n\tvar args []string\n\tfor _, opt := range opts {\n\t\targs = append(args, opt()...)\n\t}\n\n\tin, err := tempfile(\"in_\", ext)\n\tif err != nil {\n\t\treturn nil, errors.New(\"primitive: failed to create temporary input file\")\n\t}\n\tdefer os.Remove(in.Name())\n\tout, err := tempfile(\"in_\", ext)\n\tif err != nil {\n\t\treturn nil, errors.New(\"primitive: failed to create temporary output file\")\n\t}\n\tdefer os.Remove(out.Name())\n\n\t// Read image into in file\n\t_, err = io.Copy(in, image)\n\tif err != nil {\n\t\treturn nil, errors.New(\"primitive: failed to copy image into temp input file\")\n\t}\n\n\t// Run primitive w/ -i in.Name() -o out.Name()\n\tstdCombo, err := primitive(in.Name(), out.Name(), numShapes, args...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"primitive: failed to run the primitive command. stdcombo=%s\", stdCombo)\n\t}\n\t// if strings.TrimSpace(stdCombo) == \"\" {\n\t// \tpanic(stdCombo)\n\t// }\n\n\t// read out into a reader, return reader, delete out\n\tb := bytes.NewBuffer(nil)\n\t_, err = io.Copy(b, out)\n\tif err != nil {\n\t\treturn nil, errors.New(\"primitive: Failed to copy output file into byte buffer\")\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "029714f4d9f2d04806a3b7e1ecd2cf93", "score": "0.44538715", "text": "func (p *HashTransformerPlugin) Transform(m resmap.ResMap) error {\n\tfor _, res := range m.Resources() {\n\t\tif res.NeedHashSuffix() {\n\t\t\th, err := res.Hash(p.hasher)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tres.StorePreviousId()\n\t\t\tres.SetName(fmt.Sprintf(\"%s-%s\", res.GetName(), h))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "50c4906cf4ef385c2d7e74f2ce67f0e7", "score": "0.44500482", "text": "func (c *TitusInfoContainer) ImageTagForMetrics() map[string]string {\n\timageName := \"\"\n\tif img := c.ImageName(); img != nil {\n\t\timageName = *img\n\t}\n\n\treturn map[string]string{\"image\": imageName}\n}", "title": "" }, { "docid": "af1d9fe73826ec19a71115d5cd0c93be", "score": "0.44473955", "text": "func (ctx *iterContext) transform(obj interface{}) interface{} {\n\told := reflect.ValueOf(obj)\n\tnew := reflect.New(old.Type()).Elem()\n\tctx.transformRecursive(old, new)\n\treturn new.Interface()\n}", "title": "" }, { "docid": "44040e72a166fb558a715541d5e2c418", "score": "0.4445569", "text": "func (ie *IfdEnumerate) postparseTag(ite *IfdTagEntry, med *MiscellaneousExifData) (err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = log.Wrap(state.(error))\n\t\t}\n\t}()\n\n\t// TODO(dustin): Add test\n\n\tii := ite.IfdIdentity()\n\n\ttagId := ite.TagId()\n\ttagType := ite.TagType()\n\n\tit, err := ie.tagIndex.Get(ii, tagId)\n\tif err == nil {\n\t\tite.setTagName(it.Name)\n\t} else {\n\t\tif err != ErrTagNotFound {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\t// This is an unknown tag.\n\n\t\toriginalBt := exifcommon.BasicTag{\n\t\t\tFqIfdPath: ii.String(),\n\t\t\tIfdPath: ii.UnindexedString(),\n\t\t\tTagId: tagId,\n\t\t}\n\n\t\tif med != nil {\n\t\t\tmed.unknownTags[originalBt] = exifcommon.BasicTag{}\n\t\t}\n\n\t\tutilityLogger.Debugf(nil,\n\t\t\t\"Tag (0x%04x) is not valid for IFD [%s]. Attempting secondary \"+\n\t\t\t\t\"lookup.\", tagId, ii.String())\n\n\t\t// This will overwrite the existing `it` and `err`. Since `FindFirst()`\n\t\t// might generate different Errors than `Get()`, the log message above\n\t\t// is import to try and mitigate confusion in that case.\n\t\tit, err = ie.tagIndex.FindFirst(tagId, tagType, nil)\n\t\tif err != nil {\n\t\t\tif err != ErrTagNotFound {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\n\t\t\t// This is supposed to be a convenience function and if we were\n\t\t\t// to keep the name empty or set it to some placeholder, it\n\t\t\t// might be mismanaged by the package that is calling us. If\n\t\t\t// they want to specifically manage these types of tags, they\n\t\t\t// can use more advanced functionality to specifically -handle\n\t\t\t// unknown tags.\n\t\t\tutilityLogger.Warningf(nil,\n\t\t\t\t\"Tag with ID (0x%04x) in IFD [%s] is not recognized and \"+\n\t\t\t\t\t\"will be ignored.\", tagId, ii.String())\n\n\t\t\treturn ErrTagNotFound\n\t\t}\n\n\t\tite.setTagName(it.Name)\n\n\t\tutilityLogger.Warningf(nil,\n\t\t\t\"Tag with ID (0x%04x) is not valid for IFD [%s], but it *is* \"+\n\t\t\t\t\"valid as tag [%s] under IFD [%s] and has the same type \"+\n\t\t\t\t\"[%s], so we will use that. This EXIF blob was probably \"+\n\t\t\t\t\"written by a buggy implementation.\",\n\t\t\ttagId, ii.UnindexedString(), it.Name, it.IfdPath,\n\t\t\ttagType)\n\n\t\tif med != nil {\n\t\t\tmed.unknownTags[originalBt] = exifcommon.BasicTag{\n\t\t\t\tIfdPath: it.IfdPath,\n\t\t\t\tTagId: tagId,\n\t\t\t}\n\t\t}\n\t}\n\n\t// This is a known tag (from the standard, unless the user did\n\t// something different).\n\n\t// Skip any tags that have a type that doesn't match the type in the\n\t// index (which is loaded with the standard and accept tag\n\t// information unless configured otherwise).\n\t//\n\t// We've run into multiple instances of the same tag, where a) no\n\t// tag should ever be repeated, and b) all but one had an incorrect\n\t// type and caused parsing/conversion woes. So, this is a quick fix\n\t// for those scenarios.\n\tif it.DoesSupportType(tagType) == false {\n\t\tifdEnumerateLogger.Warningf(nil,\n\t\t\t\"Skipping tag [%s] (0x%04x) [%s] with an unexpected type: %v ∉ %v\",\n\t\t\tii.UnindexedString(), tagId, it.Name,\n\t\t\ttagType, it.SupportedTypes)\n\n\t\treturn ErrTagNotFound\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "88ebb2ae5aeb75d1f0d39202857b1511", "score": "0.44432873", "text": "func GetOrientationTag(r io.ReadSeeker) (uint16, error) {\n\tendr, err := splitSearch(r, bufferExif, 8)\n\tif err != nil {\n\t\treturn 0, NoExifError\n\t}\n\tr.Seek(0, io.SeekStart)\n\n\tlittleEndian := endr[6] == 0x49 && endr[7] == 0x49\n\tbufferOrien := bufferOrienBig\n\tif littleEndian {\n\t\tbufferOrien = bufferOrienLittle\n\t}\n\n\tres, err := splitSearch(r, bufferOrien, 10)\n\tif err != nil {\n\t\treturn 0, NoExifError\n\t}\n\tr.Seek(0, io.SeekStart)\n\n\ttagr := res[8:]\n\tif littleEndian {\n\t\ttagr[0], tagr[1] = tagr[1], tagr[0]\n\t}\n\n\tvar tag uint16\n\ttag |= uint16(tagr[1])\n\ttag += uint16(tagr[0]) << 8\n\n\tif tag < 1 || tag > 8 {\n\t\ttag = 1\n\t}\n\n\treturn tag, nil\n}", "title": "" }, { "docid": "0199f0fc880989f1f446ec27f28c7f57", "score": "0.4430106", "text": "func reverseOrientation(img image.Image, o string, logger *CustomLogger) *image.NRGBA {\n\tprefixLog := \"reverseOrientation - \"\n\tswitch o {\n\tcase \"1\":\n\t\treturn imaging.Clone(img)\n\tcase \"2\":\n\t\treturn imaging.FlipV(img)\n\tcase \"3\":\n\t\treturn imaging.Rotate180(img)\n\tcase \"4\":\n\t\treturn imaging.Rotate180(imaging.FlipV(img))\n\tcase \"5\":\n\t\treturn imaging.Rotate270(imaging.FlipV(img))\n\tcase \"6\":\n\t\treturn imaging.Rotate270(img)\n\tcase \"7\":\n\t\treturn imaging.Rotate90(imaging.FlipV(img))\n\tcase \"8\":\n\t\treturn imaging.Rotate90(img)\n\t}\n\tlogger.Println(prefixLog+\"unknown orientation %s, expect 1-8\", o)\n\treturn imaging.Clone(img)\n}", "title": "" }, { "docid": "2ea6a726831c5755e7a7a09c18752d1c", "score": "0.4426858", "text": "func (t *fingerprintTransformation) Transform(ctx *resources.ResourceTransformationCtx) error {\n\th, err := newHash(t.algo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar w io.Writer\n\tif rc, ok := ctx.From.(io.ReadSeeker); ok {\n\t\t// This transformation does not change the content, so try to\n\t\t// avoid writing to To if we can.\n\t\tdefer rc.Seek(0, 0)\n\t\tw = h\n\t} else {\n\t\tw = io.MultiWriter(h, ctx.To)\n\t}\n\n\tio.Copy(w, ctx.From)\n\td, err := digest(h)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx.Data[\"Integrity\"] = integrity(t.algo, d)\n\tctx.AddOutPathIdentifier(\".\" + hex.EncodeToString(d[:]))\n\treturn nil\n}", "title": "" }, { "docid": "7d719f2bce2693b9b7119c71149acded", "score": "0.44172913", "text": "func TagReplace(tag, attr string, rep string) OptionFunc {\n\treturn func(c Converter) error {\n\t\tif c.base() == nil {\n\t\t\treturn errors.New(\"convert should contains a base converter\")\n\t\t}\n\t\tif tag == \"\" || rep == \"\" {\n\t\t\treturn errors.New(\"nil tag not allowed\")\n\t\t}\n\t\tif attr == \"\" {\n\t\t\tattr = \"_all\"\n\t\t}\n\t\tif _, ok := c.base().tagReplaceMap[tag]; ok {\n\t\t\tc.base().tagReplaceMap[tag][attr] = rep\n\t\t} else {\n\t\t\tc.base().tagReplaceMap[tag] = map[string]string{attr: rep}\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "f9b5130b6ef846333ae5c03283a20f5c", "score": "0.44113344", "text": "func (c *camera) transform(vm *lin.M4) *lin.M4 { return c.vt(c.at, c.q0, vm) }", "title": "" }, { "docid": "a453aa5d3ed3ece3c06161b58d2b9f1f", "score": "0.43861076", "text": "func NewImageTagTransformer(slice []types.ImageTag) (Transformer, error) {\n\treturn &imageTagTransformer{slice}, nil\n}", "title": "" }, { "docid": "31183f7493ee96f7ff9f17c3c63e1089", "score": "0.43817636", "text": "func IccTransform(in *C.VipsImage, outputProfile string, options ...*Option) (*C.VipsImage, error) {\n\tvar out *C.VipsImage\n\tvar err error\n\toptions = append(options,\n\t\tInputImage(\"in\", in),\n\t\tInputString(\"output-profile\", outputProfile),\n\t\tOutputImage(\"out\", &out),\n\t)\n\tincOpCounter(\"icc_transform\")\n\terr = vipsCall(\"icc_transform\", options)\n\treturn out, err\n}", "title": "" }, { "docid": "91d8dc71c8102ae338895f0bc7bce2c2", "score": "0.43651196", "text": "func NormalizeImageStreamTag(name string) string {\n\tstripped, tag, ok := SplitImageStreamTag(name)\n\tif !ok {\n\t\t// Default to latest\n\t\treturn JoinImageStreamTag(stripped, tag)\n\t}\n\treturn name\n}", "title": "" }, { "docid": "edc106cfb7d3d103b330863a01dd5082", "score": "0.435941", "text": "func (m *ObjStorageTransformer) TransformToStorage(ctx context.Context, i interface{}) (interface{}, error) {\n\tm.TransformToStorageCalled++\n\treturn i, nil\n}", "title": "" }, { "docid": "be2299475e62de0b84dbf5ae441cfaff", "score": "0.43342257", "text": "func (card *Card) Transform(transformation int) {\n\tswitch transformation {\n\tcase rotate90:\n\t\tcard.rotation = (card.rotation + 90) % 360\n\tcase rotate180:\n\t\tcard.rotation = (card.rotation + 180) % 360\n\tcase rotate270:\n\t\tcard.rotation = (card.rotation + 270) % 360\n\tcase flipHorizontal:\n\t\tcard.isFront = !card.isFront\n\t\tcard.rotation = (card.rotation + 180) % 360\n\t}\n}", "title": "" }, { "docid": "67eebf12b8fa791cfcf1cc6fd94d1079", "score": "0.4325376", "text": "func Transform(slice, fn interface{}) interface{} {\n\treturn transform(slice, fn, false)\n}", "title": "" }, { "docid": "5d0c8296e1cb7d4ca9306cbc9011a9d5", "score": "0.43246448", "text": "func (in *ImageRef) Rot(angle Angle, options ...*Option) error {\n\tout, err := Rot(in.image, angle, options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tin.SetImage(out)\n\treturn nil\n}", "title": "" }, { "docid": "a0f278bf5f527d18575cbd3a68e7a3ca", "score": "0.43240553", "text": "func (i *Image) SetTag(tag string) error {\n\ti.refName = tag\n\treturn i.save()\n}", "title": "" }, { "docid": "3580698a7f4f6ef1214ee2dceaf2aee8", "score": "0.4314852", "text": "func IdentityTransform(ev Event) Event { return ev }", "title": "" }, { "docid": "a5b91926ba73c406d4e248339ec1aab6", "score": "0.4311069", "text": "func (kt *KnativeTransformer) Transform(ir irtypes.IR) error {\n\tlog.Debugf(\"Starting Knative transform\")\n\tlog.Debugf(\"Total services to be transformed : %d\", len(ir.Services))\n\n\tkt.Name = ir.Name\n\tkt.Values = ir.Values\n\tkt.Containers = ir.Containers\n\tkt.TargetClusterSpec = ir.TargetClusterSpec\n\tkt.IgnoreUnsupportedKinds = ir.Kubernetes.IgnoreUnsupportedKinds\n\tkt.TransformedObjects = convertIRToObjects(irtypes.NewEnhancedIRFromIR(ir), kt.getAPIResources())\n\tkt.RootDir = ir.RootDir\n\tlog.Debugf(\"Total transformed objects : %d\", len(kt.TransformedObjects))\n\n\treturn nil\n}", "title": "" }, { "docid": "5fe130b6aa65d1f968ad6d64e1acdc42", "score": "0.43016094", "text": "func (pt *imageTagTransformer) findAndReplaceTag(obj map[string]interface{}) error {\n\tpaths := []string{\"containers\", \"initContainers\"}\n\tfound := false\n\tfor _, path := range paths {\n\t\t_, found = obj[path]\n\t\tif found {\n\t\t\terr := pt.updateContainers(obj, path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif !found {\n\t\treturn pt.findContainers(obj)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "494804eddf00e92db0f616e7e42082eb", "score": "0.43011093", "text": "func (i *ImageT) GetTransform() *helpers.Transform {\n\treturn i.Transform\n}", "title": "" }, { "docid": "536b9be8be71c002bff48fdd9ab14bd0", "score": "0.43004245", "text": "func (pv *PixView) RotateImage(pi *picinfo.Info, deg float32) error {\n\tnon90 := deg != 90 && deg != -90 && deg != 180\n\tif non90 || pi.Sup != filecat.Jpeg {\n\t\timg, err := picinfo.OpenImage(pi.File)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t\timg = picinfo.OrientImage(img, pi.Orient)\n\t\topts := &transform.RotationOptions{ResizeBounds: true}\n\t\timg = transform.Rotate(img, float64(deg), opts)\n\t\tswitch pi.Sup {\n\t\tcase filecat.Jpeg:\n\t\t\trawExif, _ := picinfo.OpenRawExif(pi.File)\n\t\t\tpi.SaveJpegUpdatedExif(rawExif, img)\n\t\tcase filecat.Heic:\n\t\t\trawExif, _ := picinfo.OpenRawExif(pi.File)\n\t\t\tpv.RenameAsJpeg(pi)\n\t\t\tpi.SaveJpegUpdatedExif(rawExif, img)\n\t\tdefault:\n\t\t\tpicinfo.SaveImage(pi.File, img) // todo: need exif support for other formats..\n\t\t}\n\t\tpv.ThumbGen(pi)\n\t} else {\n\t\tpi.Orient = pi.Orient.Rotate(int(deg))\n\t\tpv.SaveExifFile(pi) // does thumbgen\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b50f8a837ae8cbe787eb951cf14f708b", "score": "0.42961115", "text": "func Transform(name string, f func(ctx context.Context, id api.CmdID, cmd api.Cmd, output Writer) error) Transformer {\n\treturn transform{name, f}\n}", "title": "" }, { "docid": "caa57e31b8490dc51c4a2e58848deaf5", "score": "0.4290596", "text": "func (ctx *ValidationContext) transform(root, sig *etree.Element, transforms []*etree.Element) (*etree.Element, Canonicalizer, error) {\n\tif len(transforms) != 2 {\n\t\treturn nil, nil, errors.New(\"Expected Enveloped and C14N transforms\")\n\t}\n\n\tvar canonicalizer Canonicalizer\n\n\tfor _, transform := range transforms {\n\t\talgo := transform.SelectAttr(AlgorithmAttr)\n\t\tif algo == nil {\n\t\t\treturn nil, nil, errors.New(\"Missing Algorithm attribute\")\n\t\t}\n\n\t\tswitch AlgorithmID(algo.Value) {\n\t\tcase EnvelopedSignatureAltorithmId:\n\t\t\tif !recursivelyRemoveElement(root, sig) {\n\t\t\t\treturn nil, nil, errors.New(\"Error applying canonicalization transform: Signature not found\")\n\t\t\t}\n\n\t\tcase CanonicalXML10ExclusiveAlgorithmId:\n\t\t\tvar prefixList string\n\t\t\tins := transform.FindElement(childPath(\"\", InclusiveNamespacesTag))\n\t\t\tif ins != nil {\n\t\t\t\tprefixListEl := ins.SelectAttr(PrefixListAttr)\n\t\t\t\tif prefixListEl != nil {\n\t\t\t\t\tprefixList = prefixListEl.Value\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcanonicalizer = MakeC14N10ExclusiveCanonicalizerWithPrefixList(prefixList)\n\n\t\tcase CanonicalXML11AlgorithmId:\n\t\t\tcanonicalizer = MakeC14N11Canonicalizer()\n\n\t\tdefault:\n\t\t\treturn nil, nil, errors.New(\"Unknown Transform Algorithm: \" + algo.Value)\n\t\t}\n\t}\n\n\tif canonicalizer == nil {\n\t\treturn nil, nil, errors.New(\"Expected canonicalization transform\")\n\t}\n\n\treturn root, canonicalizer, nil\n}", "title": "" }, { "docid": "c7e1f84700ad38387f25cdeda26c4e82", "score": "0.42890468", "text": "func (i *Importer) ImportTag(\n\tctx context.Context, it *imagtagv1.Tag,\n) (imagtagv1.HashReference, error) {\n\tvar zero imagtagv1.HashReference\n\tif it.Spec.From == \"\" {\n\t\treturn zero, fmt.Errorf(\"empty tag reference\")\n\t}\n\n\tregDomain, remainder := i.SplitRegistryDomain(it.Spec.From)\n\n\tregistries := i.syssvc.UnqualifiedRegistries(ctx)\n\tif regDomain != \"\" {\n\t\tregistries = []string{regDomain}\n\t}\n\tif len(registries) == 0 {\n\t\treturn zero, fmt.Errorf(\"no registry candidates found\")\n\t}\n\n\tvar errors *multierror.Error\n\tfor _, registry := range registries {\n\t\timgFullPath := fmt.Sprintf(\"%s/%s\", registry, remainder)\n\t\tnamedReference, err := reference.ParseDockerRef(imgFullPath)\n\t\tif err != nil {\n\t\t\terrors = multierror.Append(errors, err)\n\t\t\tcontinue\n\t\t}\n\n\t\timgref, err := docker.NewReference(namedReference)\n\t\tif err != nil {\n\t\t\terrors = multierror.Append(errors, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tauths, err := i.syssvc.AuthsFor(ctx, imgref, it.Namespace)\n\t\tif err != nil {\n\t\t\terrors = multierror.Append(errors, err)\n\t\t\tcontinue\n\t\t}\n\t\t// adds a no authenticated attempt to the last position so\n\t\t// if everything fails we attempt without auth at all.\n\t\tauths = append(auths, nil)\n\n\t\tfor _, auth := range auths {\n\t\t\tsysctx := &types.SystemContext{\n\t\t\t\tDockerAuthConfig: auth,\n\t\t\t}\n\n\t\t\t// XXX move this to its own func.\n\t\t\timg, err := imgref.NewImage(ctx, sysctx)\n\t\t\tif err != nil {\n\t\t\t\terrors = multierror.Append(errors, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmanifestBlob, _, err := img.Manifest(ctx)\n\t\t\tif err != nil {\n\t\t\t\timg.Close()\n\t\t\t\terrors = multierror.Append(errors, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdefer img.Close()\n\n\t\t\tdgst, err := manifest.Digest(manifestBlob)\n\t\t\tif err != nil {\n\t\t\t\treturn zero, fmt.Errorf(\"error calculating digest: %w\", err)\n\t\t\t}\n\n\t\t\timageref := fmt.Sprintf(\"%s@%s\", imgref.DockerReference().Name(), dgst)\n\t\t\tif it.Spec.Cache {\n\t\t\t\timageref, err = i.cacheTag(ctx, it, imageref, sysctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn zero, fmt.Errorf(\"unable to cache image: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn imagtagv1.HashReference{\n\t\t\t\tGeneration: it.Spec.Generation,\n\t\t\t\tFrom: it.Spec.From,\n\t\t\t\tImportedAt: metav1.NewTime(time.Now()),\n\t\t\t\tImageReference: imageref,\n\t\t\t}, nil\n\t\t}\n\t}\n\treturn zero, errors.ErrorOrNil()\n}", "title": "" }, { "docid": "44bb9b023dc6eabd77fa98733f8ddc01", "score": "0.42813632", "text": "func (p *plugin) Transform(m resmap.ResMap) error {\n\tfor _, res := range m.Resources() {\n\t\tu := unstructured.Unstructured{\n\t\t\tObject: res.Map(),\n\t\t}\n\t\tkind := u.GetKind()\n\t\tif kind == \"SealedSecret\" {\n\t\t\tsec, err := unstructuredToSealedSecret(u)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\th, err := secretHash(sec)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tres.SetName(fmt.Sprintf(\"%s-%s\", res.GetName(), h))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07a2b4681c5c3ff4bac7c45785ca01e7", "score": "0.42657807", "text": "func (o TagOptions) Run() error {\n\tvar tagReferencePolicy imagev1.TagReferencePolicyType\n\tswitch o.referencePolicy {\n\tcase SourceReferencePolicy:\n\t\ttagReferencePolicy = imagev1.SourceTagReferencePolicy\n\tcase LocalReferencePolicy:\n\t\ttagReferencePolicy = imagev1.LocalTagReferencePolicy\n\t}\n\tfor i, destNameAndTag := range o.destNameAndTag {\n\t\tdestName, destTag, ok := imageutil.SplitImageStreamTag(destNameAndTag)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%q must be of the form <stream_name>:<tag>\", destNameAndTag)\n\t\t}\n\n\t\terr := retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\t\tisc := o.client.ImageStreams(o.destNamespace[i])\n\n\t\t\tif o.deleteTag {\n\t\t\t\t// new server support\n\t\t\t\terr := o.client.ImageStreamTags(o.destNamespace[i]).Delete(context.TODO(), imageutil.JoinImageStreamTag(destName, destTag), metav1.DeleteOptions{})\n\t\t\t\tswitch {\n\t\t\t\tcase err == nil:\n\t\t\t\t\tfmt.Fprintf(o.Out, \"Deleted tag %s/%s.\\n\", o.destNamespace[i], destNameAndTag)\n\t\t\t\t\treturn nil\n\n\t\t\t\tcase kerrors.IsMethodNotSupported(err), kerrors.IsForbidden(err):\n\t\t\t\t\t// fall back to legacy behavior\n\t\t\t\tdefault:\n\t\t\t\t\t// error that isn't whitelisted: fail\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// try the old way\n\t\t\t\ttarget, err := isc.Get(context.TODO(), destName, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tif !kerrors.IsNotFound(err) {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\t// Nothing to do here, continue to the next dest tag\n\t\t\t\t\t// if there is any.\n\t\t\t\t\tfmt.Fprintf(o.Out, \"Image stream %q does not exist.\\n\", destName)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\t// The user wants to delete a spec tag.\n\t\t\t\tif _, ok := imageutil.SpecHasTag(target, destTag); !ok {\n\t\t\t\t\treturn fmt.Errorf(\"destination tag %s/%s does not exist.\\n\", o.destNamespace[i], destNameAndTag)\n\t\t\t\t}\n\t\t\t\t// delete tag\n\t\t\t\ttags := []imagev1.TagReference{}\n\t\t\t\tfor i := range target.Spec.Tags {\n\t\t\t\t\tt := target.Spec.Tags[i]\n\t\t\t\t\tif t.Name != destTag {\n\t\t\t\t\t\ttags = append(tags, t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttarget.Spec.Tags = tags\n\n\t\t\t\tif _, err = isc.Update(context.TODO(), target, metav1.UpdateOptions{}); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tfmt.Fprintf(o.Out, \"Deleted tag %s/%s.\\n\", o.destNamespace[i], destNameAndTag)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// The user wants to symlink a tag.\n\t\t\tistag := &imagev1.ImageStreamTag{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: destNameAndTag,\n\t\t\t\t\tNamespace: o.destNamespace[i],\n\t\t\t\t},\n\t\t\t\tTag: &imagev1.TagReference{\n\t\t\t\t\tName: destTag,\n\t\t\t\t\tReference: o.referenceTag,\n\t\t\t\t\tImportPolicy: imagev1.TagImportPolicy{\n\t\t\t\t\t\tInsecure: o.insecureTag,\n\t\t\t\t\t\tScheduled: o.scheduleTag,\n\t\t\t\t\t\tImportMode: imagev1.ImportModeType(o.importMode),\n\t\t\t\t\t},\n\t\t\t\t\tReferencePolicy: imagev1.TagReferencePolicy{\n\t\t\t\t\t\tType: tagReferencePolicy,\n\t\t\t\t\t},\n\t\t\t\t\tFrom: &corev1.ObjectReference{\n\t\t\t\t\t\tKind: o.sourceKind,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tlocalRef := o.ref\n\t\t\tswitch o.sourceKind {\n\t\t\tcase \"DockerImage\":\n\t\t\t\tistag.Tag.From.Name = imagehelpers.DockerImageReferenceExact(localRef)\n\t\t\t\tgen := int64(0)\n\t\t\t\tistag.Tag.Generation = &gen\n\n\t\t\tdefault:\n\t\t\t\tistag.Tag.From.Name = imagehelpers.DockerImageReferenceNameString(localRef)\n\t\t\t\tistag.Tag.From.Namespace = o.ref.Namespace\n\t\t\t\tif len(o.ref.Namespace) == 0 && o.destNamespace[i] != o.namespace {\n\t\t\t\t\tistag.Tag.From.Namespace = o.namespace\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmsg := \"\"\n\t\t\tsameNamespace := o.namespace == o.destNamespace[i]\n\t\t\tif o.aliasTag {\n\t\t\t\tif sameNamespace {\n\t\t\t\t\tmsg = fmt.Sprintf(\"Tag %s set up to track %s.\", destNameAndTag, imagehelpers.DockerImageReferenceExact(o.ref))\n\t\t\t\t} else {\n\t\t\t\t\tmsg = fmt.Sprintf(\"Tag %s/%s set up to track %s.\", o.destNamespace[i], destNameAndTag, imagehelpers.DockerImageReferenceExact(o.ref))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif istag.Tag.ImportPolicy.Scheduled {\n\t\t\t\t\tif sameNamespace {\n\t\t\t\t\t\tmsg = fmt.Sprintf(\"Tag %s set to import %s periodically.\", destNameAndTag, imagehelpers.DockerImageReferenceExact(o.ref))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmsg = fmt.Sprintf(\"Tag %s/%s set to %s periodically.\", o.destNamespace[i], destNameAndTag, imagehelpers.DockerImageReferenceExact(o.ref))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif sameNamespace {\n\t\t\t\t\t\tmsg = fmt.Sprintf(\"Tag %s set to %s.\", destNameAndTag, imagehelpers.DockerImageReferenceExact(o.ref))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmsg = fmt.Sprintf(\"Tag %s/%s set to %s.\", o.destNamespace[i], destNameAndTag, imagehelpers.DockerImageReferenceExact(o.ref))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// supported by new servers.\n\t\t\t_, err := o.client.ImageStreamTags(o.destNamespace[i]).Update(context.TODO(), istag, metav1.UpdateOptions{})\n\t\t\tswitch {\n\t\t\tcase err == nil:\n\t\t\t\tfmt.Fprintln(o.Out, msg)\n\t\t\t\treturn nil\n\n\t\t\tcase kerrors.IsMethodNotSupported(err), kerrors.IsForbidden(err), kerrors.IsNotFound(err):\n\t\t\t\t// if we got one of these errors, it possible that a Create will do what we need. Try that\n\t\t\t\t_, err := o.client.ImageStreamTags(o.destNamespace[i]).Create(context.TODO(), istag, metav1.CreateOptions{})\n\t\t\t\tswitch {\n\t\t\t\tcase err == nil:\n\t\t\t\t\tfmt.Fprintln(o.Out, msg)\n\t\t\t\t\treturn nil\n\n\t\t\t\tcase kerrors.IsMethodNotSupported(err), kerrors.IsForbidden(err):\n\t\t\t\t\t// fall back to legacy behavior\n\t\t\t\tdefault:\n\t\t\t\t\t// error that isn't whitelisted: fail\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\t// error that isn't whitelisted: fail\n\t\t\t\treturn err\n\n\t\t\t}\n\n\t\t\ttarget, err := isc.Get(context.TODO(), destName, metav1.GetOptions{})\n\t\t\tif kerrors.IsNotFound(err) {\n\t\t\t\ttarget = &imagev1.ImageStream{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\tName: destName,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t} else if err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif target.Spec.Tags == nil {\n\t\t\t\ttarget.Spec.Tags = []imagev1.TagReference{}\n\t\t\t}\n\n\t\t\tif oldTargetTag, exists := imageutil.SpecHasTag(target, destTag); exists {\n\t\t\t\tif oldTargetTag.Generation == nil {\n\t\t\t\t\t// for servers that do not support tag generations, we need to force re-import to fetch its metadata\n\t\t\t\t\tdelete(target.Annotations, imagev1.DockerImageRepositoryCheckAnnotation)\n\t\t\t\t\tistag.Tag.Generation = nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// create or update tag\n\t\t\tfound := false\n\t\t\tfor i := range target.Spec.Tags {\n\t\t\t\tt := &target.Spec.Tags[i]\n\t\t\t\tif t.Name == destTag {\n\t\t\t\t\t*t = *istag.Tag\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\ttarget.Spec.Tags = append(target.Spec.Tags, *istag.Tag)\n\t\t\t}\n\n\t\t\t// Check the stream creation timestamp and make sure we will not\n\t\t\t// create a new image stream while deleting.\n\t\t\tif target.CreationTimestamp.IsZero() && !o.deleteTag {\n\t\t\t\t_, err = isc.Create(context.TODO(), target, metav1.CreateOptions{})\n\t\t\t} else {\n\t\t\t\t_, err = isc.Update(context.TODO(), target, metav1.UpdateOptions{})\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Fprintln(o.Out, msg)\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c642626850928b0c21e2b12a69227fa5", "score": "0.42643952", "text": "func (m *mirror) tagImage(tag string) error {\n\tm.log.Info(\"Starting docker tag\")\n\tdefer m.timeTrack(time.Now(), \"Completed docker tag\")\n\n\ttagOptions := docker.TagImageOptions{\n\t\tRepo: fmt.Sprintf(\"%s/%s\", config.Target.Registry, m.targetRepositoryName()),\n\t\tTag: tag,\n\t\tForce: true,\n\t}\n\n\tswitch m.repo.Host {\n\tcase dockerHub:\n\t\treturn (*m.dockerClient).TagImage(fmt.Sprintf(\"%s:%s\", m.repo.Name, tag), tagOptions)\n\tcase quay:\n\t\treturn (*m.dockerClient).TagImage(fmt.Sprintf(\"%s/%s:%s\", quay, m.repo.Name, tag), tagOptions)\n\tcase gcr:\n\t\treturn (*m.dockerClient).TagImage(fmt.Sprintf(\"%s/%s:%s\", gcr, m.repo.Name, tag), tagOptions)\n\tcase k8s:\n\t\treturn (*m.dockerClient).TagImage(fmt.Sprintf(\"%s/%s:%s\", k8s, m.repo.Name, tag), tagOptions)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "81a4fd76a35bec4efffa305cdbfbf974", "score": "0.42436844", "text": "func (m *MultiLabelBinarizer) Transform(X, Y mat.Matrix) (Xout, Yout *mat.Dense) {\n\treturn m.Transform2(X, Y)\n}", "title": "" }, { "docid": "3f228be810744181b4aeb7c5845e2ec5", "score": "0.42397067", "text": "func (t *Tekton) Transform(newArtifacts []transformertypes.Artifact, oldArtifacts []transformertypes.Artifact) (pathMappings []transformertypes.PathMapping, createdArtifacts []transformertypes.Artifact, err error) {\n\tlogrus.Debugf(\"Translating IR using Kubernetes transformer\")\n\tpathMappings = []transformertypes.PathMapping{}\n\tcreatedArtifacts = []transformertypes.Artifact{}\n\tfor _, a := range newArtifacts {\n\t\tif a.Artifact != irtypes.IRArtifactType {\n\t\t\tcontinue\n\t\t}\n\t\tvar ir irtypes.IR\n\t\tif err := a.GetConfig(irtypes.IRConfigType, &ir); err != nil {\n\t\t\tlogrus.Errorf(\"unable to load config for Transformer into %T : %s\", ir, err)\n\t\t\tcontinue\n\t\t}\n\t\tir.Name = a.Name\n\t\tpreprocessedIR, err := irpreprocessor.Preprocess(ir)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Unable to prepreocess IR : %s\", err)\n\t\t} else {\n\t\t\tir = preprocessedIR\n\t\t}\n\t\tapis := []apiresource.IAPIResource{\n\t\t\tnew(apiresource.Service),\n\t\t\tnew(apiresource.ServiceAccount),\n\t\t\tnew(apiresource.RoleBinding),\n\t\t\tnew(apiresource.Role),\n\t\t\tnew(apiresource.Storage),\n\t\t\tnew(apiresource.EventListener),\n\t\t\tnew(apiresource.TriggerBinding),\n\t\t\tnew(apiresource.TriggerTemplate),\n\t\t\tnew(apiresource.Pipeline),\n\t\t}\n\t\tdeployCICDDir := filepath.Join(common.DeployDir, common.CICDDir, \"tekton\")\n\t\ttempDest := filepath.Join(t.Env.TempPath, deployCICDDir)\n\t\tlogrus.Infof(\"Generating Tekton pipeline for CI/CD\")\n\t\tenhancedIR := t.setupEnhancedIR(ir, t.Env.GetProjectName())\n\t\tfiles, err := apiresource.TransformAndPersist(enhancedIR, tempDest, apis, t.Env.TargetCluster)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Unable to transform and persist IR : %s\", err)\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tfor _, f := range files {\n\t\t\tdestPath, err := filepath.Rel(t.Env.TempPath, f)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"Invalid yaml path : %s\", destPath)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpathMappings = append(pathMappings, transformertypes.PathMapping{\n\t\t\t\tType: transformertypes.DefaultPathMappingType,\n\t\t\t\tSrcPath: f,\n\t\t\t\tDestPath: destPath,\n\t\t\t})\n\t\t}\n\t\ta := transformertypes.Artifact{\n\t\t\tName: t.Config.Name,\n\t\t\tArtifact: artifacts.KubernetesYamlsArtifactType,\n\t\t\tPaths: map[transformertypes.PathType][]string{\n\t\t\t\tartifacts.KubernetesYamlsPathType: {deployCICDDir},\n\t\t\t},\n\t\t}\n\t\tcreatedArtifacts = append(createdArtifacts, a)\n\t\tlogrus.Debugf(\"Total transformed objects : %d\", len(files))\n\t}\n\treturn pathMappings, createdArtifacts, nil\n}", "title": "" }, { "docid": "ea3e9f0c6099541e74c7959a62eddd5e", "score": "0.423861", "text": "func normalizeNameTag(image string) (string, string, error) {\n\t// Remove illegal characters when image is \"<none>:<none>\"\n\tre := regexp.MustCompile(`<|>`)\n\timage = re.ReplaceAllString(image, \"\")\n\tref, err := reference.ParseNormalizedNamed(image)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"error parsing image name '%s': %v\", image, err)\n\t}\n\ttag := \"\"\n\tnt, isTagged := ref.(reference.NamedTagged)\n\tif isTagged {\n\t\ttag = nt.Tag()\n\t}\n\treturn ref.Name(), tag, nil\n}", "title": "" }, { "docid": "f8008e3e19aaa3527267d8079becd191", "score": "0.42229992", "text": "func (x TransformBase64Decode) Transform(in []byte) ([]byte, error) {\n\tresult := make([]byte, base64.StdEncoding.DecodedLen(len(in)))\n\t_, err := base64.StdEncoding.Decode(result, in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "a8f46095b85d234fa528d964a0d631c5", "score": "0.42220238", "text": "func (r *rubiksCube) transform(p func(sticker) bool, t func(ivec3) ivec3) {\n\tfor i, s := range *r {\n\t\tif p(s) {\n\t\t\t(*r)[i] = s.transform(t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4456c0c96a76e7fcfafdbb189f8d23b6", "score": "0.42185512", "text": "func (l List) TransformTags(f func(Tags) Tags) List {\n\tcache := map[string]Tags{}\n\tout := List{}\n\tfor _, r := range l {\n\t\tkey := TagsToString(r.Tags)\n\t\ttags, cached := cache[key]\n\t\tif !cached {\n\t\t\ttags = f(r.Tags.Clone())\n\t\t\tcache[key] = tags\n\t\t}\n\t\tout = append(out, Result{\n\t\t\tQuery: r.Query,\n\t\t\tTags: tags,\n\t\t\tStatus: r.Status,\n\t\t\tDuration: r.Duration,\n\t\t\tMayExonerate: r.MayExonerate,\n\t\t})\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1080f693cb381cf33d35dd2bbafeba8c", "score": "0.42138746", "text": "func FixJpgOrientation(data []byte) (oriented []byte) {\n\tex, err := exif.Decode(bytes.NewReader(data))\n\tif err != nil {\n\t\treturn data\n\t}\n\ttag, err := ex.Get(exif.Orientation)\n\tif err != nil {\n\t\treturn data\n\t}\n\tangle := 0\n\tflipMode := FlipDirection(0)\n\torient, err := tag.Int(0)\n\tif err != nil {\n\t\treturn data\n\t}\n\tswitch orient {\n\tcase topLeftSide:\n\t\t// do nothing\n\t\treturn data\n\tcase topRightSide:\n\t\tflipMode = 2\n\tcase bottomRightSide:\n\t\tangle = 180\n\tcase bottomLeftSide:\n\t\tangle = 180\n\t\tflipMode = 2\n\tcase leftSideTop:\n\t\tangle = -90\n\t\tflipMode = 2\n\tcase rightSideTop:\n\t\tangle = -90\n\tcase rightSideBottom:\n\t\tangle = 90\n\t\tflipMode = 2\n\tcase leftSideBottom:\n\t\tangle = 90\n\t}\n\n\tif srcImage, _, err := image.Decode(bytes.NewReader(data)); err == nil {\n\t\tdstImage := flip(rotate(srcImage, angle), flipMode)\n\t\tvar buf bytes.Buffer\n\t\tjpeg.Encode(&buf, dstImage, nil)\n\t\treturn buf.Bytes()\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "7d8f533ca5711fd41963378879f1f970", "score": "0.41973147", "text": "func (c *Converter) transformOPF2(doc *etree.Document) error {\n\ttransformOPF2coverImage(doc) // mandatory\n\ttransformOPF2calibreMeta(doc)\n\tdoc.Indent(4)\n\treturn nil\n}", "title": "" }, { "docid": "ae3a14154589ddeca2ab1c195756f690", "score": "0.41917697", "text": "func (self *Canvas) SetTransformI(args ...interface{}) dom.CanvasRenderingContext2D{\n return WrapCanvasRenderingContext2D(self.Object.Call(\"setTransform\", args))\n}", "title": "" }, { "docid": "9e8cbb3d744e3cfdb4458a593856ed1e", "score": "0.4180791", "text": "func RemoveTag(filenames []string, tagnames []string) error {\n\tfor _, filename := range filenames {\n\t\tmedia, err := getMedia(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif media.Index == 0 { // Media not formatted. Leave it alone\n\t\t\tcontinue\n\t\t}\n\t\toldname, err := media.FormatName()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Remove tags\n\t\tfor _, tagname := range tagnames {\n\t\t\tdelete(media.Tags, tagname)\n\t\t}\n\t\tnewname, err := media.FormatName()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if oldname == newname { // No change. We're done here!\n\t\t\tcontinue\n\t\t}\n\t\t// Build new path\n\t\tfileDir := filepath.Dir(filename)\n\t\tnewPath := filepath.Join(fileDir, newname)\n\t\t// Ensure newpath does not exist\n\t\tif _, err := os.Stat(newPath); !os.IsNotExist(err) {\n\t\t\tif err == nil {\n\t\t\t\treturn os.ErrExist\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tif err := os.Rename(filename, newPath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae9757536f63ad8e75015a99cb21b157", "score": "0.4171369", "text": "func (in *ImageRef) Rot45(options ...*Option) error {\n\tout, err := Rot45(in.image, options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tin.SetImage(out)\n\treturn nil\n}", "title": "" }, { "docid": "5132781d53a8620ae56504dcca133338", "score": "0.41575497", "text": "func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {\n\treturn t.t.Transform(dst, src, atEOF)\n}", "title": "" }, { "docid": "c79cb3d33036e37c3b7f62eec3e1b07d", "score": "0.41570863", "text": "func (m *LabelEncoder) Transform(X, Y mat.Matrix) (Xout, Yout *mat.Dense) {\n\tYmat := base.ToDense(Y).RawMatrix()\n\tYout = mat.NewDense(Ymat.Rows, Ymat.Cols, nil)\n\tYoutmat := Yout.RawMatrix()\n\tfor jY, jYout := 0, 0; jY < Ymat.Rows*Ymat.Stride; jY, jYout = jY+Ymat.Stride, jYout+Youtmat.Stride {\n\t\tfor i, v := range Ymat.Data[jY : jY+Ymat.Cols] {\n\t\t\tpos := sort.SearchFloat64s(m.Classes[i], v)\n\t\t\tif pos < 0 || pos >= len(m.Classes[i]) {\n\t\t\t\tpos = -1\n\t\t\t}\n\t\t\tYoutmat.Data[jYout+i] = float64(pos)\n\t\t}\n\t}\n\tXout = base.ToDense(X)\n\treturn\n}", "title": "" }, { "docid": "8299445a80a284a188ff6ad5d8688edb", "score": "0.41570696", "text": "func UnpackTag(tag Tag) (Sequence, Kind) {\n\treturn Sequence(tag >> kindBits), Kind(tag & 0xff)\n}", "title": "" }, { "docid": "c3c05424824d96d697b5e0a21a6e7158", "score": "0.41515842", "text": "func applyTransformation() {\n\tif (queueParts < 1 && queueOp == SCALE) || queueOp == NOTHING {\n\t\topText = \"Complete.\"\n\t\treturn\n\t}\n\n\tfor j, o := range worldSpace {\n\t\tvar newPoints []Point\n\t\t// Transform each point in the object\n\t\tfor _, j := range o.P {\n\t\t\tnewPoints = append(newPoints, transform(transformMatrix, j))\n\t\t}\n\t\to.P = newPoints\n\n\t\t// Transform the mid point of the object. In theory, this should mean the mid point can always be used\n\t\t// for a simple (not-cpu-intensive) way to sort the objects in Z depth order\n\t\to.Mid = transform(transformMatrix, o.Mid)\n\n\t\t// Update the object in world space\n\t\tworldSpace[j] = o\n\t}\n\n\tqueueParts--\n}", "title": "" }, { "docid": "b2514d8cafc6b4dd4426a64767ccab29", "score": "0.41479865", "text": "func Transform(key string, f func(val interface{}) (interface{}, error)) Updater {\n\treturn func(data interface{}) error {\n\t\treturn TransformKey(data, key, f)\n\t}\n}", "title": "" }, { "docid": "1244ff9d4de8df8a785f53ecd3fc3916", "score": "0.41461724", "text": "func (s *Stream) Transform(op api.UnOperation) *Stream {\n\toperator := NewUnaryOp(s.ctx)\n\toperator.SetOperation(op)\n\ts.ops = append(s.ops, operator)\n\treturn s\n}", "title": "" }, { "docid": "fa6689af823471e326e72ec75aa4a6e4", "score": "0.41397166", "text": "func (a *Activity) FormatTag() string {\n\tif a.TagIndex != \"\" {\n\t\treturn \"[\" + a.Tag + a.TagIndex + \"]\"\n\t}\n\treturn \"[\" + a.Tag + \"]\"\n}", "title": "" }, { "docid": "1e0f6b1ff1c26784b55f75a0f7fd2b39", "score": "0.41255143", "text": "func (p *Plugin) naiveDiscardExif(info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string) {\n\tim, _, err := image.Decode(file)\n\tif err != nil {\n\t\tp.API.LogError(\"An error occurred while trying to decoding the uploaded file\")\n\t\treturn nil, fmt.Sprintf(\"An error occurred while trying to decode the uploaded file: %v\", err)\n\t}\n\terr = jpeg.Encode(output, im, nil)\n\tif err != nil {\n\t\tp.API.LogError(\"An error occurred while trying to encode the uploaded file\")\n\t\treturn nil, fmt.Sprintf(\"An error occurred while trying to encode the uploaded file: %v\", err)\n\t}\n\tp.API.LogInfo(\"Processed a new image.\")\n\treturn info, \"\"\n}", "title": "" }, { "docid": "891e678ec8dcb4914626bde76973d238", "score": "0.4118643", "text": "func (i *Image) TagImage(tag string) error {\n\ti.reloadImage()\n\tref, err := normalizedTag(tag)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttags := i.Names()\n\tif util.StringInSlice(ref.String(), tags) {\n\t\treturn nil\n\t}\n\ttags = append(tags, ref.String())\n\tif err := i.imageruntime.store.SetNames(i.ID(), tags); err != nil {\n\t\treturn err\n\t}\n\ti.reloadImage()\n\tdefer i.newImageEvent(events.Tag)\n\treturn nil\n}", "title": "" }, { "docid": "7a9e248cf54928251983cac2954191a6", "score": "0.41172105", "text": "func (svc *ServiceContext) RotateImage(c *gin.Context) {\n\tlog.Printf(\"INFO: rotate image requested\")\n\tsubID := c.Param(\"id\")\n\tsubPath := fmt.Sprintf(\"%s/submitted\", svc.UploadDir)\n\timgPath := strings.Replace(c.Query(\"url\"), \"/uploads\", subPath, -1)\n\tlog.Printf(\"INFO: submission %s: rotate image %s\", subID, imgPath)\n\tif _, err := os.Stat(imgPath); err != nil {\n\t\tlog.Printf(\"ERROR: file %s not found\", imgPath)\n\t\tc.String(http.StatusNotFound, fmt.Sprintf(\"%s not found\", imgPath))\n\t\treturn\n\t}\n\n\terr := rotateImage(imgPath)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: rotate %s failed: %s\", imgPath, err.Error())\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tthumbPath := getThumbFilename(imgPath)\n\terr = rotateImage(thumbPath)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: rotate THUMB %s failed: %s\", thumbPath, err.Error())\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.String(http.StatusOK, \"rotated\")\n}", "title": "" }, { "docid": "88f143d00d78331f421581c0cfd02e22", "score": "0.41060773", "text": "func (i *Importer) cacheTag(\n\tctx context.Context,\n\tit *imagtagv1.Tag,\n\tfrom string,\n\tsrcCtx *types.SystemContext,\n) (string, error) {\n\tfromRef, err := i.ImageRefForStringRef(from)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tinregaddr, outregaddr, err := i.syssvc.CacheRegistryAddresses()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// We cache images under registry/namespace/image-tag.\n\tto := fmt.Sprintf(\"%s/%s/%s\", inregaddr, it.Namespace, it.Name)\n\ttoRef, err := i.ImageRefForStringRef(to)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpolctx, err := i.DefaultPolicyContext()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmanifest, err := imgcopy.Image(\n\t\tctx, polctx, toRef, fromRef, &imgcopy.Options{\n\t\t\tImageListSelection: imgcopy.CopyAllImages,\n\t\t\tSourceCtx: srcCtx,\n\t\t\tDestinationCtx: i.syssvc.CacheRegistryContext(ctx),\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\n\t\t\"%s/%s/%s@sha256:%x\", outregaddr, it.Namespace, it.Name, sha256.Sum256(manifest),\n\t), nil\n}", "title": "" }, { "docid": "bc1a8593fb4da9e19dd91ac07112cdd6", "score": "0.41035947", "text": "func (s *SliceUint32) Transform(fn func(elem uint32) uint32) *SliceUint32 {\n\tif s == nil {\n\t\treturn nil\n\t}\n\tfor i, elem := range s.data {\n\t\ts.data[i] = fn(elem)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5f666832390be4742c85aad4f04e1c57", "score": "0.40878472", "text": "func (i *scannerItem) transformMetaDir() {\n\tsplit := strings.Split(i.prefix, SlashSeparator)\n\tif len(split) > 1 {\n\t\ti.prefix = path.Join(split[:len(split)-1]...)\n\t} else {\n\t\ti.prefix = \"\"\n\t}\n\t// Object name is last element\n\ti.objectName = split[len(split)-1]\n}", "title": "" }, { "docid": "058cd5ecc1073320fc4fccd264ce1151", "score": "0.4083661", "text": "func exifOrientation(r io.Reader) (opt Options) {\n\t// Exif Orientation Tag values\n\t// http://sylvana.net/jpegcrop/exif_orientation.html\n\tconst (\n\t\ttopLeftSide = 1\n\t\ttopRightSide = 2\n\t\tbottomRightSide = 3\n\t\tbottomLeftSide = 4\n\t\tleftSideTop = 5\n\t\trightSideTop = 6\n\t\trightSideBottom = 7\n\t\tleftSideBottom = 8\n\t)\n\n\tex, err := exif.Decode(r)\n\tif err != nil {\n\t\treturn opt\n\t}\n\ttag, err := ex.Get(exif.Orientation)\n\tif err != nil {\n\t\treturn opt\n\t}\n\torient, err := tag.Int(0)\n\tif err != nil {\n\t\treturn opt\n\t}\n\n\tswitch orient {\n\tcase topLeftSide:\n\t\t// do nothing\n\tcase topRightSide:\n\t\topt.FlipHorizontal = true\n\tcase bottomRightSide:\n\t\topt.Rotate = 180\n\tcase bottomLeftSide:\n\t\topt.FlipVertical = true\n\tcase leftSideTop:\n\t\topt.Rotate = 90\n\t\topt.FlipVertical = true\n\tcase rightSideTop:\n\t\topt.Rotate = -90\n\tcase rightSideBottom:\n\t\topt.Rotate = 90\n\t\topt.FlipHorizontal = true\n\tcase leftSideBottom:\n\t\topt.Rotate = 90\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "245e42ff18ee04cc014212420bf61f3c", "score": "0.40830117", "text": "func makeTransformImageGraph(imageFormat ImageType) (graph *tf.Graph, input, output tf.Output, err error) {\n\tconst (\n\t\tH, W = 224, 224\n\t\tMean = float32(117)\n\t\tScale = float32(1)\n\t)\n\ts := op.NewScope()\n\tinput = op.Placeholder(s, tf.String)\n\n\t// Decode PNG or JPEG\n\tvar decode tf.Output\n\tif imageFormat == PNG {\n\t\tdecode = op.DecodePng(s, input, op.DecodePngChannels(3))\n\t} else if imageFormat == JPG {\n\t\tdecode = op.DecodeJpeg(s, input, op.DecodeJpegChannels(3))\n\t} else {\n\t\terr := errors.New(\"Unsupported image type given: \" + imageFormat.string() + \" Expecting \" + PNG.string() + \" or \" + JPG.string())\n\t\treturn nil, input, decode, err\n\t}\n\n\t// Div and Sub perform (value-Mean)/Scale for each pixel\n\toutput = op.Div(s,\n\t\top.Sub(s,\n\t\t\t// Resize to 224x224 with bilinear interpolation\n\t\t\top.ResizeBilinear(s,\n\t\t\t\t// Create a batch containing a single image\n\t\t\t\top.ExpandDims(s,\n\t\t\t\t\t// Use decoded pixel values\n\t\t\t\t\top.Cast(s, decode, tf.Float),\n\t\t\t\t\top.Const(s.SubScope(\"make_batch\"), int32(0))),\n\t\t\t\top.Const(s.SubScope(\"size\"), []int32{H, W})),\n\t\t\top.Const(s.SubScope(\"mean\"), Mean)),\n\t\top.Const(s.SubScope(\"scale\"), Scale))\n\tgraph, err = s.Finalize()\n\treturn graph, input, output, err\n}", "title": "" }, { "docid": "1a9b455677146fe6714092e8d5a00f15", "score": "0.407851", "text": "func (c *Context) Transform(tmpl *template.Template) (string, error) {\n\tbuff := new(bytes.Buffer)\n\tif err := tmpl.Execute(buff, c); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buff.String(), nil\n}", "title": "" }, { "docid": "80940111844add026e73e32928045e6f", "score": "0.40743738", "text": "func (t NoopTransformer) Transform(traceID uuid.UUID, body []byte) ([]byte, error) {\n\treturn body, nil\n}", "title": "" }, { "docid": "6f69dc1d79b2b7f21b9c5bed364a3e82", "score": "0.40666103", "text": "func (dockerExecutorImpl) ImageTag(imageID string, repoTags string) error {\n\tlogger.Logging(logger.DEBUG)\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\terr := getImageTag(client, context.Background(), imageID, repoTags)\n\tif err != nil {\n\t\tlogger.Logging(logger.DEBUG, err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6bee41417c75299ae2f9f9c895a9d060", "score": "0.40660992", "text": "func (client *HtmlToImageClient) SetTag(tag string) *HtmlToImageClient {\n client.fields[\"tag\"] = tag\n return client\n}", "title": "" }, { "docid": "83a3bc30ef4fcd13ff3ad1d03ccf47c1", "score": "0.40645772", "text": "func (ih DefaultImageHandler) Compress(input *Image, quality int64) (*Image, error) {\n\treturn input, nil\n}", "title": "" }, { "docid": "33043059516e90fa30b2b3143caba758", "score": "0.40594563", "text": "func Rotate(img image.Image, angle float64, outSize int) image.Image {\n\tcos := math.Cos(angle)\n\tsin := math.Sin(angle)\n\n\twidth := float64(img.Bounds().Dx())\n\theight := float64(img.Bounds().Dy())\n\taxisBasis := &linalg.Matrix{\n\t\tRows: 2,\n\t\tCols: 2,\n\t\tData: []float64{\n\t\t\tcos * width / 2, -sin * height / 2,\n\t\t\tsin * width / 2, cos * height / 2,\n\t\t},\n\t}\n\n\tinv := ludecomp.Decompose(axisBasis)\n\tvar sideLength float64\n\tfor rectFits(inv, sideLength+1) {\n\t\tsideLength++\n\t}\n\n\tscale := sideLength / float64(outSize)\n\n\tinImage := newRGBACache(img)\n\tnewImage := image.NewRGBA(image.Rect(0, 0, int(outSize), int(outSize)))\n\tfor x := 0; x < int(outSize); x++ {\n\t\tfor y := 0; y < int(outSize); y++ {\n\t\t\txOff := scale*float64(x) - sideLength/2\n\t\t\tyOff := scale*float64(y) - sideLength/2\n\t\t\tnewX := cos*xOff + sin*yOff + width/2\n\t\t\tnewY := cos*yOff - sin*xOff + height/2\n\t\t\tnewImage.SetRGBA(x, y, interpolate(inImage, newX, newY))\n\t\t}\n\t}\n\n\treturn newImage\n}", "title": "" }, { "docid": "ca7359a978ced23ef51b3a0351060279", "score": "0.40525594", "text": "func (r *Resolver) Tag() generated.TagResolver { return &tagResolver{r} }", "title": "" }, { "docid": "ca7359a978ced23ef51b3a0351060279", "score": "0.40525594", "text": "func (r *Resolver) Tag() generated.TagResolver { return &tagResolver{r} }", "title": "" }, { "docid": "0e39a7d4fa9d8933ce449cb7dd5c3cab", "score": "0.40502", "text": "func (image *image) Tag() string {\n\treturn image.tag\n}", "title": "" }, { "docid": "f6204fdb405b772960234f9eadc67631", "score": "0.404667", "text": "func (c *CICDTransformer) Transform(ir irtypes.IR) error {\n\tc.TargetClusterSpec = ir.TargetClusterSpec\n\tc.IgnoreUnsupportedKinds = ir.Kubernetes.IgnoreUnsupportedKinds\n\tif ir.TargetClusterSpec.IsTektonInstalled() {\n\t\tlog.Infof(\"The target cluster has support for Tekton, generating Tekton pipeline for CI/CD\")\n\t} else if ir.TargetClusterSpec.IsBuildConfigSupported() {\n\t\tlog.Infof(\"The target cluster has support for BuildConfig, generating build configs for CI/CD\")\n\t\tb := cicd.NewBuildconfigTransformer()\n\t\tc.transformedObjects = convertIRToObjects(b.SetupEnhancedIR(ir), b.GetAPIResources())\n\t\tc.extraFiles = b.ExtraFiles\n\t} else {\n\t\tlog.Infof(\"Neither Tekton nor BuildConfig was found on the target cluster. Defaulting to Tekton pipeline for CI/CD.\")\n\t}\n\tt := new(cicd.TektonTransformer)\n\tc.transformedObjects = convertIRToObjects(t.SetupEnhancedIR(ir), t.GetAPIResources())\n\treturn nil\n}", "title": "" }, { "docid": "13f32a84d54aa24c7eee3d67d26ea9b1", "score": "0.40453047", "text": "func RunTag(ctx CommandContext, args TagArgs) error {\n\tsnapshotID, err := ctx.API.GetSnapshotID(args.Snapshot)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsnapshot, err := ctx.API.GetSnapshot(snapshotID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot fetch snapshot: %v\", err)\n\t}\n\n\tbootscriptID := \"\"\n\tif args.Bootscript != \"\" {\n\t\tbootscriptID, err = ctx.API.GetBootscriptID(args.Bootscript, args.Arch)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\timage, err := ctx.API.PostImage(snapshot.Identifier, args.Name, bootscriptID, args.Arch)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot create image: %v\", err)\n\t}\n\tfmt.Fprintln(ctx.Stdout, image)\n\treturn nil\n}", "title": "" }, { "docid": "eec0c758ef8455c4045ca5b2a49bcacc", "score": "0.40374017", "text": "func (self *BitmapText) UpdateTransform() {\n self.Object.Call(\"updateTransform\")\n}", "title": "" }, { "docid": "7a6847c4e008dedaaf2cfa87562d9630", "score": "0.40343732", "text": "func Obj2Img(v, ofs vec.V3f, scale float32) vec.V2i {\n\tp := v.Sum(ofs).Scale(scale)\n\treturn vec.V2i{int(p[0]), int(p[1])}\n}", "title": "" }, { "docid": "f031419f476b4aa7e62f96ca2cebd19f", "score": "0.402581", "text": "func Transform(v interface{}) (interface{}, error) {\n\ttransformerFunc, ok := typeMap[reflect.TypeOf(v)]\n\tif !ok {\n\t\treturn nil, ErrUnknownTypeToTransform\n\t}\n\n\treturn transformerFunc(v), nil\n}", "title": "" }, { "docid": "b5ba6e601a1fb876802b1e6898daecf6", "score": "0.40201083", "text": "func (o ImageOutput) Tags() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "20bf3e25ac58ac9ad8b0962838696c21", "score": "0.40079203", "text": "func (t *Transformer) Transform(ctx context.Context, md pmetric.Metrics) error {\n\treturn t.consumer(ctx, md)\n}", "title": "" }, { "docid": "bff97a850873cc93902de2d98028468c", "score": "0.40029943", "text": "func (f *Factory) Transform(m map[string]interface{}) error {\n\tvar challenges, frontendLinks []string\n\tfor _, transform := range f.transforms {\n\t\tif matched := transform.matcher.Allow(context.Background(), m); !matched {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, args := range transform.actions {\n\t\t\tswitch args[0] {\n\t\t\tcase \"block\", \"deny\":\n\t\t\t\treturn fmt.Errorf(\"transformer action is block/deny\")\n\t\t\tcase \"require\":\n\t\t\t\tchallenges = append(challenges, cfgutils.EncodeArgs(args))\n\t\t\tcase \"link\":\n\t\t\t\tfrontendLinks = append(frontendLinks, cfgutils.EncodeArgs(args[1:]))\n\t\t\tdefault:\n\t\t\t\tif err := transformData(args, m); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"transformer for %v erred: %v\", args, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif len(challenges) > 0 {\n\t\tm[\"challenges\"] = challenges\n\t}\n\tif len(frontendLinks) > 0 {\n\t\tm[\"frontend_links\"] = frontendLinks\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4af1caf61151cffc34d2cfbb989903c6", "score": "0.39929068", "text": "func (self *Patch) Transform(opts TransformOpts) *Patch {\n\treturn transform(self, opts)\n}", "title": "" }, { "docid": "83fed5aaef0e2870702886ddf3d12f1f", "score": "0.39907756", "text": "func (t *tl8transformer) Transform(doc *ast.Document, reader text.Reader, pc parser.Context) {\n\tast.Walk(doc, func(n ast.Node, entering bool) (ast.WalkStatus, error) {\n\t\t//log.Printf(\"ast.Walk(type=%v, kind=%v)\", n.Type(), n.Kind())\n\t\tif n.Type() == ast.TypeDocument {\n\t\t\treturn ast.WalkContinue, nil\n\t\t}\n\t\tif n.Kind() == ast.KindHeading && entering {\n\t\t\tmodifyASTFromHeading(n)\n\t\t}\n\t\treturn ast.WalkSkipChildren, nil\n\t})\n}", "title": "" }, { "docid": "abe5175f362d62f3eafa8e39efc99bd7", "score": "0.39891797", "text": "func (ctx *Context2D) Transform(a, b, c, d, e, f float64) {\r\n\tctx.Call(\"transform\", a, b, c, d, e, f)\r\n}", "title": "" }, { "docid": "abe5175f362d62f3eafa8e39efc99bd7", "score": "0.39891797", "text": "func (ctx *Context2D) Transform(a, b, c, d, e, f float64) {\r\n\tctx.Call(\"transform\", a, b, c, d, e, f)\r\n}", "title": "" }, { "docid": "bd3d3532736aeb3535bb8364a0f55a57", "score": "0.39883628", "text": "func (o *V1Image) GetTagOk() (*string, bool) {\n\tif o == nil || o.Tag == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Tag, true\n}", "title": "" }, { "docid": "04fc5834db206ad8b1a2a0cffe6271a3", "score": "0.39840773", "text": "func (j Jotter) Tag(msg string) Jotter {\n\tif j.Context != nil {\n\t\tmemo.TagKey.Transcribe(j.Context, &j.Page, msg)\n\t}\n\treturn j\n}", "title": "" }, { "docid": "7cb4d5e1f8a30571d14d4d00f1e9c31b", "score": "0.3977739", "text": "func tagImage(ctx context.Context, imageName string, newImageName string, client *containerd.Client) error {\n\tlog.G(ctx).WithField(\"imageName\", newImageName).Info(\"Tagging image\")\n\t// Retrieve image information\n\timageService := client.ImageService()\n\timage, err := imageService.Get(ctx, imageName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Tag with new image name\n\timage.Name = newImageName\n\t// Attempt to create the image first\n\tif _, err = imageService.Create(ctx, image); err != nil {\n\t\t// The image already exists then delete the original and attempt to create the new one\n\t\tif errdefs.IsAlreadyExists(err) {\n\t\t\tif err = imageService.Delete(ctx, newImageName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif _, err = imageService.Create(ctx, image); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be60deeefed4a7a0ec7c2961459654e0", "score": "0.3977555", "text": "func (m *ObjStorageTransformer) TransformFromStorage(ctx context.Context, i interface{}) (interface{}, error) {\n\tm.TransformFromStorageCalled++\n\treturn i, nil\n}", "title": "" } ]
8d930479e70953e26eaa1e10c0ced885
Subscribe new handler on some particular subscriber interface by name
[ { "docid": "3bbcbc74338c1c020a4c0648236128da", "score": "0.61817527", "text": "func (r *Registry) Subscribe(ctx context.Context, name string, receiver any) error {\n\tif sub := r.Subscriber(name); sub != nil {\n\t\treturn sub.Subscribe(ctx, ReceiverFrom(receiver))\n\t}\n\treturn errors.Wrap(ErrUndefinedSubscriberInterface, name)\n}", "title": "" } ]
[ { "docid": "f0a506fcc8662d9c1ecf9419a7772e13", "score": "0.69485724", "text": "func Subscribe(name string, handler message.Subscriber) {\n\t_, found := subscriptions[name]\n\tif !found {\n\t\tsubscriptions[name] = []message.Subscriber{handler}\n\t} else {\n\t\tsubscriptions[name] = append(subscriptions[name], handler)\n\t}\n}", "title": "" }, { "docid": "47e16b137efd23e23ee810fc4987ba3f", "score": "0.67057455", "text": "func (b *IBus) Subscribe(t Type, eh Handler) {\n\tb.eventHandlers[t] = append(b.eventHandlers[t], eh)\n}", "title": "" }, { "docid": "d22ffe9956d3dafb46b2e73ca2a9f0ea", "score": "0.6658527", "text": "func (cl *Client) Subscribe(name string, h handler) error {\n\tfor i := range cl.topic {\n\t\tif i == name {\n\t\t\tcl.topic[name] = append(cl.topic[name], h)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"publisher not finded\")\n}", "title": "" }, { "docid": "ace7f473670bfdba8e0c94daf380d2d1", "score": "0.6322474", "text": "func Subscribe(SubscriptionID int, SubscriberFunc) {\n\n}", "title": "" }, { "docid": "4a4649ab68ab02987f83a985408a2bc9", "score": "0.63198733", "text": "func (sub *SimpleSub) Subscribe(topic string, handler func(inet.Stream, *Message)) {\n\tsub.Handlers[topic] = handler // Set handler\n}", "title": "" }, { "docid": "f0e53bf4ecdd0e8e7744d4b842bec22f", "score": "0.6317813", "text": "func (c *Client) Subscribe(event string, handler interface{}) {\n\tpanicPrefix := \"ws: subscribe: \"\n\n\thandlerType := reflect.TypeOf(handler)\n\n\tif handlerType.Kind() != reflect.Func {\n\t\tpanic(panicPrefix + \"handler must be of type func\")\n\t}\n\n\tif handlerType.NumIn() != 1 {\n\t\tpanic(panicPrefix + \"expected 1 input argument, \" +\n\t\t\t\"instead got \" + strconv.Itoa(handlerType.NumIn()))\n\t}\n\n\tif handlerType.NumOut() != 0 {\n\t\tpanic(panicPrefix + \"expected no return arguments, \" +\n\t\t\t\"instead got \" + strconv.Itoa(handlerType.NumOut()))\n\t}\n\n\tc.subscribedMutex.Lock()\n\tif _, found := c.subscriptions[event]; found {\n\t\tpanic(panicPrefix + \"subscription for event \\\"\" + event +\n\t\t\t\"\\\" already exists\")\n\t}\n\n\tc.subscriptions[event] = subscription{\n\t\tvalueType: handlerType.In(0),\n\t\thandler: reflect.ValueOf(handler),\n\t}\n\tc.subscribedMutex.Unlock()\n\n\tdata, _ := json.Marshal(SubscriptionMessage{\n\t\tEvent: event,\n\t\tSubscribe: true,\n\t})\n\tc.conn.Write(data)\n}", "title": "" }, { "docid": "3c1c44208a35983c1ee08ba38d670ac7", "score": "0.6236792", "text": "func (_m *Bus) Subscribe(_a0 event.Type, _a1 event.Listener) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "2415887b19dc97f52875b3493afb66a8", "score": "0.6182611", "text": "func (m *MangosClient) Subscribe(filter string, handler PayloadHandler) (chan string, error) {\n\tvar sock mangos.Socket\n\tvar err error\n\n\t_, _, found := m.payloadHandlers.Get(filter)\n\tif found {\n\t\t// There's already a listener, just swap out the handler\n\t\tm.registerHandlerForChannel(sock, filter, handler)\n\t\treturn m.SubscribeChan, nil\n\t}\n\n\tif sock, err = sub.NewSocket(); err != nil {\n\t\treturn m.SubscribeChan, fmt.Errorf(\"can't get new sub socket: %s\", err.Error())\n\t}\n\tsock.AddTransport(tcp.NewTransport())\n\n\tlog.Info(\"Dialing: \", m.URL)\n\tif err = sock.Dial(m.URL); err != nil {\n\t\treturn m.SubscribeChan, fmt.Errorf(\"can't dial on sub socket: %s\", err.Error())\n\t}\n\n\terr = sock.SetOption(mangos.OptionSubscribe, []byte(filter))\n\t//err = sock.SetOption(mangos.OptionSubscribe, []byte(\"\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm.registerHandlerForChannel(sock, filter, handler)\n\n\tgo m.startListening(sock, filter)\n\treturn m.SubscribeChan, nil\n}", "title": "" }, { "docid": "c06cb4baf9bc08666217c2c0b76bb9e8", "score": "0.61712456", "text": "func Subscribe(eventType Type, handlerFunction func(args ...interface{})) string {\n\thandlerId := generateHandlerId()\n\taddToRegistry(eventType, handlerFunction, handlerId)\n\treturn handlerId\n}", "title": "" }, { "docid": "2f7b5d3c68980330acfc91951c38092b", "score": "0.6124235", "text": "func (b *Bus) Subscribe(e interface{ Event }, sub interface{ Handler }) {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tif _, exists := b.subscribers[e]; !exists {\n\t\tb.subscribers[e] = make(map[interface{ Handler }]struct{})\n\t}\n\tb.subscribers[e][sub] = struct{}{}\n}", "title": "" }, { "docid": "32e10025640249c7099e5ad105841e5b", "score": "0.60383934", "text": "func Subscribe(topic string, h Handler) (Subscriber, error) {\n\treturn DefaultBroker.Subscribe(topic, h)\n}", "title": "" }, { "docid": "ad663cf5ea67ef62cc0f22becb148232", "score": "0.6033043", "text": "func subscribe(p *Proxy) {\n\tlumber.Trace(\"Adding proxy to subscribers...\")\n\n\tmutex.Lock()\n\tsubscribers[p.id] = p\n\tmutex.Unlock()\n}", "title": "" }, { "docid": "97ebc457342bfcc1b9c2e5db6dbc7714", "score": "0.6028168", "text": "func (kp *interContainerProxy) SubscribeWithRequestHandlerInterface(ctx context.Context, topic Topic, handler interface{}) error {\n\n\t// Subscribe to receive messages for that topic\n\tvar ch <-chan *ic.InterContainerMessage\n\tvar err error\n\tif ch, err = kp.kafkaClient.Subscribe(ctx, &topic); err != nil {\n\t\t//if ch, err = kp.Subscribe(topic); err != nil {\n\t\tlogger.Errorw(ctx, \"failed-to-subscribe\", log.Fields{\"error\": err, \"topic\": topic.Name})\n\t\treturn err\n\t}\n\n\tkp.defaultRequestHandlerInterface = handler\n\tkp.addToTopicRequestHandlerChannelMap(topic.Name, &requestHandlerChannel{requesthandlerInterface: handler, ch: ch})\n\t// Launch a go routine to receive and process kafka messages\n\tgo kp.waitForMessages(ctx, ch, topic, handler)\n\n\treturn nil\n}", "title": "" }, { "docid": "c1f637b651dba2c21b6e24ea8478c03f", "score": "0.597392", "text": "func (t *API) Subscribe(ctx context.Context, onMessage func(interface{}) error) error {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\tt.subscribers = append(t.subscribers, onMessage)\n\treturn nil\n}", "title": "" }, { "docid": "933ec093525957b7dd479372cc3ded52", "score": "0.59732306", "text": "func (r *Registry) Subscribe(name string, c chan EventBlock) {\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\tif _, ok := r.subscriptions[name]; !ok {\n\t\tr.subscriptions[name] = c\n\t}\n\tif r.log != nil {\n\t\tr.log.Println(`subscribed ` + name)\n\t}\n}", "title": "" }, { "docid": "e272ec7712cb2d50b8ecc4910c0ed6d6", "score": "0.5962258", "text": "func (ch *Channel) Subscribe(sub Subscriber) {\n\tch.subscribers[sub.GetID()] = sub\n}", "title": "" }, { "docid": "a858ecda16b2f1470f4208dd2edaec80", "score": "0.5942416", "text": "func (m IOManager) subscribe() error {\n\tsubs := []struct {\n\t\tsubject string\n\t\thandler nats.MsgHandler\n\t}{\n\t\t{\"job.*.output\", m.jobOutputHandler},\n\t}\n\tfor _, s := range subs {\n\t\tsub, err := m.nc.Subscribe(s.subject, s.handler)\n\t\tif err != nil {\n\t\t\tlogrus.WithField(\"subject\", s.subject).WithError(err).Warn(\"failed to subscribe\")\n\t\t\treturn err\n\t\t}\n\t\tlogrus.WithField(\"subject\", s.subject).Info(\"subscribed\")\n\n\t\tm.subs = append(m.subs, sub)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bc2e9a1e03e37c96a578ed78571dcff6", "score": "0.59157634", "text": "func (cl *Client) RegisterSubscriber(name string) error {\n\tmsg := Message{\n\t\tMode: \"subscriber\",\n\t\tData: name,\n\t}\n\tstr, _ := json.Marshal(msg)\n\t_, err := cl.c.Write([]byte(str))\n\tif err != nil {\n\t\treturn err\n\t}\n\tSerr := <-cl.Err\n\tif \" \" != Serr {\n\t\treturn fmt.Errorf(Serr)\n\t}\n\tcl.YourSubscribers[name] = struct{}{}\n\tcl.topic[name] = []handler{}\n\treturn nil\n}", "title": "" }, { "docid": "72600ce0e5c981c08ca90e7dccc7ca8b", "score": "0.5913295", "text": "func (w *Wrapper) Subscribe(id string, f OnConnect) error {\n\t_, exist := w.OnConnect[id]\n\tif exist {\n\t\treturn fmt.Errorf(\"Key '%s' already subscribed to MongoDb OnConnect event\", id)\n\t}\n\tw.OnConnect[id] = f\n\treturn nil\n}", "title": "" }, { "docid": "af0516fe05d4330100588c830e84cb55", "score": "0.5885938", "text": "func (ps *InMemoryPubSub) Subscribe(event string, handler graphqlws.Handler) string {\n\ts := newSubscriber(event, handler)\n\tps.subscribers.Store(s.ID, s)\n\treturn s.ID\n}", "title": "" }, { "docid": "0b473c06eae1ea13a02301b6f7f31e1e", "score": "0.586649", "text": "func (mngr *Manager) Subscribe(evType string, data interface{}, cb EventCb) {\n\tmngr.subscribers[evType] = append(mngr.subscribers[evType],\n\t\t&eventSubscriber{\n\t\t\tdata: data,\n\t\t\tcb: cb,\n\t\t},\n\t)\n}", "title": "" }, { "docid": "107628e2fe1244103fe6fb1e107af0e2", "score": "0.5848165", "text": "func Subscribe(id string, f OnConnect) error {\n\treturn wrapper.Subscribe(id, f)\n}", "title": "" }, { "docid": "7f56b2fa933c4fc6c8b4ebbf128d72e7", "score": "0.5846023", "text": "func (_m *serviceBindingOperations) Subscribe(listener resource.Listener) {\n\t_m.Called(listener)\n}", "title": "" }, { "docid": "e59a129e81a89d7d9aeef8f04f456aef", "score": "0.58284646", "text": "func (agent *BroadcastAgent) Subscribe(freq string, handler SubscriberHandler, workersAmmount uint32) *Subscriber {\n\tret := newSubscriber(freq, handler, workersAmmount, &agent.wgBusy, &agent.wg)\n\n\tagent.mutex.Lock()\n\tif agent.subsRegister[freq] == nil {\n\t\tagent.subsRegister[freq] = []*Subscriber{}\n\t}\n\n\tagent.subsRegister[freq] = append(agent.subsRegister[freq], ret)\n\tagent.mutex.Unlock()\n\n\treturn ret\n}", "title": "" }, { "docid": "0aa31cd6df9d026f18534735015eb99c", "score": "0.5821147", "text": "func (h *HeadlessAuthenticationWatcher) Subscribe(ctx context.Context, username, name string) (HeadlessAuthenticationSubscriber, error) {\n\tif name == \"\" {\n\t\treturn nil, trace.BadParameter(\"name must be provided\")\n\t}\n\tif username == \"\" {\n\t\treturn nil, trace.BadParameter(\"username must be provided\")\n\t}\n\n\ti, err := h.assignSubscriber(username, name)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tsubscriber := h.subscribers[i]\n\n\tgo func() {\n\t\t<-subscriber.Done()\n\t\th.unassignSubscriber(i)\n\t}()\n\n\t// Check for an existing backend entry and send it as the first update.\n\tif ha, err := h.identityService.GetHeadlessAuthentication(ctx, username, name); err == nil {\n\t\t// If the subscriber receives an event before we finish checking the\n\t\t// current backend, we can just skip this update rather than overwriting\n\t\t// the more up to date event.\n\t\tsubscriber.update(ha, false /* overwrite */)\n\t} else if !trace.IsNotFound(err) {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn subscriber, nil\n}", "title": "" }, { "docid": "bfef6bc858dda588d879b280271851db", "score": "0.58118063", "text": "func (ds *Server) Subscribe(client Client, devName string) {\n\tlog.Infof(\"Device: Registering client for interface %s\", devName)\n\n\td := ds.getLinkState(devName)\n\tif d != nil {\n\t\tclient.DeviceUpdate(d)\n\t}\n\n\tds.clientsByDeviceMu.Lock()\n\tdefer ds.clientsByDeviceMu.Unlock()\n\n\tif _, ok := ds.clientsByDevice[devName]; !ok {\n\t\tds.clientsByDevice[devName] = make([]Client, 0)\n\t}\n\n\tds.clientsByDevice[devName] = append(ds.clientsByDevice[devName], client)\n}", "title": "" }, { "docid": "fbc30b464bc89990811fd0c8e05b3750", "score": "0.5797069", "text": "func newSubscriber(event string, handler graphqlws.Handler) Subscriber {\n\treturn Subscriber{\n\t\tID: uuid.New().String(),\n\t\tEvent: event,\n\t\tHandler: handler,\n\t}\n}", "title": "" }, { "docid": "742595e170e2dbf65019e4f21ba631e5", "score": "0.5796838", "text": "func (c *Client) Subscribe(id, t string, pattern map[string]interface{}, once bool) {\n\tm := Message{\n\t\tType: \"_subscribe\",\n\t\tData: map[string]interface{}{\n\t\t\t\"ID\": id,\n\t\t\t\"Type\": t,\n\t\t\t\"Pattern\": pattern,\n\t\t\t\"Once\": once,\n\t\t},\n\t}\n\tc.Conn.SendMessage(m)\n}", "title": "" }, { "docid": "83fdf2239f8f36720bf48b54711ab2dd", "score": "0.5793867", "text": "func (b *EventBus) Subscribe(evtType event.Type, handler event.Handler) {\n\tsuscribersForType, ok := b.handlers[evtType]\n\tif !ok {\n\t\tb.handlers[evtType] = []event.Handler{handler}\n\t}\n\n\tsuscribersForType = append(suscribersForType, handler)\n}", "title": "" }, { "docid": "9556ffac14b6dc0001c2e97ebc5c2844", "score": "0.57801646", "text": "func (bh *BridgeHandle) Subscribe(n ...string) Subscription {\n\tif bh == nil {\n\t\treturn nil\n\t}\n\treturn bh.b.Subscribe(bh.key, n...)\n}", "title": "" }, { "docid": "4ac01dcec3e080826c57282d7a071fcc", "score": "0.57676345", "text": "func subscribeHandler(w http.ResponseWriter, r *http.Request) {\n\t// We don't have to worry about this when running locally\n\tupgrader.CheckOrigin = func(r *http.Request) bool {\n\t\treturn true\n\n\t}\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tid := uuid.New().String()\n\tps.Subscribe(id, conn)\n\tfmt.Println(\"New subscription incoming, total: \", len(ps.Subs))\n\tconn.WriteMessage(1, []byte(\"subscriber id \"+id))\n}", "title": "" }, { "docid": "dc8941038beaa8b603db8e2fa460958e", "score": "0.5765868", "text": "func (m *mockSubscribePubSub) Subscribe(_ context.Context, req pubsub.SubscribeRequest, handler pubsub.Handler) error {\n\tm.handlers[req.Topic] = handler\n\treturn nil\n}", "title": "" }, { "docid": "8ff918a9af3275f6bcecac10f4d38d14", "score": "0.5764652", "text": "func (c *Cache) Subscribe(ctx context.Context, resourceName string, obj runtime.Object, objChan EventHandler) error {\n\tkey := c.getObjectType(obj)\n\n\tvar inf cache.Controller\n\tif _, ok := c.subs[key]; !ok {\n\t\tinf = c.TrackObject(resourceName, obj)\n\t}\n\n\tc.subs[key] = append(c.subs[key], objChan)\n\n\t// start the informer\n\tif inf != nil {\n\t\tgo inf.Run(ctx.Done())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fa56e170b9b4502e5a7cc10e4b7f7483", "score": "0.5757108", "text": "func (p *Poloniex) Subscribe(chid string) error {\n\tif c, ok := p.ByName[chid]; ok {\n\t\tchid = c\n\t} else if c, ok := p.ByID[chid]; ok {\n\t\tchid = c\n\t} else {\n\t\treturn errors.New(\"unrecognised channelid in subscribe\")\n\t}\n\n\tp.subscriptions[chid] = true\n\tmessage := subscription{Command: \"subscribe\", Channel: chid}\n\treturn p.sendWSMessage(message)\n}", "title": "" }, { "docid": "7621bca6a79467709567d0c7e7f2b91b", "score": "0.57403135", "text": "func (serv SubscribeService) Subscribe(imdbID string) error {\n\t_, err := searcher.GetByIMDBID(imdbID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubscription := &Subscription{\n\t\timdbID: imdbID,\n\t}\n\n\treturn subscription.create(serv.storer)\n}", "title": "" }, { "docid": "9f4d5bb95fa2d2f1887169bb5dc597c2", "score": "0.572799", "text": "func Subscribe(i IEvent, fn func(IMessage)) error {\n\treturn i.Subscribe(fn)\n}", "title": "" }, { "docid": "286fc23cd8a1a18cb7019a028375dbdb", "score": "0.570352", "text": "func (rcvr *Receiver) Subscribe(svcName string) {\n\tfor _, subName := range rcvr.Subscriptions {\n\t\tif subName == svcName {\n\t\t\treturn\n\t\t}\n\t}\n\n\trcvr.Subscriptions = append(rcvr.Subscriptions, svcName)\n}", "title": "" }, { "docid": "8a6c55f192080e9cf727506a4b764e6f", "score": "0.5692194", "text": "func SubscriberHandlerName(topic string) string {\n\tname := strings.ToLower(topic)\n\tname = strings.Replace(name, \".\", \"_\", -1)\n\tname += \"_subscriber\"\n\tname = strcase.ToCamel(name)\n\n\treturn name\n}", "title": "" }, { "docid": "93b630e40ea4889ca06c9db575ea0408", "score": "0.56811714", "text": "func (ps *pubsub) subscribe(nf notifyFunc) (_id id) {\n\t_id = id(guuid())\n\tps.t[_id] = nf\n\treturn\n}", "title": "" }, { "docid": "ad499e246349ec16eff39fd34d390934", "score": "0.56741804", "text": "func (c *Client) OnSubscribed(handler ServerSubscribedHandler) {\n\tc.events.onServerSubscribe = handler\n}", "title": "" }, { "docid": "e7916223cdd52493eff49815e8d590bf", "score": "0.56699", "text": "func (m *Module) Subscribe() {\n\tm.eventManager.OnEvent(m.handleEvent)\n\tm.eventManager.OnPacket(m.handlePacket)\n}", "title": "" }, { "docid": "a8cc13115f2cd7ea445a88a8e7dfe250", "score": "0.56652623", "text": "func (s *Subscriber) Subscriber(event interface{}, listener interface{}) error {\n\tok := checkIsEvent(event)\n\n\tif !ok {\n\t\treturn errors.New(\"event must be implement IBaseEvent\")\n\t}\n\n\tok = checkIsListener(listener)\n\n\tif !ok {\n\t\treturn errors.New(\"listener must be implement IListener\")\n\t}\n\n\tlisteners, ok := s.EventListeners.Load(event.(IBaseEvent).GetEventName())\n\n\tvar listenersList []IListener\n\n\tif ok {\n\t\tlistenersList = append(listeners.([]IListener), listener.(IListener))\n\t} else {\n\t\tlistenersList = append(listenersList, listener.(IListener))\n\t}\n\n\ts.EventListeners.Store(event.(IBaseEvent).GetEventName(), listenersList)\n\n\treturn nil\n}", "title": "" }, { "docid": "fa2ea124d86b4d6c917ddd8120cf4a03", "score": "0.5653124", "text": "func (t *Topic) SubscriberHandler(w http.ResponseWriter, r *http.Request) error {\n\ts, err := NewSubscriber(w, r, t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.addSubscriber <- s\n\treturn nil\n}", "title": "" }, { "docid": "e577950870f3035f4af9e322371f1d3e", "score": "0.56411177", "text": "func Subscribe(ch chan<- sdk.Event) {\n\tsubscribers = append(subscribers, ch)\n}", "title": "" }, { "docid": "e217bba31203da45450579fae8571a31", "score": "0.5636919", "text": "func (ps *PubSub) Subscribe(id string, conn *websocket.Conn) {\n\tnewSub := Subscription{\n\t\tConnection: conn,\n\t\tID: id,\n\t}\n\n\tps.Subs = append(ps.Subs, newSub)\n}", "title": "" }, { "docid": "672df1efa181d63f301aa02bc0c8a7f3", "score": "0.56356627", "text": "func (np *NowPlaying) Subscribe(c chan string) {\n\tnp.Lock()\n\tdefer np.Unlock()\n\tnp.subscribers = append(np.subscribers, c)\n}", "title": "" }, { "docid": "8236eee8c4f4ea0651f60813f007c34a", "score": "0.5603901", "text": "func (c *Client) Subscribe(channel string, handler Handler) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tif _, ok := c.handlers[channel]; ok {\n\t\tslog.Panicf(\"already subscribed to Firehose channel %q\", channel)\n\t}\n\n\tc.handlers[channel] = handler\n}", "title": "" }, { "docid": "6cd1d2b66f918a3c3438b2f1e7c8efb8", "score": "0.56025267", "text": "func Subscribe(topic string, middlewares ...func(*emitter.Event)) <-chan emitter.Event {\n\treturn engine.On(topic, middlewares...)\n}", "title": "" }, { "docid": "89f230d7bd385059f687583b01fc562d", "score": "0.55899054", "text": "func Subscribe(h Handler, e EventType) int {\n\tif len(eventMap[e]) == 0 {\n\t\teventMap[e] = make([]Handler, 0)\n\t}\n\teventMap[e] = append(eventMap[e], h)\n\n\teventCount++\n\treturn eventCount\n}", "title": "" }, { "docid": "63cdad77b26e5bacef704fef44e5d031", "score": "0.55836153", "text": "func (es *eventSource) subscribeHandler(rw http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tif channel := params[\"channel\"]; len(channel) > 0 {\n\t\tif channel == globalChannel {\n\t\t\tlog.Printf(\"[E] Subscribing consumer on %s to global notification channel 'all' rejected\\n\", req.RemoteAddr)\n\t\t\thttp.Error(rw, \"Error: Channel 'all' is reserved for global notifications. Please choose another channel name.\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tcr, err := newConsumer(rw, req, es, channel)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[E] Subscribing consumer on %s to channel '%s' failed\\n\", req.RemoteAddr, channel)\n\t\t\thttp.Error(rw, fmt.Sprintf(\"[E] Unable to connect to channel '%s'.\", channel), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tes.addConsumer <- cr\n\t}\n}", "title": "" }, { "docid": "c379a917226aae91e9d54421d330bc44", "score": "0.55749166", "text": "func (a *Archiver) HandleSubscriber(s Subscriber, query, apikey string) {\n\ta.republisher.HandleSubscriber(s, query, apikey)\n}", "title": "" }, { "docid": "157caa66577add76d5666ac7201f3cb3", "score": "0.5565006", "text": "func (bus *EventBus) Subscribe(listeners ...interface{}) (*EventBus) {\n for _, listener := range listeners {\n bus.subscription.AddListener(listener)\n }\n return bus\n}", "title": "" }, { "docid": "eda911655601d701c78f12d7af9144c2", "score": "0.55452335", "text": "func newSubscriber(ctx context.Context, ch chan mq.Message) func(client mq.Client, message mq.Message) {\n\treturn func(client mq.Client, message mq.Message) {\n\t\tt := message.Topic()\n\t\tm := message.Payload()\n\t\tvenom.Debug(ctx, \"rx message in subscribe handler: %s len(%d), %v\", t, len(m), m)\n\t\tch <- message\n\t}\n}", "title": "" }, { "docid": "67084e7615a96b81f4c81bd56fa927d6", "score": "0.554023", "text": "func (b *Bot) Subscribe(id string) chan interface{} {\n\tb.mx.Lock()\n\tdefer b.mx.Unlock()\n\tc := make(chan interface{}, 10)\n\tb.subs[id] = c\n\treturn c\n}", "title": "" }, { "docid": "6f707f470bd4a80daa8b6e00e6c78a98", "score": "0.5532493", "text": "func (b *Broker) listen(s subscription) {\n\tfor {\n\t\tselect {\n\t\tcase m := <- s.messages:\n\t\t\tlog.Printf(\"received inbound message with value: %s\", m.Value)\n\n\t\t\tvar e kafka.Message\n\t\t\tvar b = make([]byte, len(m.Value))\n\t\t\tcopy(b, m.Value)\n\n\t\t\tif err := json.Unmarshal(b, &e); err != nil {\n\t\t\t\tlog.Printf(\"err received marshalling an inbound event err: %+v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif v, ok := s.callbacks[e.Type]; ok {\n\t\t\t\tv(m.Value)\n\t\t\t\tcontinue\n\t\t\t}\n\n\n\t\t\tlog.Printf(\"could not find callback for event type: %s\", e.Type)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "520ef8dfd94a1f56ab8ab444daf11336", "score": "0.5524476", "text": "func RegisterSubscriberHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SubscriberClient) error {\n\n\tmux.Handle(\"PUT\", pattern_Subscriber_CreateSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_CreateSubscription_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_CreateSubscription_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Subscriber_GetSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_GetSubscription_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_GetSubscription_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_Subscriber_UpdateSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_UpdateSubscription_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_UpdateSubscription_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Subscriber_ListSubscriptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_ListSubscriptions_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_ListSubscriptions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_Subscriber_DeleteSubscription_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_DeleteSubscription_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_DeleteSubscription_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_Subscriber_ModifyAckDeadline_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_ModifyAckDeadline_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_ModifyAckDeadline_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_Subscriber_Acknowledge_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_Acknowledge_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_Acknowledge_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_Subscriber_Pull_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_Pull_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_Pull_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_Subscriber_ModifyPushConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_ModifyPushConfig_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_ModifyPushConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Subscriber_ListSnapshots_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_ListSnapshots_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_ListSnapshots_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_Subscriber_CreateSnapshot_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_CreateSnapshot_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_CreateSnapshot_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_Subscriber_UpdateSnapshot_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_UpdateSnapshot_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_UpdateSnapshot_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_Subscriber_DeleteSnapshot_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_DeleteSnapshot_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_DeleteSnapshot_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_Subscriber_Seek_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Subscriber_Seek_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Subscriber_Seek_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "02c4d278339744863efc75c0f63e061c", "score": "0.552159", "text": "func (bh *ByteHub) Subscribe(id int, ch chan<- []byte) error {\n\tbh.Lock()\n\n\tif _, ok := bh.subscribers[id]; ok {\n\t\tbh.Unlock()\n\t\treturn errors.New(\"subscriber already exists\")\n\t}\n\n\tbh.subscribers[id] = ch\n\n\tbh.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "f0e8ed72725de0a479a7802810289dc7", "score": "0.55080813", "text": "func (p *Publisher) Subscribe(s Subscriber) error {\n\tif s.ID == \"\" {\n\t\treturn ErrSubscriberWithoutID{}\n\t}\n\tif s.C == nil {\n\t\ts.C = make(chan []byte)\n\t}\n\tif s.Timeout == 0 {\n\t\ts.Timeout = p.defaultTimeout\n\t}\n\ts.quit = make(chan struct{})\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif _, ok := p.subscribers[s.ID]; ok {\n\t\treturn ErrDuplicateSubscriberID{SubscriberID: s.ID}\n\t}\n\tp.subscribers[s.ID] = s\n\treturn nil\n}", "title": "" }, { "docid": "dbf3464d0dd21399ad93c1ab40eb65fa", "score": "0.5506961", "text": "func (c *Controller) Subscribe(ctx context.Context, args *string,\n\treply *time.Time) (err error) {\n\ttn := time.Now()\n\t*reply = tn\n\tc.Lock()\n\t(*c.Subscribers)[*args] = Subscriber{Timeout: tn.Add(c.timeout)}\n\tc.Unlock()\n\treturn\n}", "title": "" }, { "docid": "014a3049cf7fcf3eb2f66f7bca7be5e6", "score": "0.5505396", "text": "func Subscribe(svc normalizer.Service, nc *nats.Conn, logger log.Logger) {\n\tps := pubsub{\n\t\tnc: nc,\n\t\tsvc: svc,\n\t\tlogger: logger,\n\t}\n\tps.nc.QueueSubscribe(input, queue, ps.handleMsg)\n}", "title": "" }, { "docid": "77a9acadc7c198d97d14fc2b3a67c6e0", "score": "0.5503135", "text": "func (hm *HandlerMap) Register(sub *Subscriber) (*Subscriber, error) {\n\tif sub == nil {\n\t\treturn nil, ErrSubscribe\n\t}\n\tv, ok := hm.subscriberCenter.Load(sub.msgType)\n\tif !ok {\n\t\tms := newMultiSubscriber()\n\t\thm.subscriberCenter.Store(sub.msgType, ms)\n\t\treturn ms.register(sub)\n\t}\n\tms, ok := v.(*MultiSubscriber)\n\tif !ok {\n\t\treturn nil, ErrSubscribe\n\t}\n\treturn ms.register(sub)\n\n}", "title": "" }, { "docid": "8b67c06545c7854bae49adf28e4e4da1", "score": "0.54968154", "text": "func HandleSubscription(s Subscription, handler MessageHandler) error {\n for {\n var m Message\n err := s.Receive(m)\n if err != nil {\n return err\n }\n\n // call handler.\n // synchronous. user can make async if she wishes.\n handler(m)\n }\n}", "title": "" }, { "docid": "a5150c6102160b9557ed2680d277a62d", "score": "0.5495753", "text": "func (subscriber *MsgSubscriberWithMWs) Subscribe(spec MsgSpec, queue string, handler MsgHandler, opts ...interface{}) error {\n\tfor i := len(subscriber.mws) - 1; i >= 0; i-- {\n\t\thandler = subscriber.mws[i](spec, queue, handler)\n\t}\n\treturn subscriber.subscriber.Subscribe(spec, queue, handler, opts...)\n}", "title": "" }, { "docid": "973240ed8041376961aa8de2909662e3", "score": "0.5491776", "text": "func (a *apiServer) subscribe(ext string, isNormalEvent bool, ids []uint64) *sub {\n\textSubs, ok := a.subs[ext]\n\tif !ok {\n\t\textSubs = make(map[uint64]*sub)\n\t\ta.subs[ext] = extSubs\n\t}\n\n\ts := &sub{\n\t\tsubID: a.nextSubID,\n\t\teventIDs: ids,\n\t}\n\tif isNormalEvent {\n\t\ts.eventChan = make(chan *api.IRCEventResponse)\n\t} else {\n\t\ts.commandChan = make(chan *api.CmdEventResponse)\n\t}\n\ta.nextSubID++\n\n\textSubs[s.subID] = s\n\treturn s\n}", "title": "" }, { "docid": "62e81d218b030df93cc679d01fa93065", "score": "0.5490941", "text": "func (_m *addonsCfgService) Subscribe(listener resource.Listener) {\n\t_m.Called(listener)\n}", "title": "" }, { "docid": "3464886231ea74d595e7651a2a1aa320", "score": "0.54902935", "text": "func (e *ListennerT) Subscribe2(eventType string, handlerFunc Handler) error {\n\tif eventType != \"\" {\n\t\tif len(e.filter) == 0 {\n\t\t\te.filter = make(map[string]Handler)\n\t\t}\n\t\te.filter[eventType] = handlerFunc\n\t} else {\n\t\te.filter = nil\n\t\te.filter = make(map[string]Handler)\n\t\te.filter[\"\"] = handlerFunc\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce34b9a152595bd011fbe8b8d52f0ba1", "score": "0.5488942", "text": "func (r *Router) Subscribe(key string, f fn) {\n\tvar fl []fn\n\tfl = r_tbl[key]\n\tr_tbl[key] = append(fl, f)\n}", "title": "" }, { "docid": "667cde049f6c3dac95ab2d65120b3b3e", "score": "0.54882133", "text": "func (r *SubscriberRegistry) register(listener interface{}) {\n\tls := findAllSubscribers(listener)\n\tfor _, l := range ls {\n\t\tr.subscribersForType(l.kind()).Add(l)\n\t}\n}", "title": "" }, { "docid": "5417f91213fadbe1a1019e99d049c255", "score": "0.548056", "text": "func (h *connectionHandler) subscribe(sub subscription) {\n\tgraphQLBody, err := json.Marshal(sub.options.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\th.nextSubscriptionID++\n\n\tsubscriptionID := strconv.Itoa(h.nextSubscriptionID)\n\n\tstartRequest := fmt.Sprintf(startMessage, subscriptionID, string(graphQLBody))\n\terr = h.conn.Write(h.ctx, websocket.MessageText, []byte(startRequest))\n\tif err != nil {\n\t\treturn\n\t}\n\n\th.subscriptions[subscriptionID] = sub\n}", "title": "" }, { "docid": "5a735cc28c8a5164e27d565bb1a3799e", "score": "0.5470403", "text": "func (_m *OHLCVService) Subscribe(c *ws.Client, p *types.SubscriptionPayload) {\n\t_m.Called(c, p)\n}", "title": "" }, { "docid": "62966b2a42c6f3963fee086d95f24f92", "score": "0.54592144", "text": "func (c *Client) Subscribe(mt string) {\n\tok, _ := c.IsSubscribed(mt)\n\tif !ok {\n\t\tc.mu.Lock()\n\t\tdefer c.mu.Unlock()\n\t\tc.SubscribedTo = append(c.SubscribedTo, mt)\n\t\tc.Logger.Printf(\"Has subscribed to %s\\n\", mt)\n\t}\n}", "title": "" }, { "docid": "1551556a19aa37f1a51b4d71a85d359d", "score": "0.5453389", "text": "func (c *creator) Subscribe(ctx context.Context, eventType core.EventType) <-chan *core.EventData {\n\tc.Lock()\n\tdefer c.Unlock()\n\thandler := make(chan *core.EventData, maxChanSize)\n\t_, ok := c.subs[eventType]\n\tif !ok {\n\t\tc.subs[eventType] = []chan *core.EventData{}\n\t}\n\tc.subs[eventType] = append(c.subs[eventType], handler)\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tc.Lock()\n\t\tdefer c.Unlock()\n\t\tclose(handler)\n\t}()\n\n\treturn handler\n}", "title": "" }, { "docid": "7d9b544d173383cfd3db76055c54c5c4", "score": "0.5447352", "text": "func Subscribe(in chan LogMessage) { //DO NOT LOG WITHIN THIS METHOD - DEADLOCK\n\tsubStructLock.Lock()\n\tdefer subStructLock.Unlock()\n\n\tsubscribers[in] = true\n}", "title": "" }, { "docid": "8137c260d487ac6ef9c661df2fd7982d", "score": "0.5437086", "text": "func (c *BaseClient) Subscribe(ctx context.Context, q Query, clientType ...string) error {\n\tif err := q.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif len(clientType) == 0 {\n\t\tclientType = RegisteredImpls()\n\t}\n\n\t// TODO: concurrent subscribes can be removed after we enforce reflection\n\t// at client Impl level.\n\tfn := func(ctx context.Context, typ string, input interface{}) (Impl, error) {\n\t\tq := input.(Query)\n\t\timpl, err := NewImpl(ctx, q.Destination(), typ)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := impl.Subscribe(ctx, q); err != nil {\n\t\t\timpl.Close()\n\t\t\treturn nil, err\n\t\t}\n\t\treturn impl, nil\n\t}\n\timpl, err := getFirst(ctx, clientType, q, fn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.mu.Lock()\n\tc.query = q\n\tif c.clientImpl != nil {\n\t\tc.clientImpl.Close()\n\t}\n\tc.clientImpl = impl\n\tc.closed = false\n\tc.mu.Unlock()\n\n\treturn c.run(impl)\n}", "title": "" }, { "docid": "aaa0c00298f2a9a24412d9c9ecec1560", "score": "0.54303133", "text": "func (c *Client) subscribe() error {\n\tsub, err := c.protocol.NewSubscription()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor event := range sub.Events() {\n\t\t\tc.Publish(event)\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "a21397be9c627e633424e098e153af2d", "score": "0.5428753", "text": "func subscribe(input []string) {\n\tif len(input) < 2 {\n\t\tfmt.Print(subUsage)\n\t\treturn\n\t}\n\t_, err := nc.Subscribe(input[1], handleIncomingMessage)\n\tif err != nil {\n\t\tfmt.Printf(\"Error Subscribing: %+v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"+OK\\n\")\n}", "title": "" }, { "docid": "7b8d5e1d17f5735895c53948b36d7768", "score": "0.54231924", "text": "func (c *Client) OnSubscribing(handler ServerSubscribingHandler) {\n\tc.events.onServerSubscribing = handler\n}", "title": "" }, { "docid": "31579c00105932324db7ea1fbc4accae", "score": "0.54229903", "text": "func NewSubscriber(conn *websocket.Conn, readCh chan *Request, closeCh chan string) *Subscriber {\n\t//\n\n\tif conn == nil {\n\t\t//\n\n\t\tpanic(\"conn cannot be nil\")\n\t}\n\n\thash, _ := blake2b.New256([]byte(conn.RemoteAddr().String()))\n\tid := hex.EncodeToString(hash.Sum(nil))\n\twriteCh := make(chan *Response, channelBufSize)\n\tdoneCh := make(chan bool)\n\n\treturn &Subscriber{id, conn, writeCh, readCh, closeCh, doneCh}\n}", "title": "" }, { "docid": "aaa75d2c26e650b8d521f73c5d707961", "score": "0.5421389", "text": "func (m *NodeMonitor) Subscribe(ctx context.Context, params *opcua.SubscriptionParameters, cb MsgHandler, nodes ...string) (*Subscription, error) {\n\tsub, err := newSubscription(ctx, m, params, DefaultCallbackBufferLen, nodes...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgo sub.pump(ctx, nil, cb)\n\n\treturn sub, nil\n}", "title": "" }, { "docid": "5b2612ed6c0c897859b1d46761d997e6", "score": "0.54097104", "text": "func (c *ConfigStore) Subscribe(req *configstores.SubscribeReq, ch chan *configstores.SubscribeResp) error {\n\t// 0. check if illegal\n\tif len(req.Keys) > 0 && req.Group == \"\" {\n\t\treq.Group = defaultNamespace\n\t}\n\t// 1. app level\n\tif len(req.Keys) == 0 && req.Group == \"\" {\n\t\tsplit := strings.Split(c.kvConfig.namespaceName, \",\")\n\t\t// loop every namespace in config\n\t\tfor _, ns := range split {\n\t\t\tif ns == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr := c.listener.addByTopic(ns, \"\", ch)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\t// 2. group level\n\tif len(req.Keys) == 0 {\n\t\terr := c.listener.addByTopic(req.Group, \"\", ch)\n\t\treturn err\n\t}\n\t// 3. key level\n\tfor _, k := range req.Keys {\n\t\terr := c.listener.addByTopic(req.Group, c.concatenateKey(k, req.Label), ch)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "264c20693c82102f1470f237f904da76", "score": "0.5405789", "text": "func NewSubscriber(conn io.ReadWriteCloser) (protocol.Subscriber, error) {\n\n\t//jsonClient := jsonrpc.NewClient(conn)\n\n\tsubscriberProxy := &subscriberProxy{\n\t\tclient: jsonrpc.NewClient(conn),\n\t}\n\n\treturn subscriberProxy, nil\n}", "title": "" }, { "docid": "51bbddf27467d6197e9e833d88861e1e", "score": "0.53966975", "text": "func (p *PoolConn) Subscribe(processor Processor) {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg := <-p.q:\n\t\t\t\tgo processor(p, p.db, msg)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "4a5b9b4c752e3aca3ebd58eaa199c2ec", "score": "0.5394081", "text": "func (em *eventManager) subscribe(remoteAddr string, w io.Writer) {\n\tc := &eventClient{\n\t\tw: w,\n\t\tf: w.(http.Flusher),\n\t\tn: w.(http.CloseNotifier),\n\n\t\twait: make(chan struct{}),\n\t\trecv: make(chan []byte, 1024),\n\t}\n\n\tgo func(em *eventManager, c *eventClient, remoteAddr string) {\n\t\tdefer em.evict(remoteAddr)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-c.n.CloseNotify():\n\t\t\t\treturn\n\t\t\tcase msg := <-c.recv:\n\t\t\t\tif _, err := c.w.Write(msg); err != nil {\n\t\t\t\t\tlog.Errorf(\"write event message to client [%s] error: [%v]\", remoteAddr, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tc.f.Flush()\n\t\t\t}\n\t\t}\n\t}(em, c, remoteAddr)\n\n\tem.Lock()\n\tem.m[remoteAddr] = c\n\tem.Unlock()\n}", "title": "" }, { "docid": "f9c889996a5236c0689f4f5171def003", "score": "0.53920525", "text": "func (this *Handler) Subscribe(clientId string, user string, topic string) (result Result, err error) {\n\tif this == nil {\n\t\treturn Unhandled, nil\n\t}\n\tif !strings.HasPrefix(topic, this.fogTopicPrefix) {\n\t\treturn Unhandled, nil\n\t}\n\treturn Accepted, nil\n}", "title": "" }, { "docid": "befd7b2638a6b28e3ed03da3a03f85b2", "score": "0.5388787", "text": "func subscribe(q string) {\n\titems := lookup(q)\n\tif len(items) != 1 {\n\t\treturn\n\t} else if contains(subs, items[0].ID) {\n\t\tchatter(\"already subscribed\")\n\t\treturn\n\t}\n\n\tsubs = append(subs, items[0].ID)\n\t\n\ttmp, _ := gw2api.ItemsIds(\"\",items[0].ID)\n\tsubsNames[items[0].ID] = tmp[0].Name\n\tsort.Ints(subs)\n\tchatter(\"subscribed\")\n}", "title": "" }, { "docid": "c22a0548c99ba96f2a3902601358fee7", "score": "0.53872174", "text": "func (h *gqlWSConnectionHandler) subscribe(sub Subscription) {\n\tgraphQLBody, err := json.Marshal(sub.options.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\th.nextSubscriptionID++\n\n\tsubscriptionID := strconv.Itoa(h.nextSubscriptionID)\n\n\tstartRequest := fmt.Sprintf(startMessage, subscriptionID, string(graphQLBody))\n\terr = h.conn.Write(h.ctx, nhooyrwebsocket.MessageText, []byte(startRequest))\n\tif err != nil {\n\t\treturn\n\t}\n\n\th.subscriptions[subscriptionID] = sub\n}", "title": "" }, { "docid": "5b8a49d743787bc5f04728b5767cd6fd", "score": "0.5381004", "text": "func (m *Client) Subscribe(uri string, recv chan Response, cb Callback) error {\n\tm.addChannelSubscriber(uri, recv)\n\terr := m.Request(Request{\n\t\tMethod: \"SUB\",\n\t\tUri: uri,\n\t}, func(response Response) {\n\t\tfor _, part := range response.Payload {\n\t\t\tsub := &Spotify.Subscription{}\n\t\t\terr := proto.Unmarshal(part, sub)\n\t\t\tif err == nil && *sub.Uri != uri {\n\t\t\t\tm.addChannelSubscriber(*sub.Uri, recv)\n\t\t\t}\n\t\t}\n\t\tcb(response)\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "5eb74fb310078e2d06101452d3a590ca", "score": "0.53740966", "text": "func (disco *DiscoveryService) Subscribe(clientName string) chan []byte {\n\tdisco.mtx.Lock()\n\tdefer disco.mtx.Unlock()\n\n\tlog.Infof(\"Subscribing client: [%s]\", clientName)\n\tclientChan := make(chan []byte)\n\tdisco.clientChannels[clientName] = clientChan\n\n\treturn clientChan\n}", "title": "" }, { "docid": "103dea1bc6a8f15ab8f2d3d4ad2d16bd", "score": "0.53724205", "text": "func (e *Engine) Subscribe(channel []byte, cb func([]byte) error) error {\n\treturn fmt.Errorf(\"the %s driver doesn't support publish/subscribe\", Name)\n}", "title": "" }, { "docid": "f4f6181d8b283f83a4bf56e800201f54", "score": "0.5371865", "text": "func (a *Agent) Subscribe(msgCh chan interface{}) {\n\ta.getWorker().Subscribe(msgCh)\n}", "title": "" }, { "docid": "5a2e5caddcdeea85d71be20c9f4be586", "score": "0.537088", "text": "func (t *Trait) Handler(n string, h EventHandler) {\n\tt.Client.RegisterHandler(n, h)\n}", "title": "" }, { "docid": "b3e64ad358a4ec610c91c7d44afd0b10", "score": "0.5361736", "text": "func RegisterLogSubscriber(sub LogSubscriber) {\n mutex.Lock()\n defer mutex.Unlock()\n\n subscribers[sub.Name()] = sub\n\n logPerfs.Increment(PERF_LOG_SUBSCRIBER_REG)\n Info(\"LogSubscriber %v registered\", sub.Name())\n}", "title": "" }, { "docid": "33e73525da132c349fef35cbd638ba0d", "score": "0.5355842", "text": "func (e *bus) Subscribe(name string) (*ExpectedMessage, *ExpectedMessage, error) {\n\tslog := log.With(zap.String(\"name\", name))\n\tslog.Debug(\"Event::Subscribe\")\n\n\t// returns error when subscription already exists\n\tif _, ok := e.subscriptions[name]; ok {\n\t\treturn e.subscriptions[name].OnAck, e.subscriptions[name].OnMessage, nil\n\t\t//return nil, nil, ErrorSubscriptionExists\n\t}\n\n\te.mu.Lock()\n\te.subscriptions[name] = &Subscription{\n\t\tName: name,\n\t}\n\te.mu.Unlock()\n\n\tslog.Debug(\"Event::Subscribe Running onEventSubscribe\")\n\ts := e.subscriptions[name]\n\n\tslog.Debug(\"DeepStream::onSubscribe\")\n\n\t// on receive a message\n\texOnMessage, err := e.ds.ExpectMessage(topics.Event, actions.Event, []byte(s.Name))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// on subscribe ack\n\texOnSub, err := e.ds.ExpectMessageOnce(topics.Event, actions.Ack, actions.Subscribe, []byte(s.Name))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// send the subscription request\n\tslog.Debug(\"DeepStream::onSubscribe - emitting...\")\n\tgo e.ds.Emit(message.New(topics.Event, actions.Subscribe, s.Name))\n\n\ts.OnMessage = exOnMessage\n\ts.OnAck = exOnSub\n\n\treturn exOnSub, exOnMessage, nil\n}", "title": "" }, { "docid": "6740b2a431e17583dd9fb428a4d519c6", "score": "0.53472096", "text": "func (c *Consumer) Subscribe(channel string, handler Handler, deadLetter ...Handler) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tswitch len(deadLetter) {\n\tcase 0: // ignore\n\tcase 1:\n\t\tc.deadLetterHandlers[channel] = deadLetter[0]\n\tdefault:\n\t\tpanic(fmt.Errorf(\"too many dead letter handlers\"))\n\t}\n\n\tc.handlers[channel] = handler\n}", "title": "" }, { "docid": "dfefcd332f6cce6ccaa0cbf024784a27", "score": "0.53437763", "text": "func (g *Gate) Subscribe(session HubSession, stream string, identifier string) {\n\tg.mu.Lock()\n\tdefer g.mu.Unlock()\n\n\tif _, ok := g.streams[stream]; !ok {\n\t\tg.streams[stream] = make(map[HubSession]map[string]bool)\n\t}\n\n\tif _, ok := g.streams[stream][session]; !ok {\n\t\tg.streams[stream][session] = make(map[string]bool)\n\t}\n\n\tg.streams[stream][session][identifier] = true\n}", "title": "" }, { "docid": "584073e466b4348fbfc8465e4798a8f5", "score": "0.5338085", "text": "func HandleSubscribe(c *stompngo.Connection, d, i, a string) <-chan stompngo.MessageData {\n\th := stompngo.Headers{\"destination\", d, \"ack\", a}\n\t//\n\tswitch c.Protocol() {\n\tcase stompngo.SPL_12:\n\t\t// Add required id header\n\t\th = h.Add(\"id\", i)\n\tcase stompngo.SPL_11:\n\t\t// Add required id header\n\t\th = h.Add(\"id\", i)\n\tcase stompngo.SPL_10:\n\t\t// Nothing else to do here\n\tdefault:\n\t\tllu.Fatalf(\"v1:%v v2:%v\\n\", \"subscribe invalid protocol level, should not happen\",\n\t\t\tc.Protocol())\n\t}\n\t//\n\tr, e := c.Subscribe(h)\n\tif e != nil {\n\t\tllu.Fatalf(\"v1:%v v2:%v\\n\", \"subscribe failed\", e)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "c041ef32e17a749e9f8e459710b6a482", "score": "0.5334979", "text": "func (_m *MqttInterface) Listen(_a0 string, _a1 *[]string) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "9dc4670b5c117d87ec4347644493a9ab", "score": "0.5334369", "text": "func (p *PubSub) Subscribe(c chan<- interface{}) {\n\tp.in <- message{msgTypeSubscribe, c}\n}", "title": "" }, { "docid": "108d3cada61645cbcbe7399cbad21267", "score": "0.5329669", "text": "func (c gnmiBaseClientImpl) Subscribe(ctx context.Context, q client.Query, types ...string) error {\n\treturn c.c.Subscribe(ctx, q, types...)\n}", "title": "" }, { "docid": "66ad459e2ca9f70157700a5b5d587a38", "score": "0.5323897", "text": "func (l *Listener) Subscribe(addr string, c chan<- UDPMsg) {\n\tl.mux.Lock()\n\tdefer l.mux.Unlock()\n\n\tl.clients[addr] = c\n}", "title": "" } ]
5cd52ce30934e4a0217ffda5d72872be
ResetNamespaceId resets all changes to the "namespaceId" field.
[ { "docid": "e7ce6bd721d7b2d34e3ab9067eb0eb23", "score": "0.82174486", "text": "func (m *K8sEventMutation) ResetNamespaceId() {\n\tm.namespaceId = nil\n\tm.addnamespaceId = nil\n}", "title": "" } ]
[ { "docid": "c084037abc8d91dbf84f81f1da04f7dd", "score": "0.76026183", "text": "func (m *K8sStatefulSetMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "5cd8ba4e6a9799f0443e517c13091537", "score": "0.74803114", "text": "func (m *K8sPodMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "654a0414935c96f53e4efe72a0858e97", "score": "0.74384445", "text": "func (m *K8sContainerMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "eb802d090dce3954c71be0307a14b3de", "score": "0.74273443", "text": "func (m *K8sDeploymentMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "443456b4a238ccef98790c873e012f37", "score": "0.7419721", "text": "func (m *K8sMetricMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "70bb9de1ddadc3d13878f8870f7de5a8", "score": "0.7332689", "text": "func (m *K8sDaemonSetMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "a2381498a90fb1246aeb1cacba7b9a8a", "score": "0.7330528", "text": "func (m *K8sReplicaSetMutation) ResetK8sNamespaceId() {\n\tm.k8sNamespaceId = nil\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "1781e3f2a1a5af595e55ee04b5d1823f", "score": "0.65264726", "text": "func (kpuo *K8sPodUpdateOne) SetK8sNamespaceId(u uint) *K8sPodUpdateOne {\n\tkpuo.mutation.ResetK8sNamespaceId()\n\tkpuo.mutation.SetK8sNamespaceId(u)\n\treturn kpuo\n}", "title": "" }, { "docid": "6bc126232cf83387b65c80b1e624908b", "score": "0.6480255", "text": "func (m *WorkflowMutation) ResetNamespace() {\n\tm.namespace = nil\n\tm.clearednamespace = false\n}", "title": "" }, { "docid": "4eb1802564a6b8be9d32fc3d8953e464", "score": "0.6471685", "text": "func (m *InodeMutation) ResetNamespace() {\n\tm.namespace = nil\n\tm.clearednamespace = false\n}", "title": "" }, { "docid": "ffeda5d53dc521c8a141f65d6be2d194", "score": "0.64563125", "text": "func (m *K8sEventMutation) SetNamespaceId(u uint) {\n\tm.namespaceId = &u\n\tm.addnamespaceId = nil\n}", "title": "" }, { "docid": "4b3194c6fb515eb5ca987d43a8f5a5c4", "score": "0.64508486", "text": "func (m *LogMsgMutation) ResetNamespace() {\n\tm.namespace = nil\n\tm.clearednamespace = false\n}", "title": "" }, { "docid": "7f7bfc23e8e2d519495b7cda4d5f3cd8", "score": "0.6284578", "text": "func (m *InstanceMutation) ResetNamespace() {\n\tm.namespace = nil\n\tm.clearednamespace = false\n}", "title": "" }, { "docid": "ea2e59b27b774d9fb8d0ac2b82730e17", "score": "0.62476647", "text": "func (kpu *K8sPodUpdate) SetK8sNamespaceId(u uint) *K8sPodUpdate {\n\tkpu.mutation.ResetK8sNamespaceId()\n\tkpu.mutation.SetK8sNamespaceId(u)\n\treturn kpu\n}", "title": "" }, { "docid": "13efee20fcf675318fb3ebc76fdd42cf", "score": "0.6231956", "text": "func (m *VarRefMutation) ResetNamespace() {\n\tm.namespace = nil\n\tm.clearednamespace = false\n}", "title": "" }, { "docid": "70b169830bdc9e1dc59e34e23ff96331", "score": "0.622087", "text": "func (m *K8sStatefulSetMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "6dc9e29a9fadb206e5623f10210e36b6", "score": "0.6201301", "text": "func (m *K8sNamespaceMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "03f55b0e390f844274b0675b24a108e9", "score": "0.61873627", "text": "func (m *CloudEventsMutation) ResetNamespace() {\n\tm.namespace = nil\n\tm.clearednamespace = false\n}", "title": "" }, { "docid": "a22d9fb5116e5f683758f997d3f5545f", "score": "0.6179601", "text": "func (o *ModelsDeployment) SetNamespaceId(v string) {\n\to.NamespaceId = &v\n}", "title": "" }, { "docid": "adb630f0e88537d761b510d9a07849b4", "score": "0.6135652", "text": "func (m *K8sReplicaSetMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "245805d6d86a6dc118b4c2d45f22ee3e", "score": "0.61207366", "text": "func (m *K8sPodMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "bbfc8b6e69dee0822a67711b3807877b", "score": "0.59891945", "text": "func (m *K8sDaemonSetMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "470a0304d2a3e3d46002c8740baca7e2", "score": "0.5986509", "text": "func (m *K8sMetricMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "cf636363c8c77a0e0be0c5f45eeae43c", "score": "0.5956438", "text": "func (m *WorkflowMutation) SetNamespaceID(id uuid.UUID) {\n\tm.namespace = &id\n}", "title": "" }, { "docid": "9940f4593ea4f00ff00b5a0703f99c16", "score": "0.59506553", "text": "func (wc *WorkflowCreate) SetNamespaceID(id string) *WorkflowCreate {\n\twc.mutation.SetNamespaceID(id)\n\treturn wc\n}", "title": "" }, { "docid": "d55068be2a6e4cb6113e38082919b69d", "score": "0.5933587", "text": "func (m *LogMsgMutation) SetNamespaceID(id uuid.UUID) {\n\tm.namespace = &id\n}", "title": "" }, { "docid": "c0fa59b29a0490e16c27224a310cd373", "score": "0.59072167", "text": "func (m *K8sEventMutation) ResetLabelId() {\n\tm.labelId = nil\n\tm.addlabelId = nil\n}", "title": "" }, { "docid": "a2318568b5426e4719e42d9f3460e268", "score": "0.58845377", "text": "func (m *K8sContainerMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "12825138a136e35525563abab053571a", "score": "0.58676434", "text": "func (kpc *K8sPodCreate) SetK8sNamespaceId(u uint) *K8sPodCreate {\n\tkpc.mutation.SetK8sNamespaceId(u)\n\treturn kpc\n}", "title": "" }, { "docid": "d5e45c547b07be2dae75011b22c91b78", "score": "0.5861875", "text": "func (m *CloudEventsMutation) SetNamespaceID(id uuid.UUID) {\n\tm.namespace = &id\n}", "title": "" }, { "docid": "bfea195d3dd47bec5d726edb4e4c1459", "score": "0.58478916", "text": "func (m *K8sMetricMutation) ResetLabelId() {\n\tm.labelId = nil\n\tm.addlabelId = nil\n}", "title": "" }, { "docid": "bab707195e50fae03488a520eeba5426", "score": "0.5836967", "text": "func (m *InstanceMutation) SetNamespaceID(id uuid.UUID) {\n\tm.namespace = &id\n}", "title": "" }, { "docid": "560826301131101eb7c63eea41a309e8", "score": "0.58358693", "text": "func (m *InodeMutation) SetNamespaceID(id uuid.UUID) {\n\tm.namespace = &id\n}", "title": "" }, { "docid": "c6562b24d8b201bb2d8722e3195167b5", "score": "0.58339316", "text": "func (m *K8sDeploymentMutation) SetK8sNamespaceId(u uint) {\n\tm.k8sNamespaceId = &u\n\tm.addk8sNamespaceId = nil\n}", "title": "" }, { "docid": "14b57f22eea16564ded376d570a3a469", "score": "0.5805622", "text": "func (m *K8sMetricMutation) ResetNameId() {\n\tm.nameId = nil\n\tm.addnameId = nil\n}", "title": "" }, { "docid": "8224595b29b310e57ec668912296a660", "score": "0.58029646", "text": "func (m *K8sNamespaceMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "aea8e4c6425ee6ec21f3c3176ce1f530", "score": "0.5792744", "text": "func (m *EventMutation) ResetLabelId() {\n\tm.labelId = nil\n\tm.addlabelId = nil\n}", "title": "" }, { "docid": "d2fe8e910a06d2bcd8c45bce6c9560e8", "score": "0.57918656", "text": "func (m *K8sEventMutation) ResetNameId() {\n\tm.nameId = nil\n\tm.addnameId = nil\n}", "title": "" }, { "docid": "30fc65c3c068415256cc04b1c9551f4b", "score": "0.5774266", "text": "func (m *OrganizationOwnershipMutation) ResetOrganizationId() {\n\tm.organization = nil\n}", "title": "" }, { "docid": "eac2337682250252a48b4f2dae144c02", "score": "0.57669204", "text": "func (m *MetricMutation) ResetLabelId() {\n\tm.labelId = nil\n\tm.addlabelId = nil\n}", "title": "" }, { "docid": "485002df7b9eeb268fc75d31651b852d", "score": "0.5730584", "text": "func (m *K8sObjectTagMutation) ResetK8sLabelId() {\n\tm.k8sLabelId = nil\n\tm.addk8sLabelId = nil\n}", "title": "" }, { "docid": "d71520d153381462a741e01f7f6d11aa", "score": "0.57029873", "text": "func (m *MetricMutation) ResetNameId() {\n\tm.nameId = nil\n\tm.addnameId = nil\n}", "title": "" }, { "docid": "b1f0459af88d2b15f4bababf405ba539", "score": "0.5672735", "text": "func (m *EntityTaxInformationMutation) ResetTaxId() {\n\tm.taxId = nil\n}", "title": "" }, { "docid": "6941326636228a2fe164cfb162b32add", "score": "0.5666609", "text": "func (m *K8sContainerMutation) ResetK8sPodId() {\n\tm._K8sPodId = nil\n\tm.add_K8sPodId = nil\n}", "title": "" }, { "docid": "a885121910753c0f3bb5d7162ee2a3a5", "score": "0.56407624", "text": "func (m *VarRefMutation) SetNamespaceID(id uuid.UUID) {\n\tm.namespace = &id\n}", "title": "" }, { "docid": "66f2c55385369c4f7e1922e9487b3075", "score": "0.56397647", "text": "func (m *K8sDeploymentMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "ff470d3e931b45149264896d55300ee9", "score": "0.56169057", "text": "func (m *K8sNodeMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "e7bb0465f2c56b81f8f9b351ae38a206", "score": "0.56165123", "text": "func (m *K8sStatefulSetMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "418fdb7685112aa7ba4729de42bba386", "score": "0.5612148", "text": "func (o *ModelsDeployment) GetNamespaceId() string {\n\tif o == nil || o.NamespaceId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.NamespaceId\n}", "title": "" }, { "docid": "9bc64226384c084bd2b81080c15dd205", "score": "0.5607791", "text": "func (m *K8sLabelMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "e27fbc9d565b9cb5cb0fb1fbc4752f61", "score": "0.5606578", "text": "func (o GetRegistryEnterpriseNamespacesNamespaceOutput) NamespaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetRegistryEnterpriseNamespacesNamespace) string { return v.NamespaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "78f94c0db738f00c4cc860f65a29d005", "score": "0.55996466", "text": "func (m *ResourceMutation) ResetOrganizationId() {\n\tm.organization = nil\n}", "title": "" }, { "docid": "1b6d1671938b11cf652da984a3590f57", "score": "0.5594894", "text": "func (m *K8sPodMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "f5bba4899782d474fb390c3e43e50dde", "score": "0.559164", "text": "func (o NamespaceOutput) NamespaceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Namespace) pulumi.StringOutput { return v.NamespaceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2a9f0b9358e92d9b73529ae25fb521c7", "score": "0.5577084", "text": "func (m *K8sEventMutation) ResetPodId() {\n\tm.podId = nil\n\tm.addpodId = nil\n}", "title": "" }, { "docid": "394eb64c12962a93101d724096be178c", "score": "0.5518983", "text": "func (m *K8sObjectTagMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "5b8438bab2a79561d7313e6de856f57f", "score": "0.5505193", "text": "func (n *NodeID) SetNamespace(v int) error {\n\tswitch n.Type() {\n\tcase TypeTwoByte:\n\t\tif v != 0 {\n\t\t\treturn fmt.Errorf(\"out of range [0..0]: %d\", v)\n\t\t}\n\t\treturn nil\n\n\tcase TypeFourByte:\n\t\tif max := math.MaxUint8; v < 0 || v > max {\n\t\t\treturn fmt.Errorf(\"out of range [0..%d]: %d\", max, v)\n\t\t}\n\t\tn.ns = uint16(v)\n\t\treturn nil\n\n\tdefault:\n\t\tif max := math.MaxUint16; v < 0 || v > max {\n\t\t\treturn fmt.Errorf(\"out of range [0..%d]: %d\", max, v)\n\t\t}\n\t\tn.ns = uint16(v)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a71832353753ad3674a4417f60211bc4", "score": "0.5503211", "text": "func (m *EventMutation) ResetNameId() {\n\tm.nameId = nil\n\tm.addnameId = nil\n}", "title": "" }, { "docid": "581322a279c79cee8fbe85ecb652bd34", "score": "0.5503179", "text": "func (m *TokenMutation) ResetOrganizationId() {\n\tm.organization = nil\n}", "title": "" }, { "docid": "be0cb4310c10588846a523579e555242", "score": "0.54760396", "text": "func (m *K8sMetricMutation) ResetK8sNodeId() {\n\tm.k8sNodeId = nil\n\tm.addk8sNodeId = nil\n}", "title": "" }, { "docid": "e438299079fb7c7f1c8aa08dcc9aaf08", "score": "0.5459015", "text": "func (m *K8sMetricMutation) ResetK8sContainerId() {\n\tm.k8sContainerId = nil\n\tm.addk8sContainerId = nil\n}", "title": "" }, { "docid": "de770c58dc51f19efe35a55f85e8b7a6", "score": "0.544326", "text": "func (m *K8sDaemonSetMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "c9cd3b0ca16e020ff01a234afec0afa5", "score": "0.54367894", "text": "func (o CertificateOutput) NamespaceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.NamespaceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "90188c890dc2db3ca54e881d09fd8518", "score": "0.5434828", "text": "func (m *NodeMutation) ResetAgentId() {\n\tm.agentId = nil\n\tm.addagentId = nil\n}", "title": "" }, { "docid": "7340383a2df7fd494679883761f7fdf0", "score": "0.54288936", "text": "func (m *EventMutation) ResetPodId() {\n\tm.podId = nil\n\tm.addpodId = nil\n}", "title": "" }, { "docid": "ce0471e661d635fa4a1d589a5ee726da", "score": "0.5355902", "text": "func (m *MetricMutation) ResetProcesId() {\n\tm.procesId = nil\n\tm.addprocesId = nil\n}", "title": "" }, { "docid": "38418996ea7e2257856bfbad1d6cc5c4", "score": "0.535268", "text": "func (eventCallback EventCallback) ResetId(ID string) persistence.Persistable {\n\teventCallback.ID = ID\n\treturn eventCallback\n}", "title": "" }, { "docid": "675c7bc43f68fab9d375c2df69b4c555", "score": "0.5306746", "text": "func (m *K8sEventMutation) ResetNodeId() {\n\tm.nodeId = nil\n\tm.addnodeId = nil\n}", "title": "" }, { "docid": "86cd0c51c660e838587374cbde25b241", "score": "0.5299348", "text": "func (m *K8sNodeMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "02e3bf9c957053f784e05c32ceba998b", "score": "0.52956104", "text": "func (o *SearchDocParams) SetNamespaceID(namespaceID string) {\n\to.NamespaceID = namespaceID\n}", "title": "" }, { "docid": "0964760c0f86abc949c7f91b8b76b9a2", "score": "0.5278985", "text": "func (m *NamespaceMutation) ResetName() {\n\tm.name = nil\n}", "title": "" }, { "docid": "1679f75fa2301d9d5064ce61585dbd3d", "score": "0.5271993", "text": "func (m *K8sReplicaSetMutation) ResetK8sObjectId() {\n\tm.k8sObjectId = nil\n\tm.addk8sObjectId = nil\n}", "title": "" }, { "docid": "7df6dc6ba1f2aa8f1abf4f67589cffc2", "score": "0.5260331", "text": "func (m *K8sEventMutation) ResetContainerId() {\n\tm.containerId = nil\n\tm.addcontainerId = nil\n}", "title": "" }, { "docid": "cf59b2cb7d50816b524829436d21fc02", "score": "0.52471894", "text": "func (m *K8sReplicaSetMutation) ResetK8sDeploymentId() {\n\tm.k8sDeploymentId = nil\n\tm.addk8sDeploymentId = nil\n}", "title": "" }, { "docid": "f3314a2c3268d760cd608d603bd546c2", "score": "0.5244166", "text": "func (m *K8sNamespaceMutation) ResetName() {\n\tm.name = nil\n}", "title": "" }, { "docid": "5e871a6253e035891965078d698f446a", "score": "0.52376986", "text": "func (m *PillorderMutation) ResetPillorderNameID() {\n\tm._PillorderNameID = nil\n}", "title": "" }, { "docid": "e64d5970bddf8b90cf1b0a7aac2ff53a", "score": "0.523247", "text": "func (m *WorkflowMutation) ClearNamespace() {\n\tm.clearednamespace = true\n}", "title": "" }, { "docid": "7a1c33d1cb4e2042af3565f4fc744965", "score": "0.5219334", "text": "func (m *UserMutation) ResetOrganizationId() {\n\tm.organization = nil\n\tdelete(m.clearedFields, user.FieldOrganizationId)\n}", "title": "" }, { "docid": "99f1df21322ce5e0c9cfc297201b270a", "score": "0.5219319", "text": "func (m *ContainerMutation) ResetNodeId() {\n\tm.nodeId = nil\n\tm.addnodeId = nil\n}", "title": "" }, { "docid": "e5eb156fc58c04e46fb855466813fe7b", "score": "0.5218614", "text": "func (m *InodeMutation) ClearNamespace() {\n\tm.clearednamespace = true\n}", "title": "" }, { "docid": "5babbaa4461169d66017a32e24f580c3", "score": "0.5217004", "text": "func (m *EventMutation) ResetProcesId() {\n\tm.procesId = nil\n\tm.addprocesId = nil\n}", "title": "" }, { "docid": "45ee7aa16bd1063b783600adecec9597", "score": "0.5213395", "text": "func (m *K8sObjectMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "08a2fcad1aa0e71edcf22de5a56b3b1e", "score": "0.5208858", "text": "func (m *K8sContainerMutation) ResetContainerId() {\n\tm.containerId = nil\n}", "title": "" }, { "docid": "3132c2ff277977abef112dc2b4ff8c9b", "score": "0.5203929", "text": "func (m *AccountMutation) ResetAccountKid() {\n\tm.account_kid = nil\n}", "title": "" }, { "docid": "d37f35b0dfda2fd66cbcec91948e42cc", "score": "0.51910025", "text": "func (m *MetricNameMutation) ResetTypeId() {\n\tm.typeId = nil\n\tm.addtypeId = nil\n}", "title": "" }, { "docid": "79b8774d053d7254af14f037abf07693", "score": "0.51887476", "text": "func (m *NodeMutation) ResetClusterId() {\n\tm.clusterId = nil\n\tm.addclusterId = nil\n}", "title": "" }, { "docid": "68f49085f1318062f50c06aaf148339c", "score": "0.5183348", "text": "func (bd *BmApplyBindKid) ResetIdWithId_() {\n\tbmmodel.ResetIdWithId_(bd)\n}", "title": "" }, { "docid": "350e418f050d187f83e01d495ca643f6", "score": "0.5170172", "text": "func (m *MetricMutation) ResetContainerId() {\n\tm.containerId = nil\n\tm.addcontainerId = nil\n}", "title": "" }, { "docid": "b1a170dfbcb2877d1d0964001c1683db", "score": "0.5167288", "text": "func (m *K8sDeploymentMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "56c0607eec404a6f210262aed8505352", "score": "0.51514745", "text": "func (m *EventMutation) ResetAgentId() {\n\tm.agentId = nil\n\tm.addagentId = nil\n}", "title": "" }, { "docid": "2d9894c60eecbf02cd56e1f51bd75353", "score": "0.5149829", "text": "func (m *K8sMetricMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "2ba1d4dbe9666831d65fabd4cab4861e", "score": "0.51491797", "text": "func (m *AccountMutation) ResetPid() {\n\tm.pid = nil\n}", "title": "" }, { "docid": "2fd930346bd5cd478eacbd516ff0c10e", "score": "0.5146878", "text": "func (m *K8sPodMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "855f7b7170baaf782dad8163257fe735", "score": "0.514624", "text": "func (m *EventMutation) ResetContainerId() {\n\tm.containerId = nil\n\tm.addcontainerId = nil\n}", "title": "" }, { "docid": "ec050a83b9dce7b500330b098b2efaae", "score": "0.51372576", "text": "func (m *K8sStatefulSetMutation) OldK8sNamespaceId(ctx context.Context) (v uint, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldK8sNamespaceId is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldK8sNamespaceId requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldK8sNamespaceId: %w\", err)\n\t}\n\treturn oldValue.K8sNamespaceId, nil\n}", "title": "" }, { "docid": "db36ac0d4f2cad6e09bd5c66eaa4e061", "score": "0.5135948", "text": "func (bd *ResultCheck) ResetIdWithId_() {\n\tbmmodel.ResetIdWithId_(bd)\n}", "title": "" }, { "docid": "a63f9b4955fa52b7f467fe6a491c9dbe", "score": "0.5131473", "text": "func (m *ContainerMutation) ResetContainerId() {\n\tm.containerId = nil\n}", "title": "" }, { "docid": "1ab96b872ace4b2b4ab1cd3244ec0e40", "score": "0.5129298", "text": "func (m *K8sStatefulSetMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "5faacd51f1576b1b9e9cd1911fea2d32", "score": "0.51275015", "text": "func (m *K8sContainerMutation) ResetK8sClusterId() {\n\tm.k8sClusterId = nil\n\tm.addk8sClusterId = nil\n}", "title": "" }, { "docid": "913f03b5074e42d2f3402d2b8650141b", "score": "0.51194304", "text": "func (m *K8sPodMutation) OldK8sNamespaceId(ctx context.Context) (v uint, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldK8sNamespaceId is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldK8sNamespaceId requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldK8sNamespaceId: %w\", err)\n\t}\n\treturn oldValue.K8sNamespaceId, nil\n}", "title": "" } ]
8314555233973b00c7371a9d54de0fec
GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise and a boolean to check if the value has been set.
[ { "docid": "0312dac0a2f2789f671e7ff7abde83b7", "score": "0.8260261", "text": "func (o *VersionedProcessor) GetPropertiesOk() (*map[string]string, bool) {\n\tif o == nil || o.Properties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties, true\n}", "title": "" } ]
[ { "docid": "1502e0de2c733dfb20585e1620f8f5d7", "score": "0.78752637", "text": "func (o *AddPartnerTenantRequest) GetPropertiesOk() (*map[string]string, bool) {\n\tif o == nil || o.Properties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties, true\n}", "title": "" }, { "docid": "078b8998c7d79d41497e837cb3d6cd36", "score": "0.77232826", "text": "func (o *ControllerServiceDTO) GetPropertiesOk() (*map[string]string, bool) {\n\tif o == nil || o.Properties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties, true\n}", "title": "" }, { "docid": "4f28abfbd2221e00ca3213aa2e79816a", "score": "0.76962453", "text": "func (o *Request) GetPropertiesOk() (*RequestProperties, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Properties, true\n}", "title": "" }, { "docid": "26ff11b1a2ca51fbb5f72ea4e4a7bc4b", "score": "0.7642819", "text": "func (o *ThingUpdateRequest) GetPropertiesOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Properties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties, true\n}", "title": "" }, { "docid": "5bb678d232930b62e7a57f5f14576c23", "score": "0.76114684", "text": "func (o *WorkflowWorkflowInfoAllOf) GetPropertiesOk() (*WorkflowWorkflowInfoProperties, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties.Get(), o.Properties.IsSet()\n}", "title": "" }, { "docid": "076b05d1f7fce774da5b0fbcd6362386", "score": "0.7516412", "text": "func (o *ThingUpdateResponse) GetPropertiesOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Properties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties, true\n}", "title": "" }, { "docid": "4656a5789f8f866cfe9f641d69d62e07", "score": "0.64408207", "text": "func (o *VersionedProcessor) GetPropertyDescriptorsOk() (*map[string]VersionedPropertyDescriptor, bool) {\n\tif o == nil || o.PropertyDescriptors == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PropertyDescriptors, true\n}", "title": "" }, { "docid": "ce4380b4fba9083e8cc8a56446b8bb3e", "score": "0.6242741", "text": "func (o *ThingUpdateResponse) HasProperties() bool {\n\tif o != nil && o.Properties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a02cf6bc8cfe6220e853b20cf8346026", "score": "0.6147498", "text": "func (o *WorkflowWorkflowInfoAllOf) HasProperties() bool {\n\tif o != nil && o.Properties.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1fe6ad39ae5a86683f6aed49d3e8e12e", "score": "0.61302096", "text": "func (o *ControllerServiceDTO) HasProperties() bool {\n\tif o != nil && o.Properties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5ed9d1b50a793c62896d9876cab279d7", "score": "0.6106079", "text": "func (o *AddPartnerTenantRequest) HasProperties() bool {\n\tif o != nil && o.Properties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "52d41c5f4248f25dc608dc200153fe05", "score": "0.6097797", "text": "func (o *ThingUpdateRequest) HasProperties() bool {\n\tif o != nil && o.Properties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "14e859b7609b4ee602f2ea6c9c40bfab", "score": "0.6035836", "text": "func (o *VersionedProcessor) HasProperties() bool {\n\tif o != nil && o.Properties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5c614b8606a64ab63544408d3f5fc368", "score": "0.5922735", "text": "func (o *Request) HasProperties() bool {\n\tif o != nil && o.Properties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f580b9513f95167d9ad11e83360cbdae", "score": "0.59193057", "text": "func (m *PingCheck) Properties() []*NameAndValue {\n\treturn m.propertiesField\n}", "title": "" }, { "docid": "a5b8883335ad883193778714718f6ae2", "score": "0.5772127", "text": "func (m *ServicePrincipalLockConfiguration) GetAllProperties()(*bool) {\n val, err := m.GetBackingStore().Get(\"allProperties\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "2c6157f31f41264f5802b15b1fa4db77", "score": "0.57598346", "text": "func (o *DeviceConfigWeb) GetParametersOk() (*map[string]DeviceParameterWeb, bool) {\n\tif o == nil || o.Parameters == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Parameters, true\n}", "title": "" }, { "docid": "e61a2c99b7bf3d0abff9be8e28d08c5b", "score": "0.5736621", "text": "func (o *ReadOnlyWithDefault) GetProp3Ok() (*string, bool) {\n\tif o == nil || IsNil(o.Prop3) {\n\t\treturn nil, false\n\t}\n\treturn o.Prop3, true\n}", "title": "" }, { "docid": "0a47c64226c1ab322fd22f7db22cbb57", "score": "0.56903225", "text": "func (p Properties) AsProperties() (*Properties, bool) {\n\treturn &p, true\n}", "title": "" }, { "docid": "b5e111a45c86ad1bbf7e94f0eca5e9c0", "score": "0.5689453", "text": "func (o *StorageRemoteKeySettingAllOf) GetIsPasswordSetOk() (*bool, bool) {\n\tif o == nil || o.IsPasswordSet == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsPasswordSet, true\n}", "title": "" }, { "docid": "bf41b8c2122711628e33a9c2fe4fb14c", "score": "0.5677681", "text": "func (p ValueProperties) Len() int {\n\treturn len(p)\n}", "title": "" }, { "docid": "78aa199153bb2fbd46291900608cee27", "score": "0.5662882", "text": "func (o *ReadOnlyWithDefault) GetProp1Ok() (*string, bool) {\n\tif o == nil || IsNil(o.Prop1) {\n\t\treturn nil, false\n\t}\n\treturn o.Prop1, true\n}", "title": "" }, { "docid": "4214688cd011f4bd43e1beaa7a4d4ca5", "score": "0.5629938", "text": "func (o *DatacenterProperties) GetFeaturesOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Features, true\n}", "title": "" }, { "docid": "97e709be266ec66c9a04e3bf5524a234", "score": "0.5612459", "text": "func (o *ServerProperties) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Type, true\n}", "title": "" }, { "docid": "a4079ddf064ca0605994c244b6cc0507", "score": "0.55964226", "text": "func (p Properties) AsBasicProperties() (BasicProperties, bool) {\n\treturn &p, true\n}", "title": "" }, { "docid": "0966afb0ef36bb89bf89562b69635d08", "score": "0.5564924", "text": "func (o *AppParameters) GetValuesOk() (*string, bool) {\n\tif o == nil || o.Values == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Values, true\n}", "title": "" }, { "docid": "8bdfc8129acb146832d3dbe045ee3c7d", "score": "0.5482165", "text": "func (v *schema) HasMaxProperties() bool {\n\treturn v.maxProperties != nil\n}", "title": "" }, { "docid": "7b2f84cfdfa355a5ff927e618226072d", "score": "0.5469932", "text": "func (o *DatacenterProperties) GetVersionOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Version, true\n}", "title": "" }, { "docid": "6fe16d687dac183c2eeb4883c6c79fb4", "score": "0.5455112", "text": "func (o *PatchConfigurationPropertyOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c2a9934fe527856ecdc9f8f92b10e37b", "score": "0.53845453", "text": "func (_m *MockBacNetPlcTag) GetProperties() []property {\n\tret := _m.Called()\n\n\tvar r0 []property\n\tif rf, ok := ret.Get(0).(func() []property); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]property)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "61457e3b9466bc271156bea56b7eff05", "score": "0.5379721", "text": "func (hjp HiveJobProperties) AsProperties() (*Properties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fa2bd7e10b0e6e9f5985f26350ffa7c3", "score": "0.5376019", "text": "func (v PropertyValue) HasValue() bool {\n\tif v.IsOutput() {\n\t\treturn v.OutputValue().Known\n\t}\n\treturn !v.IsNull()\n}", "title": "" }, { "docid": "ac4a25f54ce4186d8f0ce4d6057c7b00", "score": "0.5367668", "text": "func (usjp USQLJobProperties) AsProperties() (*Properties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "73d078a96d6de60f16eaceb1129f9375", "score": "0.5366811", "text": "func (o *ReadOnlyWithDefault) GetBoolProp1Ok() (*bool, bool) {\n\tif o == nil || IsNil(o.BoolProp1) {\n\t\treturn nil, false\n\t}\n\treturn o.BoolProp1, true\n}", "title": "" }, { "docid": "b7a6d49669c0f86c090b079a142296c1", "score": "0.5328156", "text": "func (o *ServerProperties) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Name, true\n}", "title": "" }, { "docid": "cda5a45d2fc4c5adc6af3f54d4732c5f", "score": "0.5307741", "text": "func (o *ReadOnlyWithDefault) HasProp3() bool {\n\tif o != nil && !IsNil(o.Prop3) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2f62a354014244db96e6e8c97f99527d", "score": "0.5295201", "text": "func (o *UcsdUcsdRestoreParametersAllOf) GetIsPasswordSetOk() (*bool, bool) {\n\tif o == nil || o.IsPasswordSet == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsPasswordSet, true\n}", "title": "" }, { "docid": "de01a1d4105ebd3908b67c1b67944215", "score": "0.5266454", "text": "func IsPropertySet() PredicateFunc {\n\treturn func(v *VolumeCreate) bool {\n\t\treturn len(v.Property) != 0\n\t}\n}", "title": "" }, { "docid": "b0074d89bc50369ecf0e4e877d7a8fe3", "score": "0.5266124", "text": "func (o *ThingUpdateResponse) GetProperties() map[string]interface{} {\n\tif o == nil || o.Properties == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Properties\n}", "title": "" }, { "docid": "124cd32acbed7346fde2c3e77ba4523f", "score": "0.5265597", "text": "func (o *Ga4ghResult) GetFieldsOk() ([]string, bool) {\n\tif o == nil || o.Fields == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.Fields, true\n}", "title": "" }, { "docid": "395b493a6c75f84ffb2ff4d7c440d80b", "score": "0.5258176", "text": "func (o *NatGatewayRuleProperties) GetTypeOk() (*NatGatewayRuleType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Type, true\n}", "title": "" }, { "docid": "fd05ea3bdf2ee01c2d2990d70a6f41c5", "score": "0.52525425", "text": "func GetMetadataProperty(props map[string]string, keys ...string) (val string, ok bool) {\n\tfor _, k := range keys {\n\t\tval, ok = props[k]\n\t\tif ok {\n\t\t\treturn val, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "f8aa9ff71036497250dd062e96f59b24", "score": "0.5249141", "text": "func GetOk(p interface{}) (interface{}, bool) {\n\tt := reflect.TypeOf(p)\n\n\t// if p is a non-pointer, just return it\n\tif t.Kind() != reflect.Ptr {\n\t\treturn p, true\n\t}\n\n\t// p is a pointer. If non-nil, return the value pointed to\n\tv := reflect.Indirect(reflect.ValueOf(p))\n\tif v.IsValid() {\n\t\treturn v.Interface(), true\n\t}\n\n\t// p is a nil pointer. Return the zero value for the pointed-to type\n\treturn reflect.Zero(t.Elem()).Interface(), false\n}", "title": "" }, { "docid": "41108cd0fcf4bd2955f5949b4de22ff0", "score": "0.5246307", "text": "func (v *schema) HasMinProperties() bool {\n\treturn v.minProperties != nil\n}", "title": "" }, { "docid": "041740a48e96b7a7356b042222e53103", "score": "0.52336365", "text": "func (o *ServerProperties) GetVmStateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.VmState, true\n}", "title": "" }, { "docid": "220adf403f4329f8a2646322ca57be6c", "score": "0.52209836", "text": "func (o *MicrosoftGraphWorkbookFilterCriteria) GetValuesOk() (AnyOfobject, bool) {\n\tif o == nil || o.Values == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Values, true\n}", "title": "" }, { "docid": "2f4b951c5092096e4751ebf33cdac0be", "score": "0.5217125", "text": "func (*OpenconfigPlatform_Components_Component_Properties_Property) IsYANGGoStruct() {}", "title": "" }, { "docid": "f2a4022603a2b8185386164cf7766d50", "score": "0.5207511", "text": "func (o *DatacenterProperties) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Name, true\n}", "title": "" }, { "docid": "fba5768cd556b41122d99b8c4569ab6a", "score": "0.520738", "text": "func (o *StorageRemoteKeySettingAllOf) GetPasswordOk() (*string, bool) {\n\tif o == nil || o.Password == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Password, true\n}", "title": "" }, { "docid": "ca2c8ea1c658e46754d316f2505560eb", "score": "0.5194007", "text": "func (_m *MockMetadata) Properties() map[string]interface{} {\n\tret := _m.Called()\n\n\tvar r0 map[string]interface{}\n\tif rf, ok := ret.Get(0).(func() map[string]interface{}); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(map[string]interface{})\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "7bb9678fa23ee4adf5f197971d0820de", "score": "0.5175994", "text": "func (o *StorageKmipAuthCredentialsAllOf) GetIsPasswordSetOk() (*bool, bool) {\n\tif o == nil || o.IsPasswordSet == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsPasswordSet, true\n}", "title": "" }, { "docid": "1ab7a578edbaf07202c2dbacdcb04b01", "score": "0.5173073", "text": "func (o *VersionedProcessor) HasPropertyDescriptors() bool {\n\tif o != nil && o.PropertyDescriptors != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ef2ab2662562c24ed7241cf678bf92ea", "score": "0.51664686", "text": "func (p KeyProperties) Len() int {\n\treturn len(p)\n}", "title": "" }, { "docid": "6467fd4a2a4f060e44f24b20dcb7b55e", "score": "0.51319873", "text": "func (j JSONSchemaMap) Properties() Properties {\n\tif properties, ok := j[\"properties\"]; ok {\n\t\treturn properties.(map[string]interface{})\n\t}\n\treturn map[string]interface{}{}\n}", "title": "" }, { "docid": "dd0302401ebed5205717ea0614f057a3", "score": "0.5125502", "text": "func (o *ProcessorDTO) GetPersistsStateOk() (*bool, bool) {\n\tif o == nil || o.PersistsState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PersistsState, true\n}", "title": "" }, { "docid": "a6602dcba4494dd5eb053a1d900e7a78", "score": "0.5125152", "text": "func (o *TemplateProperties) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Name, true\n}", "title": "" }, { "docid": "b99730d728ab793070ba6c0c7644e94b", "score": "0.5118332", "text": "func (o *PatchConfigurationPropertyNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c6bea0ba3b5c49f68d35af80b658f1fd", "score": "0.51114136", "text": "func (o *WorkflowWorkflowInfoPropertiesAllOf) GetRetryableOk() (*bool, bool) {\n\tif o == nil || o.Retryable == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Retryable, true\n}", "title": "" }, { "docid": "80980803f83716e188e1e841eb9e5e69", "score": "0.5110835", "text": "func (o *DatacenterProperties) GetLocationOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Location, true\n}", "title": "" }, { "docid": "cf206873d75c7c673c50bc4d98449ca2", "score": "0.5106161", "text": "func (o *ThingUpdateRequest) GetProperties() map[string]interface{} {\n\tif o == nil || o.Properties == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Properties\n}", "title": "" }, { "docid": "9a37e7486b490d09791a5e6518dbf8f4", "score": "0.50912666", "text": "func (o *DatacenterProperties) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Description, true\n}", "title": "" }, { "docid": "7877adc1f0f38c0a15e9b364da712b11", "score": "0.5088171", "text": "func (o *FullWebServiceRule) GetMetadataOk() (*ConfigurationMetadata, bool) {\n\tif o == nil || o.Metadata == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metadata, true\n}", "title": "" }, { "docid": "71ea63b42ac21ce2f64180bf75bf1dc8", "score": "0.50645745", "text": "func (o GetResultOutput) DetectedProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v GetResult) map[string]string { return v.DetectedProperties }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "f0611618f3ffbc9661296b2491b59272", "score": "0.50631106", "text": "func (o *FastcgiAuthOptions) GetParamsOk() (*map[string]string, bool) {\n\tif o == nil || o.Params == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Params, true\n}", "title": "" }, { "docid": "0d5c868be50cc95b00390242496c79e6", "score": "0.5044298", "text": "func (o *MaintenanceWindow) GetMetadataOk() (*ConfigurationMetadata, bool) {\n\tif o == nil || o.Metadata == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metadata, true\n}", "title": "" }, { "docid": "73b777bdc7352f19e2b654434f1071fa", "score": "0.50343835", "text": "func (o *CreateWorkspaceInvitation) GetPermissionsOk() (*string, bool) {\n\tif o == nil || IsNil(o.Permissions) {\n\t\treturn nil, false\n\t}\n\treturn o.Permissions, true\n}", "title": "" }, { "docid": "76db55cba382051b67e302aeaf3114bc", "score": "0.50311065", "text": "func (o *InlineObject780) GetTrialsOk() (AnyOfobject, bool) {\n\tif o == nil || o.Trials == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Trials, true\n}", "title": "" }, { "docid": "707b1692a61776720feb1feb02de4150", "score": "0.5027083", "text": "func (o *ReadOnlyWithDefault) GetProp2Ok() (*string, bool) {\n\tif o == nil || IsNil(o.Prop2) {\n\t\treturn nil, false\n\t}\n\treturn o.Prop2, true\n}", "title": "" }, { "docid": "1ccfbef51ebffab46ff97f26908c3a6c", "score": "0.5019167", "text": "func (o *RuleTriggerUpdate) GetValueOk() (*string, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "title": "" }, { "docid": "9ebefca1600cc9f172cb6b5514696659", "score": "0.50187224", "text": "func (o *InlineObject81) GetNotifyOk() (*bool, bool) {\n\tif o == nil || o.Notify == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Notify, true\n}", "title": "" }, { "docid": "033948f9771f727452ff6f3c660c563a", "score": "0.50127125", "text": "func (o *NatGatewayRuleProperties) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Name, true\n}", "title": "" }, { "docid": "db2b79b6315b820dbb10ce1dcc1ae744", "score": "0.5011471", "text": "func (o *GetVSphereStorageProfilesOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "e86c9a8f4a0c9dea6be1fc7994a1504b", "score": "0.50079566", "text": "func (o *ControllerServiceDTO) GetPersistsStateOk() (*bool, bool) {\n\tif o == nil || o.PersistsState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PersistsState, true\n}", "title": "" }, { "docid": "051674ddd636bf5a3748c57d9b5b8d64", "score": "0.5005554", "text": "func (o *GetFlavorProfilesOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "64c7e829b65efda6518fb09eff1efeb2", "score": "0.50045896", "text": "func (o *InlineObject99) GetNotifyOk() (*bool, bool) {\n\tif o == nil || o.Notify == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Notify, true\n}", "title": "" }, { "docid": "8ed80e11a550a303c624ce6e32bb6970", "score": "0.500306", "text": "func (o *PatchConfigurationPropertyForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5360ebc5529a921cd88f15f19f411338", "score": "0.499974", "text": "func (o *ReadOnlyWithDefault) GetBoolProp2Ok() (*bool, bool) {\n\tif o == nil || IsNil(o.BoolProp2) {\n\t\treturn nil, false\n\t}\n\treturn o.BoolProp2, true\n}", "title": "" }, { "docid": "248e087fb82a4b2ca68a84c1e0b10f8e", "score": "0.49977228", "text": "func (o *AppParameters) GetDefaultValuesOk() (*string, bool) {\n\tif o == nil || o.DefaultValues == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DefaultValues, true\n}", "title": "" }, { "docid": "c937169a17e994b75680ef4ed146a329", "score": "0.49966046", "text": "func (sdk SDKProperties) GetValidPropertyNames() []string {\n\treturn validPropertyNames[:]\n}", "title": "" }, { "docid": "19754bb9c90fecf0ece73ab719e0cd7f", "score": "0.49902484", "text": "func (o *Register) GetAuthenticateOk() (*bool, bool) {\n\tif o == nil || IsNil(o.Authenticate) {\n\t\treturn nil, false\n\t}\n\treturn o.Authenticate, true\n}", "title": "" }, { "docid": "96c6aabf8b0920e2611d1b7e8506e5be", "score": "0.49808314", "text": "func (o *AeFlags) GetFlagsOk() (*map[string]Flag, bool) {\n\tif o == nil || o.Flags == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Flags, true\n}", "title": "" }, { "docid": "6bd00545a514bc61a5e316c2aeb10341", "score": "0.4979959", "text": "func (hjp HiveJobProperties) AsBasicProperties() (BasicProperties, bool) {\n\treturn &hjp, true\n}", "title": "" }, { "docid": "8a171a9df009022167602eb9bf772c4a", "score": "0.49794397", "text": "func (usjp USQLJobProperties) AsBasicProperties() (BasicProperties, bool) {\n\treturn &usjp, true\n}", "title": "" }, { "docid": "9c99dc3e5ca0c7748fe5aa60e94f4b10", "score": "0.4972532", "text": "func (v Vertex) GetPropertyBool(key string) (val bool, err error) {\n\tvar valsInterface []interface{}\n\tif valsInterface, err = v.GetMultiPropertyAs(key, \"bool\"); err != nil {\n\t\treturn\n\t}\n\tif len(valsInterface) == 0 {\n\t\terr = ErrorPropertyNotFound\n\t\treturn\n\t}\n\tif len(valsInterface) > 1 {\n\t\terr = ErrorPropertyIsMulti\n\t\treturn\n\t}\n\treturn valsInterface[0].(bool), nil\n}", "title": "" }, { "docid": "7e087041a5b53b0a1ef192aac831d5e5", "score": "0.49679905", "text": "func (o *VersionedProcessor) GetProperties() map[string]string {\n\tif o == nil || o.Properties == nil {\n\t\tvar ret map[string]string\n\t\treturn ret\n\t}\n\treturn *o.Properties\n}", "title": "" }, { "docid": "d7aa054d10a00e071122a4068fd0918e", "score": "0.49607617", "text": "func (o *NatGatewayProperties) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Name, true\n}", "title": "" }, { "docid": "7ea882c7270d5e717c39cc848a77413a", "score": "0.49595922", "text": "func (o *Campaign) GetAttributesOk() (map[string]interface{}, bool) {\n\tif o == nil || o.Attributes == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret, false\n\t}\n\treturn *o.Attributes, true\n}", "title": "" }, { "docid": "016700532634a696b7be82a39be86b3f", "score": "0.49592355", "text": "func (a *MediaEndpoint1) GetProperties() (*MediaEndpoint1Properties, error) {\n\ta.Properties.Lock()\n\terr := a.client.GetProperties(a.Properties)\n\ta.Properties.Unlock()\n\treturn a.Properties, err\n}", "title": "" }, { "docid": "016700532634a696b7be82a39be86b3f", "score": "0.49592355", "text": "func (a *MediaEndpoint1) GetProperties() (*MediaEndpoint1Properties, error) {\n\ta.Properties.Lock()\n\terr := a.client.GetProperties(a.Properties)\n\ta.Properties.Unlock()\n\treturn a.Properties, err\n}", "title": "" }, { "docid": "36d07bf59522f9962f20dd8c3fba2ac3", "score": "0.49577782", "text": "func (p *Properties) verify() error {\n\tif p == nil {\n\t\treturn errors.New(\"lzma: properties are nil\")\n\t}\n\tif !(minLC <= p.LC && p.LC <= maxLC) {\n\t\treturn errors.New(\"lzma: lc out of range\")\n\t}\n\tif !(minLP <= p.LP && p.LP <= maxLP) {\n\t\treturn errors.New(\"lzma: lp out of range\")\n\t}\n\tif !(minPB <= p.PB && p.PB <= maxPB) {\n\t\treturn errors.New(\"lzma: pb out of range\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f233e6a64d0ff9011bb6afa4f9740aa", "score": "0.49503165", "text": "func (o *ReadOnlyWithDefault) GetIntProp1Ok() (*float32, bool) {\n\tif o == nil || IsNil(o.IntProp1) {\n\t\treturn nil, false\n\t}\n\treturn o.IntProp1, true\n}", "title": "" }, { "docid": "daf0e648bc30b34105bf5956dc25e27c", "score": "0.4946385", "text": "func (o *MetaDataCapturing) GetPublicMetadataOk() (*bool, bool) {\n\tif o == nil || o.PublicMetadata == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PublicMetadata, true\n}", "title": "" }, { "docid": "9678819ae2f065bf8beb5bc78e1501a0", "score": "0.49399433", "text": "func (o *GetProjectSettingsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "5e9748a4d1cc9686ac604da114dcc64e", "score": "0.49372843", "text": "func (o *ExtensionProperty) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "title": "" }, { "docid": "51ded5f1d3dfe23b9f5dec3d4105224a", "score": "0.49333343", "text": "func (o *MortgageLiability) GetPropertyAddressOk() (*MortgagePropertyAddress, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PropertyAddress, true\n}", "title": "" }, { "docid": "3ef26e319d15e9dfaf30f8a6930561ed", "score": "0.49332017", "text": "func (fg *fakeGinit) GetProperty(fileName string, keys []string, allKeys bool) (map[string]string, error) {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "32a0316f2e758f0fac6db81ace69ca6c", "score": "0.49269694", "text": "func GetProperties() (*Properties, error) {\n\t// get properties from the factom API and the wallet API\n\tprops := new(Properties)\n\t// wprops := new(PropertiesResponse)\n\treq := NewJSON2Request(\"properties\", APICounter(), nil)\n\twreq := NewJSON2Request(\"properties\", APICounter(), nil)\n\n\tresp, err := factomdRequest(req)\n\tif err != nil {\n\t\tprops.FactomdVersionErr = err.Error()\n\t\treturn props, err\n\t} else if resp.Error != nil {\n\t\tprops.FactomdVersionErr = resp.Error.Error()\n\t} else if jerr := json.Unmarshal(resp.JSONResult(), props); jerr != nil {\n\t\tprops.FactomdVersionErr = jerr.Error()\n\t\treturn props, jerr\n\t}\n\n\twresp, werr := walletRequest(wreq)\n\twprops := new(Properties)\n\tif werr != nil {\n\t\tprops.WalletVersionErr = werr.Error()\n\t\treturn props, werr\n\t} else if wresp.Error != nil {\n\t\tprops.WalletVersionErr = wresp.Error.Error()\n\t} else if jwerr := json.Unmarshal(wresp.JSONResult(), wprops); jwerr != nil {\n\t\tprops.WalletVersionErr = jwerr.Error()\n\t\treturn props, jwerr\n\t}\n\n\tprops.WalletVersion = wprops.WalletVersion\n\tprops.WalletVersionErr = wprops.WalletVersionErr\n\tprops.WalletAPIVersion = wprops.WalletAPIVersion\n\tprops.WalletVersionErr = wprops.WalletAPIVersionErr\n\n\treturn props, nil\n}", "title": "" }, { "docid": "42cf7e20925af1abf7a94978704fbc1a", "score": "0.49250963", "text": "func (o *ProvenanceDTO) GetFinishedOk() (*bool, bool) {\n\tif o == nil || o.Finished == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Finished, true\n}", "title": "" }, { "docid": "3deb66b6f93e750aacc6ae8583ed49cb", "score": "0.4918354", "text": "func (o *NatGatewayProperties) GetLansOk() (*[]NatGatewayLanProperties, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\n\treturn o.Lans, true\n}", "title": "" }, { "docid": "888a324fbe481e75d74129559697c60d", "score": "0.4911369", "text": "func (o *StubList) GetValuesOk() (*[]EntityShortRepresentation, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Values, true\n}", "title": "" } ]
069be7d93067b738245476b92e3d669a
SetLeftFalse will set left property to false
[ { "docid": "90be00bac6a68b5bc958376c9e2751b1", "score": "0.77406526", "text": "func (s *KeyboardState) SetLeftFalse(event dom.Event) {\n\ts.left = false\n}", "title": "" } ]
[ { "docid": "09adeb2f95efd50b8f2c112456355242", "score": "0.687927", "text": "func (s *KeyboardState) SetLeftTrue(event dom.Event) {\n\ts.left = true\n}", "title": "" }, { "docid": "2f2126053d31bd501dc832edb9536ebc", "score": "0.65986127", "text": "func (False) GetLeft() interface{} { return 1 }", "title": "" }, { "docid": "aac7fe2f3a74d30402a77f3230b2a069", "score": "0.6394827", "text": "func (self *Transform) MovingLeft(isMoving bool) {\n\tif isMoving {\n\t\tself.moveDirection.X = -1\n\t} else {\n\t\tself.moveDirection.X = 0\n\t}\n}", "title": "" }, { "docid": "3a7aa4cc9264e828d206a9804d0ab3a3", "score": "0.62856364", "text": "func (btree *BinaryTree) SetLeft(left *BinaryTree) {\n\tbtree.left = left\n}", "title": "" }, { "docid": "a5111c159296e4f3c3a94bc6765ea8a6", "score": "0.6221615", "text": "func (p *Position) Left() {\n\tif p.sx > 0 {\n\t\tp.sx--\n\t}\n}", "title": "" }, { "docid": "477014d7e1478df9bc86bc4c8bbb1d4a", "score": "0.61755586", "text": "func (m *Mul) setLeft(expr Expr) {\n\tm.left = expr\n}", "title": "" }, { "docid": "66a38d2781da4a6cd92ad47c749ab744", "score": "0.6166484", "text": "func (s *KeyboardState) SetRightFalse(event dom.Event) {\n\ts.right = false\n}", "title": "" }, { "docid": "4bac65130d34813ae8675766c55feb82", "score": "0.6112439", "text": "func (t *Triangle) SetLeft(value float64) *Triangle {\n\tif value >= t.Right() {\n\t\tt.Width = 0\n\t} else {\n\t\tt.Width = t.Right() - value\n\t}\n\n\tt.X = value\n\treturn r\n}", "title": "" }, { "docid": "73572986dad9062f157bfec86ee367e6", "score": "0.6089335", "text": "func (s *KeyboardState) SetRightTrue(event dom.Event) {\n\ts.right = true\n}", "title": "" }, { "docid": "c6601d96c71c2b639ee8f67a44b5a6da", "score": "0.6085813", "text": "func (client *PdfToPdfClient) SetRightToLeft(value bool) *PdfToPdfClient {\n client.fields[\"right_to_left\"] = strconv.FormatBool(value)\n return client\n}", "title": "" }, { "docid": "4090d7a044e6a6b58cc7caa4e885edf9", "score": "0.6043371", "text": "func (block *Block) MoveLeft() {\r\n\tblock.x--\r\n}", "title": "" }, { "docid": "836a4221abd302072f3ff8c5c91ad287", "score": "0.6025427", "text": "func (builder *LabelBuilder) SetLeft(value ui.Anchor) *LabelBuilder {\n\tbuilder.areaBuilder.SetLeft(value)\n\treturn builder\n}", "title": "" }, { "docid": "53e0b7c53ea269f0204c0a6b652d6643", "score": "0.6020481", "text": "func (client *HtmlToPdfClient) SetRightToLeft(value bool) *HtmlToPdfClient {\n client.fields[\"right_to_left\"] = strconv.FormatBool(value)\n return client\n}", "title": "" }, { "docid": "b6f90b453f77d0c595af88b674976297", "score": "0.6018099", "text": "func (e *Ed) Left() {\n\tif e.Pos > 0 {\n\t\te.MoveCursor(1, Back)\n\t}\n}", "title": "" }, { "docid": "8ec19f73eef01fd3bed1480120260cce", "score": "0.5956503", "text": "func (connector *InputConnector) SetValueLeft(v interface{}) {\n\tconnector.attributeLeft.SetValue(v)\n\tconnector.channel <- connector.attributeLeft.Value()\n\tconnector.attributeRight.SetValue(<-connector.channel)\n}", "title": "" }, { "docid": "7fd5c297b7718c09a26949168bbb48c1", "score": "0.5921249", "text": "func (this *UI) set_left(_str string) {\n\tthis.Lbl_lhs.SetLabel(_str)\n}", "title": "" }, { "docid": "21c8b14f77b0ede3c2c447e3b1bf555f", "score": "0.59104127", "text": "func (builder *ComboBoxBuilder) SetLeft(value area.Anchor) *ComboBoxBuilder {\n\tbuilder.areaBuilder.SetLeft(value)\n\treturn builder\n}", "title": "" }, { "docid": "8985e154cf7e3e10d7ffbb83dda4ce5f", "score": "0.5864163", "text": "func (self *BitmapText) SetLeftA(member int) {\n self.Object.Set(\"left\", member)\n}", "title": "" }, { "docid": "afe453e158b3fa9b0d160084cbe68165", "score": "0.585698", "text": "func (builder *ImageDisplayBuilder) SetLeft(value ui.Anchor) *ImageDisplayBuilder {\n\tbuilder.areaBuilder.SetLeft(value)\n\treturn builder\n}", "title": "" }, { "docid": "96914ef89102578389ea9ce4aa69189c", "score": "0.5840095", "text": "func (b *BaseStructureTile) RotateLeft() {\n\tif b.rotationPosition == 0 {\n\t\tb.rotationPosition = b.maxRotations - 1\n\t} else {\n\t\tb.rotationPosition--\n\t}\n}", "title": "" }, { "docid": "3c408f2d26452a15f89a45820a622209", "score": "0.57933927", "text": "func (n *Node) IsLeft() bool {\n\tif n.parent == nil {\n\t\treturn false\n\t}\n\treturn n.parent.left == n\n}", "title": "" }, { "docid": "ad2a9080b0468bb15369e59bdcaa7942", "score": "0.574447", "text": "func (rover *RoverStatus) rotateLeft() {\n\tanticlockwiseOrientation := map[string]string{\n\t\t\"N\": \"W\",\n\t\t\"W\": \"S\",\n\t\t\"S\": \"E\",\n\t\t\"E\": \"N\",\n\t}\n\trover.Direction = anticlockwiseOrientation[rover.Direction]\n}", "title": "" }, { "docid": "da4c03e4032a0e24a5bd3b0cfcf61224", "score": "0.5714116", "text": "func (tree *Tree) leftLeftRotate(parent *Node) (*Node) {\n temp := parent\n if parent != tree.root {\n parent.parent.leftchild = parent.leftchild\n }\n temp2 := parent.rightchild\n parent = parent.leftchild\n parent.rightchild = temp\n temp.parent = parent\n parent.rightchild.leftchild = temp2\n parent.rightheight = 1\n parent.rightchild.leftheight = 0\n return parent\n}", "title": "" }, { "docid": "12d1000a07a13d36d83e068fc6732598", "score": "0.56872636", "text": "func (self *Circle) SetLeftA(member interface{}) {\n self.Object.Set(\"left\", member)\n}", "title": "" }, { "docid": "2c1bbe4a778ebb3b75c4cc2384f26b0b", "score": "0.5661676", "text": "func (m *PrintMargin) SetLeft(value *int32)() {\n err := m.GetBackingStore().Set(\"left\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9d1a25d7e41619167fdfd2b26e2a16f0", "score": "0.56581247", "text": "func (tree *Tree) rightLeftRotate(parent *Node) (*Node) {\n temp := parent.rightchild\n parent.rightchild = parent.rightchild.leftchild\n parent.rightchild.rightheight = 1\n parent.rightchild.rightchild = temp\n parent.rightchild.rightchild.leftheight = 0\n tree.rightRightRotate(parent)\n return parent\n}", "title": "" }, { "docid": "a17c2fac0c6321454da2355b437be129", "score": "0.5646705", "text": "func (m *TrackEditor) RotateLeft(amt int) {\n\tm.Rotate(-amt)\n}", "title": "" }, { "docid": "fb770470a6694752453e6ea7558c0791", "score": "0.56320554", "text": "func (self *Transform) TurningLeft(isTurning bool) {\n\tif isTurning {\n\t\tself.rotateDirection.Y = -1\n\t} else {\n\t\tself.rotateDirection.Y = 0\n\t}\n}", "title": "" }, { "docid": "a46b073797793000d8285ea7f1e838b0", "score": "0.5617816", "text": "func (z *PTZ) Left() error {\n\treturn z.ptzReq(ptzCommandLeft)\n}", "title": "" }, { "docid": "cb91afd8834dbda01a6b921e5b2f111c", "score": "0.56154126", "text": "func (a Seg2) Left(u Vec2) bool {\n\treturn a.Ray().Cross().Dot(u.Sub(a.P)) > 0\n}", "title": "" }, { "docid": "902825561ed2d60ea5d4b87a82905830", "score": "0.56150836", "text": "func (tr *Trapezoid) Lefts(tr2 *Trapezoid) {\n\ttr.Neighbors[upleft] = tr2\n\ttr.Neighbors[botleft] = tr2\n}", "title": "" }, { "docid": "7ccfb04a40e36ed1d67c1ff2b1c3d42a", "score": "0.5584723", "text": "func (tree *Tree) leftRightRotate(parent *Node) (*Node) {\n temp := parent.leftchild\n parent.leftchild = parent.leftchild.rightchild\n parent.leftchild.leftchild = temp\n parent.leftchild.leftheight = 1\n parent.leftchild.leftchild.rightheight = 0\n tree.leftLeftRotate(parent)\n return parent\n}", "title": "" }, { "docid": "a8439d5f4896e721c32f8b97c17e1019", "score": "0.5570262", "text": "func (merkleTree *MerkleTree) Left() {\n\tmerkleTree.CurrentDepth++\n\tmerkleTree.CurrentIndex *= 2\n}", "title": "" }, { "docid": "5de42ad9b1f6d751db369bc80322834a", "score": "0.5566329", "text": "func (caller *Point2D) HasLeft() bool {\n\treturn caller.X > XMin\n}", "title": "" }, { "docid": "b6931a406a915af02b870dd91117d8a2", "score": "0.55462587", "text": "func (t *Table) Left() {\n\tif t.robot != nil {\n\t\tt.robot.F = compass.Left(t.robot.F)\n\t}\n}", "title": "" }, { "docid": "133ebc9fa63be6594963b35ead36f73f", "score": "0.5536705", "text": "func (chat ChatMember) HasLeft() bool { return chat.Status == \"left\" }", "title": "" }, { "docid": "e3d7aca4c9fa4cdb7059199ed2816e85", "score": "0.55344504", "text": "func (t *Tape) MoveLeft() {\n\tt.right = t.middle + t.right\n\n\tif len(t.left) != 0 {\n\t\tt.middle = string(t.left[len(t.left)-1])\n\t\tt.left = t.left[:len(t.left)-1]\n\t} else {\n\t\tt.middle = \" \"\n\t\tt.left = \"\"\n\t}\n}", "title": "" }, { "docid": "e24fadac78f4097608278d2ab43adeba", "score": "0.5502319", "text": "func (node *RBNode) leftRotate() {\n\trs := node.rs\n\trs.p, node.p = node.p, rs\n\trs.ls, node.rs = node, rs.ls\n}", "title": "" }, { "docid": "f77b22df7c073e79bf57aae535de1fa9", "score": "0.549815", "text": "func (s *BoundingBox) SetLeft(v float64) *BoundingBox {\n\ts.Left = &v\n\treturn s\n}", "title": "" }, { "docid": "f77b22df7c073e79bf57aae535de1fa9", "score": "0.5496556", "text": "func (s *BoundingBox) SetLeft(v float64) *BoundingBox {\n\ts.Left = &v\n\treturn s\n}", "title": "" }, { "docid": "d81e8d428fed11b93038099012375934", "score": "0.5458574", "text": "func Left() {\n\tStep1Robot.Dir = Dir((uint(Step1Robot.Dir) - 1) % 4)\n}", "title": "" }, { "docid": "9a34cf121cb341375a6522125753388d", "score": "0.5447751", "text": "func (mc *ModelCreate) SetRight(b bool) *ModelCreate {\n\tmc.mutation.SetRight(b)\n\treturn mc\n}", "title": "" }, { "docid": "9ac93e09366b54502c46b951edbcdad3", "score": "0.543137", "text": "func (n *Node) IsLefty() bool {\n\treturn n.arity == Lefty\n}", "title": "" }, { "docid": "8766a4ba12edc690691f7f3420a29de1", "score": "0.54049164", "text": "func (p *Point) MoveLeft() *Point {\n\tp.X--\n\treturn p\n}", "title": "" }, { "docid": "28f262cd277397e8cf09dc6c104884bf", "score": "0.54018795", "text": "func (self *Frame) SetRightA(member int) {\n self.Object.Set(\"right\", member)\n}", "title": "" }, { "docid": "01935866ece09cd7245f4a7a491359a7", "score": "0.5374575", "text": "func (scope *Scope) SkipLeft() {\n\tscope.skipLeft = true\n}", "title": "" }, { "docid": "ea2a5d6c25c8601b5a87b0e8cbcc0a45", "score": "0.5358494", "text": "func (self *Node) rotateLeft() *Node {\n y := self.right\n self.right = y.left\n y.left = self\n\n y.size = self.size\n self.calcSize()\n return y\n}", "title": "" }, { "docid": "0cb637dc97977e81c23cc29a895c58ff", "score": "0.5355337", "text": "func (n *treeNodeV6) IsLeftBitSet() bool {\n\treturn n.prefixLeft >= _leftmost64Bit\n}", "title": "" }, { "docid": "21c38e25f0026059973f94bfc91ca85a", "score": "0.53437656", "text": "func (c *Cursor) Left() {\n\tif c.Loc == c.buf.Start() {\n\t\treturn\n\t}\n\tif c.X > 0 {\n\t\tc.X--\n\t} else {\n\t\tc.Up()\n\t\tc.End()\n\t}\n\tc.LastVisualX = c.GetVisualX()\n}", "title": "" }, { "docid": "825070ae82c0b416c3a421955a718871", "score": "0.5331762", "text": "func (p *GoPiGo) Left() error {\n p.mu.Lock()\n defer p.mu.Unlock()\n return p.sendCmd(cmdValues(leftCmd))\n}", "title": "" }, { "docid": "582aa6bc952c86055955ceaaa2780bac", "score": "0.5329753", "text": "func rotateLeft(y *Node) *Node {\n\tx := y.right\n\ty.right = x.left\n\tif x.left != nil {\n\t\tx.left.parent = y\n\t}\n\tx.left = y\n\tx.parent = y.parent\n\ty.parent = x\n\treturn x\n}", "title": "" }, { "docid": "110615c3bf9d0bdfb967f6aeaf5caeb5", "score": "0.5295995", "text": "func (n *Node) rotateLeft(ptrN **Node) {\n\tp := n.childR\n\tif p.balanceFactor == 0 {\n\t\tn.balanceFactor, p.balanceFactor = 1, -1\n\t} else {\n\t\tn.balanceFactor, p.balanceFactor = 0, 0\n\t}\n\tp.childL, *ptrN, n.childR = n, p, p.childL\n}", "title": "" }, { "docid": "8e26b45e0a4bf1669efa2209ac13d31f", "score": "0.5290212", "text": "func (b *Belt) RotateLeft() {\n\tb.RotationPosition += 11\n\tb.RotationPosition %= 12\n\n\tb.tiles[0][0].RotateLeft()\n\n\tb.setTransfers()\n}", "title": "" }, { "docid": "fd050c10c27b2ed9a1ec339ffc7a9127", "score": "0.52858317", "text": "func leftRotate(x *node) *node {\n\ty := x.right\n\tx.right = y.left\n\ty.left = x\n\treturn y\n}", "title": "" }, { "docid": "397cd62434b69512b74d375063e981d1", "score": "0.5277718", "text": "func (n *Node) lefty() *Node {\n\tn.arity = Lefty\n\treturn n\n}", "title": "" }, { "docid": "5e8f5a6aac4740e9bf9d6d27f86cdaa2", "score": "0.5244149", "text": "func (n *Node) rotateLeft() *Node {\n\t// store our new root\n\tr := n.Right\n\tn.Right = r.Left\n\tr.Left = n\n\tn.setHeight()\n\tr.setHeight()\n\treturn r\n}", "title": "" }, { "docid": "ab160b3a4ccea1db7d1d082f8ae2131b", "score": "0.52427965", "text": "func (t *balancedBST) leftRotate(node *node) *node {\n\ttmp := node.right\n\tnode.right = tmp.left\n\ttmp.left = node\n\treturn tmp\n}", "title": "" }, { "docid": "f0a2dd6460887485425d15e1ed8d9067", "score": "0.5239399", "text": "func (b *Bot) moveLeftRight(dir string) error {\n\tmove := 1\n\tif dir == West {\n\t\tmove = -1\n\t}\n\n\tif isOnTable(b.point.X+move, 0) == false {\n\t\treturn ErrorFalling\n\t}\n\n\tb.point.X += move\n\treturn nil\n}", "title": "" }, { "docid": "c12e57f32e57bd9a092136e961bebbde", "score": "0.5226537", "text": "func (self *Constraint) SetLeftSide(summands *SummandList) {\n\tif !self.isValid {\n\t\treturn\n\t}\n\n\t// check left side\n\tfor i := 0; i < summands.Len(); i++ {\n\t\ts := summands.GetAt(i)\n\t\tfor a := i + 1; a < summands.Len(); a++ {\n\t\t\tnextSummand := summands.GetAt(a)\n\t\t\tif s.Var() == nextSummand.Var() {\n\t\t\t\ts.SetCoeff(s.Coeff() + nextSummand.Coeff())\n\t\t\t\tsummands.RemoveItem(nextSummand)\n\t\t\t\ta--\n\t\t\t}\n\t\t}\n\t}\n\tself.leftSide = summands\n\tself.ls.updateLeftSide(self)\n}", "title": "" }, { "docid": "22b763e0636e54f34f8d4de71c233b23", "score": "0.52218884", "text": "func (m *IdentityNode) LeftRight() (string, string, bool) {\n\tif m.left == \"\" {\n\t\tm.left, m.right, _ = LeftRight(m.Text)\n\t}\n\treturn m.left, m.right, m.left != \"\"\n}", "title": "" }, { "docid": "e52253ec1a2e9ab1fdc477f5c496db26", "score": "0.5218973", "text": "func (c *Cursor) MoveLeft() {\n\tc.MoveTo(c.Row, c.Col-1)\n}", "title": "" }, { "docid": "d602a07f616b3c8a16a662065ede178d", "score": "0.52188855", "text": "func (n *node) rotateLeft() *node {\n\tn.applyShifts()\n\tif n.right != nil {\n\t\tn.right.applyShifts()\n\t}\n\n\tnewRoot := n.right\n\tn.right = newRoot.left\n\tnewRoot.left = n\n\n\tn.updateHeightAndMax()\n\tnewRoot.updateHeightAndMax()\n\treturn newRoot\n}", "title": "" }, { "docid": "04a40f0484782e58847fce711bda18f9", "score": "0.52178663", "text": "func (n *Node) rotateRightLeft(ptrN **Node) {\n\tp := n.childR\n\tq := p.childL\n\tif q.balanceFactor < 0 {\n\t\tn.balanceFactor, p.balanceFactor = 0, 1\n\t} else if q.balanceFactor > 0 {\n\t\tn.balanceFactor, p.balanceFactor = -1, 0\n\t} else {\n\t\tn.balanceFactor, p.balanceFactor = 0, 0\n\t}\n\tq.balanceFactor = 0\n\tq.childL, q.childR, *ptrN, n.childR, p.childL = n, p, q, q.childL, q.childR\n}", "title": "" }, { "docid": "a0f19d5a92e031c5fce262e23ed0b2ae", "score": "0.5211663", "text": "func (parent *Node) hasLeftNode() bool {\n\treturn parent.Left != nil //parent.isNode(parent.Left, (*Node)(nil))\n}", "title": "" }, { "docid": "f8240fb6a25bd8891507c9f800d5c957", "score": "0.5201973", "text": "func (n *Node) leftRotate() *Node {\n\tb := n.right\n\tbl := b.left\n\n\tb.left = n\n\tn.right = bl\n\n\tn.updateHeight()\n\tb.updateHeight()\n\treturn b\n}", "title": "" }, { "docid": "fefccbeaa0387c66b8adadc42d6065b3", "score": "0.51969177", "text": "func (s *KeyboardState) SetUpFalse(event dom.Event) {\n\ts.up = false\n}", "title": "" }, { "docid": "436e7ea11d7943e48feb26976bed0b34", "score": "0.5194921", "text": "func (i iterator) IsLeft() bool {\n\treturn isEven(i.offset)\n}", "title": "" }, { "docid": "f6fb7e1f7685a664f8c52cc875ca28dc", "score": "0.51890373", "text": "func (tree *_Tree) Left() *_RBNode {\r\n\tvar parent *_RBNode\r\n\tcurrent := tree.Root\r\n\tfor current != nil {\r\n\t\tparent = current\r\n\t\tcurrent = current.Left\r\n\t}\r\n\treturn parent\r\n}", "title": "" }, { "docid": "f6fb7e1f7685a664f8c52cc875ca28dc", "score": "0.51890373", "text": "func (tree *_Tree) Left() *_RBNode {\r\n\tvar parent *_RBNode\r\n\tcurrent := tree.Root\r\n\tfor current != nil {\r\n\t\tparent = current\r\n\t\tcurrent = current.Left\r\n\t}\r\n\treturn parent\r\n}", "title": "" }, { "docid": "8d2e47eaaeb635748712c549c3126b39", "score": "0.5185493", "text": "func (t *Triangle) SetRight(value float64) *Triangle {\n\tif value <= t.X {\n\t\tt.Width = 0\n\t} else {\n\t\tt.Width = value - t.X\n\t}\n\n\tt.X = value\n\n\treturn r\n}", "title": "" }, { "docid": "40f7944c105f14dabaedc02f6c497870", "score": "0.5171768", "text": "func (p *GoPiGo) LeftRotate() error {\n p.mu.Lock()\n defer p.mu.Unlock()\n return p.sendCmd(cmdValues(leftRotCmd))\n}", "title": "" }, { "docid": "a24c29543522de9388b373c069e21ab6", "score": "0.51634854", "text": "func LeftUp() error {\n\treturn buttonUp(w32.MOUSEEVENTF_LEFTUP)\n}", "title": "" }, { "docid": "f5f16b4e72e316502052e12b7b8f0f11", "score": "0.5161633", "text": "func (v *Vec2) SetNegate() {\n\tv.X = -v.X\n\tv.Y = -v.Y\n}", "title": "" }, { "docid": "483ff33be86f713085bc1e1101b36e2c", "score": "0.5143678", "text": "func moveLeft(entity components.ComponentHolder, event events.Event) {\n\tcomponents.GetTransform(entity).MovingLeft(event.Pressed)\n}", "title": "" }, { "docid": "bf93f469b0302915366490f47c538195", "score": "0.51402056", "text": "func (robot *Step2Robot) left() {\n\trobot.Dir = (robot.Dir + 3) % 4\n}", "title": "" }, { "docid": "b46be144e94cbaafed5fed3312251b08", "score": "0.5134698", "text": "func leftRotate(n *Node) *Node {\n\tr := n.right\n\trl := r.left\n\tr.left = n\n\tn.right = rl\n\n\tn.height = max(NodeHeight(n.left), NodeHeight(n.right)) + 1\n\tr.height = max(NodeHeight(r.left), NodeHeight(r.right)) + 1\n\treturn r\n}", "title": "" }, { "docid": "1da99fec086d47339bca368b91a16c2c", "score": "0.5131844", "text": "func (rbt *Rbt) rotateLeft(x *node) {\n\ty := x.right\n\tx.right = y.left\n\n\tif y.left != nil {\n\t\ty.left.parent = x\n\t}\n\n\ty.parent = x.parent\n\n\tif x.parent == nil {\n\t\trbt.root = y\n\t} else if x == x.parent.left {\n\t\tx.parent.left = y\n\t} else {\n\t\tx.parent.right = y\n\t}\n\n\ty.left = x\n\tx.parent = y\n}", "title": "" }, { "docid": "a78739e7eedfcb9a543e92bbdfa1e2be", "score": "0.51257795", "text": "func (caller *Point2D) Left() Point2D {\n\treturn Point2D{caller.X - 1, caller.Y}\n}", "title": "" }, { "docid": "41b64870d1280547fbb72f1a7d92c1e0", "score": "0.5123584", "text": "func (side *side) setFromBoolean(value bool) {\n\tif value {\n\t\t*side = 1\n\t} else {\n\t\t*side = 0\n\t}\n}", "title": "" }, { "docid": "738e8871f8f5eeb839b948ea438ef068", "score": "0.5123141", "text": "func (z *PTZ) DownLeft() error {\n\treturn z.ptzReq(ptzCommandDownLeft)\n}", "title": "" }, { "docid": "8fe1762867da7bf1e957cee2f6293755", "score": "0.5123127", "text": "func (buf *Buffer) Left() error {\n\tif buf.pos <= 0 {\n\t\treturn nil\n\t}\n\n\tbuf.pos--\n\treturn buf.Refresh()\n}", "title": "" }, { "docid": "e1cabdde36be7fdef009f37428a4fced", "score": "0.51184464", "text": "func (m *IdentityNode) HasLeftRight() bool {\n\treturn m.left != \"\"\n}", "title": "" }, { "docid": "34ac643b6ec94e458e28f07b31449366", "score": "0.51120013", "text": "func RbLeftRotate(T *Tree, x *TreeNode) {\n\ty := x.Right\n\n\t// move y.Left to x.Right\n\tx.Right = y.Left\n\n\tif y.Left != TreeNil {\n\t\ty.Left.Parent = x\n\t}\n\n\t// move y to x position\n\ty.Parent = x.Parent\n\n\tif x.Parent == TreeNil {\n\t\tT.Root = y\n\t} else if x == x.Parent.Left {\n\t\tx.Parent.Left = y\n\t} else {\n\t\tx.Parent.Right = y\n\t}\n\n\t// update x's new position\n\ty.Left = x\n\tx.Parent = y\n}", "title": "" }, { "docid": "64bc47c0c9e6c942d3df388f9930d3df", "score": "0.5097093", "text": "func (tree *ByExpiry) Left() *ByExpiryNode {\n\tvar parent *ByExpiryNode\n\tcurrent := tree.Root\n\tfor current != nil {\n\t\tparent = current\n\t\tcurrent = current.Left\n\t}\n\treturn parent\n}", "title": "" }, { "docid": "edccaf145abfcf93f91a0f913c657e2c", "score": "0.5094192", "text": "func (o OneDashboardPageWidgetLineOutput) YAxisLeftZero() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v OneDashboardPageWidgetLine) *bool { return v.YAxisLeftZero }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "ec80341b27a37e59f2773cd8ee5b2548", "score": "0.5092618", "text": "func LeftRotate(n *Node) *Node {\n\tif n == nil || n.right == nil {\n\t\treturn n // can't rotate left\n\t}\n\ty := n.right\n\ty.parent = n.parent\n\tn.parent = y\n\tn.right = y.left\n\ty.left = n\n\tif y.parent != nil { // not tree root\n\t\tif y.parent.left == n {\n\t\t\ty.parent.left = y\n\t\t} else if y.parent.right == n {\n\t\t\ty.parent.right = y\n\t\t}\n\t}\n\tFixHeight(n)\n\tFixHeight(y) // needed?\n\treturn y\n}", "title": "" }, { "docid": "faee848f278fb8317324d582dd39c38b", "score": "0.5091231", "text": "func (v Vector) Left() Vector { return Vector{x: v.y, y: -v.x} }", "title": "" }, { "docid": "370723e5536d8da6c5d7f4cc543a4fdf", "score": "0.5087183", "text": "func (t *Token) Left() Node {\n\treturn nil\n}", "title": "" }, { "docid": "d9135ced9c37f6b8cee9ff4c7b610cae", "score": "0.5086765", "text": "func (self *Transform) MovingRight(isMoving bool) {\n\tif isMoving {\n\t\tself.moveDirection.X = 1\n\t} else {\n\t\tself.moveDirection.X = 0\n\t}\n}", "title": "" }, { "docid": "7b6b3c15b4da0ee7c6324371af5d2b0a", "score": "0.50800127", "text": "func (h *LiquidCrystalDriver) LeftToRight() error {\n\th.displaymode |= LCD_ENTRYLEFT\n\treturn h.command(LCD_ENTRYMODESET | h.displaymode)\n}", "title": "" }, { "docid": "8ad9fd1160331443a5d930605e2ab9bf", "score": "0.5078251", "text": "func (t *balancedBST) leftRightRotate(node *node) *node {\n\tnode.left = t.leftRotate(node.left)\n\treturn t.rightRotate(node)\n}", "title": "" }, { "docid": "2d4c2a1190a42d7ca6d349f5875f95f8", "score": "0.50721735", "text": "func (n *Node) Left() *Node {\n\treturn nilIfSentinel(n.left)\n}", "title": "" }, { "docid": "60bf1699bf5ff2de60a1bce151c9a4ca", "score": "0.5071805", "text": "func (field *Field) decrementCellsLeft() {\n\tfield.cellsLeftM.Lock()\n\tfield.CellsLeft--\n\tfield.cellsLeftM.Unlock()\n}", "title": "" }, { "docid": "ace91eac40b3d0d685d8ab56ad3c2efd", "score": "0.50686723", "text": "func (self *Animation) SetIsReversedA(member bool) {\n self.Object.Set(\"isReversed\", member)\n}", "title": "" }, { "docid": "fe8f2b012845fb20779f76253c7ada68", "score": "0.50663924", "text": "func (b *Bool) SetFalse() {\n\tb.Lock()\n\tdefer b.Unlock()\n\tb.v = false\n}", "title": "" }, { "docid": "6673a29191169eea940b182c41aa905c", "score": "0.50606525", "text": "func (p *Paragraph) IsLeftToRight() bool {\n\tpanic(\"unimplemented\")\n}", "title": "" }, { "docid": "15e605edc338d5bb75b4280baa4c148b", "score": "0.50535405", "text": "func (t *balancedBST) rightLeftRotate(node *node) *node {\n\t// 4.right becomes 6\n\tnode.right = t.rightRotate(node.right)\n\treturn t.leftRotate(node)\n}", "title": "" }, { "docid": "5bda7e0ce4c45d5c95fc91b138605b69", "score": "0.504916", "text": "func (board *Board) RotateLeft(x int, y int) {\n\tif board.rotation[x][y] == 0 {\n\t\tboard.rotation[x][y] = 3\n\t\treturn\n\t}\n\tboard.rotation[x][y]--\n}", "title": "" }, { "docid": "cfb418c8901a3c525ccd6fe6bd0c9b91", "score": "0.50354034", "text": "func (self *Cursor) LeftCursor(newValue string) {\n\t// add guard\n\tself.Move(self.Index-1, newValue)\n}", "title": "" }, { "docid": "10d51259a05c095674342f795de2e2b2", "score": "0.50304264", "text": "func setLeftColumn(left []float64, t shmeh.Tensor) shmeh.Tensor {\n\tif len(t.Signature()) != 2 {\n\t\tpanic(\"Trying to set a column of a non-matrix.\")\n\t}\n\ta := t.Reify()\n\tten := shmeh.NewRealTensor(\n\t\tfunc(j ...int) float64 {\n\t\t\tif j[1] == 0 { // if we're trying to access the left column\n\t\t\t\treturn left[j[0]]\n\t\t\t}\n\t\t\treturn a[j[0]][j[1]].(float64)\n\t\t},\n\t\t\"ud\",\n\t\tt.Dimension())\n\treturn ten\n}", "title": "" } ]
649582e9a3bf1eaff9c4f45cebc2365e
SIZEPKESK returns the size in bytes of the PKE secret key of a kyber instance
[ { "docid": "a2fb5a031bf333ccf7db0d79720e2fce", "score": "0.8014973", "text": "func (k *Kyber) SIZEPKESK() int {\n\treturn k.params.SIZEPKESK\n}", "title": "" } ]
[ { "docid": "e5d0f8443c909154c3d46af176c31485", "score": "0.67959684", "text": "func (k *Kyber) SIZESK() int {\n\treturn k.params.SIZESK\n}", "title": "" }, { "docid": "a75208055842dba038dcd30668769629", "score": "0.66773", "text": "func (k *Kyber) PackPKESK(sk *PKEPrivateKey) []byte {\n\tpsk := make([]byte, k.params.SIZEPKESK)\n\tcopy(psk[:], pack(sk.S, k.params.K))\n\treturn psk\n}", "title": "" }, { "docid": "426d238c9b96af2c3cff2eb1be2db802", "score": "0.66600215", "text": "func (k *Kyber) SIZEPK() int {\n\treturn k.params.SIZEPK\n}", "title": "" }, { "docid": "b97844df32c9c74f048a12c96a160812", "score": "0.66592073", "text": "func (k *IceKey) keySize() int { return k.size * 8 }", "title": "" }, { "docid": "51a1b795a0935de7972d1a45f54b1bdd", "score": "0.6450493", "text": "func (e Aes256CtsHmacSha384192) GetKeyByteSize() int {\n\treturn 192 / 8\n}", "title": "" }, { "docid": "3e452b3340b339c2a9fc567ee0cd3626", "score": "0.6244515", "text": "func (kr *keyRequest) Size() int {\n\treturn kr.S\n}", "title": "" }, { "docid": "4509dd2e407ca058693211aa5fc68169", "score": "0.62350917", "text": "func pksize(key []byte, params keymask) int {\n\tn := len(key) * 2 // worst case, all ZEROs or all ONEs\n\tn += 2 // null-termination\n\tn = ((n + 8 - 1) >> 3) << 3 // make it 8-byte aligned.\n\tn += 8 /*hdr*/ + paramsize(params)\n\treturn n\n}", "title": "" }, { "docid": "f59a80e263c24c8eb4b74d6ea0ef8e83", "score": "0.6229005", "text": "func (entryData *EntrySACMDataCommon) GetKeySize() SizeM4 { return entryData.KeySize }", "title": "" }, { "docid": "bc2c8e16e04dd5b4af5ad5b33bd0555f", "score": "0.62108606", "text": "func (prv *PrivateKey) Size() int {\n\ttmp := len(prv.Scalar)\n\tif prv.Variant() == KeyVariantSike {\n\t\ttmp += prv.params.MsgLen\n\t}\n\treturn tmp\n}", "title": "" }, { "docid": "8411c0d0253bf7550cf85e8b768ca29e", "score": "0.6142534", "text": "func (pk *ecdsaPK) Size() int {\n\tif pk == nil {\n\t\treturn 0\n\t}\n\treturn pubKeySize\n}", "title": "" }, { "docid": "b0f00fca5c3aab8ee51ec2053e76bc84", "score": "0.5965948", "text": "func computeKeyValueSize(kv proto.RawKeyValue) int64 {\n\treturn int64(len(kv.Key)) + int64(len(kv.Value))\n}", "title": "" }, { "docid": "c1c71792ead2096474064713a8046f95", "score": "0.59216654", "text": "func (params *Params) PrivateKeySize() int {\n\treturn int(params.N * 3) // skSeed + skPrf + pubSeed\n}", "title": "" }, { "docid": "09c39edc5ab4b15c25ab17f361f783d5", "score": "0.58789", "text": "func (o MfaTotpOutput) KeySize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *MfaTotp) pulumi.IntPtrOutput { return v.KeySize }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "ab1dc8ba333d4828659702de5f56b44e", "score": "0.5859214", "text": "func kvSize(key string, val Value) int {\n\treturn len(key) + len(val.Bytes) + 2 /* flags */ + 8 /* cas unique */\n}", "title": "" }, { "docid": "3328f54cf5c5878713f52dd1fef51aeb", "score": "0.5798369", "text": "func SecretKeyMarshalledSize(compressed bool) int {\n\treturn int(C.embedded_pairing_lqibe_secretkey_get_marshalled_length(C._Bool(compressed)))\n}", "title": "" }, { "docid": "4e31ce9a48aeba23e371fc9371842e2c", "score": "0.57929736", "text": "func (e Aes256CtsHmacSha384192) GetKeySeedBitLength() int {\n\treturn e.GetKeyByteSize() * 8\n}", "title": "" }, { "docid": "1d43b30cca8aa9356187fd892c5b55f7", "score": "0.57905394", "text": "func (kr *rsaKeyRequest) Size() int {\n\treturn kr.size\n}", "title": "" }, { "docid": "aab00e98b78b17f7a0b86d6745e09f94", "score": "0.57385844", "text": "func (bie *blockIndexEntry) size() store.KVLen {\n\treturn store.KVLenSize + store.KVLen(len(bie.key)) + store.KVLenSize*2\n}", "title": "" }, { "docid": "47a708891bde024597a53ac244354eb6", "score": "0.5696838", "text": "func (c *Cipher) KeySize() int {\n\treturn KeySize\n}", "title": "" }, { "docid": "6677c9eb1ca9df6809047437bcdd0856", "score": "0.5636978", "text": "func GetKibibytesP(prefix, key string, defaultVal ...uint64) uint64 {\n\treturn currentOptions().GetKibibytesEx(fmt.Sprintf(\"%s.%s\", prefix, key), defaultVal...)\n}", "title": "" }, { "docid": "122f39d329225e4b93f205a59bbe3a5f", "score": "0.5627598", "text": "func (entity *Entity) GetSizeInBytes(key string) uint {\n\tsizeStr := cast.ToString(entity.Get(key))\n\treturn parseSizeInBytes(sizeStr)\n}", "title": "" }, { "docid": "f5ef83deff3a99ca8413bf280aec4b96", "score": "0.5602079", "text": "func (d *Dilithium) SIZESK() int {\n\treturn d.params.SIZESK\n}", "title": "" }, { "docid": "9da3c638e39d3c84dd5cfef3281221b3", "score": "0.55675906", "text": "func (k *Kyber) UnpackPKESK(psk []byte) *PKEPrivateKey {\n\tif len(psk) != k.params.SIZEPKESK {\n\t\tprintln(\"cannot unpack this private key\")\n\t\treturn nil\n\t}\n\treturn &PKEPrivateKey{S: unpack(psk[:], k.params.K)}\n}", "title": "" }, { "docid": "64ea809273b3a3a9e26984a65b157bbb", "score": "0.55021286", "text": "func (pub *PublicKey) Size() int {\n\treturn pub.params.PublicKeySize\n}", "title": "" }, { "docid": "94ba84d6c7d105ee43d08a408dbe67c2", "score": "0.54755795", "text": "func GetKibibytes(key string, defaultVal ...uint64) uint64 {\n\treturn currentOptions().GetKibibytesEx(key, defaultVal...)\n}", "title": "" }, { "docid": "04d199cfed23c4b27e2b78bda4196fc8", "score": "0.54490846", "text": "func GetK3sSize() ([]string, error) {\n\tclient, err := config.CivoAPIClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tk8sSize := []string{}\n\tallSize, err := client.ListInstanceSizes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, v := range allSize {\n\t\tif strings.Contains(v.Name, \".kube.\") {\n\t\t\tk8sSize = append(k8sSize, v.Name)\n\t\t}\n\t}\n\n\treturn k8sSize, nil\n}", "title": "" }, { "docid": "91a51591302c1bff3365b4e23aff3585", "score": "0.54440117", "text": "func (k *Keystore) Size() int {\n\tk.eMux.Lock()\n\ts := len(k.entries)\n\tk.eMux.Unlock()\n\treturn s\n}", "title": "" }, { "docid": "d4bbaa9f6e1e55882bffae80e8291166", "score": "0.54420644", "text": "func (mb *kvMemBuf) Size() int {\n\treturn mb.size\n}", "title": "" }, { "docid": "584fa59f0cd555511c253f2756c56356", "score": "0.5403751", "text": "func (o GeneralOciKeyring) Size() int {\n\treturn len(o.store)\n}", "title": "" }, { "docid": "6dc25d96980aede64e1245c5550e44e5", "score": "0.5393657", "text": "func (resp *BytesWatchPutResp) GetKey() string {\n\treturn resp.key\n}", "title": "" }, { "docid": "cb46f86e6096abb12012e0a6d3ca179f", "score": "0.53661776", "text": "func (s Size) KiB() uint64 {\n\treturn uint64(s) >> 10\n}", "title": "" }, { "docid": "e819dbe910d0dc7120fefeabf20843fb", "score": "0.535582", "text": "func (store *Datastore) GetSize(ctx context.Context, key ds.Key) (size int, err error) {\n\treturn ds.GetBackedSize(ctx, store, key)\n}", "title": "" }, { "docid": "9f933b5d83b593c429fbf514f8e502ef", "score": "0.53546923", "text": "func Size() int {\n\tvar size int\n\tdb.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket(mainBkt)\n\t\tsize = bucket.Stats().KeyN\n\t\treturn nil\n\t})\n\treturn size\n}", "title": "" }, { "docid": "0a0471d5a46ac07b7a6bbc30173ac848", "score": "0.5354", "text": "func (d *Dilithium) SIZEPK() int {\n\treturn d.params.SIZEPK\n}", "title": "" }, { "docid": "c2186aea87b82964ae8a5851f5243d88", "score": "0.5351347", "text": "func GetKilobytesP(prefix, key string, defaultVal ...uint64) uint64 {\n\treturn currentOptions().GetKilobytesEx(fmt.Sprintf(\"%s.%s\", prefix, key), defaultVal...)\n}", "title": "" }, { "docid": "b20caf0a2fd510031f47b21d8df2df25", "score": "0.52885777", "text": "func hostGetKeyId(key *byte, size int32) int32", "title": "" }, { "docid": "7e2b0781e44ea7cc9d5aa3340b0a1520", "score": "0.5250088", "text": "func (d *Failstore) GetSize(ctx context.Context, k ds.Key) (int, error) {\n\terr := d.errfunc(\"getsize\")\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn d.child.GetSize(ctx, k)\n}", "title": "" }, { "docid": "06f63bbe282e6afce31e392cb4e2dcb0", "score": "0.52230185", "text": "func Size(key string) (uint64, error) {\n\tvar iter = bucket.List(&blob.ListOptions{Prefix: key})\n\tvar size uint64\n\tfor {\n\t\tctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)\n\t\titem, err := iter.Next(ctx)\n\t\tcancel()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn 0, err\n\t\t}\n\t\tif item.Size != 0 {\n\t\t\tsize += uint64(item.Size)\n\t\t\tcontinue\n\t\t}\n\t\t// if size == 0 maybe is dir in upyun\n\t\ts, _ := Size(item.Key + \"/\")\n\t\tsize += s\n\t}\n\treturn size, nil\n}", "title": "" }, { "docid": "b892fa3f7f543f5880eacd12539da1a3", "score": "0.52184063", "text": "func (o LookupTlsPrivateKeyResultOutput) KeyLength() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupTlsPrivateKeyResult) int { return v.KeyLength }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "62b8b574ed09ed01b2606a1e4ae4ded0", "score": "0.52085805", "text": "func (k *IceKey) blockSize() int { return 8 }", "title": "" }, { "docid": "8e15ce177726da35af06c30cd0661a04", "score": "0.51919365", "text": "func (prv *PrivateKey) SharedSecretSize() int {\n\treturn prv.params.SharedSecretSize\n}", "title": "" }, { "docid": "e5fb7405392de4cfba20e157af936d72", "score": "0.5172391", "text": "func computeSize(kv proto.RawKeyValue) int64 {\n\treturn computeKeyValueSize(kv) + llrbNodeSize + keyValueSize\n}", "title": "" }, { "docid": "025310ced785503794f79dc55f056986", "score": "0.51694083", "text": "func (db *DB) GetSize(key string) (resp.SizeResponse, error) {\n\tvar response resp.SizeResponse\n\tif data, ok := db.database[strings.ToLower(key)]; ok {\n\t\tswitch {\n\t\tcase fmt.Sprint(reflect.TypeOf(data)) == \"*dataStructures.LinkedList\":\n\t\t\td := data.(*dataStructures.LinkedList)\n\t\t\tresponse.Value = int(d.Len())\n\t\tcase fmt.Sprint(reflect.TypeOf(data)) == \"*dataStructures.SortedSet\":\n\t\t\td := data.(*dataStructures.SortedSet)\n\t\t\tresponse.Value = d.Size()\n\t\tcase fmt.Sprint(reflect.TypeOf(data)) == \"[]interface {}\":\n\t\t\td := data.([]interface{})\n\t\t\tresponse.Value = len(d)\n\t\tdefault:\n\t\t\tresponse.Value = int(reflect.TypeOf(data).Size())\n\t\t}\n\t\treturn response, nil\n\t}\n\treturn response, errors.New(\"no such key present\")\n}", "title": "" }, { "docid": "1ed47561af9983bcd1ddc7e613d5e6be", "score": "0.51536596", "text": "func (attributes *Attributes) PckSize() int {\n\treturn 3\n}", "title": "" }, { "docid": "9601ed3b9db2c18d04f3319191ab6899", "score": "0.51474833", "text": "func findKeySize(msg []byte, maxKeySize int, distanceFn func(a, b []byte) (int, error)) (int, error) {\n\tnumberOfBlocks := 4\n\t// big number that should be replace on first iteration\n\tminAverage := float64(1000000)\n\tkeysize := 0\n\tfor i := 2; i < maxKeySize; i++ {\n\t\tblocks := getBlocks(msg, i, numberOfBlocks)\n\t\tavg, err := averageDistanceBlocks(blocks, distanceFn)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif minAverage > avg {\n\t\t\tminAverage = avg\n\t\t\tkeysize = i\n\t\t}\n\n\t}\n\treturn keysize, nil\n\n}", "title": "" }, { "docid": "6bb52d3d89aea8feca5737d64e876c84", "score": "0.5139479", "text": "func GetKilobytes(key string, defaultVal ...uint64) uint64 {\n\treturn currentOptions().GetKilobytesEx(key, defaultVal...)\n}", "title": "" }, { "docid": "e90193e5f4b6fbf505188e25ef4391e9", "score": "0.5103832", "text": "func KeyCount() int {\n\tkeyCount := 0\n\tfor _, token := range MyKVS {\n\t\tkeyCount += len(token)\n\t}\n\treturn keyCount\n}", "title": "" }, { "docid": "069c621ef4e346d1b34e24355e6e55b2", "score": "0.50913996", "text": "func (s Size) Kibibytes() float64 {\n\twhole := s / Kibibyte\n\tpart := s % Kibibyte\n\treturn float64(whole) + float64(part)/(1<<(10))\n}", "title": "" }, { "docid": "9b1db2d217210f4d15a65f2153c08e52", "score": "0.508799", "text": "func (k KeySize) Get() (int, error) {\n\tif k != 16 && k != 32 {\n\t\treturn 0, fmt.Errorf(\"expected key size to be 16 or 32, got %d instead\", k)\n\t}\n\n\treturn int(k), nil\n}", "title": "" }, { "docid": "d72ad646085f316121bf9b260746afac", "score": "0.5079842", "text": "func FindKeySize(input []byte, maxKeysize int) int {\n\tnumBlocks := 32\n\tkeysize := 0\n\n\t// Initialise to max 32 bit value\n\tminDist := float32((1 << 32) - 1)\n\n\tfor i := 2; i < maxKeysize; i++ {\n\t\thammingDist := float32(0)\n\t\tdist := float32(0)\n\t\tblocks := prepareBlocks(i, numBlocks, input)\n\n\t\tfor j := 0; j < numBlocks; j += 2 {\n\t\t\thammingDist += float32(HammingDistance(blocks[j], blocks[j+1])) / float32(i)\n\t\t\tdist += hammingDist\n\t\t}\n\t\tnormalisedDist := dist / float32(numBlocks)\n\t\tif normalisedDist < minDist {\n\t\t\tminDist = normalisedDist\n\t\t\tkeysize = i\n\t\t}\n\t}\n\treturn keysize\n}", "title": "" }, { "docid": "67a64a6908b2c26599586baeb72805cc", "score": "0.5078952", "text": "func (k *Kyber) PackSK(sk *PrivateKey) []byte {\n\tpsk := make([]byte, k.params.SIZESK)\n\tid := 0\n\tK := k.params.K\n\tsubtle.ConstantTimeCopy(1, psk[id:id+K*polysize], sk.SkP[:])\n\tid += K * polysize\n\thpk := sk.Pk[:]\n\tcopy(psk[id:], hpk)\n\tid += k.params.SIZEPK\n\thState := sha3.New256()\n\thState.Write(hpk)\n\tcopy(psk[id:id+32], hState.Sum(nil))\n\tid += 32\n\tsubtle.ConstantTimeCopy(1, psk[id:id+32], sk.Z[:])\n\treturn psk\n}", "title": "" }, { "docid": "e868f4b1c7a8e19a8cac5c652f11e696", "score": "0.5077672", "text": "func tryKeySize(n int, text []byte) float64 {\n comps := 10\n ham := 0\n for i := 0; i < comps; i++ {\n ham += hamBytes(text[(i+0)*n:(i+1)*n],\n text[(i+1)*n:(i+2)*n])\n }\n ave := float64(ham) / float64(comps)\n return ave/float64(n)\n}", "title": "" }, { "docid": "e10de03523e761689a4b5ef21a9ff17d", "score": "0.5075333", "text": "func (o SecretOutput) KmsKeyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Secret) *string { return v.KmsKeyName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e40d80bfb9da264905d483e4e523fa5e", "score": "0.5060241", "text": "func (_IDisputeCrowdsourcer *IDisputeCrowdsourcerSession) GetSize() (*big.Int, error) {\n\treturn _IDisputeCrowdsourcer.Contract.GetSize(&_IDisputeCrowdsourcer.CallOpts)\n}", "title": "" }, { "docid": "ce67ce5e659dd22d8402523d1773813a", "score": "0.5052862", "text": "func (jbobject *JavaUtilDictionary) Size() int {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"size\", javabind.Int)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret.(int)\n}", "title": "" }, { "docid": "24724242f83ce9fb252a75a85cf45b8b", "score": "0.5038345", "text": "func (fks *FinderKeys) Len() int {\n\treturn len(fks.keys)\n}", "title": "" }, { "docid": "95c245cf7227fabc29c87dd36faf16b8", "score": "0.5024094", "text": "func (resp *BytesWatchDelResp) GetKey() string {\n\treturn resp.key\n}", "title": "" }, { "docid": "81efab2630f47fe33e2fc22ffcb98146", "score": "0.5017119", "text": "func keyBytes(k uint64) []byte {\n\tb := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(b, k)\n\treturn b\n}", "title": "" }, { "docid": "1bb28f6c6cd9d8d2d44700dd9f3f0d4c", "score": "0.50162864", "text": "func (entryData EntrySACMDataCommon) KeySizeBinaryOffset() uint {\n\treturn 120\n}", "title": "" }, { "docid": "e91cd8734dd71467d1144ff0a443cdd4", "score": "0.50157046", "text": "func (r *RawMessage) KE() (uint64, error) {\n\tdf, err := r.DF()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tswitch df {\n\tcase 24:\n\t\treturn r.Bits(4, 4), nil\n\tdefault:\n\t\treturn 0, newErrorf(ErrNotAvailable, \"error retrieving %s from %d\",\n\t\t\t\"KE\", df)\n\t}\n}", "title": "" }, { "docid": "66d08ed55a444274834fe62f7b92b0ec", "score": "0.5010459", "text": "func KeySize(x, y int, data []byte) (keysize int) {\n\tvar ham float64\n\n\tfor i := x; i <= y; i++ {\n\n\t\ttemp_ham, counter := float64(0), 0\n\t\tblocks := datautils.Blocks(i, data)\n\n\t\tfor j, init := range blocks {\n\t\t\tfor _, rem := range blocks[j+1:] {\n\n\t\t\t\tresult, err := datautils.Hamming(init, rem)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\ttemp_ham += (float64(result) / float64(i))\n\t\t\t\tcounter++\n\t\t\t}\n\t\t}\n\n\t\ttemp_ham /= float64(counter)\n\t\tif temp_ham < ham || ham == 0 {\n\t\t\tham = temp_ham\n\t\t\tkeysize = i\n\t\t}\n\t}\n\treturn keysize\n}", "title": "" }, { "docid": "f208fac87f5dabd61d33da3eb9b923df", "score": "0.5005465", "text": "func (key *keyBase) Msgsize() (s int) {\n\ts = 1 + msgp.Uint8Size + msgp.BytesPrefixSize + len(key.key)\n\treturn\n}", "title": "" }, { "docid": "90275f15e0958af0e05e106e3988d6d8", "score": "0.4993159", "text": "func (o ObjectStorageBucketOutput) SecretKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ObjectStorageBucket) pulumi.StringPtrOutput { return v.SecretKey }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d7034c35fa58b2582f57353f51e30685", "score": "0.49924678", "text": "func (c *speck128k256) BlockSize() int { return 16; }", "title": "" }, { "docid": "53d8ddce5a29f4c3c06f133dc53f531a", "score": "0.49922538", "text": "func Key(c *gin.Context) {\n\n\tdeps := ginject.Deps(c)\n\tkeyProvider, err := models.NewKeyProvider(deps)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tkey := keyProvider.GetJWK()\n\tif key == nil {\n\t\tc.AbortWithStatus(500)\n\t\treturn\n\t}\n\n\tjson, err := gojwk.Marshal(key)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tc.AbortWithStatus(500)\n\t}\n\n\tc.Data(200, \"application/json\", json)\n}", "title": "" }, { "docid": "948b8f74838667c46eaeec87ef54ea5e", "score": "0.49796745", "text": "func (cur *Cursor) KeyLen() int {\n\treturn cur.KeySize()\n}", "title": "" }, { "docid": "cc9e67f47f6729210293a78175e7fdd7", "score": "0.4973192", "text": "func (c *Code) K() uint {\n\treturn uint(len(c.basis))\n}", "title": "" }, { "docid": "f8f3d362c5f3fda4c3b1ba877f5feeac", "score": "0.49726447", "text": "func (p *Point) PBSize() int {\n\tpbpt := p.PBPoint()\n\td, err := proto.Marshal(pbpt)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn len(d)\n}", "title": "" }, { "docid": "b454b9dbe5eff4fa7c48af666542b266", "score": "0.4951956", "text": "func (o InlineSecretOutput) KmsKeyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InlineSecret) *string { return v.KmsKeyName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bd2be18f6a3b994ce302b697c3c45dcc", "score": "0.49499053", "text": "func (k *KeyList) Len() int {\n\treturn len(k.keys)\n}", "title": "" }, { "docid": "7baa7b36a8ec25e559da178225f01fb1", "score": "0.4948806", "text": "func KeyLength(method encryptionpb.EncryptionMethod) (int, error) {\n\tswitch method {\n\tcase encryptionpb.EncryptionMethod_AES128_CTR:\n\t\treturn 16, nil\n\tcase encryptionpb.EncryptionMethod_AES192_CTR:\n\t\treturn 24, nil\n\tcase encryptionpb.EncryptionMethod_AES256_CTR:\n\t\treturn 32, nil\n\tdefault:\n\t\tname, ok := encryptionpb.EncryptionMethod_name[int32(method)]\n\t\tif ok {\n\t\t\treturn 0, errs.ErrEncryptionInvalidMethod.GenWithStackByArgs(name)\n\t\t}\n\t\treturn 0, errs.ErrEncryptionInvalidMethod.GenWithStackByArgs(int32(method))\n\t}\n}", "title": "" }, { "docid": "ff3ebfb16a63395df9ef9b3e75507b9b", "score": "0.49381202", "text": "func (k *Kyber) SIZEC() int {\n\treturn k.params.SIZEC\n}", "title": "" }, { "docid": "45cc67a521ca6206e0a9f88659ef1c14", "score": "0.49108788", "text": "func keyBytes() []byte {\n\tif pubKey, _, err := GetKeys(\"\"); err != nil {\n\t\tglog.Errorf(rpclogString(fmt.Sprintf(\"Error getting keys %v\", err)))\n\t\treturn []byte(`none`)\n\t} else if b, err := MarshalPublicKey(pubKey); err != nil {\n\t\tglog.Errorf(rpclogString(fmt.Sprintf(\"Error marshalling device public key %v, error %v\", pubKey, err)))\n\t\treturn []byte(`none`)\n\t} else {\n\t\treturn b\n\t}\n}", "title": "" }, { "docid": "af89247b9caeb82aef4a56cd438c80e5", "score": "0.4903674", "text": "func (user *User) PckSizeWithTag() int {\n\tpanic(\"User doesn't support tagged serialization\")\n}", "title": "" }, { "docid": "bf3b0fa08923289ba288d3e81c2387a5", "score": "0.49032596", "text": "func (p *Pk) Pk() ([]byte, error) {\n\treturn field.EncodeInt64(p.B), nil\n}", "title": "" }, { "docid": "b992291587f42937acc4776071be56de", "score": "0.48999578", "text": "func (o GetInstanceBootDiskInitializeParamOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetInstanceBootDiskInitializeParam) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "855ccad4ce7c0fcf67a0b75ca267b571", "score": "0.48932606", "text": "func (p *Point) Size() int {\n\tn := len(p.name)\n\tfor _, kv := range p.kvs {\n\t\tn += len(kv.Key)\n\t\tn += 1 // IsTag\n\t\tn += 8 // time\n\t\tn += 4 // MetricType: uint32\n\t\tn += len(kv.Unit)\n\t\tswitch kv.Val.(type) {\n\t\tcase *Field_I, *Field_F, *Field_U:\n\t\t\tn += 8\n\t\tcase *Field_B:\n\t\t\tn += 1\n\t\tcase *Field_D:\n\t\t\tn += len(kv.GetD())\n\t\tdefault:\n\t\t\t// ignored\n\t\t}\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "d097fb332f77618876f36d4d4242ff18", "score": "0.4891174", "text": "func (o DatabaseEncryptionConfigurationOutput) KmsKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DatabaseEncryptionConfiguration) *string { return v.KmsKey }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "61ca6ea156b8a84e775f0b5a71ae7761", "score": "0.48879504", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerSession) GetSize() (*big.Int, error) {\n\treturn _DisputeCrowdsourcer.Contract.GetSize(&_DisputeCrowdsourcer.CallOpts)\n}", "title": "" }, { "docid": "74401801ce88318f4f8ae9e2ba476d71", "score": "0.48848262", "text": "func KDF(N, R, P int, salt []byte, password string) (*Key, error) {\n\tif len(salt) == 0 {\n\t\treturn nil, fmt.Errorf(\"scrypt() called with empty salt\")\n\t}\n\n\tderKeys := &Key{}\n\n\tkeybytes := macKeySize + aesKeySize\n\tscryptKeys, err := scrypt.Key([]byte(password), salt, N, R, P, keybytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error deriving keys from password: %v\", err)\n\t}\n\n\tif len(scryptKeys) != keybytes {\n\t\treturn nil, fmt.Errorf(\"invalid numbers of bytes expanded from scrypt(): %d\", len(scryptKeys))\n\t}\n\n\t// first 32 byte of scrypt output is the encryption key\n\tcopy(derKeys.Encrypt[:], scryptKeys[:aesKeySize])\n\n\t// next 32 byte of scrypt output is the mac key, in the form k||r\n\tmacKeyFromSlice(&derKeys.MAC, scryptKeys[aesKeySize:])\n\n\treturn derKeys, nil\n}", "title": "" }, { "docid": "74e3a4baf7097a8b75663c4dfbc91e26", "score": "0.4871863", "text": "func (_IDisputeCrowdsourcer *IDisputeCrowdsourcerCallerSession) GetSize() (*big.Int, error) {\n\treturn _IDisputeCrowdsourcer.Contract.GetSize(&_IDisputeCrowdsourcer.CallOpts)\n}", "title": "" }, { "docid": "80d5c7e92c344684c96d081b8b37ba18", "score": "0.4866687", "text": "func (db *RedisDB) KeyCount() int {\n\treturn int(db.Client.HLen(db.HashKey).Val())\n}", "title": "" }, { "docid": "02ad1b34b803b8137e3d4f267dc37526", "score": "0.48495564", "text": "func (o SecretResponseOutput) KmsKeyName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SecretResponse) string { return v.KmsKeyName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c8dbcaa2756e29be167c974e12759ca5", "score": "0.4844401", "text": "func (hashing *JaccardHashing) K() uint {\n\treturn uint(len(hashing.tables))\n}", "title": "" }, { "docid": "6e30cc749f4459e74d7974f105eec496", "score": "0.48366848", "text": "func (r *Bid) NKeys() int { return 0 }", "title": "" }, { "docid": "d7eb73f36e0111b70b0bd4f9bb85b003", "score": "0.4828328", "text": "func (size Bits) KiB() float64 {\n\treturn float64(size) / KiB\n}", "title": "" }, { "docid": "9aed6b1f2bf396d9237d65d6f042f9ae", "score": "0.48255754", "text": "func (b *BackupEngineInfo) GetSize(index int) int64 {\n\treturn int64(C.rocksdb_backup_engine_info_size(b.c, C.int(index)))\n}", "title": "" }, { "docid": "ab7dee52f889c9a2dfe061be7832023c", "score": "0.4822341", "text": "func (o TriggerBuildSecretOutput) KmsKeyName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TriggerBuildSecret) string { return v.KmsKeyName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cabadf8f99a1cb03e0e19bc72099e0af", "score": "0.48183987", "text": "func (v viperStore) KMSKeyID() string {\n\treturn viper.GetString(\"KMS.KeyID\")\n}", "title": "" }, { "docid": "5c2c224373760935e8686ef2db3613cb", "score": "0.48156425", "text": "func (k *Kyber) PackPK(pk *PublicKey) []byte {\n\tppk := make([]byte, k.params.SIZEPK)\n\tcopy(ppk[:], pack(pk.T, k.params.K))\n\tcopy(ppk[k.params.K*polysize:], pk.Rho[:])\n\treturn ppk\n}", "title": "" }, { "docid": "3bce7d94bcdf9dd1c12e3215799c8508", "score": "0.48146442", "text": "func scoreKeysize(c []byte, k int) float64 {\n\tvar sum, n int\n\tprev := c[:k]\n\n\tfor i := k; i < len(c); i += k {\n\t\tsum += mustGetEditDistance(prev, c[i:i+k])\n\t\tn += 1\n\t}\n\n\treturn float64(sum) / float64(n) / float64(k)\n}", "title": "" }, { "docid": "fbca0602a1e1465b9f7279a139141acd", "score": "0.4812797", "text": "func (k KEM) PayloadSize() int {\n\tswitch k {\n\tcase CLASSIC_MCELIECE_348864:\n\t\treturn 4\n\tcase CLASSIC_MCELIECE_348864f:\n\t\t// TODO FIX THIS TO BE CORRECT\n\t\treturn 5\n\tcase SABER_FIRESABER:\n\t\treturn 1312\n\tcase NTRU_HPS_2048_509:\n\t\treturn 699\n\tcase NTRU_HPS_2048_677:\n\t\treturn 930\n\tcase NTRU_HPS_4096_821:\n\t\treturn 1230\n\tcase NTRU_HRSS_701:\n\t\treturn 1138\n\tcase KYBER_512:\n\t\treturn 800\n\tcase KYBER_768:\n\t\treturn 1184\n\tcase KYBER_1024:\n\t\treturn 1568\n\tcase SIKE_p434:\n\t\treturn 330\n\tcase SIKE_p434_compressed:\n\t\treturn 197\n\tcase SIKE_p503:\n\t\treturn 378\n\tcase SIKE_p503_compressed:\n\t\treturn 378\n\tcase SIKE_p610:\n\t\treturn 462\n\tcase SIKE_p610_compressed:\n\t\treturn 274\n\tcase SIKE_p751_compressed:\n\t\treturn 335\n\tdefault:\n\t\treturn -1\n\t}\n}", "title": "" }, { "docid": "eb2704d12aa88540e5d7adac65411778", "score": "0.48124027", "text": "func (k Key) boxKey() *[KeyLen]byte {\n\treturn (*[KeyLen]byte)(&k)\n}", "title": "" }, { "docid": "8e42161dbbe4e7ee06acbb5dbbeb30fc", "score": "0.48121375", "text": "func (b *Bucket) ListSize(key string) (uint, Cas, error) {\n\tvar listContents []interface{}\n\tcas, err := b.Get(key, &listContents)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\treturn uint(len(listContents)), cas, nil\n}", "title": "" }, { "docid": "9b850bc65a2dca58d072f934157cb5dc", "score": "0.48101175", "text": "func (pk RsaThalesPrivKey) PrivateKeyBytes() []byte {\n\treturn pk.pkeyBytes\n}", "title": "" }, { "docid": "1bc355f522c5ab6fab1dd87c982eed0e", "score": "0.48100504", "text": "func EgressLengthKey(destChain string) []byte {\n\treturn []byte(fmt.Sprintf(\"egress/%s\", destChain))\n}", "title": "" }, { "docid": "404b33bb9b8eeb43b7305680bf17870c", "score": "0.4803817", "text": "func GetBinlogSize(kv kv.DataKV, key string) (int64, error) {\n\n\treturn kv.GetSize(key)\n}", "title": "" }, { "docid": "8c543f2764c99d8a750ddff8f86eebbc", "score": "0.47886378", "text": "func (o KeysAwOutput) SecretKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeysAw) string { return v.SecretKey }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ca4f9a6f216c5f62bb7e18c42d1aa643", "score": "0.47855592", "text": "func (a byKey) Len() int {\n\treturn len(a)\n}", "title": "" }, { "docid": "8b624935fd7e5d47e9cdfdb485609db4", "score": "0.47838828", "text": "func (user *User) PckSize() (size int) {\n\tvar length int\n\t_ = length\n\tsize = 4\n\tsize += sizeIvar(int64(user.Health))\n\tsize += user.Position.PckSize()\n\treturn\n}", "title": "" } ]
e491150ac62060318ced6ad3b25497a4
12factor setup for viperbacked application. Most important it will check environment variables for all flags in the provided flag set.
[ { "docid": "d5b4ca53df1243b77faef9ed320d56c1", "score": "0.6084441", "text": "func TwelveFactor(name string, flags *pflag.FlagSet, viperMaybe ...*viper.Viper) error {\n\tv := viper.GetViper()\n\tif len(viperMaybe) != 0 {\n\t\tv = viperMaybe[0]\n\t}\n\n\terr := initDebugFlags(flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tenvprefix := strings.ToUpper(sanitize(name))\n\terr = initEnvFlags(flags, envprefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = initLogFlags(flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = initMetricsFlags(flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = initCronFlags(flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Bind flags and configuration keys 1-to-1\n\terr = v.BindPFlags(flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set env prefix\n\tv.SetEnvPrefix(envprefix)\n\n\t// Patch automatic env\n\tAutomaticEnv(flags, v)\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "0c2e11ce01e75189d25569aae3faed4b", "score": "0.5916917", "text": "func initViper() {\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\", \".\", \"_\"))\n\tviper.AutomaticEnv()\n}", "title": "" }, { "docid": "ca0b33f96835b2b4ffd493cf43cc342e", "score": "0.5890364", "text": "func setGlobalFlagValues() {\n\tpkcs11Lib = viper.GetString(\"pkcs11.library\")\n\tpkcs11SlotLabel = viper.GetString(\"pkcs11.label\")\n\tpkcs11SlotPin = viper.GetString(\"pkcs11.pin\")\n}", "title": "" }, { "docid": "fd2cf88ca42aeb1185c69c45c6af8399", "score": "0.5871988", "text": "func init() {\n iFlag := flag.Bool(\"i\", false, \n\t\t\"Ignore previous environment values and use the new value pairs for next process execution.\")\n flag.Parse()\n ignoreFlag = iFlag;\n}", "title": "" }, { "docid": "3624c86f34b1804edc43de0c7cb35ed8", "score": "0.5800335", "text": "func initConfig() {\n\tviper.AutomaticEnv() // read in environment variables that match\n\tviper.BindPFlags(rootCmd.Flags())\n}", "title": "" }, { "docid": "d6e6a8c6b92d5aa2adf69c669f3fc72d", "score": "0.5768245", "text": "func (h *Helper) InstallFlags(flags *pflag.FlagSet) {\n}", "title": "" }, { "docid": "3fc94836b8bf763da041c26ee0d4da33", "score": "0.57252717", "text": "func Setup(serviceName string) func(cmd *cobra.Command, args []string) error {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tviper.AutomaticEnv()\n\t\tviper.SetEnvPrefix(strings.ToUpper(serviceName))\n\t\tviper.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\", \".\", \"_\"))\n\n\t\tenv := Env()\n\n\t\tenvFiles := []string{\".env\"}\n\t\tif env.IsLocal() {\n\t\t\tenvFiles = append(envFiles, \".env.local\")\n\t\t} else {\n\t\t\tenvFiles = append(envFiles, \".env.\"+env.String())\n\t\t}\n\n\t\t_ = godotenv.Overload(envFiles...)\n\n\t\terr := viper.BindPFlags(cmd.Flags())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tconfigFile := cmd.Flags().Lookup(\"config\").Value.String()\n\t\tviper.SetConfigFile(configFile)\n\t\tviper.ReadInConfig()\n\n\t\tswitch viper.GetString(\"loglevel\") {\n\t\tcase \"fatal\":\n\t\t\tlogrus.SetLevel(logrus.FatalLevel)\n\n\t\tcase \"error\":\n\t\t\tlogrus.SetLevel(logrus.ErrorLevel)\n\n\t\tcase \"info\":\n\t\t\tlogrus.SetLevel(logrus.InfoLevel)\n\n\t\tcase \"debug\":\n\t\t\tlogrus.SetLevel(logrus.DebugLevel)\n\n\t\tcase \"trace\":\n\t\t\tlogrus.SetLevel(logrus.TraceLevel)\n\n\t\tdefault:\n\t\t\tif env.IsProduction() {\n\t\t\t\tlogrus.SetLevel(logrus.WarnLevel)\n\t\t\t} else {\n\t\t\t\tlogrus.SetLevel(logrus.DebugLevel)\n\t\t\t}\n\t\t}\n\n\t\tif env.IsLocal() {\n\t\t\tlogrus.SetFormatter(&logrus.TextFormatter{\n\t\t\t\tForceColors: true,\n\t\t\t})\n\t\t} else {\n\t\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t\t}\n\n\t\tlog.SetOutput(logrus.New().Writer())\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "88d732d838ec4dcb0268e5bcc4763307", "score": "0.5706301", "text": "func CheckServiceFlags() {\n\tif viper.GetBool(\"version\") {\n\t\tlog.WithField(\"version\", version.GetVersion().ToString()).\n\t\t\tInfo(\"Exiting\")\n\t\tos.Exit(0)\n\t}\n\n\tif len(viper.GetString(\"jwt_signing_key\")) == 0 {\n\t\tlog.Panic(\"Flag --jwt_signing_key or ENV PL_JWT_SIGNING_KEY is required\")\n\t}\n\n\tif !viper.GetBool(\"disable_ssl\") {\n\t\tif len(viper.GetString(\"server_tls_key\")) == 0 {\n\t\t\tlog.Panic(\"Flag --server_tls_key or ENV PL_SERVER_TLS_KEY is required when ssl is enabled\")\n\t\t}\n\n\t\tif len(viper.GetString(\"server_tls_cert\")) == 0 {\n\t\t\tlog.Panic(\"Flag --server_tls_cert or ENV PL_SERVER_TLS_CERT is required when ssl is enabled\")\n\t\t}\n\n\t\tif len(viper.GetString(\"tls_ca_cert\")) == 0 {\n\t\t\tlog.Panic(\"Flag --tls_ca_cert or ENV PL_TLS_CA_CERT is required when ssl is enabled\")\n\t\t}\n\t}\n\n\tif viper.GetBool(\"disable_grpc_auth\") {\n\t\tlog.Warn(\"Security WARNING!!! : Auth disabled on GRPC.\")\n\t}\n}", "title": "" }, { "docid": "8e64e806f1df9567b067878319295b9a", "score": "0.56559515", "text": "func initFlags() {\n\tenvflag.CommandLine.Parse()\n\tflag.Parse()\n}", "title": "" }, { "docid": "7a9108af3d966535e3edaf8668ff4cda", "score": "0.56299126", "text": "func bindFlags(cmd *cobra.Command, v *viper.Viper) {\n\tcmd.Flags().VisitAll(func(f *pflag.Flag) {\n\t\t// Environment variables can't have dashes in them, so bind them to their equivalent\n\t\t// keys with underscores, e.g. --favorite-color to STING_FAVORITE_COLOR\n\t\t// if strings.Contains(f.Name, \"-\") {\n\t\t// \tenvVarSuffix := strings.ToUpper(strings.ReplaceAll(f.Name, \"-\", \"_\"))\n\t\t// \tv.BindEnv(f.Name, fmt.Sprintf(\"%s_%s\", envPrefix, envVarSuffix))\n\t\t// }\n\n\t\t// Apply the viper config value to the flag when the flag is not set and viper has a value\n\t\tif !f.Changed && v.IsSet(f.Name) {\n\t\t\tval := v.Get(f.Name)\n\t\t\tcmd.Flags().Set(f.Name, fmt.Sprintf(\"%v\", val))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "3a821a5e53167a549af32df5db308b4c", "score": "0.56206644", "text": "func init() {\n\tviper.SetDefault(\"host\", \"0.0.0.0\")\n\tif host := viper.GetString(\"host\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"HOST\", host)\n\t}\n\n\tviper.SetDefault(\"port\", \"8080\")\n\tif host := viper.GetString(\"port\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"PORT\", host)\n\t}\n\n\tif host := viper.GetString(\"tls.host\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"TLS_HOST\", host)\n\t}\n\n\tviper.SetDefault(\"tls.port\", \"8443\")\n\tif host := viper.GetString(\"tls.port\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"TLS_PORT\", host)\n\t}\n\n\tviper.SetDefault(\"tls.certificate\", \"tls/certificate.crt\")\n\tif host := viper.GetString(\"tls.certificate\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"TLS_CERTIFICATE\", host)\n\t}\n\n\tviper.SetDefault(\"tls.key\", \"tls/key.key\")\n\tif host := viper.GetString(\"tls.key\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"TLS_PRIVATE_KEY\", host)\n\t}\n\n\tif host := viper.GetString(\"tls.ca.certificate\"); host != \"\" {\n\t\t//#nosec\n\t\tos.Setenv(\"TLS_CA_CERTIFICATE\", host)\n\t}\n}", "title": "" }, { "docid": "d5081c061d0ea7924d666902ad64cdc2", "score": "0.5586215", "text": "func SetupEnv() {\n\tviper.AutomaticEnv()\n\n\tviper.SetDefault(\"ALLOWED_ORIGIN\", \"\")\n\n\t// twilio\n\tviper.SetDefault(\"TWILIO_ACCOUNT_SID\", \"\")\n\tviper.SetDefault(\"TWILIO_AUTH_TOKEN\", \"\")\n\n\t// sendgrid\n\tviper.SetDefault(\"SENDGRID_API_KEY\", \"\")\n\n\t// database\n\tviper.SetDefault(\"DB_HOST\", \"\")\n\tviper.SetDefault(\"DB_PORT\", \"\")\n\tviper.SetDefault(\"DB_USER\", \"\")\n\tviper.SetDefault(\"DB_PASSWORD\", \"\")\n\tviper.SetDefault(\"DB_NAME\", \"\")\n\tviper.SetDefault(\"DB_SSL_MODE\", \"\")\n\n}", "title": "" }, { "docid": "4196d7d38ec30c9ce33b93dd19067dcd", "score": "0.55379415", "text": "func (s *ServerCmd) registerFlags() {\n\t// Get the default config file path\n\tcfg := util.GetDefaultConfigFile(cmdName)\n\n\t// All env variables must be prefixed\n\ts.myViper.SetEnvPrefix(envVarPrefix)\n\ts.myViper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\"))\n\n\t// Set specific global flags used by all commands\n\tpflags := s.rootCmd.PersistentFlags()\n\tpflags.StringVarP(&s.cfgFileName, \"config\", \"c\", \"\", \"Configuration file\")\n\tpflags.MarkHidden(\"config\")\n\t// Don't want to use the default parameter for StringVarP. Need to be able to identify if home directory was explicitly set\n\tpflags.StringVarP(&s.homeDirectory, \"home\", \"H\", \"\", fmt.Sprintf(\"Server's home directory (default \\\"%s\\\")\", filepath.Dir(cfg)))\n\tutil.FlagString(s.myViper, pflags, \"boot\", \"b\", \"\",\n\t\t\"The user:pass for bootstrap admin which is required to build default config file\")\n\n\t// Register flags for all tagged and exported fields in the config\n\ts.cfg = &lib.ServerConfig{}\n\ttags := map[string]string{\n\t\t\"help.csr.cn\": \"The common name field of the certificate signing request to a parent fabric-ca-server\",\n\t\t\"help.csr.serialnumber\": \"The serial number in a certificate signing request to a parent fabric-ca-server\",\n\t\t\"help.csr.hosts\": \"A list of comma-separated host names in a certificate signing request to a parent fabric-ca-server\",\n\t}\n\terr := util.RegisterFlags(s.myViper, pflags, s.cfg, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcaCfg := &lib.CAConfig{}\n\terr = util.RegisterFlags(s.myViper, pflags, caCfg, tags)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "cefefd4b5efd13bcb347ca6934d284fb", "score": "0.55241275", "text": "func (cmd *WorkerCommand) verifyRuntimeFlags() error {\n\tswitch {\n\tcase cmd.Runtime == houdiniRuntime:\n\t\tif cmd.hasFlags(guardianEnvPrefix) || cmd.hasFlags(containerdEnvPrefix) {\n\t\t\treturn fmt.Errorf(\"cannot use %s or %s environment variables with Houdini\", guardianEnvPrefix, containerdEnvPrefix)\n\t\t}\n\tcase cmd.Runtime == containerdRuntime:\n\t\tif cmd.hasFlags(guardianEnvPrefix) {\n\t\t\treturn fmt.Errorf(\"cannot use %s environment variables with Containerd\", guardianEnvPrefix)\n\t\t}\n\tcase cmd.Runtime == guardianRuntime:\n\t\tif cmd.hasFlags(containerdEnvPrefix) {\n\t\t\treturn fmt.Errorf(\"cannot use %s environment variables with Guardian\", containerdEnvPrefix)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported Runtime :%s\", cmd.Runtime)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08eec4f2ba045dd033c55900b552aad1", "score": "0.55220604", "text": "func setup() {\n\tflag.Usage = func() {\n\t\tg.Printf(banner)\n\t\ty.Printf(\"\\nwritten & maintained with ♥ by NetEvert\\n\\n\")\n\t\tfmt.Println(utilDescription)\n\t\tflag.PrintDefaults()\n\t}\n\n\tflag.Parse()\n\n\tif *ver {\n\t\ty.Printf(\"DELATOR\")\n\t\tfmt.Printf(\" v.%s\\n\", appVersion)\n\t\tos.Exit(1)\n\t}\n\n\tif *domain == \"\" {\n\t\tr.Printf(\"\\nplease supply a domain\\n\\n\")\n\t\tfmt.Println(utilDescription)\n\t\tflag.PrintDefaults()\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "357b439b275789ddc74f76b08a8d6d8d", "score": "0.5517852", "text": "func InitVaultFlags(flag *pflag.FlagSet) {\n\t// Flags default to empty string to facilitate deploys from CircleCI\n\tflag.String(VaultAWSKeychainNameFlag, \"\", \"The aws-vault keychain name\")\n\tflag.String(VaultAWSProfileFlag, \"\", \"The aws-vault profile\")\n\tflag.Duration(VaultAWSSessionDurationFlag, time.Hour*4, \"the aws-vault sesion duration\")\n\tflag.Duration(VaultAWSAssumeRoleTTLFlag, time.Minute*15, \"the aws-vault assume role duration\")\n}", "title": "" }, { "docid": "0435175c842dcd75bb504fde22e30672", "score": "0.5517721", "text": "func flagsToArgs(flags Flags) []string {\n\t// Port targets\n\thttpPortString := strconv.FormatUint(uint64(flags.HTTPPort), 10)\n\tstakingPortString := strconv.FormatUint(uint64(flags.StakingPort), 10)\n\n\twd, _ := os.Getwd()\n\t// If the path given in the flag doesn't begin with \"/\", treat it as relative\n\t// to the directory of the avash binary\n\thttpCertFile := flags.HTTPTLSCertFile\n\tif httpCertFile != \"\" && string(httpCertFile[0]) != \"/\" {\n\t\thttpCertFile = fmt.Sprintf(\"%s/%s\", wd, httpCertFile)\n\t}\n\n\thttpKeyFile := flags.HTTPTLSKeyFile\n\tif httpKeyFile != \"\" && string(httpKeyFile[0]) != \"/\" {\n\t\thttpKeyFile = fmt.Sprintf(\"%s/%s\", wd, httpKeyFile)\n\t}\n\n\tstakerCertFile := flags.StakingTLSCertFile\n\tif stakerCertFile != \"\" && string(stakerCertFile[0]) != \"/\" {\n\t\tstakerCertFile = fmt.Sprintf(\"%s/%s\", wd, stakerCertFile)\n\t}\n\n\tstakerKeyFile := flags.StakingTLSKeyFile\n\tif stakerKeyFile != \"\" && string(stakerKeyFile[0]) != \"/\" {\n\t\tstakerKeyFile = fmt.Sprintf(\"%s/%s\", wd, stakerKeyFile)\n\t}\n\tfmt.Println(stakerKeyFile, stakerCertFile)\n\n\targs := []string{\n\t\t\"--assertions-enabled=\" + strconv.FormatBool(flags.AssertionsEnabled),\n\t\t\"--version=\" + strconv.FormatBool(flags.Version),\n\t\t\"--tx-fee=\" + strconv.FormatUint(uint64(flags.TxFee), 10),\n\t\t\"--public-ip=\" + flags.PublicIP,\n\t\t\"--dynamic-update-duration=\" + flags.DynamicUpdateDuration,\n\t\t\"--dynamic-public-ip=\" + flags.DynamicPublicIP,\n\t\t\"--network-id=\" + flags.NetworkID,\n\t\t\"--signature-verification-enabled=\" + strconv.FormatBool(flags.SignatureVerificationEnabled),\n\t\t\"--api-admin-enabled=\" + strconv.FormatBool(flags.APIAdminEnabled),\n\t\t\"--api-ipcs-enabled=\" + strconv.FormatBool(flags.APIIPCsEnabled),\n\t\t\"--api-keystore-enabled=\" + strconv.FormatBool(flags.APIKeystoreEnabled),\n\t\t\"--api-metrics-enabled=\" + strconv.FormatBool(flags.APIMetricsEnabled),\n\t\t\"--http-host=\" + flags.HTTPHost,\n\t\t\"--http-port=\" + httpPortString,\n\t\t\"--http-tls-enabled=\" + strconv.FormatBool(flags.HTTPTLSEnabled),\n\t\t\"--http-tls-cert-file=\" + httpCertFile,\n\t\t\"--http-tls-key-file=\" + httpKeyFile,\n\t\t\"--bootstrap-ips=\" + flags.BootstrapIPs,\n\t\t\"--bootstrap-ids=\" + flags.BootstrapIDs,\n\t\t\"--bootstrap-beacon-connection-timeout=\" + flags.BootstrapBeaconConnectionTimeout,\n\t\t\"--db-dir=\" + flags.DBDir,\n\t\t\"--build-dir=\" + flags.BuildDir,\n\t\t\"--log-level=\" + flags.LogLevel,\n\t\t\"--log-dir=\" + flags.LogDir,\n\t\t\"--log-display-level=\" + flags.LogDisplayLevel,\n\t\t\"--log-display-highlight=\" + flags.LogDisplayHighlight,\n\t\t\"--snow-avalanche-batch-size=\" + strconv.Itoa(flags.SnowAvalancheBatchSize),\n\t\t\"--snow-avalanche-num-parents=\" + strconv.Itoa(flags.SnowAvalancheNumParents),\n\t\t\"--snow-sample-size=\" + strconv.Itoa(flags.SnowSampleSize),\n\t\t\"--snow-quorum-size=\" + strconv.Itoa(flags.SnowQuorumSize),\n\t\t\"--snow-virtuous-commit-threshold=\" + strconv.Itoa(flags.SnowVirtuousCommitThreshold),\n\t\t\"--snow-rogue-commit-threshold=\" + strconv.Itoa(flags.SnowRogueCommitThreshold),\n\t\t\"--snow-epoch-first-transition=\" + strconv.Itoa(flags.SnowEpochFirstTransition),\n\t\t\"--snow-epoch-duration=\" + flags.SnowEpochDuration,\n\t\t\"--min-delegator-stake=\" + strconv.Itoa(flags.MinDelegatorStake),\n\t\t\"--consensus-shutdown-timeout=\" + flags.ConsensusShutdownTimeout,\n\t\t\"--consensus-gossip-frequency=\" + flags.ConsensusGossipFrequency,\n\t\t\"--min-delegation-fee=\" + strconv.Itoa(flags.MinDelegationFee),\n\t\t\"--min-validator-stake=\" + strconv.Itoa(flags.MinValidatorStake),\n\t\t\"--max-stake-duration=\" + flags.MaxStakeDuration,\n\t\t\"--max-validator-stake=\" + strconv.Itoa(flags.MaxValidatorStake),\n\t\t\"--snow-concurrent-repolls=\" + strconv.Itoa(flags.SnowConcurrentRepolls),\n\t\t\"--stake-minting-period=\" + flags.StakeMintingPeriod,\n\t\t\"--network-initial-timeout=\" + flags.NetworkInitialTimeout,\n\t\t\"--network-minimum-timeout=\" + flags.NetworkMinimumTimeout,\n\t\t\"--network-maximum-timeout=\" + flags.NetworkMaximumTimeout,\n\t\tfmt.Sprintf(\"--network-health-max-send-fail-rate=%f\", flags.NetworkHealthMaxSendFailRateKey),\n\t\tfmt.Sprintf(\"--network-health-max-portion-send-queue-full=%f\", flags.NetworkHealthMaxPortionSendQueueFillKey),\n\t\t\"--network-health-max-time-since-msg-sent=\" + flags.NetworkHealthMaxTimeSinceMsgSentKey,\n\t\t\"--network-health-max-time-since-msg-received=\" + flags.NetworkHealthMaxTimeSinceMsgReceivedKey,\n\t\t\"--network-health-min-conn-peers=\" + strconv.Itoa(flags.NetworkHealthMinConnPeers),\n\t\t\"--network-timeout-coefficient=\" + strconv.Itoa(flags.NetworkTimeoutCoefficient),\n\t\t\"--network-timeout-halflife=\" + flags.NetworkTimeoutHalflife,\n\t\t\"--network-peer-list-gossip-frequency=\" + flags.NetworkPeerListGossipFrequency,\n\t\t\"--network-peer-list-gossip-size=\" + strconv.Itoa(flags.NetworkPeerListGossipSize),\n\t\t\"--network-peer-list-size=\" + strconv.Itoa(flags.NetworkPeerListSize),\n\t\t\"--staking-enabled=\" + strconv.FormatBool(flags.StakingEnabled),\n\t\t\"--staking-port=\" + stakingPortString,\n\t\t\"--staking-disabled-weight=\" + strconv.Itoa(flags.StakingDisabledWeight),\n\t\t\"--staking-tls-key-file=\" + stakerKeyFile,\n\t\t\"--staking-tls-cert-file=\" + stakerCertFile,\n\t\t\"--api-auth-required=\" + strconv.FormatBool(flags.APIAuthRequired),\n\t\t\"--api-auth-password-file=\" + flags.APIAuthPasswordFileKey,\n\t\t\"--min-stake-duration=\" + flags.MinStakeDuration,\n\t\t\"--whitelisted-subnets=\" + flags.WhitelistedSubnets,\n\t\t\"--api-health-enabled=\" + strconv.FormatBool(flags.APIHealthEnabled),\n\t\t\"--config-file=\" + flags.ConfigFile,\n\t\t\"--chain-config-dir=\" + flags.ChainConfigDir,\n\t\t\"--api-info-enabled=\" + strconv.FormatBool(flags.APIInfoEnabled),\n\t\t\"--ipcs-chain-ids=\" + flags.IPCSChainIDs,\n\t\t\"--ipcs-path=\" + flags.IPCSPath,\n\t\t\"--fd-limit=\" + strconv.Itoa(flags.FDLimit),\n\t\t\"--benchlist-duration=\" + flags.BenchlistDuration,\n\t\t\"--benchlist-fail-threshold=\" + strconv.Itoa(flags.BenchlistFailThreshold),\n\t\t\"--benchlist-min-failing-duration=\" + flags.BenchlistMinFailingDuration,\n\t\t\"--benchlist-peer-summary-enabled=\" + strconv.FormatBool(flags.BenchlistPeerSummaryEnabled),\n\t\tfmt.Sprintf(\"--uptime-requirement=%f\", flags.UptimeRequirement),\n\t\t\"--bootstrap-retry-enabled=\" + strconv.FormatBool(flags.RetryBootstrap),\n\t\t\"--health-check-averager-halflife=\" + flags.HealthCheckAveragerHalflifeKey,\n\t\t\"--health-check-frequency=\" + flags.HealthCheckFreqKey,\n\t\t\"--router-health-max-outstanding-requests=\" + strconv.Itoa(flags.RouterHealthMaxOutstandingRequestsKey),\n\t\tfmt.Sprintf(\"--router-health-max-drop-rate=%f\", flags.RouterHealthMaxDropRateKey),\n\t\t\"--index-enabled=\" + strconv.FormatBool(flags.IndexEnabled),\n\t\t\"--plugin-mode-enabled=\" + strconv.FormatBool(flags.PluginModeEnabled),\n\t}\n\targs = removeEmptyFlags(args)\n\n\treturn args\n}", "title": "" }, { "docid": "b54f56b94981a0ec246ce9267035ca29", "score": "0.5516079", "text": "func init() {\n\tflag.StringVar(&cb_systemKey, \"cb_systemKey\", \"\", \"ClearBlade System Key (required)\")\n\tflag.StringVar(&cb_systemSecret, \"cb_systemSecret\", \"\", \"ClearBlade System Secret (required)\")\n\tflag.StringVar(&cb_platformURL, \"cb_platformURL\", \"\", \"ClearBlade Platform URL)\")\n\tflag.StringVar(&cb_messagingURL, \"cb_messagingURL\", \"\", \"ClearBlade Messaging URL\")\n\tflag.StringVar(&cb_email, \"cb_email\", \"\", \"ClearBlade Email Credentials (required)\")\n\tflag.StringVar(&cb_password, \"cb_password\", \"\", \"cb_password (required)\")\n\n\tif(DEBUG){\n\t\tflag.StringVar(&vt_systemKey, \"vt_systemKey\", \"\", \"system key (required)\")\n\t\tflag.StringVar(&vt_systemSecret, \"vt_systemSecret\", \"\", \"system secret (required)\")\n\t\tflag.StringVar(&vt_platformURL, \"vt_platformURL\", \"\", \"platform url)\")\n\t}\n\n\tflag.StringVar(&vt_messagingURL, \"vt_messagingURL\", \"\", \"system key\")\n\tflag.StringVar(&vt_email, \"vt_email\", \"\", \"vt_email (required)\")\n\tflag.StringVar(&vt_password, \"vt_password\", \"\", \"vt_password (required)\")\n}", "title": "" }, { "docid": "4ba26ee02086f40cabf2e1ae393d7dc7", "score": "0.55139226", "text": "func Setup(name, version, commit ,envPrefix string, defaults map[string]interface{}) {\n\tlog.Printf(\"Starting %s in version: %s commit: %s\", name, version, commit )\n\tsetDefaults(defaults)\n\tlog.Println(\"Config path env variable \",envPrefix,\"_CONFIG_PATH:\", os.Getenv(envPrefix + \"_CONFIG_PATH\"))\n\tlog.Println(\"Config name env variable \",envPrefix,\"_CONFIG_NAME:\", os.Getenv(envPrefix + \"_CONFIG_NAME\"))\n\tviper.SetEnvPrefix(envPrefix)\n\tviper.BindEnv(\"configPath\", envPrefix + \"_CONFIG_PATH\")\n\tviper.BindEnv(\"configName\", envPrefix + \"_CONFIG_NAME\")\n\n\tlog.Println(\"Reading config from \", viper.GetString(\"configPath\"),\"/\",viper.GetString(\"configName\"))\n\tviper.SetConfigName(viper.GetString(\"configName\"))\n\tviper.AddConfigPath(viper.GetString(\"configPath\"))\n\n\terr := viper.ReadInConfig()\n\tif err != nil { // Handle errors reading the config file\n\t\tlog.Panic(\"Fatal error config file: %s \\n\", err)\n\t}\n\tviper.AutomaticEnv()\n\tviper.WatchConfig()\n\n\t//Initializing the validation framework\n\tvalid.SetFieldsRequiredByDefault(true)\n}", "title": "" }, { "docid": "5604d954b5033fb67a87d7ad3fa8532e", "score": "0.55114293", "text": "func prepareFlags() runtime.Config {\n mongoURI := flag.String(\"m\", \"localhost\", \"The Mongo URI to connect to MongoDB.\")\n dbName := flag.String(\"d\", \"wcie\", \"The DB name to use in MongoDB.\")\n apiKey := flag.String(\"k\", \"\", \"The twitter apikey to use for queries on Twitter.\")\n secret := flag.String(\"s\", \"\", \"The twitter secret use as a password on Twitter to identify this app.\")\n token := flag.String(\"t\", \"\", \"The access token to query Twitter.\")\n tokenSecret := flag.String(\"ts\", \"\", \"The access token secret to query Twitter.\")\n\n flag.Parse()\n\n // Mandatory parameters.\n if len(*apiKey) == 0 || len(*secret) == 0 || len(*token) == 0 || len(*tokenSecret) == 0 {\n fmt.Println(\"Bad usage: one or more missing flags. See :\")\n flag.PrintDefaults()\n os.Exit(1)\n }\n\n return runtime.Config{MongoURI: *mongoURI, DBName: *dbName, TwitterApiKey: *apiKey, TwitterSecret: *secret, TwitterAccessToken: *token, TwitterAccessTokenSecret: *tokenSecret}\n}", "title": "" }, { "docid": "9e752ab9d89dd7a5916fb74d7f32abe0", "score": "0.5511232", "text": "func setFlagsFromEnv() {\n\tif flags.identity.IP == \"\" {\n\t\tflags.identity.IP = os.Getenv(\"POD_IP\")\n\t}\n\tif flags.identity.Name == \"\" {\n\t\tflags.identity.Name = fmt.Sprintf(\"%s.%s\", os.Getenv(\"POD_NAME\"), os.Getenv(\"POD_NAMESPACE\"))\n\t}\n\n}", "title": "" }, { "docid": "5a9986aba29fcee21ddb14fe94754898", "score": "0.5491102", "text": "func registerFlags(c *cli.Config, f *flag.FlagSet) {\n\tf.StringVar(&c.CertFile, \"cert\", \"\", \"Client certificate that contains the public key\")\n\tf.StringVar(&c.KeyFile, \"key\", \"\", \"private key for the certificate\")\n\tf.StringVar(&c.CABundleFile, \"ca-bundle\", \"\", \"path to root certificate store\")\n\tf.StringVar(&c.IntBundleFile, \"int-bundle\", \"\", \"path to intermediate certificate store\")\n\tf.StringVar(&c.Flavor, \"flavor\", \"ubiquitous\", \"Bundle Flavor: ubiquitous, optimal and force.\")\n\tf.StringVar(&c.IntDir, \"int-dir\", \"\", \"specify intermediates directory\")\n\tf.StringVar(&c.Metadata, \"metadata\", \"\", \"Metadata file for root certificate presence. The content of the file is a json dictionary (k,v): each key k is SHA-1 digest of a root certificate while value v is a list of key store filenames.\")\n\tf.StringVar(&c.Domain, \"domain\", \"\", \"remote server domain name\")\n\tf.StringVar(&c.IP, \"ip\", \"\", \"remote server ip\")\n\tf.StringVar(&c.Password, \"password\", \"0\", \"Password for accessing PKCS #12 data passed to bundler\")\n}", "title": "" }, { "docid": "518dd782ff657c57025a0e463fb9ae4f", "score": "0.54897773", "text": "func bindFlagsLoadViper(cmd *cobra.Command, args []string) error {\n\t// cmd.Flags() includes flags from this command and all persistent flags from the parent\n\tif err := viper.BindPFlags(cmd.Flags()); err != nil {\n\t\treturn err\n\t}\n\n\thomeDir := viper.GetString(HomeFlag)\n\tviper.Set(HomeFlag, homeDir)\n\tviper.SetConfigName(\"config\") // name of config file (without extension)\n\tviper.AddConfigPath(homeDir) // search root directory\n\tviper.AddConfigPath(filepath.Join(homeDir, \"config\")) // search root directory /config\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err == nil {\n\t\t// stderr, so if we redirect output to json file, this doesn't appear\n\t\t// fmt.Fprintln(os.Stderr, \"Using config file:\", viper.ConfigFileUsed())\n\t} else if _, ok := err.(viper.ConfigFileNotFoundError); !ok {\n\t\t// ignore not found error, return other errors\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5b1298a48af2def7d5d4a85374ddace2", "score": "0.54839844", "text": "func init() {\n\tflag.StringVar(category, \"c\", tunelinux.All, categoryDescription)\n\tflag.StringVar(complianceStatus, \"st\", tunelinux.All, complianceDescription)\n\tflag.StringVar(severity, \"sev\", tunelinux.All, severityDescription)\n\tflag.BoolVar(versionFlag, \"v\", false, versionDescription)\n}", "title": "" }, { "docid": "9ddee44bf7295ebe68836650b73ebcec", "score": "0.5482653", "text": "func init() {\n\t// Bind flags to the dfsst command\n\tRootCmd.PersistentFlags().BoolP(\"verbose\", \"v\", false, \"print verbose messages\")\n\tRootCmd.PersistentFlags().String(\"ca\", \"ca.pem\", \"path to the root certificate\")\n\tRootCmd.PersistentFlags().String(\"cert\", \"cert.pem\", \"path to the ttp's certificate\")\n\tRootCmd.PersistentFlags().String(\"key\", \"key.pem\", \"path to the ttp's private key\")\n\tRootCmd.PersistentFlags().StringP(\"demo\", \"d\", \"\", \"demonstrator address and port, empty will disable it\")\n\n\tstartCmd.Flags().StringP(\"address\", \"a\", \"0.0.0.0\", \"address to bind for listening\")\n\tstartCmd.Flags().String(\"db\", \"mongodb://localhost/dfss\", \"server url in standard MongoDB format to access the database\")\n\tstartCmd.Flags().IntP(\"port\", \"p\", 9020, \"port to bind for listening\")\n\n\t// Store flag values into viper\n\t_ = viper.BindPFlag(\"verbose\", RootCmd.PersistentFlags().Lookup(\"verbose\"))\n\t_ = viper.BindPFlag(\"file_ca\", RootCmd.PersistentFlags().Lookup(\"ca\"))\n\t_ = viper.BindPFlag(\"file_cert\", RootCmd.PersistentFlags().Lookup(\"cert\"))\n\t_ = viper.BindPFlag(\"file_key\", RootCmd.PersistentFlags().Lookup(\"key\"))\n\t_ = viper.BindPFlag(\"demo\", RootCmd.PersistentFlags().Lookup(\"demo\"))\n\n\t_ = viper.BindPFlag(\"port\", startCmd.Flags().Lookup(\"port\"))\n\t_ = viper.BindPFlag(\"address\", startCmd.Flags().Lookup(\"address\"))\n\t_ = viper.BindPFlag(\"dbURI\", startCmd.Flags().Lookup(\"db\"))\n\n\tif err := viper.BindEnv(\"password\", \"DFSS_TTP_PASSWORD\"); err != nil {\n\t\tfmt.Println(\"Warning: The DFSS_TTP_PASSWORD environment variable is not set, assuming the private key is decrypted\")\n\t\tviper.Set(\"password\", \"\")\n\t}\n\n\t// Register Sub Commands\n\tRootCmd.AddCommand(dfss.VersionCmd, startCmd)\n\n}", "title": "" }, { "docid": "6094d1b4feadfbf526b0a9f2ca593c77", "score": "0.54731375", "text": "func init() {\n\tappEnv = os.Getenv(\"APP_ENV\")\n\tif appEnv == \"\" {\n\t\tappEnv = \"dev\"\n\t}\n\tflag.StringVar(&rootDir, \"d\", rootDir, \"app root dir\")\n\tflag.StringVar(&listenAddr, \"listen\", listenAddr, \"address to listen on\")\n\tflag.StringVar(&httpPrefix, \"prefix\", httpPrefix, \"URL path prefix to serve from\")\n\tflag.StringVar(&appEnv, \"env\", appEnv, \"app environment: dev, stage or prod\")\n\n\twrapHandler = logHandler\n}", "title": "" }, { "docid": "533c828c5b6bb318dcd3697b021740a7", "score": "0.54702085", "text": "func bindFlagsLoadViper(cmd *cobra.Command, args []string) error {\n\t// cmd.Flags() includes flags from this command and all persistent flags from the parent\n\tif err := viper.BindPFlags(cmd.Flags()); err != nil {\n\t\treturn err\n\t}\n\n\thomeDir := viper.GetString(HomeFlag)\n\tviper.Set(HomeFlag, homeDir)\n\tviper.SetConfigName(\"config\") // name of config file (without extension)\n\tviper.AddConfigPath(homeDir) // search root directory\n\tviper.AddConfigPath(filepath.Join(homeDir, ConfigDir)) // search root directory /config\n\n\t// Ensure Root\n\tconfig.RootDir = homeDir\n\tconfig.SetRoot(homeDir)\n\tcfg.EnsureRoot(homeDir)\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err == nil {\n\n\t\t// stderr, so if we redirect output to json file, this doesn't appear\n\t\t// fmt.Fprintln(os.Stderr, \"Using config file:\", viper.ConfigFileUsed())\n\t} else if _, ok := err.(viper.ConfigFileNotFoundError); !ok {\n\t\t// ignore not found error, return other errors\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af77b117869f1ca26596d9832e481df7", "score": "0.54636425", "text": "func defineFlags() {\n\tflag.String(logLevelFlag, \"info\", \"log level\")\n\tflag.String(listenAddressFlag, \":9090\", \"the address the productinfo app listens to HTTP requests.\")\n\tflag.Duration(prodInfRenewalIntervalFlag, 24*time.Hour, \"duration (in go syntax) between renewing the product information. Example: 2h30m\")\n\tflag.String(prometheusAddressFlag, \"\", \"http address of a Prometheus instance that has AWS spot \"+\n\t\t\"price metrics via banzaicloud/spot-price-exporter. If empty, the productinfo app will use current spot prices queried directly from the AWS API.\")\n\tflag.String(prometheusQueryFlag, \"avg_over_time(aws_spot_current_price{region=\\\"%s\\\", product_description=\\\"Linux/UNIX\\\"}[1w])\",\n\t\t\"advanced configuration: change the query used to query spot price info from Prometheus.\")\n\tflag.String(gceApiKeyFlag, \"\", \"GCE API key to use for getting SKUs\")\n\tflag.StringSlice(providerFlag, []string{Ec2, Gce, Azure, Oracle, Alibaba}, \"Providers that will be used with the productinfo application.\")\n\tflag.String(azureSubscriptionId, \"\", \"Azure subscription ID to use with the APIs\")\n\tflag.Bool(helpFlag, false, \"print usage\")\n\tflag.Bool(metricsEnabledFlag, false, \"internal metrics are exposed if enabled\")\n\tflag.String(metricsAddressFlag, \":9900\", \"the address where internal metrics are exposed\")\n\tflag.String(alibabaRegionId, \"\", \"alibaba region id\")\n\tflag.String(alibabaAccessKeyId, \"\", \"alibaba access key id\")\n\tflag.String(alibabaAccessKeySecret, \"\", \"alibaba access key secret\")\n}", "title": "" }, { "docid": "8a870fe0ced42dc2893ea2bad43b30c0", "score": "0.5442925", "text": "func (c *CLIConfig) AddFlag(_ *flag.FlagSet) {\n\tflag.BoolVar(&c.PrintVersion, \"V\", false, \"Show version and quit\")\n\tflag.BoolVar(&c.PrintVersion, \"version\", false, \"Show version and quit\")\n\tflag.IntVar(&c.Workers, \"workers\", c.Workers, \"The number of workers that are allowed to sync concurrently. Larger number = more responsive management, but more CPU (and network) load\")\n\tflag.BoolVar(&c.ClusterScoped, \"cluster-scoped\", c.ClusterScoped, \"Whether tidb-operator should manage kubernetes cluster wide TiDB Clusters\")\n\tflag.BoolVar(&c.ClusterPermissionNode, \"cluster-permission-node\", c.ClusterPermissionNode, \"Whether tidb-operator should have node permissions even if cluster-scoped is false\")\n\tflag.BoolVar(&c.ClusterPermissionPV, \"cluster-permission-pv\", c.ClusterPermissionPV, \"Whether tidb-operator should have persistent volume permissions even if cluster-scoped is false\")\n\tflag.BoolVar(&c.ClusterPermissionSC, \"cluster-permission-sc\", c.ClusterPermissionSC, \"Whether tidb-operator should have storage class permissions even if cluster-scoped is false\")\n\tflag.BoolVar(&c.AutoFailover, \"auto-failover\", c.AutoFailover, \"Auto failover\")\n\tflag.DurationVar(&c.PDFailoverPeriod, \"pd-failover-period\", c.PDFailoverPeriod, \"PD failover period default(5m)\")\n\tflag.DurationVar(&c.TiKVFailoverPeriod, \"tikv-failover-period\", c.TiKVFailoverPeriod, \"TiKV failover period default(5m)\")\n\tflag.DurationVar(&c.TiFlashFailoverPeriod, \"tiflash-failover-period\", c.TiFlashFailoverPeriod, \"TiFlash failover period default(5m)\")\n\tflag.DurationVar(&c.TiDBFailoverPeriod, \"tidb-failover-period\", c.TiDBFailoverPeriod, \"TiDB failover period\")\n\tflag.DurationVar(&c.MasterFailoverPeriod, \"dm-master-failover-period\", c.MasterFailoverPeriod, \"dm-master failover period\")\n\tflag.DurationVar(&c.WorkerFailoverPeriod, \"dm-worker-failover-period\", c.WorkerFailoverPeriod, \"dm-worker failover period\")\n\tflag.DurationVar(&c.PodHardRecoveryPeriod, \"pod-hard-recovery-period\", c.PodHardRecoveryPeriod, \"Hard recovery period for a failure pod default(24h)\")\n\tflag.BoolVar(&c.DetectNodeFailure, \"detect-node-failure\", c.DetectNodeFailure, \"Automatically detect node failures\")\n\tflag.DurationVar(&c.ResyncDuration, \"resync-duration\", c.ResyncDuration, \"Resync time of informer\")\n\tflag.BoolVar(&c.TestMode, \"test-mode\", false, \"whether tidb-operator run in test mode\")\n\tflag.StringVar(&c.TiDBBackupManagerImage, \"tidb-backup-manager-image\", c.TiDBBackupManagerImage, \"The image of backup manager tool\")\n\t// TODO: actually we just want to use the same image with tidb-controller-manager, but DownwardAPI cannot get image ID, see if there is any better solution\n\tflag.StringVar(&c.TiDBDiscoveryImage, \"tidb-discovery-image\", c.TiDBDiscoveryImage, \"The image of the tidb discovery service\")\n\tflag.StringVar(&c.Selector, \"selector\", c.Selector, \"Selector (label query) to filter on, supports '=', '==', and '!='\")\n\n\t// see https://pkg.go.dev/k8s.io/client-go/tools/leaderelection#LeaderElectionConfig for the config\n\tflag.DurationVar(&c.LeaseDuration, \"leader-lease-duration\", c.LeaseDuration, \"leader-lease-duration is the duration that non-leader candidates will wait to force acquire leadership\")\n\tflag.DurationVar(&c.RenewDeadline, \"leader-renew-deadline\", c.RenewDeadline, \"leader-renew-deadline is the duration that the acting master will retry refreshing leadership before giving up\")\n\tflag.DurationVar(&c.RetryPeriod, \"leader-retry-period\", c.RetryPeriod, \"leader-retry-period is the duration the LeaderElector clients should wait between tries of actions\")\n\tflag.Float64Var(&c.KubeClientQPS, \"kube-client-qps\", c.KubeClientQPS, \"The maximum QPS to the kubenetes API server from client\")\n\tflag.IntVar(&c.KubeClientBurst, \"kube-client-burst\", c.KubeClientBurst, \"The maximum burst for throttle to the kubenetes API server from client\")\n}", "title": "" }, { "docid": "91eb815363e85672beb817f72554c825", "score": "0.54330915", "text": "func SetupFlags() {\n\tflag.Float64Var(&defaultConfig.Size, \"bot-size\", defaultConfig.Size, \"Size (mm) of the bot, it's square.\")\n\tflag.Float64Var(&defaultConfig.DriveSpeedMax, \"drive-speed-max\", defaultConfig.DriveSpeedMax, \"Maximum drive speed (mm/s).\")\n\tflag.Float64Var(&defaultConfig.TurnSpeedMax, \"turn-speed-max\", defaultConfig.TurnSpeedMax, \"Maximum turn speed (degrees/s), 0 means unlimited.\")\n}", "title": "" }, { "docid": "54aeb87af5558d0c1547d5b6c27dd0ed", "score": "0.54258925", "text": "func initFlags() {\n\tapp.Flags = []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"subject, s\",\n\t\t\tValue: \"\",\n\t\t\tUsage: \"`SUBJECT` for the SMS, defaults to none\",\n\t\t\tDestination: &subject,\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"verbose\",\n\t\t\tUsage: \"verbose output\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "13f471974039cee8851ed4b8da3920b8", "score": "0.5425215", "text": "func init() {\n\tflag.CommandLine.BoolVar(&verbose, \"v\", false, \"Set verbose output\")\n}", "title": "" }, { "docid": "491f26f6ebb9e32c18bda68b6602ed6e", "score": "0.54218185", "text": "func flagSet(name string, cfg *CmdConfig) *flag.FlagSet {\n\tflags := flag.NewFlagSet(name, flag.ExitOnError)\n\tflags.StringVar(\n\t\t&cfg.ConfigPath,\n\t\t\"config-path\",\n\t\tsetFromEnvStr(\"CONFIG_PATH\", \"/repo\"),\n\t\t\"Configuration root directory. Should include the '.porter' or 'environment' directory. \"+\n\t\t\t\"Kubernetes object yaml files may be in the directory or in a subdirectory named 'k8s'.\",\n\t)\n\tflags.StringVar(&cfg.ConfigType, \"config-type\", setFromEnvStr(\"CONFIG_TYPE\", \"porter\"), \"Configuration type, \"+\n\t\t\"simple or porter.\")\n\tflags.StringVar(&cfg.Environment, \"environment\", setFromEnvStr(\"ENVIRONMENT\", \"\"), \"Environment of deployment.\")\n\tflags.IntVar(&cfg.MaxConfigMaps, \"max-cm\", setFromEnvInt(\"MAX_CM\", 5), \"Maximum number of configmaps and secret \"+\n\t\t\"objects to keep per app.\")\n\tflags.StringVar(&cfg.Namespace, \"namespace\", setFromEnvStr(\"NAMESPACE\", \"default\"), \"Kubernetes namespace.\")\n\tflags.StringVar(&cfg.Regions, \"regions\", setFromEnvStr(\"REGIONS\", \"\"), \"Regions\"+\n\t\t\"of deployment. (Multiple Space delimited regions allowed)\")\n\tflags.StringVar(&cfg.SHA, \"sha\", setFromEnvStr(\"sha\", \"\"), \"Deployment sha.\")\n\tflags.StringVar(&cfg.VaultAddress, \"vault-addr\", setFromEnvStr(\"VAULT_ADDR\", \"https://vault.loc.adobe.net\"),\n\t\t\"Vault server.\")\n\tflags.StringVar(&cfg.VaultBasePath, \"vault-path\", setFromEnvStr(\"VAULT_PATH\", \"/\"), \"Path in Vault.\")\n\tflags.StringVar(&cfg.VaultToken, \"vault-token\", setFromEnvStr(\"VAULT_TOKEN\", \"\"), \"Vault token.\")\n\tflags.StringVar(&cfg.VaultNamespace, \"vault-namespace\", setFromEnvStr(\"VAULT_NAMESPACE\", \"\"), \"Vault namespace.\")\n\tflags.StringVar(&cfg.SecretPathWhiteList, \"secret-path-whitelist\", setFromEnvStr(\"SECRET_PATH_WHITELIST\", \"\"), \"\"+\n\t\t\"Multiple Space delimited secret path whitelist allowed\")\n\tflags.BoolVar(&cfg.Verbose, \"v\", setFromEnvBool(\"VERBOSE\"), \"Verbose log output.\")\n\tflags.IntVar(&cfg.Wait, \"wait\", setFromEnvInt(\"WAIT\", 180), \"Extra time to wait for deployment to complete in \"+\n\t\t\"seconds.\")\n\tflags.StringVar(&cfg.LogMode, \"log-mode\", setFromEnvStr(\"LOG_MODE\", \"inline\"), \"Pod log streaming mode. \"+\n\t\t\"One of 'inline' (print to STDOUT), 'single' (single region to stdout), \"+\n\t\t\"'file' (write to filesystem, see log-dir option), 'none' (disable log streaming)\")\n\tflags.StringVar(&cfg.LogDir, \"log-dir\", setFromEnvStr(\"LOG_DIR\", \"logs\"),\n\t\t\"Directory to write pod logs into. (must already exist)\")\n\tflags.BoolVar(&cfg.DynamicParallel, \"dynamic-parallel\", setFromEnvBool(\"DYNAMIC_PARALLEL\"),\n\t\t\"Update Dynamic Objects in parallel.\")\n\n\treturn flags\n}", "title": "" }, { "docid": "6be2b2b5e6e158d1a73a0a691322b9ad", "score": "0.54145736", "text": "func init() {\n\n\t// Allow for more dynamic setting of settings namespace\n\t// Based on article https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#the-downward-api\n\tdefaultNamespace := os.Getenv(PodNamespace)\n\tif defaultNamespace == \"\" {\n\t\tdefaultNamespace = defaults.GlooSystem\n\t}\n\tflag.StringVar(&setupNamespace, \"namespace\", defaultNamespace, \"namespace to watch for settings crd/file\")\n\tflag.StringVar(&setupName, \"name\", defaults.SettingsName, \"name of settings crd/file to use\")\n\tflag.StringVar(&setupDir, \"dir\", \"\",\n\t\t\"directory to find bootstrap settings if not using kubernetes crds\")\n}", "title": "" }, { "docid": "710b360ec0906da6476fc663857ba919", "score": "0.5414388", "text": "func setup(ctx *cli.Context) (err error) {\n\tsetting.Debug = ctx.GlobalBool(\"debug\")\n\tlog.NonColor = ctx.GlobalBool(\"noterm\")\n\tlog.Verbose = ctx.Bool(\"verbose\")\n\n\tlog.Info(\"App Version: %s\", ctx.App.Version)\n\n\tsetting.HomeDir, err = base.HomeDir()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Fail to get home directory: %v\", err)\n\t}\n\tsetting.HomeDir = strings.Replace(setting.HomeDir, \"\\\\\", \"/\", -1)\n\n\tsetting.InstallRepoPath = path.Join(setting.HomeDir, \".gopm/repos\")\n\tif runtime.GOOS == \"windows\" {\n\t\tsetting.IsWindows = true\n\t}\n\tos.MkdirAll(setting.InstallRepoPath, os.ModePerm)\n\tlog.Info(\"Local repository path: %s\", setting.InstallRepoPath)\n\n\tif !setting.LibraryMode || len(setting.WorkDir) == 0 {\n\t\tsetting.WorkDir, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Fail to get work directory: %v\", err)\n\t\t}\n\t\tsetting.WorkDir = strings.Replace(setting.WorkDir, \"\\\\\", \"/\", -1)\n\t}\n\tsetting.DefaultGopmfile = path.Join(setting.WorkDir, setting.GOPMFILE)\n\tsetting.DefaultVendor = path.Join(setting.WorkDir, setting.VENDOR)\n\tsetting.DefaultVendorSrc = path.Join(setting.DefaultVendor, \"src\")\n\n\tif !ctx.Bool(\"remote\") {\n\t\tif ctx.Bool(\"local\") {\n\t\t\t// gf, _, _, err := genGopmfile(ctx)\n\t\t\t// if err != nil {\n\t\t\t// \treturn err\n\t\t\t// }\n\t\t\t// setting.InstallGopath = gf.MustValue(\"project\", \"local_gopath\")\n\t\t\t// if ctx.Command.Name != \"gen\" {\n\t\t\t// \tif com.IsDir(setting.InstallGopath) {\n\t\t\t// \t\tlog.Log(\"Indicated local GOPATH: %s\", setting.InstallGopath)\n\t\t\t// \t\tsetting.InstallGopath += \"/src\"\n\t\t\t// \t} else {\n\t\t\t// \t\tif setting.LibraryMode {\n\t\t\t// \t\t\treturn fmt.Errorf(\"Local GOPATH does not exist or is not a directory: %s\",\n\t\t\t// \t\t\t\tsetting.InstallGopath)\n\t\t\t// \t\t}\n\t\t\t// \t\tlog.Error(\"\", \"Invalid local GOPATH path\")\n\t\t\t// \t\tlog.Error(\"\", \"Local GOPATH does not exist or is not a directory:\")\n\t\t\t// \t\tlog.Error(\"\", \"\\t\"+setting.InstallGopath)\n\t\t\t// \t\tlog.Help(\"Try 'go help gopath' to get more information\")\n\t\t\t// \t}\n\t\t\t// }\n\n\t\t} else {\n\t\t\t// Get GOPATH.\n\t\t\tsetting.InstallGopath = base.GetGOPATHs()[0]\n\t\t\tif base.IsDir(setting.InstallGopath) {\n\t\t\t\tlog.Info(\"Indicated GOPATH: %s\", setting.InstallGopath)\n\t\t\t\tsetting.InstallGopath += \"/src\"\n\t\t\t\tsetting.HasGOPATHSetting = true\n\t\t\t} else {\n\t\t\t\tif ctx.Bool(\"gopath\") {\n\t\t\t\t\treturn fmt.Errorf(\"Local GOPATH does not exist or is not a directory: %s\",\n\t\t\t\t\t\tsetting.InstallGopath)\n\t\t\t\t} else {\n\t\t\t\t\t// It's OK that no GOPATH setting\n\t\t\t\t\t// when user does not specify to use.\n\t\t\t\t\tlog.Warn(\"No GOPATH setting available\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsetting.ConfigFile = path.Join(setting.HomeDir, \".gopm/data/gopm.ini\")\n\tif err = setting.LoadConfig(); err != nil {\n\t\treturn err\n\t}\n\n\tsetting.PkgNameListFile = path.Join(setting.HomeDir, \".gopm/data/pkgname.list\")\n\tif err = setting.LoadPkgNameList(); err != nil {\n\t\treturn err\n\t}\n\n\tsetting.LocalNodesFile = path.Join(setting.HomeDir, \".gopm/data/localnodes.list\")\n\tif err = setting.LoadLocalNodes(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "567b5c7e0e5c74f9fb7450c4c3a1e478", "score": "0.54123855", "text": "func init() {\n\tlog.Println(\"Starting wwwgo ...\")\n\tflag.StringVar(&flags.envFile, \"env-file\", \"\", \"Source environment variable from a file\")\n\tflag.Parse()\n\tif flags.envFile != \"\" {\n\t\tlog.Println(\"Use .env file\")\n\t\tif err := godotenv.Load(flags.envFile); err != nil {\n\t\t\tlog.Fatal(\"Unable to load .env file: \" + err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a302048b5541e49af42f9bddb3e0313a", "score": "0.54118216", "text": "func (ac *Config) handleFlags(serverTempDir string) {\n\tvar (\n\t\t// The short version of some flags\n\t\tserveJustHTTPShort, autoRefreshShort, productionModeShort,\n\t\tdebugModeShort, serverModeShort, useBoltShort, devModeShort,\n\t\tshowVersionShort, quietModeShort, cacheFileStatShort, simpleModeShort,\n\t\tnoBannerShort, quitAfterFirstRequestShort, verboseModeShort,\n\t\tserveJustQUICShort, onlyLuaModeShort, redirectShort bool\n\t\t// Used when setting the cache mode\n\t\tcacheModeString string\n\t\t// Used if disabling cache compression\n\t\trawCache bool\n\t\t// Used if disabling the database backend\n\t\tnoDatabase bool\n\t)\n\n\t// The usage function that provides more help (for --help or -h)\n\tflag.Usage = generateUsageFunction(ac)\n\n\t// The default for running the redis server on Windows is to listen\n\t// to \"localhost:port\", but not just \":port\".\n\thost := \"\"\n\tif runtime.GOOS == \"windows\" {\n\t\thost = \"localhost\"\n\t\t// Default Bolt database file\n\t\tac.defaultBoltFilename = filepath.Join(serverTempDir, \"algernon.db\")\n\t\t// Default log file\n\t\tac.defaultLogFile = filepath.Join(serverTempDir, \"algernon.log\")\n\t}\n\n\t// Commandline flag configuration\n\n\tflag.StringVar(&ac.serverDirOrFilename, \"dir\", \".\", \"Server directory\")\n\tflag.StringVar(&ac.serverAddr, \"addr\", \"\", \"Server [host][:port] (ie \\\":443\\\")\")\n\tflag.StringVar(&ac.serverCert, \"cert\", \"cert.pem\", \"Server certificate\")\n\tflag.StringVar(&ac.serverKey, \"key\", \"key.pem\", \"Server key\")\n\tflag.StringVar(&ac.redisAddr, \"redis\", \"\", \"Redis [host][:port] (ie \\\"\"+ac.defaultRedisColonPort+\"\\\")\")\n\tflag.IntVar(&ac.redisDBindex, \"dbindex\", 0, \"Redis database index\")\n\tflag.StringVar(&ac.serverConfScript, \"conf\", \"serverconf.lua\", \"Server configuration written in Lua\")\n\tflag.StringVar(&ac.serverLogFile, \"log\", \"\", \"Server log file\")\n\tflag.StringVar(&ac.internalLogFilename, \"internal\", os.DevNull, \"Internal log file\")\n\tflag.BoolVar(&ac.serveJustHTTP2, \"http2only\", false, \"Serve HTTP/2, not HTTPS + HTTP/2\")\n\tflag.BoolVar(&ac.serveJustHTTP, \"httponly\", false, \"Serve plain old HTTP\")\n\tflag.BoolVar(&ac.productionMode, \"prod\", false, \"Production mode (when running as a system service)\")\n\tflag.BoolVar(&ac.debugMode, \"debug\", false, \"Debug mode\")\n\tflag.BoolVar(&ac.verboseMode, \"verbose\", false, \"Verbose logging\")\n\tflag.BoolVar(&ac.redirectHTTP, \"redirect\", false, \"Redirect HTTP traffic to HTTPS if both are enabled\")\n\tflag.BoolVar(&ac.autoRefresh, \"autorefresh\", false, \"Enable the auto-refresh feature\")\n\tflag.StringVar(&ac.autoRefreshDir, \"watchdir\", \"\", \"Directory to watch (also enables auto-refresh)\")\n\tflag.StringVar(&ac.eventAddr, \"eventserver\", \"\", \"SSE [host][:port] (ie \\\"\"+ac.defaultEventColonPort+\"\\\")\")\n\tflag.StringVar(&ac.eventRefresh, \"eventrefresh\", ac.defaultEventRefresh, \"Event refresh interval (ie \\\"\"+ac.defaultEventRefresh+\"\\\")\")\n\tflag.BoolVar(&ac.serverMode, \"server\", false, \"Server mode (disable interactive mode)\")\n\tflag.StringVar(&ac.mariadbDSN, \"maria\", \"\", \"MariaDB/MySQL connection string (DSN)\")\n\tflag.StringVar(&ac.mariaDatabase, \"mariadb\", \"\", \"MariaDB/MySQL database name\")\n\tflag.StringVar(&ac.postgresDSN, \"postgres\", \"\", \"PostgreSQL connection string (DSN)\")\n\tflag.StringVar(&ac.postgresDatabase, \"postgresdb\", \"\", \"PostgreSQL database name\")\n\tflag.BoolVar(&ac.useBolt, \"bolt\", false, \"Use the default Bolt filename\")\n\tflag.StringVar(&ac.boltFilename, \"boltdb\", \"\", \"Bolt database filename\")\n\tflag.Int64Var(&ac.limitRequests, \"limit\", ac.defaultLimit, \"Limit clients to a number of requests per second\")\n\tflag.BoolVar(&ac.disableRateLimiting, \"nolimit\", false, \"Disable rate limiting\")\n\tflag.BoolVar(&ac.devMode, \"dev\", false, \"Development mode\")\n\tflag.BoolVar(&ac.showVersion, \"version\", false, \"Version\")\n\tflag.StringVar(&cacheModeString, \"cache\", \"\", \"Cache everything but Amber, Lua, GCSS and Markdown\")\n\tflag.Uint64Var(&ac.cacheSize, \"cachesize\", ac.defaultCacheSize, \"Cache size, in bytes\")\n\tflag.Uint64Var(&ac.largeFileSize, \"largesize\", ac.defaultLargeFileSize, \"Threshold for not reading static files into memory, in bytes\")\n\tflag.Uint64Var(&ac.writeTimeout, \"timeout\", 10, \"Timeout when writing to a client, in seconds\")\n\tflag.BoolVar(&ac.quietMode, \"quiet\", false, \"Quiet\")\n\tflag.BoolVar(&rawCache, \"rawcache\", false, \"Disable cache compression\")\n\tflag.StringVar(&ac.serverHeaderName, \"servername\", ac.versionString, \"Server header name\")\n\tflag.BoolVar(&ac.cacheFileStat, \"statcache\", false, \"Cache os.Stat\")\n\tflag.BoolVar(&ac.serverAddDomain, \"domain\", false, \"Look for files in the directory named the same as the hostname\")\n\tflag.BoolVar(&ac.simpleMode, \"simple\", false, \"Serve a directory of files over HTTP\")\n\tflag.StringVar(&ac.openExecutable, \"open\", \"\", \"Open URL after serving, with an application\")\n\tflag.BoolVar(&ac.quitAfterFirstRequest, \"quit\", false, \"Quit after the first request\")\n\tflag.BoolVar(&ac.noCache, \"nocache\", false, \"Disable caching\")\n\tflag.BoolVar(&ac.noHeaders, \"noheaders\", false, \"Don't set any HTTP headers by default\")\n\tflag.BoolVar(&ac.stricterHeaders, \"stricter\", false, \"Stricter HTTP headers\")\n\tflag.StringVar(&ac.defaultTheme, \"theme\", themes.DefaultTheme, \"Theme for Markdown and directory listings\")\n\tflag.BoolVar(&ac.noBanner, \"nobanner\", false, \"Don't show a banner at start\")\n\tflag.BoolVar(&ac.ctrldTwice, \"ctrld\", false, \"Press ctrl-d twice to exit\")\n\tif quicEnabled {\n\t\tflag.BoolVar(&ac.serveJustQUIC, \"quic\", false, \"Serve just QUIC\")\n\t}\n\tflag.BoolVar(&noDatabase, \"nodb\", false, \"No database backend\")\n\tflag.BoolVar(&ac.onlyLuaMode, \"lua\", false, \"Only present the Lua REPL\")\n\tflag.StringVar(&ac.combinedAccessLogFilename, \"accesslog\", \"\", \"Combined access log filename\")\n\tflag.StringVar(&ac.commonAccessLogFilename, \"ncsa\", \"\", \"NCSA access log filename\")\n\tflag.BoolVar(&ac.clearDefaultPathPrefixes, \"clear\", false, \"Clear the default URI prefixes for handling permissions\")\n\tflag.StringVar(&ac.cookieSecret, \"cookiesecret\", \"\", \"Secret to be used when setting and getting login cookies\")\n\tflag.BoolVar(&ac.useCertMagic, \"letsencrypt\", false, \"Use Let's Encrypt for all served domains and serve regular HTTPS\")\n\tflag.StringVar(&ac.dirBaseURL, \"dirbaseurl\", \"\", \"Base URL for the directory listing (optional)\")\n\n\t// The short versions of some flags\n\tflag.BoolVar(&serveJustHTTPShort, \"t\", false, \"Serve plain old HTTP\")\n\tflag.BoolVar(&autoRefreshShort, \"a\", false, \"Enable the auto-refresh feature\")\n\tflag.BoolVar(&serverModeShort, \"s\", false, \"Server mode (non-interactive)\")\n\tflag.BoolVar(&useBoltShort, \"b\", false, \"Use the default Bolt filename\")\n\tflag.BoolVar(&productionModeShort, \"p\", false, \"Production mode (when running as a system service)\")\n\tflag.BoolVar(&debugModeShort, \"d\", false, \"Debug mode\")\n\tflag.BoolVar(&devModeShort, \"e\", false, \"Development mode\")\n\tflag.BoolVar(&showVersionShort, \"v\", false, \"Version\")\n\tflag.BoolVar(&verboseModeShort, \"V\", false, \"Verbose\")\n\tflag.BoolVar(&quietModeShort, \"q\", false, \"Quiet\")\n\tflag.BoolVar(&cacheFileStatShort, \"c\", false, \"Cache os.Stat\")\n\tflag.BoolVar(&simpleModeShort, \"x\", false, \"Simple mode\")\n\tflag.BoolVar(&ac.openURLAfterServing, \"o\", false, \"Open URL after serving\")\n\tflag.BoolVar(&quitAfterFirstRequestShort, \"z\", false, \"Quit after the first request\")\n\tflag.BoolVar(&ac.markdownMode, \"m\", false, \"Markdown mode\")\n\tflag.BoolVar(&noBannerShort, \"n\", false, \"Don't show a banner at start\")\n\tif quicEnabled {\n\t\tflag.BoolVar(&serveJustQUICShort, \"u\", false, \"Serve just QUIC\")\n\t}\n\tflag.BoolVar(&onlyLuaModeShort, \"l\", false, \"Only present the Lua REPL\")\n\tflag.BoolVar(&redirectShort, \"r\", false, \"Redirect HTTP traffic to HTTPS, if both are enabled\")\n\n\tflag.Parse()\n\n\t// Accept both long and short versions of some flags\n\tac.serveJustHTTP = ac.serveJustHTTP || serveJustHTTPShort\n\tac.autoRefresh = ac.autoRefresh || autoRefreshShort\n\tac.debugMode = ac.debugMode || debugModeShort\n\tac.serverMode = ac.serverMode || serverModeShort\n\tac.useBolt = ac.useBolt || useBoltShort\n\tac.productionMode = ac.productionMode || productionModeShort\n\tac.devMode = ac.devMode || devModeShort\n\tac.showVersion = ac.showVersion || showVersionShort\n\tac.quietMode = ac.quietMode || quietModeShort\n\tac.cacheFileStat = ac.cacheFileStat || cacheFileStatShort\n\tac.simpleMode = ac.simpleMode || simpleModeShort\n\tac.openURLAfterServing = ac.openURLAfterServing || (ac.openExecutable != \"\")\n\tac.quitAfterFirstRequest = ac.quitAfterFirstRequest || quitAfterFirstRequestShort\n\tac.verboseMode = ac.verboseMode || verboseModeShort\n\tac.noBanner = ac.noBanner || noBannerShort\n\tif quicEnabled {\n\t\tac.serveJustQUIC = ac.serveJustQUIC || serveJustQUICShort\n\t}\n\tac.onlyLuaMode = ac.onlyLuaMode || onlyLuaModeShort\n\tac.redirectHTTP = ac.redirectHTTP || redirectShort\n\n\t// Serve a single Markdown file once, and open it in the browser\n\tif ac.markdownMode {\n\t\tac.quietMode = true\n\t\tac.openURLAfterServing = true\n\t\tac.quitAfterFirstRequest = true\n\t}\n\n\t// If only using the Lua REPL, don't include the banner, and don't serve anything\n\tif ac.onlyLuaMode {\n\t\tac.noBanner = true\n\t\tac.debugMode = true\n\t\tac.serverConfScript = \"\"\n\t}\n\n\t// Check if IGNOREEOF is set\n\tif ignoreEOF := env.Int(\"IGNOREEOF\", 0); ignoreEOF > 1 {\n\t\tac.ctrldTwice = true\n\t}\n\n\t// Disable verbose mode if quiet mode has been enabled\n\tif ac.quietMode {\n\t\tac.verboseMode = false\n\t}\n\n\t// Enable cache compression unless raw cache is specified\n\tac.cacheCompression = !rawCache\n\n\tac.redisAddrSpecified = ac.redisAddr != \"\"\n\tif ac.redisAddr == \"\" {\n\t\t// The default host and port\n\t\tac.redisAddr = host + ac.defaultRedisColonPort\n\t}\n\n\t// May be overridden by devMode\n\tif ac.serverMode {\n\t\tac.debugMode = false\n\t}\n\n\tif noDatabase {\n\t\tac.boltFilename = os.DevNull\n\t}\n\n\t// TODO: If flags are set in addition to -p or -e, don't override those\n\t// when -p or -e is set.\n\n\t// Change several defaults if production mode is enabled\n\tswitch {\n\tcase ac.productionMode:\n\t\t// Use system directories\n\t\tac.serverDirOrFilename = \"/srv/algernon\"\n\t\tac.serverCert = \"/etc/algernon/cert.pem\"\n\t\tac.serverKey = \"/etc/algernon/key.pem\"\n\t\tac.cacheMode = cachemode.Production\n\t\tac.serverMode = true\n\tcase ac.devMode:\n\t\t// Change several defaults if development mode is enabled\n\t\tac.serveJustHTTP = true\n\t\t// serverLogFile = defaultLogFile\n\t\tac.debugMode = true\n\t\t// TODO: Make it possible to set --limit to the default limit also when -e is used\n\t\tif ac.limitRequests == ac.defaultLimit {\n\t\t\tac.limitRequests = 700 // Increase the rate limit considerably\n\t\t}\n\t\tac.cacheMode = cachemode.Development\n\tcase ac.simpleMode:\n\t\tac.useBolt = true\n\t\tac.boltFilename = os.DevNull\n\t\tac.serveJustHTTP = true\n\t\tac.serverMode = true\n\t\tac.cacheMode = cachemode.Off\n\t\tac.noCache = true\n\t\tac.disableRateLimiting = true\n\t\tac.clearDefaultPathPrefixes = true\n\t\tac.noHeaders = true\n\t\tac.writeTimeout = 3600 * 24\n\t}\n\n\tif ac.onlyLuaMode {\n\t\t// Use a random database, so that several lua REPLs can be started without colliding,\n\t\t// but only if the current default bolt database file can not be opened.\n\t\tif ac.boltFilename != os.DevNull && !files.CanRead(ac.boltFilename) {\n\t\t\ttempFile, err := os.CreateTemp(\"\", \"algernon_repl*.db\")\n\t\t\tif err == nil { // no issue\n\t\t\t\tac.boltFilename = tempFile.Name()\n\t\t\t}\n\t\t}\n\t}\n\n\t// If a watch directory is given, enable the auto refresh feature\n\tif ac.autoRefreshDir != \"\" {\n\t\tac.autoRefresh = true\n\t}\n\n\t// If nocache is given, disable the cache\n\tif ac.noCache {\n\t\tac.cacheMode = cachemode.Off\n\t\tac.cacheFileStat = false\n\t}\n\n\t// Convert the request limit to a string\n\tac.limitRequestsString = strconv.FormatInt(ac.limitRequests, 10)\n\n\t// If auto-refresh is enabled, change the caching\n\tif ac.autoRefresh {\n\t\tif cacheModeString == \"\" {\n\t\t\t// Disable caching by default, when auto-refresh is enabled\n\t\t\tac.cacheMode = cachemode.Off\n\t\t\tac.cacheFileStat = false\n\t\t}\n\t}\n\n\t// The cache flag overrides the settings from the other modes\n\tif cacheModeString != \"\" {\n\t\tac.cacheMode = cachemode.New(cacheModeString)\n\t}\n\n\t// Disable cache entirely if cacheSize is set to 0\n\tif ac.cacheSize == 0 {\n\t\tac.cacheMode = cachemode.Off\n\t}\n\n\t// Set cacheSize to 0 if the cache is disabled\n\tif ac.cacheMode == cachemode.Off {\n\t\tac.cacheSize = 0\n\t}\n\n\t// If cache mode is unset, use the dev mode\n\tif ac.cacheMode == cachemode.Unset {\n\t\tac.cacheMode = cachemode.Default\n\t}\n\n\tif ac.cacheMode == cachemode.Small {\n\t\tac.cacheMaxEntitySize = ac.defaultCacheMaxEntitySize\n\t}\n\n\t// For backward compatibility with previous versions of Algernon\n\t// TODO: Remove, in favor of a better config/flag system\n\tserverAddrChanged := false\n\tif len(flag.Args()) >= 1 {\n\t\t// Only override the default server directory if Algernon can find it\n\t\tfirstArg := flag.Args()[0]\n\t\tfs := datablock.NewFileStat(ac.cacheFileStat, ac.defaultStatCacheRefresh)\n\t\t// Interpret as a file or directory\n\t\tif fs.IsDir(firstArg) || fs.Exists(firstArg) {\n\t\t\tif strings.HasSuffix(firstArg, string(os.PathSeparator)) {\n\t\t\t\tac.serverDirOrFilename = firstArg[:len(firstArg)-1]\n\t\t\t} else {\n\t\t\t\tac.serverDirOrFilename = firstArg\n\t\t\t}\n\t\t} else if strings.Contains(firstArg, \":\") {\n\t\t\t// Interpret as the server address\n\t\t\tac.serverAddr = firstArg\n\t\t\tserverAddrChanged = true\n\t\t} else if _, err := strconv.Atoi(firstArg); err == nil { // no error\n\t\t\t// Is a number. Interpret as the server address\n\t\t\tac.serverAddr = \":\" + firstArg\n\t\t\tserverAddrChanged = true\n\t\t}\n\t}\n\n\t// Clean up path in ac.serverDirOrFilename\n\t// .Rel calls .Clean on the result.\n\tif pwd, err := os.Getwd(); err == nil { // no error\n\t\tif cleanPath, err := filepath.Rel(pwd, ac.serverDirOrFilename); err == nil { // no error\n\t\t\tac.serverDirOrFilename = cleanPath\n\t\t}\n\t}\n\n\t// TODO: Replace the code below with a good config/flag package.\n\tshift := 0\n\tif serverAddrChanged {\n\t\tshift = 1\n\t}\n\tif len(flag.Args()) >= 2 {\n\t\tsecondArg := flag.Args()[1]\n\t\tif strings.Contains(secondArg, \":\") {\n\t\t\tac.serverAddr = secondArg\n\t\t} else if _, err := strconv.Atoi(secondArg); err == nil { // no error\n\t\t\t// Is a number. Interpret as the server address.\n\t\t\tac.serverAddr = \":\" + secondArg\n\t\t} else if len(flag.Args()) >= 3-shift {\n\t\t\tac.serverCert = flag.Args()[2-shift]\n\t\t}\n\t}\n\tif len(flag.Args()) >= 4-shift {\n\t\tac.serverKey = flag.Args()[3-shift]\n\t}\n\tif len(flag.Args()) >= 5-shift {\n\t\tac.redisAddr = flag.Args()[4-shift]\n\t\tac.redisAddrSpecified = true\n\t}\n\tif len(flag.Args()) >= 6-shift {\n\t\t// Convert the dbindex from string to int\n\t\tDBindex, err := strconv.Atoi(flag.Args()[5-shift])\n\t\tif err != nil {\n\t\t\tac.redisDBindex = DBindex\n\t\t}\n\t}\n\n\t// Use the default openExecutable if none is set\n\tif ac.openURLAfterServing && ac.openExecutable == \"\" {\n\t\tac.openExecutable = ac.defaultOpenExecutable\n\t}\n\n\t// Add the serverConfScript to the list of configuration scripts to be read and executed\n\tif ac.serverConfScript != \"\" && ac.serverConfScript != os.DevNull {\n\t\tac.serverConfigurationFilenames = append(ac.serverConfigurationFilenames, ac.serverConfScript, filepath.Join(ac.serverDirOrFilename, ac.serverConfScript))\n\t}\n\n\tac.serverHost = host\n\n\t// CertMagic and Let's Encrypt\n\tif ac.useCertMagic {\n\t\tlog.Info(\"Use Cert Magic\")\n\t\tif dirEntries, err := os.ReadDir(ac.serverDirOrFilename); err != nil {\n\t\t\tlog.Error(\"Could not use Cert Magic:\" + err.Error())\n\t\t\tac.useCertMagic = false\n\t\t} else {\n\t\t\t// log.Infof(\"Looping over %v files\", len(files))\n\t\t\tfor _, dirEntry := range dirEntries {\n\t\t\t\tbasename := filepath.Base(dirEntry.Name())\n\t\t\t\tdirOrSymlink := dirEntry.IsDir() || ((dirEntry.Type() & os.ModeSymlink) == os.ModeSymlink)\n\t\t\t\t// TODO: Confirm that the symlink is a symlink to a directory, if it's a symlink\n\t\t\t\tif dirOrSymlink && strings.Contains(basename, \".\") && !strings.HasPrefix(basename, \".\") && !strings.HasSuffix(basename, \".old\") {\n\t\t\t\t\tac.certMagicDomains = append(ac.certMagicDomains, basename)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Using Let's Encrypt implies --domain, to search for suitable directories in the directory to be served\n\t\t\tac.serverAddDomain = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2cf0fe91f025e7831f594fb17670feea", "score": "0.5409051", "text": "func init() {\n\tRootCmd.AddCommand(genKeyCmd)\n\tgenKeyCmd.Flags().StringVarP(&keyGenEnv, \"environment\", \"e\", \"\", \"Key generation environment\")\n\tgenKeyCmd.Flags().StringVarP(&apiName, \"name\", \"n\", \"\", \"API to be generated keys\")\n\tgenKeyCmd.Flags().StringVarP(&apiVersion, \"version\", \"v\", \"\", \"Version of the API\")\n\tgenKeyCmd.Flags().StringVarP(&apiProvider, \"provider\", \"r\", \"\", \"Provider of the API\")\n\t_ = genKeyCmd.MarkFlagRequired(\"environment\")\n}", "title": "" }, { "docid": "03e755c34b5fa17b56914aff54ae4edf", "score": "0.54047036", "text": "func createFlags() {\n\tcreateCmd.Flags().IntVarP(&cmdOptions.Cpu, \"cpu\", \"c\",defaultCpu, \"Customize the CPU of the vagrant VM that is going to created\")\n\tcreateCmd.Flags().IntVarP(&cmdOptions.Memory, \"memory\", \"m\",defaultMemory, \"Customize the Memory of the vagrant VM that is going to created, units in MegaBytes\")\n\tcreateCmd.Flags().IntVarP(&cmdOptions.Segments, \"segments\", \"s\",defaultSegments, \"Customize the number of segments host created during the vagrant provision\")\n\tcreateCmd.Flags().BoolVar(&cmdOptions.Standby, \"standby\",false, \"Do you need a standby host vagrants to be created?\")\n\tcreateCmd.Flags().StringVarP(&cmdOptions.Os, \"os\",\"o\",defaultOs,\"The vagrant OS to be used when being provisioned\")\n\tcreateCmd.Flags().StringVarP(&cmdOptions.Subnet, \"subnet\",\"b\", defaultSubnet,\"The vagrant subnet to be used when being provisioned\")\n\tcreateCmd.Flags().StringVarP(&cmdOptions.Hostname, \"hostname\",\"n\",defaultHostname,\"The name of the host that should be used when being provisioned\")\n}", "title": "" }, { "docid": "12d7baffbc6dcdfc8c79f7d2063cc969", "score": "0.5383962", "text": "func setupFlags() {\n\tflag.StringVar(&imageFile, \"image\", \"\", \"Path to a NemID image file 125% zoom level\")\n\tflag.StringVar(&key, \"key\", \"\", \"NemID 4 digit key\")\n\tflag.Parse()\n\tif imageFile == \"\" {\n\t\tlog.Fatal(\"You must provide a NemID image path using the --image option\")\n\t}\n\tif _, err := os.Stat(imageFile); os.IsNotExist(err) {\n\t\tlog.Fatalf(\"image file does not exists %s\", imageFile)\n\t}\n\tif key == \"\" {\n\t\tlog.Fatal(\"You must provide a 4 digit key using the --key option\")\n\t}\n}", "title": "" }, { "docid": "f17726fee072134b421f3afc08438bdc", "score": "0.53744197", "text": "func InitFlags() {\n\tpflag.CommandLine.SetNormalizeFunc(WordSepNormalizeFunc)\n\tpflag.CommandLine.AddGoFlagSet(goflag.CommandLine)\n\tver := AddCommonFlags(pflag.CommandLine)\n\tpflag.Parse()\n\n\t//add handler if flag include --version/-v\n\tif *ver {\n\t\tversion.ShowVersion()\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "5f00c5a7744590e5591a2d3cb56589ad", "score": "0.5368829", "text": "func init() {\n\tconst (\n\t\tdefaultPort = \":8080\"\n\t\tusagePort = \"http service address\"\n\t\tdefaultToken = \"\"\n\t\tusageToken = \"http auth token\"\n\t\tdefaultBase = \"/var/www\"\n\t\tusageBase = \"REPREPRO_BASE_DIR\"\n\t\tdefaultTls = false\n\t\tusageTls = \"TLS boolean flag\"\n\t)\n\tflag.StringVar(&port, \"port\", defaultPort, usagePort)\n\tflag.StringVar(&port, \"p\", defaultPort, usagePort+\" (shorthand)\")\n\tflag.StringVar(&token, \"token\", defaultToken, usageToken)\n\tflag.StringVar(&token, \"t\", defaultToken, usageToken+\" (shorthand)\")\n\tflag.StringVar(&base, \"base\", defaultBase, usageBase)\n\tflag.StringVar(&base, \"b\", defaultBase, usageBase+\" (shorthand)\")\n\tflag.BoolVar(&tls, \"ssl\", defaultTls, usageTls)\n\tflag.BoolVar(&tls, \"s\", defaultTls, usageTls+\" (shorthand)\")\n}", "title": "" }, { "docid": "0a2caf69f90946ad41f240ebd16d7410", "score": "0.5362041", "text": "func initCmd() error {\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\"))\n\tviper.AutomaticEnv()\n\n\tviper.SetDefault(otlpExporterEndpoint, \"localhost\")\n\tflag.String(otlpExporterEndpoint, \"\", \"OTL Exporter endpoint\")\n\n\tviper.SetDefault(flagJaegerServiceName, \"jaeger-service\")\n\tflag.String(flagJaegerServiceName, \"\", \"Jaeger service name\")\n\n\tviper.SetDefault(flagReportingProtocol, \"http\")\n\tflag.String(flagReportingProtocol, \"\", \"Protocol to report traces (http|grpc)\")\n\n\tviper.SetDefault(flagVerbose, false)\n\tflag.Bool(flagVerbose, false, \"Enable verbosity\")\n\n\tviper.SetDefault(flagJaegerOperationName, \"jaeger-operation\")\n\tflag.String(flagJaegerOperationName, \"\", \"Jaeger operation name\")\n\n\tpflag.CommandLine.AddGoFlagSet(flag.CommandLine)\n\tpflag.Parse()\n\n\terr := viper.BindPFlags(pflag.CommandLine)\n\treturn err\n}", "title": "" }, { "docid": "d446559954a80ef7259a5fd40b6ffe26", "score": "0.53420216", "text": "func bindFlags(flags *pflag.FlagSet, v *viper.Viper) (err error) {\n\tflags.VisitAll(func(f *pflag.Flag) {\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tif err = bindFlag(flags, f, v); err != nil {\n\t\t\terr = fmt.Errorf(\"failed to set flag from env or config: %w\", err)\n\t\t}\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "7124a567e96bd874dcd5f974b516d1bf", "score": "0.5341842", "text": "func init () {\n\t// root command flags\n\trootCmd.PersistentFlags().BoolVarP(&cmdOptions.Debug, \"verbose\", \"v\", false, \"Enable verbose or debug logging\")\n\trootCmd.PersistentFlags().BoolVar(&cmdOptions.Developer, \"developer\", false, \"Setup the virtual machine with developer tools to build the go-gpdb binaries\")\n\t// Attach the sub command to the root command.\n\trootCmd.AddCommand(createCmd)\n\tcreateFlags()\n\trootCmd.AddCommand(upCmd)\n\tupFlags()\n\trootCmd.AddCommand(sshCmd)\n\tsshFlags()\n\trootCmd.AddCommand(stopCmd)\n\tstopFlags()\n\trootCmd.AddCommand(statusCmd)\n\tstatusFlags()\n\trootCmd.AddCommand(restartCmd)\n\trestartFlags()\n\trootCmd.AddCommand(destroyCmd)\n\tdestroyFlags()\n\trootCmd.AddCommand(updateCmd)\n\tupdateConfigFlags()\n\trootCmd.AddCommand(deleteCmd)\n\tdeleteConfigFlags()\n\trootCmd.AddCommand(listCmd)\n\tlistFlags()\n}", "title": "" }, { "docid": "3040621a6b51622ed79acc4d0931812a", "score": "0.5340401", "text": "func PostFlagSetupAndParse() {\n\tpflag.Parse()\n\n\t// Must call after all flags are setup.\n\tviper.AutomaticEnv()\n\tviper.SetEnvPrefix(\"PL\")\n\tviper.BindPFlags(pflag.CommandLine)\n}", "title": "" }, { "docid": "35b13352fadccf6d260b96fdd269fb5a", "score": "0.5331334", "text": "func (e *ArgEnv) setupFlags() (err error) {\n\te.values = make(map[string]interface{})\n\t// setup arguments for flags\n\tfor i := 0; i < len(e.entries); i++ {\n\t\tswitch e.entries[i].Type {\n\t\tcase \"string\":\n\t\t\tvar value string\n\t\t\tflag.StringVar(&value, e.entries[i].FlagName, e.entries[i].Default, e.entries[i].Description)\n\t\t\te.values[e.entries[i].Name] = &value\n\t\tcase \"int\":\n\t\t\tvar value int\n\t\t\tvar defaultValue int64\n\n\t\t\tdefaultValue, _ = strconv.ParseInt(e.entries[i].Default, 10, 64)\n\n\t\t\tflag.IntVar(&value, e.entries[i].FlagName, int(defaultValue), e.entries[i].Description)\n\t\t\te.values[e.entries[i].Name] = &value\n\t\tcase \"float64\":\n\t\t\tvar value float64\n\t\t\tvar defaultValue float64\n\n\t\t\tdefaultValue, _ = strconv.ParseFloat(e.entries[i].Default, 64)\n\n\t\t\tflag.Float64Var(&value, e.entries[i].FlagName, float64(defaultValue), e.entries[i].Description)\n\t\t\te.values[e.entries[i].Name] = &value\n\t\tcase \"bool\":\n\t\t\tvar value bool\n\t\t\tvar defaultValue bool\n\n\t\t\tdefaultValue, _ = strconv.ParseBool(e.entries[i].Default)\n\n\t\t\tflag.BoolVar(&value, e.entries[i].FlagName, defaultValue, e.entries[i].Description)\n\t\t\te.values[e.entries[i].Name] = &value\n\t\tdefault:\n log.Printf(\"setupFlags: Unknown type %s\\n\", e.entries[i].Type)\n\t\t}\n\t}\n\n\t// Overwrite default usage with ours and parse flags\n\tflag.Usage = e.usage\n\n\t// parse all of the flags we've setup\n\tflag.Parse()\n\n\treturn\n}", "title": "" }, { "docid": "c4393b9a3133fcd258d441ef7417213f", "score": "0.5330775", "text": "func init() {\n\tflag.BoolVar(&showHelp, \"h\", false, \"show this help text\")\n\tflag.BoolVar(&showVersion, \"v\", false, \"show version information\")\n}", "title": "" }, { "docid": "a8387ff084109e00bc88cef093740b6d", "score": "0.53254884", "text": "func setupFlags() *flag.FlagSet {\n\tflagSet := flag.NewFlagSet(\"goxc\", flag.ContinueOnError)\n\tflagSet.StringVar(&configName, \"c\", \"\", \"config name\")\n\n\t//TODO deprecate?\n\tflagSet.StringVar(&settings.Os, \"os\", \"\", \"Specify OS (default is all - \\\"linux darwin windows freebsd openbsd\\\")\")\n\tflagSet.StringVar(&settings.Arch, \"arch\", \"\", \"Specify Arch (default is all - \\\"386 amd64 arm\\\")\")\n\n\t//TODO introduce and implement in time for 0.6\n\tflagSet.StringVar(&settings.BuildConstraints, \"bc\", \"\", \"Specify build constraints (e.g. 'linux,arm windows')\")\n\n\tflagSet.StringVar(&workingDirectoryFlag, \"wd\", \"\", \"Specify directory to work on\")\n\n\tflagSet.StringVar(&settings.PackageVersion, \"pv\", \"\", \"Package version (usually [major].[minor].[patch]. default='\"+core.PACKAGE_VERSION_DEFAULT+\"')\")\n\tflagSet.StringVar(&settings.PackageVersion, \"av\", \"\", \"DEPRECATED: Package version (deprecated option name)\")\n\tflagSet.StringVar(&settings.PrereleaseInfo, \"pr\", \"\", \"Prerelease info (usually 'alpha', 'snapshot' ...)\")\n\tflagSet.StringVar(&settings.PrereleaseInfo, \"pi\", \"\", \"DEPRECATED option name. Use -pr instead\")\n\tflagSet.StringVar(&settings.BranchName, \"br\", \"\", \"Branch name (use this if you've forked a repo)\")\n\tflagSet.StringVar(&settings.BuildName, \"bu\", \"\", \"Build name (use this for pre-release builds)\")\n\n\tflagSet.StringVar(&settings.ArtifactsDest, \"d\", \"\", \"Destination root directory (default=$GOBIN/(appname)-xc)\")\n\tflagSet.StringVar(&codesignId, \"codesign\", \"\", \"identity to sign darwin binaries with (only applied when host OS is 'darwin')\")\n\n\tflagSet.StringVar(&settings.Resources.Include, \"include\", \"\", \"Include resources in archives (default=\"+core.RESOURCES_INCLUDE_DEFAULT+\")\") //TODO: Add resources to non-zips & downloads.md\n\n\t//0.2.0 Not easy to 'merge' boolean config items. More flexible to translate them to string options anyway\n\tflagSet.BoolVar(&isHelp, \"h\", false, \"Help - options\")\n\tflagSet.BoolVar(&isHelp, \"help\", false, \"Help - options\")\n\tflagSet.BoolVar(&isHelpTasks, \"ht\", false, \"Help about tasks\")\n\tflagSet.BoolVar(&isHelpTasks, \"h-tasks\", false, \"Help about tasks\")\n\tflagSet.BoolVar(&isHelpTasks, \"help-tasks\", false, \"Help about tasks\")\n\tflagSet.BoolVar(&isVersion, \"version\", false, \"Print version\")\n\n\tflagSet.BoolVar(&isVerbose, \"v\", false, \"Verbose\")\n\tflagSet.StringVar(&isCliZipArchives, \"z\", \"\", \"DEPRECATED (use archive & rmbin tasks instead): create ZIP archives instead of directories (true/false. default=true)\")\n\tflagSet.StringVar(&tasksToRun, \"tasks\", \"\", \"Tasks to run. Use `goxc -ht` for more details\")\n\tflagSet.StringVar(&tasksPlus, \"tasks+\", \"\", \"Additional tasks to run. See -ht for tasks list\")\n\tflagSet.StringVar(&tasksMinus, \"tasks-\", \"\", \"Tasks to exclude. See -ht for tasks list\")\n\tflagSet.BoolVar(&isBuildToolchain, \"t\", false, \"Build cross-compiler toolchain(s). Equivalent to -tasks=toolchain\")\n\tflagSet.BoolVar(&isWriteConfig, \"wc\", false, \"(over)write config. Overwrites are additive. Try goxc -wc to produce a starting point.\")\n\tflagSet.Usage = func() {\n\t\tprintHelpTopic(flagSet, \"options\")\n\t}\n\treturn flagSet\n}", "title": "" }, { "docid": "b0488bad3c8ca5d832f5dce71849dcc0", "score": "0.53198814", "text": "func preRunSetup(cmd *cobra.Command, args []string) (err error) {\n\tlevel := viper.GetString(FlagLogLevel)\n\tlogger, err = tmflags.ParseLogLevel(level, logger, defaultLogLevel)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif viper.GetBool(cli.TraceFlag) {\n\t\tlogger = log.NewTracingLogger(logger)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c4cee65ec208becbfc1d48f9e83a33e", "score": "0.5319719", "text": "func AddFlagsVar(a *kingpin.Application, config *Config) {\n\ta.Flag(\"orc8r.host\", \"orchestrator host\").\n\t\tEnvar(\"ORC8R_HOST\").\n\t\tStringVar(&config.Host)\n\ta.Flag(\"orc8r.cert\", \"orchestrator certificate\").\n\t\tEnvar(\"ORC8R_CERT\").\n\t\tStringVar(&config.Cert)\n\ta.Flag(\"orc8r.pkey\", \"orchestrator private key\").\n\t\tEnvar(\"ORC8R_PKEY\").\n\t\tStringVar(&config.PKey)\n}", "title": "" }, { "docid": "24e8f4e0249c907dfd1b024ba909f373", "score": "0.5311673", "text": "func init() {\n\tdebug := os.Getenv(\"DEBUG\")\n\tif debug != \"\" && debug != \"false\" && debug != \"0\" {\n\t\tDebug = true\n\t}\n}", "title": "" }, { "docid": "d9c6c23e49bedad66dc7aba88f4ac13c", "score": "0.5305747", "text": "func initConfig() {\n if cfgFile != \"\" {\n // Use config file from the flag.\n viper.SetConfigFile(cfgFile)\n } else {\n // Find home directory.\n home, err := homedir.Dir()\n if err != nil {\n fmt.Println(err)\n os.Exit(1)\n }\n\n // Search config in home directory with name \".twitter-cli\" (without extension).\n viper.AddConfigPath(home)\n viper.SetConfigName(\".twitter-cli\")\n }\n\n viper.AutomaticEnv() // read in environment variables that match\n\n // If a config file is found, read it in.\n if err := viper.ReadInConfig(); err == nil {\n fmt.Println(\"Using config file:\", viper.ConfigFileUsed())\n }\n}", "title": "" }, { "docid": "2a1962e986cab9fb3fb6f147675d27a4", "score": "0.5301975", "text": "func extraFlagInit() {\n\t// If any of the security flags have been set, clear the insecure\n\t// setting. Note that we do the inverse when the --insecure flag is\n\t// set. See insecureValue.Set().\n\tif baseCtx.SSLCA != \"\" || baseCtx.SSLCAKey != \"\" ||\n\t\tbaseCtx.SSLCert != \"\" || baseCtx.SSLCertKey != \"\" {\n\t\tbaseCtx.Insecure = false\n\t}\n\n\tserverCtx.Addr = net.JoinHostPort(connHost, connPort)\n\tif httpAddr == \"\" {\n\t\thttpAddr = connHost\n\t}\n\tserverCtx.HTTPAddr = net.JoinHostPort(httpAddr, httpPort)\n}", "title": "" }, { "docid": "b31005e342fb0e6ce73ac87c224c8247", "score": "0.5301219", "text": "func init(){\n\tflag.StringVar(&server,\"server\",\"localhost:8080\",\"server flag\")\t\n}", "title": "" }, { "docid": "ca7a102b021ff6d061aecf7306a61ec1", "score": "0.53007084", "text": "func initConfig() {\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\"))\n\tviper.AutomaticEnv() // read in environment variables that match\n}", "title": "" }, { "docid": "899e2613b0f4926576ba22bfdc0601d0", "score": "0.5300271", "text": "func RegisterIntoKingpinFlags(app *kingpin.Application) {\n\tapp.Flag(\"version\", \"Prints current version.\").Default(\"false\").BoolVar(&printVer)\n\tapp.Flag(\"short-version\", \"Print just the version number.\").Default(\"false\").BoolVar(&printShort)\n}", "title": "" }, { "docid": "0e64ecf16eb8574cf90475e5d4912480", "score": "0.5297712", "text": "func init() {\n\trootCmd.Flags().BoolVarP(&ignoreCaseFlag, \"ignore-case\", \"i\", false, \"Ignore case distinction\")\n\trootCmd.Flags().BoolVarP(&stdinFlag, \"stdin\", \"\", false, \"Expects input via pipes\")\n}", "title": "" }, { "docid": "a7b97aad14cf8f4a367776db5a67f783", "score": "0.52925277", "text": "func InitFlags() {\n\tflag.StringVar(&ibxServer, \"server\", os.Getenv(\"IBX_SERVER\"),\n\t\t\"Infoblox API server hostname or address. (Env: IBX_SERVER)\")\n\tflag.StringVar(&wapiVersion, \"wapiVersion\", \"v2.6.1\",\n\t\t\"WAPI version (defaults to v2.6.1)\")\n\tflag.IntVar(&ibxPort, \"port\", 443,\n\t\t\"Infoblox API server port. Default:443\")\n\tflag.StringVar(&ibxUsername, \"username\", os.Getenv(\"IBX_USERNAME\"),\n\t\t\"Authentication username (Env: IBX_USERNAME)\")\n\tflag.StringVar(&ibxPassword, \"password\", os.Getenv(\"IBX_PASSWORD\"),\n\t\t\"Authentication password (Env: IBX_PASSWORD)\")\n\tflag.BoolVar(&debug, \"debug\", false, \"Debug output. Default:false\")\n}", "title": "" }, { "docid": "c6f745ca73ac3930d0d1fa36daca9a1c", "score": "0.52845347", "text": "func extractCommandLine() {\n\tvar emailFlag = flag.String(\"email\", \"\", \"User email\")\n\tvar accountFlag = flag.String(\"account\", \"\", \"User Account\")\n\tvar nsFlag = flag.String(\"namespace\", \"\", \"User's Namespace\")\n\tvar keyFlag = flag.String(\"key\", \"\", \"Account Global Key\")\n\tvar tokenFlag = flag.String(\"token\", \"\", \"Configured KV Workers key\")\n\tvar addLocationFlag = flag.String(\"addLocation\", \"\", \"Add these locations/files to backup\")\n\tvar locationFlag = flag.String(\"location\", \"\", \"Use only these locations to backup\")\n\tvar backupFlag = flag.String(\"backup\", \"\", \"Backup strategy\")\n\tvar downloadFlag = flag.String(\"download\", \"\", \"Folder/files to download\")\n\tvar zipFlag = flag.String(\"zip\", \"\", \"zip\")\n\tvar verboseFlag = flag.Bool(\"v\", false, \"More information\")\n\tvar altPrefFlag = flag.String(\"pref\", \"\", \"use an alternate preference file\")\n\n\tflag.Parse()\n\n\tif *altPrefFlag != \"\" {\n\t\treadTOML(*altPrefFlag)\n\t\tif !gobackup.ValidateCF(&cf) {\n\t\t\tfmt.Printf(\"%v has errors that need to be fixed!\", *altPrefFlag)\n\t\t}\n\t}\n\n\t//overwrite over any preferences file\n\tif *emailFlag != \"\" {\n\t\tcf.Email = *emailFlag\n\t}\n\tif *accountFlag != \"\" {\n\t\tcf.Account = *accountFlag\n\t}\n\tif *nsFlag != \"\" {\n\t\tcf.Namespace = *nsFlag\n\t}\n\tif *keyFlag != \"\" {\n\t\tcf.Key = *keyFlag\n\t}\n\tif *tokenFlag != \"\" {\n\t\tcf.Token = *tokenFlag\n\t}\n\tif *locationFlag != \"\" { //replace the locations\n\t\tcf.Location = *locationFlag\n\t}\n\tif *addLocationFlag != \"\" { //add to the locations\n\t\tcf.Location = cf.Location + \",\" + *addLocationFlag\n\t}\n\tif *backupFlag != \"\" {\n\t\tcf.Backup = *backupFlag\n\t}\n\tif *zipFlag != \"\" {\n\t\tcf.Zip = *zipFlag\n\t}\n\tif *verboseFlag {\n\t\tverbose = true\n\t\tfmt.Println(\"Extracting flags from commandline:\")\n\t}\n\tif *downloadFlag != \"\" {\n\t\tcf.Location = *downloadFlag //hash\n\t\tgobackup.DownloadKV(&cf, *downloadFlag, \"download.file\")\n\t\tfmt.Println(\"Downloaded a file!\")\n\t\tos.Exit(0)\n\t}\n\n}", "title": "" }, { "docid": "625471703f0cc25ded139ae770071eab", "score": "0.52826744", "text": "func Init() {\n // host flag (required)\n Exploit.Flags().StringVarP(&addr, \"addr\", \"a\", \"\",\n \"the target machine's IP address\")\n Exploit.MarkFlagRequired(\"addr\")\n\n // port flag (required)\n Exploit.Flags().IntVarP(&port, \"port\", \"p\", 0,\n \"the port the target service is running on\")\n Exploit.MarkFlagRequired(\"port\")\n\n // offset flag (required)\n Exploit.Flags().IntVarP(&offset, \"offset\", \"o\", 0,\n \"the offset of the EIP register\")\n Exploit.MarkFlagRequired(\"offset\")\n\n // jump flag (required)\n Exploit.Flags().StringVarP(&jump, \"jump\", \"j\", \"\",\n \"the jump address for executing shellcode\")\n Exploit.MarkFlagRequired(\"jump\")\n\n // reverse flag (optional)\n Exploit.Flags().BoolVarP(&reverse, \"reverse\", \"r\", false,\n \"(optional) reverse the endianness of the jump address bytes\")\n\n // nops flag (optional)\n Exploit.Flags().IntVarP(&nops, \"nops\", \"n\", 16,\n \"(optional) the number of NOPs to pad payload with\")\n\n // shell flag (required)\n Exploit.Flags().StringVarP(&shell, \"shell\", \"s\", \"\",\n \"the path to the payload to be executed on the target\")\n Exploit.MarkFlagRequired(\"shell\")\n\n // template flag (optional)\n Exploit.Flags().StringVarP(&tmpl, \"template\", \"t\", \"{payload}\",\n \"(optional) template to format payload with, see docs for more info\")\n}", "title": "" }, { "docid": "d82a185f68b8c25b470948cbd8962f9a", "score": "0.5281718", "text": "func RegisterFlags() {\n\tservenv.OnParse(func(fs *pflag.FlagSet) {\n\t\tfs.IntVar(&flagServerID, \"mycnf_server_id\", flagServerID, \"mysql server id of the server (if specified, mycnf-file will be ignored)\")\n\t\tfs.IntVar(&flagMysqlPort, \"mycnf_mysql_port\", flagMysqlPort, \"port mysql is listening on\")\n\t\tfs.StringVar(&flagDataDir, \"mycnf_data_dir\", flagDataDir, \"data directory for mysql\")\n\t\tfs.StringVar(&flagInnodbDataHomeDir, \"mycnf_innodb_data_home_dir\", flagInnodbDataHomeDir, \"Innodb data home directory\")\n\t\tfs.StringVar(&flagInnodbLogGroupHomeDir, \"mycnf_innodb_log_group_home_dir\", flagInnodbLogGroupHomeDir, \"Innodb log group home directory\")\n\t\tfs.StringVar(&flagSocketFile, \"mycnf_socket_file\", flagSocketFile, \"mysql socket file\")\n\t\tfs.StringVar(&flagGeneralLogPath, \"mycnf_general_log_path\", flagGeneralLogPath, \"mysql general log path\")\n\t\tfs.StringVar(&flagErrorLogPath, \"mycnf_error_log_path\", flagErrorLogPath, \"mysql error log path\")\n\t\tfs.StringVar(&flagSlowLogPath, \"mycnf_slow_log_path\", flagSlowLogPath, \"mysql slow query log path\")\n\t\tfs.StringVar(&flagRelayLogPath, \"mycnf_relay_log_path\", flagRelayLogPath, \"mysql relay log path\")\n\t\tfs.StringVar(&flagRelayLogIndexPath, \"mycnf_relay_log_index_path\", flagRelayLogIndexPath, \"mysql relay log index path\")\n\t\tfs.StringVar(&flagRelayLogInfoPath, \"mycnf_relay_log_info_path\", flagRelayLogInfoPath, \"mysql relay log info path\")\n\t\tfs.StringVar(&flagBinLogPath, \"mycnf_bin_log_path\", flagBinLogPath, \"mysql binlog path\")\n\t\tfs.StringVar(&flagMasterInfoFile, \"mycnf_master_info_file\", flagMasterInfoFile, \"mysql master.info file\")\n\t\tfs.StringVar(&flagPidFile, \"mycnf_pid_file\", flagPidFile, \"mysql pid file\")\n\t\tfs.StringVar(&flagTmpDir, \"mycnf_tmp_dir\", flagTmpDir, \"mysql tmp directory\")\n\t\tfs.StringVar(&flagSecureFilePriv, \"mycnf_secure_file_priv\", flagSecureFilePriv, \"mysql path for loading secure files\")\n\n\t\tfs.StringVar(&flagMycnfFile, \"mycnf-file\", flagMycnfFile, \"path to my.cnf, if reading all config params from there\")\n\t})\n}", "title": "" }, { "docid": "c0990762f7ba366179f79b339d4d2d2d", "score": "0.52800286", "text": "func init() {\n\tif appId := os.Getenv(\"APP_ID\"); appId != \"\" {\n\t\tAppId = appId\n\t}\n\tif appCertificate := os.Getenv(\"APP_CERTIFICATE\"); appCertificate != \"\" {\n\t\tAppCertificate = appCertificate\n\t}\n\n\tif AppId == \"\" || AppCertificate == \"\" {\n\t\tlog.Printf(\"check appId or appCertificate\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "818600c7ed31dc3249739050cd022e23", "score": "0.5272043", "text": "func init() {\n\tcobra.OnInitialize(initConfig)\n\n\trootCmd.SetVersionTemplate(fmt.Sprintf(\"Version: %v\\nCommit: %v\\nDate: %v\\n\", Version, Commit, Date))\n\n\trootCmd.PersistentFlags().StringVarP(&configFile, \"config\", \"c\", \"config.yml\", \"Config file\")\n\n\trootCmd.PersistentFlags().StringP(\"ssh-address\", \"a\", \"localhost:2222\", \"The address to listen for SSH connections\")\n\trootCmd.PersistentFlags().StringP(\"http-address\", \"i\", \"localhost:80\", \"The address to listen for HTTP connections\")\n\trootCmd.PersistentFlags().StringP(\"https-address\", \"t\", \"localhost:443\", \"The address to listen for HTTPS connections\")\n\trootCmd.PersistentFlags().StringP(\"redirect-root-location\", \"r\", \"https://github.com/antoniomika/sish\", \"The location to redirect requests to the root domain\\nto instead of responding with a 404\")\n\trootCmd.PersistentFlags().StringP(\"https-certificate-directory\", \"s\", \"deploy/ssl/\", \"The directory containing HTTPS certificate files (name.crt and name.key). There can be many crt/key pairs\")\n\trootCmd.PersistentFlags().StringP(\"https-ondemand-certificate-email\", \"\", \"\", \"The email to use with Let's Encrypt for cert notifications. Can be left blank\")\n\trootCmd.PersistentFlags().StringP(\"domain\", \"d\", \"ssi.sh\", \"The root domain for HTTP(S) multiplexing that will be appended to subdomains\")\n\trootCmd.PersistentFlags().StringP(\"banned-subdomains\", \"b\", \"localhost\", \"A comma separated list of banned subdomains that users are unable to bind\")\n\trootCmd.PersistentFlags().StringP(\"banned-ips\", \"x\", \"\", \"A comma separated list of banned ips that are unable to access the service. Applies to HTTP, TCP, and SSH connections\")\n\trootCmd.PersistentFlags().StringP(\"banned-countries\", \"o\", \"\", \"A comma separated list of banned countries. Applies to HTTP, TCP, and SSH connections\")\n\trootCmd.PersistentFlags().StringP(\"whitelisted-ips\", \"w\", \"\", \"A comma separated list of whitelisted ips. Applies to HTTP, TCP, and SSH connections\")\n\trootCmd.PersistentFlags().StringP(\"whitelisted-countries\", \"y\", \"\", \"A comma separated list of whitelisted countries. Applies to HTTP, TCP, and SSH connections\")\n\trootCmd.PersistentFlags().StringP(\"private-key-passphrase\", \"p\", \"S3Cr3tP4$$phrAsE\", \"Passphrase to use to encrypt the server private key\")\n\trootCmd.PersistentFlags().StringP(\"private-key-location\", \"l\", \"deploy/keys/ssh_key\", \"The location of the SSH server private key. sish will create a private key here if\\nit doesn't exist using the --private-key-passphrase to encrypt it if supplied\")\n\trootCmd.PersistentFlags().StringP(\"authentication-password\", \"u\", \"S3Cr3tP4$$W0rD\", \"Password to use for ssh server password authentication\")\n\trootCmd.PersistentFlags().StringP(\"authentication-keys-directory\", \"k\", \"deploy/pubkeys/\", \"Directory where public keys for public key authentication are stored.\\nsish will watch this directory and automatically load new keys and remove keys\\nfrom the authentication list\")\n\trootCmd.PersistentFlags().StringP(\"port-bind-range\", \"n\", \"0,1024-65535\", \"Ports or port ranges that sish will allow to be bound when a user attempts to use TCP forwarding\")\n\trootCmd.PersistentFlags().StringP(\"proxy-protocol-version\", \"q\", \"1\", \"What version of the proxy protocol to use. Can either be 1, 2, or userdefined.\\nIf userdefined, the user needs to add a command to SSH called proxyproto:version (ie proxyproto:1)\")\n\trootCmd.PersistentFlags().StringP(\"admin-console-token\", \"j\", \"S3Cr3tP4$$W0rD\", \"The token to use for admin console access if it's enabled\")\n\trootCmd.PersistentFlags().StringP(\"service-console-token\", \"m\", \"\", \"The token to use for service console access. Auto generated if empty for each connected tunnel\")\n\trootCmd.PersistentFlags().StringP(\"append-user-to-subdomain-separator\", \"\", \"-\", \"The token to use for separating username and subdomain selection in a virtualhost\")\n\trootCmd.PersistentFlags().StringP(\"time-format\", \"\", \"2006/01/02 - 15:04:05\", \"The time format to use for both HTTP and general log messages\")\n\trootCmd.PersistentFlags().StringP(\"log-to-file-path\", \"\", \"/tmp/sish.log\", \"The file to write log output to\")\n\trootCmd.PersistentFlags().StringP(\"bind-hosts\", \"\", \"\", \"A comma separated list of other hosts a user can bind. Requested hosts should be subdomains of a host in this list\")\n\trootCmd.PersistentFlags().StringP(\"load-templates-directory\", \"\", \"templates/*\", \"The directory and glob parameter for templates that should be loaded\")\n\n\trootCmd.PersistentFlags().BoolP(\"bind-random-subdomains\", \"\", true, \"Force bound HTTP tunnels to use random subdomains instead of user provided ones\")\n\trootCmd.PersistentFlags().BoolP(\"verify-ssl\", \"\", true, \"Verify SSL certificates made on proxied HTTP connections\")\n\trootCmd.PersistentFlags().BoolP(\"verify-dns\", \"\", true, \"Verify DNS information for hosts and ensure it matches a connecting users sha256 key fingerprint\")\n\trootCmd.PersistentFlags().BoolP(\"cleanup-unbound\", \"\", true, \"Cleanup unbound (unforwarded) SSH connections after a set timeout\")\n\trootCmd.PersistentFlags().BoolP(\"bind-random-ports\", \"\", true, \"Force TCP tunnels to bind a random port, where the kernel will randomly assign it\")\n\trootCmd.PersistentFlags().BoolP(\"append-user-to-subdomain\", \"\", false, \"Append the SSH user to the subdomain. This is useful in multitenant environments\")\n\trootCmd.PersistentFlags().BoolP(\"debug\", \"\", false, \"Enable debugging information\")\n\trootCmd.PersistentFlags().BoolP(\"ping-client\", \"\", true, \"Send ping requests to the underlying SSH client.\\nThis is useful to ensure that SSH connections are kept open or close cleanly\")\n\trootCmd.PersistentFlags().BoolP(\"geodb\", \"\", false, \"Use a geodb to verify country IP address association for IP filtering\")\n\trootCmd.PersistentFlags().BoolP(\"authentication\", \"\", false, \"Require authentication for the SSH service\")\n\trootCmd.PersistentFlags().BoolP(\"proxy-protocol\", \"\", false, \"Use the proxy-protocol while proxying connections in order to pass-on IP address and port information\")\n\trootCmd.PersistentFlags().BoolP(\"https\", \"\", false, \"Listen for HTTPS connections. Requires a correct --https-certificate-directory\")\n\trootCmd.PersistentFlags().BoolP(\"redirect-root\", \"\", true, \"Redirect the root domain to the location defined in --redirect-root-location\")\n\trootCmd.PersistentFlags().BoolP(\"admin-console\", \"\", false, \"Enable the admin console accessible at http(s)://domain/_sish/console?x-authorization=admin-console-token\")\n\trootCmd.PersistentFlags().BoolP(\"service-console\", \"\", false, \"Enable the service console for each service and send the info to connected clients\")\n\trootCmd.PersistentFlags().BoolP(\"tcp-aliases\", \"\", false, \"Enable the use of TCP aliasing\")\n\trootCmd.PersistentFlags().BoolP(\"log-to-client\", \"\", false, \"Enable logging HTTP and TCP requests to the client\")\n\trootCmd.PersistentFlags().BoolP(\"idle-connection\", \"\", true, \"Enable connection idle timeouts for reads and writes\")\n\trootCmd.PersistentFlags().BoolP(\"http-load-balancer\", \"\", false, \"Enable the HTTP load balancer (multiple clients can bind the same domain)\")\n\trootCmd.PersistentFlags().BoolP(\"tcp-load-balancer\", \"\", false, \"Enable the TCP load balancer (multiple clients can bind the same port)\")\n\trootCmd.PersistentFlags().BoolP(\"alias-load-balancer\", \"\", false, \"Enable the alias load balancer (multiple clients can bind the same alias)\")\n\trootCmd.PersistentFlags().BoolP(\"localhost-as-all\", \"\", true, \"Enable forcing localhost to mean all interfaces for tcp listeners\")\n\trootCmd.PersistentFlags().BoolP(\"log-to-stdout\", \"\", true, \"Enable writing log output to stdout\")\n\trootCmd.PersistentFlags().BoolP(\"log-to-file\", \"\", false, \"Enable writing log output to file, specified by log-to-file-path\")\n\trootCmd.PersistentFlags().BoolP(\"log-to-file-compress\", \"\", false, \"Enable compressing log output files\")\n\trootCmd.PersistentFlags().BoolP(\"https-ondemand-certificate\", \"\", false, \"Enable retrieving certificates on demand via Let's Encrypt\")\n\trootCmd.PersistentFlags().BoolP(\"https-ondemand-certificate-accept-terms\", \"\", false, \"Accept the Let's Encrypt terms\")\n\trootCmd.PersistentFlags().BoolP(\"bind-any-host\", \"\", false, \"Bind any host when accepting an HTTP listener\")\n\trootCmd.PersistentFlags().BoolP(\"load-templates\", \"\", true, \"Load HTML templates. This is required for admin/service consoles\")\n\n\trootCmd.PersistentFlags().IntP(\"http-port-override\", \"\", 0, \"The port to use for http command output. This does not effect ports used for connecting, it's for cosmetic use only\")\n\trootCmd.PersistentFlags().IntP(\"https-port-override\", \"\", 0, \"The port to use for https command output. This does not effect ports used for connecting, it's for cosmetic use only\")\n\trootCmd.PersistentFlags().IntP(\"bind-random-subdomains-length\", \"\", 3, \"The length of the random subdomain to generate if a subdomain is unavailable or if random subdomains are enforced\")\n\trootCmd.PersistentFlags().IntP(\"log-to-file-max-size\", \"\", 500, \"The maximum size of outputed log files in megabytes\")\n\trootCmd.PersistentFlags().IntP(\"log-to-file-max-backups\", \"\", 3, \"The maxium number of rotated logs files to keep\")\n\trootCmd.PersistentFlags().IntP(\"log-to-file-max-age\", \"\", 28, \"The maxium number of days to store log output in a file\")\n\n\trootCmd.PersistentFlags().DurationP(\"idle-connection-timeout\", \"\", 5*time.Second, \"Duration to wait for activity before closing a connection for all reads and writes\")\n\trootCmd.PersistentFlags().DurationP(\"ping-client-interval\", \"\", 5*time.Second, \"Duration representing an interval to ping a client to ensure it is up\")\n\trootCmd.PersistentFlags().DurationP(\"ping-client-timeout\", \"\", 5*time.Second, \"Duration to wait for activity before closing a connection after sending a ping to a client\")\n\trootCmd.PersistentFlags().DurationP(\"cleanup-unbound-timeout\", \"\", 5*time.Second, \"Duration to wait before cleaning up an unbound (unforwarded) connection\")\n}", "title": "" }, { "docid": "05127d4eb7b81cdbdc6f38525438bf93", "score": "0.5267197", "text": "func initConfig() {\n if cfgFile != \"\" {\n // Use config file from the flag.\n viper.SetConfigFile(cfgFile)\n } else {\n // Find home directory.\n home, err := homedir.Dir()\n if err != nil {\n fmt.Println(err)\n os.Exit(1)\n }\n\n // Search config in home directory with name \".consent-receipt-go\" (without extension).\n viper.AddConfigPath(home)\n viper.SetConfigName(\".consent-receipt-go\")\n }\n\n viper.AutomaticEnv() // read in environment variables that match\n\n // If a config file is found, read it in.\n if err := viper.ReadInConfig(); err == nil {\n fmt.Fprintf(os.Stderr, \"Using config file: %s\\n\", viper.ConfigFileUsed())\n err = viper.Unmarshal(cfg)\n if err != nil {\n log.Fatal(err)\n }\n\n // Set any other defaults that may be missing from the config file\n cfg.SetDefaults()\n }\n}", "title": "" }, { "docid": "df34a743acdd16d41dd7d80e44c6de36", "score": "0.5259109", "text": "func Setup() {\n\tif os.Getenv(\"ENVIRONMENT\") == \"DEV\" {\n\t\tgodotenv.Load() //Загрузить файл .env\n\t}\n\n\tDatabaseSetting.User = os.Getenv(\"db_user\")\n\tDatabaseSetting.Password = os.Getenv(\"db_pass\")\n\tDatabaseSetting.Host = os.Getenv(\"db_host\")\n\tDatabaseSetting.Name = os.Getenv(\"db_name\")\n\tDatabaseSetting.Port = os.Getenv(\"db_port\")\n\n\tviper.SetConfigName(\"config\")\n\tviper.AddConfigPath(\".\")\n\terr := viper.ReadInConfig() // Find and read the config file\n\tif err != nil { // Handle errors reading the config file\n\t\tpanic(fmt.Errorf(\"Fatal error config file: %s \\n\", err))\n\t}\n\n}", "title": "" }, { "docid": "71664ba5ed6fd32270ef859a70f170e2", "score": "0.5258161", "text": "func initConfig() {\n\tif cfgFile != \"\" {\n\t\t// Use config file from the flag.\n\t\tviper.SetConfigFile(cfgFile)\n\t} else {\n\t\t// Find home directory.\n\t\thome, err := homedir.Dir()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Printf(\"Home dir is %s\\n\", home)\n\t\t// Search config in home directory with name \".spm\" (without extension).\n\t\tviper.AddConfigPath(home)\n\t\t//viper.AddConfigPath(\"./example\")\n\t\tviper.SetConfigName(\".spm\")\n\t}\n\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err == nil {\n\t\tfmt.Println(\"Using config file:\", viper.ConfigFileUsed())\n\t\tPubpkg = viper.GetString(\"pubpkg\")\n\t\tPubart = viper.GetString(\"pubart\")\n\t\tfmt.Printf(\"Pkg publish url=%s Artifacts=%s\\n\", Pubpkg, Pubart)\n\n\t\tviper.SetEnvPrefix(\"spm\")\n\t\tviper.BindEnv(\"pkgpassword\")\n\t\timpl.PkgPassword = viper.GetString(\"pkgpassword\")\n\t\timpl.Workarea = viper.GetString(\"package.workarea\")\n\t\t//fmt.Printf(\"Pkg Password %s Workarea %s\\n\", impl.PkgPassword, impl.Workarea)\n\t} else {\n\t\tlog.Printf(\"Unable to load config (%s). Using defaults\", err)\n\t}\n}", "title": "" }, { "docid": "30be348cbcbf2a36a4519fc56e36967e", "score": "0.52581245", "text": "func init() {\n\tcobra.OnInitialize(initConfig)\n\n\tRootCmd.PersistentFlags().StringVar(&cfgFile, \"config\", \"\", \"config file (default is $HOME/.ttnctl.yaml)\")\n\n\tRootCmd.PersistentFlags().String(\"ttn-router\", \"staging.thethingsnetwork.org:1700\", \"The net address of the TTN Router\")\n\tviper.BindPFlag(\"ttn-router\", RootCmd.PersistentFlags().Lookup(\"ttn-router\"))\n\n\tRootCmd.PersistentFlags().String(\"ttn-handler\", \"staging.thethingsnetwork.org:1782\", \"The net address of the TTN Handler\")\n\tviper.BindPFlag(\"ttn-handler\", RootCmd.PersistentFlags().Lookup(\"ttn-handler\"))\n\n\tRootCmd.PersistentFlags().String(\"mqtt-broker\", \"staging.thethingsnetwork.org:1883\", \"The address of the MQTT broker\")\n\tviper.BindPFlag(\"mqtt-broker\", RootCmd.PersistentFlags().Lookup(\"mqtt-broker\"))\n\n\tRootCmd.PersistentFlags().String(\"app-eui\", \"\", \"The app EUI to use\")\n\tviper.BindPFlag(\"app-eui\", RootCmd.PersistentFlags().Lookup(\"app-eui\"))\n\n\tRootCmd.PersistentFlags().String(\"ttn-account-server\", \"https://account.thethingsnetwork.org\", \"The address of the OAuth 2.0 server\")\n\tviper.BindPFlag(\"ttn-account-server\", RootCmd.PersistentFlags().Lookup(\"ttn-account-server\"))\n}", "title": "" }, { "docid": "31de9633ad6b3fd6e18db7454de0e30b", "score": "0.5256998", "text": "func setFlagEnvBool(p *bool, key, desc string, fallback bool) {\n\tif val := envValue(key); val != nil {\n\t\tfallback, _ = strconv.ParseBool(*val)\n\t}\n\tflag.BoolVar(p, key, fallback, envDesc(key, desc))\n}", "title": "" }, { "docid": "6842b91b1e73ef283006394740a4ed82", "score": "0.52534074", "text": "func Setup() {\n\t// 针对不同的环境获取配置文件\n\t// 获取 CONFIGOR_ENV 环境变量(dev/test/pro) 不设置默认 pro\n\tconfigorEnv := os.Getenv(\"CONFIGOR_ENV\")\n\tif configorEnv == \"\" {\n\t\tconfigorEnv = \"pro\"\n\t}\n\tconfigName := \"app_\" + configorEnv\n\tviper.SetConfigName(configName) // 配置文件的文件名,没有扩展名,如 .yaml, .toml 这样的扩展名\n\tviper.SetConfigType(\"yaml\") // 设置扩展名。在这里设置文件的扩展名。另外,如果配置文件的名称没有扩展名,则需要配置这个选项\n\tviper.AddConfigPath(\"conf/\") // 查找配置文件所在路径\n\terr := viper.ReadInConfig() // 搜索并读取配置文件\n\tif err != nil { // 处理错误\n\t\tpanic(fmt.Errorf(\"Fatal error open config file: %v\", err))\n\t}\n\t// 设置\n\tSetConfig()\n}", "title": "" }, { "docid": "6c8ed2cd2ce6b52d017d58d4ead25d6c", "score": "0.5252006", "text": "func initConfig() {\n\tviper.SetTypeByDefaultValue(true)\n\tviper.SetEnvPrefix(\"perf\")\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\"))\n\tviper.AutomaticEnv()\n}", "title": "" }, { "docid": "c0784e2edab59e1005eaf8803e7b295a", "score": "0.52474236", "text": "func configureFlags() {\n\t// empty for now\n}", "title": "" }, { "docid": "d66e6eb8c6d4be86b378a0462a0b6b69", "score": "0.52357274", "text": "func init() {\n\t// Config file lookup locations\n\tviper.SetConfigType(\"toml\")\n\tviper.SetConfigName(\"queuemanager\")\n\tviper.AddConfigPath(\"$HOME/.config/\")\n\tviper.AddConfigPath(\"/etc/fm/queuemanager\")\n\tviper.AddConfigPath(\"$HOME/.config/fm/queuemanager\")\n\t// Environment variables\n\tviper.AutomaticEnv()\n\tviper.SetEnvPrefix(\"queuemanager\")\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\"))\n\t// Environment variable binding\n\tviper.SetDefault(ENVIORNMENT_KEY, \"prod\") // Default env - always assume prod\n\tviper.BindEnv(CONFIG_PATH_KEY, ENVIORNMENT_KEY)\n}", "title": "" }, { "docid": "dfc44546e5f02ed37ab5907c4b08d110", "score": "0.52280587", "text": "func configureFlags(api *operations.TezTrackerAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "title": "" }, { "docid": "3493d77a1d686a77c7f1045c6b052a45", "score": "0.5226536", "text": "func Init() {\n\t// Default user for SSH clone.\n\tviper.SetDefault(GitUser, \"git\")\n\n\tviper.SetDefault(SourceBranch, \"develop\")\n\tviper.SetDefault(SortRepos, true)\n\tviper.SetDefault(UseSync, false)\n\n\tviper.SetDefault(ChannelBuffer, 100)\n\n\tif gopath, err := exec.Command(\"go\", \"env\", \"GOPATH\").Output(); err == nil {\n\t\tviper.SetDefault(EnvGopath, strings.TrimSpace(string(gopath)))\n\t}\n\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\", \"-\", \"_\"))\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\tif CfgFile != \"\" {\n\t\t// Use config file from the flag.\n\t\tviper.SetConfigFile(CfgFile)\n\t} else {\n\t\tviper.SetConfigName(\"batch-tool\")\n\n\t\t// Search in the working directory\n\t\tviper.AddConfigPath(\".\")\n\n\t\t// Search in system configuration (Linux/Darwin only)\n\t\tviper.AddConfigPath(\"/usr/local/etc/\")\n\n\t\t// Search in the executable's directory\n\t\tif ex, err := os.Executable(); err == nil {\n\t\t\tviper.AddConfigPath(filepath.Dir(ex))\n\t\t}\n\t}\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err == nil {\n\t\tfmt.Printf(\"Using config file: %v\\n\\n\", viper.ConfigFileUsed())\n\t}\n\n\t// default reviewers in the form `repo: [reviewers...]`\n\tviper.SetDefault(DefaultReviewers, map[string][]string{})\n\n\t// aliases in the form `alias: [repos...]`\n\tviper.SetDefault(RepoAliases, map[string][]string{})\n}", "title": "" }, { "docid": "1f4500ba7bc0afec4474f00a9302ef4f", "score": "0.52217066", "text": "func init() {\n\tconst (\n\t\tsilentUsage = \"silent; don't output to STDERR\"\n\t\tcwdUsage = \"the directory to verify using its checksum file\"\n\t)\n\thashUsage := fmt.Sprintf(\"the hash to use; if unspecified, the following are tried in order: %s\", strings.Join(preferredHashes, \", \"))\n\tf := &cmdVerify.Flag\n\tf.BoolVar(&silent, \"s\", false, silentUsage)\n\tf.Var(&hashFunction, \"c\", hashUsage)\n\tf.StringVar(&cwd, \"D\", \".\", cwdUsage)\n}", "title": "" }, { "docid": "b8508cdcca5d44f52c494c13b1cce15d", "score": "0.5220483", "text": "func platformFlags(flags *pflag.FlagSet) {\n}", "title": "" }, { "docid": "3ad70da3ef6484029b47a8dfe396f436", "score": "0.5219853", "text": "func EnvironmentSetupEntrypoint() {\n\tif os.Getenv(ambassadorClusterIdEnvVar) != \"\" {\n\t\treturn\n\t}\n\tambassadorRoot := \"/ambassador\"\n\tambassadorConfigBaseDir := ambassadorRoot\n\tif os.Getenv(ambassadorRootEnvVar) != \"\" {\n\t\tambassadorRoot = os.Getenv(ambassadorRootEnvVar)\n\t}\n\tif os.Getenv(ambassadorConfigBaseDirEnvVar) != \"\" {\n\t\tambassadorConfigBaseDir = os.Getenv(ambassadorConfigBaseDirEnvVar)\n\t}\n\n\t// build kubewatch.py command\n\tcmd := exec.Command(\"python3\", ambassadorRoot+\"/kubewatch.py\", \"--debug\")\n\n\t// inherit all existing environment variables & inject python's own\n\tcmd.Env = os.Environ()\n\tif os.Getenv(\"PYTHON_EGG_CACHE\") == \"\" {\n\t\tcmd.Env = append(cmd.Env, \"PYTHON_EGG_CACHE=\"+ambassadorConfigBaseDir+\"/.cache\")\n\t}\n\tcmd.Env = append(cmd.Env, \"PYTHONUNBUFFERED=true\")\n\n\t// execute and read output\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\tlog.Printf(\"%s failed with %s\\n%s\\n\", cmd.String(), err, string(out))\n\t\treturn\n\t}\n\n\t// set the AMBASSADOR_CLUSTER_ID\n\tos.Setenv(ambassadorClusterIdEnvVar, strings.TrimSpace(string(out)))\n\tlog.Printf(\"%s=%s\", ambassadorClusterIdEnvVar, os.Getenv(ambassadorClusterIdEnvVar))\n}", "title": "" }, { "docid": "36f3c3673b30eee01951d3a57cba3610", "score": "0.5218864", "text": "func init() {\n\t/*\n\t * TODO: Verify that vagrant is installed\n\t * TODO: Verify that jenkins is installed and running\n\t */\n\tflag.StringVar(&confPath, \"configurationPath\", defaultConfPath, usageConfPath)\n}", "title": "" }, { "docid": "24afdd5944a04a3259c053cd882427e4", "score": "0.5217584", "text": "func initConfig(cmd *cobra.Command) {\n\n\t//config file (fargate.yml)\n\tviper.SetConfigName(\"fargate\")\n\tviper.AddConfigPath(\"./\")\n\tviper.ReadInConfig()\n\n\t//env vars\n\tviper.BindEnv(keyCluster, \"FARGATE_CLUSTER\")\n\tviper.BindEnv(keyService, \"FARGATE_SERVICE\")\n\tviper.BindEnv(keyVerbose, \"FARGATE_VERBOSE\")\n\tviper.BindEnv(keyNoColor, \"FARGATE_NOCOLOR\")\n\tviper.BindEnv(keyTask, \"FARGATE_TASK\")\n\tviper.BindEnv(keyRule, \"FARGATE_RULE\")\n\n\t//cli arg\n\tinitPFlag(keyCluster, cmd)\n\tinitPFlag(keyVerbose, cmd)\n\tinitPFlag(keyRegion, cmd)\n\tinitPFlag(keyNoColor, cmd)\n}", "title": "" }, { "docid": "34a7eb2cac44025b5baa027530c5c488", "score": "0.52126276", "text": "func configureFlags(api *operations.FlashcardAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "title": "" }, { "docid": "8909f206cafc19965aa4fd2cabc913c0", "score": "0.5212055", "text": "func setupViper() {\n\tviper.SetConfigName(configFileName) // name of config file (without extension)\n\tviper.SetConfigType(\"yaml\") // REQUIRED if the config file does not have the extension in the name\n\tviper.AddConfigPath(\"/etc/\" + appName + \"/\") // path to look for the config file in\n\tviper.AddConfigPath(\"$HOME/.\" + appName + \"/\") // call multiple times to add many search paths\n\tviper.AddConfigPath(\".\") // optionally look for config in the working directory\n\terr := viper.ReadInConfig() // Find and read the config file\n\tif err != nil { // Handle errors reading the config file\n\t\tpanic(fmt.Errorf(\"fatal error config file: %s\", err))\n\t}\n\n\tviper.SetDefault(\"Threads\", 1)\n\tviper.SetDefault(\"CurrentDate\", dateToString(time.Now()))\n\tviper.SetDefault(\"configStopYear\", dateToString(time.Now().AddDate(-1, 0, 0)))\n\tviper.SetDefault(\"CredFile\", path.Dir(viper.ConfigFileUsed())+\"/credentials.json\")\n\tviper.SetDefault(\"TransferFromTokenFile\", path.Dir(viper.ConfigFileUsed())+\"/transferFromToken.json\")\n\tviper.SetDefault(\"TransferToTokenFile\", path.Dir(viper.ConfigFileUsed())+\"/transferToToken.json\")\n\tviper.SetDefault(\"DownloadPath\", \"/tmp/gphotos/\")\n}", "title": "" }, { "docid": "84cbd15923af64d061968d577ac0d288", "score": "0.52108514", "text": "func main() {\n if (!(*ignoreFlag)) {\n\t\t//Refresh the shell if ignore flag is not set. \n\t\t//Sorry could not find another way out once the env is cleared.\n\t\t_, err := exec.Command(\"/home/SP_19_CPS444_11/.kshrc\").Output()\n \t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error executing command %v\", err)\n \t\t}\n\t\tfor _, v := range os.Environ() {\n pair := strings.Split(v, \"=\")\n fmt.Printf(\"%v=%v\\n\",pair[0], pair[1])\n }\n }\n\t//temp varibale to hold PATH, to be reset after clear env to \n\t//execute shell commands\n\tpath := os.Getenv(\"PATH\")\n\tif (*ignoreFlag) {\n\t\tos.Clearenv()\n\t}\n\tos.Setenv(\"PATH\", path)\n\thandleFlagArguments(flag.Args())\n}", "title": "" }, { "docid": "1d155cd2c1d23c47694b4d3df8683f91", "score": "0.5204292", "text": "func (suite *TokenTestSuite) SetupSuite() {\n\tviper.Set(\"secret_key\", \"my_so_secure_key\")\n}", "title": "" }, { "docid": "1ab42294875f8df59a34afcbeb11e133", "score": "0.5203804", "text": "func init() {\n\n\tRootCmd.PersistentFlags().StringVar(&rootArgs.rootDir, \"root\",\n\t\t\"./\", \"Set root directory\")\n\n\t/*\n\t\tRootCmd.PersistentFlags().StringVar(&global.Current.NodeName, \"node\",\n\t\t\tglobal.Current.NodeName, \"Set a node name\")\n\n\t\tRootCmd.PersistentFlags().BoolVarP(&global.Current.Debug, \"debug\", \"d\",\n\t\t\tglobal.Current.Debug, \"Set DEBUG mode\")\n\n\t\tRootCmd.PersistentFlags().StringVarP(&global.Current.Config.Network.RPCAddress, \"address\", \"a\",\n\t\t\tglobal.Current.Config.Network.RPCAddress, \"full address\")\n\n\t\tRootCmd.PersistentFlags().StringVar(&global.Current.Config.Network.SDKAddress, \"sdkrpc\",\n\t\t\tglobal.Current.Config.Network.SDKAddress, \"SDK address\")\n\t*/\n}", "title": "" }, { "docid": "b1c556d9a855d398c6d2869442a257b9", "score": "0.5203498", "text": "func SetupFlagSet(fs *pflag.FlagSet) error {\n\tfs.StringP(\"parodus-local-url\", \"l\", \"tcp://127.0.0.1:6666\", \"Parodus local server url\")\n\tfs.StringP(\"service-url\", \"s\", \"tcp://127.0.0.1:13032\", \"service local url to be used by parodus\")\n\n\tfs.BoolP(\"debug\", \"\", false, \"enables debug logging\")\n\tfs.BoolP(\"version\", \"v\", false, \"print version and exit\")\n\treturn nil\n}", "title": "" }, { "docid": "ca4d255f4246f8a95b58009e806cfa1e", "score": "0.52019", "text": "func TestNewAppDefaultFlags(t *testing.T) {\n\tconfig := newcmd.NewAppConfig()\n\tconfig.Deploy = true\n\n\ttests := map[string]struct {\n\t\tflagName string\n\t\tdefaultVal string\n\t}{\n\t\t\"as test\": {\n\t\t\tflagName: \"as-test\",\n\t\t\tdefaultVal: strconv.FormatBool(config.AsTestDeployment),\n\t\t},\n\t\t\"code\": {\n\t\t\tflagName: \"code\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.SourceRepositories, \",\") + \"]\",\n\t\t},\n\t\t\"context dir\": {\n\t\t\tflagName: \"context-dir\",\n\t\t\tdefaultVal: \"\",\n\t\t},\n\n\t\t\"image-stream\": {\n\t\t\tflagName: \"image-stream\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.ImageStreams, \",\") + \"]\",\n\t\t},\n\t\t\"image\": {\n\t\t\tflagName: \"image\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.DockerImages, \",\") + \"]\",\n\t\t},\n\t\t\"template\": {\n\t\t\tflagName: \"template\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.Templates, \",\") + \"]\",\n\t\t},\n\t\t\"file\": {\n\t\t\tflagName: \"file\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.TemplateFiles, \",\") + \"]\",\n\t\t},\n\t\t\"param\": {\n\t\t\tflagName: \"param\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.TemplateParameters, \",\") + \"]\",\n\t\t},\n\t\t\"group\": {\n\t\t\tflagName: \"group\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.Groups, \",\") + \"]\",\n\t\t},\n\t\t\"env\": {\n\t\t\tflagName: \"env\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.Environment, \",\") + \"]\",\n\t\t},\n\t\t\"build-env\": {\n\t\t\tflagName: \"build-env\",\n\t\t\tdefaultVal: \"[\" + strings.Join(config.BuildEnvironment, \",\") + \"]\",\n\t\t},\n\t\t\"name\": {\n\t\t\tflagName: \"name\",\n\t\t\tdefaultVal: config.Name,\n\t\t},\n\t\t\"strategy\": {\n\t\t\tflagName: \"strategy\",\n\t\t\tdefaultVal: \"\",\n\t\t},\n\t\t\"labels\": {\n\t\t\tflagName: \"labels\",\n\t\t\tdefaultVal: \"\",\n\t\t},\n\t\t\"insecure-registry\": {\n\t\t\tflagName: \"insecure-registry\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"list\": {\n\t\t\tflagName: \"list\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"search\": {\n\t\t\tflagName: \"search\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"allow-missing-images\": {\n\t\t\tflagName: \"allow-missing-images\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"allow-missing-imagestream-tags\": {\n\t\t\tflagName: \"allow-missing-imagestream-tags\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"grant-install-rights\": {\n\t\t\tflagName: \"grant-install-rights\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"no-install\": {\n\t\t\tflagName: \"no-install\",\n\t\t\tdefaultVal: strconv.FormatBool(false),\n\t\t},\n\t\t\"output-version\": {\n\t\t\tflagName: \"output-version\",\n\t\t\tdefaultVal: \"\",\n\t\t},\n\t}\n\n\tcmd := NewCmdNewApplication(nil, genericclioptions.NewTestIOStreamsDiscard())\n\n\tfor _, v := range tests {\n\t\tf := cmd.Flag(v.flagName)\n\t\tif f == nil {\n\t\t\tt.Fatalf(\"expected flag %s to be registered but found none\", v.flagName)\n\t\t}\n\n\t\tif f.DefValue != v.defaultVal {\n\t\t\tt.Errorf(\"expected default value of %s for %s but found %s\", v.defaultVal, v.flagName, f.DefValue)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dfecd1aee3c3e502b7ee7249f68c2c10", "score": "0.5201247", "text": "func validateSettings(b *Engine, s *Settings, flagSet map[string]bool) {\n\tb.Settings.Verbose = s.Verbose\n\tb.Settings.EnableDryRun = s.EnableDryRun\n\tb.Settings.EnableAllExchanges = s.EnableAllExchanges\n\tb.Settings.EnableAllPairs = s.EnableAllPairs\n\tb.Settings.EnableCoinmarketcapAnalysis = s.EnableCoinmarketcapAnalysis\n\tb.Settings.EnableDatabaseManager = s.EnableDatabaseManager\n\tb.Settings.EnableGCTScriptManager = s.EnableGCTScriptManager && (flagSet[\"gctscriptmanager\"] || b.Config.GCTScript.Enabled)\n\tb.Settings.MaxVirtualMachines = s.MaxVirtualMachines\n\tb.Settings.EnableDispatcher = s.EnableDispatcher\n\tb.Settings.EnablePortfolioManager = s.EnablePortfolioManager\n\tb.Settings.WithdrawCacheSize = s.WithdrawCacheSize\n\tif b.Settings.EnablePortfolioManager {\n\t\tif b.Settings.PortfolioManagerDelay == time.Duration(0) && s.PortfolioManagerDelay > 0 {\n\t\t\tb.Settings.PortfolioManagerDelay = s.PortfolioManagerDelay\n\t\t} else {\n\t\t\tb.Settings.PortfolioManagerDelay = PortfolioSleepDelay\n\t\t}\n\t}\n\n\tif flagSet[\"grpc\"] {\n\t\tb.Settings.EnableGRPC = s.EnableGRPC\n\t} else {\n\t\tb.Settings.EnableGRPC = b.Config.RemoteControl.GRPC.Enabled\n\t}\n\n\tif flagSet[\"grpcproxy\"] {\n\t\tb.Settings.EnableGRPCProxy = s.EnableGRPCProxy\n\t} else {\n\t\tb.Settings.EnableGRPCProxy = b.Config.RemoteControl.GRPC.GRPCProxyEnabled\n\t}\n\n\tif flagSet[\"websocketrpc\"] {\n\t\tb.Settings.EnableWebsocketRPC = s.EnableWebsocketRPC\n\t} else {\n\t\tb.Settings.EnableWebsocketRPC = b.Config.RemoteControl.WebsocketRPC.Enabled\n\t}\n\n\tif flagSet[\"deprecatedrpc\"] {\n\t\tb.Settings.EnableDeprecatedRPC = s.EnableDeprecatedRPC\n\t} else {\n\t\tb.Settings.EnableDeprecatedRPC = b.Config.RemoteControl.DeprecatedRPC.Enabled\n\t}\n\n\tif flagSet[\"maxvirtualmachines\"] {\n\t\tmaxMachines := uint8(s.MaxVirtualMachines)\n\t\tb.GctScriptManager.MaxVirtualMachines = &maxMachines\n\t}\n\n\tif flagSet[\"withdrawcachesize\"] {\n\t\twithdraw.CacheSize = s.WithdrawCacheSize\n\t}\n\n\tb.Settings.EnableCommsRelayer = s.EnableCommsRelayer\n\tb.Settings.EnableEventManager = s.EnableEventManager\n\n\tif b.Settings.EnableEventManager {\n\t\tif b.Settings.EventManagerDelay != time.Duration(0) && s.EventManagerDelay > 0 {\n\t\t\tb.Settings.EventManagerDelay = s.EventManagerDelay\n\t\t} else {\n\t\t\tb.Settings.EventManagerDelay = EventSleepDelay\n\t\t}\n\t}\n\n\tb.Settings.EnableConnectivityMonitor = s.EnableConnectivityMonitor\n\tb.Settings.EnableNTPClient = s.EnableNTPClient\n\tb.Settings.EnableOrderManager = s.EnableOrderManager\n\tb.Settings.EnableExchangeSyncManager = s.EnableExchangeSyncManager\n\tb.Settings.EnableTickerSyncing = s.EnableTickerSyncing\n\tb.Settings.EnableOrderbookSyncing = s.EnableOrderbookSyncing\n\tb.Settings.EnableTradeSyncing = s.EnableTradeSyncing\n\tb.Settings.SyncWorkers = s.SyncWorkers\n\tb.Settings.SyncTimeout = s.SyncTimeout\n\tb.Settings.SyncContinuously = s.SyncContinuously\n\tb.Settings.EnableDepositAddressManager = s.EnableDepositAddressManager\n\tb.Settings.EnableExchangeAutoPairUpdates = s.EnableExchangeAutoPairUpdates\n\tb.Settings.EnableExchangeWebsocketSupport = s.EnableExchangeWebsocketSupport\n\tb.Settings.EnableExchangeRESTSupport = s.EnableExchangeRESTSupport\n\tb.Settings.EnableExchangeVerbose = s.EnableExchangeVerbose\n\tb.Settings.EnableExchangeHTTPRateLimiter = s.EnableExchangeHTTPRateLimiter\n\tb.Settings.EnableExchangeHTTPDebugging = s.EnableExchangeHTTPDebugging\n\tb.Settings.DisableExchangeAutoPairUpdates = s.DisableExchangeAutoPairUpdates\n\tb.Settings.ExchangePurgeCredentials = s.ExchangePurgeCredentials\n\tb.Settings.EnableWebsocketRoutine = s.EnableWebsocketRoutine\n\n\t// Checks if the flag values are different from the defaults\n\tb.Settings.MaxHTTPRequestJobsLimit = s.MaxHTTPRequestJobsLimit\n\tif b.Settings.MaxHTTPRequestJobsLimit != int(request.DefaultMaxRequestJobs) &&\n\t\ts.MaxHTTPRequestJobsLimit > 0 {\n\t\trequest.MaxRequestJobs = int32(b.Settings.MaxHTTPRequestJobsLimit)\n\t}\n\n\tb.Settings.TradeBufferProcessingInterval = s.TradeBufferProcessingInterval\n\tif b.Settings.TradeBufferProcessingInterval != trade.DefaultProcessorIntervalTime {\n\t\tif b.Settings.TradeBufferProcessingInterval >= time.Second {\n\t\t\ttrade.BufferProcessorIntervalTime = b.Settings.TradeBufferProcessingInterval\n\t\t} else {\n\t\t\tb.Settings.TradeBufferProcessingInterval = trade.DefaultProcessorIntervalTime\n\t\t\tgctlog.Warnf(gctlog.Global, \"-tradeprocessinginterval must be >= to 1 second, using default value of %v\",\n\t\t\t\ttrade.DefaultProcessorIntervalTime)\n\t\t}\n\t}\n\n\tb.Settings.RequestMaxRetryAttempts = s.RequestMaxRetryAttempts\n\tif b.Settings.RequestMaxRetryAttempts != request.DefaultMaxRetryAttempts && s.RequestMaxRetryAttempts > 0 {\n\t\trequest.MaxRetryAttempts = b.Settings.RequestMaxRetryAttempts\n\t}\n\n\tb.Settings.HTTPTimeout = s.HTTPTimeout\n\tif s.HTTPTimeout != time.Duration(0) && s.HTTPTimeout > 0 {\n\t\tb.Settings.HTTPTimeout = s.HTTPTimeout\n\t} else {\n\t\tb.Settings.HTTPTimeout = b.Config.GlobalHTTPTimeout\n\t}\n\n\tb.Settings.HTTPUserAgent = s.HTTPUserAgent\n\tb.Settings.HTTPProxy = s.HTTPProxy\n\n\tif s.GlobalHTTPTimeout != time.Duration(0) && s.GlobalHTTPTimeout > 0 {\n\t\tb.Settings.GlobalHTTPTimeout = s.GlobalHTTPTimeout\n\t} else {\n\t\tb.Settings.GlobalHTTPTimeout = b.Config.GlobalHTTPTimeout\n\t}\n\tcommon.HTTPClient = common.NewHTTPClientWithTimeout(b.Settings.GlobalHTTPTimeout)\n\n\tb.Settings.GlobalHTTPUserAgent = s.GlobalHTTPUserAgent\n\tif b.Settings.GlobalHTTPUserAgent != \"\" {\n\t\tcommon.HTTPUserAgent = b.Settings.GlobalHTTPUserAgent\n\t}\n\n\tb.Settings.GlobalHTTPProxy = s.GlobalHTTPProxy\n\tb.Settings.DispatchMaxWorkerAmount = s.DispatchMaxWorkerAmount\n\tb.Settings.DispatchJobsLimit = s.DispatchJobsLimit\n}", "title": "" }, { "docid": "4690916aa8ff52532a37cf8d645dfe87", "score": "0.5200851", "text": "func checkFlagsSet() {\n\tflag.VisitAll(func(f *flag.Flag) {\n\t\tif f.Value.String() == \"\" {\n\t\t\tpanic(fmt.Sprintf(\"Missing environment: %s\", f.Name))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "e63527f7463f4d3a656b31976bbb1ca4", "score": "0.519551", "text": "func Check_variable() string {\n\t// get Local IP address automatically\n\tdefault_ip, err := netutil.ChooseHostInterface()\n\tklevr_tmp_server := \"localhost:8080\"\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get IP address: %v\", err)\n\t}\n\n\t// Flag options\n\t// Sample: -apiKey=\\\"{apiKey}\\\" -platform={platform} -manager=\\\"{managerUrl}\\\" -zoneId={zoneId}\n\tapikey := flag.String(\"apiKey\", \"\", \"API Key from Klevr service\")\n\tplatform := flag.String(\"platform\", \"\", \"[baremetal|aws] - Service Platform for Host build up\")\n\tzone := flag.String(\"zoneId\", \"dev-zone\", \"zone will be a [Dev/Stg/Prod]\")\n\tlocal_ip := flag.String(\"ip\", default_ip.String(), \"local IP address for networking\")\n\tklevr_addr := flag.String(\"manager\", klevr_tmp_server, \"Klevr webconsole(server) address (URL or IP, Optional: Port) for connect\")\n\n\tflag.Parse() // Important for parsing\n\n\t// Check the null data from CLI\n\tif len(*apikey) == 0 {\n\t\tfmt.Println(\"Please insert an API Key\")\n\t\tos.Exit(0)\n\t}\n\tif len(*platform) == 0 {\n\t\tfmt.Println(\"Please make sure the platform\")\n\t\tos.Exit(0)\n\t}\n\tif len(*local_ip) == 0 {\n\t\tLocal_ip_add = default_ip.String()\n\t} else {\n\t\tLocal_ip_add = *local_ip\n\t}\n\n\tif len(*klevr_addr) == 0 {\n\t\tklevr_tmp_server = klevr_tmp_server\n\t} else {\n\t\tklevr_tmp_server = *klevr_addr\n\t}\n\n\tKlevr_console = \"http://\" + klevr_tmp_server\n\n\t// Check for the Print\n\tAPI_key_id = *apikey\n\tfmt.Println(\"Account:\", API_key_id)\n\tmca := Get_mac()\n\t//base_info := \"User Account ID + MAC address as a HW + local IP address\"\n\tbase_info := *apikey + mca + *local_ip\n\t_, err = ioutil.ReadFile(Klevr_agent_id_file)\n\tif err != nil {\n\t\thash_create(base_info)\n\t}\n\tPlatform_type = string(*platform)\n\tKlevr_zone = string(*zone)\n\n\treturn Platform_type\n\treturn Local_ip_add\n\treturn API_key_id\n\treturn Klevr_console\n\treturn Klevr_zone\n\n\treturn Api_key_string\n}", "title": "" }, { "docid": "05b114655c0d39771c4da0c9bed75864", "score": "0.5193007", "text": "func init() {\n\trootCmd.AddCommand(firstbootCompleteMachineconfig)\n\tpflag.CommandLine.AddGoFlagSet(flag.CommandLine)\n}", "title": "" }, { "docid": "c916abc71d03c9d1a2f411cf36417d56", "score": "0.51927555", "text": "func init() {\n\tflag.StringVar(&addr, \"addr\", \":9096\", \"listening address(eg. :9096)\")\n\tflag.StringVar(&cert, \"cert\", \"\", \"certificate file path\")\n\tflag.StringVar(&certKey, \"key\", \"\", \"key file path\")\n\tflag.IntVar(&wt, \"wt\", 30, \"write timeout in second\")\n\tflag.IntVar(&rt, \"rt\", 30, \"read timeout in second\")\n\tflag.StringVar(&configFileName, \"conf\", \"./configs/server.yml\", \"config file name\")\n\tflag.StringVar(&loggerFileName, \"logger\", \"./configs/logger.yml\", \"logger config file name\")\n\tflag.BoolVar(&dumpvar, \"d\", true, \"Dump requests and responses\")\n\n\tflag.BoolVar(&printVersion, \"version\", false, \"print version\")\n\tflag.IntVar(&tickIntervalSec, \"tick\", 60, \"tick interval in second\")\n\n}", "title": "" }, { "docid": "124dd69a5fe8be374bda53407a8208d9", "score": "0.5189998", "text": "func (f *cliFlags) addFlag(c *cobra.Command, targetVar interface{}, name string, defaultValue string, required bool, desc2 string) {\n\tv := reflect.ValueOf(targetVar)\n\tif v.Kind() != reflect.Ptr {\n\t\tfmt.Println(\"error adding flag: targetVar must be a pointer\")\n\t\tos.Exit(1)\n\t}\n\tsw := f.getCliFlag(name, defaultValue, config.Main.Get) // get the cliFlag details, with defaults taken from config or the supplied defaultValue\n\tdesc := sw.desc + desc2 // create the full flag description for use below\n\t// Apply the flag.\n\tswitch p := targetVar.(type) {\n\tcase *string:\n\t\tif twelveFactorMode {\n\t\t\t*p = sw.val\n\t\t} else {\n\t\t\tc.Flags().StringVarP(p, sw.name, sw.shortHand, sw.val, desc)\n\t\t\t// Signal that the flag was set so defaults take effect.\n\t\t\tif sw.val != \"\" { // if there is a value via config or default...\n\t\t\t\tmustSetFlag(c.Flags(), sw.name, sw.val)\n\t\t\t}\n\t\t}\n\tcase *bool:\n\t\tif twelveFactorMode {\n\t\t\t// Convert any string value into True.\n\t\t\tif sw.val != \"\" {\n\t\t\t\t*p = true\n\t\t\t} else {\n\t\t\t\t*p = false\n\t\t\t}\n\t\t} else {\n\t\t\tdefaultBool := false\n\t\t\tif strings.ToLower(sw.val) == \"true\" { // TODO: test that boolean config values stored in Main work for True as well as true.\n\t\t\t\tdefaultBool = true\n\t\t\t}\n\t\t\tc.Flags().BoolVarP(p, sw.name, sw.shortHand, defaultBool, desc)\n\t\t\t// Signal that the flag was set so defaults take effect.\n\t\t\tif defaultBool {\n\t\t\t\tmustSetFlag(c.Flags(), sw.name, \"true\")\n\t\t\t} else {\n\t\t\t\tmustSetFlag(c.Flags(), sw.name, \"false\")\n\t\t\t}\n\t\t}\n\tcase *int:\n\t\tdefaultInt, err := strconv.Atoi(sw.val)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"the value for flag %q must be an integer: %v\\n\", sw.name, err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif twelveFactorMode {\n\t\t\t*p = defaultInt\n\t\t} else {\n\t\t\tc.Flags().IntVarP(p, sw.name, sw.shortHand, defaultInt, desc)\n\t\t\t// Signal that the flag was set so defaults take effect.\n\t\t\tif sw.val != \"\" { // if there is a value via config or default...\n\t\t\t\tmustSetFlag(c.Flags(), sw.name, sw.val)\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tpanic(\"Error: unhandled CLI flag target value type\")\n\t}\n\t// Optionally mark the flag as mandatory.\n\tif required && !twelveFactorMode { // if the flag is required...\n\t\t_ = c.MarkFlagRequired(sw.name)\n\t}\n}", "title": "" }, { "docid": "f21f6859470331867d4535ec4f706e17", "score": "0.51885164", "text": "func Flags() {\n\t{ //flag declaring and parsing\n\n\t\tflag.BoolVar(&conf.isVersion, \"version\", false, \"prints version information\")\n\t\t{ //on demande le help, commit ou version\n\t\t\tflag.BoolVar(&conf.isGitCommit, \"commit\", false, \"prints the git commit the code was compiled on\")\n\t\t}\n\t\t{ //standard\n\t\t\t//port number\n\t\t\tflag.StringVar(&conf.port, \"port\", \"8080\", \"defines the TCP port on which the web server is going to serve (must be a valid port number)\") // le port (par défault c'est le 8080)\n\n\t\t\t//working dir\n\t\t\tflag.StringVar(&conf.WorkingDir, \"dir\", defaultWorkingDir, \"defines the directory the server is goig to serve\") //le scope du serveur(les fichiers qui seront servit)\n\t\t\t//\t par défault c'est le fichier duquel le programme a été commencé\n\n\t\t}\n\n\t\t{ //log/info/debugging/on veut du text de couleur\n\t\t\tflag.BoolVar(&conf.isVerbose, \"v\", false, \"make the program more verbose\") //si on dit pleins d'informations\n\t\t\tflag.IntVar(&conf.verbosityLevel, \"V\", 0, \"sets the degree of verbosity of the program\") //le niveau d'information plus ou moins utiles que l'on dit\n\n\t\t\tflag.BoolVar(&conf.isDebug, \"D\", false, \"used to show internal values usefule for debuging\")\n\n\t\t\tflag.BoolVar(&conf.isTellTime, \"telltime\", false, \"each log entry will tell the time it was printed\")\n\t\t}\n\t\t{ //HTTPS\n\t\t\tflag.BoolVar(&conf.isTLS, \"tls\", false, \"enables tls encryption (not yet implemented)\") //si on utilise une encryption\n\t\t\tflag.StringVar(&conf.PathCertFile, \"certfile\", \"\", \"the location of the TLS certificate file\")\n\t\t\tflag.StringVar(&conf.PathKeyFile, \"keyfile\", \"\", \"the location of the TLS key file\")\n\t\t}\n\t\t{ //server specific := time.Unix(1<<63-1, 0)\n\t\t\tflag.BoolVar(&conf.isKeepAliveEnabled, \"A\", true, \"enables http keep-alives\")\n\t\t\tflag.DurationVar(&conf.shutdowmTimeout, \"shutdown-timeout\", time.Second*10, \"time the server waits for current connections when shutting down\")\n\t\t\tflag.DurationVar(&conf.requestTimeout, \"request-timeout\", MaxDuration, \"the time the server will wait for the request\")\n\t\t\tflag.StringVar(&conf.mode, \"mode\", \"\", \"sets server mode\")\n\t\t\t{ // web ui flags\n\t\t\t\tflag.BoolVar(&conf.isWebUIEnabled, \"webui\", false, \"enables web ui\")\n\t\t\t\tflag.IntVar(&conf.webUIport, \"uiport\", 8080, \"specifies web ui port\")\n\t\t\t}\n\t\t}\n\n\t\tflag.BoolVar(&conf.isColorEnabled, \"color\", true, \"enables or disables color in terminal log\")\n\n\t\t{ //auth flags\n\t\t\tflag.BoolVar(&conf.isAuthEnabled, \"auth\", false, \"enable password access\")\n\t\t\tflag.StringVar(&conf.authPassword, \"p\", \"\", \"sets the required password when authentification is enabled\")\n\t\t\tflag.StringVar(&conf.authUsername, \"u\", \"\", \"sets the required password when authentification is enabled\")\n\t\t}\n\n\t\t{ // file server (mode is fileServer)\n\n\t\t}\n\n\t\tflag.Parse() //on interprète\n\t\tif conf.isVersion {\n\t\t\tfmt.Fprintf(os.Stderr,\n\t\t\t\t\"git commit: %s\\ncpu architecture: %s\\noperation system: %s\\n\",\n\t\t\t\tgitCommit,\n\t\t\t\truntime.GOARCH,\n\t\t\t\truntime.GOOS,\n\t\t\t)\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif conf.isGitCommit {\n\t\t\tfmt.Println(gitCommit)\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1daa500aba855f92dd28be0c377493a7", "score": "0.5183408", "text": "func bindFlags() {\n\tflag.Parse()\n\tviper.BindPFlags(flag.CommandLine)\n}", "title": "" }, { "docid": "326bfb249f4d83ecb413dcb905538c14", "score": "0.51705647", "text": "func init() {\n\tflag.StringVar(&serverip, \"ip\", \"127.0.0.1\", \"设置服务器地址(默认127.0.0.1)\")\n\tflag.IntVar(&serverport, \"port\", 8888, \"设置服务器端口(默认8888)\")\n}", "title": "" }, { "docid": "45865d30f07a4f30f41fb7024942d89b", "score": "0.5168519", "text": "func init() {\n\tflag.StringVar(&serverIP, \"ip\", \"127.0.0.1\", \"设置服务器IP地址(默认是127.0.0.1)\")\n\tflag.IntVar(&serverPort, \"port\", 8888, \"设置服务器端口(默认是8888)\")\n}", "title": "" }, { "docid": "440c7437bbb154b3832c65cd760b434c", "score": "0.5166024", "text": "func configureFlags(api *operations.KymaDroneAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "title": "" }, { "docid": "8586fd9b1b89d45b0276b9a8b10f646c", "score": "0.51654905", "text": "func GenEnvSetup(appName string) string {\n\tvar str util.StringBuilder\n\tvar intName string\n\n\tfor _, v := range mainStruct.Flags {\n\t\tif len(v.Internal) > 0 {\n\t\t\tintName = v.Internal\n\t\t} else {\n\t\t\tintName = v.Name\n\t\t}\n\t\tstr.WriteStringf(\"\\twrk = os.Getenv(\\\"%s_%s\\\")\\n\", appName, strings.ToUpper(v.Name))\n\t\tstr.WriteString(\"\\tif len(wrk)>0 {\\n\")\n\t\tstr.WriteStringf(\"\\t\\t%s = wrk\\n\", intName)\n\t\tstr.WriteString(\"\\t}\\n\")\n\t}\n\treturn str.String()\n}", "title": "" }, { "docid": "ae40e601e0165a8406e4aabd7da2f787", "score": "0.51625603", "text": "func initEnv(prefix string) {\n\tcopyEnvVars(prefix)\n\n\t// env variables with TM prefix (eg. TM_ROOT)\n\tviper.SetEnvPrefix(prefix)\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\", \"-\", \"_\"))\n\tviper.AutomaticEnv()\n}", "title": "" }, { "docid": "ca10d31e4f0dd8c32cf7ea1650b34456", "score": "0.5160122", "text": "func InitEnv(cmd *cobra.Command, args []string) {\n\t// grab our workspace\n\tworkspace := viper.GetString(\"workspace\")\n\t// check to see if it exists\n\tif _, err := os.Stat(fmt.Sprintf(\"%s\", workspace)); err == nil {\n\t\tlog.Info().Msg(\"Found existing project. Health Checking.\")\n\t} else {\n\t\tlog.Info().Msgf(\"Creating project at %s.\", workspace)\n\t\terr := os.Mkdir(workspace, 0755)\n\t\tif err != nil {\n\t\t\tlog.Error().Err(err).Msgf(\"Could not create project\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\t// spin up consul\n\tconsulInstance, err := consul.NewService(workspace)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\terr = startService(consulInstance)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\n\t// spin up vault\n\tvaultInstance, err := vault.NewService(workspace)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\terr = startService(vaultInstance)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\t// configure our vault backents\n\terr = vaultInstance.ConfigureBackends()\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\n\t// spin up nomad\n\tnomadInstance, err := nomad.NewService(workspace, consulInstance.Address, vaultInstance.Address, vaultInstance.RootToken)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\terr = startService(nomadInstance)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n}", "title": "" } ]
e1a7ba2d43d38eb36662e8db3d24b687
Determine the index of the glyph that was the input in the given slot within the input class, and place the corresponding glyph from the output class in the current slot. The slot number is relative to the current input position.
[ { "docid": "b29d7d5f461fec120fa214eb01107bff", "score": "0.41798258", "text": "func putSubs(reg *regbank, st *stack, args []byte) ([]byte, bool) {\n\tslotRef := int8(args[0])\n\n\tinputClass := uint16(args[1])<<8 | uint16(args[2])\n\toutputClass := uint16(args[3])<<8 | uint16(args[4])\n\tslot := reg.slotAt(slotRef)\n\tseg := reg.smap.segment\n\tif slot != nil {\n\t\tindex := seg.silf.classMap.findClassIndex(inputClass, slot.glyphID)\n\t\treg.is.setGlyph(seg, seg.silf.classMap.getClassGlyph(outputClass, index))\n\t}\n\treturn args[5:], st.top < stackMax\n}", "title": "" } ]
[ { "docid": "9c71606f61cc205ec2cc8b5f4bb2e515", "score": "0.55463547", "text": "func slotToIdx(slot uint) uint {\n\treturn slot - MinPwr\n}", "title": "" }, { "docid": "4843944e4cda112a5e6f60e5d3dd568c", "score": "0.5522721", "text": "func slotToIndex(slot int) int32 {\n\treturn int32(-slot - 1)\n}", "title": "" }, { "docid": "9d7070faec8993434a0787a12b2f0833", "score": "0.52415967", "text": "func indexToSlot(index int32) int {\n\treturn int(-index - 1)\n}", "title": "" }, { "docid": "5e1241045a5d7ffaa2dfcf732486b03d", "score": "0.52364993", "text": "func idxToSlot(idx uint) uint {\n\treturn idx + MinPwr\n}", "title": "" }, { "docid": "520c9eb595f14f2dfcff837be9bed4be", "score": "0.4962641", "text": "func putGlyph(reg *regbank, st *stack, args []byte) ([]byte, bool) {\n\toutputClass := uint16(args[0])<<8 | uint16(args[1])\n\tseg := reg.smap.segment\n\treg.is.setGlyph(seg, seg.silf.classMap.getClassGlyph(outputClass, 0))\n\treturn args[2:], st.top < stackMax\n}", "title": "" }, { "docid": "d854d817795da8ddeb24786a920ec414", "score": "0.45707038", "text": "func (latches *Latches) slotID(key []byte) int {\n\treturn int(murmur3.Sum32(key)) & (len(latches.slots) - 1)\n}", "title": "" }, { "docid": "45b6f22726c28cf85efdd4c03bac6405", "score": "0.4516085", "text": "func (s *BaseFoxySheepListener) EnterSlotSequenceDigits(ctx *SlotSequenceDigitsContext) {}", "title": "" }, { "docid": "7d9efd08eac0ceadc09bd5d5fd7c4639", "score": "0.45137075", "text": "func slotToAnimRow(slot uint) uint {\n\treturn TPad + MaxPwr - slotToIdx(slot) - 1\n}", "title": "" }, { "docid": "5157c067c55fcfe69a713d912d4e4576", "score": "0.4478353", "text": "func (s *BaseFoxySheepListener) EnterSlotSequence(ctx *SlotSequenceContext) {}", "title": "" }, { "docid": "2df9df0b2538e2fe2cde71be29c0a929", "score": "0.44738433", "text": "func (s *slot) Position() int {\n\treturn s.slotNo\n}", "title": "" }, { "docid": "ba39c22346718562edebdf96d1f4ab1a", "score": "0.44248492", "text": "func (cdef *ClassDefinitions) Lookup(glyph GlyphIndex) int {\n\treturn cdef.records.Lookup(glyph)\n}", "title": "" }, { "docid": "6240e8e36aa975ffb457fb695c6a55ca", "score": "0.44246724", "text": "func (s *BaseFoxySheepListener) EnterSlotDigits(ctx *SlotDigitsContext) {}", "title": "" }, { "docid": "dd16f655d10f9c6d8089301390db3fc3", "score": "0.44039157", "text": "func (t *Table) GetByteSlot(slot VOffsetT, d byte) byte {\n\toff := t.Offset(slot)\n\tif off == 0 {\n\t\treturn d\n\t}\n\n\treturn t.GetByte(t.Pos + UOffsetT(off))\n}", "title": "" }, { "docid": "893137c460a6742053fdd1b0cf75c67c", "score": "0.43660632", "text": "func (slot InventoryWeaponSlot) SetInUse(subclass object.Subclass, objType object.Type) {\n\trawData := slot.rawData()\n\tcopy(rawData, freeWeaponSlot())\n\trawData[0] = byte(subclass)\n\trawData[1] = byte(objType)\n}", "title": "" }, { "docid": "9a6246e5d077b09f95110bd4962b6304", "score": "0.4362881", "text": "func (u *Unicode) At(input int) int {\n\treturn u.wmap[input]\n}", "title": "" }, { "docid": "b75ce6f7d389a66473aefc7bf6b5f4bd", "score": "0.43469924", "text": "func (seg *Segment) reverseSlots() {\n\tseg.dir = seg.dir ^ 1<<reverseBit // invert the reverse flag\n\tif seg.First == seg.last {\n\t\treturn\n\t} // skip 0 or 1 glyph runs\n\n\tvar (\n\t\tcurr = seg.First\n\t\tt, tlast, tfirst, out *Slot\n\t)\n\n\tfor curr != nil && seg.getSlotBidiClass(curr) == 16 {\n\t\tcurr = curr.Next\n\t}\n\tif curr == nil {\n\t\treturn\n\t}\n\ttfirst = curr.prev\n\ttlast = curr\n\n\tfor curr != nil {\n\t\tif seg.getSlotBidiClass(curr) == 16 {\n\t\t\td := curr.Next\n\t\t\tfor d != nil && seg.getSlotBidiClass(d) == 16 {\n\t\t\t\td = d.Next\n\t\t\t}\n\t\t\tif d != nil {\n\t\t\t\td = d.prev\n\t\t\t} else {\n\t\t\t\td = seg.last\n\t\t\t}\n\t\t\tp := out.Next // one after the diacritics. out can't be null\n\t\t\tif p != nil {\n\t\t\t\tp.prev = d\n\t\t\t} else {\n\t\t\t\ttlast = d\n\t\t\t}\n\t\t\tt = d.Next\n\t\t\td.Next = p\n\t\t\tcurr.prev = out\n\t\t\tout.Next = curr\n\t\t} else { // will always fire first time round the loop\n\t\t\tif out != nil {\n\t\t\t\tout.prev = curr\n\t\t\t}\n\t\t\tt = curr.Next\n\t\t\tcurr.Next = out\n\t\t\tout = curr\n\t\t}\n\t\tcurr = t\n\t}\n\tout.prev = tfirst\n\tif tfirst != nil {\n\t\ttfirst.Next = out\n\t} else {\n\t\tseg.First = out\n\t}\n\tseg.last = tlast\n}", "title": "" }, { "docid": "ebcacbd0efb1a275c0df33b26070440c", "score": "0.43331748", "text": "func (s *BaseFoxySheepListener) EnterSlot(ctx *SlotContext) {}", "title": "" }, { "docid": "00e2c0916d20ca3c1a912c7e4afb3265", "score": "0.43216246", "text": "func (bng *binning1D) coordToIndex(x float64) int {\n\tswitch {\n\tdefault:\n\t\ti := int((x - bng.xrange.Min) * bng.xstep)\n\t\treturn i\n\tcase x < bng.xrange.Min:\n\t\treturn UnderflowBin\n\tcase x >= bng.xrange.Max:\n\t\treturn OverflowBin\n\t}\n}", "title": "" }, { "docid": "ba115ba1262e2dcf0c9af42ff9f816b4", "score": "0.4287488", "text": "func (l Lookup) Lookup(g uint32) NavLocation {\n\t// inx, ok := l.coverage.GlyphRange.Lookup(GlyphIndex(g >> 16))\n\t// if !ok {\n\t// \treturn fontBinSegm{}\n\t// }\n\t// trace().Debugf(\"lookup of 0x%x -> %d\", g, inx)\n\treturn fontBinSegm{} // TODO\n}", "title": "" }, { "docid": "da8bc0677d44ab2b67994a8cbaea0a40", "score": "0.4280471", "text": "func getDigitAtPosition(input, position int) int {\n\treturn (input / int(math.Pow10(position-1))) % 10\n}", "title": "" }, { "docid": "9f32552bf4f40d138b70ce951a4ec904", "score": "0.42784792", "text": "func (s *slot) UpdatePosition(position int) *slot {\n\ts.slotNo = position\n\treturn s\n}", "title": "" }, { "docid": "ae89c6d7435737b1f641e045bfaa5795", "score": "0.42600274", "text": "func (r *Render) toPos(cursor int) (x, y int) {\n\tcol := int(r.col)\n\treturn cursor % col, cursor / col\n}", "title": "" }, { "docid": "bbeb427c8b14c1076c53701e148de06a", "score": "0.42272258", "text": "func (s *solver) cellIndex(p position) int {\n\treturn p.y*s.width + p.x\n}", "title": "" }, { "docid": "0c4540c244bc1604371d4d03e42029d6", "score": "0.422148", "text": "func (inst *Instance) Slot(name string) (interface{}, error) {\n\tcl := inst.Class()\n\t_, err := cl.Slot(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn inst.slotValue(name), nil\n}", "title": "" }, { "docid": "4f04850344e0af654e962abbf0baa49c", "score": "0.42168567", "text": "func animRowToSlot(row uint) uint {\n\treturn idxToSlot(TPad + MaxPwr - row - 1)\n}", "title": "" }, { "docid": "13b0773a9f4026da240d379559dbd05e", "score": "0.42120016", "text": "func (t *Table) GetInt8Slot(slot VOffsetT, d int8) int8 {\n\toff := t.Offset(slot)\n\tif off == 0 {\n\t\treturn d\n\t}\n\n\treturn t.GetInt8(t.Pos + UOffsetT(off))\n}", "title": "" }, { "docid": "266de102cf398c6ababf48cc10e66daf", "score": "0.42114908", "text": "func lookupAndReturn(index *varArray, ginx int, deep bool) NavLocation {\n\toutglyph, err := index.Get(ginx, deep)\n\tif err != nil {\n\t\treturn fontBinSegm{}\n\t}\n\treturn outglyph\n}", "title": "" }, { "docid": "6dd3e217cfa2e3b915c8834f5a09089b", "score": "0.41877127", "text": "func (i *index) Write(off uint32, pos uint64) error {\r\n\t// Validate we have space.\r\n\tif uint64(len(i.mmap)) < i.size+entWidth {\r\n\t\treturn io.EOF // Need a new Segment?\r\n\t}\r\n\r\n\t// Encode offset & position and write them to mmap file.\r\n\tenc.PutUint32(i.mmap[i.size:i.size+offWidth], off)\r\n\tenc.PutUint64(i.mmap[i.size+offWidth:i.size+entWidth], pos)\r\n\r\n\t// Increment for next write.\r\n\ti.size += uint64(entWidth)\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9cb940d85baf1b01f3f3cbf575e5b96d", "score": "0.4186167", "text": "func (swb *SimpleWordBreaker) CodePointClassFor(r rune) int {\n\tif unicode.IsSpace(r) {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "49443fc2f5ee63a85b85b2ee4121ba42", "score": "0.4185326", "text": "func (m *Mapbased) getMapProofWithIndexSlot(ctx context.Context, holder common.Address,\n\tblock *big.Int, islot int) (*ethstorageproof.StorageProof, error) {\n\tslot := helpers.GetMapSlot(holder, islot)\n\treturn m.erc20.GetProof(ctx, [][]byte{slot[:]}, block)\n}", "title": "" }, { "docid": "ff467e64761046a29356653174ff23fc", "score": "0.41790742", "text": "func (sl *Slot) setPosition(pos Position) {\n\tsl.Position = pos.add(sl.shift)\n}", "title": "" }, { "docid": "0361f33a8f502ba0bcdc2b0c282bda65", "score": "0.4151333", "text": "func (d *TextDrawer) Glyph(dot fixed.Point26_6, r rune) (dp image.Point, gr *Region, advance fixed.Int26_6) {\n\tdx, dy := (dot.X+fontSubPixelBiasX)&fontSubPixelMaskX, (dot.Y+fontSubPixelBiasY)&fontSubPixelMaskY\n\tix, iy := int(dx>>6), int(dy>>6)\n\n\tkey := cacheKey{r, uint8(dx & 0x3f), uint8(dy & 0x3f)}\n\tif v, ok := d.cache[key]; ok {\n\t\tif idx := v.index; idx >= 0 {\n\t\t\treturn image.Point{X: ix, Y: iy}, &d.glyphs[idx], v.adv\n\t\t}\n\t\treturn image.Point{}, nil, v.adv\n\t}\n\n\tdr, mask, maskp, advance, ok := d.face.Glyph(fixed.Point26_6{X: dot.X & 0x3f, Y: dot.Y & 0x3f}, r)\n\tif !ok {\n\t\treturn image.Point{}, nil, 0\n\t}\n\tsz := dr.Size()\n\tif sz.X == 0 || sz.Y == 0 {\n\t\t// empty glyph\n\t\td.cache[key] = cacheValue{-1, advance}\n\t\treturn image.Point{}, nil, advance\n\t}\n\t// adjust point of origin to account for rounding when quantizing subPixels\n\torg := image.Pt(-dr.Min.X+(ix-dot.X.Floor()), -dr.Min.Y+(iy-dot.Y.Floor()))\n\ttr := dr.Add(image.Pt(-dr.Min.X+d.p.X, -dr.Min.Y+d.p.Y))\n\tt := d.currentTexture()\n\tif t != nil {\n\t\tsz := t.Size()\n\t\tif tr.Max.X > sz.X {\n\t\t\td.p = image.Pt(1, d.p.Y+d.lh)\n\t\t\ttr = tr.Add(image.Pt(-tr.Min.X+d.p.X, d.lh))\n\t\t}\n\t\tif tr.Max.Y > sz.Y {\n\t\t\tt = nil\n\t\t}\n\t}\n\tif t == nil {\n\t\tt = TextureFromImage(image.NewRGBA(image.Rect(0, 0, FontTextureSize, FontTextureSize)),\n\t\t\tFilter(Linear, d.mf))\n\t\td.ts = append(d.ts, t)\n\t\td.p = image.Point{1, 1}\n\t\ttr = dr.Add(image.Pt(-dr.Min.X+d.p.X, -dr.Min.Y+d.p.Y))\n\t\td.lh = 0\n\t}\n\tt.SetSubImage(tr, mask, maskp)\n\td.p.X += tr.Dx() + 1\n\tif h := tr.Dy() + 1; h > d.lh {\n\t\td.lh = h\n\t}\n\tindex := int32(len(d.glyphs))\n\td.glyphs = append(d.glyphs, *t.Region(tr, org))\n\td.cache[key] = cacheValue{index, advance}\n\treturn image.Point{X: ix, Y: iy}, &d.glyphs[index], advance\n}", "title": "" }, { "docid": "d9fedb1e430833c9d857a276d7e0a914", "score": "0.41480088", "text": "func (node *Node) Slot() int {\n\treturn node.slot\n}", "title": "" }, { "docid": "4fd5cedf66a69675359bdd3b41fdcda3", "score": "0.4130403", "text": "func lookupItemSlot(itemName string) *MutableSlot {\n\tt := Treasures[itemName]\n\tfor _, slot := range ItemSlots {\n\t\tif slot.Treasure == t {\n\t\t\treturn slot\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "feda0be8d8201c3d8c5821a5286d6cd5", "score": "0.4129051", "text": "func (tf *TextField) CursorSprite() *Viewport2D {\n\twin := tf.Viewport.Win\n\tif win == nil {\n\t\treturn nil\n\t}\n\tsty := &tf.StateStyles[TextFieldActive]\n\tspnm := fmt.Sprintf(\"%v-%v\", TextFieldSpriteName, tf.FontHeight)\n\tsp, ok := win.Sprites[spnm]\n\tif !ok {\n\t\tbbsz := image.Point{int(math32.Ceil(tf.CursorWidth.Dots)), int(math32.Ceil(tf.FontHeight))}\n\t\tif bbsz.X < 2 { // at least 2\n\t\t\tbbsz.X = 2\n\t\t}\n\t\tsp = win.AddSprite(spnm, bbsz, image.ZP)\n\t\tdraw.Draw(sp.Pixels, sp.Pixels.Bounds(), &image.Uniform{sty.Font.Color}, image.ZP, draw.Src)\n\t}\n\treturn sp\n}", "title": "" }, { "docid": "05061e63709e66327384e3d5f9d6e844", "score": "0.4124434", "text": "func (s *Chart) GetSlot() *int32 {\n\tvar ret *int32\n\tret = (*int32)(unsafe.Pointer(&s.slot))\n\treturn ret\n}", "title": "" }, { "docid": "8c678fbf088de2727b85bb5de9a8f8a9", "score": "0.4117195", "text": "func (o TextMappingOutput) InputTrack() pulumi.IntOutput {\n\treturn o.ApplyT(func(v TextMapping) int { return v.InputTrack }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "109ed52d94e6fa3485eb58085eacb3da", "score": "0.4103981", "text": "func (gb *Breaker) CodePointClassFor(r rune) int {\n\tc := ClassForRune(r)\n\tif c == Other {\n\t\tif unicode.Is(emoji.Extended_Pictographic, r) {\n\t\t\treturn int(emojiPictographic)\n\t\t}\n\t}\n\treturn int(c)\n}", "title": "" }, { "docid": "37c2392acf913b865ff5764c6c3bbda2", "score": "0.40912625", "text": "func putGlyph8bitObs(reg *regbank, st *stack, args []byte) ([]byte, bool) {\n\toutputClass := args[0]\n\tseg := reg.smap.segment\n\treg.is.setGlyph(seg, seg.silf.classMap.getClassGlyph(uint16(outputClass), 0))\n\treturn args[1:], st.top < stackMax\n}", "title": "" }, { "docid": "88d3a663e090fbd7e586c78ed5f90d23", "score": "0.40852433", "text": "func (f *Filter) location(h [2]uint64, i uint64) uint {\n\treturn uint((h[0] + h[1]*i) & f.mask)\n}", "title": "" }, { "docid": "c6fdb815f629e9e2b0bb13da32b7d3e0", "score": "0.40814883", "text": "func (s *Switch) Index() int { return int(s.idx) }", "title": "" }, { "docid": "4e57db5f92b8e8d4ab069739e2233cc3", "score": "0.40717185", "text": "func (p *Picture) IndexFor(x, y int) int {\n\treturn x + y*p.HorizontalImageChunks\n}", "title": "" }, { "docid": "dc604f1a59d648abac801a9a1795d8d5", "score": "0.40698192", "text": "func (s *slot) FindPosition(position int) (*slot, error) {\n\tif s.slotNo == position {\n\t\treturn s, nil\n\t}\n\n\tif s.nextSlot == nil {\n\t\treturn nil, errors.New(CarNotFound)\n\t}\n\n\treturn s.nextSlot.FindPosition(position)\n}", "title": "" }, { "docid": "2cbc6e90da38ab3e93e04e2dc8f303a0", "score": "0.4068418", "text": "func (s *BaseFoxySheepListener) EnterSlotNamed(ctx *SlotNamedContext) {}", "title": "" }, { "docid": "3be4688f83b4f95616116542c2295c78", "score": "0.40614656", "text": "func (self *Ring) GetSlot() []byte {\n\tself.lock.RLock()\n\tdefer self.lock.RUnlock()\n\tbiggestSpace := new(big.Int)\n\tbiggestSpaceIndex := 0\n\tfor i := 0; i < len(self.nodes); i++ {\n\t\tthis := new(big.Int).SetBytes(self.nodes[i].Pos)\n\t\tvar next *big.Int\n\t\tif i+1 < len(self.nodes) {\n\t\t\tnext = new(big.Int).SetBytes(self.nodes[i+1].Pos)\n\t\t} else {\n\t\t\tmax := make([]byte, murmur.Size+1)\n\t\t\tmax[0] = 1\n\t\t\tnext = new(big.Int).Add(new(big.Int).SetBytes(max), new(big.Int).SetBytes(self.nodes[0].Pos))\n\t\t}\n\t\tthisSpace := new(big.Int).Sub(next, this)\n\t\tif biggestSpace.Cmp(thisSpace) < 0 {\n\t\t\tbiggestSpace = thisSpace\n\t\t\tbiggestSpaceIndex = i\n\t\t}\n\t}\n\treturn new(big.Int).Add(new(big.Int).SetBytes(self.nodes[biggestSpaceIndex].Pos), new(big.Int).Div(biggestSpace, big.NewInt(2))).Bytes()\n}", "title": "" }, { "docid": "bdc3c5f146887a3c799278fc21afa7c9", "score": "0.40458986", "text": "func FindSlotByLabel(p *pkcs11.Ctx, slotLabel string) (slot uint, index int, err error) {\n\n\tvar slotFound bool\n\n\t// Get list of slots\n\tslots, err := p.GetSlotList(true)\n\tif err == nil {\n\n\t\t// Look for matching slot label\n\t\tfor i, s := range slots {\n\t\t\ttInfo, errGt := p.GetTokenInfo(s)\n\t\t\tif errGt != nil {\n\t\t\t\terr = errGt\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif slotLabel == tInfo.Label {\n\t\t\t\tslotFound = true\n\t\t\t\tslot = s\n\t\t\t\tindex = i\n\t\t\t\tfmt.Printf(\"PKCS11 provider found specified slot label: %s (slot: %d, index: %d)\\n\", slotLabel, slot, i)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// set error if slot not found\n\tif !slotFound {\n\t\terr = errors.New(fmt.Sprintf(\"Could not find slot with label: %s\", slotLabel))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8088b398d62fad991d2f1e0197eda86a", "score": "0.40390942", "text": "func (f *TemplateFact) Slot(name string) (interface{}, error) {\n\tdata, err := slotValue(f.env, f.factptr, Symbol(name))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer data.Delete()\n\treturn data.Value(), nil\n}", "title": "" }, { "docid": "4d2e0ccfe405af25823a10fa0156f489", "score": "0.40283826", "text": "func (sc *slotCanonicalizer) lookup(ls LocalSlot) (SlKeyIdx, bool) {\n\tsplit := noSlot\n\tif ls.SplitOf != nil {\n\t\tsplit, _ = sc.lookup(*ls.SplitOf)\n\t}\n\tk := slotKey{\n\t\tname: ls.N, offset: ls.Off, width: ls.Type.Size(),\n\t\tsplitOf: split, splitOffset: ls.SplitOffset,\n\t}\n\tif idx, ok := sc.slmap[k]; ok {\n\t\treturn idx, true\n\t}\n\trv := SlKeyIdx(len(sc.slkeys))\n\tsc.slkeys = append(sc.slkeys, ls)\n\tsc.slmap[k] = rv\n\treturn rv, false\n}", "title": "" }, { "docid": "36a1759f16de64c777f284ea873eff6f", "score": "0.40180326", "text": "func (t *Table) GetFloat32Slot(slot VOffsetT, d float32) float32 {\n\toff := t.Offset(slot)\n\tif off == 0 {\n\t\treturn d\n\t}\n\n\treturn t.GetFloat32(t.Pos + UOffsetT(off))\n}", "title": "" }, { "docid": "5a5c52ffe2b61a82f5a4500b1e820285", "score": "0.4010225", "text": "func (ib *ixbuf) Insert(key string, off uint64) {\n\tib.modCount++\n\tif len(ib.chunks) == 0 {\n\t\tib.size++\n\t\tib.chunks = make([]chunk, 1, 4) // ???\n\t\tib.chunks[0] = make([]slot, 1, 8) // ???\n\t\tib.chunks[0][0] = slot{key: key, off: off}\n\t\treturn\n\t}\n\tci := ib.searchChunks(key)\n\tc := ib.chunks[ci]\n\ti := search(ib.chunks[ci], key)\n\n\tif i < len(c) && c[i].key == key {\n\t\t// already exists, combine\n\t\tslot := &c[i]\n\t\tslot.off = Combine(slot.off, off) // handles update/delete\n\t\tif slot.off == 0 {\n\t\t\tib.remove(ci, i)\n\t\t}\n\t\treturn\n\t}\n\n\t// insert in place\n\tib.size++\n\tc = append(c, slot{})\n\tib.chunks[ci] = c\n\tcopy(c[i+1:], c[i:])\n\tc[i] = slot{key: key, off: off}\n\n\tif len(c) > goal(ib.size) {\n\t\t// split\n\t\tn := len(c)\n\t\tat := n / 2\n\t\tif i == 0 {\n\t\t\tat = n / 4\n\t\t} else if i == len(c)-1 {\n\t\t\tat += n / 4\n\t\t}\n\t\tleft := c[:at] // re-use\n\t\tright := make([]slot, n-at)\n\t\tcopy(right, c[at:])\n\t\tib.chunks[ci] = left\n\t\tib.chunks = append(ib.chunks, nil)\n\t\tci++\n\t\tcopy(ib.chunks[ci+1:], ib.chunks[ci:])\n\t\tib.chunks[ci] = right\n\t}\n}", "title": "" }, { "docid": "6b02e69e1ea5f0a12460ac07c47a60b1", "score": "0.39965767", "text": "func slotNameFor(field reflect.StructField) string {\n\tif tag, ok := field.Tag.Lookup(\"clips\"); ok {\n\t\treturn tag\n\t}\n\tvar ret = field.Name\n\tif tag, ok := field.Tag.Lookup(\"json\"); ok {\n\t\tret = strings.Split(tag, \",\")[0]\n\t}\n\tif ret == \"name\" {\n\t\tret = \"_name\"\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "53bef2a65d915993e1e2ee0b6353d639", "score": "0.39963353", "text": "func (t *Table) GetInt32Slot(slot VOffsetT, d int32) int32 {\n\toff := t.Offset(slot)\n\tif off == 0 {\n\t\treturn d\n\t}\n\n\treturn t.GetInt32(t.Pos + UOffsetT(off))\n}", "title": "" }, { "docid": "e32c98d176d1120d65bffd09f8c728e4", "score": "0.39961308", "text": "func addressFromInput(input Input, outputsByID OutputsByID) Address {\n\ttypeCastedInput, ok := input.(*UTXOInput)\n\tif !ok {\n\t\tpanic(\"unexpected Input type\")\n\t}\n\n\tswitch referencedOutput := outputsByID[typeCastedInput.ReferencedOutputID()]; referencedOutput.Type() {\n\tcase SigLockedSingleOutputType:\n\t\ttypeCastedOutput, ok := referencedOutput.(*SigLockedSingleOutput)\n\t\tif !ok {\n\t\t\tpanic(\"failed to type cast SigLockedSingleOutput\")\n\t\t}\n\n\t\treturn typeCastedOutput.Address()\n\tcase SigLockedColoredOutputType:\n\t\ttypeCastedOutput, ok := referencedOutput.(*SigLockedColoredOutput)\n\t\tif !ok {\n\t\t\tpanic(\"failed to type cast SigLockedColoredOutput\")\n\t\t}\n\n\t\treturn typeCastedOutput.Address()\n\tdefault:\n\t\tpanic(\"unexpected Output type\")\n\t}\n}", "title": "" }, { "docid": "eeccee1487bc695f5623181923dfe5b0", "score": "0.39913452", "text": "func (f *Filter) location(h uint64) (uint64, uint64) {\n\tslot := (h / bitPerByte) & (f.m - 1)\n\tmod := h & mod7\n\treturn slot, mod\n}", "title": "" }, { "docid": "af091bd0f77b8c41c8095fabc1e9cbad", "score": "0.39801526", "text": "func (p *Pattern) getIdx(x, y int) int {\n\tif y < 0 || y >= p.H {\n\t\treturn -1\n\t}\n\tfor ; x < 0 ; x += p.W {}\n\n\treturn y * p.W + x % p.W\n}", "title": "" }, { "docid": "80a2d622278b14cf7af463983710507f", "score": "0.39752698", "text": "func iterateCoordinate(location *image.Point, input rune) {\n\tswitch input {\n\tcase 'v':\n\t\tlocation.Y--\n\tcase '^':\n\t\tlocation.Y++\n\tcase '<':\n\t\tlocation.X--\n\tcase '>':\n\t\tlocation.X++\n\t}\n}", "title": "" }, { "docid": "cb841350ec2c8aac182962325e6389ee", "score": "0.39746496", "text": "func Key2Slot(key string) uint16 {\n\t// Only hash what is inside {...} if there is such a pattern in the key.\n\t// Note that the specification requires the content that is between\n\t// the first { and the first } after the first {. If we found {} without\n\t// nothing in the middle, the whole key is hashed as usually.\n\thashKey := key\n\n\tstart := strings.Index(key, HASHTAG_START)\n\tif start >= 0 {\n\t\tend := strings.LastIndex(key, HASHTAG_END)\n\t\tif end >= 0 && start < end {\n\t\t\thashKey = key[start:end]\n\t\t}\n\t}\n\n\treturn crc16(hashKey) % DEFAULT_SLOT_NUM\n}", "title": "" }, { "docid": "70d05161330f0dde35a20293dddb9eac", "score": "0.39722955", "text": "func (o BotSlotPriorityOutput) SlotName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BotSlotPriority) string { return v.SlotName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ba4304ca531a9b878477951e06a9d0ed", "score": "0.39659402", "text": "func putSubs8bitObs(reg *regbank, st *stack, args []byte) ([]byte, bool) {\n\tslotRef := int8(args[0])\n\tinputClass := args[1]\n\toutputClass := args[2]\n\tslot := reg.slotAt(slotRef)\n\tif slot != nil {\n\t\tseg := reg.smap.segment\n\t\tindex := seg.silf.classMap.findClassIndex(uint16(inputClass), slot.glyphID)\n\t\treg.is.setGlyph(seg, seg.silf.classMap.getClassGlyph(uint16(outputClass), index))\n\t}\n\treturn args[3:], st.top < stackMax\n}", "title": "" }, { "docid": "0b36df823c7f145e19310a93cfbfbe25", "score": "0.39586076", "text": "func (byt *Byt) Index(vs []byte, t byte) int {\r\n\tfor i, v := range vs {\r\n\t\tif v == t {\r\n\t\t\treturn i\r\n\t\t}\r\n\t}\r\n\treturn -1\r\n}", "title": "" }, { "docid": "84af783d454752b2f00fb4a61b33b993", "score": "0.39483038", "text": "func (s *Score) location(g *gocui.Gui) (x, y, w, h int) {\n\tmaxX, maxY := g.Size()\n\tx = int(0.35 * float32(maxX))\n\ty = int(0.1 * float32(maxY))\n\tw = int(0.65 * float32(maxX))\n\th = int(0.2 * float32(maxY))\n\treturn\n}", "title": "" }, { "docid": "0f14dd62efb67346bfc689a39216c462", "score": "0.39438128", "text": "func NewSlot(car *model.Car, pos int) *model.Slot {\n\treturn &model.Slot{\n\t\tCar: car,\n\t\tPosition: pos,\n\t}\n}", "title": "" }, { "docid": "e736bc9b45b28fd7ac734fb7ea84e232", "score": "0.3943801", "text": "func (s *Selection) Index() []int {}", "title": "" }, { "docid": "b8ee8cca336cb2e0848404c3450a9b77", "score": "0.39414263", "text": "func (t *Table) GetInt16Slot(slot VOffsetT, d int16) int16 {\n\toff := t.Offset(slot)\n\tif off == 0 {\n\t\treturn d\n\t}\n\n\treturn t.GetInt16(t.Pos + UOffsetT(off))\n}", "title": "" }, { "docid": "1d8327e9eede4c96d174250a960241c0", "score": "0.39330178", "text": "func (recv *SpinButton) ConnectOutput(callback SpinButtonSignalOutputCallback) int {\n\tsignalSpinButtonOutputLock.Lock()\n\tdefer signalSpinButtonOutputLock.Unlock()\n\n\tsignalSpinButtonOutputId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.SpinButton_signal_connect_output(instance, C.gpointer(uintptr(signalSpinButtonOutputId)))\n\n\tdetail := signalSpinButtonOutputDetail{callback, handlerID}\n\tsignalSpinButtonOutputMap[signalSpinButtonOutputId] = detail\n\n\treturn signalSpinButtonOutputId\n}", "title": "" }, { "docid": "2181cfbbf49bd541616527a163761e94", "score": "0.39282665", "text": "func (c VoxelCoord) ToBlockIndex(blockSize Point3d) (index int) {\n\tbv := c.BlockVoxel(blockSize)\n\tindex = int(bv[2]*blockSize[0]*blockSize[1] + bv[1]*blockSize[0] + bv[0])\n\treturn\n}", "title": "" }, { "docid": "7aeab72c10a22bf195868696916cadd9", "score": "0.39212456", "text": "func Index(gid uint32) uint32 {\n\treturn uint32(gid &^ tileFlipped)\n}", "title": "" }, { "docid": "b6a4f27bb1761941bfc70e2dcb4d9599", "score": "0.3909851", "text": "func (self *BitmapText) AlignIn2O(container interface{}, position int, offsetX int) interface{}{\n return self.Object.Call(\"alignIn\", container, position, offsetX)\n}", "title": "" }, { "docid": "d25d94581cbde35c0e4e8d6c773b4f4a", "score": "0.39082044", "text": "func pos2bitIndex(x, y int) int {\n\treturn 5*y + x\n}", "title": "" }, { "docid": "527914dde1bfdb4785a7cc8dd7241e50", "score": "0.39075527", "text": "func (i *index) Write(off uint32, pos uint64) error {\n\tif uint64(len(i.mmap)) < i.size+entWidth {\n\t\treturn io.EOF\n\t}\n\tenc.PutUint32(i.mmap[i.size:i.size+offWidth], off)\n\tenc.PutUint64(i.mmap[i.size+offWidth:i.size+entWidth], pos)\n\ti.size += uint64(entWidth)\n\treturn nil\n}", "title": "" }, { "docid": "527914dde1bfdb4785a7cc8dd7241e50", "score": "0.39075527", "text": "func (i *index) Write(off uint32, pos uint64) error {\n\tif uint64(len(i.mmap)) < i.size+entWidth {\n\t\treturn io.EOF\n\t}\n\tenc.PutUint32(i.mmap[i.size:i.size+offWidth], off)\n\tenc.PutUint64(i.mmap[i.size+offWidth:i.size+entWidth], pos)\n\ti.size += uint64(entWidth)\n\treturn nil\n}", "title": "" }, { "docid": "561dd7552dbe79a795fe8ad878784f14", "score": "0.39021605", "text": "func (s *BaseFoxySheepListener) ExitSlot(ctx *SlotContext) {}", "title": "" }, { "docid": "0c01b56b1c67191544e841efdf225e97", "score": "0.38987508", "text": "func getPosition(tbl []uint64, slot int, key uint64) (has bool, pos int) {\n\tif tbl != nil {\n\t\tslotCnt := len(tbl)\n\t\tn := neighbour\n\t\tif slot+neighbour >= slotCnt {\n\t\t\tn = slotCnt - slot\n\t\t}\n\t\tfor i := 0; i < n; i++ {\n\t\t\tk := atomic.LoadUint64(&tbl[slot+i])\n\t\t\tif k == key {\n\t\t\t\treturn true, slot + i\n\t\t\t}\n\t\t}\n\t}\n\treturn false, 0\n}", "title": "" }, { "docid": "4613b1d0f3eb3a028f532ebe108896f1", "score": "0.38957658", "text": "func (s *Scanner) findCell() int {\n\tyi := s.yi\n\tif yi < 0 || yi >= len(s.cellIndex) {\n\t\treturn -1\n\t}\n\txi := s.xi\n\tif xi < 0 {\n\t\txi = -1\n\t} else if xi > s.width {\n\t\txi = s.width\n\t}\n\ti, prev := s.cellIndex[yi], -1\n\tfor i != -1 && s.cell[i].xi <= xi {\n\t\tif s.cell[i].xi == xi {\n\t\t\treturn i\n\t\t}\n\t\ti, prev = s.cell[i].next, i\n\t}\n\tc := len(s.cell)\n\ts.cell = append(s.cell, cell{xi, 0, 0, i})\n\tif prev == -1 {\n\t\ts.cellIndex[yi] = c\n\t} else {\n\t\ts.cell[prev].next = c\n\t}\n\treturn c\n}", "title": "" }, { "docid": "ae696d6a438326b37f3e9c09563a1b43", "score": "0.3894844", "text": "func (ps *Station) GetSlot(slotNumber ptypes.Index) (*slot.Slot, error) {\n\tif slotNumber < ps.startIndex && slotNumber > ptypes.Index(ps.capacity) {\n\t\treturn nil, perror.ErrInvalidSlotNumber\n\t}\n\treturn ps.slots[slotNumber-ps.startIndex], nil\n}", "title": "" }, { "docid": "45c07d3ab83db6dd0795f72cf1696ab6", "score": "0.38839963", "text": "func (t *Table) MutateByteSlot(slot VOffsetT, n byte) bool {\n\tif off := t.Offset(slot); off != 0 {\n\t\tt.MutateByte(t.Pos+UOffsetT(off), n)\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7fb4b714f4313e21f137245b1980b4af", "score": "0.38837925", "text": "func (t *Table) MutateInt8Slot(slot VOffsetT, n int8) bool {\n\tif off := t.Offset(slot); off != 0 {\n\t\tt.MutateInt8(t.Pos+UOffsetT(off), n)\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "369bd69b5ea59f30de2cdd12463d6e06", "score": "0.3880711", "text": "func newSeek(input InputStatement) (Statement, error) {\n\terr := interpreter.CheckSyntax(\n\t\t[]string{\"R/N\"},\n\t\tinput.Tokens,\n\t\tinput.LineNum,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &seekStatement{\n\t\tinput: input,\n\t}, nil\n}", "title": "" }, { "docid": "c48d1133dd1e07bc8ad778f422e11c18", "score": "0.38798857", "text": "func (ps GPOSPairSet) FindGlyph(secondGlyph GID) *GPOSPairValueRecord {\n\tlow, high := 0, len(ps)\n\tfor low < high {\n\t\tmid := low + (high-low)/2 // avoid overflow when computing mid\n\t\tp := ps[mid].SecondGlyph\n\t\tif secondGlyph < p {\n\t\t\thigh = mid\n\t\t} else if secondGlyph > p {\n\t\t\tlow = mid + 1\n\t\t} else {\n\t\t\treturn &ps[mid]\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b21c21bee04483a5c3a6c4772d54e898", "score": "0.38792744", "text": "func (r *CanvasWrapper) newFont(n *html.Node, font string) (vg.Point, error) {\n\tf := r.sty.Font\n\tif err := r.sty.Font.SetName(font); err != nil {\n\t\treturn r.At, err\n\t}\n\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\tif at, err := r.draw(c); err != nil {\n\t\t\treturn at, err\n\t\t}\n\t}\n\tr.sty.Font = f\n\treturn r.At, nil\n}", "title": "" }, { "docid": "588a1cfe85b0c884d059fda1061baee4", "score": "0.3868948", "text": "func PointToIndex(p Point, boundaries Rect) int {\n\treturn p.Y()*boundaries.Width() + p.X()\n}", "title": "" }, { "docid": "4eb4c72eae08d7674ec8af2defd70d0c", "score": "0.38682762", "text": "func (sim *SimulationSession) ProcessSlot(ctx context.Context, slot uint32) {\n\tlogutil.GetLogger(PackageName).Debugf(\"[ProcessSlot] slot %v\", slot)\n\tSlotCtx, cancel := context.WithCancel(ctx)\n\n\tselect {\n\tcase <-ctx.Done():\n\t\tlogutil.GetLogger(PackageName).Fatalf(\"[ProcessSlot] context canceled.\")\n\tdefault:\n\t\t// move the vehicles!\n\t\tsim.moveVehiclesPerSlot(SlotCtx, slot)\n\n\t\t// generate trust value offsets\n\t\tsim.prepareRSUsForSlot(SlotCtx, slot)\n\t\t// generate and dispatch trust value offsets to every RSUs\n\t\tsim.genTrustValueOffset(SlotCtx, slot)\n\t\t// execute related RSU logic\n\t\tsim.forgeTrustValueOffsets(SlotCtx, slot)\n\n\t\t// signal the ib-dtm module to execute related logic\n\t\tsim.dialIBDTMLogicModulePerSlot(SlotCtx, slot)\n\t}\n\tcancel()\n}", "title": "" }, { "docid": "c9f99f3e4b5814ef398e9504469993bf", "score": "0.3864868", "text": "func (node *Node) Slot() int {\n\treturn node.chain.Slot()\n}", "title": "" }, { "docid": "18ee899a239909e72d3bf56c4b88d69c", "score": "0.38639808", "text": "func (s *scanner) cur() byte { return s.buf[s.ipos] }", "title": "" }, { "docid": "6cae4b089e885009a4b30f9eba4b7b8d", "score": "0.38637635", "text": "func InsertInInput(r rune) {\n if IP == len(Input) {\n Input = append(Input, r)\n } else {\n new_input := make([]rune, 0, len(Input)+1)\n new_input = append(new_input, Input[:IP]...)\n new_input = append(new_input, r)\n new_input = append(new_input, Input[IP:]...)\n Input = new_input\n }\n IP++\n \n DrawInput()\n}", "title": "" }, { "docid": "828eb2d27d0a6260779a8f7e605498ff", "score": "0.38622394", "text": "func (sl *Slot) GID() fonts.GID {\n\tif sl.realGlyphID != 0 {\n\t\treturn sl.realGlyphID\n\t}\n\treturn sl.glyphID\n}", "title": "" }, { "docid": "a5b5e699f496718cc2670e37532b1b9a", "score": "0.38567278", "text": "func (g CmdIDGroup) Index(index uint64) SpanItem {\n\tfor _, s := range g.Spans {\n\t\tc := s.itemCount()\n\t\tif index < c {\n\t\t\treturn s.item(index)\n\t\t}\n\t\tindex -= c\n\t}\n\treturn nil // Out of range.\n}", "title": "" }, { "docid": "70049bbece3dccbe2f45190967be7b13", "score": "0.38565588", "text": "func (s *BaseFoxySheepListener) ExitSlotSequenceDigits(ctx *SlotSequenceDigitsContext) {}", "title": "" }, { "docid": "74b70d0ac8b89c8b30c4d9f2b3e53df9", "score": "0.38525203", "text": "func (s *state) update(offset int, codepoint characterGroup) {\n\ts.before = s.previous\n\ts.beforeOffset = s.previousOffset\n\ts.previous = s.current\n\ts.previousOffset = s.currentOffset\n\ts.current = s.next\n\ts.currentOffset = s.nextOffset\n\ts.next = codepoint\n\ts.nextOffset = offset\n}", "title": "" }, { "docid": "6d5396d3255e6db86f90a97de3343d65", "score": "0.38489014", "text": "func placeMarker(spaces []string, marker string, position int) {\n\t// fmt.Println(marker)\n\tspaces[position] = marker\n}", "title": "" }, { "docid": "85e8401ad423a24cae5e93d10976810b", "score": "0.3841133", "text": "func DrawInput() {\n var n int = 0\n var scroll int = 0\n \n if IP > InputRL {\n scroll = IP - InputRL\n }\n if scroll < 0 {\n scroll = 0\n }\n \n ip_pos := IP - scroll\n input_end := len(Input) - scroll\n \n for n := 0; n < ip_pos; n++ {\n termbox.SetCell(n, InputY, Input[n+scroll], DefaultFg, DefaultBg)\n }\n if IP == len(Input) {\n termbox.SetCell(ip_pos, InputY, ' ', DefaultFg | termbox.AttrReverse,\n DefaultBg | termbox.AttrReverse)\n for n = ip_pos+1; n < TermW; n++ {\n termbox.SetCell(n, InputY, ' ', DefaultFg, DefaultBg)\n }\n } else {\n termbox.SetCell(ip_pos, InputY, Input[IP], DefaultFg | termbox.AttrReverse, \n DefaultBg | termbox.AttrReverse)\n for n = ip_pos+1; n < input_end; n++ {\n termbox.SetCell(n, InputY, Input[n+scroll], DefaultFg, DefaultBg)\n }\n for n = input_end; n < TermW; n++ {\n termbox.SetCell(n, InputY, ' ', DefaultFg, DefaultBg)\n }\n }\n \n if scroll > 0 {\n termbox.SetCell(0, InputY, '<', DefaultFg | termbox.AttrReverse,\n DefaultBg | termbox.AttrReverse)\n }\n if len(Input) > scroll + TermW {\n termbox.SetCell(TermW - 1, InputY, '>', DefaultFg | termbox.AttrReverse,\n DefaultBg | termbox.AttrReverse)\n }\n \n \n}", "title": "" }, { "docid": "991d4d5a1fd6357e5d70afffb5dcd1d2", "score": "0.38351163", "text": "func (s *state) process(offset int, codepoint rune) int {\n\tswitch {\n\tcase unicode.IsLower(codepoint):\n\t\treturn s.lower(offset)\n\tcase unicode.IsSpace(codepoint):\n\t\treturn s.space(offset)\n\tcase unicode.IsUpper(codepoint):\n\t\treturn s.upper(offset)\n\tcase unicode.IsNumber(codepoint):\n\t\treturn s.number(offset)\n\tcase codepoint == '.' || codepoint == '?' || codepoint == '!':\n\t\treturn s.terminal(offset)\n\tcase unicode.Is(unicode.Ps, codepoint) || unicode.Is(unicode.Pe, codepoint):\n\t\treturn s.punctuation(offset)\n\tcase strings.ContainsRune(hyphens, codepoint):\n\t\treturn s.hyphen(offset)\n\tcase strings.ContainsRune(apostrophes, codepoint):\n\t\treturn s.apostrophe(offset)\n\tdefault:\n\t\treturn s.symbol(offset)\n\t}\n}", "title": "" }, { "docid": "4402d7c1084fd747897d4bf6a3de49eb", "score": "0.38269427", "text": "func findCharClass(s string, step *byPassStep) (foundIndex int, matchingChar rune) {\n\tfor idx, char := range s {\n\t\tfor i := 0; i < len(step.classes); i += 2 {\n\t\t\tif step.classes[i] <= char && char <= step.classes[i+1] {\n\t\t\t\treturn idx, char\n\t\t\t}\n\t\t}\n\t}\n\tfoundIndex = -1\n\treturn\n}", "title": "" }, { "docid": "8d58aeb1a56f615a1cdc4a2e46055f0a", "score": "0.3825581", "text": "func (ci CellID) Pos() uint64 { return uint64(ci) & (^uint64(0) >> FaceBits) }", "title": "" }, { "docid": "c4e13f8316ca9d66a9f5c03142596891", "score": "0.38224396", "text": "func (self *BitmapText) SetInputA(member interface{}) {\n self.Object.Set(\"input\", member)\n}", "title": "" }, { "docid": "6e5bb16111c7c19f8b8f207298d416aa", "score": "0.38075948", "text": "func (s *BaseFoxySheepListener) ExitSlotSequence(ctx *SlotSequenceContext) {}", "title": "" }, { "docid": "5887cc92d256d4a37d407de370e148d8", "score": "0.38055587", "text": "func (s *BaseFoxySheepListener) ExitSlotDigits(ctx *SlotDigitsContext) {}", "title": "" }, { "docid": "820a4a8cf1249a9a86dad02c48b0894f", "score": "0.38038394", "text": "func (w Phase0BeaconBlock) Slot() types.Slot {\n\treturn w.b.Slot\n}", "title": "" }, { "docid": "6a599943e47ba06496d3acb26f4a2f5e", "score": "0.3796105", "text": "func (f *Font) Write(dest draw.Image, text string, startX, startY int) (newX, newY int) {\n\tscale := f.fontInfo.ScaleForPixelHeight(float64(f.HeightInPixels))\n\tascend, descend, baseline := f.fontInfo.GetFontVMetrics()\n\tlineHeight := round(float64(ascend-descend+baseline) * scale)\n\n\tsource := image.NewUniform(color.RGBA{f.R, f.G, f.B, 255})\n\tx := startX\n\tyOffset := round(float64(ascend+baseline) * scale)\n\ty := startY + yOffset\n\n\tvar last rune\n\tfor i, r := range text {\n\t\tif r == '\\n' {\n\t\t\tx = startX\n\t\t\ty += lineHeight\n\t\t\tlast = 0\n\t\t\tcontinue\n\t\t}\n\n\t\tadvance, leftSideBearing := f.fontInfo.GetCodepointHMetrics(int(r))\n\t\tx += round(float64(leftSideBearing) * scale)\n\n\t\tletter := f.getLetter(r, scale)\n\t\tvar mask image.Image = letter\n\t\tif f.A != 255 {\n\t\t\tmask = newAlphaMultiplied(letter, f.A)\n\t\t}\n\t\tw := letter.Bounds().Dx()\n\t\th := letter.Bounds().Dy()\n\t\tx0, _, _, y1 := f.fontInfo.GetCodepointBitmapBox(int(r), 0, scale)\n\t\tdraw.DrawMask(\n\t\t\tdest, image.Rect(x+x0, y+y1-h, x+w, y+h),\n\t\t\tsource, image.ZP,\n\t\t\tmask, image.ZP,\n\t\t\tdraw.Over,\n\t\t)\n\t\tkerning := 0\n\t\tif i != 0 {\n\t\t\tkerning = round(float64(f.fontInfo.GetCodepointKernAdvance(int(last), int(r))) * scale)\n\t\t}\n\t\tx += round(float64(advance)*scale) + kerning\n\t\tlast = r\n\t}\n\treturn x, y - yOffset\n}", "title": "" }, { "docid": "9f5303896452a15edad5e2da83115b00", "score": "0.3794337", "text": "func (r *RecipeSetMatcher) Match(width, height int, slots []Slot) (output Slot) {\n\n // Precondition check.\n if width*height != len(slots) || width > maxRecipeWidth || height > maxRecipeHeight {\n return\n }\n\n minX, minY := int(width), int(height)\n maxX, maxY := 0, 0\n curIndex := 0\n // Find the position and size of the smallest rectangle that contains all\n // non-empty slots.\n for y := 0; y < height; y++ {\n for x := 0; x < width; x++ {\n if slots[curIndex].Count > 0 {\n if x < minX {\n minX = x\n }\n if y < minY {\n minY = y\n }\n if x > maxX {\n maxX = x\n }\n if y > maxY {\n maxY = y\n }\n }\n curIndex++\n }\n }\n\n widthUsed := 1 + maxY - minY\n heightUsed := 1 + maxX - minX\n // Empty grid.\n if widthUsed <= 0 || heightUsed <= 0 {\n return\n }\n\n // Make used rectangle into a linear array of []int indices.\n indices := r.indicesArray[:widthUsed*heightUsed]\n outIndex := 0\n for y := minY; y <= maxY; y++ {\n for x := minX; x <= maxX; x++ {\n inIndex := y*width + x\n indices[outIndex] = inIndex\n outIndex++\n }\n }\n\n hash := inputHash(slots, indices)\n\n bucket, ok := r.recipes.recipeHash[hash]\n\n if !ok {\n return\n }\n\n // Find the matching recipe, if any.\n for i := range bucket {\n recipe := bucket[i]\n if recipe.match(byte(widthUsed), byte(heightUsed), slots, indices) {\n // Found matching recipe.\n output = recipe.Output\n }\n }\n\n return\n}", "title": "" } ]
d706f66b40aaa49152fd39850d9538dc
NewNoTradingSessions returns an initialized NoTradingSessions instance
[ { "docid": "110eb8cf715d49d6f7af6af64b7fbc8a", "score": "0.79772323", "text": "func NewNoTradingSessions() *NoTradingSessions {\n\tvar m NoTradingSessions\n\treturn &m\n}", "title": "" } ]
[ { "docid": "00dc58c519d48f8d406d14b813bf6c14", "score": "0.7228161", "text": "func NewNoTradingSessions(val int) NoTradingSessionsField {\n\treturn NoTradingSessionsField{quickfix.FIXInt(val)}\n}", "title": "" }, { "docid": "424940df613f4f5927f459e3e28654a1", "score": "0.7006595", "text": "func (m NoOrders) GetNoTradingSessions() (NoTradingSessionsRepeatingGroup, quickfix.MessageRejectError) {\n\tf := NewNoTradingSessionsRepeatingGroup()\n\terr := m.GetGroup(f)\n\treturn f, err\n}", "title": "" }, { "docid": "ec3b9d6d550a6696bf983dcd7cd5f1a3", "score": "0.6941433", "text": "func (m NewOrderSingle) GetNoTradingSessions() (NoTradingSessionsRepeatingGroup, quickfix.MessageRejectError) {\n\tf := NewNoTradingSessionsRepeatingGroup()\n\terr := m.GetGroup(f)\n\treturn f, err\n}", "title": "" }, { "docid": "6b004dea082bfb6cdb6e0d74d206ceb5", "score": "0.68612295", "text": "func NewNoTradingSessions(tradingsessionid string, tradsesstatus int) *NoTradingSessions {\n\tvar m NoTradingSessions\n\tm.SetTradingSessionID(tradingsessionid)\n\tm.SetTradSesStatus(tradsesstatus)\n\treturn &m\n}", "title": "" }, { "docid": "902da2f196e35c1b45748306585f3f02", "score": "0.66140985", "text": "func (m NewOrderSingle) SetNoTradingSessions(f NoTradingSessionsRepeatingGroup) {\n\tm.SetGroup(f)\n}", "title": "" }, { "docid": "26352ffcff25aab44991a14cef8f896d", "score": "0.6509759", "text": "func (m Message) NoTradingSessions() (*field.NoTradingSessionsField, quickfix.MessageRejectError) {\n\tf := &field.NoTradingSessionsField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "4d7c484bf9ed5cdc424afe488984de64", "score": "0.634307", "text": "func NewNoTradingSessionsRepeatingGroup() NoTradingSessionsRepeatingGroup {\n\treturn NoTradingSessionsRepeatingGroup{\n\t\tquickfix.NewRepeatingGroup(tag.NoTradingSessions,\n\t\t\tquickfix.GroupTemplate{quickfix.GroupElement(tag.TradingSessionID)}),\n\t}\n}", "title": "" }, { "docid": "4d7c484bf9ed5cdc424afe488984de64", "score": "0.634307", "text": "func NewNoTradingSessionsRepeatingGroup() NoTradingSessionsRepeatingGroup {\n\treturn NoTradingSessionsRepeatingGroup{\n\t\tquickfix.NewRepeatingGroup(tag.NoTradingSessions,\n\t\t\tquickfix.GroupTemplate{quickfix.GroupElement(tag.TradingSessionID)}),\n\t}\n}", "title": "" }, { "docid": "e0b2513294d0b20e0a7c027f45f5cc0c", "score": "0.63387823", "text": "func (m NewOrderSingle) HasNoTradingSessions() bool {\n\treturn m.Has(tag.NoTradingSessions)\n}", "title": "" }, { "docid": "d91b29f1cf8b8702fec6659ed7cff5a5", "score": "0.6223549", "text": "func (m NoOrders) SetNoTradingSessions(f NoTradingSessionsRepeatingGroup) {\n\tm.SetGroup(f)\n}", "title": "" }, { "docid": "a8b542eed79a28b2847da1dda60aad5a", "score": "0.6210478", "text": "func NewNoTradingSessionsRepeatingGroup() NoTradingSessionsRepeatingGroup {\n\treturn NoTradingSessionsRepeatingGroup{\n\t\tquickfix.NewRepeatingGroup(tag.NoTradingSessions,\n\t\t\tquickfix.GroupTemplate{quickfix.GroupElement(tag.TradingSessionID), quickfix.GroupElement(tag.TradingSessionSubID)})}\n}", "title": "" }, { "docid": "7cc79fe46d7dad5a4cf77dc7d12d2280", "score": "0.6171098", "text": "func NewSession(token string) *NeppedSession {\r\n return &NeppedSession{\r\n Token: token,\r\n }\r\n}", "title": "" }, { "docid": "2fed44266d7297ddfa218d19344c3706", "score": "0.6094566", "text": "func (m Message) GetNoTradingSessions(f *field.NoTradingSessionsField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "6f0e132bf20483ed6f71467d3039bba8", "score": "0.5999244", "text": "func NewNoTradingSessionRules(val int) NoTradingSessionRulesField {\n\treturn NoTradingSessionRulesField{quickfix.FIXInt(val)}\n}", "title": "" }, { "docid": "7ef04b717d1e8a2fb4dbde8d19814836", "score": "0.59158283", "text": "func (m NoOrders) HasNoTradingSessions() bool {\n\treturn m.Has(tag.NoTradingSessions)\n}", "title": "" }, { "docid": "3082b439a6071da958bd371144818c8c", "score": "0.58166075", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "3082b439a6071da958bd371144818c8c", "score": "0.58166075", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "3082b439a6071da958bd371144818c8c", "score": "0.58166075", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "3082b439a6071da958bd371144818c8c", "score": "0.58161765", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "9066982395cc071814c2b0e66c08498d", "score": "0.5780551", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "9066982395cc071814c2b0e66c08498d", "score": "0.5780551", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "9066982395cc071814c2b0e66c08498d", "score": "0.5780028", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) NewSession(LocalIndex uint64) (*Mpls_SignalingProtocols_RsvpTe_Session, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Session == nil {\n\t\tt.Session = make(map[uint64]*Mpls_SignalingProtocols_RsvpTe_Session)\n\t}\n\n\tkey := LocalIndex\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Session[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Session\", key)\n\t}\n\n\tt.Session[key] = &Mpls_SignalingProtocols_RsvpTe_Session{\n\t\tLocalIndex: &LocalIndex,\n\t}\n\n\treturn t.Session[key], nil\n}", "title": "" }, { "docid": "2e36622c33b16a0d4008d397fcb02961", "score": "0.5713085", "text": "func NewAllUserSessionsNotFound() *AllUserSessionsNotFound {\n return &AllUserSessionsNotFound{\n }\n}", "title": "" }, { "docid": "50d1bbab8c954df73787dc0a3c9e0489", "score": "0.56969935", "text": "func (m NoTradingSessionsRepeatingGroup) Add() NoTradingSessions {\n\tg := m.RepeatingGroup.Add()\n\treturn NoTradingSessions{g}\n}", "title": "" }, { "docid": "50d1bbab8c954df73787dc0a3c9e0489", "score": "0.56969935", "text": "func (m NoTradingSessionsRepeatingGroup) Add() NoTradingSessions {\n\tg := m.RepeatingGroup.Add()\n\treturn NoTradingSessions{g}\n}", "title": "" }, { "docid": "50d1bbab8c954df73787dc0a3c9e0489", "score": "0.56969935", "text": "func (m NoTradingSessionsRepeatingGroup) Add() NoTradingSessions {\n\tg := m.RepeatingGroup.Add()\n\treturn NoTradingSessions{g}\n}", "title": "" }, { "docid": "c45f10330ba948e69e16f2a935839d26", "score": "0.56765425", "text": "func CreateNoOPSession(clusterID uint64) uint64 {\n\tcs := client.NewNoOPSession(clusterID, random.LockGuardedRand)\n\treturn addManagedObject(cs)\n}", "title": "" }, { "docid": "ddce0976f2c04472abe8b48d51d5e0ec", "score": "0.56734973", "text": "func New(notradingsessions []NoTradingSessions) *TrdSessLstGrp {\n\tvar m TrdSessLstGrp\n\tm.SetNoTradingSessions(notradingsessions)\n\treturn &m\n}", "title": "" }, { "docid": "2f6014b9ff0179265416edb757198053", "score": "0.56498605", "text": "func newSession(name string, cfg *config.Config) *Session {\n\treturn &Session{ID: utils.RandSeq(5), Name: name, config: cfg}\n}", "title": "" }, { "docid": "a92bb29fae2399378107009bc6c3a26f", "score": "0.5637905", "text": "func New(ctx context.Context, storer SessionStorer, userId string, metaData string, maxGenerateAttempts int) (session []byte, err error) {\n\tfor i := 0; i < maxGenerateAttempts; i++ {\n\t\tsession, err = storer.GenerateAndStore(ctx, userId, metaData)\n\t\tif err == ErrSessionCollision {\n\t\t\tcontinue\n\t\t}\n\t\treturn session, err\n\t}\n\treturn []byte{}, ErrSessionCollision\n}", "title": "" }, { "docid": "14d59b12f772954f9522d16484dde8e7", "score": "0.5610934", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "14d59b12f772954f9522d16484dde8e7", "score": "0.56096965", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "14d59b12f772954f9522d16484dde8e7", "score": "0.56096965", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "14d59b12f772954f9522d16484dde8e7", "score": "0.56096965", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "71925a20acc678e1024e1693c631ac39", "score": "0.56038195", "text": "func emptySession() *Session {\n\treturn &Session{\n\t\tSessionId: MetadataAddress{},\n\t\tSpecificationId: MetadataAddress{},\n\t\tParties: []Party{},\n\t\tName: \"\",\n\t\tAudit: nil,\n\t\tContext: nil,\n\t}\n}", "title": "" }, { "docid": "f00598ed1f88acfac03b52ad5f84b33e", "score": "0.55984706", "text": "func newSession() *session {\n\treturn &session{\n\t\tm: map[string]string{},\n\t}\n}", "title": "" }, { "docid": "6b4301787e7e75339d335ab6966d754f", "score": "0.5586471", "text": "func New() *Sessions {\n\treturn &Sessions{SessionsMap: make(map[string]string), SessionsSyncLoc: new(sync.RWMutex)}\n}", "title": "" }, { "docid": "ef012088927d638a064cc0e0db0177b8", "score": "0.55756736", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ef012088927d638a064cc0e0db0177b8", "score": "0.557444", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ef012088927d638a064cc0e0db0177b8", "score": "0.557444", "text": "func (t *Mpls_SignalingProtocols_RsvpTe) GetOrCreateSession(LocalIndex uint64) *Mpls_SignalingProtocols_RsvpTe_Session {\n\n\tkey := LocalIndex\n\n\tif v, ok := t.Session[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewSession(LocalIndex)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateSession got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "de8d5ef6022a9354c8d17444e7f95a17", "score": "0.5563674", "text": "func (ts TestStore) New(req *http.Request, name string) (*Session, error) {\n\treturn &Session{\n\t\tname: name,\n\t}, nil\n}", "title": "" }, { "docid": "618f295380f86f959d1c445b07fe1091", "score": "0.55314577", "text": "func (c *ctx) newSession() {\n\tsessionID, err := c.cfg.Store.Create()\n\tif err != nil {\n\t\tpanic(err) // explode\n\t}\n\n\tc.id = sessionID\n\tc.loaded = true\n\tc.isNewSession = true\n\n\t// Send cookie.\n\tsc := storage.Cookie{ID: sessionID}\n\tc.writeSessionCookie(sc)\n\n\t// Initial data.\n\tc.data = map[string]interface{}{\n\t\t\"epoch\": uint32(0),\n\t}\n\n\t// The session will have been created by Create(), but we need to make sure we save the epoch.\n\tc.dirty = true\n}", "title": "" }, { "docid": "d63e2b3a21028208419f34fb4ba9061e", "score": "0.55118763", "text": "func New(entity NetworkEntity) *Session {\n\treturn &Session{\n\t\tid: service.Connections.SessionID(),\n\t\tentity: entity,\n\t\tdata: make(map[string]interface{}),\n\t\tlastTime: time.Now().Unix(),\n\t\trouter: newRouter(),\n\t}\n}", "title": "" }, { "docid": "a10d33c35bec058d6c394917ee5abdb7", "score": "0.5497654", "text": "func New() (s *Session, err error) {\n\tfilename := strconv.FormatInt(time.Now().Unix(), 10) + \".json\"\n\tfilePath := path.Join(sessionsPath, filename)\n\ts = &Session{FilePath: filePath}\n\n\ttree, err := sway.GetTree()\n\tif err != nil {\n\t\treturn\n\t}\n\n\ts.Programs, err = program.GetPrograms(&program.GetProgramsInput{\n\t\tParent: tree.Root,\n\t\tProcs: proc.AllProcs(),\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "f5c4f0d741c0443923a769b13f51838e", "score": "0.54725724", "text": "func (s *sess) New() Session {\n\treturn NewSession(s.deps)\n}", "title": "" }, { "docid": "e1b6f52c39ed092aa33b6eaa7d489f70", "score": "0.546406", "text": "func newSessionList() *SessionList {\n\treturn &SessionList{\n\t\tmapOnlineList: make(map[string]ISession),\n\t}\n}", "title": "" }, { "docid": "4d9297886b4384dcbf6a1fca132df538", "score": "0.5436", "text": "func newSession(t *testing.T, appKey, hmacKey []byte) *testSession {\n\treturn &testSession{\n\t\tt: t,\n\t\tkeySHS: appKey,\n\t\tkeyHMAC: hmacKey,\n\t}\n}", "title": "" }, { "docid": "41adff838651ae53802f9563120f2cdc", "score": "0.5426071", "text": "func New(tradingsessionid field.TradingSessionIDField, tradsesstatus field.TradSesStatusField) (m TradingSessionStatus) {\n\tm.Header = fix44.NewHeader()\n\tm.Init()\n\tm.Trailer.Init()\n\n\tm.Header.Set(field.NewMsgType(\"h\"))\n\tm.Set(tradingsessionid)\n\tm.Set(tradsesstatus)\n\n\treturn\n}", "title": "" }, { "docid": "aa67eb7496c447ebc837dd0ef7fd1a14", "score": "0.54245263", "text": "func NewSessions() *Sessions {\n\treturn &Sessions{\n\t\tbyTok: map[string]string{},\n\t\tbyUsr: map[string]string{},\n\t}\n}", "title": "" }, { "docid": "fea726ceb337250e51d77f8de1f06398", "score": "0.53920805", "text": "func NewSession(i *System) *Session {\n\tcdb := i.CoreDB.Clone()\n\thdb := i.HorizonDB.Clone()\n\n\treturn &Session{\n\t\tConfig: i.Config,\n\t\tIngestion: &Ingestion{\n\t\t\tDB: hdb,\n\t\t},\n\t\tNetwork: i.Network,\n\t\tStellarCoreURL: i.StellarCoreURL,\n\t\tSkipCursorUpdate: i.SkipCursorUpdate,\n\t\tMetrics: &i.Metrics,\n\t\tAssetStats: &AssetStats{\n\t\t\tCoreSession: cdb,\n\t\t\tHistorySession: hdb,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "aafdc1744da50099b72dadc350d7cf89", "score": "0.5380435", "text": "func (pdr *ProviderMem) SessionNew(sid string) (session.Store, error) {\n\tpdr.lock.RLock()\n\tif element, ok := pdr.sessions[sid]; ok {\n\t\tgo pdr.SessionUpdate(sid)\n\t\tpdr.lock.RUnlock()\n\t\treturn element.Value.(*SessionStoreMem), nil\n\t}\n\tpdr.lock.RUnlock()\n\tpdr.lock.Lock()\n\tnewSess := &SessionStoreMem{sid: sid, timeAccessed: time.Now(), values: make(map[interface{}]interface{})}\n\telement := pdr.list.PushFront(newSess)\n\tpdr.sessions[sid] = element\n\tpdr.lock.Unlock()\n\treturn newSess, nil\n}", "title": "" }, { "docid": "7ed6f80fe7cbdc52f206c12ddbd8213a", "score": "0.5344316", "text": "func newSession() (*session.Session, error) {\n\topts := session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t}\n\tif Command.AwsOpts.Profile != \"\" {\n\t\topts.Profile = Command.AwsOpts.Profile\n\t}\n\tsess, err := session.NewSessionWithOptions(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, nil\n}", "title": "" }, { "docid": "1552c6810ff447b59ad3f79a22b08e97", "score": "0.5339352", "text": "func NewSession() (Session, *SessionMetadata) {\n\tvar (\n\t\ttoken Session\n\t\ttemp *big.Int\n\t\terr error\n\t\tmetadata = &SessionMetadata{\n\t\t\tExpiry: time.Now().Add(expiryDelay),\n\t\t}\n\t)\n\tfor i := 0; i < SessionKeyLength; i++ {\n\t\ttemp, err = rand.Int(rand.Reader, byteSize)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error reading from random number generator! %v\", err)\n\t\t}\n\t\ttoken[i] = byte(temp.Int64())\n\t}\n\tif token.CurrentlyExists() {\n\t\ttoken, metadata = NewSession()\n\t}\n\tAllSessions[token] = metadata\n\treturn token, metadata\n}", "title": "" }, { "docid": "557bd64673d66389a9dc57e096903cb5", "score": "0.53239334", "text": "func (t *tun) newSession() string {\n\treturn uuid.New().String()\n}", "title": "" }, { "docid": "9c076c1fa1baf5cf47a5141a192f7b03", "score": "0.53220516", "text": "func NewNoTrades(val int) NoTradesField {\n\treturn NoTradesField{quickfix.FIXInt(val)}\n}", "title": "" }, { "docid": "7daf0bd7b8c5126d55dfc95ecf21546c", "score": "0.531832", "text": "func NewSession() Session {\n\tvar mySession Session\n\tmySession = make(map[int64]string)\n\n\treturn mySession\n}", "title": "" }, { "docid": "12f9f876be2ef30c247c7cd86337fc41", "score": "0.5312939", "text": "func newSession(amqpSession *amqp.Session) (*session, error) {\n\tid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &session{\n\t\tSession: amqpSession,\n\t\tSessionID: id.String(),\n\t\tcounter: 0,\n\t}, nil\n}", "title": "" }, { "docid": "79d1fb87184faac2b6955d1b38338050", "score": "0.5303838", "text": "func NewSession() *Session {\n\treturn &Session{\n\t\tState: StateNone,\n\t\tTransactionID: 1,\n\t\tCurrentLine: 1,\n\t\tHistory: []string{},\n\t}\n}", "title": "" }, { "docid": "6beb75af8f1cedbeaffe498bb0f0b3e4", "score": "0.5291598", "text": "func (s *SessionManager) newSession() (id string, sssn *session) {\n\ts.l.Lock()\n\tdefer func() {\n\t\ts.l.Unlock()\n\t}()\n\tfor i := 0; i < 99; i++ {\n\t\tid = newSessionId()\n\t\tif _, exist := s.sessions[id]; !exist {\n\t\t\tnow := time.Now()\n\t\t\tsssn = &session{id: id, ctime: now, atime: now}\n\t\t\ts.sessions[id] = sssn\n\t\t\treturn\n\t\t}\n\t}\n\tpanic(\"Can't generate new session id\")\n}", "title": "" }, { "docid": "b85ea4827e377037e0af3632b57997cf", "score": "0.5290037", "text": "func NewSessions() *Sessions {\n\treturn &Sessions{\n\t\tsessions: make(map[string]*Session),\n\t}\n}", "title": "" }, { "docid": "7cb97896411c553ed30fc01a3f76a76e", "score": "0.5286188", "text": "func (e *Entity) NewSession() string {\n\te.AssertUser()\n\tkey := base.GenerateHexSecret(32)\n\tdata := member.SessionData{\n\t\tKey: key,\n\t\tUserId: &e.data.Id,\n\t\tCreated: time.Now(),\n\t\tLastActivity: time.Now(),\n\t}\n\tif err := scol.Insert(data); err != nil {\n\t\tlog.Printf(\"NewSession(): scol.Insert(): %s\", err)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "576f712a8a39cbe98c8e9d6c8f762500", "score": "0.5276356", "text": "func NewSessions(l *log.Logger) *Sessions {\r\n\treturn &Sessions{l}\r\n}", "title": "" }, { "docid": "676bda9d796ed2191ad55bf8727564db", "score": "0.5275889", "text": "func New() *Session {\n\treturn &Session{}\n}", "title": "" }, { "docid": "84fa77cbbea6712668c6b77a1b7d59a7", "score": "0.5264524", "text": "func (*NoFactory) New() Module { return nil }", "title": "" }, { "docid": "8e0fa5069d50eae09a677204e701fe26", "score": "0.52559686", "text": "func New(Token string, Intents int) (sess *Session, err error) {\n\tsess = &Session{\n\t\tToken: Token,\n\t\tSequence: 0,\n\t\tIntents: Intents,\n\t}\n\n\tif c, _, err := websocket.DefaultDialer.Dial(\"wss://gateway.discord.gg?v=8&encoding=json\", nil); err == nil {\n\t\tsess.Connection = c\n\t} else {\n\t\treturn nil, err\n\t}\n\n\treturn sess, nil\n}", "title": "" }, { "docid": "b3e2c41733392c518bd314b55bc360ed", "score": "0.52539283", "text": "func newSession(db *sql.DB) *Session {\n\ts := &Session{\n\t\tdb: db,\n\t\tLogger: log.New(os.Stderr, \"\", log.LstdFlags)}\n\ts.genreService = NewGenreService(s)\n\ts.artistService = NewArtistService(s)\n\ts.albumService = NewAlbumService(s)\n\ts.songService = NewSongService(s)\n\ts.AlbumDiscogService = NewAlbumDiscogService(s)\n\ts.SongDiscogService = NewSongDiscogService(s)\n\treturn s\n}", "title": "" }, { "docid": "9e7cdb7d2b15329d3239a6b7eba94b30", "score": "0.5245932", "text": "func NewSession() Session {\n\treturn Session{Cancel: make(chan bool, 1), Rules: rules.NewTestRules()}\n}", "title": "" }, { "docid": "7133b2639a386af8d15332452ea05cdd", "score": "0.52388066", "text": "func New() *NoOp {\n\treturn &NoOp{\n\t\tchanges: make(chan agents.Change, 10),\n\t}\n}", "title": "" }, { "docid": "4f04c1998f578ae602ec0b401e1a67f4", "score": "0.5235536", "text": "func NewSession(account string) (*Session, error) {\n\ts := &Session{account, nil}\n\tauth, err := s.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\ts.KiteAuth = auth\n\n\terr = s.testToken()\n\tif err != nil { \n\t\treturn nil, err \n\t}\n\n\treturn s, err\n}", "title": "" }, { "docid": "21c5ef7b1637f2a586ca90147b753d11", "score": "0.5224595", "text": "func newSession(stor storage.Storage, o *opt.Options) (s *session, err error) {\n\tif stor == nil {\n\t\treturn nil, os.ErrInvalid\n\t}\n\tstorLock, err := stor.Lock()\n\tif err != nil {\n\t\treturn\n\t}\n\ts = &session{\n\t\tstor: stor,\n\t\tstorLock: storLock,\n\t}\n\ts.setOptions(o)\n\ts.tops = newTableOps(s, s.o.GetMaxOpenFiles())\n\ts.setVersion(&version{s: s})\n\ts.log(\"log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock D·DeletedEntry L·Level Q·SeqNum T·TimeElapsed\")\n\treturn\n}", "title": "" }, { "docid": "69f6a7909f9f25f3c27aa66cfab4a324", "score": "0.5209221", "text": "func (m NoTradingSessionsRepeatingGroup) Get(i int) NoTradingSessions {\n\treturn NoTradingSessions{m.RepeatingGroup.Get(i)}\n}", "title": "" }, { "docid": "69f6a7909f9f25f3c27aa66cfab4a324", "score": "0.5209221", "text": "func (m NoTradingSessionsRepeatingGroup) Get(i int) NoTradingSessions {\n\treturn NoTradingSessions{m.RepeatingGroup.Get(i)}\n}", "title": "" }, { "docid": "69f6a7909f9f25f3c27aa66cfab4a324", "score": "0.5209221", "text": "func (m NoTradingSessionsRepeatingGroup) Get(i int) NoTradingSessions {\n\treturn NoTradingSessions{m.RepeatingGroup.Get(i)}\n}", "title": "" }, { "docid": "197b8c574493c5df423becf2a2945986", "score": "0.5202994", "text": "func NewSessions(db *sqlx.DB, log domain.LogService, timeout time.Duration, useSecureCookie bool) Sessions {\n\tstore := dbstore.NewDBStore(db)\n\tsession := session.NewSessionService(timeout, store, log)\n\tmiddleware := seshttp.NewSessionMiddleware(log, session)\n\tcookie := seshttp.NewSessionCookieService(useSecureCookie)\n\n\treturn Sessions{\n\t\tsession,\n\t\tmiddleware,\n\t\tcookie,\n\t}\n}", "title": "" }, { "docid": "3a7498ec89a36a9d84843633b9f5a355", "score": "0.5202477", "text": "func (m UserResponse) HasNoTradingSessions() bool {\n\treturn m.Has(tag.NoTradingSessions)\n}", "title": "" }, { "docid": "d16241f4dcc16b5af63b5becfed908d8", "score": "0.51973546", "text": "func (ctx *HandlerContext) newSession(validUser *users.User, w http.ResponseWriter) {\n\tvar state SessionState\n\tstate.User = validUser\n\tstate.StartTime = time.Now()\n\n\t_, err := sessions.BeginSession(ctx.SigningKey, ctx.SessionStore, state, w)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error while creating new session\")\n\t}\n}", "title": "" }, { "docid": "e218f84df61928fbfd14544b54b5df2e", "score": "0.5185718", "text": "func (repo *Repository) newSession() *mgo.Session {\n\treturn repo.dbSession.Clone()\n}", "title": "" }, { "docid": "779fbababa446d7e686beb8b35f01b0f", "score": "0.51814604", "text": "func New(sessionId, steamLogin, steamLoginSecure string, other steamid.SteamId) *Trade {\n\tclient := new(http.Client)\n\tclient.Timeout = 10 * time.Second\n\n\tt := &Trade{\n\t\tclient: client,\n\t\tother: other,\n\t\tsessionId: sessionId,\n\t\tbaseUrl: fmt.Sprintf(tradeUrl, other),\n\t\tVersion: 1,\n\t}\n\tcommunity.SetCookies(t.client, sessionId, steamLogin, steamLoginSecure)\n\treturn t\n}", "title": "" }, { "docid": "499958884aa9aa2fd22c211d5f95ff5f", "score": "0.5179461", "text": "func NewNoStrikes(symbol string, price float64) *NoStrikes {\n\tvar m NoStrikes\n\tm.SetSymbol(symbol)\n\tm.SetPrice(price)\n\treturn &m\n}", "title": "" }, { "docid": "2d6addf0504e5ca6194d4822a3c01a42", "score": "0.5171194", "text": "func (c *Client) NewSession() {\n\ts := randomString(10)\n\tc.SessionID = s\n}", "title": "" }, { "docid": "af74bb4bc1e2421ce4011e217f70e4dc", "score": "0.5158146", "text": "func (s *TiKVStore) New(r *http.Request, name string) (*sessions.Session, error) {\n\tvar (\n\t\terr error\n\t\tok bool\n\t)\n\tsession := sessions.NewSession(s, name)\n\t// make a copy\n\toptions := *s.options\n\tsession.Options = &options\n\tsession.IsNew = true\n\tif c, errCookie := r.Cookie(name); errCookie == nil {\n\t\terr = securecookie.DecodeMulti(name, c.Value, &session.ID, s.Codecs...)\n\t\tif err == nil {\n\t\t\tok, err = s.load(r.Context(), session)\n\t\t\tsession.IsNew = !(err == nil && ok) // not new if no error and data available\n\t\t}\n\t}\n\treturn session, err\n}", "title": "" }, { "docid": "d89e68d24904c6621e2160a9734e9452", "score": "0.51472795", "text": "func NewSession() Session {\n\treturn Session{ID: NewID()}\n}", "title": "" }, { "docid": "d27d5b3ef3cb42695c1a6908d3826ef2", "score": "0.5147114", "text": "func (f NoTradingSessionsField) Tag() quickfix.Tag { return tag.NoTradingSessions }", "title": "" }, { "docid": "f33fa65a112a6982abebebbcf3680dc8", "score": "0.51403457", "text": "func NewAllUserSessionsOK() *AllUserSessionsOK {\n return &AllUserSessionsOK{\n }\n}", "title": "" }, { "docid": "4785b4de4bea51957a47e63cd8aa3775", "score": "0.51398253", "text": "func New(collection *nano.Collection) *SessionStoreNano {\n\treturn &SessionStoreNano{\n\t\tcollection: collection,\n\t}\n}", "title": "" }, { "docid": "a031476bb4c43c21b68cd9cf259443b5", "score": "0.5132659", "text": "func newEmptyHistory() *History {\n\trecords := make(map[string]Record)\n\treturn &History{\n\t\trecords: records,\n\t}\n}", "title": "" }, { "docid": "ddfee1a7e384bf6d7771ae1a3f6b51a5", "score": "0.5128158", "text": "func NewSession() *Session {\n\tb := make([]byte, 8)\n\trand.Read(b)\n\tid := hex.EncodeToString(b)\n\treturn &Session{\n\t\tID: id,\n\t\tChan: make(chan []byte),\n\t\tClose: make(chan struct{}),\n\t\tState: 0,\n\t}\n}", "title": "" }, { "docid": "54939b6d4bb5cebb6f73eaa20d454a6a", "score": "0.5111534", "text": "func New() Backend {\n\treturn Backend{client: \"dummy\"}\n}", "title": "" }, { "docid": "f04a76ad4c75f8a1a558b289c4aae0e4", "score": "0.5108364", "text": "func NewNoOrders(clordid string, cumqty int, leavesqty int, cxlqty int, avgpx float64) *NoOrders {\n\tvar m NoOrders\n\tm.SetClOrdID(clordid)\n\tm.SetCumQty(cumqty)\n\tm.SetLeavesQty(leavesqty)\n\tm.SetCxlQty(cxlqty)\n\tm.SetAvgPx(avgpx)\n\treturn &m\n}", "title": "" }, { "docid": "381192eedeb5e29cf2e2ad7a85660029", "score": "0.5107557", "text": "func New(db *sql.DB, tableName string) *Provider {\n\tif tableName == \"\" {\n\t\ttableName = \"http_sessions\"\n\t}\n\treturn &Provider{\n\t\tdb: db,\n\t\ttableName: tableName,\n\t}\n}", "title": "" }, { "docid": "d9f349cdf76b790b6f08e01989c04c15", "score": "0.5084724", "text": "func NewNuttall() *Nuttall {\n\treturn &Nuttall{}\n}", "title": "" }, { "docid": "1a97c9ed55f30277f819b7e3323f8426", "score": "0.50804734", "text": "func NewSession() *Session {\n\treturn &Session{\n\t\tVersion: -1,\n\t\tOpCache: map[int]ops.Op{},\n\t\tMergeCache: map[int][]ops.Op{},\n\t}\n}", "title": "" }, { "docid": "da6c31647bff5f05f089b7feab74c0ea", "score": "0.50755036", "text": "func (t *MailboxTracker) NewSession() *SessionTracker {\n\tst := &SessionTracker{mailbox: t}\n\tt.mutex.Lock()\n\tt.sessions[st] = struct{}{}\n\tt.mutex.Unlock()\n\treturn st\n}", "title": "" }, { "docid": "f35ad7691dbd581cb394b0e7e9c130ca", "score": "0.50727963", "text": "func MustNewSession(cfg Config) *session.Session {\n\tsession, err := NewSession(cfg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn session\n}", "title": "" }, { "docid": "a5009d80f55d75f7a253370a8da05518", "score": "0.50607437", "text": "func newSession(subscription string, rg string, scaleSet string) (*azureSession, error) {\n\tauthorizer, err := auth.NewAuthorizerFromCLI()\n\tif err != nil {\n\t\treturn &azureSession{}, err\n\t}\n\n\treturn &azureSession{\n\t\tSubscriptionID: subscription,\n\t\tResourceGroupName: rg,\n\t\tScaleSetName: scaleSet,\n\t\tAuthorizer: &authorizer,\n\t}, nil\n}", "title": "" }, { "docid": "bb65002126dce52a8cabcf2db38beee8", "score": "0.5059078", "text": "func New(sess *session.Session) *Store {\n\ts := &Store{\n\t\tsess: sess,\n\t\tbuckets: make(map[string]*Bucket),\n\t}\n\ts.cond = ctxsync.NewCond(&s.mu)\n\treturn s\n}", "title": "" }, { "docid": "7fe9479d8644c19d6aa3376cd2fa33fc", "score": "0.5052492", "text": "func New(initString string) (*discordgo.Session, error){\n\tvar err error\n\tSession, err = discordgo.New(initString)\n\tif(err != nil){\n\t\treturn Session, err\n\t}\n\treturn Session, nil\n}", "title": "" }, { "docid": "0d6623026c9b487a245fca8ca9496b3b", "score": "0.50479394", "text": "func CreateNewSession(id uint) *entities.Session {\n\ttokenExpires := time.Now().AddDate(0, 1, 0).Unix()\n\tsigningString, err := rtoken.GenerateRandomString(32)\n\tsessionID, err := rtoken.GenerateRandomString(32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &entities.Session{\n\t\tSessionID: sessionID,\n\t\tExpires: tokenExpires,\n\t\tSigningKey: []byte(signingString),\n\t\tUUID: id,\n\t}\n}", "title": "" }, { "docid": "ed1afcb45d7f659fc896c5f80abca0d2", "score": "0.5037993", "text": "func NewNoAllocs() *NoAllocs {\n\tvar m NoAllocs\n\treturn &m\n}", "title": "" } ]
f267ce25681fd38a35d61c2f7ca6d49b
getOverlappingNodes returns the list of nodes that is present both in the accessibleNodes of the storagePool and the host names present provided in the preferred segment of accessibility requirements.
[ { "docid": "7aa7873c86976c42679a912a14a65f16", "score": "0.8228759", "text": "func getOverlappingNodes(accessibleNodes []string, topologyRequirement *csi.TopologyRequirement) ([]string, error) {\n\tvar overlappingNodes []string\n\tnoOverLappingNodes := true\n\taccessibleNodeMap := make(map[string]bool)\n\tfor _, node := range accessibleNodes {\n\t\taccessibleNodeMap[node] = true\n\t}\n\tfor _, topology := range topologyRequirement.GetPreferred() {\n\t\thostname := topology.Segments[v1.LabelHostname]\n\t\tif accessibleNodeMap[hostname] {\n\t\t\t// Found an overlapping node.\n\t\t\tnoOverLappingNodes = false\n\t\t\toverlappingNodes = append(overlappingNodes, hostname)\n\t\t}\n\t}\n\tif noOverLappingNodes {\n\t\treturn nil, fmt.Errorf(\"couldn't find any overlapping node as accessible nodes present in storage pool \" +\n\t\t\t\"and hostnames provided in accessibility requirements are disjoint\")\n\t}\n\treturn overlappingNodes, nil\n}", "title": "" } ]
[ { "docid": "7d925de448c644a94828e8c772a3540d", "score": "0.51652735", "text": "func NodeAppend(nodeList dockercloud.NodeListResponse) ([]string, []string) {\n\tnetworkAvailable := make(map[string]NodeNetwork)\n\tNodePublicIPs := []string{}\n\tnodePrivateIps := []string{}\n\n\tfor i := range nodeList.Objects {\n\t\tstate := nodeList.Objects[i].State\n\t\tif state == \"Deployed\" || state == \"Unreachable\" {\n\t\t\tnetworkAvailable[nodeList.Objects[i].Uuid] = NodeNetwork{cidrs: nodeList.Objects[i].Private_ips, PublicIP: nodeList.Objects[i].Public_ip, region: nodeList.Objects[i].Region}\n\t\t}\n\t}\n\n\ttemp := []string{}\n\tfor _, value := range networkAvailable {\n\t\ttemp1 := []string{}\n\t\tif len(value.cidrs) > 0 {\n\t\t\tfor _, networkAvailableCIDR := range value.cidrs {\n\t\t\tLoop1:\n\t\t\t\tfor _, network := range NodeCIDR {\n\t\t\t\t\tif networkAvailableCIDR.CIDR != network.CIDR && IsInPrivateRange(networkAvailableCIDR.CIDR) && IsInPrivateRange(network.CIDR) {\n\t\t\t\t\t\tif os.Getenv(\"DOCKERCLOUD_PRIVATE_CIDR\") != \"\" {\n\t\t\t\t\t\t\tif value.region == Region && CheckIfSameNetwork(os.Getenv(\"DOCKERCLOUD_PRIVATE_CIDR\"), networkAvailableCIDR.CIDR) {\n\t\t\t\t\t\t\t\ttemp1 = append(nodePrivateIps, networkAvailableCIDR.CIDR)\n\t\t\t\t\t\t\t\tbreak Loop1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif CheckIfSameNetwork(network.CIDR, networkAvailableCIDR.CIDR) {\n\t\t\t\t\t\t\t\ttemp1 = append(nodePrivateIps, networkAvailableCIDR.CIDR)\n\t\t\t\t\t\t\t\tbreak Loop1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(temp1) == 0 && value.PublicIP != NodePublicIP {\n\t\t\t\t\tNodePublicIPs = append(NodePublicIPs, value.PublicIP)\n\t\t\t\t} else {\n\t\t\t\t\ttemp = append(temp, temp1...)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif value.PublicIP != NodePublicIP {\n\t\t\t\tNodePublicIPs = append(NodePublicIPs, value.PublicIP)\n\t\t\t}\n\t\t}\n\t}\n\tif len(temp) > 0 {\n\t\tnodePrivateIps = append(nodePrivateIps, temp...)\n\t}\n\n\tnodePrivateIps = CIDRToIP(nodePrivateIps)\n\treturn tools.RemoveDuplicates(NodePublicIPs), tools.RemoveDuplicates(nodePrivateIps)\n}", "title": "" }, { "docid": "dd437a0b5ed84ba2d4ee465a349da08f", "score": "0.5096723", "text": "func GetNodeList(topo *csi.TopologyRequirement) ([]string, error) {\n\n\tvar nodelist []string\n\n\tlist, err := k8sapi.ListNodes(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, node := range list.Items {\n\t\tfor _, prf := range topo.Preferred {\n\t\t\tnodeFiltered := false\n\t\t\tfor key, value := range prf.Segments {\n\t\t\t\tif node.Labels[key] != value {\n\t\t\t\t\tnodeFiltered = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif nodeFiltered == false {\n\t\t\t\tnodelist = append(nodelist, node.Name)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodelist, nil\n}", "title": "" }, { "docid": "89912f6e8a1a7f1cf2c3cc22e1f65526", "score": "0.489335", "text": "func (w *PrefixWatcher) getAssignedPrefixes() ([]string, error) {\n\tvar ps []string\n\n\tf := func(ipVersion int) error {\n\t\tblockList, err := w.client.Backend.List(\n\t\t\tcontext.Background(),\n\t\t\tmodel.BlockAffinityListOptions{Host: *config.NodeName, IPVersion: ipVersion},\n\t\t\t\"\",\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, block := range blockList.KVPairs {\n\t\t\tw.log.Debugf(\"Found assigned prefix: %+v\", block)\n\t\t\tkey := block.Key.(model.BlockAffinityKey)\n\t\t\tvalue := block.Value.(*model.BlockAffinity)\n\t\t\tif value.State == model.StateConfirmed && !value.Deleted {\n\t\t\t\tps = append(ps, key.CIDR.String())\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tip4, ip6 := common.GetBGPSpecAddresses(w.nodeBGPSpec)\n\tif ip4 != nil {\n\t\tif err := f(4); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif ip6 != nil {\n\t\tif err := f(6); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ps, nil\n}", "title": "" }, { "docid": "c00fabcfd3ffdd789221e6967b4110b6", "score": "0.4861246", "text": "func (c Config) getOrderedNodes(pods [][]*core.Pod) ([][]RedisNode, error) {\n\tvar (\n\t\terr error\n\t\tnodesConf string\n\t\tnodes map[string]*RedisNode\n\t\torderedNodes [][]RedisNode\n\t)\n\n\tif err = c.ensureFirstPodAsMaster(pods); err != nil {\n\t\treturn nil, err\n\t}\n\nAgain:\n\tfor {\n\t\texecPod := pods[0][0]\n\t\tif nodesConf, err = c.getClusterNodes(execPod, execPod.Status.PodIP); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// for j > 0, this ensures pods[i][j] is slave of pods[i][0]\n\t\tnodes = processNodesConf(nodesConf)\n\t\tfor _, master := range nodes {\n\t\t\tfor i := 0; i < len(pods); i++ {\n\t\t\t\tif pods[i][0].Status.PodIP == master.IP {\n\t\t\t\t\tfor _, slave := range master.Slaves {\n\t\t\t\t\t\tfor k := 0; k < len(pods); k++ {\n\t\t\t\t\t\t\tfor j := 1; j < len(pods[k]); j++ {\n\t\t\t\t\t\t\t\tif pods[k][j].Status.PodIP == slave.IP && i != k {\n\t\t\t\t\t\t\t\t\tif err = c.clusterReplicate(\n\t\t\t\t\t\t\t\t\t\tpods[k][j], pods[k][j].Status.PodIP,\n\t\t\t\t\t\t\t\t\t\tgetNodeId(getNodeConfByIP(nodesConf, pods[k][0].Status.PodIP))); err != nil {\n\t\t\t\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ttime.Sleep(time.Second * 5)\n\t\t\t\t\t\t\t\t\tgoto Again\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbreak\n\t}\n\n\t// order the nodes we got earlier\n\torderedNodes = make([][]RedisNode, len(pods))\n\tgotMasterCnt := 0\n\tfor i := 0; i < len(nodes); i++ {\n\t\tif gotMasterCnt >= len(pods) {\n\t\t\tbreak\n\t\t}\n\t\tfor _, master := range nodes {\n\t\t\tif master.IP == pods[i][0].Status.PodIP {\n\t\t\t\tgotMasterCnt++\n\t\t\t\torderedNodes[i] = make([]RedisNode, len(master.Slaves)+1)\n\t\t\t\torderedNodes[i][0] = *master\n\t\t\t\tfor j := 1; j < len(orderedNodes[i]); j++ {\n\t\t\t\t\tfor _, slave := range master.Slaves {\n\t\t\t\t\t\tif slave.IP == pods[i][j].Status.PodIP {\n\t\t\t\t\t\t\torderedNodes[i][j] = *slave\n\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn orderedNodes, nil\n}", "title": "" }, { "docid": "a96a42f2b28a8fb61cda59e27cc7b524", "score": "0.48600477", "text": "func OtherAddrs() []string {\n\tvar (\n\t\taddrs []string\n\t\terr error\n\t)\n\tlength := *NewFullNodes\n\tif length > 0 {\n\t\tif *EnableDocker {\n\t\t\taddrs, err = GetStrArrayCfgVal(nil, \"iplist\", \"docker\")\n\t\t} else {\n\t\t\taddrs, err = GetStrArrayCfgVal(nil, \"iplist\", \"local\")\n\t\t}\n\t\tif length > len(addrs) {\n\t\t\tlength = len(addrs)\n\t\t}\n\t\treturn addrs[:length]\n\t}\n\tif err != nil {\n\t\tlogger.Panic(err)\n\t}\n\treturn []string{}\n}", "title": "" }, { "docid": "aaad19ba199607b88effa7093f87f97e", "score": "0.48286375", "text": "func usableNodes(eps epslices.EpsOrSlices, speakers map[string]bool) []string {\n\tusable := map[string]bool{}\n\tswitch eps.Type {\n\tcase epslices.Eps:\n\t\tfor _, subset := range eps.EpVal.Subsets {\n\t\t\tfor _, ep := range subset.Addresses {\n\t\t\t\tif ep.NodeName == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif speakers != nil {\n\t\t\t\t\tif hasSpeaker := speakers[*ep.NodeName]; !hasSpeaker {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif _, ok := usable[*ep.NodeName]; !ok {\n\t\t\t\t\tusable[*ep.NodeName] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase epslices.Slices:\n\t\tfor _, slice := range eps.SlicesVal {\n\t\t\tfor _, ep := range slice.Endpoints {\n\t\t\t\tif !epslices.IsConditionReady(ep.Conditions) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif ep.NodeName == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnodeName := *ep.NodeName\n\t\t\t\tif speakers != nil {\n\t\t\t\t\tif hasSpeaker := speakers[nodeName]; !hasSpeaker {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif _, ok := usable[nodeName]; !ok {\n\t\t\t\t\tusable[nodeName] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar ret []string\n\tfor node, ok := range usable {\n\t\tif ok {\n\t\t\tret = append(ret, node)\n\t\t}\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "7c0b43ca920d1cea5a27b183cfebf161", "score": "0.47982848", "text": "func Hosts(cidr string) ([]string, error) {\n\tvar ip uint32 // ip address\n\n\tvar ipS uint32 // Start IP address range\n\tvar ipE uint32 // End IP address range\n\tcidrParts := strings.Split(cidr, \"/\")\n\n\tip = iPv4ToUint32(cidrParts[0])\n\tbits, _ := strconv.ParseUint(cidrParts[1], 10, 32)\n\n\tif ipS == 0 || ipS > ip {\n\t\tipS = ip\n\t}\n\n\tip = ip | (0xFFFFFFFF >> bits)\n\n\tif ipE < ip {\n\t\tipE = ip\n\t}\n\t//ipStart := uInt32ToIPv4(ipS)\n\tlog.Infof(\"Start of range: %d\\n\", lastOctet(ipS))\n\t//ipEnd := uInt32ToIPv4(ipE)\n\tlog.Infof(\"End of Range: %d\\n\", lastOctet(ipE))\n\tips := make([]string, 0)\n\tfor w := lastOctet(ipS); w <= lastOctet(ipE); w++ {\n\t\tips = append(ips, uInt32ToIPv4(ipS))\n\t\tipS = ipS + 1\n\t}\n\treturn ips, nil\n}", "title": "" }, { "docid": "d802d05c0c5ffa8fb48ff92ac33c5284", "score": "0.47914797", "text": "func (s *segregatedScheduler) minMaxNodes(nodes []cluster.Node, appName, process string) (string, string, error) {\n\tnodesPtr := make([]*cluster.Node, len(nodes))\n\tfor i := range nodes {\n\t\tnodesPtr[i] = &nodes[i]\n\t}\n\tmetaFreqList, _, err := splitMetadata(nodesPtr)\n\tif err != nil {\n\t\tlog.Debugf(\"[scheduler] ignoring metadata diff when selecting node: %s\", err)\n\t}\n\thostGroupMap := map[string]int{}\n\tfor i, m := range metaFreqList {\n\t\tfor _, n := range m.nodes {\n\t\t\thostGroupMap[net.URLToHost(n.Address)] = i\n\t\t}\n\t}\n\thosts, hostsMap := s.nodesToHosts(nodes)\n\thostCountMap, err := s.aggregateContainersByHost(hosts)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tappCountMap, err := s.aggregateContainersByHostAppProcess(hosts, appName, process)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpriorityEntries := []map[string]int{appGroupCount(hostGroupMap, appCountMap), appCountMap, hostCountMap}\n\tvar minHost, maxHost string\n\tvar minScore uint64 = math.MaxUint64\n\tvar maxScore uint64 = 0\n\tfor _, host := range hosts {\n\t\tvar score uint64\n\t\tfor i, e := range priorityEntries {\n\t\t\tscore += uint64(e[host]) << uint((len(priorityEntries)-i-1)*(64/len(priorityEntries)))\n\t\t}\n\t\tif score < minScore {\n\t\t\tminScore = score\n\t\t\tminHost = host\n\t\t}\n\t\tif score > maxScore {\n\t\t\tmaxScore = score\n\t\t\tmaxHost = host\n\t\t}\n\t}\n\treturn hostsMap[minHost], hostsMap[maxHost], nil\n}", "title": "" }, { "docid": "bf6b0dbe37b18cb4be240a990d77a7f9", "score": "0.47845927", "text": "func (c *Controller) assignedToComputeNodes(nodes []dax.AssignedNode) ([]dax.ComputeNode, error) {\n\tcomputeNodes := make([]dax.ComputeNode, 0)\n\n\tfor _, node := range nodes {\n\t\trole, ok := node.Role.(*dax.ComputeRole)\n\t\tif !ok {\n\t\t\t// TODO: this should be impossible, but still, we could use\n\t\t\t// some API (HTTP?) error codes.\n\t\t\treturn nil, NewErrInternal(\"not a compute node\")\n\t\t}\n\n\t\tcomputeNodes = append(computeNodes, dax.ComputeNode{\n\t\t\tAddress: node.Address,\n\t\t\tTable: role.TableKey,\n\t\t\tShards: role.Shards,\n\t\t})\n\t}\n\n\treturn computeNodes, nil\n}", "title": "" }, { "docid": "e56e3474d6063d97e12932b361181c6f", "score": "0.4775744", "text": "func (pool *SocketPool) SelectNodes() (*ring.Ring, *ring.Ring) {\n\tsafeNodes := make(map[*ActiveNode]bool)\n\tunsafeNodes := make(map[*ActiveNode]bool)\n\n\t// separate node list by whether status is old or not\n\tfor node := range pool.Nodes {\n\t\tif node.Status.isOld {\n\t\t\tunsafeNodes[node] = true\n\t\t} else {\n\t\t\tsafeNodes[node] = true\n\t\t}\n\t}\n\n\t// TODO: implement node selection algorithm\n\n\treturn mapToRing(safeNodes), mapToRing(unsafeNodes)\n}", "title": "" }, { "docid": "2c70f49e45e1fb45bf2bcb419de8104c", "score": "0.47732213", "text": "func (s *NodePlanner) GetAllowedNodesOrCached() ([]*unstructured.Unstructured, error) {\n\tif len(s.allowedNodes) != 0 {\n\t\t// used the cached info\n\t\treturn s.allowedNodes, nil\n\t}\n\treturn s.GetAllowedNodes()\n}", "title": "" }, { "docid": "95d21f3e248c2f8e02f672094df70ca2", "score": "0.4763901", "text": "func (s *NodePlanner) GetAllowedNodes() ([]*unstructured.Unstructured, error) {\n\tvar allowed []*unstructured.Unstructured\n\tallnodes := s.GetAllNodes()\n\tif len(s.NodeSelector.SelectorTerms) == 0 {\n\t\t// all nodes are allowed since there is no preference\n\t\t// i.e. no selector terms were specified\n\t\ts.allowedNodes = allnodes\n\t\treturn s.allowedNodes, nil\n\t}\n\tfor _, node := range allnodes {\n\t\teval := selector.Evaluation{\n\t\t\tTarget: node,\n\t\t\tTerms: s.NodeSelector.SelectorTerms,\n\t\t}\n\t\tmatch, err := eval.RunMatch()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif match {\n\t\t\tallowed = append(allowed, node)\n\t\t}\n\t}\n\ts.allowedNodes = allowed\n\treturn s.allowedNodes, nil\n}", "title": "" }, { "docid": "7e135d281d28285d4c27b926044aa94f", "score": "0.4754781", "text": "func (c *Conn) GetAvailableNodes(path ...NodeName) ([]string, error) {\n\tvar ret []string\n\targs := pathToArgs(path)\n\terr := c.Request(\"get_nodes\", &ret, args...)\n\treturn ret, err\n}", "title": "" }, { "docid": "0ee5f539c42ca1e2a6aa3a2fdba44975", "score": "0.47484216", "text": "func findAGsMatchingNodeLabels(nodeLabels map[string]string, ags []*cerebralv1alpha1.AutoscalingGroup) []*cerebralv1alpha1.AutoscalingGroup {\n\tmatchingags := make([]*cerebralv1alpha1.AutoscalingGroup, 0)\n\n\tfor _, autoscalingGroup := range ags {\n\t\t// create selector object from nodeSelector of AG\n\t\tagselectors := nodeutil.GetNodesLabelSelector(autoscalingGroup.Spec.NodeSelector)\n\n\t\t// check to see if the nodeSelector labels match the node labels that\n\t\t// were passed in\n\t\tif agselectors.Matches(labels.Set(nodeLabels)) {\n\t\t\tmatchingags = append(matchingags, autoscalingGroup)\n\t\t}\n\t}\n\n\treturn matchingags\n}", "title": "" }, { "docid": "b1bb2b280e5bd3ba7d6b0b2a6dd95b6e", "score": "0.47391954", "text": "func (ac AhoCorasick) IterOverlapping(haystack string) Iter {\n\treturn ac.IterOverlappingByte([]byte(haystack))\n}", "title": "" }, { "docid": "d67e9cdea237d02b3b299a0da3201914", "score": "0.4736014", "text": "func (n *Node) Pool() (pool ipamTypes.AllocationMap) {\n\tpool = ipamTypes.AllocationMap{}\n\tn.mutex.RLock()\n\tfor k, allocationIP := range n.available {\n\t\tpool[k] = allocationIP\n\t}\n\tn.mutex.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "3b4be0d415f3a91dcddada08453041c6", "score": "0.4728733", "text": "func (r *RedisClusterView) HealthyNodeIPs() []string {\n\tvar ips []string\n\tfor _, leader := range *r {\n\t\tif leader.Pod != nil && !(leader.Failed || leader.Terminating) {\n\t\t\tips = append(ips, leader.Pod.Status.PodIP)\n\t\t}\n\t\tfor _, follower := range leader.Followers {\n\t\t\tif follower.Pod != nil && !(follower.Failed || follower.Terminating) {\n\t\t\t\tips = append(ips, follower.Pod.Status.PodIP)\n\t\t\t}\n\t\t}\n\t}\n\treturn ips\n}", "title": "" }, { "docid": "92cd9fd276d8d8a89772cd7f729e16fd", "score": "0.47247434", "text": "func (o *SubscriptionMetrics) ComputeNodesSockets() *ClusterResource {\n\tif o != nil && o.bitmap_&8 != 0 {\n\t\treturn o.computeNodesSockets\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "332db2d53537b7f7959b0d62197ac59c", "score": "0.47130844", "text": "func MakeOverlapNetwork(reads []string, match, mismatch, gap, threshold float64) map[string][]string {\n\t//Initialize an adjacency list to represent the overlap graph.\n\tmtx := OverlapScoringMatrix(reads, match, mismatch, gap)\n\tmtx1 := BinarizeMatrix(mtx, threshold)\n\tadjacencyList := make(map[string][]string)\n\n\tfor i := 0; i < len(mtx); i++ {\n\t\tfor j := 0; j < len(mtx); j++ {\n\t\t\tif mtx1[i][j] == 1 {\n\t\t\t\tadjacencyList[reads[i]] = append(adjacencyList[reads[i]], reads[j])\n\t\t\t}\n\t\t}\n\t}\n\t// fill in details of the function here.\n\n\treturn adjacencyList\n}", "title": "" }, { "docid": "63a6a7566b5e02e330e169b354df51ef", "score": "0.47005054", "text": "func hostsFromRange(m []string) ([]string, error, error) {\n\tip := m[2] // [192.168.0].1-255\n\n\tstart, err1 := strconv.Atoi(m[3]) // 192.168.0.(1)-255\n\tend, err2 := strconv.Atoi(m[4]) // 192.168.(0).(1)-(255)\n\tvar ips []string\n\n\tfor i := start; i <= end; i++ {\n\t\tip := ip + strconv.Itoa(i)\n\t\tips = append(ips, ip)\n\t}\n\treturn ips, err1, err2\n}", "title": "" }, { "docid": "cbb302eca769cbac0bf3146828cfa0eb", "score": "0.4694323", "text": "func (n *Node) Pool() (pool map[string]v2.AllocationIP) {\n\tpool = map[string]v2.AllocationIP{}\n\tn.mutex.RLock()\n\tfor k, allocationIP := range n.available {\n\t\tpool[k] = allocationIP\n\t}\n\tn.mutex.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "ce96b2ec20a13660e8f66760caf77ae0", "score": "0.468956", "text": "func (_Governance *GovernanceSession) Nodes(arg0 *big.Int) (struct {\n\tOwner common.Address\n\tPublicKey []byte\n\tStaked *big.Int\n\tFined *big.Int\n\tName string\n\tEmail string\n\tLocation string\n\tUrl string\n\tUnstaked *big.Int\n\tUnstakedAt *big.Int\n}, error) {\n\treturn _Governance.Contract.Nodes(&_Governance.CallOpts, arg0)\n}", "title": "" }, { "docid": "3fb21514123aeb68dd12f074d442c7dc", "score": "0.46585265", "text": "func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerNodes, error) {\n\tc := NewContext(m)\n\tc.setPivot(pivot)\n\tc.setCBF(p.ContainerBackupFactor())\n\n\tif err := c.processFilters(p); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := c.processSelectors(p); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := make([]Nodes, len(p.Replicas()))\n\n\tfor i, r := range p.Replicas() {\n\t\tif r == nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: REPLICA\", ErrMissingField)\n\t\t}\n\n\t\tif r.Selector() == \"\" {\n\t\t\tif len(p.Selectors()) == 0 {\n\t\t\t\ts := new(Selector)\n\t\t\t\ts.SetCount(r.Count())\n\t\t\t\ts.SetFilter(MainFilterName)\n\n\t\t\t\tnodes, err := c.getSelection(p, s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tresult[i] = flattenNodes(nodes)\n\t\t\t}\n\n\t\t\tfor _, s := range p.Selectors() {\n\t\t\t\tresult[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...)\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tnodes, ok := c.Selections[r.Selector()]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: REPLICA '%s'\", ErrSelectorNotFound, r.Selector())\n\t\t}\n\n\t\tresult[i] = append(result[i], flattenNodes(nodes)...)\n\t}\n\n\treturn containerNodes(result), nil\n}", "title": "" }, { "docid": "6228da18638733cf7d7ff5d20a6f3db5", "score": "0.46367225", "text": "func (sp *ScyllaOrganizationProvider) ListNodes(organizationID string) ([]string, derrors.Error) {\n\n\tsp.Lock()\n\tdefer sp.Unlock()\n\n\tif err := sp.CheckAndConnect(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 1.-Check if the organization exists\n\texists, err := sp.UnsafeGenericExist(organizationTable, organizationTablePK, organizationID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, derrors.NewNotFoundError(\"organization\").WithParams(organizationID)\n\t}\n\n\tstmt, names := qb.Select(organizationNodeTable).Columns(\"node_id\").Where(qb.Eq(\"organization_id\")).ToCql()\n\tq := gocqlx.Query(sp.Session.Query(stmt), names).BindMap(qb.M{\n\t\t\"organization_id\": organizationID,\n\t})\n\n\tnodes := make([]string, 0)\n\tcqlErr := q.SelectRelease(&nodes)\n\n\tif cqlErr != nil {\n\t\treturn nil, derrors.AsError(cqlErr, \"cannot list nodes\")\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "86de62659e5c368d99ef6751891e2a79", "score": "0.46326563", "text": "func MatchPodsToNodes(pods []*utils.Pod, nodes []*utils.Node) ([]*utils.Pod, []*utils.Node) {\n\tfor _, n := range nodes {\n\t\tn.Role = \"worker\"\n\t\tfor _, pod := range pods {\n\t\t\tif pod.HostIP == n.InternIP {\n\t\t\t\tn.Pods = append(n.Pods, pod)\n\t\t\t\tpod.Node = n\n\t\t\t\tif len(pod.Name) >= 14 && pod.Name[0:14] == \"kube-apiserver\" {\n\t\t\t\t\tn.Role = \"master\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn pods, nodes\n}", "title": "" }, { "docid": "3322c78e8e33dd3376680f2a88f73fbc", "score": "0.46286148", "text": "func (n *NetworkProvider) getNonOverlappingDefaultCIDR(ctx context.Context) (*net.IPNet, error) {\n\tclusterVpc, err := getClusterVpc(ctx, n.Client, n.Ec2Api, n.Logger)\n\tif err != nil {\n\t\treturn nil, errorUtil.Wrap(err, \"failed to get cluster vpc for cidr block\")\n\t}\n\t//parse the cidr to an ipnet cidr in order to manipulate the ip\n\t_, clusterNet, err := net.ParseCIDR(aws.StringValue(clusterVpc.CidrBlock))\n\n\tif err != nil {\n\t\treturn nil, errorUtil.Wrap(err, \"error parsing cluster cidr block\")\n\t}\n\n\t// this list is used to loop through the available options for a vpc cidr range in aws\n\t// See aws docs https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html#vpc-sizing-ipv4\n\tcidrRanges := []*cidrList{\n\t\t{\n\t\t\t\"10.255.255.255/8\",\n\t\t\tfmt.Sprintf(\"10.0.0.0/%s\", defaultCIDRMask),\n\t\t},\n\t\t{\n\t\t\t\"172.31.255.255/12\",\n\t\t\tfmt.Sprintf(\"172.16.0.0/%s\", defaultCIDRMask),\n\t\t},\n\t}\n\n\t//getting the network cr called from the cluster\n\tnetworkConf := &configv1.Network{}\n\terr = n.Client.Get(ctx, client.ObjectKey{Name: \"cluster\"}, networkConf)\n\tif err != nil {\n\t\treturn nil, errorUtil.Wrap(err, \"failed to get network kind\")\n\t}\n\n\tpodCIDR, foundPodNet, err := getPodCIDR(networkConf)\n\tif err != nil {\n\t\treturn nil, errorUtil.Wrap(err, \"failed to get pod CIDR\")\n\t}\n\n\tserviceCIDR, foundServiceNet, err := getServiceCIDR(networkConf)\n\tif err != nil {\n\t\treturn nil, errorUtil.Wrap(err, \"failed to get service CIDR\")\n\t}\n\n\t// in this loop we loop through the available cidr ranges for vpcs in aws\n\t// in each range the ip of the cidr block is incremented only in the A and B range\n\t// the reason for this is that cro allows a maximum mask size of /16\n\t// the default cidr mask is set by defaultCIDRMask env and is currently 26\n\t//\n\t// the current logic checks that the cidr block does not overlap with the cluster machine,\n\t// pod and service cidr range\n\tfor _, cidrList := range cidrRanges {\n\t\t_, cidrRangeNet, err := net.ParseCIDR(cidrList.cidr)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error parsing cidr range for default cidr block\", err)\n\t\t}\n\t\t// our potential default\n\t\tpotentialDefaultIP, _, err := net.ParseCIDR(cidrList.defaultVal)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error parsing potential default cidr range for default cidr block\", err)\n\t\t}\n\n\t\t// loop for as long as potential default is a valid CIDR in range\n\t\tfor cidrRangeNet.Contains(potentialDefaultIP) {\n\n\t\t\t// create CIDR adding the default /26 mask\n\t\t\t_, defaultNet, err := net.ParseCIDR(fmt.Sprintf(\"%s/26\", potentialDefaultIP.String()))\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// increment potential IP\n\t\t\tpotentialDefaultIP = incrementIPForDefaultCIDR(potentialDefaultIP)\n\n\t\t\tif clusterNet.Contains(defaultNet.IP) || defaultNet.Contains(clusterNet.IP) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif foundPodNet {\n\t\t\t\tif podCIDR.Contains(defaultNet.IP) || defaultNet.Contains(podCIDR.IP) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif foundServiceNet {\n\t\t\t\tif serviceCIDR.Contains(defaultNet.IP) || defaultNet.Contains(serviceCIDR.IP) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// return the first available option that does not overlap\n\t\t\treturn defaultNet, nil\n\t\t}\n\t}\n\n\t// if the loop finishes, it means that we have gone through all available cidr blocks in the available ranges in aws\n\t// return an error that cro was unable to find an option\n\treturn nil, errorUtil.New(\"could not find a default cidr block\")\n}", "title": "" }, { "docid": "acfe9ae6d2067e4ec68af3033ab0139f", "score": "0.4623933", "text": "func GetNodeHostnames(autoscalingGroupNodes []*autoscaling.Instance) ([]string, error) {\n\tsvc := ec2.New(session.New())\n\tvar instanceHostnames []string\n\tfor _, node := range autoscalingGroupNodes {\n\t\tresp, err := svc.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: []*string{aws.String(*node.InstanceId)},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to describe ec2 instance\")\n\t\t}\n\t\tinstanceHostnames = append(instanceHostnames, *resp.Reservations[0].Instances[0].PrivateDnsName)\n\t}\n\treturn instanceHostnames, nil\n}", "title": "" }, { "docid": "6c1cc22ad34d8479bae1a0e7e90f7a47", "score": "0.46086654", "text": "func (u rancherProvider) NodeGroups() []cloudprovider.NodeGroup {\n\tnodeGroups := make([]cloudprovider.NodeGroup, len(u.nodePools))\n\tfor i, ng := range u.nodePools {\n\t\tnodeGroups[i] = ng\n\t}\n\treturn nodeGroups\n}", "title": "" }, { "docid": "481f8b127a32166ad9a71294877bb739", "score": "0.45936996", "text": "func (_Governance *GovernanceCallerSession) Nodes(arg0 *big.Int) (struct {\n\tOwner common.Address\n\tPublicKey []byte\n\tStaked *big.Int\n\tFined *big.Int\n\tName string\n\tEmail string\n\tLocation string\n\tUrl string\n\tUnstaked *big.Int\n\tUnstakedAt *big.Int\n}, error) {\n\treturn _Governance.Contract.Nodes(&_Governance.CallOpts, arg0)\n}", "title": "" }, { "docid": "8703c0e96fa5a99d4ff6b4fdd597a193", "score": "0.45926312", "text": "func (l *KubeListener) syncNodes() {\n\tlog.Trace(trace.Inside, \"Entering syncNodes()\\n\")\n\n\tvar err error\n\tl.syncNodesMutex.Lock()\n\tif l.syncNodesRunning {\n\t\t// This really can only happen if syncNodes was taking too long\n\t\t// and the next scheduled syncNodes started. Very unlikely, but\n\t\t// doesn'thurt to check.\n\t\tlog.Infof(\"syncNodes() already running, will exit.\")\n\t\tl.syncNodesMutex.Unlock()\n\t\treturn\n\t}\n\tl.syncNodesRunning = true\n\tl.syncNodesMutex.Unlock()\n\n\tk8sNodesList := l.nodeStore.List()\n\tromanaHostList := l.client.IPAM.ListHosts()\n\n\tlog.Debugf(\"Comparing Romana host list %d vs K8S node list %d\", len(k8sNodesList), len(romanaHostList.Hosts))\n\n\t// Check for nodes that exist in kubernetes but not registered as romana hosts.\n\t// Add hosts that are missing\n\tfor _, n := range k8sNodesList {\n\t\thost, err := l.nodeToHost(n)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Tracef(trace.Inside, \"Checking if node %s is in Romana\", host)\n\n\t\tnodeInRomana := false\n\t\t// This is not super-efficient but as we don't have that many hosts for now\n\t\t// to deal with, it can do.\n\t\tfor _, romanaHost := range romanaHostList.Hosts {\n\t\t\tif romanaHost.IP.String() == host.IP.String() {\n\t\t\t\tnodeInRomana = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !nodeInRomana {\n\t\t\tlog.Tracef(trace.Inside, \"Trying to add host %s to Romana\", host)\n\t\t\tif err = l.romanaHostAdd(host); err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check for hosts that are registered with romana but don't exist as kubernetes nodes.\n\t// Remove hosts that are missing in kubernetes\n\tfor _, romanaHost := range romanaHostList.Hosts {\n\t\thostInK8S := false\n\t\tfor _, n := range k8sNodesList {\n\t\t\tnode := n.(*v1.Node)\n\t\t\thost, err := l.nodeToHost(node)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif host.IP.String() == romanaHost.IP.String() {\n\t\t\t\thostInK8S = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tlog.Tracef(trace.Inside, \"Checking if host %s is in K8S: %t\", romanaHost, hostInK8S)\n\n\t\tif !hostInK8S {\n\t\t\tif err = l.romanaHostRemove(romanaHost); err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t}\n\t}\n\tl.syncNodesMutex.Lock()\n\tl.syncNodesRunning = false\n\tl.syncNodesMutex.Unlock()\n}", "title": "" }, { "docid": "f06412c5a01d2ac241e97b49ae0f071c", "score": "0.45874313", "text": "func IterateForAssignment(ip net.IP, ipnet net.IPNet, reservelist []string, containerID string) (net.IP, []string, error) {\n\n firstip, lastip, err := GetIPRange(ip, ipnet)\n logging.Debugf(\"IterateForAssignment input >> ip: %v | ipnet: %v | first IP: %v | last IP: %v\", ip, ipnet, firstip, lastip)\n if err != nil {\n logging.Errorf(\"GetIPRange request failed with: %v\", err)\n return net.IP{}, reservelist, err\n }\n\n // Iterate every IP address in the range\n var assignedip net.IP\n performedassignment := false\n for i := ip2Long(firstip); i < ip2Long(lastip); i++ {\n // For each address see if it has been allocated\n isallocated := false\n for _, v := range reservelist {\n // Skip to the next IP if it's already allocated\n // We look for the space at the end so 192.168.1.1 doesn't match 192.168.1.100\n if strings.Contains(v, fmt.Sprint(longToIP4(i))+\" \") {\n isallocated = true\n break\n }\n }\n\n // Continue if this IP is allocated.\n if isallocated {\n continue\n }\n\n // We can try to work with the current IP\n // However, let's skip 0-based addresses\n // So go ahead and continue if the 4th byte equals 0\n ipbytes := longToIP4(i).To4()\n if ipbytes[3] == 0 {\n continue\n }\n\n // Ok, this one looks like we can assign it!\n performedassignment = true\n assignedip = longToIP4(i)\n stringip := fmt.Sprint(assignedip)\n logging.Debugf(\"Reserving IP: |%v|\", stringip+\" \"+containerID)\n reservelist = append(reservelist, stringip+\" \"+containerID)\n break\n\n }\n\n if !performedassignment {\n return net.IP{}, reservelist, fmt.Errorf(\"Could not allocate IP in range: ip: %v / range: %v\", ip, ipnet)\n }\n\n return assignedip, reservelist, nil\n\n}", "title": "" }, { "docid": "f402f49d462a553a793710df156b8a72", "score": "0.45834786", "text": "func getMasterAddresses(kubeClient crclient.Client, controlPlaneReplicaCount int, hypershift bool, timeout int) ([]string, int, error) {\n\tvar heartBeat int\n\tmasterNodeList := &corev1.NodeList{}\n\tovnMasterAddresses := make([]string, 0, controlPlaneReplicaCount)\n\n\tif hypershift {\n\t\tfor i := 0; i < controlPlaneReplicaCount; i++ {\n\t\t\tovnMasterAddresses = append(ovnMasterAddresses, fmt.Sprintf(\"ovnkube-master-%d.ovnkube-master-internal.%s.svc.cluster.local\", i, os.Getenv(\"HOSTED_CLUSTER_NAMESPACE\")))\n\t\t}\n\t\tsort.Strings(ovnMasterAddresses)\n\t\treturn ovnMasterAddresses, timeout, nil\n\t}\n\n\t// Not Hypershift... find all master nodes by label\n\terr := wait.PollUntilContextTimeout(context.TODO(), OVN_MASTER_DISCOVERY_POLL*time.Second, time.Duration(timeout)*time.Second, true, func(ctx context.Context) (bool, error) {\n\t\tmatchingLabels := &crclient.MatchingLabels{\"node-role.kubernetes.io/master\": \"\"}\n\t\tif err := kubeClient.List(ctx, masterNodeList, matchingLabels); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif len(masterNodeList.Items) != 0 && controlPlaneReplicaCount == len(masterNodeList.Items) {\n\t\t\treturn true, nil\n\t\t}\n\n\t\theartBeat++\n\t\tif heartBeat%3 == 0 {\n\t\t\tklog.V(2).Infof(\"Waiting to complete OVN bootstrap: found (%d) master nodes out of (%d) expected: timing out in %d seconds\",\n\t\t\t\tlen(masterNodeList.Items), controlPlaneReplicaCount, timeout-OVN_MASTER_DISCOVERY_POLL*heartBeat)\n\t\t}\n\t\treturn false, nil\n\t})\n\tif wait.Interrupted(err) {\n\t\tklog.Warningf(\"Timeout exceeded while bootstraping OVN, expected amount of control plane nodes (%v) do not match found (%v): continuing deployment with found replicas\",\n\t\t\tcontrolPlaneReplicaCount, len(masterNodeList.Items))\n\t\t// On certain types of cluster this condition will never be met (assisted installer, for example)\n\t\t// As to not hold the reconciliation loop for too long on such clusters: dynamically modify the timeout\n\t\t// to a shorter and shorter value. Never reach 0 however as that will result in a `PollInfinity`.\n\t\t// Right now we'll do:\n\t\t// - First reconciliation 250 second timeout\n\t\t// - Second reconciliation 130 second timeout\n\t\t// - >= Third reconciliation 10 second timeout\n\t\tif timeout-OVN_MASTER_DISCOVERY_BACKOFF > 0 {\n\t\t\ttimeout = timeout - OVN_MASTER_DISCOVERY_BACKOFF\n\t\t}\n\t} else if err != nil {\n\t\treturn nil, timeout, fmt.Errorf(\"unable to bootstrap OVN, err: %v\", err)\n\t}\n\n\tnodeList := make(nodeInfoList, 0, len(masterNodeList.Items))\n\tfor _, node := range masterNodeList.Items {\n\t\tni := nodeInfo{created: node.CreationTimestamp.Time}\n\t\tfor _, address := range node.Status.Addresses {\n\t\t\tif address.Type == corev1.NodeInternalIP {\n\t\t\t\tni.address = address.Address\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif ni.address == \"\" {\n\t\t\treturn nil, timeout, fmt.Errorf(\"no InternalIP found on master node '%s'\", node.Name)\n\t\t}\n\n\t\tnodeList = append(nodeList, ni)\n\t}\n\n\t// Take the oldest masters up to the expected number of replicas\n\tsort.Stable(nodeList)\n\tfor i, ni := range nodeList {\n\t\tif i >= controlPlaneReplicaCount {\n\t\t\tbreak\n\t\t}\n\t\tovnMasterAddresses = append(ovnMasterAddresses, ni.address)\n\t}\n\tklog.V(2).Infof(\"Preferring %s for database clusters\", ovnMasterAddresses)\n\n\treturn ovnMasterAddresses, timeout, nil\n}", "title": "" }, { "docid": "8f93f40c0bf26ae40c54e0b0bb3d85e3", "score": "0.45728624", "text": "func (tm TasksManager)GetNodes()[]string{\n\tif len(tm.nodes) <=1 {\n\t\treturn []string{}\n\t}\n\tnodes := make([]string,0,len(tm.nodes)-1)\n\tfor url,_ := range tm.nodes {\n\t\tif url != tm.url {\n\t\t\tnodes = append(nodes,url)\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "30dd369210a6b439658124abb2cc69f6", "score": "0.45657903", "text": "func (c *Controller) ComputeNodes(ctx context.Context, qtid dax.QualifiedTableID, shards dax.ShardNums) ([]dax.ComputeNode, error) {\n\trole := &dax.ComputeRole{\n\t\tTableKey: qtid.Key(),\n\t\tShards: shards,\n\t}\n\tqdbid := qtid.QualifiedDatabaseID\n\n\ttx, err := c.Transactor.BeginTx(ctx, false)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"beginning tx\")\n\t}\n\tdefer tx.Rollback()\n\n\t// If no shards are provided, get the nodes responsible for the entire\n\t// table.\n\tif len(role.Shards) == 0 {\n\t\tassignedNodes, err := c.nodesForTable(tx, dax.RoleTypeCompute, qtid)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"getting nodes for table\")\n\t\t}\n\t\tcomputeNodes, err := c.assignedToComputeNodes(assignedNodes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"converting assigned to compute nodes\")\n\t\t}\n\t\treturn computeNodes, nil\n\t}\n\n\tassignedNodes, _, _, err := c.nodesComputeReadOrWrite(tx, role, qdbid, false, false)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"getting compute nodes read or write\")\n\t}\n\n\treturn c.assignedToComputeNodes(assignedNodes)\n}", "title": "" }, { "docid": "baa86a7af9449ac8a2f5356851766934", "score": "0.45631203", "text": "func (o *SubscriptionMetrics) GetComputeNodesSockets() (value *ClusterResource, ok bool) {\n\tok = o != nil && o.bitmap_&8 != 0\n\tif ok {\n\t\tvalue = o.computeNodesSockets\n\t}\n\treturn\n}", "title": "" }, { "docid": "583951ad87e066abc2ce35768ba7715a", "score": "0.45345858", "text": "func (rrm *defaultResourceReservationManager) FindUnboundReservationNodes(ctx context.Context, executor *v1.Pod) ([]string, bool, error) {\n\tunboundReservationsToNodes, err := rrm.getUnboundReservations(ctx, executor.Labels[common.SparkAppIDLabel], executor.Namespace)\n\tif err != nil {\n\t\treturn []string{}, false, err\n\t}\n\tunboundReservationNodes := utils.NewStringSet(len(unboundReservationsToNodes))\n\tfound := false\n\tfor _, node := range unboundReservationsToNodes {\n\t\tunboundReservationNodes.Add(node)\n\t\tfound = true\n\t}\n\treturn unboundReservationNodes.ToSlice(), found, nil\n}", "title": "" }, { "docid": "9ff4a6343476deceb4072147ba092b5b", "score": "0.45307192", "text": "func RangeNodesForPrefix(size uint64) []NodeID {\n\tids := make([]NodeID, 0, bits.OnesCount64(size))\n\t// Iterate over perfect subtrees along the right border of the tree. Those\n\t// correspond to the bits of the tree size that are set to one.\n\tfor sz := size; sz != 0; sz &= sz - 1 {\n\t\tlevel := uint(bits.TrailingZeros64(sz))\n\t\tindex := (sz - 1) >> level\n\t\tids = append(ids, NewNodeID(level, index))\n\t}\n\t// Note: Right border nodes of compact.Range are ordered from root to leaves.\n\tfor i, j := 0, len(ids)-1; i < j; i, j = i+1, j-1 {\n\t\tids[i], ids[j] = ids[j], ids[i]\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "c993bd18e8145785ed21427c88312f5a", "score": "0.4528132", "text": "func (nodeInstance *Node) GetNodeList() {\n client := http.Client{\n Timeout: 10 * time.Second,\n }\n\n // loop through all known nodes and get their node lists\n for _, node := range nodeInstance.NodeList {\n httpAddress := \"http://\" + node.IpAddr + \":\" + strconv.Itoa(node.Port) + \"/get-nodes\"\n resp, err := client.Get(httpAddress)\n if err != nil {\n continue\n }\n\n // convert response body to a slice of NodeAddresses\n var nodeAddresses []NodeAddress\n err = json.NewDecoder(resp.Body).Decode(&nodeAddresses)\n if err != nil { //we got an error, so the node list was not formatted well\n continue\n }\n\n for _, nodeAddress := range nodeAddresses {\n nodeInstance.NodeList = append(nodeInstance.NodeList, nodeAddress)\n }\n // remove duplicates from the node list\n nodeInstance.NodeList = removeDuplicateNodes(nodeInstance.NodeList)\n }\n return\n}", "title": "" }, { "docid": "408fa85ac468188bc8f1f4d34ec88cb3", "score": "0.4521899", "text": "func mergeIPRangeLists(podSpecific, global []string) []string {\n\tipSet := mapset.NewSet()\n\tvar ipRanges []string\n\n\tfor _, ip := range podSpecific {\n\t\tif addedToSet := ipSet.Add(ip); addedToSet {\n\t\t\tipRanges = append(ipRanges, ip)\n\t\t}\n\t}\n\n\tfor _, ip := range global {\n\t\tif addedToSet := ipSet.Add(ip); addedToSet {\n\t\t\tipRanges = append(ipRanges, ip)\n\t\t}\n\t}\n\n\treturn ipRanges\n}", "title": "" }, { "docid": "eb4001cae78b5e729d0966ab701596c9", "score": "0.45177844", "text": "func (n *NodeSorter) PotentialNodes(availableNodesSchedulingMetadata resources.NodeGroupSchedulingMetadata, nodeNames []string) (driverNodes, executorNodes []string) {\n\tnodesInPriorityOrder := getNodeNamesInPriorityOrder(availableNodesSchedulingMetadata)\n\tdriverNodeNames := make([]string, 0, len(nodesInPriorityOrder))\n\texecutorNodeNames := make([]string, 0, len(nodesInPriorityOrder))\n\n\tnodeNamesSet := make(map[string]interface{})\n\tfor _, item := range nodeNames {\n\t\tnodeNamesSet[item] = nil\n\t}\n\n\tfor _, nodeName := range nodesInPriorityOrder {\n\t\tif _, ok := nodeNamesSet[nodeName]; ok {\n\t\t\tdriverNodeNames = append(driverNodeNames, nodeName)\n\t\t}\n\t\tif !availableNodesSchedulingMetadata[nodeName].Unschedulable && availableNodesSchedulingMetadata[nodeName].Ready {\n\t\t\texecutorNodeNames = append(executorNodeNames, nodeName)\n\t\t}\n\t}\n\n\t// further sort driver and executor nodes based on config if present\n\tsortNodesByMetadataLessThanFunction(driverNodeNames, availableNodesSchedulingMetadata, n.driverNodePriorityLessThanFunction)\n\tsortNodesByMetadataLessThanFunction(executorNodeNames, availableNodesSchedulingMetadata, n.executorNodePriorityLessThanFunction)\n\treturn driverNodeNames, executorNodeNames\n}", "title": "" }, { "docid": "934fbac0a81e2528708c227951a045a7", "score": "0.4507598", "text": "func GetNodeLocs() ([]NodeLocation, error) {\n\tnodeList := corev1.NodeList{}\n\n\tif gTestEnv.K8sClient.List(context.TODO(), &nodeList, &client.ListOptions{}) != nil {\n\t\treturn nil, errors.New(\"failed to list nodes\")\n\t}\n\tNodeLocs := make([]NodeLocation, 0, len(nodeList.Items))\n\tfor _, k8snode := range nodeList.Items {\n\t\taddrstr := \"\"\n\t\tnamestr := \"\"\n\t\tmayastorNode := false\n\t\tmasterNode := false\n\t\tfor label, value := range k8snode.Labels {\n\t\t\tif label == \"openebs.io/engine\" && value == \"mayastor\" {\n\t\t\t\tmayastorNode = true\n\t\t\t}\n\t\t\tif label == \"node-role.kubernetes.io/master\" {\n\t\t\t\tmasterNode = true\n\t\t\t}\n\t\t}\n\t\tfor _, addr := range k8snode.Status.Addresses {\n\t\t\tif addr.Type == corev1.NodeInternalIP {\n\t\t\t\taddrstr = addr.Address\n\t\t\t}\n\t\t\tif addr.Type == corev1.NodeHostName {\n\t\t\t\tnamestr = addr.Address\n\t\t\t}\n\t\t}\n\t\tif namestr != \"\" && addrstr != \"\" {\n\t\t\tNodeLocs = append(NodeLocs, NodeLocation{\n\t\t\t\tNodeName: namestr,\n\t\t\t\tIPAddress: addrstr,\n\t\t\t\tMayastorNode: mayastorNode,\n\t\t\t\tMasterNode: masterNode,\n\t\t\t})\n\t\t} else {\n\t\t\treturn nil, errors.New(\"node lacks expected fields\")\n\t\t}\n\t}\n\treturn NodeLocs, nil\n}", "title": "" }, { "docid": "ea8357279f944e33cc8fa4fef527c969", "score": "0.45067194", "text": "func (kj *KubernetesJoiner) DiscoverNodes() ([]cluster.NodeInfo, error) {\n\tdiscoveredNodes := []cluster.NodeInfo{}\n\tpodLabels, err := kj.getRaftPodLabels()\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.ErrorReason: err.Error(),\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-LABELS\",\n\t\t}).Errorf(\"failed to get labels on the pod\")\n\t\treturn discoveredNodes, err\n\t}\n\tclusterID, present := podLabels[raftClusterIDLabel]\n\tif !present {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-RAFT-CLUSTER-ID\",\n\t\t}).Warnf(\"couldn't find label: %s\", raftClusterIDLabel)\n\t\treturn discoveredNodes, &LabelNotPresentError{RequiredLabel: raftClusterIDLabel}\n\t}\n\tclusterSize, present := podLabels[raftClusterSizeLabel]\n\tif !present {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-RAFT-CLUSTER-SIZE\",\n\t\t}).Warnf(\"couldn't find label: %s\", raftClusterSizeLabel)\n\t\treturn discoveredNodes, &LabelNotPresentError{RequiredLabel: raftClusterSizeLabel}\n\t}\n\tclusterSvcName, present := podLabels[raftClusterSvcNameLabel]\n\tif !present {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-RAFT-CLUSTER-SVC-NAME\",\n\t\t}).Warnf(\"couldn't find label: %s\", raftClusterSvcNameLabel)\n\t\treturn discoveredNodes, &LabelNotPresentError{RequiredLabel: clusterSvcName}\n\t}\n\tvar intClusterSize int\n\t_, err = fmt.Sscanf(clusterSize, \"%d\", &intClusterSize)\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.ErrorReason: err.Error(),\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"PARSE-RAFT-CLUSTER-SIZE\",\n\t\t}).Errorf(\"error while parsing %s as integer\", clusterSize)\n\t\treturn discoveredNodes, err\n\t}\n\tns, err := kj.getRaftClusterNamespace()\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.ErrorReason: err.Error(),\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-POD-NAMESPACE\",\n\t\t}).Errorf(\"error while getting pod namespace\")\n\t\treturn discoveredNodes, err\n\t}\n\tdiscoveredNodes = kj.getRaftClusterNodeInfo(clusterID, clusterSvcName, ns, intClusterSize)\n\tfor _, node := range discoveredNodes {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"DISCOVERY-DONE\",\n\t\t}).Infof(\"discovered peer: nodeID=%s, rpcURL=%s, apiURL=%s\",\n\t\t\tnode.ID, node.RPCURL, node.APIURL)\n\t}\n\treturn discoveredNodes, nil\n}", "title": "" }, { "docid": "ea7eed889282f98bbc6bd951f120e403", "score": "0.45042896", "text": "func (g *Group) Nodes() committee.NodeDescriptorLookup {\n\treturn g.nodes\n}", "title": "" }, { "docid": "7479bc19fa40dff002e2c5ee93c2f035", "score": "0.45037353", "text": "func GetNodesHostedOn(ctx context.Context, deploymentID, hostNode string) ([]string, error) {\n\t// Thinking: maybe we can store at parsing time for each node the list of nodes on which it is hosted on and/or the opposite rather than re-scan the whole node list\n\tnodesList, err := GetNodes(ctx, deploymentID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstackNodes := nodesList[:0]\n\tfor _, node := range nodesList {\n\t\tvar hostedOn bool\n\t\thostedOn, err = IsHostedOn(ctx, deploymentID, node, hostNode)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif hostedOn {\n\t\t\tstackNodes = append(stackNodes, node)\n\t\t}\n\t}\n\treturn stackNodes, nil\n}", "title": "" }, { "docid": "6800146de70013563275cb913726c7e3", "score": "0.44945642", "text": "func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool {\n\tif len(netX.IP) == len(netY.IP) {\n\t\tif firstIP, _ := NetworkRange(netX); netY.Contains(firstIP) {\n\t\t\treturn true\n\t\t}\n\t\tif firstIP, _ := NetworkRange(netY); netX.Contains(firstIP) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0843d48c3014653f6216954c9dab65c3", "score": "0.44930625", "text": "func (self *MetaDataNodeState) LeastUsedNodes() []NodeID {\n\tvar nodes []NodeID\n\tfor nodeID, _ := range self.dataNodes {\n\t\tnodes = append(nodes, nodeID)\n\t}\n\n\tsort.Sort(ByRandom(nodes))\n\tsort.Stable(ByUtilization(nodes))\n\n\treturn nodes\n}", "title": "" }, { "docid": "2a9a779440723e6936d9aea197eb28c9", "score": "0.44856352", "text": "func (ng *GrpcNodeGroup) Nodes() ([]cloudprovider.Instance, error) {\n\tvar instances []cloudprovider.Instance\n\tmanager := ng.GetManager()\n\n\tmanager.Lock()\n\tdefer manager.Unlock()\n\n\tctx, cancel := context.WithTimeout(context.Background(), manager.GetGrpcTimeout())\n\tdefer cancel()\n\n\tnodeGroupService, err := manager.GetNodeGroupServiceClient()\n\n\tif err == nil {\n\t\tr, err := nodeGroupService.Nodes(ctx, &NodeGroupServiceRequest{ProviderID: manager.GetCloudProviderID(), NodeGroupID: ng.name})\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Could not get NodeGroup::Nodes for cloud provider:%s:%s error: %v\", manager.GetCloudProviderID(), ng.name, err)\n\n\t\t\treturn nil, err\n\t\t} else if rerr := r.GetError(); rerr != nil {\n\t\t\tlog.Printf(\"Cloud provider:%s:%s call NodeGroup::Nodes got error: %v\", manager.GetCloudProviderID(), ng.name, rerr)\n\n\t\t\treturn nil, errors.NewAutoscalerError((errors.AutoscalerErrorType)(rerr.Code), rerr.Reason)\n\t\t}\n\n\t\tif r.GetInstances() != nil && r.GetInstances().GetItems() != nil {\n\n\t\t\tinstances = make([]cloudprovider.Instance, len(r.GetInstances().GetItems()))\n\n\t\t\tfor i, instance := range r.GetInstances().GetItems() {\n\t\t\t\terrorInfo := instance.GetStatus().GetErrorInfo()\n\n\t\t\t\tvar instanceErrorInfo *cloudprovider.InstanceErrorInfo\n\n\t\t\t\tif errorInfo != nil {\n\t\t\t\t\tinstanceErrorInfo = &cloudprovider.InstanceErrorInfo{\n\t\t\t\t\t\tErrorClass: cloudprovider.InstanceErrorClass(errorInfo.GetErrorClass()),\n\t\t\t\t\t\tErrorCode: errorInfo.GetErrorCode(),\n\t\t\t\t\t\tErrorMessage: errorInfo.GetErrorMessage(),\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcloudInstance := cloudprovider.Instance{\n\t\t\t\t\tId: instance.GetId(),\n\t\t\t\t\tStatus: &cloudprovider.InstanceStatus{\n\t\t\t\t\t\tState: cloudprovider.InstanceState(instance.GetStatus().GetState()),\n\t\t\t\t\t\tErrorInfo: instanceErrorInfo,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tinstances[i] = cloudInstance\n\t\t\t}\n\t\t}\n\t}\n\n\treturn instances, err\n}", "title": "" }, { "docid": "78e465fb17596a1b0e661effbd0784a7", "score": "0.44774288", "text": "func (a *WebSphereLibertyApplicationAffinity) GetNodeAffinityLabels() map[string]string {\n\treturn a.NodeAffinityLabels\n}", "title": "" }, { "docid": "17476f77530586652bf4754c0f9fade2", "score": "0.44694635", "text": "func (helper *masterHelper) Nodes() (nodes []string) {\n\thelper.RLock()\n\tnodes = helper.masters\n\thelper.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "1c93c3cddd81bd5838df4147a3382bc7", "score": "0.4463007", "text": "func (r *RedisClusterReconciler) getNodeIPs(redisCluster *dbv1.RedisCluster) (map[string]string, error) {\n\tnodeIPs := make(map[string]string)\n\tpods, err := r.getRedisClusterPods(redisCluster)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, pod := range pods {\n\t\tnodeIPs[pod.Labels[\"node-number\"]] = pod.Status.PodIP\n\t}\n\treturn nodeIPs, nil\n}", "title": "" }, { "docid": "532e44097af983ef62b74d418d3a1c09", "score": "0.4458607", "text": "func GetNodesAddr(ctx context.Context) ([]string, error) {\n\targs := utils.PlanetCommand(Command(\"get\", \"nodes\",\n\t\t\"--output\",\n\t\t`jsonpath={.items[*].status.addresses[?(@.type==\"InternalIP\")].address}`))\n\tcmd := exec.CommandContext(ctx, args[0], args[1:]...)\n\n\tcmd.Stderr = utils.NewStderrLogger(log.WithField(\"cmd\", \"kubectl get nodes\"))\n\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err, \"%v : %v\", cmd, err)\n\t}\n\n\tnodes := strings.Fields(strings.TrimSpace(string(out)))\n\treturn nodes, nil\n}", "title": "" }, { "docid": "58b09729281d1c6f04911c32e41c1634", "score": "0.44528392", "text": "func TestGetIntersectionNode(t *testing.T) {\n\tl1 := GenListNode([]int{4, 1})\n\tl2 := GenListNode([]int{})\n\t//公共部分\n\t// l3 := GenListNode([]int{8, 4, 5})\n\t// l1.Next = l3\n\t// l2.Next = l3\n\tout := getIntersectionNode(l1, l2)\n\tt.Log(out)\n}", "title": "" }, { "docid": "cd111545c1fb298176a8224916d38d8a", "score": "0.4449773", "text": "func nodeAddresses(srv *servers.Server, ports []PortWithTrunkDetails, client *gophercloud.ServiceClient, networkingOpts NetworkingOpts) ([]v1.NodeAddress, error) {\n\taddrs := []v1.NodeAddress{}\n\n\t// parse private IP addresses first in an ordered manner\n\tfor _, port := range ports {\n\t\tfor _, fixedIP := range port.FixedIPs {\n\t\t\tif port.Status == \"ACTIVE\" {\n\t\t\t\tisIPv6 := net.ParseIP(fixedIP.IPAddress).To4() == nil\n\t\t\t\tif !(isIPv6 && networkingOpts.IPv6SupportDisabled) {\n\t\t\t\t\tAddToNodeAddresses(&addrs,\n\t\t\t\t\t\tv1.NodeAddress{\n\t\t\t\t\t\t\tType: v1.NodeInternalIP,\n\t\t\t\t\t\t\tAddress: fixedIP.IPAddress,\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// process public IP addresses\n\tif srv.AccessIPv4 != \"\" {\n\t\tAddToNodeAddresses(&addrs,\n\t\t\tv1.NodeAddress{\n\t\t\t\tType: v1.NodeExternalIP,\n\t\t\t\tAddress: srv.AccessIPv4,\n\t\t\t},\n\t\t)\n\t}\n\n\tif srv.AccessIPv6 != \"\" && !networkingOpts.IPv6SupportDisabled {\n\t\tAddToNodeAddresses(&addrs,\n\t\t\tv1.NodeAddress{\n\t\t\t\tType: v1.NodeExternalIP,\n\t\t\t\tAddress: srv.AccessIPv6,\n\t\t\t},\n\t\t)\n\t}\n\n\tif srv.Metadata[TypeHostName] != \"\" {\n\t\tAddToNodeAddresses(&addrs,\n\t\t\tv1.NodeAddress{\n\t\t\t\tType: v1.NodeHostName,\n\t\t\t\tAddress: srv.Metadata[TypeHostName],\n\t\t\t},\n\t\t)\n\t}\n\n\t// process the rest\n\ttype Address struct {\n\t\tIPType string `mapstructure:\"OS-EXT-IPS:type\"`\n\t\tAddr string\n\t}\n\n\tvar addresses map[string][]Address\n\terr := mapstructure.Decode(srv.Addresses, &addresses)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add the addresses assigned on subports via trunk\n\t// This exposes the vlan networks to which subports are attached\n\tfor _, port := range ports {\n\t\tfor _, subport := range port.TrunkDetails.SubPorts {\n\t\t\tp, err := neutronports.Get(client, subport.PortID).Extract()\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to get subport %s details: %v\", subport.PortID, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tn, err := networks.Get(client, p.NetworkID).Extract()\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to get subport %s network details: %v\", subport.PortID, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, fixedIP := range p.FixedIPs {\n\t\t\t\tklog.V(5).Infof(\"Node '%s' is found subport '%s' address '%s/%s'\", srv.Name, p.Name, n.Name, fixedIP.IPAddress)\n\t\t\t\tisIPv6 := net.ParseIP(fixedIP.IPAddress).To4() == nil\n\t\t\t\tif !(isIPv6 && networkingOpts.IPv6SupportDisabled) {\n\t\t\t\t\taddr := Address{IPType: \"fixed\", Addr: fixedIP.IPAddress}\n\t\t\t\t\tsubportAddresses := map[string][]Address{n.Name: {addr}}\n\t\t\t\t\tsrvAddresses, ok := addresses[n.Name]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\taddresses[n.Name] = subportAddresses[n.Name]\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// this is to take care the corner case\n\t\t\t\t\t\t// where the same network is attached to the node both directly and via trunk\n\t\t\t\t\t\taddresses[n.Name] = append(srvAddresses, subportAddresses[n.Name]...)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tnetworks := make([]string, 0, len(addresses))\n\tfor k := range addresses {\n\t\tnetworks = append(networks, k)\n\t}\n\tsort.Strings(networks)\n\n\tfor _, network := range networks {\n\t\tfor _, props := range addresses[network] {\n\t\t\tvar addressType v1.NodeAddressType\n\t\t\tif props.IPType == \"floating\" {\n\t\t\t\taddressType = v1.NodeExternalIP\n\t\t\t} else if util.Contains(networkingOpts.PublicNetworkName, network) {\n\t\t\t\taddressType = v1.NodeExternalIP\n\t\t\t\t// removing already added address to avoid listing it as both ExternalIP and InternalIP\n\t\t\t\t// may happen due to listing \"private\" network as \"public\" in CCM's config\n\t\t\t\tRemoveFromNodeAddresses(&addrs,\n\t\t\t\t\tv1.NodeAddress{\n\t\t\t\t\t\tAddress: props.Addr,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tif len(networkingOpts.InternalNetworkName) == 0 || util.Contains(networkingOpts.InternalNetworkName, network) {\n\t\t\t\t\taddressType = v1.NodeInternalIP\n\t\t\t\t} else {\n\t\t\t\t\tklog.V(5).Infof(\"Node '%s' address '%s' ignored due to 'internal-network-name' option\", srv.Name, props.Addr)\n\t\t\t\t\tRemoveFromNodeAddresses(&addrs,\n\t\t\t\t\t\tv1.NodeAddress{\n\t\t\t\t\t\t\tAddress: props.Addr,\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tisIPv6 := net.ParseIP(props.Addr).To4() == nil\n\t\t\tif !(isIPv6 && networkingOpts.IPv6SupportDisabled) {\n\t\t\t\tAddToNodeAddresses(&addrs,\n\t\t\t\t\tv1.NodeAddress{\n\t\t\t\t\t\tType: addressType,\n\t\t\t\t\t\tAddress: props.Addr,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\tif networkingOpts.AddressSortOrder != \"\" {\n\t\tsortNodeAddresses(addrs, networkingOpts.AddressSortOrder)\n\t}\n\n\tklog.V(5).Infof(\"Node '%s' returns addresses '%v'\", srv.Name, addrs)\n\treturn addrs, nil\n}", "title": "" }, { "docid": "6bbe031200479202644d58173c04332b", "score": "0.44394895", "text": "func (r *Registry) GetActiveNodes() []string {\n\tvar nodes []string\n\tunique_nodes := make(map[string]bool)\n\n\tfor _, service := range r.services {\n\t\tfor _, val := range service.Addresses {\n\t\t\taddr := strings.Split(val, \":\")[0]\n\t\t\tunique_nodes[addr] = true\n\t\t}\n\t}\n\n\tfor node, _ := range unique_nodes {\n\t\tnodes = append(nodes, node)\n\t}\n\n\treturn nodes\n}", "title": "" }, { "docid": "291b5e7d8f7d7c6b3c42e313d2833d86", "score": "0.44387484", "text": "func getNodes(clusterDir string) (nodeip []string, err error) {\n\n\tfileName := clusterDir + \"addSlaves\"\n\texist, _ := common.PathExist(fileName)\n\tif !exist {\n\t\t//logrus.Infof(\"getNodeIp, file %s not exists\", fileName)\n\t\treturn nil, nil\n\n\t}\n\n\tnodeByte, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\tlogrus.Errorf(\"getNodeIp, read file %s failed, err is %v\", fileName, err)\n\t\treturn nil, err\n\t}\n\tnodeip = strings.Split(strings.TrimSuffix(string(nodeByte), \",\"), \",\")\n\treturn\n}", "title": "" }, { "docid": "c4083a3b08c041e13189b634ffadec04", "score": "0.44337708", "text": "func (rh *RendezvousHash) GetOrderedNodes(key string, n int) []*RendezvousHashNode {\n\tnodes := make([]*RendezvousHashNode, len(rh.Nodes))\n\tcopy(nodes, rh.Nodes)\n\n\tsort.Sort(sort.Reverse(&RendezvousNodesByScore{key: key, nodes: nodes}))\n\n\tif n >= len(nodes) {\n\t\treturn nodes\n\t}\n\treturn nodes[:n]\n}", "title": "" }, { "docid": "256b5c2dec552b5b020159c98b0dbd6f", "score": "0.44331437", "text": "func TestFindOverlappingVolume(t *testing.T) {\n\tvolMnt := corev1.VolumeMount{\n\t\tName: \"workdir\",\n\t\tMountPath: \"/user-mount\",\n\t}\n\ttemplateWithVolMount := &wfv1.Template{\n\t\tContainer: &corev1.Container{\n\t\t\tVolumeMounts: []corev1.VolumeMount{volMnt},\n\t\t},\n\t}\n\tassert.Equal(t, &volMnt, FindOverlappingVolume(templateWithVolMount, \"/user-mount\"))\n\tassert.Equal(t, &volMnt, FindOverlappingVolume(templateWithVolMount, \"/user-mount/subdir\"))\n\tassert.Nil(t, FindOverlappingVolume(templateWithVolMount, \"/user-mount-coincidental-prefix\"))\n}", "title": "" }, { "docid": "24dfdcc472cbdcf8a0cf97fcbbdc11df", "score": "0.44299218", "text": "func ComputeAnnouncedResources(physicalNodes *corev1.NodeList, reqs corev1.ResourceList, sharingPercentage int64) (availability corev1.ResourceList, images []corev1.ContainerImage) {\n\t// get allocatable resources in all the physical nodes\n\tallocatable, images := GetClusterResources(physicalNodes.Items)\n\n\t// subtract used resources from available ones to have available resources\n\tcpu := allocatable.Cpu().DeepCopy()\n\tcpu.Sub(reqs.Cpu().DeepCopy())\n\tif cpu.Value() < 0 {\n\t\tcpu.Set(0)\n\t}\n\tmem := allocatable.Memory().DeepCopy()\n\tif mem.Value() < 0 {\n\t\tmem.Set(0)\n\t}\n\tmem.Sub(reqs.Memory().DeepCopy())\n\tpods := allocatable.Pods().DeepCopy()\n\n\tcpu.SetScaled(cpu.MilliValue()*sharingPercentage/100, resource.Milli)\n\tmem.Set(mem.Value() * sharingPercentage / 100)\n\tpods.Set(pods.Value() * sharingPercentage / 100)\n\tavailability = corev1.ResourceList{\n\t\tcorev1.ResourceCPU: cpu,\n\t\tcorev1.ResourceMemory: mem,\n\t\tcorev1.ResourcePods: pods,\n\t}\n\n\treturn availability, images\n}", "title": "" }, { "docid": "defb68446906e5accd58204c6f6f075c", "score": "0.44290817", "text": "func (d *Deployer) nodeSlice() []*jettypes.NodeTemplate {\n\n\tnodes := make([]*jettypes.NodeTemplate, 0)\n\n\tfor _, n := range d.scenario.nodesGroup {\n\t\tfor _, v := range n {\n\t\t\tnodes = append(nodes, v)\n\t\t}\n\t}\n\n\treturn nodes\n}", "title": "" }, { "docid": "0d0a35fd28678d81e42694593c883dbe", "score": "0.44208977", "text": "func computeMulticastInterfaces(t *testing.T, data *TestData) (map[int][]string, error) {\n\tmulticastInterfaces, err := data.GetMulticastInterfaces(antreaNamespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttransportInterface, err := GetTransportInterface(data)\n\tif err != nil {\n\t\tt.Fatalf(\"Error getting transport interfaces: %v\", err)\n\t}\n\tnodeMulticastInterfaces := make(map[int][]string)\n\tfor nodeIdx := range clusterInfo.nodes {\n\t\t_, localInterfacesStr, _, err := data.RunCommandOnNode(nodeName(nodeIdx), \"ls /sys/class/net\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// The final multicast interfaces used for the node is calculated by (localInterfacesSet intersects multicastInterfaceSet adds transportInterface).\n\t\tlocalInterfacesSet := sets.New[string](strings.Split(strings.TrimSpace(localInterfacesStr), \"\\n\")...)\n\t\tmulticastInterfaceSet := sets.New[string](multicastInterfaces...)\n\t\texternalMulticastInterfaces := localInterfacesSet.Intersection(multicastInterfaceSet)\n\t\tcurrNodeMulticastInterfaces := sets.List(externalMulticastInterfaces.Insert(transportInterface))\n\t\tt.Logf(\"Multicast interfaces for node index %d is %+v\", nodeIdx, currNodeMulticastInterfaces)\n\t\tnodeMulticastInterfaces[nodeIdx] = currNodeMulticastInterfaces\n\t}\n\treturn nodeMulticastInterfaces, nil\n}", "title": "" }, { "docid": "d08f9d062c970257970cf4368d52ee70", "score": "0.44128934", "text": "func (s *srvNodeInfo) listNodes() {\n\tnmmu.RLock()\n\tnk := make([]int32, len(s.nodeMap))\n\ti := 0\n\tfor k := range s.nodeMap {\n\t\tnk[i] = k\n\t\ti++\n\t}\n\tsort.Slice(nk, func(i, j int) bool { return nk[i] < nk[j] })\n\tfor i := range nk {\n\t\teni := s.nodeMap[nk[i]]\n\t\tsub := time.Now().Sub(eni.lastAlive) / time.Second\n\t\tlog.Printf(\"ID: %4d %25s %14s %3d %2d:%3d %s\\n\", nk[i], eni.nodeName, eni.address, int(sub), eni.count, eni.status, eni.arg)\n\t}\n\tnmmu.RUnlock()\n}", "title": "" }, { "docid": "51b9ec828dc2e024c33fc6401d77ed66", "score": "0.4410578", "text": "func (st *DCOSTools) GetAgentNodes() (nodes []Node, err error) {\n\tfinder := &findNodesInDNS{\n\t\tforceTLS: st.ForceTLS,\n\t\tdnsRecord: \"leader.mesos\",\n\t\trole: AgentRole,\n\t\tgetFn: st.Get,\n\t\tnext: &findAgentsInHistoryService{\n\t\t\tpastTime: \"/minute/\",\n\t\t\tnext: &findAgentsInHistoryService{\n\t\t\t\tpastTime: \"/hour/\",\n\t\t\t\tnext: nil,\n\t\t\t},\n\t\t},\n\t}\n\treturn finder.find()\n}", "title": "" }, { "docid": "18e0e464c52c8e923d75f9279ecf5cc0", "score": "0.44011232", "text": "func nodesByNames(kube do.KubernetesService, clusterID, poolID string, nodeNames []string) ([]*godo.KubernetesNode, error) {\n\tnodePool, err := kube.GetNodePool(clusterID, poolID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := make([]*godo.KubernetesNode, 0, len(nodeNames))\n\tfor _, name := range nodeNames {\n\t\tnode, err := nodeByName(name, nodePool.Nodes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout = append(out, node)\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "2e4e35be4382d52bd093a30efb2be358", "score": "0.4400941", "text": "func (_Governance *GovernanceCaller) Nodes(opts *bind.CallOpts, arg0 *big.Int) (struct {\n\tOwner common.Address\n\tPublicKey []byte\n\tStaked *big.Int\n\tFined *big.Int\n\tName string\n\tEmail string\n\tLocation string\n\tUrl string\n\tUnstaked *big.Int\n\tUnstakedAt *big.Int\n}, error) {\n\tret := new(struct {\n\t\tOwner common.Address\n\t\tPublicKey []byte\n\t\tStaked *big.Int\n\t\tFined *big.Int\n\t\tName string\n\t\tEmail string\n\t\tLocation string\n\t\tUrl string\n\t\tUnstaked *big.Int\n\t\tUnstakedAt *big.Int\n\t})\n\tout := ret\n\terr := _Governance.contract.Call(opts, out, \"nodes\", arg0)\n\treturn *ret, err\n}", "title": "" }, { "docid": "88c0eb811f4680bc18197b2276a28614", "score": "0.4396342", "text": "func FindSimilarNodeGroups(nodeGroup cloudprovider.NodeGroup, cloudProvider cloudprovider.CloudProvider,\n\tnodeInfosForGroups map[string]*schedulercache.NodeInfo) ([]cloudprovider.NodeGroup, errors.AutoscalerError) {\n\tresult := []cloudprovider.NodeGroup{}\n\tnodeGroupId := nodeGroup.Id()\n\tnodeInfo, found := nodeInfosForGroups[nodeGroupId]\n\tif !found {\n\t\treturn []cloudprovider.NodeGroup{}, errors.NewAutoscalerError(\n\t\t\terrors.InternalError,\n\t\t\t\"failed to find template node for node group %s\",\n\t\t\tnodeGroupId)\n\t}\n\tfor _, ng := range cloudProvider.NodeGroups() {\n\t\tngId := ng.Id()\n\t\tif ngId == nodeGroupId {\n\t\t\tcontinue\n\t\t}\n\t\tngNodeInfo, found := nodeInfosForGroups[ngId]\n\t\tif !found {\n\t\t\tglog.Warningf(\"Failed to find nodeInfo for group %v\", ngId)\n\t\t\tcontinue\n\t\t}\n\t\tif IsNodeInfoSimilar(nodeInfo, ngNodeInfo) {\n\t\t\tresult = append(result, ng)\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "14f5f013961212b54ec843eba5e64bc3", "score": "0.43953303", "text": "func (dn *DefaultNoder) GetNodes(addr, path string) (Nodes, error) {\n\tqs := \"?near=_agent\"\n\turl := fmt.Sprintf(\"http://%s%s%s\", addr, path, qs)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnodes := Nodes{}\n\tif err := json.Unmarshal(body, &nodes); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "613ce1dd221a0e432128c253673d487b", "score": "0.43947285", "text": "func determineEnabledPoolCIDRs(node api.Node, ipPoolList api.IPPoolList, vxlan bool) []net.IPNet {\n\tvar cidrs []net.IPNet\n\tfor _, ipPool := range ipPoolList.Items {\n\t\t_, poolCidr, err := net.ParseCIDR(ipPool.Spec.CIDR)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Fatalf(\"Failed to parse CIDR '%s' for IPPool '%s'\", ipPool.Spec.CIDR, ipPool.Name)\n\t\t}\n\n\t\t// Check if IP pool selects the node\n\t\tif selects, err := ipPool.SelectsNode(node); err != nil {\n\t\t\tlog.WithError(err).Errorf(\"Failed to compare nodeSelector '%s' for IPPool '%s', skipping\", ipPool.Spec.NodeSelector, ipPool.Name)\n\t\t\tcontinue\n\t\t} else if !selects {\n\t\t\tlog.Debugf(\"IPPool '%s' does not select Node '%s'\", ipPool.Name, node.Name)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check if desired encap is enabled in the IP pool, the IP pool is not disabled, and it is IPv4 pool since we don't support encap with IPv6.\n\t\tif vxlan {\n\t\t\tif (ipPool.Spec.VXLANMode == api.VXLANModeAlways || ipPool.Spec.VXLANMode == api.VXLANModeCrossSubnet) && !ipPool.Spec.Disabled && poolCidr.Version() == 4 {\n\t\t\t\tcidrs = append(cidrs, *poolCidr)\n\t\t\t}\n\t\t} else {\n\t\t\t// Check if IPIP is enabled in the IP pool, the IP pool is not disabled, and it is IPv4 pool since we don't support IPIP with IPv6.\n\t\t\tif (ipPool.Spec.IPIPMode == api.IPIPModeCrossSubnet || ipPool.Spec.IPIPMode == api.IPIPModeAlways) && !ipPool.Spec.Disabled && poolCidr.Version() == 4 {\n\t\t\t\tcidrs = append(cidrs, *poolCidr)\n\t\t\t}\n\t\t}\n\t}\n\treturn cidrs\n}", "title": "" }, { "docid": "613ce1dd221a0e432128c253673d487b", "score": "0.43947285", "text": "func determineEnabledPoolCIDRs(node api.Node, ipPoolList api.IPPoolList, vxlan bool) []net.IPNet {\n\tvar cidrs []net.IPNet\n\tfor _, ipPool := range ipPoolList.Items {\n\t\t_, poolCidr, err := net.ParseCIDR(ipPool.Spec.CIDR)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Fatalf(\"Failed to parse CIDR '%s' for IPPool '%s'\", ipPool.Spec.CIDR, ipPool.Name)\n\t\t}\n\n\t\t// Check if IP pool selects the node\n\t\tif selects, err := ipPool.SelectsNode(node); err != nil {\n\t\t\tlog.WithError(err).Errorf(\"Failed to compare nodeSelector '%s' for IPPool '%s', skipping\", ipPool.Spec.NodeSelector, ipPool.Name)\n\t\t\tcontinue\n\t\t} else if !selects {\n\t\t\tlog.Debugf(\"IPPool '%s' does not select Node '%s'\", ipPool.Name, node.Name)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check if desired encap is enabled in the IP pool, the IP pool is not disabled, and it is IPv4 pool since we don't support encap with IPv6.\n\t\tif vxlan {\n\t\t\tif (ipPool.Spec.VXLANMode == api.VXLANModeAlways || ipPool.Spec.VXLANMode == api.VXLANModeCrossSubnet) && !ipPool.Spec.Disabled && poolCidr.Version() == 4 {\n\t\t\t\tcidrs = append(cidrs, *poolCidr)\n\t\t\t}\n\t\t} else {\n\t\t\t// Check if IPIP is enabled in the IP pool, the IP pool is not disabled, and it is IPv4 pool since we don't support IPIP with IPv6.\n\t\t\tif (ipPool.Spec.IPIPMode == api.IPIPModeCrossSubnet || ipPool.Spec.IPIPMode == api.IPIPModeAlways) && !ipPool.Spec.Disabled && poolCidr.Version() == 4 {\n\t\t\t\tcidrs = append(cidrs, *poolCidr)\n\t\t\t}\n\t\t}\n\t}\n\treturn cidrs\n}", "title": "" }, { "docid": "95fbeff848a105953d50ecf7761768a8", "score": "0.4392438", "text": "func (ns NodeIDSet) Intersection(other NodeIDSet) NodeIDSet {\n\tif len(ns) == 0 || len(other) == 0 {\n\t\treturn nil\n\t}\n\tvar result NodeIDSet\n\tfor i, j := 0, 0; i < len(ns) && j < len(other); {\n\t\tswitch {\n\t\tcase ns[i].Less(other[j]):\n\t\t\ti++\n\t\tcase other[j].Less(ns[i]):\n\t\t\tj++\n\t\tdefault:\n\t\t\tresult = append(result, ns[i])\n\t\t\ti++\n\t\t\tj++\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "d27351d6d5cf2ea3f65e111bd3ead829", "score": "0.43924257", "text": "func Getsysrange(apipa bool) (nets []string) {\r\n\tips, err := Adapters()\r\n\tif err != nil {\r\n\t\treturn []string{\"192.168.1.0/24\"}\r\n\t}\r\n\r\n\tfor _, i := range ips {\r\n\t\tfor _, j := range i.IPNets {\r\n\t\t\tif !apipa && j.Contains(net.ParseIP(\"169.254.67.143\")) {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\t_, ipnetA, _ := net.ParseCIDR(j.String())\r\n\t\t\tnets = append(nets, ipnetA.String())\r\n\t\t}\r\n\t}\r\n\treturn RemoveDuplicates(nets)\r\n}", "title": "" }, { "docid": "58ad0e110fd13a6065cb816c9d6b9231", "score": "0.4391287", "text": "func (db *MongoDbBridge) NetworkNodeAddressList(cur *mongo.Cursor, size uint) ([]*enode.Node, error) {\n\tlist := make([]*enode.Node, 0, size)\n\n\tfor cur.Next(context.Background()) {\n\t\tvar n struct {\n\t\t\tNode enode.Node `bson:\"node\"`\n\t\t}\n\t\tif err := cur.Decode(&n); err != nil {\n\t\t\tdb.log.Errorf(\"could not decode network node; %s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tlist = append(list, &n.Node)\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "b4f9d224296eb74650acc307f553732d", "score": "0.4387777", "text": "func (s *Server) hostNameAndIP() (map[string]string, error) {\n\tresult := make(map[string]string)\n\tlist, err := s.cs.CoreV1().Nodes().List(metav1.ListOptions{})\n\n\tif err != nil {\n\t\treturn result, errors.Wrap(err, \"Error Listing nodes\")\n\t}\n\n\tfor _, i := range list.Items {\n\t\tk := i.ObjectMeta.Name\n\t\tvar addr string\n\t\tfor _, a := range i.Status.Addresses {\n\t\t\tif a.Type == v1.NodeExternalIP {\n\t\t\t\taddr = a.Address\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif addr == \"\" {\n\t\t\treturn result, errors.Errorf(\"Could not find an external ip for Node: #%v\", i)\n\t\t}\n\n\t\tresult[k] = addr\n\t}\n\n\tlog.Printf(\"[Info][Kubernetes] List of nodes and ips: %#v\", result)\n\n\treturn result, nil\n}", "title": "" }, { "docid": "3e3c6832eee04c7e9ed351f4401230bc", "score": "0.4387572", "text": "func (routingTable *RoutingTable) FindClosestNodes(target *hashing.KademliaID, count int) []Node {\n\tvar candidates NodeCandidates\n\tbucketIndex := routingTable.getBucketIndex(target, hashing.IDLength)\n\tbucket := routingTable.buckets[bucketIndex]\n\n\tcandidates.Append(bucket.GetNodeAndCalcDistance(target))\n\n\tfor i := 1; (bucketIndex-i >= 0 || bucketIndex+i < hashing.IDLength*8) && candidates.Len() < count; i++ {\n\t\tif bucketIndex-i >= 0 {\n\t\t\tbucket = routingTable.buckets[bucketIndex-i]\n\t\t\tcandidates.Append(bucket.GetNodeAndCalcDistance(target))\n\t\t}\n\t\tif bucketIndex+i < hashing.IDLength*8 {\n\t\t\tbucket = routingTable.buckets[bucketIndex+i]\n\t\t\tcandidates.Append(bucket.GetNodeAndCalcDistance(target))\n\t\t}\n\t}\n\n\tcandidates.Sort()\n\n\tif count > candidates.Len() {\n\t\tcount = candidates.Len()\n\t}\n\n\treturn candidates.GetNodes(count)\n}", "title": "" }, { "docid": "ad675edcb065ea6284114b0421b83f28", "score": "0.4383451", "text": "func GetUnreachableNodes(c clientset.Interface, namespace string) ([]*v1.Node, error) {\n\t/*\n\t\t1. Select configmaps by label\n\t\t2. Verify the reported datetime is within threasholds\n\t\t3. Get a list of Unreachable nodes that have a quorum of results\n\t*/\n\tvar unreachableNodes []*v1.Node\n\n\t// get ConfigMaps \"reporting node Unreachable\"\n\tcmOptions := metav1.ListOptions{\n\t\tLabelSelector: configMapLabelName + \"=\" + configMapLabelValue,\n\t}\n\tcmList, err := c.CoreV1().ConfigMaps(namespace).List(cmOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting configmaps: %s\", err)\n\t}\n\tklog.V(4).Infof(\"got %d configmaps with matching labels\", len(cmList.Items))\n\n\tallNodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})\n\tif err != nil {\n\t\t// Maybe we should be retrying...?\n\t\treturn nil, fmt.Errorf(\"can't list nodes: %s\", err)\n\t}\n\tunreadyNodes, err := GetUnreadyNodes(c)\n\tif err != nil {\n\t\t// Maybe we should be retrying...?\n\t\treturn nil, fmt.Errorf(\"problem getting list of UnReady nodes %s\", err)\n\t}\n\treportingQuorum := len(allNodes.Items) - len(unreadyNodes.Items)\n\tklog.V(4).Infof(\"got results from %d nodes \", reportingQuorum)\n\tunReachableReportCountsByHost := make(map[string]int)\n\tfor _, cm := range cmList.Items {\n\t\t// check the cm checkTime is valid:\n\t\treportTimeStr := cm.Data[configMapKeyLastChecked]\n\t\treportTime, err := time.Parse(time.RFC3339, reportTimeStr)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"cannot parse datetime value %s in configmap %s error=%s\", reportTimeStr, cm.Name, err)\n\t\t\t// discount this report\n\t\t\tcontinue\n\t\t}\n\t\tklog.V(4).Infof(\"got a report time %s from a node\", reportTime)\n\t\tif reportTime.Before(time.Now().Add(configMapValidFor)) {\n\t\t\t// REAP contender\n\t\t\tfor _, nodeName := range strings.Split((cm.Data[configMapKeyUnreachableNodes]), \",\") {\n\t\t\t\tunReachableReportCountsByHost[nodeName]++\n\t\t\t}\n\t\t}\n\t}\n\t// Work out if all nodes that have reported agree (above the quorum threashold)\n\tfor _, node := range unreadyNodes.Items {\n\t\tif _, ok := unReachableReportCountsByHost[node.Name]; ok {\n\t\t\tklog.V(4).Infof(\"%d nodes have reported %s as unreachable (quorum is %d)\", unReachableReportCountsByHost[node.Name], node.Name, reportingQuorum)\n\t\t\tif unReachableReportCountsByHost[node.Name] >= reportingQuorum {\n\t\t\t\tunreachableNodes = append(unreachableNodes, &node)\n\t\t\t}\n\t\t}\n\t}\n\treturn unreachableNodes, nil\n}", "title": "" }, { "docid": "3ba0ec172fe8deb28c5db54a00ae2a18", "score": "0.43826053", "text": "func (o *Area2D) GetOverlappingAreas() gdnative.Array {\n\t//log.Println(\"Calling Area2D.GetOverlappingAreas()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"Area2D\", \"get_overlapping_areas\")\n\n\t// Call the parent method.\n\t// Array\n\tretPtr := gdnative.NewEmptyArray()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewArrayFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "0f1468229dcaefb80de5bdfa0bcdbddf", "score": "0.43778488", "text": "func (s *Container) NetworkNodes() ([]NetworkNode, error) {\n\tinspect, err := s.Inspect()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(inspect) == 0 {\n\t\treturn nil, fmt.Errorf(\"Container inspect is empty\")\n\t}\n\n\tnodes := make([]NetworkNode, 0)\n\tfor _, i := range inspect {\n\t\tip := i.NetworkSettings.IPAddress\n\t\tif ip == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(i.NetworkSettings.Ports) == 0 {\n\t\t\tnodes = append(nodes, NetworkNode{\n\t\t\t\tIpAddress: ip,\n\t\t\t})\n\t\t} else {\n\t\t\tfor k, _ := range i.NetworkSettings.Ports {\n\t\t\t\tnode := NetworkNode{}\n\t\t\t\tnode.IpAddress = ip\n\t\t\t\tnode.SetFromDocker(k)\n\t\t\t\tnodes = append(nodes, node)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "fa6104cd586d99c8df06b7616554a23d", "score": "0.43539748", "text": "func (l *importHeartbeatListener) GetNodes() ([]string, error) {\n\n\tl.lock.RLock()\n\tnodeIDsCopy := make([]string, len(l.nodeIDs))\n\tcopy(nodeIDsCopy, l.nodeIDs)\n\tl.lock.RUnlock()\n\treturn nodeIDsCopy, nil\n}", "title": "" }, { "docid": "8c021a6847142d71b6494caf265e8080", "score": "0.4353177", "text": "func (s *taskGroupController) ListAppNodes(selector labels.Selector) ([]*v1.AppNode, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "363b18206e0f74937c07cc155d9296ed", "score": "0.4349029", "text": "func (n *Node) GetNeededAddresses() int {\n\tstats := n.Stats()\n\tif stats.NeededIPs > 0 {\n\t\treturn stats.NeededIPs\n\t}\n\tif n.manager.releaseExcessIPs && stats.ExcessIPs > 0 {\n\t\t// Nodes are sorted by needed addresses, return negative values of excessIPs\n\t\t// so that nodes with IP deficit are resolved first\n\t\treturn stats.ExcessIPs * -1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "fbb36ef899f0b826073b2316eaf06413", "score": "0.43433464", "text": "func ExampleElastiCache_DescribeReservedCacheNodesOfferings_shared01() {\n\tsvc := elasticache.New(session.New())\n\tinput := &elasticache.DescribeReservedCacheNodesOfferingsInput{\n\t\tCacheNodeType: aws.String(\"cache.r3.large\"),\n\t\tDuration: aws.String(\"3\"),\n\t\tMaxRecords: aws.Int64(25),\n\t\tOfferingType: aws.String(\"Light Utilization\"),\n\t\tReservedCacheNodesOfferingId: aws.String(\"\"),\n\t}\n\n\tresult, err := svc.DescribeReservedCacheNodesOfferings(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase elasticache.ErrCodeReservedCacheNodesOfferingNotFoundFault:\n\t\t\t\tfmt.Println(elasticache.ErrCodeReservedCacheNodesOfferingNotFoundFault, aerr.Error())\n\t\t\tcase elasticache.ErrCodeInvalidParameterValueException:\n\t\t\t\tfmt.Println(elasticache.ErrCodeInvalidParameterValueException, aerr.Error())\n\t\t\tcase elasticache.ErrCodeInvalidParameterCombinationException:\n\t\t\t\tfmt.Println(elasticache.ErrCodeInvalidParameterCombinationException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "title": "" }, { "docid": "331a545053928153c35b28359696915f", "score": "0.4341804", "text": "func getAvailableCPULists(socket int64, pool *poolConfig) [](*cpuList) {\n\tavailableCPULists := make([](*cpuList), 0, len(pool.CPULists))\n\tfor _, c := range pool.CPULists {\n\t\tif socket < 0 || socket == int64(c.Socket) {\n\t\t\tif pool.Exclusive && len(c.getContainers()) > 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tavailableCPULists = append(availableCPULists, c)\n\t\t}\n\t}\n\treturn availableCPULists\n}", "title": "" }, { "docid": "366df5f33d2f3c1b4b7d736084a4b815", "score": "0.43415263", "text": "func (psc *partitionSchedulingContext) getSchedulingNodes(excludeReserved bool) []*SchedulingNode {\n\tpsc.RLock()\n\tdefer psc.RUnlock()\n\n\tschedulingNodes := make([]*SchedulingNode, 0)\n\tfor _, node := range psc.nodes {\n\t\t// filter out the nodes that are not scheduling\n\t\tif !node.nodeInfo.IsSchedulable() || (excludeReserved && node.isReserved()) {\n\t\t\tcontinue\n\t\t}\n\t\tschedulingNodes = append(schedulingNodes, node)\n\t}\n\treturn schedulingNodes\n}", "title": "" }, { "docid": "d3ab8bd4c2c7dd87a3bc5cdd7b3575a7", "score": "0.43399376", "text": "func (r *RedisPod) ClusterNodes() (nodes []*RedisNode, err error) {\n\tm, err := r.getPodsInNamespace(r.pod.Namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnodes, err = r.clusterNodes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, node := range nodes {\n\t\tp, ok := m[node.IP]\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"can't find pod for ip \" + node.IP)\n\t\t}\n\t\tnode.Pod = &p\n\t}\n\treturn\n}", "title": "" }, { "docid": "79b9c5a71c4f1454450f068753024614", "score": "0.4339193", "text": "func (w *Watcher) buildNodeConfig() ([]*v1.Node, error) {\n\n\t// if the clusterConfig is nil for the watcher, we can't do anything\n\tif w.ClusterConfig == nil {\n\t\t// w.logger.Infof(\"w.ClusterConfig %p, len AllEndpoints %d\", w.ClusterConfig, len(w.AllEndpoints))\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.ClusterConfig was nil\")\n\t}\n\n\t// if all endpoints are empty then throw an error. we can't publish this\n\tif len(w.AllEndpoints) == 0 {\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.AllEndpoints was empty\")\n\t}\n\n\tif len(w.Nodes) == 0 {\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.Nodes was empty\")\n\t}\n\n\tw.RLock()\n\tdefer w.RUnlock()\n\n\t// make a map for all nodes known to the watcher to prevent dupes\n\tnodeMap := make(map[string]*v1.Node)\n\tfor _, n := range w.Nodes {\n\t\tnodeMap[n.Name] = n\n\t}\n\n\t// loop over subsets across all endpoints and sort them into our nodes\n\t// for _, endpoint := range w.AllEndpoints { // Kubernetes *v1.Endpoint\n\n\t// \t// look over the subsets and address to find what node owns this endpoint\n\t// \tfor _, subset := range endpoint.Subsets {\n\n\t// \t\t// find the owning node of this set of subsets\n\t// \t\tfor _, addr := range subset.Addresses {\n\t// \t\t\tif addr.NodeName == nil {\n\t// \t\t\t\tlog.Warningln(\"watcher: skipped a subset address because the NodeName within was nil\")\n\t// \t\t\t\tcontinue\n\t// \t\t\t}\n\n\t// \t\t\t// check if this address's node name is in our nodeList map. If not,\n\t// \t\t\t// skip it until we learn about this node existing\n\t// \t\t\towningNode, ok := nodeMap[*addr.NodeName]\n\t// \t\t\tif !ok {\n\t// \t\t\t\tlog.Warningln(\"watcher: buildNodeConfig() skipped endpoint\", addr.IP, \"for node\", *addr.NodeName, \"because no node of this name is known yet\")\n\t// \t\t\t\tcontinue\n\t// \t\t\t}\n\n\t// \t\t\t// if the node does not have this endpoint yet, then we add it to the list and set this node in the node map\n\t// \t\t\tif !w.nodeHasAddressAlready(owningNode, addr) {\n\t// \t\t\t\t// fetch the owning node from our node map, append this new endpoint, and set it back\n\t// \t\t\t\towningNode.EndpointAddresses = append(owningNode.EndpointAddresses, addr)\n\t// \t\t\t\tlog.Warningln(\"watcher: node\", owningNode.Name, \"has had the following endpoint added:\", endpoint, \"these endpoints are now set:\", owningNode.EndpointAddresses)\n\t// \t\t\t\tw.Lock()\n\t// \t\t\t\tnodeMap[owningNode.Name] = owningNode\n\t// \t\t\t\tw.Unlock()\n\t// \t\t\t}\n\t// \t\t}\n\t// \t}\n\t// }\n\n\t// convert the nodeList map into a types.NodeList. Sort all the subsets\n\t// and then sort the node list at the end as well\n\tvar nodeList []*v1.Node\n\tfor _, n := range nodeMap {\n\t\tnodeList = append(nodeList, n)\n\t}\n\n\t// log.Debugln(\"watcher: buildNodeConfig is returning\", len(nodeList), \"nodes\")\n\treturn nodeList, nil\n}", "title": "" }, { "docid": "9596f70e9b65a85470fa7e12cff857de", "score": "0.4338942", "text": "func (e *EpochSnapshot) Nodes() committee.NodeDescriptorLookup {\n\treturn e.nodes\n}", "title": "" }, { "docid": "502bbee65190afa3f78a9ffdd872fd65", "score": "0.4338856", "text": "func GetNodes(client kubernetes.Interface) (*types.KurlNodes, error) {\n\tnodes, err := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"list nodes\")\n\t}\n\n\ttoReturn := types.KurlNodes{}\n\n\tfor _, node := range nodes.Items {\n\t\tcpuCapacity := types.CapacityAvailable{}\n\t\tmemoryCapacity := types.CapacityAvailable{}\n\t\tpodCapacity := types.CapacityAvailable{}\n\n\t\tmemoryCapacity.Capacity = float64(node.Status.Capacity.Memory().Value()) / math.Pow(2, 30) // capacity in GB\n\n\t\tcpuCapacity.Capacity, err = strconv.ParseFloat(node.Status.Capacity.Cpu().String(), 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse CPU capacity %q for node %s\", node.Status.Capacity.Cpu().String(), node.Name)\n\t\t}\n\n\t\tpodCapacity.Capacity = float64(node.Status.Capacity.Pods().Value())\n\n\t\tnodeIP := \"\"\n\t\tfor _, address := range node.Status.Addresses {\n\t\t\tif address.Type == v1.NodeInternalIP {\n\t\t\t\tnodeIP = address.Address\n\t\t\t}\n\t\t}\n\n\t\tif nodeIP == \"\" {\n\t\t\tlogger.Infof(\"Did not find address for node %s, %+v\", node.Name, node.Status.Addresses)\n\t\t} else {\n\t\t\tnodeMetrics, err := getNodeMetrics(nodeIP)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Infof(\"Got error retrieving stats for node %q: %v\", node.Name, err)\n\t\t\t} else {\n\t\t\t\tif nodeMetrics.Node.Memory != nil && nodeMetrics.Node.Memory.AvailableBytes != nil {\n\t\t\t\t\tmemoryCapacity.Available = float64(*nodeMetrics.Node.Memory.AvailableBytes) / math.Pow(2, 30)\n\t\t\t\t}\n\n\t\t\t\tif nodeMetrics.Node.CPU != nil && nodeMetrics.Node.CPU.UsageNanoCores != nil {\n\t\t\t\t\tcpuCapacity.Available = cpuCapacity.Capacity - (float64(*nodeMetrics.Node.CPU.UsageNanoCores) / math.Pow(10, 9))\n\t\t\t\t}\n\n\t\t\t\tpodCapacity.Available = podCapacity.Capacity - float64(len(nodeMetrics.Pods))\n\t\t\t}\n\t\t}\n\n\t\tnodeLabelArray := []string{}\n\t\tfor k, v := range node.Labels {\n\t\t\tnodeLabelArray = append(nodeLabelArray, fmt.Sprintf(\"%s:%s\", k, v))\n\t\t}\n\n\t\ttoReturn.Nodes = append(toReturn.Nodes, types.Node{\n\t\t\tName: node.Name,\n\t\t\tIsConnected: isConnected(node),\n\t\t\tIsReady: isReady(node),\n\t\t\tIsPrimaryNode: isPrimary(node),\n\t\t\tCanDelete: node.Spec.Unschedulable && !isConnected(node),\n\t\t\tKubeletVersion: node.Status.NodeInfo.KubeletVersion,\n\t\t\tCPU: cpuCapacity,\n\t\t\tMemory: memoryCapacity,\n\t\t\tPods: podCapacity,\n\t\t\tLabels: nodeLabelArray,\n\t\t\tConditions: findNodeConditions(node.Status.Conditions),\n\t\t})\n\t}\n\n\tkurlConf, err := ReadConfigMap(client)\n\tif err != nil {\n\t\tif kuberneteserrors.IsNotFound(err) {\n\t\t\ttoReturn.IsKurlEnabled = false\n\t\t\treturn &toReturn, nil\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"get kurl config\")\n\t}\n\n\ttoReturn.IsKurlEnabled = true\n\n\tif val, ok := kurlConf.Data[\"ha\"]; ok && val != \"\" {\n\t\tparsedBool, err := strconv.ParseBool(val)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse 'ha' entry in kurl config %q\", val)\n\t\t}\n\t\ttoReturn.HA = parsedBool\n\t}\n\n\treturn &toReturn, nil\n}", "title": "" }, { "docid": "c9331c5b4e7493581b1582ec2709d64b", "score": "0.43326128", "text": "func FindAvailableHost(namespace, cidr string) (string, error) {\n\n\t// Look through namespaces and update one if it exists\n\tfor x := range Manager {\n\t\tif Manager[x].namespace == namespace {\n\t\t\t// Check that the address range is the same\n\t\t\tif Manager[x].cidr != cidr {\n\t\t\t\t// If not rebuild the available hosts\n\t\t\t\tah, err := buildHosts(cidr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tManager[x].hosts = ah\n\t\t\t}\n\t\t\t// TODO - currently we search (incrementally) through the list of hosts\n\t\t\tfor y := range Manager[x].hosts {\n\t\t\t\t// find a host that is marked false (i.e. unused)\n\t\t\t\tif Manager[x].addressManager[Manager[x].hosts[y]] == false {\n\t\t\t\t\t// Mark it to used\n\t\t\t\t\tManager[x].addressManager[Manager[x].hosts[y]] = true\n\t\t\t\t\treturn Manager[x].hosts[y], nil\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If we have found the manager for this namespace and not returned an address then we've expired the range\n\t\t\treturn \"\", fmt.Errorf(\"No addresses available in [%s] range [%s]\", namespace, cidr)\n\n\t\t}\n\t}\n\tah, err := buildHosts(cidr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// If it doesn't exist then it will need adding\n\tnewManager := ipManager{\n\t\tnamespace: namespace,\n\t\taddressManager: make(map[string]bool),\n\t\thosts: ah,\n\t\tcidr: cidr,\n\t}\n\tManager = append(Manager, newManager)\n\n\tfor x := range newManager.hosts {\n\t\tif Manager[x].addressManager[newManager.hosts[x]] == false {\n\t\t\tManager[x].addressManager[newManager.hosts[x]] = true\n\t\t\treturn newManager.hosts[x], nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"No addresses available in [%s] range [%s]\", namespace, cidr)\n\n}", "title": "" }, { "docid": "dc5114601a1ebb55354bb168e73fcf76", "score": "0.433136", "text": "func (tc *ToxiCluster) PoisonedPGAddr(ctx context.Context, node nodeListOption) []string {\n\tvar out []string\n\n\turls := tc.ExternalPGUrl(ctx, node)\n\texts := tc.PoisonedExternalAddr(ctx, node)\n\tfor i, s := range urls {\n\t\tu, err := url.Parse(s)\n\t\tif err != nil {\n\t\t\ttc.cluster.t.Fatal(err)\n\t\t}\n\t\tu.Host = exts[i]\n\t\tout = append(out, u.String())\n\t}\n\treturn out\n}", "title": "" }, { "docid": "3783b9286681938dab0657eae28f84f1", "score": "0.43302977", "text": "func getMinionNodes(c *kubernetes.Clientset) *api.NodeList {\n\tnodes, err := c.Core().Nodes().List(\n\t\tmetav1.ListOptions{\n\t\t\tFieldSelector: \"spec.unschedulable=false\",\n\t\t})\n\tif err != nil {\n\t\tfmt.Println(\"Failed to fetch nodes\", err)\n\t\treturn nil\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "90fc5e18cd242b30a58c8fa4f933002d", "score": "0.43302575", "text": "func nodesOverview(cfg api.Config, context string) (string, error) {\n\tcs, err := csForContext(cfg, context)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Can't create a clientset based on config provided\")\n\t}\n\tnodes, err := cs.CoreV1().Nodes().List(metav1.ListOptions{})\n\tnodeCount := len(nodes.Items)\n\treadyCount := 0\n\tfor _, node := range nodes.Items {\n\t\tfor _, nodeCondition := range node.Status.Conditions {\n\t\t\tif nodeCondition.Type == \"Ready\" {\n\t\t\t\tif nodeCondition.Status == \"True\" {\n\t\t\t\t\treadyCount++\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Can't get nodes in cluster\")\n\t}\n\tnoverview := fmt.Sprintf(\"%v/%v\", readyCount, nodeCount)\n\treturn noverview, nil\n}", "title": "" }, { "docid": "b37167476d186c9c1a45e4c2403a3e55", "score": "0.43273667", "text": "func (g *Graph) HealAddressNodes(cache *net.ASNCache, uuid string) error {\n\tvar err error\n\tcidrToNode := make(map[string]Node)\n\n\tif cache == nil {\n\t\tcache = net.NewASNCache()\n\n\t\tif err = g.ASNCacheFill(cache); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tnodes, err := g.AllNodesOfType(\"ipaddr\", uuid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, node := range nodes {\n\t\taddr := g.db.NodeToID(node)\n\n\t\tas := cache.AddrSearch(addr)\n\t\tif as == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tcidr, found := cidrToNode[as.Prefix]\n\t\tif !found {\n\t\t\tcidr, err = g.db.ReadNode(as.Prefix, \"netblock\")\n\t\t\tif err != nil {\n\t\t\t\tif err := g.InsertInfrastructure(as.ASN, as.Description, addr, as.Prefix, as.Source, as.Tag, uuid); err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tcidr, err = g.db.ReadNode(as.Prefix, \"netblock\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcidrToNode[as.Prefix] = cidr\n\t\t}\n\n\t\tif err := g.InsertEdge(&Edge{\n\t\t\tPredicate: \"contains\",\n\t\t\tFrom: cidr,\n\t\t\tTo: node,\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "664c54c8d6df5735260178982609ae9b", "score": "0.43230674", "text": "func (o *Network) AutoRanges(node *Node) ([]*NetworkRange, error) {\n\tnetId, err := o.Id()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnodeId, err := node.Id()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turi := path.Join(o.ApiName(), netId, \"auto_ranges\", nodeId)\n\tres := make([]*NetworkRange, 0)\n\treturn res, List(uri, &res)\n}", "title": "" }, { "docid": "6df32cde2d5fd301539ef809840a318b", "score": "0.43207902", "text": "func (s *hashRingState) fixReplicaOwners() {\n\tfor i := 0; i < len(s.virtualNodes); i++ {\n\t\tvnode := s.virtualNodes[i] // auxiliary\n\t\ts.replicaOwners[vnode] = make([]Node, s.replicationFactor)\n\t\ts.replicaOwners[vnode][0] = s.virtualNodes[i].node\n\n\t\tj := i // j: index i --> len(s.virtualNodes) --> 0 --> i-1\n\t\tk := s.replicationFactor - 1 // k: # of subsequent nodes remaining to be found\n\t\tfor k > 0 {\n\t\t\t// Get j, the next index in state's vnodes slice.\n\t\t\tj = (j + 1) % len(s.virtualNodes)\n\t\t\t// If cycle, break. even if k > 0; it means that s.replicationFactor > # of nodes.\n\t\t\tif j == i {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcurrNode := s.virtualNodes[j].node // the node we are on for this `i`'s (index `j`-)traversal\n\t\t\tnodePresent := false // flag to raise if currNode is already in s.replicaOwners\n\t\t\t// As we want distinct nodes only in s.replicaOwners, make sure currNode is not already in.\n\t\t\tfor _, l := range s.replicaOwners[vnode] {\n\t\t\t\tif currNode == l {\n\t\t\t\t\tnodePresent = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If currNode is not already in, get it in, and decrease # of nodes remaining to be found.\n\t\t\tif !nodePresent {\n\t\t\t\ts.replicaOwners[vnode][s.replicationFactor-k] = currNode\n\t\t\t\tk--\n\t\t\t}\n\t\t}\n\t\t// If cycled above, set slice's length so as to address the useful values only:\n\t\tif j == i {\n\t\t\ts.replicaOwners[vnode] = s.replicaOwners[vnode][:s.replicationFactor-k]\n\t\t\t// NOTE: There is a memory leak: the amount of memory that is allocated for the\n\t\t\t// slice of every key in s.replicaOwners is more than the required amount when\n\t\t\t// such cycles happen (i.e. when replicationFactor > number of distinct nodes).\n\t\t\t// To fix this, allocate a temp slice as make([]Node, 1, s.replicationFactor)\n\t\t\t// and immediately fill it with the distinct Node that the vnode belongs to,\n\t\t\t// then append any extra Nodes found, and in the end, allocate a new slice of\n\t\t\t// capacity equal to temp slice's *length*, and copy(newSlice, temp).\n\t\t\t// This, however, would result in lower performance (more allocations) in my\n\t\t\t// own average use cases (that replicationFactor <= number of distinct nodes),\n\t\t\t// so I'm not interested in changing it for now.\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d4dce1fa28380df4d913959a54cc6e6", "score": "0.43202758", "text": "func (o *V0037JobResponseProperties) GetRequiredNodes() string {\n\tif o == nil || o.RequiredNodes == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequiredNodes\n}", "title": "" }, { "docid": "989778dfba91aed25b2f51a895de8e94", "score": "0.43198934", "text": "func (scw *scalewayCloudProvider) NodeGroups() []cloudprovider.NodeGroup {\n\n\tklog.V(4).Info(\"NodeGroups,ClusterID=\", scw.clusterID)\n\n\tnodeGroups := make([]cloudprovider.NodeGroup, len(scw.nodeGroups))\n\tfor i, ng := range scw.nodeGroups {\n\t\tnodeGroups[i] = ng\n\t}\n\treturn nodeGroups\n}", "title": "" }, { "docid": "d4021d5eb03dcdb78d344450625504ae", "score": "0.4317703", "text": "func (pc *PoolConfig) getNodePresentOnCSPC(cspc *cstor.CStorPoolCluster) (map[string]bool, error) {\n\tnodeMap := make(map[string]bool)\n\tfor _, pool := range cspc.Spec.Pools {\n\t\tnodeName, err := pc.AlgorithmConfig.GetNodeFromLabelSelector(pool.NodeSelector)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err,\n\t\t\t\t\"could not get node name for node selector {%v} \"+\n\t\t\t\t\t\"from cspc %s\", pool.NodeSelector, cspc.Name)\n\t\t}\n\t\tnodeMap[nodeName] = true\n\t}\n\treturn nodeMap, nil\n}", "title": "" }, { "docid": "a8086b90e1ba25dc497cd2c1298abba6", "score": "0.43083465", "text": "func (m *WindowsNetworkIsolationPolicy) GetEnterpriseIPRanges()([]IpRangeable) {\n val, err := m.GetBackingStore().Get(\"enterpriseIPRanges\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]IpRangeable)\n }\n return nil\n}", "title": "" }, { "docid": "2b22ca6c1c2e5dfb36878e1fa10d7de4", "score": "0.42810678", "text": "func CompareNodes(n1, n2 []*Node) []*Node {\n\tvar commonNodes []*Node\n\tfor _, i := range n1 {\n\t\tfor _, j := range n2 {\n\t\t\tif i == j {\n\t\t\t\tcommonNodes = append(commonNodes, i)\n\t\t\t}\n\t\t}\n\t}\n\treturn commonNodes\n}", "title": "" }, { "docid": "5d0f37a6b2cec05c0c443d0d68dd8ad7", "score": "0.42766866", "text": "func loadNodes(ctx context.Context, cfg *Config) ([]v1.Node, error) {\n\tcs, err := cfg.Clientset()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cfg.NodeName != \"\" {\n\t\tnode, err := cs.CoreV1().Nodes().Get(ctx, cfg.NodeName, metav1.GetOptions{})\n\t\treturn []v1.Node{*node}, err\n\t}\n\n\tlopts := metav1.ListOptions{}\n\tif sel := cfg.NodeSelector; sel != nil {\n\t\tlopts.LabelSelector = sel.String()\n\t}\n\n\tnodes, err := cs.CoreV1().Nodes().List(ctx, lopts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nodes.Items, nil\n}", "title": "" }, { "docid": "97e676e33f268a354154b55d06c366fd", "score": "0.4275837", "text": "func GetNodes(edges *Edges) Nodes {\n\tencountered := map[string]int{}\n\n\t// Create a map of all unique elements.\n\tfor v := range edges.Source {\n\t\tencountered[edges.Source[v]] = encountered[edges.Source[v]] + 1\n\t}\n\n\tfor v := range edges.Target {\n\t\tencountered[edges.Target[v]] = encountered[edges.Target[v]] + 1\n\t}\n\n\t// Place all keys from the map into a slice.\n\tresult := []string{}\n\tcount := []int{}\n\tfor key, index := range encountered {\n\t\tresult = append(result, key)\n\t\tcount = append(count, index)\n\t}\n\tnodes := Nodes{result, count}\n\n\treturn (nodes)\n}", "title": "" } ]
658727b2eff88aa6d102d97869f9ac9d
String returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "66e16744f3ebd77b95561fbce23e2198", "score": "0.0", "text": "func (s DisassociateTrustStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65449643", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65449643", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65449643", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65449643", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65449643", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "947af2e687894d6d29a03e631290b565", "score": "0.64547503", "text": "func (s CognitoMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d5612f7ba09e736647ac5e632243a30b", "score": "0.643539", "text": "func (s BotMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.63775235", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "844a81f1d0eca520ae47087c72a631f9", "score": "0.6358759", "text": "func (s OidcMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9ee2b223b7036b0844ac2370527fbfe", "score": "0.633222", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Distribution Params:\n Community Tax: %s\n Withdraw Addr Enabled: %t`,\n\t\tp.CommunityTax, p.WithdrawAddrEnabled)\n}", "title": "" }, { "docid": "7810f5262bc9faa785879a38fa9b775d", "score": "0.6268914", "text": "func (s MemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fdd9d07690703691d426379ec8d9a7a", "score": "0.62640214", "text": "func (s MemberFrameworkAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.6248132", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.6248132", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5c518cab9a26cf655d1488d854d900db", "score": "0.6175749", "text": "func (s ApiCallDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1918ba7d7432948a4b58121035f828ce", "score": "0.6152453", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"ACLKey: %v\\n\", p.ACL))\n\tsb.WriteString(fmt.Sprintf(\"DAOOwnerKey: %s\\n\", p.DAOOwner))\n\tsb.WriteString(fmt.Sprintf(\"UpgradeKey: %v\\n\", p.Upgrade))\n\treturn sb.String()\n}", "title": "" }, { "docid": "1f8cd632fedb20ae2db50fc88345f4ca", "score": "0.61329937", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(\n\t\t\"TokenCourse: %d\\n\"+\n\t\t\t\"SubscriptionPrice: %d\\n\"+\n\t\t\t\"VPNGBPrice: %d\\n\"+\n\t\t\t\"StorageGBPrice: %d\\n\"+\n\t\t\t\"BaseVPNGb: %d\\n\"+\n\t\t\t\"BaseStorageGb: %d\\n\"+\n\t\t\t\"CouseChangeSigners: %v\\n\",\n\t\tp.TokenCourse,\n\t\tp.SubscriptionPrice,\n\t\tp.VPNGBPrice,\n\t\tp.StorageGBPrice,\n\t\tp.BaseVPNGb,\n\t\tp.BaseStorageGb,\n\t\tp.CourseChangeSigners,\n\t)\n}", "title": "" }, { "docid": "6fd9f1d4d485cf6d2559650a970dc32b", "score": "0.61230373", "text": "func (s UpdateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.6090859", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.60702074", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.60702074", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3901139e74a3c7073fb661bd90272907", "score": "0.60649943", "text": "func (s FeatureParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "faed4e1bb0db60dcb2c6f36e3c1066ed", "score": "0.6063792", "text": "func (k *key) String() string {\n\treturn \"api context value \" + k.name\n}", "title": "" }, { "docid": "8d24224fe2d09199e308710466d5c714", "score": "0.5997587", "text": "func (p paramHeader) String() string {\n\treturn fmt.Sprintf(\"%s (%d): %s\", p.typ, p.len, p.raw)\n}", "title": "" }, { "docid": "f0c8ec069ef4f371f74a77c1fff342eb", "score": "0.59937793", "text": "func (s Api) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f0c8ec069ef4f371f74a77c1fff342eb", "score": "0.59937793", "text": "func (s Api) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.5986722", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a5a738c2efdc9f171b82ac6ba530b5b7", "score": "0.59865755", "text": "func (s MemberSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.592786", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.592786", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c8c4ae4808f93da388e9d506cd9913ca", "score": "0.5926663", "text": "func (pc ParamChange) String() string {\n\treturn fmt.Sprintf(`Param Change:\n Subspace: %s\n Key: %s\n Subkey: %X\n Value: %X\n`, pc.Subspace, pc.Key, pc.Subkey, pc.Value)\n}", "title": "" }, { "docid": "0763cdfe3b89f2f4d83053ed67f8ca3e", "score": "0.591537", "text": "func (s UpdateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bc3052ec2d6d17830a144a788ddc57d3", "score": "0.59061795", "text": "func (s ListMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5882995", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5880884", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5880884", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3815b87970f5ed84eedf754a2150de2c", "score": "0.5868394", "text": "func (s MethodSetting) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "332c8c86d87b0654fa614312ec4429f0", "score": "0.58665967", "text": "func (p Provider) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "1cdad9caaf72275da4ef3e46c448a1a3", "score": "0.5859716", "text": "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "title": "" }, { "docid": "bbc0a707148f9155b8d783f7e43faf92", "score": "0.58576953", "text": "func (vl VerbLevel) String() string {\n\treturn fmt.Sprintf(\"%d=%s\", vl, vl.Name())\n}", "title": "" }, { "docid": "d4cb7553dc2c5babac931f8d2e20874e", "score": "0.58555984", "text": "func (s HeaderMatchMethod) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "71d132ba1d30a77fff56311ae4ba8357", "score": "0.584429", "text": "func (s InvisibleFieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d276cf09182d09730c046fea89169f72", "score": "0.5843529", "text": "func (g *Generic) String() string {\n\tparamStr := make([]string, len(g.Params))\n\tfor i, pr := range g.Params {\n\t\tparamStr[i] = pr.String()\n\t}\n\n\treturn fmt.Sprintf(\"{Header: %s, Params: %s}\",\n\t\tg.Header.String(),\n\t\tparamStr,\n\t)\n}", "title": "" }, { "docid": "cdfef40083c53bb9723ce783f15375e4", "score": "0.58268124", "text": "func (c CliParams) String() string {\n\tnameFmt := \"%20s: \"\n\tlines := []string{\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Debug\", c.Debug),\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Help Printed\", c.HelpPrinted),\n\t\tfmt.Sprintf(nameFmt+\"%q\", \"Errors\", c.Errors),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Input File\", c.InputFile),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Count\", c.Count),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Points\", c.Points),\n\t}\n\treturn strings.Join(lines, \"\\n\") + \"\\n\"\n}", "title": "" }, { "docid": "2e924ed8b95c5fb25e921c6ac44b5f27", "score": "0.58194304", "text": "func (s MemberConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "621894444e85b1dadecdc7c588e9c52b", "score": "0.581234", "text": "func (p *VCardProperty) String() string {\n\treturn fmt.Sprintf(\" %s (type=%s, parameters=%v): %v\", p.Name, p.Type, p.Parameters, p.Value)\n}", "title": "" }, { "docid": "39e9504fecf3857dbef7c488840dcd72", "score": "0.5810874", "text": "func (o LunOnlineRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4dbcf4e917e2636916cf8b979f3d6134", "score": "0.58059764", "text": "func (s AuthInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.5802966", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11c90d6ee574cda9903fc75bee8832a0", "score": "0.5797353", "text": "func (s DBClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9c66cccdde8c717e9a130db2918369c1", "score": "0.5794307", "text": "func (s ParameterStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "de2779b21a0c4435f4cf673825eb1442", "score": "0.57896495", "text": "func (p *PluginAPI) String() string {\n\tvar lines []string\n\tlines = append(lines, \"Struct PluginAPI:\")\n\tlines = append(lines, \"\\t- Generated on: 2016-12-06 08:06:59.815134005 +0100 CET\")\n\tlines = append(lines, \"\\t- Command: go-bind-plugin -plugin-path plugin.so -plugin-package ./plugin -output-name PluginAPI -output-path plugin_api.go -output-package main -dereference-vars -rebuild\")\n\tlines = append(lines, \"\\nPlugin info:\")\n\tlines = append(lines, \"\\t- package: github.com/wendigo/go-bind-plugin-example/plugin\")\n\tlines = append(lines, \"\\t- sha256 sum: 303cd891bd37c209c0ad0798673bd871af8e6bae3673cc7c261abb54e76e6ae9\")\n\tlines = append(lines, \"\\t- size: 2578348 bytes\")\n\tlines = append(lines, \"\\nExported functions (2):\")\n\tlines = append(lines, \"\\t- CalculateSin func(float64) (float64)\")\n\tlines = append(lines, \"\\t- SayHello func(string)\")\n\n\tlines = append(lines, \"\\nExported variables (1):\")\n\tlines = append(lines, \"\\t- CurrentYear int\")\n\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "ab429420bcc0e75dcb7ca22c09e73967", "score": "0.5780354", "text": "func (s IdentityProviderDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14a5d8153fa38ed0e3c2c8e5825e17e4", "score": "0.5774273", "text": "func (s CreateMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14a5d8153fa38ed0e3c2c8e5825e17e4", "score": "0.5774273", "text": "func (s CreateMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3d29636fde22fff60ec1419e6a474619", "score": "0.57726157", "text": "func (s OutputParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d00241105253d4428c22acb51ad5ae04", "score": "0.577088", "text": "func (obj KeyColumnUsage) String() string {\n\tif data, err := json.Marshal(obj); err != nil {\n\t\treturn fmt.Sprintf(\"<KeyColumnUsage>\")\n\t} else {\n\t\treturn string(data)\n\t}\n}", "title": "" }, { "docid": "a1a197d01d3356cc58146d848344edad", "score": "0.5762847", "text": "func (s GetApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.5754628", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "decd8e9f3b4aa59eb22e199be9f77f20", "score": "0.57526225", "text": "func (o ExportPolicyCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "1e89f691f0ca1e346e18ac407cb71020", "score": "0.57522655", "text": "func (v *Argument) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Type: %v\", v.Type)\n\ti++\n\tif v.Annotations != nil {\n\t\tfields[i] = fmt.Sprintf(\"Annotations: %v\", v.Annotations)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Argument{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "447719bdb220732b4bce8c4dc6d60e01", "score": "0.5742958", "text": "func (p *Parameters) String() string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s%s%s\", p.URL.String(), p.Headers.String(), p.TLSClient.String())\n}", "title": "" }, { "docid": "965a9abdefe33b7750c8d7579c523240", "score": "0.57293695", "text": "func (s ReadOnlyFieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "acb5f15fa51a789751deffe7cde15980", "score": "0.57267505", "text": "func (bs *Bindings) String() string {\r\n\treturn \"PARAM=VALUE\"\r\n}", "title": "" }, { "docid": "fc5a5ad42da54884cfd84053b31bb46a", "score": "0.5718113", "text": "func (o *Webchatmemberinfo) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "2a06959f51277ecf54529ee5b2a72ded", "score": "0.57134175", "text": "func (s MemberFrameworkConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e31bfc3c4e736fc4911e733d7d46a900", "score": "0.57114756", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, quotedArgsString(i.finalArgs))\n}", "title": "" }, { "docid": "420fa8ace31be8c1faca8c622cb1dec1", "score": "0.57056797", "text": "func (a Access) String() string {\n\tswitch a {\n\tcase Default, PhoneAndEmail:\n\t\treturn \"phone+email\"\n\tcase Phone:\n\t\treturn \"phone\"\n\tcase Email:\n\t\treturn \"email\"\n\tcase Disabled:\n\t\treturn \"disabled\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "05c123f93f222656e1cd07c1a3db6741", "score": "0.5698609", "text": "func (s InstanceInformationStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "91162058a12197555a9198a77cba4eb6", "score": "0.5698122", "text": "func (s MemberFabricAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a055cc21dc61ca5dc698ea9ff7d4b847", "score": "0.56891847", "text": "func (s ApiKeyCredential) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7249bc55cee6e54f969343b21734bc93", "score": "0.5681956", "text": "func (o SnapmirrorCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2fc1b2ea1d2dc3b92ae03f3c915fc03e", "score": "0.56795216", "text": "func (p *Param) String() string {\n\tswitch p.ParameterKind {\n\tcase variable, variableDecl:\n\t\treturn strconv.Quote(\"$\" + p.Name)\n\tcase declaration:\n\t\treturn p.Name\n\tcase stringConstant:\n\t\treturn strconv.Quote(p.Name)\n\tcase otherConstant:\n\t\treturn p.Name\n\tcase ignored:\n\t\treturn \"\"\n\tdefault:\n\t\treturn \"<not supported>\"\n\t}\n}", "title": "" }, { "docid": "783de1237c3178c9c58f5582516163ec", "score": "0.5672054", "text": "func (p MigProfileInfo) String() string {\n\tvar suffix string\n\tif len(p.Attributes) > 0 {\n\t\tsuffix = \"+\" + strings.Join(p.Attributes, \",\")\n\t}\n\tif p.C == p.G {\n\t\treturn fmt.Sprintf(\"%dg.%dgb%s\", p.G, p.GB, suffix)\n\t}\n\treturn fmt.Sprintf(\"%dc.%dg.%dgb%s\", p.C, p.G, p.GB, suffix)\n}", "title": "" }, { "docid": "2e5cf7aeadef29bfb22dee4204766b1b", "score": "0.56703496", "text": "func (s CreateApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "30a6f48663aa14bc52a73a72cc8a55ca", "score": "0.5669307", "text": "func (s EndpointInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "54c92a6a2279bba9408a740ecb74adde", "score": "0.56545717", "text": "func (ps *Segment) String() string {\n\treturn fmt.Sprintf(\"{ Name: %v, IsVariable: %v, IsWildcard: %v }\",\n\t\tps.Name, ps.IsVariable, ps.IsWildcard)\n}", "title": "" }, { "docid": "b43f0fd1497d0d70395b90a0f23f73b4", "score": "0.56495863", "text": "func (s EndpointAccess) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e48cc421d8de6ecad5a5da1526316415", "score": "0.56376714", "text": "func (s ListMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "88d88e2a43e2ff091793f31f1de09861", "score": "0.5635892", "text": "func (p Providers) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "4873139562b1e1270fb504c8a70a35e5", "score": "0.5634883", "text": "func (v Vector) String() string {\n\treturn fmt.Sprintf(\"%v:%v\", v.Gate, v.Valve)\n}", "title": "" }, { "docid": "90faaf1f49275808b1cf90892b5cabaf", "score": "0.56340486", "text": "func (b *BitSet) String() string {\n\tm := b.Members()\n\ts := make([]byte, 0, 4*len(m))\n\ts = append(s, '{')\n\tfor _, i := range m {\n\t\ts = append(s, fmt.Sprintf(\" %d\", i)...)\n\t}\n\treturn string(append(s, \" }\"...))\n}", "title": "" }, { "docid": "61b9ead56774282db4e04c4b70570b94", "score": "0.56332225", "text": "func (s ParameterMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e041c6be9c819de6a5d40d1fd63acfc8", "score": "0.5629105", "text": "func (s ParametersFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c491613a0dbf57cdf045506b6be0cb1f", "score": "0.5625292", "text": "func (s RestApi) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b2b61165467edf67fea36f7348c30927", "score": "0.5616864", "text": "func (p *ubPayload) String() string {\n\treturn fmt.Sprintf(\"[%s][%s]\", formatFlags(p.flags), p.suffix)\n}", "title": "" }, { "docid": "95412ff336fbc5b06f35ed4ffea03a0d", "score": "0.5614519", "text": "func (this *Name) String() string {\n\tif this.DoubleValue != nil {\n\t\treturn this.Before.String() + strconv.FormatFloat(this.GetDoubleValue(), 'f', -1, 64)\n\t}\n\tif this.IntValue != nil {\n\t\treturn this.Before.String() + strconv.FormatInt(this.GetIntValue(), 10)\n\t}\n\tif this.UintValue != nil {\n\t\treturn this.Before.String() + \"uint(\" + strconv.FormatUint(this.GetUintValue(), 10) + \")\"\n\t}\n\tif this.BoolValue != nil {\n\t\treturn this.Before.String() + strconv.FormatBool(this.GetBoolValue())\n\t}\n\tif this.StringValue != nil {\n\t\tif isId(this.GetStringValue()) {\n\t\t\treturn this.Before.String() + this.GetStringValue()\n\t\t}\n\t\treturn this.Before.String() + strconv.Quote(this.GetStringValue())\n\t}\n\tif this.BytesValue != nil {\n\t\treturn this.Before.String() + fmt.Sprintf(\"%#v\", this.GetBytesValue())\n\t}\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "dde389e53d617fdce15d5304d1290371", "score": "0.55968344", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Treasury Params:\n\tBasePool: %s\n\tPoolRecoveryPeriod: %d\n\tMinStabilitySpread: %s\n\t`, params.BasePool, params.PoolRecoveryPeriod, params.MinStabilitySpread)\n}", "title": "" }, { "docid": "12e91abc3632a1158a717f2f0bdf592f", "score": "0.5595747", "text": "func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string {\n\tsep := \",\"\n\tswitch collectionFormat {\n\tcase \"pipes\":\n\t\tsep = \"|\"\n\tcase \"ssv\":\n\t\tsep = \" \"\n\tcase \"tsv\":\n\t\tsep = \"\\t\"\n\t}\n\n\tswitch t := reflect.TypeOf(obj).String(); t {\n\tcase \"[]string\":\n\t\treturn strings.Join(obj.([]string), sep)\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", obj)\n\t}\n}", "title": "" }, { "docid": "f03cd35a740e74ed99ab0128f55710f1", "score": "0.55945575", "text": "func (s WorkflowParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0d4dfeb8fd902b515f05c05129702a9a", "score": "0.5592116", "text": "func (s OptionGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2ae00c0bb298d2e574d4479f54796d", "score": "0.55916166", "text": "func (s VocabularyFilterInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e26540770e51fd568fbc7de170aeb593", "score": "0.5591063", "text": "func (s SomeStruct) String() string {\n\treturn fmt.Sprintf(\"p1: %T %+v; p2: %T %+v\", s.p1, s.p1, s.p2, s.p2)\n}", "title": "" }, { "docid": "d713e668abedd315c12ef86d1ee19818", "score": "0.5588718", "text": "func (s EndpointDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c77da8e77c30d6a397ef3b069cfecb8c", "score": "0.55769", "text": "func (o IgroupAddRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7657ce98c9091c9009ef40f193e1f111", "score": "0.55761063", "text": "func (opt OptNameOnly) String() string {\n\treturn \"OptNameOnly: \" + strconv.FormatBool(bool(opt))\n}", "title": "" }, { "docid": "6070a102a4c0ca13a7159bbacadc50e2", "score": "0.5572909", "text": "func (s RequiredFieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "79f79cadd28fa45a671401aa7685c540", "score": "0.55716693", "text": "func (s GetParameterOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eed957cb6858fc0c6031de634ccaf403", "score": "0.55714035", "text": "func (s VoiceSettings) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a980ea84e6b5527c94c8b0c65a993d75", "score": "0.5570969", "text": "func (i Info) String() string {\n\ts, _ := i.toJSON()\n\treturn s\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.5570386", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
0ad6fb2ad0a9f7ff98099d9b372bf2b8
UpdateDomains updates the list of domains that 1secmail supports. This is useful if the list of domains have changed since this library was last updated.
[ { "docid": "0cadf9540e88b3cbf42eb7ccb88d18fc", "score": "0.8414749", "text": "func (a API) UpdateDomains() error {\n\tdomains := make(map[string]struct{})\n\tliveDomains, err := a.Domains()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, domain := range liveDomains {\n\t\tdomains[domain] = struct{}{}\n\t}\n\tdomainsMu.Lock()\n\tdefer domainsMu.Unlock()\n\tDomains = domains\n\treturn nil\n}", "title": "" } ]
[ { "docid": "c5f297dbf9a499da89836a97b698f34b", "score": "0.63218296", "text": "func (m *TenantMutation) SetDomains(s []string) {\n\tm.domains = &s\n}", "title": "" }, { "docid": "6c7816116b7b3a349f09cd3c07a31588", "score": "0.62946075", "text": "func (o *Service) SetDomains(v []string) {\n\to.Domains = &v\n}", "title": "" }, { "docid": "beb32bc7d1c0aed7fca4a860ed188595", "score": "0.6126625", "text": "func (e *Domain) AddDomains(names ...string) {\n\te.Domains = names\n}", "title": "" }, { "docid": "11e8c3b7431b4b9e43842d0acce3df26", "score": "0.6014186", "text": "func (c *Client) UpdateDomainRecords(customerID, domain string, records []*DomainRecord) error {\n\tfor _, t := range supportedTypes {\n\t\ttypeRecords := c.domainRecordsOfType(t, records)\n\t\tif IsDisallowed(t, typeRecords) {\n\t\t\tcontinue\n\t\t}\n\n\t\tmsg, err := json.Marshal(typeRecords)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuffer := bytes.NewBuffer(msg)\n\t\tdomainURL := fmt.Sprintf(pathDomainRecordsByType, c.baseURL, domain, t)\n\t\tlog.Println(domainURL)\n\t\tlog.Println(buffer)\n\n\t\treq, err := http.NewRequest(http.MethodPut, domainURL, buffer)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.execute(customerID, req, nil); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "487c9d220467eecd552a11eb5e06d7ef", "score": "0.5999636", "text": "func (s *ListFirewallDomainsOutput) SetDomains(v []*string) *ListFirewallDomainsOutput {\n\ts.Domains = v\n\treturn s\n}", "title": "" }, { "docid": "19ccb992a5e5b888a8da400b20f90973", "score": "0.5962742", "text": "func (app *Application) ReplaceDomainsConfig(newGlobalConfig *viper.Viper) {\n\tapp.Config.Set(domainsConfigKey, newGlobalConfig.Get(domainsConfigKey))\n\tif err := app.Reset(app.Config); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "80aa4ab5a789cf070abc6a9890836a9e", "score": "0.5910808", "text": "func (s *RegistrarAPI) RenewDomains(req *RegistrarAPIRenewDomainsRequest, opts ...scw.RequestOption) (*OrderResponse, error) {\n\tvar err error\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"POST\",\n\t\tPath: \"/domain/v2beta1/renew-domains\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp OrderResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "c5d6ab7aed0a4c2b8bf83a6c86d8508a", "score": "0.5885974", "text": "func Domains(domains ...string) Opt {\n\treturn func(p *params) { p.domains = domains }\n}", "title": "" }, { "docid": "8b261c1920584bf3d344ae35c9ded9b6", "score": "0.58803725", "text": "func (c *FakeAthenzDomains) Update(athenzDomain *athenz_v1.AthenzDomain) (result *athenz_v1.AthenzDomain, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(athenzdomainsResource, c.ns, athenzDomain), &athenz_v1.AthenzDomain{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*athenz_v1.AthenzDomain), err\n}", "title": "" }, { "docid": "044d989aad51241d540e6aa62e15cece", "score": "0.5854342", "text": "func (s *UpdateFirewallDomainsInput) SetDomains(v []*string) *UpdateFirewallDomainsInput {\n\ts.Domains = v\n\treturn s\n}", "title": "" }, { "docid": "33f220856b71fb7bcbaf63fe632cb097", "score": "0.5834397", "text": "func (v *Verifier) AddDisposableDomains(domains []string) *Verifier {\n\tfor _, d := range domains {\n\t\tadditionalDisposableDomains[d] = true\n\t\tdisposableSyncDomains.Store(d, struct{}{})\n\t}\n\treturn v\n}", "title": "" }, { "docid": "7c8fa5086780361c6299c0cf2991a3ad", "score": "0.57977754", "text": "func (g *Domain) UpdateNameServers(domain string, ns []string) (err error) {\n\t_, err = g.client.Put(\"domains/\"+domain+\"/nameservers\", Nameservers{ns}, nil)\n\treturn\n}", "title": "" }, { "docid": "78c762d3a0a28bac82a148987fcceb79", "score": "0.57793856", "text": "func (o ResolverFirewallDomainListOutput) Domains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ResolverFirewallDomainList) pulumi.StringArrayOutput { return v.Domains }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "08404f3f6346ff467fbab7c923284dbf", "score": "0.5740043", "text": "func (s *API) ListDomains(req *ListDomainsRequest, opts ...scw.RequestOption) (*ListDomainsResponse, error) {\n\tvar err error\n\n\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\tparameter.AddToQuery(query, \"registrar\", req.Registrar)\n\tparameter.AddToQuery(query, \"status\", req.Status)\n\tparameter.AddToQuery(query, \"organization_id\", req.OrganizationID)\n\tparameter.AddToQuery(query, \"is_external\", req.IsExternal)\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/domain/v2alpha2/domains\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListDomainsResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "1a95d9ac3d1f9dfff921e5031b078b56", "score": "0.5736297", "text": "func (s *sitesController) UpdateStaticSites() {\n\tfor _, config := range s.configs {\n\t\tlog.Debug(\"sites.Controller.UpdateStaticSites - Creating Site:\" + config.Domain)\n\t\tsiteCreator := NewSiteCreator(config)\n\t\tsiteCreator.addSite()\n\t\tsiteCreator.addSources()\n\t\tsiteCreator.addContainers()\n\t\tsiteCreator.addLocations()\n\t\tsiteCreator.addContexts()\n\t\tsiteCreator.fillFileContainers(config)\n\t\tsiteCreator.writeFiles()\n\t}\n}", "title": "" }, { "docid": "aa7490109c7d323b3294b51b5d83644c", "score": "0.56713855", "text": "func (c *FakeSimpledbDomains) Update(simpledbDomain *v1alpha1.SimpledbDomain) (result *v1alpha1.SimpledbDomain, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(simpledbdomainsResource, c.ns, simpledbDomain), &v1alpha1.SimpledbDomain{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.SimpledbDomain), err\n}", "title": "" }, { "docid": "6f79526958b709aaf86ed07762ce73cc", "score": "0.5627056", "text": "func (s *ListDomainsOutput) SetDomains(v []*DomainDetails) *ListDomainsOutput {\n\ts.Domains = v\n\treturn s\n}", "title": "" }, { "docid": "ad8c21325f2d8ad09caaddf2e5acefd7", "score": "0.56031", "text": "func (dl *DomainLearner) learnDomains(domains []string){\n\tfor _, domain := range domains{\n\t\tips, err := dl.resolver.Resolve(domain)\n\t\tif err != nil{\n\t\t\t//report\n\t\t\tdl.logger.Error(flowName, \"cannot resolve domain %s - %s\",domain, err.Error())\n\t\t\treturn\n\t\t}\n\t\tif (len(ips) > 0){\n\t\t\tdl.updateDomainIps(domain, ips)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e413b5db3e5e2f3235ef6a5d3173765c", "score": "0.55999845", "text": "func (m MySqlStorage) UpdateDomain(d Domain) (dom Domain, err error) {\n\t_, err = m.db.Exec(\"UPDATE ZNS_domains SET d_zid=?, d_name=?, d_txt=? WHERE d_id=? LIMIT 1\", d.ZoneID, d.Name, d.Txt, d.Id)\n\tif err != nil {\n\t\treturn Domain{}, err\n\t}\n\n\treturn m.r.fetchDomainById(d.Id)\n}", "title": "" }, { "docid": "fb03c0559cbcf4a8f53a216b37840918", "score": "0.558816", "text": "func (s *RegistrarAPI) ListDomains(req *RegistrarAPIListDomainsRequest, opts ...scw.RequestOption) (*ListDomainsResponse, error) {\n\tvar err error\n\n\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\tparameter.AddToQuery(query, \"registrar\", req.Registrar)\n\tparameter.AddToQuery(query, \"status\", req.Status)\n\tparameter.AddToQuery(query, \"project_id\", req.ProjectID)\n\tparameter.AddToQuery(query, \"organization_id\", req.OrganizationID)\n\tparameter.AddToQuery(query, \"is_external\", req.IsExternal)\n\tparameter.AddToQuery(query, \"domain\", req.Domain)\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/domain/v2beta1/domains\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListDomainsResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "edba355bb5327ecfbc68fe36b0f83774", "score": "0.5581766", "text": "func (a *Client) DomainServicesUpdate(params *DomainServicesUpdateParams) (*DomainServicesUpdateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDomainServicesUpdateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"domainServicesUpdate\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/domain/_services\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DomainServicesUpdateReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DomainServicesUpdateOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for domainServicesUpdate: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "b0f708fc8606a7cdcdcafcb0c498ff65", "score": "0.5578763", "text": "func GetSupportedDomains() []string {\n\treturn watcher.SupportedDomains\n}", "title": "" }, { "docid": "c387279302e56f6d5165305d8109287c", "score": "0.55681497", "text": "func (o SslCertificateManagedSslCertificateOutput) Domains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v SslCertificateManagedSslCertificate) []string { return v.Domains }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "5b7f24984cd39994e2a9604a5e7f45c6", "score": "0.5564049", "text": "func DomainsConfig(globalConfig *viper.Viper) (config []domain.ConfigItem, err error) {\n\tglobalConfig.SetDefault(domainsConfigKey, []interface{}{})\n\t// note that `.Sub` cannot be used to get a slice\n\terr = globalConfig.UnmarshalKey(domainsConfigKey, &config)\n\treturn\n}", "title": "" }, { "docid": "0d213cb02e44df7292fc9105b968e041", "score": "0.5560407", "text": "func setupDomains() []string {\n\n\tvar myDomains []string\n\n\tnsTemplate := []byte(fileSig + \"\\nnameserver 127.0.0.1\\n\")\n\n\t// Don't care if it already exists.\n\t// If root can't make the directory, we have much bigger problems.\n\t_ = os.Mkdir(targetDir, 0755)\n\n\t// Check for domains supplied on the command-line.\n\tif *inDomains != \"\" {\n\t\tmyDomains = strings.Split(*inDomains, \",\")\n\t} else {\n\t\t// Or try to read from the config file.\n\t\tcontent, err := ioutil.ReadFile(*inConfig)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\\nUnable to read config file (%s)\\n and no domains supplied on command-line \", *inConfig)\n\t\t\tpanic(panicExit{1})\n\t\t}\n\t\tmyDomains = strings.Split(string(content), \"\\n\")\n\t}\n\n\t// Setup each domain in the resolver directory.\n\tfor i := range myDomains {\n\t\tfmt.Printf(\"Creating resolver for (%s)\\n\", myDomains[i])\n\t\terr := ioutil.WriteFile(targetDir+myDomains[i], nsTemplate, 0644)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn myDomains\n}", "title": "" }, { "docid": "b7bf9282558c871e9e52def2d4e9782f", "score": "0.5554701", "text": "func (m *CustomDomainManager) Update(id string, c *CustomDomain, opts ...RequestOption) (err error) {\n\treturn m.Request(\"PATCH\", m.URI(\"custom-domains\", id), c, opts...)\n}", "title": "" }, { "docid": "ec8a6de09210db9e3dcba474a4331ebf", "score": "0.55279976", "text": "func (this *DoClient) ListDomains() (interface{}, error) {\n\treturn this.client.ListDomains()\n\n}", "title": "" }, { "docid": "e6c8124877530a54f775de01c8f48bc9", "score": "0.5520603", "text": "func (g *LiveDNS) UpdateDomain(fqdn string, details UpdateDomainRequest) (response client.StandardResponse, err error) {\n\t_, err = g.client.Patch(\"domains/\"+fqdn, details, &response)\n\treturn\n}", "title": "" }, { "docid": "8316bbcce00fd05dd1e31ebbc025adac", "score": "0.55085444", "text": "func (test *Test) CreateOrUpdateDomains(projectName string, domain []models.Domain) error {\n\treturn errors.New(\"Not implemented yet\")\n}", "title": "" }, { "docid": "065bb87d3ecee3aa0f8f205e24397387", "score": "0.5481953", "text": "func (s *RegistrarAPI) UpdateDomain(req *RegistrarAPIUpdateDomainRequest, opts ...scw.RequestOption) (*Domain, error) {\n\tvar err error\n\n\tif fmt.Sprint(req.Domain) == \"\" {\n\t\treturn nil, errors.New(\"field Domain cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"PATCH\",\n\t\tPath: \"/domain/v2beta1/domains/\" + fmt.Sprint(req.Domain) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Domain\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "7781b868434b7921579664cc917bb7c8", "score": "0.5481214", "text": "func (o SslCertificateManagedSslCertificateResponseOutput) Domains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v SslCertificateManagedSslCertificateResponse) []string { return v.Domains }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "2ce43d3e6e94618a2d877143b21d70c7", "score": "0.5466069", "text": "func (s *API) UpdateDomain(req *UpdateDomainRequest, opts ...scw.RequestOption) (*Domain, error) {\n\tvar err error\n\n\tif fmt.Sprint(req.Domain) == \"\" {\n\t\treturn nil, errors.New(\"field Domain cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"PATCH\",\n\t\tPath: \"/domain/v2alpha2/domains/\" + fmt.Sprint(req.Domain) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Domain\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "566fa2d1bd2ee1634ad57f8ffb686b22", "score": "0.5457004", "text": "func (o *AggregatedDomain) AssignDomains(children DomainsList) *bambou.Error {\n\n\tlist := []bambou.Identifiable{}\n\tfor _, c := range children {\n\t\tlist = append(list, c)\n\t}\n\n\treturn bambou.CurrentSession().AssignChildren(o, list, DomainIdentity)\n}", "title": "" }, { "docid": "2d256085341be725f1671772301b85bd", "score": "0.54511523", "text": "func (a *API) UpdateClientDomain(d *ClientDomainUpdateReq) (r *ClientDomainUpdateResp, err error) {\n\tbody, err := a.Do(\"updateclientdomain\", &d)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"gowhmcs updateclientdomain error: %v\", err)\n\t\treturn\n\t}\n\n\tr = &ClientDomainUpdateResp{}\n\tif err = json.Unmarshal(body, r); err != nil {\n\t\terr = fmt.Errorf(\"gowhmcs updateclientdomain error: %v\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8b53017feb18b11f4ab12fe249d7993c", "score": "0.54478616", "text": "func NewDomains(config Config) (*Domains, error) {\n\tdomains := &Domains{}\n\tif err := domains.setConfigSource(config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn domains, nil\n}", "title": "" }, { "docid": "13c2dca20d57868d80b8bd7ad3c08cb9", "score": "0.5442863", "text": "func (regionEnv *RegionEnv) updateDomainName() {\n\tdomainList, ok := regionEnv.ClusterSettings[\"DOMAIN\"]\n\tif !ok {\n\t\tregionEnv.Logger.Infof(\"No local domain name found for %s.\", regionEnv.Region)\n\t\treturn\n\t}\n\n\t// Replace domain in the domain name, by substituting text up to the first period.\n\t// Cluster may have multiple domain names. Therefore multiple new domains may replace the single original domain.\n\t// Ex. foo.bar -> foo.domain1, foo.domain2\n\n\t// Change cluster domain list into strings for regex.\n\tdomains := strings.Split(domainList, \",\")\n\tfor i, domain := range domains {\n\t\tdomains[i] = fmt.Sprintf(\"$1%s\", domain)\n\t}\n\tregex := regexp.MustCompile(`(.*?)\\..*`)\n\tregionEnv.Logger.Infof(\"Domains: %s\", domains)\n\n\t// IngressRoutes have at most one virtualhost, so if multiple domains are given,\n\t// a new IngressRoute has to be created for each one. The domain replacements\n\t// are determined based on the contour annotation \"kubernetes.io/ingress.class\".\n\t// For ethos-k8s, the DOMAIN setting is that of the ethos cluster: <cluster-name>.ethos.adobe.net\n\t// Ingress classes of contour-internal and contour-corp have an additional domain component\n\t// of \"int\" or \"corp\" inserted between the service name and the cluster domain.\n\t// https://git.corp.adobe.com/adobe-platform/k8s-infrastructure/blob/master/docs/user-guide.md#ingress-dns-names\n\n\tingressRoutes := regionEnv.findUnstructured(\"contour.heptio.com/v1beta1\", \"IngressRoute\")\n\tif len(domains) == 1 && domains[0] != \"\" && len(ingressRoutes) > 0 {\n\t\tclusterDomain := domains[0]\n\t\tfor _, ingressRoute := range ingressRoutes {\n\t\t\tvar newFqdn string\n\t\t\tfqdn, _, _ := unstructured.NestedString(ingressRoute.Object, \"spec\", \"virtualhost\", \"fqdn\")\n\t\t\tingressClass, _, ingressAnnotationErr := unstructured.NestedString(\n\t\t\t\tingressRoute.Object, \"metadata\", \"annotations\", \"kubernetes.io/ingress.class\",\n\t\t\t)\n\t\t\ttlsSecret, tlsSecretFound, _ := unstructured.NestedString(\n\t\t\t\tingressRoute.Object, \"spec\", \"virtualhost\", \"tls\", \"secretName\",\n\t\t\t)\n\t\t\tif !tlsSecretFound {\n\t\t\t\tregionEnv.Logger.Warnf(\"No TLS secret listed for ingress route %s\", fqdn)\n\t\t\t}\n\t\t\tswitch ingressClass {\n\t\t\tcase \"contour-corp\":\n\t\t\t\t// prefix base cluster domain with \"corp\", per ethos cluster domain convention:\n\t\t\t\tnewCorpDomain := insertDomainPart(clusterDomain, 1, \"corp\")\n\t\t\t\tnewFqdn = regex.ReplaceAllString(fqdn, newCorpDomain)\n\t\t\t\tunstructured.SetNestedField(ingressRoute.Object, newFqdn, \"spec\", \"virtualhost\", \"fqdn\")\n\t\t\t\t// Sanity check the SecretName if TLS is in use\n\t\t\t\tif tlsSecretFound && tlsSecret != \"heptio-contour/cluster-ssl-corp\" {\n\t\t\t\t\tregionEnv.Logger.Errorf(\n\t\t\t\t\t\t\"Invalid IngressRoute class + TLS SecretName combination: contour-corp + %s\", tlsSecret,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\tcase \"contour-internal\":\n\t\t\t\t// prefix base cluster domain with \"int\"\n\t\t\t\tnewInternalDomain := insertDomainPart(clusterDomain, 1, \"int\")\n\t\t\t\tnewFqdn = regex.ReplaceAllString(fqdn, newInternalDomain)\n\t\t\t\tunstructured.SetNestedField(ingressRoute.Object, newFqdn, \"spec\", \"virtualhost\", \"fqdn\")\n\t\t\t\t// Sanity check the SecretName if TLS is in use\n\t\t\t\tif tlsSecretFound && tlsSecret != \"heptio-contour/cluster-ssl-int\" {\n\t\t\t\t\tregionEnv.Logger.Errorf(\n\t\t\t\t\t\t\"Invalid IngressRoute class + TLS SecretName combination: contour-internal + %s\", tlsSecret,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\tcase \"contour-public\":\n\t\t\t\t// replace the fqdn only if the cluster TLS cert is in use\n\t\t\t\tif tlsSecretFound && tlsSecret == \"heptio-contour/cluster-ssl-public\" {\n\t\t\t\t\tnewFqdn = regex.ReplaceAllString(fqdn, clusterDomain)\n\t\t\t\t\tunstructured.SetNestedField(ingressRoute.Object, newFqdn, \"spec\", \"virtualhost\", \"fqdn\")\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tregionEnv.Logger.Errorf(\n\t\t\t\t\t\"Invalid kubernetes.io/ingress.class: %s, %s\", ingressClass, ingressAnnotationErr,\n\t\t\t\t)\n\t\t\t}\n\t\t\tregionEnv.Logger.Infof(\"Added IngressRoute for fqdn: %s -> %s\", fqdn, newFqdn)\n\t\t}\n\t} else if len(domains) > 1 && len(ingressRoutes) > 0 {\n\t\tregionEnv.Logger.Warnf(\"Ingress Routes cannot accomadate multiple domains %s\", domains)\n\t}\n\n\tfor _, gw := range regionEnv.findUnstructured(\"networking.istio.io/v1beta1\", \"Gateway\") {\n\t\tvar newServers []interface{}\n\t\tservers, serversFound, _ := unstructured.NestedSlice(gw.Object, \"spec\", \"servers\")\n\t\tfor _, server := range servers {\n\t\t\tvar newHosts []string\n\t\t\tserverMap, ok := server.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\tregionEnv.errf(\"Malformed Istio Gateway missing server entries %+v\", gw)\n\t\t\t}\n\t\t\thosts, hostsFound, _ := unstructured.NestedStringSlice(serverMap, \"hosts\")\n\t\t\tfor _, host := range hosts {\n\t\t\t\tfor _, domain := range domains {\n\t\t\t\t\tnewHosts = append(newHosts, regex.ReplaceAllString(host, domain))\n\t\t\t\t}\n\t\t\t}\n\t\t\tif hostsFound {\n\t\t\t\tregionEnv.Logger.Infof(\"Changed Gateway domain to %s\", newHosts)\n\t\t\t\tunstructured.SetNestedStringSlice(serverMap, newHosts, \"hosts\")\n\t\t\t}\n\t\t\tnewServers = append(newServers, server)\n\t\t}\n\t\tif serversFound {\n\t\t\tunstructured.SetNestedSlice(gw.Object, newServers, \"spec\", \"servers\")\n\t\t}\n\t}\n\n\tvirtualServices := regionEnv.findUnstructured(\"networking.istio.io/v1beta1\", \"VirtualService\")\n\tif len(virtualServices) > 0 {\n\t\tregionEnv.updateGateway()\n\t}\n\tfor _, vs := range virtualServices {\n\t\tvar newHosts []string\n\t\thosts, hostsFound, _ := unstructured.NestedStringSlice(vs.Object, \"spec\", \"hosts\")\n\t\tfor _, host := range hosts {\n\t\t\tfor _, domain := range domains {\n\t\t\t\tnewHosts = append(newHosts, regex.ReplaceAllString(host, domain))\n\t\t\t}\n\t\t}\n\t\tif hostsFound {\n\t\t\tunstructured.SetNestedStringSlice(vs.Object, newHosts, \"spec\", \"hosts\")\n\t\t\tregionEnv.Logger.Infof(\"Changed Virtual Service domain to %s\", newHosts)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "974fdf15ad57fad4bccf222b7414043e", "score": "0.5434549", "text": "func (g *LiveDNS) ListDomains() (domains []Domain, err error) {\n\t_, err = g.client.Get(\"domains\", nil, &domains)\n\treturn\n}", "title": "" }, { "docid": "cf2fbabeeb00d9dbc80a73edeae440d2", "score": "0.54213977", "text": "func (g *Domain) ListDomains() (domains []ListResponse, err error) {\n\t_, err = g.client.Get(\"domains\", nil, &domains)\n\treturn\n}", "title": "" }, { "docid": "49bd212401c32e1bebe6f64110bcd08d", "score": "0.5418347", "text": "func (c *APIGateway) UpdateDomainName(input *UpdateDomainNameInput) (*DomainName, error) {\n\treq, out := c.UpdateDomainNameRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "title": "" }, { "docid": "ab6619ffb14cb37487adc77a67d45fba", "score": "0.541277", "text": "func (o GroupDnsConfigOutput) SearchDomains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GroupDnsConfig) []string { return v.SearchDomains }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "139ca34652939f2b3f086b6c8986b8d7", "score": "0.5410709", "text": "func (c *Client) SetDNSNameservers(ctx context.Context, dns []string) error {\n\tconst uriFmt = \"/api/v2/domain/%v/dns/nameservers\"\n\n\treq, err := c.buildRequest(ctx, http.MethodPost, fmt.Sprintf(uriFmt, c.domain), DomainDNSNameservers{\n\t\tDNS: dns,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.performRequest(req, nil)\n}", "title": "" }, { "docid": "7fa3860425edcafa3102a8e9950eccf1", "score": "0.5406413", "text": "func (o SslCertificateManagedSslCertificatePtrOutput) Domains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SslCertificateManagedSslCertificate) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Domains\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "76a03e00c0a675bc3d8b14a97172401e", "score": "0.54058605", "text": "func (o *LocalDatabaseProvider) SetDnsSearchDomains(v []string) {\n\to.DnsSearchDomains = v\n}", "title": "" }, { "docid": "a0d5ebf26bdd1fd7dc3779068d2e0f5d", "score": "0.5382471", "text": "func (o *PluginDnsClient) AddDomainEntries(domain string, newEntries []DnsEntry) error {\n\tif !o.IsNameServer() {\n\t\treturn fmt.Errorf(\"This operation is permitted for Dns Name Servers only!\")\n\t}\n\tentries, ok := o.db[domain]\n\tif ok {\n\t\t// This domain already exists.\n\t\t// Let's convert the entries into a set for fast lookup.\n\t\t// Since the DnsEntry is a trivial structure the autogenerated hash and equals function work.\n\t\tentriesSet := make(map[DnsEntry]bool)\n\t\tfor _, entry := range entries {\n\t\t\tentriesSet[entry] = true\n\t\t}\n\t\tfor _, entry := range newEntries {\n\t\t\tif entriesSet[entry] {\n\t\t\t\t// Entry already exists.\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tentries = append(entries, entry)\n\t\t\t\tentriesSet[entry] = true // malicious user can provide twice the same entry in newEntries\n\t\t\t}\n\t\t}\n\t\to.db[domain] = entries\n\t} else {\n\t\t// The domain doesn't exist.\n\t\to.db[domain] = newEntries\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45b49a647403b58510c4a06615a460c9", "score": "0.5373442", "text": "func (client AppsClient) ListDomains(ctx context.Context) (result ListString, err error) {\n\treq, err := client.ListDomainsPreparer(ctx)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"ListDomains\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListDomainsSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"ListDomains\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListDomainsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"ListDomains\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "495886de0949cf7d791e286eb559e48f", "score": "0.5370383", "text": "func (a *Client) DomainUpdate(params *DomainUpdateParams) (*DomainUpdateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDomainUpdateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"domainUpdate\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/domain/{name}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DomainUpdateReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DomainUpdateOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for domainUpdate: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "aa52769e97442469f25ad17db656f56e", "score": "0.53695494", "text": "func (o GroupDnsConfigPtrOutput) SearchDomains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *GroupDnsConfig) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SearchDomains\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7878ce445674dde3ba4fb89c8066f09b", "score": "0.5338019", "text": "func (s *ContainerDefinition) SetDnsSearchDomains(v []*string) *ContainerDefinition {\n\ts.DnsSearchDomains = v\n\treturn s\n}", "title": "" }, { "docid": "2099b2a9c8657ce13c986c6b02588526", "score": "0.5337682", "text": "func ReadAndParseDomains(domainsFile string) ([]Domain, error) {\n\t// Getting absolute path to be called from different packages/test files\n\t_, b, _, _ := runtime.Caller(0)\n\tbasepath := filepath.Dir(b)\n\t// Open and read domains file list.\n\tdata, err := ioutil.ReadFile(basepath + \"/../\" + domainsFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in reading %s file: %v\", domainsFile, err)\n\t}\n\t// Parse domains file list.\n\tdomains, err := parseDomainsFile(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in parsing %s file: %v\", domainsFile, err)\n\t}\n\tlog.Infof(\"Loaded and parsed %s\", domainsFile)\n\n\treturn domains, err\n}", "title": "" }, { "docid": "44cc64e0ccf7c8fc734fc25a933f0012", "score": "0.53263354", "text": "func (lc *LibvirtConnect) ListDomains() ([]*LibvirtDomain, error) {\n\treturn nil, fmt.Errorf(\"not supported\")\n}", "title": "" }, { "docid": "d3d7fe96133e638001aa4a6720e9ff45", "score": "0.5326116", "text": "func (r Dns_Domain_Registration) AddNameserversToDomain(nameservers []string) (resp bool, err error) {\n\tparams := []interface{}{\n\t\tnameservers,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Dns_Domain_Registration\", \"addNameserversToDomain\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "6cbb77c4dc3e9f127fcba1d3aaefddb5", "score": "0.53224987", "text": "func (o SslCertificateManagedSslCertificateResponsePtrOutput) Domains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SslCertificateManagedSslCertificateResponse) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Domains\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1969d20f23c93e1817260f02708280d7", "score": "0.53200895", "text": "func UpdateTLDs(url string) (err error) {\n\treturn tld.Update(url)\n}", "title": "" }, { "docid": "adfdafcfeb6cc31ad28e013790145e29", "score": "0.53061014", "text": "func (b *Builder) WithDefaultDomains(defaultDomains []*gardenerutils.Domain) *Builder {\n\tb.defaultDomainsFunc = func() ([]*gardenerutils.Domain, error) { return defaultDomains, nil }\n\treturn b\n}", "title": "" }, { "docid": "8a3efeff3ada80ae58b083683328bacd", "score": "0.5301431", "text": "func (o GoogleCloudRecaptchaenterpriseV1WebKeySettingsPtrOutput) AllowedDomains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *GoogleCloudRecaptchaenterpriseV1WebKeySettings) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AllowedDomains\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "68380c6b8443fafc9f5464889e0e1508", "score": "0.52973133", "text": "func (hg *HostGroup) GetDomains(ctx context.Context) ([]DomainParams, []byte, error) {\n\tout := new(domains)\n\traw, err := hg.client.PostOut(ctx, \"/api/v1.0/HostGroup.GetDomains\", &out)\n\treturn out.Domains, raw, err\n}", "title": "" }, { "docid": "4dc69c7192ce961e3a40a4fc628b5308", "score": "0.52970594", "text": "func (o GoogleCloudRecaptchaenterpriseV1WebKeySettingsOutput) AllowedDomains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudRecaptchaenterpriseV1WebKeySettings) []string { return v.AllowedDomains }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7d35430a41ef026e5ddd380525bea789", "score": "0.5284835", "text": "func (g *Gandi) ListDomains() (domains []Domain, err error) {\n\t_, err = g.askGandi(mGET, \"domains\", nil, &domains)\n\treturn\n}", "title": "" }, { "docid": "a4efe91c0c7ce6db7250c5baba67a2e3", "score": "0.5264014", "text": "func (m *FederatedTokenValidationPolicy) SetValidatingDomains(value ValidatingDomainsable)() {\n err := m.GetBackingStore().Set(\"validatingDomains\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "090a285ef077a872d1bcae75f1c0771e", "score": "0.52513963", "text": "func (s *Server) Domains() (Domains, error) {\n\treturn s.domainQuery(domainQueryAll)\n}", "title": "" }, { "docid": "35df114eb6868fdc42ef9314d92b65e6", "score": "0.5251366", "text": "func (client DnsClient) UpdateDomainRecords(ctx context.Context, request UpdateDomainRecordsRequest) (response UpdateDomainRecordsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.updateDomainRecords, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = UpdateDomainRecordsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = UpdateDomainRecordsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(UpdateDomainRecordsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into UpdateDomainRecordsResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "778e311df5f11ea01f0b782367cd0e35", "score": "0.5230362", "text": "func (c *_Crawler) AllowedDomains() []string {\n\treturn []string{\"*.luisaviaroma.com\"}\n}", "title": "" }, { "docid": "138e732ff9628e2eef07fe625463a25c", "score": "0.5209459", "text": "func (o *PluginDnsClient) RemoveDomainEntries(domain string, entriesToRemove []DnsEntry) error {\n\tif !o.IsNameServer() {\n\t\treturn fmt.Errorf(\"This operation is permitted for Dns Name Servers only!\")\n\t}\n\n\tentriesToRemoveSet := make(map[DnsEntry]bool)\n\tfor _, entry := range entriesToRemove {\n\t\tentriesToRemoveSet[entry] = true\n\t}\n\n\tvar validEntries []DnsEntry\n\tentries, ok := o.db[domain]\n\tif ok {\n\t\t// Domain exists\n\t\tfor _, entry := range entries {\n\t\t\tif _, ok := entriesToRemoveSet[entry]; !ok {\n\t\t\t\t// Entry is not in entries to remove.\n\t\t\t\tvalidEntries = append(validEntries, entry)\n\t\t\t}\n\t\t}\n\t\tif len(validEntries) > 0 {\n\t\t\to.db[domain] = validEntries\n\t\t} else {\n\t\t\tdelete(o.db, domain)\n\t\t}\n\t}\n\t// Domain doesn't exist or entry removed.\n\treturn nil\n}", "title": "" }, { "docid": "4ea42c73f423de93b764f67a0d4055bd", "score": "0.5207638", "text": "func (o GoogleCloudRecaptchaenterpriseV1WebKeySettingsResponsePtrOutput) AllowedDomains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *GoogleCloudRecaptchaenterpriseV1WebKeySettingsResponse) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AllowedDomains\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "6f3107740ee2eb5dc1f8b2d9ec351047", "score": "0.5200001", "text": "func (w *ServerInterfaceWrapper) UpdateDomain(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"zone\" -------------\n\tvar zone Zone\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"zone\", ctx.Param(\"zone\"), &zone)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter zone: %s\", err))\n\t}\n\n\t// ------------- Path parameter \"domain\" -------------\n\tvar domain Domain\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"domain\", ctx.Param(\"domain\"), &domain)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter domain: %s\", err))\n\t}\n\n\t// ------------- Path parameter \"recordType\" -------------\n\tvar recordType RecordType\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"recordType\", ctx.Param(\"recordType\"), &recordType)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter recordType: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.UpdateDomain(ctx, zone, domain, recordType)\n\treturn err\n}", "title": "" }, { "docid": "0b1d562958db244a1b250dfb048f1f37", "score": "0.51848614", "text": "func (l *Libvirt) Domains() ([]Domain, error) {\n\t// these are the flags as passed by `virsh`, defined in:\n\t// src/remote/remote_protocol.x # remote_connect_list_all_domains_args\n\tdomains, _, err := l.ConnectListAllDomains(1, 3)\n\treturn domains, err\n}", "title": "" }, { "docid": "93e7204330cd24c881df6103961e16d4", "score": "0.51759666", "text": "func (o GoogleCloudRecaptchaenterpriseV1WebKeySettingsResponseOutput) AllowedDomains() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudRecaptchaenterpriseV1WebKeySettingsResponse) []string { return v.AllowedDomains }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1f4703244057a755d3119b79f58a6d65", "score": "0.5159492", "text": "func Update(c *golangsdk.ServiceClient, domainID string, opts UpdateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToDomainUpdateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\treqOpt := &golangsdk.RequestOpts{OkCodes: []int{200}}\n\t_, r.Err = c.Put(resourceURL(c, domainID), b, nil, reqOpt)\n\treturn\n}", "title": "" }, { "docid": "e4c8af56204663941128d6a6c7875be0", "score": "0.51445717", "text": "func cleanupDomains() {\n\t// Look for our files in the resolver directory\n\tfmt.Println(\"Cleaning up\")\n\tfiles, err := ioutil.ReadDir(targetDir)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, f := range files {\n\t\tif f.IsDir() == false {\n\t\t\tcontent, err := ioutil.ReadFile(targetDir + f.Name())\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\t// Check if it's one of ours\n\t\t\tif strings.HasPrefix(string(content), fileSig) {\n\t\t\t\tfmt.Printf(\"Removing file: (%s)\\n\", targetDir+f.Name())\n\t\t\t\terr := os.Remove(targetDir + f.Name())\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Skipping file: (%s)\", f.Name())\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "383e6b70b70e783ed538079eed709f64", "score": "0.51392424", "text": "func (o *NetworkDns) SetAdditionalDomains(v []string) {\n\to.AdditionalDomains = v\n}", "title": "" }, { "docid": "1d9964a4c828250f3a296dcdfa21404f", "score": "0.51366156", "text": "func (client IdentityClient) ListDomains(ctx context.Context, request ListDomainsRequest) (response ListDomainsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listDomains, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListDomainsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListDomainsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListDomainsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListDomainsResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "ddfb5543ce89e2b62439c55febf745c3", "score": "0.51343966", "text": "func (o GetDomainsResultOutput) Domains() GetDomainsDomainArrayOutput {\n\treturn o.ApplyT(func(v GetDomainsResult) []GetDomainsDomain { return v.Domains }).(GetDomainsDomainArrayOutput)\n}", "title": "" }, { "docid": "54f5af6ca56fb401ea1a6b82b2ef3d08", "score": "0.5128956", "text": "func DomainCheck(domains []string, domain string) error {\n\tvar bMatch bool = false\n\n\t// Iterate over domains set in config\n\tfor _, el := range domains {\n\t\tif strings.HasSuffix(domain, el) {\n\t\t\tbMatch = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !bMatch {\n\t\treturn fmt.Errorf(\"Not accepting email for domain: %s\", domain)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92d2acc694d6a349cfe81b99b725bc86", "score": "0.51130533", "text": "func (c *DomainController) WithDomains(store *crud.Store) *DomainController {\n\tc.store = store\n\treturn c\n}", "title": "" }, { "docid": "a87ca2fc9dbb41dfd22f153f7e432052", "score": "0.51024294", "text": "func UpdateDeployments(trList map[string]*model.Translation, c *kubernetes.Clientset) error {\n\tfor _, tr := range trList {\n\t\tif tr.Deployment == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err := update(tr.Deployment, c); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c87f5b10edbac2c3fea89bccba52b1d9", "score": "0.5098222", "text": "func (c *_Crawler) AllowedDomains() []string {\n\treturn []string{\"*.bareminerals.com\"}\n}", "title": "" }, { "docid": "35185751cd47a05bdac415b39b1fdcdc", "score": "0.50954413", "text": "func (input *BeegoInput) SubDomains() string {\n\tparts := strings.Split(input.Host(), \".\")\n\tif len(parts) >= 3 {\n\t\treturn strings.Join(parts[:len(parts)-2], \".\")\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "6b35a3f82bf1b021a43ee2282fd489ce", "score": "0.5093933", "text": "func (input *Input) SubDomains() string {\n\tparts := strings.Split(input.Host(), \".\")\n\tif len(parts) >= 3 {\n\t\treturn strings.Join(parts[:len(parts)-2], \".\")\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "78d5cdede7a63a2d6e0404396d7f88e0", "score": "0.50920963", "text": "func (m *GraphBaseServiceClient) Domains()(*i957076b10ba162b23efec7b94dd26b84c6475d285449c1cbc9c5b85910d36a12.DomainsRequestBuilder) {\n return i957076b10ba162b23efec7b94dd26b84c6475d285449c1cbc9c5b85910d36a12.NewDomainsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "78d5cdede7a63a2d6e0404396d7f88e0", "score": "0.50920963", "text": "func (m *GraphBaseServiceClient) Domains()(*i957076b10ba162b23efec7b94dd26b84c6475d285449c1cbc9c5b85910d36a12.DomainsRequestBuilder) {\n return i957076b10ba162b23efec7b94dd26b84c6475d285449c1cbc9c5b85910d36a12.NewDomainsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "f44f6d1302ca333bb98c438603f6dced", "score": "0.50906193", "text": "func (client AppsClient) ListDomainsSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "0613e4beeaa6aa50c17b576ee1d8c258", "score": "0.50779057", "text": "func (apikey *APIKey) GetDomains() Domains {\n\n\tdata := new(Domains)\n\n\t// Call API\n\tvar client = &http.Client{Timeout: 10 * time.Second}\n\tendpoint := baseurl + \"/domain_whitelist?apikey=\" + apikey.Key\n\tresp, err := client.Get(endpoint)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tdefer resp.Body.Close() // close response\n\n\t// Unmarshall\n\terr = json.NewDecoder(resp.Body).Decode(&data)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\treturn (*data)\n}", "title": "" }, { "docid": "86e3169e6418c831aa56f6171d7a2142", "score": "0.5067172", "text": "func (client GoDaddyClient) UpdateIPAddresses(ipv4, ipv6 net.IP) error {\n\tdynDnsIpUpdateUrl := fmt.Sprintf(\n\t\t\"https://api.godaddy.com/v1/domains/%s/records/A/%s\",\n\t\tclient.ServiceConfig.TargetDomain,\n\t\tclient.ServiceConfig.RecordName)\n\n\tjsonBody := fmt.Sprintf(`[{\n\t\t\"data\": \"%s\",\n\t\t\"port\": %d,\n\t\t\"priority\": 0,\n\t\t\"protocol\": \"string\",\n\t\t\"service\": \"string\",\n\t\t\"ttl\": %d,\n\t\t\"weight\": 0\n\t }]`, ipv4, client.ServiceConfig.Port, client.ServiceConfig.TTL)\n\n\theaders := make(map[string]string)\n\theaders[\"accept\"] = \"application/json\"\n\theaders[\"Content-Type\"] = \"application/json\"\n\theaders[\"Authorization\"] = fmt.Sprintf(\"sso-key %s:%s\", client.ServiceConfig.APIKey, client.ServiceConfig.APISecret)\n\n\tstatusCode, responseBytes, err := PerformHttpRequest(\n\t\thttp.MethodPut,\n\t\tdynDnsIpUpdateUrl,\n\t\t\"\",\n\t\t\"\",\n\t\tbytes.NewBuffer([]byte(jsonBody)),\n\t\theaders)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif statusCode != http.StatusOK {\n\t\tresponseStr := string(responseBytes)\n\t\treturn fmt.Errorf(\"the GoDaddy IP address update to %s for domain %s failed: '%s'\",\n\t\t\tipv4, client.ServiceConfig.TargetDomain, responseStr)\n\t}\n\n\tClient(client).LogIPAddressUpdate()\n\n\treturn nil\n}", "title": "" }, { "docid": "28ef8cdbc4b07629c34efc8fda745f36", "score": "0.5045068", "text": "func (r Dns_Domain_Registration) RemoveNameserversFromDomain(nameservers []string) (resp bool, err error) {\n\tparams := []interface{}{\n\t\tnameservers,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Dns_Domain_Registration\", \"removeNameserversFromDomain\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "54930990a25c4ff88db28be588038a7e", "score": "0.5038308", "text": "func (o *VirtualizationVmwareVirtualMachineAllOf) SetDnsSuffixList(v []string) {\n\to.DnsSuffixList = v\n}", "title": "" }, { "docid": "c528a883a383bbc3462e1c682f01a9d4", "score": "0.5028833", "text": "func NewListDomainsRequest(server string, params *ListDomainsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/domain/v2alpha2/domains\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif params.Page != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", *params.Page); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.PageSize != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page_size\", *params.PageSize); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.OrderBy != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by\", *params.OrderBy); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Registrar != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"registrar\", *params.Registrar); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Status != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"status\", *params.Status); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.OrganizationId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"organization_id\", *params.OrganizationId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.IsExternal != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"is_external\", *params.IsExternal); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "9d447e08449bbd9c44546902794737bb", "score": "0.50190294", "text": "func Sort(domains []string) {\n\tsort.Sort(sortDomains(domains))\n}", "title": "" }, { "docid": "4fa2ffd9ef498d62119a51f05e260f65", "score": "0.49994504", "text": "func UpdateProxies(newProxies map[string]C.Proxy, newProviders map[string]provider.ProxyProvider) {\n\tconfigMux.Lock()\n\tproxies = newProxies\n\tproviders = newProviders\n\tconfigMux.Unlock()\n}", "title": "" }, { "docid": "1de3fab711c0a6aa29f2e1ae96730ddc", "score": "0.49957907", "text": "func (c *_Crawler) AllowedDomains() []string {\n\treturn []string{\"*.drbrandtskincare.com\"}\n}", "title": "" }, { "docid": "66e069d116b65f5332ad9cc46ce0ab42", "score": "0.49933437", "text": "func (o GoogleCloudRecaptchaenterpriseV1WebKeySettingsOutput) AllowAllDomains() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRecaptchaenterpriseV1WebKeySettings) *bool { return v.AllowAllDomains }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "eb6d01464852ccfca396eb11d92b4f05", "score": "0.4981628", "text": "func RunDomainList(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\n\tf := func(opt *godo.ListOptions) ([]interface{}, *godo.Response, error) {\n\t\tlist, resp, err := client.Domains.List(opt)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tsi := make([]interface{}, len(list))\n\t\tfor i := range list {\n\t\t\tsi[i] = list[i]\n\t\t}\n\n\t\treturn si, resp, err\n\t}\n\n\tsi, err := doit.PaginateResp(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlist := make([]godo.Domain, len(si))\n\tfor i := range si {\n\t\tlist[i] = si[i].(godo.Domain)\n\t}\n\n\treturn displayOutput(&domain{domains: list}, out)\n}", "title": "" }, { "docid": "cc9f2adfc735b68423cb4f8fb2d9a2e9", "score": "0.49810544", "text": "func (m *TenantMutation) Domains() (r []string, exists bool) {\n\tv := m.domains\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "37f132b5809ed5aaab3bd81a203f22ae", "score": "0.49809787", "text": "func (o *PluginDnsClient) GetDomains() ([]string, error) {\n\tif !o.IsNameServer() {\n\t\treturn nil, fmt.Errorf(\"This operation is permitted for Dns Name Servers only!\")\n\t}\n\tdomains := make([]string, 0, len(o.db))\n\tfor domain := range o.db {\n\t\tdomains = append(domains, domain)\n\t}\n\treturn domains, nil\n}", "title": "" }, { "docid": "f4c67a9a15d028b26dda302bb2e4dca3", "score": "0.49794394", "text": "func (m *TenantMutation) ResetDomains() {\n\tm.domains = nil\n}", "title": "" }, { "docid": "875a6864c6f48d5beb9a6ea571ee4b43", "score": "0.4976507", "text": "func (sp *SkynetPortals) UpdatePortals(additions []modules.SkynetPortal, removals []modules.NetAddress) error {\n\tsp.mu.Lock()\n\tdefer sp.mu.Unlock()\n\n\t// Convert portal addresses to lowercase for case-insensitivity.\n\taddPortals := make([]modules.SkynetPortal, len(additions))\n\tfor i, portalInfo := range additions {\n\t\taddress := modules.NetAddress(strings.ToLower(string(portalInfo.Address)))\n\t\tportalInfo.Address = address\n\t\taddPortals[i] = portalInfo\n\t}\n\tremovePortals := make([]modules.NetAddress, len(removals))\n\tfor i, address := range removals {\n\t\taddress = modules.NetAddress(strings.ToLower(string(address)))\n\t\tremovePortals[i] = address\n\t}\n\n\t// Validate now before we start making changes.\n\terr := sp.validatePortalChanges(additions, removals)\n\tif err != nil {\n\t\treturn errors.AddContext(err, ErrSkynetPortalsValidation.Error())\n\t}\n\n\tbuf, err := sp.marshalObjects(additions, removals)\n\tif err != nil {\n\t\treturn errors.AddContext(err, fmt.Sprintf(\"unable to update skynet portal list persistence at '%v'\", sp.staticAop.FilePath()))\n\t}\n\t_, err = sp.staticAop.Write(buf.Bytes())\n\treturn errors.AddContext(err, fmt.Sprintf(\"unable to update skynet portal list persistence at '%v'\", sp.staticAop.FilePath()))\n}", "title": "" }, { "docid": "dcdc7a4d0418b240873d8fee23159001", "score": "0.49723363", "text": "func TestListDomains(t *testing.T) {\n\tdomains, _, err := testCli.ListDomains(\"\")\n\n\tt.Logf(\"domains: %v\", domains)\n\tcheckClientErr(t, \"ListDomains\", err)\n}", "title": "" }, { "docid": "71a31d51b57f7856651f0d2ddfb7265b", "score": "0.4970544", "text": "func (d *DomainMigrator) Migrate() { //add parallel migrations to all Migrate!\n\tfor _, dd := range d.DeprecatedDomains {\n\t\tif d.isDeprecated(dd.Name) {\n\t\t\tLog.Printf(\"action=migrate at=deprecate-domain domain=%s status=previously-deprecated\", LS(dd.Name))\n\t\t} else {\n\t\t\td.deprecate(dd)\n\t\t\tLog.Printf(\"action=migrate at=deprecate-domain domain=%s status=deprecated\", LS(dd.Name))\n\t\t}\n\t}\n\tfor _, r := range d.RegisteredDomains {\n\t\tif d.isRegisteredNotDeprecated(r) {\n\t\t\tLog.Printf(\"action=migrate at=register-domain domain=%s status=previously-registered\", LS(r.Name))\n\t\t} else {\n\t\t\td.register(r)\n\t\t\tLog.Printf(\"action=migrate at=register-domain domain=%s status=registered\", LS(r.Name))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8ca9aa93a4ff102eb2cd6a1eb1e8cc4", "score": "0.49449393", "text": "func (c *FakeSimpledbDomains) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(simpledbdomainsResource, c.ns, opts))\n\n}", "title": "" }, { "docid": "df41373ccf1bf25c675a7d14efc7695c", "score": "0.49283853", "text": "func (o ElastigroupIntegrationRoute53Output) Domains() ElastigroupIntegrationRoute53DomainArrayOutput {\n\treturn o.ApplyT(func(v ElastigroupIntegrationRoute53) []ElastigroupIntegrationRoute53Domain { return v.Domains }).(ElastigroupIntegrationRoute53DomainArrayOutput)\n}", "title": "" }, { "docid": "7c288205edb9868e24793484a76b6fb8", "score": "0.49276364", "text": "func (o GoogleCloudRecaptchaenterpriseV1WebKeySettingsPtrOutput) AllowAllDomains() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudRecaptchaenterpriseV1WebKeySettings) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AllowAllDomains\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" } ]
0ff4471e35d7c5ab062ada9a70aa61d0
updateStoredConfig updates the config stored in datastore. fetchedConfigs contains the new configs to store, forceUpdate forces overwrite of existing configuration (ignoring whether the config revision is newer).
[ { "docid": "4763d8cc782373cc9587218626979d72", "score": "0.7808819", "text": "func updateStoredConfig(ctx context.Context, fetchedConfigs map[string]*fetchedProjectConfig, forceUpdate bool) error {\n\t// Drop out of any existing datastore transactions.\n\tctx = cleanContext(ctx)\n\n\tcurrentConfigs, err := fetchProjectConfigEntities(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar errs []error\n\tvar toPut []*cachedProjectConfig\n\tfor project, fetch := range fetchedConfigs {\n\t\tif fetch.Config == nil {\n\t\t\t// Config did not pass validation.\n\t\t\tcontinue\n\t\t}\n\t\tblob, err := proto.Marshal(fetch.Config)\n\t\tif err != nil {\n\t\t\t// Continue through errors to ensure bad config for one project\n\t\t\t// does not affect others.\n\t\t\terrs = append(errs, errors.Annotate(err, \"\").Err())\n\t\t\tcontinue\n\t\t}\n\t\tcur, ok := currentConfigs[project]\n\t\tif !ok {\n\t\t\tcur = &cachedProjectConfig{\n\t\t\t\tID: project,\n\t\t\t}\n\t\t}\n\t\tif !forceUpdate && cur.Meta.Revision == fetch.Meta.Revision {\n\t\t\tlogging.Infof(ctx, \"Cached config %s is up-to-date at rev %q\", cur.ID, cur.Meta.Revision)\n\t\t\tcontinue\n\t\t}\n\t\tlogging.Infof(ctx, \"Updating cached config %s: %q -> %q\", cur.ID, cur.Meta.Revision, fetch.Meta.Revision)\n\t\ttoPut = append(toPut, &cachedProjectConfig{\n\t\t\tID: cur.ID,\n\t\t\tConfig: blob,\n\t\t\tMeta: fetch.Meta,\n\t\t})\n\t}\n\tif err := datastore.Put(ctx, toPut); err != nil {\n\t\terrs = append(errs, errors.Annotate(err, \"updating project configs\").Err())\n\t}\n\n\tvar toDelete []*datastore.Key\n\tfor project, cur := range currentConfigs {\n\t\tif _, ok := fetchedConfigs[project]; ok {\n\t\t\tcontinue\n\t\t}\n\t\ttoDelete = append(toDelete, datastore.KeyForObj(ctx, cur))\n\t}\n\n\tif err := datastore.Delete(ctx, toDelete); err != nil {\n\t\terrs = append(errs, errors.Annotate(err, \"deleting stale project configs\").Err())\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn errors.NewMultiError(errs...)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "83936c5d0edaf57dbeb3ce1726adb748", "score": "0.5529503", "text": "func updateConfig() {\n\t// going to v1 apply these changes\n\tif instance.CfgVersion < 1 {\n\t\t// new known mod extension\n\t\tif !strings.Contains(instance.ModExtensions, \".pke\") {\n\t\t\tinstance.ModExtensions = instance.ModExtensions + \".pke\"\n\t\t}\n\t\t// additional known iwads\n\t\tinstance.IWADs = append(instance.IWADs, \"boa.ipk3\", \"plutonia.wad\", \"tnt.wad\", \"heretic.wad\")\n\t}\n\n\t// v2\n\tif instance.CfgVersion < 2 {\n\t\tif !strings.Contains(instance.ModExtensions, \".zip\") {\n\t\t\tinstance.ModExtensions = instance.ModExtensions + \".zip\"\n\t\t}\n\t}\n\n\tinstance.CfgVersion = CFG_VERSION\n\tgo Persist()\n}", "title": "" }, { "docid": "19b451e518b6b355b78d60835cf41036", "score": "0.5512884", "text": "func (h ApiService) UpdateConfigStoreInfo(ctx context.Context, r *pb.UpdateConfigStoreInfoRequest) (*pb.UpdateConfigStoreInfoResponse, error) {\n\tres := service.UpdateConfigStoreInfo(r)\n\treturn &res, nil\n}", "title": "" }, { "docid": "7215e25af07ede1f36a18893c0caa2f2", "score": "0.54632515", "text": "func (c *configData) update() error {\n\tif err := c.Global.WriteConfig(); err != nil {\n\t\treturn err\n\t}\n\t// return c.Local.WriteConfig() // TODO: Get local working.\n\treturn nil\n}", "title": "" }, { "docid": "f9885c4b1bc03b56bb8e81aa5a4078b9", "score": "0.5421847", "text": "func (c *CheckpointAdvancer) UpdateConfig(newConf config.Config) {\n\tneedRefreshCache := newConf.AdvancingByCache != c.cfg.AdvancingByCache\n\tc.cfg = newConf\n\tif needRefreshCache {\n\t\tif c.cfg.AdvancingByCache {\n\t\t\tc.enableCache()\n\t\t} else {\n\t\t\tc.disableCache()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "625b168245dba43f8e1810fea49aa4f7", "score": "0.5399274", "text": "func AdminUpdateDynamicConfig(c *cli.Context) {\n\tadminClient := cFactory.ServerAdminClient(c)\n\n\tdcName := getRequiredOption(c, FlagDynamicConfigName)\n\tdcValues := c.StringSlice(FlagDynamicConfigValue)\n\n\tctx, cancel := newContext(c)\n\tdefer cancel()\n\n\tvar parsedValues []*types.DynamicConfigValue\n\n\tif dcValues != nil {\n\t\tparsedValues = make([]*types.DynamicConfigValue, 0, len(dcValues))\n\n\t\tfor _, valueString := range dcValues {\n\t\t\tvar parsedInputValue *cliValue\n\t\t\terr := json.Unmarshal([]byte(valueString), &parsedInputValue)\n\t\t\tif err != nil {\n\t\t\t\tErrorAndExit(\"Unable to unmarshal value to inputValue\", err)\n\t\t\t}\n\t\t\tparsedValue, err := convertFromInputValue(parsedInputValue)\n\t\t\tif err != nil {\n\t\t\t\tErrorAndExit(\"Unable to convert from inputValue to DynamicConfigValue\", err)\n\t\t\t}\n\t\t\tparsedValues = append(parsedValues, parsedValue)\n\t\t}\n\t} else {\n\t\tparsedValues = nil\n\t}\n\n\treq := &types.UpdateDynamicConfigRequest{\n\t\tConfigName: dcName,\n\t\tConfigValues: parsedValues,\n\t}\n\n\terr := adminClient.UpdateDynamicConfig(ctx, req)\n\tif err != nil {\n\t\tErrorAndExit(\"Failed to update dynamic config value\", err)\n\t}\n\tfmt.Printf(\"Dynamic Config %s updated\\n\", dcName)\n}", "title": "" }, { "docid": "963c10addd66fa6655f207b03d0360f7", "score": "0.537578", "text": "func (mr *MockConfigStoreManagerMockRecorder) UpdateDynamicConfig(ctx, request interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateDynamicConfig\", reflect.TypeOf((*MockConfigStoreManager)(nil).UpdateDynamicConfig), ctx, request)\n}", "title": "" }, { "docid": "3e0b0500355e1d972abd18ab8c7271cc", "score": "0.53350985", "text": "func (c *ConfigManager) UpdateConfig(kind *configpb.ConfigKind, version *configpb.Version, entries []*configpb.ConfigEntry) (*configpb.Version, *configpb.Status) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tglobal := kind.GetGlobal()\n\tif global != nil {\n\t\treturn c.updateGlobalLocked(global.GetComponent(), version, entries)\n\t}\n\n\tlocal := kind.GetLocal()\n\tif local != nil {\n\t\treturn c.updateLocal(local.GetComponentId(), version, entries)\n\t}\n\treturn &configpb.Version{Global: 0, Local: 0}, &configpb.Status{Code: configpb.StatusCode_UNKNOWN, Message: errUnknownKind(kind)}\n}", "title": "" }, { "docid": "a419154129b66440d8f3276988cf2c37", "score": "0.5330602", "text": "func (t *task) updateConfig(ctx context.Context, configVersion uint64) error {\n\tif t.config != nil && t.config.configVersion == configVersion {\n\t\t// no change, do nothing\n\t\treturn nil\n\t}\n\n\ttaskConfig, _, err := t.jobFactory.taskConfigV2Ops.GetTaskConfig(\n\t\tctx, t.jobID, t.id, configVersion)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt.config = &taskConfigCache{\n\t\tconfigVersion: configVersion,\n\t\tlabels: taskConfig.GetLabels(),\n\t\trevocable: taskConfig.GetRevocable(),\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ab382764da714ca187c267c12ccf7c7", "score": "0.52783257", "text": "func (s *Syncthing) UpdateConfig() error {\n\tbs, err := s.GetLocalConfigXML()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := ioutil.WriteFile(filepath.Join(s.LocalHome, configFile), bs, 0700); err != nil {\n\t\treturn fmt.Errorf(\"failed to write syncthing configuration file: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "07dce2c0feab2ad17db10c648e1e6a07", "score": "0.52594656", "text": "func (s *ServiceComb) UpdateConfig(configPath string) error {\n\tconf, err := loadConfig(configPath)\n\tif err != nil {\n\t\topenlogging.Error(fmt.Sprintf(\"load sidecar config failed: filename = %s, error = %s\", configPath, err.Error()))\n\t\treturn err\n\t}\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.conf = s.mergeConfig(conf, s.conf)\n\treturn nil\n}", "title": "" }, { "docid": "833d3dcd3c6acfba0214200ef3f7f95c", "score": "0.5194143", "text": "func UpdateConfig(w http.ResponseWriter, r *http.Request) {\n\tapiContext := api.GetApiContext(r)\n\tbytes, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig failed with error: %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content\")\n\t\treturn\n\t}\n\tvar authConfig model.AuthConfig\n\n\terr = json.Unmarshal(bytes, &authConfig)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig unmarshal failed with error: %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content\")\n\t\treturn\n\t}\n\n\tif authConfig.Provider == \"\" {\n\t\tlog.Errorf(\"UpdateConfig: Provider is a required field\")\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content, Provider is a required field\")\n\t\treturn\n\t}\n\n\terr = server.UpdateConfig(authConfig)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig failed with error: %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content\")\n\t\treturn\n\t}\n\tlog.Debugf(\"Updated config, listing the config back\")\n\n\t//list the config and return in response\n\tconfig, err := server.GetConfig(\"\", true)\n\tif err == nil {\n\t\tapiContext.Write(&config)\n\t} else {\n\t\t//failed to get the config\n\t\tlog.Debugf(\"GetConfig failed with error %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusInternalServerError, \"Failed to list the config\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "fc44d4af3b729b58a1ee2b8c49d78433", "score": "0.5169524", "text": "func UpdateConfig(s *Site) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif s.Config.CanEdit == false {\n\t\t\tlog.Println(\"not allowed to edit this site\")\n\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tb, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error reading body\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tcfg, err := unmarshalConfig(b)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error unmarshaling\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\terr = ioutil.WriteFile(cfg.ConfigFilePath, b, 0644)\n\t\tif err != nil {\n\t\t\tlog.Println(\"could not write config file\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\ts.Config.Merge(cfg)\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tfmt.Fprint(w, string(b))\n\t}\n}", "title": "" }, { "docid": "8a349176504f8d2a98c6f98d3ab00002", "score": "0.5152128", "text": "func (s *Syncthing) UpdateConfig() error {\n\tbuf := new(bytes.Buffer)\n\tif err := configTemplate.Execute(buf, s); err != nil {\n\t\treturn fmt.Errorf(\"failed to write syncthing configuration template: %w\", err)\n\t}\n\n\tif err := os.WriteFile(filepath.Join(s.Home, configFile), buf.Bytes(), 0600); err != nil {\n\t\treturn fmt.Errorf(\"failed to write syncthing configuration file: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f6988a72652484faab8e4fd02b68be5", "score": "0.51318", "text": "func (ps *PlatformService) SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) (*model.Config, *model.Config, *model.AppError) {\n\toldCfg, newCfg, err := ps.configStore.Set(newCfg)\n\tif errors.Is(err, config.ErrReadOnlyConfiguration) {\n\t\treturn nil, nil, model.NewAppError(\"saveConfig\", \"ent.cluster.save_config.error\", nil, \"\", http.StatusForbidden).Wrap(err)\n\t} else if err != nil {\n\t\treturn nil, nil, model.NewAppError(\"saveConfig\", \"app.save_config.app_error\", nil, \"\", http.StatusInternalServerError).Wrap(err)\n\t}\n\n\tif ps.startMetrics && *ps.Config().MetricsSettings.Enable {\n\t\tps.RestartMetrics()\n\t} else {\n\t\tps.ShutdownMetrics()\n\t}\n\n\tif ps.clusterIFace != nil {\n\t\terr := ps.clusterIFace.ConfigChanged(ps.configStore.RemoveEnvironmentOverrides(oldCfg),\n\t\t\tps.configStore.RemoveEnvironmentOverrides(newCfg), sendConfigChangeClusterMessage)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\treturn oldCfg, newCfg, nil\n}", "title": "" }, { "docid": "a4e6274e9f6fa89836cfa29c1a7bd539", "score": "0.510632", "text": "func (kv *ShardKV) TryUpdateConfig () {\n\n kv.configMtx.Lock()\n curConfig := kv.config\n kv.configMtx.Unlock()\n\n newConfig := kv.mck.Query(curConfig.Num+1)\n if newConfig.Num == curConfig.Num+1 {\n if _, isLeader := kv.rf.GetState(); isLeader {\n recvFinished := false\n kv.configMtx.Lock()\n recvFinished = kv.shardToRecv.Empty() == true\n kv.configMtx.Unlock()\n\n if recvFinished {\n request := CfgChangeArgs{newConfig}\n kv.rf.Start(Op{Type: ReqCfgChange, ArgsCfgChange: request})\n }\n }\n }\n}", "title": "" }, { "docid": "fa543a777c26ffb03e6d17a5dbf216c9", "score": "0.5096845", "text": "func (c *Config) UpdateConfig(updated ChainConfig) (err error) {\n\tif _, loaded := c.ChainConfigs[c.currentType][c.currentNode]; loaded {\n\t\tc.ChainConfigs[c.currentType][c.currentNode] = updated\n\t}\n\treturn UpdateConfig(c.path, c)\n}", "title": "" }, { "docid": "6fcba52b02a50f3095cec75a855011a4", "score": "0.5082487", "text": "func (c *Config) UpdateConfig() (err error) {\n\tconfigJson, _ := json.MarshalIndent(c, \"\", \" \")\n\terr = ioutil.WriteFile(path, configJson, 0644)\n\treturn\n}", "title": "" }, { "docid": "87846343195422fd24a5928889039d30", "score": "0.5054872", "text": "func (s *Synchronizer) NotifyConfigUpdate(immediate bool) {\n\ts.l.Lock()\n\tdefer s.l.Unlock()\n\n\ts.forceSync[syncMethodInfo] = true\n\ts.forceSync[syncMethodAgent] = true\n\ts.forceSync[syncMethodFact] = true\n\ts.forceSync[syncMethodAccountConfig] = true\n\n\tif !immediate {\n\t\treturn\n\t}\n\n\ts.forceSync[syncMethodMetric] = true\n\ts.forceSync[syncMethodContainer] = true\n\ts.forceSync[syncMethodMonitor] = true\n}", "title": "" }, { "docid": "3abc28429b291f0793c188947260315a", "score": "0.5044736", "text": "func (c *FakeKconfigs) Update(kconfig *v1alpha1.Kconfig) (result *v1alpha1.Kconfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(kconfigsResource, c.ns, kconfig), &v1alpha1.Kconfig{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.Kconfig), err\n}", "title": "" }, { "docid": "05b74e5a7d518dc118146a90cb5ef26a", "score": "0.5036605", "text": "func (a *APIServerconfigMapStore) Update(obj interface{}) error {\n\tcfg := obj.(*api_v1.ConfigMap)\n\t_, err := a.client.CoreV1().ConfigMaps(cfg.Namespace).Update(context.TODO(), cfg, metav1.UpdateOptions{})\n\treturn err\n}", "title": "" }, { "docid": "d37a95d098e332425301e099c6f6e3be", "score": "0.5012283", "text": "func (self *NNTPDaemon) storeFeedsConfig() (err error) {\n\tfeeds := self.activeFeeds()\n\tvar feedconfigs []FeedConfig\n\tfor _, status := range feeds {\n\t\tfeedconfigs = append(feedconfigs, *status.State.Config)\n\t}\n\terr = SaveFeeds(feedconfigs, self.conf.inboundPolicy)\n\treturn\n}", "title": "" }, { "docid": "4c1b487c8c742f90e2332168ab55c9b7", "score": "0.49842185", "text": "func UpdateConfig(path string, c interface{}) (err error) {\n\tconfigsJson, _ := json.MarshalIndent(c, \"\", \" \")\n\terr = ioutil.WriteFile(path, configsJson, 0644)\n\treturn\n}", "title": "" }, { "docid": "283c062d66b495e820e5b071cf23b603", "score": "0.49774292", "text": "func (st *DBstore) UpdateAlertmanagerConfiguration(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error {\n\treturn st.SQLStore.WithTransactionalDbSession(ctx, func(sess *db.Session) error {\n\t\tconfig := models.AlertConfiguration{\n\t\t\tAlertmanagerConfiguration: cmd.AlertmanagerConfiguration,\n\t\t\tConfigurationHash: fmt.Sprintf(\"%x\", md5.Sum([]byte(cmd.AlertmanagerConfiguration))),\n\t\t\tConfigurationVersion: cmd.ConfigurationVersion,\n\t\t\tDefault: cmd.Default,\n\t\t\tOrgID: cmd.OrgID,\n\t\t\tCreatedAt: time.Now().Unix(),\n\t\t}\n\t\trows, err := sess.Table(\"alert_configuration\").\n\t\t\tWhere(\"org_id = ? AND configuration_hash = ?\", config.OrgID, cmd.FetchedConfigurationHash).\n\t\t\tUpdate(config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif rows == 0 {\n\t\t\treturn ErrVersionLockedObjectNotFound\n\t\t}\n\n\t\thistoricConfig := models.HistoricConfigFromAlertConfig(config)\n\t\tif _, err := sess.Table(\"alert_configuration_history\").Insert(historicConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := st.deleteOldConfigurations(ctx, cmd.OrgID, ConfigRecordsLimit); err != nil {\n\t\t\tst.Logger.Warn(\"failed to delete old am configs\", \"org\", cmd.OrgID, \"error\", err)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "33f340094e881b559da1ebfd649bbf89", "score": "0.49698454", "text": "func (c *CLI) UpdateCloudConfig(config IAASEnvironment, ip, password, ca string) error {\n\tvar cloudConfig string\n\tvar err error\n\n\tcloudConfig, err = config.ConfigureDirectorCloudConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcloudConfigPath, err := writeTempFile([]byte(cloudConfig))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer os.Remove(cloudConfigPath)\n\tcaPath, err := writeTempFile([]byte(ca))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer os.Remove(caPath)\n\tip = fmt.Sprintf(\"https://%s\", ip)\n\tcmd := c.execCmd(c.boshPath, \"--non-interactive\", \"--environment\", ip, \"--ca-cert\", caPath, \"--client\", \"admin\", \"--client-secret\", password, \"update-cloud-config\", cloudConfigPath)\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "dba174317fbb0d6f8d289b6dd849c2db", "score": "0.4945521", "text": "func (c *Config) Update(ncfg Config) {\n\tconfigLock.Lock()\n\tdefer configLock.Unlock()\n\n\tc.Enable = ncfg.Enable\n\tc.Frequency = ncfg.Frequency\n}", "title": "" }, { "docid": "4b260e40fa7cbc074fc0f4e72dacc806", "score": "0.49368507", "text": "func (m *MockConfigStoreManager) UpdateDynamicConfig(ctx context.Context, request *UpdateDynamicConfigRequest) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateDynamicConfig\", ctx, request)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "464c3d8518d834f298268f629968f3ad", "score": "0.49366307", "text": "func UpdateConfig(config map[string]interface{}, runtimeName string, runtimePath string, setAsDefault bool) error {\n\t// Read the existing runtimes\n\truntimes := make(map[string]interface{})\n\tif _, exists := config[\"runtimes\"]; exists {\n\t\truntimes = config[\"runtimes\"].(map[string]interface{})\n\t}\n\n\t// Add / update the runtime definitions\n\truntimes[runtimeName] = map[string]interface{}{\n\t\t\"path\": runtimePath,\n\t\t\"args\": []string{},\n\t}\n\n\t// Update the runtimes definition\n\tif len(runtimes) > 0 {\n\t\tconfig[\"runtimes\"] = runtimes\n\t}\n\n\tif setAsDefault {\n\t\tconfig[\"default-runtime\"] = runtimeName\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "01fb73c9eaffa72049c1025a32a86e1a", "score": "0.49364862", "text": "func (i *ImageService) UpdateConfig(maxDownloads, maxUploads int) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "d0de4cc73e425ac593624051f4e828da", "score": "0.4927987", "text": "func (cmw *configMapWatcher) updateConfig() {\n\tconf, err := readConfigMap(cmw.logger, cmw.dir)\n\tif err != nil {\n\t\tcmw.logger.Error(\"Unable to read the configMap\", zap.Error(err))\n\t\treturn\n\t}\n\terr = cmw.configUpdated(conf)\n\tif err != nil {\n\t\tcmw.logger.Error(\"Unable to update config\", zap.Error(err))\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "644ea0bb616ab7e180d616321f1a7415", "score": "0.49277654", "text": "func UpdateConfig(w http.ResponseWriter, r *http.Request) {\n\tbytes, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig failed with error: %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content\")\n\t}\n\tvar authConfig model.AuthConfig\n\n\terr = json.Unmarshal(bytes, &authConfig)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig unmarshal failed with error: %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content\")\n\t}\n\n\tif authConfig.Provider == \"\" {\n\t\tlog.Errorf(\"UpdateConfig: Provider is a required field\")\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content, Provider is a required field\")\n\t}\n\terr = server.UpdateConfig(authConfig)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig failed with error: %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusBadRequest, \"Bad Request, Please check the request content\")\n\t} else {\n\t\tlog.Debugf(\"Updated config, listing the config back\")\n\t\t//list the config and return in response\n\t\tconfig, err := server.GetConfig(\"\")\n\t\tif err == nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tjson.NewEncoder(w).Encode(config)\n\t\t} else {\n\t\t\t//failed to get the config\n\t\t\tlog.Debugf(\"GetConfig failed with error %v\", err)\n\t\t\tReturnHTTPError(w, r, http.StatusInternalServerError, \"Failed to list the config\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "93c3919f5cfa6a2f2b624d5ff2b30b68", "score": "0.49226594", "text": "func (c *FakeVarnishConfigs) Update(varnishConfig *v1alpha1.VarnishConfig) (result *v1alpha1.VarnishConfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(varnishconfigsResource, c.ns, varnishConfig), &v1alpha1.VarnishConfig{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.VarnishConfig), err\n}", "title": "" }, { "docid": "ba69eb7ef36f6264f720549f82b50015", "score": "0.49047872", "text": "func (ssc *StorageSmartContract) updateConfig(t *transaction.Transaction,\n\tinput []byte, balances chainState.StateContextI) (resp string, err error) {\n\n\tif t.ClientID != owner {\n\t\treturn \"\", common.NewError(\"update_config\",\n\t\t\t\"unauthorized access - only the owner can update the variables\")\n\t}\n\n\tvar conf *scConfig\n\tif conf, err = ssc.getConfig(balances, true); err != nil {\n\t\treturn \"\", common.NewError(\"update_config\",\n\t\t\t\"can't get config: \"+err.Error())\n\t}\n\n\tvar update scConfig\n\tif err = update.Decode(input); err != nil {\n\t\treturn \"\", common.NewError(\"update_config\", err.Error())\n\t}\n\n\tif err = update.validate(); err != nil {\n\t\treturn\n\t}\n\n\tupdate.Minted = conf.Minted\n\n\t_, err = balances.InsertTrieNode(scConfigKey(ssc.ID), &update)\n\tif err != nil {\n\t\treturn \"\", common.NewError(\"update_config\", err.Error())\n\t}\n\n\treturn string(update.Encode()), nil\n}", "title": "" }, { "docid": "acd629b1f678fe917e0f379fc8b69b44", "score": "0.48820627", "text": "func (d *AlertsRouter) SyncAndApplyConfigFromDatabase() error {\n\tcfgs, err := d.adminConfigStore.GetAdminConfigurations()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.logger.Debug(\"Attempting to sync admin configs\", \"count\", len(cfgs))\n\n\torgsFound := make(map[int64]struct{}, len(cfgs))\n\td.adminConfigMtx.Lock()\n\tfor _, cfg := range cfgs {\n\t\t_, isDisabledOrg := d.disabledOrgs[cfg.OrgID]\n\t\tif isDisabledOrg {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Update the Alertmanagers choice for the organization.\n\t\td.sendAlertsTo[cfg.OrgID] = cfg.SendAlertsTo\n\n\t\torgsFound[cfg.OrgID] = struct{}{} // keep track of the which externalAlertmanagers we need to keep.\n\n\t\texisting, ok := d.externalAlertmanagers[cfg.OrgID]\n\n\t\t// We have no running sender and alerts are handled internally, no-op.\n\t\tif !ok && cfg.SendAlertsTo == models.InternalAlertmanager {\n\t\t\td.logger.Debug(\"Grafana is configured to send alerts to the internal alertmanager only. Skipping synchronization with external alertmanager\", \"org\", cfg.OrgID)\n\t\t\tcontinue\n\t\t}\n\n\t\talertmanagers, err := d.alertmanagersFromDatasources(cfg.OrgID)\n\t\tif err != nil {\n\t\t\td.logger.Error(\"Failed to get alertmanagers from datasources\", \"org\", cfg.OrgID, \"error\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// We have no running sender and no Alertmanager(s) configured, no-op.\n\t\tif !ok && len(alertmanagers) == 0 {\n\t\t\td.logger.Debug(\"No external alertmanagers configured\", \"org\", cfg.OrgID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// We have a running sender but no Alertmanager(s) configured, shut it down.\n\t\tif ok && len(alertmanagers) == 0 {\n\t\t\td.logger.Info(\"No external alertmanager(s) configured, sender will be stopped\", \"org\", cfg.OrgID)\n\t\t\tdelete(orgsFound, cfg.OrgID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Avoid logging sensitive data\n\t\tredactedAMs := buildRedactedAMs(d.logger, alertmanagers, cfg.OrgID)\n\t\td.logger.Debug(\"Alertmanagers found in the configuration\", \"alertmanagers\", redactedAMs)\n\n\t\tvar hashes []string\n\t\tfor _, cfg := range alertmanagers {\n\t\t\thashes = append(hashes, cfg.SHA256())\n\t\t}\n\t\t// We have a running sender, check if we need to apply a new config.\n\t\tamHash := asSHA256(hashes)\n\t\tif ok {\n\t\t\tif d.externalAlertmanagersCfgHash[cfg.OrgID] == amHash {\n\t\t\t\td.logger.Debug(\"Sender configuration is the same as the one running, no-op\", \"org\", cfg.OrgID, \"alertmanagers\", redactedAMs)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\td.logger.Info(\"Applying new configuration to sender\", \"org\", cfg.OrgID, \"alertmanagers\", redactedAMs, \"cfg\", cfg.ID)\n\t\t\terr := existing.ApplyConfig(cfg.OrgID, cfg.ID, alertmanagers)\n\t\t\tif err != nil {\n\t\t\t\td.logger.Error(\"Failed to apply configuration\", \"error\", err, \"org\", cfg.OrgID)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\td.externalAlertmanagersCfgHash[cfg.OrgID] = amHash\n\t\t\tcontinue\n\t\t}\n\n\t\t// No sender and have Alertmanager(s) to send to - start a new one.\n\t\td.logger.Info(\"Creating new sender for the external alertmanagers\", \"org\", cfg.OrgID, \"alertmanagers\", redactedAMs)\n\t\ts := NewExternalAlertmanagerSender()\n\t\td.externalAlertmanagers[cfg.OrgID] = s\n\t\ts.Run()\n\n\t\terr = s.ApplyConfig(cfg.OrgID, cfg.ID, alertmanagers)\n\t\tif err != nil {\n\t\t\td.logger.Error(\"Failed to apply configuration\", \"error\", err, \"org\", cfg.OrgID)\n\t\t\tcontinue\n\t\t}\n\n\t\td.externalAlertmanagersCfgHash[cfg.OrgID] = amHash\n\t}\n\n\tsendersToStop := map[int64]*ExternalAlertmanager{}\n\n\tfor orgID, s := range d.externalAlertmanagers {\n\t\tif _, exists := orgsFound[orgID]; !exists {\n\t\t\tsendersToStop[orgID] = s\n\t\t\tdelete(d.externalAlertmanagers, orgID)\n\t\t\tdelete(d.externalAlertmanagersCfgHash, orgID)\n\t\t}\n\t}\n\td.adminConfigMtx.Unlock()\n\n\t// We can now stop these external Alertmanagers w/o having to hold a lock.\n\tfor orgID, s := range sendersToStop {\n\t\td.logger.Info(\"Stopping sender\", \"org\", orgID)\n\t\ts.Stop()\n\t\td.logger.Info(\"Stopped sender\", \"org\", orgID)\n\t}\n\n\td.logger.Debug(\"Finish of admin configuration sync\")\n\n\treturn nil\n}", "title": "" }, { "docid": "f8d9398ca47a1a406777078ee4c46bca", "score": "0.48656037", "text": "func (sys *BucketMetadataSys) Update(bucket string, configFile string, configData []byte) error {\n\tobjAPI := newObjectLayerFn()\n\tif objAPI == nil {\n\t\treturn errServerNotInitialized\n\t}\n\n\tif globalIsGateway {\n\t\t// This code is needed only for gateway implementations.\n\t\tswitch configFile {\n\t\tcase bucketSSEConfig:\n\t\t\tif globalGatewayName == NASBackendGateway {\n\t\t\t\tmeta, err := loadBucketMetadata(GlobalContext, objAPI, bucket)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmeta.EncryptionConfigXML = configData\n\t\t\t\treturn meta.Save(GlobalContext, objAPI)\n\t\t\t}\n\t\tcase bucketLifecycleConfig:\n\t\t\tif globalGatewayName == NASBackendGateway {\n\t\t\t\tmeta, err := loadBucketMetadata(GlobalContext, objAPI, bucket)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmeta.LifecycleConfigXML = configData\n\t\t\t\treturn meta.Save(GlobalContext, objAPI)\n\t\t\t}\n\t\tcase bucketTaggingConfig:\n\t\t\tif globalGatewayName == NASBackendGateway {\n\t\t\t\tmeta, err := loadBucketMetadata(GlobalContext, objAPI, bucket)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmeta.TaggingConfigXML = configData\n\t\t\t\treturn meta.Save(GlobalContext, objAPI)\n\t\t\t}\n\t\tcase bucketNotificationConfig:\n\t\t\tif globalGatewayName == NASBackendGateway {\n\t\t\t\tmeta, err := loadBucketMetadata(GlobalContext, objAPI, bucket)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmeta.NotificationConfigXML = configData\n\t\t\t\treturn meta.Save(GlobalContext, objAPI)\n\t\t\t}\n\t\tcase bucketPolicyConfig:\n\t\t\tif configData == nil {\n\t\t\t\treturn objAPI.DeleteBucketPolicy(GlobalContext, bucket)\n\t\t\t}\n\t\t\tconfig, err := policy.ParseConfig(bytes.NewReader(configData), bucket)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn objAPI.SetBucketPolicy(GlobalContext, bucket, config)\n\t\t}\n\t\treturn NotImplemented{}\n\t}\n\n\tif bucket == minioMetaBucket {\n\t\treturn errInvalidArgument\n\t}\n\n\tmeta, err := loadBucketMetadata(GlobalContext, objAPI, bucket)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch configFile {\n\tcase bucketPolicyConfig:\n\t\tmeta.PolicyConfigJSON = configData\n\tcase bucketNotificationConfig:\n\t\tmeta.NotificationConfigXML = configData\n\tcase bucketLifecycleConfig:\n\t\tmeta.LifecycleConfigXML = configData\n\tcase bucketSSEConfig:\n\t\tmeta.EncryptionConfigXML = configData\n\tcase bucketTaggingConfig:\n\t\tmeta.TaggingConfigXML = configData\n\tcase bucketQuotaConfigFile:\n\t\tmeta.QuotaConfigJSON = configData\n\tcase objectLockConfig:\n\t\tif !globalIsErasure && !globalIsDistErasure {\n\t\t\treturn NotImplemented{}\n\t\t}\n\t\tmeta.ObjectLockConfigXML = configData\n\tcase bucketVersioningConfig:\n\t\tif !globalIsErasure && !globalIsDistErasure {\n\t\t\treturn NotImplemented{}\n\t\t}\n\t\tmeta.VersioningConfigXML = configData\n\tcase bucketReplicationConfig:\n\t\tif !globalIsErasure && !globalIsDistErasure {\n\t\t\treturn NotImplemented{}\n\t\t}\n\t\tmeta.ReplicationConfigXML = configData\n\tcase bucketTargetsFile:\n\t\tmeta.BucketTargetsConfigJSON, meta.BucketTargetsConfigMetaJSON, err = encryptBucketMetadata(meta.Name, configData, kms.Context{\n\t\t\tbucket: meta.Name,\n\t\t\tbucketTargetsFile: bucketTargetsFile,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error encrypting bucket target metadata %w\", err)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown bucket %s metadata update requested %s\", bucket, configFile)\n\t}\n\n\tif err := meta.Save(GlobalContext, objAPI); err != nil {\n\t\treturn err\n\t}\n\n\tsys.Set(bucket, meta)\n\tglobalNotificationSys.LoadBucketMetadata(GlobalContext, bucket)\n\n\treturn nil\n}", "title": "" }, { "docid": "40f51e1458ce7e2424be40c0baa7f2ca", "score": "0.48501053", "text": "func (api *API) UpdateConfig(request *restful.Request, response *restful.Response) {\n\n\t// ToDo: check url name matches body name\n\n\tparams := request.PathParameters()\n\tk, err := setup(params)\n\tif err != nil {\n\t\tapi.writeError(http.StatusBadRequest, err.Error(), response)\n\t\treturn\n\t}\n\n\tconfig := &Config{}\n\tif err = request.ReadEntity(config); err != nil {\n\t\tapi.writeError(http.StatusBadRequest, err.Error(), response)\n\t\treturn\n\t}\n\n\tif err = config.ParseSpec(); err != nil {\n\t\tapi.writeError(http.StatusBadRequest, err.Error(), response)\n\t\treturn\n\t}\n\n\tglog.V(2).Infof(\"Updating config in Istio registry: key %+v, config %+v\", k, config)\n\n\t// TODO: incorrect use with new registry\n\tif _, err = api.registry.Put(config.ParsedSpec, \"\"); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *model.ItemNotFoundError:\n\t\t\tapi.writeError(http.StatusNotFound, err.Error(), response)\n\t\tdefault:\n\t\t\tapi.writeError(http.StatusInternalServerError, err.Error(), response)\n\t\t}\n\t\treturn\n\t}\n\tglog.V(2).Infof(\"Updated config to %+v\", config)\n\tif err = response.WriteHeaderAndEntity(http.StatusOK, config); err != nil {\n\t\tapi.writeError(http.StatusInternalServerError, err.Error(), response)\n\t}\n}", "title": "" }, { "docid": "a57970bf1a4adbc161aa24a897e8ad65", "score": "0.48432928", "text": "func (c *Client) Update(response *pbgo.LatestConfigsResponse) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.cachedVerify = false\n\n\t// in case the commit is successful it is a no-op.\n\t// the defer is present to be sure a transaction is never left behind.\n\tdefer c.transactionalStore.rollback()\n\n\terr := c.updateRepos(response)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.pruneTargetFiles()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.verify()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.transactionalStore.commit()\n}", "title": "" }, { "docid": "bf12bb06b162aae00e6a649ab2aeb2c1", "score": "0.48338228", "text": "func (o ServiceOutput) UpdateConfig() ServiceUpdateConfigPtrOutput {\n\treturn o.ApplyT(func(v *Service) ServiceUpdateConfigPtrOutput { return v.UpdateConfig }).(ServiceUpdateConfigPtrOutput)\n}", "title": "" }, { "docid": "d91ba1275c6f1146a3b093a81fce07c3", "score": "0.4830867", "text": "func (d *StaticSystem) ConfigUpdate(key string, val string) error {\n\tswitch key {\n\tcase \"report_period_ms\":\n\t\t// update myself\n\t\tperiod, err := strconv.ParseInt(val, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.server.collector.UpdateReportPeriod(time.Duration(period) * time.Millisecond)\n\t\treturn nil\n\tdefault:\n\t\tglog.Warningf(\"unsupport key: %v\", key)\n\t\treturn errors.New(\"unsupport key\")\n\t}\n}", "title": "" }, { "docid": "1e5fe41369e8a653d134d8de1ab55c89", "score": "0.48300022", "text": "func (proxy *StandAloneProxyConfig) UpdateManagedArrays(config *StandAloneProxyConfig) {\n\tif !reflect.DeepEqual(proxy.managedArrays, config.managedArrays) {\n\t\tlog.Info(\"Detected changes, updating managed array config\")\n\t\tproxy.managedArrays = config.managedArrays\n\t\tproxy.proxyCredentials = config.proxyCredentials\n\t}\n}", "title": "" }, { "docid": "0c994cdcffe91c987606b4c25772b39f", "score": "0.48132893", "text": "func UpdateConfig(newConfig map[string]string) error {\n\tconfig, err := GetConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range newConfig {\n\t\tconfig[k] = v\n\t}\n\tmarshaled, err := json.Marshal(config)\n\terr = upload(GcpConfigFileName, marshaled)\n\treturn err\n}", "title": "" }, { "docid": "4168ec1a320c2e3dd77673b287013d48", "score": "0.48094428", "text": "func updateConfigFile(context *cli.Context) {\n\tconfig, configFilename, err := lib.GetConfig(context)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tif configFilename == \"\" {\n\t\tfmt.Println(\"Could not find a config file to update\")\n\t\treturn\n\t}\n\n\t// Same config in []byte format.\n\tconfigRaw, err := ioutil.ReadFile(configFilename)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Same config in map format so that we can detect missing keys.\n\tvar configMap map[string]interface{}\n\tif err = json.Unmarshal(configRaw, &configMap); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tdirty := updateConfig(config, configMap)\n\n\tif dirty {\n\t\tconfig.ToFile(context)\n\t\tfmt.Printf(\"Wrote %s\\n\", configFilename)\n\t} else {\n\t\tfmt.Println(\"Nothing to update\")\n\t}\n}", "title": "" }, { "docid": "4d08f50b43563d2446b00adb0ea4aeeb", "score": "0.48084503", "text": "func (cc *CenterConfig) Update() error {\n\tdb := cc.getDb()\n\terr := db.Begin()\n\t_, err = db.Update(cc)\n\tif err == nil {\n\t\t_, err = MetaCache.Put(MetaCache{}, cc.formatEtcdKeys(), base64.StdEncoding.EncodeToString([]byte(cc.Val)))\n\t\tif err != nil {\n\t\t\tlog.Error(\"Etcd put error:\" + err.Error())\n\t\t\terr = db.Rollback()\n\t\t} else {\n\t\t\terr = db.Commit()\n\t\t}\n\t} else {\n\t\terr = db.Rollback()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "bfb7b5f097fafab977778cfde5fe672b", "score": "0.48084262", "text": "func (c *client) UpdateConfig(apiKey string, secretKey string, opts ...ClientOption) error {\n\tswitch {\n\tcase apiKey == \"\":\n\t\treturn errors.InvalidParameterError{Parameter: \"apiKey\", Reason: \"cannot be empty\"}\n\tcase secretKey == \"\":\n\t\treturn errors.InvalidParameterError{Parameter: \"secretKey\", Reason: \"cannot be empty\"}\n\t}\n\n\tc.apiKey = apiKey\n\tc.secretKey = secretKey\n\n\tfor _, opt := range opts {\n\t\tif err := opt(c); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fb880c71c2e2d479f679c4c65632c164", "score": "0.4805943", "text": "func UpdateConfigYaml(scanPath string, outputDir string, noMoreFiles bool) {\n\tvar currentConf YamlConf\n\t_, err := currentConf.GetYamlConfig(scanPath)\n\tCheck(err)\n\n\t//Modifying outputDir if option is not \"\"\n\tif outputDir != \"\" {\n\t\tcurrentConf.OutputDirPath = outputDir\n\t}\n\n\t//Scanning\n\tfiles, err := scanProject(scanPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//Parsing\n\tcontextSlice, batches := parsingProject(files)\n\tmissing_contexts := currentConf.getMissingContexts(contextSlice)\n\n\t/*\n\t\tHandling contexts update\n\t*/\n\n\tif missing_contexts != nil {\n\t\t//If no more files then we add these contexts to pending and do not add filenames for new contexts\n\t\t//Note that generateTS won't work if some contexts are still pending (except if --ignore-pending)\n\t\tif noMoreFiles {\n\t\t\tcurrentConf.Pending = append(currentConf.Pending, missing_contexts...)\n\n\t\t} else {\n\t\t\tfor _, mc := range missing_contexts {\n\t\t\t\tl := make([]string, 0)\n\t\t\t\tl = append(l, strings.ToLower(mc))\n\t\t\t\tcurrentConf.FilenameContextsMap[strings.Title(mc)+\"Model\"] = l\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t\tHandling batches update\n\t*/\n\tcurrentConf.BatchesInterface = batches\n\tcurrentConf.marshallAndWrite(scanPath + \"/gototoConf.yaml\")\n\n}", "title": "" }, { "docid": "0a676a8a7ea229be36d62663ebbe633b", "score": "0.48014462", "text": "func (c *FilecoinRetrievalProviderAdmin) ForceUpdate(providerID *nodeid.NodeID) error {\n\tc.ActiveProvidersLock.RLock()\n\tdefer c.ActiveProvidersLock.RUnlock()\n\tproviderRegistrar, exists := c.ActiveProviders[providerID.ToString()]\n\tif !exists {\n\t\treturn errors.New(\"unable to find the provider in admin storage\")\n\t}\n\treturn c.AdminApiCaller.RequestForceRefresh(providerRegistrar, c.Settings.providerAdminPrivateKey, c.Settings.providerAdminPrivateKeyVer)\n}", "title": "" }, { "docid": "39e68fa9a07164d223f0b31b520c672b", "score": "0.47879276", "text": "func updateCurrentAmount(c context.Context, id string) (cfg *model.Config, now time.Time, err error) {\n\tcfg = &model.Config{\n\t\tID: id,\n\t}\n\t// Avoid transaction if possible.\n\tif err = datastore.Get(c, cfg); err != nil {\n\t\terr = errors.Annotate(err, \"failed to fetch config\").Err()\n\t\treturn\n\t}\n\n\tnow = clock.Now(c)\n\tvar amt int32\n\tswitch amt, err = cfg.Config.ComputeAmount(cfg.Config.CurrentAmount, now); {\n\tcase err != nil:\n\t\terr = errors.Annotate(err, \"failed to parse amount\").Err()\n\t\treturn\n\tcase cfg.Config.CurrentAmount == amt:\n\t\treturn\n\t}\n\n\terr = datastore.RunInTransaction(c, func(c context.Context) error {\n\t\tvar err error\n\t\tif err = datastore.Get(c, cfg); err != nil {\n\t\t\treturn errors.Annotate(err, \"failed to fetch config\").Err()\n\t\t}\n\n\t\tnow = clock.Now(c)\n\t\tswitch amt, err = cfg.Config.ComputeAmount(cfg.Config.CurrentAmount, now); {\n\t\tcase err != nil:\n\t\t\treturn errors.Annotate(err, \"failed to parse amount\").Err()\n\t\tcase cfg.Config.CurrentAmount == amt:\n\t\t\treturn nil\n\t\t}\n\t\tcfg.Config.CurrentAmount = amt\n\t\tlogging.Debugf(c, \"set config %q to allow %d VMs\", cfg.ID, cfg.Config.CurrentAmount)\n\t\tif err = datastore.Put(c, cfg); err != nil {\n\t\t\treturn errors.Annotate(err, \"failed to store config\").Err()\n\t\t}\n\t\treturn nil\n\t}, nil)\n\treturn\n}", "title": "" }, { "docid": "b4d7a36afff323bcb7c359480ad025f2", "score": "0.47782373", "text": "func (c *FakeSensuCheckConfigs) Update(sensuCheckConfig *v1beta1.SensuCheckConfig) (result *v1beta1.SensuCheckConfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(sensucheckconfigsResource, c.ns, sensuCheckConfig), &v1beta1.SensuCheckConfig{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1beta1.SensuCheckConfig), err\n}", "title": "" }, { "docid": "785758fd0ee220ba8da6241364256e71", "score": "0.4775378", "text": "func (c *StreamerController) UpdateSyncCfg(syncCfg replication.BinlogSyncerConfig, fromDB *dbconn.UpStreamConn) {\n\tc.Lock()\n\tc.fromDB = fromDB\n\tc.syncCfg = syncCfg\n\tc.Unlock()\n}", "title": "" }, { "docid": "cd0871128f739e54c83c3973c86c567c", "score": "0.4771084", "text": "func (d DB) SetRulesConfig(ctx context.Context, userID string, oldConfig, newConfig userconfig.RulesConfig) (bool, error) {\n\tupdated := false\n\terr := d.Transaction(func(tx DB) error {\n\t\tcurrent, err := d.GetConfig(ctx, userID)\n\t\tif err != nil && err != sql.ErrNoRows {\n\t\t\treturn err\n\t\t}\n\t\t// The supplied oldConfig must match the current config. If no config\n\t\t// exists, then oldConfig must be nil. Otherwise, it must exactly\n\t\t// equal the existing config.\n\t\tif !((err == sql.ErrNoRows && oldConfig.Files == nil) || oldConfig.Equal(current.Config.RulesConfig)) {\n\t\t\treturn nil\n\t\t}\n\t\tnew := userconfig.Config{\n\t\t\tAlertmanagerConfig: current.Config.AlertmanagerConfig,\n\t\t\tRulesConfig: newConfig,\n\t\t}\n\t\tupdated = true\n\t\treturn d.SetConfig(ctx, userID, new)\n\t})\n\treturn updated, err\n}", "title": "" }, { "docid": "14f14ff037b8dfd105af7f686ba64b1b", "score": "0.4765132", "text": "func (s *Server) SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError {\n\toldCfg, err := s.configStore.Set(newCfg)\n\tif errors.Cause(err) == config.ErrReadOnlyConfiguration {\n\t\treturn model.NewAppError(\"saveConfig\", \"ent.cluster.save_config.error\", nil, err.Error(), http.StatusForbidden)\n\t} else if err != nil {\n\t\treturn model.NewAppError(\"saveConfig\", \"app.save_config.app_error\", nil, err.Error(), http.StatusInternalServerError)\n\t}\n\n\tif s.Metrics != nil {\n\t\tif *s.Config().MetricsSettings.Enable {\n\t\t\ts.Metrics.StartServer()\n\t\t} else {\n\t\t\ts.Metrics.StopServer()\n\t\t}\n\t}\n\n\tif s.Cluster != nil {\n\t\tnewCfg = s.configStore.RemoveEnvironmentOverrides(newCfg)\n\t\toldCfg = s.configStore.RemoveEnvironmentOverrides(oldCfg)\n\t\terr := s.Cluster.ConfigChanged(oldCfg, newCfg, sendConfigChangeClusterMessage)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9699083cf41daf6c5213ae9abcf4c9d0", "score": "0.47632465", "text": "func (config *Config) StoreConfig() error {\n\tvar configPath = config.GetValue(ConfigPath)\n\tvar err1 = CreateParentDir(configPath)\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\tvar bytes, err2 = json.Marshal(config.values)\n\tif err2 != nil {\n\t\treturn err2\n\t}\n\treturn ioutil.WriteFile(configPath, bytes, 0644)\n}", "title": "" }, { "docid": "15341db8e12cc0734e611dc23f9109d5", "score": "0.47625148", "text": "func (lc *LocalConfig) updateLocalConfig(cfg string) error {\n\tnew := make(map[string]interface{})\n\tif err := decodeConfigs(cfg, new); err != nil {\n\t\treturn err\n\t}\n\told := lc.getConfigs()\n\tupdateItem(new, old)\n\treturn nil\n}", "title": "" }, { "docid": "cad83ec900718f9f8f3704c7b3d8e1f0", "score": "0.47434333", "text": "func (ctx *Context) updateConfigMaps(obj, newObj interface{}) {\n\tlog.Logger.Debug(\"trigger scheduler to reload configuration\")\n\t// When update event is received, it is not guaranteed the data mounted to the pod\n\t// is also updated. This is because the actual update in pod's volume is ensured\n\t// by kubelet, kubelet is checking whether the mounted ConfigMap is fresh on every\n\t// periodic sync. As a result, the total delay from the moment when the ConfigMap\n\t// is updated to the moment when new keys are projected to the pod can be as long\n\t// as kubelet sync period + ttl of ConfigMaps cache in kubelet.\n\t// We trigger configuration reload, on yunikorn-core side, it keeps checking config\n\t// file state once this is called. And the actual reload happens when it detects\n\t// actual changes on the content.\n\tctx.triggerReloadConfig()\n}", "title": "" }, { "docid": "b112e939d5f5a46e7e0600376827f885", "score": "0.47300696", "text": "func (*deployInsideDeployConfigMapHandler) updateConfigMap(_ context.Context, _ *apiv1.ConfigMap, _ *pipeline.CfgData, err error) error {\n\treturn nil\n}", "title": "" }, { "docid": "ad2a94b51857e6678a7c69a390000c49", "score": "0.47265548", "text": "func (c *FakeGlobalConfigs) Update(ctx context.Context, globalConfig *v1beta1.GlobalConfig, opts v1.UpdateOptions) (result *v1beta1.GlobalConfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(globalconfigsResource, c.ns, globalConfig), &v1beta1.GlobalConfig{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1beta1.GlobalConfig), err\n}", "title": "" }, { "docid": "d49fbba1d314b2b7d7823a481e8f6220", "score": "0.4724172", "text": "func (s *Service) update() error {\n\tkey := path.Join(servicesPrefix, s.ID, \"config\")\n\n\tmodIndex, err := s.c.kvUpdate(key, s.ServiceConf, s.ModIndex)\n\tif err != nil {\n\t\treturn errors.Wrapv(err, map[string]interface{}{\"serviceID\": s.ID})\n\t}\n\ts.ModIndex = modIndex\n\n\treturn nil\n}", "title": "" }, { "docid": "15ecf030681ecf7a35628cc6cd6e1929", "score": "0.47230908", "text": "func UpdateConfig(conf caddy.Config, host string) error {\n\tu := fmt.Sprintf(\"http://%s:2019/load\", host)\n\n\td, err := json.Marshal(conf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to json.Marshal: %w\", err)\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, u, bytes.NewBuffer(d))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to http.NewRequest: %w\", err)\n\t}\n\n\treq.Header.Add(\"Cache-Control\", \"must-revalidate\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tclient := new(http.Client)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to HTTP POST: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tb, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read response body: %w\", err)\n\t}\n\n\tif resp.StatusCode >= 400 {\n\t\treturn fmt.Errorf(\"invalid status code (code: %d, body: %s)\", resp.StatusCode, b)\n\t}\n\n\tklog.Info(\"Update successfully!\")\n\n\treturn nil\n}", "title": "" }, { "docid": "83aac737575cab1d1d3672f54dfa7d20", "score": "0.4719041", "text": "func (d *GossipSystem) ConfigUpdate(key string, val string) error {\n\tswitch key {\n\tcase \"report_period_ms\":\n\t\tperiod, err := strconv.ParseInt(val, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.server.collector.UpdateReportPeriod(time.Duration(period) * time.Millisecond)\n\t\treturn nil\n\tdefault:\n\t\tglog.Warningf(\"unsupport key: %v\", key)\n\t\treturn errors.New(\"unsupport key\")\n\t}\n}", "title": "" }, { "docid": "b151c5ee28ea798e282fdd267fbec143", "score": "0.4717477", "text": "func (ds *MySQLDatastore) UpdateApp(ctx context.Context, newapp *models.App) (*models.App, error) {\n\tapp := &models.App{Name: newapp.Name}\n\terr := ds.Tx(func(tx *sql.Tx) error {\n\t\trow := ds.db.QueryRow(`SELECT config FROM apps WHERE name=?`, app.Name)\n\n\t\tvar config string\n\t\tif err := row.Scan(&config); err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\treturn models.ErrAppsNotFound\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\tif config != \"\" {\n\t\t\terr := json.Unmarshal([]byte(config), &app.Config)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tapp.UpdateConfig(newapp.Config)\n\n\t\tcbyte, err := json.Marshal(app.Config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tstmt, err := ds.db.Prepare(`UPDATE apps SET config=? WHERE name=?`)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tres, err := stmt.Exec(string(cbyte), app.Name)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif n, err := res.RowsAffected(); err != nil {\n\t\t\treturn err\n\t\t} else if n == 0 {\n\t\t\treturn models.ErrAppsNotFound\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn app, nil\n}", "title": "" }, { "docid": "ecabee9f4f25bcae55dbd77ae93f7e15", "score": "0.47003874", "text": "func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertificateWrite bool) (retErr error) {\n\toldConfig = canonicalizeEmptyMC(oldConfig)\n\n\tif dn.nodeWriter != nil {\n\t\tstate, err := getNodeAnnotationExt(dn.node, constants.MachineConfigDaemonStateAnnotationKey, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif state != constants.MachineConfigDaemonStateDegraded && state != constants.MachineConfigDaemonStateUnreconcilable {\n\t\t\tif err := dn.nodeWriter.SetWorking(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error setting node's state to Working: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tdn.catchIgnoreSIGTERM()\n\tdefer func() {\n\t\t// now that we do rebootless updates, we need to turn off our SIGTERM protection\n\t\t// regardless of how we leave the \"update loop\"\n\t\tdn.cancelSIGTERM()\n\t}()\n\n\toldConfigName := oldConfig.GetName()\n\tnewConfigName := newConfig.GetName()\n\n\toldIgnConfig, err := ctrlcommon.ParseAndConvertConfig(oldConfig.Spec.Config.Raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing old Ignition config failed: %w\", err)\n\t}\n\tnewIgnConfig, err := ctrlcommon.ParseAndConvertConfig(newConfig.Spec.Config.Raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing new Ignition config failed: %w\", err)\n\t}\n\n\tklog.Infof(\"Checking Reconcilable for config %v to %v\", oldConfigName, newConfigName)\n\n\t// make sure we can actually reconcile this state\n\tdiff, reconcilableError := reconcilable(oldConfig, newConfig)\n\n\tif reconcilableError != nil {\n\t\twrappedErr := fmt.Errorf(\"can't reconcile config %s with %s: %w\", oldConfigName, newConfigName, reconcilableError)\n\t\tif dn.nodeWriter != nil {\n\t\t\tdn.nodeWriter.Eventf(corev1.EventTypeWarning, \"FailedToReconcile\", wrappedErr.Error())\n\t\t}\n\t\treturn &unreconcilableErr{wrappedErr}\n\t}\n\n\tlogSystem(\"Starting update from %s to %s: %+v\", oldConfigName, newConfigName, diff)\n\n\tdiffFileSet := ctrlcommon.CalculateConfigFileDiffs(&oldIgnConfig, &newIgnConfig)\n\tactions, err := calculatePostConfigChangeAction(diff, diffFileSet)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check and perform node drain if required\n\tdrain, err := isDrainRequired(actions, diffFileSet, oldIgnConfig, newIgnConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif drain {\n\t\tif err := dn.performDrain(); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tklog.Info(\"Changes do not require drain, skipping.\")\n\t}\n\n\t// update files on disk that need updating\n\tif err := dn.updateFiles(oldIgnConfig, newIgnConfig, skipCertificateWrite); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := dn.updateFiles(newIgnConfig, oldIgnConfig, skipCertificateWrite); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back files writes: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// update file permissions\n\tif err := dn.updateKubeConfigPermission(); err != nil {\n\t\treturn err\n\t}\n\n\t// only update passwd if it has changed (do not nullify)\n\t// we do not need to include SetPasswordHash in this, since only updateSSHKeys has issues on firstboot.\n\tif diff.passwd {\n\t\tif err := dn.updateSSHKeys(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif retErr != nil {\n\t\t\t\tif err := dn.updateSSHKeys(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\t\tretErr = fmt.Errorf(\"error rolling back SSH keys updates: %w\", errs)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// Set password hash\n\tif err := dn.SetPasswordHash(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := dn.SetPasswordHash(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back password hash updates: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tif dn.os.IsCoreOSVariant() {\n\t\tcoreOSDaemon := CoreOSDaemon{dn}\n\t\tif err := coreOSDaemon.applyOSChanges(*diff, oldConfig, newConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif retErr != nil {\n\t\t\t\tif err := coreOSDaemon.applyOSChanges(*diff, newConfig, oldConfig); err != nil {\n\t\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\t\tretErr = fmt.Errorf(\"error rolling back changes to OS: %w\", errs)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t} else {\n\t\tklog.Info(\"updating the OS on non-CoreOS nodes is not supported\")\n\t}\n\n\t// Ideally we would want to update kernelArguments only via MachineConfigs.\n\t// We are keeping this to maintain compatibility and OKD requirement.\n\tif err := UpdateTuningArgs(KernelTuningFile, CmdLineFile); err != nil {\n\t\treturn err\n\t}\n\n\t// At this point, we write the now expected to be \"current\" config to /etc.\n\t// When we reboot, we'll find this file and validate that we're in this state,\n\t// and that completes an update.\n\todc := &onDiskConfig{\n\t\tcurrentConfig: newConfig,\n\t}\n\n\tif err := dn.storeCurrentConfigOnDisk(odc); err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\todc.currentConfig = oldConfig\n\t\t\tif err := dn.storeCurrentConfigOnDisk(odc); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back current config on disk: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn dn.performPostConfigChangeAction(actions, newConfig.GetName())\n}", "title": "" }, { "docid": "eb09f324342b7fa886961fbcb72c3a26", "score": "0.46966216", "text": "func (cm *PollingProjectConfigManager) SyncConfig(datafile []byte) {\n\tvar e error\n\tvar code int\n\tif len(datafile) == 0 {\n\t\tdatafile, code, e = cm.requester.Get()\n\n\t\tif e != nil {\n\t\t\tcmLogger.Error(fmt.Sprintf(\"request returned with http code=%d\", code), e)\n\t\t}\n\t}\n\n\tprojectConfig, err := datafileprojectconfig.NewDatafileProjectConfig(datafile)\n\tif err != nil {\n\t\tcmLogger.Error(\"failed to create project config\", err)\n\t}\n\n\tcm.configLock.Lock()\n\tif cm.projectConfig != nil {\n\t\tif cm.projectConfig.GetRevision() == projectConfig.GetRevision() {\n\t\t\tcmLogger.Debug(fmt.Sprintf(\"No datafile updates. Current revision number: %s\", cm.projectConfig.GetRevision()))\n\t\t} else {\n\t\t\tcmLogger.Debug(fmt.Sprintf(\"Received new datafile and updated config. Old revision number: %s. New revision number: %s\", cm.projectConfig.GetRevision(), projectConfig.GetRevision()))\n\t\t\tcm.projectConfig = projectConfig\n\n\t\t\tif cm.notificationCenter != nil {\n\t\t\t\tprojectConfigUpdateNotification := notification.ProjectConfigUpdateNotification{\n\t\t\t\t\tType: notification.ProjectConfigUpdate,\n\t\t\t\t\tRevision: cm.projectConfig.GetRevision(),\n\t\t\t\t}\n\t\t\t\tif err = cm.notificationCenter.Send(notification.ProjectConfigUpdate, projectConfigUpdateNotification); err != nil {\n\t\t\t\t\tcmLogger.Warning(\"Problem with sending notification\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcm.projectConfig = projectConfig\n\t}\n\tcm.err = err\n\tcm.configLock.Unlock()\n}", "title": "" }, { "docid": "f25adebfcc8b724f6aa8fd6f7ba28cb9", "score": "0.4689058", "text": "func (a *Admin) SetConfigIfNeed(newConfig map[string]string) error {\n\tfor addr, c := range a.Connections().GetAll() {\n\t\toldConfig, err := a.GetAllConfig(c, addr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor key, value := range newConfig {\n\t\t\tvar err error\n\t\t\tif _, ok := parseConfigMap[key]; ok {\n\t\t\t\tvalue, err = utils.ParseRedisMemConf(value)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.log.Error(err, \"redis config format err\", \"key\", key, \"value\", value)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif value != oldConfig[key] {\n\t\t\t\ta.log.V(3).Info(\"CONFIG SET\", key, value)\n\t\t\t\tresp := c.Cmd(\"CONFIG\", \"SET\", key, value)\n\t\t\t\tif err := a.Connections().ValidateResp(resp, addr, \"unable to retrieve config\"); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d45267a3fb2ac00bda2c3f44708299dc", "score": "0.46806452", "text": "func (fmd *FakeMysqlDaemon) RefreshConfig(ctx context.Context, cnf *Mycnf) error {\n\treturn nil\n}", "title": "" }, { "docid": "fac86fa650cea2de095e24c373ca3b2e", "score": "0.46753895", "text": "func StoreConfig(c *KubernetesCluster) ([]byte, error) {\n\tisBasicOn := false\n\tif c.Username != \"\" && c.Password != \"\" {\n\t\tisBasicOn = true\n\t}\n\tusername, password, token := \"\", \"\", \"\"\n\tif isBasicOn {\n\t\tusername = c.Username\n\t\tpassword = c.Password\n\t} else {\n\t\ttoken = c.ServiceAccountToken\n\t}\n\n\tconfig := KubeConfig{}\n\tconfig.APIVersion = \"v1\"\n\tconfig.Kind = \"Config\"\n\n\t// setup clusters\n\thost := c.Endpoint\n\tif !strings.HasPrefix(host, \"https://\") {\n\t\thost = fmt.Sprintf(\"https://%s\", host)\n\t}\n\tcluster := configCluster{\n\t\tCluster: dataCluster{\n\t\t\tCertificateAuthorityData: c.RootCACert,\n\t\t\tServer: host,\n\t\t},\n\t\tName: c.Name,\n\t}\n\tif config.Clusters == nil || len(config.Clusters) == 0 {\n\t\tconfig.Clusters = []configCluster{cluster}\n\t} else {\n\t\texist := false\n\t\tfor _, cluster := range config.Clusters {\n\t\t\tif cluster.Name == c.Name {\n\t\t\t\texist = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !exist {\n\t\t\tconfig.Clusters = append(config.Clusters, cluster)\n\t\t}\n\t}\n\n\tvar provider authProvider\n\tif len(c.AuthProviderName) != 0 || len(c.AuthAccessToken) != 0 {\n\t\tprovider = authProvider{\n\t\t\tProviderConfig: providerConfig{\n\t\t\t\tAccessToken: c.AuthAccessToken,\n\t\t\t\tExpiry: c.AuthAccessTokenExpiry,\n\t\t\t},\n\t\t\tName: c.AuthProviderName,\n\t\t}\n\t}\n\n\t// setup users\n\tuser := configUser{\n\t\tUser: userData{\n\t\t\tToken: token,\n\t\t\tUsername: username,\n\t\t\tPassword: password,\n\t\t\tAuthProvider: provider,\n\t\t},\n\t\tName: c.Name,\n\t}\n\tif config.Users == nil || len(config.Users) == 0 {\n\t\tconfig.Users = []configUser{user}\n\t} else {\n\t\texist := false\n\t\tfor _, user := range config.Users {\n\t\t\tif user.Name == c.Name {\n\t\t\t\texist = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !exist {\n\t\t\tconfig.Users = append(config.Users, user)\n\t\t}\n\t}\n\n\t// setup context\n\tcontext := configContext{\n\t\tContext: contextData{\n\t\t\tCluster: c.Name,\n\t\t\tUser: c.Name,\n\t\t},\n\t\tName: c.Name,\n\t}\n\n\tconfig.CurrentContext = context.Name\n\n\tif config.Contexts == nil || len(config.Contexts) == 0 {\n\t\tconfig.Contexts = []configContext{context}\n\t} else {\n\t\texist := false\n\t\tfor _, context := range config.Contexts {\n\t\t\tif context.Name == c.Name {\n\t\t\t\texist = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !exist {\n\t\t\tconfig.Contexts = append(config.Contexts, context)\n\t\t}\n\t}\n\n\tdata, err := yaml.Marshal(config)\n\tif err != nil {\n\t\treturn nil, errors.WrapIf(err, \"marshaling kubernetes config failed\")\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "854b942d022d3bd645bce9b48448e70f", "score": "0.4662513", "text": "func (mr *MockConfigStoreManagerMockRecorder) FetchDynamicConfig(ctx interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"FetchDynamicConfig\", reflect.TypeOf((*MockConfigStoreManager)(nil).FetchDynamicConfig), ctx)\n}", "title": "" }, { "docid": "e593caf9357062c428ea383c17292399", "score": "0.46621874", "text": "func (c *FakeAddonConfigs) Update(addonConfig *kubermaticv1.AddonConfig) (result *kubermaticv1.AddonConfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootUpdateAction(addonconfigsResource, addonConfig), &kubermaticv1.AddonConfig{})\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*kubermaticv1.AddonConfig), err\n}", "title": "" }, { "docid": "9de19c0d68d2cffb3ecb270328026fbd", "score": "0.4660704", "text": "func (s *IMService) UpdateEntConvConfigs(ctx echo.Context) (err error) {\n\tentID := ctx.Get(middleware.AgentEntIDKey).(string)\n\tagentID := ctx.Get(middleware.AgentIDKey).(string)\n\tif !conf.IMConf.Debug {\n\t\tif msg := hasPerm(entID, agentID, \"agent_settings\", \"check_update_conversation_rule\"); msg != nil {\n\t\t\treturn noPermResp(ctx, msg)\n\t\t}\n\t}\n\n\treq := &UpdateConvConfigsReq{}\n\tif err = ctx.Bind(req); err != nil {\n\t\treturn\n\t}\n\n\tlog.Logger.Println(req.ConvConfigs.VisitorQueueConf)\n\n\tconfigs := req.ConvConfigs\n\tif configs != nil {\n\t\tif configs.EndingMessageConf != nil {\n\t\t\tif err := models.InsertOrUpdateEndMessage(db.Mysql, entID, configs.EndingMessageConf); err != nil {\n\t\t\t\treturn dbErrResp(ctx, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif configs.EndingConversationConf != nil {\n\t\t\tif err := models.InsertOrUpdateEndConversation(db.Mysql, entID, configs.EndingConversationConf); err != nil {\n\t\t\t\treturn dbErrResp(ctx, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif configs.VisitorQueueConf != nil {\n\t\t\tif err := models.InsertOrUpdateQueueConfig(db.Mysql, entID, configs.VisitorQueueConf); err != nil {\n\t\t\t\treturn dbErrResp(ctx, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif configs.ConversationQualityConf != nil {\n\t\t\tif err := models.InsertOrUpdateConversationQuality(db.Mysql, entID, configs.ConversationQualityConf); err != nil {\n\t\t\t\treturn dbErrResp(ctx, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif configs.ConversationTransferConf != nil {\n\t\t\tif err := models.InsertOrUpdateConversationTransfer(db.Mysql, entID, configs.ConversationTransferConf); err != nil {\n\t\t\t\treturn dbErrResp(ctx, err.Error())\n\t\t\t}\n\t\t}\n\t}\n\n\tresp, err := s.getConvConfigs(entID)\n\tif err != nil {\n\t\treturn dbErrResp(ctx, err.Error())\n\t}\n\n\treturn jsonResponse(ctx, &Resp{Code: 0, Body: resp})\n}", "title": "" }, { "docid": "18f09d5ea18720bd385dea7c4ebeefb8", "score": "0.4649728", "text": "func (s Set) UpdateConfig(ctx context.Context, siteID uint, config string) error {\n\tresp, err := s.UpdateConfigEndpoint(ctx, UpdateConfigRequest{SiteID: siteID, Config: config})\n\tif err != nil {\n\t\treturn err\n\t}\n\tresponse := resp.(UpdateConfigResponse)\n\treturn response.Err\n}", "title": "" }, { "docid": "8e454bbc763a2b6739dc1445287bedb7", "score": "0.46475318", "text": "func (c *Client) UpdateAutosalesConfigs(ids []int64, ac *AutosalesConfig) error {\n\treturn c.Update(AutosalesConfigModel, ids, ac)\n}", "title": "" }, { "docid": "b77f9cd032ea9ec8f715a69b34c28c4a", "score": "0.46358055", "text": "func (api *configurationsnapshotAPI) SyncSave(obj *cluster.ConfigurationSnapshotRequest) (*cluster.ConfigurationSnapshot, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tret, err := apicl.ClusterV1().ConfigurationSnapshot().Save(context.Background(), obj)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\t\t// Perform Get to update the cache\n\t\tnewObj, err := apicl.ClusterV1().ConfigurationSnapshot().Get(context.Background(), obj.GetObjectMeta())\n\t\tif err == nil {\n\t\t\tapi.ct.handleConfigurationSnapshotEvent(&kvstore.WatchEvent{Object: newObj, Type: kvstore.Updated})\n\t\t}\n\t\treturn ret, err\n\t}\n\tif api.localSyncSaveHandler != nil {\n\t\treturn api.localSyncSaveHandler(obj)\n\t}\n\treturn nil, fmt.Errorf(\"Action not implemented for local operation\")\n}", "title": "" }, { "docid": "9c00fd475ccab708eaceae8048d676fe", "score": "0.46230957", "text": "func (i *API) StoreConfig(config types.DistributedServiceCardStatus) {\n\ti.Lock()\n\tdefer i.Unlock()\n\ti.config = config\n}", "title": "" }, { "docid": "0339b091cf40ca2efcc9371e4d2223c4", "score": "0.4622806", "text": "func (h *Handler) UpdateConfig(config *multichannelfanout.Config) error {\n\tif config == nil {\n\t\treturn errors.New(\"nil config\")\n\t}\n\n\th.updateLock.Lock()\n\tdefer h.updateLock.Unlock()\n\n\tih := h.getMultiChannelFanoutHandler()\n\tif diff := ih.ConfigDiff(*config); diff != \"\" {\n\t\th.logger.Info(\"Updating config (-old +new)\", zap.String(\"diff\", diff))\n\t\tnewIh, err := ih.CopyWithNewConfig(*config)\n\t\tif err != nil {\n\t\t\th.logger.Info(\"Unable to update config\", zap.Error(err), zap.Any(\"config\", config))\n\t\t\treturn err\n\t\t}\n\t\th.setMultiChannelFanoutHandler(newIh)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25852f19834c18b99148b8635d1d5c16", "score": "0.46215752", "text": "func (sc *Config) UpdateConfig() {\n\tviper.Set(sc.confServerNameKey(), sc.Name)\n\tviper.Set(sc.confServerTypeKey(), sc.ServerType)\n\tviper.Set(sc.confLocationNameKey(), sc.LocationName)\n\tviper.Set(sc.confImageNameKey(), sc.ImageName)\n\tviper.Set(sc.confSSKPublicKeyID(), sc.SSHPublicKeyID)\n\tviper.Set(sc.confRoles(), sc.Roles)\n\n\tif sc.ID != 0 {\n\t\tviper.Set(sc.confIDKey(), sc.ID)\n\t}\n\n\tif sc.PublicIP != \"\" {\n\t\tviper.Set(sc.confPublicIPKey(), sc.PublicIP)\n\t}\n\n\tif sc.PrivateIP != \"\" {\n\t\tviper.Set(sc.confPrivateIPKey(), sc.PrivateIP)\n\t}\n\n\tif sc.RootPassword != \"\" {\n\t\tviper.Set(sc.confRootPasswordKey(), sc.RootPassword)\n\t}\n}", "title": "" }, { "docid": "f087f7e9ca61964f840f68c4fb5fc4f7", "score": "0.46121222", "text": "func Update(ctx context.Context) error {\n\tvar errs []error\n\tif _, err := cachedCfg.Update(ctx, nil); err != nil {\n\t\terrs = append(errs, err)\n\t}\n\tif err := updateProjects(ctx); err != nil {\n\t\terrs = append(errs, err)\n\t}\n\tif len(errs) > 0 {\n\t\treturn errors.NewMultiError(errs...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7b4ce8e28a0a0b0db9295a6ef8c308a", "score": "0.4610275", "text": "func (c *Config) updateHttpApiConfig(e *Engine) {\n\te.ErrorLog.Debug(\"config.go: updateHttpApiConfig\")\n\n\terr := c.updateRowCounts(e)\n\tif err != nil {\n\t\te.ErrorLog.Errorf(\"Error updating row counts: %v\", err)\n\t}\n\te.ErrorLog.Debug(\"config.go: updateHttpApiConfig: c.updateRowCounts done\")\n\n\tc.httpAPIConfigLock.Lock()\n\tdefer c.httpAPIConfigLock.Unlock()\n\n\tc.httpAPIConfig, err = c.generateConfigForHTTPAPI()\n\tif err != nil {\n\t\te.ErrorLog.Errorf(\"Error generating config for HTTP API: %v\", err)\n\t}\n\te.ErrorLog.Debug(\"config.go: updateHttpApiConfig: c.generateConfigForHttpAPI done\")\n\n\thash := sha1.Sum([]byte(c.httpAPIConfig))\n\tc.httpAPIConfigHash = hex.EncodeToString(hash[:8])\n}", "title": "" }, { "docid": "a8e79f0c925d4c83d15d2b266c76fed0", "score": "0.4605857", "text": "func (st DBstore) SaveAlertmanagerConfigurationWithCallback(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd, callback SaveCallback) error {\n\treturn st.SQLStore.WithTransactionalDbSession(ctx, func(sess *db.Session) error {\n\t\tconfig := models.AlertConfiguration{\n\t\t\tAlertmanagerConfiguration: cmd.AlertmanagerConfiguration,\n\t\t\tConfigurationHash: fmt.Sprintf(\"%x\", md5.Sum([]byte(cmd.AlertmanagerConfiguration))),\n\t\t\tConfigurationVersion: cmd.ConfigurationVersion,\n\t\t\tDefault: cmd.Default,\n\t\t\tOrgID: cmd.OrgID,\n\t\t\tCreatedAt: time.Now().Unix(),\n\t\t}\n\n\t\t// TODO: If we are more structured around how we seed configurations in the future, this can be a pure update instead of upsert. This should improve perf and code clarity.\n\t\tupsertSQL := st.SQLStore.GetDialect().UpsertSQL(\n\t\t\t\"alert_configuration\",\n\t\t\t[]string{\"org_id\"},\n\t\t\t[]string{\"alertmanager_configuration\", \"configuration_version\", \"created_at\", \"default\", \"org_id\", \"configuration_hash\"},\n\t\t)\n\t\tparams := append(make([]interface{}, 0), cmd.AlertmanagerConfiguration, cmd.ConfigurationVersion, config.CreatedAt, config.Default, config.OrgID, config.ConfigurationHash)\n\t\tif _, err := sess.SQL(upsertSQL, params...).Query(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thistoricConfig := models.HistoricConfigFromAlertConfig(config)\n\t\thistoricConfig.LastApplied = cmd.LastApplied\n\t\tif _, err := sess.Table(\"alert_configuration_history\").Insert(historicConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif _, err := st.deleteOldConfigurations(ctx, cmd.OrgID, ConfigRecordsLimit); err != nil {\n\t\t\tst.Logger.Warn(\"failed to delete old am configs\", \"org\", cmd.OrgID, \"error\", err)\n\t\t}\n\n\t\tif err := callback(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "db95350b8e869ee778b2c167f0c372f0", "score": "0.46016157", "text": "func UpdateConfig(authConfig model.AuthConfig) error {\n\tif authConfig.Provider == \"shibbolethconfig\" {\n\t\tauthConfig.ShibbolethConfig.IDPMetadataFilePath = IDPMetadataFile\n\t\tauthConfig.ShibbolethConfig.SPSelfSignedCertFilePath = selfSignedCertFile\n\t\tauthConfig.ShibbolethConfig.SPSelfSignedKeyFilePath = selfSignedKeyFile\n\t\tauthConfig.ShibbolethConfig.RancherAPIHost = GetRancherAPIHost()\n\t}\n\n\tnewProvider, err := initProviderWithConfig(&authConfig)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig: Cannot update the config, error initializing the provider %v\", err)\n\t\treturn err\n\t}\n\t//store the config to db\n\tlog.Infof(\"newProvider %v\", newProvider.GetName())\n\n\tproviderSettings := newProvider.GetSettings()\n\n\tgenObjConfig := make(map[string]map[string]string)\n\tgenObjConfig[newProvider.GetName()] = providerSettings\n\terr = updateSettings(genObjConfig, newProvider.GetProviderSecretSettings(), newProvider.GetName(), authConfig.Enabled)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig: Error Storing the provider settings %v\", err)\n\t\treturn err\n\t}\n\n\t//add the generic settings\n\tcommonSettings := make(map[string]string)\n\tcommonSettings[accessModeSetting] = authConfig.AccessMode\n\tcommonSettings[userTypeSetting] = newProvider.GetUserType()\n\tcommonSettings[identitySeparatorSetting] = newProvider.GetIdentitySeparator()\n\tcommonSettings[allowedIdentitiesSetting] = getAllowedIDString(authConfig.AllowedIdentities, newProvider.GetIdentitySeparator())\n\tcommonSettings[providerNameSetting] = authConfig.Provider\n\tcommonSettings[providerSetting] = authConfig.Provider\n\tcommonSettings[externalProviderSetting] = \"true\"\n\tcommonSettings[noIdentityLookupSupportedSetting] = strconv.FormatBool(!newProvider.IsIdentityLookupSupported())\n\terr = updateCommonSettings(commonSettings)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"UpdateConfig: Error Storing the common settings\")\n\t}\n\n\t//set the security setting last specifically\n\tcommonSettings = make(map[string]string)\n\tcommonSettings[securitySetting] = strconv.FormatBool(authConfig.Enabled)\n\tcommonSettings[authServiceConfigUpdateTimestamp] = time.Now().String()\n\terr = updateCommonSettings(commonSettings)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"UpdateConfig: Error Storing the provider securitySetting\")\n\t}\n\n\t//switch the in-memory provider\n\tif provider == nil {\n\t\tif authConfig.Provider == \"shibbolethconfig\" {\n\t\t\tSamlServiceProvider = authConfig.ShibbolethConfig.SamlServiceProvider\n\t\t}\n\t\tprovider = newProvider\n\t\tauthConfigInMemory = authConfig\n\t} else {\n\t\t//reload the in-memory provider\n\t\tlog.Infof(\"Calling reload\")\n\t\tskipped, err := Reload(true)\n\t\tfor skipped {\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to reload the auth provider from db on updateConfig: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttime.Sleep(30 * time.Millisecond)\n\t\t\tskipped, err = Reload(true)\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to reload the auth provider from db on updateConfig: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c08de72944ca08de59ed20f0dbb1dae6", "score": "0.45970625", "text": "func (r *AndroidManagedStoreAccountEnterpriseSettingsRequest) Update(ctx context.Context, reqObj *AndroidManagedStoreAccountEnterpriseSettings) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "a40fb7e082358356bfb603659a4030c7", "score": "0.45900628", "text": "func (dn *Daemon) triggerUpdateWithMachineConfig(currentConfig *mcfgv1.MachineConfig, desiredConfig *mcfgv1.MachineConfig) error {\n\tif currentConfig == nil {\n\t\tccAnnotation, err := getNodeAnnotation(dn.node, constants.CurrentMachineConfigAnnotationKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcurrentConfig, err = getMachineConfig(dn.client.MachineconfigurationV1().MachineConfigs(), ccAnnotation)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif desiredConfig == nil {\n\t\tdcAnnotation, err := getNodeAnnotation(dn.node, constants.DesiredMachineConfigAnnotationKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdesiredConfig, err = getMachineConfig(dn.client.MachineconfigurationV1().MachineConfigs(), dcAnnotation)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// run the update process. this function doesn't currently return.\n\treturn dn.update(currentConfig, desiredConfig)\n}", "title": "" }, { "docid": "48ac701e1aa31eb2dc69c9ad0d0947d2", "score": "0.4578065", "text": "func (c *Config) UpdateRules() error {\n\tcfg, err := c.readConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.parseRules(cfg)\n}", "title": "" }, { "docid": "ca74f8f21c479e78aeaef9742d7dafb9", "score": "0.45761847", "text": "func (n *NodeManager) ConfigRefresh(node OsqueryNode, lastIp string, incBytes int) error {\n\tupdates := map[string]interface{}{\n\t\t\"last_config\": time.Now(),\n\t\t\"bytes_received\": node.BytesReceived + incBytes,\n\t}\n\tif lastIp != \"\" {\n\t\tupdates[\"ip_address\"] = lastIp\n\t}\n\tif err := n.DB.Model(&node).Updates(updates).Error; err != nil {\n\t\treturn fmt.Errorf(\"Updates %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1244eec078a4bd6eec37b6bf145c52a6", "score": "0.45745158", "text": "func (op *updateGoogleChannelConfigUpdateGoogleChannelConfigOperation) do(ctx context.Context, r *GoogleChannelConfig, c *Client) error {\n\t_, err := c.GetGoogleChannelConfig(ctx, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err := r.updateURL(c.Config.BasePath, \"UpdateGoogleChannelConfig\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tmask := dcl.UpdateMask(op.FieldDiffs)\n\tu, err = dcl.AddQueryParams(u, map[string]string{\"updateMask\": mask})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := newUpdateGoogleChannelConfigUpdateGoogleChannelConfigRequest(ctx, r, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Config.Logger.InfoWithContextf(ctx, \"Created update: %#v\", req)\n\tbody, err := marshalUpdateGoogleChannelConfigUpdateGoogleChannelConfigRequest(c, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dcl.SendRequest(ctx, c.Config, \"PATCH\", u, bytes.NewBuffer(body), c.Config.RetryProvider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "438135264728d6eadb43e782c8d77094", "score": "0.4569022", "text": "func ConfigUpdateHandler(w http.ResponseWriter, r *http.Request) {\n\tupdateConfig(w, r, updateConfigURL)\n}", "title": "" }, { "docid": "ae0f0d9ef95449f37dae6fcaca5c9477", "score": "0.4556807", "text": "func (c *Client) DatacenterConfigUpdate(datacenterName string, datacenterConfig DatacenterConfig) error {\n\n\tresp, err := c.rpcClient.Call(\n\t\t\"datacenter_config_update\",\n\t\tdatacenterName,\n\t\tdatacenterConfig,\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Error != nil {\n\t\treturn fmt.Errorf(resp.Error.Message)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b63d8d3072431a52f5297ae0f48206ad", "score": "0.45556092", "text": "func (e *aksOperatorController) updateAKSClusterConfig(cluster *apimgmtv3.Cluster, aksClusterConfigDynamic *unstructured.Unstructured, spec map[string]interface{}) (*apimgmtv3.Cluster, error) {\n\tlist, err := e.DynamicClient.Namespace(namespace.GlobalNamespace).List(context.TODO(), v1.ListOptions{})\n\tif err != nil {\n\t\treturn cluster, err\n\t}\n\tselector := fields.OneTermEqualSelector(\"metadata.name\", cluster.Name)\n\tw, err := e.DynamicClient.Namespace(namespace.GlobalNamespace).Watch(context.TODO(), v1.ListOptions{ResourceVersion: list.GetResourceVersion(), FieldSelector: selector.String()})\n\tif err != nil {\n\t\treturn cluster, err\n\t}\n\taksClusterConfigDynamic.Object[\"spec\"] = spec\n\taksClusterConfigDynamic, err = e.DynamicClient.Namespace(namespace.GlobalNamespace).Update(context.TODO(), aksClusterConfigDynamic, v1.UpdateOptions{})\n\tif err != nil {\n\t\treturn cluster, err\n\t}\n\n\t// AKS cluster and node pool statuses are not always immediately updated. This cause the AKSConfig to\n\t// stay in \"active\" for a few seconds, causing the cluster to go back to \"active\".\n\ttimeout := time.NewTimer(10 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase event := <-w.ResultChan():\n\t\t\tvar ok bool\n\t\t\tif aksClusterConfigDynamic, ok = event.Object.(*unstructured.Unstructured); !ok {\n\t\t\t\treturn cluster, fmt.Errorf(\"unexpected nil cluster config\")\n\t\t\t}\n\t\t\tstatus, _ := aksClusterConfigDynamic.Object[\"status\"].(map[string]interface{})\n\t\t\tif status[\"phase\"] == \"active\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// this enqueue is necessary to ensure that the controller is reentered with the updating phase\n\t\t\te.ClusterEnqueueAfter(cluster.Name, enqueueTime)\n\t\t\treturn e.SetUnknown(cluster, apimgmtv3.ClusterConditionUpdated, \"\")\n\t\tcase <-timeout.C:\n\t\t\tcluster, err = e.recordAppliedSpec(cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn cluster, err\n\t\t\t}\n\t\t\treturn cluster, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d2bc8e3acea825f511f4036fa0e391c7", "score": "0.45447096", "text": "func (a *apiServer) updateConfig(config *auth.AuthConfig) error {\n\tif config != nil {\n\t\tnewConfig, err := validateConfig(config, internal)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ta.configCache = newConfig\n\t} else {\n\t\ta.configCache = nil\n\t}\n\tif a.configCache != nil && a.configCache.IDPName != \"\" {\n\t\t// construct SAML handler\n\t\ta.samlSP = &saml.ServiceProvider{\n\t\t\tLogger: logrus.New(),\n\t\t\tIDPMetadata: a.configCache.IDPMetadata,\n\t\t\tAcsURL: *a.configCache.ACSURL,\n\t\t\tMetadataURL: *a.configCache.MetadataURL,\n\n\t\t\t// Not set:\n\t\t\t// Key: Private key for Pachyderm ACS. Unclear if needed\n\t\t\t// Certificate: Public key for Pachyderm ACS. Unclear if needed\n\t\t\t// ForceAuthn: (whether users need to re-authenticate with the IdP, even\n\t\t\t// if they already have a session--leaving this false)\n\t\t\t// AuthnNameIDFormat: (format the ACS expects the AuthnName to be in)\n\t\t\t// MetadataValidDuration: (how long the SP endpoints are valid? Returned\n\t\t\t// by the Metadata service)\n\t\t}\n\t\ta.redirectAddress = a.configCache.DashURL // Set redirect address from config as well\n\t} else {\n\t\ta.samlSP = nil\n\t\ta.redirectAddress = nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f898c8c4d82a3141cc8189c7d56162e9", "score": "0.4542941", "text": "func (c *updateConfigCmd) Run(k *kong.Context, logger logging.Logger) error {\n\tlogger = logger.WithValues(\"Name\", c.Name)\n\tkubeConfig, err := ctrl.GetConfig()\n\tif err != nil {\n\t\tlogger.Debug(errKubeConfig, \"error\", err)\n\t\treturn errors.Wrap(err, errKubeConfig)\n\t}\n\tlogger.Debug(\"Found kubeconfig\")\n\tkube, err := typedclient.NewForConfig(kubeConfig)\n\tif err != nil {\n\t\tlogger.Debug(errKubeClient, \"error\", err)\n\t\treturn errors.Wrap(err, errKubeClient)\n\t}\n\tlogger.Debug(\"Created kubernetes client\")\n\tprevConf, err := kube.Configurations().Get(context.Background(), c.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\terr = warnIfNotFound(err)\n\t\tlogger.Debug(\"Failed to update configuration\", \"error\", err)\n\t\treturn errors.Wrap(err, \"cannot update configuration\")\n\t}\n\tlogger.Debug(\"Found previous configuration object\")\n\tpkg := prevConf.Spec.Package\n\tpkgReference, err := name.ParseReference(pkg, name.WithDefaultRegistry(\"\"))\n\tif err != nil {\n\t\terr = warnIfNotFound(err)\n\t\tlogger.Debug(\"Failed to update configuration\", \"error\", err)\n\t\treturn errors.Wrap(err, \"cannot update configuration\")\n\t}\n\tnewPkg := \"\"\n\tif strings.HasPrefix(c.Tag, \"sha256\") {\n\t\tnewPkg = pkgReference.Context().Digest(c.Tag).Name()\n\t} else {\n\t\tnewPkg = pkgReference.Context().Tag(c.Tag).Name()\n\t}\n\tprevConf.Spec.Package = newPkg\n\treq, err := json.Marshal(prevConf)\n\tif err != nil {\n\t\terr = warnIfNotFound(err)\n\t\tlogger.Debug(\"Failed to update configuration\", \"error\", err)\n\t\treturn errors.Wrap(err, \"cannot update configuration\")\n\t}\n\tres, err := kube.Configurations().Patch(context.Background(), c.Name, types.MergePatchType, req, metav1.PatchOptions{})\n\tif err != nil {\n\t\terr = warnIfNotFound(err)\n\t\tlogger.Debug(\"Failed to update configuration\", \"error\", err)\n\t\treturn errors.Wrap(err, \"cannot update configuration\")\n\t}\n\t_, err = fmt.Fprintf(k.Stdout, \"%s/%s updated\\n\", strings.ToLower(v1.ConfigurationGroupKind), res.GetName())\n\treturn err\n}", "title": "" }, { "docid": "070c8fd208dc6df0d4d17ad89de3b64c", "score": "0.45350558", "text": "func (cfg *Config) Sync() (err error) {\n\tif !filepath.IsAbs(cfg.ConfigPath) {\n\t\tcfg.ConfigPath, err = filepath.Abs(cfg.ConfigPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tcfg.UpdatedAt = time.Now().UTC()\n\tvar d []byte\n\td, err = yaml.Marshal(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"writing to:\", cfg.ConfigPath)\n\treturn ioutil.WriteFile(cfg.ConfigPath, d, 0600)\n}", "title": "" }, { "docid": "12a7dc553fb97390af1fa0261151f525", "score": "0.45222738", "text": "func (c *Config) Update(c2 Config) {\n\tif c2.ClientID != \"\" {\n\t\tc.ClientID = c2.ClientID\n\t}\n\tif c2.Quality != \"\" {\n\t\tc.Quality = c2.Quality\n\t}\n\tif c2.StartTime != \"\" {\n\t\tc.StartTime = c2.StartTime\n\t}\n\tif c2.EndTime != \"\" {\n\t\tc.EndTime = c2.EndTime\n\t}\n\tif c2.Length != \"\" {\n\t\tc.EndTime = c2.Length\n\t}\n\tif c2.VodID != 0 {\n\t\tc.VodID = c2.VodID\n\t}\n\tif c2.FilePrefix != \"\" {\n\t\tc.FilePrefix = c2.FilePrefix\n\t}\n\tif c2.OutputFolder != \"\" {\n\t\tc.OutputFolder = c2.OutputFolder\n\t}\n\tif c2.Workers != 0 {\n\t\tc.Workers = c2.Workers\n\t}\n}", "title": "" }, { "docid": "9b187c1a853a775eb4437ac786fde994", "score": "0.45087293", "text": "func (_m *Resolver) UpdateAddonsConfiguration(ctx context.Context, name string, namespace string, repositories []*gqlschema.AddonsConfigurationRepositoryInput, urls []string, labels gqlschema.Labels) (*gqlschema.AddonsConfiguration, error) {\n\tvar r0 *gqlschema.AddonsConfiguration\n\tvar r1 error\n\tr1 = _m.err\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "7443e7b70d230481a15b45ba3f7410d7", "score": "0.45004672", "text": "func (dbc *DatabaseCfg) UpdateSnmpMetricCfg(id string, dev SnmpMetricCfg) (int64, error) {\n\tvar affecteddev, affected int64\n\tvar err error\n\t// create SnmpMetricCfg to check if any configuration issue found before persist to database.\n\terr = dev.Init()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t// initialize data persistence\n\tsession := dbc.x.NewSession()\n\tif err := session.Begin(); err != nil {\n\t\t// if returned then will rollback automatically\n\t\treturn 0, err\n\t}\n\tdefer session.Close()\n\n\tif id != dev.ID { // ID has been changed\n\t\taffecteddev, err = session.Where(\"id_metric_cfg='\" + id + \"'\").Cols(\"id_metric_cfg\").Update(&MeasurementFieldCfg{IDMetricCfg: dev.ID})\n\t\tif err != nil {\n\t\t\tsession.Rollback()\n\t\t\treturn 0, fmt.Errorf(\"Error Update Metric id(old) %s with (new): %s, error: %s\", id, dev.ID, err)\n\t\t}\n\t\tlog.Infof(\"Updated SnmpMetric Config to %d devices \", affecteddev)\n\t}\n\n\taffected, err = session.Where(\"id='\" + id + \"'\").UseBool().AllCols().Update(dev)\n\tif err != nil {\n\t\tsession.Rollback()\n\t\treturn 0, err\n\t}\n\terr = session.Commit()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tlog.Infof(\"Updated SnmpMetric Config Successfully with id %s and data:%+v, affected\", id, dev)\n\tdbc.addChanges(affected + affecteddev)\n\treturn affected, nil\n}", "title": "" }, { "docid": "195522b8e543553a07b2f0545975e7cd", "score": "0.44997087", "text": "func (_m *Resolver) UpdateClusterAddonsConfiguration(ctx context.Context, name string, repositories []*gqlschema.AddonsConfigurationRepositoryInput, urls []string, labels gqlschema.Labels) (*gqlschema.AddonsConfiguration, error) {\n\tvar r0 *gqlschema.AddonsConfiguration\n\tvar r1 error\n\tr1 = _m.err\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "d24eb40f7462ec440db52f136ac05765", "score": "0.4497957", "text": "func UpdateAll(config *latest.Config, cache *generated.Config, allowCyclic bool, log log.Logger) error {\n\tif config == nil || config.Dependencies == nil || len(*config.Dependencies) == 0 {\n\t\treturn nil\n\t}\n\n\tlog.StartWait(\"Update dependencies\")\n\tdefer log.StopWait()\n\n\t// Create a new dependency resolver\n\tresolver, err := NewResolver(config, cache, allowCyclic, log)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"new resolver\")\n\t}\n\n\t// Resolve all dependencies\n\t_, err = resolver.Resolve(*config.Dependencies, true)\n\tif err != nil {\n\t\tif _, ok := err.(*CyclicError); ok {\n\t\t\treturn fmt.Errorf(\"%v.\\n To allow cyclic dependencies run with the '%s' flag\", err, ansi.Color(\"--allow-cyclic\", \"white+b\"))\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ae7ced2f24a24854c1dbad8490819068", "score": "0.44957665", "text": "func updateConfigValues() bool {\n leftModules := getConfValue(\"main;modules_left\", \"\")\n centerModules := getConfValue(\"main;modules_center\", \"\")\n rightModules := getConfValue(\"main;modules_right\", \"\")\n\n if leftModules == \"\" && centerModules == \"\" && rightModules == \"\" {\n leftModules = defaultEnabledModules[0]\n centerModules = defaultEnabledModules[1]\n rightModules = defaultEnabledModules[2]\n }\n\n paddingLeft := getConfInt(\"main;left_padding\", 0)\n paddingRight := getConfInt(\"main;right_padding\", 0)\n\n seperator := getConfValue(\"main;item_seperator\", \"|\")\n\n if leftModules != enabledModules[0] || centerModules != enabledModules[1] ||\n rightModules != enabledModules[2] {\n enabledModules[0] = leftModules\n enabledModules[1] = centerModules\n enabledModules[2] = rightModules\n return true\n }\n\n if paddingLeft != leftPadding || paddingRight != rightPadding {\n leftPadding = paddingLeft\n rightPadding = paddingRight\n return true\n }\n\n if seperator != elementSeperator {\n elementSeperator = seperator\n return true\n }\n\n return false\n}", "title": "" }, { "docid": "45255c755c52878d8ad5e2e879a90410", "score": "0.44949993", "text": "func (c *restClient) UpdateKmsConfig(ctx context.Context, req *netapppb.UpdateKmsConfigRequest, opts ...gax.CallOption) (*UpdateKmsConfigOperation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tbody := req.GetKmsConfig()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v\", req.GetKmsConfig().GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tif req.GetUpdateMask() != nil {\n\t\tupdateMask, err := protojson.Marshal(req.GetUpdateMask())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tparams.Add(\"updateMask\", string(updateMask[1:len(updateMask)-1]))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"kms_config.name\", url.QueryEscape(req.GetKmsConfig().GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &longrunningpb.Operation{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"PATCH\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toverride := fmt.Sprintf(\"/v1/%s\", resp.GetName())\n\treturn &UpdateKmsConfigOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "title": "" }, { "docid": "001ad16df9c3a9a5bdd6f2fe92127e50", "score": "0.4486", "text": "func Update(ctx context.Context) error {\n\t_, err := cachedAllowlistCfg.Update(ctx, nil)\n\treturn err\n}", "title": "" }, { "docid": "f57628835414f1244ee748b4edc4ba99", "score": "0.4482323", "text": "func (api *clusterAPI) SyncUpdateTLSConfig(obj *cluster.UpdateTLSConfigRequest) (*cluster.Cluster, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tret, err := apicl.ClusterV1().Cluster().UpdateTLSConfig(context.Background(), obj)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\t\t// Perform Get to update the cache\n\t\tnewObj, err := apicl.ClusterV1().Cluster().Get(context.Background(), obj.GetObjectMeta())\n\t\tif err == nil {\n\t\t\tapi.ct.handleClusterEvent(&kvstore.WatchEvent{Object: newObj, Type: kvstore.Updated})\n\t\t}\n\t\treturn ret, err\n\t}\n\tif api.localSyncUpdateTLSConfigHandler != nil {\n\t\treturn api.localSyncUpdateTLSConfigHandler(obj)\n\t}\n\treturn nil, fmt.Errorf(\"Action not implemented for local operation\")\n}", "title": "" }, { "docid": "a13928a8fa9420a988d46a4a63be8562", "score": "0.44773027", "text": "func (e *eksOperatorController) updateEKSClusterConfig(cluster *mgmtv3.Cluster, eksClusterConfigDynamic *unstructured.Unstructured, spec map[string]interface{}) (*mgmtv3.Cluster, error) {\n\tlist, err := e.DynamicClient.Namespace(namespace.GlobalNamespace).List(context.TODO(), v1.ListOptions{})\n\tif err != nil {\n\t\treturn cluster, err\n\t}\n\tselector := fields.OneTermEqualSelector(\"metadata.name\", cluster.Name)\n\tw, err := e.DynamicClient.Namespace(namespace.GlobalNamespace).Watch(context.TODO(), v1.ListOptions{ResourceVersion: list.GetResourceVersion(), FieldSelector: selector.String()})\n\tif err != nil {\n\t\treturn cluster, err\n\t}\n\teksClusterConfigDynamic.Object[\"spec\"] = spec\n\teksClusterConfigDynamic, err = e.DynamicClient.Namespace(namespace.GlobalNamespace).Update(context.TODO(), eksClusterConfigDynamic, v1.UpdateOptions{})\n\tif err != nil {\n\t\treturn cluster, err\n\t}\n\n\t// EKS cluster and node group statuses are not always immediately updated. This cause the EKSConfig to\n\t// stay in \"active\" for a few seconds, causing the cluster to go back to \"active\".\n\ttimeout := time.NewTimer(10 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase event := <-w.ResultChan():\n\t\t\teksClusterConfigDynamic = event.Object.(*unstructured.Unstructured)\n\t\t\tstatus, _ := eksClusterConfigDynamic.Object[\"status\"].(map[string]interface{})\n\t\t\tif status[\"phase\"] == \"active\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// this enqueue is necessary to ensure that the controller is reentered with the updating phase\n\t\t\te.ClusterEnqueueAfter(cluster.Name, enqueueTime)\n\t\t\treturn e.SetUnknown(cluster, apimgmtv3.ClusterConditionUpdated, \"\")\n\t\tcase <-timeout.C:\n\t\t\tcluster, err = e.recordAppliedSpec(cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn cluster, err\n\t\t\t}\n\t\t\treturn cluster, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "05ae2a42607a7c55838624e4965fc39f", "score": "0.44720107", "text": "func (c *Client) UpdateAutosalesConfig(ac *AutosalesConfig) error {\n\treturn c.UpdateAutosalesConfigs([]int64{ac.Id.Get()}, ac)\n}", "title": "" }, { "docid": "a7bad2e4b8145eebe3c1fc5d251471f1", "score": "0.44713125", "text": "func (c *FakeRBACSyncConfigs) Update(ctx context.Context, rBACSyncConfig *v1alpha.RBACSyncConfig, opts v1.UpdateOptions) (result *v1alpha.RBACSyncConfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(rbacsyncconfigsResource, c.ns, rBACSyncConfig), &v1alpha.RBACSyncConfig{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha.RBACSyncConfig), err\n}", "title": "" } ]
38c263ce9d0b720df8d4f8594dff347f
GetRumQuery returns the RumQuery field value if set, zero value otherwise.
[ { "docid": "d3580c91b3fcd8c3bb7ded99195d1346", "score": "0.80381596", "text": "func (o *ChangeWidgetRequest) GetRumQuery() LogQueryDefinition {\n\tif o == nil || o.RumQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.RumQuery\n}", "title": "" } ]
[ { "docid": "64a1f0a5dc7cdf3af0179892ab30e8fb", "score": "0.80275047", "text": "func (o *ScatterPlotRequest) GetRumQuery() LogQueryDefinition {\n\tif o == nil || o.RumQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.RumQuery\n}", "title": "" }, { "docid": "0b8e60e5c308b6964bd9aca3e8e74064", "score": "0.7243668", "text": "func (o *ChangeWidgetRequest) SetRumQuery(v LogQueryDefinition) {\n\to.RumQuery = &v\n}", "title": "" }, { "docid": "399ecf603571bec4b50032f6696a595d", "score": "0.716469", "text": "func (o *ScatterPlotRequest) SetRumQuery(v LogQueryDefinition) {\n\to.RumQuery = &v\n}", "title": "" }, { "docid": "8fafe81d955a338ab076ee4fe0e3b8fc", "score": "0.7075839", "text": "func (o *ChangeWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) {\n\tif o == nil || o.RumQuery == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RumQuery, true\n}", "title": "" }, { "docid": "e31ff34f02fe584b79aa78f299f03fab", "score": "0.69701606", "text": "func (o *ScatterPlotRequest) GetRumQueryOk() (*LogQueryDefinition, bool) {\n\tif o == nil || o.RumQuery == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RumQuery, true\n}", "title": "" }, { "docid": "d711852738c65158f7bc43346105a82d", "score": "0.6378365", "text": "func (o *ChangeWidgetRequest) HasRumQuery() bool {\n\tif o != nil && o.RumQuery != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3963f1ba087860a5f029a6e398ec7ff4", "score": "0.6233959", "text": "func (o *ScatterPlotRequest) HasRumQuery() bool {\n\tif o != nil && o.RumQuery != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "200ca40fd5babd8336ec66ef97ab0811", "score": "0.5411137", "text": "func RQ() *RelationQuery {\n\treturn &RelationQuery{\n\t\tPopOp: &PopulationOption{},\n\t}\n}", "title": "" }, { "docid": "8703451cac5de58cd11758b6c95ce2d5", "score": "0.5353904", "text": "func (x MobileApplicationEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "cf2f5a0b05f0321186c4c4056c792d86", "score": "0.5331801", "text": "func (x ApmApplicationEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "f0ba6ad652f71de96e458465432ffc6b", "score": "0.5323749", "text": "func (o *MonitorSummaryWidgetDefinition) GetQuery() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn o.Query\n}", "title": "" }, { "docid": "7cadc7e265c65b8ae5e8dfa664876349", "score": "0.5300276", "text": "func (x SyntheticMonitorEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "b9759676c1dc3f328827a5685886754e", "score": "0.52725494", "text": "func (h *handler) getIntQuery(query string, defaultValue uint64) (value uint64) {\n\tvalue = defaultValue\n\tq := h.getQuery(query)\n\tif q != \"\" {\n\t\tvalue, _ = strconv.ParseUint(q, 10, 64)\n\t}\n\treturn\n}", "title": "" }, { "docid": "009d0da19bfa9505e86cebe467bfc89f", "score": "0.52564174", "text": "func (x ApmExternalServiceEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "54813816a9d533f3944421ea2d66c905", "score": "0.52222633", "text": "func (x WorkloadEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "20d23b06e7022b64e2a1d563a6a07c33", "score": "0.52177495", "text": "func (x UnavailableEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "aa72e6f4dfe66282931f2fb2816e11b6", "score": "0.52034277", "text": "func (x DashboardEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "0939887b0b6298949df451f4abd3627c", "score": "0.51954293", "text": "func (x ExternalEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "234dc7c3bd883ce580faeb4b8df80de5", "score": "0.5190305", "text": "func (x ApmAgentInstrumentedServiceEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "2b71c044189471f177438c276c5bc287", "score": "0.5184514", "text": "func (x InfrastructureHostEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "86d759d8f1e07b036511b1f048541322", "score": "0.51728487", "text": "func (x ServiceEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "df661c80ff2b73fcceebde66a872c60b", "score": "0.51466095", "text": "func (x BrowserApplicationEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "b25dbed724abcce2130d490565f8844a", "score": "0.5124213", "text": "func (h *handler) getIntQuery(query string, defaultValue uint64) (value uint64) {\n\treturn getRestrictedIntQuery(h.rq.URL.Query(), query, defaultValue, 0, 0, false)\n}", "title": "" }, { "docid": "6bc3b919bc64a59b4698e8935417708b", "score": "0.51111007", "text": "func (x GenericEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "6466e78c021e4ab2e713e1807e4dec73", "score": "0.51049423", "text": "func (x ApmDatabaseInstanceEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "b2fd01e6d03796f7399be645d3808eb0", "score": "0.5069739", "text": "func (x GenericServiceEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "25a934aacdddf6b6dd2ae2a4e198c09c", "score": "0.50220746", "text": "func (o *ChangeWidgetRequest) GetApmQuery() LogQueryDefinition {\n\tif o == nil || o.ApmQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.ApmQuery\n}", "title": "" }, { "docid": "f3bfdcd2c7d391d7b2af24200082f611", "score": "0.5015693", "text": "func (x GenericInfrastructureEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "673ef1c9a5367e2b7ca692a197959f61", "score": "0.5007646", "text": "func (i *InvokeWithTakeoutRequest) GetQuery() (value bin.Object) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Query\n}", "title": "" }, { "docid": "cf34335a3aea3aa2b730d10715e26509", "score": "0.49790663", "text": "func (m *JetCoordinatorMock) QueryRoleMinimockPreCounter() uint64 {\n\treturn atomic.LoadUint64(&m.QueryRolePreCounter)\n}", "title": "" }, { "docid": "7bbc2fa97c58c658613469b94aa8f3bc", "score": "0.49600017", "text": "func (x ThirdPartyServiceEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "4ec499707a04408ba4112f6e81406164", "score": "0.49532548", "text": "func (s *SlidingWindowAggregationDeque) Query() E {\r\n\tif len(s.leftSum) == 0 && len(s.rightSum) == 0 {\r\n\t\treturn s.e()\r\n\t}\r\n\tif len(s.rightSum) == 0 {\r\n\t\treturn s.leftSum[len(s.leftSum)-1]\r\n\t}\r\n\tif len(s.leftSum) == 0 {\r\n\t\treturn s.rightSum[len(s.rightSum)-1]\r\n\t}\r\n\treturn s.op(s.leftSum[len(s.leftSum)-1], s.rightSum[len(s.rightSum)-1])\r\n}", "title": "" }, { "docid": "7ae5ab57f13c3c04c28b67f4a002559b", "score": "0.49480093", "text": "func (m *JetCoordinatorMock) QueryRoleMinimockCounter() uint64 {\n\treturn atomic.LoadUint64(&m.QueryRoleCounter)\n}", "title": "" }, { "docid": "53d8ee3e68000ab6c8c68d8c5d15e7e6", "score": "0.48572728", "text": "func (g *GetInlineQueryResultsRequest) GetQuery() (value string) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Query\n}", "title": "" }, { "docid": "48e5db3ce29adfcda25fcc8c60b021f3", "score": "0.48571008", "text": "func (o *ServiceLevelObjectiveRequest) GetQuery() ServiceLevelObjectiveQuery {\n\tif o == nil || o.Query == nil {\n\t\tvar ret ServiceLevelObjectiveQuery\n\t\treturn ret\n\t}\n\treturn *o.Query\n}", "title": "" }, { "docid": "7a46924789c10470233e3d9af8a383bf", "score": "0.4854069", "text": "func (v *PollForDecisionTaskResponse) GetQuery() (o *shared.WorkflowQuery) {\n\tif v != nil && v.Query != nil {\n\t\treturn v.Query\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "eaa9ce23032bc2216c8bbca9457b22a8", "score": "0.48074582", "text": "func (o *ChangeWidgetRequest) GetProcessQuery() ProcessQueryDefinition {\n\tif o == nil || o.ProcessQuery == nil {\n\t\tvar ret ProcessQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.ProcessQuery\n}", "title": "" }, { "docid": "fe4c709b9843821c51df3ab153dd9a29", "score": "0.47069842", "text": "func (x *SearchResponse_Diagnostics) GetDrillDownQuery() string {\n\tif x != nil {\n\t\treturn x.DrillDownQuery\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "09e7416462b5bd051c2f0ee380a6a84d", "score": "0.468927", "text": "func GetQueryValue(name string, w http.ResponseWriter, r *http.Request) string {\n\tquery, err := url.ParseQuery(r.URL.RawQuery)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tlogging.LogHttpErr(w, r, fmt.Errorf(\"Query parse error\"), http.StatusInternalServerError)\n\t\treturn \"\"\n\t}\n\tvalue := query.Get(name)\n\tif len(value) == 0 || value == \"\" {\n\t\tlog.Println(err)\n\t\tlogging.LogHttpErr(w, r, fmt.Errorf(\"Must specify %s\", name), http.StatusBadRequest)\n\t\treturn \"\"\n\t}\n\treturn value\n}", "title": "" }, { "docid": "e46dde90725b52f4b8d03194ef3deb7c", "score": "0.46813732", "text": "func (o *ScatterPlotRequest) GetApmQuery() LogQueryDefinition {\n\tif o == nil || o.ApmQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.ApmQuery\n}", "title": "" }, { "docid": "4f700b6646ce76ab0b976a6df23265d5", "score": "0.46293873", "text": "func (p *Prom) Query(query string, testTime time.Time) (model.SampleValue, error) {\n\tout, warnings, err := p.API.Query(context.Background(), query, testTime)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif len(warnings) != 0 {\n\t\tlog.Debugf(\"prometheus query warnings: %v\", warnings)\n\t}\n\tif len(out.(model.Vector)) != 1 {\n\t\tlog.Debugf(\"prometheus query (%s) has no data at time %v\", query, testTime)\n\t\treturn 0, nil\n\t}\n\treturn out.(model.Vector)[0].Value, err\n}", "title": "" }, { "docid": "2ef070f1d604ff98f2f5f12d8653587d", "score": "0.4623247", "text": "func (o *ChangeWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) {\n\tif o == nil || o.ApmQuery == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ApmQuery, true\n}", "title": "" }, { "docid": "835006510e9fb78e54f83c59a9201a18", "score": "0.4619425", "text": "func (o *ChangeWidgetRequest) GetLogQuery() LogQueryDefinition {\n\tif o == nil || o.LogQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.LogQuery\n}", "title": "" }, { "docid": "abcc8854aa47eb53ee3b8bffb4121c11", "score": "0.46080372", "text": "func (o *MonitorSummaryWidgetDefinition) GetQueryOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Query, true\n}", "title": "" }, { "docid": "e2959fec2fc1c9350f39a27194b11b0c", "score": "0.4597289", "text": "func (g *GetChatJoinRequestsRequest) GetQuery() (value string) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Query\n}", "title": "" }, { "docid": "1fd920116cf39d5d1c0c56d9530c008d", "score": "0.45966566", "text": "func (qp *QueryParams) RawQuery() string {\n\treturn qp.query\n}", "title": "" }, { "docid": "f66ff44b0942a1cd1dd7fc707e496020", "score": "0.45909187", "text": "func (o *ExportRuleGetIterRequest) Query() ExportRuleGetIterRequestQuery {\n\tvar r ExportRuleGetIterRequestQuery\n\tif o.QueryPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.QueryPtr\n\treturn r\n}", "title": "" }, { "docid": "57fb6192f44f67222092e02ef2f5c836", "score": "0.4586311", "text": "func GetQueryValue(r *http.Request, param string) (bool, string) {\n\tif values := r.URL.Query()[param]; len(values) > 0 {\n\t\treturn true, values[0]\n\t}\n\n\treturn false, \"\"\n}", "title": "" }, { "docid": "58256133ce7a1cc4cb944a16d9ab8aa9", "score": "0.4583696", "text": "func (r *Resolver) SystemQuery() generated.SystemQueryResolver { return &systemQueryResolver{r} }", "title": "" }, { "docid": "2b8015d0e859f1edcae6410cd0ab41ea", "score": "0.45726767", "text": "func (client *ClientImpl) GetPullRequestQuery(ctx context.Context, args GetPullRequestQueryArgs) (*GitPullRequestQuery, error) {\n\tif args.Queries == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.Queries\"}\n\t}\n\trouteValues := make(map[string]string)\n\tif args.Project != nil && *args.Project != \"\" {\n\t\trouteValues[\"project\"] = *args.Project\n\t}\n\tif args.RepositoryId == nil || *args.RepositoryId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RepositoryId\"}\n\t}\n\trouteValues[\"repositoryId\"] = *args.RepositoryId\n\n\tbody, marshalErr := json.Marshal(*args.Queries)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"b3a6eebe-9cf0-49ea-b6cb-1a4c5f5007b0\")\n\tresp, err := client.Client.Send(ctx, http.MethodPost, locationId, \"5.1\", routeValues, nil, bytes.NewReader(body), \"application/json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue GitPullRequestQuery\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "1b2e13b813eeaa6e0d2da672c9b843ed", "score": "0.4572149", "text": "func RunQuery(ctx context.Context, logger *logging.BaseLogger, promAPI v1.API, metric string, names test.ResourceNames) float64 {\n\tquery := fmt.Sprintf(\"%s{configuration_namespace=\\\"%s\\\", configuration=\\\"%s\\\", revision=\\\"%s\\\"}\", metric, test.ServingNamespace, names.Config, names.Revision)\n\tlogger.Infof(\"Prometheus query: %s\", query)\n\n\tvalue, err := promAPI.Query(ctx, query, time.Now())\n\tif err != nil {\n\t\tlogger.Errorf(\"Could not get metrics from prometheus: %v\", err)\n\t}\n\n\treturn VectorValue(value)\n}", "title": "" }, { "docid": "94d4518e2b4406004ca910a4b2a6a580", "score": "0.45647344", "text": "func (x *SearchResponse_Diagnostics) GetRewrittenQuery() string {\n\tif x != nil {\n\t\treturn x.RewrittenQuery\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1dea2c7229b286b8c043bc14ae0d7b4b", "score": "0.45575425", "text": "func (o *ChangeWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) {\n\tif o == nil || o.ProcessQuery == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ProcessQuery, true\n}", "title": "" }, { "docid": "285673d00f4676e8731d2d629ac4c1d3", "score": "0.45238447", "text": "func (r *Resolver) Query() gql_generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c0ad69d826949187c9267e8ec6ebc055", "score": "0.45234197", "text": "func (x InfrastructureAwsLambdaFunctionEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "0100f4a615eb9786b7c52d9a7450d59e", "score": "0.45218313", "text": "func (r *UserList) GetQuery() string {\n\treturn r.Query\n}", "title": "" }, { "docid": "4d10931d0b1eb25b6c8f1128db48bcc2", "score": "0.45165843", "text": "func (r *Resolver) Query() gql.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "790bfbc60fd2e363f89224f996259626", "score": "0.45096013", "text": "func (c *Context) QueryInt(name string) int {\n\treturn 0\n}", "title": "" }, { "docid": "d3f387a966e1daa649535201de8652c7", "score": "0.45071974", "text": "func (n IssuesNav) rawQuery(tabName string) string {\n\tq := n.Query\n\tif tabName == defaultTabName {\n\t\tq.Del(n.StateQueryKey)\n\t\treturn q.Encode()\n\t}\n\tq.Set(n.StateQueryKey, tabName)\n\treturn q.Encode()\n}", "title": "" }, { "docid": "ddb3fefef834b28b581233e50684ecc3", "score": "0.44895878", "text": "func RustQuery(querier Querier, binRequest []byte, gasLimit uint64) QuerierResult {\n\tvar request QueryRequest\n\terr := json.Unmarshal(binRequest, &request)\n\tif err != nil {\n\t\treturn QuerierResult{\n\t\t\tErr: &SystemError{\n\t\t\t\tInvalidRequest: &InvalidRequest{\n\t\t\t\t\tErr: err.Error(),\n\t\t\t\t\tRequest: binRequest,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\tbz, err := querier.Query(request, gasLimit)\n\treturn ToQuerierResult(bz, err)\n}", "title": "" }, { "docid": "8ea55cda5b8a465b464010d98f55557c", "score": "0.4483334", "text": "func (x SecureCredentialEntity) GetNRDBQuery() nrdb.NRDBResultContainer {\n\treturn x.NRDBQuery\n}", "title": "" }, { "docid": "e43732b11cf16313292662cd0255c811", "score": "0.44820312", "text": "func (h *HTTPRequestLib) GetIntQuery(key string) (int, bool) {\n\tvalToRe, ex := h.GetQuery(key)\n\n\tif !ex {\n\t\treturn 0, false\n\t}\n\tvtr, _ := strconv.Atoi(valToRe)\n\treturn vtr, true\n}", "title": "" }, { "docid": "6c27dfb5d75610369e1745c8c88343ab", "score": "0.44732028", "text": "func (c *RoomamountClient) Query() *RoomamountQuery {\n\treturn &RoomamountQuery{config: c.config}\n}", "title": "" }, { "docid": "740dbea0d8c3a2c346af38b9a2534b49", "score": "0.44727388", "text": "func (a Atom) Query() cqr.CommonQueryRepresentation {\n\treturn a.Clause.Query\n}", "title": "" }, { "docid": "d46317dd9442f1f3860ae357cee0f645", "score": "0.4464945", "text": "func uintQuery(field string, n uint) QueryOption {\n\tval := strconv.FormatUint(uint64(n), 10)\n\treturn func(v url.Values) error {\n\t\tv.Add(field, val)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "072f496d501e278218404688d4163fba", "score": "0.44631222", "text": "func (v *MatchingService_QueryWorkflow_Args) GetQueryRequest() (o *QueryWorkflowRequest) {\n\tif v != nil && v.QueryRequest != nil {\n\t\treturn v.QueryRequest\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d573acc36e000f5d51d1ac311929d499", "score": "0.44547743", "text": "func GetQueryFieldD(doc proto.SystemProfile) (primitive.M, error) {\n\t// Proper way to detect if protocol used is \"op_msg\" or \"op_command\"\n\t// would be to look at \"doc.Protocol\" field,\n\t// however MongoDB 3.0 doesn't have that field\n\t// so we need to detect protocol by looking at actual data.\n\tquery := doc.Query\n\tif len(doc.Command) > 0 {\n\t\tquery = doc.Command\n\t\tif doc.Op == \"update\" || doc.Op == \"remove\" {\n\t\t\treturn asMap(query.Map()[\"q\"])\n\t\t}\n\t}\n\n\t// \"query\" in MongoDB 3.0 can look like this:\n\t// {\n\t// \t\"op\" : \"query\",\n\t// \t\"ns\" : \"test.coll\",\n\t// \t\"query\" : {\n\t// \t\t\"a\" : 1\n\t// \t},\n\t// \t\t...\n\t// }\n\t//\n\t// but also it can have \"query\" subkey like this:\n\t// {\n\t// \t\"op\" : \"query\",\n\t// \t\"ns\" : \"test.coll\",\n\t// \t\"query\" : {\n\t// \t\t\"query\" : {\n\t// \t\t\t\"$and\" : [\n\t// \t\t\t]\n\t// \t\t},\n\t// \t\t\"orderby\" : {\n\t// \t\t\t\"k\" : -1\n\t// \t\t}\n\t// \t},\n\t// \t\t...\n\t// }\n\t//\n\tif squery, ok := query.Map()[\"query\"]; ok {\n\t\treturn asMap(squery)\n\t}\n\n\t// \"query\" in MongoDB 3.2+ is better structured and always has a \"filter\" subkey:\n\tif squery, ok := query.Map()[\"filter\"]; ok {\n\t\treturn asMap(squery)\n\t}\n\n\t// {\"ns\":\"test.system.js\",\"op\":\"query\",\"query\":{\"find\":\"system.js\"}}\n\tif len(query) == 1 && query[0].Key == \"find\" {\n\t\treturn primitive.M{}, nil\n\t}\n\n\treturn query.Map(), nil\n}", "title": "" }, { "docid": "adab31b4261678f4698d89563d46e49c", "score": "0.44535592", "text": "func (main Main) getResultQuery(query string, workspaceID uuid.UUID) (float64, error) {\n\n\tfmt.Println(\"QUERY: \", query)\n\n\tdatasource, err := main.datasource.FindHealthByWorkspaceId(workspaceID)\n\tif err != nil {\n\t\tlogger.Error(util.QueryGetPluginError, \"getResultQuery\", err, \"prometheus\")\n\t\treturn 0, err\n\t}\n\n\tplugin, err := main.pluginMain.GetPluginBySrc(datasource.PluginSrc)\n\tif err != nil {\n\t\tlogger.Error(util.QueryGetPluginError, \"getResultQuery\", err, \"prometheus\")\n\t\treturn 0, err\n\t}\n\n\tgetQuery, err := plugin.Lookup(\"Result\")\n\tif err != nil {\n\t\tlogger.Error(util.PluginLookupError, \"getResultQuery\", err, plugin)\n\t\treturn 0, err\n\t}\n\n\treturn getQuery.(func(request datasourcePKG.ResultRequest) (float64, error))(datasourcePKG.ResultRequest{\n\t\tDatasourceConfiguration: datasource.Data,\n\t\tQuery: query,\n\t\tFilters: []datasourcePKG.MetricFilter{},\n\t})\n}", "title": "" }, { "docid": "a34a379e8db54de15258e05b510ee6a9", "score": "0.44461927", "text": "func (c *CustomTx) Query(query string, args ...interface{}) (httputil.Rower, error) {\n\treturn c.tx.Query(query, args...)\n}", "title": "" }, { "docid": "f5b15bcad2c3a29072d095872559650e", "score": "0.4431075", "text": "func (g *G) RvGetOrGlobal() int64 {\n\tif g != nil {\n\t\treturn g.RvGet()\n\t}\n\treturn RvGet()\n}", "title": "" }, { "docid": "452919bdb83dab4143ca17cffa47cd11", "score": "0.44308123", "text": "func (a AdjAtom) Query() cqr.CommonQueryRepresentation {\n\treturn a.Clause.Query\n}", "title": "" }, { "docid": "4282b119c730d85f44e6ab79313cfe5c", "score": "0.4407895", "text": "func GetQuery(target, pname GLenum) int {\n\tvar params C.GLint\n\n\tC.glGetQueryiv(C.GLenum(target), C.GLenum(pname), &params)\n\n\treturn int(params)\n}", "title": "" }, { "docid": "f2a7cda05b5f13f223d119d66f377705", "score": "0.44059795", "text": "func (ctx *Context) QueryInt(key string, def int) int {\n\tparams := ctx.QueryAll()\n\tif vals, ok := params[key]; ok {\n\t\tlen := len(vals)\n\t\tif len > 0 {\n\t\t\tintval, err := strconv.Atoi(vals[len-1])\n\t\t\tif err != nil {\n\t\t\t\treturn def\n\t\t\t}\n\t\t\treturn intval\n\t\t}\n\t}\n\treturn def\n}", "title": "" }, { "docid": "3081d00d315d01130cc3283df89f6f26", "score": "0.4402346", "text": "func (q *QueryPackage) PayloadQuery(vehicleID int, daedalusQuery DaedalusQuery) uint32 {\n\tid := q.currentQueryId\n\tq.currentQueryId++\n\tquery := IcarusQuery{\n\t\tQueryId: id,\n\t\tType: PayloadQuery,\n\t\tVehicleId: uint32(vehicleID),\n\t\tDaedalus: daedalusQuery,\n\t}\n\tq.Queries = append(q.Queries, query)\n\treturn id\n}", "title": "" }, { "docid": "747d1f38821c78890c059f529b745fcb", "score": "0.4390645", "text": "func (op *ListStatusChangesOp) QueryBudget(val string) *ListStatusChangesOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"query_budget\", val)\n\t}\n\treturn op\n}", "title": "" }, { "docid": "e99c480141209c23911f6c0253257a20", "score": "0.4387618", "text": "func (o *ScatterPlotRequest) GetLogQuery() LogQueryDefinition {\n\tif o == nil || o.LogQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.LogQuery\n}", "title": "" }, { "docid": "0750b88b43766ccaa30afaaacafdabac", "score": "0.43829808", "text": "func (o *PostBucketRequest) GetRp() string {\n\tif o == nil || o.Rp == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Rp\n}", "title": "" }, { "docid": "f6e252e28ba112dc555ed79903e2c9a6", "score": "0.43752214", "text": "func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil }", "title": "" }, { "docid": "4271cc1bb053219b11189ba1efd5e129", "score": "0.4375121", "text": "func (o *SnapmirrorGetIterRequest) Query() SnapmirrorGetIterRequestQuery {\n\tvar r SnapmirrorGetIterRequestQuery\n\tif o.QueryPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.QueryPtr\n\treturn r\n}", "title": "" }, { "docid": "5565064b7df05cd3fba3b338a81521d1", "score": "0.4373927", "text": "func (e *MgmtClient) GetQueryBase(scheme, port, uri, vdc string) (resp *http.Response, err error) {\n\treturn e.QueryBaseWithRetry(\"GET\", scheme, port, uri, nil, 0, http.Header{}, vdc)\n}", "title": "" }, { "docid": "41c90b7a95736341213756f75aeb158f", "score": "0.436933", "text": "func (o *ChangeWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) {\n\tif o == nil || o.LogQuery == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LogQuery, true\n}", "title": "" }, { "docid": "eceb870712c02c7ea53130123066faf0", "score": "0.4368541", "text": "func (v *QueryWorkflowRequest) GetQueryRequest() (o *shared.QueryWorkflowRequest) {\n\tif v != nil && v.QueryRequest != nil {\n\t\treturn v.QueryRequest\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9d1aacae474d05bae53e4f8e740f2d55", "score": "0.43665478", "text": "func (r *CustomResolverType) Query() customresolver.QueryResolver { return &queryCustomResolverType{r} }", "title": "" }, { "docid": "6d4fb4b69595efee6295ecfb83476b6a", "score": "0.43625736", "text": "func (r *Resolver) Query() bff.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "50927d64ef36a5160ae0a75153371854", "score": "0.43513608", "text": "func (o *ConnectorUrlAllOf) GetRawQuery() string {\n\tif o == nil || o.RawQuery == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RawQuery\n}", "title": "" }, { "docid": "b25bc1f93752ee4080519653b5acd08b", "score": "0.43392253", "text": "func (c *Context) QueryUint(name string, expect uint64) uint64 {\n\tif res, err := strconv.ParseUint(c.Query(name), 10, 64); err == nil {\n\t\treturn res\n\t}\n\n\treturn expect\n}", "title": "" }, { "docid": "37c71cb3065b54f65e8a43f0afc1044d", "score": "0.43355843", "text": "func (c *Context) QueryInt(name string, expect int64) int64 {\n\tif res, err := strconv.ParseInt(c.Query(name), 10, 64); err == nil {\n\t\treturn res\n\t}\n\n\treturn expect\n}", "title": "" }, { "docid": "60bc93247090f299a13dcdb38e8d9626", "score": "0.43301597", "text": "func (r *Roomage) QueryRoomageRent() *RentQuery {\n\treturn (&RoomageClient{config: r.config}).QueryRoomageRent(r)\n}", "title": "" }, { "docid": "20658cb83d9d00ec816aed4aec02dba6", "score": "0.43224487", "text": "func (o *ScatterPlotRequest) GetProcessQuery() ProcessQueryDefinition {\n\tif o == nil || o.ProcessQuery == nil {\n\t\tvar ret ProcessQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.ProcessQuery\n}", "title": "" }, { "docid": "184393dbfb29d59236452c81df4d3a95", "score": "0.4313909", "text": "func (q queryValue) get(expr string, r *http.Request) interface{} {\n\treturn find(expr, r.URL.Query())\n}", "title": "" }, { "docid": "08a18bd33c95a4274f8dbb5fddb713c2", "score": "0.43138367", "text": "func (t *Transaction) QueryVar(name string) string {\n\treturn t.Query().Get(name)\n}", "title": "" }, { "docid": "72eefc723dd092947ffacfe11d145963", "score": "0.43098807", "text": "func (r *Rent) QueryRentRoomage() *RoomageQuery {\n\treturn (&RentClient{config: r.config}).QueryRentRoomage(r)\n}", "title": "" }, { "docid": "93b4eaaa0c0610cc072694ddb2f29319", "score": "0.43075746", "text": "func (mdb MongoDB) RunQuery(sql string) (result string) {\n\treturn mdb.database[sql]\n}", "title": "" }, { "docid": "b9d7c271cd4cfda9b9bf0843e204219a", "score": "0.43068933", "text": "func (t *Transport) QueryReceive() *HospitalQuery {\n\treturn (&TransportClient{config: t.config}).QueryReceive(t)\n}", "title": "" }, { "docid": "f1f3b60ca438d32bb4d628dbb316f412", "score": "0.43025604", "text": "func (AppModuleBasic) GetQueryCmd() *cobra.Command {\n\treturn nil\n}", "title": "" }, { "docid": "63a466b180032d5f5de8da557a94dec9", "score": "0.42992473", "text": "func (q *Query) CoreQuery() *core.Query {\n\treturn q.coreQuery\n}", "title": "" }, { "docid": "ef3ca6d15db753fec623150333b55282", "score": "0.42979252", "text": "func (c Combinator) Query() cqr.CommonQueryRepresentation {\n\treturn c.Clause.Query\n}", "title": "" }, { "docid": "9bc7cf8ea712081a284cd9bbeb8662f1", "score": "0.42918256", "text": "func getRevenueSumAmount(month, year int) (revenue []rev, e error) {\n\to := orm.NewOrm()\n\t_, e = o.Raw(\"SELECT DATE(rev.recognition_date) AS date , sum(rev.amount) as amount \"+\n\t\t\"FROM finance_revenue rev WHERE rev.is_deleted = 0 AND month(rev.recognition_date) = ? AND YEAR(rev.recognition_date) = ? \"+\n\t\t\"GROUP BY DATE(rev.recognition_date) ORDER BY date ASC\", month, year).QueryRows(&revenue)\n\treturn\n}", "title": "" }, { "docid": "6529b0de060615c1a6ed368ec132b783", "score": "0.42912185", "text": "func (o *ChangeWidgetRequest) GetNetworkQuery() LogQueryDefinition {\n\tif o == nil || o.NetworkQuery == nil {\n\t\tvar ret LogQueryDefinition\n\t\treturn ret\n\t}\n\treturn *o.NetworkQuery\n}", "title": "" }, { "docid": "4e43aa012a2d40b33327988f17d8e79c", "score": "0.42726848", "text": "func (r *resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" } ]
c8c9f89ae9bc7bde65e4d4b1b279c879
Marshal indicates an expected call of Marshal
[ { "docid": "d7a19ffe439c0a88bb7420eae2940401", "score": "0.66576165", "text": "func (mr *MockSerializerMockRecorder) Marshal(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Marshal\", reflect.TypeOf((*MockSerializer)(nil).Marshal), arg0)\n}", "title": "" } ]
[ { "docid": "d492740eedad733d2f8a31c6d66cf6f5", "score": "0.66308683", "text": "func (mr *MockMarshalerMockRecorder) Marshal(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Marshal\", reflect.TypeOf((*MockMarshaler)(nil).Marshal), arg0)\n}", "title": "" }, { "docid": "7d937558719578987e81185df6082e44", "score": "0.6546799", "text": "func (mr *MockisAppKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisAppKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "91990f68188a1ac447397748fae2e209", "score": "0.65441877", "text": "func (mr *MockisCoppKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisCoppKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "e736e2bf2dc975dce4464ec1f125535b", "score": "0.6520592", "text": "func (mr *MockisLifKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisLifKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "6c35660e4df2528b8939221a671405f3", "score": "0.6520084", "text": "func (mr *MockisInterfaceKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisInterfaceKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "8068ff63ce24d359a28496c94ebf6424", "score": "0.65088034", "text": "func (mr *MockisNatMappingKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisNatMappingKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "83310672245c653d3b2949c564c35b2e", "score": "0.6484843", "text": "func TestBadMarshal(t *testing.T) {\n\tc := make(chan bool)\n\t_, err := marshal(c)\n\tif err == nil {\n\t\tt.Fatal(\"succeed to marshal channel\")\n\t}\n}", "title": "" }, { "docid": "4b51e8a8f58261d2936f3ae61ae4a41c", "score": "0.6476192", "text": "func (mr *MockisExportControlKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisExportControlKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "f7bd928bbb6c87e6f011950dee611224", "score": "0.6471741", "text": "func (mr *MockisCollectorKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisCollectorKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "0414d9b2c04873515860141f74bad974", "score": "0.6471157", "text": "func (mr *MockisEndpointKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisEndpointKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "a58bfa6d77a10a38cdc2e0f39104050b", "score": "0.64533997", "text": "func (mr *MockisVrfKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisVrfKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "9ae8064306c2730a32b896bfca62e472", "score": "0.6446995", "text": "func (mr *MockisPortKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisPortKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "bda25e50b558f1c1d1dc0bb0612e51e1", "score": "0.644615", "text": "func (mr *MockisMulticastEntryKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisMulticastEntryKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "5f164e7591c2d77ea58757dfb92228f1", "score": "0.64419776", "text": "func (mr *MockisNetworkKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisNetworkKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "acd1550f7bd03813740bb7c388afd9e0", "score": "0.6441292", "text": "func (mr *MockisNatPolicyKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisNatPolicyKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "9ae41b94efd53de858c0a8aed3372349", "score": "0.6435494", "text": "func (mr *MockisSecurityGroupKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisSecurityGroupKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "242510a6d83badbc676fc6f2b0f1fc7c", "score": "0.64321935", "text": "func (mr *MockisNatPoolKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisNatPoolKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "0b81398e05955d80fe8b5c24fc5c4113", "score": "0.64180106", "text": "func (mr *MockisL2SegmentKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisL2SegmentKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "3561662e56674ef9343f69edf2dbb255", "score": "0.6414609", "text": "func (mr *MockisFilterKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisFilterKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "0adbe286111c5d3165f70952cf4b39e4", "score": "0.6412943", "text": "func mustMarshal(val interface{}) []byte {\n\tif b, err := asn1.Marshal(val); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\treturn b\n\t}\n}", "title": "" }, { "docid": "4562fd0697fc798e8dea50ed11ede396", "score": "0.6404888", "text": "func (mr *MockisQosClassKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisQosClassKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "9ebe1d0fe47935036326f3a5ce53dfac", "score": "0.63859755", "text": "func (mr *MockContextMockRecorder) Marshal() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Marshal\", reflect.TypeOf((*MockContext)(nil).Marshal))\n}", "title": "" }, { "docid": "1c3f8f39452b6807349463c4ec886f08", "score": "0.6381063", "text": "func (mr *MockisAclKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisAclKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "b3086b54b1bd75984cbcc09835166e8f", "score": "0.6373549", "text": "func (mr *MockisSecurityPolicyKeyHandle_PolicyKeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisSecurityPolicyKeyHandle_PolicyKeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "00ebc9166d9debf12d1bb4a1aa8eddf1", "score": "0.63697714", "text": "func (mr *MockisRouteKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisRouteKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "527900299120e93bebbca0230a5fae0f", "score": "0.63692963", "text": "func (mr *MockisSecurityProfileKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisSecurityProfileKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "03e0f6f98492f1a9df6b5505fe432610", "score": "0.6362626", "text": "func (mr *MockisIpsecSAEncryptKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisIpsecSAEncryptKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "a55407638b5a51e3b1c43e9e9d89f17a", "score": "0.6362556", "text": "func (mr *MockisNexthopKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisNexthopKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "97ee77c9d3ac3592945788dc66e7bcbb", "score": "0.6356295", "text": "func (mr *MockisDropMonitorRuleKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisDropMonitorRuleKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "585180eaf63bddd662531fdb21df821a", "score": "0.6356037", "text": "func (mr *MockisIpsecSADecryptKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisIpsecSADecryptKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "813fca1f7466ab272ecd7e9861788a70", "score": "0.63515335", "text": "func MatchesMarshal(t TestingT, expected []byte, actualValue interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\treturn defaultComparer.MatchesMarshal(t, expected, actualValue, msgAndArgs...)\n}", "title": "" }, { "docid": "def70f8642ac55771cb9848c5539c0f4", "score": "0.63490695", "text": "func (mr *MockisFlowMonitorRuleKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisFlowMonitorRuleKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "d7ae971ff9cde8e82ac597897eee2ae5", "score": "0.6347624", "text": "func (mr *MockisSecurityGroupPolicyKeyHandle_PolicyKeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisSecurityGroupPolicyKeyHandle_PolicyKeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "293b3fd5b55d11759b42894947ec0111", "score": "0.63289845", "text": "func (mr *MockisIpsecRuleKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisIpsecRuleKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "1baa83f8c7f9b26fb5b28c4cad344173", "score": "0.6326471", "text": "func (l DummyMarshaler) Marshal(entry *entry) ([]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "d2dbb9945b3314c1605083777cbf3f64", "score": "0.63084275", "text": "func (mr *MockisMirrorSessionKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisMirrorSessionKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "66ce7106bb589db0034a219dc7098cb6", "score": "0.63024515", "text": "func (mr *MockisMulticastEntryKey_IpOrMacMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisMulticastEntryKey_IpOrMac)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "f1bae9846f240b93a70c657edf3ba869", "score": "0.6294191", "text": "func (mr *MockisTcpProxyRuleKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisTcpProxyRuleKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "9ad3e203a0c11e017cd0bbef6b085129", "score": "0.62607723", "text": "func (o *codeObject) Marshal(buf []byte) ([]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "994c4ad2d966a5869bee31852b981a06", "score": "0.6246242", "text": "func (x Fn) Marshal(buf []byte, rem int) ([]byte, int, error) {\n\tif len(buf) < FnSizeMarshalled || rem < 32 {\n\t\treturn buf, rem, surge.ErrUnexpectedEndOfBuffer\n\t}\n\n\tx.PutB32(buf[:FnSizeMarshalled])\n\n\treturn buf[FnSizeMarshalled:], rem - FnSizeMarshalled, nil\n}", "title": "" }, { "docid": "9ba5d3817eeb353f50b38707f58bae78", "score": "0.6246098", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn protocol.Marshal(-1, v)\n}", "title": "" }, { "docid": "2749d176ad5daf0821f79b6fb5e8b514", "score": "0.62383753", "text": "func (mr *MockisGftExactMatchProfileKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisGftExactMatchProfileKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "d2fa2562a9b51966f7d71df1b877b6bd", "score": "0.6228738", "text": "func (mr *MockisGftHeaderTranspositionProfileKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisGftHeaderTranspositionProfileKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "a888f153960e4ba344be52b5a2139489", "score": "0.6207516", "text": "func (mr *MockisGftExactMatchFlowEntryKeyHandle_KeyOrHandleMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisGftExactMatchFlowEntryKeyHandle_KeyOrHandle)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "d453398fcfe311c0dcf1f5af383c1471", "score": "0.6168876", "text": "func FailMismatchMarshal(expected []byte, actualValue interface{}) error {\n\treturn defaultComparer.FailMismatchMarshal(expected, actualValue)\n}", "title": "" }, { "docid": "fd91a023300d64872623fd7833425b5e", "score": "0.616315", "text": "func Marshal(val interface{}) ([]byte, error) {\n\treturn MarshalWithParams(val, \"\")\n}", "title": "" }, { "docid": "bb7ae89b84ef16662a72a587287bfcf4", "score": "0.6143942", "text": "func (m *MockSerializer) Marshal(arg0 interface{}) ([]byte, error) {\n\tret := m.ctrl.Call(m, \"Marshal\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "edd84f69c52d4ea27eb9157ee1d090f2", "score": "0.6141917", "text": "func Marshal(v interface{}) ([]byte, error)", "title": "" }, { "docid": "6ca2901e50ce3f1ff4838a1a6dac59a6", "score": "0.6083374", "text": "func (mr *MockisEndpointKey_EndpointL2L3KeyMockRecorder) MarshalTo(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarshalTo\", reflect.TypeOf((*MockisEndpointKey_EndpointL2L3Key)(nil).MarshalTo), arg0)\n}", "title": "" }, { "docid": "ebe19987641a0d09d861af4d4532b191", "score": "0.60742253", "text": "func (s *Assertions) Marshal(w io.Writer) error {\n\treturn s.marshal(w)\n}", "title": "" }, { "docid": "2981aa416c7aa8780fc94b22e68558fe", "score": "0.6008095", "text": "func MustMarshal(bs []byte, err error) []byte {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn bs\n}", "title": "" }, { "docid": "0064245fa49ecfc943ea2f8d7f27f20f", "score": "0.5942477", "text": "func (m *MockMarshaler) Marshal(arg0 interface{}) ([]byte, error) {\n\tret := m.ctrl.Call(m, \"Marshal\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d4c5462b40e2a9c76438cc4a4b8f5efb", "score": "0.5919326", "text": "func MustMarshal(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tE2P(err)\n\treturn b\n}", "title": "" }, { "docid": "d4c5462b40e2a9c76438cc4a4b8f5efb", "score": "0.5919326", "text": "func MustMarshal(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tE2P(err)\n\treturn b\n}", "title": "" }, { "docid": "2b68e6aade5729d9a90c3342bcf6e40b", "score": "0.5916702", "text": "func (m *MockisNatMappingKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e60a356635888901da01d5394435e39e", "score": "0.589961", "text": "func (mock *MarshallerMock) MarshalCalls() []struct {\n\tS interface{}\n} {\n\tvar calls []struct {\n\t\tS interface{}\n\t}\n\tlockMarshallerMockMarshal.RLock()\n\tcalls = mock.calls.Marshal\n\tlockMarshallerMockMarshal.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ba3ceeb0903cea577d7fe06964bc5d87", "score": "0.58947796", "text": "func (m *MockisAppKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fbe98f4e3f2d18090f4e7a7d556adde4", "score": "0.5880619", "text": "func (i *NodeInfo) Marshal(b ...[]byte) ([]byte, error) {\n\tvar buf []byte\n\tif len(b) > 0 {\n\t\tbuf = b[0]\n\t}\n\n\treturn (*netmap.NodeInfo)(i).\n\t\tStableMarshal(buf)\n}", "title": "" }, { "docid": "54a29590943c11e6e586b231a15e2766", "score": "0.58795404", "text": "func (m *MockContext) Marshal() ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Marshal\")\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b7b57dd56024ccd942a0013d45772ccb", "score": "0.58618665", "text": "func (m *MockisMulticastEntryKey_IpOrMac) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "50ce98ad1c48122f74a9ee7a0ff822d4", "score": "0.5850469", "text": "func (m *MockisL2SegmentKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5fe0b89d17ea09600e73be40842b2e81", "score": "0.58479077", "text": "func (m *MockisVrfKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "931b4eae27ac6e61120212bff3acf2bc", "score": "0.584657", "text": "func (m *MockisCoppKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "4e84e291d44cd85b8e39f5dc8d2c4a65", "score": "0.5844566", "text": "func (codec *IgnoreCodec) Marshal(s interface{}) (bb []byte, err error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "c69b3e92b7bd2608720049924e99ae7d", "score": "0.584345", "text": "func (m *MockisNatPolicyKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e6758c9cb69189c8a8e381a82c0cec2f", "score": "0.58411014", "text": "func (m *MockisCollectorKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "633ddf667fae4f378dbc4cbbaa552e6e", "score": "0.5835656", "text": "func (m *MockisMulticastEntryKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8a7dbc6f220538864bede9b32e212c47", "score": "0.58315635", "text": "func (m *MockisSecurityGroupKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5442ee635748bdd13598aca34c676fcc", "score": "0.5830855", "text": "func (m *MockisFilterKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0ff63e1bfe1ec6796293ef888fca87a9", "score": "0.5828715", "text": "func Marshal(pb Message) ([]byte, error) {\n\tif m, ok := pb.(newMarshaler); ok {\n\t\tsiz := m.XXX_Size()\n\t\tb := make([]byte, 0, siz)\n\t\treturn m.XXX_Marshal(b, false)\n\t}\n\tif m, ok := pb.(Marshaler); ok {\n\t\t// If the message can marshal itself, let it do it, for compatibility.\n\t\t// NOTE: This is not efficient.\n\t\treturn m.Marshal()\n\t}\n\n\treturn nil, ErrNotSupport\n\t// in case somehow we didn't generate the wrapper\n\t// if pb == nil {\n\t// \treturn nil, ErrNil\n\t// }\n\n\t// var info InternalMessageInfo\n\t// siz := info.Size(pb)\n\t// b := make([]byte, 0, siz)\n\t// return info.Marshal(b, pb, false)\n}", "title": "" }, { "docid": "0084fb3a0f131e2a69976e1edb9f17a0", "score": "0.58172876", "text": "func (p *Buffer) Marshal(pb Message) error {\n\t// Can the object marshal itself?\n\tif m, ok := pb.(Marshaler); ok {\n\t\tdata, err := m.Marshal()\n\t\tp.buf = append(p.buf, data...)\n\t\treturn err\n\t}\n\n\tt, base, err := getbase(pb)\n\tif structPointer_IsNil(base) {\n\t\treturn ErrNil\n\t}\n\tif err == nil {\n\t\terr = p.enc_struct(GetProperties(t.Elem()), base)\n\t}\n\n\tif collectStats {\n\t\t(stats).Encode++ // Parens are to work around a goimports bug.\n\t}\n\n\tif len(p.buf) > maxMarshalSize {\n\t\treturn ErrTooLarge\n\t}\n\treturn err\n}", "title": "" }, { "docid": "d2b7c43d77408ba94ad43bcf34da828f", "score": "0.581507", "text": "func (m *MockisAclKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "08a3c25ec446930d47fd1b2727dca6e1", "score": "0.58073735", "text": "func (m *MockisSecurityProfileKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5a1403fb2d96ee22179b0cf039c635a0", "score": "0.5800849", "text": "func (m *MockisSecurityPolicyKeyHandle_PolicyKeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "17bb920287f3eb8034bdba43ab200932", "score": "0.5796976", "text": "func (m *MockisIpsecSAEncryptKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6fc85f82842b3b9e57b48f975179c444", "score": "0.5791902", "text": "func (m *MockisInterfaceKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "26a769ab14e1354579ede90ee28e1832", "score": "0.5787269", "text": "func (m *MockisSecurityGroupPolicyKeyHandle_PolicyKeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d6543faf9bca1173bf25afeb1e4ec9bc", "score": "0.57827705", "text": "func (m *MockisEndpointKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "465038cb99c985e39de105313361b2fa", "score": "0.57794434", "text": "func (m *MockisNatPoolKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e820f47c93bd576a976aa3a3e85c5145", "score": "0.57680035", "text": "func (m *MockisFlowMonitorRuleKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "13d91ec960407369df49f99b4c881da6", "score": "0.5767057", "text": "func Marshal(w io.Writer, val interface{}) error {\n\treturn EncodeTo(w, val)\n}", "title": "" }, { "docid": "b53821ae5ce5f0703f8b82becefe0fa7", "score": "0.5766227", "text": "func (m *MockisQosClassKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a5a1face2c97fbf9ba9f731cb7d35700", "score": "0.57648766", "text": "func (m *MockisLifKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d15a301e97ec67a7c0efc56d3d219a3b", "score": "0.57604504", "text": "func (m *MockisExportControlKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "692cff71c55c39c5a2dc78939d2bd353", "score": "0.57524085", "text": "func (c Comparer) MatchesMarshal(t TestingT, expected []byte, actualValue interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tactual, err := MarshalIndentCompact(actualValue, \"\", \" \", 80)\n\tassert.NoError(t, err, \"failed to marshal actual value\")\n\n\tif len(msgAndArgs) == 0 {\n\t\tmsgAndArgs = append(msgAndArgs, string(actual))\n\t}\n\n\treturn c.Matches(t, expected, actual, msgAndArgs...)\n}", "title": "" }, { "docid": "4cfdf782e8ff60fcc09cec985301fa8f", "score": "0.5749108", "text": "func (m *MockisNetworkKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b1fca0c6a5eef40add22026d212034f1", "score": "0.5748815", "text": "func (m *MockisNexthopKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2a2d522e695945d56ad15280712e076d", "score": "0.574852", "text": "func (m *JsonMarshaller) Marshal(name string, msg interface{}) ([]byte, error) {\n\treturn json.Marshal(msg)\n}", "title": "" }, { "docid": "16821083c2b4e9acdb1884bc59f64a05", "score": "0.57461417", "text": "func (c Comparer) FailMismatchMarshal(expected []byte, actualValue interface{}) error {\n\tactual, err := MarshalIndentCompact(actualValue, \"\", \" \", 80)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.FailMismatch(expected, actual)\n}", "title": "" }, { "docid": "5996285bfb43a090aa721a933b479c66", "score": "0.5745859", "text": "func (m *MockisDropMonitorRuleKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9e7d5c85fe60310828d6d24ae5a97322", "score": "0.57360464", "text": "func (m *MockisRouteKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b108d088f3bc918f67dc3fe78511ed0b", "score": "0.57353354", "text": "func Marshal(pb proto.Message) ([]byte, error) {\n\treturn proto.Marshal(pb)\n}", "title": "" }, { "docid": "b108d088f3bc918f67dc3fe78511ed0b", "score": "0.57353354", "text": "func Marshal(pb proto.Message) ([]byte, error) {\n\treturn proto.Marshal(pb)\n}", "title": "" }, { "docid": "ad1e3fe4c6f8acd2ed02dd07d8e6da57", "score": "0.5729743", "text": "func (m *MockisMirrorSessionKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b867c8e16dbb21adf46f9862f0303b20", "score": "0.5728258", "text": "func TestMarshal(t *testing.T) {\n\tvar bz [32]byte\n\tcopy(bz[:], rand.NewRand().Bytes(32))\n\tdataB := HexByteArray32(bz)\n\tbz2, err := dataB.Marshal()\n\tassert.Nil(t, err)\n\tassert.Equal(t, bz[:], bz2)\n\n\tvar dataB2 HexByteArray32\n\terr = (&dataB2).Unmarshal(bz[:])\n\tassert.Nil(t, err)\n\tassert.Equal(t, dataB, dataB2)\n}", "title": "" }, { "docid": "424121df048fa1236d58e27d3e1a38ac", "score": "0.5725816", "text": "func (i *idsType) MustMarshal() []byte {\n\tret, _ := i.Marshal()\n\treturn ret\n}", "title": "" }, { "docid": "0ad96e4bdc972b5487e4d8d3df590c0b", "score": "0.57200295", "text": "func (p Point) Marshal(buf []byte, rem int) ([]byte, int, error) {\n\tif len(buf) < PointSizeMarshalled || rem < PointSizeMarshalled {\n\t\treturn buf, rem, surge.ErrUnexpectedEndOfBuffer\n\t}\n\n\tp.PutBytes(buf[:PointSizeMarshalled])\n\n\treturn buf[PointSizeMarshalled:], rem - PointSizeMarshalled, nil\n}", "title": "" }, { "docid": "2d4bb5e98b93e4a57b845e09ce8815be", "score": "0.5715665", "text": "func (nm nullMarshal) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\treturn nil\n}", "title": "" }, { "docid": "dbb258cbe71fd8fedb3a389e6d608faa", "score": "0.571561", "text": "func (m *MockisIpsecRuleKeyHandle_KeyOrHandle) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "476bc48d231beb7a9a94149ff94c78f4", "score": "0.5713668", "text": "func Marshal(fam TableFamily, rev uint32, info InfoAny) ([]byte, error) {\n\treturn info.marshal(fam, rev)\n}", "title": "" } ]
1e4cf4cf7a8a1057e393f07d30863f58
GenerateCore returns a list of at most n words generated from Chain.
[ { "docid": "68287fcef53e90e6ae3f9f6032040884", "score": "0.7341698", "text": "func (chain *Chain) GenerateCore(forward bool, start string, n int) []string {\n\tp := make(Leader, chain.leaderLen)\n\tif start != \"\" {\n\t\tp = strings.Fields(start)\n\t}\n\tvar words []string\n\twords = append(words, p...)\n\tfor i := 0; i < n; i++ {\n\t\tvar choices []string\n\t\tif forward {\n\t\t\tchoices = chain.forward[p.String()]\n\t\t} else {\n\t\t\tchoices = chain.backward[p.String()]\n\t\t}\n\t\tif len(choices) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tnext := choices[rand.Intn(len(choices))]\n\n\t\tif forward {\n\t\t\tp.Shift(next)\n\t\t} else {\n\t\t\t// This is the code for \"Beginning of sentence.\n\t\t\tif next == \" \" || next == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tp.Unshift(next)\n\t\t}\n\n\t\tif forward {\n\t\t\twords = append(words, next)\n\t\t} else {\n\t\t\twords = append([]string{next}, words...)\n\t\t}\n\n\t\t// We have at least 15 words and we have a period, let's stop.\n\t\tif len(words) > 6 {\n\t\t\tif forward {\n\t\t\t\tlastchr := next[len(next)-1]\n\t\t\t\tif lastchr == '.' || lastchr == '!' || lastchr == '?' {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfirstchr := ([]rune(next))[0]\n\t\t\t\tif unicode.IsUpper(firstchr) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn words\n}", "title": "" } ]
[ { "docid": "47209581ab917e03e456e0f76512e0a7", "score": "0.6647089", "text": "func (chain *Chain) Generate(n int) string {\n\twords := chain.GenerateCore(true, \"\", n)\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "1173d83430458bf89ca31f5c2d1ec7e4", "score": "0.6437841", "text": "func (c *Chain) Generate(n int) string {\n\tp := make(Prefix, c.PrefixLen)\n\tvar words []string\n\tfor i := 0; i < n; i++ {\n\t\tmutex.Lock()\n\t\tchoices := c.MapChain[p.String()]\n\t\tmutex.Unlock()\n\t\tif len(choices) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tnext := choices[rand.Intn(len(choices))]\n\t\twords = append(words, next)\n\t\tp.Shift(next)\n\t}\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "3b3243483361723f5215121fd24564df", "score": "0.6380163", "text": "func (c *Chain) Generate(n int) string {\n\tp := make(Prefix, c.prefixLen)\n\tvar words []string\n\tfor i := 0; i < n; i++ {\n\t\tchoices := c.chain[p.String()]\n\t\tif len(choices) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tnext := choices[rand.Intn(len(choices))]\n\t\twords = append(words, next)\n\t\tp.Shift(next)\n\t}\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "3b3243483361723f5215121fd24564df", "score": "0.6380163", "text": "func (c *Chain) Generate(n int) string {\n\tp := make(Prefix, c.prefixLen)\n\tvar words []string\n\tfor i := 0; i < n; i++ {\n\t\tchoices := c.chain[p.String()]\n\t\tif len(choices) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tnext := choices[rand.Intn(len(choices))]\n\t\twords = append(words, next)\n\t\tp.Shift(next)\n\t}\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "4e7e5d66264a02dcb9ea3029246eb8bb", "score": "0.6260487", "text": "func (c *Chain) Generate(n int) string {\n\tnprefix := len(c.prefixes)\n\tif nprefix == 0 {\n\t\treturn \"\"\n\t}\n\n\tif n < markovOrder {\n\t\treturn \"\"\n\t}\n\n\tvar p Prefix\n\n\trnd := rand.Intn(nprefix)\n\ti := 0\n\tfor k, _ := range c.prefixes {\n\t\tif i == rnd {\n\t\t\tp = Prefix(strings.Split(k, \" \"))\n\t\t\tbreak\n\t\t}\n\t\ti++\n\t}\n\n\tvar words []string\n\n\twords = append(words, p...)\n\n\tfor {\n\t\tsuf := c.getgram(p)\n\t\tif len(suf.M) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tword := suf.Pick()\n\n\t\twords = append(words, word)\n\n\t\tif strings.Contains(word, \".?!\") {\n\t\t\tbreak\n\t\t}\n\t\tp.Shift(word)\n\t}\n\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "439b0e60137c4b146aa02b683a63bcbf", "score": "0.57899016", "text": "func (c *Chain) Generate() string {\n\tp := make(Prefix, PrefixLen)\n\tvar words []string\n\tfor {\n\t\tchoices := c.Chain[p.String()]\n\t\tif len(choices) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tnext := choices[rand.Intn(len(choices))]\n\t\twords = append(words, next)\n\t\tp.Shift(next)\n\t}\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "439b0e60137c4b146aa02b683a63bcbf", "score": "0.57899016", "text": "func (c *Chain) Generate() string {\n\tp := make(Prefix, PrefixLen)\n\tvar words []string\n\tfor {\n\t\tchoices := c.Chain[p.String()]\n\t\tif len(choices) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tnext := choices[rand.Intn(len(choices))]\n\t\twords = append(words, next)\n\t\tp.Shift(next)\n\t}\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "38aceb2bbfed0ad7ad545daf7b7008df", "score": "0.5652386", "text": "func (c *Chain) Generate() string {\n\tn := paragraphCount()\n\tparagraphs := make([]string, n, n)\n\tfor i := 0; i < n; i++ {\n\t\tparagraphs = append(paragraphs, c.GenerateParagraph())\n\t}\n\treturn strings.TrimLeft(strings.Join(paragraphs, \"\\n\\n\"), \"\\n \")\n}", "title": "" }, { "docid": "d70add36aa28447c683638659a3e0778", "score": "0.5279221", "text": "func generate(len int, language string) {\n\tl := []string{}\n\tfor index := 0; index < len; index++ {\n\t\tl = append(l, \"N\")\n\t}\n\tp := strings.Join(l, \" \")\n\tt, err := lengths.GetLengthTypeForMnemonic(p)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to generate: %s\\n\", err.Error())\n\t\treturn\n\t}\n\tif t == lengths.UnknownWordSeed {\n\t\tfmt.Printf(\"Invalid seed length\\n\")\n\t\treturn\n\t}\n\n\tent, err := sansseed.NewWordEntropy(t)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to generate: %s\\n\", err.Error())\n\t\treturn\n\t}\n\n\twordList, err := wordlists.GetByLanguageName(language)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to find language '%s' check documentation for available languages\\n\", language)\n\t\treturn\n\t}\n\n\tresult, err := sansseed.MnemonicPhraseForLanguage(ent, *wordList)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to generate: %s\\n\", err.Error())\n\t\treturn\n\t}\n\n\tres := strings.Join(result, \" \")\n\tfmt.Printf(\"%s\\n\", res)\n}", "title": "" }, { "docid": "212c3cb8135af4b6fd40d851a1cdcf37", "score": "0.52169436", "text": "func GenerateWords() []string {\n\trandomBits := generateRandomBits()\n\t_, checksum := generateChecksum(randomBits)\n\trandomBits = append(randomBits, checksum)\n\tseparatedBits := splitBits(randomBits)\n\twords := mapDictionary(separatedBits)\n\treturn words\n}", "title": "" }, { "docid": "27df96070308dd0b425c27fd633fc3c2", "score": "0.51623696", "text": "func (chain *Chain) GenerateForward(start string, n int) string {\n\twords := chain.GenerateCore(true, start, n)\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "c7a2fc35e8547fd4dfd26e42f7f9e375", "score": "0.5125965", "text": "func MakeN(str string, N int, word []string) (result []string) {\n\tarr := strings.Fields(\"$ \" + stopWords(normalize(str, word)) + \" $\")\n\twords := len(arr)\n\n\tfor k := 0; k < N; k++ {\n\t\tstep := (words - k)\n\t\tlength := k + 1\n\t\ttmp := make([]string, length)\n\n\t\tfor i := 0; i < step; i++ {\n\t\t\tif len(arr[i:i+length]) == 1 && arr[i : i+length][0] == \"$\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcopy(tmp, arr[i:i+length])\n\t\t\tresult = append(result, strings.Join(tmp, \" \"))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "cee14e2e64f302d4a6c0f1dfffd42dd6", "score": "0.4976303", "text": "func GenerateChain(config *params.ChainConfig, fastChain *core.BlockChain, parent *types.SnailBlock, engine consensus.Engine, db ethdb.Database, n int, gen func(int, *BlockGen)) []*types.SnailBlock {\n\tif config == nil {\n\t\tconfig = params.TestChainConfig\n\t}\n\tblocks := make(types.SnailBlocks, n)\n\tgenblock := func(i int, parent *types.SnailBlock) *types.SnailBlock {\n\t\t// TODO(karalabe): This is needed for clique, which depends on multiple blocks.\n\t\t// It's nonetheless ugly to spin up a blockchain here. Get rid of this somehow.\n\t\tblockchain, _ := NewSnailBlockChain(db, nil, config, engine, vm.Config{})\n\t\tblockchain.SetValidator(NewBlockValidator(config, fastChain, blockchain, engine))\n\t\tdefer blockchain.Stop()\n\t\tblocks := make(types.SnailBlocks, 2)\n\t\tblocks[0] = blockchain.genesisBlock\n\t\tblocks[1] = parent\n\t\tblockchain.InsertChain(blocks)\n\t\tb := &BlockGen{i: i, parent: parent, chain: blocks, chainReader: blockchain, config: config, engine: engine}\n\t\tb.header = makeHeader(b.chainReader, parent, b.engine)\n\n\t\t// Execute any user modifications to the block and finalize it\n\t\tif gen != nil {\n\t\t\tgen(i, b)\n\t\t}\n\n\t\tif b.engine != nil {\n\t\t\t// TODO: add fruits support\n\t\t\tblock, error := MakeSnailBlockFruit(blockchain, fastChain, i, params.MinimumFruits, blockchain.genesisBlock.PublicKey(), blockchain.genesisBlock.Coinbase(), true, blockchain.genesisBlock.BlockDifficulty())\n\t\t\tif error != nil {\n\t\t\t\tpanic(error)\n\t\t\t}\n\n\t\t\t//block, _ := b.engine.FinalizeSnail(b.chainReader, b.header, b.uncles, b.fruits, b.signs)\n\t\t\treturn block\n\t\t}\n\t\treturn nil\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tblock := genblock(i, parent)\n\t\tblocks[i] = block\n\t\tparent = block\n\t}\n\treturn blocks\n}", "title": "" }, { "docid": "070b6fb1abc6f68f038b4b42d98b088f", "score": "0.49532163", "text": "func Generate(n int, g Generator, f Lesser) *List {\n\tls := List{less: f}\n\tfor ; 0 < n; n-- {\n\t\tls.InsertAt(ls.length, g(ls.length))\n\t}\n\n\treturn &ls\n}", "title": "" }, { "docid": "3d2b1ebef1122c167fd67003c925571a", "score": "0.49465123", "text": "func (chain *Chain) GenerateFromWord(n int, word string) string {\n\ttuple := chain.GetRandomTupleForWord(word)\n\tlog.Printf(\"Chosen tuple: %s\", tuple)\n\n\tbwords := chain.GenerateCore(false, tuple, n)\n\tfwords := chain.GenerateCore(true, tuple, n)\n\tif len(fwords) > 2 {\n\t\tfwords = fwords[2:]\n\t} else {\n\t\tfwords = nil\n\t}\n\n\twords := append(bwords, fwords...)\n\tgenSentence := strings.Join(words, \" \")\n\n\treturn genSentence\n}", "title": "" }, { "docid": "993aec6815e35d9512ffde5a47968fbc", "score": "0.48786065", "text": "func GenerateParenthesis(n int) []string {\n\tif n < 1 {\n\t\treturn []string{}\n\t}\n\tret := make([]string, 0)\n\trecursive(&ret, \"\", n, 0, 0)\n\treturn ret\n}", "title": "" }, { "docid": "98c715e489be26c60080ba982211024f", "score": "0.48571932", "text": "func (c *NGramChain) GenerateRandomText(maxWords uint) string {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\t// if the map is empty, no text to generate\n\tif len(c.store) == 0 {\n\t\treturn \"\"\n\t}\n\n\t// start with a random seed\n\tvar ngram = c.getRandomNGram()\n\n\tvar strBuilder strings.Builder\n\tstrBuilder.WriteString(ngram)\n\n\tfor i := uint(0); i < maxWords; i++ {\n\t\tvar candidates, exists = c.store[ngram]\n\t\tif !exists {\n\t\t\t// if the ngram doesn't exist, end the text generation\n\t\t\tbreak\n\t\t}\n\n\t\tvar candidate = candidates.selectCandidate(c.randFunc)\n\n\t\t// add the candidate to the output Builder\n\t\tstrBuilder.WriteByte(' ')\n\t\tstrBuilder.WriteString(candidate)\n\n\t\t// generate new ngram with the selected candidate\n\t\tvar ngramSplit = strings.Split(ngram, \" \")\n\t\tvar newNgram = make([]string, len(ngramSplit))\n\t\tcopy(newNgram, ngramSplit[1:])\n\n\t\tnewNgram[len(newNgram)-1] = candidate\n\t\tngram = strings.Join(newNgram, \" \")\n\t}\n\n\t// Add a dot at the end (if not present already)\n\tif !strings.HasSuffix(strBuilder.String(), \".\") {\n\t\tstrBuilder.WriteByte('.')\n\t}\n\n\treturn strBuilder.String()\n}", "title": "" }, { "docid": "b8807740b0481ca54b8bc816075bd930", "score": "0.4839002", "text": "func main() {\n\tfor _, unit := range Units {\n\t\tgenerate(unit)\n\t}\n}", "title": "" }, { "docid": "68325f7385adbce7c81444a38a4a455e", "score": "0.4776801", "text": "func Generate(n int) string {\n\treturn rsg.Generate(n)\n}", "title": "" }, { "docid": "5c8140589ec0c05677e1952a18754e8c", "score": "0.47543672", "text": "func RandomWords(n int) []string {\n\tres := make([]string, n)\n\tfor i := range res {\n\t\tres[i] = _words[rand.Intn(WordCount)]\n\t}\n\treturn res\n}", "title": "" }, { "docid": "a873810044d829e0d8801f552e412df7", "score": "0.4747733", "text": "func generateSamples(n int, overhead TSCValue) []sample {\n\tsamples := []sample{{before: 1000000, after: 1000000 + overhead, ref: 100}}\n\tfor i := 0; i < n-1; i++ {\n\t\tprev := samples[len(samples)-1]\n\t\tsamples = append(samples, sample{\n\t\t\tbefore: prev.before + 1000000,\n\t\t\tafter: prev.after + 1000000,\n\t\t\tref: prev.ref + 100,\n\t\t})\n\t}\n\treturn samples\n}", "title": "" }, { "docid": "d59c8ead8bcfed378d562d049de7c22d", "score": "0.46959886", "text": "func (c *Client) GetChain(start, end string) ([]string, error) {\n\tvar startWord, endWord *Word\n\n\tfor i := 0; i < len(c.Words); i++ {\n\t\tif c.Words[i].Term == start {\n\t\t\tstartWord = c.Words[i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif startWord == nil {\n\t\treturn nil, fmt.Errorf(\"error, start word '%s' not found\", start)\n\t}\n\n\tfor i := 0; i < len(c.Words); i++ {\n\t\tif c.Words[i].Term == end {\n\t\t\tendWord = c.Words[i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif endWord == nil {\n\t\treturn nil, fmt.Errorf(\"error, end word '%s' not found\", end)\n\t}\n\n\tstartWord.CalcScore(endWord.Term)\n\n\ttraverse := &Traverse{\n\t\tStartWord: startWord,\n\t\tEndWord: endWord,\n\t\tResults: make(chan Chain),\n\t}\n\n\treturn traverse.Perform()\n}", "title": "" }, { "docid": "f6261a0ae1001ab4cfa1a3412ce08789", "score": "0.46773908", "text": "func Generate(r *rand.Rand) ([]e2e.Manifest, error) {\n\ttestnetCombinations := combinations(cfg.testnetCombinations)\n\tmanifests := make([]e2e.Manifest, 0, len(testnetCombinations))\n\tfor _, opt := range testnetCombinations {\n\t\tmanifest, err := generateTestnet(r, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmanifests = append(manifests, manifest)\n\t}\n\treturn manifests, nil\n}", "title": "" }, { "docid": "1a2942ffc2fd2ddf73def986d2e0730a", "score": "0.46614477", "text": "func GenCFICombinations() []string {\n\tcfis := make([]string, 0, 10000)\n\tfor k, v := range validCFI {\n\t\tfor _, v2 := range combinations(v) {\n\t\t\tcfis = append(cfis, k+v2)\n\t\t}\n\t}\n\treturn cfis\n}", "title": "" }, { "docid": "3c5bdf615b7a4f6779f4c0653677ad2d", "score": "0.46568617", "text": "func TestFind2WordCombos(t *testing.T) {\n\ttest := []string{\"a\", \"b\", \"c\", \"d\"}\n\tpairs := GetWordCombinations(test)\n\tfmt.Println(pairs)\n\tassert.Len(t, pairs, 12)\n}", "title": "" }, { "docid": "c30a8d4ce8d0738cb6053aae85da5a8e", "score": "0.46258783", "text": "func genWires(size int) []gc.Wire {\n\tif size <= 0 {\n\t\tpanic(\"genWires with request <= 0\")\n\t}\n\tres := make([]gc.Wire, size)\n\tfor i := 0; i < size; i++ {\n\t\tres[i] = genWire()\n\t}\n\treturn res\n}", "title": "" }, { "docid": "eb70d4248f32194f880deb9a08c3bd4c", "score": "0.46111915", "text": "func dictionary(n int) []string {\n\tvar words []string\n\tdict := \"/usr/share/dict/words\"\n\tf, err := os.Open(dict)\n\tif err != nil {\n\t\tfmt.Printf(\"can't open dictionary file '%s': %v\\n\", dict, err)\n\t\tos.Exit(1)\n\t}\n\tcount := 0\n\tbuf := bufio.NewReader(f)\n\tfor {\n\t\tif n != 0 && count >= n {\n\t\t\tbreak\n\t\t}\n\t\tword, err := buf.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\twords = append(words, word)\n\t\tcount++\n\t}\n\tf.Close()\n\treturn words\n}", "title": "" }, { "docid": "227ff35f20e9c1b8f4b41579e9825d63", "score": "0.45987016", "text": "func (s *WordStats) GetFirstN(n uint64) []string{\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tcount := n\n\tif count > s.Count { //Get the lower value, the given N or the words count\n\t\tcount = s.Count\n\t}\n\tres := make([]string, count)//Create the result vector\n\tfor i := uint64(0); i < count; i++ { //Extract all the words\n\t\tres[i] = trie.GetWord(s.Words[i]) //Convert the trie to string\n\t}\n\treturn res\n}", "title": "" }, { "docid": "56b9901ec51bccadd54a64fdbcb53064", "score": "0.45839795", "text": "func generateTestChain(numToGenerate uint32, node *rpcclient.Client) error {\n\tfmt.Printf(\"Generating %v blocks...\\n\", numToGenerate)\n\t_, err := node.Generate(numToGenerate)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"Block generation complete.\")\n\treturn nil\n}", "title": "" }, { "docid": "941ce20bc0de29702028443e449c4301", "score": "0.4572895", "text": "func generateComp() []float64 {\n\t/* \tBayes theorem\n\tP(T)\t=\t(1 / N * Ratio(30%)) + ...nTH\n\tPE(1)\t= (1 / N * Ratio(30%)) / P(T)\n\t*/\n\tdr := DefRange{cMin, cMax}\n\t//randSrc ensures that the number that is generated is random\n\trandSrc := rand.New(rand.NewSource(now()))\n\tCF := dr.ConsRandom(randSrc, TotalProfileRead)\n\tpr := make([]float64, TotalProfileRead)\n\t//fmt.Printf(\"Worker's profile(Random)\t\t\t\t= %v\\n\", CF)\n\ttcm := totalValueMatrix(CF)\n\tfor i, f := range CF {\n\t\tp := float64(float64(f) / float64(tcm)) //5 replaced by all factors\n\t\tpr[i] = p * w1\n\t}\n\treturn pr\n}", "title": "" }, { "docid": "e92443fc537c979c8753a995b368ba06", "score": "0.45344922", "text": "func (chain *Chain) Generate(current NGram) (string, error) {\n\tif len(current) != chain.Order {\n\t\treturn \"\", errors.New(\"N-gram length does not match chain order\")\n\t}\n\tif current[len(current)-1] == EndToken {\n\t\t// Dont generate anything after the end token\n\t\treturn \"\", nil\n\t}\n\tcurrentIndex, currentExists := chain.statePool.get(current.key())\n\tif !currentExists {\n\t\treturn \"\", fmt.Errorf(\"Unknown ngram %v\", current)\n\t}\n\tarr := chain.frequencyMat[currentIndex]\n\tsum := arr.sum()\n\trandN := rand.Intn(sum)\n\tfor i, freq := range arr {\n\t\trandN -= freq\n\t\tif randN <= 0 {\n\t\t\treturn chain.statePool.intMap[i], nil\n\t\t}\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "723ba159462ab913827cfe0dd2e5fa1c", "score": "0.45225325", "text": "func (w *Word) RandWordsList(tx *sqlx.Tx, amount int) ([]string , error){\n var wordList []string\n err := w.db.Select(&wordList,\"SELECT word FROM Words_T ORDER BY RAND() LIMIT ?\", amount)\n if err != nil{\n return nil, err\n }\n return wordList, nil\n}", "title": "" }, { "docid": "334b5a54c37ed3d54846dad8e40b0e4e", "score": "0.44855136", "text": "func MostCommon10(text string) []string {\n\twordMap := make(map[string]int)\n\twords := re.FindAllString(text, -1)\n\tfor _, w := range words {\n\t\twordMap[w]++\n\t}\n\tresult := []string{}\n\tsorted := sortWordByQuantity(wordMap)\n\tfor _, v := range sorted {\n\t\tresult = append(result, v.word)\n\t\tif len(result) == 10 {\n\t\t\treturn result\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c67e288c46500a0780a807fe070b3c2b", "score": "0.44591054", "text": "func GenerateN(dFirst OutputIter, count int, g Generator) OutputIter {\n\tfor ; count > 0; count-- {\n\t\tdFirst = _writeNext(dFirst, g())\n\t}\n\treturn dFirst\n}", "title": "" }, { "docid": "60b285fb8bbf2f3109d3545d1216d9dd", "score": "0.44094706", "text": "func main() {\n\tdefer profile.Start().Stop()\n\ttexts := []string{\"Hello, my name is Aaron\",\n\t\t\"Goodbye, I will see you later\",\n\t\t\"What a beautiful day it is\"}\n\n\tfmt.Println(ConcurrentLetterFrequency(texts))\n}", "title": "" }, { "docid": "11e2c5406b1d68688874ee543a716144", "score": "0.44093472", "text": "func (c *Chain) Build(r io.Reader) error {\n\tscans := bufio.NewScanner(r)\n\tscans.Split(scanSentence)\n\n\tfor scans.Scan() {\n\t\tsent := strings.ToLower(scans.Text())\n\t\tsentr := strings.NewReader(sent)\n\n\t\tscw := bufio.NewScanner(sentr)\n\t\tscw.Split(bufio.ScanWords)\n\n\t\twords := 0\n\t\tfirst := true\n\n\t\tp := make(Prefix, markovOrder)\n\n\t\tfor scw.Scan() {\n\t\t\tword := scw.Text()\n\t\t\twords++\n\t\t\tif words < markovOrder+1 {\n\t\t\t\tp.Shift(word)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif first {\n\t\t\t\tc.prefixes[p.String()] = true\n\t\t\t\tc.putprefix(p)\n\t\t\t\tfirst = false\n\t\t\t}\n\n\t\t\tsuf := c.getgram(p)\n\t\t\tsuf.Insert(word)\n\t\t\tc.upgram(p, suf)\n\n\t\t\tp.Shift(word)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "775eea804e30223c7404693ddb14b9b0", "score": "0.43961826", "text": "func Chain(block string, count int) ([]string, error) {\n\tpayload := map[string]interface{}{\n\t\t\"block\": block,\n\t\t\"count\": count,\n\t}\n\n\treturn client.fetchSlice(\"chain\", payload, \"blocks\")\n}", "title": "" }, { "docid": "5d99889f55fe9aa2791a67e6035ac608", "score": "0.4395939", "text": "func CollatzLength(n int) Collat {\n workers := 5\n numbers := make(chan int, workers*100)\n finished := make(chan Collat, workers*500)\n\n // init map in global cache\n cache.data = make(map[int]int)\n\n // start genator thread\n go generate(n, numbers)\n\n // start worker threads\n for i:=0; i<workers; i++ {\n go worker(numbers, finished)\n }\n\n // use current thread as collector thread and return value from collect func\n return collect(n, finished)\n}", "title": "" }, { "docid": "7d3d0b2b0e5c2b4676ed37a58fb2b58a", "score": "0.43900767", "text": "func (m *MarkovChain) Generate() string {\n\tvar sentence, prefix string\n\trand := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tprefix = strings.Repeat(delim, 2)\n\tfor {\n\t\tsuffixMap := m.chain[prefix]\n\t\tvar keys []string\n\t\tfor key := range suffixMap {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\n\t\tsuffix := keys[rand.Intn(len(keys))]\n\t\tif len(suffix) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tsentence = sentence + delim + suffix\n\t\tprefix = nextPrefix(prefix, suffix)\n\t}\n\treturn strings.TrimSpace(sentence)\n}", "title": "" }, { "docid": "0286f1e045068e621fd3d4e8959a2150", "score": "0.4385652", "text": "func (chain *Chain) GenerateOnTopic(n int, sentence string) string {\n\tvar newSentence string\n\twords := chain.GetWordsByPopularity(sentence)\n\n\tfor _, w := range words {\n\t\tlog.Printf(\"Chosen word: %s\", w)\n\n\t\tnewSentence = chain.GenerateFromWord(n, w)\n\t\tspaceCount := strings.Count(newSentence, \" \")\n\n\t\tif newSentence != sentence && spaceCount > 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tlog.Printf(\"Same sentence generated, retrying...\")\n\t}\n\n\treturn newSentence\n}", "title": "" }, { "docid": "e1ef907ddfc79d51e953b76e43e333d4", "score": "0.43842036", "text": "func wordCount() int {\n\tnumbers := []int{13, 21, 34, 55, 89, 144}\n\treturn numbers[rand.Intn(len(numbers))]\n}", "title": "" }, { "docid": "bbf396bff452b0de0fbfd55810b0c240", "score": "0.437134", "text": "func GenerateCids(n int) []cid.Cid {\n\tcids := make([]cid.Cid, 0, n)\n\tfor i := 0; i < n; i++ {\n\t\tc := blockGenerator.Next().Cid()\n\t\tcids = append(cids, c)\n\t}\n\treturn cids\n}", "title": "" }, { "docid": "2bdb046a55023489edb5a9e904f5b35c", "score": "0.43708572", "text": "func gen() []interface{} {\n\tv := make([]interface{}, 32)\n\tfor i := 0; i < 32; i++ {\n\t\tv[i] = i\n\t}\n\treturn v\n}", "title": "" }, { "docid": "05366350edc5641551091143222272e4", "score": "0.43668926", "text": "func genWorkUnit(l int) (out WorkUnit) {\n\tout = make(WorkUnit, l)\n\tfor i := 0; i < l; i++ {\n\t\tout <- r.Int() % 100\n\t}\n\tclose(out)\n\treturn\n}", "title": "" }, { "docid": "cf0aead62432b631a1dd7b095601250d", "score": "0.4356995", "text": "func main() {\n\tword := getArgument()\n\tif word == \"-1\" {\n\t\tos.Exit(-1)\n\t}\n\tchanIn := make(chan uint64, 50)\n\tfor idx,_ := range word {\n\t\tgo count(chanIn, word[idx:])\n\t}\n\tvar acc uint64\n\tacc = 1\n\tfor i := 0; i < len(word); i++ {\n\t\tacc += <- chanIn\n\t}\n\tfmt.Println(acc)\n}", "title": "" }, { "docid": "ed21009157e4f3097c1e771b4bee760c", "score": "0.43491358", "text": "func runGoBuildChain(platforms *[]gotools.Platform) (*[]string, error) {\n\tpaths := &[]string{}\n\n\tlog.Println(\"Running go generate...\")\n\terr := goGenerate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, p := range *platforms {\n\t\tlog.Println(\"Building \" + buildName(appName, appVersion, &p) + \"...\")\n\t\tpath, err := goBuild(appName, appVersion, &p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t*paths = append(*paths, path)\n\t}\n\treturn paths, nil\n}", "title": "" }, { "docid": "14801e42dbbe71fc42f1e89804465f7a", "score": "0.43462685", "text": "func (langs *LanguagesDetection) Fork(n int) []core.PipelineItem {\n\treturn core.ForkSamePipelineItem(langs, n)\n}", "title": "" }, { "docid": "499bd8c24ca19c225b94ccf554e6abac", "score": "0.43385714", "text": "func initChain(vals []int) int {\n\tchn = make([]int, chnLen+1)\n\tfor i := 0; i < 8; i++ {\n\t\tchn[vals[i]] = vals[i+1]\n\t}\n\tif chnLen > 9 {\n\t\tchn[vals[8]] = 10\t\t\n\t\tfor i := 10; i < chnLen; i++ {\n\t\t\tchn[i] = i+1\n\t\t}\n\t\tchn[chnLen] = vals[0]\n\t} else {\n\t\tchn[vals[8]] = vals[0]\n\t}\n\n\treturn vals[0]\n}", "title": "" }, { "docid": "f5e2ab9d233a1452e7bf6d69646f252f", "score": "0.4332607", "text": "func GenElems(n int) []int {\n\ta := make([]int, n, n)\n\tmax := n * 4\n\tfor i := range a {\n\t\ta[i] = rand.Intn(max)\n\t}\n\treturn a\n}", "title": "" }, { "docid": "b24882d16d3e2e04f5addab46f047ad8", "score": "0.43319252", "text": "func GenerateCombinations(alphabet string, length int) <-chan string {\n\tc := make(chan string)\n\n\t// Starting a separate goroutine that will create all the combinations,\n\t// feeding them to the channel c\n\tgo func(c chan string) {\n\t\tdefer close(c) // Once the iteration function is finished, we close the channel\n\n\t\tAddLetter(c, \"\", alphabet, length) // We start by feeding it an empty string\n\t}(c)\n\n\treturn c // Return the channel to the calling function\n}", "title": "" }, { "docid": "ea7ad9a5e1cc97f1c8d2666e19c72a7a", "score": "0.4331312", "text": "func (rsg *Generator) Generate(n int) string {\n\tvar letterIdxMask int64 = 1<<rsg.letterIdxBits - 1 // All 1-bits, as many as letterIdxBits\n\tvar letterIdxMax = 63 / rsg.letterIdxBits // # of letter indices fitting in 63 bits\n\tvar src = rand.NewSource(time.Now().UnixNano())\n\tb := make([]byte, n)\n\t// A src.Int63() generates 63 random bits, enough for letterIdxMax characters!\n\tfor i, cache, remain := n-1, src.Int63(), letterIdxMax; i >= 0; {\n\t\tif remain == 0 {\n\t\t\tcache, remain = src.Int63(), letterIdxMax\n\t\t}\n\t\tif idx := int(cache & letterIdxMask); idx < rsg.charsetLength {\n\t\t\tb[i] = rsg.charset[idx]\n\t\t\ti--\n\t\t}\n\t\tcache >>= rsg.letterIdxBits\n\t\tremain--\n\t}\n\n\treturn string(b)\n}", "title": "" }, { "docid": "3d3ab93ecaac83f37fdac244019ce0ce", "score": "0.43092978", "text": "func (greedy *GreedySolver) FindWordChains(from string, to string, wordList []string) ([][]string, error) {\n\tif len([]rune(from)) != len([]rune(to)) {\n\t\treturn nil, ErrorWordLengthDoesNotMatch\n\t}\n\tgreedy.from = from\n\tgreedy.to = to\n\tgreedy.wordList = wordList\n\tgreedy.maxDepth = len(from) * 3\n\n\tgreedy.getUsefulWordOnly()\n\n\tsolutions := greedy.getPath()\n\tgreedy.Clean()\n\treturn getBestSolution(solutions), nil\n}", "title": "" }, { "docid": "29a3badb35e4438bbd52d20648bb0cfd", "score": "0.43062165", "text": "func RandStringRunes(n int) string {\n b := make([]rune, n)\n for i := range b {\n b[i] = letterRunes[rand.Intn(len(letterRunes))]\n }\n return string(b)\n}", "title": "" }, { "docid": "871c1d4bb0f915fe27a01ddd35da0bbe", "score": "0.4302518", "text": "func NewNGramChain(n uint) (*NGramChain, error) {\n\tif n <= 1 {\n\t\treturn nil, errors.New(\"error initialising NGramChain: n must be at least 2\")\n\t}\n\n\treturn &NGramChain{\n\t\tstore: make(map[string]*candidates),\n\t\t// having the randFunc as a field of the NGramChain allows for testing with deterministic output\n\t\trandFunc: rand.Intn,\n\t\tlock: &sync.RWMutex{},\n\t\tn: n,\n\t}, nil\n}", "title": "" }, { "docid": "1fd528e3ac020caffa016523e906b255", "score": "0.43011904", "text": "func (h *HMM) GenerateSpeechWithNumWords(numWords int) string {\n\tvar speech []string\n\n\tn := len(h.firstWords)\n\tcurWord := h.firstWords[rand.Intn(n)]\n\n\tfor i := 0; i < numWords; i++ {\n\t\tspeech = append(speech, curWord)\n\t\tcurWord = getNextWord(curWord, h.probMap)\n\n\t\t// If we roll a newline char, keep rolling until we don't get a newline.\n\t\tfor curWord == \"\\n\" {\n\t\t\tcurWord = getNextWord(curWord, h.probMap)\n\t\t}\n\t}\n\n\toutput := strings.Join(speech, \" \")\n\treturn strings.TrimSpace(output)\n}", "title": "" }, { "docid": "1471e78aca3616f507981e022f72f5be", "score": "0.4289945", "text": "func allNgrams(n int) []string {\n\tif n == 0 {\n\t\treturn []string{}\n\t} else if n == 1 {\n\t\treturn lowerCaseLetters\n\t}\n\n\tnewNgrams := make([]string, 0)\n\tfor _, letter := range lowerCaseLetters {\n\t\tfor _, ngram := range allNgrams(n - 1) {\n\t\t\tnewNgrams = append(newNgrams, letter+ngram)\n\t\t}\n\t}\n\treturn newNgrams\n}", "title": "" }, { "docid": "8a4889f2f68767d1149db4c0c04e3aa7", "score": "0.42856777", "text": "func generateFuzzList(repeat int) {\n}", "title": "" }, { "docid": "0311d4dd86a5d65b5d6764185ba3beba", "score": "0.42767757", "text": "func GenChpts(lambda int, sid int, B int, parties []int, h int) ([][]supportCode.Nonce, [][][]int) { // do this before onion forming and pass it in?\n\tnoncesList := make([][]supportCode.Nonce, 0)\n\tfor i := 0; i < len(parties); i++ { // creates the 2D array\n\t\tnonceList := make([]supportCode.Nonce, 0)\n\t\tnoncesList = append(noncesList, nonceList)\n\t}\n\texpected := make([][][]int, 0) //create the expected nonces: intervals x parties x nonces\n\tfor i := 0; i < int(math.Log2(float64(B)))+1; i++ { //creates the 3D array\n\t\tfirstLayer := make([][]int, 0)\n\t\texpected = append(expected, firstLayer)\n\t\tfor j := 0; j < len(parties); j++ {\n\t\t\tsecondLayer := make([]int, 0)\n\t\t\texpected[i] = append(expected[i], secondLayer)\n\t\t}\n\t}\n\tfor i := 0; i < h; i++ { //This goes through every height of the Binary Tree\n\t\t//for every interval number\n\t\tfor j := 0; j < len(parties); j++ {\n\t\t\t//for every party before selfID(so only checks once)\n\t\t\tfor k := 0; k <= j; k++ {\n\t\t\t\tif j == k {\n\t\t\t\t\tcreateDummy := CheckToDummy(B, ALPHA*2, float64(len(parties))) //double the probability\n\t\t\t\t\tif createDummy { //same as below, but only creating one\n\t\t\t\t\t\tnonce := supportCode.Nonce{i + 1, k, FUNCTIONFORCODE()}\n\t\t\t\t\t\tnoncesList[j] = append(noncesList[j], nonce)\n\t\t\t\t\t\texpected[i][k] = append(expected[i][k], nonce.Nonce) //also add to expected\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcreateDummy := CheckToDummy(B, ALPHA*2, float64(len(parties))) //check with probablity based on code\n\t\t\t\t\tif createDummy { //create symmetric nonces\n\t\t\t\t\t\tnonceNumber := FUNCTIONFORCODE() //change for actual function or fake it\n\t\t\t\t\t\tnonce1 := supportCode.Nonce{i + 1, j, nonceNumber}\n\t\t\t\t\t\tnonce2 := supportCode.Nonce{i + 1, k, nonceNumber}\n\n\t\t\t\t\t\tnoncesList[k] = append(noncesList[k], nonce1)\n\t\t\t\t\t\texpected[i][k] = append(expected[i][k], nonceNumber) //also add to expected\n\t\t\t\t\t\tnoncesList[j] = append(noncesList[j], nonce2)\n\t\t\t\t\t\texpected[i][j] = append(expected[i][j], nonceNumber) //also add to expected\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn noncesList, expected\n}", "title": "" }, { "docid": "a3095f1800203f26b96f8e2a6d3b9c82", "score": "0.42707768", "text": "func NewChain(leaderLen int) *Chain {\n\treturn &Chain{\n\t\tforward: make(map[string][]string),\n\t\tbackward: make(map[string][]string),\n\t\twords: make(map[string]uint64),\n\t\tleaderLen: leaderLen,\n\t}\n}", "title": "" }, { "docid": "94f1effde22b1828beea0b033ca1d56a", "score": "0.42645413", "text": "func (c *CircuitGen) Generate(numGates int) (<-chan Circuit, int) {\n\tfor len(c.cache) <= numGates && c.cacheRemaining > 0 {\n\t\tc.extendCache()\n\t}\n\n\tch := make(chan Circuit, 10)\n\n\tif numGates < len(c.cache) {\n\t\tgo func() {\n\t\t\tdefer close(ch)\n\t\t\tfor _, circ := range c.cache[numGates] {\n\t\t\t\tch <- circ\n\t\t\t}\n\t\t}()\n\t\treturn ch, len(c.cache[numGates])\n\t}\n\n\tsubCh, subCount := c.Generate(numGates - len(c.cache) + 1)\n\tgo func() {\n\t\tdefer close(ch)\n\t\tfor subCirc := range subCh {\n\t\t\tfor _, circ := range c.cache[len(c.cache)-1] {\n\t\t\t\tch <- append(append(Circuit{}, subCirc...), circ...)\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn ch, subCount * len(c.cache[len(c.cache)-1])\n}", "title": "" }, { "docid": "efd6fbea31501e2b82e0ff07b9aaf42d", "score": "0.42488182", "text": "func Iterations(n int) {\n\tTee(fmt.Sprint(n))\n}", "title": "" }, { "docid": "0cb7f55c3b9bf237a701ead24d04c551", "score": "0.42407608", "text": "func String(n int) string {\n runes := make([]rune, n)\n for i := range runes {\n // I'm not sure if len(letterRunes) will ever go out of bounds here or not...\n runes[i] = letterRunes[mrand.Intn(len(letterRunes))]\n }\n return string(runes)\n}", "title": "" }, { "docid": "8c4b94dd1892556ccf5ee19eaa5fc835", "score": "0.42338046", "text": "func GenerateStandardDecks(n int) (d models.Decks) {\n\tfor i := 0; i < n; i++ {\n\t\td = append(d, NewStandardDeck())\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d253f248012b8ca0164a542acd7b79fc", "score": "0.42336568", "text": "func (content TranslatedProvider) CustomChain(chain []string) Translated {\n\tif len(chain) == 0 {\n\t\tfor _, v := range content {\n\t\t\treturn v\n\t\t}\n\t}\n\n\tinverseChain := make([]string, 0, len(chain))\n\tfor i := len(chain) - 1; i >= 0; i-- {\n\t\tinverseChain = append(inverseChain, chain[i])\n\t}\n\n\tresult := make(Translated)\n\tfor _, p := range inverseChain {\n\t\tfor lang, value := range content[p] {\n\t\t\tif value != \"\" {\n\t\t\t\tresult[lang] = value\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "be6a151efae8fd9c9c54c27733379287", "score": "0.42297366", "text": "func GeneratePeers(n int) []peer.ID {\n\tpeerIds := make([]peer.ID, 0, n)\n\tfor i := 0; i < n; i++ {\n\t\tpeerSeq++\n\t\tp := peer.ID(fmt.Sprint(peerSeq))\n\t\tpeerIds = append(peerIds, p)\n\t}\n\treturn peerIds\n}", "title": "" }, { "docid": "239143981d470f06ff055aea925fa77a", "score": "0.42289424", "text": "func (l Lorem) Words(nbWords int) []string {\n\twords := make([]string, 0, nbWords)\n\tfor i := 0; i < nbWords; i++ {\n\t\twords = append(words, l.Word())\n\t}\n\n\treturn words\n}", "title": "" }, { "docid": "f15b6f22e6ae100b585c40716e3aa977", "score": "0.42253628", "text": "func GenControlers(db *gorm.DB) string {\n\n\tcontrollersCodeReg := \"\"\n\n\t// create the list of structs\n\tvar structs []models.Struct\n\tdb.Find(&structs)\n\n\tfor _, _struct := range structs {\n\t\tfilename := filepath.Join(ControllersPkgGenPath, fmt.Sprintf(\"%s.go\", _struct.Name))\n\n\t\t// we should use go generate\n\t\tlog.Println(\"generating controller file : \" + filename)\n\n\t\tf, err := os.Create(filename)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\tlowerCaseStructName := strings.ToLower(_struct.Name)\n\n\t\tres := strings.ReplaceAll(controlerTemplate, \"{{Structname}}\", _struct.Name)\n\t\tres = strings.ReplaceAll(res, \"{{structname}}\", lowerCaseStructName)\n\n\t\tcontrollersCode, controllersCodeID, _controllersCodeReg := genControllersAssociation(db, _struct)\n\n\t\tcontrollersCodeReg += _controllersCodeReg\n\n\t\tres = strings.ReplaceAll(res, \"{{AssociationControllers}}\", controllersCode)\n\t\tres = strings.ReplaceAll(res, \"{{AssociationControllerIDs}}\", controllersCodeID)\n\t\tres = strings.ReplaceAll(res, \"{{PkgPathRoot}}\", strings.ReplaceAll(PkgGoPath, \"/models\", \"\"))\n\n\t\tfmt.Fprintf(f, \"%s\", res)\n\n\t\tdefer f.Close()\n\n\t}\n\treturn controllersCodeReg\n}", "title": "" }, { "docid": "0b8d78a43ae299bfc59b8193bfa11d02", "score": "0.42132095", "text": "func manyDemo() {\n\tfor i := 0; i < 1000; i++ {\n\t\tgo f(i)\n\t}\n\tvar input string\n\tfmt.Scanln(&input)\n}", "title": "" }, { "docid": "70f2266072b7435702e89583d71151b7", "score": "0.42123157", "text": "func (gn *Gen) GenSeq() string {\n\tcatstr := \"\"\n\tprv := -1\n\tcnt := 0\n\tfor cnt < gn.NWords {\n\t\tidx := rand.Intn(len(gn.Words))\n\t\tif idx != prv {\n\t\t\tcatstr += gn.Words[idx]\n\t\t\tif cnt < gn.NWords-1 {\n\t\t\t\tcatstr += gn.Separator\n\t\t\t}\n\t\t\tcnt++\n\t\t\tprv = idx\n\t\t}\n\t}\n\tcatstr += \"\\n\"\n\treturn catstr\n}", "title": "" }, { "docid": "d0ffa7df0ef7674d7fd756d788f7d9c7", "score": "0.42066824", "text": "func Generate() string {\n\trand.Seed(time.Now().Unix())\n\tstart, _ := utf8.DecodeRuneInString(\"a\")\n\tend, _ := utf8.DecodeRuneInString(\"z\")\n\tr := int(end) - int(start)\n\tresult := \"\"\n\tfor i := 0; i < 6; i++ {\n\t\tc := rand.Intn(r)\n\t\tresult += string(rune(int(start) + c))\n\t}\n\treturn result\n}", "title": "" }, { "docid": "f1eef5c8a12343bb6d862015d35b1711", "score": "0.42012492", "text": "func generate(codesInUse map[string]bool, word chan string) (map[string]bool, string) {\n\n\t//TODO: make n = 6, 7, 8 randomly with appropriate weightings\n\t//\t\tgiven the distribution of max^6, max^7 and max^8\n\tn := 8 // number of words in unique code\n\tvar str string // stores unique code\n\n\tfor codesInUse[str] { // If the code is in use, try again\n\n\t\tfor i := 0; i < n; i++ {\n\t\t\tx := <-word\n\t\t\tstr += x // Get a word and add it to the string\n\t\t\tif i < n-1 {\n\t\t\t\tstr += \" \"\n\t\t\t}\n\t\t} // A candidate code has been generated\n\n\t} // A unique code has been generated\n\n\t// Mark code as in use\n\tcodesInUse[str] = true\n\n\treturn codesInUse, str\n\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.4184008", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.4184008", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "b98668e776c764d2fe53d7c796222b1d", "score": "0.4184008", "text": "func NewChain(prefixLen int) *Chain {\n\treturn &Chain{make(map[string][]string), prefixLen}\n}", "title": "" }, { "docid": "f5fc063c518bd31edb21d9fc71683a17", "score": "0.4183673", "text": "func gen(batches int) <-chan int {\n\tout := make(chan int)\n\tgo func() {\n\t\tfor i := 0; i < batches; i++ {\n\t\t\tfor j := 3; j < 13; j++ {\n\t\t\t\tout <- j\n\t\t\t}\n\t\t}\n\t\tclose(out)\n\t}()\n\treturn out\n}", "title": "" }, { "docid": "d30dbe9c1ea8556e452325a42ada4db0", "score": "0.4180301", "text": "func Generate(length int) string {\n\trand.Seed(time.Now().UTC().UnixNano())\n\n\tvar s strings.Builder\n\tfor i := 0; i < length-1; i++ {\n\t\ts.WriteString(strconv.Itoa(rand.Intn(9)))\n\t}\n\n\t_, res, _ := Calculate(s.String()) //ignore error because this will always be valid\n\treturn res\n}", "title": "" }, { "docid": "7574bcf5243311edeb97c1b1ce196f64", "score": "0.41794142", "text": "func (tc *testChain) generate(n int, seed byte, parent *model.Block, heavy bool) {\n\tblocks, _ := blockchain.GenerateChain(config.TestChainConfig, parent, ethash.NewFaker(), testDB, n, func(i int, block *blockchain.BlockGen) {\n\t\tblock.SetCoinbase(common.Address{seed})\n\t\t// If a heavy chain is requested, delay blocks to raise difficulty\n\t\tif heavy {\n\t\t\tblock.OffsetTime(-9)\n\t\t}\n\t\t// Include transactions to the miner to make blocks more interesting.\n\t\tif parent == tc.blocks[0] && i%22 == 0 {\n\t\t\tsigner := model.MakeSigner(config.TestChainConfig, block.Number())\n\t\t\ttx, err := model.SignTx(model.NewTransaction(block.TxNonce(testAddress), common.Address{seed}, big.NewInt(1000), config.TxGas, block.BaseFee(), nil), signer, testKey)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tblock.AddTx(tx)\n\t\t}\n\t\t// if the block number is a multiple of 5, add a bonus uncle to the block\n\t\tif i > 0 && i%5 == 0 {\n\t\t\tblock.AddUncle(&model.Header{\n\t\t\t\tParentHash: block.PrevBlock(i - 2).Hash(),\n\t\t\t\tNumber: big.NewInt(block.Number().Int64() - 1),\n\t\t\t})\n\t\t}\n\t})\n\ttc.blocks = append(tc.blocks, blocks...)\n}", "title": "" }, { "docid": "b6a2cdf073fbf72c91c1b3d55da1ed14", "score": "0.41748038", "text": "func (g *Generator) Generate(req *common.Req, res *common.Res) error {\n\tcontext := req.Context\n\n\tif context == nil || context.Config == nil {\n\t\treturn nil\n\t}\n\n\tif !common.IsIn(\"kit\", context.Config.Generators...) {\n\t\treturn nil\n\t}\n\n\tif req.Schema == nil {\n\t\tif req.SchemaStr == \"\" {\n\t\t\treturn errors.New(\"both schema and string schema is not set\")\n\t\t}\n\n\t\ts := &schema.Schema{}\n\t\tif err := json.Unmarshal([]byte(req.SchemaStr), s); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treq.Schema = s.Resolve(nil)\n\t}\n\n\tsettings, ok := req.Schema.Generators.Get(\"workers\")\n\tif !ok {\n\t\tsettings = schema.Generator{}\n\t}\n\n\tsettings.SetNX(\"rootPathPrefix\", \"workers\")\n\trootPathPrefix := settings.Get(\"rootPathPrefix\").(string)\n\tfullPathPrefix := req.Context.Config.Target + rootPathPrefix + \"/\"\n\tsettings.Set(\"fullPathPrefix\", fullPathPrefix)\n\n\t// TODO(cihangir) remove this statement when Process transition is complete\n\treq.Context.Config.Target = fullPathPrefix\n\toutputs, err := GenerateKitWorker(context, req.Schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutput, err := GenerateInterface(context, req.Schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutputs = append(outputs, output...)\n\n\toutput, err = GenerateTransportHTTPSemiotics(context, req.Schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\toutputs = append(outputs, output...)\n\n\toutput, err = GenerateTransportHTTPServer(context, req.Schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutputs = append(outputs, output...)\n\n\toutput, err = GenerateTransportHTTPClient(context, req.Schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutputs = append(outputs, output...)\n\n\toutput, err = GenerateService(context, req.Schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\toutputs = append(outputs, output...)\n\n\tres.Output = outputs\n\treturn nil\n}", "title": "" }, { "docid": "b2bcbb2ffd7022009c49e66eb981509c", "score": "0.41746342", "text": "func TestChordManyInitialization(t *testing.T) {\n\ttestSize := 50\n\tfmt.Printf(\"Test: Chord %d initializations ...\\n\", testSize)\n\terr := initializeChordRing(testSize)\n\tif err != nil {\n\t\tt.Fatalf(\"Chord many initialization failed: %s\", err)\n\t}\n\n\tfmt.Println(\" ... Passed\")\n}", "title": "" }, { "docid": "f94dcc839de2d70797d92f97399cc433", "score": "0.41716936", "text": "func Gen(args []string) (string, error) {\n\tnum := runtime.NumCPU()\n\tsuffix := args[0]\n\tlimit := args[1]\n\tdur, err := time.ParseDuration(limit)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tticker := time.NewTicker(dur)\n\tdefer ticker.Stop()\n\tch := make(chan string, num)\n\tfor i := 0; i < num; i++ {\n\t\tgo gen(suffix, ch)\n\t}\n\tfor {\n\t\tselect {\n\t\tcase ret := <-ch:\n\t\t\treturn ret, nil\n\t\tcase <-ticker.C:\n\t\t\treturn \"\", ErrTimeOut\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3016da6a073007521b8671df6777b1c1", "score": "0.4163445", "text": "func CollectWordsExecute(tuple CraneTuple.CraneTuple) ([]CraneTuple.CraneTuple, error) {\n\tif word, ok := tuple.TupleData[0].(string); ok {\n\t\twords[word]++\n\t\twordSum++\n\t\tvar result []CraneTuple.CraneTuple\n\t\tif wordSum%1000 == 0 {\n\t\t\tfor word, count := range words {\n\t\t\t\tresult = append(result, CraneTuple.CraneTuple{[]interface{}{word, count}})\n\t\t\t}\n\t\t}\n\t\treturn result, nil\n\t} else {\n\t\treturn nil, TypeMismatch{\"CollectWords mismatch\"}\n\t}\n}", "title": "" }, { "docid": "22fc17034511afa58d9a6b7de1db538e", "score": "0.41580576", "text": "func GenerateParenthesis(n int) []string {\n\tvar result []string\n\tparenthesis := func(l, r int, result *[]string, p string) {}\n\tparenthesis = func(l, r int, result *[]string, p string) {\n\t\t// 如果l,r都为0,则表明进入了最底一层,开始进行append\n\t\tif l == 0 && r == 0 {\n\t\t\t*result = append(*result, p)\n\t\t}\n\n\t\t// 剩余的左括号不能大于右括号\n\t\tif l > r || l < 0 || r < 0 {\n\t\t\treturn\n\t\t}\n\t\tparenthesis(l-1, r, result, p+\"(\")\n\t\tparenthesis(l, r-1, result, p+\")\")\n\t}\n\tparenthesis(n, n, &result, \"\")\n\treturn result\n}", "title": "" }, { "docid": "0b1f5e06d0544ca4d6a674067f06f1e5", "score": "0.41538936", "text": "func setup(individualCount int, n int, records []Record ) []Individual {\n parents := []Individual{}\n for i := 0; i < individualCount; i++{\n genes := []int{}\n for j := 0; j < n; j++{\n genes = append(genes, randomAction())\n }\n individual := Individual{id: RandStringRunes(IDLength),genes:genes, cash:startingWorth, stocks:0, worth:startingWorth}\n calculate(&individual, records)\n parents = append(parents, individual)\n genes = []int{}\n }\n return parents\n}", "title": "" }, { "docid": "5985cdce046d6d09efd9a53c778b4cbc", "score": "0.41512313", "text": "func gen(n int) <-chan int {\n\tch := make(chan int)\n\tgo func() {\n\t\tfor i := 1; i <= n; i++ {\n\t\t\tch <- i\n\t\t}\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "0bd6910de268c4e7ca43b759b725d737", "score": "0.41503108", "text": "func Fit(path string, procs int, words []string) map[string]*Sample {\n\tmodelPath := \"model.bin\"\n\tif Exists(modelPath) {\n\t\tm := Load(modelPath)\n\t\treturn m\n\t}\n\n\tnewSamples := NewSet()\n\tnewCats := NewCats()\n\n\tinFile, _ := os.Open(path)\n\tdefer inFile.Close()\n\n\tfileBytes, _ := ioutil.ReadFile(path)\n\tfileAsString := string(fileBytes)\n\tlines := strings.Split(fileAsString, \"\\n\")\n\tlines = lines[0 : len(lines)-1]\n\ttotalLines := len(lines)\n\tchunkSize := totalLines / procs\n\trest := totalLines % procs\n\twg := &sync.WaitGroup{}\n\n\tfor idx := 0; idx < procs; idx++ {\n\t\tchunk := lines[chunkSize*(idx) : chunkSize*(idx+1)+rest]\n\t\twg.Add(1)\n\n\t\tgo func(chunk []string) {\n\t\t\tfor _, line := range chunk {\n\t\t\t\tif len(line) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsplitedStr := strings.Split(line, \"#\")\n\t\t\t\tcategory, description := splitedStr[0], splitedStr[1]\n\t\t\t\ttotal := ngrams.MakeN(description, 3, words)\n\t\t\t\ti, err := strconv.Atoi(category)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfor _, value := range total {\n\t\t\t\t\tnewCats.Add(uint(i))\n\t\t\t\t\tok := newSamples.Has(value)\n\t\t\t\t\tif ok {\n\t\t\t\t\t\tnewSamples.Update(value, uint(i))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// init\n\t\t\t\t\t\tsample := &Sample{\n\t\t\t\t\t\t\tNgram: value,\n\t\t\t\t\t\t\tFreq: 1.0,\n\t\t\t\t\t\t\tClasses: make(map[uint]float64),\n\t\t\t\t\t\t\tTfidf: make(map[uint]float64),\n\t\t\t\t\t\t\tMaximum: 0.0,\n\t\t\t\t\t\t\tMinimum: 100000000.0,\n\t\t\t\t\t\t\tWeighted: false,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewSamples.Add(value, sample, uint(i))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(chunk)\n\t}\n\twg.Wait()\n\n\tfor _, sample := range newSamples.m {\n\t\tsample.toProb()\n\t}\n\n\tSaveModel(modelPath, newSamples.m)\n\treturn newSamples.m\n}", "title": "" }, { "docid": "6f2114fe84d6992a87087000686b5bd8", "score": "0.41486236", "text": "func (m *Model) cosineN(v Vector, n int) []Match {\n\tr := make([]Match, n)\n\tfor w, u := range m.words {\n\t\tscore := v.Dot(u)\n\t\tp := Match{w, score}\n\t\t// TODO(dhowden): MaxHeap would be better here if n is large.\n\t\tif r[n-1].Score > p.Score {\n\t\t\tcontinue\n\t\t}\n\t\tr[n-1] = p\n\t\tfor j := n - 2; j >= 0; j-- {\n\t\t\tif r[j].Score > p.Score {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tr[j], r[j+1] = p, r[j]\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "003303f0acc6d35399a7fb3bee020375", "score": "0.4141634", "text": "func CreateWordsWithDistanceFromLines(lines []string, MainWord string, fn distFunc) words {\n\tvar tmpWords words\n\tfor _, line := range lines {\n\t\ttmpWords = append(tmpWords, word{line, fn(MainWord, line)})\n\t}\n\treturn tmpWords\n}", "title": "" }, { "docid": "a3efe9cbf90c1c63f374bc2e3a627523", "score": "0.41389266", "text": "func gen(c chan int) {\n\tgo func() {\n\t\tfor i := 0; i < 10; i++ {\n\t\t\tc <- i\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "16e850f4d35106f592c92055e4cb697c", "score": "0.41224366", "text": "func mkRandomString(n int) string {\n\tb := make([]rune, n)\n\tfor i := range b {\n\t\tb[i] = letterRunes[rand.Intn(len(letterRunes))]\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "0041c29d47142954d505e7e426e7b5bf", "score": "0.41177568", "text": "func generateEvents(count int) []mesh.Event {\n\tgenerator := generators.New(generators.FixedRand())\n\ttopics := generator.Words(count)\n\treturn generateTopicEvents(topics)\n}", "title": "" }, { "docid": "c614e94afae74d5cc58d93c9dde6e00d", "score": "0.41169032", "text": "func FreqWords(c *gin.Context) {\n\twords := c.Query(\"limit\")\n\tword, err := strconv.Atoi(words)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, Response{Error: err.Error()})\n\t\treturn\n\t}\n\tfreqwords.Order = c.Query(\"order\")\n\tcommonwords := freqwords.CommonWords(\"filestore/\", word)\n\tfmt.Println(commonwords)\n\tc.JSON(http.StatusOK, gin.H{\"words\": commonwords})\n}", "title": "" }, { "docid": "602443c7337f6b73f6ccb1d8d10a856f", "score": "0.41148227", "text": "func GenerateNames() []string {\n\tnames := make([]string, NumNames)\n\n\ti := 0\n\tfor _, c1 := range UppercaseChars {\n\t\tfor _, c2 := range UppercaseChars {\n\t\t\tfor d1 := 0; d1 < 10; d1++ {\n\t\t\t\tfor d2 := 0; d2 < 10; d2++ {\n\t\t\t\t\tfor d3 := 0; d3 < 10; d3++ {\n\t\t\t\t\t\tnames[i] = fmt.Sprintf(\"%s%s%v%v%v\", string(c1), string(c2), d1, d2, d3)\n\t\t\t\t\t\ti++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn names\n}", "title": "" }, { "docid": "bd4f91d02e41c44ce79ae7e3916b60e3", "score": "0.4109166", "text": "func generateStrainSlice(file string) (strains []string) {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\txmfaReader := seq.NewXMFAReader(f)\n\tnumStrains := 0\n\tfor {\n\t\talignment, err := xmfaReader.Read()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif len(alignment) > 0 {\n\t\t\tfor _, s := range alignment {\n\t\t\t\t_, _, strain := getNames(s.Id)\n\t\t\t\tstrains = append(strains, strain)\n\t\t\t\tnumStrains++\n\t\t\t}\n\t\t\tfmt.Printf(\"\\r %d total strains\", numStrains)\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "223c1929dfe189281534f9b14823221e", "score": "0.4108787", "text": "func TestGenerateNodeChildren(t *testing.T) {\n\tfmt.Println(\"Testing generating children nodes method: 'generateNodeChildren'....\")\n\n\t//Arrange\n\twordNodeTest := newAStarWordNode(\"test\")\n\twordNodePest := newAStarWordNode(\"pest\")\n\twordNodeBest := newAStarWordNode(\"best\")\n\twordNodeBeat := newAStarWordNode(\"beat\")\n\twordNodeBrat := newAStarWordNode(\"brat\")\n\twordNodeBrag := newAStarWordNode(\"brag\")\n\n\tinputNode1 := &wordNodeTest\n\tinputDict1 := []*aStarWordNode{&wordNodePest, &wordNodeBest, &wordNodeBeat, &wordNodeBrat, &wordNodeBrag}\n\tresultChildren1 := []*aStarWordNode{&wordNodePest, &wordNodeBest}\n\tresultDict1 := []*aStarWordNode{&wordNodeBeat, &wordNodeBrat, &wordNodeBrag}\n\n\tinputNode2 := &wordNodeBest\n\tinputDict2 := []*aStarWordNode{&wordNodeTest, &wordNodePest, &wordNodeBeat, &wordNodeBrat, &wordNodeBrag}\n\tresultChildren2 := []*aStarWordNode{&wordNodeTest, &wordNodePest, &wordNodeBeat}\n\tresultDict2 := []*aStarWordNode{&wordNodeBrat, &wordNodeBrag}\n\n\tinputNode3 := &wordNodeBrag\n\tinputDict3 := []*aStarWordNode{&wordNodeTest, &wordNodeBest, &wordNodePest, &wordNodeBeat, &wordNodeBrat}\n\tresultChildren3 := []*aStarWordNode{&wordNodeBrat}\n\tresultDict3 := []*aStarWordNode{&wordNodeTest, &wordNodeBest, &wordNodePest, &wordNodeBeat}\n\n\ttestInputs := []aStarGenerateNodeChildren{\n\t\t{InputNode: inputNode1,\n\t\t\tInputDictionary: inputDict1,\n\t\t\tResultChildrenNodes: resultChildren1,\n\t\t\tResultDictionary: resultDict1},\n\t\t{InputNode: inputNode2,\n\t\t\tInputDictionary: inputDict2,\n\t\t\tResultChildrenNodes: resultChildren2,\n\t\t\tResultDictionary: resultDict2},\n\t\t{InputNode: inputNode3,\n\t\t\tInputDictionary: inputDict3,\n\t\t\tResultChildrenNodes: resultChildren3,\n\t\t\tResultDictionary: resultDict3},\n\t}\n\n\tfor i, input := range testInputs {\n\t\tfmt.Print(\"Test \", i+1, \" of \", len(testInputs))\n\t\t//Act\n\t\tresultChildren, resultDictionary := generateNodeChildren(input.InputNode, input.InputDictionary)\n\n\t\t//Assert\n\t\tif !doNodePointerArraysMatch(input.ResultChildrenNodes, resultChildren) || !doNodePointerArraysMatch(input.ResultDictionary, resultDictionary) {\n\t\t\tt.Error(\n\t\t\t\t\"Test number \", i+1, \"\\n\",\n\t\t\t\t\"Given the inputs:\\n\",\n\t\t\t\t\"start node = \", input.InputNode.Word, \"\\n\",\n\t\t\t\t\"Input Dictionary = \", convertNodePointersToNodes(input.InputDictionary), \"\\n\",\n\t\t\t\t\"Expected result to be:\\n\",\n\t\t\t\t\"Result Children = \", convertNodePointersToNodes(input.ResultChildrenNodes), \"\\n\",\n\t\t\t\t\"Actual result was:\\n\",\n\t\t\t\t\"Result Children = \", convertNodePointersToNodes(resultChildren), \"\\n\",\n\t\t\t)\n\t\t\tfmt.Println(\" - failed.\")\n\t\t} else {\n\t\t\tfmt.Println(\" - passed.\")\n\t\t}\n\t}\n\tfmt.Print(\"\\n\")\n}", "title": "" }, { "docid": "643d8e7720b35857ffdd19da434113ca", "score": "0.41061503", "text": "func (p *passwordGenerator) GenerateManyPasswords() {\n\n\tvar pwd string\n\n\tfor i := 0; i < p.Query.MaxPwds; i++ {\n\t\tpwd = p.Generate()\n\t\tp.Passwords = append(p.Passwords, pwd)\n\t}\n\n}", "title": "" }, { "docid": "e706a40db114dd5a184805d5929c0224", "score": "0.410557", "text": "func randSeq(n int) string {\n rand.Seed(time.Now().UTC().UnixNano())\n b := make([]rune, n)\n for i := range b {\n b[i] = letters[rand.Intn(len(letters))]\n }\n return strings.ToLower(string(b))\n}", "title": "" }, { "docid": "fab57b79c121ed1c367152391f760eed", "score": "0.40959746", "text": "func GenSequenceOfTxs(payer types.AccountID, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...crypto.PrivKey) []types.StdTx {\n\ttxs := make([]types.StdTx, numToGenerate)\n\tfor i := 0; i < numToGenerate; i++ {\n\t\ttxs[i] = helpers.GenTx(\n\t\t\tmsgs,\n\t\t\ttypes.NewInt64Coins(constants.DefaultBondDenom, 200000),\n\t\t\thelpers.DefaultGenTxGas,\n\t\t\tpayer,\n\t\t\t\"\",\n\t\t\taccNums,\n\t\t\tinitSeqNums,\n\t\t\tpriv...,\n\t\t)\n\t\tincrementAllSequenceNumbers(initSeqNums)\n\t}\n\n\treturn txs\n}", "title": "" }, { "docid": "c79b3b2f58d7fed76b1bc0e0f2ebab30", "score": "0.40944308", "text": "func (m *CPUMiner) GenerateNBlocks(n uint32) ([]*chainhash.Hash, error) {\n\tm.Lock()\n\n\t// Respond with an error if server is already mining.\n\tif m.started || m.discreteMining {\n\t\tm.Unlock()\n\t\treturn nil, errors.New(\"Server is already CPU mining. Please call \" +\n\t\t\t\"`setgenerate 0` before calling discrete `generate` commands.\")\n\t}\n\n\tm.started = true\n\tm.discreteMining = true\n\n\tm.speedMonitorQuit = make(chan struct{})\n\tm.wg.Add(1)\n\tgo m.speedMonitor()\n\n\tm.Unlock()\n\n\tlog.Tracef(\"Generating %d blocks\", n)\n\n\ti := uint32(0)\n\tblockHashes := make([]*chainhash.Hash, n)\n\n\t// Start a ticker which is used to signal checks for stale work and\n\t// updates to the speed monitor.\n\tticker := time.NewTicker(time.Second * hashUpdateSecs)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\t// Read updateNumWorkers in case someone tries a `setgenerate` while\n\t\t// we're generating. We can ignore it as the `generate` RPC call only\n\t\t// uses 1 worker.\n\t\tselect {\n\t\tcase <-m.updateNumWorkers:\n\t\tdefault:\n\t\t}\n\n\t\t// Grab the lock used for block submission, since the current block will\n\t\t// be changing and this would otherwise end up building a new block\n\t\t// template on a block that is in the process of becoming stale.\n\t\tm.submitBlockLock.Lock()\n\t\tcurHeight := m.g.BestSnapshot().Height\n\n\t\t// Choose a payment address at random.\n\t\trand.Seed(time.Now().UnixNano())\n\t\tpayToAddr := m.cfg.MiningAddrs[rand.Intn(len(m.cfg.MiningAddrs))]\n\n\t\t// Create a new block template using the available transactions\n\t\t// in the memory pool as a source of transactions to potentially\n\t\t// include in the block.\n\t\ttemplate, err := m.g.NewBlockTemplate(payToAddr)\n\t\tm.submitBlockLock.Unlock()\n\t\tif err != nil {\n\t\t\terrStr := fmt.Sprintf(\"Failed to create new block \"+\n\t\t\t\t\"template: %v\", err)\n\t\t\tlog.Errorf(errStr)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Attempt to solve the block. The function will exit early\n\t\t// with false when conditions that trigger a stale block, so\n\t\t// a new block template can be generated. When the return is\n\t\t// true a solution was found, so submit the solved block.\n\t\tif m.solveBlock(template.Block, curHeight+1, ticker, nil) {\n\t\t\tblock := btcutil.NewBlock(template.Block)\n\t\t\tm.submitBlock(block)\n\t\t\tblockHashes[i] = block.Hash()\n\t\t\ti++\n\t\t\tif i == n {\n\t\t\t\tlog.Tracef(\"Generated %d blocks\", i)\n\t\t\t\tm.Lock()\n\t\t\t\tclose(m.speedMonitorQuit)\n\t\t\t\tm.wg.Wait()\n\t\t\t\tm.started = false\n\t\t\t\tm.discreteMining = false\n\t\t\t\tm.Unlock()\n\t\t\t\treturn blockHashes, nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3d6e71adea9bf37d023e5f53c882a0e8", "score": "0.40926704", "text": "func generate() {\n\tfor i := 17; i < 5000; i += 17 {\n\t\tch <- i\n\t\ttime.Sleep(1 * time.Millisecond)\n\t}\n\tclose(ch)\n}", "title": "" }, { "docid": "77f086b564fccd5917a3a6f28ef0eadc", "score": "0.40897113", "text": "func (s MassSpec) SeqCyclic20(n int) []AA20 {\n\tl := s.leaderboard(n, 250)\n\tr := make([]AA20, len(l))\n\tfor i, c := range l {\n\t\tr[i] = c.AA20\n\t}\n\treturn r\n}", "title": "" } ]
b60d0d54a92a11253e2ef46fbf13dcc4
MustFind returns the set of results for the given query, but panics if there is any error.
[ { "docid": "9616e9ffb2c6727328b2da3ee5ea4fa0", "score": "0.6793492", "text": "func (s *NodeStore) MustFind(q *NodeQuery) *NodeResultSet {\n\treturn NewNodeResultSet(s.Store.MustFind(q))\n}", "title": "" } ]
[ { "docid": "177c143c48f2ed19312a98a3c549d77f", "score": "0.72152233", "text": "func (s *RepositoryStore) MustFind(q *RepositoryQuery) *RepositoryResultSet {\n\treturn NewRepositoryResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "177c143c48f2ed19312a98a3c549d77f", "score": "0.72152233", "text": "func (s *RepositoryStore) MustFind(q *RepositoryQuery) *RepositoryResultSet {\n\treturn NewRepositoryResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "6bb52e09fb588b036d5440975bb8366c", "score": "0.7094709", "text": "func (s *ObjectStore) MustFind(q *ObjectQuery) *ObjectResultSet {\n\treturn NewObjectResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "885757558029a9541fd97c0469525994", "score": "0.7038801", "text": "func (s *MentionStore) MustFind(q *MentionQuery) *MentionResultSet {\n\treturn NewMentionResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "885757558029a9541fd97c0469525994", "score": "0.7038801", "text": "func (s *MentionStore) MustFind(q *MentionQuery) *MentionResultSet {\n\treturn NewMentionResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "4ceb1e05ec250df60403ff812125e43f", "score": "0.70361316", "text": "func (s *URLStore) MustFind(q *URLQuery) *URLResultSet {\n\treturn NewURLResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "9fbc28cbfbf04cf6477c482c21740335", "score": "0.6549892", "text": "func (s *QueuedElementStore) MustFind(q *QueuedElementQuery) *QueuedElementResultSet {\n\treturn NewQueuedElementResultSet(s.Store.MustFind(q))\n}", "title": "" }, { "docid": "cb8348544afcf6700202d7d8ab6fa3e7", "score": "0.63044107", "text": "func (ps Pages) MustFind(selector string) *Page {\n\tp, err := ps.Find(selector)\n\tutils.E(err)\n\treturn p\n}", "title": "" }, { "docid": "e32307b2f75bacc4e07a74c0ce793d15", "score": "0.5991629", "text": "func (m *Mongo) Find(query interface{}, fields ...interface{}) ([]interface{}, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "966a1587ce999fd2512dda5bede6c2d4", "score": "0.5971699", "text": "func (tk *DBTestKit) MustQuery(sql string, args ...interface{}) *sql.Rows {\n\tcomment := fmt.Sprintf(\"sql:%s, args:%v\", sql, args)\n\trows, err := tk.db.Query(sql, args...)\n\ttk.require.NoError(err, comment)\n\ttk.require.NotNil(rows, comment)\n\treturn rows\n}", "title": "" }, { "docid": "966a1587ce999fd2512dda5bede6c2d4", "score": "0.5971699", "text": "func (tk *DBTestKit) MustQuery(sql string, args ...interface{}) *sql.Rows {\n\tcomment := fmt.Sprintf(\"sql:%s, args:%v\", sql, args)\n\trows, err := tk.db.Query(sql, args...)\n\ttk.require.NoError(err, comment)\n\ttk.require.NotNil(rows, comment)\n\treturn rows\n}", "title": "" }, { "docid": "b700dbc8cb3981a6d208aa87a67b9a4e", "score": "0.59605867", "text": "func (fc MockCollection) Find(query interface{}) Query {\n\treturn &MockQuery{\n\t\tcollection: fc.collection,\n\t\tquery: query.(bson.M),\n\t}\n}", "title": "" }, { "docid": "950fc164bb65fa307e3fc71c2eae09c8", "score": "0.59055966", "text": "func (tk *AsyncTestKit) MustQuery(ctx context.Context, sql string, args ...interface{}) *Result {\n\tcomment := fmt.Sprintf(\"sql:%s, args:%v\", sql, args)\n\trs, err := tk.Exec(ctx, sql, args...)\n\ttk.require.NoError(err, comment)\n\ttk.require.NotNil(rs, comment)\n\treturn tk.resultSetToResult(ctx, rs, comment)\n}", "title": "" }, { "docid": "ecb9524468d3339fc8512bc5dc074bde", "score": "0.5893263", "text": "func (c *Collection) Find(query interface{}) *Query {\n\treturn &Query{\n\t\tQuery: c.Collection.Find(query),\n\t\tcfg: c.cfg,\n\t\ttags: c.tags,\n\t}\n}", "title": "" }, { "docid": "aa02e5ecee24b09254fa39b783811b72", "score": "0.5853609", "text": "func (tx *Tx) MustQuery(query string, args ...interface{}) *sql.Rows {\n\tr, err := ((*sql.Tx)(tx)).Query(query, args...)\n\tif err != nil {\n\t\t// Panic so that we have the stack trace and the error message.\n\t\tpanic(err)\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "2bc2f45e62bf8bbfc751e20abc1322d6", "score": "0.5850604", "text": "func (t *ReadTransaction) Find(query *db.Query, dummy interface{}) (interface{}, error) {\n\tqueryBytes, err := json.Marshal(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinnerReq := &pb.FindRequest{\n\t\tQueryJSON: queryBytes,\n\t}\n\toption := &pb.ReadTransactionRequest_FindRequest{\n\t\tFindRequest: innerReq,\n\t}\n\tif err := t.client.Send(&pb.ReadTransactionRequest{\n\t\tOption: option,\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\tvar resp *pb.ReadTransactionReply\n\tif resp, err = t.client.Recv(); err != nil {\n\t\treturn nil, err\n\t}\n\tswitch x := resp.GetOption().(type) {\n\tcase *pb.ReadTransactionReply_FindReply:\n\t\treturn processFindReply(x.FindReply, dummy)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"ReadTransactionReply.Option has unexpected type %T\", x)\n\t}\n}", "title": "" }, { "docid": "e435fd349ce9d84d436ba829760a0445", "score": "0.5807943", "text": "func (s *RepositoryStore) MustFindOne(q *RepositoryQuery) *Repository {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "e435fd349ce9d84d436ba829760a0445", "score": "0.5807943", "text": "func (s *RepositoryStore) MustFindOne(q *RepositoryQuery) *Repository {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "4778ea92807880af7f0fddd2a0f3c3a7", "score": "0.5802849", "text": "func MustFind(name string) Suite {\n\ts, err := Find(name)\n\tif err != nil {\n\t\tpanic(\"Suite \" + name + \" not found.\")\n\t}\n\treturn s\n}", "title": "" }, { "docid": "7de7aa4a1de89958b1c4baa0d07cf9d0", "score": "0.57858616", "text": "func (s *Store) Find(result interface{}, query *Query) error {\n\treturn s.Bolt().View(func(tx *bolt.Tx) error {\n\t\treturn s.TxFind(tx, result, query)\n\t})\n}", "title": "" }, { "docid": "7de7aa4a1de89958b1c4baa0d07cf9d0", "score": "0.57858616", "text": "func (s *Store) Find(result interface{}, query *Query) error {\n\treturn s.Bolt().View(func(tx *bolt.Tx) error {\n\t\treturn s.TxFind(tx, result, query)\n\t})\n}", "title": "" }, { "docid": "7de7aa4a1de89958b1c4baa0d07cf9d0", "score": "0.57858616", "text": "func (s *Store) Find(result interface{}, query *Query) error {\n\treturn s.Bolt().View(func(tx *bolt.Tx) error {\n\t\treturn s.TxFind(tx, result, query)\n\t})\n}", "title": "" }, { "docid": "3212124d6dd608b3e74458524e85b800", "score": "0.56966084", "text": "func (sq *Sqinn) MustQuery(sql string, values []interface{}, colTypes []byte) []Row {\n\trows, err := sq.Query(sql, values, colTypes)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn rows\n}", "title": "" }, { "docid": "f388b1195cddb7d92043ccf9aece9132", "score": "0.5659036", "text": "func QueryNotFound(t *testing.T, repo rel.Repository) {\n\tt.Run(\"NotFound\", func(t *testing.T) {\n\t\tvar (\n\t\t\tuser User\n\t\t\terr = repo.Find(ctx, &user, where.Eq(\"id\", 0))\n\t\t)\n\n\t\t// find user error not found\n\t\tassert.Equal(t, rel.NotFoundError{}, err)\n\t})\n}", "title": "" }, { "docid": "079a1b67dac3a324988399b0078e3076", "score": "0.5655853", "text": "func (obj *MongoDriver) Find(collection string, query map[string]interface{}, selectField map[string]interface{}, skip, limit int) (ret []interface{}, err error) {\n\terr = obj.Conn.C(collection).Find(query).Select(bson.M(selectField)).Skip(skip).Limit(limit).All(&ret)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while finding data\")\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "8ec7fe135d83f50bb7b14eccd8e58d82", "score": "0.5617486", "text": "func (_m *fakeStore) FindAll(collectionName string, query ...*map[string]interface{}) (interface{}, error) {\n\tret := _m.Called()\n\n\tshouldErr := ret.Bool(0); if shouldErr {\n\t\treturn nil, errors.New(\"error\")\n\t} else {\n\t\tnumUsers := ret.Int(1)\n\t\tusers := make([]models.User, numUsers)\n\t\treturn &users, nil\n\t}\n}", "title": "" }, { "docid": "958440c95930a7919603b47fcfee409c", "score": "0.5609566", "text": "func (c MongoCollection) Find(query interface{}) MongoDBQuery {\n\treturn &MongoQuery{Query: c.Collection.Find(query)}\n}", "title": "" }, { "docid": "16970ccfc2e74c41b5ed106a8e641cb0", "score": "0.5563159", "text": "func (mgoCollection MongoCollection) Find(query interface{}) Query {\n\treturn &MongoQuery{Query: mgoCollection.Collection.Find(query)}\n}", "title": "" }, { "docid": "f8195b41b03f13fdd32e96e6158043f3", "score": "0.5531566", "text": "func (adaptor *Adaptor) QueryFind(ctx context.Context, collname string, byteQuery []byte) ([]byte, error) {\n\tvar query bson.M\n\tbson.UnmarshalJSON(byteQuery, &query)\n\n\tvar received bson.M\n\tcollection := adaptor.Client.Database(adaptor.DBName).Collection(collname)\n\terrFinding := collection.FindOne(ctx, query).Decode(&received)\n\tjsonBytes, _ := bson.MarshalJSON(&received)\n\n\treturn jsonBytes, errFinding\n}", "title": "" }, { "docid": "34d765b0af7fc2b264f6f796c4d0a19e", "score": "0.55259126", "text": "func (s *ObjectStore) MustFindOne(q *ObjectQuery) *Object {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "71ae1cb758b5efb77dd6e54d6cbd8cae", "score": "0.5519659", "text": "func (s *Scene) Find(query Query) *Result {\n\tvar result *Result\n\tif count := len(s.resultCache); count > 0 {\n\t\tresult = s.resultCache[count-1]\n\t\ts.resultCache = s.resultCache[:count-1]\n\t} else {\n\t\tresult = newResult(s)\n\t}\n\tfor entity := s.firstEntity; entity != nil; entity = entity.next {\n\t\tif entity.matches(query) {\n\t\t\tresult.entities = append(result.entities, entity)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "0ef1d55ebaac81f36f96eb5a0dc94bf9", "score": "0.55090654", "text": "func (c *Collection) Find(q *Query, opts ...TxnOption) (instances [][]byte, err error) {\n\t_ = c.ReadTxn(func(txn *Txn) error {\n\t\tinstances, err = txn.Find(q)\n\t\treturn err\n\t}, opts...)\n\treturn\n}", "title": "" }, { "docid": "a71719294c5d0a3613a4b64e1a88571b", "score": "0.550702", "text": "func (s *RepositoryStore) Find(q *RepositoryQuery) (*RepositoryResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewRepositoryResultSet(rs), nil\n}", "title": "" }, { "docid": "a71719294c5d0a3613a4b64e1a88571b", "score": "0.550702", "text": "func (s *RepositoryStore) Find(q *RepositoryQuery) (*RepositoryResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewRepositoryResultSet(rs), nil\n}", "title": "" }, { "docid": "94e362b0182f5b1524ee8a8ecd6a6daa", "score": "0.5502182", "text": "func (c *Collection) Find(query, model interface{}, sorts ...string) error {\n\treturn c.Invoke(func(col *mgo.Collection) error {\n\t\treturn col.Find(query).Sort(sorts...).One(model)\n\t})\n}", "title": "" }, { "docid": "e87dde1b476ebf06f8b06d64b856305f", "score": "0.55019546", "text": "func (mr *MockMgoCollectionMockRecorder) Find(query interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Find\", reflect.TypeOf((*MockMgoCollection)(nil).Find), query)\n}", "title": "" }, { "docid": "a0e9b81124c3489d065422bc9b13f3b6", "score": "0.5496884", "text": "func (s *MentionStore) MustFindOne(q *MentionQuery) *Mention {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "a0e9b81124c3489d065422bc9b13f3b6", "score": "0.5496884", "text": "func (s *MentionStore) MustFindOne(q *MentionQuery) *Mention {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "0e2e742c0e620369ba01b58cf5e12576", "score": "0.54588884", "text": "func (s *DNSStub) Find(ctx context.Context, conditions *sacloud.FindCondition) (*sacloud.DNSFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"DNSStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" }, { "docid": "cc5297480cccd7d1d56bfc9939d2c410", "score": "0.54559284", "text": "func ExpectFind(r *Repository, queriers []rel.Querier) *Find {\n\treturn &Find{\n\t\tFindAll: &FindAll{\n\t\t\tExpect: newExpect(r, \"Find\",\n\t\t\t\t[]interface{}{r.ctxData, mock.Anything, queriers},\n\t\t\t\t[]interface{}{nil},\n\t\t\t),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1c74b6387068a1779b8d899fb4a6db72", "score": "0.54346806", "text": "func (d *Database) Find(findArgs *find) (*FindResponse, error) {\n\tfindDocument, err := json.Marshal(findArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tjob, err := d.client.request(\"POST\", fmt.Sprintf(\"%s/%s\", d.URL.String(), \"_find\"), bytes.NewReader(findDocument))\n\tdefer job.Close()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = expectedReturnCodes(job, 200)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfindResp := &FindResponse{}\n\terr = json.NewDecoder(job.response.Body).Decode(findResp)\n\n\treturn findResp, err\n}", "title": "" }, { "docid": "d233915ecbf0a9a9d43afb607b94d308", "score": "0.53490716", "text": "func (self *MongoStore) Find(ctx context.Context, database string, collection string, query string, fields []string, optionsStr string) ([]interface{}, error) {\n\tif self.client.Database(database) == nil {\n\t\treturn nil, errors.New(\"No database found with name \" + database)\n\t}\n\n\tif self.client.Database(database).Collection(collection) == nil {\n\t\treturn nil, errors.New(\"No collection found with name \" + collection)\n\t}\n\n\tcollection_ := self.client.Database(database).Collection(collection)\n\tq := make(map[string]interface{})\n\terr := json.Unmarshal([]byte(query), &q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar opts []*options.FindOptions\n\tif len(optionsStr) > 0 {\n\t\topts = make([]*options.FindOptions, 0)\n\t\terr := json.Unmarshal([]byte(optionsStr), &opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tcur, err := collection_.Find(ctx, q, opts...)\n\tdefer cur.Close(context.Background())\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresults := make([]interface{}, 0)\n\n\tfor cur.Next(ctx) {\n\t\tentity := make(map[string]interface{})\n\t\terr := cur.Decode(&entity)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// In that case I will return the whole entity\n\t\tif len(fields) == 0 {\n\t\t\tresults = append(results, entity)\n\t\t} else {\n\t\t\tvalues := make([]interface{}, len(fields))\n\t\t\tfor i := 0; i < len(fields); i++ {\n\t\t\t\tvalues[i] = entity[fields[i]]\n\t\t\t}\n\t\t\tresults = append(results, values)\n\t\t}\n\t}\n\n\t// In case of error\n\tif err := cur.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "ac45b537024bde847b37820fb968ee7a", "score": "0.5347798", "text": "func (p *Page) MustSearch(queries ...string) *Element {\n\tlist, err := p.Search(0, 1, queries...)\n\tutils.E(err)\n\treturn list.First()\n}", "title": "" }, { "docid": "31092022c6570de50d4edef7ab93f6c4", "score": "0.534572", "text": "func (tk *DBTestKit) MustQueryRows(query string, args ...interface{}) {\n\trows := tk.MustQuery(query, args...)\n\ttk.require.True(rows.Next())\n\ttk.require.NoError(rows.Err())\n\trows.Close()\n}", "title": "" }, { "docid": "a837ed65efc6318b93e6bb1001c1f9d0", "score": "0.53346455", "text": "func (g *BaseGORMController) Find(where, limit, offset, order interface{}) ([]*Base, error) {\n\tvar array []*Base\n\n\tdb := g.DB.Where(where).Order(order).Limit(limit).Offset(offset).Find(&array)\n\n\treturn array, db.Error\n}", "title": "" }, { "docid": "8747be50f9f3ae94eb7be8ee32885c6d", "score": "0.5329411", "text": "func (c *Client) MustQuery(app string, args ...string) chan string {\n\tresult, err := c.Query(app, args...)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "078d62e1dd3d7d36da19d118852e10a1", "score": "0.53195477", "text": "func (s *DatabaseStub) Find(ctx context.Context, zone string, conditions *sacloud.FindCondition) (*sacloud.DatabaseFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"DatabaseStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" }, { "docid": "81a908691c1d3de768dd5bd07c73c19e", "score": "0.5318549", "text": "func (s *ObjectStore) Find(q *ObjectQuery) (*ObjectResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewObjectResultSet(rs), nil\n}", "title": "" }, { "docid": "dd17eccd924f1eb64ecdf8d33f7e831f", "score": "0.531202", "text": "func (m Mongo) Find(collectionName string, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error) {\n\tcollection, err := m.GetCollection(collectionName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn collection.Find(context.TODO(), filter, opts...)\n}", "title": "" }, { "docid": "a32f0ac9fa70925a1b981452ddc8b71c", "score": "0.5299526", "text": "func TestSimpleFind(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\tcdb, cleanup := prepareFilledDatabase(assert, \"find-simple\")\n\tdefer cleanup()\n\n\t// Try to find some documents a simple way.\n\tsearch := couchdb.NewSearch(`{\"$or\": [\n\t\t\t{\"$and\": [\n\t\t\t\t{\"age\": {\"$lt\": 30}},\n\t\t\t\t{\"active\": {\"$eq\": false}}\n\t\t\t]},\n\t\t\t{\"$and\": [\n\t\t\t\t{\"age\": {\"$gt\": 60}},\n\t\t\t\t{\"active\": {\"$eq\": true}}\n\t\t\t]}\n\t\t]}`).\n\t\tFields(\"name\", \"age\", \"active\")\n\n\tfnds, err := cdb.Find(search)\n\tassert.NoError(err)\n\n\terr = fnds.Process(func(document *couchdb.Unmarshable) error {\n\t\tfields := struct {\n\t\t\tName string `json:\"name\"`\n\t\t\tAge int `json:\"age\"`\n\t\t\tActive bool `json:\"active\"`\n\t\t}{}\n\t\tif err := document.Unmarshal(&fields); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tassert.True((fields.Age < 30 && !fields.Active) || (fields.Age > 60 && fields.Active))\n\t\treturn nil\n\t})\n\tassert.Nil(err)\n}", "title": "" }, { "docid": "7d1d7b478b581ff9f1813a4ccc55b1f7", "score": "0.5287328", "text": "func (s Xorm) Find(beans interface{}, condiBeans ...interface{}) error {\n\terr := s.Engine.Find(beans, condiBeans...)\n\tlogger.CheckError(err)\n\treturn err\n}", "title": "" }, { "docid": "4a46a2ce20d1f4b7b77f057a52d48edf", "score": "0.5279331", "text": "func (self *SourceCollection) Find(terms ...interface{}) (db.Item, error) {\n\tterms = append(terms, db.Limit(1))\n\n\tresult, err := self.FindAll(terms...)\n\n\tif len(result) > 0 {\n\t\treturn result[0], nil\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "715a83835a2f9755cfebccef8e93854c", "score": "0.52752143", "text": "func (self *SourceCollection) Find(terms ...interface{}) db.Item {\n\n\tvar item db.Item\n\n\tterms = append(terms, db.Limit(1))\n\n\tresult := self.invoke(\"FindAll\", terms)\n\n\tif len(result) > 0 {\n\t\tresponse := result[0].Interface().([]db.Item)\n\t\tif len(response) > 0 {\n\t\t\titem = response[0]\n\t\t}\n\t}\n\n\treturn item\n}", "title": "" }, { "docid": "0937485dae1c244a9b46e7a6811266b9", "score": "0.5266432", "text": "func (mr *MockIMongoMockRecorder) FindAll(query, result interface{}, options ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{query, result}, options...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"FindAll\", reflect.TypeOf((*MockIMongo)(nil).FindAll), varargs...)\n}", "title": "" }, { "docid": "9bcab474ce97ac4f39e3d78fae0f69c6", "score": "0.52603734", "text": "func Find(collection string, filter ...interface{}) (result []bson.M, err error) {\n\n\t//Empty filter\n\tif filter == nil {\n\t\tfilter = []interface{}{bson.D{}}\n\t}\n\n\t//Run query\n\tcursor, err := db.Collection(collection).Find(context.Background(), filter[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Get all documents\n\terr = cursor.All(context.Background(), &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Return\n\treturn result, nil\n}", "title": "" }, { "docid": "137724967362e4ea8cc1609c9167d365", "score": "0.5257372", "text": "func (s balanceSummaryStore) Find(query *model.BalanceSummary) (*model.BalanceSummary, error) {\n\tvar result model.BalanceSummary\n\n\terr := s.db.\n\t\tWhere(query).\n\t\tFirst(&result).\n\t\tError\n\n\treturn &result, checkErr(err)\n}", "title": "" }, { "docid": "d443ed2453ae5be4a2c68f79dd67e762", "score": "0.5256608", "text": "func (s *EnhancedDBStub) Find(ctx context.Context, conditions *sacloud.FindCondition) (*sacloud.EnhancedDBFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"EnhancedDBStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" }, { "docid": "f87856d1eaa47273c93f7ee0cd01a3e7", "score": "0.52452606", "text": "func (s *GSLBStub) Find(ctx context.Context, conditions *sacloud.FindCondition) (*sacloud.GSLBFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"GSLBStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" }, { "docid": "f0e300d28da5c18b46acdbb765d9f4f7", "score": "0.5230022", "text": "func (s *URLStore) MustFindOne(q *URLQuery) *URL {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "120e4bea75a53b66f749df9b8d6500d8", "score": "0.52236885", "text": "func (coll *Collection) SimpleFind(ctx context.Context, results interface{}, filter interface{}, opts ...*options.FindOptions) error {\n\tcur, err := coll.Find(ctx, filter, opts...)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn cur.All(ctx, results)\n}", "title": "" }, { "docid": "4008074bf810fa05fd9e6044bbeb5af6", "score": "0.5219574", "text": "func (t *Table) Find(terms ...interface{}) db.Item {\n\n\tvar item db.Item\n\n\tterms = append(terms, db.Limit(1))\n\n\tresult := t.invoke(\"FindAll\", terms)\n\n\tif len(result) > 0 {\n\t\tresponse := result[0].Interface().([]db.Item)\n\t\tif len(response) > 0 {\n\t\t\titem = response[0]\n\t\t}\n\t}\n\n\treturn item\n}", "title": "" }, { "docid": "08f6a974141e7d6184c0d747f9e6e80e", "score": "0.5216646", "text": "func (m *Mongo) FindAll(query interface{}, fields ...interface{}) ([]interface{}, error) {\n\tvar result []interface{}\n\n\texec := m.getSession().Find(query)\n\tif len(fields) > 0 {\n\t\texec = exec.Select(fields[0])\n\t}\n\n\terr := exec.All(&result)\n\tdefer m.tempSession.Close()\n\treturn result, err\n}", "title": "" }, { "docid": "0db2b66d55542e42ef2ae0b57361c6a8", "score": "0.52161086", "text": "func (m *MockCollection) Find(query interface{}) mongodb.Query {\n\tret := m.ctrl.Call(m, \"Find\", query)\n\tret0, _ := ret[0].(mongodb.Query)\n\treturn ret0\n}", "title": "" }, { "docid": "27e7801d5093bdbaf2101367d1f8f565", "score": "0.5212723", "text": "func (mr *MockCollectionMockRecorder) Find(query interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Find\", reflect.TypeOf((*MockCollection)(nil).Find), query)\n}", "title": "" }, { "docid": "cc43035371e78debf041540b2473ece1", "score": "0.521007", "text": "func (manager *MongoCollection) FindAll(query interface{}, result interface{}) error {\n\treturn manager.Collection.Find(query).All(result)\n}", "title": "" }, { "docid": "0aba77218221f3c764ede6c818f0371b", "score": "0.52085495", "text": "func (s *URLStore) Find(q *URLQuery) (*URLResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewURLResultSet(rs), nil\n}", "title": "" }, { "docid": "9cf64820adf680ec410fd8e7b3bf5780", "score": "0.520009", "text": "func (f *Fetcher) Find() {}", "title": "" }, { "docid": "7e22a470efd6dc089fc60138c038891f", "score": "0.51950806", "text": "func (s *NodeStore) MustFindOne(q *NodeQuery) *Node {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "5d147bbfb0c72ebd1aa03ce3544ac07e", "score": "0.51911366", "text": "func (db *MongoConn) FindAll(collection string, query Query, result interface{}, pagination *PaginationParams) error {\n\tqueryResult := db.Session.\n\t\tDB(db.DialInfo.Database).\n\t\tC(collection).\n\t\tFind(query)\n\n\tif pagination != nil {\n\t\tqueryResult = queryResult.\n\t\t\tSort(pagination.SortBy).\n\t\t\tSkip(pagination.Page * pagination.Limit).\n\t\t\tLimit(pagination.Limit)\n\t}\n\n\treturn queryResult.All(result)\n}", "title": "" }, { "docid": "2077e7aeb26eaf4c6beb85ad6c7ab482", "score": "0.5189275", "text": "func ShardFind(id int64, limit, start int, objs interface{}) error {\n\treturn ShardGetTable(objs, id).Limit(limit, start).Find(objs)\n}", "title": "" }, { "docid": "3738d6e550a108cc920f8e0dda5f15e7", "score": "0.51651025", "text": "func (s *MentionStore) Find(q *MentionQuery) (*MentionResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewMentionResultSet(rs), nil\n}", "title": "" }, { "docid": "3738d6e550a108cc920f8e0dda5f15e7", "score": "0.51651025", "text": "func (s *MentionStore) Find(q *MentionQuery) (*MentionResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewMentionResultSet(rs), nil\n}", "title": "" }, { "docid": "d4c48cd72e34027a5f43ba522320d5df", "score": "0.5164694", "text": "func Find(m Model) *mgo.Query {\n\treturn Where(m, m.Unique()).Limit(1)\n}", "title": "" }, { "docid": "95ae383f8cd1b124ac7d9ec93f77a031", "score": "0.5155239", "text": "func TestFindExists(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\tcdb, cleanup := prepareFilledDatabase(assert, \"find-exists\")\n\tdefer cleanup()\n\n\t// Try to find some documents having an existing \"last_active\".\n\tsearch := couchdb.NewSearch(`{\"last_ective\": {\"$exists\": true}, \"age\": {\"$lte\": 25}}`).\n\t\tFields(\"name\", \"age\", \"active\", \"last_active\")\n\n\tfnds, err := cdb.Find(search)\n\tassert.NoError(err)\n\n\terr = fnds.Process(func(document *couchdb.Unmarshable) error {\n\t\tfields := struct {\n\t\t\tName string `json:\"name\"`\n\t\t\tAge int `json:\"age\"`\n\t\t\tActive bool `json:\"active\"`\n\t\t\tLastActive int64 `json:\"last_active\"`\n\t\t}{}\n\t\tif err := document.Unmarshal(&fields); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tassert.True(fields.Age <= 25 && fields.LastActive > 0 && fields.Active)\n\t\treturn nil\n\t})\n\tassert.Nil(err)\n\n\t// Now look for existing \"last_active\" but \"active\" is false. So\n\t// no results.\n\tsearch = couchdb.NewSearch(`{\"last_ective\": {\"$exists\": true}, \"active\": {\"$eq\": true}}`).\n\t\tFields(\"name\", \"age\", \"active\", \"last_active\")\n\n\tfnds, err = cdb.Find(search)\n\tassert.NoError(err)\n\tassert.Length(fnds, 0)\n}", "title": "" }, { "docid": "022f93b8f40d346ce440bedab643c129", "score": "0.5153461", "text": "func (s *QueuedElementStore) MustFindOne(q *QueuedElementQuery) *QueuedElement {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "title": "" }, { "docid": "4d34707d1eeedfd3af6ed4db2922c659", "score": "0.51453197", "text": "func Find(origErr error, test func(error) bool) error {\n\tvar foundErr error\n\tWalkDeep(origErr, func(err error) bool {\n\t\tif test(err) {\n\t\t\tfoundErr = err\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\treturn foundErr\n}", "title": "" }, { "docid": "655c31842ac74eb4fb45f3e6cc71062a", "score": "0.5134831", "text": "func (s *LocalRouterStub) Find(ctx context.Context, conditions *sacloud.FindCondition) (*sacloud.LocalRouterFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"LocalRouterStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" }, { "docid": "041ac9a081810ea0441d841d798f9628", "score": "0.5133747", "text": "func FindByQuery(query map[string]interface{}) ([]Bill, error) {\n\tvar results []Bill\n\terr := tools.MongoDB.C(collection).Find(query).All(&results)\n\treturn results, err\n}", "title": "" }, { "docid": "dd739c8aec42c24743d792fce992801d", "score": "0.5124618", "text": "func Find(query db.Q) ([]Distro, error) {\n\tdistros := []Distro{}\n\terr := db.FindAllQ(Collection, query, &distros)\n\treturn distros, err\n}", "title": "" }, { "docid": "d2ac3d5aa46183e3fbcdd1e28dd0c6bb", "score": "0.512412", "text": "func (s *SimpleMonitorStub) Find(ctx context.Context, conditions *sacloud.FindCondition) (*sacloud.SimpleMonitorFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"SimpleMonitorStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" }, { "docid": "a381b23aa9d24678d6729989f648d6bf", "score": "0.51123166", "text": "func (w WebPart) QueryOrFail(errResult *WebPart, requiredKeys ...string) WebPart {\n\treturn Compose(w, QueryOrFail(errResult, requiredKeys...))\n}", "title": "" }, { "docid": "2cac119c24ff197182a4c05f146d03c9", "score": "0.51013833", "text": "func (u *Users) Find(ctx context.Context, kid keys.ID) (*Result, error) {\n\tres, err := u.Get(ctx, kid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res != nil {\n\t\treturn res, nil\n\t}\n\trkid, err := u.scs.Lookup(kid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif rkid == \"\" {\n\t\treturn nil, nil\n\t}\n\treturn u.Get(ctx, rkid)\n}", "title": "" }, { "docid": "018367d5d6aaa338e2df434c5ad34d71", "score": "0.5096319", "text": "func (m *MockMgoCollection) Find(query interface{}) *mgo.Query {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Find\", query)\n\tret0, _ := ret[0].(*mgo.Query)\n\treturn ret0\n}", "title": "" }, { "docid": "c1d0727204509a2c3f8badc1f56092ac", "score": "0.50691015", "text": "func (repo *UserRepository) Find(query *model.User) ([]model.User, error) {\n\tusers := []model.User{}\n\tif err := repo.db.Where(query).Find(&users).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "title": "" }, { "docid": "0475b0cbea45efe3981251973bd11de0", "score": "0.5068402", "text": "func find(coll *mongo.Collection, m map[string]interface{}) (*mongo.Cursor, error) {\n\treturn coll.Find(nil, bson.M(m), nil)\n}", "title": "" }, { "docid": "7702921af0f1b1c9001ccbed7f229a9f", "score": "0.5060392", "text": "func (this ReaderRepositoryTest) FindAll_DataFound(t *testing.T, tc *TestContext) {\n\t// given\n\trepo, mock := this.NewRepoWithMock(t)\n\n\t_, rows := this.MockFindAllWithRows(mock)\n\ttc.rowMocker.Mock(rows)\n\n\t// when\n\terr := repo.FindAll(context.Background(), tc.valueHolder)\n\n\t// then\n\tassert.Nil(t, err, \"should not get error\")\n\ttc.asserter.Assert(t, TestResult{tc.valueHolder, nil})\n}", "title": "" }, { "docid": "0176cf03e468f9b766fc07b20547472f", "score": "0.5038411", "text": "func Query(database string, collection string, filter bson.M) (*mongo.Cursor, error) {\n\n\tfmt.Print(\"Query: \" + database + \" \" + collection + \" with filter:\")\n\tfmt.Println(filter)\n\n\tresult, err := getCollection(database, collection).Find(context.TODO(), filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "210800a1fd7dddc8e6364d17d2f16489", "score": "0.5032237", "text": "func TestDefaultResultRepository_FindByIntegration(t *testing.T) {\n\tvar dbCred dbCredentials\n\tgetCredentialsFromEnv(&dbCred)\n\tdb, err := sqlx.Connect(\"postgres\", dbCred.connString())\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\trepo := defaultResultRepository{\n\t\tsource: db,\n\t}\n\n\tresults, err := repo.FindBy(ResultDTO{\n\t\tDTO: DTO{\n\t\t\tPage: 1,\n\t\t},\n\t\tContestID: 0,\n\t\tUserID: 1,\n\t\tMaxScore: true,\n\t})\n\n\tif err != nil {\n\t\tt.Fatalf(\"Failed querying for Result. %v\", err)\n\t}\n\n\tt.Logf(\"Found '%d' entries\", len(results))\n\n\tfor _, result := range results {\n\t\t// t.Logf(\"%T -> %d-%d\", result, result.EntryID, result.DatasetID)\n\t\tt.Logf(\"id: %d-%d, score: %f\", result.EntryID, result.DatasetID, result.TaskScore)\n\t}\n}", "title": "" }, { "docid": "ca0bc95b9fc5e3f95a76063e3db47b0a", "score": "0.50289017", "text": "func (q *Query) MustExec() *Iterator {\n\tit := q.Exec()\n\tif it.err != nil {\n\t\tpanic(it.err)\n\t}\n\treturn it\n}", "title": "" }, { "docid": "1ef1240c7319852b97832401d4909915", "score": "0.5027236", "text": "func (m *Model) Find(ctx context.Context, v, filter any, opts ...*mopt.FindOptions) error {\n\tcur, err := m.Collection.Find(ctx, filter, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cur.Close(ctx)\n\n\treturn cur.All(ctx, v)\n}", "title": "" }, { "docid": "29d214ff45ad2f7e4a87d9228eafd1db", "score": "0.5024451", "text": "func (adapter *Adapter) Query(ctx context.Context, query rel.Query) (rel.Cursor, error) {\n\tvar (\n\t\tstatement, args = NewBuilder(adapter.Config).Find(query)\n\t)\n\n\tfinish := adapter.Instrument(ctx, \"adapter-query\", statement)\n\trows, err := adapter.query(ctx, statement, args)\n\tfinish(err)\n\n\treturn &Cursor{rows}, adapter.Config.ErrorFunc(err)\n}", "title": "" }, { "docid": "f4ef8f61836ec3055b3ea766f7a99591", "score": "0.5019834", "text": "func (f *Find) Do(dataReq interface{}, err error) (interface{}, error) {\n\tf.Log(\"mongodocs\", \"Find.Do\", \"Started : %s\", utils.Query.Query(dataReq))\n\n\tif err != nil {\n\t\tf.Error(\"mongodocs\", \"Find.Do\", err, \"Completed\")\n\t\treturn nil, err\n\t}\n\n\treq, ok := dataReq.(*coquery.Request)\n\tif !ok {\n\t\tf.Error(\"mongodocs.Find\", \"Find.Do\", coquery.ErrInvalidRequestType, \"Completed\")\n\t\treturn nil, coquery.ErrInvalidRequestType\n\t}\n\n\tfind, ok := req.R.(*coquery.Find)\n\tif !ok {\n\t\tf.Error(req.R.RequestID(), \"Find.Do\", coquery.ErrInvalidRequestType, \"Completed\")\n\t\treturn nil, coquery.ErrInvalidRequestType\n\t}\n\n\tvar val interface{}\n\n\tif utils.IsDigits(find.Value) {\n\t\tval, _ = utils.ParseInt(find.Value)\n\t}\n\n\tvar res data.Parameters\n\tfound := true\n\n\trecords, err := f.Store.GetByRef(find.Key, val)\n\tif err != nil {\n\t\tfound = false\n\t\tf.Error(req.R.RequestID(), \"Find.Do\", coquery.ErrInvalidRequestType, \"Completed\")\n\t}\n\n\tif found {\n\t\tfor _, recs := range records {\n\t\t\tres = append(res, data.Parameter(recs))\n\t\t}\n\n\t\tf.Log(find.RequestID(), \"Find.Do\", \"Info : Store : Record Found\")\n\n\t\tf.Log(find.RequestID(), \"Find.Do\", \"Completed\")\n\t\treturn &coquery.Response{\n\t\t\tReq: find,\n\t\t\tData: res,\n\t\t}, nil\n\t}\n\n\tdb, session, err := f.Db.New(find.RequestID())\n\tif err != nil {\n\t\tf.Error(find.RequestID(), \"db.New\", err, \"Completed : New Session\")\n\t\treturn nil, &MError{Rid: find.RID, Msg: \"New Session Failed\", IError: err}\n\t}\n\n\tdefer session.Close()\n\n\tq := bson.M{find.Key: val}\n\tf.Log(find.RequestID(), find.RequestID(), \"DBAction : db.%s.find(%s)\", find.Doc, utils.Query.Query(q))\n\n\tif err := db.C(find.Doc).Find(q).All(&res); err != nil {\n\t\tf.Error(find.RequestID(), \"DBAction\", err, \"Completed\")\n\t\treturn nil, &MError{Rid: find.RID, Msg: \"FindProc Failed\", IError: err}\n\t}\n\n\tf.Log(find.RequestID(), \"Find.Do\", \"Info : Response : %s\", utils.Query.Query(res))\n\n\tfor _, record := range res {\n\t\tif err := f.Store.AddRef((map[string]interface{})(record), find.Key); err != nil {\n\t\t\tf.Error(find.RequestID(), \"Find.Do\", err, \"Info : Store.AddRef : Key[%s]\", find.Key)\n\t\t}\n\t}\n\n\tf.Log(find.RequestID(), \"Find.Do\", \"Completed\")\n\tf.Log(\"mongodocs\", \"Find.Do\", \"Completed\")\n\n\treturn &coquery.Response{\n\t\tReq: find,\n\t\tData: res,\n\t}, nil\n}", "title": "" }, { "docid": "0d5796f809bb9c5dbb14c2d4c5f6ff7b", "score": "0.5013396", "text": "func (_m *MongoCollection) Find(query interface{}) *mgo.Query {\n\tret := _m.Called(query)\n\n\tvar r0 *mgo.Query\n\tif rf, ok := ret.Get(0).(func(interface{}) *mgo.Query); ok {\n\t\tr0 = rf(query)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*mgo.Query)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f3fc7e20736915e417b6c7619594cf66", "score": "0.5002716", "text": "func Find(query db.Q) ([]DBUser, error) {\n\tus := []DBUser{}\n\terr := db.FindAllQ(Collection, query, &us)\n\treturn us, err\n}", "title": "" }, { "docid": "e33764da75e03536d826328a159d4b33", "score": "0.49987122", "text": "func TestFind(t *testing.T) {\n\ttype findTest struct {\n\t\tname string\n\t\tdb *db\n\t\tquery interface{}\n\t\texpectedIDs []string\n\t\terr string\n\t\trowsErr string\n\t}\n\ttests := []findTest{\n\t\t{\n\t\t\tname: \"invalid query\",\n\t\t\tquery: make(chan int),\n\t\t\terr: \"json: unsupported type: chan int\",\n\t\t},\n\t\t{\n\t\t\tname: \"Invalid JSON query\",\n\t\t\tquery: \"asdf\",\n\t\t\terr: \"invalid character 'a' looking for beginning of value\",\n\t\t},\n\t\t{\n\t\t\tname: \"No query\",\n\t\t\terr: \"Missing required key: selector\",\n\t\t},\n\t\t{\n\t\t\tname: \"empty selector\",\n\t\t\tquery: `{\"selector\":{}}`,\n\t\t\tdb: func() *db {\n\t\t\t\tdb := setupDB(t)\n\t\t\t\tfor _, id := range []string{\"a\", \"c\", \"z\", \"q\", \"chicken\"} {\n\t\t\t\t\tif _, err := db.Put(context.Background(), id, map[string]string{\"value\": id}, nil); err != nil {\n\t\t\t\t\t\tt.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn db\n\t\t\t}(),\n\t\t\texpectedIDs: []string{\"a\", \"c\", \"chicken\", \"q\", \"z\"},\n\t\t},\n\t\t{\n\t\t\tname: \"simple selector\",\n\t\t\tquery: `{\"selector\":{\"value\":\"chicken\"}}`,\n\t\t\tdb: func() *db {\n\t\t\t\tdb := setupDB(t)\n\t\t\t\tfor _, id := range []string{\"a\", \"c\", \"z\", \"q\", \"chicken\"} {\n\t\t\t\t\tif _, err := db.Put(context.Background(), id, map[string]string{\"value\": id}, nil); err != nil {\n\t\t\t\t\t\tt.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn db\n\t\t\t}(),\n\t\t\texpectedIDs: []string{\"chicken\"},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tdb := test.db\n\t\t\tif db == nil {\n\t\t\t\tdb = setupDB(t)\n\t\t\t}\n\t\t\trows, err := db.Find(context.Background(), test.query, nil)\n\t\t\tvar msg string\n\t\t\tif err != nil {\n\t\t\t\tmsg = err.Error()\n\t\t\t}\n\t\t\tif msg != test.err {\n\t\t\t\tt.Errorf(\"Unexpected error: %s\", err)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcheckRows(t, rows, test.expectedIDs, test.rowsErr)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "0c754c2243effd13dd61561567d6d1f8", "score": "0.4993052", "text": "func (db *gomgo) FindOne(collectionName string, query map[string]interface{}, sort string, TResult interface{}) (err error) {\n\tsessionClone := db.conn.Session.Copy()\n\tdefer sessionClone.Close()\n\tcollection := sessionClone.DB(db.conn.Name).C(collectionName)\n\n\tif sort != \"\" {\n\t\tcursor := collection.Find(query).Sort(sort)\n\t\terr = cursor.One(TResult)\n\t} else {\n\t\terr = collection.Find(query).One(TResult)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "34c8dd411ec4e2b706eb4fdcc660196a", "score": "0.49917695", "text": "func Find(dbName, collName string, client *mongo.Client, filter DP, sortOrder DP, setLimit int64) (DM, error) {\r\n\topts := options.Find()\r\n\topts.SetSort(sortOrder)\r\n\tif setLimit > 0 {\r\n\t\topts.SetLimit(setLimit)\r\n\t}\r\n\r\n\tcollection := client.Database(dbName).Collection(collName)\r\n\tresults := []map[string]interface{}{}\r\n\tcursor, err := collection.Find(context.TODO(), filter, opts)\r\n\tif err != nil {\r\n\t\treturn results, err\r\n\t}\r\n\tdefer cursor.Close(context.TODO())\r\n\r\n\tfor cursor.Next(context.TODO()) {\r\n\t\trowData := make(map[string]interface{})\r\n\t\tcursor.Decode(&rowData)\r\n\t\tresults = append(results, rowData)\r\n\t}\r\n\tif err := cursor.Err(); err != nil {\r\n\t\treturn results, err\r\n\t}\r\n\treturn results, nil\r\n}", "title": "" }, { "docid": "9b5955914903f5f4285df8c1efd2cc1f", "score": "0.49828497", "text": "func (c *mongoCollection) FindAll(result interface{}) error {\n\treturn c.col.Find(nil).All(result)\n}", "title": "" }, { "docid": "fbbef589b431d4ad91134b04f3bd1a06", "score": "0.49766728", "text": "func (s *Search) Find(query string) *Candidates {\n\tshingles := Shingle([]string{query})\n\tindex := s.reIndex(shingles)\n\tsignatureMatrix := minhashSetsMatrix(index, s.hashers)\n\tbandBuckets := LSH(signatureMatrix, s.bandsNum)\n\treturn bandBuckets.FindCandidates()\n\t/* found := candidates.GetByKey(index.setsNum - 1)\n\tresult := make([]string, len(found))\n\tfor i, v := range found {\n\t\tresult[i] = s.documents[v.Index]\n\t}\n\treturn result */\n}", "title": "" }, { "docid": "adcb3fb2a6c06413e60017d1e1fdccfc", "score": "0.4969824", "text": "func (s *NoteStub) Find(ctx context.Context, conditions *sacloud.FindCondition) (*sacloud.NoteFindResult, error) {\n\tif s.FindStubResult == nil {\n\t\tlog.Fatal(\"NoteStub.FindStubResult is not set\")\n\t}\n\treturn s.FindStubResult.Values, s.FindStubResult.Err\n}", "title": "" } ]
fc79a112816a87e50baf794d38b1e06a
UnmarshalYAML unmarshals a set of rules from YAML.
[ { "docid": "fbb41bd3664919857a2f4a0f6d288dc7", "score": "0.64151", "text": "func (moves *Moves) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar mvList []string\n\tif err := unmarshal(&mvList); err != nil {\n\t\treturn err\n\t}\n\n\tparsed, err := ParseMoves(mvList)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*moves = parsed\n\treturn nil\n}", "title": "" } ]
[ { "docid": "1af72431694cdacf3cb7c1b9c0dbeb52", "score": "0.70097065", "text": "func (a anchors) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\treturn nil\n}", "title": "" }, { "docid": "19dba49a7bf243fb3dd7c278061d9c23", "score": "0.65863717", "text": "func (at *SecurityCheck) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar res map[string]interface{}\n\tif err := unmarshal(&res); err != nil {\n\t\treturn err\n\t}\n\terr := mapstructure.Decode(res, &at)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif at.TestType == common.NonApplicableTest || at.TestType == common.ManualTest {\n\t\tat.NonApplicable = true\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef7558552cef6b8f7cbdba0ac9cd424a", "score": "0.64968425", "text": "func (e *ExternalOptimizeForConfigV1) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\treturn e.unmarshalWith(unmarshal)\n}", "title": "" }, { "docid": "2932550fd5698c2851a8bdb5992a5032", "score": "0.6471466", "text": "func (rl *RunList) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar runSlice []*Run\n\tsliceCandidate := marshal.UnmarshalCandidate{\n\t\tUnmarshal: func() error { return unmarshal(&runSlice) },\n\t\tAssign: func() { *rl = runSlice },\n\t}\n\n\tvar runItem *Run\n\titemCandidate := marshal.UnmarshalCandidate{\n\t\tUnmarshal: func() error { return unmarshal(&runItem) },\n\t\tAssign: func() { *rl = RunList{runItem} },\n\t}\n\n\treturn marshal.UnmarshalOneOf(sliceCandidate, itemCandidate)\n}", "title": "" }, { "docid": "bcbc03a32ad829057fbf391edb5975be", "score": "0.64021766", "text": "func (v *LabelSet) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tlbSet := model.LabelSet{}\n\terr := unmarshal(&lbSet)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv.LabelSet = lbSet\n\treturn nil\n}", "title": "" }, { "docid": "a630e2ab4c0514d9b34a84f815baad5c", "score": "0.6351119", "text": "func (r *OAuthFlow) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tobj := make(map[string]interface{})\n\tif err := unmarshal(&obj); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif value, ok := obj[\"authorizationUrl\"]; ok {\n\t\tif value, ok := value.(string); ok {\n\t\t\tr.AuthorizationURL = value\n\t\t}\n\t}\n\n\tif value, ok := obj[\"tokenUrl\"]; ok {\n\t\tif value, ok := value.(string); ok {\n\t\t\tr.TokenURL = value\n\t\t}\n\t}\n\n\tif value, ok := obj[\"refreshUrl\"]; ok {\n\t\tif value, ok := value.(string); ok {\n\t\t\tr.RefreshURL = value\n\t\t}\n\t}\n\n\tif value, ok := obj[\"scopes\"]; ok {\n\t\trbytes, err := yaml.Marshal(value)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tvalue := map[string]string{}\n\t\tif err := yaml.Unmarshal(rbytes, &value); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tr.Scopes = value\n\t}\n\n\texts := Extensions{}\n\tif err := unmarshal(&exts); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif len(exts) > 0 {\n\t\tr.Extensions = exts\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "712bc413f60d03c866bddad0da9a42f8", "score": "0.6342654", "text": "func (s *Store) UnmarshalYAML(unmarshal func(interface{}) error) (err error) {\n\ttype storeYAML map[string]map[string]entryYAML\n\n\tsy := make(storeYAML, 0)\n\n\terr = unmarshal(&sy)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*s = NewStore()\n\tfor groupID, group := range sy {\n\t\tfor entryID, entry := range group {\n\t\t\tentry.e.setGroup(groupID)\n\t\t\tif err = s.add(entryID, entry.e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a8d5b4810e10e20b176132b65c61097d", "score": "0.6330666", "text": "func (a *Alias) UnmarshalYAML(value *yaml.Node) error {\n\tif err := value.Decode(&a.AdvancedAliases); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(a.AdvancedAliases) != 0 {\n\t\t// Unmarshaled successfully to s.StringSlice, unset s.String, and return.\n\t\ta.StringSliceOrString = StringSliceOrString{}\n\t\treturn nil\n\t}\n\tif err := a.StringSliceOrString.UnmarshalYAML(value); err != nil {\n\t\treturn errUnmarshalAlias\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "56047a7c2fb02002048decbe8116f4ce", "score": "0.6310965", "text": "func (s *MaporEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tparts, err := unmarshalToStringOrSepMapParts(unmarshal, \"=\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = parts\n\treturn nil\n}", "title": "" }, { "docid": "99e3889c32932a32fdd5d408511bd42b", "score": "0.6288062", "text": "func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error {\n\tvo := reflect.ValueOf(o)\n\tunmarshalFn := yaml.Unmarshal\n\tif strict {\n\t\tunmarshalFn = yaml.UnmarshalStrict\n\t}\n\tj, err := yamlToJSON(y, &vo, unmarshalFn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error converting YAML to JSON: %v\", err)\n\t}\n\n\terr = jsonUnmarshal(bytes.NewReader(j), o, opts...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error unmarshaling JSON: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a44504b237266ea4d02207d0fc8bad7a", "score": "0.6285379", "text": "func (a *RelabelAction) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\tswitch act := RelabelAction(strings.ToLower(s)); act {\n\tcase RelabelReplace, RelabelKeep, RelabelDrop, RelabelHashMod, RelabelLabelMap, RelabelLabelDrop, RelabelLabelKeep:\n\t\t*a = act\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown relabel action %q\", s)\n}", "title": "" }, { "docid": "b29dfc9513fd5bf9d6d3e41ed2ec3558", "score": "0.6267765", "text": "func (r *Run) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar cl CommandList\n\tcommandCandidate := marshal.UnmarshalCandidate{\n\t\tUnmarshal: func() error { return unmarshal(&cl) },\n\t\tAssign: func() { *r = Run{Command: cl} },\n\t}\n\n\ttype runType Run // Use new type to avoid recursion\n\tvar runItem runType\n\trunCandidate := marshal.UnmarshalCandidate{\n\t\tUnmarshal: func() error { return unmarshal(&runItem) },\n\t\tAssign: func() { *r = Run(runItem) },\n\t\tValidate: func() error {\n\t\t\tactionUsedList := []bool{\n\t\t\t\tlen(runItem.Command) != 0,\n\t\t\t\tlen(runItem.SubTaskList) != 0,\n\t\t\t\trunItem.SetEnvironment != nil,\n\t\t\t}\n\n\t\t\tcount := 0\n\t\t\tfor _, isUsed := range actionUsedList {\n\t\t\t\tif isUsed {\n\t\t\t\t\tcount++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif count > 1 {\n\t\t\t\treturn errors.New(\"only one action can be defined in `run`\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn marshal.UnmarshalOneOf(commandCandidate, runCandidate)\n}", "title": "" }, { "docid": "bd3c896ba331d118c620e61956bcce4d", "score": "0.6267202", "text": "func (l *LogLevel) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar tp string\n\tunmarshal(&tp)\n\tlevel, exist := LogLevelMapping[tp]\n\tif !exist {\n\t\treturn errors.New(\"invalid mode\")\n\t}\n\t*l = level\n\treturn nil\n}", "title": "" }, { "docid": "bd9b86bd2ffaa9b77d00ca320ecb90a6", "score": "0.6241849", "text": "func (l *TestLimits) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tif defaultTestLimits != nil {\n\t\t*l = *defaultTestLimits\n\t}\n\ttype plain TestLimits\n\treturn unmarshal((*plain)(l))\n}", "title": "" }, { "docid": "45ee17b82756e588fb584573843c673b", "score": "0.6229447", "text": "func (c *NodeSelectorCondition) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tif err := unmarshal(&c.Keys); err != nil {\n\t\treturn err\n\t}\n\n\tc.NodeSelector = labels.SelectorFromSet(c.Keys)\n\treturn nil\n}", "title": "" }, { "docid": "19efba43de522df56986fd0d315dfc62", "score": "0.6210186", "text": "func (s *MaporColonSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tparts, err := unmarshalToStringOrSepMapParts(unmarshal, \":\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = parts\n\treturn nil\n}", "title": "" }, { "docid": "28a3a54e9a073ae413b45e89f40f9091", "score": "0.6207714", "text": "func (s *MaporSpaceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tparts, err := unmarshalToStringOrSepMapParts(unmarshal, \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = parts\n\treturn nil\n}", "title": "" }, { "docid": "0b70de4a629cbb10b3c836b086a09c2e", "score": "0.6201694", "text": "func (cd *ContainerDef) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype rawContainerDef ContainerDef\n\traw := rawContainerDef{Essential: true} // If essential is not specified, we want it to be true\n\tif err := unmarshal(&raw); err != nil {\n\t\treturn err\n\t}\n\n\t*cd = ContainerDef(raw)\n\treturn nil\n}", "title": "" }, { "docid": "0d5d830ab71bfab27b945a17f0fc2beb", "score": "0.61790776", "text": "func (vl *valueList) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\n\tvar err error\n\n\tvar valueSlice []value\n\tif err = unmarshal(&valueSlice); err == nil {\n\t\t*vl = valueSlice\n\t\treturn nil\n\t}\n\n\tvar valueItem value\n\tif err = unmarshal(&valueItem); err == nil {\n\t\t*vl = valueList{valueItem}\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "81d4f279612a67909efbc06848d0c643", "score": "0.61623365", "text": "func (gc *GroupConfiguration) UnmarshalYAML(value *yaml.Node) error {\n\tif value.Kind != yaml.MappingNode {\n\t\treturn errors.New(\"expected mapping\")\n\t}\n\n\tgc.versions = make(map[string]*VersionConfiguration)\n\tvar lastId string\n\n\tfor i, c := range value.Content {\n\t\t// Grab identifiers and loop to handle the associated value\n\t\tif i%2 == 0 {\n\t\t\tlastId = c.Value\n\t\t\tcontinue\n\t\t}\n\n\t\t// Handle nested version metadata\n\t\tif c.Kind == yaml.MappingNode {\n\t\t\tv := NewVersionConfiguration(lastId)\n\t\t\terr := c.Decode(&v)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"decoding yaml for %q\", lastId)\n\t\t\t}\n\n\t\t\tgc.addVersion(lastId, v)\n\t\t\tcontinue\n\t\t}\n\n\t\t// $payloadType: <string>\n\t\tif strings.EqualFold(lastId, payloadTypeTag) && c.Kind == yaml.ScalarNode {\n\t\t\tswitch strings.ToLower(c.Value) {\n\t\t\tcase string(OmitEmptyProperties):\n\t\t\t\tgc.PayloadType.Set(OmitEmptyProperties)\n\t\t\tcase string(ExplicitCollections):\n\t\t\t\tgc.PayloadType.Set(ExplicitCollections)\n\t\t\tcase string(ExplicitProperties):\n\t\t\t\tgc.PayloadType.Set(ExplicitProperties)\n\t\t\tdefault:\n\t\t\t\treturn errors.Errorf(\"unknown %s value: %s.\", payloadTypeTag, c.Value)\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// No handler for this value, return an error\n\t\treturn errors.Errorf(\n\t\t\t\"group configuration, unexpected yaml value %s: %s (line %d col %d)\", lastId, c.Value, c.Line, c.Column)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "094cd2b78c27601d1c8f408779e3b556", "score": "0.61517507", "text": "func (c *NamespaceCondition) UnmarshalFromYaml(data []byte) error {\n\treturn yaml.Unmarshal(data, c)\n}", "title": "" }, { "docid": "47a4c054c16eb959334992d9e1f85a78", "score": "0.6146833", "text": "func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar sliceType []string\n\tif err := unmarshal(&sliceType); err == nil {\n\t\tfor _, name := range sliceType {\n\t\t\tn.Networks = append(n.Networks, &Network{\n\t\t\t\tName: name,\n\t\t\t})\n\t\t}\n\t\treturn nil\n\t}\n\n\tvar mapType map[string]*Network\n\tif err := unmarshal(&sliceType); err != nil {\n\t\treturn err\n\t}\n\tfor name, network := range mapType {\n\t\tnetwork.Name = name\n\t\tn.Networks = append(n.Networks, network)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f291ee99fa5422134b2757c1b3b13024", "score": "0.61364853", "text": "func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\tr, err := NewRegexp(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*re = r\n\treturn nil\n}", "title": "" }, { "docid": "f291ee99fa5422134b2757c1b3b13024", "score": "0.61364853", "text": "func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\tr, err := NewRegexp(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*re = r\n\treturn nil\n}", "title": "" }, { "docid": "1ecfe623fbea108be1d8bc3f4f6e68c0", "score": "0.6136217", "text": "func (p *PortMapping) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype Alias PortMapping\n\taux := &struct {\n\t\tProtocol string `json:\"protocol\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(p),\n\t}\n\tif err := unmarshal(&aux); err != nil {\n\t\treturn err\n\t}\n\tif aux.Protocol != \"\" {\n\t\tval, ok := PortMappingProtocolNameToValue[strings.ToUpper(aux.Protocol)]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unknown protocol value: %s\", aux.Protocol)\n\t\t}\n\t\tp.Protocol = PortMappingProtocol(val)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af68b155ffb4a86ae7f3d6c268d6d14a", "score": "0.61176133", "text": "func (m *Manifest) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar tmp map[string]interface{}\n\tif err := unmarshal(&tmp); err != nil {\n\t\treturn err\n\t}\n\n\tdata, err := json.Marshal(tmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(data, m)\n}", "title": "" }, { "docid": "4dbb652e3bf2e0c638c96507d41dbd4c", "score": "0.61055666", "text": "func (r *HTTPOrBool) UnmarshalYAML(value *yaml.Node) error {\n\tif err := value.Decode(&r.HTTP); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !r.HTTP.IsEmpty() {\n\t\t// Unmarshalled successfully to r.HTTP, unset r.Enabled, and return.\n\t\tr.Enabled = nil\n\t\t// this assignment lets us treat the main listener rule and additional listener rules equally\n\t\t// because we eliminate the need for TargetContainerCamelCase by assigning its value to TargetContainer.\n\t\tif r.TargetContainerCamelCase != nil && r.Main.TargetContainer == nil {\n\t\t\tr.Main.TargetContainer = r.TargetContainerCamelCase\n\t\t\tr.TargetContainerCamelCase = nil\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := value.Decode(&r.Enabled); err != nil {\n\t\treturn errors.New(`cannot marshal \"http\" field into bool or map`)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e88573197df505b1645284f16d83ff9", "score": "0.610171", "text": "func (s *TokenStrategy) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar t string\n\terr := unmarshal(&t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif val, ok := toStrategy[strings.ToLower(t)]; ok {\n\t\t*s = val\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"'%s' is not a valid token strategy\", t)\n}", "title": "" }, { "docid": "ff75a7026ece528b82d134d3670a610e", "score": "0.60961604", "text": "func (a *ApprovalStrategy) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar j string\n\tif err := unmarshal(&j); err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.\n\t*a = approvalStrategyToID[strings.ToLower(j)]\n\treturn nil\n}", "title": "" }, { "docid": "7b7f041b70cf50a581eb2e0bf9b7f654", "score": "0.6092587", "text": "func (i *UserGroupAccess) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tvar err error\n\t*i, err = UserGroupAccessString(s)\n\treturn err\n}", "title": "" }, { "docid": "ce24a388642c6573fa90024d577130d6", "score": "0.60904396", "text": "func (conf *Config) UnmarshalYAML(value *yaml.Node) error {\n\ttype confAlias Config\n\taliased := confAlias(NewConfig())\n\n\terr := value.Decode(&aliased)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"line %v: %v\", value.Line, err)\n\t}\n\n\tif aliased.Type, _, err = docs.GetInferenceCandidateFromYAML(nil, docs.TypeTracer, aliased.Type, value); err != nil {\n\t\treturn fmt.Errorf(\"line %v: %w\", value.Line, err)\n\t}\n\n\t*conf = Config(aliased)\n\treturn nil\n}", "title": "" }, { "docid": "b27d5b85154fe1ede57c8ffe5e163ec7", "score": "0.60882425", "text": "func UnmarshalYAML(config *YAMLConfiguration, path string) {\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = yaml.Unmarshal(data, config)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "1e701a94892a2dacb9cb7fb8f7045282", "score": "0.60862756", "text": "func (r *Connection) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype tmp Connection\n\tvar s struct {\n\t\ttmp `yaml:\",inline\"`\n\t}\n\n\terr := unmarshal(&s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to parse YAML: %s\", err)\n\t}\n\n\t*r = Connection(s.tmp)\n\n\tif err := utils.ValidateTags(r); err != nil {\n\t\treturn err\n\t}\n\n\t// If options weren't specified, create an empty map.\n\tif r.Options == nil {\n\t\tr.Options = make(map[string]interface{})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "00e57039a6d45d12b4549d2042104b6c", "score": "0.6079959", "text": "func (r *Rank) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar i uint32\n\tif err := unmarshal(&i); err != nil {\n\t\treturn err\n\t}\n\tif err := checkRank(Rank(i)); err != nil {\n\t\treturn err\n\t}\n\t*r = Rank(i)\n\treturn nil\n}", "title": "" }, { "docid": "bd73d6724172f04c88507478080edc6f", "score": "0.6073515", "text": "func (s *ArtifactoryParams) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype plain ArtifactoryParams\n\tif err := unmarshal((*plain)(s)); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "832e66e5202f6b41df59193f0769a3dd", "score": "0.6067147", "text": "func (b *Bool) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar candidate bool\n\tif err := unmarshal(&candidate); err != nil {\n\t\treturn err\n\t}\n\n\tb.set(candidate)\n\treturn nil\n}", "title": "" }, { "docid": "a8426e77988fbd62f14bb3eb2ef591d7", "score": "0.60351163", "text": "func (m *MixinDeclaration) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// First try to just read the mixin name\n\tvar mixinNameOnly string\n\terr := unmarshal(&mixinNameOnly)\n\tif err == nil {\n\t\tm.Name = mixinNameOnly\n\t\tm.Config = nil\n\t\treturn nil\n\t}\n\n\t// Next try to read a mixin name with config defined\n\tmixinWithConfig := map[string]interface{}{}\n\terr = unmarshal(&mixinWithConfig)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not unmarshal raw yaml of mixin declarations\")\n\t}\n\n\tif len(mixinWithConfig) == 0 {\n\t\treturn errors.New(\"mixin declaration was empty\")\n\t} else if len(mixinWithConfig) > 1 {\n\t\treturn errors.New(\"mixin declaration contained more than one mixin\")\n\t}\n\n\tfor mixinName, config := range mixinWithConfig {\n\t\tm.Name = mixinName\n\t\tm.Config = config\n\t\tbreak // There is only one mixin anyway but break for clarity\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "820e306d368a3588e321ba74cc7948c0", "score": "0.60296667", "text": "func (loglevel *Loglevel) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar loglevelString string\n\terr := unmarshal(&loglevelString)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tloglevelString = strings.ToLower(loglevelString)\n\tswitch loglevelString {\n\tcase \"error\", \"warn\", \"info\", \"debug\":\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid loglevel %s Must be one of [error, warn, info, debug]\", loglevelString)\n\t}\n\n\t*loglevel = Loglevel(loglevelString)\n\treturn nil\n}", "title": "" }, { "docid": "335bd50a21552545f2125725364fbecc", "score": "0.60142946", "text": "func (z *Z) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype Z struct {\n\t\tS *string `json:\"s\"`\n\t\tI *int32 `json:\"iVal\"`\n\t}\n\tvar dec Z\n\tif err := unmarshal(&dec); err != nil {\n\t\treturn err\n\t}\n\tif dec.S != nil {\n\t\tz.S = *dec.S\n\t}\n\tif dec.I != nil {\n\t\tz.I = *dec.I\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d9e40cf709f94e14f10b822a239c56c", "score": "0.60131377", "text": "func UnmarshalYAML(yml []byte) (map[string]ZNode, error) {\n\tvar root map[string]ZNode\n\tvar err = yaml.Unmarshal(yml, &root)\n\treturn root, err\n}", "title": "" }, { "docid": "69cb57b74cea858bd57c3d739bb74818", "score": "0.60117716", "text": "func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype plain Secret\n\treturn unmarshal((*plain)(s))\n}", "title": "" }, { "docid": "69cb57b74cea858bd57c3d739bb74818", "score": "0.60117716", "text": "func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype plain Secret\n\treturn unmarshal((*plain)(s))\n}", "title": "" }, { "docid": "d38f4b03f47da22abf2ee9dca58983b4", "score": "0.6010966", "text": "func (i *Transform) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tvar err error\n\t*i, err = ParseTransformString(s)\n\treturn err\n}", "title": "" }, { "docid": "fd9e9d3e21cf2439fb5baead242ca546", "score": "0.60071135", "text": "func (d *duration) UnmarshalYAML(unmashal func(interface{}) error) error {\n\tvar s string\n\tif err := unmashal(&s); err != nil {\n\t\treturn err\n\t}\n\tdur, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = duration(dur)\n\treturn nil\n}", "title": "" }, { "docid": "5c2ab5060f38abb29d201c6334e96549", "score": "0.59928334", "text": "func (y *PipelineYml) Unmarshal() error {\n\n\terr := yaml.Unmarshal(y.byteData, &y.obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif y.obj == nil {\n\t\treturn errors.New(\"PipelineYml.obj is nil pointer\")\n\t}\n\n\t//err = y.Evaluate(applyEnvsWithPriority(y.metadata.publicTemplateVars, y.metadata.secretTemplateVars))\n\t//if err != nil {\n\t//\treturn err\n\t//}\n\n\t// re unmarshal to obj, because byteData updated by evaluate\n\terr = yaml.Unmarshal(y.byteData, &y.obj)\n\treturn err\n}", "title": "" }, { "docid": "73ca6e604fe1470c5472931ec4303192", "score": "0.5987389", "text": "func (r *ScalingConfigOrT[_]) UnmarshalYAML(value *yaml.Node) error {\n\tif err := value.Decode(&r.ScalingConfig); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !r.ScalingConfig.IsEmpty() {\n\t\t// Successfully unmarshalled ScalingConfig fields, return\n\t\treturn nil\n\t}\n\n\tif err := value.Decode(&r.Value); err != nil {\n\t\treturn errors.New(`unable to unmarshal into int or composite-style map`)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78647655419c73691b7555ae2bf0324c", "score": "0.597839", "text": "func (c *Count) UnmarshalYAML(value *yaml.Node) error {\n\tif err := value.Decode(&c.AdvancedCount); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !c.AdvancedCount.IsEmpty() {\n\t\t// Successfully unmarshalled AdvancedCount fields, return\n\t\treturn nil\n\t}\n\n\tif err := value.Decode(&c.Value); err != nil {\n\t\treturn errUnmarshalCountOpts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c06b1bd5f0c49078ad09d3e8baa5083", "score": "0.5977757", "text": "func (m *Mount) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype Alias Mount\n\taux := &struct {\n\t\tPropagation string `yaml:\"propagation\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(m),\n\t}\n\tif err := unmarshal(&aux); err != nil {\n\t\treturn err\n\t}\n\t// if unset, will fallback to the default (0)\n\tif aux.Propagation != \"\" {\n\t\tval, ok := MountPropagationNameToValue[aux.Propagation]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unknown propagation value: %s\", aux.Propagation)\n\t\t}\n\t\tm.Propagation = MountPropagation(val)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "732bff2060ae9fa9155a1ace048c74a9", "score": "0.5976861", "text": "func (c *NodeSelectorCondition) UnmarshalFromYaml(data []byte) error {\n\treturn yaml.Unmarshal(data, c)\n}", "title": "" }, { "docid": "3ffe7baefa62cf7e48e5dac16316373f", "score": "0.5970196", "text": "func (d *DurationMinutes) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar candidate int\n\tif err := unmarshal(&candidate); err != nil {\n\t\treturn err\n\t}\n\n\ttc := OfMinutes(candidate)\n\t*d = tc\n\treturn nil\n}", "title": "" }, { "docid": "c374177544bde57743898d0f3c389903", "score": "0.59695685", "text": "func (m *BootstrapMode) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar str string\n\tif err := unmarshal(&str); err != nil {\n\t\treturn err\n\t}\n\n\t// If unspecified, use default mode.\n\tif str == \"\" {\n\t\t*m = DefaultBootstrapMode\n\t\treturn nil\n\t}\n\n\tfor _, valid := range validBootstrapModes {\n\t\tif str == valid.String() {\n\t\t\t*m = valid\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"invalid BootstrapMode '%s' valid types are: %s\",\n\t\tstr, validBootstrapModes)\n}", "title": "" }, { "docid": "631066da8b61aa9f7d87fb2b42a42ec5", "score": "0.59681803", "text": "func (b *brokerOutputList) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tgenericOutputs := []interface{}{}\n\tif err := unmarshal(&genericOutputs); err != nil {\n\t\treturn err\n\t}\n\n\toutputConfs, err := parseOutputConfsWithDefaults(genericOutputs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*b = outputConfs\n\treturn nil\n}", "title": "" }, { "docid": "193b330f3c43e54b84f921e98095aa32", "score": "0.5962764", "text": "func (d *Rate) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\trate, err := ParseRate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = rate\n\treturn nil\n}", "title": "" }, { "docid": "637a28ffe0b13405ce9ad5d70e187368", "score": "0.5960883", "text": "func (s *IPMIConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t*s = defaultConfig\n\ttype plain IPMIConfig\n\tif err := unmarshal((*plain)(s)); err != nil {\n\t\treturn err\n\t}\n\tif err := checkOverflow(s.XXX, \"modules\"); err != nil {\n\t\treturn err\n\t}\n\tfor _, c := range s.Collectors {\n\t\tif err := c.IsValid(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4413a4c295fbd5797702332b06e7126", "score": "0.59576464", "text": "func (t *Task) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar rawTask map[string]interface{}\n\terr := unmarshal(&rawTask)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal task: %s\", err)\n\t}\n\n\trawName, ok := rawTask[\"name\"]\n\tif !ok {\n\t\treturn errors.New(\"missing 'name' field\")\n\t}\n\n\ttaskName, ok := rawName.(string)\n\tif !ok || taskName == \"\" {\n\t\treturn errors.New(\"'name' field needs to be a non-empty string\")\n\t}\n\n\tt.Name = taskName\n\n\t// Delete name field, since it doesn't represent an action\n\tdelete(rawTask, \"name\")\n\n\tfor actionType, action := range rawTask {\n\t\taction, err := actions.UnmarshalAction(actionType, action)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unmarshal action %q from task %q: %s\", actionType, t.Name, err)\n\t\t}\n\n\t\tt.Actions = append(t.Actions, action)\n\t}\n\n\tif len(t.Actions) == 0 {\n\t\treturn fmt.Errorf(\"task %q has no actions\", t.Name)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c48f6b5735b0af711dc7a84ef4445843", "score": "0.59391946", "text": "func (c *Scenario) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype C Scenario\n\tnewConfig := (*C)(c)\n\tif err := unmarshal(&newConfig); err != nil {\n\t\treturn err\n\t}\n\tif c.Database == nil {\n\t\treturn fmt.Errorf(\"Database must not be empty\")\n\t}\n\tif c.Collection == nil {\n\t\treturn fmt.Errorf(\"Collection must not be empty\")\n\t}\n\tswitch p := c.Parallel; {\n\tcase p == nil:\n\t\tc.Parallel = Int(1)\n\tcase *p < 1:\n\t\treturn fmt.Errorf(\"Parallel must be greater than or equal to 1\")\n\tdefault:\n\t}\n\tswitch s := c.BufferSize; {\n\tcase s == nil:\n\t\tc.BufferSize = Int(1000)\n\tcase *s < 1:\n\t\treturn fmt.Errorf(\"BufferSize must be greater than or equal to 1\")\n\tdefault:\n\t}\n\tswitch s := c.Repeat; {\n\tcase s == nil:\n\t\tc.Repeat = Int(1)\n\tcase *s < 0:\n\t\treturn fmt.Errorf(\"Repeat must be greater than or equal to 0\")\n\tdefault:\n\t}\n\tif len(c.Queries) == 0 {\n\t\treturn fmt.Errorf(\"Queries must not be empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87d58a4ee4b73a8273946f3228dbca62", "score": "0.59358007", "text": "func (msg *RawMessage) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tmsg.unmarshal = unmarshal\n\treturn nil\n}", "title": "" }, { "docid": "e166cf9b5ba5d55119141079a2ac3585", "score": "0.5932524", "text": "func (s *GitEvent) UnmarshalYAML(n *yaml.Node) error {\n\tvar j string\n\terr := yaml.Unmarshal([]byte(n.Value), &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Push' in this case.\n\t*s = toID[j]\n\treturn nil\n}", "title": "" }, { "docid": "24a57162e0df0f491843840ee3d142b8", "score": "0.59303755", "text": "func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\tif !LabelName(s).IsValid() {\n\t\treturn fmt.Errorf(\"%q is not a valid label name\", s)\n\t}\n\t*ln = LabelName(s)\n\treturn nil\n}", "title": "" }, { "docid": "0224bfa360fcde6b3d6d85aa1fa04e9c", "score": "0.5921524", "text": "func (f *Flag) UnmarshalYAML(node *yaml.Node) error {\n\ttag := GetTag(node.Value)\n\tf.Name = tag.Name\n\tf.Negates = tag.Negates\n\tlog.Tracef(\"Unmarshal %s into %s\\n\", node.Value, tag)\n\treturn nil\n}", "title": "" }, { "docid": "14fe05cd4cddd1e4a02a289a0ebed728", "score": "0.59163016", "text": "func (c *Count) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tif err := unmarshal(&c.AdvancedCount); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := c.AdvancedCount.IsValid(); err != nil {\n\t\treturn err\n\t}\n\n\tif !c.AdvancedCount.IsEmpty() {\n\t\t// Successfully unmarshalled AdvancedCount fields, return\n\t\treturn nil\n\t}\n\n\tif err := unmarshal(&c.Value); err != nil {\n\t\treturn errUnmarshalCountOpts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26f4905400b8d1b462a93136739fde81", "score": "0.59105027", "text": "func (this *Write) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// new temp as map[string]interface{}.\n\ttemp := make(map[string]interface{})\n\n\t// unmarshal temp as yaml.\n\tif err := unmarshal(temp); err != nil {\n\t\treturn err\n\t}\n\n\treturn this.unmarshal(temp)\n}", "title": "" }, { "docid": "720cac5fe5daffb1c081fd9b0c549d01", "score": "0.59086907", "text": "func UnmarshalRules(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Rules)\n\terr = core.UnmarshalPrimitive(m, \"enabled\", &obj.Enabled)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"event_type_filter\", &obj.EventTypeFilter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"notification_filter\", &obj.NotificationFilter)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "449ce20d875b1bcac9cc95dd7922d1bb", "score": "0.5907496", "text": "func (r *Discriminator) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tobj := make(map[string]interface{})\n\tif err := unmarshal(&obj); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif value, ok := obj[\"propertyName\"]; ok {\n\t\tif value, ok := value.(string); ok {\n\t\t\tr.PropertyName = value\n\t\t}\n\t}\n\n\tif value, ok := obj[\"mapping\"]; ok {\n\t\tif value, ok := cleanupMapValue(value).(map[string]interface{}); ok {\n\t\t\ts := make(map[string]string, len(value))\n\t\t\tfor k, v := range value {\n\t\t\t\ts[k] = fmt.Sprint(v)\n\t\t\t}\n\t\t\tr.Mapping = s\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2e9997af9bf4da4c01f2940a0dc467ac", "score": "0.5903912", "text": "func (options *Options) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype defaults Options\n\tdefaultValues := defaults(*NewOptions())\n\n\tif err := unmarshal(&defaultValues); err != nil {\n\t\treturn err\n\t}\n\n\t*options = Options(defaultValues)\n\n\tif options.SingleLineDisplay {\n\t\toptions.ShowSummaryFooter = false\n\t\toptions.CollapseOnCompletion = false\n\t}\n\n\t// the global options must be available when parsing the task yaml (todo: does order matter?)\n\tglobalOptions = options\n\treturn nil\n}", "title": "" }, { "docid": "3f752e5af490598041f2b77b4c4b2368", "score": "0.5893353", "text": "func (i *Int) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar candidate int\n\tif err := unmarshal(&candidate); err != nil {\n\t\treturn err\n\t}\n\n\ti.set(candidate)\n\treturn nil\n}", "title": "" }, { "docid": "89afeb3dc5e101c3c50e398abd80184b", "score": "0.5892005", "text": "func (s *TestFileParams) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype plain TestFileParams\n\tif err := unmarshal((*plain)(s)); err != nil {\n\t\treturn err\n\t}\n\tif s.Size == 0 {\n\t\treturn errors.New(\"File 'size' must be defined\")\n\t}\n\tif s.HistogramBucketPush == nil {\n\t\treturn errors.New(\"File 'histogram_bucket_push' must be defined\")\n\t}\n\tif s.HistogramBucketPull == nil {\n\t\treturn errors.New(\"File 'histogram_bucket_pull' must be defined\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e850abce77fb1c7c94a9c9c012f5018a", "score": "0.5890075", "text": "func (r *ParseKind) UnmarshalYAML(unmarshal func(v interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn fmt.Errorf(\"ParseKind should be a string\")\n\t}\n\tv, ok := _ParseKindNameToValue[s]\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid ParseKind %q\", s)\n\t}\n\t*r = v\n\treturn nil\n}", "title": "" }, { "docid": "51bfe071223214384c55fa2877483308", "score": "0.58870184", "text": "func (o *Op) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar typeDecoder map[string]rawMessage\n\terr := unmarshal(&typeDecoder)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn o.unmarshalDecodedType(typeDecoder)\n}", "title": "" }, { "docid": "c305771254d36a81e5e49f035c77c5cf", "score": "0.586009", "text": "func (decoder Decoder) ParseCriteriaFromYAML(r io.Reader, c *Criteria) error {\n\tdecoder.Logger.Printf(\"parsing criteria from reader\\n\")\n\terr := yaml.NewDecoder(r).Decode(c)\n\tif err != nil {\n\t\tdecoder.Logger.Printf(\"error decoding criteria from reader: %v\\n\", err)\n\t\treturn err\n\t}\n\tfor i := range c.Routes {\n\t\tif c.Routes[i].StructRoute != nil {\n\t\t\tnamedPathVarExtractor := defaultURLNamedPathVarExtractor\n\t\t\tif len(c.Routes[i].StructRoute.NamedPathVarExtractor) > 0 {\n\t\t\t\tnamedPathVarExtractor, err = regexp.Compile(c.Routes[i].StructRoute.NamedPathVarExtractor)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.Routes[i].StructRoute.NamedPathVarExtractorRegexp = namedPathVarExtractor\n\t\t\tif c.Routes[i].StructRoute.Parameters != nil {\n\t\t\t\tfor k, v := range c.Routes[i].StructRoute.Parameters {\n\t\t\t\t\tif len(v.Matches) > 0 && !v.Always {\n\t\t\t\t\t\tmatchesRegexp, err := regexp.Compile(v.Matches)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv.MatchesRegExp = matchesRegexp\n\t\t\t\t\t\tc.Routes[i].StructRoute.Parameters[k] = v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO: Extract this to a function\n\t\t\t}\n\t\t\tif c.Routes[i].StructRoute.Security != nil {\n\t\t\t\tfor k, v := range c.Routes[i].StructRoute.Security {\n\t\t\t\t\tif len(v.Matches) > 0 && !v.Always {\n\t\t\t\t\t\tmatchesRegexp, err := regexp.Compile(v.Matches)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv.MatchesRegExp = matchesRegexp\n\t\t\t\t\t\tc.Routes[i].StructRoute.Security[k] = v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if c.Routes[i].FuncRoute != nil {\n\t\t\tnamedPathVarExtractor := defaultURLNamedPathVarExtractor\n\t\t\tif len(c.Routes[i].FuncRoute.NamedPathVarExtractor) > 0 {\n\t\t\t\tnamedPathVarExtractor, err = regexp.Compile(c.Routes[i].FuncRoute.NamedPathVarExtractor)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.Routes[i].FuncRoute.NamedPathVarExtractorRegexp = namedPathVarExtractor\n\t\t}\n\t}\n\tfor i := range c.Request {\n\t\tif c.Request[i].Validations != nil {\n\t\t\tfor k, v := range c.Request[i].Validations {\n\t\t\t\tif len(v.Validation) > 0 {\n\t\t\t\t\ttagRegexp, err := regexp.Compile(v.Validation)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tdecoder.Logger.Printf(\"error processing validation %s, could not compile regexp '%s': %v\", k, v.Validation, err)\n\t\t\t\t\t}\n\t\t\t\t\tv.TagRegexp = []*regexp.Regexp{tagRegexp}\n\t\t\t\t\tc.Request[i].Validations[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66983419d777f559e8888ed8f97c4537", "score": "0.5858028", "text": "func (f *Fixture) FromYAML(tmpl string, vals, dst interface{}) {\n\tf.t.Helper()\n\n\tt, err := template.New(\"\").Parse(tmpl)\n\tif err != nil {\n\t\tf.t.Fatalf(\"Invalid template: %s\", err)\n\t}\n\tvar buf bytes.Buffer\n\tif err := t.Execute(&buf, vals); err != nil {\n\t\tf.t.Fatalf(\"Execute template: %s\", err)\n\t}\n\tif err := yaml.Unmarshal(bytes.TrimSpace(buf.Bytes()), dst); err != nil {\n\t\tf.t.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "1ee235820c809fa726e8789aa097bb6c", "score": "0.5853342", "text": "func (r *Rate) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar value float64\n\tif err := unmarshal(&value); err != nil {\n\t\treturn err\n\t}\n\n\tparsed := Rate(value)\n\tif err := parsed.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\t*r = parsed\n\n\treturn nil\n}", "title": "" }, { "docid": "ee58e825fffed224b2919b713be56080", "score": "0.5845418", "text": "func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t*c = DefaultSDConfig\n\ttype plain SDConfig\n\terr := unmarshal((*plain)(c))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(c.Files) == 0 {\n\t\treturn errors.New(\"file service discovery config must contain at least one path name\")\n\t}\n\tfor _, name := range c.Files {\n\t\tif !patFileSDName.MatchString(name) {\n\t\t\treturn fmt.Errorf(\"path name %q is not valid for file discovery\", name)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0639362807887ff591623de3f783a534", "score": "0.5834607", "text": "func (c *MailConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype plain MailConfig\n\tif err := unmarshal((*plain)(c)); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2e2d4efa0cfa4a6c2a3a083bd232710", "score": "0.58213896", "text": "func (date *Date) UnmarshalYAML(value *yaml.Node) (err error) {\n\tvar d string\n\tif err = value.Decode(&d); err != nil {\n\t\treturn err\n\t}\n\t// check data format\n\tif err := checkDateFormat(d); err != nil {\n\t\treturn err\n\t}\n\n\t*date = Date(d)\n\treturn nil\n}", "title": "" }, { "docid": "89bb33efe39295d40d854e5a2e7c25b2", "score": "0.5819889", "text": "func (s *Step) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// unmarshal into stepUnmarshaller instead of Step for dynamic unmarshalling Request/Expect\n\tvar unmarshaled stepUnmarshaller\n\tif err := unmarshal(&unmarshaled); err != nil {\n\t\treturn err\n\t}\n\n\ts.Title = unmarshaled.Title\n\ts.Description = unmarshaled.Description\n\ts.Vars = unmarshaled.Vars\n\ts.Protocol = unmarshaled.Protocol\n\ts.Include = unmarshaled.Include\n\ts.Ref = unmarshaled.Ref\n\ts.Bind = unmarshaled.Bind\n\ts.Timeout = unmarshaled.Timeout\n\ts.PostTimeoutWaitingLimit = unmarshaled.PostTimeoutWaitingLimit\n\ts.Retry = unmarshaled.Retry\n\n\tp := protocol.Get(s.Protocol)\n\tif p == nil {\n\t\tif unmarshaled.Request != nil || unmarshaled.Expect != nil {\n\t\t\treturn errors.Errorf(\"unknown protocol: %s\", s.Protocol)\n\t\t}\n\t\treturn nil\n\t}\n\tif unmarshaled.Request != nil {\n\t\tinvoker, err := p.UnmarshalRequest(unmarshaled.Request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.Request = invoker\n\t}\n\tbuilder, err := p.UnmarshalExpect(unmarshaled.Expect)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.Expect = builder\n\n\treturn nil\n}", "title": "" }, { "docid": "229628608ccc1b5891214335c5fb6dd9", "score": "0.58197635", "text": "func (e *ExternalJavaPackagePrefixConfigV1) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\treturn e.unmarshalWith(unmarshal)\n}", "title": "" }, { "docid": "8e8778ab6fdc8d11cc0dd0d154818e88", "score": "0.5814534", "text": "func (i *ImportDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\n\tif err := unmarshal(&s); err == nil {\n\t\ti.File = s\n\t\treturn nil\n\t}\n\tvar str struct {\n\t\tFile string `yaml:\"file,omitempty\"`\n\t\tRepository string `yaml:\"repository,omitempty\"`\n\t\tNamespaceURI string `yaml:\"namespace_uri,omitempty\"`\n\t\tNamespacePrefix string `yaml:\"namespace_prefix,omitempty\"`\n\t}\n\tif err := unmarshal(&str); err != nil {\n\t\treturn err\n\t}\n\ti.File = str.File\n\ti.Repository = str.Repository\n\ti.NamespaceURI = str.NamespaceURI\n\ti.NamespacePrefix = str.NamespacePrefix\n\treturn nil\n}", "title": "" }, { "docid": "f47879e2481caacbecfc804322947fb2", "score": "0.58143014", "text": "func (t *Type) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar str string\n\tif err := unmarshal(&str); err != nil {\n\t\treturn err\n\t}\n\tvar validStrings []string\n\tfor _, validType := range validTypes {\n\t\tvalidString := string(validType)\n\t\tif validString == str {\n\t\t\t*t = validType\n\t\t\treturn nil\n\t\t}\n\t\tvalidStrings = append(validStrings, validString)\n\t}\n\n\treturn fmt.Errorf(\"invalid traffic controller type %s, valid types are: %v\", str, validStrings)\n}", "title": "" }, { "docid": "160f2bba3116542f3d224d67c682bf03", "score": "0.5810161", "text": "func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t*c = DefaultConfig\n\tc.LogsLabels = make(map[string]string)\n\ttype plain Config\n\treturn unmarshal((*plain)(c))\n}", "title": "" }, { "docid": "d98f5e62a20a579cb438f00aa86a8725", "score": "0.58033854", "text": "func (mv *Move) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tparsed, err := ParseMove(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*mv = *parsed\n\treturn nil\n}", "title": "" }, { "docid": "04219dd89d9f2632d15ff4a6a4333710", "score": "0.58017004", "text": "func (w *CommandWrapper) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar err error\n\tvar str string\n\tif err = unmarshal(&str); err == nil {\n\t\tw.Command = str\n\t\treturn nil\n\t}\n\n\tvar commandArray []string\n\tif err = unmarshal(&commandArray); err == nil {\n\t\tw.Commands = commandArray\n\t\treturn nil\n\t}\n\treturn nil //TODO: should be an error , something like UNhhandledError\n}", "title": "" }, { "docid": "b93030a576b6fde280827276d6f92335", "score": "0.578057", "text": "func (c *SlackConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t*c = DefaultSlackConfig\n\ttype plain SlackConfig\n\tif err := unmarshal((*plain)(c)); err != nil {\n\t\treturn err\n\t}\n\treturn checkOverflow(c.XXX, \"slack config\")\n}", "title": "" }, { "docid": "8ea9f8381b6a300c997bd3abaedf213d", "score": "0.576628", "text": "func (m *OrderedMap[K, V]) UnmarshalYAML(b []byte) error {\n\tvar s yaml.MapSlice\n\tif err := yaml.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\tif len(s) == 0 {\n\t\treturn nil\n\t}\n\tresult := OrderedMap[K, V]{\n\t\tidx: map[K]int{},\n\t\titems: make([]OrderedMapItem[K, V], len(s)),\n\t}\n\tfor i, item := range s {\n\t\tkb, err := yaml.Marshal(item.Key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar k K\n\t\tif err := yaml.Unmarshal(kb, &k); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvb, err := yaml.Marshal(item.Value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar v V\n\t\tif err := yaml.UnmarshalWithOptions(vb, &v, yaml.UseOrderedMap(), yaml.Strict()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresult.idx[k] = i\n\t\tresult.items[i].Key = k\n\t\tresult.items[i].Value = v\n\t}\n\t*m = result\n\treturn nil\n}", "title": "" }, { "docid": "f740ee864fee0d51d4ca52e375ecf3e4", "score": "0.5764221", "text": "func (f *Fixed8) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\terr := unmarshal(&s)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn f.setFromString(s)\n}", "title": "" }, { "docid": "6e40ae9425891d1ab2c2f1dab82f0b68", "score": "0.57633215", "text": "func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\tdur, err := ParseDuration(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = dur\n\treturn nil\n}", "title": "" }, { "docid": "e5a5a6f7e8e8d6e25c9632ad84db61fd", "score": "0.5762661", "text": "func (t *TimeUnixSeconds) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar candidate int\n\tif err := unmarshal(&candidate); err != nil {\n\t\treturn err\n\t}\n\n\ttc := OfUnixSeconds(candidate)\n\t*t = tc\n\treturn nil\n}", "title": "" }, { "docid": "13cd77e98b99d5112d2d8ddb61e363d9", "score": "0.5759239", "text": "func (tf *Taskfile) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tif err := unmarshal(&tf.Tasks); err == nil {\n\t\ttf.Version = \"1\"\n\t\treturn nil\n\t}\n\n\tvar taskfile struct {\n\t\tVersion string\n\t\tExpansions int\n\t\tOutput string\n\t\tIncludes yaml.MapSlice\n\t\tVars Vars\n\t\tEnv Vars\n\t\tTasks Tasks\n\t}\n\tif err := unmarshal(&taskfile); err != nil {\n\t\treturn err\n\t}\n\ttf.Version = taskfile.Version\n\ttf.Expansions = taskfile.Expansions\n\ttf.Output = taskfile.Output\n\tincludes, defaultInclude, err := IncludesFromYaml(taskfile.Includes)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttf.Includes = includes\n\ttf.IncludeDefaults = defaultInclude\n\ttf.Vars = taskfile.Vars\n\ttf.Env = taskfile.Env\n\ttf.Tasks = taskfile.Tasks\n\tif tf.Expansions <= 0 {\n\t\ttf.Expansions = 2\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3d753b6692e5ae648b29eef70c2d41fb", "score": "0.5752641", "text": "func (d *ConfigDuration) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\tdur, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Duration = dur\n\treturn nil\n}", "title": "" }, { "docid": "3efbd37719a57a22d69feb1c2794547c", "score": "0.57471716", "text": "func (c *VictorOpsConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t*c = DefaultVictorOpsConfig\n\ttype plain VictorOpsConfig\n\tif err := unmarshal((*plain)(c)); err != nil {\n\t\treturn err\n\t}\n\tif c.APIKey == \"\" {\n\t\treturn fmt.Errorf(\"missing API key in VictorOps config\")\n\t}\n\tif c.RoutingKey == \"\" {\n\t\treturn fmt.Errorf(\"missing Routing key in VictorOps config\")\n\t}\n\treturn checkOverflow(c.XXX, \"victorops config\")\n}", "title": "" }, { "docid": "b9af3e28d62c3443731dd31f9c7ef399", "score": "0.5739681", "text": "func (conf *Config) UnmarshalYAML(value *yaml.Node) error {\n\ttype confAlias Config\n\taliased := confAlias(NewConfig())\n\n\terr := value.Decode(&aliased)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"line %v: %v\", value.Line, err)\n\t}\n\n\tvar spec docs.ComponentSpec\n\tif aliased.Type, spec, err = docs.GetInferenceCandidateFromYAML(docs.DeprecatedProvider, docs.TypeOutput, value); err != nil {\n\t\treturn fmt.Errorf(\"line %v: %w\", value.Line, err)\n\t}\n\n\tif spec.Plugin {\n\t\tpluginNode, err := docs.GetPluginConfigYAML(aliased.Type, value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"line %v: %v\", value.Line, err)\n\t\t}\n\t\taliased.Plugin = &pluginNode\n\t} else {\n\t\taliased.Plugin = nil\n\t}\n\n\t*conf = Config(aliased)\n\treturn nil\n}", "title": "" }, { "docid": "4f1d07d715f3a3b3d7683f5499d2d6dc", "score": "0.5730007", "text": "func (sc *ScrapeConfigs) UnmarshalJSON(b []byte) error {\n\n\tvar oneConfig ScrapeConfig\n\tif err := json.Unmarshal(b, &oneConfig); err == nil {\n\t\t*sc = ScrapeConfigs{oneConfig}\n\t\treturn nil\n\t}\n\tvar multiConfigs []ScrapeConfig\n\tif err := json.Unmarshal(b, &multiConfigs); err == nil {\n\t\t*sc = multiConfigs\n\t\treturn nil\n\t} else {\n\t\tfmt.Println(err)\n\t\tfmt.Println(\"Badly formatted YAML: Exiting\")\n\t\tos.Exit(1)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3eb59d0e7f95045f04731e94def71ae5", "score": "0.571729", "text": "func (r *Range) UnmarshalYAML(value *yaml.Node) error {\n\tif err := value.Decode(&r.RangeConfig); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *yaml.TypeError:\n\t\t\tbreak\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !r.RangeConfig.IsEmpty() {\n\t\t// Unmarshaled successfully to r.RangeConfig, unset r.Range, and return.\n\t\tr.Value = nil\n\t\treturn nil\n\t}\n\n\tif err := value.Decode(&r.Value); err != nil {\n\t\treturn errUnmarshalRangeOpts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "037620de4155e21c1185cd1704db8839", "score": "0.5717124", "text": "func (op *OpRemove) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\treturn unmarshal(&op.Field)\n}", "title": "" }, { "docid": "48adaf6368cc83a0da29e01624e33874", "score": "0.5705805", "text": "func (act *Action) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\t// creating anonimus struct to avoid recursion\n\tvar a struct {\n\t\tName ActionType `yaml:\"type\"`\n\t\tTimeout time.Duration `yaml:\"timeout,omitempty\"`\n\t\tOnFail onFailAction `yaml:\"on-fail,omitempty\"`\n\t\tInterval time.Duration `yaml:\"interval,omitempty\"`\n\t\tEnabled bool `yaml:\"enabled,omitempty\"`\n\t\tRecordPending bool `yaml:\"record-pending,omitempty\"`\n\t\tRole actionRole `yaml:\"role,omitempty\"`\n\t}\n\t// setting default\n\ta.Name = \"defaultName\"\n\ta.Timeout = 20 * time.Second\n\ta.OnFail = of_ignore\n\ta.Interval = 20 * time.Second\n\ta.Enabled = true\n\ta.RecordPending = false\n\ta.Role = ar_none\n\tif err := unmarshal(&a); err != nil {\n\t\treturn err\n\t}\n\t// copying into aim struct fields\n\t*act = Action{a.Name, a.Timeout, a.OnFail, a.Interval,\n\t\ta.Enabled, a.RecordPending, a.Role, nil}\n\treturn nil\n}", "title": "" }, { "docid": "88f2649ca86c20c75145fe566655a04e", "score": "0.5702081", "text": "func (t *Type) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar value string\n\tif err := unmarshal(&value); err != nil {\n\t\treturn err\n\t}\n\n\tif err := t.Set(value); err != nil {\n\t\treturn fmt.Errorf(\"failed to parse '%s' to Type: %v\", value, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d6411dd11f9dc6d3875d9a8daf2a32c9", "score": "0.5700258", "text": "func (i *UOM) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tvar err error\n\t*i, err = UOMString(s)\n\treturn err\n}", "title": "" }, { "docid": "938688f6c98b7171898d230dd210b091", "score": "0.56976026", "text": "func (f *Float64) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar candidate float64\n\tif err := unmarshal(&candidate); err != nil {\n\t\treturn err\n\t}\n\n\tf.set(candidate)\n\treturn nil\n}", "title": "" }, { "docid": "0c8849356f00b361befcc0c1a8b18b5f", "score": "0.5697547", "text": "func (d *DurationMillis) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tvar candidate int\n\tif err := unmarshal(&candidate); err != nil {\n\t\treturn err\n\t}\n\n\ttc := OfMilliseconds(candidate)\n\t*d = tc\n\treturn nil\n}", "title": "" }, { "docid": "727e36a0fde9708dde77d91f30229764", "score": "0.569532", "text": "func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\ttype raw Config\n\tvar cfg raw\n\tif c.URL.URL != nil {\n\t\t// we used flags to set that value, which already has sane default.\n\t\tcfg = raw(*c)\n\t} else {\n\t\t// force sane defaults.\n\t\tcfg = raw{\n\t\t\tBackoffConfig: util.BackoffConfig{\n\t\t\t\tMaxBackoff: 5 * time.Second,\n\t\t\t\tMaxRetries: 5,\n\t\t\t\tMinBackoff: 100 * time.Millisecond,\n\t\t\t},\n\t\t\tBatchSize: 100 * 1024,\n\t\t\tBatchWait: 1 * time.Second,\n\t\t\tTimeout: 10 * time.Second,\n\t\t}\n\t}\n\n\tif err := unmarshal(&cfg); err != nil {\n\t\treturn err\n\t}\n\n\t*c = Config(cfg)\n\treturn nil\n}", "title": "" } ]
6bc6e0d07beb40df8c84dc64eaba07b8
SetPeerSwitchDbId gets a reference to the given int64 and assigns it to the PeerSwitchDbId field.
[ { "docid": "f41cadca9f9f8e6dfcb0d2a26101e0be", "score": "0.7199763", "text": "func (o *NiatelemetryVpcDetails) SetPeerSwitchDbId(v int64) {\n\to.PeerSwitchDbId = &v\n}", "title": "" } ]
[ { "docid": "20281499681b99c9b3db112474c360d0", "score": "0.709194", "text": "func (o *NiatelemetryVpcDetails) GetPeerSwitchDbId() int64 {\n\tif o == nil || o.PeerSwitchDbId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.PeerSwitchDbId\n}", "title": "" }, { "docid": "7cb87bc62ca09637698fed9f4475a786", "score": "0.69398946", "text": "func (o *NiatelemetryVpcDetails) GetSwitchDbId() int64 {\n\tif o == nil || o.SwitchDbId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.SwitchDbId\n}", "title": "" }, { "docid": "074f8e94bf13d0965370453c00ed0075", "score": "0.6794257", "text": "func (o *NiatelemetryVpcDetails) SetSwitchDbId(v int64) {\n\to.SwitchDbId = &v\n}", "title": "" }, { "docid": "44acb56b4ea689b6929c7c2609590025", "score": "0.5174552", "text": "func (o *NiatelemetryVpcDetails) HasSwitchDbId() bool {\n\tif o != nil && o.SwitchDbId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a591ff0515207adc664c41e1ac57ac66", "score": "0.5169649", "text": "func (o *NiatelemetryVpcDetails) HasPeerSwitchDbId() bool {\n\tif o != nil && o.PeerSwitchDbId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "88e8ecb7bc308a07142c3ef9782c5b1b", "score": "0.50752866", "text": "func (m *AuthenticationContext) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7108ca3b45cb5ed82df5506ea75d3d6e", "score": "0.50592244", "text": "func (o *NetworkElementSummaryAllOf) SetSwitchId(v string) {\n\to.SwitchId = &v\n}", "title": "" }, { "docid": "d58c211fa145b646f30ad9dff235e2d6", "score": "0.50297266", "text": "func (m *SmsLogRow) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8a22dd005ed761473ea1c564c4c0b442", "score": "0.50152946", "text": "func (m *TeamworkTag) SetTeamId(value *string)() {\n err := m.GetBackingStore().Set(\"teamId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "006ad57dcbde656ddc9585bb4fbac330", "score": "0.49490464", "text": "func (m *DiscoveredSensitiveType) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4000f211ccfc058bda1fc6ba92f1ddb8", "score": "0.49410748", "text": "func (o *NiatelemetryVpcDetails) GetPeerSwitchDbIdOk() (*int64, bool) {\n\tif o == nil || o.PeerSwitchDbId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PeerSwitchDbId, true\n}", "title": "" }, { "docid": "97bb2ab0ba939507a139ae7c7c66731d", "score": "0.48867065", "text": "func (md *ManagementNode) SetToDb(ctx context.Context,\n\tsubj interface{}, id string) error {\n\tb, err := json.Marshal(subj)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tc, cancel := context.WithTimeout(ctx,\n\t\tmd.cfg.EtcdDialTimeout)\n\t_, err = md.etcd.Put(c, id, string(b))\n\tcancel()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4cde2d740611ec387d32887b1c3bc408", "score": "0.48760548", "text": "func (m *AgedAccountsPayable) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1e557eb617b6784bcf7ed824bad5ea3e", "score": "0.481296", "text": "func (m *ChatMessageAttachment) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "36dc1819d44b94c4b4bff11a0b8c9e09", "score": "0.47409552", "text": "func (m *ChannelIdentity) SetTeamId(value *string)() {\n m.teamId = value\n}", "title": "" }, { "docid": "5dd472a6728d8af7225e3cadeeb3574a", "score": "0.47194016", "text": "func (o *NiatelemetryVpcDetails) GetSwitchDbIdOk() (*int64, bool) {\n\tif o == nil || o.SwitchDbId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SwitchDbId, true\n}", "title": "" }, { "docid": "01ae67c3a819f9e66f66ad333b633eb5", "score": "0.4700192", "text": "func (tcdb *Teocdb) SetID(key string, value []byte) (err error) {\n\tnextID, err := strconv.Atoi(string(value))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn tcdb.session.Query(`UPDATE ids SET next_id = ? WHERE id_name = ?`,\n\t\tnextID, key).Exec()\n}", "title": "" }, { "docid": "f64e702f377d6803383adb31f68da035", "score": "0.469624", "text": "func FlipSwitch(switchDB *sql.DB) error {\n\tcurrentSwitch, err := getSwitch(switchDB)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar newSwitch int\n\tif currentSwitch == 1 {\n\t\tnewSwitch = 2\n\t} else {\n\t\tnewSwitch = 1\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"UPDATE %s SET %s = %d WHERE %s = %d\",\n\t\tconfig.SwitchDBTable,\n\t\tconfig.SwitchDBCol,\n\t\tnewSwitch,\n\t\tconfig.SwitchDBCol,\n\t\tcurrentSwitch,\n\t)\n\t_, err = switchDB.Exec(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aaf3e221e24a3ad40a1eb8831310705c", "score": "0.46226788", "text": "func (o GatewayOutput) VswitchId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Gateway) pulumi.StringPtrOutput { return v.VswitchId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8a64a6d159c020a983d675f6f9c4f36b", "score": "0.46172133", "text": "func (m *PortalNotification) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9cd22dfb7cbbed398238e63b29e4e33b", "score": "0.46062452", "text": "func (m *SmsLogRow) SetSmsId(value *string)() {\n err := m.GetBackingStore().Set(\"smsId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f2b96c9f8be73d722cb2bc4dcf92dfd1", "score": "0.45821425", "text": "func (o *NetworkElementSummaryAllOf) GetSwitchId() string {\n\tif o == nil || o.SwitchId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SwitchId\n}", "title": "" }, { "docid": "f3bf67421d63d3457a4d608d536c1544", "score": "0.45676768", "text": "func (m *DomainDnsSrvRecord) SetWeight(value *int32)() {\n err := m.GetBackingStore().Set(\"weight\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "486ff7791f326d4e9ba52d5ff8b000b0", "score": "0.45613313", "text": "func (o GetLoadBalancersBalancerZoneMappingOutput) VswitchId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLoadBalancersBalancerZoneMapping) string { return v.VswitchId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "26086ed15fb7ec7cb77e4e4dbe58e699", "score": "0.45602506", "text": "func (d *DriveDB) setLastChangeId(id int64) {\n\td.Lock()\n\tdefer d.Unlock()\n\td.cpt.LastChangeID = id\n}", "title": "" }, { "docid": "a36c06783494cb1457b09a3720bb7eb4", "score": "0.45313585", "text": "func (ci *ConnectionInfo) SetID(id string) (bool, uint64) {\n\tif id == \"\" {\n\t\tpanic(\"empty id not allowed\")\n\t}\n\tci.Lock()\n\tif ci.id != \"\" {\n\t\tci.Unlock()\n\t\tpanic(\"SetID called twice\")\n\t}\n\tci.id = id\n\tci.Unlock()\n\n\treturn ci.serveconn.server.bindID(ci.serveconn, id)\n}", "title": "" }, { "docid": "d22a1103d53da7524bd0a87a45d16828", "score": "0.4523308", "text": "func SetBlogVersionsViaBlogId(iBlogId int64, blog_versions *BlogVersions) (int64, error) {\n\tblog_versions.BlogId = iBlogId\n\treturn Engine.Insert(blog_versions)\n}", "title": "" }, { "docid": "2e1a6a6332f03a40a1c5564844aee27e", "score": "0.45130256", "text": "func (m *ParentLabelDetails) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6503461b6041c053dfcbdb3f4c9df01f", "score": "0.44962123", "text": "func (m *SharepointIds) SetSiteId(value *string)() {\n err := m.GetBackingStore().Set(\"siteId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7785a681658dad4656eec40c32a93019", "score": "0.449614", "text": "func (o GetVpcEndpointLinkedVpcsVpcEndpointLinkedVpcOutput) VswitchId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetVpcEndpointLinkedVpcsVpcEndpointLinkedVpc) string { return v.VswitchId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "39759b2e3188bbfa615fe2f1c6f33d4c", "score": "0.44595954", "text": "func (o LoadBalancerZoneMappingOutput) VswitchId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LoadBalancerZoneMapping) string { return v.VswitchId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2fba6f34aca92cdad669cb8b1199c5b1", "score": "0.44554755", "text": "func (m *IosStoreAppAssignmentSettings) SetVpnConfigurationId(value *string)() {\n err := m.GetBackingStore().Set(\"vpnConfigurationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ec33b3ca8cc7ae33c1bb26ca2d787899", "score": "0.4433481", "text": "func (m *PortalNotification) SetAlertRecordId(value *string)() {\n err := m.GetBackingStore().Set(\"alertRecordId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f417dfefab7cc52e8355de9e806faf27", "score": "0.44088185", "text": "func (m *SharepointIds) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "d66abfa6cb74e39113c55c12d2469e84", "score": "0.43988475", "text": "func SetHookId(etid int64, hook_id int64) error {\n\tvar dummy string\n\tif err := db.QueryRow(\"UPDATE event_tasks SET hook_id=$1 WHERE id=$2 \"+\n\t\t\"RETURNING id\", hook_id, etid).Scan(&dummy); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4d51ab75def876026459fe09cec0463", "score": "0.43956408", "text": "func (m *ProgramControl) SetControlId(value *string)() {\n err := m.GetBackingStore().Set(\"controlId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c74ab31f8e2e39d5f310ff23ad2e74a8", "score": "0.43856066", "text": "func (m *ConnectorStatusDetails) SetConnectorInstanceId(value *string)() {\n err := m.GetBackingStore().Set(\"connectorInstanceId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fe88aa217f5f6536211e4c222a04e4cd", "score": "0.43682846", "text": "func SaveSwitchPort(switchID string, data []string) error {\n\treturn SaveToDB(db.TableSwitchPorts, switchID, data)\n}", "title": "" }, { "docid": "84f5e99b5a6a51f302e485ed72c84c98", "score": "0.4358914", "text": "func (m *Setting) SetSettingId(value *string)() {\n err := m.GetBackingStore().Set(\"settingId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e63e3f6009b1aff66fb152760f3e70b1", "score": "0.43420961", "text": "func (m *OnlineMeetingInfo) SetConferenceId(value *string)() {\n err := m.GetBackingStore().Set(\"conferenceId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8d81e1d2f87d1a443a56be0f34e360af", "score": "0.43345785", "text": "func SetWatchdogViaWid(iWid int64, watchdog *Watchdog) (int64, error) {\n\twatchdog.Wid = iWid\n\treturn Engine.Insert(watchdog)\n}", "title": "" }, { "docid": "9c5fdb359052e5de1d3bacf28c1adf46", "score": "0.43245164", "text": "func (m *FileAttachment) SetContentId(value *string)() {\n err := m.GetBackingStore().Set(\"contentId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6a5cc6803f77a3e4e44d6fe8ef221993", "score": "0.43189046", "text": "func SetBlogVersionsViaDbVersion(iDbVersion string, blog_versions *BlogVersions) (int64, error) {\n\tblog_versions.DbVersion = iDbVersion\n\treturn Engine.Insert(blog_versions)\n}", "title": "" }, { "docid": "f7f956421222b14d1c67681a2fa767e6", "score": "0.4311709", "text": "func (m *ChannelIdentity) SetChannelId(value *string)() {\n m.channelId = value\n}", "title": "" }, { "docid": "a46e9a7178727b4a0b8152eda5432c2c", "score": "0.43049893", "text": "func (t *Thread) SetDbms(dbms IDbms) {\n\tt.dbms = dbms\n}", "title": "" }, { "docid": "94988dfe0a832b9ce23b50c7ccec4d5f", "score": "0.42947412", "text": "func (o EcsLaunchTemplateOutput) VswitchId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EcsLaunchTemplate) pulumi.StringPtrOutput { return v.VswitchId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2726b220ce7f01707c9a90c3d4e5488a", "score": "0.42852086", "text": "func SetManagementDB(db *gorp.DbMap) {\n\tmgmtDb = db\n}", "title": "" }, { "docid": "a0eaf97297c9e8b2a3028f52a0bd66bf", "score": "0.42802122", "text": "func (lbu *LoadBalanceUpdate) SetServiceID(i int64) *LoadBalanceUpdate {\n\tlbu.mutation.ResetServiceID()\n\tlbu.mutation.SetServiceID(i)\n\treturn lbu\n}", "title": "" }, { "docid": "d47d418ba7a618119cd60b77897abb1e", "score": "0.42696595", "text": "func (o InstanceOutput) VswitchId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.VswitchId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "77e5b3cd86dfa2a4dde3528825d50723", "score": "0.42694244", "text": "func (m *PaymentTerm) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f55af044eea45e416360064494607461", "score": "0.42643553", "text": "func (plgf PLGridFacade) SetId(smRecord *SMRecord, id string) {\n\tsmRecord.JobID = id\n}", "title": "" }, { "docid": "8504df7c4f77da528cdde5e1366961ec", "score": "0.4262471", "text": "func (m *DomainDnsSrvRecord) SetProtocol(value *string)() {\n err := m.GetBackingStore().Set(\"protocol\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "623fce10fa867bae1bc99585fd865dc9", "score": "0.4258073", "text": "func (a *SqlAgent) SetDBMapper(mapper *reflectx.Mapper) {\n\ta.db.Mapper = mapper\n}", "title": "" }, { "docid": "6e4eeca60f2c0908dfb876924a3adc47", "score": "0.42268327", "text": "func getSwitch(dpid net.HardwareAddr) *OFSwitch {\n\tsw, _ := switchDb.Get(dpid.String())\n\tif sw == nil {\n\t\treturn nil\n\t}\n\treturn sw.(*OFSwitch)\n}", "title": "" }, { "docid": "4ae321c4d76f36b3baa27d1bd7617b8a", "score": "0.42257908", "text": "func (m *AzureCommunicationServicesUserConversationMember) SetAzureCommunicationServicesId(value *string)() {\n err := m.GetBackingStore().Set(\"azureCommunicationServicesId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e63649375c86e900d128b951c20bb743", "score": "0.41950485", "text": "func SetStateDb() {\n\tgenCode(flagSetStateDb)\n}", "title": "" }, { "docid": "6ce5f4ca135d623446d1a2df7d1de85c", "score": "0.41820484", "text": "func (lbuo *LoadBalanceUpdateOne) SetServiceID(i int64) *LoadBalanceUpdateOne {\n\tlbuo.mutation.ResetServiceID()\n\tlbuo.mutation.SetServiceID(i)\n\treturn lbuo\n}", "title": "" }, { "docid": "14f0dd140c99f2e8c0c4dfc87cfbc868", "score": "0.41803595", "text": "func (c *PostgresConnect) SwitchDatabase(dbName string) error {\n\tif c.DB != nil {\n\t\tif err := c.DB.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdns := c.baseDNS + \" dbname=\" + dbName\n\tdb, err := sql.Open(\"postgres\", dns)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.DB = db\n\treturn nil\n}", "title": "" }, { "docid": "fab6737ddfd72dbe4e61aea6858ba020", "score": "0.41596344", "text": "func getSwitch(db *sql.DB) (int, error) {\n\tvar result int\n\tquery := fmt.Sprintf(\"SELECT %s FROM %s LIMIT 1\", config.SwitchDBCol, config.SwitchDBTable)\n\tif err := db.QueryRow(query).Scan(&result); err != nil {\n\t\treturn -1, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "978a6cf5446955773846e0044b172b2b", "score": "0.41553992", "text": "func (sc *SessionCreate) SetPeerID(s string) *SessionCreate {\n\tsc.mutation.SetPeerID(s)\n\treturn sc\n}", "title": "" }, { "docid": "7f5ead0d45f01cd6b862bdc338690201", "score": "0.41552615", "text": "func (s *SimpleBlockFactory) SetStateDB(sdb *state.ChainStateDB) {\n}", "title": "" }, { "docid": "3c10669d3829ae434237530db09ae30a", "score": "0.41526568", "text": "func (m *ConnectorStatusDetails) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "d9fb5e764ff4a616934f2e60a6fab32e", "score": "0.41483623", "text": "func (p *LegoPort) setID(id int) { *p = LegoPort{id: id} }", "title": "" }, { "docid": "38f331ba3467e9570722faacc4316d61", "score": "0.41427702", "text": "func (t *Target) setBreakpointWithID(id int, addr uint64) (*Breakpoint, error) {\n\tbpmap := t.Breakpoints()\n\tbp, err := t.SetBreakpoint(addr, UserBreakpoint, nil)\n\tif err == nil {\n\t\tbp.LogicalID = id\n\t\tbpmap.breakpointIDCounter--\n\t}\n\treturn bp, err\n}", "title": "" }, { "docid": "e14c3f354be8e600932a06fc04c542be", "score": "0.41344392", "text": "func (storage *Storage) SetDbPath(dbPath string) {\n}", "title": "" }, { "docid": "575bb828762c10bea1329e30715cb807", "score": "0.4125399", "text": "func (sh *SystemsHandler) SetDbx(db *dbx.Dbx) {\n\tsh.db = db\n}", "title": "" }, { "docid": "e3aa766d121c995aee67f2b378e7af19", "score": "0.41235137", "text": "func (profile *Profile) FromDb(id interface{}) error {\n\tidInt := id.(*int64)\n\tprofile.Id = *idInt\n\treturn nil\n}", "title": "" }, { "docid": "16a960b41db1908449086a4f8a273056", "score": "0.4113853", "text": "func (r *RealEnv) SetDBHandle(h *db.DBHandle) {\n\tr.dbHandle = h\n}", "title": "" }, { "docid": "3a2276be897d82c26cdf85841215b46a", "score": "0.41083992", "text": "func (m *ImportedWindowsAutopilotDeviceIdentityState) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "c0baffe86f3242ac66c34f9824f0fc03", "score": "0.40995106", "text": "func (m *DomainDnsSrvRecord) SetPort(value *int32)() {\n err := m.GetBackingStore().Set(\"port\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "50d2fe27fd8707672bceb02a92712a10", "score": "0.40808913", "text": "func (m *SolutionsRoot) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "3523a56fe9acb07a4288c351c4b3ad83", "score": "0.40785217", "text": "func SetDBOne(host, database, user, pass string) {\n\tdbInfo = &model.DBInfo{\n\t\tHosts: []*model.DBHost{\n\t\t\t&model.DBHost{\n\t\t\t\tAddress: host,\n\t\t\t\tDatabases: []*model.DBDatabase{&model.DBDatabase{Name: database}},\n\t\t\t\tUser: user,\n\t\t\t\tPassword: pass,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "02dfc2fadc9117d59276a2a793af1420", "score": "0.4078074", "text": "func Mk_switch( id *string ) ( s *Switch ) {\n\ttokens := strings.SplitN( *id, \"@\", 2 )\t\t\t// in q-lite world we get host@interface and we need only host portion\n\tid = &tokens[0]\n\n\ts = &Switch {\n\t\tid: id,\n\t\tlidx: 0,\n\t}\n\n\tif id == nil {\n\t\tdup_str := \"no_id_given\"\n\t\tid = &dup_str\n\t}\n\n\ts.links = make( []*Link, 32 )\n\ts.hosts = make( map[string]bool, 64 )\n\ts.hport = make( map[string]int, 64 )\n\ts.hvmid = make( map[string]*string, 64 )\n\treturn\n}", "title": "" }, { "docid": "ba593ed346d4e9eac2dcabc200f3c0fe", "score": "0.40724307", "text": "func (m *SharepointIds) SetWebId(value *string)() {\n err := m.GetBackingStore().Set(\"webId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4ee337dec18a5a68405bc3921a85e5c1", "score": "0.40644076", "text": "func (mtr *Mxmx0intmacMetrics) SetLane2Dbe(val metrics.Counter) error {\n\tmtr.metrics.SetCounter(val, mtr.getOffset(\"Lane2Dbe\"))\n\treturn nil\n}", "title": "" }, { "docid": "8b0d840100442a7d35d39832ee282d3a", "score": "0.4062301", "text": "func (ac *CredentialAccessor) SetDB(db db.FabricCADB) {\n\tac.db = db\n}", "title": "" }, { "docid": "1023d00b6cd7f5ddd15c64903ab49008", "score": "0.4061522", "text": "func (testEntityRelated_EntityInfo) SetId(object interface{}, id uint64) {\n\tobject.(*TestEntityRelated).Id = id\n}", "title": "" }, { "docid": "3b2423ceb4f6847d4e98ddb376b5665a", "score": "0.40518567", "text": "func (m *DeviceManagementSettingDependency) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "f7a1032b88e533b9f105d3103a068b59", "score": "0.40492457", "text": "func (p *MockPeer) SetChaincodeID(ccID string) {\r\n\tp.ChaincodeID = ccID\r\n}", "title": "" }, { "docid": "cf18a7b1ba0f36e87ba2620d6de08b04", "score": "0.4043977", "text": "func (m *ServicePrincipalRiskDetection) SetServicePrincipalId(value *string)() {\n err := m.GetBackingStore().Set(\"servicePrincipalId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c73aaa4221c0c2aac2b1dadb022fc3e7", "score": "0.4039889", "text": "func (m *TeamworkActivePeripherals) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "9a1c07efbbc3cc29ff45a38e1f256f25", "score": "0.40389687", "text": "func (m *DeliveryOptimizationBandwidthBusinessHoursLimit) SetBandwidthEndBusinessHours(value *int32)() {\n err := m.GetBackingStore().Set(\"bandwidthEndBusinessHours\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "dd60afbbc8cb9e9064b159d167758920", "score": "0.4017176", "text": "func SwapInt64(addr *int64, new int64) (old int64)", "title": "" }, { "docid": "6e489d58472e1b77ce7b04297afedd94", "score": "0.40124816", "text": "func (m *DeviceManagementSettings) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "73939644062f9d70684345b6f19d6736", "score": "0.4008669", "text": "func SetDB(db *config.DatabaseCfg) {\n\tdbc = db\n}", "title": "" }, { "docid": "5de68e4b4aa783c302b061206f9cb498", "score": "0.3999526", "text": "func (o *GetLogicalSwitchParams) SetLswitchID(lswitchID string) {\n\to.LswitchID = lswitchID\n}", "title": "" }, { "docid": "16ac28145a108943fae2c559e801d872", "score": "0.3992589", "text": "func SetDBInfo(ctx context.Context, info *model.DBInfo) {\n\tdbInfo = info\n}", "title": "" }, { "docid": "65df3a77679ff385c291f280dcb58cfb", "score": "0.39908764", "text": "func (m *Manager) SetCLIMessageID(channelID, adID int64, cliMessageID string) error {\n\tq := fmt.Sprintf(\"UPDATE %s SET cli_message_id = ? WHERE channel_id=? AND ad_id = ?\", ChannelAdTableFull)\n\t_, err := m.GetDbMap().Exec(q, cliMessageID, channelID, adID)\n\treturn err\n}", "title": "" }, { "docid": "7a24d1d6a840cead7d3b2a07e9ba81cf", "score": "0.39813945", "text": "func (m *ServiceUpdateMessageViewpoint) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "c5cbe2741e5871a78c465c2bb7944bba", "score": "0.3978261", "text": "func (m *UserExperienceAnalyticsAnomalyDevice) SetAnomalyId(value *string)() {\n err := m.GetBackingStore().Set(\"anomalyId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "46a8c766d8171d78df4ceb440f809770", "score": "0.3977126", "text": "func (s *GetCredentialsOutput) SetDbPassword(v string) *GetCredentialsOutput {\n\ts.DbPassword = &v\n\treturn s\n}", "title": "" }, { "docid": "a5bf8c182071f7b1be36453658d9add1", "score": "0.3966633", "text": "func (m *DeliveryOptimizationBandwidthBusinessHoursLimit) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "8b0f42402b31eb57a04efb52bf8ad204", "score": "0.39644948", "text": "func (b *MessagesPinBuilder) PeerID(v int) *MessagesPinBuilder {\n\tb.Params[\"peer_id\"] = v\n\treturn b\n}", "title": "" }, { "docid": "67ed0cf66c82c8c9920e2787c564cce6", "score": "0.39613035", "text": "func (s *Manager) SetDatabaseConnection(ctx context.Context, project, dbAlias string, v config.CrudStub) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update database config\n\tcoll, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\tprojectConfig.Modules.Crud[dbAlias] = &config.CrudStub{Conn: v.Conn, Enabled: v.Enabled, Collections: map[string]*config.TableRule{}, Type: v.Type}\n\t} else {\n\t\tcoll.Conn = v.Conn\n\t\tcoll.Enabled = v.Enabled\n\t\tcoll.Type = v.Type\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "title": "" }, { "docid": "e63cc93b6e7f0e77356f550ca5f24dbd", "score": "0.3955735", "text": "func (s *PvlSourceImpl) dbSet(ctx context.Context, hash libkb.PvlKitHash, pvl libkb.PvlKitString) {\n\tdb := s.G().LocalDb\n\tif db == nil {\n\t\ts.G().Log.CErrorf(ctx, \"storing pvl: no db\")\n\t\treturn\n\t}\n\tent := entry{\n\t\tDBVersion: dbVersion,\n\t\tHash: hash,\n\t\tPvlKit: pvl,\n\t}\n\terr := db.PutObj(dbKey, nil, ent)\n\tif err != nil {\n\t\ts.G().Log.CErrorf(ctx, \"storing pvl: %s\", err)\n\t}\n}", "title": "" }, { "docid": "6689174673b869f2a3d5b86d51a19f84", "score": "0.395005", "text": "func (u SysDBUpdater) SetID(ID uint64) SysDBUpdater {\n\tu.fields[string(SysDBDBSchema.ID)] = ID\n\treturn u\n}", "title": "" }, { "docid": "098330a822cb2bb22ffe8f071a56c2b9", "score": "0.39497903", "text": "func (mtr *Mxmx1intmacMetrics) SetLane2Dbe(val metrics.Counter) error {\n\tmtr.metrics.SetCounter(val, mtr.getOffset(\"Lane2Dbe\"))\n\treturn nil\n}", "title": "" }, { "docid": "475a51d9054ab9b76254de260da464da", "score": "0.3949697", "text": "func (m *BgpConfiguration) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "e59be1f16adaa1273156f29d3cc68d8d", "score": "0.39477167", "text": "func (m *ParentLabelDetails) SetBackingStore(value ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore)() {\n m.backingStore = value\n}", "title": "" }, { "docid": "de525e766067b6723a0e83844c64c6fa", "score": "0.39444694", "text": "func (track *Track) FromDb(id interface{}) error {\n\tidString := id.(*string)\n\ttrack.Id = *idString\n\treturn nil\n}", "title": "" } ]
920d9f98a75c4fd4a1485f434acf419d
Convert an unstructured.Unstructured into a typed PlanningPhaseList
[ { "docid": "69c5d443b52fcbcfb0655b0c4f96bce6", "score": "0.77085435", "text": "func ToPlanningPhaseList(u *unstructured.Unstructured) *PlanningPhaseList {\n\tvar obj *PlanningPhaseList\n\terr := runtime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), &obj)\n\tif err != nil {\n\t\treturn &PlanningPhaseList{}\n\t}\n\treturn obj\n}", "title": "" } ]
[ { "docid": "9b4a1fd493216eb26742440df2be7f60", "score": "0.6996392", "text": "func (obj *PlanningPhaseList) FromPlanningPhaseList() *unstructured.Unstructured {\n\tu := NewPlanningPhaseListVersionKind(\"\", \"\")\n\ttmp, err := runtime.DefaultUnstructuredConverter.ToUnstructured(*obj)\n\tif err != nil {\n\t\treturn u\n\t}\n\tu.SetUnstructuredContent(tmp)\n\treturn u\n}", "title": "" }, { "docid": "6a23eb02a20208d2c7302f7fa84fb9e1", "score": "0.65500194", "text": "func ToPlanningPhase(u *unstructured.Unstructured) *PlanningPhase {\n\tvar obj *PlanningPhase\n\terr := runtime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), &obj)\n\tif err != nil {\n\t\treturn &PlanningPhase{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: u.GetName(),\n\t\t\t\tNamespace: u.GetNamespace(),\n\t\t\t},\n\t\t}\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "f341f12d0b992a9a235221d93e533164", "score": "0.6240607", "text": "func (obj *PlanningPhase) FromPlanningPhase() *unstructured.Unstructured {\n\tu := NewPlanningPhaseVersionKind(obj.ObjectMeta.Namespace, obj.ObjectMeta.Name)\n\ttmp, err := runtime.DefaultUnstructuredConverter.ToUnstructured(*obj)\n\tif err != nil {\n\t\treturn u\n\t}\n\tu.SetUnstructuredContent(tmp)\n\treturn u\n}", "title": "" }, { "docid": "d80acb03e1f3a6624825d1bc7745c738", "score": "0.55477333", "text": "func NewPlanningPhaseListVersionKind(namespace string, name string) *unstructured.Unstructured {\n\tu := &unstructured.Unstructured{}\n\tu.SetAPIVersion(\"openstacklcm.airshipit.org/v1alpha1\")\n\tu.SetKind(\"PlanningPhaseList\")\n\tu.SetNamespace(namespace)\n\tu.SetName(name)\n\treturn u\n}", "title": "" }, { "docid": "2bf9777f2897d4aee919e20b8187bfbb", "score": "0.48359525", "text": "func (helper *Helper) ListPlans() ([]*v1alpha1.PhasePlan, error) {\n\tplan := &v1alpha1.PhasePlan{}\n\tselector, err := document.NewSelector().ByObject(plan, v1alpha1.Scheme)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdocs, err := helper.phaseConfigBundle.Select(selector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tplans := make([]*v1alpha1.PhasePlan, len(docs))\n\tfor i, doc := range docs {\n\t\tp := &v1alpha1.PhasePlan{}\n\t\tif err = doc.ToAPIObject(p, v1alpha1.Scheme); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tplans[i] = p\n\t}\n\treturn plans, nil\n}", "title": "" }, { "docid": "6683cfe7489de2b1ed9b61d1c1a222c9", "score": "0.4701079", "text": "func listToVector(name string, args []interface{}) (interface{}, LispError) {\n\tif pair, ok := args[0].(Pair); ok {\n\t\tresult := make([]interface{}, 0)\n\t\titer := pair.Iterator()\n\t\tfor iter.HasNext() {\n\t\t\tresult = append(result, iter.Next())\n\t\t}\n\t\treturn NewVector(result), nil\n\t}\n\treturn nil, NewLispErrorf(EARGUMENT, \"%s expects a list, not %v\", name, args[0])\n}", "title": "" }, { "docid": "1d852f10ff47879c858f8a7e0f91f38a", "score": "0.4646014", "text": "func (helper *Helper) ListPhases(o ifc.ListPhaseOptions) ([]*v1alpha1.Phase, error) {\n\tphase := &v1alpha1.Phase{}\n\tselector, err := document.NewSelector().ByObject(phase, v1alpha1.Scheme)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbundle, err := helper.phaseConfigBundle.SelectBundle(selector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif o.ClusterName != \"\" {\n\t\tif bundle, err = bundle.SelectByFieldValue(\"metadata.clusterName\", func(v interface{}) bool {\n\t\t\tif field, ok := v.(string); ok {\n\t\t\t\treturn field == o.ClusterName\n\t\t\t}\n\t\t\treturn false\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar docs []document.Document\n\tif o.PlanID.Name != \"\" {\n\t\tif docs, err = helper.getDocsByPhasePlan(o.PlanID, bundle); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if docs, err = bundle.GetAllDocuments(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tphases := make([]*v1alpha1.Phase, 0)\n\tfor _, doc := range docs {\n\t\tp := v1alpha1.DefaultPhase()\n\t\tif err = doc.ToAPIObject(p, v1alpha1.Scheme); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tphases = append(phases, p)\n\t}\n\treturn phases, nil\n}", "title": "" }, { "docid": "4588f1a61789e4122416c3cd0a8479ce", "score": "0.4644503", "text": "func render(result []storage.OperationPhase, phases []*Phase) {\n\tfor i, phase := range phases {\n\t\tresult[i] = phase.p\n\t\tif len(phase.phases) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tresult[i].Phases = make([]storage.OperationPhase, len(phase.phases))\n\t\trender(result[i].Phases, phase.phases)\n\t}\n}", "title": "" }, { "docid": "eee8c8c6365f6ac094d295e2f8b5205b", "score": "0.45967412", "text": "func ToOslcList(u *unstructured.Unstructured) *OslcList {\n\tvar obj *OslcList\n\terr := runtime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), &obj)\n\tif err != nil {\n\t\treturn &OslcList{}\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "529fcf8b88ed0675d18cbfa26e4c2a95", "score": "0.45860767", "text": "func ToUnstructured(wf *wfv1.Workflow) (*unstructured.Unstructured, error) {\n\tobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(wf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tun := &unstructured.Unstructured{Object: obj}\n\t// we need to add these values so that the `EventRecorder` does not error\n\tun.SetKind(\"Workflow\")\n\tun.SetAPIVersion(\"argoproj.io/v1alpha1\")\n\treturn un, nil\n}", "title": "" }, { "docid": "eef66d4c39b6233a6c93eabc46312fd9", "score": "0.44949755", "text": "func AsListOfUnstructured(lockedResources []LockedResource) []unstructured.Unstructured {\n\tunstructuredList := []unstructured.Unstructured{}\n\tfor _, lockedResource := range lockedResources {\n\t\tunstructuredList = append(unstructuredList, lockedResource.Unstructured)\n\t}\n\treturn unstructuredList\n}", "title": "" }, { "docid": "2f0f9435600c2c8d6b512b32bcbccbd7", "score": "0.44905946", "text": "func toUnstructured(obj interface{}) (*unstructured.Unstructured, error) {\n\tb, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu := &unstructured.Unstructured{}\n\tif err := json.Unmarshal(b, u); err != nil {\n\t\treturn nil, err\n\t}\n\treturn u, nil\n}", "title": "" }, { "docid": "f37b914df9abc966ba0e5a44fbe9951b", "score": "0.4476581", "text": "func NewPlanningPhaseVersionKind(namespace string, name string) *unstructured.Unstructured {\n\tu := &unstructured.Unstructured{}\n\tu.SetAPIVersion(\"openstacklcm.airshipit.org/v1alpha1\")\n\tu.SetKind(\"PlanningPhase\")\n\tu.SetNamespace(namespace)\n\tu.SetName(name)\n\treturn u\n}", "title": "" }, { "docid": "6a4c0d416907a53ad6a6fde37773c344", "score": "0.44150737", "text": "func listToVector(l stype) (v stvector) {\n\tlen := objListLength(l)\n\tif 0 == len {\n\t\tv = sonullvec\n\t} else {\n\t\tv = make(stvector, len, len)\n\t\tfor i:=0; i<len; i++ {\n\t\t\tv[i] = l.(stpair).car\n\t\t\tl = l.(stpair).cdr\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "174a426ec78876ff18387d0c6dbaa6fa", "score": "0.43632075", "text": "func convertTermList(l []interface{}) termsList {\n\tif len(l) == 0 {\n\t\treturn nil\n\t}\n\n\tterms := make(termsList, len(l))\n\tfor i, v := range l {\n\t\tterms[i] = Expr(v)\n\t}\n\n\treturn terms\n}", "title": "" }, { "docid": "d48fce49aa897a6a08d255abcd6d5152", "score": "0.43523264", "text": "func ToUnstructured(in runtime.Object) (*runtime.Unstructured, error) {\n\tm, err := json.Marshal(in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ret runtime.Unstructured\n\terr = json.Unmarshal(m, &ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ret, nil\n}", "title": "" }, { "docid": "513e98683dcce5783918d0df0285cba7", "score": "0.43445837", "text": "func ToList(node Node) (List, error) {\n\tif l, ok := node.(List); ok {\n\t\treturn l, nil\n\t}\n\treturn nil, errors.New(\"Not yaml.List\")\n}", "title": "" }, { "docid": "86cc0aae8dfd12d5d0352e1c7385966b", "score": "0.4339546", "text": "func (p *InstallPhase) UnmarshalJSON(b []byte) error {\n\tvar s string\n\terr := json.Unmarshal(b, &s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*p, err = InstallPhaseString(s)\n\treturn err\n}", "title": "" }, { "docid": "fe11169010d48aff911f6b488f89f52b", "score": "0.4338381", "text": "func toPlist(data interface{}) (string, error) {\n\tbuf := &bytes.Buffer{}\n\tencoder := plist.NewEncoder(buf)\n\terr := encoder.Encode(data)\n\treturn buf.String(), err\n}", "title": "" }, { "docid": "233c75da15aea5f751e926918c90bb12", "score": "0.43093157", "text": "func ListOf(p interface{}, c Converter) interface {\n\tpref.List\n\tUnwrapper\n} {\n\t// TODO: Validate that p is a *[]T?\n\trv := reflect.ValueOf(p)\n\treturn &listReflect{rv, c}\n}", "title": "" }, { "docid": "111b3814d2439951eecabab38a257b9a", "score": "0.43070245", "text": "func ToUnstructured(obj runtime.Object, uo ...UnstructuredOption) *unstructured.Unstructured {\n\tu := &unstructured.Unstructured{}\n\tif err := scheme.Scheme.Convert(obj, u, nil); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, opt := range uo {\n\t\topt(u)\n\t}\n\n\treturn u\n}", "title": "" }, { "docid": "34cfd5b773fd6f75d457c30083e36072", "score": "0.43014452", "text": "func (p *parser) parseListKind() {\n}", "title": "" }, { "docid": "70eec9ba40c3df0b485d30fdd13e1a67", "score": "0.42979965", "text": "func unmarshalTimersList(blob []byte) ([]*internal.Timer, error) {\n\tif len(blob) == 0 {\n\t\treturn nil, nil\n\t}\n\tlist := internal.TimerList{}\n\tif err := proto.Unmarshal(blob, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn list.Timers, nil\n}", "title": "" }, { "docid": "65dc14510b0f194839da69e80ac7a691", "score": "0.42516664", "text": "func ConvertToUnstructured(data []byte) (*unstructured.Unstructured, error) {\n\tresource := &unstructured.Unstructured{}\n\terr := resource.UnmarshalJSON(data)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"failed to unmarshall resource: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn resource, nil\n}", "title": "" }, { "docid": "df23a80735257508bcdc942043d15e7d", "score": "0.42400724", "text": "func convertList(original deleteYaml) ([]string, error) {\n\n\tif original.Delete == nil {\n\t\treturn nil, errors.New(\"invalid YAML structure\")\n\t}\n\n\tresult := make([]string, 0)\n\tlist, _ := original.Delete.([]interface{})\n\n\tfor _, x := range list {\n\t\ty := x.(string)\n\t\tresult = append(result, y)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "57bb1700e12fdb5dd32e581391cd9b0c", "score": "0.42182136", "text": "func unmarshalFinishedInvs(raw []byte) ([]*internal.FinishedInvocation, error) {\n\tif len(raw) == 0 {\n\t\treturn nil, nil\n\t}\n\tinvs := internal.FinishedInvocationList{}\n\tif err := proto.Unmarshal(raw, &invs); err != nil {\n\t\treturn nil, err\n\t}\n\treturn invs.Invocations, nil\n}", "title": "" }, { "docid": "30b92d559fe27569968874677db174b4", "score": "0.42045435", "text": "func (dst *AzureManagedControlPlaneList) ConvertFrom(srcRaw conversion.Hub) error {\n\tsrc := srcRaw.(*infrav1.AzureManagedControlPlaneList)\n\treturn Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList(src, dst, nil)\n}", "title": "" }, { "docid": "7e472d2b3f3074e26491caf584280b45", "score": "0.4185342", "text": "func (cfg *Config) genSimpleListSpec(t *xsd.SimpleType) ([]spec, error) {\n\tcfg.debugf(\"generating Go source for simple list %q\", xsd.XMLName(t).Local)\n\texpr, err := cfg.expr(t.Base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\texpr = &ast.ArrayType{Elt: expr}\n\ts := spec{\n\t\tname: cfg.public(t.Name),\n\t\texpr: expr,\n\t\txsdType: t,\n\t}\n\tmarshalFn := gen.Func(\"MarshalText\").\n\t\tReceiver(\"x *\"+s.name).\n\t\tReturns(\"[]byte\", \"error\")\n\tunmarshalFn := gen.Func(\"UnmarshalText\").\n\t\tReceiver(\"x *\" + s.name).\n\t\tArgs(\"text []byte\").\n\t\tReturns(\"error\")\n\n\tbase := t.Base\n\tfor xsd.Base(base) != nil {\n\t\tbase = xsd.Base(base)\n\t}\n\n\tswitch base.(xsd.Builtin) {\n\tcase xsd.ID, xsd.NCName, xsd.NMTOKEN, xsd.Name, xsd.QName, xsd.ENTITY, xsd.AnyURI, xsd.Language, xsd.String, xsd.Token, xsd.XMLLang, xsd.XMLSpace, xsd.XMLBase, xsd.XMLId, xsd.Duration, xsd.NormalizedString:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\tresult = append(result, []byte(v))\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range bytes.Fields(text) {\n\t\t\t\t*x = append(*x, string(v))\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tcase xsd.Date, xsd.DateTime, xsd.GDay, xsd.GMonth, xsd.GMonthDay, xsd.GYear, xsd.GYearMonth, xsd.Time:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\tif b, err := v.MarshalText(); err != nil {\n\t\t\t\t\treturn result, err\n\t\t\t\t} else {\n\t\t\t\t\tresult = append(result, b)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \"))\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range bytes.Fields(text) {\n\t\t\t\tvar t %s\n\t\t\t\tif err := t.UnmarshalText(v); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t*x = append(*x, t)\n\t\t\t}\n\t\t`, builtinExpr(base.(xsd.Builtin)).(*ast.Ident).Name)\n\tcase xsd.Long:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\tresult = append(result, []byte(strconv.FormatInt(v, 10)))\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range strings.Fields(string(text)) {\n\t\t\t\tif i, err := strconv.ParseInt(v, 10, 64); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t} else {\n\t\t\t\t\t*x = append(*x, i)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tcase xsd.Decimal, xsd.Double:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\ts := strconv.FormatFloat(v, 'g', -1, 64)\n\t\t\t\tresult = append(result, []byte(s))\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range strings.Fields(string(text)) {\n\t\t\t\tif f, err := strconv.ParseFloat(v, 64); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t} else {\n\t\t\t\t\t*x = append(*x, f)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tcase xsd.Int, xsd.Integer, xsd.NegativeInteger, xsd.NonNegativeInteger, xsd.NonPositiveInteger, xsd.Short:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\tresult = append(result, []byte(strconv.Itoa(v)))\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range strings.Fields(string(text)) {\n\t\t\t\tif i, err := strconv.Atoi(v); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t} else {\n\t\t\t\t\t*x = append(*x, i)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tcase xsd.UnsignedInt, xsd.UnsignedShort:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\tresult = append(result, []byte(strconv.FormatUint(uint64(v), 10)))\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range strings.Fields(string(text)) {\n\t\t\t\tif i, err := strconv.ParseUint(v, 10, 32); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t} else {\n\t\t\t\t\t*x = append(*x, uint(i))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tcase xsd.UnsignedLong:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte, 0, len(*x))\n\t\t\tfor _, v := range *x {\n\t\t\t\tresult = append(result, []byte(strconv.FormatUInt(v, 10)))\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range strings.Fields(string(text)) {\n\t\t\t\tif i, err := strconv.ParseInt(v, 10, 64); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t} else {\n\t\t\t\t\t*x = append(*x, i)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tcase xsd.Byte, xsd.UnsignedByte:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\treturn []byte(*x), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\t*x = %s(text)\n\t\t\treturn nil\n\t\t`, s.name)\n\tcase xsd.Boolean:\n\t\tmarshalFn = marshalFn.Body(`\n\t\t\tresult := make([][]byte\n\t\t\tfor _, b := range *x {\n\t\t\t\tif b {\n\t\t\t\t\tresult = append(result, []byte(\"1\"))\n\t\t\t\t} else {\n\t\t\t\t\tresult = append(result, []byte(\"0\"))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn bytes.Join(result, []byte(\" \")), nil\n\t\t`)\n\t\tunmarshalFn = unmarshalFn.Body(`\n\t\t\tfor _, v := range bytes.Fields(text) {\n\t\t\t\tswitch string(v) {\n\t\t\t\tcase \"1\", \"true\":\n\t\t\t\t\t*x = append(*x, true)\n\t\t\t\tdefault:\n\t\t\t\t\t*x = append(*x, false)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t`)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"don't know how to marshal/unmarshal <list> of %s\", base)\n\t}\n\n\tmarshal, err := marshalFn.Decl()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"MarshalText %s: %v\", s.name, err)\n\t}\n\n\tunmarshal, err := unmarshalFn.Decl()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"UnmarshalText %s: %v\", s.name, err)\n\t}\n\n\ts.methods = append(s.methods, marshal, unmarshal)\n\treturn []spec{s}, nil\n}", "title": "" }, { "docid": "418d0c03407f9e8df43d9fb0c159994b", "score": "0.41709158", "text": "func (me TransformListType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "000c62428d02025024f03f1c0c646b60", "score": "0.41591334", "text": "func UnmarshalSubTLV(b []byte) ([]*SubTLV, error) {\n\tstlvs := make([]*SubTLV, 0)\n\tfor p := 0; p < len(b); {\n\t\tstlv := &SubTLV{}\n\t\tif p+2 > len(b) {\n\t\t\tbreak\n\t\t}\n\t\tstlv.Type = binary.BigEndian.Uint16(b[p : p+2])\n\t\tp += 2\n\t\tif p+2 > len(b) {\n\t\t\tbreak\n\t\t}\n\t\tstlv.Length = binary.BigEndian.Uint16(b[p : p+2])\n\t\tp += 2\n\t\tif p+int(stlv.Length) > len(b) {\n\t\t\tbreak\n\t\t}\n\t\tstlv.Value = make([]byte, stlv.Length)\n\t\tcopy(stlv.Value, b[p:p+int(stlv.Length)])\n\t\tp += int(stlv.Length)\n\t\tstlvs = append(stlvs, stlv)\n\t}\n\n\treturn stlvs, nil\n}", "title": "" }, { "docid": "a229ae2a2cf882abc78e0f1df6e74cb6", "score": "0.41468143", "text": "func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error {\n\tsrc := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplateList)\n\treturn Convert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil)\n}", "title": "" }, { "docid": "47c03f7b59d62356c24833b1eead4612", "score": "0.41427684", "text": "func convertUnstructuredToElementTree(obj interface{}, name string, required bool) *element {\n\te := element{}\n\tm, ok := obj.(map[string]interface{})\n\tif !ok {\n\t\treturn &e\n\t}\n\n\te.name = name\n\te.required = required\n\tif d, ok := m[\"description\"].(string); ok {\n\t\te.description = d\n\t}\n\n\te.elemtype = getType(m)\n\n\tif e.elemtype == \"object\" {\n\t\thandleObjectType(&e, m)\n\t}\n\n\tif e.elemtype == \"array\" {\n\t\t// store the allowed child type of the list in \"items\"\n\t\tif p, ok := m[\"items\"].(map[string]interface{}); ok {\n\t\t\te.items = convertUnstructuredToElementTree(p, \"items\", false)\n\t\t}\n\t}\n\treturn &e\n}", "title": "" }, { "docid": "6c4982c3c66c1da2e90630904bebd855", "score": "0.41292477", "text": "func (dst *VSphereVMList) ConvertFrom(srcRaw conversion.Hub) error {\n\tsrc := srcRaw.(*infrav1.VSphereVMList)\n\treturn Convert_v1beta1_VSphereVMList_To_v1alpha3_VSphereVMList(src, dst, nil)\n}", "title": "" }, { "docid": "9eef3538e97dbb8665c937321061f6d3", "score": "0.4110781", "text": "func Parse(buf []byte) (*PDL, error) {\n\t// regexp's copied from pdl.py in the chromium source tree.\n\tvar (\n\t\tdomainRE = regexp.MustCompile(`^(experimental )?(deprecated )?domain (.*)`)\n\t\tdependsRE = regexp.MustCompile(`^ depends on ([^\\s]+)`)\n\t\ttypeRE = regexp.MustCompile(`^ (experimental )?(deprecated )?type (.*) extends (array of )?([^\\s]+)`)\n\t\tcommandEventRE = regexp.MustCompile(`^ (experimental )?(deprecated )?(command|event) (.*)`)\n\t\tmemberRE = regexp.MustCompile(`^ (experimental )?(deprecated )?(optional )?(array of )?([^\\s]+) ([^\\s]+)`)\n\t\tparamsRetsPropsRE = regexp.MustCompile(`^ (parameters|returns|properties)`)\n\t\tenumRE = regexp.MustCompile(`^ enum`)\n\t\tversionRE = regexp.MustCompile(`^version`)\n\t\tmajorRE = regexp.MustCompile(`^ major (\\d+)`)\n\t\tminorRE = regexp.MustCompile(`^ minor (\\d+)`)\n\t\tredirectRE = regexp.MustCompile(`^ redirect ([^\\s]+)`)\n\t\tredirectCommentRE = regexp.MustCompile(`^Use '([^']+)' instead$`)\n\t\tenumLiteralRE = regexp.MustCompile(`^ ( )?[^\\s]+$`)\n\t)\n\n\tpdl := new(PDL)\n\n\t// state objects\n\tvar domain *Domain\n\tvar item *Type\n\tvar subitems *[]*Type\n\tvar enumliterals *[]string\n\tvar desc string\n\tvar copyright, clearDesc bool\n\n\tfor i, line := range strings.Split(string(buf), \"\\n\") {\n\t\t// clear the description if toggled\n\t\tif clearDesc {\n\t\t\tdesc, clearDesc = \"\", false\n\t\t}\n\n\t\t// trim the line\n\t\ttrimmed := strings.TrimSpace(line)\n\n\t\t// add to desc\n\t\tif strings.HasPrefix(trimmed, \"#\") {\n\t\t\tif len(desc) != 0 {\n\t\t\t\tdesc += \"\\n\"\n\t\t\t}\n\t\t\tdesc += strings.TrimSpace(trimmed[1:])\n\t\t\tcontinue\n\t\t} else {\n\t\t\tif !copyright {\n\t\t\t\tcopyright, pdl.Copyright = true, desc\n\t\t\t}\n\t\t\tclearDesc = true\n\t\t}\n\n\t\t// skip empty line\n\t\tif len(trimmed) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// domain\n\t\tif matches := domainRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tdomain = &Domain{\n\t\t\t\tDomain: DomainType(matches[0][3]),\n\t\t\t\tExperimental: matches[0][1] != \"\",\n\t\t\t\tDeprecated: matches[0][2] != \"\",\n\t\t\t\tDescription: strings.TrimSpace(desc),\n\t\t\t}\n\t\t\tpdl.Domains = append(pdl.Domains, domain)\n\t\t\tcontinue\n\t\t}\n\n\t\t// dependencies\n\t\tif matches := dependsRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tdomain.Dependencies = append(domain.Dependencies, matches[0][1])\n\t\t\tcontinue\n\t\t}\n\n\t\t// type\n\t\tif matches := typeRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\titem = &Type{\n\t\t\t\tRawType: \"type\",\n\t\t\t\tRawName: domain.Domain.String() + \".\" + matches[0][3],\n\t\t\t\tIsCircularDep: IsCircularDep(domain.Domain.String(), matches[0][3]),\n\t\t\t\tName: matches[0][3],\n\t\t\t\tExperimental: matches[0][1] != \"\",\n\t\t\t\tDeprecated: matches[0][2] != \"\",\n\t\t\t\tDescription: strings.TrimSpace(desc),\n\t\t\t}\n\t\t\tassignType(item, matches[0][5], matches[0][4] != \"\")\n\t\t\tdomain.Types = append(domain.Types, item)\n\t\t\tcontinue\n\t\t}\n\n\t\t// command or event\n\t\tif matches := commandEventRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\titem = &Type{\n\t\t\t\tRawName: domain.Domain.String() + \".\" + matches[0][4],\n\t\t\t\tIsCircularDep: IsCircularDep(domain.Domain.String(), matches[0][4]),\n\t\t\t\tName: matches[0][4],\n\t\t\t\tExperimental: matches[0][1] != \"\",\n\t\t\t\tDeprecated: matches[0][2] != \"\",\n\t\t\t\tDescription: strings.TrimSpace(desc),\n\t\t\t}\n\t\t\tif matches[0][3] == \"command\" {\n\t\t\t\titem.RawType = \"command\"\n\t\t\t\tdomain.Commands = append(domain.Commands, item)\n\t\t\t} else {\n\t\t\t\titem.RawType = \"event\"\n\t\t\t\tdomain.Events = append(domain.Events, item)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// member to params / returns / properties\n\t\tif matches := memberRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tparam := &Type{\n\t\t\t\tRawName: domain.Domain.String() + \".\" + matches[0][6],\n\t\t\t\tIsCircularDep: IsCircularDep(domain.Domain.String(), matches[0][6]),\n\t\t\t\tName: matches[0][6],\n\t\t\t\tExperimental: matches[0][1] != \"\",\n\t\t\t\tDeprecated: matches[0][2] != \"\",\n\t\t\t\tDescription: strings.TrimSpace(desc),\n\t\t\t\tOptional: matches[0][3] != \"\",\n\t\t\t}\n\t\t\tassignType(param, matches[0][5], matches[0][4] != \"\")\n\t\t\tif matches[0][5] == \"enum\" {\n\t\t\t\tparam.Enum = make([]string, 0)\n\t\t\t\tenumliterals = &param.Enum\n\t\t\t}\n\t\t\t*subitems = append(*subitems, param)\n\t\t\tcontinue\n\t\t}\n\n\t\t// parameters, returns, properties definition\n\t\tif matches := paramsRetsPropsRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tswitch matches[0][1] {\n\t\t\tcase \"parameters\":\n\t\t\t\titem.Parameters = make([]*Type, 0)\n\t\t\t\tsubitems = &item.Parameters\n\t\t\tcase \"returns\":\n\t\t\t\titem.Returns = make([]*Type, 0)\n\t\t\t\tsubitems = &item.Returns\n\t\t\tcase \"properties\":\n\t\t\t\titem.Properties = make([]*Type, 0)\n\t\t\t\tsubitems = &item.Properties\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// enum\n\t\tif matches := enumRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\titem.Enum = make([]string, 0)\n\t\t\tenumliterals = &item.Enum\n\t\t\tcontinue\n\t\t}\n\n\t\t// version\n\t\tif matches := versionRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tpdl.Version = new(Version)\n\t\t\tcontinue\n\t\t}\n\n\t\t// version major\n\t\tif matches := majorRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tpdl.Version.Major, _ = strconv.Atoi(matches[0][1])\n\t\t\tcontinue\n\t\t}\n\n\t\t// version minor\n\t\tif matches := minorRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\tpdl.Version.Minor, _ = strconv.Atoi(matches[0][1])\n\t\t\tcontinue\n\t\t}\n\n\t\t// redirect\n\t\tif matches := redirectRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\titem.Redirect = &Redirect{\n\t\t\t\tDomain: DomainType(matches[0][1]),\n\t\t\t}\n\t\t\tif m := redirectCommentRE.FindAllStringSubmatch(desc, -1); len(m) != 0 {\n\t\t\t\tname := m[0][1]\n\t\t\t\tif n := strings.LastIndex(name, \".\"); n != -1 {\n\t\t\t\t\tname = name[n+1:]\n\t\t\t\t}\n\t\t\t\titem.Redirect.Name = name\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// enum literal\n\t\tif matches := enumLiteralRE.FindAllStringSubmatch(line, -1); len(matches) != 0 {\n\t\t\t*enumliterals = append(*enumliterals, trimmed)\n\t\t\tcontinue\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"line %d unknown token %q\", i, line)\n\t}\n\n\treturn pdl, nil\n}", "title": "" }, { "docid": "6d952445850158ff421df811ec56528d", "score": "0.41102326", "text": "func unmarshalListPlacePayload(ctx context.Context, service *goa.Service, req *http.Request) error {\n\tpayload := &listPlacePayload{}\n\tif err := service.DecodeRequest(req, payload); err != nil {\n\t\treturn err\n\t}\n\tgoa.ContextRequest(ctx).Payload = payload.Publicize()\n\treturn nil\n}", "title": "" }, { "docid": "39cc5d774eca29b1ba8845169cef2d0d", "score": "0.41069913", "text": "func (o PrometheusSpecStorageVolumeClaimTemplateStatusOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpecStorageVolumeClaimTemplateStatus) *string { return v.Phase }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cd376b67cc6d9611b02fba26ea81cbf9", "score": "0.4099237", "text": "func NewTurn_List(s *capnp.Segment, sz int32) (Turn_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz)\n\treturn Turn_List{l}, err\n}", "title": "" }, { "docid": "b95ba917db5a837d5b25ffa10fe6b0d4", "score": "0.4096513", "text": "func (o AuthenticationServiceStatusOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AuthenticationServiceStatus) *string { return v.Phase }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "39da37f95569c4c784e9fa3de2aaee02", "score": "0.40915567", "text": "func (src *HAProxyLoadBalancerList) ConvertTo(dstRaw conversion.Hub) error { // nolint\n\tdst := dstRaw.(*infrav1alpha4.HAProxyLoadBalancerList)\n\treturn Convert_v1alpha3_HAProxyLoadBalancerList_To_v1alpha4_HAProxyLoadBalancerList(src, dst, nil)\n}", "title": "" }, { "docid": "7de412d2a8b80f3dabe511958b6e7b45", "score": "0.40863004", "text": "func convertSlice(targetType reflect.Type, value interface{}) (reflect.Value, error) {\n\n\t// if the field is a slice, we need to initialize a new slice of\n\t// the correct type and add all items to it\n\n\telemType := targetType.Elem()\n\n\t// create a new slice of the correct type\n\telemSlice := reflect.New(reflect.SliceOf(elemType)).Elem()\n\n\t// if the elements in the slice are structs, we need to map them back\n\t// from the map to the struct first, before we can add them to the slice\n\tif targetType.Elem().Kind() == reflect.Struct {\n\n\t\tfor _, elem := range value.([]interface{}) {\n\n\t\t\tm, ok := elem.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn reflect.ValueOf(nil), fmt.Errorf(\"failed to convert value to map\")\n\t\t\t}\n\n\t\t\t// create a new struct of the correct type\n\t\t\tnewElem := reflect.New(elemType)\n\n\t\t\tgetter := func(key string) (any, bool) {\n\t\t\t\tval, ok := m[key]\n\t\t\t\treturn val, ok\n\t\t\t}\n\n\t\t\tif err := decoder(getter, newElem.Interface()); err != nil {\n\t\t\t\treturn reflect.ValueOf(nil), fmt.Errorf(\"failed to convert map to struct: %w\", err)\n\t\t\t}\n\n\t\t\telemSlice = reflect.Append(elemSlice, reflect.Indirect(newElem))\n\t\t}\n\n\t} else if targetType.Elem().Kind() == reflect.Slice {\n\n\t\t// nested slices have to be handled separately from primitive types\n\n\t\tsubType := reflect.SliceOf(elemType.Elem())\n\t\tfor _, elem := range value.([]interface{}) {\n\t\t\tval, err := convertSlice(subType, elem)\n\t\t\tif err != nil {\n\t\t\t\treturn reflect.ValueOf(nil), fmt.Errorf(\"failed to convert slice: %w\", err)\n\t\t\t}\n\n\t\t\telemSlice = reflect.Append(elemSlice, val)\n\t\t}\n\n\t} else {\n\n\t\t// otherwise we can just fill the slice, assuming it's\n\t\t// a slice of primitive types\n\t\tfor _, elem := range value.([]interface{}) {\n\t\t\telemSlice = reflect.Append(elemSlice, reflect.ValueOf(elem))\n\t\t}\n\n\t}\n\n\treturn elemSlice, nil\n}", "title": "" }, { "docid": "cf54d687856141be54f4343775224f1d", "score": "0.40834168", "text": "func Unmarshall(ns string) ([]string, error) {\n\tlength := len(ns)\n\tif length < 3 {\n\t\treturn nil, fmt.Errorf(\"invalid format\")\n\t}\n\tposition := 0\n\tvar components []string\n\tvar substringLength int\n\tvar currentLetter rune\n\tfor position < length {\n\t\tsubstringLength = 0\n\t\tcurrentLetter = rune(ns[position])\n\t\tfor unicode.IsNumber(currentLetter) {\n\t\t\tsubstringLength *= 10\n\t\t\tsubstringLength += int(currentLetter - '0')\n\t\t\tposition++\n\t\t\tcurrentLetter = rune(ns[position])\n\t\t}\n\t\tif substringLength == 0 {\n\t\t\treturn nil, fmt.Errorf(\"length must be 1 or more\")\n\t\t}\n\t\tif length < position+substringLength+1 {\n\t\t\treturn nil, fmt.Errorf(\"invalid length %d specified at %d\", substringLength, position-1)\n\t\t}\n\t\tif currentLetter != ':' {\n\t\t\treturn nil, fmt.Errorf(\"missing colon at position %d\", position)\n\t\t}\n\t\tposition++\n\t\tcomponents = append(components, ns[position:position+substringLength])\n\t\tposition += substringLength\n\t\tif ns[position] != ',' {\n\t\t\treturn nil, fmt.Errorf(\"no comma at position %d\", position)\n\t\t}\n\t\tposition++\n\t}\n\treturn components, nil\n\n}", "title": "" }, { "docid": "532ac254ce1ed77366a8139307de2bcd", "score": "0.40814313", "text": "func ToPlist(data interface{}) string {\n\treturn string(ToPlistBytes(data))\n}", "title": "" }, { "docid": "0c1581822f3014e652128740c292fc7c", "score": "0.40796474", "text": "func (_Pausable *PausableFilterer) ParseUnpaused(log types.Log) (*PausableUnpaused, error) {\n\tevent := new(PausableUnpaused)\n\tif err := _Pausable.contract.UnpackLog(event, \"Unpaused\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "title": "" }, { "docid": "73aab6198e4e76286d2b0c1c46ab4a5d", "score": "0.40784287", "text": "func (src *AzureManagedControlPlaneList) ConvertTo(dstRaw conversion.Hub) error {\n\tdst := dstRaw.(*infrav1.AzureManagedControlPlaneList)\n\treturn Convert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(src, dst, nil)\n}", "title": "" }, { "docid": "8b187c72ba9cde3ed6f832f217e47685", "score": "0.40738407", "text": "func (o ThanosRulerSpecStorageVolumeClaimTemplateStatusOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ThanosRulerSpecStorageVolumeClaimTemplateStatus) *string { return v.Phase }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "903912ca559e18e62fff4db57ecaaf02", "score": "0.40729892", "text": "func (dst *HAProxyLoadBalancerList) ConvertFrom(srcRaw conversion.Hub) error { // nolint\n\tsrc := srcRaw.(*infrav1alpha4.HAProxyLoadBalancerList)\n\treturn Convert_v1alpha4_HAProxyLoadBalancerList_To_v1alpha3_HAProxyLoadBalancerList(src, dst, nil)\n}", "title": "" }, { "docid": "07073bf314cff9748c16d7a6c0c09405", "score": "0.4070486", "text": "func FromUnstructured(in runtime.Unstructured, out runtime.Object) error {\n\tb, err := json.Marshal(in.UnstructuredContent())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := json.Unmarshal(b, out); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ad5477dc04869184ead490e28429d02", "score": "0.40695623", "text": "func NewPhase(phase storage.OperationPhase) *Phase {\n\treturn &Phase{\n\t\tp: phase,\n\t}\n}", "title": "" }, { "docid": "908bb92d4f2461d65d99721df406a64b", "score": "0.40646094", "text": "func toList(msg Message) []interface{} {\n\tval := reflect.ValueOf(msg)\n\tif val.Kind() == reflect.Ptr {\n\t\tval = val.Elem()\n\t}\n\n\t// iterate backwards until a non-empty or non-\"omitempty\" field is found\n\tlast := val.Type().NumField() - 1\n\tfor ; last > 0; last-- {\n\t\ttag := val.Type().Field(last).Tag.Get(\"wamp\")\n\t\tif !strings.Contains(tag, \"omitempty\") || val.Field(last).Len() > 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tret := []interface{}{int(msg.MessageType())}\n\tfor i := 0; i <= last; i++ {\n\t\tret = append(ret, val.Field(i).Interface())\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "92d72e983e2b72898ccecdc9b38d122a", "score": "0.4040546", "text": "func (o AuthenticationServiceStatusPtrOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AuthenticationServiceStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Phase\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "332f3fe4bee85aaaf51970495875678a", "score": "0.40286064", "text": "func DecodeGrpcRespRolloutPhase(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "c6026698d86c5a18e3f6a65fc7e0f534", "score": "0.40277272", "text": "func (o PrometheusSpecStorageVolumeClaimTemplateStatusPtrOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PrometheusSpecStorageVolumeClaimTemplateStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Phase\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c63b66255177936ad98a5aa741981993", "score": "0.40219057", "text": "func (o AlertmanagerSpecStorageVolumeClaimTemplateStatusOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertmanagerSpecStorageVolumeClaimTemplateStatus) *string { return v.Phase }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2b9c232a3e89153fbdc49523a271b06b", "score": "0.40185076", "text": "func (o ThanosRulerSpecStorageVolumeClaimTemplateStatusPtrOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ThanosRulerSpecStorageVolumeClaimTemplateStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Phase\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7190706fc5e8e829cba770ce236f90c9", "score": "0.40148166", "text": "func (c *convertor) fieldList(fieldList *ast.FieldList) {\n\tlst := []*ast.Field{}\n\tfor _, field := range fieldList.List {\n\t\t// only handle ident types for now (not eg SelectorExpr)\n\t\tvar (\n\t\t\tidentType *ast.Ident\n\t\t\tkind string\n\t\t\tarrayLen string\n\t\t)\n\t\tswitch fieldType := field.Type.(type) {\n\t\tcase *ast.Ident:\n\t\t\tidentType = fieldType\n\t\tcase *ast.ArrayType:\n\t\t\tvar ok bool\n\t\t\tidentType, ok = fieldType.Elt.(*ast.Ident)\n\t\t\tif !ok {\n\t\t\t\tlst = append(lst, field)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tkind = \"array\"\n\t\t\tif basicLit, ok := fieldType.Len.(*ast.BasicLit); ok {\n\t\t\t\tarrayLen = basicLit.Value\n\t\t\t}\n\t\tdefault:\n\t\t\tlst = append(lst, field)\n\t\t\tcontinue\n\t\t}\n\n\t\tif identType.Name != c.fromType {\n\t\t\tlst = append(lst, field)\n\t\t\tcontinue\n\t\t}\n\t\tif field.Names == nil {\n\t\t\tidentType.Name = c.toType\n\t\t\tlst = append(lst, field)\n\t\t\tcontinue\n\t\t}\n\t\ttypstr := map[bool]string{\n\t\t\ttrue: c.fromType,\n\t\t\tfalse: c.toType}\n\t\tprev := []*ast.Ident{field.Names[0]}\n\t\tprevSkip := c.skipField(prev[0].Name)\n\t\tfor _, ident := range field.Names[1:] {\n\t\t\tskip := c.skipField(ident.Name)\n\t\t\tif skip == prevSkip {\n\t\t\t\tprev = append(prev, ident)\n\t\t\t} else {\n\t\t\t\tlst = appendField(lst, prev, typstr, prevSkip, kind, arrayLen)\n\t\t\t\tprev = []*ast.Ident{ident}\n\t\t\t\tprevSkip = skip\n\t\t\t}\n\t\t}\n\t\tif len(prev) != 0 {\n\t\t\tlst = appendField(lst, prev, typstr, prevSkip, kind, arrayLen)\n\t\t}\n\t}\n\tfieldList.List = lst\n}", "title": "" }, { "docid": "c5a7f2f4a5a16111052e95f8b14e283c", "score": "0.40115976", "text": "func ToPod(u *unstructured.Unstructured) *corev1.Pod {\n\tvar obj *corev1.Pod\n\terr := runtime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), &obj)\n\tif err != nil {\n\t\treturn &corev1.Pod{}\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "41f0397da7535b91abfe1365cf91cc4a", "score": "0.40088868", "text": "func (o OperatorStatusOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v OperatorStatus) *string { return v.Phase }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3f1695178d7efb36e30e6f83b74dbbb6", "score": "0.3994475", "text": "func parseInput(input string) []Step {\n\n\t// First split by the comma\n\tparts := strings.Split(input, \",\")\n\n\t// Reserve output memory\n\toutput := make([]Step, len(parts))\n\n\tfor i, part := range parts {\n\t\t// Split the first character off (direction) and the rest is the amount, store as Step struct\n\t\ttrimmed := strings.TrimSpace(part)\n\t\tamount, err := strconv.Atoi(trimmed[1:])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput[i] = Step{\n\t\t\tdirection: trimmed[:1],\n\t\t\tamount: amount,\n\t\t}\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "feeae49ee2b22d0cf3c5e20a51eaaa17", "score": "0.39923817", "text": "func (src *KubeadmConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error {\n\tdst := dstRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplateList)\n\treturn Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList(src, dst, nil)\n}", "title": "" }, { "docid": "be2eaa996d971a5fe93017e7c856ca4b", "score": "0.39861038", "text": "func (_ StepOutput) NewList(i interface{}) []StepOutput {\n\tdest := []StepOutput{}\n\tswitch x := i.(type) {\n\tcase []interface{}:\n\t\tfor _, v := range x {\n\t\t\tdest = append(dest, StepOutput{}.New(v))\n\t\t}\n\t}\n\treturn dest\n}", "title": "" }, { "docid": "67f99f6a1ebe1113a5b54b919525741e", "score": "0.3983581", "text": "func AsListing(obj *unstructured.Unstructured) *Listing {\n\treturn NewListing(\n\t\t[]*unstructured.Unstructured{obj},\n\t)\n}", "title": "" }, { "docid": "b6530eb3ee2614d57bdc90b0c63bfe16", "score": "0.39715332", "text": "func (src *VSphereVMList) ConvertTo(dstRaw conversion.Hub) error {\n\tdst := dstRaw.(*infrav1.VSphereVMList)\n\treturn Convert_v1alpha3_VSphereVMList_To_v1beta1_VSphereVMList(src, dst, nil)\n}", "title": "" }, { "docid": "27251b821bd0ff4d59222dd9fcde70ca", "score": "0.39696318", "text": "func (o AlertmanagerSpecStorageVolumeClaimTemplateStatusPtrOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AlertmanagerSpecStorageVolumeClaimTemplateStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Phase\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "adf52aec3f8c833369d5bd7faa33ce75", "score": "0.3967016", "text": "func setPhase(status *navarchosv1alpha1.NodeRolloutStatus, result *Result) {\n\tif result.Phase != nil {\n\t\tstatus.Phase = *result.Phase\n\t}\n}", "title": "" }, { "docid": "c10dd8c5edd6d12eca0adcfa05a0aca7", "score": "0.39658806", "text": "func (h *Handler) GetFromUnstructured(u *unstructured.Unstructured) (*corev1.Pod, error) {\n\tpod := &corev1.Pod{}\n\terr := runtime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), pod)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn h.getPod(pod)\n}", "title": "" }, { "docid": "8e3c5a62369d786e3d2abe3c85440edb", "score": "0.39617914", "text": "func (x OslcPhase) String() string { return string(x) }", "title": "" }, { "docid": "89b34268a5508818ecd39c3ababe4b38", "score": "0.39617032", "text": "func stringToUnstructuredArray(out string) ([]*unstructured.Unstructured, error) {\n\tparts := diffSeparator.Split(out, -1)\n\tvar objs []*unstructured.Unstructured\n\tvar firstErr error\n\tfor _, part := range parts {\n\t\tvar objMap map[string]interface{}\n\t\terr := yaml.Unmarshal([]byte(part), &objMap)\n\t\tif err != nil {\n\t\t\tif firstErr == nil {\n\t\t\t\tfirstErr = fmt.Errorf(\"failed to unmarshal manifest: %v\", err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif len(objMap) == 0 {\n\t\t\t// handles case where theres no content between `---`\n\t\t\tcontinue\n\t\t}\n\t\tvar obj unstructured.Unstructured\n\t\terr = yaml.Unmarshal([]byte(part), &obj)\n\t\tif err != nil {\n\t\t\tif firstErr == nil {\n\t\t\t\tfirstErr = fmt.Errorf(\"failed to unmarshal manifest: %v\", err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tobjs = append(objs, &obj)\n\t}\n\treturn objs, firstErr\n}", "title": "" }, { "docid": "fb494514d6504831398cb87bfdff80ed", "score": "0.39567226", "text": "func typeList(t *Type) typeSlice {\n\tif t.Desc.Kind() == UnionKind {\n\t\treturn t.Desc.(CompoundDesc).ElemTypes\n\t}\n\treturn typeSlice{t}\n}", "title": "" }, { "docid": "a37aeacac02492558bca74a05da4bb56", "score": "0.39555368", "text": "func (p *Clause) TimeList(format string, options ...AccumulatorOption) (target *[]time.Time) {\n\ttarget = new([]time.Time)\n\tp.TimeListVar(format, target, options...)\n\treturn\n}", "title": "" }, { "docid": "eda46053f1cf0bc4acd08ed31ec8d560", "score": "0.3955263", "text": "func unpackArgSPluginscriptLanguageDesc(x []PluginscriptLanguageDesc) (unpacked *C.godot_pluginscript_language_desc, allocs *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t}\n\tallocs = new(cgoAllocMap)\n\tdefer runtime.SetFinalizer(&unpacked, func(**C.godot_pluginscript_language_desc) {\n\t\tgo allocs.Free()\n\t})\n\n\tlen0 := len(x)\n\tmem0 := allocPluginscriptLanguageDescMemory(len0)\n\tallocs.Add(mem0)\n\th0 := &sliceHeader{\n\t\tData: uintptr(mem0),\n\t\tCap: len0,\n\t\tLen: len0,\n\t}\n\tv0 := *(*[]C.godot_pluginscript_language_desc)(unsafe.Pointer(h0))\n\tfor i0 := range x {\n\t\tallocs0 := new(cgoAllocMap)\n\t\tv0[i0], allocs0 = x[i0].PassValue()\n\t\tallocs.Borrow(allocs0)\n\t}\n\th := (*sliceHeader)(unsafe.Pointer(&v0))\n\tunpacked = (*C.godot_pluginscript_language_desc)(unsafe.Pointer(h.Data))\n\treturn\n}", "title": "" }, { "docid": "c6d4e5273e92e325dd08b935f3961b78", "score": "0.3949013", "text": "func (s *CombinatorialSolver) Convert(phi br.ClauseSet, nbvar int) (*LPB, error) {\n\ttree := NewSplittingTree(phi, nbvar, s.SortPatterns, s.SortClauses)\n\ttree.Cut = s.Cut\n\ttree.SymTest = s.SymTest\n\tres, err := s.TSolver.Solve(tree)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// undo the renaming\n\treturn res.Rename(tree.ReverseRenaming), nil\n}", "title": "" }, { "docid": "4a331035dcc979186aa450e80d4ac046", "score": "0.394123", "text": "func SCObjectToTPRObject(object interface{}) (*runtime.Unstructured, error) {\n\tm, err := json.Marshal(object)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to marshal %#v : %v\", object, err)\n\t\treturn nil, err\n\t}\n\tvar ret runtime.Unstructured\n\terr = json.Unmarshal(m, &ret)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to unmarshal: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\treturn &ret, nil\n}", "title": "" }, { "docid": "d7e5cc2027e486e9be6857b561c6024a", "score": "0.39270067", "text": "func flattenWorkflowTemplateJobsPigJobQueryListSlice(c *Client, i interface{}) []WorkflowTemplateJobsPigJobQueryList {\n\ta, ok := i.([]interface{})\n\tif !ok {\n\t\treturn []WorkflowTemplateJobsPigJobQueryList{}\n\t}\n\n\tif len(a) == 0 {\n\t\treturn []WorkflowTemplateJobsPigJobQueryList{}\n\t}\n\n\titems := make([]WorkflowTemplateJobsPigJobQueryList, 0, len(a))\n\tfor _, item := range a {\n\t\titems = append(items, *flattenWorkflowTemplateJobsPigJobQueryList(c, item.(map[string]interface{})))\n\t}\n\n\treturn items\n}", "title": "" }, { "docid": "c18cdb458278eb46cba40f37c09c2974", "score": "0.3921035", "text": "func (dst *KubeadmConfigList) ConvertFrom(srcRaw conversion.Hub) error {\n\tsrc := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigList)\n\treturn Convert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(src, dst, nil)\n}", "title": "" }, { "docid": "3c181877c7fa78a0777f15bac59cc668", "score": "0.39188167", "text": "func (p *parser) parseList() {\n}", "title": "" }, { "docid": "aae56ba1b45219d397218b480e1778a3", "score": "0.39089388", "text": "func FlattenToV1(objs []runtime.Unstructured) []metav1.Object {\n\tret := make([]metav1.Object, 0, len(objs))\n\tfor _, obj := range objs {\n\t\tswitch o := obj.(type) {\n\t\tcase *unstructuredv1.UnstructuredList:\n\t\t\tfor _, item := range o.Items {\n\t\t\t\tret = append(ret, &item)\n\t\t\t}\n\t\tcase *unstructuredv1.Unstructured:\n\t\t\tret = append(ret, o)\n\t\tdefault:\n\t\t\tpanic(\"Unexpected unstructured object type\")\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "568f4e8ebc97097696dfef257d24c905", "score": "0.39003357", "text": "func ParseSyndicateMissions(platformno int, platform string, c mqtt.Client, lang string) {\n\ttype SyndicateJobs struct {\n\t\tJobtype string\n\t\tRewards string // temp until translator is added\n\t\tMinEnemyLevel int64\n\t\tMaxEnemyLevel int64\n\t\tStandingReward []string\n\t}\n\ttype SyndicateMissions struct {\n\t\tID string\n\t\tStarted string\n\t\tEnd string\n\t\tSyndicate string\n\t\tJobs []SyndicateJobs\n\t}\n\tdata := datasources.Apidata[platformno]\n\tvar syndicates []SyndicateMissions\n\tjsonparser.ArrayEach(data, func(value []byte, dataType jsonparser.ValueType, offset int, err error) {\n\t\tsyndicatecheck, _ := jsonparser.GetString(value, \"Tag\")\n\t\tfmt.Println(syndicatecheck)\n\t\tif syndicatecheck == \"CetusSyndicate\" || syndicatecheck == \"SolarisSyndicate\" {\n\t\t\tid, _ := jsonparser.GetString(value, \"_id\", \"$oid\")\n\t\t\tstarted, _ := jsonparser.GetString(value, \"Activation\", \"$date\", \"$numberLong\")\n\t\t\tended, _ := jsonparser.GetString(value, \"Expiry\", \"$date\", \"$numberLong\")\n\t\t\tsyndicate, _ := jsonparser.GetString(value, \"Tag\")\n\t\t\tvar jobs []SyndicateJobs\n\t\t\tjsonparser.ArrayEach(value, func(value1 []byte, dataType jsonparser.ValueType, offset int, err error) {\n\t\t\t\tjobtype, _ := jsonparser.GetString(value1, \"jobType\")\n\t\t\t\trewards, _ := jsonparser.GetString(value1, \"rewards\") // temp until translator is added\n\t\t\t\t/*rewards := make([]string, 0)\n\t\t\t\tjsonparser.ArrayEach(value1, func(reward []byte, dataType jsonparser.ValueType, offset int, err error) {\n\t\t\t\t\trewards = append(rewards, string(reward))\n\n\t\t\t\t}, \"rewardPool\")*/\n\t\t\t\tminEnemyLevel, _ := jsonparser.GetInt(value1, \"minEnemyLevel\")\n\t\t\t\tmaxEnemyLevel, _ := jsonparser.GetInt(value1, \"maxEnemyLevel\")\n\t\t\t\tstanding := make([]string, 0)\n\t\t\t\tjsonparser.ArrayEach(value1, func(xpam []byte, dataType jsonparser.ValueType, offset int, err error) {\n\t\t\t\t\tstanding = append(standing, string(xpam))\n\n\t\t\t\t}, \"xpAmounts\")\n\t\t\t\tjobs = append(jobs, SyndicateJobs{\n\t\t\t\t\tJobtype: jobtype,\n\t\t\t\t\tRewards: rewards,\n\t\t\t\t\tMinEnemyLevel: minEnemyLevel,\n\t\t\t\t\tMaxEnemyLevel: maxEnemyLevel,\n\t\t\t\t\tStandingReward: standing,\n\t\t\t\t})\n\t\t\t}, \"Jobs\")\n\n\t\t\tw := SyndicateMissions{\n\t\t\t\tID: id,\n\t\t\t\tStarted: started,\n\t\t\t\tEnd: ended,\n\t\t\t\tSyndicate: syndicate,\n\t\t\t\tJobs: jobs}\n\t\t\tsyndicates = append(syndicates, w)\n\t\t}\n\t}, \"SyndicateMissions\")\n\n\ttopicf := \"/wf/\" + lang + \"/\" + platform + \"/syndicates\"\n\tmessageJSON, _ := json.Marshal(syndicates)\n\ttoken := c.Publish(topicf, 0, true, messageJSON)\n\ttoken.Wait()\n}", "title": "" }, { "docid": "ad8a1fadabaf77338c7fd175c2de0438", "score": "0.38992372", "text": "func getStatusFromPod(hook *unstructured.Unstructured) (v1alpha1.OperationPhase, string) {\n\tvar pod apiv1.Pod\n\terr := runtime.DefaultUnstructuredConverter.FromUnstructured(hook.Object, &pod)\n\tif err != nil {\n\t\treturn v1alpha1.OperationError, err.Error()\n\t}\n\tgetFailMessage := func(ctr *apiv1.ContainerStatus) string {\n\t\tif ctr.State.Terminated != nil {\n\t\t\tif ctr.State.Terminated.Message != \"\" {\n\t\t\t\treturn ctr.State.Terminated.Message\n\t\t\t}\n\t\t\tif ctr.State.Terminated.Reason == \"OOMKilled\" {\n\t\t\t\treturn ctr.State.Terminated.Reason\n\t\t\t}\n\t\t\tif ctr.State.Terminated.ExitCode != 0 {\n\t\t\t\treturn fmt.Sprintf(\"container %q failed with exit code %d\", ctr.Name, ctr.State.Terminated.ExitCode)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\tswitch pod.Status.Phase {\n\tcase apiv1.PodPending, apiv1.PodRunning:\n\t\treturn v1alpha1.OperationRunning, \"\"\n\tcase apiv1.PodSucceeded:\n\t\treturn v1alpha1.OperationSucceeded, \"\"\n\tcase apiv1.PodFailed:\n\t\tif pod.Status.Message != \"\" {\n\t\t\t// Pod has a nice error message. Use that.\n\t\t\treturn v1alpha1.OperationFailed, pod.Status.Message\n\t\t}\n\t\tfor _, ctr := range append(pod.Status.InitContainerStatuses, pod.Status.ContainerStatuses...) {\n\t\t\tif msg := getFailMessage(&ctr); msg != \"\" {\n\t\t\t\treturn v1alpha1.OperationFailed, msg\n\t\t\t}\n\t\t}\n\t\treturn v1alpha1.OperationFailed, \"\"\n\tcase apiv1.PodUnknown:\n\t\treturn v1alpha1.OperationError, \"\"\n\t}\n\treturn v1alpha1.OperationRunning, \"\"\n}", "title": "" }, { "docid": "5a5a64978fd7cc3a7e77886cbbddea6c", "score": "0.3891297", "text": "func unmarshalArray(str []rune, outp interface{}) (interface{}, error) {\n\toutpType := reflect.TypeOf(outp)\n\tif outpType.Kind() != reflect.Slice {\n\t\treturn nil, errors.New(\"expected slice output when decoding array\")\n\t}\n\n\telemType := outpType.Elem()\n\telemKind := elemType.Kind()\n\tisPtr := elemKind == reflect.Ptr\n\tif !isPtr {\n\t\treturn nil, errors.New(\"expected to output a slice of struct pointers\")\n\t}\n\n\telemType = elemType.Elem()\n\telemKind = elemType.Kind()\n\tif elemKind != reflect.Struct {\n\t\treturn nil, errors.New(\"expected to output a slice of struct pointers\")\n\t}\n\n\toutpVal := reflect.ValueOf(outp)\n\tpts := strings.Split(string(str), \"|\")\n\tfor _, part := range pts {\n\t\telemVal := reflect.New(elemType)\n\n\t\terr := unmarshalObject([]rune(part), elemVal.Interface())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\toutpVal = reflect.Append(outpVal, elemVal)\n\t}\n\n\treturn outpVal.Interface(), nil\n}", "title": "" }, { "docid": "e484be7c6c335399e44ab1423b865e72", "score": "0.38849765", "text": "func (helper *Helper) Phase(phaseID ifc.ID) (*v1alpha1.Phase, error) {\n\tphase := &v1alpha1.Phase{\n\t\tObjectMeta: v1.ObjectMeta{\n\t\t\tName: phaseID.Name,\n\t\t\tNamespace: phaseID.Namespace,\n\t\t},\n\t}\n\tselector, err := document.NewSelector().ByObject(phase, v1alpha1.Scheme)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdoc, err := helper.phaseConfigBundle.SelectOne(selector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Overwrite phase used for selector, with a phase with default values\n\tphase = v1alpha1.DefaultPhase()\n\tif err = doc.ToAPIObject(phase, v1alpha1.Scheme); err != nil {\n\t\treturn nil, err\n\t}\n\t// Phase must contain an executor\n\tif phase.Config.ExecutorRef == nil {\n\t\treturn nil, errors.ErrExecutorRefNotDefined{\n\t\t\tPhaseName: phase.Name,\n\t\t\tPhaseNamespace: phase.Namespace,\n\t\t}\n\t}\n\treturn phase, nil\n}", "title": "" }, { "docid": "749a7e65a1b0cd7804b5bbe7c9245ea9", "score": "0.38818878", "text": "func (o OperatorStatusPtrOutput) Phase() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *OperatorStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Phase\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b479154f92293dc4134e0cdbaa38f861", "score": "0.38806248", "text": "func (src *KubeadmConfigList) ConvertTo(dstRaw conversion.Hub) error {\n\tdst := dstRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigList)\n\treturn Convert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(src, dst, nil)\n}", "title": "" }, { "docid": "9479d328f0851b6828ebc08ab42ca526", "score": "0.3877736", "text": "func flattenWorkflowTemplateJobsPigJobQueryList(c *Client, i interface{}) *WorkflowTemplateJobsPigJobQueryList {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tr := &WorkflowTemplateJobsPigJobQueryList{}\n\tr.Queries = dcl.FlattenStringSlice(m[\"queries\"])\n\n\treturn r\n}", "title": "" }, { "docid": "369a8832b09e0626b8e1fbc94db7b6cd", "score": "0.38773814", "text": "func (builder *convertFromArmBuilder) fromArmComplexPropertyConversion(\n\tparams complexPropertyConversionParameters) []ast.Stmt {\n\n\tswitch params.destinationType.(type) {\n\tcase *astmodel.OptionalType:\n\t\treturn builder.convertComplexOptionalProperty(params)\n\tcase *astmodel.ArrayType:\n\t\treturn builder.convertComplexArrayProperty(params)\n\tcase *astmodel.MapType:\n\t\treturn builder.convertComplexMapProperty(params)\n\tcase astmodel.TypeName:\n\t\treturn builder.convertComplexTypeNameProperty(params)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"don't know how to perform fromArm conversion for type: %T\", params.destinationType))\n\t}\n}", "title": "" }, { "docid": "eccdc50ebe6c94efea41b473e609465c", "score": "0.3871476", "text": "func (m *MissionWritePartialList) Decode(buf []byte) {\n\tdata := bytes.NewBuffer(buf)\n\tbinary.Read(data, binary.LittleEndian, &m.START_INDEX)\n\tbinary.Read(data, binary.LittleEndian, &m.END_INDEX)\n\tbinary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM)\n\tbinary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT)\n}", "title": "" }, { "docid": "642f76d67f9f6bfe5dd61254806c22fe", "score": "0.38703585", "text": "func (ps ServicePorts) Convert() []corev1.ServicePort {\n\tports := make([]corev1.ServicePort, 0)\n\tfor _, po := range ps {\n\t\tport := corev1.ServicePort{\n\t\t\tName: po.Name,\n\t\t\tProtocol: po.Protocol,\n\t\t\tPort: po.Port,\n\t\t\tNodePort: po.NodePort,\n\t\t}\n\t\tif po.TargetPort != nil {\n\t\t\tport.TargetPort = intstr.FromInt(int(util.PointerToInt32(po.TargetPort)))\n\t\t}\n\t\tports = append(ports, port)\n\t}\n\n\treturn ports\n}", "title": "" }, { "docid": "5b0a95d59562c6a60d074329c0570623", "score": "0.38693732", "text": "func (src *AzureMachineList) ConvertTo(dstRaw conversion.Hub) error { // nolint\n\tdst := dstRaw.(*infrav1alpha3.AzureMachineList)\n\treturn Convert_v1alpha2_AzureMachineList_To_v1alpha3_AzureMachineList(src, dst, nil)\n}", "title": "" }, { "docid": "f9547349448b33754d2841a93c6644d5", "score": "0.38652346", "text": "func (c *nopConverter) ConvertToVersion(in runtime.Object, target runtime.GroupVersioner) (runtime.Object, error) {\n\tvar err error\n\t// Run the converter on the list items instead of list itself\n\tif list, ok := in.(*unstructured.UnstructuredList); ok {\n\t\terr = list.EachListItem(func(item runtime.Object) error {\n\t\t\treturn c.convertToVersion(item, target)\n\t\t})\n\t}\n\terr = c.convertToVersion(in, target)\n\treturn in, err\n}", "title": "" }, { "docid": "833d39c32e7ed4c6799ebc210facae81", "score": "0.3862877", "text": "func UnpackPlans(plansAny []*types.Any) ([]PlanI, error) {\n\tplans := make([]PlanI, len(plansAny))\n\tfor i, any := range plansAny {\n\t\tp, ok := any.GetCachedValue().(PlanI)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected planI\")\n\t\t}\n\t\tplans[i] = p\n\t}\n\n\treturn plans, nil\n}", "title": "" }, { "docid": "34fe417560b4f35193899d6e310261b5", "score": "0.38621703", "text": "func toDeserializedForm(t vocab.Type) vocab.Type {\n\tm := mustSerialize(t)\n\tasValue, err := streams.ToType(context.Background(), m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn asValue\n}", "title": "" }, { "docid": "e3b340cf78617cb8bfc186e18e8768f0", "score": "0.3861793", "text": "func L(args ...data.Value) data.List {\n\treturn data.NewList(args...)\n}", "title": "" }, { "docid": "1a4f825fdd0a28132b7171874de387b7", "score": "0.38580972", "text": "func (obj *OslcList) FromOslcList() *unstructured.Unstructured {\n\tu := NewOslcListVersionKind(\"\", \"\")\n\ttmp, err := runtime.DefaultUnstructuredConverter.ToUnstructured(*obj)\n\tif err != nil {\n\t\treturn u\n\t}\n\tu.SetUnstructuredContent(tmp)\n\treturn u\n}", "title": "" }, { "docid": "e0ecc42d217b76cff9c87c04dc3f44aa", "score": "0.3857614", "text": "func DurationMapstructureDecodeHookFunc(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) {\n\tif f.Kind() != reflect.String {\n\t\treturn data, nil\n\t}\n\tif t != reflect.TypeOf(Duration(0)) && t != reflect.TypeOf(time.Duration(0)) {\n\t\treturn data, nil\n\t}\n\n\t// Convert it by parsing\n\treturn time.ParseDuration(data.(string))\n}", "title": "" }, { "docid": "01b61b7122a1bcb3a9520d34bbdba8cb", "score": "0.38537776", "text": "func (dst *AzureMachineList) ConvertFrom(srcRaw conversion.Hub) error { // nolint\n\tsrc := srcRaw.(*infrav1alpha3.AzureMachineList)\n\treturn Convert_v1alpha3_AzureMachineList_To_v1alpha2_AzureMachineList(src, dst, nil)\n}", "title": "" }, { "docid": "9861eb6535de4851805a7ed71ad8046a", "score": "0.38536867", "text": "func unifyTuplesAsList(types []cty.Type, unsafe bool) (cty.Type, []Conversion) {\n\tvar tuples []cty.Type\n\tvar tupleIdxs []int\n\tfor i, t := range types {\n\t\tif t.IsTupleType() {\n\t\t\ttuples = append(tuples, t)\n\t\t\ttupleIdxs = append(tupleIdxs, i)\n\t\t}\n\t}\n\n\tty, tupleConvs := unifyTupleTypesToList(tuples, unsafe)\n\tif !ty.IsListType() {\n\t\treturn cty.NilType, nil\n\t}\n\n\t// the tuples themselves unified as a list, get the overall\n\t// unification with this list type instead of the tuple.\n\t// make a copy of the types, so we can fallback to the standard\n\t// codepath if something went wrong\n\tlisted := make([]cty.Type, len(types))\n\tcopy(listed, types)\n\tfor _, idx := range tupleIdxs {\n\t\tlisted[idx] = ty\n\t}\n\n\tnewTy, convs := unify(listed, unsafe)\n\tif !newTy.IsListType() {\n\t\treturn cty.NilType, nil\n\t}\n\n\t// we have a good conversion, wrap the nested tuple conversions.\n\t// We know the tuple conversion is not nil, because we went from tuple to\n\t// list\n\tfor i, idx := range tupleIdxs {\n\t\tlistConv := convs[idx]\n\t\ttupleConv := tupleConvs[i]\n\n\t\tif listConv == nil {\n\t\t\tconvs[idx] = tupleConv\n\t\t\tcontinue\n\t\t}\n\n\t\tconvs[idx] = func(in cty.Value) (out cty.Value, err error) {\n\t\t\tout, err = tupleConv(in)\n\t\t\tif err != nil {\n\t\t\t\treturn out, err\n\t\t\t}\n\n\t\t\treturn listConv(in)\n\t\t}\n\t}\n\n\treturn newTy, convs\n}", "title": "" }, { "docid": "a6ccc2bc0ccf7a6efba517a73ce64596", "score": "0.38516334", "text": "func DecodeGrpcRespLbPolicyList(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "035eb99952733103b9cba5e239b2a188", "score": "0.3849247", "text": "func (_Store *StoreFilterer) ParseUnpaused(log types.Log) (*StoreUnpaused, error) {\n\tevent := new(StoreUnpaused)\n\tif err := _Store.contract.UnpackLog(event, \"Unpaused\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "title": "" }, { "docid": "05a14034d8d6d7752a1ea97eb236989c", "score": "0.3847867", "text": "func NewPipeline_Stage_List(s *capnp.Segment, sz int32) (Pipeline_Stage_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 0}, sz)\n\treturn Pipeline_Stage_List{l}, err\n}", "title": "" }, { "docid": "f990848eba172f68d2399a39ced4bcf6", "score": "0.38459158", "text": "func (p *defaultFieldProcessor) validateAndConvertField(sf *ast.JsonStreamField, t interface{}) (interface{}, error) {\n\tv := reflect.ValueOf(t)\n\tjtype := v.Kind()\n\tswitch sf.Type {\n\tcase (ast.BIGINT).String():\n\t\tif jtype == reflect.Int64 {\n\t\t\treturn t, nil\n\t\t}\n\t\treturn cast.ToInt64(t, cast.CONVERT_SAMEKIND)\n\tcase (ast.FLOAT).String():\n\t\tif jtype == reflect.Float64 {\n\t\t\treturn t, nil\n\t\t}\n\t\treturn cast.ToFloat64(t, cast.CONVERT_SAMEKIND)\n\tcase (ast.BOOLEAN).String():\n\t\tif jtype == reflect.Bool {\n\t\t\treturn t, nil\n\t\t}\n\t\treturn cast.ToBool(t, cast.CONVERT_SAMEKIND)\n\tcase (ast.STRINGS).String():\n\t\tif jtype == reflect.String {\n\t\t\treturn t, nil\n\t\t}\n\t\treturn cast.ToString(t, cast.CONVERT_SAMEKIND)\n\tcase (ast.DATETIME).String():\n\t\treturn cast.InterfaceToTime(t, p.timestampFormat)\n\tcase (ast.BYTEA).String():\n\t\treturn cast.ToByteA(t, cast.CONVERT_SAMEKIND)\n\tcase (ast.ARRAY).String():\n\t\tif t == nil {\n\t\t\treturn []interface{}(nil), nil\n\t\t} else if jtype == reflect.Slice {\n\t\t\ta, ok := t.([]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot convert %v to []interface{}\", t)\n\t\t\t}\n\t\t\tfor i, e := range a {\n\t\t\t\tne, err := p.validateAndConvertField(sf.Items, e)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"array element type mismatch: %v\", err)\n\t\t\t\t}\n\t\t\t\tif ne != nil {\n\t\t\t\t\ta[i] = ne\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn a, nil\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"expect array but got %v\", t)\n\t\t}\n\tcase (ast.STRUCT).String():\n\t\tvar (\n\t\t\tnextJ map[string]interface{}\n\t\t\tok bool\n\t\t)\n\t\tif t == nil {\n\t\t\treturn map[string]interface{}(nil), nil\n\t\t} else if jtype == reflect.Map {\n\t\t\tnextJ, ok = t.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"expect map but found %[1]T(%[1]v)\", t)\n\t\t\t}\n\t\t} else if jtype == reflect.String {\n\t\t\terr := json.Unmarshal(cast.StringToBytes(t.(string)), &nextJ)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid data type for %s, expect map but found %[1]T(%[1]v)\", t)\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"expect struct but found %[1]T(%[1]v)\", t)\n\t\t}\n\t\treturn p.validateAndConvertMessage(sf.Properties, nextJ)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported type %s\", sf.Type)\n\t}\n}", "title": "" }, { "docid": "caf4c2485505c8d752a3bada36ed4838", "score": "0.38443473", "text": "func unmarshalListOfFields(fields map[string]interface{}, fieldName string) ([]map[string]interface{}, error) {\n\tlistOfFields := []map[string]interface{}{}\n\n\tfieldAsYaml, containsField := fields[fieldName]\n\tif !containsField || fieldAsYaml == nil {\n\t\treturn listOfFields, nil\n\t}\n\n\tasYamlList, isYamlList := fieldAsYaml.([]interface{})\n\tif !isYamlList {\n\t\treturn listOfFields, errors.WithStackTrace(InvalidTypeForField{FieldName: fieldName, ExpectedType: \"[]interface{}\", ActualType: reflect.TypeOf(fieldAsYaml)})\n\t}\n\n\tfor _, asYaml := range asYamlList {\n\t\tasYamlMap, isYamlMap := asYaml.(map[interface{}]interface{})\n\t\tif !isYamlMap {\n\t\t\treturn listOfFields, errors.WithStackTrace(InvalidTypeForField{FieldName: fieldName, ExpectedType: \"map[string]interface{}\", ActualType: reflect.TypeOf(asYaml)})\n\t\t}\n\n\t\tlistOfFields = append(listOfFields, util.ToStringToGenericMap(asYamlMap))\n\t}\n\n\treturn listOfFields, nil\n}", "title": "" } ]
fbdb39bb23ff22dbd8fe88ff9cfcc667
GenerateCA returns the certificate and private key pair for a certificate authority, and an error.
[ { "docid": "72adfe3d7ef2647f6815ed55a536b8f7", "score": "0.66754514", "text": "func (g *GRPCTLS) GenerateCA(notBefore, notAfter time.Time, serialNumberLimit *big.Int) (*x509.Certificate, DSAKey, error) {\n\tcaKey, err := g.KeyGenerator.GenerateKey()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\terr = g.setKey(CAKey, caKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcaTemplate := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{g.Organization},\n\t\t\tCommonName: \"Root CA\",\n\t\t},\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\tKeyUsage: x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t}\n\n\tb, err := x509.CreateCertificate(rand.Reader, caTemplate, caTemplate, caKey.Public(), caKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t_ = g.setCert(CACert, b)\n\n\treturn caTemplate, caKey, nil\n}", "title": "" } ]
[ { "docid": "5d48d21e7d4b323586f1f29546e7d43e", "score": "0.7611423", "text": "func GenerateCA(store string) error {\n\tlog.Println(\"[CONFIG] Generating CA\")\n\n\tif store == \"\" {\n\t\treturn errors.New(\"certificates directory not provided\")\n\t}\n\n\tif _, err := os.Stat(store); err != nil {\n\t\treturn fmt.Errorf(\"can't locate certificates directory (%s), %s\", store, err)\n\t}\n\n\tprivateCA, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't generate CA private key: %s\", err)\n\t}\n\n\tprivateCAFile, err := os.OpenFile(filepath.FromSlash(filepath.Join(store, \"ca.key\")), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create CA private key: %s\", err)\n\t}\n\tpem.Encode(privateCAFile, &pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: x509.MarshalPKCS1PrivateKey(privateCA)})\n\tprivateCAFile.Close()\n\n\tpublicCA := &privateCA.PublicKey\n\n\tcsrCA := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1653),\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"IT\"},\n\t\t\tCountry: []string{\"PL\"},\n\t\t\tProvince: []string{\"PL\"},\n\t\t\tLocality: []string{\"City\"},\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().AddDate(10, 0, 0),\n\t\tIsCA: true,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tBasicConstraintsValid: true,\n\t}\n\tcertificateCA, err := x509.CreateCertificate(rand.Reader, csrCA, csrCA, publicCA, privateCA)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't generate CA certificate: %s\", err)\n\t}\n\n\tcertificateFile, err := os.Create(filepath.FromSlash(filepath.Join(store, \"ca.crt\")))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create CA certificate: %s\", err)\n\t}\n\n\tpem.Encode(certificateFile, &pem.Block{Type: \"CERTIFICATE\", Bytes: certificateCA})\n\tcertificateFile.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "6a282b37678ef4d162505040218cce4c", "score": "0.7250498", "text": "func GenerateCertificateAuthority(caType string, save bool) ([]byte, []byte) {\n\tcert, key := GenerateCertificate(\"\", \"\", true, false)\n\tif save {\n\t\tSaveCertificateAuthority(caType, cert, key)\n\t}\n\treturn cert, key\n}", "title": "" }, { "docid": "0fbe52643ed8a1637afaf732954a117c", "score": "0.71962065", "text": "func GenerateCertificateAuthority(caType string) (*x509.Certificate, *ecdsa.PrivateKey) {\n\tstorageDir := getCertDir()\n\tcertFilePath := path.Join(storageDir, fmt.Sprintf(\"%s-ca-cert.pem\", caType))\n\tif _, err := os.Stat(certFilePath); os.IsNotExist(err) {\n\t\t// certsLog.Infof(\"Generating certificate authority for '%s'\", caType)\n\t\tcert, key := GenerateECCCertificate(caType, \"\", true, false)\n\t\tSaveCertificateAuthority(caType, cert, key)\n\t}\n\tcert, key, err := GetCertificateAuthority(caType)\n\tif err != nil {\n\t\t// certsLog.Fatalf(\"Failed to load CA %s\", err)\n\t}\n\treturn cert, key\n}", "title": "" }, { "docid": "ea6f7bda2e4178b50a8121a9f299ae6e", "score": "0.7181152", "text": "func GenerateCA(name string) (certPEM, keyPEM []byte, err error) {\n\tnow := time.Now().UTC()\n\tca := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tSubject: pkix.Name{CommonName: name},\n\t\tNotBefore: now,\n\t\tNotAfter: now.Add(caMaxAge),\n\t\tKeyUsage: caUsage,\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tMaxPathLen: 2,\n\t\tSignatureAlgorithm: x509.SHA256WithRSA,\n\t}\n\n\t// Get KeyPair\n\tkey, err := genKeyPair()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcertBytes, err := x509.CreateCertificate(rand.Reader, ca, ca, key.Public(), key)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcertPEM = pem.EncodeToMemory(&pem.Block{\n\t\tType: \"CERTIFICATE\",\n\t\tBytes: certBytes,\n\t})\n\tkeyPEM = pem.EncodeToMemory(&pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(key),\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "2c5b260915c06f5b43ebbbf901dfa4eb", "score": "0.69615734", "text": "func CreateCertificateAuthority(logger logr.Logger) ([]byte, []byte, error) {\n\treq := csr.CertificateRequest{\n\t\tKeyRequest: &csr.KeyRequest{\n\t\t\tA: \"rsa\",\n\t\t\tS: 2048,\n\t\t},\n\t\tCN: \"octarine_ca\",\n\t\tHosts: []string{\n\t\t\t\"octarine_ca\",\n\t\t},\n\t\tCA: &csr.CAConfig{\n\t\t\tExpiry: \"8760h\",\n\t\t},\n\t}\n\n\tlogger.V(1).Info(\"creating CA\")\n\tcert, _, key, err := initca.New(&req)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn cert, key, nil\n}", "title": "" }, { "docid": "7d66a463836c2406e2cf2fcf043f225d", "score": "0.6881741", "text": "func generateRootCA() (\n\tcaPEM, caPrivKeyPEM []byte, caCert *x509.Certificate, caPrivKey *rsa.PrivateKey, err error,\n) {\n\tcaCert = &x509.Certificate{\n\t\tSerialNumber: big.NewInt(42),\n\t\tSubject: pkix.Name{\n\t\t\tCountry: []string{\"US\"},\n\t\t\tOrganization: []string{\"Agones\"},\n\t\t\tCommonName: \"Test Root CA\",\n\t\t},\n\t\tNotBefore: time.Now().Add(-time.Minute),\n\t\tNotAfter: time.Now().AddDate(1, 0, 0),\n\t\tKeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{\n\t\t\tx509.ExtKeyUsageClientAuth,\n\t\t\tx509.ExtKeyUsageServerAuth,\n\t\t},\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t}\n\n\t// Create CA private and public key\n\tcaPrivKey, err = rsa.GenerateKey(cryptorand.Reader, 4096)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed generate CA RSA key, %w\", err)\n\t}\n\n\t// Create CA certificate\n\tcaBytes, err := x509.CreateCertificate(cryptorand.Reader, caCert, caCert, &caPrivKey.PublicKey, caPrivKey)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed generate CA certificate, %w\", err)\n\t}\n\n\t// PEM encode CA certificate and private key\n\tvar caPEMBuf bytes.Buffer\n\terr = pem.Encode(&caPEMBuf, &pem.Block{\n\t\tType: \"CERTIFICATE\",\n\t\tBytes: caBytes,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to endcode root PEM, %w\", err)\n\t}\n\n\tvar caPrivKeyPEMBuf bytes.Buffer\n\terr = pem.Encode(&caPrivKeyPEMBuf, &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(caPrivKey),\n\t})\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"failed to endcode private root PEM, %w\", err)\n\t}\n\n\treturn caPEMBuf.Bytes(), caPrivKeyPEMBuf.Bytes(), caCert, caPrivKey, nil\n}", "title": "" }, { "docid": "f25f23cd06310c06f2f1ac1794536af1", "score": "0.6849388", "text": "func generateCaCert() error {\n\t// Setup fake cert\n\tos.Mkdir(mirror.GetCADir(), 755)\n\tos.Mkdir(mirror.GetCertDir(), 755)\n\tCaCertPath := filepath.Join(mirror.GetCADir(), \"ca.pem\")\n\tCaKeyPath := filepath.Join(mirror.GetCertDir(), \"key.pem\")\n\ttestOrg := \"test-org\"\n\tbits := 2048\n\tif err := GenerateCACertificate(CaCertPath, CaKeyPath, testOrg, bits); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := os.Stat(CaCertPath); err != nil {\n\t\treturn err\n\t}\n\tif _, err := os.Stat(CaKeyPath); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5cce4344bcbc75f5b0200bb05d9590c9", "score": "0.6847976", "text": "func CA(opts ...CertOption) ([]byte, []byte, error) {\n\topts = append(opts, IsCA())\n\toptions := CertOptions{}\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\ttemplate := &x509.Certificate{\n\t\tSignatureAlgorithm: x509.PureEd25519,\n\t\tSubject: options.Subject,\n\t\tDNSNames: options.DNSNames,\n\t\tIPAddresses: options.IPAddresses,\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tNotBefore: options.NotBefore,\n\t\tNotAfter: options.NotAfter,\n\t\tSerialNumber: options.SerialNumber,\n\t\tBasicConstraintsValid: true,\n\t}\n\tif options.IsCA {\n\t\ttemplate.IsCA = true\n\t\ttemplate.KeyUsage |= x509.KeyUsageCertSign\n\t}\n\tx509Cert, err := x509.CreateCertificate(rand.Reader, template, template, options.Pub, options.Priv)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcert, key := &bytes.Buffer{}, &bytes.Buffer{}\n\tif err := pem.Encode(cert, &pem.Block{Type: \"CERTIFICATE\", Bytes: x509Cert}); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tx509Key, err := x509.MarshalPKCS8PrivateKey(options.Priv)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif err := pem.Encode(key, &pem.Block{Type: \"PRIVATE KEY\", Bytes: x509Key}); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn cert.Bytes(), key.Bytes(), nil\n}", "title": "" }, { "docid": "0194a4093cfc8cd482fae2c31140b15d", "score": "0.6825396", "text": "func CreateCA(root string) {\n\tlog.Infof(\"Creating test root CA in %v\", root)\n\tkey := path.Join(root, \"ca-key.pem\")\n\tcert := path.Join(root, \"ca-cert.pem\")\n\topenssl(\"genrsa\", \"-out\", key)\n\n\tconfig := path.Join(root, \"ca.config\")\n\tif err := ioutil.WriteFile(config, []byte(caConfig), os.ModePerm); err != nil {\n\t\tlog.Fatalf(\"cannot write file %v: %v\", config, err)\n\t}\n\topenssl(\"req\", \"-new\", \"-x509\", \"-nodes\", \"-days\", \"3600\", \"-batch\",\n\t\t\"-config\", config,\n\t\t\"-key\", key,\n\t\t\"-out\", cert)\n}", "title": "" }, { "docid": "f92b52abd88f32a0541b455c4c84b19b", "score": "0.6777729", "text": "func CreateCA(options ...CertOption) (output CertBundle, err error) {\n\toutput.PrivateKey, err = rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\terr = exception.New(err)\n\t\treturn\n\t}\n\toutput.PublicKey = &output.PrivateKey.PublicKey\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tvar serialNumber *big.Int\n\tserialNumber, err = rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\terr = exception.New(err)\n\t\treturn\n\t}\n\n\tcsr := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: \"warden-ca\",\n\t\t\tOrganization: []string{\"Warden\"},\n\t\t\tCountry: []string{\"United States\"},\n\t\t\tProvince: []string{\"California\"},\n\t\t\tLocality: []string{\"San Francisco\"},\n\t\t},\n\t\tNotBefore: time.Now().UTC(),\n\t\tNotAfter: time.Now().UTC().AddDate(10, 0, 0),\n\t\tIsCA: true,\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tBasicConstraintsValid: true,\n\t}\n\n\tfor _, option := range options {\n\t\toption(&csr)\n\t}\n\n\tder, err := x509.CreateCertificate(rand.Reader, &csr, &csr, output.PublicKey, output.PrivateKey)\n\tif err != nil {\n\t\terr = exception.New(err)\n\t\treturn\n\t}\n\tcert, err := x509.ParseCertificate(der)\n\tif err != nil {\n\t\terr = exception.New(err)\n\t\treturn\n\t}\n\toutput.CertificateDERs = [][]byte{der}\n\toutput.Certificates = []x509.Certificate{*cert}\n\treturn\n}", "title": "" }, { "docid": "bcd46f9baa88757bbeca851cbb1639a0", "score": "0.66836303", "text": "func buildCACert(template *x509.Certificate, privateKey *ecdsa.PrivateKey) ([]byte, *x509.Certificate) {\n\ttemplate.IsCA = true\n\ttemplate.KeyUsage = x509.KeyUsageCertSign | x509.KeyUsageCRLSign\n\n\tderBytes := buildCert(template, template, &privateKey.PublicKey, privateKey)\n\n\tcaCert, err := x509.ParseCertificate(derBytes)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to parse CA certificate: %s\", err)\n\t}\n\n\treturn derBytes, caCert\n}", "title": "" }, { "docid": "fefd38d92121f9f5b0d06f13590eaae8", "score": "0.66002995", "text": "func CreateCA(c *mycert) error {\n\tc.cert.IsCA = true\n\tc.cert.KeyUsage = c.cert.KeyUsage | x509.KeyUsageCertSign\n\tc.cert.BasicConstraintsValid = true\n\treturn nil\n}", "title": "" }, { "docid": "6dca2668739195739cf26c4bccb763f9", "score": "0.65582514", "text": "func BuildCA() (cert []byte, key []byte, err error) {\n\tnow := time.Now()\n\n\ttpl := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tSubject: pkixNameFromEnv(),\n\t\tNotBefore: now,\n\t\tNotAfter: now.AddDate(10, 0, 0),\n\t\tIsCA: true,\n\t\tMaxPathLenZero: true,\n\t\tBasicConstraintsValid: true,\n\t}\n\n\treturn buildCert(tpl, tpl, nil)\n}", "title": "" }, { "docid": "b15c3719f2499b6f842dc83b2f1c578b", "score": "0.64741504", "text": "func generateCACertAndPrivateKey(t *testing.T, orgName string) (*x509.Certificate, *ecdsa.PrivateKey) {\n\tserialNumber := generateSerialNumber(t)\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: \"ca.\" + orgName,\n\t\t\tOrganization: []string{orgName},\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().Add(365 * 24 * time.Hour),\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t}\n\treturn generateCertAndPrivateKey(t, template, template, nil)\n}", "title": "" }, { "docid": "1a289cbcacdcfbeb3c180137201aa5bc", "score": "0.6455747", "text": "func genIntermediateCertificateAuthorityECDSA(name string, signKey *ecdsa.PrivateKey,\n\tsignCert *x509.Certificate) (*ecdsa.PrivateKey, *x509.Certificate, error) {\n\n\tfmt.Println(name)\n\tkey, _, err := genKeyECDSA(name)\n\ttemplate, err := x509Template()\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t//this is a CA\n\ttemplate.IsCA = true\n\ttemplate.KeyUsage |= x509.KeyUsageCertSign | x509.KeyUsageCRLSign\n\ttemplate.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}\n\n\t//set the organization for the subject\n\tsubject := subjectTemplate()\n\tsubject.Organization = []string{name}\n\tsubject.CommonName = name\n\n\ttemplate.Subject = subject\n\ttemplate.SubjectKeyId = []byte{1, 2, 3, 4}\n\n\tx509Cert, _, err := genCertificateECDSA(name, &template, signCert, &key.PublicKey, signKey)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn key, x509Cert, nil\n}", "title": "" }, { "docid": "b5a18b02d0e6e2c7fdcd7b2643f039fd", "score": "0.6444865", "text": "func CreateTestCA() (*rsa.PrivateKey, *x509.Certificate, error) {\n\tkey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"rsa.GenerateKey failed: %w\", err)\n\t}\n\n\tca := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: \"test-ca\",\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().AddDate(1, 0, 0),\n\t\tIsCA: true,\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tBasicConstraintsValid: true,\n\t}\n\tcaCert, err := certifyKey(&key.PublicKey, ca, key, ca)\n\n\treturn key, caCert, err\n}", "title": "" }, { "docid": "9ab14a88e979a5889139e387fa0341f3", "score": "0.6425424", "text": "func NewCA(cn string) (*rsa.PrivateKey, *x509.Certificate, error) {\n\tnow := time.Now().Add(-time.Hour)\n\n\tserialNumber, err := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 128))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tNotBefore: now,\n\t\tNotAfter: now.AddDate(5, 0, 0),\n\t\tSubject: pkix.Name{CommonName: cn},\n\t\tBasicConstraintsValid: true,\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment | x509.KeyUsageCertSign,\n\t\tIsCA: true,\n\t}\n\n\tkey, err := NewPrivateKey()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcert, err := newCert(key, template, nil, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn key, cert, nil\n}", "title": "" }, { "docid": "6de8ebea743a8187738a79e144d90b2c", "score": "0.6409294", "text": "func generateRootCA(path string) {\n\tpriv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"can not generate Private Key: %v\", err)\n\t}\n\n\tnotBefore := time.Now()\n\t// Certificate validity set to one year.\n\tnotAfter := notBefore.AddDate(1, 0, 0)\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\n\ttemplate := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"Tracy the Tracer\"},\n\t\t},\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\tIsCA: true,\n\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t\tIPAddresses: []net.IP{net.ParseIP(\"127.0.0.1\")},\n\t}\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, priv.Public(), priv)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to create certificate: %v\", err)\n\t}\n\n\tcertOut, err := os.Create(filepath.Join(path, \"cert.pem\"))\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to open cert.pem for writing: %v\", err)\n\t}\n\n\tpem.Encode(certOut, &pem.Block{Type: \"CERTIFICATE\", Bytes: derBytes})\n\tcertOut.Close()\n\n\tkeyOut, err := os.OpenFile(filepath.Join(path, \"key.pem\"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to open key.pem for writing: %v\", err)\n\t\treturn\n\t}\n\n\tb, err := x509.MarshalECPrivateKey(priv)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to get private key bytes: %v\", err)\n\t\treturn\n\t}\n\n\tpem.Encode(keyOut, &pem.Block{Type: \"EC PRIVATE KEY\", Bytes: b})\n\tkeyOut.Close()\n}", "title": "" }, { "docid": "e6e845f758980c651ec9603e1972a2f0", "score": "0.6363222", "text": "func NewCA(commonName string, organisation string, organisationalUnit string, province string, locality string, streetAddress string, postalCode string) {\n\tvar root models.Root\n\n\tcrc64Table := crc64.MakeTable(crc64.ECMA)\n\tcrc64Int := crc64.Checksum([]byte(commonName+organisation+organisationalUnit+province+locality+streetAddress+postalCode), crc64Table)\n\n\troot.Identifier = strconv.FormatUint(crc64Int, 16)\n\troot.Name = commonName\n\troot.Expiry = time.Now().AddDate(20, 0, 0)\n\troot.SerialNumber = int64(crc64Int >> 32)\n\n\tb, _ := json.Marshal(root)\n\tioutil.WriteFile(\"./cas/\"+root.Identifier+\".json\", b, 0775)\n\n\t// TODO: default configuration for some of the below\n\tca := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(root.SerialNumber),\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: commonName,\n\t\t\tOrganization: []string{organisation},\n\t\t\tCountry: []string{\"GB\"},\n\t\t\tProvince: []string{province},\n\t\t\tLocality: []string{locality},\n\t\t\tStreetAddress: []string{streetAddress},\n\t\t\tPostalCode: []string{postalCode},\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().AddDate(20, 0, 0),\n\t\tIsCA: true,\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\n\tcaPrivKey, err := rsa.GenerateKey(rand.Reader, 4096)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tcaBytes, err := x509.CreateCertificate(rand.Reader, ca, ca, &caPrivKey.PublicKey, caPrivKey)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tcaPEM := new(bytes.Buffer)\n\tpem.Encode(caPEM, &pem.Block{\n\t\tType: \"CERTIFICATE\",\n\t\tBytes: caBytes,\n\t})\n\n\tcaPrivKeyPEM := new(bytes.Buffer)\n\tpem.Encode(caPrivKeyPEM, &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(caPrivKey),\n\t})\n\n\tos.Mkdir(\"./cas/\"+root.Identifier, 0755)\n\n\tioutil.WriteFile(\"./cas/\"+root.Identifier+\"/root.cer\", caPEM.Bytes(), 0755)\n\n\tioutil.WriteFile(\"./cas/\"+root.Identifier+\"/root.key\", caPrivKeyPEM.Bytes(), 0755)\n}", "title": "" }, { "docid": "680cdab543f49a30675b0c1200f9b9ce", "score": "0.6354279", "text": "func (c *Client) CaCertificateCreate(payload *PemCertificateStruct) (string, error) {\nvar err error\nvar result string\nreturn result, err\n}", "title": "" }, { "docid": "160fb44d59ec84610bdf312dd3dad258", "score": "0.6330266", "text": "func CreateCertFromCA(logger logr.Logger, namespacedName types.NamespacedName, caCert []byte, caKey []byte) ([]byte, []byte, error) {\n\t// Parse the ca into an x509 object\n\tparsedCaCert, err := helpers.ParseCertificatePEM(caCert)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tparsedCaKey, err := helpers.ParsePrivateKeyPEM(caKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tsvcFullname := fmt.Sprintf(\"%s.%s.svc\", namespacedName.Name, namespacedName.Namespace)\n\treq := csr.CertificateRequest{\n\t\tKeyRequest: &csr.KeyRequest{\n\t\t\tA: \"rsa\",\n\t\t\tS: 2048,\n\t\t},\n\t\tCN: svcFullname,\n\t\tHosts: []string{\n\t\t\tsvcFullname,\n\t\t},\n\t}\n\tcertReq, key, err := csr.ParseRequest(&req)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tsigner, err := local.NewSigner(parsedCaKey, parsedCaCert, csigner.DefaultSigAlgo(parsedCaKey), nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlogger.V(1).Info(\"signing certficiate\")\n\tsignedCert, err := signer.Sign(csigner.SignRequest{\n\t\tHosts: []string{svcFullname},\n\t\tRequest: string(certReq),\n\t\tSubject: &csigner.Subject{\n\t\t\tCN: svcFullname,\n\t\t},\n\t\tProfile: svcFullname,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn signedCert, key, nil\n}", "title": "" }, { "docid": "1561d131978ad4c6930d372f0684cec1", "score": "0.63024026", "text": "func (c *Client) CaCertificateCreate(payload *PemCertificateStruct) (string, error) {\n\tvar err error\n\tvar result string\n\treturn result, err\n}", "title": "" }, { "docid": "26111d94d3a1579e4412c1a3b917f8be", "score": "0.6236229", "text": "func generateRouterCA() ([]byte, []byte, error) {\n\tsignerName := fmt.Sprintf(\"%s@%d\", \"ingress-operator\", time.Now().Unix())\n\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to generate key: %v\", err)\n\t}\n\n\troot := &x509.Certificate{\n\t\tSubject: pkix.Name{CommonName: signerName},\n\n\t\tSignatureAlgorithm: x509.SHA256WithRSA,\n\n\t\tNotBefore: time.Now().Add(-1 * time.Second),\n\t\tNotAfter: time.Now().Add(2 * 365 * 24 * time.Hour),\n\t\tSerialNumber: big.NewInt(1),\n\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tBasicConstraintsValid: true,\n\n\t\tIsCA: true,\n\n\t\t// Don't allow the CA to be used to make another CA.\n\t\tMaxPathLen: 0,\n\t\tMaxPathLenZero: true,\n\t}\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, root, root, &privateKey.PublicKey, privateKey)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create certificate: %v\", err)\n\t}\n\n\tcerts, err := x509.ParseCertificates(derBytes)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to parse certificate: %v\", err)\n\t}\n\n\tif len(certs) != 1 {\n\t\treturn nil, nil, fmt.Errorf(\"expected a single certificate\")\n\t}\n\n\tcertBytes := pem.EncodeToMemory(&pem.Block{\n\t\tType: \"CERTIFICATE\",\n\t\tBytes: certs[0].Raw,\n\t})\n\n\tkeyBytes := pem.EncodeToMemory(&pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(privateKey),\n\t})\n\n\treturn certBytes, keyBytes, nil\n}", "title": "" }, { "docid": "dbd4d744d273039c792c322b1022dc2e", "score": "0.62074083", "text": "func New(request client.APICertificateRequest) ([]byte, []byte, error) {\n\n\tvar (\n\t\tca CA\n\t\tcaCert, caKey []byte\n\t\terr error\n\t)\n\n\t// validation - request has the minimal required values\n\tif !valid(request) {\n\t\treturn []byte{}, []byte{}, rest.ErrBadRequest\n\t}\n\n\tca.ca = APITox509Certificate(request)\n\n\tca.caKey, err = apiToCryptoKey(request)\n\tif err != nil {\n\t\treturn []byte{}, []byte{}, err\n\t}\n\n\tca.ca.IsCA = true\n\tca.ca.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}\n\tca.ca.KeyUsage = x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign\n\tca.ca.BasicConstraintsValid = true\n\tca.ca.MaxPathLenZero = true\n\n\tspkiASN1, err := x509.MarshalPKIXPublicKey(ca.caKey.(crypto.Signer).Public())\n\tif err != nil {\n\t\treturn []byte{}, []byte{}, err\n\t}\n\n\tvar spki struct {\n\t\tAlgorithm pkix.AlgorithmIdentifier\n\t\tSubjectPublicKey asn1.BitString\n\t}\n\t_, err = asn1.Unmarshal(spkiASN1, &spki)\n\tif err != nil {\n\t\treturn []byte{}, []byte{}, err\n\t}\n\n\tskid := sha1.Sum(spki.SubjectPublicKey.Bytes)\n\n\tca.ca.SubjectKeyId = skid[:]\n\n\tcaCert, caKey, err = ca.CreateCertificate(ca.ca, ca.caKey)\n\tif err != nil {\n\t\treturn []byte{}, []byte{}, err\n\t}\n\n\tca.bytesCertificate = caCert\n\n\treturn caCert, caKey, err\n\n}", "title": "" }, { "docid": "6eba379020d0b2936663e4ae422f9931", "score": "0.6200004", "text": "func (c *SoftCAS) CreateCertificateAuthority(req *apiv1.CreateCertificateAuthorityRequest) (*apiv1.CreateCertificateAuthorityResponse, error) {\n\tswitch {\n\tcase req.Template == nil:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `template` cannot be nil\")\n\tcase req.Lifetime == 0:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `lifetime` cannot be 0\")\n\tcase req.Type == apiv1.IntermediateCA && req.Parent == nil:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `parent` cannot be nil\")\n\tcase req.Type == apiv1.IntermediateCA && req.Parent.Certificate == nil:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `parent.template` cannot be nil\")\n\tcase req.Type == apiv1.IntermediateCA && req.Parent.Signer == nil:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `parent.signer` cannot be nil\")\n\t}\n\n\tkey, err := c.createKey(req.CreateKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsigner, err := c.createSigner(&key.CreateSignerRequest)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := now()\n\tif req.Template.NotBefore.IsZero() {\n\t\treq.Template.NotBefore = t.Add(-1 * req.Backdate)\n\t}\n\tif req.Template.NotAfter.IsZero() {\n\t\treq.Template.NotAfter = t.Add(req.Lifetime)\n\t}\n\n\tvar cert *x509.Certificate\n\tswitch req.Type {\n\tcase apiv1.RootCA:\n\t\tcert, err = createCertificate(req.Template, req.Template, signer.Public(), signer)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase apiv1.IntermediateCA:\n\t\tcert, err = createCertificate(req.Template, req.Parent.Certificate, signer.Public(), req.Parent.Signer)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, errors.Errorf(\"createCertificateAuthorityRequest `type=%d' is invalid or not supported\", req.Type)\n\t}\n\n\t// Add the parent\n\tvar chain []*x509.Certificate\n\tif req.Parent != nil {\n\t\tchain = append(chain, req.Parent.Certificate)\n\t\tchain = append(chain, req.Parent.CertificateChain...)\n\t}\n\n\treturn &apiv1.CreateCertificateAuthorityResponse{\n\t\tName: cert.Subject.CommonName,\n\t\tCertificate: cert,\n\t\tCertificateChain: chain,\n\t\tKeyName: key.Name,\n\t\tPublicKey: key.PublicKey,\n\t\tPrivateKey: key.PrivateKey,\n\t\tSigner: signer,\n\t}, nil\n}", "title": "" }, { "docid": "3921db4026893f562750c7894f2f356c", "score": "0.61827713", "text": "func EnsureCA(certFile, keyFile, name string, expireDays int) (*CA, bool, error) {\n\tif ca, err := GetCA(certFile, keyFile); err == nil {\n\t\treturn ca, false, err\n\t}\n\tca, err := MakeCA(certFile, keyFile, name, expireDays)\n\treturn ca, true, err\n}", "title": "" }, { "docid": "59e29716f51ba25d868a72ce453fac1a", "score": "0.61614007", "text": "func (ca *RootCertificateAuthority) Generate() error {\n\t// ensure functions are defined\n\tif ca.generateKey == nil || ca.generateCertificate == nil || ca.generateSerialNumber == nil {\n\t\treturn ErrFunctionNotImplemented\n\t}\n\n\t// generate a private key\n\tif privateKey, err := ca.generateKey(); err != nil {\n\t\treturn err\n\t} else {\n\t\tca.PrivateKey = NewPrivateKey(privateKey)\n\t}\n\n\t// generate a serial number\n\tserialNumber, err := ca.generateSerialNumber()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// generate a certificate\n\tif certificate, err := ca.generateCertificate(ca.PrivateKey.PrivateKey, serialNumber); err != nil {\n\t\treturn err\n\t} else {\n\t\tca.Certificate = &Certificate{Certificate: certificate}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fe54456e54ff4d8b58219b87a91d9723", "score": "0.61541104", "text": "func generateCertAndPrivateKeyFromCACert(t *testing.T, orgName string, caCert *x509.Certificate, privateKey *ecdsa.PrivateKey) (*x509.Certificate, *ecdsa.PrivateKey) {\n\tserialNumber := generateSerialNumber(t)\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: \"user.\" + orgName,\n\t\t\tOrganization: []string{orgName},\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().Add(365 * 24 * time.Hour),\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\treturn generateCertAndPrivateKey(t, template, caCert, privateKey)\n}", "title": "" }, { "docid": "51bfe16691054da8d8815049be5ded8c", "score": "0.6152704", "text": "func GenCertificateAuthorityECDSA(name string) (*ecdsa.PrivateKey, *x509.Certificate, []byte, error) {\n\n\tkey, _, err := genKeyECDSA(name)\n\ttemplate, err := x509Template()\n\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t//this is a CA\n\ttemplate.IsCA = true\n\ttemplate.KeyUsage |= x509.KeyUsageCertSign | x509.KeyUsageCRLSign\n\ttemplate.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}\n\n\t//set the organization for the subject\n\tsubject := subjectTemplate()\n\tsubject.Organization = []string{name}\n\tsubject.CommonName = name\n\n\ttemplate.Subject = subject\n\ttemplate.SubjectKeyId = []byte{1, 2, 3, 4}\n\n\tx509Cert, certBytes, err := genCertificateECDSA(name, &template, &template, &key.PublicKey, key)\n\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\treturn key, x509Cert, certBytes, nil\n}", "title": "" }, { "docid": "954f83cb1c7a2665cfcb2ceaeff6ec36", "score": "0.61410886", "text": "func (pki *MicroPkI) CreateCertificateAuthority(key *rsa.PrivateKey, organizationalUnit string, years int, organization string, country string, province string, locality string, commonName string) (*x509.Certificate, error) {\n\tsubjectKeyID, err := pki.GenerateSubjectKeyID(key.Public)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tauthTemplate.SubjectKeyId = subjectKeyID\n\tauthTemplate.NotAfter = time.Now().AddDate(years, 0, 0).UTC()\n\tif len(country) > 0 {\n\t\tauthTemplate.Subject.Country = []string{country}\n\t}\n\tif len(province) > 0 {\n\t\tauthTemplate.Subject.Province = []string{province}\n\t}\n\tif len(locality) > 0 {\n\t\tauthTemplate.Subject.Locality = []string{locality}\n\t}\n\tif len(organization) > 0 {\n\t\tauthTemplate.Subject.Organization = []string{organization}\n\t}\n\tif len(organizationalUnit) > 0 {\n\t\tauthTemplate.Subject.OrganizationalUnit = []string{organizationalUnit}\n\t}\n\tif len(commonName) > 0 {\n\t\tauthTemplate.Subject.CommonName = commonName\n\t}\n\n\tcrtBytes, err := x509.CreateCertificate(rand.Reader, &authTemplate, &authTemplate, key.PublicKey, key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tca, err := LoadCertificatefromDerBytes(crtBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ca, nil\n}", "title": "" }, { "docid": "f97bc5a5129f6d7d7a95923860d7b9f0", "score": "0.6120656", "text": "func CreateCAPair(\n\tcertsDir, caKeyPath string,\n\tkeySize int,\n\tlifetime time.Duration,\n\tallowKeyReuse bool,\n\toverwrite bool,\n) error {\n\tif len(caKeyPath) == 0 {\n\t\treturn errors.New(\"the path to the CA key is required\")\n\t}\n\tif len(certsDir) == 0 {\n\t\treturn errors.New(\"the path to the certs directory is required\")\n\t}\n\n\t// The certificate manager expands the env for the certs directory.\n\t// For consistency, we need to do this for the key as well.\n\tcaKeyPath = os.ExpandEnv(caKeyPath)\n\n\t// Create a certificate manager with \"create dir if not exist\".\n\tcm, err := NewCertificateManagerFirstRun(certsDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar key crypto.PrivateKey\n\tif _, err := os.Stat(caKeyPath); err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn errors.Errorf(\"could not stat CA key file %s: %v\", caKeyPath, err)\n\t\t}\n\n\t\t// The key does not exist: create it.\n\t\tkey, err = rsa.GenerateKey(rand.Reader, keySize)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"could not generate new CA key: %v\", err)\n\t\t}\n\n\t\t// overwrite is not technically needed here, but use it in case something else created it.\n\t\tif err := writeKeyToFile(caKeyPath, key, overwrite); err != nil {\n\t\t\treturn errors.Errorf(\"could not write CA key to file %s: %v\", caKeyPath, err)\n\t\t}\n\n\t\tlog.Infof(context.Background(), \"Generated CA key %s\", caKeyPath)\n\t} else {\n\t\tif !allowKeyReuse {\n\t\t\treturn errors.Errorf(\"CA key %s exists, but key reuse is disabled\", caKeyPath)\n\t\t}\n\t\t// The key exists, parse it.\n\t\tcontents, err := ioutil.ReadFile(caKeyPath)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"could not read CA key file %s: %v\", caKeyPath, err)\n\t\t}\n\n\t\tkey, err = PEMToPrivateKey(contents)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"could not parse CA key file %s: %v\", caKeyPath, err)\n\t\t}\n\n\t\tlog.Infof(context.Background(), \"Using CA key from file %s\", caKeyPath)\n\t}\n\n\t// Generate certificate.\n\tcertContents, err := GenerateCA(key.(crypto.Signer), lifetime)\n\tif err != nil {\n\t\treturn errors.Errorf(\"could not generate CA certificate: %v\", err)\n\t}\n\n\tcertPath := cm.CACertPath()\n\n\tvar existingCertificates []*pem.Block\n\tif _, err := os.Stat(certPath); err == nil {\n\t\t// The cert file already exists, load certificates.\n\t\tcontents, err := ioutil.ReadFile(certPath)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"could not read existing CA cert file %s: %v\", certPath, err)\n\t\t}\n\n\t\texistingCertificates, err = PEMToCertificates(contents)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"could not parse existing CA cert file %s: %v\", certPath, err)\n\t\t}\n\t\tlog.Infof(context.Background(), \"Found %d certificates in %s\",\n\t\t\tlen(existingCertificates), certPath)\n\t} else if !os.IsNotExist(err) {\n\t\treturn errors.Errorf(\"could not stat CA cert file %s: %v\", certPath, err)\n\t}\n\n\t// Always place the new certificate first.\n\tcertificates := []*pem.Block{{Type: \"CERTIFICATE\", Bytes: certContents}}\n\tcertificates = append(certificates, existingCertificates...)\n\n\tif err := WritePEMToFile(certPath, certFileMode, overwrite, certificates...); err != nil {\n\t\treturn errors.Errorf(\"could not write CA certificate file %s: %v\", certPath, err)\n\t}\n\n\tlog.Infof(context.Background(), \"Wrote %d certificates to %s\", len(certificates), certPath)\n\n\treturn nil\n}", "title": "" }, { "docid": "bbfca1e205942989b2cd669fee5dfbb9", "score": "0.60998344", "text": "func (c *Cert) CreateAsCA(node *Node, ic *kubeadmapi.InitConfiguration) error {\n\tcfg, err := c.GetConfig(node, ic)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't get configuration for %q CA certificate\", c.Name)\n\t}\n\tc.Cert, c.Key, err = pkiutil.NewCertificateAuthority(cfg)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't generate %q CA certificate\", c.Name)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "86ccd0b2b418a35df62f7b25368df6cf", "score": "0.6090713", "text": "func (g *GeneratesCertsMock) GetCA() *CA { return g.ca }", "title": "" }, { "docid": "f10e44a6c03564475cacaaeb49943210", "score": "0.60846484", "text": "func GenerateCertificate(privateKeyBuilder PrivateKeyBuilder, hosts []string, validFrom time.Time, validFor time.Duration, isCA bool) ([]byte, []byte, error) {\n\tprivateKey, err := privateKeyBuilder.Build()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to build private key: %w\", err)\n\t}\n\n\tnotBefore := validFrom\n\tnotAfter := validFrom.Add(validFor)\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to generate serial number: %v\", err)\n\t}\n\n\ttemplate := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"Acme Co\"},\n\t\t},\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\n\tfor _, h := range hosts {\n\t\tif ip := net.ParseIP(h); ip != nil {\n\t\t\ttemplate.IPAddresses = append(template.IPAddresses, ip)\n\t\t} else {\n\t\t\ttemplate.DNSNames = append(template.DNSNames, h)\n\t\t}\n\t}\n\n\tif isCA {\n\t\ttemplate.IsCA = true\n\t\ttemplate.KeyUsage |= x509.KeyUsageCertSign\n\t}\n\n\tcertDERBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(privateKey), privateKey)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create certificate: %v\", err)\n\t}\n\n\tcertPEMBytes, err := ConvertDERToPEM(certDERBytes, Certificate)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"faile to convert certificate in DER format into PEM: %v\", err)\n\t}\n\n\tkeyDERBytes, err := x509.MarshalPKCS8PrivateKey(privateKey)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to marshal private key: %v\", err)\n\t}\n\n\tkeyPEMBytes, err := ConvertDERToPEM(keyDERBytes, PrivateKey)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"faile to convert certificate in DER format into PEM: %v\", err)\n\t}\n\n\treturn certPEMBytes, keyPEMBytes, nil\n}", "title": "" }, { "docid": "fe54c046ea2bddddc86c29a025d5115f", "score": "0.6081108", "text": "func (a *EtcdCA) Generate(dependencies asset.Parents) error {\n\trootCA := &RootCA{}\n\tdependencies.Get(rootCA)\n\n\tcfg := &CertCfg{\n\t\tSubject: pkix.Name{CommonName: \"etcd\", OrganizationalUnit: []string{\"etcd\"}},\n\t\tKeyUsages: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tValidity: ValidityTenYears,\n\t\tIsCA: true,\n\t}\n\n\treturn a.CertKey.Generate(cfg, rootCA, \"etcd-client-ca\", DoNotAppendParent)\n}", "title": "" }, { "docid": "950a7955012bc82d49f05d80c671e663", "score": "0.60740495", "text": "func (t Authority) Create(duration time.Duration, bits int, options ...tlsx.X509Option) (ca, key, cert []byte, err error) {\n\tvar (\n\t\ttemplate x509.Certificate\n\t\tgenerated *rsa.PrivateKey\n\t\tkeybuf = bytes.NewBufferString(\"\")\n\t\tcertbuf = bytes.NewBufferString(\"\")\n\t\tcabuf = bytes.NewBufferString(\"\")\n\t)\n\n\tif template, err = tlsx.X509Template(duration, options...); err != nil {\n\t\treturn ca, key, cert, err\n\t}\n\n\tif generated, cert, err = tlsx.SignedRSAGen(bits, template, *t.CACert, t.CAKey); err != nil {\n\t\treturn ca, key, cert, err\n\t}\n\n\tif err = tlsx.WritePrivateKey(keybuf, generated); err != nil {\n\t\treturn ca, key, cert, err\n\t}\n\n\tif err = tlsx.WriteCertificate(certbuf, cert); err != nil {\n\t\treturn ca, key, cert, err\n\t}\n\n\tif err = tlsx.WriteCertificate(cabuf, t.CACert.Raw); err != nil {\n\t\treturn ca, key, cert, err\n\t}\n\n\treturn cabuf.Bytes(), keybuf.Bytes(), certbuf.Bytes(), err\n}", "title": "" }, { "docid": "628ad5c819c511e5cfb0c1618a136ec1", "score": "0.6072409", "text": "func (c *CA) CreateCertificate(request *x509.Certificate, key crypto.PrivateKey) ([]byte, []byte, error) {\n\n\tvar (\n\t\tcertBytes []byte\n\t\terr error\n\t)\n\n\tif request.Subject.CommonName == \"\" {\n\t\treturn []byte{}, []byte{}, ErrCommonNameBlank\n\t}\n\n\tswitch key.(type) {\n\tcase *rsa.PrivateKey:\n\t\tcertBytes, err = x509.CreateCertificate(rand.Reader, request, c.ca, &key.(*rsa.PrivateKey).PublicKey, c.caKey)\n\tcase *ecdsa.PrivateKey:\n\t\tcertBytes, err = x509.CreateCertificate(rand.Reader, request, c.ca, &key.(*ecdsa.PrivateKey).PublicKey, c.caKey)\n\tdefault:\n\t\treturn []byte{}, []byte{}, ErrKeyInvalid\n\t}\n\n\tif err != nil {\n\t\treturn []byte{}, []byte{}, err\n\t}\n\n\tcertPEM := new(bytes.Buffer)\n\n\terr = pem.Encode(certPEM, &pem.Block{\n\t\tType: FileCertificate,\n\t\tBytes: certBytes,\n\t})\n\n\tif err != nil {\n\t\treturn []byte{}, []byte{}, err\n\t}\n\n\tcertPrivKeyPEM := new(bytes.Buffer)\n\tcertPrivKeyBytes, err := x509.MarshalPKCS8PrivateKey(key)\n\tpem.Encode(certPrivKeyPEM, &pem.Block{\n\t\tType: FilePrivateKey,\n\t\tBytes: certPrivKeyBytes,\n\t})\n\n\treturn certPEM.Bytes(), certPrivKeyPEM.Bytes(), nil\n\n}", "title": "" }, { "docid": "2f151bdac18667376010854f5b33ad9c", "score": "0.60580695", "text": "func GenerateCerts(t *testing.T) (string, string) {\n\tt.Helper()\n\n\trootCA := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().AddDate(0, 0, 1),\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tIPAddresses: []net.IP{net.ParseIP(\"0.0.0.0\"), net.ParseIP(\"127.0.0.1\"), net.ParseIP(\"::1\"), net.ParseIP(\"::\")},\n\t\tDNSNames: []string{\"localhost\"},\n\t\tKeyUsage: x509.KeyUsageCertSign,\n\t}\n\n\tcaKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\trequire.NoError(t, err)\n\n\tcaCert, err := x509.CreateCertificate(rand.Reader, rootCA, rootCA, &caKey.PublicKey, caKey)\n\trequire.NoError(t, err)\n\n\tentityKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\trequire.NoError(t, err)\n\n\tentityX509 := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(2),\n\t}\n\n\tentityCert, err := x509.CreateCertificate(rand.Reader, rootCA, entityX509, &entityKey.PublicKey, caKey)\n\trequire.NoError(t, err)\n\n\tcertFile, err := os.CreateTemp(testDirectory, \"\")\n\trequire.NoError(t, err)\n\tdefer MustClose(t, certFile)\n\tt.Cleanup(func() {\n\t\trequire.NoError(t, os.Remove(certFile.Name()))\n\t})\n\n\t// create chained PEM file with CA and entity cert\n\tfor _, cert := range [][]byte{entityCert, caCert} {\n\t\trequire.NoError(t,\n\t\t\tpem.Encode(certFile, &pem.Block{\n\t\t\t\tType: \"CERTIFICATE\",\n\t\t\t\tBytes: cert,\n\t\t\t}),\n\t\t)\n\t}\n\n\tkeyFile, err := os.CreateTemp(testDirectory, \"\")\n\trequire.NoError(t, err)\n\tdefer MustClose(t, keyFile)\n\tt.Cleanup(func() {\n\t\trequire.NoError(t, os.Remove(keyFile.Name()))\n\t})\n\n\tentityKeyBytes, err := x509.MarshalECPrivateKey(entityKey)\n\trequire.NoError(t, err)\n\n\trequire.NoError(t,\n\t\tpem.Encode(keyFile, &pem.Block{\n\t\t\tType: \"ECDSA PRIVATE KEY\",\n\t\t\tBytes: entityKeyBytes,\n\t\t}),\n\t)\n\n\treturn certFile.Name(), keyFile.Name()\n}", "title": "" }, { "docid": "971932c7a205b2791c836335a736b258", "score": "0.6055404", "text": "func (c *CloudCAS) CreateCertificateAuthority(req *apiv1.CreateCertificateAuthorityRequest) (*apiv1.CreateCertificateAuthorityResponse, error) {\n\tswitch {\n\tcase c.project == \"\":\n\t\treturn nil, errors.New(\"cloudCAS `project` cannot be empty\")\n\tcase c.location == \"\":\n\t\treturn nil, errors.New(\"cloudCAS `location` cannot be empty\")\n\tcase c.caPool == \"\":\n\t\treturn nil, errors.New(\"cloudCAS `caPool` cannot be empty\")\n\tcase c.caPoolTier == 0:\n\t\treturn nil, errors.New(\"cloudCAS `caPoolTier` cannot be empty\")\n\tcase req.Template == nil:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `template` cannot be nil\")\n\tcase req.Lifetime == 0:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `lifetime` cannot be 0\")\n\tcase req.Type == apiv1.IntermediateCA && req.Parent == nil:\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `parent` cannot be nil\")\n\tcase req.Type == apiv1.IntermediateCA && req.Parent.Name == \"\" && (req.Parent.Certificate == nil || req.Parent.Signer == nil):\n\t\treturn nil, errors.New(\"createCertificateAuthorityRequest `parent.name` cannot be empty\")\n\t}\n\n\tvar caType pb.CertificateAuthority_Type\n\tswitch req.Type {\n\tcase apiv1.RootCA:\n\t\tcaType = pb.CertificateAuthority_SELF_SIGNED\n\tcase apiv1.IntermediateCA:\n\t\tcaType = pb.CertificateAuthority_SUBORDINATE\n\tdefault:\n\t\treturn nil, errors.Errorf(\"createCertificateAuthorityRequest `type=%d' is invalid or not supported\", req.Type)\n\t}\n\n\t// Select key and signature algorithm to use\n\tvar err error\n\tvar keySpec *pb.CertificateAuthority_KeyVersionSpec\n\tif req.CreateKey == nil {\n\t\tif keySpec, err = createKeyVersionSpec(0, 0); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"createCertificateAuthorityRequest `createKey` is not valid\")\n\t\t}\n\t} else {\n\t\tif keySpec, err = createKeyVersionSpec(req.CreateKey.SignatureAlgorithm, req.CreateKey.Bits); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"createCertificateAuthorityRequest `createKey` is not valid\")\n\t\t}\n\t}\n\n\t// Normalize or generate id.\n\tcaID := normalizeCertificateAuthorityName(req.Name)\n\tif caID == \"\" {\n\t\tid, err := createCertificateID()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcaID = id\n\t}\n\n\t// Add CertificateAuthority extension\n\tcasExtension, err := apiv1.CreateCertificateAuthorityExtension(apiv1.CloudCAS, caID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Template.ExtraExtensions = append(req.Template.ExtraExtensions, casExtension)\n\n\t// Create the caPool if necessary\n\tparent, err := c.createCaPoolIfNecessary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Prepare CreateCertificateAuthorityRequest\n\tpbReq := &pb.CreateCertificateAuthorityRequest{\n\t\tParent: parent,\n\t\tCertificateAuthorityId: caID,\n\t\tRequestId: req.RequestID,\n\t\tCertificateAuthority: &pb.CertificateAuthority{\n\t\t\tType: caType,\n\t\t\tConfig: &pb.CertificateConfig{\n\t\t\t\tSubjectConfig: &pb.CertificateConfig_SubjectConfig{\n\t\t\t\t\tSubject: createSubject(req.Template),\n\t\t\t\t\tSubjectAltName: createSubjectAlternativeNames(req.Template),\n\t\t\t\t},\n\t\t\t\tX509Config: createX509Parameters(req.Template),\n\t\t\t},\n\t\t\tLifetime: durationpb.New(req.Lifetime),\n\t\t\tKeySpec: keySpec,\n\t\t\tGcsBucket: c.gcsBucket,\n\t\t\tLabels: map[string]string{},\n\t\t},\n\t}\n\n\t// Create certificate authority.\n\tctx, cancel := defaultContext()\n\tdefer cancel()\n\n\tresp, err := c.client.CreateCertificateAuthority(ctx, pbReq)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cloudCAS CreateCertificateAuthority failed\")\n\t}\n\n\t// Wait for the long-running operation.\n\tctx, cancel = defaultInitiatorContext()\n\tdefer cancel()\n\n\tca, err := resp.Wait(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cloudCAS CreateCertificateAuthority failed\")\n\t}\n\n\t// Sign Intermediate CAs with the parent.\n\tif req.Type == apiv1.IntermediateCA {\n\t\tca, err = c.signIntermediateCA(parent, ca.Name, req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Enable Certificate Authority.\n\tca, err = c.enableCertificateAuthority(ca)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ca.PemCaCertificates) == 0 {\n\t\treturn nil, errors.New(\"cloudCAS CreateCertificateAuthority failed: PemCaCertificates is empty\")\n\t}\n\n\tcert, err := parseCertificate(ca.PemCaCertificates[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar chain []*x509.Certificate\n\tif pemChain := ca.PemCaCertificates[1:]; len(pemChain) > 0 {\n\t\tchain = make([]*x509.Certificate, len(pemChain))\n\t\tfor i, s := range pemChain {\n\t\t\tif chain[i], err = parseCertificate(s); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &apiv1.CreateCertificateAuthorityResponse{\n\t\tName: ca.Name,\n\t\tCertificate: cert,\n\t\tCertificateChain: chain,\n\t}, nil\n}", "title": "" }, { "docid": "f4567125de6d23296c1fd4201f4c533d", "score": "0.60467446", "text": "func GenerateCert(ca *tls.Certificate, hosts ...string) (*tls.Certificate, error) {\n\tnow := time.Now().Add(-1 * time.Hour).UTC()\n\tif !ca.Leaf.IsCA {\n\t\treturn nil, errors.New(\"CA cert is not a CA\")\n\t}\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to generate serial number: %s\", err)\n\t}\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{CommonName: hosts[0]},\n\t\tNotBefore: now,\n\t\tNotAfter: now.Add(leafMaxAge),\n\t\tKeyUsage: leafUsage,\n\t\tBasicConstraintsValid: true,\n\t}\n\n\tfor _, h := range hosts {\n\t\tif ip := net.ParseIP(h); ip != nil {\n\t\t\ttemplate.IPAddresses = append(template.IPAddresses, ip)\n\t\t} else {\n\t\t\ttemplate.DNSNames = append(template.DNSNames, h)\n\t\t}\n\t}\n\n\tkey, err := genKeyPair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tx, err := x509.CreateCertificate(rand.Reader, template, ca.Leaf, key.Public(), ca.PrivateKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcert := new(tls.Certificate)\n\tcert.Certificate = append(cert.Certificate, x)\n\tcert.PrivateKey = key\n\tcert.Leaf, _ = x509.ParseCertificate(x)\n\treturn cert, nil\n}", "title": "" }, { "docid": "bb4e4a95fa76bf81f92c90d2d8dc4c0c", "score": "0.60393155", "text": "func NewCA(\n\tbaseDir,\n\torg,\n\tname,\n\tcountry,\n\tprovince,\n\tlocality,\n\torgUnit,\n\tstreetAddress,\n\tpostalCode string,\n) (*CA, error) {\n\tvar ca *CA\n\n\terr := os.MkdirAll(baseDir, 0o755)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpriv, err := csp.GeneratePrivateKey(baseDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttemplate := x509Template()\n\t// this is a CA\n\ttemplate.IsCA = true\n\ttemplate.KeyUsage |= x509.KeyUsageDigitalSignature |\n\t\tx509.KeyUsageKeyEncipherment | x509.KeyUsageCertSign |\n\t\tx509.KeyUsageCRLSign\n\ttemplate.ExtKeyUsage = []x509.ExtKeyUsage{\n\t\tx509.ExtKeyUsageClientAuth,\n\t\tx509.ExtKeyUsageServerAuth,\n\t}\n\n\t// set the organization for the subject\n\tsubject := subjectTemplateAdditional(country, province, locality, orgUnit, streetAddress, postalCode)\n\tsubject.Organization = []string{org}\n\tsubject.CommonName = name\n\n\ttemplate.Subject = subject\n\ttemplate.SubjectKeyId = computeSKI(priv)\n\n\tx509Cert, err := genCertificateECDSA(\n\t\tbaseDir,\n\t\tname,\n\t\t&template,\n\t\t&template,\n\t\t&priv.PublicKey,\n\t\tpriv,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tca = &CA{\n\t\tName: name,\n\t\tSigner: &csp.ECDSASigner{\n\t\t\tPrivateKey: priv,\n\t\t},\n\t\tSignCert: x509Cert,\n\t\tCountry: country,\n\t\tProvince: province,\n\t\tLocality: locality,\n\t\tOrganizationalUnit: orgUnit,\n\t\tStreetAddress: streetAddress,\n\t\tPostalCode: postalCode,\n\t}\n\n\treturn ca, err\n}", "title": "" }, { "docid": "b35272106996723178d8ea0585ee979c", "score": "0.6032313", "text": "func (s *Server) GetCa(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif s.CA.PolicyGen == nil {\n\t\tError(w, Problem{\n\t\t\tDetail: api.StringRef(\"This instance is not configured with CA capability\"),\n\t\t\tStatus: http.StatusNotImplemented,\n\t\t\tTitle: \"Not a CA\",\n\t\t\tType: api.StringRef(api.NotImplemented),\n\t\t})\n\t\treturn\n\t}\n\n\tp, err := s.CA.PolicyGen.Generate(r.Context())\n\tif err != nil {\n\t\tError(w, Problem{\n\t\t\tDetail: api.StringRef(err.Error()),\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tTitle: \"No active signer\",\n\t\t\tType: api.StringRef(api.InternalError),\n\t\t})\n\t\treturn\n\t}\n\tia, err := cppki.ExtractIA(p.Certificate.Subject)\n\tif err != nil {\n\t\tError(w, Problem{\n\t\t\tDetail: api.StringRef(err.Error()),\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tTitle: \"Unable to extract ISD-AS\",\n\t\t\tType: api.StringRef(api.InternalError),\n\t\t})\n\t\treturn\n\t}\n\trep := CA{\n\t\tCertValidity: Validity{\n\t\t\tNotAfter: p.Certificate.NotAfter,\n\t\t\tNotBefore: p.Certificate.NotBefore,\n\t\t},\n\t\tPolicy: Policy{\n\t\t\tChainLifetime: p.Validity.String(),\n\t\t},\n\t\tSubject: Subject{\n\t\t\tIsdAs: IsdAs(ia.String()),\n\t\t},\n\t\tSubjectKeyId: SubjectKeyID(fmt.Sprintf(\"% X\", p.Certificate.SubjectKeyId)),\n\t}\n\tenc := json.NewEncoder(w)\n\tenc.SetIndent(\"\", \" \")\n\tif err := enc.Encode(rep); err != nil {\n\t\tError(w, Problem{\n\t\t\tDetail: api.StringRef(err.Error()),\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tTitle: \"unable to marshal response\",\n\t\t\tType: api.StringRef(api.InternalError),\n\t\t})\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "34ae88a363e399f16ea616a8939fea9b", "score": "0.6023097", "text": "func CreateCAHandler(c *gin.Context) {\r\n\tcertInfo := cert.CertInfo{}\r\n\terr := c.BindJSON(&certInfo)\r\n\tif err != nil {\r\n\t\tlog.Println(\"could not parse json\")\r\n\t\thandleError(c, err)\r\n\t\treturn\r\n\t}\r\n\r\n\t// Get pem and key from cert.go\r\n\tcaId, err := cert.GenerateRootCertificate(certInfo)\r\n\tif err != nil {\r\n\t\tlog.Println(\"could not generate cert\")\r\n\t\thandleError(c, err)\r\n\t\treturn\r\n\t}\r\n\tc.JSON(http.StatusOK, gin.H{\"id\": caId})\r\n}", "title": "" }, { "docid": "6d5bfec2b302a03688d1cdf7a079aa3c", "score": "0.60207635", "text": "func CertificateAuthority() string {\n\treturn files.CA\n}", "title": "" }, { "docid": "2e8c5ffe0ba88f0caa9d8d27f7c3e9da", "score": "0.5984887", "text": "func makeTestCACert() (*x509.Certificate, []byte, error) {\n\tkey, err := rsa.GenerateKey(rand.Reader, 512)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcertBytes, err := security.GenerateCA(key, time.Hour*48)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tx509Cert, err := x509.ParseCertificate(certBytes)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcertBlock := &pem.Block{Type: \"CERTIFICATE\", Bytes: certBytes}\n\treturn x509Cert, pem.EncodeToMemory(certBlock), nil\n}", "title": "" }, { "docid": "415c367f82a151dae9d0278abc5ae276", "score": "0.59688115", "text": "func GenerateSelfSignedCA(entity pkix.Name, dnsNames []string, ttl time.Duration) ([]byte, []byte, error) {\n\tpriv, err := rsa.GenerateKey(rand.Reader, constants.DefaultRSABits)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\tnotBefore := time.Now()\n\tnotAfter := notBefore.Add(ttl)\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\ttemplate := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tIssuer: entity,\n\t\tSubject: entity,\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tDNSNames: dnsNames,\n\t}\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\tkeyPEM := pem.EncodeToMemory(&pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: x509.MarshalPKCS1PrivateKey(priv)})\n\tcertPEM := pem.EncodeToMemory(&pem.Block{Type: \"CERTIFICATE\", Bytes: derBytes})\n\n\treturn keyPEM, certPEM, nil\n}", "title": "" }, { "docid": "c7cc2682e404b3443e1fb43984d9c969", "score": "0.59500104", "text": "func GetCertificateAuthority(caType string) (*x509.Certificate, *ecdsa.PrivateKey, error) {\n\n\tcertPEM, keyPEM, err := GetCertificateAuthorityPEM(caType)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcertBlock, _ := pem.Decode(certPEM)\n\tif certBlock == nil {\n\t\tlog.Print(\"Failed to parse certificate PEM\")\n\t\treturn nil, nil, err\n\t}\n\tcert, err := x509.ParseCertificate(certBlock.Bytes)\n\tif err != nil {\n\t\tlog.Print(\"Failed to parse certificate: \" + err.Error())\n\t\treturn nil, nil, err\n\t}\n\n\tkeyBlock, _ := pem.Decode(keyPEM)\n\tif keyBlock == nil {\n\t\tlog.Print(\"Failed to parse certificate PEM\")\n\t\treturn nil, nil, err\n\t}\n\tkey, err := x509.ParseECPrivateKey(keyBlock.Bytes)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, nil, err\n\t}\n\n\treturn cert, key, nil\n}", "title": "" }, { "docid": "114426cf5093a46cbe4e15bc8b338db2", "score": "0.59401464", "text": "func runCreateCACert(cmd *cobra.Command, args []string) error {\n\tif len(baseCtx.SSLCA) == 0 || len(baseCtx.SSLCAKey) == 0 {\n\t\tmustUsage(cmd)\n\t\treturn errMissingParams\n\t}\n\tif err := security.RunCreateCACert(baseCtx.SSLCA, baseCtx.SSLCAKey, keySize); err != nil {\n\t\treturn fmt.Errorf(\"failed to generate CA certificate: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcb023c9ba932b47815137eebbd3925a", "score": "0.5910039", "text": "func GetCertificateAuthority(caType string) (*x509.Certificate, *ecdsa.PrivateKey, error) {\n\tcertPEM, keyPEM, err := GetCertificateAuthorityPEM(caType)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcertBlock, _ := pem.Decode(certPEM)\n\tif certBlock == nil {\n\t\t// certsLog.Error(\"Failed to parse certificate PEM\")\n\t\treturn nil, nil, err\n\t}\n\tcert, err := x509.ParseCertificate(certBlock.Bytes)\n\tif err != nil {\n\t\t// certsLog.Error(\"Failed to parse certificate: \" + err.Error())\n\t\treturn nil, nil, err\n\t}\n\n\tkeyBlock, _ := pem.Decode(keyPEM)\n\tif keyBlock == nil {\n\t\t// certsLog.Error(\"Failed to parse certificate PEM\")\n\t\treturn nil, nil, err\n\t}\n\tkey, err := x509.ParseECPrivateKey(keyBlock.Bytes)\n\tif err != nil {\n\t\t// certsLog.Error(err)\n\t\treturn nil, nil, err\n\t}\n\n\treturn cert, key, nil\n}", "title": "" }, { "docid": "f8130a758d9b3ef3feb985df3057bbea", "score": "0.5853598", "text": "func GenerateCerts(certInfo map[string]CertInfo, csri util.CertificateSigningRequestInterface, namespace, clusterDomain string, expiration int, autoApproval bool, secrets *v1.Secret) error {\n\t// generate all the CAs first because they are needed to sign the certs\n\tfor id, info := range certInfo {\n\t\tif !info.IsAuthority {\n\t\t\tcontinue\n\t\t}\n\t\tglog.Printf(\"- SSL CA: %s\\n\", id)\n\t\terr := createCA(certInfo, secrets, id, expiration)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\twg := sync.WaitGroup{}\n\tmut := sync.Mutex{}\n\terrs := []error{}\n\tnewCerts := map[string]*CertInfo{}\n\n\tfor id, info := range certInfo {\n\t\tif info.IsAuthority {\n\t\t\tcontinue\n\t\t}\n\t\tglog.Printf(\"- SSL CRT: %s (%s / %s)\\n\", id, info.CertificateName, info.PrivateKeyName)\n\t\tif len(info.SubjectNames) == 0 && info.RoleName == \"\" {\n\t\t\tglog.Printf(\"Warning: certificate %s has no names\\n\", info.CertificateName)\n\t\t}\n\n\t\twg.Add(1)\n\t\tgo func(id string, info CertInfo) {\n\t\t\tdefer wg.Done()\n\t\t\t// Just one of the fields may be deleted by changes to the generator input.\n\t\t\t// Need to generate a new cert if either is missing.\n\t\t\tmut.Lock()\n\t\t\tif len(secrets.Data[info.PrivateKeyName]) > 0 && len(secrets.Data[info.CertificateName]) > 0 {\n\t\t\t\tmut.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmut.Unlock()\n\n\t\t\tnewCert, err := createCert(certInfo, csri, namespace, clusterDomain, secrets, id, expiration, autoApproval)\n\t\t\tmut.Lock()\n\t\t\tdefer mut.Unlock()\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, err)\n\t\t\t} else {\n\t\t\t\tif newCert == nil {\n\t\t\t\t\tpanic(\"createCert returned no errors, but no certificate either\")\n\t\t\t\t}\n\t\t\t\tsecrets.Data[newCert.PrivateKeyName] = newCert.PrivateKey\n\t\t\t\tsecrets.Data[newCert.CertificateName] = newCert.Certificate\n\t\t\t\t// We stash the new certificate in a secondary map so that we\n\t\t\t\t// can freely read `certInfo` in `createCert()`` (to look up the\n\t\t\t\t// CA needed to generate other certificates) without triggering\n\t\t\t\t// data races.\n\t\t\t\tnewCerts[id] = newCert\n\t\t\t}\n\t\t}(id, info)\n\t}\n\twg.Wait()\n\n\tvar err error\n\tif len(errs) > 0 {\n\t\terr = errs[0]\n\t}\n\n\tfor id, newCert := range newCerts {\n\t\tif newCert.CSRName != \"\" {\n\t\t\tif err == nil {\n\t\t\t\tnewCert, err = waitForKubeCSR(csri, *newCert)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"Kube CSR failed with %s\", err)\n\t\t\t\t}\n\t\t\t\tsecrets.Data[newCert.PrivateKeyName] = newCert.PrivateKey\n\t\t\t\tsecrets.Data[newCert.CertificateName] = newCert.Certificate\n\t\t\t}\n\t\t\t_ = csri.Delete(newCert.CSRName, &metav1.DeleteOptions{})\n\t\t}\n\n\t\t// Once we hit an error we just delete all still outstanding kube csrs\n\t\t// and then return the first error we encountered.\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(newCert.PrivateKeyName) == 0 {\n\t\t\terr = fmt.Errorf(\"Certificate %s created with empty private key name\", id)\n\t\t} else if len(newCert.PrivateKey) == 0 {\n\t\t\terr = fmt.Errorf(\"Certificate %s created with empty private key\", id)\n\t\t} else if len(newCert.CertificateName) == 0 {\n\t\t\terr = fmt.Errorf(\"Certificate %s created with empty certificate name\", id)\n\t\t} else if len(newCert.Certificate) == 0 {\n\t\t\terr = fmt.Errorf(\"Certificate %s created with empty certificate\", id)\n\t\t}\n\t\tcertInfo[id] = *newCert\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4737ab29bae19d835ba1bc3dc3118d4f", "score": "0.585248", "text": "func (c *Certificate) Generate(ca *Certificate) error {\n\tif err := c.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"failed validating the certificate: %w\", err)\n\t}\n\n\tk, err := c.getPrivateKey()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed getting private key: %w\", err)\n\t}\n\n\treturn c.ensureX509Certificate(k, ca)\n}", "title": "" }, { "docid": "df122e66f73abe6813d0c213adcf5e2f", "score": "0.5850052", "text": "func NewAuthority(name, organization string, validity time.Duration) (*x509.Certificate, *rsa.PrivateKey, error) {\n\tpriv, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tpub := priv.Public()\n\n\t// Subject Key Identifier support for end entity certificate.\n\t// https://www.ietf.org/rfc/rfc3280.txt (section 4.2.1.2)\n\tpkixpub, err := x509.MarshalPKIXPublicKey(pub)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\th := sha1.New()\n\th.Write(pkixpub)\n\tkeyID := h.Sum(nil)\n\n\t// TODO: keep a map of used serial numbers to avoid potentially reusing a\n\t// serial multiple times.\n\tserial, err := rand.Int(rand.Reader, MaxSerialNumber)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttmpl := &x509.Certificate{\n\t\tSerialNumber: serial,\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: name,\n\t\t\tOrganization: []string{organization},\n\t\t},\n\t\tSubjectKeyId: keyID,\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t\tNotBefore: time.Now().Add(-validity),\n\t\tNotAfter: time.Now().Add(validity),\n\t\tDNSNames: []string{name},\n\t\tIsCA: true,\n\t}\n\n\traw, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, pub, priv)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Parse certificate bytes so that we have a leaf certificate.\n\tx509c, err := x509.ParseCertificate(raw)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn x509c, priv, nil\n}", "title": "" }, { "docid": "c0745b910e10fbf01c871ea6667c089f", "score": "0.5838444", "text": "func (o OrganizationOutput) CaCertificate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Organization) pulumi.StringOutput { return v.CaCertificate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7fe42002e56abce10ad10d5fe1e528e6", "score": "0.5819104", "text": "func createCACertTemplate(name, namespace string, notAfter time.Time) (*x509.Certificate, error) {\n\trootCert, err := createCertTemplate(name, namespace, notAfter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Make it into a CA cert and change it so we can use it to sign certs\n\trootCert.IsCA = true\n\trootCert.KeyUsage = x509.KeyUsageCertSign | x509.KeyUsageDigitalSignature\n\trootCert.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}\n\treturn rootCert, nil\n}", "title": "" }, { "docid": "b58735ae67761118215f260320a7ba28", "score": "0.5814171", "text": "func newCertificateAuthority(key crypto.PrivateKey) (*x509.Certificate, error) {\n\trsaKey, subjectID, err := keyAndSubjectID(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar template = x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tSubject: pkix.Name{},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Time{},\n\n\t\tKeyUsage: caKeyUsage,\n\t\tExtKeyUsage: nil,\n\n\t\tIsCA: true,\n\t\tSubjectKeyId: subjectID[:],\n\t}\n\n\tcert, err := x509.CreateCertificate(rand.Reader, &template, &template, &rsaKey.PublicKey, rsaKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn x509.ParseCertificate(cert)\n}", "title": "" }, { "docid": "53d61ae2fd2f68a2ff2fd1fe4712f649", "score": "0.5791025", "text": "func NewCertificateAuthority() (*x509.Certificate, *rsa.PrivateKey, error) {\n\tkey, err := certutil.NewPrivateKey()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to create private key [%v]\", err)\n\t}\n\n\tconfig := certutil.Config{\n\t\tCommonName: \"kubernetes\",\n\t}\n\tcert, err := certutil.NewSelfSignedCACert(config, key)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to create self-signed certificate [%v]\", err)\n\t}\n\n\treturn cert, key, nil\n}", "title": "" }, { "docid": "afa1f7987c8d8ed7664660fc4dca81c9", "score": "0.5785882", "text": "func GetCACreator(commonName string) reconciling.SecretCreator {\n\treturn func(se *corev1.Secret) (*corev1.Secret, error) {\n\t\tif se.Data == nil {\n\t\t\tse.Data = map[string][]byte{}\n\t\t}\n\n\t\t// if the CA exists, only check if it's expired but never attempt to replace an existing CA\n\t\tif certPEM, exists := se.Data[resources.CACertSecretKey]; exists {\n\t\t\tcerts, err := certutil.ParseCertsPEM(certPEM)\n\t\t\tif err != nil {\n\t\t\t\treturn se, fmt.Errorf(\"certificate is not valid PEM-encoded: %v\", err)\n\t\t\t}\n\n\t\t\tif time.Now().After(certs[0].NotAfter) {\n\t\t\t\treturn se, errors.New(\"certificate has expired\")\n\t\t\t}\n\n\t\t\treturn se, nil\n\t\t}\n\n\t\tcaKp, err := triple.NewCA(commonName)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to create a new CA: %v\", err)\n\t\t}\n\n\t\tse.Data[resources.CAKeySecretKey] = triple.EncodePrivateKeyPEM(caKp.Key)\n\t\tse.Data[resources.CACertSecretKey] = triple.EncodeCertPEM(caKp.Cert)\n\n\t\treturn se, nil\n\t}\n}", "title": "" }, { "docid": "683313811838e157bdd1e8f4e421c104", "score": "0.57810384", "text": "func GenCARoot() (*x509.Certificate, *rsa.PrivateKey) {\n\tvar rootTemplate = x509.Certificate{\n\t\tSerialNumber: big.NewInt(1),\n\t\tSubject: pkix.Name{\n\t\t\tCountry: []string{defaults.DefaultX509Country},\n\t\t\tOrganization: []string{defaults.DefaultX509Company},\n\t\t\tCommonName: \"Root CA\",\n\t\t},\n\t\tNotBefore: time.Now().Add(-10 * time.Second),\n\t\tNotAfter: time.Now().AddDate(10, 0, 0),\n\t\tKeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tMaxPathLen: 2,\n\t\tIPAddresses: []net.IP{net.ParseIP(\"127.0.0.1\")},\n\t}\n\tpriv, err := rsa.GenerateKey(rand.Reader, 4096)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trootCert := genCert(&rootTemplate, &rootTemplate, &priv.PublicKey, priv)\n\treturn rootCert, priv\n}", "title": "" }, { "docid": "2cacb0d4a86fe4b8ba239f5b1a798867", "score": "0.5780472", "text": "func (a *CAApiService) CertificateAuthorityCaGet(ctx _context.Context) ApiCertificateAuthorityCaGetRequest {\n\treturn ApiCertificateAuthorityCaGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "23219905994d5bb43ae86d537bffc3b4", "score": "0.57757056", "text": "func (cap *CFSSL) CACertificate() ([]byte, error) {\n\treq := &info.Req{\n\t\tLabel: cap.Label,\n\t\tProfile: cap.Profile,\n\t}\n\tout, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := cap.remote.Info(out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn []byte(resp.Certificate), nil\n}", "title": "" }, { "docid": "7d3ebeb335dba06b4b7074a00a4eb7a5", "score": "0.57689965", "text": "func TestCa(t *testing.T) {\n\tlogger.InitLogs(os.Stdout, os.Stdout, os.Stderr)\n\tkeylength := 4098\n\torganization := \"org\"\n\tcountry := \"PT-PT\"\n\texpiresDays := 10\n\texpires := time.Now().AddDate(0, 0, expiresDays).UTC()\n\n\t// generate certificate\n\t_, rootCert, _, err := NewRootCertificate(keylength, expires, organization, country)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// verify fingerprint\n\tfingerprint, err := GetCertificateFingerprint()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif err := rootCert.VerifyFingerprint(&fingerprint); err != nil {\n\t\tt.Fatalf(\"Fingerprint! %s\", err)\n\t}\n\n\t// CSR signature is tested in container_test.go\n\n}", "title": "" }, { "docid": "cc83320094a4616bfae322c338562e5c", "score": "0.57523257", "text": "func (pki *MicroPkI) createIntermediateCertificateAuthority(csr *x509.CertificateRequest, expYear int, expMonths int, expDays int) (*x509.Certificate, error) {\n\t/*\n\t// Random Serial Number\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t*/\n\traw, err := pki.db.Get([]byte(KeySerialNumber), nil)\n\tif err != nil {\n\t\tlog.Fatal(\"DB Failed: [createIntermediateCertificateAuthority] \", err)\n\t}\n\tserialNumber := big.NewInt(0).SetBytes(raw)\n\tserialNumber = serialNumber.Add(serialNumber, big.NewInt(1)) // SerialNumber increase once\n\tnewCert := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tMaxPathLenZero: false,\n\t\tRawSubject: csr.RawSubject,\n\t}\n\n\tcaExpiry := pki.caCert.NotAfter\n\tproposedExpiry := time.Now().AddDate(expYear, expMonths, expDays).UTC()\n\t// ensure cert doesn't expire after issuer\n\tif caExpiry.Before(proposedExpiry) {\n\t\tnewCert.NotAfter = caExpiry\n\t} else {\n\t\tnewCert.NotAfter = proposedExpiry\n\t}\n\n\tnewCert.SubjectKeyId, err = pki.GenerateSubjectKeyID(csr.PublicKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//newCert.IPAddresses = csr.IPAddresses\n\t//newCert.DNSNames = csr.DNSNames\n\tnewCert.SignatureAlgorithm = x509.SHA1WithRSA;\n\n\tcrtOutBytes, err := x509.CreateCertificate(rand.Reader, &newCert, pki.caCert, csr.PublicKey, pki.caKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcert, err := LoadCertificatefromDerBytes(crtOutBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = pki.recordCertificateSigning(cert)\n\tif err != nil {\n\t\tlog.Fatal(\"Record Failed: \", err)\n\t\treturn nil, err\n\t}\n\treturn cert, nil\n}", "title": "" }, { "docid": "b461ed26d72dcf3e8ff2a70419c63beb", "score": "0.5751949", "text": "func (a *CAApiService) CertificateAuthorityCaGetExecute(r ApiCertificateAuthorityCaGetRequest) (CaConfig, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CaConfig\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"CAApiService.CertificateAuthorityCaGet\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/certificate-authority/ca\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "3ebc5608e32ad0a3d6d35b3afe729ef7", "score": "0.572378", "text": "func generateKeyPairs(isCA, isRSA bool, name, org string, hostnames []string, ip []string, years int) error {\n\n\tlog.Printf(\"Generating CA certificate for the following hostname %s with RSA: %v\\n\", hostnames, isRSA)\n\tlog.Printf(\"Generating CA certificate for the following ip addresses %s with RSA: %v\\n\", ip, isRSA)\n\n\t// Generate a private/public key pair\n\tvar privateKey interface{}\n\tvar caPrivateKey interface{}\n\tvar err error\n\tif isRSA {\n\t\tprivateKey, err = rsa.GenerateKey(rand.Reader, 4096)\n\t} else {\n\t\tprivateKey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to generate private key: %s\", err)\n\t}\n\n\t// if the request is not for a CA authority generation then load the CA public key\n\tvar caCRT *x509.Certificate\n\tif !isCA {\n\t\tcaCRT, err = readCertificate(\"ca\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttemplate, err := makeTemplate(isCA, isRSA, org, hostnames, ip, years, caCRT)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// in case we are generating the certificates for a CA\n\tif isCA {\n\t\tcaCRT = template\n\t\tcaPrivateKey = privateKey\n\t} else {\n\t\t// in case we are signing a certificate with an existing certitifcate authority then load the CA private key\n\t\tcaPrivateKey, err = readPrivateKey(\"ca\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, template, caCRT, publicKey(privateKey), caPrivateKey)\n\tif err != nil {\n\t\tlog.Printf(\"Certificate autohority generation: failed to create certificate with error %s\", err)\n\t\treturn err\n\t}\n\n\tif err := storeCertificate(name, derBytes); err != nil {\n\t\treturn err\n\t}\n\n\terr = storePrivateKey(name, privateKey)\n\n\treturn err\n\n}", "title": "" }, { "docid": "43bdb9dd0e4cfca93bc942b2a9ba1372", "score": "0.56935865", "text": "func createCertificate(principal string, certType uint32, caKey crypto.Signer, key crypto.Signer) (*ssh.Certificate, ssh.Signer, error) {\n\t// Create CA.\n\tcaPublicKey, err := ssh.NewPublicKey(caKey.Public())\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\tcaSigner, err := ssh.NewSignerFromKey(caKey)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\t// Create key.\n\tpublicKey, err := ssh.NewPublicKey(key.Public())\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\tkeySigner, err := ssh.NewSignerFromKey(key)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\t// Create certificate and signer.\n\tcert := &ssh.Certificate{\n\t\tKeyId: principal,\n\t\tValidPrincipals: []string{principal},\n\t\tKey: publicKey,\n\t\tSignatureKey: caPublicKey,\n\t\tValidAfter: uint64(time.Now().UTC().Add(-1 * time.Minute).Unix()),\n\t\tValidBefore: uint64(time.Now().UTC().Add(1 * time.Minute).Unix()),\n\t\tCertType: certType,\n\t}\n\terr = cert.SignCert(rand.Reader, caSigner)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\tcertSigner, err := ssh.NewCertSigner(cert, keySigner)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\treturn cert, certSigner, nil\n}", "title": "" }, { "docid": "5ecf836cd1cba5598a08ff82c61f33fc", "score": "0.5689252", "text": "func (s *CertificateAuthorityStub) Create(ctx context.Context, param *sacloud.CertificateAuthorityCreateRequest) (*sacloud.CertificateAuthority, error) {\n\tif s.CreateStubResult == nil {\n\t\tlog.Fatal(\"CertificateAuthorityStub.CreateStubResult is not set\")\n\t}\n\treturn s.CreateStubResult.CertificateAuthority, s.CreateStubResult.Err\n}", "title": "" }, { "docid": "cfe400dad2f92390e29fba29eabd87a2", "score": "0.5679157", "text": "func (a *CAApiService) CertificateAuthorityCaNextGeneratePostExecute(r ApiCertificateAuthorityCaNextGeneratePostRequest) (CaConfig, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CaConfig\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"CAApiService.CertificateAuthorityCaNextGeneratePost\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/certificate-authority/ca/next/generate\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.authorization == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"authorization is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tlocalVarHeaderParams[\"Authorization\"] = parameterToString(*r.authorization, \"\")\n\t// body params\n\tlocalVarPostBody = r.inlineObject8\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "c084b78055d70b84a2ed6f50a2038144", "score": "0.5663055", "text": "func (a Agreement) GenerateCertificate() *block.Certificate {\n\treturn &block.Certificate{\n\t\tStepOneBatchedSig: a.VotesPerStep[0].Signature,\n\t\tStepTwoBatchedSig: a.VotesPerStep[1].Signature,\n\t\tStepOneCommittee: a.VotesPerStep[0].BitSet,\n\t\tStepTwoCommittee: a.VotesPerStep[1].BitSet,\n\t}\n}", "title": "" }, { "docid": "c5611941d31bc9fc5e7f9e2fa9b5c84d", "score": "0.56576914", "text": "func generateRootCert() ([]byte, *ecdsa.PrivateKey, error) {\n\ttemplate, priv, err := generateTemplate()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\ttemplate.IsCA = true\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, template, template, &priv.PublicKey, priv)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create root certificate: %s\", err)\n\t}\n\n\treturn derBytes, priv, err\n}", "title": "" }, { "docid": "95338aee402178b764d5e52148375933", "score": "0.56570095", "text": "func NewCertificateAuthority(config *certutil.Config) (*x509.Certificate, crypto.Signer, error) {\n\tkey, err := NewPrivateKey()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to create private key\")\n\t}\n\n\tcert, err := certutil.NewSelfSignedCACert(*config, key)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to create self-signed certificate\")\n\t}\n\n\treturn cert, key, nil\n}", "title": "" }, { "docid": "ed1789086763f899f4a2e037c8e04094", "score": "0.5655633", "text": "func (a *CertAuthority) ValidateCA() error {\n\tif time.Until(a.rootCert.NotAfter) < expiryMargin {\n\t\treturn NewCertExpired(a.rootCert.NotAfter, expiryMargin)\n\t}\n\n\tif time.Until(a.rootCert.NotBefore) > notBeforeMargin {\n\t\treturn NewCertNotYetValid(a.rootCert.NotBefore)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "51417b49507bdfd8e1c5b01eaa2f1a5c", "score": "0.5653361", "text": "func GenerateCertificate(host string, caType string, isCA bool, isClient bool) ([]byte, []byte) {\n\n\tlog.Printf(\"Generating new TLS certificate ...\")\n\n\tvar privateKey interface{}\n\tvar err error\n\n\t// Generate private key\n\tprivateKey, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to generate private key: %s\", err)\n\t}\n\n\t// Valid times\n\tnotBefore := time.Now()\n\tnotAfter := notBefore.Add(validFor)\n\tlog.Printf(\"Valid from %v to %v\", notBefore, notAfter)\n\n\t// Serial number\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, _ := rand.Int(rand.Reader, serialNumberLimit)\n\tlog.Printf(\"Serial Number: %d\", serialNumber)\n\n\t// [!] Extended Key Usage (EKU)\n\t// -------------------------------------------------------------------------------\n\t// This is actually pretty important, it controls what the key can be used to do.\n\t// We need to be careful that client certificates can only be used to authenticate\n\t// clients, since everything is signed with the same CA an attacker who recovered\n\t// a pivot binary could potentially recover the embedded cert/key and use that to\n\t// mitm other connections, which would validate since we only check the signing\n\t// authority. To prevent this only server keys can be used to authenticate servers\n\t// and only client keys can be used to authenticate clients.\n\tvar extKeyUsage []x509.ExtKeyUsage\n\n\tif isCA {\n\t\tlog.Printf(\"Authority certificate\")\n\t\textKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageAny}\n\t} else if isClient {\n\t\tlog.Printf(\"Client authentication certificate\")\n\t\textKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}\n\t} else {\n\t\tlog.Printf(\"Server authentication certificate\")\n\t\textKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}\n\t}\n\tlog.Printf(\"ExtKeyUsage = %v\", extKeyUsage)\n\n\t// Certificate template\n\ttemplate := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"rosie-the-pivoter\"},\n\t\t},\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: extKeyUsage,\n\t\tBasicConstraintsValid: isCA,\n\t}\n\n\tif !isClient {\n\t\t// Host or IP address\n\t\tif ip := net.ParseIP(host); ip != nil {\n\t\t\tlog.Printf(\"Certificate authenticates IP address: %v\", ip)\n\t\t\ttemplate.IPAddresses = append(template.IPAddresses, ip)\n\t\t} else {\n\t\t\tlog.Printf(\"Certificate authenticates host: %v\", host)\n\t\t\ttemplate.DNSNames = append(template.DNSNames, host)\n\t\t}\n\t}\n\n\t// Sign certificate or self-sign if CA\n\tvar derBytes []byte\n\tif isCA {\n\t\tlog.Printf(\"Ceritificate is an AUTHORITY\")\n\t\ttemplate.IsCA = true\n\t\ttemplate.KeyUsage |= x509.KeyUsageCertSign\n\t\tderBytes, err = x509.CreateCertificate(rand.Reader, &template, &template, publicKey(privateKey), privateKey)\n\t} else {\n\t\t// We use seperate authorities for clients, and pivots otherwise an attacker could take a cert/key pair\n\t\t// from a pivot and use it to authenticate against the client socket.\n\t\tcaCert, caKey, err := GetCertificateAuthority(caType) // Sign the new ceritificate with our CA\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Invalid ca type (%s): %v\", caType, err)\n\t\t}\n\t\tderBytes, err = x509.CreateCertificate(rand.Reader, &template, caCert, publicKey(privateKey), caKey)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create certificate: %s\", err)\n\t}\n\n\t// Encode certificate and key\n\tcertOut := bytes.NewBuffer([]byte{})\n\tpem.Encode(certOut, &pem.Block{Type: \"CERTIFICATE\", Bytes: derBytes})\n\n\tkeyOut := bytes.NewBuffer([]byte{})\n\tpem.Encode(keyOut, pemBlockForKey(privateKey))\n\n\treturn certOut.Bytes(), keyOut.Bytes()\n}", "title": "" }, { "docid": "81d99d036e13d365d3a11e32c2cca79b", "score": "0.56462973", "text": "func createCertificate(\n\tw io.Writer,\n\tprojectId string,\n\tlocation string,\n\tcaPoolId string,\n\tcaId string,\n\tcertId string,\n\tcommonName string,\n\tdomainName string,\n\tcertDuration int64,\n\tpublicKeyBytes []byte) error {\n\t// projectId := \"your_project_id\"\n\t// location := \"us-central1\"\t\t// For a list of locations, see: https://cloud.google.com/certificate-authority-service/docs/locations.\n\t// caPoolId := \"ca-pool-id\"\t\t\t// The CA Pool id in which the certificate authority exists.\n\t// caId := \"ca-id\"\t\t\t\t\t// The name of the certificate authority which issues the certificate.\n\t// certId := \"certificate\"\t\t\t// A unique name for the certificate.\n\t// commonName := \"cert-name\"\t\t// A common name for the certificate.\n\t// domainName := \"cert.example.com\"\t// Fully qualified domain name for the certificate.\n\t// certDuration := int64(31536000)\t// The validity of the certificate in seconds.\n\t// publicKeyBytes \t\t\t\t\t// The public key used in signing the certificates.\n\n\tctx := context.Background()\n\tcaClient, err := privateca.NewCertificateAuthorityClient(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"NewCertificateAuthorityClient creation failed: %w\", err)\n\t}\n\tdefer caClient.Close()\n\n\t// Set the Public Key and its format.\n\tpublicKey := &privatecapb.PublicKey{\n\t\tKey: publicKeyBytes,\n\t\tFormat: privatecapb.PublicKey_PEM,\n\t}\n\n\t// Set Certificate subject config.\n\tsubjectConfig := &privatecapb.CertificateConfig_SubjectConfig{\n\t\tSubject: &privatecapb.Subject{\n\t\t\tCommonName: commonName,\n\t\t},\n\t\tSubjectAltName: &privatecapb.SubjectAltNames{\n\t\t\tDnsNames: []string{domainName},\n\t\t},\n\t}\n\n\t// Set the X.509 fields required for the certificate.\n\tx509Parameters := &privatecapb.X509Parameters{\n\t\tKeyUsage: &privatecapb.KeyUsage{\n\t\t\tBaseKeyUsage: &privatecapb.KeyUsage_KeyUsageOptions{\n\t\t\t\tDigitalSignature: true,\n\t\t\t\tKeyEncipherment: true,\n\t\t\t},\n\t\t\tExtendedKeyUsage: &privatecapb.KeyUsage_ExtendedKeyUsageOptions{\n\t\t\t\tServerAuth: true,\n\t\t\t\tClientAuth: true,\n\t\t\t},\n\t\t},\n\t}\n\n\t// Set certificate settings.\n\tcert := &privatecapb.Certificate{\n\t\tCertificateConfig: &privatecapb.Certificate_Config{\n\t\t\tConfig: &privatecapb.CertificateConfig{\n\t\t\t\tPublicKey: publicKey,\n\t\t\t\tSubjectConfig: subjectConfig,\n\t\t\t\tX509Config: x509Parameters,\n\t\t\t},\n\t\t},\n\t\tLifetime: &durationpb.Duration{\n\t\t\tSeconds: certDuration,\n\t\t},\n\t}\n\n\tfullCaPoolName := fmt.Sprintf(\"projects/%s/locations/%s/caPools/%s\", projectId, location, caPoolId)\n\n\t// Create the CreateCertificateRequest.\n\t// See https://pkg.go.dev/cloud.google.com/go/security/privateca/apiv1/privatecapb#CreateCertificateRequest.\n\treq := &privatecapb.CreateCertificateRequest{\n\t\tParent: fullCaPoolName,\n\t\tCertificateId: certId,\n\t\tCertificate: cert,\n\t\tIssuingCertificateAuthorityId: caId,\n\t}\n\n\t_, err = caClient.CreateCertificate(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CreateCertificate failed: %w\", err)\n\t}\n\n\tfmt.Fprintf(w, \"Certificate %s created\", certId)\n\n\treturn nil\n}", "title": "" }, { "docid": "968ce51d4d2a64215fa7ce1ab6d6afa1", "score": "0.56409025", "text": "func NewCA(certCA, certKey []byte, metrics CertificateMetrics,\n\tcacheMaxSize int64, cacheItemsToPrune uint32, orgNames ...string) (CA, error) {\n\tca, err := tls.X509KeyPair(certCA, certKey)\n\tif err != nil {\n\t\treturn CA{}, errors.Annotate(err, \"Invalid certificates\")\n\t}\n\tif ca.Leaf, err = x509.ParseCertificate(ca.Certificate[0]); err != nil {\n\t\treturn CA{}, errors.Annotate(err, \"Invalid certificates\")\n\t}\n\n\tccacheConf := ccache.Configure()\n\tccacheConf = ccacheConf.MaxSize(cacheMaxSize)\n\tccacheConf = ccacheConf.ItemsToPrune(cacheItemsToPrune)\n\tccacheConf = ccacheConf.OnDelete(func(_ *ccache.Item) { metrics.DropCertificate() })\n\n\tobj := CA{\n\t\tca: ca,\n\t\tmetrics: metrics,\n\t\tsecret: certKey,\n\t\torgNames: orgNames,\n\t\tcache: ccache.New(ccacheConf),\n\t\trequestChans: make([]chan *signRequest, 0, certWorkerCount),\n\t\twg: &sync.WaitGroup{},\n\t}\n\tfor i := 0; i < int(certWorkerCount); i++ {\n\t\tnewChan := make(chan *signRequest)\n\t\tobj.requestChans = append(obj.requestChans, newChan)\n\t\tobj.wg.Add(1)\n\t\tgo obj.worker(newChan, obj.wg)\n\t}\n\n\treturn obj, nil\n}", "title": "" }, { "docid": "26c1bdb42f7f8e234c34dec9b1a84656", "score": "0.56284", "text": "func (c *certManager) getCA() (caName, caKind string) {\n\tcaKind = certv1.IssuerKind\n\tissuerRef := c.cluster.Spec.ListenersConfig.SSLSecrets.IssuerRef\n\tif issuerRef != nil {\n\t\tcaName = issuerRef.Name\n\t\tcaKind = issuerRef.Kind\n\t} else {\n\t\tif c.cluster.Spec.ListenersConfig.SSLSecrets.ClusterScoped {\n\t\t\tcaKind = certv1.ClusterIssuerKind\n\t\t}\n\t\tcaName = fmt.Sprintf(pkicommon.NodeIssuerTemplate, c.cluster.Name)\n\t}\n\t// TODO: Do we need to ensure this Issuer is exist?\n\treturn\n}", "title": "" }, { "docid": "0015f5a2ee92cc5e60b7fd24f1f42c96", "score": "0.56183803", "text": "func (a *ServiceServingCA) Generate(dependencies asset.Parents) error {\n\trootCA := &RootCA{}\n\tdependencies.Get(rootCA)\n\n\tcfg := &CertCfg{\n\t\tSubject: pkix.Name{CommonName: \"service-serving\", OrganizationalUnit: []string{\"bootkube\"}},\n\t\tKeyUsages: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tValidity: ValidityTenYears,\n\t\tIsCA: true,\n\t}\n\n\treturn a.CertKey.Generate(cfg, rootCA, \"service-serving-ca\", DoNotAppendParent)\n}", "title": "" }, { "docid": "0ee57db581eb5c82259e1289dcacee0b", "score": "0.56181836", "text": "func (a *CAApiService) CertificateAuthorityCaNextGeneratePost(ctx _context.Context) ApiCertificateAuthorityCaNextGeneratePostRequest {\n\treturn ApiCertificateAuthorityCaNextGeneratePostRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "c7b9a977b712cd8e42621535f7bb5232", "score": "0.56159556", "text": "func (c *templateFunctions) CACertificate() (*fi.Certificate, error) {\n\tif c.keyStore != nil {\n\t\treturn c.keyStore.Cert(fi.CertificateId_CA)\n\t}\n\n\t// Fallback to direct properties\n\treturn c.Certificate(fi.CertificateId_CA)\n}", "title": "" }, { "docid": "b7e117b921829c8942a5d13db3fcdbff", "score": "0.5599575", "text": "func createCAAppendPlan(ctx context.Context,\n\tlog zerolog.Logger, apiObject k8sutil.APIObject,\n\tspec api.DeploymentSpec, status api.DeploymentStatus,\n\tcachedStatus inspectorInterface.Inspector, context PlanBuilderContext) api.Plan {\n\tif !spec.TLS.IsSecure() {\n\t\treturn nil\n\t}\n\n\tcaSecret, exists := cachedStatus.Secret(spec.TLS.GetCASecretName())\n\tif !exists {\n\t\tlog.Warn().Str(\"secret\", spec.TLS.GetCASecretName()).Msg(\"CA Secret does not exists\")\n\t\treturn nil\n\t}\n\n\tca, _, err := resources.GetKeyCertFromSecret(log, caSecret, resources.CACertName, resources.CAKeyName)\n\tif err != nil {\n\t\tlog.Warn().Err(err).Str(\"secret\", spec.TLS.GetCASecretName()).Msg(\"CA Secret does not contains Cert\")\n\t\treturn nil\n\t}\n\n\tif len(ca) == 0 {\n\t\tlog.Warn().Str(\"secret\", spec.TLS.GetCASecretName()).Msg(\"CA does not contain any certs\")\n\t\treturn nil\n\t}\n\n\ttrusted, exists := cachedStatus.Secret(resources.GetCASecretName(apiObject))\n\tif !exists {\n\t\tlog.Warn().Str(\"secret\", resources.GetCASecretName(apiObject)).Msg(\"Folder with secrets does not exist\")\n\t\treturn nil\n\t}\n\n\tcaData, err := ca.ToPem()\n\tif err != nil {\n\t\tlog.Warn().Err(err).Str(\"secret\", spec.TLS.GetCASecretName()).Msg(\"Unable to parse cert\")\n\t\treturn nil\n\t}\n\n\tcertSha := util.SHA256(caData)\n\n\tif _, exists := trusted.Data[certSha]; !exists {\n\t\treturn api.Plan{api.NewAction(api.ActionTypeAppendTLSCACertificate, api.ServerGroupUnknown, \"\", \"Append CA to truststore\").\n\t\t\tAddParam(checksum, certSha)}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b2531c0b6c01ef4ffc5df8c474e48a92", "score": "0.559619", "text": "func (c *RootCA) Generate(parents asset.Parents) error {\n\tcfg := &CertCfg{\n\t\tSubject: pkix.Name{CommonName: \"root-ca\", OrganizationalUnit: []string{\"openshift\"}},\n\t\tKeyUsages: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tValidity: ValidityTenYears,\n\t\tIsCA: true,\n\t}\n\n\tkey, crt, err := GenerateRootCertKey(cfg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to generate RootCA\")\n\t}\n\n\tc.KeyRaw = PrivateKeyToPem(key)\n\tc.CertRaw = CertToPem(crt)\n\n\tc.generateFiles(\"root-ca\")\n\n\treturn nil\n}", "title": "" }, { "docid": "5d509f4339b530c87c13c67d5906e9a9", "score": "0.55934936", "text": "func (c Client) FetchCa() ([]byte, error) {\n\tlog.WithFields(log.Fields{\"f\": \"FetchCa\"}).Info(\"Fetching CA Certificate\")\n\tresp, err := c.lambdaSvc.Invoke(&lambda.InvokeInput{FunctionName: aws.String(\"slsslGetCa-\" + c.config.Name)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcaResp := sign.Response{}\n\n\terr = json.Unmarshal(resp.Payload, &caResp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn caResp.Certificate, nil\n}", "title": "" }, { "docid": "93431c199f0634c8bd4b93ebb33e2a2b", "score": "0.55888975", "text": "func (o MysqlSslConfigResponseOutput) CaCertificate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MysqlSslConfigResponse) string { return v.CaCertificate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "85b1526718b2e39799b2465e8e4ba81d", "score": "0.5580739", "text": "func (ca *CA) GenerateSub(parentCA interface{}) error {\n\t//https://www.socketloop.com/tutorials/golang-create-x509-certificate-private-and-public-keys\n\n\t// Override from parent if necessary\n\t// Ugly as hell. Need to fix.\n\tswitch parentCA.(type) {\n\tcase *CA:\n\t\tp := parentCA.(*CA)\n\t\tif p.Data.Body.DNScope.Country != \"\" {\n\t\t\tca.Data.Body.DNScope.Country = p.Data.Body.DNScope.Country\n\t\t}\n\t\tif p.Data.Body.DNScope.Organization != \"\" {\n\t\t\tca.Data.Body.DNScope.Organization = p.Data.Body.DNScope.Organization\n\t\t}\n\t\tif p.Data.Body.DNScope.OrganizationalUnit != \"\" {\n\t\t\tca.Data.Body.DNScope.OrganizationalUnit = p.Data.Body.DNScope.OrganizationalUnit\n\t\t}\n\t\tif p.Data.Body.DNScope.Locality != \"\" {\n\t\t\tca.Data.Body.DNScope.Locality = p.Data.Body.DNScope.Locality\n\t\t}\n\t\tif p.Data.Body.DNScope.Province != \"\" {\n\t\t\tca.Data.Body.DNScope.Province = p.Data.Body.DNScope.Province\n\t\t}\n\t\tif p.Data.Body.DNScope.StreetAddress != \"\" {\n\t\t\tca.Data.Body.DNScope.StreetAddress = p.Data.Body.DNScope.StreetAddress\n\t\t}\n\t\tif p.Data.Body.DNScope.PostalCode != \"\" {\n\t\t\tca.Data.Body.DNScope.PostalCode = p.Data.Body.DNScope.PostalCode\n\t\t}\n\t}\n\n\tsubject := new(pkix.Name)\n\tsubject.CommonName = ca.Data.Body.Name\n\n\t// Set using CA's DNScope\n\tif ca.Data.Body.DNScope.Country != \"\" {\n\t\tsubject.Country = []string{ca.Data.Body.DNScope.Country}\n\t}\n\tif ca.Data.Body.DNScope.Organization != \"\" {\n\t\tsubject.Organization = []string{ca.Data.Body.DNScope.Organization}\n\t}\n\tif ca.Data.Body.DNScope.OrganizationalUnit != \"\" {\n\t\tsubject.OrganizationalUnit = []string{ca.Data.Body.DNScope.OrganizationalUnit}\n\t}\n\tif ca.Data.Body.DNScope.Locality != \"\" {\n\t\tsubject.Locality = []string{ca.Data.Body.DNScope.Locality}\n\t}\n\tif ca.Data.Body.DNScope.Province != \"\" {\n\t\tsubject.Province = []string{ca.Data.Body.DNScope.Province}\n\t}\n\tif ca.Data.Body.DNScope.StreetAddress != \"\" {\n\t\tsubject.StreetAddress = []string{ca.Data.Body.DNScope.StreetAddress}\n\t}\n\tif ca.Data.Body.DNScope.PostalCode != \"\" {\n\t\tsubject.PostalCode = []string{ca.Data.Body.DNScope.PostalCode}\n\t}\n\n\tserial, err := NewSerial()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create serial: %s\", err)\n\t}\n\n\tnotBefore := time.Now()\n\tnotAfter := notBefore.AddDate(0, 0, ca.Data.Body.CAExpiry)\n\n\ttemplate := &x509.Certificate{\n\t\tIsCA: true,\n\t\tBasicConstraintsValid: true,\n\t\t//SubjectKeyId: []byte{1, 2, 3},\n\t\tSerialNumber: serial,\n\t\tSubject: *subject,\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\t// see http://golang.org/pkg/crypto/x509/#KeyUsage\n\t\t// http://security.stackexchange.com/questions/49229/root-certificate-key-usage-non-self-signed-end-entity\n\t\t//ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t\tKeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign,\n\t}\n\tvar privateKey interface{}\n\tvar publicKey interface{}\n\tkeyType := crypto.KeyType(ca.Data.Body.KeyType)\n\n\tswitch keyType {\n\tcase crypto.KeyTypeRSA:\n\t\trsaKey, err := crypto.GenerateRSAKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to generate RSA Key: %s\", err)\n\t\t}\n\t\tprivateKey = rsaKey\n\t\tpublicKey = &rsaKey.PublicKey\n\tcase crypto.KeyTypeEC:\n\t\tecKey, err := crypto.GenerateECKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"\")\n\t\t}\n\t\tprivateKey = ecKey\n\t\tpublicKey = &ecKey.PublicKey\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid key type: %s\", keyType)\n\t}\n\n\tvar parent *x509.Certificate\n\tvar signingKey interface{}\n\n\tswitch t := parentCA.(type) {\n\tcase *CA:\n\t\tparent, err = parentCA.(*CA).Certificate()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not get certificate: %s\", err)\n\t\t}\n\t\tsigningKey, err = parentCA.(*CA).PrivateKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not get private key: %s\", err)\n\t\t}\n\tcase nil:\n\t\t// Self signed\n\t\tparent = template\n\t\tsigningKey = privateKey\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid parent type: %T\", t)\n\t}\n\n\tder, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey, signingKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create certificate: %s\", err)\n\t}\n\tca.Data.Body.Id = NewID()\n\tca.Data.Body.Certificate = string(PemEncodeX509CertificateDER(der))\n\tenc, err := crypto.PemEncodePrivate(privateKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not pem encode private key: %s\", err)\n\t}\n\tca.Data.Body.PrivateKey = string(enc)\n\n\treturn nil\n}", "title": "" }, { "docid": "43d50fad96620d56cc4750ba71facbd7", "score": "0.5569005", "text": "func validateCAConfig(ctx context.Context, securityConfig *ca.SecurityConfig, cluster *api.Cluster) (*api.RootCA, error) {\n\tnewConfig := cluster.Spec.CAConfig\n\n\tif len(newConfig.SigningCAKey) > 0 && len(newConfig.SigningCACert) == 0 {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"if a signing CA key is provided, the signing CA cert must also be provided\")\n\t}\n\n\tif err := validateHasRequiredExternalCAs(ctx, securityConfig, cluster); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if the desired CA cert and key are not set, then we are happy with the current root CA configuration, unless\n\t// the ForceRotate version has changed\n\tif len(newConfig.SigningCACert) == 0 {\n\t\tif cluster.RootCA.LastForcedRotation != newConfig.ForceRotate {\n\t\t\tnewRootCA, err := ca.CreateRootCA(ca.DefaultRootCN)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, grpc.Errorf(codes.Internal, err.Error())\n\t\t\t}\n\t\t\treturn newRootRotationObject(ctx, securityConfig, cluster, newRootCA, newConfig.ForceRotate)\n\t\t}\n\t\treturn &cluster.RootCA, nil // no change, return as is\n\t}\n\n\t// A desired cert and maybe key were provided - we need to make sure the cert and key (if provided) match.\n\tvar signingCert []byte\n\tif hasSigningKey(newConfig) {\n\t\tsigningCert = newConfig.SigningCACert\n\t}\n\tnewRootCA, err := ca.NewRootCA(newConfig.SigningCACert, signingCert, newConfig.SigningCAKey, ca.DefaultNodeCertExpiration, nil)\n\tif err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\n\tif len(newRootCA.Pool.Subjects()) != 1 {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"the desired CA certificate cannot contain multiple certificates\")\n\t}\n\n\tparsedCert, err := helpers.ParseCertificatePEM(newConfig.SigningCACert)\n\tif err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"could not parse the desired CA certificate\")\n\t}\n\n\t// The new certificate's expiry must be at least one year away\n\tif parsedCert.NotAfter.Before(time.Now().Add(minRootExpiration)) {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"CA certificate expires too soon\")\n\t}\n\n\t// check if we can abort any existing root rotations\n\tif bytes.Equal(cluster.RootCA.CACert, cluster.Spec.CAConfig.SigningCACert) {\n\t\tcopied := cluster.RootCA.Copy()\n\t\tcopied.CAKey = newConfig.SigningCAKey\n\t\tcopied.RootRotation = nil\n\t\tcopied.LastForcedRotation = newConfig.ForceRotate\n\t\treturn copied, nil\n\t}\n\n\t// check if this is the same desired cert as an existing root rotation\n\tif r := cluster.RootCA.RootRotation; r != nil && bytes.Equal(r.CACert, cluster.Spec.CAConfig.SigningCACert) {\n\t\tcopied := cluster.RootCA.Copy()\n\t\tcopied.RootRotation.CAKey = newConfig.SigningCAKey\n\t\tcopied.LastForcedRotation = newConfig.ForceRotate\n\t\treturn copied, nil\n\t}\n\n\t// ok, everything's different; we have to begin a new root rotation which means generating a new cross-signed cert\n\treturn newRootRotationObject(ctx, securityConfig, cluster, newRootCA, newConfig.ForceRotate)\n}", "title": "" }, { "docid": "12dee50fe6e39946be7850fafaa24802", "score": "0.55589163", "text": "func GetCACertificates(httpWriter http.ResponseWriter, httpRequest *http.Request) {\n\tlog.Trace(\"resource/ca_certificates:GetCACertificates() Entering\")\n\tdefer log.Trace(\"resource/ca_certificates:GetCACertificates() Leaving\")\n\n\tif httpRequest.Header.Get(\"Accept\") != \"application/x-pem-file\" {\n\t\thttpWriter.WriteHeader(http.StatusNotAcceptable)\n\t\thttpWriter.Write([]byte(\"Accept type not supported\"))\n\t\treturn\n\t}\n\n\tissuingCa := httpRequest.URL.Query().Get(\"issuingCa\")\n\tif (issuingCa == \"\") {\n\t\tissuingCa = \"root\"\t\t\n\t}\n\tlog.Debugf(\"resource/ca_certificates:GetCACertificates() Requesting CA certificate for - %v\", issuingCa)\n\tcaCertificateBytes, err := getCaCert(issuingCa)\n\tif err != nil {\n\t\tlog.Errorf(\"resource/ca_certificates:GetCACertificates() Cannot load Issuing CA - %v\", issuingCa)\n\t\tlog.Tracef(\"%+v\",err)\n\t\tif strings.Contains(err.Error(), \"Invalid Query parameter\") {\n\t\t\tslog.Warning(commLogMsg.InvalidInputBadParam)\n\t\t\thttpWriter.WriteHeader(http.StatusBadRequest)\n\t\t\thttpWriter.Write([]byte(\"Invalid Query parameter provided\"))\n\t\t} else {\n\t\t\thttpWriter.WriteHeader(http.StatusInternalServerError)\n\t\t\thttpWriter.Write([]byte(\"Cannot load Issuing CA\"))\n\t\t}\n\t\treturn\n\t}\n\thttpWriter.Header().Set(\"Content-Type\", \"application/x-pem-file\")\n\thttpWriter.WriteHeader(http.StatusOK)\n\thttpWriter.Write(caCertificateBytes)\n\tlog.Infof(\"resource/ca_certificates:GetCACertificates() Returned requested %v CA certificate\", issuingCa)\n\treturn\n}", "title": "" }, { "docid": "2d3c8cabdb00aee4a568a60fc2d40341", "score": "0.55564094", "text": "func (certificate *Certificate) Generate(parentCertificate interface{}, subject *pkix.Name) error {\n\t//https://www.socketloop.com/tutorials/golang-create-x509-certificate-private-and-public-keys\n\n\tserial, err := NewSerial()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create serial: %s\", err)\n\t}\n\n\tnotBefore := time.Now()\n\tnotAfter := notBefore.AddDate(0, 0, certificate.Data.Body.Expiry)\n\n\ttemplate := &x509.Certificate{\n\t\tIsCA: false,\n\t\tBasicConstraintsValid: true,\n\t\tSerialNumber: serial,\n\t\tSubject: *subject,\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\t// see http://golang.org/pkg/crypto/x509/#KeyUsage\n\t\t// http://security.stackexchange.com/questions/24106/which-key-usages-are-required-by-each-key-exchange-method\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment | x509.KeyUsageKeyAgreement,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t}\n\n\tvar privateKey interface{}\n\tvar publicKey interface{}\n\n\tswitch crypto.KeyType(certificate.Data.Body.KeyType) {\n\tcase crypto.KeyTypeRSA:\n\t\trsaKey, err := crypto.GenerateRSAKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not generate RSA key: %s\", err)\n\t\t}\n\t\tprivateKey = rsaKey\n\t\tpublicKey = &rsaKey.PublicKey\n\tcase crypto.KeyTypeEC:\n\t\tecKey, err := crypto.GenerateECKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not generate ec key: %s\", err)\n\t\t}\n\t\tprivateKey = ecKey\n\t\tpublicKey = &ecKey.PublicKey\n\t}\n\n\tvar parent *x509.Certificate\n\tvar signingKey interface{}\n\n\tswitch t := parentCertificate.(type) {\n\tcase *CA:\n\t\tparent, err = parentCertificate.(*CA).Certificate()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not get certificate: %s\", err)\n\t\t}\n\t\tsigningKey, err = parentCertificate.(*CA).PrivateKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not get private key: %s\", err)\n\t\t}\n\t\t// TODO - Should probably track CA by name and load cert if required.\n\t\tcertificate.Data.Body.CACertificate = parentCertificate.(*CA).Data.Body.Certificate\n\tcase nil:\n\t\t// Self signed\n\t\tparent = template\n\t\tsigningKey = privateKey\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid parent type: %T\", t)\n\t}\n\n\tder, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey, signingKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create certificate: %s\", err)\n\t}\n\tcertificate.Data.Body.Certificate = string(PemEncodeX509CertificateDER(der))\n\tcertificate.Data.Body.Id = NewID()\n\tenc, err := crypto.PemEncodePrivate(privateKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to pem encode private key: %s\", err)\n\t}\n\tcertificate.Data.Body.PrivateKey = string(enc)\n\n\treturn nil\n}", "title": "" }, { "docid": "f309e46381e47306cf8df69bba830271", "score": "0.5542478", "text": "func (c *Cert) CreateFromCA(node *Node, ic *kubeadmapi.InitConfiguration, caCert *x509.Certificate, caKey crypto.Signer) error {\n\tcfg, err := c.GetConfig(node, ic)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't get configuration for %q certificate\", c.Name)\n\t}\n\tc.Cert, c.Key, err = pkiutil.NewCertAndKey(caCert, caKey, cfg)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't generate %q certificate\", c.Name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6827a24718375a9750121d55e6b62307", "score": "0.55296487", "text": "func newTestCa(f FactoryInterface, t *testing.T) (*rsa.PrivateKey, *x509.Certificate) {\n\tkey, err := rsa.GenerateKey(rand.Reader, 512)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcer, err := f.NewCertificateAuthority(key, pkix.Name{CommonName: \"example CA\"})\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treturn key, cer\n}", "title": "" }, { "docid": "ab10b3bb2788dbb0484db7a46c040b4c", "score": "0.55161995", "text": "func GetCertificateAuthorityPEM(caType string) ([]byte, []byte, error) {\n\n\trosieDir := GetRosieDir()\n\tcaType = path.Base(caType)\n\tcaCertPath := path.Join(rosieDir, certsDirName, fmt.Sprintf(\"%s-ca-cert.pem\", caType))\n\tcaKeyPath := path.Join(rosieDir, certsDirName, fmt.Sprintf(\"%s-ca-key.pem\", caType))\n\n\tcertPEM, err := ioutil.ReadFile(caCertPath)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, nil, err\n\t}\n\n\tkeyPEM, err := ioutil.ReadFile(caKeyPath)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, nil, err\n\t}\n\treturn certPEM, keyPEM, nil\n}", "title": "" }, { "docid": "3f6b9a8de27fdb3d2d107867dfeb980e", "score": "0.55126184", "text": "func (m *mkcert) loadCA() {\n\tif !pathExists(filepath.Join(m.CAROOT, rootName)) {\n\t\tm.newCA()\n\t}\n\n\tcertPEMBlock, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootName))\n\tfatalIfErr(err, \"failed to read the CA certificate\")\n\tcertDERBlock, _ := pem.Decode(certPEMBlock)\n\tif certDERBlock == nil || certDERBlock.Type != \"CERTIFICATE\" {\n\t\tlog.Fatalln(\"ERROR: failed to read the CA certificate: unexpected content\")\n\t}\n\tm.caCert, err = x509.ParseCertificate(certDERBlock.Bytes)\n\tfatalIfErr(err, \"failed to parse the CA certificate\")\n\n\tif !pathExists(filepath.Join(m.CAROOT, rootKeyName)) {\n\t\treturn // keyless mode, where only -install works\n\t}\n\n\tkeyPEMBlock, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootKeyName))\n\tfatalIfErr(err, \"failed to read the CA key\")\n\tkeyDERBlock, _ := pem.Decode(keyPEMBlock)\n\tif keyDERBlock == nil || keyDERBlock.Type != \"PRIVATE KEY\" {\n\t\tlog.Fatalln(\"ERROR: failed to read the CA key: unexpected content\")\n\t}\n\tm.caKey, err = x509.ParsePKCS8PrivateKey(keyDERBlock.Bytes)\n\tfatalIfErr(err, \"failed to parse the CA key\")\n}", "title": "" }, { "docid": "198d31d66f569889ec42a3c92dcb25bc", "score": "0.5506726", "text": "func (ca *CA) getCACert() (cert []byte, err error) {\n\tif ca.Config.Intermediate.ParentServer.URL != \"\" {\n\t\tlog.Debugf(\"Getting CA cert; parent server URL is %s\", util.GetMaskedURL(ca.Config.Intermediate.ParentServer.URL))\n\t\tclientCfg := ca.Config.Client\n\t\tif clientCfg == nil {\n\t\t\tclientCfg = &config.ClientConfig{}\n\t\t}\n\t\tclientCfg.TLS = ca.Config.Intermediate.TLS\n\t\tclientCfg.CAName = ca.Config.Intermediate.ParentServer.CAName\n\t\tclientCfg.CSR = ca.Config.CSR\n\t\tif ca.Config.CSR.CN != \"\" {\n\t\t\treturn nil, errors.Errorf(\"CN '%s' cannot be sepcified for an intermediate CA. Remove CN from CSR section for enrollment of intermediate CA to be successful\", ca.Config.CSR.CN)\n\t\t}\n\n\t\tvar resp *api.EnrollmentResponse\n\t\tresp, err = ca.enroll(clientCfg, ca.Config.Intermediate.ParentServer.URL, ca.HomeDir)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tca.Config.CSR.CN = resp.Identity.GetName()\n\t\tecert := resp.Identity.GetECert()\n\t\tif ecert == nil {\n\t\t\treturn nil, errors.New(\"No enrollment certificate returned by parent server\")\n\t\t}\n\t\tcert = ecert.Cert()\n\t\tchainPath := ca.Config.CA.Chainfile\n\t\tchain, err := ca.concatChain(resp.CAInfo.CAChain, cert)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = os.MkdirAll(filepath.Dir(chainPath), 0755)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to create intermediate chain file directory\")\n\t\t}\n\t\terr = util.WriteFile(chainPath, chain, 0644)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"Failed to create intermediate chain file\")\n\t\t}\n\t\tlog.Debugf(\"Stored intermediate certificate chain at %s\", chainPath)\n\t} else {\n\t\tif ca.Config.CSR.CN == \"\" {\n\t\t\tca.Config.CSR.CN = \"rksync-ca\"\n\t\t}\n\t\tcsr := &ca.Config.CSR\n\t\tif csr.CA == nil {\n\t\t\tcsr.CA = &cfcsr.CAConfig{}\n\t\t}\n\t\tif csr.CA.Expiry == \"\" {\n\t\t\tcsr.CA.Expiry = defaultRootCACertificateExpiration\n\t\t}\n\n\t\tif csr.KeyRequest == nil || (csr.KeyRequest.Algo == \"\" && csr.KeyRequest.Size == 0) {\n\t\t\tcsr.KeyRequest = api.NewBasicKeyRequest()\n\t\t}\n\t\treq := cfcsr.CertificateRequest{\n\t\t\tCN: csr.CN,\n\t\t\tNames: csr.Names,\n\t\t\tHosts: csr.Hosts,\n\t\t\tKeyRequest: &cfcsr.BasicKeyRequest{A: csr.KeyRequest.Algo, S: csr.KeyRequest.Size},\n\t\t\tCA: csr.CA,\n\t\t\tSerialNumber: csr.SerialNumber,\n\t\t}\n\t\tlog.Debugf(\"Root CA certificate request: %+v\", req)\n\t\t_, cspSigner, err := util.CCCSPKeyRequestGenerate(&req, ca.csp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcert, _, err = initca.NewFromSigner(&req, cspSigner)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"Failed to create new CA certificate\")\n\t\t}\n\t}\n\treturn cert, nil\n}", "title": "" }, { "docid": "e6fa5385a82879fd7c62b52073685a99", "score": "0.5505649", "text": "func (r *ProjectsLocationsCaPoolsCertificateAuthoritiesService) Create(parent string, certificateauthority *CertificateAuthority) *ProjectsLocationsCaPoolsCertificateAuthoritiesCreateCall {\n\tc := &ProjectsLocationsCaPoolsCertificateAuthoritiesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.certificateauthority = certificateauthority\n\treturn c\n}", "title": "" }, { "docid": "e74b517e1e919d5f6ef8efa0e752cf77", "score": "0.55015254", "text": "func GenerateCertificate(writeDir string, ip string,dns string,genCaCert bool,genServerCert bool, genClientCert bool) error {\n\tdir := filepath.Join(writeDir, \"pki\")\n\tcreateDir(dir)\n\n\tif genCaCert {\n\t\terr :=generateCaCertificates(dir)\n\t\tif err!=nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif genServerCert {\n\t\terr := generateServerCertificates(dir,ip,dns)\n\t\tif err!=nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif genClientCert {\n\t\terr := generateClientCertificates(dir)\n\t\tif err!=nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af719cdfab0c63777a39af52996596cb", "score": "0.55014443", "text": "func (p *PCAProvisioner) Sign(ctx context.Context, cr *cmapi.CertificateRequest) ([]byte, []byte, error) {\n\tblock, _ := pem.Decode(cr.Spec.Request)\n\tif block == nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to decode CSR\")\n\t}\n\n\tvalidityDays := int64(30)\n\tif cr.Spec.Duration != nil {\n\t\tvalidityDays = int64(cr.Spec.Duration.Hours() / 24)\n\t}\n\n\ttempArn := templateArn(p.arn, cr.Spec)\n\n\t// Consider it a \"retry\" if we try to re-create a cert with the same name in the same namespace\n\ttoken := idempotencyToken(cr)\n\n\terr := getSigningAlgorithm(ctx, p)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tissueParams := acmpca.IssueCertificateInput{\n\t\tCertificateAuthorityArn: aws.String(p.arn),\n\t\tSigningAlgorithm: *p.signingAlgorithm,\n\t\tTemplateArn: aws.String(tempArn),\n\t\tCsr: cr.Spec.Request,\n\t\tValidity: &acmpcatypes.Validity{\n\t\t\tType: acmpcatypes.ValidityPeriodTypeDays,\n\t\t\tValue: &validityDays,\n\t\t},\n\t\tIdempotencyToken: aws.String(token),\n\t}\n\n\tissueOutput, err := p.pcaClient.IssueCertificate(ctx, &issueParams)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tgetParams := acmpca.GetCertificateInput{\n\t\tCertificateArn: aws.String(*issueOutput.CertificateArn),\n\t\tCertificateAuthorityArn: aws.String(p.arn),\n\t}\n\n\twaiter := acmpca.NewCertificateIssuedWaiter(p.pcaClient)\n\terr = waiter.Wait(ctx, &getParams, 5*time.Minute)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tgetOutput, err := p.pcaClient.GetCertificate(ctx, &getParams)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcertPem := []byte(*getOutput.Certificate + \"\\n\")\n\tchainPem := []byte(*getOutput.CertificateChain)\n\tchainIntCAs, rootCA, err := splitRootCACertificate(chainPem)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcertPem = append(certPem, chainIntCAs...)\n\n\treturn certPem, rootCA, nil\n}", "title": "" }, { "docid": "130335efa98882b73ff6de3fc295c579", "score": "0.55011237", "text": "func (o DatabaseInstanceReplicaConfigurationOutput) CaCertificate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DatabaseInstanceReplicaConfiguration) *string { return v.CaCertificate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "46041cb4f694426f4952f4871e64c725", "score": "0.549942", "text": "func (o GetDatabaseInstanceReplicaConfigurationOutput) CaCertificate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDatabaseInstanceReplicaConfiguration) string { return v.CaCertificate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "be292c8af2538f997980091ef930430d", "score": "0.54918504", "text": "func (o ConnectionProfileMysqlSslOutput) CaCertificate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ConnectionProfileMysqlSsl) string { return v.CaCertificate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4d4b13d373cfdf42cfa1e491199421f8", "score": "0.54886013", "text": "func GetCertificateAuthorityPEM(caType string) ([]byte, []byte, error) {\n\tcaType = path.Base(caType)\n\tcaCertPath := path.Join(getCertDir(), fmt.Sprintf(\"%s-ca-cert.pem\", caType))\n\tcaKeyPath := path.Join(getCertDir(), fmt.Sprintf(\"%s-ca-key.pem\", caType))\n\n\tcertPEM, err := ioutil.ReadFile(caCertPath)\n\tif err != nil {\n\t\t// certsLog.Error(err)\n\t\treturn nil, nil, err\n\t}\n\n\tkeyPEM, err := ioutil.ReadFile(caKeyPath)\n\tif err != nil {\n\t\t// certsLog.Error(err)\n\t\treturn nil, nil, err\n\t}\n\treturn certPEM, keyPEM, nil\n}", "title": "" }, { "docid": "bb5e452cf2e897621a18a72d55e0f76d", "score": "0.54881346", "text": "func (o ConnectionProfilePostgresqlSslOutput) CaCertificate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ConnectionProfilePostgresqlSsl) string { return v.CaCertificate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5c97c70a3c5d0fc4852f15dd31dc1513", "score": "0.54853296", "text": "func (o ConnectionProfileMysqlProfileSslConfigOutput) CaCertificate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ConnectionProfileMysqlProfileSslConfig) *string { return v.CaCertificate }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
082801ef47ec7fe673e605b2414f960e
Read an int64 at the given offset
[ { "docid": "115e2e33998a0b46847b8300d214baad", "score": "0.6425475", "text": "func ReadLong(file io.ReaderAt, offset int64) (int64, error) {\n\tbuffer, err := ReadChunk(file, offset, 8)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tresult := (int64(buffer[0]&0xff) << 56) + (int64(buffer[1]&0xff) << 48) + (int64(buffer[2]&0xff) << 40) + (int64(buffer[3]) << 32) + (int64(buffer[4]) << 24) + (int64(buffer[5]) << 16) + (int64(buffer[6]) << 8) + (int64(buffer[7]))\n\treturn result, nil\n}", "title": "" } ]
[ { "docid": "07bda6332217c1cc45e553f30b12f545", "score": "0.7608974", "text": "func (self *Countmap) getInt64(offset int64) int64 {\n\t// FIXME - check file length\n\tbuff := make([]byte, int64Size)\n\tself.bytemap.Seek(offset, 0)\n\tself.bytemap.Read(buff)\n\tvalue, _ := binary.Varint(buff)\n\treturn value\n}", "title": "" }, { "docid": "c81f0abde0c66b53a7440f87192b1c57", "score": "0.759334", "text": "func (it *Iterator) ReadInt64() (int64, error) {\n\tc, err := it.nextToken()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tit.head++\n\treturn it.readInt64(c)\n}", "title": "" }, { "docid": "1f9fdc33f58fd16bb3b1d361cf6130f3", "score": "0.75073177", "text": "func readll() int64 {\n\treturn _readInt64()\n}", "title": "" }, { "docid": "1f9fdc33f58fd16bb3b1d361cf6130f3", "score": "0.75073177", "text": "func readll() int64 {\n\treturn _readInt64()\n}", "title": "" }, { "docid": "5b4531af63f50b50a04165747fe18125", "score": "0.750722", "text": "func (sr *StreamReader) ReadInt64() (int64, error) {\n\tbs := sr.buffer[0:8]\n\t_, err := sr.read(bs)\n\treturn int64(bigEndian.Uint64(bs)), err\n}", "title": "" }, { "docid": "7ecd11232739b936ce3e2e4fd7618503", "score": "0.7408209", "text": "func ReadInt64(b []byte) (uint32, int64, error) {\n\tbytecnt, result, err := Read(b, 64, true)\n\treturn bytecnt, result, err\n}", "title": "" }, { "docid": "2853781fceb9e6b410a04ff6e1dad881", "score": "0.7352571", "text": "func (dr *DataReader) ReadInt64() (int64, error) {\n\tx, err := dr.ReadUint64()\n\treturn int64(x), err\n}", "title": "" }, { "docid": "1aa69612765ac33766f054e48a18c356", "score": "0.7323856", "text": "func readll() int64 {\n\treturn readInt64()\n}", "title": "" }, { "docid": "ab8e098a9b56cb1feb24e85dc465541f", "score": "0.7299243", "text": "func (p *Process) ReadInt64(addr uintptr) (int64, error) {\n\tvar v int64\n\te := p.read(addr, &v)\n\treturn v, e\n}", "title": "" }, { "docid": "11f74694424a202e164991f54cf35e46", "score": "0.72709835", "text": "func (b *ByteFrame) ReadInt64() (x int64) {\n\tif !b.rcheck(8) {\n\t\tb.rerr()\n\t}\n\tx = int64(b.byteOrder.Uint64(b.buf[b.index:]))\n\tb.rprologue(8)\n\treturn\n}", "title": "" }, { "docid": "ddbaf812bc3241741afadd2dbf05875d", "score": "0.72359306", "text": "func (c *Codec) ReadInt64() int64 {\n\tc.ReadTypeMarker(TMInt64)\n\treturn int64(c.getIntType())\n}", "title": "" }, { "docid": "c883e99d87a29a00df50e39298324638", "score": "0.7227096", "text": "func (b *Buffer) Read64() uint64 {\n\tv, ok := b.consume(8)\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn order.Uint64(v)\n}", "title": "" }, { "docid": "822ce295e39b525dca236216ada37f32", "score": "0.72012943", "text": "func ReadInt64() int64 {\n\treturn readInt64()\n}", "title": "" }, { "docid": "822ce295e39b525dca236216ada37f32", "score": "0.72012943", "text": "func ReadInt64() int64 {\n\treturn readInt64()\n}", "title": "" }, { "docid": "822ce295e39b525dca236216ada37f32", "score": "0.72012943", "text": "func ReadInt64() int64 {\n\treturn readInt64()\n}", "title": "" }, { "docid": "84e58cbcc161b9df3f808e29800c9e3c", "score": "0.7175818", "text": "func ReadInt64(r io.Reader) (val int64, err error) {\n\tuval, err := ReadUint64(r)\n\tval = int64(uval)\n\treturn\n}", "title": "" }, { "docid": "57fe74e79e8d7baaf79fb421916ff8dd", "score": "0.713754", "text": "func (it *Iterator) ReadUint64() (uint64, error) {\n\tc, err := it.nextToken()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tit.head++\n\treturn it.readUint64(c)\n}", "title": "" }, { "docid": "3eb31a1ca2b164d3eadae1939bb251ff", "score": "0.710466", "text": "func (r *BinReader) Uint64(offset int) uint64 {\n\treturn r.bo.Uint64(r.Read(offset, 8))\n}", "title": "" }, { "docid": "e23546f337c4f7ecfa0f67d22442849f", "score": "0.70762676", "text": "func ReadUint64(b *[]byte, p *int, e *binary.ByteOrder) (i uint64) {\n\tif len((*b)[*p:]) < 8 {\n\t\treturn\n\t}\n\tensureAlignment(p, 8)\n\ti = (*e).Uint64((*b)[*p : *p+8])\n\t*p += 8\n\treturn\n}", "title": "" }, { "docid": "d9d2a9aa3a3b01027da76440cc5d44c3", "score": "0.7072925", "text": "func readUint64(r io.Reader, val *uint64, n uint) error {\n\tvar buf [8]byte\n\tif _, err := r.Read(buf[8-n:]); err != nil {\n\t\treturn err\n\t}\n\t*val = byteOrder.Uint64(buf[:])\n\treturn nil\n}", "title": "" }, { "docid": "797adcdbd7d6c611c1252bbd16aa9645", "score": "0.7020098", "text": "func ReadOffset(buf []byte) uint64 {\n\treturn uint64(binary.LittleEndian.Uint32(buf))\n}", "title": "" }, { "docid": "61c3617bb40a442a149824c89017596e", "score": "0.7005359", "text": "func readInt64(filePath string) (int64, error) {\n\tstr, err := readFirstLine(filePath)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn strconv.ParseInt(str, 10, 64)\n}", "title": "" }, { "docid": "e7b942771d82ac1523b526cdd960aee8", "score": "0.70011854", "text": "func readInt64Little(r io.Reader) (int64, error) {\n\tu, err := readUint64Little(r)\n\treturn int64(u), err\n}", "title": "" }, { "docid": "524957e16dad7ed0ba3aeed3640fb138", "score": "0.6980921", "text": "func (b *BinPack) ReadInt64() (int64, error) {\n\tvar i int64\n\terr := binary.Read(b.fp, b.endianness, &i)\n\treturn i, err\n}", "title": "" }, { "docid": "358f925786062d5da102c59609df198a", "score": "0.69607246", "text": "func readi() int {\n\treturn int(_readInt64())\n}", "title": "" }, { "docid": "358f925786062d5da102c59609df198a", "score": "0.69607246", "text": "func readi() int {\n\treturn int(_readInt64())\n}", "title": "" }, { "docid": "2c38863035b367382be1e1f7bbf06e3f", "score": "0.6932546", "text": "func readi() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "91d9dd902acfbaf6a8ce01385245845f", "score": "0.6843774", "text": "func (r *BinReader) ReadInt64() (int64, error) {\n\tv, err := r.ReadUint64()\n\tif nil != err {\n\t\treturn 0, errors.Trace(err)\n\t}\n\treturn int64(v), nil\n}", "title": "" }, { "docid": "f2befee378c659d92997a4d0a354f695", "score": "0.67105263", "text": "func (d *BufferData) Int64(ix int) (int64, error) {\n\tc, err := d.getChannel(ix, 64, true)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn int64(c.byteOrder.Uint64(d.data[ix])) >> c.Shift, nil\n}", "title": "" }, { "docid": "61639248c80e2276d2e1df8199035ba6", "score": "0.6695748", "text": "func (b *ByteFrame) ReadUint64() (x uint64) {\n\tif !b.rcheck(8) {\n\t\tb.rerr()\n\t}\n\tx = b.byteOrder.Uint64(b.buf[b.index:])\n\tb.rprologue(8)\n\treturn\n}", "title": "" }, { "docid": "3ee61d298b741be39b18577faa542346", "score": "0.6687398", "text": "func readUint64Little(r io.Reader) (uint64, error) {\n\tb, err := readBytes(r, 8)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn binary.LittleEndian.Uint64(b), nil\n}", "title": "" }, { "docid": "49b0568a7154659514b13d72c77e65af", "score": "0.6658574", "text": "func (r *Reader) Uint64() (uint64, error) {\n\tif len(r.data) < 8 {\n\t\treturn 0, errReader\n\t}\n\n\td := binary.BigEndian.Uint64(r.data)\n\tr.advance(8)\n\n\treturn d, nil\n}", "title": "" }, { "docid": "15d0e069ee5778a6bc9f036aa8d48745", "score": "0.6656251", "text": "func (r *Reader) Int64() (int64, error) {\n\ts, err := r.Line()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\ti64, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn i64, nil\n}", "title": "" }, { "docid": "e4157405934d210591f7443d71401379", "score": "0.6645101", "text": "func (p *Process) ReadUint64(addr uintptr) (uint64, error) {\n\tvar v uint64\n\te := p.read(addr, &v)\n\treturn v, e\n}", "title": "" }, { "docid": "ed528667a3fc8092173a23f38a9894c1", "score": "0.6633784", "text": "func (b *BinPack) ReadUInt64() (uint64, error) {\n\tvar i uint64\n\terr := binary.Read(b.fp, b.endianness, &i)\n\treturn i, err\n}", "title": "" }, { "docid": "a7d1965559174ef09383fb6dec95cc74", "score": "0.6623939", "text": "func ReadUint64(b []byte) (uint32, uint64, error) {\n\tbytecnt, result, err := Read(b, 64, false)\n\treturn bytecnt, uint64(result), err\n}", "title": "" }, { "docid": "c1cb05e2ecc52e9c9441e47fba9dbb33", "score": "0.6611353", "text": "func ReadUint64(data []byte, pos int) (uint64, int, bool) {\n\tif pos+7 >= len(data) {\n\t\treturn 0, 0, false\n\t}\n\treturn binary.LittleEndian.Uint64(data[pos : pos+8]), pos + 8, true\n}", "title": "" }, { "docid": "bdb213603f2ea419f4c474c0a8f6b5d8", "score": "0.6611233", "text": "func (p *Packet) ReadUint64() (v uint64) {\n\treturn (*pktconn.Packet)(p).ReadUint64()\n}", "title": "" }, { "docid": "4ed33b84f8c086218cc870f9e9c3891f", "score": "0.6599496", "text": "func ReadUint64(r io.Reader) (val uint64, err error) {\n\tvar util [8]byte\n\t_, err = r.Read(util[:8])\n\tval = binary.BigEndian.Uint64(util[:8])\n\treturn\n}", "title": "" }, { "docid": "8b71c68e09344ee7d35ea9158032359c", "score": "0.65920275", "text": "func (s *ReadSuite) TestReadBinaryInteger64BitLittleEndian(c *C) {\n\tblock := []byte(\"\\x10\\x01\\x10\\x01\\x10\\x01\\x10\\x01\")\n\tblockLength := 8\n\tbyteOrder := binary.LittleEndian\n\tvalue, err := readBinaryInteger(block, blockLength, byteOrder)\n\tc.Assert(err, IsNil)\n\tc.Assert(value, Equals, int64(76562361914229008))\n}", "title": "" }, { "docid": "f2a2a90f1f8235408d717eccc53de32a", "score": "0.6590602", "text": "func (c *Codec) ReadUint64() uint64 {\n\tc.ReadTypeMarker(TMUint64)\n\treturn c.getIntType()\n}", "title": "" }, { "docid": "b55e29ed18411e5a4ed80947dadc1847", "score": "0.65806305", "text": "func (p *Packet) ReadUint64() (v uint64) {\n\treturn packetEndian.Uint64(p.ReadBytes(8))\n}", "title": "" }, { "docid": "0596572d314f4974c5c23178d5c6a525", "score": "0.6563847", "text": "func (r *ReadBuffer) ReadUint64() uint64 {\n\tif b := r.ReadBytes(8); b != nil {\n\t\treturn binary.BigEndian.Uint64(b)\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "295ba0e33da3d4a5efeefa93ec33c8c1", "score": "0.6559801", "text": "func (dec *BinaryDecoder) ReadInt64(value *int64) error {\n\tif _, err := io.ReadFull(dec.r, dec.bs[:8]); err != nil {\n\t\treturn BadDecodingError\n\t}\n\t*value = int64(binary.LittleEndian.Uint64(dec.bs[:8]))\n\treturn nil\n}", "title": "" }, { "docid": "3acdb490c62ef20d17957a5fa9d1ee1d", "score": "0.65552646", "text": "func (dr *DataReader) PeekUint64() (uint64, error) {\n\tbuf, err := dr.br.Peek(8)\n\tif err != nil || len(buf) != 8 {\n\t\treturn 0, err\n\t}\n\treturn binary.LittleEndian.Uint64(buf[:]), nil\n}", "title": "" }, { "docid": "fb3b865f4a6770a3faa6ab88d0ea60c5", "score": "0.6534466", "text": "func ReadIntBytes(p []byte) (i int64, n int, err error) { return readIntBytes(p) }", "title": "" }, { "docid": "215ecc6b4f9a42a34958931b91734370", "score": "0.6510227", "text": "func (r reader) ReadUint64() (uint64, error) {\n\tb := make([]byte, 8)\n\tif _, err := io.ReadFull(r, b); err != nil {\n\t\treturn 0, err\n\t}\n\treturn binary.LittleEndian.Uint64(b), nil\n}", "title": "" }, { "docid": "f26128bac635446d0325054d07b64761", "score": "0.6499063", "text": "func (r *Reader) Uint64() uint64 {\n\tb := r.rd(8)\n\tif b == nil {\n\t\treturn 0\n\t}\n\treturn r.ByteOrder.Uint64(b)\n}", "title": "" }, { "docid": "2898f1a506268f6d7a44870d17c061b8", "score": "0.64913374", "text": "func (p *Packet) ReadUint64() uint64 {\n\tif checkError(p.Skip(8)) {\n\t\treturn 0\n\t}\n\t// return uint64((p.ReadUint32() << 32) | p.ReadUint32())\n\treturn binary.BigEndian.Uint64(p.FrameBuffer[p.ReadIndex-8:])\n}", "title": "" }, { "docid": "243ac94620baf9ed66c8efbf8c31c115", "score": "0.6485731", "text": "func Int64() (i int64) {\n\trandomBits(r)\n\tbuf := bytes.NewBuffer(r)\n\tbinary.Read(buf, binary.LittleEndian, &i)\n\treturn i\n}", "title": "" }, { "docid": "cf221d18dc8c3ff54abaec16b25aaca6", "score": "0.6477317", "text": "func (s *ReadSuite) TestReadBinaryUnsignedInteger64BitLittleEndian(c *C) {\n\tblock := []byte(\"\\x10\\x01\\x10\\x01\\x10\\x01\\x10\\x01\")\n\tblockLength := 8\n\tbyteOrder := binary.LittleEndian\n\tvalue, err := readBinaryUnsignedInteger(block, blockLength, byteOrder)\n\tc.Assert(err, IsNil)\n\tc.Assert(value, Equals, uint64(76562361914229008))\n}", "title": "" }, { "docid": "a6090eb150e73d656d824274f43ecb2e", "score": "0.64643776", "text": "func (db *DB) fetchInt64(key []byte) int64 {\n\tblob, err := db.lvl.Get(key, nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tval, read := binary.Varint(blob)\n\tif read <= 0 {\n\t\treturn 0\n\t}\n\treturn val\n}", "title": "" }, { "docid": "1d7e93ca2222d3cf97e80785c58de78f", "score": "0.64595234", "text": "func (r *Reader) Uint64() (uint64, error) {\n\ts, err := r.Line()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tui64, err := strconv.ParseUint(s, 10, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ui64, nil\n}", "title": "" }, { "docid": "9a0954d722558539404a877e2f41ca4f", "score": "0.64511955", "text": "func readInt64(filePath string) (int64, error) {\n\tdata, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\ts := strings.TrimSpace(string(data))\n\tval, err := strconv.ParseInt(s, 10, 64)\n\t// overflow errors are ok, we'll get return a math.MaxInt64 value which is more\n\t// than enough anyway. For underflow we'll return MinInt64 and the error.\n\tif err != nil && err.(*strconv.NumError).Err == strconv.ErrRange {\n\t\tif s[0] == '-' {\n\t\t\treturn math.MinInt64, err\n\t\t}\n\t\treturn math.MaxInt64, nil\n\t} else if err != nil {\n\t\treturn -1, err\n\t}\n\treturn val, nil\n}", "title": "" }, { "docid": "9870f166c62177e30657d7efc19b7a7e", "score": "0.640699", "text": "func Pread64(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {\n\tfd := args[0].Int()\n\taddr := args[1].Pointer()\n\tsize := args[2].SizeT()\n\toffset := args[3].Int64()\n\n\tfile := t.GetFile(fd)\n\tif file == nil {\n\t\treturn 0, nil, linuxerr.EBADF\n\t}\n\tdefer file.DecRef(t)\n\n\t// Check that the offset is legitimate and does not overflow.\n\tif offset < 0 || offset+int64(size) < 0 {\n\t\treturn 0, nil, linuxerr.EINVAL\n\t}\n\n\t// Check that the size is legitimate.\n\tsi := int(size)\n\tif si < 0 {\n\t\treturn 0, nil, linuxerr.EINVAL\n\t}\n\n\t// Get the destination of the read.\n\tdst, err := t.SingleIOSequence(addr, si, usermem.IOOpts{\n\t\tAddressSpaceActive: true,\n\t})\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\tn, err := pread(t, file, dst, offset, vfs.ReadOptions{})\n\tt.IOUsage().AccountReadSyscall(n)\n\treturn uintptr(n), nil, HandleIOError(t, n != 0, err, linuxerr.ERESTARTSYS, \"pread64\", file)\n}", "title": "" }, { "docid": "2a88b815b9de1c8f715ddc174cc4bf82", "score": "0.63975954", "text": "func ReadInt() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "2a88b815b9de1c8f715ddc174cc4bf82", "score": "0.63975954", "text": "func ReadInt() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "2a88b815b9de1c8f715ddc174cc4bf82", "score": "0.63975954", "text": "func ReadInt() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "35e2ba9a4a55f07d62e4f083a61761ba", "score": "0.6385622", "text": "func (dr *DataReader) ReadUint64() (uint64, error) {\n\tvar buf [8]byte\n\tif _, err := io.ReadFull(dr.br, buf[:]); err != nil {\n\t\treturn 0, err\n\t}\n\treturn binary.LittleEndian.Uint64(buf[:]), nil\n}", "title": "" }, { "docid": "6a257a3f0123c79dd469487ac52a268e", "score": "0.63757735", "text": "func (l binaryFreeList) Uint64(r io.Reader, byteOrder binary.ByteOrder) (uint64, error) {\n\tbuf := l.Borrow()[:8]\n\tif _, err := io.ReadFull(r, buf); err != nil {\n\t\tl.Return(buf)\n\t\treturn 0, err\n\t}\n\trv := byteOrder.Uint64(buf)\n\tl.Return(buf)\n\treturn rv, nil\n}", "title": "" }, { "docid": "b24b1f98a3f3a8d381e8ac750118ef54", "score": "0.6354833", "text": "func getInt64(b []byte) int64 {\n\treturn int64(binary.BigEndian.Uint64(b))\n}", "title": "" }, { "docid": "c01082f9265bbe93c87ef4bd02b36f53", "score": "0.6351264", "text": "func (f *Factory) readDataOffset() (int64, error) {\n\tvalue, err := f.vhdReader.ReadInt64(f.headerOffset + 8)\n\tif err != nil {\n\t\treturn -1, NewParseError(\"DataOffset\", err)\n\t}\n\treturn value, nil\n}", "title": "" }, { "docid": "e8685a1d75bcf3dd364f384502cb1cdb", "score": "0.6350817", "text": "func LoadInt64(addr *int64) (val int64) {\n\treturn atomic.LoadInt64(addr)\n}", "title": "" }, { "docid": "b34723e148e75e6d9c63f905f6f31819", "score": "0.6323029", "text": "func (b BigEndian) ReadUint64() uint64 {\n\t_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808\n\n\treturn uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |\n\t\tuint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56\n}", "title": "" }, { "docid": "c6844378e8ed0f85a2729a251dd4ffb8", "score": "0.62705874", "text": "func (rwops *RWops) ReadLE64() uint64 {\n\tif rwops == nil {\n\t\treturn 0\n\t}\n\tr1, r2, _ := readLE64.Call(uintptr(unsafe.Pointer(rwops)))\n\treturn uint64(r2)<<32 + uint64(r1)\n}", "title": "" }, { "docid": "d434cdee5e71032c55551b4c3c3175c5", "score": "0.6264969", "text": "func (p *Packet) Uint64() uint64 {\n\tif p.idx+7 >= p.length {\n\t\tp.Err = ErrReadPastEndData\n\t\treturn 0\n\t}\n\tv := p.endian.Uint64(p.buf[p.idx:])\n\tp.idx += 8\n\treturn v\n}", "title": "" }, { "docid": "d0ce5d782f0d7299f6b12c66eb398c7e", "score": "0.62556607", "text": "func GetInt64Val(key string, offset int, defaultVal int64) (int64, *ConfigEntry) {\n val, entry, err := getIntVal(key, offset, 64)\n if err != nil {\n log.Debug(ERR_KEY_NOT_FOUND, key, defaultVal)\n return defaultVal, entry\n }\n\n return val, entry\n}", "title": "" }, { "docid": "60cb6004cc2b58cc0fc4753d16e77e17", "score": "0.62493986", "text": "func (s *source) Uint64() (val uint64) {\n\tlock.RLock()\n\tdefer lock.RUnlock()\n\tif err := binary.Read(rand.Reader, binary.BigEndian, &val); err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "049400bdc173a4529ae0a5a4ec250ad9", "score": "0.62227285", "text": "func (r *BinReader) ReadUint64() (uint64, error) {\n\tdata, err := r.next(8)\n\tif nil != err {\n\t\treturn 0, errors.Trace(err)\n\t}\n\treturn binary.LittleEndian.Uint64(data), nil\n}", "title": "" }, { "docid": "bf7c7f76b0482988dade5c7e4bc29b73", "score": "0.6211716", "text": "func GetInt64(name string) (int64, error) {\n\ti, err := lookup(name)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tv, err := strconv.ParseInt(i, 10, 64)\n\tif err != nil {\n\t\treturn 0, NewError(InvalidType, name, err.Error())\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "a9a5bce019433fd99f34f982a2ff65b7", "score": "0.6210448", "text": "func ByteArrToInt64(arr *[]byte, offset *int, isBigEndian bool) (int64, bool) {\n\tunsignedNum, success := ByteArrToUInt64(arr, offset, isBigEndian)\n\treturn int64(unsignedNum), success\n}", "title": "" }, { "docid": "2b76159b6b2bae420acbfc01dcf256da", "score": "0.6199493", "text": "func (d *BufferData) Uint64(ix int) (uint64, error) {\n\tc, err := d.getChannel(ix, 64, false)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn c.byteOrder.Uint64(d.data[ix]) >> c.Shift, nil\n}", "title": "" }, { "docid": "502067e5123e4283566cedb2e3daf89d", "score": "0.6196109", "text": "func (rdr *NpyReader) GetInt64() ([]int64, error) {\n\n\tif rdr.Dtype != \"i8\" {\n\t\treturn nil, fmt.Errorf(\"Reader does not contain int64 data\")\n\t}\n\n\tdata := make([]int64, rdr.nElt)\n\terr := binary.Read(rdr.r, rdr.Endian, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "382fc386442e7def0d5c926ab3bdf56f", "score": "0.61852795", "text": "func DecoderInputOffset(d *xml.Decoder,) int64", "title": "" }, { "docid": "436069a2c95cde04374930be1c73946c", "score": "0.6179279", "text": "func GetInt64(key string) int64 {\n\treturn o.GetInt64(key)\n}", "title": "" }, { "docid": "7db2dd5379be859a2164248a9428cd21", "score": "0.61752266", "text": "func (s *ReadSuite) TestReadBinaryInteger64BitBigEndian(c *C) {\n\tblock := []byte(\"\\x10\\x01\\x10\\x01\\x10\\x01\\x10\\x01\")\n\tblockLength := 8\n\tbyteOrder := binary.BigEndian\n\tvalue, err := readBinaryInteger(block, blockLength, byteOrder)\n\tc.Assert(err, IsNil)\n\tc.Assert(value, Equals, int64(1153220576333074433))\n}", "title": "" }, { "docid": "e3b794f7d6bca6df6a56f0927a3ba2b5", "score": "0.6172857", "text": "func (v *Value) Int64() int64 {\n\tif v == nil || v.offset == 0 || v.data == nil {\n\t\tpanic(ErrUninitializedElement)\n\t}\n\tif v.data[v.start] != '\\x12' {\n\t\tpanic(ElementTypeError{\"compact.Element.int64Type\", Type(v.data[v.start])})\n\t}\n\treturn int64(binary.LittleEndian.Uint64(v.data[v.offset : v.offset+8]))\n}", "title": "" }, { "docid": "3d86fb3fa28f61494284530cf979a789", "score": "0.61721206", "text": "func (reader *Reader) GetKeyPartInt64(counterId int32, offset int32) (int64, error) {\n\tif err := reader.validateCounterIdAndOffset(counterId, offset+util.SizeOfInt64); err != nil {\n\t\treturn 0, err\n\t}\n\tmetaDataOffset := counterId * METADATA_LENGTH\n\trecordStatus := reader.metaData.GetInt32Volatile(metaDataOffset)\n\tif recordStatus != RECORD_ALLOCATED {\n\t\treturn 0, fmt.Errorf(\"counterId=%d recordStatus=%d\", counterId, recordStatus)\n\t}\n\treturn reader.metaData.GetInt64(metaDataOffset + KEY_OFFSET + offset), nil\n}", "title": "" }, { "docid": "b3cc83652f0592f60b62b8ea6e30ed4b", "score": "0.6154822", "text": "func (r *Reader) ReadLong() int64 {\n\tvar val uint64\n\tvar offset int8\n\n\tfor r.Error == nil {\n\t\tif offset == maxLongBufSize {\n\t\t\tr.ReportError(\"ReadLong\", \"long overflow\")\n\t\t\treturn 0\n\t\t}\n\n\t\tb := r.readByte()\n\t\tval |= uint64(b&0x7F) << uint(7*offset)\n\t\tif b&0x80 == 0 {\n\t\t\tbreak\n\t\t}\n\t\toffset++\n\t}\n\n\treturn int64((val >> 1) ^ -(val & 1))\n}", "title": "" }, { "docid": "869a531039f715925ae04d0d9bb87469", "score": "0.61430854", "text": "func LoLseek64(db XODB, v0 int, v1 int64, v2 int) (int64, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.lo_lseek64($1, $2, $3)`\n\n\t// run query\n\tvar ret int64\n\tXOLog(sqlstr, v0, v1, v2)\n\terr = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "0b35abb9edbafe5e1010c5f7bbd25459", "score": "0.6118271", "text": "func LoTell64(db XODB, v0 int) (int64, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.lo_tell64($1)`\n\n\t// run query\n\tvar ret int64\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "96136452a15e13543a71f5e9225c14ee", "score": "0.6109053", "text": "func ReadInt(rd io.Reader) (uint64, error) {\n\tvar num uint64\n\tvar err error\n\tvar b byte = 0x80\n\tvar digits uint64\n\t\n\tfor (b & 0x80) == 0x80 {\n\t\tb, err = readByte(rd)\n\t\tif err != nil {\n\t\t\treturn num, err\n\t\t}\n\t\t\n\t\tdigits = uint64(b & 0x7F)\n\t\tnum = num << 7;\n\t\tnum |= digits;\n\t}\n\t\n\treturn num, nil\n}", "title": "" }, { "docid": "0f9c578adf68c48d0bc02ecfabd711f5", "score": "0.61044824", "text": "func (s *Store) Int64(r interface{}, err error) (int64, error) {\n\treturn redis.Int64(r, err)\n}", "title": "" }, { "docid": "da8107198f4a18bc465136e4d4230059", "score": "0.61008495", "text": "func (self *TiffData) Int64() int64 {\n\tnumBytes := len(self.slice)\n\tmsb := 1 << ((uint8(numBytes) * 8) - 1) // shift 1 to msb\n\tv := self.Uint64() // unsigned value\n\t// fmt.Printf(\"msb = %b; v = %v\\n\", msb, v)\n\tif msb&int(v) == msb { // msb is 1\n\t\tv = -v // negate the value\n\t}\n\n\treturn int64(v)\n}", "title": "" }, { "docid": "eb5ed12aaec9b9229dede70804ed232a", "score": "0.60881484", "text": "func (r *HashStorageType2RedisController) GetInt64(key string, field string) (value int64, err error) {\n\t// redis conn\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t// get field\n\treturn github_com_gomodule_redigo_redis.Int64(conn.Do(\"HGET\", key, field))\n}", "title": "" }, { "docid": "294b15d07cc0494b41dc14c88592fb30", "score": "0.6082077", "text": "func parseInt64(bytes []byte) (ret int64, err error) {\n\tif len(bytes) > 8 {\n\t\t// We'll overflow an int64 in this case.\n\t\terr = errors.New(\"integer too large\")\n\t\treturn\n\t}\n\tfor bytesRead := 0; bytesRead < len(bytes); bytesRead++ {\n\t\tret <<= 8\n\t\tret |= int64(bytes[bytesRead])\n\t}\n\n\t// Shift up and down in order to sign extend the result.\n\tret <<= 64 - uint8(len(bytes))*8\n\tret >>= 64 - uint8(len(bytes))*8\n\treturn\n}", "title": "" }, { "docid": "da3f82c94a60eb5326119d44757c1755", "score": "0.60813874", "text": "func GetProcInt64(path string) (result int64, err error) {\n\tresultString, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif strings.HasSuffix(string(resultString), \"\\n\") {\n\t\tresultString = resultString[0 : len(resultString)-1]\n\t}\n\n\treturn strconv.ParseInt(string(resultString), 0, 64)\n}", "title": "" }, { "docid": "321788218f01773874d143227ad23b87", "score": "0.60800916", "text": "func (ini *Ini) GetInt64(sectionName, key string) (int64, error) {\n\tif section, ok := ini.sections[sectionName]; ok {\n\t\treturn section.GetInt64(key)\n\t}\n\treturn 0, noSuchSection(sectionName)\n}", "title": "" }, { "docid": "c9d943173e33c5ba012ba6f01f3cca0c", "score": "0.60703456", "text": "func Int64ValueFromBytes(bytes []byte) (int64Value Int64Value, consumedBytes int, err error) {\n\tmarshalUtil := marshalutil.New(bytes)\n\tif int64Value, err = Int64ValueFromMarshalUtil(marshalUtil); err != nil {\n\t\terr = xerrors.Errorf(\"failed to parse Int64Value from MarshalUtil: %w\", err)\n\n\t\treturn\n\t}\n\tconsumedBytes = marshalUtil.ReadOffset()\n\n\treturn\n}", "title": "" }, { "docid": "ada42f9f36506f6dcfec99e73678e187", "score": "0.6055011", "text": "func (self *url) Int64(id string) int64 {\n var rtn int64 = 0\n var raw, found = self.c.vars[id]\n if found {\n var _, err = fmt.Sscanf(raw, \"%d\", &rtn)\n if err != nil {\n n.Log(\"Failed reading incoming url param: %s is not int64\", raw[0])\n n.Log(err.Error())\n }\n }\n return rtn\n}", "title": "" }, { "docid": "6858ad9f95b06db7879a047440062baf", "score": "0.6031279", "text": "func (client *Client) GetInt64(key string) (int64, error) {\n\tresp, err := client.KeysAPI.Get(context.Background(), key, nil)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn strconv.ParseInt(resp.Node.Value, 10, 64)\n}", "title": "" }, { "docid": "4518d64e2c3cb5c5f79e6e2d92309853", "score": "0.6026991", "text": "func parseInt64FromString(ctx context.Context, src usermem.IOSequence) (val, len int64, err error) {\n\tconst maxInt64StrLen = 20 // i.e. len(fmt.Sprintf(\"%d\", math.MinInt64)) == 20\n\n\tbuf := copyScratchBufferFromContext(ctx, maxInt64StrLen)\n\tn, err := src.CopyIn(ctx, buf)\n\tif err != nil {\n\t\treturn 0, int64(n), err\n\t}\n\tstr := strings.TrimSpace(string(buf[:n]))\n\n\tval, err = strconv.ParseInt(str, 10, 64)\n\tif err != nil {\n\t\t// Note: This also handles zero-len writes if offset is beyond the end\n\t\t// of src, or src is empty.\n\t\tctx.Debugf(\"cgroupfs.parseInt64FromString: failed to parse %q: %v\", str, err)\n\t\treturn 0, int64(n), linuxerr.EINVAL\n\t}\n\n\treturn val, int64(n), nil\n}", "title": "" }, { "docid": "4d727dd456fd6a138b63bc089aa746ca", "score": "0.60262793", "text": "func (ar *Reader) readInt(b []byte, base int) int64 {\n\ts := string(bytes.TrimSpace(b))\n\trv, err := strconv.ParseInt(s, base, 64)\n\tif err != nil {\n\t\tar.err = err\n\t\treturn 0\n\t}\n\treturn rv\n}", "title": "" }, { "docid": "53ea728fc20405b84ca5635bcf10604d", "score": "0.6025855", "text": "func ReadVarIntAndDecode64(r io.Reader) (int64, error) {\n\tencodedLen, err := ReadVarIntToUint(r)\n\tif err != nil {\n\t\treturn 0, oerror.NewTrace(err)\n\t}\n\treturn ZigzagDecodeInt64(encodedLen), nil\n}", "title": "" }, { "docid": "d6a45dd4800be81dffa6cb3f7144991c", "score": "0.6022911", "text": "func (r *HashStorageTypeRedisController) GetInt64(key string, field string) (value int64, err error) {\n\t// redis conn\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t// get field\n\treturn github_com_gomodule_redigo_redis.Int64(conn.Do(\"HGET\", key, field))\n}", "title": "" }, { "docid": "213dddc58ec2225c790e39bfcb85a2d7", "score": "0.60122037", "text": "func (rwops *RWops) ReadBE64() uint64 {\n\tif rwops == nil {\n\t\treturn 0\n\t}\n\tr1, r2, _ := readBE64.Call(uintptr(unsafe.Pointer(rwops)))\n\treturn uint64(r2)<<32 + uint64(r1)\n}", "title": "" }, { "docid": "46c217503734f86053ffb1495ef41e85", "score": "0.6011319", "text": "func decodeInt(r io.ByteReader) (int64, error) {\n\tresult := int64(0)\n\tvar shift uint8\n\n\tfor {\n\t\traw, err := r.ReadByte()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tb := raw - 63\n\t\tresult += int64(b&0x1f) << shift\n\t\tshift += 5\n\n\t\tif b < 0x20 {\n\t\t\tbit := result & 1\n\t\t\tresult >>= 1\n\t\t\tif bit != 0 {\n\t\t\t\tresult = ^result\n\t\t\t}\n\t\t\treturn result, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1f4d0fa6599a58869e3cfc80db651212", "score": "0.6007296", "text": "func (n Number) Int64() (int64, error) {\n\treturn n.intOfBitSize(64)\n}", "title": "" }, { "docid": "6d2793b41e380cd43b22188006e3a572", "score": "0.6003425", "text": "func ReadInt64Slice(n int) []int64 {\n\tb := make([]int64, n)\n\tfor i := 0; i < n; i++ {\n\t\tb[i] = ReadInt64()\n\t}\n\treturn b\n}", "title": "" }, { "docid": "6d2793b41e380cd43b22188006e3a572", "score": "0.6003425", "text": "func ReadInt64Slice(n int) []int64 {\n\tb := make([]int64, n)\n\tfor i := 0; i < n; i++ {\n\t\tb[i] = ReadInt64()\n\t}\n\treturn b\n}", "title": "" } ]
ccb0ca3240bbf4923d830e9b6d230477
FetchPopulation looks up the population of country from wikidata. In case of error, the population is set to 1. Note: country selection is not yet implemented, it's hard coded to be Hungary at the moment.
[ { "docid": "2095a8274c2e1cfdf6ac0f3394fcae65", "score": "0.84452146", "text": "func FetchPopulation(country string) (int, error) {\n\t// wikidata endpoint\n\tendpoint := \"https://query.wikidata.org/sparql\"\n\n\tquery := \"SELECT ?population WHERE { \" +\n\t\t\"?country wdt:P31 wd:Q6256.\" +\n\t\t\"?country wdt:P17 wd:Q28.\" +\n\t\t\"?country wdt:P1082 ?population.\" +\n\t\t\"SERVICE wikibase:label { bd:serviceParam wikibase:language \\\"en\\\". }}\"\n\n\tform := url.Values{}\n\tform.Set(\"format\", \"json\")\n\tform.Set(\"query\", query)\n\treqBody := bytes.NewBuffer([]byte(form.Encode()))\n\n\treq, err := http.NewRequestWithContext(context.Background(), http.MethodPost, endpoint, reqBody)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"cannot create http request to wikibase | %w\", err)\n\t}\n\n\treq.Header.Add(\"User-Agent\", \"covidtracker\")\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"cannot fetch wikibase response | %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"cannot read body of wikibase response | %w\", err)\n\t}\n\n\tbodyJSON := string(body)\n\n\tnum := gjson.Get(bodyJSON, \"results.bindings.0.population.value\").Int()\n\n\treturn int(num), nil\n}", "title": "" } ]
[ { "docid": "11cd8af6b471334d64e78a51efdb3bb2", "score": "0.5921825", "text": "func (n *NLopt) GetPopulation() uint {\n\tvar cPop C.uint = C.nlopt_get_population(n.cOpt)\n\treturn uint(cPop)\n}", "title": "" }, { "docid": "eb89f28af2bcb14bfd25fbc63f8f4658", "score": "0.5779868", "text": "func (b *Lifeboi) GetPopulation() int {\n\tpop := 0\n\tfor i := 0; i < b.height; i++ {\n\t\tfor j := 0; j < b.width; j++ {\n\t\t\tpop += b.getCell(i, j)\n\t\t}\n\t}\n\n\treturn pop\n}", "title": "" }, { "docid": "4a11b0db41daa29c1fe93f119be4dd17", "score": "0.56121916", "text": "func Fetch() (*Response, error) {\n\treturn fetchInfoFromAPI(urlForAllCountries)\n}", "title": "" }, { "docid": "1e9d0b713198d0254c7e56360c1b2327", "score": "0.5509507", "text": "func (c *countryDB) Fetch(id string) (*country.CountryType, error) {\n\tctx := context.Background()\n\n\tvar country country.CountryType\n\terr := models.MCountries(\n\t\tqm.Select(\"id, country_code, name\"),\n\t\tqm.Where(\"id=?\", id),\n\t).Bind(ctx, c.dbConn, &country)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to call models.MCountries().Bind() in Fetch()\")\n\t}\n\n\treturn &country, nil\n}", "title": "" }, { "docid": "b75e07e6f5a5fe6e37ea106c1875e67c", "score": "0.5307091", "text": "func WBGetPopulationDataById(id string, startYear, endYear string) []CountryPopulationByYear {\n\tvar itemsPerPage = \"100\"\n\tvar dateRange = \"\"\n\tvar pd []CountryPopulationByYear\n\n\tif hc == nil {\n\t\thc = NewHttpClient(WBPopScheme, WBPopHost, WBPopPort, \"\", \"\")\n\t}\n\n\tif startYear == \"\" {\n\t\tstartYear = time.Now().Format(\"YYYY\")\n\t}\n\tif endYear == \"\" {\n\t\tendYear = startYear\n\t}\n\tdateRange = startYear + \":\" + endYear\n\n\t// Format the URL\n\turi := getCountryPopURI(id)\n\t// Append the query string\n\tlog.Printf(\"Country Population: requesting %s.\\n\", uri)\n\tresp, err := hc.getRequest(uri + buildQuery(map[string]string{\n\t\t\"format\":\"json\", \"date\": dateRange, \"per_page\": itemsPerPage}))\n\tif err != nil {\n\t\tlog.Printf(\"%s\\n\", err)\n\t}\n\n\trespMap := decodeResponseToMap(resp).([]interface{})\n\tlog.Printf(\"Received: %v\\n\", respMap)\n\n\t// The first record contains information about the response data.\n\t// Page number, number of pages, number of records per page, and total number of records.\n\tri := mapToResponseHdr(respMap[0].(map[string]interface{}))\n\tif ri.Total == 0 {\n\t\tlog.Printf(\"No results returned for %s.\", id)\n\t\treturn []CountryPopulationByYear{}\n\t}\n\n\t// Skip over the first record to the start of the data\n\tdata := respMap[1].([]interface{})\n\tlog.Printf(\"Country Population: loading: %d pages, %s items per page %d total items.\\n\", ri.Pages, ri.PerPage, ri.Total)\n\n\tfor pg := 1; pg <= ri.Pages; pg++ {\n\t\t// Unmarshall from JSON, and append to the slice\n\t\tpd = unmarshalPopulationData(data, pd)\n\n\t\t// Fetch next page, must page the page number in the request.\n\t\tresp, err := hc.getRequest(uri + buildQuery(map[string]string{\n\t\t\t\"format\":\"json\", \"per_page\": itemsPerPage, \"page\": fmt.Sprintf(\"%d\", pg + 1)}))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s\\n\", err)\n\t\t}\n\t\trespMap = decodeResponseToMap(resp).([]interface{})\n\t\tdata = respMap[1].([]interface{})\n\t}\n\t//log.Printf(\"PopulationData: %+v.\\n\", pd)\n\treturn pd\n}", "title": "" }, { "docid": "cbb5738d00df5c998df5ec206c10a5c4", "score": "0.5120165", "text": "func setPopulation(d *int) {\n\n\tfmt.Print(\"Please enter the cities population: \")\n\t_, err := fmt.Scanf(\"%d\\n\", d)\n\tif err != nil { fmt.Println(err) }\n}", "title": "" }, { "docid": "60ffe91ae9715ce5da7e0c71b4a5cd5d", "score": "0.5086585", "text": "func (s *Service) FetchCountries() (CountriesResponse, error) {\n\tvar countries CountriesResponse\n\terr := s.fetchData(\"/countries\", &countries)\n\n\treturn countries, err\n}", "title": "" }, { "docid": "487c1ee02dd6c1545d47a673212e3fb3", "score": "0.50234175", "text": "func (n *NLopt) SetPopulation(pop uint) error {\n\treturn n.cFuncResult(\n\t\tfunc() C.nlopt_result {\n\t\t\treturn C.nlopt_set_population(n.cOpt, (C.uint)(pop))\n\t\t})\n}", "title": "" }, { "docid": "6a2390ab1cf421138e3b966dd2dd26be", "score": "0.50124645", "text": "func FetchForOneCountry(country string) (*Response, error) {\n\turl := getURL(country)\n\treturn fetchInfoFromAPI(url)\n}", "title": "" }, { "docid": "99f7d9cfffafb7c9039b6ee06f07977c", "score": "0.49617523", "text": "func GetOneCountry(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvars := mux.Vars(r)\n\tfinalResponse := map[string]interface{}{}\n\tpowerData := []models.GlobalPowerPlants{}\n\tfuelData := []models.FuelAggregates{}\n\n\tdb.DB.Where(\"country = ?\", vars[\"code\"]).Find(&powerData)\n\n\tdb.DB.Raw(`select primary_fuel, sum(gwh) as total from\n\t\t(select country, primary_fuel,\n\t\tCASE when generation_gwh2017=0 OR generation_gwh2017='' or generation_gwh2017 is null THEN estimated_generation_gwh\n\t\t\telse generation_gwh2017\n\t\tEND as gwh\n\t\tfrom global_power_plants where country=?) a\n\tgroup by primary_fuel order by total desc`, vars[\"code\"]).Scan(&fuelData)\n\n\tfinalResponse[\"power\"] = powerData\n\tfinalResponse[\"fuel\"] = fuelData\n\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(finalResponse)\n}", "title": "" }, { "docid": "55648a45807442ccc8668d9f8ba43693", "score": "0.48484308", "text": "func (puo *PlanetUpdateOne) SetPopulation(i int64) *PlanetUpdateOne {\n\tpuo.mutation.ResetPopulation()\n\tpuo.mutation.SetPopulation(i)\n\treturn puo\n}", "title": "" }, { "docid": "fcad86e68d9edb7194643aace925c9c4", "score": "0.46998677", "text": "func (s *Service) FetchDataForCountry(country string) (*Stats, error) {\n\tvar data Stats\n\terr := s.fetchData(fmt.Sprintf(\"/countries/%s\", country), &data)\n\n\treturn &data, err\n}", "title": "" }, { "docid": "93af0919faa9ca98c4be7f9eb836cb83", "score": "0.4657229", "text": "func (res *CountryResource) CountryFetcher() http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tif len(req.URL.Query()) > 0 {\n\t\t\terr := errors.BadRequest.New(\"invalid query params\")\n\t\t\tlog.Error(err)\n\t\t\tSendError(rw, err)\n\t\t\treturn\n\t\t}\n\t\tcountries, err := res.env.ReadAllCountries()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn\n\t\t}\n\t\tres.writer.Write(rw, countries)\n\t}\n}", "title": "" }, { "docid": "80b130bcb2819672fff68e9896b3a879", "score": "0.4629527", "text": "func (c *countryDB) FetchByName(name string) (*country.CountryType, error) {\n\tctx := context.Background()\n\n\tvar country country.CountryType\n\terr := models.MCountries(\n\t\tqm.Select(\"id, country_code, name\"),\n\t\tqm.Where(\"name=?\", name),\n\t).Bind(ctx, c.dbConn, &country)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to call models.MCountries().Bind() in FetchByName()\")\n\t}\n\n\treturn &country, nil\n}", "title": "" }, { "docid": "7854b5280136ea1799fbba741affbd90", "score": "0.46084145", "text": "func ExampleReader_Lookup_struct() {\n\tdb, err := maxminddb.Open(\"test-data/test-data/GeoIP2-City-Test.mmdb\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tip := net.ParseIP(\"81.2.69.142\")\n\n\tvar record onlyCountry // Or any appropriate struct\n\terr = db.Lookup(ip, &record)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Print(record.Country.ISOCode)\n\t// Output:\n\t// GB\n}", "title": "" }, { "docid": "1999e06f4a6896f07bc319a3e35d10b9", "score": "0.45873776", "text": "func (pu *PlanetUpdate) SetPopulation(i int64) *PlanetUpdate {\n\tpu.mutation.ResetPopulation()\n\tpu.mutation.SetPopulation(i)\n\treturn pu\n}", "title": "" }, { "docid": "cb2aca56d3fc231f4d172faf2de3e002", "score": "0.45503792", "text": "func (b Bitboard) Population() int {\n\tvar mask1, mask2, mask4 Bitboard\n\tmask1 = 0x5555555555555555 // 0101...\n\tmask2 = 0x3333333333333333 // 00110011..\n\tmask4 = 0x0f0f0f0f0f0f0f0f // 00001111...\n\tb -= (b >> 1) & mask1\n\tb = (b & mask2) + ((b >> 2) & mask2)\n\tb = (b + (b >> 4)) & mask4\n\tb += b >> 8\n\tb += b >> 16\n\tb += b >> 32\n\treturn int(b & 0x7f)\n}", "title": "" }, { "docid": "56e82a755531b7141c3d0e302ff5742c", "score": "0.4500105", "text": "func GetAllCountries(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tpowerData := []models.GlobalPowerPlants{}\n\tdb.DB.Find(&powerData, []int{1, 2, 3})\n\n\tjson.NewEncoder(w).Encode(powerData)\n}", "title": "" }, { "docid": "ffb0866ed6ae3d6d61b7d717d9809a05", "score": "0.44924206", "text": "func ReadPopulation(ir io.Reader, context *neat.NeatContext) (pop *Population, err error) {\n\tpop = newPopulation()\n\n\t// Loop until file is finished, parsing each line\n\tscanner := bufio.NewScanner(ir)\n\tscanner.Split(bufio.ScanLines)\n\tvar out_buff *bytes.Buffer\n\tvar id_check int\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tparts := strings.SplitN(line, \" \", 2)\n\t\tif len(parts) < 2 {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"Line: [%s] can not be split when reading Population\", line))\n\t\t}\n\t\tswitch parts[0] {\n\t\tcase \"genomestart\":\n\t\t\tout_buff = bytes.NewBufferString(fmt.Sprintf(\"genomestart %s\", parts[1]))\n\t\t\tid_check, err = strconv.Atoi(parts[1])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase \"genomeend\":\n\t\t\tfmt.Fprintf(out_buff, \"genomeend %d\", id_check)\n\t\t\tnew_genome, err := ReadGenome(bufio.NewReader(out_buff), id_check)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// add new organism for read genome\n\t\t\tnew_organism := NewOrganism(0.0, new_genome, 1)\n\t\t\tpop.Organisms = append(pop.Organisms, new_organism)\n\n\t\t\tif last_node_id, err := new_genome.getLastNodeId(); err == nil {\n\t\t\t\tif pop.currNodeId < last_node_id {\n\t\t\t\t\tpop.currNodeId = last_node_id\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif last_gene_innov_num, err := new_genome.getLastGeneInnovNum(); err == nil {\n\t\t\t\tif pop.currInnovNum < last_gene_innov_num {\n\t\t\t\t\tpop.currInnovNum = last_gene_innov_num\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// clear buffer\n\t\t\tout_buff = nil\n\t\t\tid_check = -1\n\n\t\tcase \"/*\":\n\t\t\t// read all comments and print it\n\t\t\tneat.InfoLog(line)\n\t\tdefault:\n\t\t\t// write line to buffer\n\t\t\tfmt.Fprintln(out_buff, line)\n\t\t}\n\n\t}\n\terr = pop.speciate(context)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn pop, nil\n\t}\n}", "title": "" }, { "docid": "cbfa0549e96e0ae485faa1822dc27eae", "score": "0.447437", "text": "func ExampleReader_Lookup_struct() {\n\tdb, err := maxminddb.Open(\"test-data/test-data/GeoIP2-City-Test.mmdb\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tip := net.ParseIP(\"81.2.69.142\")\n\n\tvar record struct {\n\t\tCountry struct {\n\t\t\tISOCode string `maxminddb:\"iso_code\"`\n\t\t} `maxminddb:\"country\"`\n\t} // Or any appropriate struct\n\n\terr = db.Lookup(ip, &record)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tfmt.Print(record.Country.ISOCode)\n\t// Output:\n\t// GB\n}", "title": "" }, { "docid": "c2537bab3356c195f22e9d6710e7416a", "score": "0.44674954", "text": "func (rs *CountriesResultSet) Get() (*Countries, error) {\n\treturn rs.last, rs.lastErr\n}", "title": "" }, { "docid": "454e53ee8cf547283e1b7daf90cdd3e9", "score": "0.4430207", "text": "func (puo *PlanetUpdateOne) SetNillablePopulation(i *int64) *PlanetUpdateOne {\n\tif i != nil {\n\t\tpuo.SetPopulation(*i)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "f96d40004b19497ad1bfca1ffe5a3b32", "score": "0.44041592", "text": "func (rs *CountriesResultSet) One() (*Countries, error) {\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "title": "" }, { "docid": "93f7a6b3450004e0962f5b262f201e10", "score": "0.44035703", "text": "func showPopulation(popul []popType, popCaption string) {\n\tif !ShowPopulation { // this might be the beginning of a debug level configuration type; currently we have the options from the go-logging pkg (20170813).\n\t\treturn\n\t}\n\n\toutputBuffer := \"<div class='table-responsive'><table class='table table-striped table-bordered table-hover'><caption>\" + popCaption + \"</caption><thead><tr><th>Pop #</th><th>Fitness</th><th>Chromossomes</th></tr></thead><tbody>\\n\"\n\n\tfor p, pop := range popul {\n\t\toutputBuffer += fmt.Sprintf(\"<tr><td>%v</td><td>%.4f</td>\", p, pop.Fitness)\n\t\tfor _, chr := range pop.chromosomes {\n\t\t\toutputBuffer += fmt.Sprintf(\"<td>(%v, %v, %v)<br />Distance: %.4f<br />Obstacle: %.4f<br />Angle: %.4f<br />Smoothness %.4f</td>\",\n\t\t\t\tchr.x, chr.y, chr.z, chr.distance, chr.obstacle, chr.angle, chr.smoothness)\n\t\t}\n\t\toutputBuffer += \"</tr>\\n\"\n\t}\n\toutputBuffer += \"</tbody><tfoot><tr><th>Pop #</th><th>Fitness</th><th>Chromossomes</th></tr></tfoot></table></div>\\n\"\n\tsendMessageToBrowser(\"status\", \"\", outputBuffer, \"\")\n}", "title": "" }, { "docid": "44a3c4710c328ffab106bd7e5a518685", "score": "0.4400631", "text": "func (sc *StructureCountry) GetData() *xdominion.XRecord {\n\treturn sc.Data\n}", "title": "" }, { "docid": "955e67d8b93784f322e633f35086d470", "score": "0.43694183", "text": "func Populate() {\n\tgo fetchData()\n}", "title": "" }, { "docid": "511e2ddbf6820fec58a46a82a6b6cf5c", "score": "0.4261565", "text": "func (puo *PlanetUpdateOne) AddPopulation(i int64) *PlanetUpdateOne {\n\tpuo.mutation.AddPopulation(i)\n\treturn puo\n}", "title": "" }, { "docid": "42d0e7b6ba9ef11804aa6c2953a22652", "score": "0.42553028", "text": "func (c *countryDB) FetchAll() ([]*country.CountryType, error) {\n\tctx := context.Background()\n\n\tvar countries []*country.CountryType\n\terr := models.MCountries(\n\t\tqm.Select(\"id, country_code, name\"),\n\t).Bind(ctx, c.dbConn, &countries)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to call models.MCountries().Bind() in FetchAll()\")\n\t}\n\treturn countries, nil\n}", "title": "" }, { "docid": "8ff25fad9c239c9d4a15fe747f2557f5", "score": "0.42517215", "text": "func NewPopulation(eliteSize, genSize int) (p *Population) {\n\t// Make population of worst case 'degenerate' individuals.\n\te := make([][]uint32, eliteSize)\n\ts := make([]float64, eliteSize)\n\tpe := make([][]uint32, eliteSize)\n\tfor i := range e {\n\t\te[i] = []uint32{}\n\t\ts[i] = math.Inf(-1)\n\t\tpe[i] = []uint32{}\n\t}\n\n\tp = &Population{\n\t\tElites: e,\n\t\tScores: s,\n\t\tPrevElites: pe,\n\n\t\tEliteSize: eliteSize,\n\t\tGenSize: genSize,\n\t\tGenNum: 0,\n\t\tGenProgress: 0,\n\n\t\tMutex: &sync.Mutex{},\n\t}\n\treturn p\n}", "title": "" }, { "docid": "137964604ba3fbd8590707e9c0a8fe62", "score": "0.42382142", "text": "func NewPopulation(g *Genome, context *neat.NeatContext) (*Population, error) {\n\tif context.PopSize <= 0 {\n\t\treturn nil, errors.New(\n\t\t\tfmt.Sprintf(\"Wrong population size in the context: %d\", context.PopSize))\n\t}\n\n\tpop := newPopulation()\n\terr := pop.spawn(g, context)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pop, nil\n}", "title": "" }, { "docid": "9bd67cf4129401676094467cd6cb34cd", "score": "0.4230219", "text": "func (u *uwp) Population() ehex.Ehex {\n\treturn u.data[POPS]\n}", "title": "" }, { "docid": "7fb8666f86b9257b30dcc8a00741da48", "score": "0.42241222", "text": "func (b *BareVM) fetch() int {\n\treturn b.program[b.registers[IP]]\n}", "title": "" }, { "docid": "e5ea043bb81b2e3e97806a4c6679319b", "score": "0.421211", "text": "func (p *Population) Size() int {\n\treturn len(p.DNSs)\n}", "title": "" }, { "docid": "cc5b6e09a7602b8281e93ad8ffe975b4", "score": "0.42060256", "text": "func NewPopulation(finalVal []byte, popNum int, mutation float64) Population {\n\tdna := make([]DNA, popNum)\n\tfor i := 0; i < popNum; i++ {\n\t\tdna[i] = NewDNA(finalVal)\n\t}\n\treturn Population{entities: dna, mutation: mutation, popNum: popNum, finalVal: finalVal}\n}", "title": "" }, { "docid": "a3abca87743d03a6488482ca7b66f7fb", "score": "0.42032143", "text": "func (repo TagRepository) LoadCountries(ctx context.Context, entities ...Tag) error {\n\tvar (\n\t\terr error\n\t\tplaceholder string\n\t\tvalues []interface{}\n\t\tindices = make(map[string][]*Tag)\n\t)\n\n\tif err = util.CheckContext(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tc := 1\n\tfor _, entity := range entities {\n\t\tplaceholder += \"$\" + strconv.Itoa(c) + \",\"\n\t\tindices[entity.ID] = append(indices[entity.ID], &entity)\n\t\tvalues = append(values, entity.ID)\n\t\tc++\n\t}\n\tplaceholder = strings.TrimRight(placeholder, \",\")\n\n\trows, err := repo.db.Query(\"SELECT tag_id, country_id FROM countries_tags WHERE tag_id IN (\"+placeholder+\")\", values...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = util.CheckContext(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tthisID string\n\t\t\tthatID string\n\t\t)\n\t\terr = rows.Scan(&thisID, &thatID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ent := range indices[thisID] {\n\t\t\tent.Countries = append(ent.Countries, thatID)\n\t\t}\n\n\t\tif err = util.CheckContext(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a99e5bdf0ae282843020635263f1da62", "score": "0.42003936", "text": "func CountryManagerGetAll() (models.GraphScore, error) {\n\tvar f models.GraphScore\n\n\tcountries, err := repositories.CountryGetAll()\n\tif err != nil {\n\t\treturn f, err\n\t}\n\n\trels, err := repositories.RelationshipGetAll()\n\tscores, err := models.NewRelationshipSetArray(rels).ToScoreArray()\n\tif err != nil {\n\t\treturn f, nil\n\t}\n\n\treturn models.GraphScore{\n\t\tNodes: countries,\n\t\tEdges: scores,\n\t}, nil\n}", "title": "" }, { "docid": "5df89bb7a82fd92973d5f6e17594a66d", "score": "0.41938585", "text": "func (s *Service) FetchWorldwideData() (*Stats, error) {\n\tvar data Stats\n\terr := s.fetchData(\"/all\", &data)\n\n\treturn &data, err\n}", "title": "" }, { "docid": "10b0431b8720a425d5d44e810ea7b25f", "score": "0.41932586", "text": "func fetchDataPerPage(p int) model.Proverbs {\n\turl := urlFormat(p)\n\tresponse, _ := helper.DownloadHtml(url)\n\tresponseString := string([]byte(response))\n\tresults := commonFetch(responseString)\n\treturn results\n}", "title": "" }, { "docid": "c8a2f94e92cd3d0cf69643339a88a2c6", "score": "0.41880006", "text": "func (c *Client) DatabaseGetCountries(count, offset int, all bool, code string) (GetContriesResponse, error) {\n\tv := url.Values{}\n\tsetCountOffsetParams(&v, count, offset)\n\tif all {\n\t\tv.Add(\"need_all\", \"1\")\n\t} else {\n\t\tv.Add(\"need_all\", \"0\")\n\t}\n\tif code != \"\" {\n\t\tv.Add(\"code\", code)\n\t}\n\n\turi := c.buildURLForMethod(\"database.getCountries\", v)\n\tres := GetContriesResponse{}\n\terr := c.send(uri, &res)\n\treturn res, err\n}", "title": "" }, { "docid": "f052a798fda7620f371ddde9c33a8a1d", "score": "0.41828698", "text": "func unmarshalPopulationData(data []interface{}, list []CountryPopulationByYear) []CountryPopulationByYear {\n\n\t// FOr all records ins the buffer, convert to internal format\n\tfor i := 0; i < len(data); i++ {\n\t\tcpdby := CountryPopulationByYear{}\n\t\tcountryEntry := data[i].(map[string]interface{})\n\t\tcountry := mapToDataPair(countryEntry[\"country\"].(map[string]interface{}))\n\n\t\tcpdby.Id = country.Id\n\t\tcpdby.Name = country.Value\n\t\tif x, _ := countryEntry[\"value\"]; x != nil {\n\t\t\tv,_ := strconv.ParseUint(countryEntry[\"value\"].(string), 10, 0)\n\t\t\tcpdby.Value = uint(v)\n\t\t}\n\t\tif x, _ := countryEntry[\"date\"]; x != nil {\n\t\t\tcpdby.Year = countryEntry[\"date\"].(string)\n\t\t}\n\t\tlist = append(list, cpdby)\n\t}\n\treturn list\n}", "title": "" }, { "docid": "3b4b04a2532615ba887cbec91760a4eb", "score": "0.41750222", "text": "func (m *Manager) UpdateCountry(c *Country) error {\n\n\tfunc(in interface{}) {\n\t\tif ii, ok := in.(initializer.Simple); ok {\n\t\t\tii.Initialize()\n\t\t}\n\t}(c)\n\n\t_, err := m.GetWDbMap().Update(c)\n\treturn err\n}", "title": "" }, { "docid": "3389546b1e11ce37b4ffed62239973ce", "score": "0.41746202", "text": "func (ms *MySQLStore) GetByName(name string) (*County, error) {\n\treturn ms.getByProvidedType(Name, name)\n}", "title": "" }, { "docid": "2ed90926139504b77c2d53ede724d645", "score": "0.41714287", "text": "func (c Client) Fetch() (*FetchConfigurationResponse, error) {\n\treturn c.FetchWithContext(context.Background())\n}", "title": "" }, { "docid": "48b4e5cf4cc1eb3eeb88763bc10b0961", "score": "0.41698647", "text": "func (b *UsersSearchBuilder) UniversityCountry(v int) *UsersSearchBuilder {\n\tb.Params[\"university_country\"] = v\n\treturn b\n}", "title": "" }, { "docid": "df419610f59b464c4518078fc16a0e4b", "score": "0.4137671", "text": "func (m *FindwordGA) InitPopulation(initSolution []byte, initAlphabet []byte, initPopulationSize int, initMutationRate float32,\n\tinitSeed int64, initNumberOfThreads int) {\n\n\tif initMutationRate < 0 {\n\t\tpanic(\"mutation rate must be greater than 0\")\n\t} else if len(initAlphabet) < 1 {\n\t\tpanic(\"alphabet must include chars\")\n\t} else if initPopulationSize < 1 {\n\t\tpanic(\"population size must be greater than 0\")\n\t} else if initNumberOfThreads < 1 {\n\t\tpanic(\"GA has to run with at least one thread\")\n\t} else if len(initSolution) < 1 {\n\t\tpanic(\"solution must include at least one char\")\n\t}\n\n\tm.mutationRate = initMutationRate\n\tm.solution = initSolution\n\tm.alphabet = initAlphabet\n\tm.solutionLength = len(m.solution)\n\tm.alphabetLength = len(m.alphabet)\n\tm.populationSize = initPopulationSize\n\tm.population = make([][]byte, initPopulationSize)\n\tm.populationBuffer = make([][]byte, initPopulationSize)\n\tm.populationFitness = make([]int, initPopulationSize)\n\tm.selectedParents = make([]int, initPopulationSize)\n\t//m.selectedParentsDensityFunction = make([]float32, m.populationSize)\n\tm.numberOfThreads = initNumberOfThreads\n\tm.threadsDoneChannel = make(chan int, m.numberOfThreads)\n\n\t//if it is running alone\n\tm.doneChannel = make(chan bool, 1)\n\tm.doneChannelMutex = &sync.Mutex{}\n\tm.doneChannel <- false\n\n\tif initSeed != 0 {\n\t\tm.randomSourceSeed = initSeed\n\t} else {\n\t\tm.randomSourceSeed = time.Now().UnixNano()\n\t}\n\tm.random = rand.New(rand.NewSource(m.randomSourceSeed))\n\n\tm.randomForThreads = make([]*rand.Rand, m.numberOfThreads)\n\tfor i := 0; i < m.numberOfThreads; i++ {\n\t\tm.randomForThreads[i] = rand.New(rand.NewSource(m.randomSourceSeed + int64(i)))\n\t}\n\n\t//filling the population with random strings\n\tfor i := 0; i < m.populationSize; i++ {\n\t\tm.population[i] = m.randomString(m.solutionLength)\n\t}\n\n\t//calculate population blocks for threads\n\tm.popBlockStart = make([]int, m.numberOfThreads)\n\tm.popBlockEnd = make([]int, m.numberOfThreads)\n\n\tfor i := 0; i < m.numberOfThreads; i++ {\n\t\t//when this is the last thread and there is a rest from dividing through numberOfThreads\n\t\tif i == m.numberOfThreads-1 {\n\t\t\tm.popBlockStart[i] = i * (m.populationSize / m.numberOfThreads)\n\t\t\tm.popBlockEnd[i] = (i+1)*int(m.populationSize/m.numberOfThreads) + (m.populationSize % m.numberOfThreads) - 1\n\t\t} else {\n\t\t\tm.popBlockStart[i] = i * (m.populationSize / m.numberOfThreads)\n\t\t\tm.popBlockEnd[i] = (i+1)*int(m.populationSize/m.numberOfThreads) - 1\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "38ce37ae30caab5965643a6dc1fbf500", "score": "0.41266245", "text": "func (pu *PlanetUpdate) SetNillablePopulation(i *int64) *PlanetUpdate {\n\tif i != nil {\n\t\tpu.SetPopulation(*i)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "de4a124cd47be238ae4f4fecbe6b9164", "score": "0.41038254", "text": "func (s *SpyStore) Fetch(ctx context.Context) (string, error) {\n\tdata := make(chan string, 1)\n\n\tgo func() {\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\tdata <- s.response\n\t}()\n\n\tselect {\n\tcase msg := <-data:\n\t\treturn msg, nil\n\tcase <-ctx.Done():\n\t\treturn \"\", ctx.Err()\n\t}\n}", "title": "" }, { "docid": "33faad0d4cc31aae6e558e09d74c9220", "score": "0.40966412", "text": "func generatePopulation(i *image.RGBA) (population []Entity) {\n\tpopulation = make([]Entity, PopulationSize)\n\tfor k := 0; k < PopulationSize; k++ {\n\t\tpopulation[k] = generateEntity(i)\n\t}\n\treturn population\n}", "title": "" }, { "docid": "81759aebe8d0c9eaae3edc39d2bb5aa4", "score": "0.40939906", "text": "func Fetch() []float64 {\n\tvar cases []float64\n\tresp, err := http.Get(\"https://api.covid19api.com/country/india/status/confirmed\")\n\n\tif err != nil {\n\t\tpanic(\"Unable to connect to server\")\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tpanic(\"Invalid body received\")\n\t}\n\n\tvar response []responseStructure\n\tjson.Unmarshal([]byte(body), &response)\n\n\tfor _, item := range response {\n\t\tcases = append(cases, float64(item.Cases))\n\t}\n\n\treturn cases\n}", "title": "" }, { "docid": "cb91e8c07b4d9d3ec0a7e61c5a6cf6ae", "score": "0.40821326", "text": "func GetCountries() []CountryStruct {\n\treturn dataStore.globalCases\n}", "title": "" }, { "docid": "0fdbbb65f5c7e54d5709404999c71216", "score": "0.4081329", "text": "func (m *MetricSet) Fetch() (common.MapStr, error) {\n\tscanner, err := m.http.FetchScanner()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn eventMapping(scanner, m)\n}", "title": "" }, { "docid": "bc079cc78059faf55e7644f4ddb92bd2", "score": "0.4070334", "text": "func (puo *PlanetUpdateOne) SetPopulationProdLevel(i int) *PlanetUpdateOne {\n\tpuo.mutation.ResetPopulationProdLevel()\n\tpuo.mutation.SetPopulationProdLevel(i)\n\treturn puo\n}", "title": "" }, { "docid": "bd5869d70f9b9d2bd74b54ccee96ac63", "score": "0.40696794", "text": "func (i *IPIfy) Fetch() (string, error) {\n\trsp, err := http.Get(i.url)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\tdefer rsp.Body.Close()\n\n\tip, err := ioutil.ReadAll(rsp.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\n\treturn string(ip), nil\n}", "title": "" }, { "docid": "8ad67c841eea74de982456af93477fc7", "score": "0.40684158", "text": "func (c *companyMap) Fetch(id string) (*company.CompanyType, error) {\n\tif v, ok := c.repo[id]; ok {\n\t\treturn &v, nil\n\t}\n\treturn nil, errors.New(\"company is not found\")\n}", "title": "" }, { "docid": "1ae3ffaecb8953df7c8fb547f118f3b7", "score": "0.4063065", "text": "func GetCountryLong(ipAddress string) Record {\n\treturn query(ipAddress, countryLong)\n}", "title": "" }, { "docid": "b82f4dff3782dc74742d1c3cf5df42e0", "score": "0.40537336", "text": "func luaU_FetchInt(l Lua_State, v *reflect.Value) (ok bool) {\n\tif ok = Lua_isnumber(l, -1); ok {\n\t\tv.SetInt(int64(Lua_tointeger(l, -1)))\n\t}\n\tLua_pop(l, 1)\n\treturn\n}", "title": "" }, { "docid": "52a84ecd71439c5a5388f5f81dc13f98", "score": "0.40403014", "text": "func (s *Stack) Fetch(address Value) Value {\n\taddr := int(address.Content.(float64))\n\tif addr < len(s.data) {\n\t\titem := s.data[len(s.data)-addr-1]\n\t\ts.Push(item)\n\t\treturn item\n\t}\n\treturn Nil\n}", "title": "" }, { "docid": "acc6bcbd62519354b1e3fc4a3e105722", "score": "0.40338522", "text": "func FetchPaged(db *factory.DB, q squirrel.SelectBuilder, p PageFilter, set interface{}) error {\n\tif p.Limit+p.Offset == 0 {\n\t\t// When both, offset & limit are 0,\n\t\t// calculate both values from page/perPage params\n\t\tif p.PerPage > 0 {\n\t\t\tp.Limit = p.PerPage\n\t\t}\n\n\t\tif p.Page < 1 {\n\t\t\tp.Page = 1\n\t\t}\n\n\t\tp.Offset = uint((p.Page - 1) * p.PerPage)\n\t}\n\n\tif p.Limit > 0 {\n\t\tq = q.Limit(uint64(p.Limit))\n\t}\n\n\tif p.Offset > 0 {\n\t\tq = q.Offset(uint64(p.Offset))\n\t}\n\n\treturn FetchAll(db, q, set)\n}", "title": "" }, { "docid": "8831b6694d7b105c0d4f5439c9e53dbe", "score": "0.40260234", "text": "func Fetch(url string) (*goquery.Document, error) {\n\t<-rateLimit\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"Error: \", \"code\", res.StatusCode)\n\t}\n\treturn goquery.NewDocumentFromReader(res.Body)\n}", "title": "" }, { "docid": "4bd739c8c2541e09842ffec83bbb2820", "score": "0.40224436", "text": "func (pu *PlanetUpdate) AddPopulation(i int64) *PlanetUpdate {\n\tpu.mutation.AddPopulation(i)\n\treturn pu\n}", "title": "" }, { "docid": "98ae500f4b2dcd24a6d3ba3b30cb76c6", "score": "0.40058845", "text": "func Country() string { return country(globalFaker.Rand) }", "title": "" }, { "docid": "80854e13c87e931a8a75ab88bcf8608f", "score": "0.3999234", "text": "func PopCountLoopLazy(x uint64) int {\n\tinitializeOnce.Do(initialize)\n\tvar b byte\n\tfor i := 0; i < 8; i++ {\n\t\tb += pc2[byte(x>>uint(i*8))]\n\t}\n\treturn int(b)\n}", "title": "" }, { "docid": "0f755751ddd6471792bdad84309c278b", "score": "0.39927113", "text": "func FetchWorkload(ctx context.Context, c client.Client, mLog logr.Logger, oamTrait oam.Trait) (\n\t*unstructured.Unstructured, error) {\n\tvar workload unstructured.Unstructured\n\tworkloadRef := oamTrait.GetWorkloadReference()\n\tif len(workloadRef.Kind) == 0 || len(workloadRef.APIVersion) == 0 || len(workloadRef.Name) == 0 {\n\t\terr := errors.New(\"no workload reference\")\n\t\tmLog.Error(err, ErrLocateWorkload)\n\t\treturn nil, err\n\t}\n\tworkload.SetAPIVersion(workloadRef.APIVersion)\n\tworkload.SetKind(workloadRef.Kind)\n\twn := client.ObjectKey{Name: workloadRef.Name, Namespace: oamTrait.GetNamespace()}\n\tif err := c.Get(ctx, wn, &workload); err != nil {\n\t\tmLog.Error(err, \"Workload not find\", \"kind\", workloadRef.Kind, \"workload name\", workloadRef.Name)\n\t\treturn nil, err\n\t}\n\tmLog.Info(\"Get the workload the trait is pointing to\", \"workload name\", workload.GetName(),\n\t\t\"workload APIVersion\", workload.GetAPIVersion(), \"workload Kind\", workload.GetKind(), \"workload UID\",\n\t\tworkload.GetUID())\n\treturn &workload, nil\n}", "title": "" }, { "docid": "acaf5e03338d66ec7597e974750582af", "score": "0.3989637", "text": "func (w *WeatherService) Fetch(start time.Time, finish time.Time) ([]weather.State, error) {\n\treturn query(w.session, weatherField, start, finish)\n}", "title": "" }, { "docid": "b6eb5845e8714e384f6a208e7f939c04", "score": "0.3984795", "text": "func fetchUSGSData() error {\n\tvar usgsClient = &http.Client{Timeout: 10 * time.Second}\n\tr, err := usgsClient.Get(usgsDayURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Body.Close()\n\n\tjsonData, err := ioutil.ReadAll(r.Body)\n\terr = model.InitUSGSData(jsonData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "490363918eb6a43eaf723049cbe3a98e", "score": "0.3977735", "text": "func (o *PSNATPool) Fetch() *bambou.Error {\n\n\treturn bambou.CurrentSession().FetchEntity(o)\n}", "title": "" }, { "docid": "8cff0ebe866084c52aae61a8e91793a8", "score": "0.39774787", "text": "func Fetch(cfg *config.Config) {\n\n\tlog.Println(\"Starting fetch\")\n\n\tstart := time.Now()\n\n\ts, err := store.New(cfg)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer s.Close()\n\n\tconn := s.Conn()\n\n\tvar channels []models.Channel\n\tif err := s.Channels().SelectAll(conn, &channels); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tnumChannels := len(channels)\n\n\tlog.Printf(\"%d channels to fetch\", numChannels)\n\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tf := feedparser.New()\n\n\tbatchSize := cfg.MaxDBConnections / 10\n\tbatch := make([]models.Channel, batchSize)\n\n\tfor i, channel := range channels {\n\n\t\tbatch = append(batch, channel)\n\n\t\tif i > 0 && (i%batchSize == 0 || i == numChannels-1) {\n\t\t\thandleBatch(batch, s, f)\n\t\t\tbatch = make([]models.Channel, batchSize)\n\t\t}\n\n\t}\n\tlog.Printf(\"Fetch completed, %d channels fetched in %v\", numChannels, time.Since(start))\n\n}", "title": "" }, { "docid": "9108d25b554e748dd4da50806861df22", "score": "0.39694095", "text": "func (co Controllers) GetCountry(c echo.Context) (err error) {\n\t// Get country id\n\tqueryCountryID := c.QueryParam(\"country_id\")\n\tcountryID, err := strconv.Atoi(queryCountryID)\n\tif err != nil && queryCountryID != \"\" {\n\t\terr = Lookup.ErrInvalidCountryID\n\t\treturn\n\t}\n\n\t// Initialize lookup service\n\tls := Lookup.New()\n\n\t// Get country\n\tif countryID > 0 {\n\t\tcountry, err := ls.GetCountry(countryID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Send response\n\t\treturn SendResponse(c, http.StatusOK, country)\n\t}\n\n\t// Get list of countries\n\tcountries, err := ls.GetCountries()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Send response\n\treturn SendResponse(c, http.StatusOK, countries)\n}", "title": "" }, { "docid": "2a1d3fe87aafc34a5bd106ccd242a686", "score": "0.39648622", "text": "func ConfigurationGetCountry(config *Configuration, outCountry *byte) {\n\tcconfig, _ := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown\n\tcoutCountry, _ := (*C.char)(unsafe.Pointer(outCountry)), cgoAllocsUnknown\n\tC.AConfiguration_getCountry(cconfig, coutCountry)\n}", "title": "" }, { "docid": "1a64f52dedc8dfc051dc7dd022e2f000", "score": "0.39648485", "text": "func (p *ShopServiceClient) GetPopularPackages(ctx context.Context, start int64, size int32, language string, country string) (r *ProductList, err error) {\r\n var _args269 ShopServiceGetPopularPackagesArgs\r\n _args269.Start = start\r\n _args269.Size = size\r\n _args269.Language = language\r\n _args269.Country = country\r\n var _result270 ShopServiceGetPopularPackagesResult\r\n if err = p.c.Call(ctx, \"getPopularPackages\", &_args269, &_result270); err != nil {\r\n return\r\n }\r\n switch {\r\n case _result270.E!= nil:\r\n return r, _result270.E\r\n }\r\n\r\n return _result270.GetSuccess(), nil\r\n}", "title": "" }, { "docid": "61c2e8f12cf0669f31d2f0fbe324f337", "score": "0.3959975", "text": "func (r *mysqlTagsRepository) Fetch(ctx context.Context, num int64) ([]*domain.Tags, error) {\n\tquery := \"Select * From tags limit ?\"\n\n\treturn r.fetch(ctx, query, num)\n}", "title": "" }, { "docid": "80f1b229fd1b2621d72665303c10f045", "score": "0.39428055", "text": "func GetAggregates(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tcountryAggregates := []models.CountryAggregates{}\n\n\tdb.DB.Raw(`select country, country_long, sum(gwh) as total from (\n\t\tselect country, country_long,\n\t\tCASE when generation_gwh2017=0 OR generation_gwh2017='' or generation_gwh2017 is null THEN estimated_generation_gwh\n\t\t\t else generation_gwh2017\n\t\tEND as gwh\n\t\tfrom global_power_plants) a\n\t\tgroup by country order by total desc`).Scan(&countryAggregates)\n\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(countryAggregates)\n}", "title": "" }, { "docid": "af0f14322e2a247cad8cfb0f62e74d68", "score": "0.39402226", "text": "func fetchData() {\n\tvar err error\n\tpeopleArr, err = dao.Find(bson.M{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "8c87e5e77df730684a546821de9fb145", "score": "0.39400834", "text": "func PopCount(x uint64) int {\n\treturn int(pc[byte(x>>(0*8))] +\n\t\tpc[byte(x>>(1*8))] +\n\t\tpc[byte(x>>(2*8))] +\n\t\tpc[byte(x>>(3*8))] +\n\t\tpc[byte(x>>(4*8))] +\n\t\tpc[byte(x>>(5*8))] +\n\t\tpc[byte(x>>(6*8))] +\n\t\tpc[byte(x>>(7*8))])\n}", "title": "" }, { "docid": "8c87e5e77df730684a546821de9fb145", "score": "0.39400834", "text": "func PopCount(x uint64) int {\n\treturn int(pc[byte(x>>(0*8))] +\n\t\tpc[byte(x>>(1*8))] +\n\t\tpc[byte(x>>(2*8))] +\n\t\tpc[byte(x>>(3*8))] +\n\t\tpc[byte(x>>(4*8))] +\n\t\tpc[byte(x>>(5*8))] +\n\t\tpc[byte(x>>(6*8))] +\n\t\tpc[byte(x>>(7*8))])\n}", "title": "" }, { "docid": "8c87e5e77df730684a546821de9fb145", "score": "0.39400834", "text": "func PopCount(x uint64) int {\n\treturn int(pc[byte(x>>(0*8))] +\n\t\tpc[byte(x>>(1*8))] +\n\t\tpc[byte(x>>(2*8))] +\n\t\tpc[byte(x>>(3*8))] +\n\t\tpc[byte(x>>(4*8))] +\n\t\tpc[byte(x>>(5*8))] +\n\t\tpc[byte(x>>(6*8))] +\n\t\tpc[byte(x>>(7*8))])\n}", "title": "" }, { "docid": "8c87e5e77df730684a546821de9fb145", "score": "0.39400834", "text": "func PopCount(x uint64) int {\n\treturn int(pc[byte(x>>(0*8))] +\n\t\tpc[byte(x>>(1*8))] +\n\t\tpc[byte(x>>(2*8))] +\n\t\tpc[byte(x>>(3*8))] +\n\t\tpc[byte(x>>(4*8))] +\n\t\tpc[byte(x>>(5*8))] +\n\t\tpc[byte(x>>(6*8))] +\n\t\tpc[byte(x>>(7*8))])\n}", "title": "" }, { "docid": "8c87e5e77df730684a546821de9fb145", "score": "0.39400834", "text": "func PopCount(x uint64) int {\n\treturn int(pc[byte(x>>(0*8))] +\n\t\tpc[byte(x>>(1*8))] +\n\t\tpc[byte(x>>(2*8))] +\n\t\tpc[byte(x>>(3*8))] +\n\t\tpc[byte(x>>(4*8))] +\n\t\tpc[byte(x>>(5*8))] +\n\t\tpc[byte(x>>(6*8))] +\n\t\tpc[byte(x>>(7*8))])\n}", "title": "" }, { "docid": "9992f218429c548e076c6a8829dd8883", "score": "0.39377922", "text": "func CreateNewPopulation(\n\tpopSize int,\n\tdnsLength int,\n\tfitnessFunc func(*DNS) float64,\n\tallowedBytes []byte,\n) *Population {\n\tdnss := make([]*DNS, popSize)\n\tfor i := 0; i < popSize; i++ {\n\t\tdnss[i] = NewRandomDNS(dnsLength, allowedBytes)\n\t}\n\treturn &Population{\n\t\tDNSs: dnss,\n\t\tfitnessFunc: fitnessFunc,\n\t\tallowedBytes: allowedBytes,\n\t}\n}", "title": "" }, { "docid": "661dc23e11444987ae2d657abd2b7ce2", "score": "0.39336258", "text": "func LoadWorld(data []byte) error {\n\tcountries := make(map[string]*Country)\n\tisps := make(map[string]*ISP)\n\tvar country *Country\n\tvar subdivision *Subdivision\n\tscanner := bufio.NewScanner(bytes.NewBuffer(data))\n\tfor scanner.Scan() {\n\t\ttext := strings.TrimSpace(scanner.Text())\n\t\tif len(text) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\trecord := strings.Split(text, \",\")\n\t\tswitch record[0] {\n\t\tcase \"country\":\n\t\t\tcountry = parseCountry(record[1:])\n\t\t\tif country == nil {\n\t\t\t\treturn fmt.Errorf(\"错误的国家ID数据: %v\", record)\n\t\t\t}\n\t\t\tcountries[country.name] = country\n\t\tcase \"subdivision\":\n\t\t\tsubdivision = parseSubdivision(record[1:], country)\n\t\t\tif subdivision == nil {\n\t\t\t\treturn fmt.Errorf(\"错误的子区域ID数据: %v\", record)\n\t\t\t}\n\t\t\tcountry.subdivisions[subdivision.name] = subdivision\n\t\tcase \"city\":\n\t\t\tcity := parseCity(record[1:], subdivision)\n\t\t\tif city == nil {\n\t\t\t\treturn fmt.Errorf(\"错误的城市ID数据: %v\", record)\n\t\t\t}\n\t\t\tsubdivision.cities[city.name] = city\n\t\tcase \"isp\":\n\t\t\tisp, aliases := parseISP(record[1:])\n\t\t\tif isp == nil {\n\t\t\t\treturn fmt.Errorf(\"错误的ISP ID数据: %v\", record)\n\t\t\t}\n\t\t\tisps[isp.Name] = isp\n\t\t\tfor _, alias := range aliases {\n\t\t\t\tisps[alias] = isp\n\t\t\t}\n\t\tcase \"\":\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"未知数据行格式: %v\", record)\n\t\t}\n\t}\n\tworldCountries = countries\n\tworldIsps = isps\n\treturn nil\n}", "title": "" }, { "docid": "bf514a1d6a4b674eb32f898f22e8afd6", "score": "0.39321822", "text": "func (b Bitboard) PopCount() int {\n\treturn bits.OnesCount64(uint64(b))\n}", "title": "" }, { "docid": "4d6bce4ba378abf09ed5098851c59382", "score": "0.39282796", "text": "func (entity *Country) Unmarshal(raw []byte) error {\n\treturn json.Unmarshal(raw, entity)\n}", "title": "" }, { "docid": "1d11883394da2ca88cdd615efc77950a", "score": "0.39257264", "text": "func (b *Builder) Populate() {\n\tb.Numbers.Set = make([]int, 5)\n\n\ttmp := b.random.Perm(70) // [0, 75)\n\tb.Numbers.Set[0] = tmp[0] + 1\n\tb.Numbers.Set[1] = tmp[1] + 1\n\tb.Numbers.Set[2] = tmp[2] + 1\n\tb.Numbers.Set[3] = tmp[3] + 1\n\tb.Numbers.Set[4] = tmp[4] + 1\n\n\tsort.Ints(b.Numbers.Set)\n\n\tb.Numbers.Mb = b.random.Intn(25) + 1\n}", "title": "" }, { "docid": "0242f03000aa366dafe0c1392e9585aa", "score": "0.3925332", "text": "func (f *Flags) LookupSamplingInitial() (int, bool) {\n\treturn f.SamplingInitial(), f.FlagSet.IsSet(f.FlagSamplingInitial)\n}", "title": "" }, { "docid": "75c6930937bfa03797c2ca0f266a08b3", "score": "0.39197558", "text": "func (p *Population) Count() int {\n\treturn p.GenNum*p.GenSize + p.GenProgress\n}", "title": "" }, { "docid": "25167f10363e6cbf0d93cae453dcd8da", "score": "0.39175713", "text": "func (o *Page) GetCountryOk() (*string, bool) {\n\tif o == nil || o.Country == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Country, true\n}", "title": "" }, { "docid": "3fcc54897aa06b35c36d2722da6a1d3e", "score": "0.3915634", "text": "func (r *ChocoChaincode) getCBCountryCount(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n if len(args) != 1{\n return shim.Error(\"@@@@@@@@@@@@@@@@@@@ Incorrect no. of arguments Expecting 1 argument @@@@@@@@@@@@@@@@@@@\")\n }\n\n var countryCode = args[0]\n \n // making the query string \n queryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"$and\\\":[{\\\"country\\\": \\\"\"+ countryCode + \"\\\"}, {\\\"isConsumed\\\":true}]}}\")\n \n // getting the count of records \n recordCount, err := getQueryResultForQueryString(stub, queryString)\n\tif err != nil {\n\t\treturn shim.Error(\"Unable to retrieve Cocoa Bean Bags from ledger.\"+err.Error())\n\t}\n\n\tnumberOfChocoBars := recordCount * 100 \n\treturn shim.Success([]byte(strconv.Itoa(numberOfChocoBars))) \n}", "title": "" }, { "docid": "34780bdf6e2672d2fadd88ed35c4aa43", "score": "0.39148673", "text": "func GetCompetitionsCountry(client scout.Client) (CompetitionsCountry, error) {\n\n\trequestURL := fmt.Sprintf(\"https://%s/%s/competitions\",\n\t\tclient.APIHost, client.APIVersion)\n\n\tparams := map[string]string{\n\t\t\"api_token\": client.APIToken,\n\t\t\"include\": \"country\",\n\t}\n\n\tbody, err := Get(requestURL, params)\n\tif err != nil {\n\t\treturn CompetitionsCountry{}, fmt.Errorf(\"Failed to make competitions-country request: %s\", err)\n\t}\n\n\tdefer body.Close()\n\tdec := json.NewDecoder(body)\n\n\tvar competitionsCountry CompetitionsCountry\n\n\tif err := dec.Decode(&competitionsCountry); err != nil {\n\t\treturn CompetitionsCountry{}, fmt.Errorf(\"Failed to decode competitions-country response: %s\", err)\n\t}\n\tlog.Printf(\"%+v\\n\", competitionsCountry)\n\treturn competitionsCountry, nil\n}", "title": "" }, { "docid": "e36054d0a7d96b89fda22dfba7145b88", "score": "0.39087868", "text": "func InfoByCountry(c echo.Context) (err error) {\n\turl := app.SetURL(\"latest_stat_by_country.php?country=\" + c.Param(\"country\"))\n\n\ti := InfoCountry{}\n\n\tresult, err := i.Info(c, url)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn c.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "731699e1cb289e54f26a70a454a86459", "score": "0.3905689", "text": "func (r *Repository) Fetch(o *FetchOptions) error {\n\treturn r.FetchContext(context.Background(), o)\n}", "title": "" }, { "docid": "f93167b592f18a2ea71f5105140ea10e", "score": "0.39009207", "text": "func PopCount(x uint64) int {\n\treturn int(pc[byte(x>>(0*8))] +\n\tpc[byte(x>>(1*8))] +\n\tpc[byte(x>>(2*8))] +\n\tpc[byte(x>>(3*8))] +\n\tpc[byte(x>>(4*8))] +\n\tpc[byte(x>>(5*8))] +\n\tpc[byte(x>>(6*8))] +\n\tpc[byte(x>>(7*8))]\n\t)\n}", "title": "" }, { "docid": "3c80e5c3f0675eb1e65f308bede385d3", "score": "0.3896874", "text": "func (c *cpu) fetch() uint16 {\n\t// fetch opcode\n\tupper := uint16(c.mem[c.pc]) << 8\n\tlower := uint16(c.mem[c.pc+1])\n\topcode := upper | lower\n\n\t// advance program counter\n\tc.pc += 2\n\n\treturn opcode\n}", "title": "" }, { "docid": "07e622daac26543351eea1ae6a6df9d2", "score": "0.38812384", "text": "func (ms *MySQLStore) GetByID(id int64) (*County, error) {\n\treturn ms.getByProvidedType(ID, id)\n}", "title": "" }, { "docid": "28257e615ac81e2de8054cb01125147c", "score": "0.3880091", "text": "func (p *ProPublica) FetchMembers(location *Location) (*Response, error) {\n\tppr, err := p.fetch(\"house\", location)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := &Response{\n\t\tLocation: location,\n\t\tRole: House,\n\t\tProvider: ProPublicaProvider,\n\t}\n\tfor _, m := range ppr.Results {\n\t\tne, err := strconv.Atoi(m.NextElection)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\td, err := strconv.Atoi(m.District)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmem := Member{\n\t\t\tName: m.Name,\n\t\t\tDistrict: d,\n\t\t\tGender: m.Gender,\n\t\t\tParty: m.Party,\n\t\t\tTwitter: m.TwitterID,\n\t\t\tFacebook: m.FacebookAccount,\n\t\t\tNextElection: ne,\n\t\t}\n\n\t\tr.Members = append(r.Members, mem)\n\t}\n\n\tsort.Slice(r.Members, func(i, j int) bool {\n\t\treturn r.Members[i].District < r.Members[j].District\n\t})\n\n\treturn r, err\n}", "title": "" }, { "docid": "aeb3884cc85e88201e2ee1950e0102ec", "score": "0.3875984", "text": "func (_Fallback *FallbackSession) GetContribution() (*big.Int, error) {\n\treturn _Fallback.Contract.GetContribution(&_Fallback.CallOpts)\n}", "title": "" }, { "docid": "eddd7b4375b8525d578265777729ebb7", "score": "0.3868272", "text": "func GeneratePopulation(selection []*Individual) {\n\tx := 0\n\tx2 := 1\n\tsellen := len(selection)\n\n\tfmt.Printf(\"overcross rate : %d\\n\", NB_INDIVIDUAL * CROSSOVER_RATE / 100)\n\t//Implementing two point crossover methods\n\tfor i := 0; i < NB_INDIVIDUAL * CROSSOVER_RATE / 100; i++ {\n\t\tfmt.Printf(\"on add ind score : %0.5f\\n\", selection[i].Score)\n\t\tPopulation[i] = selection[i]\n\t\tPopulation[i].ID = i\n\t}\n\n\n\tfor idx := NB_INDIVIDUAL * CROSSOVER_RATE / 100; idx < NB_INDIVIDUAL; idx++ {\n\t\t/*\t\tif idx == NB_INDIVIDUAL - 1 {\n\t\t\t\t\tbreak;\n\t\t\t\t}*/\n\t\ttmp := &Individual{ID: idx, Distance: 0.0, Gene:make([]float32, NB_GENE)}\n\t\tx = rand.Intn(sellen)\n\t\tx2 = x\n\t\tfor x2 == x {\n\t\t\tx2 = rand.Intn(sellen)\n\t\t}\n\n\t\tif rand.Intn(2) == 0 {\n\t\t\tx, x2 = x2, x\n\t\t}\n\t\tfor i := 0; i < F_CROSSOVER_PT; i++ {\n\t\t\ttmp.Gene[i] = selection[x].Gene[i]\n\t\t}\n\n\t\tif rand.Intn(2) == 0 {\n\t\t\tx, x2 = x2, x\n\t\t}\n\t\tfor i := F_CROSSOVER_PT; i < S_CROSSOVER_PT; i++ {\n\t\t\ttmp.Gene[i] = selection[x2].Gene[i]\n\t\t}\n\n\t\tif rand.Intn(2) == 0 {\n\t\t\tx, x2 = x2, x\n\t\t}\n\t\tfor i := S_CROSSOVER_PT; i < NB_GENE; i++ {\n\t\t\ttmp.Gene[i] = selection[x].Gene[i]\n\n\t\t}\n\n/*\t\tnbtwin := tmp.hasTwin()\n\t\tif nbtwin > 0 && nbtwin < 3 && len(twinsList) <= NB_INDIVIDUAL * NB_TWEEN_RATE / 100 {\n\t\t\tif contains(tmp.id, twinsList)\n\t\t\ttwinsList = append(twinsList, tmp.ID)\n\t\t}\n\t\tif nbtwin > 0 && len(twinsList) > NB_INDIVIDUAL * NB_TWEEN_RATE / 100 {\n\t\t\tidx--\n\t\t\tbreak\n\t\t}*/\n\t\tPopulation[idx] = tmp\n\t\tPrintIndGen(tmp)\n\t}\n\n\tfor index1, ind := range Population {\n\t\tif index1 != 0 {\n\t\t\tfor index, _ := range ind.Gene {\n\t\t\t\tif rand.Intn(100) <= MUTATE_PC {\n\n\t\t\t\t\tif (rand.Intn(2) == 0) {\n\t\t\t\t\t\tind.Gene[index] = float32(int((ind.Gene[index] + float32(rand.Intn(50)))) % 300)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tind.Gene[index] -= float32(rand.Intn(50))\n\t\t\t\t\t\tif ind.Gene[index] < 0 {\n\t\t\t\t\t\t\tind.Gene[index] += 300\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Printf(\"On mutate index : %d\\tind ID : %f\\tScore : %0.5f\\n\", index1, ind.ID, ind.Score)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tPopulation[0], Population[NB_INDIVIDUAL - 1] = Population[NB_INDIVIDUAL - 1], Population[0]\n\n\t/*\tvar twinsList []int\n\t\tfor _, ind := range Population {\n\t\t\tnbtwin := ind.hasTwin()\n\t\t\tif nbtwin > 0 && nbtwin < 3 && len(twinsList) <= NB_INDIVIDUAL * NB_TWEEN_RATE / 100 {\n\t\t\t\ttwinsList = append(twinsList, ind.ID)\n\t\t\t}\n\t\t\tif nbtwin > 0 && len(twinsList) > NB_INDIVIDUAL * NB_TWEEN_RATE / 100 {\n\t\t\t\tfor nbtwin > 0 {\n\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\n\tfmt.Printf(\"SIWE POPULATION : %d\\n\", len(Population))\n\tfor _, ind := range Population {\n\t\tfmt.Printf(\"NEW INDIVIDU ID : %d\\t\", ind.ID)\n\t\tfor i := 0; i < len(ind.Gene); i++ {\n\t\t\tfmt.Printf(\"%d : %0.5f\\t\", i, ind.Gene[i])\n\t\t}\n\t\tfmt.Printf(\"\\n\")\n\n\t}\n\n}", "title": "" }, { "docid": "90edc9af2c6c8e3bc6690815233568d7", "score": "0.38620326", "text": "func (w *Whisper) Fetch(from uint32) (Interval, []Point, error) {\n\tnow := uint32(time.Now().Unix())\n\treturn w.FetchUntil(from, now)\n}", "title": "" }, { "docid": "9b84be6c6c21503e02eca75a11efeaef", "score": "0.38588908", "text": "func newPopulation(cities []City, populationSize uint) Population {\n individuals := make([]Tour, populationSize)\n\n if initializeNN {\n individuals[0] = createNearestNeighborTour(cities)\n for idx := uint(1); idx < populationSize; idx++ {\n individuals[idx] = createRandomTour(cities)\n }\n } else {\n for idx := range individuals {\n individuals[idx] = createRandomTour(cities)\n }\n }\n\n return Population{individuals, getFittest(individuals)}\n}", "title": "" }, { "docid": "ce481297da79756fec6c5cd28a3cefda", "score": "0.38583395", "text": "func generatePopulation(hand Hand) population {\r\n\tvar population population\r\n\tvar chromosome chromosome\r\n\tvar remainingChromosomesNumber, numPlayableCards, maxAvailableVariants int\r\n\r\n\tremainingChromosomesNumber = maxPopulationSize\r\n\t//Calculate maximum number of permutations\r\n\tfor _, v := range hand.cards {\r\n\t\tif v.playable {\r\n\t\t\tnumPlayableCards++\r\n\t\t}\r\n\t}\r\n\t//Generate temp slice to store card order numbers\r\n\ttempSlice := make([]int, numPlayableCards)\r\n\tfor i := range tempSlice {\r\n\t\ttempSlice[i] = i\r\n\t}\r\n\t//Get the number of all possible orders of the cards for the specific amount of cards\r\n\tmaxAvailableVariants = len(GetAllPermutations(tempSlice))\r\n\tLogger.Debug(\"maxAvailableVariants=\", maxAvailableVariants)\r\n\t//Check to see if only card order variants emough to cover maxPopulationSize\r\n\tif maxAvailableVariants < maxPopulationSize {\r\n\t\t//Calculate number of possible combinations to get to the available hand.power and multiple it to the card order variants\r\n\t\tmaxAvailableVariants *= len(GetAllPermutationsForSum(numPlayableCards, hand.power))\r\n\t}\r\n\tLogger.Debug(\"maxAvailableVariants=\", maxAvailableVariants)\r\n\t//Select the min(maxAvailableVariants, maxPopulationSize) as remainingChromosomesNumber\r\n\tif maxAvailableVariants < maxPopulationSize {\r\n\t\tremainingChromosomesNumber = maxAvailableVariants\r\n\t}\r\n\tLogger.Debug(\"remainingChromosomesNumber=\", remainingChromosomesNumber)\r\n\r\n\tpopulation.hashes = make(map[uint64]int)\r\n\tfor condition := true; condition; condition = remainingChromosomesNumber > 0 {\r\n\t\tchromosome = generateChromosome(hand)\r\n\t\tLogger.Debug(chromosome)\r\n\t\thash := calcChromosomeHash(chromosome)\r\n\t\tLogger.Debug(hash)\r\n\t\tif _, ok := population.hashes[hash]; !ok {\r\n\t\t\tpopulation.hashes[hash] = len(population.chromosomes)\r\n\t\t\tpopulation.chromosomes = append(population.chromosomes, chromosome)\r\n\t\t\tremainingChromosomesNumber--\r\n\t\t}\r\n\t}\r\n\tLogger.Debug(population)\r\n\treturn population\r\n}", "title": "" }, { "docid": "6aabc4dde85ea4d7a5472111e15b672e", "score": "0.3857469", "text": "func (s *Store) Fetch(key []byte) ([]byte, error) {\n\tvalue, err := s.db.Get(key)\n\tif err != nil {\n\t\tif err == bitcask.ErrKeyNotFound {\n\t\t\treturn nil, core.ErrNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn value, nil\n}", "title": "" } ]
8f33e6060b47b2ab6592e6d693463bf5
ResumeCreateOrUpdate creates a new PartnerTopicEventSubscriptionsCreateOrUpdatePoller from the specified resume token. token The value must come from a previous call to PartnerTopicEventSubscriptionsCreateOrUpdatePoller.ResumeToken().
[ { "docid": "4e9c13672b2cb52a1befd7c06f3c3470", "score": "0.7841733", "text": "func (client *PartnerTopicEventSubscriptionsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse, error) {\n\tpt, err := armcore.NewLROPollerFromResumeToken(\"PartnerTopicEventSubscriptionsClient.CreateOrUpdate\", token, client.con.Pipeline(), client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse{}, err\n\t}\n\tpoller := &partnerTopicEventSubscriptionsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse{}, err\n\t}\n\tresult := PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse{\n\t\tRawResponse: resp,\n\t}\n\tresult.Poller = poller\n\tresult.PollUntilDone = func(ctx context.Context, frequency time.Duration) (PartnerTopicEventSubscriptionsCreateOrUpdateResponse, error) {\n\t\treturn poller.pollUntilDone(ctx, frequency)\n\t}\n\treturn result, nil\n}", "title": "" } ]
[ { "docid": "26e57d963005a3f6c281a6048944647c", "score": "0.7063776", "text": "func (client *DdosProtectionPlansClient) ResumeCreateOrUpdate(token string) (DdosProtectionPlanPoller, error) {\n\tpt, err := armcore.NewPollerFromResumeToken(\"DdosProtectionPlansClient.CreateOrUpdate\", token, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ddosProtectionPlanPoller{\n\t\tpipeline: client.con.Pipeline(),\n\t\tpt: pt,\n\t}, nil\n}", "title": "" }, { "docid": "0d999d7aa996d69fa2b038cf9bf863de", "score": "0.70063156", "text": "func (p *PrivateLinkServicesForO365ManagementActivityAPIClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "2c635983b9520d7b4ba9293ba31c0f7a", "score": "0.69943357", "text": "func (l *VaultsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VaultsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VaultsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VaultsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "3d7745f07e234b4cb259cd7f56df9dbc", "score": "0.6858542", "text": "func (p *PrivateLinkServicesForSCCPowershellClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "6c46f0d8b4479c5937db16cefb5d5902", "score": "0.68553954", "text": "func (p *PrivateEndpointConnectionsAdtAPIClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "c30d21caa17cf70d572177193f09546e", "score": "0.6791771", "text": "func (l *DedicatedCloudNodesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DedicatedCloudNodesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DedicatedCloudNodesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DedicatedCloudNodesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "2547ce8c7315905390c1c6f7f9a967bd", "score": "0.67796093", "text": "func (l *DscNodeConfigurationClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DscNodeConfigurationClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DscNodeConfigurationClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DscNodeConfigurationClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "38ec733657b4f4534968e0c0950af2af", "score": "0.67715067", "text": "func (p *PrivateEndpointConnectionsForSCCPowershellClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "78f28fb7a3c9ae0cbef5bfcaa27dddc5", "score": "0.6730457", "text": "func (l *RegistrationDefinitionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RegistrationDefinitionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RegistrationDefinitionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RegistrationDefinitionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "945b235620185f127112541864f10f51", "score": "0.672916", "text": "func (l *VirtualMachinesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "3e43a6204fcef43759c9442280e28058", "score": "0.67002934", "text": "func (l *ResourceClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ResourceClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ResourceClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ResourceClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "888b19058fb7e470e409f6316054e48b", "score": "0.6692374", "text": "func (l *StoragesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *StoragesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"StoragesClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &StoragesCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "af3056477bd51b960d721a4bd71e9d80", "score": "0.6690235", "text": "func (p *PrivateLinkServicesForM365ComplianceCenterClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "384fd8ff62c01055748f39fdc8c1a8d6", "score": "0.66736454", "text": "func (l *ManagedHsmsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ManagedHsmsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ManagedHsmsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ManagedHsmsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "193b6010333f2efd162268501cfb251d", "score": "0.6669793", "text": "func (p *PrivateLinkServicesForEDMUploadClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "9e05b05f576e36ff2fc97b39d0d4415b", "score": "0.666231", "text": "func (p *PrivateLinkServicesForM365SecurityCenterClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "fb261d04bbcb165439e72d3df3cf18f7", "score": "0.6654081", "text": "func (p *DedicatedCloudNodesClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "fcc357cff15a3a4c69a6502c8a14c4c7", "score": "0.6653119", "text": "func (p *VirtualMachinesClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "6b38d8c60d4477f2ed9ee4195827bf77", "score": "0.6640889", "text": "func (p *ComputeClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "1cc86ccb71b15319ed8702c5f046cc49", "score": "0.66241074", "text": "func (p *PrivateLinkServicesForMIPPolicySyncClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "4c69c5376faea46932b2cdca8f87f2b7", "score": "0.66171163", "text": "func (l *HubsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *HubsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"HubsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &HubsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "2e320e7baac417e865e3c9813d4d4491", "score": "0.66104835", "text": "func (l *ServicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServicesClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServicesCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "2e320e7baac417e865e3c9813d4d4491", "score": "0.66104835", "text": "func (l *ServicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServicesClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServicesCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b34564338de7b5f870b45f87c8ee1078", "score": "0.6607318", "text": "func (p *ApplicationsCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "a540b4a11b347439d1f272aa4f875b43", "score": "0.6603682", "text": "func (l *ApplicationsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ApplicationsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ApplicationsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ApplicationsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ab529d5e0040d341cb99b38fe3aee465", "score": "0.6603321", "text": "func (l *ApplicationTypeVersionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ApplicationTypeVersionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ApplicationTypeVersionsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ApplicationTypeVersionsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "eccb7b3a93ddd861c7cd3868f695bcfd", "score": "0.6594533", "text": "func (l *AppsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *AppsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"AppsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &AppsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "217c1a2e0d7706641192c6a83bcb933f", "score": "0.6587242", "text": "func (p *PrivateEndpointConnectionsForEDMClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "66f5ed38a089d5b0ee6bb1ced7e9a7f6", "score": "0.6586262", "text": "func (l *RegistrationAssignmentsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RegistrationAssignmentsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RegistrationAssignmentsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RegistrationAssignmentsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "aaaab977ef3a4dedb42181b822c674f6", "score": "0.65728575", "text": "func (l *SharedPrivateLinkResourcesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *SharedPrivateLinkResourcesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"SharedPrivateLinkResourcesClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &SharedPrivateLinkResourcesClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "a9f2dbb8878118b2282ab31e75761042", "score": "0.6567734", "text": "func (p *WorkspacesClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "ea6b8223ad38ec341f037ceeb15650de", "score": "0.6567199", "text": "func (l *ClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *Client, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"Client.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "ea6b8223ad38ec341f037ceeb15650de", "score": "0.6567199", "text": "func (l *ClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *Client, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"Client.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "4cc9feed3b1347266bf64298681cb8e0", "score": "0.6566825", "text": "func (l *ClustersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ClustersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ClustersClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClustersCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "cab0f854c6341475d0f2cf72b9450058", "score": "0.6565894", "text": "func (p *ServicesCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "0db2415b1626b283d99431b49380364c", "score": "0.654705", "text": "func (l *EndpointClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *EndpointClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"EndpointClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &EndpointClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "4a2a525ce677ec5c39dddd533de90921", "score": "0.65466845", "text": "func (p *ReplicationPoliciesClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "4bc6967dfc98f894d0130277fe1f0da2", "score": "0.65386015", "text": "func (p *PrivateEndpointConnectionsSecClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "5f668c8e2a5ad050cc261228bc25b81b", "score": "0.65365815", "text": "func (l *ManagedClustersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ManagedClustersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ManagedClustersClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ManagedClustersCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b82348cd2846e7470fe57057030884e5", "score": "0.65339774", "text": "func (p *ReplicationvCentersClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "de7bf72ec57ce43a8ccff088d616ce69", "score": "0.6527106", "text": "func (l *CertificatesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *CertificatesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"CertificatesClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &CertificatesCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "6b8a4e324e033d0de2beda84cbcfd08d", "score": "0.65210736", "text": "func (l *CustomDomainsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *CustomDomainsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"CustomDomainsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &CustomDomainsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "4e4686113862b73896c8d97c367649df", "score": "0.65169454", "text": "func (p *PrivateEndpointConnectionsForMIPPolicySyncClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "eb9c93bee9bb84a395e9c4d238a9021e", "score": "0.65052396", "text": "func (p *ReplicationFabricsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "53decc89a085211a420b684d6f2e53d2", "score": "0.6502068", "text": "func (p *PrivateZonesClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "afccbb45047d2a079fb22ab05858b2d3", "score": "0.6490767", "text": "func (p *VirtualNetworkLinksClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "28e33a584d141aa79f1aae07dbed3734", "score": "0.64822936", "text": "func (l *DeploymentsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DeploymentsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DeploymentsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DeploymentsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "14e6d0149d3c402b077e73f67d759a19", "score": "0.64788455", "text": "func (p *TriggersClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "60489d708ae7d36e67067c4b2de27501", "score": "0.6469805", "text": "func (l *PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateEndpointConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateEndpointConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "60489d708ae7d36e67067c4b2de27501", "score": "0.6469805", "text": "func (l *PrivateEndpointConnectionsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateEndpointConnectionsClient.CreateOrUpdate\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateEndpointConnectionsClientCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "a99f6a43d198933eb30ed091a695a4c0", "score": "0.64487857", "text": "func (p *ApplicationTypeVersionsCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "d27395637130daf17a2e3e841f14c6cf", "score": "0.644807", "text": "func (p *ReplicationVaultSettingClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "a8eb3c87c64b83d6d7223aad74dd5d1f", "score": "0.64409775", "text": "func (p *ReplicationRecoveryServicesProvidersClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "ff3f1cc8fa67dfc1fc427883e965bf88", "score": "0.64184254", "text": "func (p *AccountsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "3422cc457a530dd64a261204ea0d0a30", "score": "0.6415442", "text": "func (p *ReplicationMigrationItemsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "bb444cdc5a78969159aabeb3e2ad5e3c", "score": "0.64154315", "text": "func (p *ClustersCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "bc5e2ceb645fd1b47158759b86328918", "score": "0.64125896", "text": "func (l *BindingsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *BindingsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"BindingsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &BindingsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "23f8ab62ffa43debbdd7cf56601ec58f", "score": "0.6403752", "text": "func (l *AgentPoolsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *AgentPoolsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"AgentPoolsClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &AgentPoolsCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "cf20a5b6401cf47b1ad2b4f5c0fe92f2", "score": "0.6352416", "text": "func (p *ReplicationRecoveryPlansClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "557d1e448508139ae7cdbd8520939049", "score": "0.63321054", "text": "func (l *ClientCreatePollerResponse) Resume(ctx context.Context, client *Client, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"Client.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "cd3c803ade6e58363851d1caa69749ce", "score": "0.6331521", "text": "func (l *NamespacesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *NamespacesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"NamespacesClient.CreateOrUpdate\", token, client.pl, client.createOrUpdateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &NamespacesCreateOrUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "989d296ad26fecc80389de06979733b2", "score": "0.6314546", "text": "func (l *ConnectedClusterClientCreatePollerResponse) Resume(ctx context.Context, client *ConnectedClusterClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ConnectedClusterClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ConnectedClusterClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "b762054f22839adf3e6981388088b167", "score": "0.6306996", "text": "func (l *ServersCreatePollerResponse) Resume(ctx context.Context, client *ServersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ServersClient.Create\", token, client.pl, client.createHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ServersCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "03421b501614c9fc79aa7060ed03018b", "score": "0.6284168", "text": "func (p *ReplicationProtectedItemsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "48df3772a2da53fd9ae18e905e7ae383", "score": "0.6280706", "text": "func (p *ReplicationProtectionContainersClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "6d4fd33deeaa344c729602d7e01a78b1", "score": "0.62641555", "text": "func (p *PrivateEndpointConnectionsCompClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "d378c804b7c7857ad0532b177d7afeab", "score": "0.62572753", "text": "func (l *LinkedServerClientCreatePollerResponse) Resume(ctx context.Context, client *LinkedServerClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"LinkedServerClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &LinkedServerClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "7b4678d12ef3f2fed85c5b2f3f0e6f04", "score": "0.62187487", "text": "func (p *ReplicationStorageClassificationMappingsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "3c96cf4d326a6ee923fb6b88a01f0d3a", "score": "0.6169584", "text": "func (p *ReplicationNetworkMappingsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "325e9480d99086c80f92c6ecfa57eb38", "score": "0.61311746", "text": "func (l *RunbookClientPublishPollerResponse) Resume(ctx context.Context, client *RunbookClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RunbookClient.Publish\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RunbookClientPublishPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "4951bcb71e84612ece5bc72d65dd966f", "score": "0.6090399", "text": "func NewLROPollerFromResumeToken(pollerID string, token string, pl azcore.Pipeline, eu ErrorUnmarshaller) (*LROPoller, error) {\n\t// unmarshal into JSON object to determine the poller type\n\tobj := map[string]interface{}{}\n\terr := json.Unmarshal([]byte(token), &obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt, ok := obj[\"type\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"missing type field\")\n\t}\n\ttt, ok := t.(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid type format %T\", t)\n\t}\n\tttID, ttKind, err := pollers.DecodeID(tt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// ensure poller types match\n\tif ttID != pollerID {\n\t\treturn nil, fmt.Errorf(\"cannot resume from this poller token. expected %s, received %s\", pollerID, ttID)\n\t}\n\t// now rehydrate the poller based on the encoded poller type\n\tvar lro lroPoller\n\tswitch ttKind {\n\tcase \"async\":\n\t\tazcore.Log().Write(azcore.LogLongRunningOperation, \"Resuming Azure-AsyncOperation poller.\")\n\t\tlro = &async.Poller{}\n\tcase \"loc\":\n\t\tazcore.Log().Write(azcore.LogLongRunningOperation, \"Resuming Location poller.\")\n\t\tlro = &loc.Poller{}\n\tcase \"body\":\n\t\tazcore.Log().Write(azcore.LogLongRunningOperation, \"Resuming Body poller.\")\n\t\tlro = &body.Poller{}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unhandled poller type %s\", ttKind)\n\t}\n\tif err = json.Unmarshal([]byte(token), lro); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &LROPoller{lro: lro, Pipeline: pl, eu: eu}, nil\n}", "title": "" }, { "docid": "19f60ae50fccde74773caea79c649f88", "score": "0.6071491", "text": "func (l *DscCompilationJobClientCreatePollerResponse) Resume(ctx context.Context, client *DscCompilationJobClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"DscCompilationJobClient.Create\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &DscCompilationJobClientCreatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "19065a100a54bb152da993d1595e0dfb", "score": "0.603101", "text": "func (p *ReplicationProtectionContainerMappingsClientCreatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "10466150b698564ea7c9548e56d342c5", "score": "0.5980481", "text": "func (client *PartnerTopicEventSubscriptionsClient) ResumeDelete(ctx context.Context, token string) (PartnerTopicEventSubscriptionsDeletePollerResponse, error) {\n\tpt, err := armcore.NewLROPollerFromResumeToken(\"PartnerTopicEventSubscriptionsClient.Delete\", token, client.con.Pipeline(), client.deleteHandleError)\n\tif err != nil {\n\t\treturn PartnerTopicEventSubscriptionsDeletePollerResponse{}, err\n\t}\n\tpoller := &partnerTopicEventSubscriptionsDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn PartnerTopicEventSubscriptionsDeletePollerResponse{}, err\n\t}\n\tresult := PartnerTopicEventSubscriptionsDeletePollerResponse{\n\t\tRawResponse: resp,\n\t}\n\tresult.Poller = poller\n\tresult.PollUntilDone = func(ctx context.Context, frequency time.Duration) (PartnerTopicEventSubscriptionsDeleteResponse, error) {\n\t\treturn poller.pollUntilDone(ctx, frequency)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "67e004a638becc2eb38d1907333d3602", "score": "0.59240687", "text": "func (p *ReplicationJobsClientResumePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "d395cd23b181c549b32b1deab80716a8", "score": "0.5899185", "text": "func (p *ProviderShareSubscriptionsClientRevokePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "becb67a11d7a121147c3637b8533fffc", "score": "0.5880406", "text": "func (p *VirtualMachinesClientStartPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "e41905b085b324bdeda5d5c82499cbd1", "score": "0.58419895", "text": "func (client *PacketCapturesClient) ResumeCreate(token string) (PacketCaptureResultPoller, error) {\n\tpt, err := armcore.NewPollerFromResumeToken(\"PacketCapturesClient.Create\", token, client.createHandleError)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &packetCaptureResultPoller{\n\t\tpipeline: client.con.Pipeline(),\n\t\tpt: pt,\n\t}, nil\n}", "title": "" }, { "docid": "74c46b9cde883a71e7fdba1ce0a6ba53", "score": "0.5820385", "text": "func (client *PartnerTopicEventSubscriptionsClient) ResumeUpdate(ctx context.Context, token string) (PartnerTopicEventSubscriptionsUpdatePollerResponse, error) {\n\tpt, err := armcore.NewLROPollerFromResumeToken(\"PartnerTopicEventSubscriptionsClient.Update\", token, client.con.Pipeline(), client.updateHandleError)\n\tif err != nil {\n\t\treturn PartnerTopicEventSubscriptionsUpdatePollerResponse{}, err\n\t}\n\tpoller := &partnerTopicEventSubscriptionsUpdatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn PartnerTopicEventSubscriptionsUpdatePollerResponse{}, err\n\t}\n\tresult := PartnerTopicEventSubscriptionsUpdatePollerResponse{\n\t\tRawResponse: resp,\n\t}\n\tresult.Poller = poller\n\tresult.PollUntilDone = func(ctx context.Context, frequency time.Duration) (PartnerTopicEventSubscriptionsUpdateResponse, error) {\n\t\treturn poller.pollUntilDone(ctx, frequency)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "f03d372ba0bd23588fd971314e420be1", "score": "0.58180934", "text": "func (p *PrivateLinkServicesForO365ManagementActivityAPIClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "3cd3376ba88d828ef94a4c8bfe996aee", "score": "0.58110356", "text": "func (p *ReplicationPoliciesClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "2b7609c07fb75e93c7e2d72bc9390f43", "score": "0.58088183", "text": "func (l *VirtualMachinesClientStartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"VirtualMachinesClient.Start\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &VirtualMachinesClientStartPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "1e8511aef53a92a208b22c96e5cee77f", "score": "0.57818985", "text": "func (p *ShareSubscriptionsClientSynchronizePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "24c77c224234c3f5118fe75b12c67332", "score": "0.5779205", "text": "func (p *ComputeClientStartPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "e505a43c1bfa2a746c3bcd26a53e11ff", "score": "0.57648265", "text": "func (l *PrivateEndpointConnectionsClientPutPollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"PrivateEndpointConnectionsClient.Put\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &PrivateEndpointConnectionsClientPutPoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" }, { "docid": "8c52cdcff797cf983229981af96518ce", "score": "0.5764479", "text": "func (p *VirtualMachinesClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "5e090d704685a5d8d9eee53e25100608", "score": "0.57532495", "text": "func (p *ReplicationVaultHealthClientRefreshPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "8a2535e21753b008e4ad9614f53b17e9", "score": "0.57409203", "text": "func (p *ReplicationJobsClientRestartPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "1459b9d2c75b6df2d58916d65de2ea7f", "score": "0.5731291", "text": "func (p *PrivateLinkServicesForEDMUploadClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "c39e4317db230d29fb6d0cc3ad7fcc7a", "score": "0.5725269", "text": "func (p *PrivateZonesClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "63ffb791272482959e49ef6d8152e8ce", "score": "0.5716285", "text": "func (p *PrivateLinkServicesForM365ComplianceCenterClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "4afb9e61211e16a3f3407f2668083a8c", "score": "0.5713299", "text": "func (p *WorkspacesClientResyncKeysPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "d54893d96e3602e88fb5f65f86a5882d", "score": "0.570949", "text": "func (p *PrivateLinkServicesForSCCPowershellClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "d31f2f140cccb70d4b2be25463687070", "score": "0.5707983", "text": "func (p *ShareSubscriptionsClientDeletePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "c5ab857a0498d6a666c3e9cadfb6184b", "score": "0.5706414", "text": "func (p *PrivateLinkServicesForMIPPolicySyncClientUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "af37ba73033a84998ad08a793effc45c", "score": "0.57008415", "text": "func (p *ReplicationRecoveryPlansClientPlannedFailoverPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "d779bebbbd68d33a1e255e55ac6c8386", "score": "0.5698705", "text": "func (p *ReplicationRecoveryPlansClientFailoverCancelPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "5e1cdb9bdd1884b7ec9b87ead8d9c380", "score": "0.56962866", "text": "func (p *ReplicationJobsClientCancelPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "116b7de5445c7a36db1eb973e0444c7e", "score": "0.5692937", "text": "func (p *ShareSubscriptionsClientCancelSynchronizationPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "070543b77e1351ffcc262db035afe921", "score": "0.5691159", "text": "func (l *ConfigServersValidatePollerResponse) Resume(ctx context.Context, client *ConfigServersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"ConfigServersClient.Validate\", token, client.pl, client.validateHandleError)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &ConfigServersValidatePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "title": "" } ]
77f621f4b556494452d9a3962d954b31
Mult returns a new vector that consists of the components of vector 'a' scaled by value 'b'
[ { "docid": "3072e7f81c59419e85554ca7441ec699", "score": "0.6671487", "text": "func Mult(a Vector3, b float32) Vector3 {\n\treturn Vector3{a.X * b, a.Y * b, a.Z * b}\n}", "title": "" } ]
[ { "docid": "09aa4e0c4de18d5288519212080a24a3", "score": "0.75164175", "text": "func Mult(a, b Vek) Vek {\n\treturn Vek{a[0]*b[0], a[1]*b[1]}\n}", "title": "" }, { "docid": "b43803137b031129181617099693820e", "score": "0.72565323", "text": "func Mult(a Vec, t float64) Vec {\n\treturn *a.Mult(t)\n}", "title": "" }, { "docid": "09685d7f8d27826fdcfa91fd3486cb1f", "score": "0.68338186", "text": "func Mul(a, b Vec) Vec {\n\treturn *a.Mul(b)\n}", "title": "" }, { "docid": "da7111f7be9bd83c8505565409c6ea0d", "score": "0.66912955", "text": "func (a Frame) Mult(b Frame) Frame {\n\ta, b, err := SameSize(a, b)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tl := len(a)\n\tf := make(Frame, l)\n\tfor i := 0; i < l; i++ {\n\t\tf[i] = byte((int(a[i]) * int(b[i])) / 255)\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "8fb9e0249c96bc38ff7a6f434ceef6ac", "score": "0.6668698", "text": "func (a *Vector2i) Mult(scale int) {\n\ta.X *= scale\n\ta.Y *= scale\n}", "title": "" }, { "docid": "06796b6488615e47e9437c08bd9c4879", "score": "0.65798277", "text": "func (a *Vector2f) Mult(scale float64) {\n\ta.X *= scale\n\ta.Y *= scale\n}", "title": "" }, { "docid": "8716f71ddcd8d01a74f84e8fb92d85fe", "score": "0.6515248", "text": "func (p Vec) Mult(f float64) Vec {\n\tres := make([]float64, len(p))\n\tfor i, v := range p {\n\t\tres[i] = v * f\n\t}\n\treturn res\n}", "title": "" }, { "docid": "83f6542a3734ba4b7715c49074d43bb4", "score": "0.64971817", "text": "func (a *Vec) Mul(b Vec) *Vec {\n\ta.X *= b.X\n\ta.Y *= b.Y\n\ta.Z *= b.Z\n\treturn a\n}", "title": "" }, { "docid": "ff3f39bae63c14d7aaf99206df85a07b", "score": "0.6482819", "text": "func (v Vector) MultVector(w Vector) Vector {\r\n\treturn Vector{v.X * w.X, v.Y * w.Y, v.Z * w.Z}\r\n}", "title": "" }, { "docid": "cc6d54e8cdd55c8c36cb8500f104b083", "score": "0.6463309", "text": "func Mult(a, b *Matrix) (result *Matrix) {\r\n\r\n\treturn result\r\n\r\n}", "title": "" }, { "docid": "4c69156c66d3dd1a74e1ad9ddbcf5c4c", "score": "0.64490783", "text": "func MultiplyVector(a, b Vector) Vector {\n\tres_x := a.X * b.X\n\tres_y := a.Y * b.Y\n\n\treturn Vector{res_x, res_y}\n\n}", "title": "" }, { "docid": "41dfb34780fad188ca930a8ff0ae93b2", "score": "0.6376743", "text": "func (v Vec2) ScalarMult(n int) Vec2 {\n\treturn NewVec2(v.x*n, v.y*n)\n}", "title": "" }, { "docid": "ea2009fc4e66419ed6695a2d981687d8", "score": "0.6340139", "text": "func Multiply(a cty.Value, b cty.Value) (cty.Value, error) {\n\treturn MultiplyFunc.Call([]cty.Value{a, b})\n}", "title": "" }, { "docid": "e6df42a445392cb7e0fa2d6cfc8a58a0", "score": "0.63108855", "text": "func Mult(a, b []float64, n, blockSize int) []float64 {\r\n\r\n}", "title": "" }, { "docid": "05e113a8275399a0ee143c6078cc82d0", "score": "0.6292745", "text": "func multipl(a *mat64.Vector, m mat64.Matrix, b *mat64.Vector) float64 {\n\tprintdim(a, \"a\")\n\tprintdim(m, \"m\")\n\tprintdim(b, \"b\")\n\tp1 := new(mat64.Dense)\n\tp1.MulTrans(a, true, m, false)\n\tres := new(mat64.Dense)\n\tprintdim(p1, \"p1\")\n\tres.Mul(p1, b)\n\treturn res.At(0, 0)\n}", "title": "" }, { "docid": "376bf9587ee2ab4f4093214c1c3c4d38", "score": "0.62722427", "text": "func (a *Vec) Mult(t float64) *Vec {\n\ta.X *= t\n\ta.Y *= t\n\ta.Z *= t\n\treturn a\n}", "title": "" }, { "docid": "f3cac88503056c3716b85b0a809ac878", "score": "0.6249019", "text": "func (ns *Namespace) Mul(a, b interface{}) (interface{}, error) {\n\treturn _math.DoArithmetic(a, b, '*')\n}", "title": "" }, { "docid": "9d63a2681b7dd069a412291d26076a8f", "score": "0.619313", "text": "func (v *Vec2D) Multiply(u Vec2D) *Vec2D {\n\tv.X *= u.X\n\tv.Y *= u.Y\n\treturn v\n}", "title": "" }, { "docid": "45c92bb27a14189d53ea0b03abd96f0a", "score": "0.61782587", "text": "func Mul(a, b Dual) Dual {\n\tvar d Dual\n\td.data[0] = a.data[0] * b.data[0]\n\td.data[1] = a.data[0]*b.data[1] + a.data[1]*b.data[0]\n\td.data[2] = a.data[0]*b.data[2] + a.data[2]*b.data[0]\n\td.data[3] = a.data[0]*b.data[3] + a.data[1]*b.data[2] +\n\t\ta.data[2]*b.data[1] + a.data[3]*b.data[0]\n\treturn d\n}", "title": "" }, { "docid": "500c836e59b3f17547cc3ef573fe7a6f", "score": "0.61593753", "text": "func (v Vector) Mul(v2 Vector) Vector {\n\treturn Vector{v[0] * v2[0], v[1] * v2[1], v[2] * v2[2]}\n}", "title": "" }, { "docid": "1bf5ad79eef9f29845c27685a3fc0da8", "score": "0.6123606", "text": "func (s *FractionService) Multiply(req *FractionServiceMultiplyRequest, rsp *FractionServiceMultiplyResponse) error {\n\tresponse, err := s.SvcObj.Multiply(req.A, req.B)\n\tif err == nil {\n\t\trsp.Value = response\n\t}\n\treturn err\n}", "title": "" }, { "docid": "0aa405d0c0e7f41a0fe578d982f63ca8", "score": "0.61193603", "text": "func (v1 Vector) Mul(f float64) Vector {\n\tv := NewVector(len(v1))\n\tfor i := 0; i < len(v1); i++ {\n\t\tv[i] = v1[i] * f\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ef649a989460f3a76b78c7924c3a0386", "score": "0.6076258", "text": "func (network *Network) multiplyVectors(idx int, a, b []float64) {\n\tlenA, lenB := len(a), len(b)\n\tnewF := make([][]float64, lenB)\n\tfor i := 0; i < lenB; i++ {\n\t\tnewNodeM := make([]float64, lenA)\n\t\tfor j := 0; j < lenA; j++ {\n\t\t\tnewNodeM[j] = a[j] * b[i]\n\t\t\tnetwork.weightCosts[idx][i][j] += (a[j] * b[i]) + 0.5*network.RegStrength*network.WeightsSumSquared\n\t\t}\n\t\tnewF[i] = newNodeM\n\t}\n}", "title": "" }, { "docid": "fcb9b26d623d3cb8b2b37ba0c3dcf3be", "score": "0.60004246", "text": "func (vm *VM) mul() { b, a := vm.pop(), vm.pop(); vm.push(a * b) }", "title": "" }, { "docid": "0bf94632fe9185d75aed86138fe5b0f5", "score": "0.5995732", "text": "func (v Value) Mul(u Value) (res Value, err error) {\n\treturn calculateValues(v, u, '*')\n}", "title": "" }, { "docid": "a120ab30fb4b443b1378709f4d9876d0", "score": "0.59894365", "text": "func (s *server) Multiply(ctx context.Context, in *calc_service.MultiplyRequest) (*calc_service.MultiplyResponse, error) {\n\treturn &calc_service.MultiplyResponse{\n\t\tResult: in.GetA() * in.GetB(),\n\t}, nil\n}", "title": "" }, { "docid": "d39851ec2ca8b2320560d09d44e1a01f", "score": "0.5969853", "text": "func (s Sample) Mult(s2 Sample) Sample {\n\tif s.Channels() != s2.Channels() {\n\t\tpanic(\"Samples must have same number of channels to multiply\")\n\t}\n\tfor i := range s {\n\t\ts[i] = s[i] * s2[i]\n\t}\n\treturn s\n}", "title": "" }, { "docid": "1cc0cd0d5b94e21228674202366ab034", "score": "0.5964194", "text": "func (f *Features) mult(scalar float64) []float64 {\n\tr := make([]float64, len(f.V))\n\tfor i := range f.V {\n\t\tr[i] = f.V[i] * scalar\n\t}\n\treturn r\n}", "title": "" }, { "docid": "718a7ac6b9c23831ffa45a74b8539c69", "score": "0.5952205", "text": "func Multiply(a, b float64) float64 {\n\treturn a * b\n}", "title": "" }, { "docid": "2bfb8b7d9a55327174147528ff67e178", "score": "0.59443194", "text": "func Mul(a, b uint64) uint64 {\n\treturn a * b / DecimalUnit\n}", "title": "" }, { "docid": "9c2b105a47d8394f743e9c024f1b5705", "score": "0.5927856", "text": "func (l Length) Mult(other Length) Length {\n\tcheck.Panic(check.Equal(l.Unit, other.Unit))\n\treturn NewLength(l.Unit, l.Units*other.Units)\n}", "title": "" }, { "docid": "ab703df4e10851c700cf9a67097cfd85", "score": "0.5927069", "text": "func (a *Vector2f) CpyMult(scale float64) Vector2f {\n\treturn Vector2f{\n\t\tX: a.X * scale,\n\t\tY: a.Y * scale,\n\t}\n}", "title": "" }, { "docid": "c65e49b674dbc071043ce1838519cc4f", "score": "0.5922314", "text": "func mulVectorElem(dst []float64, src []float64) {\n\tfor c := 0; c < len(dst); c++ {\n\t\tdst[c] *= src[c]\n\t}\n}", "title": "" }, { "docid": "161701d9f097abd5b6ebf722d471fcc4", "score": "0.5917732", "text": "func (v Vector) MultScalar(s float64) Vector {\r\n\treturn Vector{v.X * s, v.Y * s, v.Z * s}\r\n}", "title": "" }, { "docid": "06d678bcdf87e43657771215a72797d8", "score": "0.59073734", "text": "func (a *Vec2) Multiply(s float32) {\n\ta.X *= s\n\ta.Y *= s\n}", "title": "" }, { "docid": "b1f3156dbc2082cd216530c157b7e631", "score": "0.58974123", "text": "func (a *Vector) ScalarMultiply(b float64) *Vector {\r\n\tc := new(Vector)\r\n\tc.X = a.X * b\r\n\tc.Y = a.Y * b\r\n\tc.Z = a.Z * b\r\n\treturn c\r\n}", "title": "" }, { "docid": "4a8a618dc81e20fc5b70ab901a2778ab", "score": "0.5885873", "text": "func Multiply(a, b Matrix) Matrix {\n\tvar values [][]float64\n\tvar row []float64\n\tfor x := 0; x < a.Height; x++ {\n\t\tfor y := 0; y < a.Width; y++ {\n\t\t\trow = append(row, multiplyCell(a, b, x, y))\n\t\t}\n\t\tvalues = append(values, make([]float64, len(row)))\n\t\tcopy(values[x], row)\n\t\trow = row[:0]\n\t}\n\tm := Matrix{Width: a.Width, Height: a.Height, Cells: values}\n\treturn m\n}", "title": "" }, { "docid": "335633d638f0c032df808eac05077b5a", "score": "0.5857231", "text": "func (a Chebyshev) Multiply(b Chebyshev) Chebyshev {\n\t// When you multiply two chebyshev polynomials, the order of the result\n\t// will be the sum of the orders of the factors\n\tl := len(a) + len(b) - 1\n\n\tc := make(Chebyshev, l, l)\n\tfor i, ai := range a {\n\t\tif ai == 0.0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor j, bj := range b {\n\t\t\tif bj == 0.0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Tn * Tm = 1/2 ( T(n+m) + T(|n-m|) )\n\t\t\tp := ai * bj / 2\n\t\t\tc[i+j] += p\n\t\t\tc[abs(i-j)] += p\n\t\t}\n\t}\n\n\treturn c.normalize()\n}", "title": "" }, { "docid": "97d7c586b483047dcf3f0a8e9d9737fb", "score": "0.5855745", "text": "func (v Vector2) Mul(value float64) Vector2 {\n\tv.X *= value\n\tv.Y *= value\n\treturn v\n}", "title": "" }, { "docid": "3380b361cf5c6c466a6e61ddbc1d8850", "score": "0.5836998", "text": "func (s *unpackedScalar) Mul(a, b *unpackedScalar) *unpackedScalar {\n\tlimbs := scalarMulInternal(a, b)\n\ts.MontgomeryReduce(&limbs)\n\tlimbs = scalarMulInternal(s, &constRR)\n\treturn s.MontgomeryReduce(&limbs)\n}", "title": "" }, { "docid": "ad22cfff3b629b5f93c3b9f84e8907b2", "score": "0.583532", "text": "func (q Quat) Mult(v Quat) Quat {\r\n\treturn Quat{\r\n\t\tA: q.A*v.A - q.I*v.I - q.J*v.J - q.K*v.K,\r\n\t\tI: q.A*v.I + q.I*v.A + q.J*v.K - q.K*v.J,\r\n\t\tJ: q.A*v.J - q.I*v.K + q.J*v.A + q.K*v.I,\r\n\t\tK: q.A*v.K + q.I*v.J - q.J*v.I + q.K*v.A,\r\n\t}\r\n\t// wow, that was tedious!\r\n}", "title": "" }, { "docid": "4cbaa4c24c8bf8327c1bb1d8535d50f7", "score": "0.58332163", "text": "func ScalarMult(dst, scalar, point *[32]byte) {\n\tscalarMult(dst, scalar, point)\n}", "title": "" }, { "docid": "4cbaa4c24c8bf8327c1bb1d8535d50f7", "score": "0.58332163", "text": "func ScalarMult(dst, scalar, point *[32]byte) {\n\tscalarMult(dst, scalar, point)\n}", "title": "" }, { "docid": "89eb66fd6741cc212aa66268dddac415", "score": "0.5830004", "text": "func (v Vector) Multi(s float64) Vector {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n\treturn v\n}", "title": "" }, { "docid": "c502efef0f13869e7bea0bd5b0037388", "score": "0.5825433", "text": "func (v Vector3) Mult(f float64) Vector3 {\n\treturn Vector3{v[X] * f, v[Y] * f, v[Z] * f}\n}", "title": "" }, { "docid": "0557964ea53fef8984b91c5d1188f5f1", "score": "0.58095616", "text": "func (a Quat) Mul(b Quat) Quat {\n\treturn Quat{\n\t\t(b.W * a.W) - (b.X * a.X) - (b.Y * a.Y) - (b.Z * a.Z),\n\t\t(b.X * a.W) + (b.W * a.X) - (b.Z * a.Y) + (b.Y * a.Z),\n\t\t(b.Y * a.W) + (b.Z * a.X) + (b.W * a.Y) - (b.X * a.Z),\n\t\t(b.Z * a.W) - (b.Y * a.X) + (b.X * a.Y) + (b.W * a.Z),\n\t}\n}", "title": "" }, { "docid": "061445e6149d586e37a56988611b93b7", "score": "0.57863945", "text": "func (s *FloatService) Multiply(req *FloatServiceMultiplyRequest, rsp *FloatServiceMultiplyResponse) error {\n\tresponse, err := s.SvcObj.Multiply(req.A, req.B)\n\tif err == nil {\n\t\trsp.Value = response\n\t}\n\treturn err\n}", "title": "" }, { "docid": "79d855f9ecead69fddd5173f8894dcb6", "score": "0.57367903", "text": "func (g groupElem) Mult(h Elem, x *big.Int) Elem {\n\tg.value.Mul(h.(groupElem).value, x)\n\treturn g\n}", "title": "" }, { "docid": "e186b0d27b26d719764d0abe62a377b0", "score": "0.56986105", "text": "func mulsub(u1, u0, v1, v0 uint32, q0 uint64) uint64 {\n\ttmp := uint64(u0) - q0*uint64(v0)\n\treturn make64(u1+uint32(tmp>>32)-uint32(q0*uint64(v1)), uint32(tmp&longMask))\n}", "title": "" }, { "docid": "2f80c9f2d6130577053b66594e02977b", "score": "0.56433326", "text": "func (v Vector2) Mul(op Vector2) Vector2 {\n\treturn Vector2{X: v.X * op.X, Y: v.Y * op.Y}\n}", "title": "" }, { "docid": "5d346b76db17dc5af8374d8d1c5de6d4", "score": "0.5620842", "text": "func multiply(b, a interface{}) interface{} {\n\tav := reflect.ValueOf(a)\n\tbv := reflect.ValueOf(b)\n\t//log.Fatalln(\"multiply kinds\", av.Kind(), bv.Kind())\n\n\tswitch av.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tswitch bv.Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\treturn av.Int() * bv.Int()\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\treturn av.Int() * int64(bv.Uint())\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\treturn float64(av.Int()) * bv.Float()\n\t\tcase reflect.String:\n\t\t\tc, _ := strconv.ParseInt(bv.String(), 10, 64)\n\t\t\treturn av.Int() * c\n\t\tdefault:\n\t\t\tlog.Fatal(fmt.Errorf(\"multiply: unknown type for %q (%T)\", bv, b))\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tswitch bv.Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\treturn int64(av.Uint()) * bv.Int()\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\treturn av.Uint() * bv.Uint()\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\treturn float64(av.Uint()) * bv.Float()\n\t\tcase reflect.String:\n\t\t\tc, _ := strconv.ParseInt(bv.String(), 10, 64)\n\t\t\treturn int64(av.Uint()) * c\n\t\tdefault:\n\t\t\tlog.Fatal(fmt.Errorf(\"multiply: unknown type for %q (%T)\", bv, b))\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tswitch bv.Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\treturn av.Float() * float64(bv.Int())\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\treturn av.Float() * float64(bv.Uint())\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\treturn av.Float() * bv.Float()\n\t\tcase reflect.String:\n\t\t\tc, _ := strconv.ParseFloat(bv.String(), 64)\n\t\t\treturn av.Float() * c\n\t\tdefault:\n\t\t\tlog.Fatal(fmt.Errorf(\"multiply: unknown type for %q (%T)\", bv, b))\n\t\t\treturn nil\n\t\t}\n\tcase reflect.String:\n\t\tca, _e := strconv.ParseInt(av.String(), 10, 64)\n\t\tif _e != nil {\n\t\t\treturn nil\n\t\t}\n\t\tswitch bv.Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\treturn ca * bv.Int()\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\treturn ca * int64(bv.Uint())\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\treturn av.Float() * bv.Float()\n\t\tcase reflect.String:\n\t\t\tcb, _ := strconv.ParseInt(bv.String(), 10, 64)\n\t\t\treturn ca * cb\n\t\tdefault:\n\t\t\tlog.Fatal(fmt.Errorf(\"multiply: unknown type for %q (%T)\", bv, b))\n\t\t\treturn nil\n\t\t}\n\tdefault:\n\t\tlog.Fatal(fmt.Errorf(\"multiply: unknown type for %q (%T)\", av, a))\n\t\treturn nil\n\t}\n\n}", "title": "" }, { "docid": "5d912ef464244591ba65bfcb050881f6", "score": "0.561351", "text": "func (v Vec2f) Mul(other Vec2f) Vec2f {\n\treturn Vec2f{v[0] * other[0], v[1] * other[1]}\n}", "title": "" }, { "docid": "9655dc497fb8165d35c4c5d6cfd768da", "score": "0.5612667", "text": "func mulVectorNum(vec []float64, d float64) {\n\tfor c := 0; c < len(vec); c++ {\n\t\tvec[c] *= d\n\t}\n}", "title": "" }, { "docid": "c01d19996f2d5ff9fe870191ded418db", "score": "0.5605676", "text": "func (v Vec3) Multiply(v2 Vec3) Vec3 {\n\treturn v.Hadamard(v2)\n}", "title": "" }, { "docid": "b1c3da143618b6f31a7bfb8665f4d22d", "score": "0.55713356", "text": "func Pow(a, b float64) float64 {\n\tres := 1.0\n\ti := 0.0\n\n\tfor i = 0; i < b; i++ {\n\t\tres = res * a\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "d048e93ef48801e7ea4f8331280af111", "score": "0.5563754", "text": "func Mul(v float64, ma *Matrix) *Matrix {\n\tmb := &Matrix{ma.m, ma.n, make([]float64, ma.m * ma.n)}\n\tfor i, val := range ma.data {\n\t\tmb.data[i] = val * v\n\t}\n\treturn mb\n}", "title": "" }, { "docid": "6c2d725e39f0ddbeee0b4cf8a54de14e", "score": "0.55177194", "text": "func (z *Decimal) MulRange(a, b int64) *Decimal {\n\tswitch {\n\tcase a > b:\n\t\treturn z.SetInt64(1)\n\tcase a <= 0 && b >= 0:\n\t\treturn z.SetInt64(0)\n\t}\n\tneg := false\n\tif a < 0 {\n\t\tneg = (b-a)&1 == 0\n\t\ta, b = -b, -a\n\t}\n\tz.mulRange(a, b)\n\tif neg {\n\t\tz.Neg(z)\n\t}\n\treturn z\n}", "title": "" }, { "docid": "0d57cbf021ecbef76758200602342507", "score": "0.5510062", "text": "func (f *Polynomial) Multiply(a float64) {\n\tfor i := range *f {\n\t\t(*f)[i] *= a\n\t}\n}", "title": "" }, { "docid": "3dba6861154fa20c5471767bab686e57", "score": "0.5492237", "text": "func (v *Variable) Multiply(coefficient float64) *Term {\n\treturn NewTerm(v, coefficient)\n}", "title": "" }, { "docid": "81b6b85f3f8bd75d5af3b9665ee73a37", "score": "0.54833645", "text": "func TestVectorMul(t *testing.T) {\n\tvar (\n\t\ta, b []*big.Int\n\t)\n\ta = make([]*big.Int, 3)\n\tb = make([]*big.Int, 3)\n\ta[0] = new(big.Int).SetInt64(7)\n\ta[1] = new(big.Int).SetInt64(8)\n\ta[2] = new(big.Int).SetInt64(9)\n\tb[0] = new(big.Int).SetInt64(3)\n\tb[1] = new(big.Int).SetInt64(30)\n\tb[2] = new(big.Int).SetInt64(40)\n\tresult, _ := VectorMul(a, b)\n\tok := (result[0].Cmp(new(big.Int).SetInt64(21)) == 0)\n\tok = ok && (result[1].Cmp(new(big.Int).SetInt64(240)) == 0)\n\tok = ok && (result[2].Cmp(new(big.Int).SetInt64(360)) == 0)\n\n\tif ok != true {\n\t\tt.Errorf(\"Assert failure: expected true, actual: %t\", ok)\n\t}\n}", "title": "" }, { "docid": "4f47b2abb36e7f5bea2f5cef9b657ee2", "score": "0.5472232", "text": "func Multiply(a int, b int) int {\n\treturn a * b\n}", "title": "" }, { "docid": "86c37664ba677b6786281d43f41857a4", "score": "0.5471228", "text": "func (a *Vec) Scale(c float64) *Vec {\n\n\tfor i := 0; i < a.Size(); i++ {\n\t\ta.Coords[i] *= c\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "1dfaa5daedf8356dde1da6b365f66fd3", "score": "0.54669183", "text": "func mul(low, high *uint, a, b uint) {\n\t*high, *low = bits.Mul(a, b)\n}", "title": "" }, { "docid": "08ee96e853f592f4f52a60bfa8e71b68", "score": "0.5463609", "text": "func (s *Series) Multiply(other *Series, ignoreNulls bool) *Series {\n\tfn := func(v1 float64, v2 float64) float64 {\n\t\treturn v1 * v2\n\t}\n\treturn s.combineMath(other, ignoreNulls, fn)\n}", "title": "" }, { "docid": "6638a79b3dc66d1cafee027f29d2fcef", "score": "0.5453054", "text": "func (v *Vector) MulVec(a Matrix, trans bool, b *Vector) {\n\tar, ac := a.Dims()\n\tbr := b.Len()\n\tif trans {\n\t\tif ar != br {\n\t\t\tpanic(ErrShape)\n\t\t}\n\t} else {\n\t\tif ac != br {\n\t\t\tpanic(ErrShape)\n\t\t}\n\t}\n\n\tvar w Vector\n\tif v != a && v != b {\n\t\tw = *v\n\t}\n\tif w.n == 0 {\n\t\tif trans {\n\t\t\tw.mat.Data = use(w.mat.Data, ac)\n\t\t} else {\n\t\t\tw.mat.Data = use(w.mat.Data, ar)\n\t\t}\n\n\t\tw.mat.Inc = 1\n\t\tw.n = ar\n\t\tif trans {\n\t\t\tw.n = ac\n\t\t}\n\t} else {\n\t\tif trans {\n\t\t\tif ac != w.n {\n\t\t\t\tpanic(ErrShape)\n\t\t\t}\n\t\t} else {\n\t\t\tif ar != w.n {\n\t\t\t\tpanic(ErrShape)\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch a := a.(type) {\n\tcase RawSymmetricer:\n\t\tamat := a.RawSymmetric()\n\t\tblas64.Symv(1, amat, b.mat, 0, w.mat)\n\tcase RawTriangular:\n\t\tw.CopyVec(b)\n\t\tamat := a.RawTriangular()\n\t\tta := blas.NoTrans\n\t\tif trans {\n\t\t\tta = blas.Trans\n\t\t}\n\t\tblas64.Trmv(ta, amat, w.mat)\n\tcase RawMatrixer:\n\t\tamat := a.RawMatrix()\n\t\tt := blas.NoTrans\n\t\tif trans {\n\t\t\tt = blas.Trans\n\t\t}\n\t\tblas64.Gemv(t, 1, amat, b.mat, 0, w.mat)\n\tcase Vectorer:\n\t\tif trans {\n\t\t\tcol := make([]float64, ar)\n\t\t\tfor c := 0; c < ac; c++ {\n\t\t\t\tw.mat.Data[c*w.mat.Inc] = blas64.Dot(ar,\n\t\t\t\t\tblas64.Vector{Inc: 1, Data: a.Col(col, c)},\n\t\t\t\t\tb.mat,\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\trow := make([]float64, ac)\n\t\t\tfor r := 0; r < ar; r++ {\n\t\t\t\tw.mat.Data[r*w.mat.Inc] = blas64.Dot(ac,\n\t\t\t\t\tblas64.Vector{Inc: 1, Data: a.Row(row, r)},\n\t\t\t\t\tb.mat,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tif trans {\n\t\t\tcol := make([]float64, ar)\n\t\t\tfor c := 0; c < ac; c++ {\n\t\t\t\tfor i := range col {\n\t\t\t\t\tcol[i] = a.At(i, c)\n\t\t\t\t}\n\t\t\t\tvar f float64\n\t\t\t\tfor i, e := range col {\n\t\t\t\t\tf += e * b.mat.Data[i*b.mat.Inc]\n\t\t\t\t}\n\t\t\t\tw.mat.Data[c*w.mat.Inc] = f\n\t\t\t}\n\t\t} else {\n\t\t\trow := make([]float64, ac)\n\t\t\tfor r := 0; r < ar; r++ {\n\t\t\t\tfor i := range row {\n\t\t\t\t\trow[i] = a.At(r, i)\n\t\t\t\t}\n\t\t\t\tvar f float64\n\t\t\t\tfor i, e := range row {\n\t\t\t\t\tf += e * b.mat.Data[i*b.mat.Inc]\n\t\t\t\t}\n\t\t\t\tw.mat.Data[r*w.mat.Inc] = f\n\t\t\t}\n\t\t}\n\t}\n\t*v = w\n}", "title": "" }, { "docid": "87dac3230bac5c874d398522726f4ca4", "score": "0.5451413", "text": "func Multiply(a, b string) string {\n\t// base case, single digit number\n\tif len(a) < 2 || len(b) < 2 {\n\t\tintA, _ := strconv.Atoi(a)\n\t\tintB, _ := strconv.Atoi(b)\n\t\treturn strconv.Itoa(intA * intB)\n\t}\n\n\tif len(a)%2 == 1 {\n\t\ta = \"0\" + a\n\t}\n\tif len(b)%2 == 1 {\n\t\tb = \"0\" + b\n\t}\n\n\t// added to fix uneven length factors\n\ta, b = addZeroFront(a, b)\n\n\t// split strings at middle index\n\tm := getMiddle(a, b)\n\thigh1, low1 := splitNum(a, m)\n\thigh2, low2 := splitNum(b, m)\n\n\t// recursive calls\n\tz0 := Multiply(low1, low2)\n\tz1 := Multiply(add(low1, high1), add(low2, high2))\n\tz2 := Multiply(high1, high2)\n\n\tt0 := sub(sub(z1, z2), z0)\n\tt1 := add(addZeroEnd(z0, m*2), addZeroEnd(t0, m))\n\tt2 := add(t1, z2)\n\treturn trim(t2)\n}", "title": "" }, { "docid": "c8cb690f441180ac12341497ae4f9922", "score": "0.54160666", "text": "func Mul(f Normal, x float64) Normal {\n\treturn func(z float64) float64 {\n\t\treturn f(z) * x\n\t}\n}", "title": "" }, { "docid": "0125c4e25704a7dfeb04fe6106706408", "score": "0.5410904", "text": "func geScalarMultBase(h *extendedGroupElement, a *[32]byte) {\n\tvar e [64]int8\n\n\tfor i, v := range a {\n\t\te[2*i] = int8(v & 15)\n\t\te[2*i+1] = int8((v >> 4) & 15)\n\t}\n\n\t// each e[i] is between 0 and 15 and e[63] is between 0 and 7.\n\n\tcarry := int8(0)\n\tfor i := 0; i < 63; i++ {\n\t\te[i] += carry\n\t\tcarry = (e[i] + 8) >> 4\n\t\te[i] -= carry << 4\n\t}\n\te[63] += carry\n\t// each e[i] is between -8 and 8.\n\n\th.Zero()\n\tvar t preComputedGroupElement\n\tvar r completedGroupElement\n\tfor i := int32(1); i < 64; i += 2 {\n\t\tselectPreComputed(&t, i/2, int32(e[i]))\n\t\tr.MixedAdd(h, &t)\n\t\tr.ToExtended(h)\n\t}\n\n\tvar s projectiveGroupElement\n\n\th.Double(&r)\n\tr.ToProjective(&s)\n\ts.Double(&r)\n\tr.ToProjective(&s)\n\ts.Double(&r)\n\tr.ToProjective(&s)\n\ts.Double(&r)\n\tr.ToExtended(h)\n\n\tfor i := int32(0); i < 64; i += 2 {\n\t\tselectPreComputed(&t, i/2, int32(e[i]))\n\t\tr.MixedAdd(h, &t)\n\t\tr.ToExtended(h)\n\t}\n}", "title": "" }, { "docid": "a3b4b7e2c15dc6e1c9bbf4bc10cfdb46", "score": "0.54089576", "text": "func multiply(a, b int) int {\n\treturn a * b\n}", "title": "" }, { "docid": "aeb44320d43e0c24a8f552b274fd20c4", "score": "0.5401166", "text": "func Mul(as ...*Exp) *Exp {\n\tvar e *Exp\n\tfor i, a := range as {\n\t\tif i == 0 {\n\t\t\te = Add(a)\n\t\t\tcontinue\n\t\t}\n\t\tf := &Exp{\n\t\t\tterms: make(map[string]term),\n\t\t}\n\t\tfor _, p := range a.terms {\n\t\t\tfor _, q := range e.terms {\n\t\t\t\tx := []factor.Value{factor.R(p.coeff), factor.R(q.coeff)}\n\t\t\t\tn, fs, s := factor.Segment(append(x, append(p.fact, q.fact...)...)...)\n\t\t\t\tf.insert(n, fs, s)\n\t\t\t}\n\t\t}\n\t\te = f\n\t}\n\treturn e\n}", "title": "" }, { "docid": "a90f71f09a6292be9b04d03e9c2e40df", "score": "0.5400936", "text": "func (a Quad) Mul(b Quad) Quad {\n\n\treturn Quad(C.mdq_multiply(C.struct_Quad(a), C.struct_Quad(b)))\n}", "title": "" }, { "docid": "a05aab4edee505974f3afc9773effc28", "score": "0.539393", "text": "func naiveMult(a, b *Matrix) *Matrix {\r\n\tr := a.RowCount()\r\n\tc := b.ColCount()\r\n\tif r != c {\r\n\t\treturn nil\r\n\t}\r\n\r\n\tresult := NewMatrix(r, c)\r\n\tfor i := 0; i < r; i++ {\r\n\t\tfor j := 0; j < c; j++ {\r\n\t\t\tval := dot(a.GetRow(i), b.GetCol(j))\r\n\t\t\tresult.Set(i, j, complex(val, 0))\r\n\t\t}\r\n\t}\r\n\r\n\tfmt.Println(\"new matrix:\", result)\r\n\treturn result\r\n}", "title": "" }, { "docid": "1d77c42092aff6396342ad670cacbbc4", "score": "0.53903687", "text": "func (m *Matrix) Multiply(a, b Matrix) {\n\tC.cairo_matrix_multiply(m.native(), a.native(), b.native())\n}", "title": "" }, { "docid": "136b7bebdcf4672ae43d843b95a1bb34", "score": "0.53832763", "text": "func Multiply(left, right *Equation) *Equation {\n\treturn &Equation{o: mult, left: left, right: right}\n}", "title": "" }, { "docid": "b70909f51597eeb0b6fcc6b135f2f720", "score": "0.537945", "text": "func (v *Vec3) Mult(t float64) *Vec3 {\n\treturn &Vec3{\n\t\tX: v.X * t,\n\t\tY: v.Y * t,\n\t\tZ: v.Z * t,\n\t}\n}", "title": "" }, { "docid": "a5ff0e51d4581234fcdf9f62e741ecb9", "score": "0.53793913", "text": "func (n Number) Mul(m Number) Number {\n\treturn (n * m) / scale\n}", "title": "" }, { "docid": "c8ba23763f05a1905c71fb4cec3df055", "score": "0.5377246", "text": "func (d Decimal) Mul(d1 Decimal) Decimal {\n\treturn (d * d1) / scaleFactor\n}", "title": "" }, { "docid": "d7185e8e0ec70c3479a2e1c1b9a602c9", "score": "0.53675866", "text": "func (sn SassNumber) Multiply(sn2 SassNumber) SassNumber {\n\tsn1Value, sn2Value := getConvertedUnits(sn, sn2)\n\treturn SassNumber{Value: sn1Value * sn2Value, Unit: sn.Unit}\n}", "title": "" }, { "docid": "f850c46212199ada7976376b6f94761d", "score": "0.53648156", "text": "func (m *Matrix) Product(a, b *Matrix) {\n\tar, ac := a.Dims()\n\tbr, bc := b.Dims()\n\n\tif ac != br {\n\t\tpanic(ErrShape)\n\t}\n\n\tfor i := 0; i < ar; i++ {\n\t\tfor j := 0; j < bc; j++ {\n\t\t\tvar sum fixed = 0\n\t\t\tfor k := 0; k < ac; k++ {\n\t\t\t\tsum += MultiplyFixed(a.At(i,k),b.At(k,j))\n\t\t\t}\n\t\t\tm.Set(i, j, sum)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3ac751e6132b56737e536024965445dc", "score": "0.5328838", "text": "func (sys System) MulVecTo(dst []float64, _ bool, x []float64) {\n\tn := len(x)\n\tax := mat.NewVecDense(n, dst)\n\tax.MulVec(sys.A, mat.NewVecDense(n, x))\n}", "title": "" }, { "docid": "c3219bbf8aa47658724e333b6a13f4ca", "score": "0.53221786", "text": "func geScalarMult(h *extendedGroupElement, a *[32]byte,\n\tA *extendedGroupElement) {\n\n\tvar t completedGroupElement\n\tvar u extendedGroupElement\n\tvar r projectiveGroupElement\n\tvar c cachedGroupElement\n\tvar i int\n\n\t// Break the exponent into 4-bit nybbles.\n\tvar e [64]int8\n\tfor i, v := range a {\n\t\te[2*i] = int8(v & 15)\n\t\te[2*i+1] = int8((v >> 4) & 15)\n\t}\n\t// each e[i] is between 0 and 15 and e[63] is between 0 and 7.\n\n\tcarry := int8(0)\n\tfor i := 0; i < 63; i++ {\n\t\te[i] += carry\n\t\tcarry = (e[i] + 8) >> 4\n\t\te[i] -= carry << 4\n\t}\n\te[63] += carry\n\t// each e[i] is between -8 and 8.\n\n\t// compute cached array of multiples of A from 1A through 8A\n\tvar Ai [8]cachedGroupElement // A,1A,2A,3A,4A,5A,6A,7A\n\tA.ToCached(&Ai[0])\n\tfor i := 0; i < 7; i++ {\n\t\tt.Add(A, &Ai[i])\n\t\tt.ToExtended(&u)\n\t\tu.ToCached(&Ai[i+1])\n\t}\n\n\t// special case for exponent nybble i == 63\n\tu.Zero()\n\tselectCached(&c, &Ai, int32(e[63]))\n\tt.Add(&u, &c)\n\n\tfor i = 62; i >= 0; i-- {\n\n\t\t// t <<= 4\n\t\tt.ToProjective(&r)\n\t\tr.Double(&t)\n\t\tt.ToProjective(&r)\n\t\tr.Double(&t)\n\t\tt.ToProjective(&r)\n\t\tr.Double(&t)\n\t\tt.ToProjective(&r)\n\t\tr.Double(&t)\n\n\t\t// Add next nybble\n\t\tt.ToExtended(&u)\n\t\tselectCached(&c, &Ai, int32(e[i]))\n\t\tt.Add(&u, &c)\n\t}\n\n\tt.ToExtended(h)\n}", "title": "" }, { "docid": "8fb53298029090dcaa5fee9f5849c79c", "score": "0.5313516", "text": "func (b *Basis) OperatorMultiplyVector(with Basis) *Basis {\n\treturn godotBasisAsBasis(\n\t\tC.godot_basis_operator_multiply_vector(\n\t\t\tb.basis,\n\t\t\twith.basis,\n\t\t),\n\t)\n}", "title": "" }, { "docid": "f739904536f654ba3e73bd075a5e0a09", "score": "0.53060704", "text": "func (bNum *BigIntNum) Multiply(multiplicand BigIntNum) (product BigIntNum) {\n\n\treturn BigIntMathMultiply{}.MultiplyBigIntNums(bNum.CopyOut(), multiplicand)\n}", "title": "" }, { "docid": "71e27b61842d387b9351b57866f15ab9", "score": "0.5301637", "text": "func (x *Fp) MulUnsafe(a, b *Fp) {\n\t// NOTE: The c function defines the pointer to b as restrict, which means\n\t// that it must not be aliased by x or a. We therefore make a new copy of b\n\t// to ensure that there is no aliasing.\n\tbCopy := *b\n\tC.secp256k1_fe_mul(&x.inner, &a.inner, &bCopy.inner)\n\tx.normalize()\n}", "title": "" }, { "docid": "1c1d0fca9c6ef876d1056fd80703fe21", "score": "0.5297456", "text": "func (s *Secp256k1) ScalarMult(k []byte) (*big.Int, *big.Int, *big.Int) {\n\t// Assign Bx, By, and Bz as the base.\n\tBx := s.Gx\n\tBy := s.Gy\n\tBz := new(big.Int).SetInt64(1)\n\n\t// x, y, z will be used for point doubling.\n\tx := Bx\n\ty := By\n\tz := Bz\n\n\t// Loop over the bytes of the secret k.\n\t// Uses the double and add algorithm.\n\tfor _, byte := range k {\n\t\tfor bitNum := 0; bitNum < 8; bitNum++ {\n\t\t\tx, y, z = s.jacobianDouble(x, y, z)\n\n\t\t\tif byte&0x80 == 0x80 {\n\t\t\t\tx, y, z = s.JacobianAdd(Bx, By, Bz, x, y, z)\n\t\t\t}\n\t\t\t// TODO: (ccdle12) need to look intowhy we need to shift the byte\n\t\t\t// by 1.\n\t\t\t// byte <<= 1\n\t\t}\n\t}\n\n\treturn x, y, z\n}", "title": "" }, { "docid": "bd9f1d84ccb421839f61ee8e39f122f2", "score": "0.5281485", "text": "func (t *Arith2) Mul(ctx context.Context, args example.Args, reply *example.Reply) error {\n\treply.C = args.A * args.B * 20\n\treturn nil\n}", "title": "" }, { "docid": "06dd3bd2185de6b434733216e9444cdd", "score": "0.5278849", "text": "func (a matrix) Multiply(b matrix) (matrix, error) {\n\tif a.lenRow == 0 || a.lenCol == 0 || b.lenRow == 0 || b.lenCol == 0 {\n\t\t// if either arguments are empty matrices.\n\t\treturn MakeZero(0, 0), nil\n\t}\n\tif a.lenCol != b.lenRow {\n\t\t// matrices must be dimensionally compatible\n\t\treturn MakeZero(0, 0), errors.New(\n\t\t\tfmt.Sprintf(\"Two Matrices are incompatible: %d x %d and %d x %d multiplication\",\n\t\t\t\ta.lenRow, a.lenCol, b.lenRow, b.lenCol))\n\t}\n\tresult := MakeZero(a.lenRow, b.lenCol) // creates result matrix with proper dimensions\n\t// matrix multiplcation algorithm\n\tfor row := 0; row < result.lenRow; row++ {\n\t\tfor col := 0; col < result.lenCol; col++ {\n\t\t\tfor i := 0; i < a.lenCol; i++ {\n\t\t\t\tresult.data[row][col] += a.data[row][i] * b.data[i][col] // similar to dot product\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8767c40fa9e165cb9d497686f718b462", "score": "0.5262079", "text": "func (xyz *XYZ) ECmult(r *XYZ, na, ng *Number) {\r\n\tvar na1, naLam, ng1, ng128 Number\r\n\r\n\t// split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit)\r\n\tna.splitExp(&na1, &naLam)\r\n\r\n\t// split ng into ng_1 and ng_128 (where gn = gn_1 + gn_128*2^128, and gn_1 and gn_128 are ~128 bit)\r\n\tng.split(&ng1, &ng128, 128)\r\n\r\n\t// build wnaf representation for na_1, na_lam, ng_1, ng_128\r\n\tvar wnafNa1, wnafNaLam, wnafNg1, wnafNg128 [129]int\r\n\tbitsNa1 := ecmultWnaf(wnafNa1[:], &na1, winA)\r\n\tbitsNaLam := ecmultWnaf(wnafNaLam[:], &naLam, winA)\r\n\tbitsNg1 := ecmultWnaf(wnafNg1[:], &ng1, winG)\r\n\tbitsNg128 := ecmultWnaf(wnafNg128[:], &ng128, winG)\r\n\r\n\t// calculate a_lam = a*lambda\r\n\tvar aLam XYZ\r\n\txyz.mulLambda(&aLam)\r\n\r\n\t// calculate odd multiples of a and a_lam\r\n\tpreA1 := xyz.precomp(winA)\r\n\tpreALam := aLam.precomp(winA)\r\n\r\n\tbits := bitsNa1\r\n\tif bitsNaLam > bits {\r\n\t\tbits = bitsNaLam\r\n\t}\r\n\tif bitsNg1 > bits {\r\n\t\tbits = bitsNg1\r\n\t}\r\n\tif bitsNg128 > bits {\r\n\t\tbits = bitsNg128\r\n\t}\r\n\r\n\tr.Infinity = true\r\n\r\n\tvar tmpj XYZ\r\n\tvar tmpa XY\r\n\tvar n int\r\n\r\n\tfor i := bits - 1; i >= 0; i-- {\r\n\t\tr.Double(r)\r\n\r\n\t\tif i < bitsNa1 {\r\n\t\t\tn = wnafNa1[i]\r\n\t\t\tif n > 0 {\r\n\t\t\t\tr.Add(r, &preA1[((n)-1)/2])\r\n\t\t\t} else if n != 0 {\r\n\t\t\t\tpreA1[(-(n)-1)/2].Neg(&tmpj)\r\n\t\t\t\tr.Add(r, &tmpj)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif i < bitsNaLam {\r\n\t\t\tn = wnafNaLam[i]\r\n\t\t\tif n > 0 {\r\n\t\t\t\tr.Add(r, &preALam[((n)-1)/2])\r\n\t\t\t} else if n != 0 {\r\n\t\t\t\tpreALam[(-(n)-1)/2].Neg(&tmpj)\r\n\t\t\t\tr.Add(r, &tmpj)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif i < bitsNg1 {\r\n\t\t\tn = wnafNg1[i]\r\n\t\t\tif n > 0 {\r\n\t\t\t\tr.AddXY(r, &preG[((n)-1)/2])\r\n\t\t\t} else if n != 0 {\r\n\t\t\t\tpreG[(-(n)-1)/2].Neg(&tmpa)\r\n\t\t\t\tr.AddXY(r, &tmpa)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif i < bitsNg128 {\r\n\t\t\tn = wnafNg128[i]\r\n\t\t\tif n > 0 {\r\n\t\t\t\tr.AddXY(r, &preG128[((n)-1)/2])\r\n\t\t\t} else if n != 0 {\r\n\t\t\t\tpreG128[(-(n)-1)/2].Neg(&tmpa)\r\n\t\t\t\tr.AddXY(r, &tmpa)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "e8182623eeb80375d131b6da6d4f6b58", "score": "0.5259947", "text": "func (d Dense) ArrMul(a, b Dense) {\n\td.checkDim(a)\n\td.checkDim(b)\n\tfor i := 0; i < d.numrow; i++ {\n\t\tdr := d.v[i*d.stride:]\n\t\tar := a.v[i*a.stride:]\n\t\tbr := b.v[i*b.stride:]\n\t\tk, n := 0, d.numcol-1\n\t\tfor k < n {\n\t\t\tdr[k+0] = ar[k+0] * br[k+0]\n\t\t\tdr[k+1] = ar[k+1] * br[k+1]\n\t\t\tk += 2\n\t\t}\n\t\tif k == n {\n\t\t\tdr[k] = ar[k] * br[k]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b0eeaad70c22e98238df71615fb74d43", "score": "0.52567697", "text": "func mulr(a, b, c int, o []int) {\n\to[c] = o[a] * o[b]\n}", "title": "" }, { "docid": "f1dcc8507b944d1e85575ad236263c7f", "score": "0.5249339", "text": "func (v Value) BigMul(v2 Value) Value {\n\tx := new(big.Int).Mul(big.NewInt(int64(v)), big.NewInt(int64(v2)))\n\treturn Value(x.Int64() / DefaultPow)\n}", "title": "" }, { "docid": "5518f4439034ab3720757818ef78519a", "score": "0.52487034", "text": "func (d Distance) Mul(x float64) Distance {\n\treturn d * Distance(x)\n}", "title": "" }, { "docid": "a74741c769f7357685a88822047bfc1b", "score": "0.52477175", "text": "func mult(m1, m2 *Matrix) (r *Matrix) {\n\tif m1.Ncol != m2.Nrow {\n\t\tpanic(fmt.Sprintf(\n\t\t\t\"incompatible: m1.Ncol=%v, m2.Nrow=%v\", m1.Ncol, m2.Nrow))\n\t}\n\tr = NewMatrix(m1.Nrow, m2.Ncol, false)\n\tnr1 := m1.Nrow\n\tnr2 := m2.Nrow\n\tnc2 := m2.Ncol\n\tfor i := 0; i < nr1; i++ {\n\t\tfor k := 0; k < nr2; k++ {\n\t\t\tfor j := 0; j < nc2; j++ {\n\t\t\t\ta := r.Get(i, j)\n\t\t\t\ta += m1.Get(i, k) * m2.Get(k, j)\n\t\t\t\tr.Set(i, j, a)\n\t\t\t}\n\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "132e887d308340091a2d3aeabef33762", "score": "0.52446884", "text": "func (curve *SECCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) {\n\treturn curve.ScalarMult(curve.Gx, curve.Gy, k)\n}", "title": "" }, { "docid": "e88aff4a22f29463b2ea89ff6b84b348", "score": "0.5235252", "text": "func (a Frame) Scale(mult int) Frame {\n\tl := len(a)\n\tf := make(Frame, l)\n\tfor i := 0; i < l; i++ {\n\t\tp := (int(a[i])*mult + 128) / 256\n\t\tif p > 255 {\n\t\t\tp = 255\n\t\t}\n\t\tf[i] = byte(p)\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "5f7e05468dd52d395f3696e02e613048", "score": "0.5234031", "text": "func Mulp(a, b int) int {\n\tr, ok := Mul(a, b)\n\tif !ok {\n\t\tpanic(\"multiplication overflow\")\n\t}\n\treturn r\n}", "title": "" }, { "docid": "179ba18ab5d682a82496fedb6b60594a", "score": "0.52326196", "text": "func (curve *SECCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) {\n\ti := 0\n\tfor i < len(k) && k[i] == 0 {\n\t\ti++\n\t}\n\tif i == len(k) {\n\t\treturn new(big.Int), new(big.Int)\n\t}\n\tmask := byte(0x80)\n\tfor (k[i] & mask) == 0 {\n\t\tmask >>= 1\n\t}\n\tmask >>= 1\n\tBz := new(big.Int).SetInt64(1)\n\tx, y, z := Bx, By, Bz\n\n\tfor ; i < len(k); i++ {\n\t\tfor mask != 0 {\n\t\t\tx, y, z = curve.doubleJacobian(x, y, z)\n\t\t\tif (k[i] & mask) != 0 {\n\t\t\t\tx, y, z = curve.addJacobian(Bx, By, Bz, x, y, z)\n\t\t\t}\n\t\t\tmask >>= 1\n\t\t}\n\t\tmask = 0x80\n\t}\n\treturn curve.affineFromJacobian(x, y, z)\n}", "title": "" }, { "docid": "7a7188cb407a0afdb602fb0c92d230f6", "score": "0.5230247", "text": "func Multiply(factor int64, res v1.ResourceList) v1.ResourceList {\n\tresult := v1.ResourceList{}\n\tfor key, value := range res {\n\t\tscaled := value\n\t\tscaled.Set(factor * scaled.Value())\n\t\tresult[key] = scaled\n\t}\n\treturn result\n}", "title": "" }, { "docid": "38d6a8b524aaca42ab0f52f233471de1", "score": "0.52281845", "text": "func ScalarBaseMult(dst, scalar *[32]byte) {\n\tScalarMult(dst, scalar, &basePoint)\n}", "title": "" }, { "docid": "acf54eebea09e184c120818de687efee", "score": "0.5224607", "text": "func (v *Vector3) Multiply(k float64) *Vector3 {\n\treturn &Vector3{v.X * k, v.Y * k, v.Z * k}\n}", "title": "" } ]
813a325a1d6bed043df1bda1a4ba83aa
writeErrRes Heper function to construct a HTTP error response
[ { "docid": "c42b681b426d742fc0ec5d62cfe15994", "score": "0.7615845", "text": "func (h *Handler) writeErrRes(w http.ResponseWriter, err error) {\n\tjsonErrRes, _ := json.Marshal(ErrRes{err.Error()})\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusInternalServerError)\n\tw.Write(jsonErrRes)\n}", "title": "" } ]
[ { "docid": "9522fd189c8665dbf68ba1415e7af18a", "score": "0.74986494", "text": "func WriteErr(w http.ResponseWriter, r *http.Request, err error, opts ...int /*[status[, silent]]*/) {\n\tif herr, allocated := err2HTTP(err); herr != nil {\n\t\therr.Status = http.StatusBadRequest\n\t\tif len(opts) > 0 && opts[0] > http.StatusBadRequest {\n\t\t\therr.Status = opts[0]\n\t\t}\n\t\therr.write(w, r, len(opts) > 1 /*silent*/)\n\t\tif allocated {\n\t\t\tFreeHterr(herr)\n\t\t}\n\t\treturn\n\t}\n\tvar (\n\t\therr = allocHterr()\n\t\tl = len(opts)\n\t\tstatus = http.StatusBadRequest\n\t)\n\n\t// assign status (in order of priority)\n\tif cos.IsErrNotFound(err) {\n\t\tstatus = http.StatusNotFound\n\t} else if l > 0 {\n\t\tstatus = opts[0]\n\t} else if errf, ok := err.(*ErrFailedTo); ok {\n\t\tstatus = errf.status\n\t} else if isErrNotFoundExtended(err) {\n\t\tstatus = http.StatusNotFound\n\t}\n\n\therr.init(r, err, status)\n\therr.write(w, r, l > 1)\n\tFreeHterr(herr)\n}", "title": "" }, { "docid": "e625efae28e6dddd26ba3125ea9b1e45", "score": "0.7417881", "text": "func writeErrorResponse(w http.ResponseWriter, errorCode int, errorMsg string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(errorCode)\n\tjson.\n\t\tNewEncoder(w).\n\t\tEncode(&JsonErrorResponse{Error: &ApiError{Status: errorCode, Title: errorMsg}})\n}", "title": "" }, { "docid": "bdfe154648827f4fb70fb06345662f2f", "score": "0.74133646", "text": "func writeErrorResponse(statusCode int, message string, w http.ResponseWriter) {\n\n\tw.WriteHeader(statusCode)\n\n\terrorObject := Error{\n\t\tMessage: message,\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(errorObject)\n}", "title": "" }, { "docid": "34711e8c6d745bf6853dd40ca96f8ad3", "score": "0.74054486", "text": "func writeError(w http.ResponseWriter, err errorResponse) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(err.Code)\n\tfmt.Fprint(w, err)\n}", "title": "" }, { "docid": "7166afcb839a1513e43e93082ea34f43", "score": "0.7374431", "text": "func WriteErrResponse(context *restful.Context, status int, msg, contentType string) {\n\tcontext.WriteHeader(status)\n\tb, _ := json.MarshalIndent(&ErrorMsg{Msg: msg}, \"\", \" \")\n\tcontext.ReadRestfulResponse().AddHeader(goRestful.HEADER_ContentType, contentType)\n\tcontext.Write(b)\n\n}", "title": "" }, { "docid": "ab6b1ed70bdb33e1d6b25c163abf01ce", "score": "0.7335188", "text": "func writeErrorResponse(w http.ResponseWriter, errorCode int, errorMsg string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(errorCode)\n\tjson.\n\t\tNewEncoder(w).\n\t\tEncode(&models.JsonErrorResponse{Error: &models.ApiError{Status: errorCode, Title: errorMsg}})\n\tfmt.Fprintf(w, \"false\")\n}", "title": "" }, { "docid": "0d39f27edb33935768fd1ddb6724e34b", "score": "0.7297567", "text": "func Error(res rest.ResponseWriter, code int, err string) {\n\tres.WriteHeader(code)\n\tres.WriteJson(ErrResp{Ok: false, ErroredAt: time.Now(), Error: err})\n\tlogger.Println(err)\n}", "title": "" }, { "docid": "e0998bc3851280188372375f61a25182", "score": "0.7275675", "text": "func HTTPErrf(resp http.ResponseWriter, statusCode int, message string, rest ...interface{}) {\n\tresp.WriteHeader(statusCode)\n\tresp.Header().Set(\"Content-Type\", \"text/plain; charset=UTF-8\")\n\tlog.Errf(message, rest...)\n\t_, _ = resp.Write([]byte(fmt.Sprintf(message, rest...)))\n}", "title": "" }, { "docid": "1a22a8c3859b56e84df771e7cdc98bd3", "score": "0.72364885", "text": "func handleError(err error, errorMsg string, w http.ResponseWriter) {\n //print the error msg and write the error msg to the client\n //log.Fatal(err)\n fmt.Println(errorMsg)\n w.Header()[\"Content-Type\"] = []string{\"text/html\"}\n w.WriteHeader(http.StatusBadRequest) \n w.Write([]byte(fmt.Sprintf(errorMsg))) \n}", "title": "" }, { "docid": "ff02609d55b640bb89daf4832d13d10d", "score": "0.7175161", "text": "func (r *Response) error(w http.ResponseWriter, httpStatus, code int, message string) {\n\tr.Error = &htp.Error{\n\t\tCode: code,\n\t\tMessage: message,\n\t}\n\tr.write(w, httpStatus)\n}", "title": "" }, { "docid": "1c1ff2de82ae8d503d654c037313be00", "score": "0.715631", "text": "func errorResponse(w http.ResponseWriter, status int, err error) {\n\tw.WriteHeader(status)\n\tw.Write([]byte(err.Error()))\n}", "title": "" }, { "docid": "69b3cb94d9678d2ca941d388286a99f0", "score": "0.71217847", "text": "func (r errorResponse) Write(w http.ResponseWriter) {\n\tlog.Printf(\"ERROR: %s\\n\", r.Error)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(r.Code)\n\tfmt.Fprint(w, r)\n}", "title": "" }, { "docid": "ddd6b902906fb3f49bffa1233d758550", "score": "0.70867616", "text": "func err(w http.ResponseWriter, n int) {\n\te := map[int]string{\n\t\t400: \"400: Bad Request\",\n\t\t404: \"404: Not Found\",\n\t\t500: \"500: Internal Server Error\",\n\t}\n\tw.WriteHeader(n)\n\tw.Write([]byte(e[n]))\n}", "title": "" }, { "docid": "69158dcedd5b2a25d91d0dc88f743b47", "score": "0.70654786", "text": "func writeError(w http.ResponseWriter, err *ctrlError) {\n\twriteJsonResponse(w, ErrorBody{Msg:err.errorMsg}, err.httpCode)\n}", "title": "" }, { "docid": "515a510a9657120469bb6b6fd53ec252", "score": "0.70606375", "text": "func (service *Service) writeErrorResponse(w http.ResponseWriter, result string, code int) {\n\tresponse := &ErrorResponse{result}\n\tdata, err := json.Marshal(response)\n\n\tif err != nil {\n\t\tif service.logger != nil {\n\t\t\tservice.logger.Errorf(\"Service.writeErrorResponse, marshal response error %s\", err)\n\t\t}\n\t\tw.WriteHeader(500)\n\t\t_, writeErr := w.Write([]byte(\"Server error\"))\n\t\tif writeErr != nil && service.logger != nil {\n\t\t\tservice.logger.Errorf(\"Service.writeErrorResponse, write `Server error` error %s\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tw.WriteHeader(code)\n\t_, writeErr := w.Write(data)\n\tif writeErr != nil && service.logger != nil {\n\t\tservice.logger.Errorf(\"Service.writeErrorResponse, write `OkResponse` error %s\", err)\n\t}\n}", "title": "" }, { "docid": "1e5f84c7125f0acf543596dc6579e704", "score": "0.69961864", "text": "func (e *Err) Write(w http.ResponseWriter, r *http.Request) {\n\tcode := e.ErrCode\n\ttxt, ok := errorCodes[code]\n\tif !ok {\n\t\tcode = 500\n\t\ttxt = errorCodes[code]\n\t}\n\thttp.Error(w, fmt.Sprintf(\"%v: %v\", txt, e.UserMsg), code)\n\tlog.Printf(\"[ERROR] %v %v %v %v %v %v %v\", txt, code, e.StdError, e.UserMsg, r.RemoteAddr, r.Method, r.URL)\n}", "title": "" }, { "docid": "2458db5e0e7868598d24e38362c1ad2b", "score": "0.6979991", "text": "func Error(w http.ResponseWriter, err error, statusCode int) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\t_ = json.NewEncoder(w).Encode(errorResponse{Error: err.Error()})\n}", "title": "" }, { "docid": "61a430b78a0bfb978cbca2aaf816e910", "score": "0.6973515", "text": "func printError(err error, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tret := responses.SingleResponse{}\n\n\tswitch err.Error() {\n\tcase \"400\":\n\t\tret.Meta.StatusCode = http.StatusBadRequest\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"Bad Request\",\n\t\t}\n\t\tbreak\n\tcase \"400-Token-Parse\":\n\t\tret.Meta.StatusCode = http.StatusBadRequest\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"Cannot Read JWT Payload\",\n\t\t}\n\t\tbreak\n\tcase \"400-Signature\":\n\t\tret.Meta.StatusCode = http.StatusBadRequest\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"Invalid JWT Signature\",\n\t\t}\n\t\tbreak\n\tcase \"401-Expired\":\n\t\tret.Meta.StatusCode = http.StatusBadRequest\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"Invalid JWT Signature\",\n\t\t}\n\t\tbreak\n\tcase \"401\":\n\t\tret.Meta.StatusCode = http.StatusUnauthorized\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"JWT Token Is Required\",\n\t\t}\n\t\tbreak\n\tcase \"404\":\n\t\tret.Meta.StatusCode = http.StatusNotFound\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"Page Not Found\",\n\t\t}\n\t\tbreak\n\tcase \"405\":\n\t\tret.Meta.StatusCode = http.StatusMethodNotAllowed\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": \"Method Not Allowed\",\n\t\t}\n\t\tbreak\n\tcase \"500\":\n\t\tret.Meta.StatusCode = http.StatusInternalServerError\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": err.Error(),\n\t\t}\n\t\tbreak\n\tdefault:\n\t\tret.Meta.StatusCode = http.StatusBadRequest\n\t\tret.Meta.Message = M{\n\t\t\t\"errors\": err.Error(),\n\t\t}\n\t\tbreak\n\t}\n\n\tw.WriteHeader(ret.Meta.StatusCode)\n\tjson.NewEncoder(w).Encode(ret)\n\n\treturn\n}", "title": "" }, { "docid": "8b20d488bd620bd7008cbd46331644a2", "score": "0.69694096", "text": "func respondErr(w http.ResponseWriter, errCode int, errMsg string) {\n\tlog.Printf(\"ERROR\\t%d\\t%s\", errCode, errMsg)\n\tw.WriteHeader(errCode)\n\trt := APIErrorRoot{}\n\tbd := APIErrorBody{}\n\tem := APIError{}\n\tem.Message = errMsg\n\tem.Domain = \"global\"\n\tem.Reason = \"backend\"\n\tbd.Code = errCode\n\tbd.Message = errMsg\n\tbd.ErrList = append(bd.ErrList, em)\n\tbd.Status = \"INTERNAL\"\n\trt.Body = bd\n\t// Output API Erorr object to JSON\n\toutput, _ := json.MarshalIndent(rt, \"\", \" \")\n\tw.Write(output)\n}", "title": "" }, { "docid": "cf328cf5a47011011f3a0b726f696ebf", "score": "0.6954773", "text": "func errRespons(w http.ResponseWriter, code int, err error) {\n\tlog.Println(err)\n\tw.WriteHeader(code)\n\t_, err = w.Write([]byte(err.Error()))\n\tif err != nil {\n\t\tlog.Panic(errors.Wrap(err, \"could not write bytes\"))\n\t}\n}", "title": "" }, { "docid": "7d2fe5219f31636e3f1659533eb1086b", "score": "0.69518673", "text": "func WriteErrorResponse(w http.ResponseWriter, errorCode int, errorMsg string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(errorCode)\n\tjson.\n\t\tNewEncoder(w).Encode(&jsonErrorResponse{Success: false, Status: errorCode, Error: errorMsg})\n}", "title": "" }, { "docid": "7d2fe5219f31636e3f1659533eb1086b", "score": "0.69518673", "text": "func WriteErrorResponse(w http.ResponseWriter, errorCode int, errorMsg string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(errorCode)\n\tjson.\n\t\tNewEncoder(w).Encode(&jsonErrorResponse{Success: false, Status: errorCode, Error: errorMsg})\n}", "title": "" }, { "docid": "74e9587060e2ca6ecc4cc701083c983c", "score": "0.68804187", "text": "func (r codecRequest) WriteError(w http.ResponseWriter, status int, err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\trep := reply{\n\t\tCode: status,\n\t\tMsg: err.Error(),\n\t}\n\n\tswitch e := err.(type) {\n\tcase *Error:\n\t\trep.Code = e.Code\n\tcase *ErrorWithData:\n\t\trep.Code = e.Code\n\t\trep.Data = e.Data\n\t}\n\n\tw.WriteHeader(rep.Code)\n\tenc := json.NewEncoder(w)\n\tenc.Encode(&rep)\n}", "title": "" }, { "docid": "8c25846298e481e7b48d084c94259115", "score": "0.68795854", "text": "func (e *MyError) WriteToResponse(w http.ResponseWriter) {\n w.WriteHeader(e.HTTPStatus)\n fmt.Fprintf(w, e.ToJSON())\n}", "title": "" }, { "docid": "0c2c71b8b663cf49864b733dd72d991f", "score": "0.68609256", "text": "func sendErrorPage(conn net.Conn, rw *bufio.ReadWriter, request string, code int, body []byte) {\n rw.Write(prepHeaders(conn, request, code))\n if body == nil {\n body = prepErrorPage(code)\n }\n rw.Write(body)\n rw.Flush()\n conn.Close()\n}", "title": "" }, { "docid": "a5f2b4fbb7a4f40a39555b328d2f288b", "score": "0.6850975", "text": "func (router Router) errorResponse(w http.ResponseWriter, httpStatusCode int, errorCode int, errorMsg string) {\n\terrorBody := types.ErrorResponseBody{HTTPStatusCode: httpStatusCode, ErrorCode: errorCode, ErrorMsg: errorMsg}\n\tres, err := json.Marshal(types.ErrorResponse{Error: errorBody})\n\tif err != nil {\n\t\tw.Write([]byte(\"BACKEND ERROR\"))\n\t\treturn\n\t}\n\tw.WriteHeader(httpStatusCode)\n\tw.Write(res)\n}", "title": "" }, { "docid": "d198fb163538a6850b92b3461bc03503", "score": "0.68091804", "text": "func errorResponse(w http.ResponseWriter, msg string, err error, statusCode int) {\n\tresponse := &Response{\n\t\tMessage: msg,\n\t\tStatusCode: statusCode}\n\tif err != nil {\n\t\tresponse.Error = err.Error()\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "e2fe049421c85642723d967b450fb3df", "score": "0.67948157", "text": "func http500res(c *router.Context, e error, msg string, args ...interface{}) {\n\targs = append(args, e)\n\tbody := fmt.Sprintf(msg, args...)\n\tlogging.Errorf(c.Context, \"HTTP %d: %s\", 500, body)\n\thttp.Error(c.Writer, body, 500)\n}", "title": "" }, { "docid": "1d7ab7464e71d6b81ec5bb8a25ab6dd0", "score": "0.678573", "text": "func error(w http.ResponseWriter, r *http.Request) {\n\tfmt.Printf(\"\\nReceived request from %v. Connection type: %v\\n\", r.Host, r.Proto)\n\tr.ParseForm()\n\trCode := r.Form.Get(\"rCode\")\n\tn, err := strconv.Atoi(rCode)\n\tif err != nil {\n\t\tfmt.Printf(\"Error getting rCode %s: %s \\n\", rCode, err.Error())\n\t\tfmt.Fprintf(w, \"bad rCode: %s \\n\", err.Error())\n\t\treturn\n\t}\n\t// return response with respones code\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(n)\n\tjson.NewEncoder(w).Encode(errorResponse{\"example-error\", n})\n\n}", "title": "" }, { "docid": "e4531df317b2c795ed79d16148d5f1cf", "score": "0.6773962", "text": "func ERROR(w http.ResponseWriter, r *http.Request, httpStatus int, err error) {\n\tw.WriteHeader(httpStatus)\n\tjson.NewEncoder(w).Encode(Response{\n\t\tHttpMethod: r.Method,\n\t\tHttpStatus: httpStatus,\n\t\tMessage: err.Error(),\n\t\tErrorMessage: \"ERROR\",\n\t\tData: nil,\n\t})\n}", "title": "" }, { "docid": "3a7487b3e60aa3547cbe2199a2ae56af", "score": "0.67717564", "text": "func generateErrorResponse(resp *http.Response, APIErr APIError, bucketName string) *http.Response {\n\t// generate error response.\n\terrorResponse := getAPIErrorResponse(APIErr, bucketName)\n\tencodedErrorResponse := encodeResponse(errorResponse)\n\t// write Header.\n\tresp.StatusCode = APIErr.HTTPStatusCode\n\tresp.Body = io.NopCloser(bytes.NewBuffer(encodedErrorResponse))\n\n\treturn resp\n}", "title": "" }, { "docid": "944568bed2694ec8ad95bdf35ffd2e10", "score": "0.6753489", "text": "func eresp(w http.ResponseWriter, err string, code int) {\n\thttp.Error(w, fmt.Sprintf(\"{\\\"error\\\": \\\"%s\\\"}\", err), code)\n}", "title": "" }, { "docid": "f7767fd42cd1881706a698eae2dd41b6", "score": "0.6753367", "text": "func respondWithError(msg string, err error, w http.ResponseWriter, status int) {\n\terrMsg := reqres.ErrorResponse{Message: msg + \": \" + err.Error()}\n\n\tjs, err := json.Marshal(errMsg)\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(status)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tw.Write(js)\n}", "title": "" }, { "docid": "955f67908b556675f9d7b3da5b9abbf7", "score": "0.6729055", "text": "func retError(w http.ResponseWriter, err error) {\n\tapiReturn := &ApiReturn{\n\t\tStatus: \"FAIL\",\n\t\tMessage: err.Error(),\n\t}\n\tret, _ := json.Marshal(apiReturn)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(ret)\n}", "title": "" }, { "docid": "a0c5b97f22a6ce1d6157422b654fa169", "score": "0.6724103", "text": "func WriteErrMsg(w http.ResponseWriter, r *http.Request, msg string, opts ...int) {\n\tvar errCode int\n\tif len(opts) > 0 {\n\t\terrCode = opts[0]\n\t}\n\therr := InitErrHTTP(r, errors.New(msg), errCode)\n\therr.write(w, r, len(opts) > 1 /*silent*/)\n\tFreeHterr(herr)\n}", "title": "" }, { "docid": "d390f258b6e5bfd686d2fb8fed44b9bf", "score": "0.6689266", "text": "func (deploy AutoDeploy) errorResponse(w http.ResponseWriter, httpStatusCode int, errorCode int, errorMsg string) {\n\terrorBody := types.ErrorResponseBody{HTTPStatusCode: httpStatusCode, ErrorCode: errorCode, ErrorMsg: errorMsg}\n\tres, err := json.Marshal(types.ErrorResponse{Error: errorBody})\n\tif err != nil {\n\t\tw.Write([]byte(\"BACKEND ERROR\"))\n\t\treturn\n\t}\n\tw.WriteHeader(httpStatusCode)\n\tw.Write(res)\n}", "title": "" }, { "docid": "9fd8fba589ae8748db650a16755638a6", "score": "0.6684182", "text": "func error_(w http.ResponseWriter, out []byte, err error) {\n\tw.WriteHeader(404)\n\tif out != nil {\n\t\tw.Write(out)\n\t} else {\n\t\tw.Write([]byte(err.Error()))\n\t}\n}", "title": "" }, { "docid": "6a5047aff7827b7565c23cc204045c14", "score": "0.6666941", "text": "func sendErrorResponse(rw http.ResponseWriter, err error, code int) {\n\t//\tOur return value\n\tresponse := ErrorResponse{\n\t\tMessage: \"Error: \" + err.Error()}\n\n\t//\tSerialize to JSON & return the response:\n\trw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\trw.WriteHeader(code)\n\tjson.NewEncoder(rw).Encode(response)\n}", "title": "" }, { "docid": "24c66ab3acf22ae721b96b6027be02e4", "score": "0.66606563", "text": "func HTTPErr(ctx context.Context, w http.ResponseWriter, err error) {\n\tlog.From(ctx).Error(\"handling request\", zap.Error(err))\n\thttp.Error(w, fmt.Sprintf(`{\"error\": \"%s\"}`, err), http.StatusInternalServerError)\n}", "title": "" }, { "docid": "2c48a93e656fb5fd9f955be498f09ed3", "score": "0.66422695", "text": "func (s *server) error(w http.ResponseWriter, r *http.Request, code int, err error) {\n\ts.respond(w, r, code, map[string]string{\"error\": err.Error()})\n}", "title": "" }, { "docid": "4b810072c311db3c53f7ae056cdb8782", "score": "0.66286755", "text": "func writeError(w http.ResponseWriter, message string) {\n\n\t//WriteError is called from recovery, so it must be panic proof\n\tdefer func() {\n\t\te := recover()\n\t\tif e != nil {\n\t\t\tlogging.Error(\"Could not write error response! %s\", e)\n\t\t}\n\t}()\n\n\thttp.Error(w, message, http.StatusInternalServerError)\n\n}", "title": "" }, { "docid": "cd73bb2d42e2204e9e4d7a3c2a8ee5f2", "score": "0.6624997", "text": "func sendErrorResponse(rw http.ResponseWriter, err error, code int) {\n\t//\tOur return value\n\tresponse := ErrorResponse{\n\t\tStatus: code,\n\t\tMessage: \"Error: \" + err.Error()}\n\n\t//\tSerialize to JSON & return the response:\n\trw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\trw.WriteHeader(code)\n\tjson.NewEncoder(rw).Encode(response)\n}", "title": "" }, { "docid": "22627693c1a424e7a8b63dd0eaa55678", "score": "0.6614903", "text": "func ErrResponse(w http.ResponseWriter, code int, errMsg ...string) {\n\tif len(errMsg) > 0 {\n\t\thttp.Error(w, strings.Join(errMsg, \" \"), code)\n\t} else {\n\t\thttp.Error(w, http.StatusText(code), code)\n\t}\n}", "title": "" }, { "docid": "67f634aae1251c6cc719e7f11891007d", "score": "0.6598533", "text": "func writeJsonERR(w http.ResponseWriter, Header int, message string) {\n\tw.WriteHeader(Header)\n\terrObj := &struct {\n\t\tError string\n\t}{\n\t\tmessage,\n\t}\n\tdata, err := json.Marshal(errObj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.Write(data)\n}", "title": "" }, { "docid": "a82ded7b26cf03cb35c5ad8fad622db0", "score": "0.6595061", "text": "func WriteError(w http.ResponseWriter, status int, errorText string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(status)\n\n\tjsonErr := struct {\n\t\tCode int\n\t\tText string\n\t}{\n\t\tstatus,\n\t\terrorText,\n\t}\n\n\tif err := json.NewEncoder(w).Encode(jsonErr); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "96f1d9ba2f2b7286deda5291fc761790", "score": "0.65315133", "text": "func jsonError(res http.ResponseWriter, err *detailedError, startedAt time.Time) {\n\n\terr.Id = uuid.NewV4().String()\n\n\tlog.Println(QUERY_API_PREFIX, fmt.Sprintf(\"[%s][%s] failed after [%.5f]secs with error [%s][%s] \", err.Id, err.Code, time.Now().Sub(startedAt).Seconds(), err.Message, err.InternalMessage))\n\n\tjsonErr, _ := json.Marshal(err)\n\n\tres.WriteHeader(err.Status)\n\tres.Header().Add(\"content-type\", \"application/json\")\n\tres.Write(jsonErr)\n\treturn\n}", "title": "" }, { "docid": "a60eda1b7a5441dc9d9b71afca7c822b", "score": "0.65304345", "text": "func restErrWithLogMsg(w rest.ResponseWriter, r *rest.Request, l *log.Logger, e error, code int, msg string) {\n\tw.WriteHeader(code)\n\terr := w.WriteJson(map[string]string{\n\t\trest.ErrorFieldName: msg,\n\t\t\"request_id\": requestid.GetReqId(r),\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.F(log.Ctx{}).Error(errors.Wrap(e, msg).Error())\n}", "title": "" }, { "docid": "cda750d9b4dc2125bf53f95cdd694c10", "score": "0.6515411", "text": "func httpFailure(w http.ResponseWriter, r *http.Request, err error) {\n\twarning.Println(\"httpFailure:\", err.Error())\n\tw.WriteHeader(http.StatusInternalServerError)\n\tj, err := json.Marshal(apiResponse{\n\t\tResponseCode: 0,\n\t\tFailure: err.Error(),\n\t})\n\n\tif err != nil {\n\t\terr500(w, r, err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(j)\n}", "title": "" }, { "docid": "23a42ab6d3b996b595c870a5510dda1c", "score": "0.6493346", "text": "func FailResponse(writer http.ResponseWriter) {\n\twriter.WriteHeader(http.StatusInternalServerError)\n\twriter.Write([]byte(\"error\"))\n\tlog.Printf(\"Failed request\")\n}", "title": "" }, { "docid": "812a1fc31dd946c1f2a0dd248d3b8793", "score": "0.6467269", "text": "func (err *HTTPError) WriteResponse(rw http.ResponseWriter) {\n\tresp := ErrorResponse{code: err.code, Error: err.parent.Error()}\n\tresp.Write(rw)\n}", "title": "" }, { "docid": "ba262ef0468f4b353c1bffb3bc6b57e5", "score": "0.64637023", "text": "func writeErr(conn net.Conn, code int, err error) {\n\tconn.Write([]byte(fmt.Sprintf(\"[%d] %s\\n\", code, err.Error())))\n}", "title": "" }, { "docid": "9d6a4cc49a341207d0928f9a243aa7d8", "score": "0.6453154", "text": "func respondErr(w http.ResponseWriter, r *http.Request, status int, args ...interface{}) {\n\trespond(w, r, status, map[string]interface{}{\n\t\t\"error\": map[string]interface{}{\n\t\t\t\"message\": fmt.Sprint(args...),\n\t\t},\n\t})\n}", "title": "" }, { "docid": "48d387bc8945a87902784d9f778177bc", "score": "0.6448884", "text": "func printRespErr(err error, t string, dat []byte) {\n\tif err != nil {\n\t\tlog.Println(t, \"=\", string(dat))\n\t\tlog.Println(\"err=\", err)\n\t}\n}", "title": "" }, { "docid": "48f4ab80600e2e522e3cb83c7e8c81a4", "score": "0.64318234", "text": "func (p Proxy) createErrorResponse(code int, message string) *bytes.Buffer {\n\tr := &http.Response{\n\t\tStatus: fmt.Sprintf(\"%d %s\", code, http.StatusText(code)),\n\t\tStatusCode: code,\n\t\tProto: \"HTTP/1.1\",\n\t\tProtoMajor: 1,\n\t\tProtoMinor: 1,\n\t\tBody: ioutil.NopCloser(bytes.NewBufferString(message)),\n\t\tContentLength: int64(len(message)),\n\t\tRequest: nil,\n\t\tHeader: make(http.Header, 0),\n\t}\n\tvar buf bytes.Buffer\n\tr.Write(&buf)\n\treturn &buf\n}", "title": "" }, { "docid": "30b3a74431a18171cb654b724c028293", "score": "0.6415244", "text": "func errResponse(err error) *plugin.CodeGeneratorResponse {\n\terrString := err.Error()\n\treturn &plugin.CodeGeneratorResponse{Error: &errString}\n}", "title": "" }, { "docid": "f9f5737f3d33b14893904de2f159cdc6", "score": "0.64013016", "text": "func errorResponse(err error) gin.H {\n\treturn gin.H{\"error\": err.Error()}\n}", "title": "" }, { "docid": "170a58c837083c45664dc4af9a33bfc1", "score": "0.63871634", "text": "func Error(w http.ResponseWriter, e error, msg string) {\n\tif e != nil {\n\t\tlog.Println(\"%v\", e)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(500)\n\tif e := FlushJson(w, Reply(false, msg)); e != nil {\n\t\tpanic(e)\n\t}\n}", "title": "" }, { "docid": "45c7c52d027aba300be9f1f70f554f0a", "score": "0.63753194", "text": "func RenderErrJson(w http.ResponseWriter, err error) {\n\t// log\n\tlog.Error(err)\n\n\t// http response\n\trdata, _ := json.Marshal(Response{\n\t\tMsg: \"internal error\",\n\t\tOk: false,\n\t})\n\n\tw.WriteHeader(500)\n\tw.Write(rdata)\n\treturn\n}", "title": "" }, { "docid": "7e7b8fe3cfb95b79f7ab3cc2b72d17e3", "score": "0.63734347", "text": "func (ew *htmlErrorWriter) WriteError(\n\trw http.ResponseWriter,\n\tcode int,\n\tmessage string,\n\tlogger logger.Logger,\n) {\n\tbody := fmt.Sprintf(\"%d %s: %s\", code, http.StatusText(code), message)\n\n\tif code != http.StatusNotFound {\n\t\tlogger.Info(\"status\", zap.String(\"body\", body))\n\t}\n\n\tif code > 299 {\n\t\trw.Header().Del(\"Connection\")\n\t}\n\n\ttplContext := htmlErrorWriterContext{\n\t\tStatus: code,\n\t\tStatusText: http.StatusText(code),\n\t\tMessage: message,\n\t\tHeader: rw.Header(),\n\t}\n\trw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\n\tvar respBytes []byte\n\tvar rendered bytes.Buffer\n\tif err := ew.tpl.Execute(&rendered, &tplContext); err != nil {\n\t\tlogger.Error(\"render-error-failed\", zap.Error(err))\n\t\trw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t\trw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\trespBytes = []byte(body)\n\t} else {\n\t\trw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\trw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\trespBytes = rendered.Bytes()\n\t}\n\n\trw.WriteHeader(code)\n\trw.Write(respBytes)\n}", "title": "" }, { "docid": "57ecad9df6c9a47d544d0a09f218f335", "score": "0.63708085", "text": "func Return210ErrorResponse(w http.ResponseWriter){\n\tvar resp ResposneStruct\n\tresp.Status = 210\n\tresp.Message = \"Error in marshalling the response from DB, contact admin\"\n\tw.WriteHeader(210)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tresponse, _ := json.Marshal(resp)\n\tw.Write(response)\n}", "title": "" }, { "docid": "2b66f93b8138de698ed5b71224c339fa", "score": "0.63610977", "text": "func returnErrorResponse(response http.ResponseWriter, request *http.Request) {\n\tjsonResponse, err := json.Marshal(\"It's not you it's me.\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\tresponse.WriteHeader(http.StatusInternalServerError)\n\tresponse.Write(jsonResponse)\n}", "title": "" }, { "docid": "1b7d29334d4256d47cff7d5a9107d4df", "score": "0.6356517", "text": "func ErrorResponse(w http.ResponseWriter, errorCode int, errorMsg string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(errorCode)\n\tjson.NewEncoder(w).Encode(&JsonResponse{Code: errorCode, Desc: errorMsg, Data: \"\"})\n}", "title": "" }, { "docid": "6550cb5790ac7a4a3e3e63f980f7808f", "score": "0.6343203", "text": "func sendServerError(w http.ResponseWriter, errorMessage string){\n\tw.WriteHeader(http.StatusInternalServerError)\n\tjs, err := json.Marshal(&ErrorResponse{errorMessage})\n\tif err != nil {\n\t\tlog.Printf(\"JSON Error while build error response: %s\\n\", err.Error())\n\t\tw.Write([]byte(\"{\\\"errorMessage\\\": \\\"Unknown server error occurred.\\\"}\"))\n\t\treturn\n\t}\n\tw.Write(js)\n}", "title": "" }, { "docid": "734a665ba68e7eafadd91d855f23f1fc", "score": "0.6342607", "text": "func (h *Handler) error(w http.ResponseWriter, error string, code int) {\n\t// TODO: Return error as JSON.\n\thttp.Error(w, error, code)\n}", "title": "" }, { "docid": "91b6974605245e3efce475a9a6ccf92e", "score": "0.6335562", "text": "func PrintErr(w http.ResponseWriter, err string) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(fmt.Sprintf(`{\"code\": 400, \"msg\": \"%s\"}`, err)))\n}", "title": "" }, { "docid": "02572036f2d0a08eccb5fd2d040b8e7c", "score": "0.63186795", "text": "func ERROR(writer http.ResponseWriter, statusCode int, err error) {\n\tif err != nil {\n\t\tJSON(writer, statusCode, struct {\n\t\t\tError string `json:\"error\"`\n\t\t}{\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tJSON(writer, statusCode, nil)\n}", "title": "" }, { "docid": "b88613289e36127ee0c695fcf30038aa", "score": "0.63044393", "text": "func (c *ContextImpl) httpResponseErr(err error) {\n\tif c.c == nil {\n\t\tpanic(\"gin context not set , please if the func is used in http request handle\")\n\t}\n\tif c.status == 0 {\n\t\t// default status 400\n\t\tc.status = 400\n\t}\n\terr = util.HTTPErrEncoder(err)\n\tif err != nil {\n\t\tif c.app.Conf().GetAtomicRequest() {\n\t\t\tc.SafeRollback()\n\t\t}\n\t\t_, resErr := util.HTTPErrDecoder(err)\n\t\tc.c.Error(fmt.Errorf(\"%v\", err))\n\t\tc.c.Error(fmt.Errorf(\"%v\", string(debug.Stack())))\n\n\t\tif c.app.ResponseFactory() != nil {\n\t\t\tc.c.JSON(c.status, c.app.ResponseFactory()(c.status, resErr, c.runtime))\n\t\t} else {\n\t\t\tif resErr != nil {\n\t\t\t\tc.c.AbortWithStatusJSON(c.status, resErr)\n\t\t\t} else {\n\t\t\t\tc.c.AbortWithStatus(c.status)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "ca0df49b8aa7006ca0756b5fbf025291", "score": "0.63041514", "text": "func writeBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(http.StatusText(http.StatusBadRequest)))\n}", "title": "" }, { "docid": "64476b6fd4379eed18ee8a0b3f2130a9", "score": "0.6295075", "text": "func errorResponse(msg string) ([]byte, error) {\r\n\tr := &responsePayload{errorMsg: msg}\r\n\treturn encodeResponse(r)\r\n}", "title": "" }, { "docid": "304b29af7c15c62466fff59e488462e6", "score": "0.6286265", "text": "func Failed(w http.ResponseWriter, err error, opts ...Option) {\n\tvar (\n\t\terrCode int\n\t\thttpCode int\n\t\tns string\n\t\treason string\n\t\tdata interface{}\n\t\tmeta interface{}\n\t)\n\n\tswitch t := err.(type) {\n\tcase exception.APIException:\n\t\terrCode = t.ErrorCode()\n\t\treason = t.GetReason()\n\t\tdata = t.GetData()\n\t\tmeta = t.GetMeta()\n\t\thttpCode = t.GetHttpCode()\n\t\tns = t.GetNamespace()\n\tdefault:\n\t\terrCode = exception.UnKnownException\n\t}\n\n\tif httpCode == 0 {\n\t\thttpCode = http.StatusInternalServerError\n\t}\n\n\tresp := Data{\n\t\tCode: &errCode,\n\t\tNamespace: ns,\n\t\tReason: reason,\n\t\tMessage: err.Error(),\n\t\tData: data,\n\t\tMeta: meta,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt.Apply(&resp)\n\t}\n\n\t// set response heanders\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// if marshal json error, use string to response\n\trespByt, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terrMSG := fmt.Sprintf(`{\"status\":\"error\", \"message\": \"encoding to json error, %s\"}`, err)\n\t\tw.Write([]byte(errMSG))\n\t\treturn\n\t}\n\n\tw.WriteHeader(httpCode)\n\tw.Write(respByt)\n}", "title": "" }, { "docid": "e45750a2ca8e6c838b99165e4b678832", "score": "0.62853694", "text": "func (err *ErrorResponse) sendError(w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusBadRequest)\n\tpayload, error := json.Marshal(err)\n\tif error != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tw.Write(payload)\n\t}\n}", "title": "" }, { "docid": "ba96a21b239488b98c1ec316fb073fa4", "score": "0.62385327", "text": "func renderErr(h func(*router.Context) error) router.Handler {\n\treturn func(ctx *router.Context) {\n\t\terr := h(ctx)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\n\t\ts, _ := status.FromError(err)\n\t\tmessage := s.Message()\n\t\tif message != \"\" {\n\t\t\t// Convert the first rune to upper case.\n\t\t\tr, n := utf8.DecodeRuneInString(message)\n\t\t\tmessage = string(unicode.ToUpper(r)) + message[n:]\n\t\t} else {\n\t\t\tmessage = \"Unspecified error\" // this should not really happen\n\t\t}\n\n\t\tctx.Writer.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tctx.Writer.WriteHeader(grpcutil.CodeStatus(s.Code()))\n\t\ttemplates.MustRender(ctx.Context, ctx.Writer, \"pages/error.html\", map[string]any{\n\t\t\t\"Message\": message,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a54a030f6561b65c3dea3396bbe2f983", "score": "0.62383634", "text": "func (res APIResponse) Write(w http.ResponseWriter, r *http.Request) {\n\tif res.Status == \"ERROR\" {\n\t\tlog.Printf(\"[ERROR][API][PATH: %s]:: Error handling request. ERROR: %s. User agent: %s\", r.RequestURI, res.Error, r.Header.Get(\"User-Agent\"))\n\t}\n\tWriteJSON(w, res)\n}", "title": "" }, { "docid": "840165db947e874c1006879b0e4bdc22", "score": "0.6236129", "text": "func ERROR(w http.ResponseWriter, statusCode int, err error) {\n\tJSON(w, statusCode, struct {\n\t\tError string `json:\"error\"`\n\t}{\n\t\tError: err.Error(),\n\t})\n\treturn\n}", "title": "" }, { "docid": "dcd00c6d06c15ca1cec56acb29e21bea", "score": "0.6235037", "text": "func (e *Err) Write(rw http.ResponseWriter, code int) {\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\trw.WriteHeader(code)\n\tjson.NewEncoder(rw).Encode(e)\n}", "title": "" }, { "docid": "d1421401a045d2b72420d6cd0eca0a5b", "score": "0.62346727", "text": "func writeResponse(w http.ResponseWriter, status int, response interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(status)\n\tif err := json.NewEncoder(w).Encode(response); err != nil {\n\t\tapiError := &ApiError{Status: http.StatusInternalServerError, Title: \"internal server error\"}\n\t\twriteResponse(w, http.StatusInternalServerError, apiError)\n\t}\n}", "title": "" }, { "docid": "aaa2b8a671b928144047006cb5b430b6", "score": "0.62316877", "text": "func errWrap(handler handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\terr := handler(w, r)\n\t\tif err != nil {\n\t\t\tvar e Error\n\n\t\t\tswitch v := err.(type) {\n\t\t\tcase *httpError:\n\t\t\t\tw.WriteHeader(v.StatusCode)\n\t\t\t\te = Error{\n\t\t\t\t\tStatusCode: v.StatusCode,\n\t\t\t\t\tMessage: v.Error(),\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\te = Error{\n\t\t\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\t\t\tMessage: v.Error(),\n\t\t\t\t}\n\t\t\t}\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\t\tout, err := json.Marshal(e)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Error returning JSON error\", \"err\", err)\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_, err = w.Write(out)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Error writing response with JSON error\", \"err\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "1215de86e526121cfd8d8153b49d3e5d", "score": "0.6228002", "text": "func wrapErr(err error) dedupe.Response {\n\treturn dedupe.Response{Error: err}\n}", "title": "" }, { "docid": "c73fb6dc92b0f7409129750f04e2a474", "score": "0.62242097", "text": "func encodeError(_ context.Context, err error, w http.ResponseWriter) {\n\tswitch err {\n\tcase NotFoundError:\n\t\tw.WriteHeader(http.StatusNotFound)\n\tcase InvalidInputError:\n\t\tw.WriteHeader(http.StatusBadRequest)\n\tdefault:\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "36b89fb661785a533241c101a2f09d8c", "score": "0.6205234", "text": "func httpReportError(error_message string, http_reply http.ResponseWriter) {\n\ttype replyMessage struct {\n\t\tStatus string `json:\"status\"`\n\t\tMessage string `json:\"error_message\"`\n\t}\n\tvar replyData replyMessage\n\treplyData.Status = \"failed\"\n\treplyData.Message = error_message\n\thttpSendReply(http_reply, replyData)\n}", "title": "" }, { "docid": "478e300a45e80d8ea796b5b291051c78", "score": "0.61982924", "text": "func genericError(_ context.Context, err errorResponse, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusInternalServerError)\n\tjson.NewEncoder(w).Encode(err)\n}", "title": "" }, { "docid": "b74006fd49754a8bf2c75d66894d2fa5", "score": "0.6198059", "text": "func (w ApiResponseWriter) WriteError(error string) {\n\tw.Write([]byte(error))\n}", "title": "" }, { "docid": "ea4d1186fbeab108c733f996c9ed8d0d", "score": "0.6192301", "text": "func showError(w http.ResponseWriter, errorMessage string, statusCode int) {\n\tw.WriteHeader(statusCode)\n\tapplyStyle(w)\n\tw.Write([]byte(\"<html><body><i>\" + errorMessage + \"</i></body></html>\"))\n\treturn\n}", "title": "" }, { "docid": "46adcb7efb62f13feee0a5077bd2211b", "score": "0.6190781", "text": "func WriteError(writer http.ResponseWriter, status int, response interface{}) error {\n\treturn WriteJSON(writer, status, errorResponse{Error: response.(string)})\n}", "title": "" }, { "docid": "aa5d071d718bc17da8105a41cc5c66d9", "score": "0.61729604", "text": "func RespondErr(w http.ResponseWriter, r *http.Request, status int, args ...interface{}) {\n\tRespond(w, r, status, map[string]interface{}{\n\t\t\"error\": map[string]interface{}{\n\t\t\t\"message\": fmt.Sprint(args...),\n\t\t},\n\t})\n}", "title": "" }, { "docid": "d4da7eef3203bd89647c4bf2f511a2b9", "score": "0.61708146", "text": "func writeResponse(w http.ResponseWriter, status int, msg string) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.WriteHeader(status)\n\tif len(msg) > 0 {\n\t\tio.WriteString(w, fmt.Sprintf(\"<h1>%s</h1>\", msg))\n\t}\n}", "title": "" }, { "docid": "8d02617d426ac0fed40f224036cc86f0", "score": "0.6161135", "text": "func (res *HTTPResponse) errorJSON(err apperror.Error) {\n\thttpStatusCode := apperror.HTTPStatusCode(err.StatusCode())\n\tif err.Error() == \"\" {\n\t\tres.writer.WriteHeader(httpStatusCode)\n\t\treturn\n\t}\n\tresError := &ResponseError{\n\t\tError: err.Error(),\n\t\tField: err.Field(),\n\t}\n\n\tif apperror.IsInternalServerError(err) {\n\t\tresError.Error = \"Something went wrong\"\n\t\tresError.Field = \"\"\n\t}\n\tres.renderJSON(httpStatusCode, resError)\n}", "title": "" }, { "docid": "92ad196cc19b1f616f3adf08dc5a9d14", "score": "0.61609846", "text": "func newErrResponse(code int, err error) *ErrResponse {\n\treturn &ErrResponse{Code: code, Err: err}\n}", "title": "" }, { "docid": "2624d95ce65ea8e93931cf47fdc6c030", "score": "0.6145733", "text": "func errorMessage(writer http.ResponseWriter, request *http.Request, msg string) {\n\turl := []string{\"/err?msg=\", msg}\n\thttp.Redirect(writer, request, strings.Join(url, \"\"), 302)\n}", "title": "" }, { "docid": "2624d95ce65ea8e93931cf47fdc6c030", "score": "0.6145733", "text": "func errorMessage(writer http.ResponseWriter, request *http.Request, msg string) {\n\turl := []string{\"/err?msg=\", msg}\n\thttp.Redirect(writer, request, strings.Join(url, \"\"), 302)\n}", "title": "" }, { "docid": "1a6940ad753127f7321811d9be7d2d50", "score": "0.61447746", "text": "func ErrToResponse(err error) (int, string) {\n\tvar statusCode int\n\tvar statusText string\n\n\tif err != nil {\n\t\tstatusText = err.Error()\n\t}\n\n\tswitch err {\n\tcase nil:\n\t\tstatusCode = 200\n\tcase ErrFieldsRequired:\n\t\tstatusCode = 400\n\tcase pgx.ErrNoRows:\n\t\tstatusText = ErrNoResult.Error()\n\t\tstatusCode = 404\n\tcase ErrNoResult:\n\t\tstatusCode = 404\n\tcase ErrNoDataToDelete:\n\t\tstatusCode = 404\n\tcase ErrNoDataToUpdate:\n\t\tstatusCode = 404\n\tcase ErrUnavailable:\n\t\tstatusCode = 503\n\tdefault:\n\t\tstatusCode = 500\n\t\t//statusText = \"Server error. Additional information may be contained in server logs.\"\n\t}\n\n\treturn statusCode, statusText\n}", "title": "" }, { "docid": "cf3556c5b4bbeaa21369cb97177cc5d8", "score": "0.6143152", "text": "func (h *queryServiceHandler) handleErr(w http.ResponseWriter, statusCode int, err error) {\n\tif statusCode == 0 {\n\t\tstatusCode = http.StatusInternalServerError\n\t}\n\tw.WriteHeader(statusCode)\n\n\tvar output []byte\n\tvar marshalErr error\n\tif output, marshalErr = json.Marshal(map[string]string{\n\t\t\"error\": err.Error(),\n\t}); marshalErr != nil {\n\t\tlogger.Error().Msg(marshalErr.Error())\n\t\treturn\n\t}\n\n\tif _, err := w.Write(output); err != nil {\n\t\tlogger.Error().Msg(err.Error())\n\t\treturn\n\t}\n\n\tlogger.Warn().Msgf(\"handled request with error code=%d, message=%s\", statusCode, err.Error())\n}", "title": "" }, { "docid": "2f660cdd915005312539454fac49af08", "score": "0.6142645", "text": "func articleHttpError(err error) render.Renderer {\n\tswitch err {\n\tcase app.ErrArticleNotFound:\n\t\treturn payloads.ErrNotFound\n\tdefault:\n\t\treturn payloads.ErrServer(err)\n\t}\n}", "title": "" }, { "docid": "be7d42b5ed8f3800b2a04828439fe650", "score": "0.6141535", "text": "func Fail(w http.ResponseWriter, status, errCode int, details ...string) {\n\tmsg, ok := frErrMap[errCode]\n\tif !ok {\n\t\terrCode = status\n\t\tmsg = http.StatusText(status)\n\t}\n\tr := &Response{\n\t\tStatus: StatusFail,\n\t\tError: &ResponseError{\n\t\t\tCode: errCode,\n\t\t\tMessage: msg,\n\t\t\tDetails: details,\n\t\t},\n\t}\n\tj, err := json.Marshal(r)\n\tif err != nil {\n\t\thttp.Error(\n\t\t\tw,\n\t\t\thttp.StatusText(http.StatusInternalServerError),\n\t\t\thttp.StatusInternalServerError,\n\t\t)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\t_, err = w.Write(j)\n\tif err != nil {\n\t\tlog.Printf(\"couldn't write response: %v\", err)\n\t}\n}", "title": "" }, { "docid": "594b5d453da9bb28083e8a32db842be6", "score": "0.6125325", "text": "func GenerateFailedResponse(w http.ResponseWriter, message string, err error) {\r\n\tstatusCode := http.StatusBadRequest\r\n\tvar errResp ErrorData\r\n\tif err != nil {\r\n\t\terrCode := \"400\"\r\n\t\terrMsg := err.Error()\r\n\t\terrResp = ErrorData{\r\n\t\t\tCode: errCode,\r\n\t\t\tMessage: errMsg,\r\n\t\t}\r\n\t}\r\n\tresp := HTTPResponse{\r\n\t\tMessage: message,\r\n\t\tData: nil,\r\n\t\tError: &errResp,\r\n\t}\r\n\tbytes, _ := json.Marshal(resp)\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\tw.WriteHeader(statusCode)\r\n\tw.Write(bytes)\r\n}", "title": "" }, { "docid": "81f898ac14563c114f83599d4184e84e", "score": "0.6122433", "text": "func Failed(response *restful.Response, err error) {\n\tlog.Println(err)\n\tif err = response.WriteAsJson(ErrorResponse{true, err.Error()}); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "a779e73c4580235e9d471aa787fff8b7", "score": "0.61191523", "text": "func WriteError(w http.ResponseWriter, err *Error) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(err.Status)\n\tjson.NewEncoder(w).Encode(Errors{[]*Error{err}})\n}", "title": "" }, { "docid": "5996c608e05f43bfaf83724bc60c4a63", "score": "0.6118068", "text": "func (api *API) handleError(w http.ResponseWriter, status int, err error) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\n\tenc := json.NewEncoder(w)\n\tenc.Encode(&ErrorResp{\n\t\tErr: err.Error(),\n\t})\n}", "title": "" }, { "docid": "029f52abf1dedd82af3d6b57cc135010", "score": "0.61151403", "text": "func FailedResponse(w http.ResponseWriter, r *http.Request, data interface{}, httpCode int) {\n\tresp := make(map[string]interface{})\n\tresp[\"msg\"] = \"500\"\n\tswitch data.(type) {\n\tcase error:\n\t\tresp[\"data\"] = data.(error).Error()\n\tcase []error:\n\t\terrs := data.([]error)\n\t\tvar s []string\n\t\tfor _, err := range errs {\n\t\t\ts = append(s, fmt.Sprintf(\"%v\", err))\n\t\t}\n\t\tresp[\"data\"] = s\n\tdefault:\n\t\tresp[\"data\"] = data\n\t}\n\n\tjsonByte, err := json.Marshal(resp)\n\tif err != nil {\n\t\tglog.Errorf(\"marshal [%v] failed with err [%v]\", data, err)\n\t}\n\t_, err = r.Cookie(\"WriteHeader\")\n\t// if no WriteHeader\n\tif err != nil {\n\t\tw.Header().Set(\"Pragma\", \"no-cache\")\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(httpCode)\n\t\tw.Write(jsonByte)\n\t}\n}", "title": "" }, { "docid": "e73f42ffe5b67dc228a568345c32d7fa", "score": "0.610237", "text": "func newErrResp(e error) *response {\n\treturn &response{\n\t\terr: e,\n\t}\n}", "title": "" } ]
397b41d76b53100ce47f05faf240d617
SummarizeForManagementGroupResponder handles the response to the SummarizeForManagementGroup request. The method always closes the http.Response Body.
[ { "docid": "742eae68ef5be2e0a8720405c0407537", "score": "0.79584426", "text": "func (client PolicyStatesClient) SummarizeForManagementGroupResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" } ]
[ { "docid": "a3edbd06160eeb516bfb174aa2677d25", "score": "0.6797052", "text": "func (client PolicyStatesClient) SummarizeForResourceGroupResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "c61f7f9bc9234a734a6376ffe24c9a86", "score": "0.63456744", "text": "func (client PolicyStatesClient) SummarizeForManagementGroupSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "e7d1870f179f302ab43a6a6bcb3908b1", "score": "0.6076352", "text": "func (client PolicyStatesClient) SummarizeForManagementGroup(ctx context.Context, managementGroupName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/PolicyStatesClient.SummarizeForManagementGroup\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: top,\n\t\t\tConstraints: []validation.Constraint{{Target: \"top\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"top\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"policyinsights.PolicyStatesClient\", \"SummarizeForManagementGroup\", err.Error())\n\t}\n\n\treq, err := client.SummarizeForManagementGroupPreparer(ctx, managementGroupName, top, from, toParameter, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"policyinsights.PolicyStatesClient\", \"SummarizeForManagementGroup\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.SummarizeForManagementGroupSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"policyinsights.PolicyStatesClient\", \"SummarizeForManagementGroup\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.SummarizeForManagementGroupResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"policyinsights.PolicyStatesClient\", \"SummarizeForManagementGroup\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a705d5f18698a76e9c9517222f28871f", "score": "0.6071422", "text": "func (client PolicyStatesClient) SummarizeForPolicyDefinitionResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "0939b1754d7e92c44992d5100fd6637c", "score": "0.60326636", "text": "func (client PolicyStatesClient) SummarizeForPolicySetDefinitionResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "772efa47d216d0537ae31b2d922e05da", "score": "0.5992523", "text": "func (client PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignmentResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "0a8cabafd826a9868eb51eaf57a00587", "score": "0.5727404", "text": "func (client *AggregatedCostClient) getByManagementGroupHandleResponse(resp *http.Response) (AggregatedCostClientGetByManagementGroupResponse, error) {\n\tresult := AggregatedCostClientGetByManagementGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroupAggregatedCostResult); err != nil {\n\t\treturn AggregatedCostClientGetByManagementGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "543102dd4c1327cff0859e72ab4d71c8", "score": "0.5701643", "text": "func (client PolicyStatesClient) SummarizeForSubscriptionResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "e679b79caee269c7a23fb9b6524715eb", "score": "0.5583585", "text": "func (client PolicyStatesClient) SummarizeForResourceResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "9aebd36288225b982a25b256d994cb53", "score": "0.5540148", "text": "func (o *DeleteGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7461acb7d15ce55eb60acf26c61783d6", "score": "0.5486389", "text": "func (client ResourceOperationsClient) GetEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "1aca332b117e630600b75ea22ae6b9d3", "score": "0.5458955", "text": "func (o *GetApiregistrationAPIGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3dafa5bc325e9b557495c9b3030cde0b", "score": "0.54395074", "text": "func (o *WeaviateGroupsGetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea7c2f19fce930b06c0b30d0d3be6f5c", "score": "0.5423808", "text": "func (client PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignmentResponder(resp *http.Response) (result SummarizeResults, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "ce47b4091df7d6c478a318e3b4ff9317", "score": "0.5363094", "text": "func (o *GetAdgroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "93e3682bb18df20ca3dec4160dfe5b10", "score": "0.5315399", "text": "func (client ResourceOperationsClient) CreateEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "4deea42d6d9fee40b77221fc3a599676", "score": "0.529252", "text": "func (client *ManagedHsmsClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedHsmsClientListByResourceGroupResponse, error) {\n\tresult := ManagedHsmsClientListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmListResult); err != nil {\n\t\treturn ManagedHsmsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "f6ba8370c1f065ec71213b155804debb", "score": "0.5288658", "text": "func (client *CapacityReservationGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (CapacityReservationGroupsClientListByResourceGroupResponse, error) {\n\tresult := CapacityReservationGroupsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil {\n\t\treturn CapacityReservationGroupsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "200fe470093f74bb926aab0290458d25", "score": "0.52757716", "text": "func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Response) (RegistriesListByResourceGroupResponse, error) {\n\tresult := RegistriesListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RegistryListResult); err != nil {\n\t\treturn RegistriesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ccf98fb9f8e8bd06d37939fe93765590", "score": "0.52752256", "text": "func (client *DomainsClient) listByResourceGroupHandleResponse(resp *http.Response) (DomainsClientListByResourceGroupResponse, error) {\n\tresult := DomainsClientListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DomainCollection); err != nil {\n\t\treturn DomainsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "325ea419341c8eed9c9df2037dca0daf", "score": "0.52611023", "text": "func (client *CommunicationsGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (CommunicationsGatewaysClientListByResourceGroupResponse, error) {\n\tresult := CommunicationsGatewaysClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CommunicationsGatewayListResult); err != nil {\n\t\treturn CommunicationsGatewaysClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a20208c7334cffdab797c77afc6db3f6", "score": "0.5242646", "text": "func (client AddsServicesClient) GetMetricMetadataForGroupResponder(resp *http.Response) (result MetricSets, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "5ebb0dcc3a95f3ecf8cc59922b3232fa", "score": "0.52217144", "text": "func (o *GetAuditregistrationAPIGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ee45623d9d2f4adb67a8f729b279e209", "score": "0.52210337", "text": "func (client *ApplicationDefinitionsClient) listByResourceGroupHandleResponse(resp *http.Response) (ApplicationDefinitionsClientListByResourceGroupResponse, error) {\n\tresult := ApplicationDefinitionsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ApplicationDefinitionListResult); err != nil {\n\t\treturn ApplicationDefinitionsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d4d5833aa97ce081e7ec6024d2a43504", "score": "0.521865", "text": "func (client *LabsClient) listByResourceGroupHandleResponse(resp *http.Response) (LabsClientListByResourceGroupResponse, error) {\n\tresult := LabsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.PagedLabs); err != nil {\n\t\treturn LabsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "0756d69e836d24b4b31f1748d551f59f", "score": "0.52075684", "text": "func (client *DedicatedHsmClient) listByResourceGroupHandleResponse(resp *http.Response) (DedicatedHsmClientListByResourceGroupResponse, error) {\n\tresult := DedicatedHsmClientListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHsmListResult); err != nil {\n\t\treturn DedicatedHsmClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "aae627f19d2984fee5f5597617065618", "score": "0.52030915", "text": "func (client *ResourceClient) listByResourceGroupHandleResponse(resp *http.Response) (ResourceClientListByResourceGroupResponse, error) {\n\tresult := ResourceClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DescriptionListResult); err != nil {\n\t\treturn ResourceClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a787f3d3db894fd1d30706de6e1cef55", "score": "0.51764274", "text": "func (client *EmailServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (EmailServicesClientListByResourceGroupResponse, error) {\n\tresult := EmailServicesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.EmailServiceResourceList); err != nil {\n\t\treturn EmailServicesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "23cfc31c1bbec1b20d786e11f2760fc1", "score": "0.51565635", "text": "func (client *ContainerServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ContainerServicesClientListByResourceGroupResponse, error) {\n\tresult := ContainerServicesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil {\n\t\treturn ContainerServicesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9f878ef2160ea035b5853e34b508d653", "score": "0.51539546", "text": "func (client *ResourceClient) getEventHubConsumerGroupHandleResponse(resp *http.Response) (ResourceClientGetEventHubConsumerGroupResponse, error) {\n\tresult := ResourceClientGetEventHubConsumerGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupInfo); err != nil {\n\t\treturn ResourceClientGetEventHubConsumerGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d7e85f02800c521454bc6c7472dd668b", "score": "0.51484776", "text": "func (o *DeleteStorageFromGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7d5f9d5908cdf65dbbf7bccb141226e0", "score": "0.51427495", "text": "func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (NamespacesClientListByResourceGroupResponse, error) {\n\tresult := NamespacesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.NamespacesListResult); err != nil {\n\t\treturn NamespacesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6008941b294ba4501520a43aed80d27e", "score": "0.5140875", "text": "func (client *NetworkVirtualAppliancesClient) listByResourceGroupHandleResponse(resp *http.Response) (NetworkVirtualAppliancesListByResourceGroupResponse, error) {\n\tresult := NetworkVirtualAppliancesListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualApplianceListResult); err != nil {\n\t\treturn NetworkVirtualAppliancesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ce54ec25d1a33798e359d3d5524015c8", "score": "0.5130726", "text": "func (client *IPExtendedCommunitiesClient) listByResourceGroupHandleResponse(resp *http.Response) (IPExtendedCommunitiesClientListByResourceGroupResponse, error) {\n\tresult := IPExtendedCommunitiesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.IPExtendedCommunityListResult); err != nil {\n\t\treturn IPExtendedCommunitiesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b812d5deb7d7e9ac6e1b0505fba008ea", "score": "0.5128507", "text": "func (client ResourceOperationsClient) ListByResourceGroupResponder(resp *http.Response) (result DescriptionListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "62aac236b04ee8dec35106abe500ff2d", "score": "0.5108799", "text": "func (client ResourceOperationsClient) DeleteEventHubConsumerGroupResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "1829b7337e44f6bd139c18f800e3e21d", "score": "0.51005936", "text": "func (o *GetAllUserGroupByUserIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c04e7464c6a98dde31d4b4e34e423b3", "score": "0.5093384", "text": "func (client *BareMetalMachinesClient) listByResourceGroupHandleResponse(resp *http.Response) (BareMetalMachinesClientListByResourceGroupResponse, error) {\n\tresult := BareMetalMachinesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.BareMetalMachineList); err != nil {\n\t\treturn BareMetalMachinesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d0af917ae83330e4d9ab846c75889d9d", "score": "0.50887376", "text": "func (client IotDpsResourceClient) ListByResourceGroupResponder(resp *http.Response) (result ProvisioningServiceDescriptionListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "0696579bd033d781066d0ea47d2935b1", "score": "0.5085726", "text": "func (client *TrafficControllerInterfaceClient) listByResourceGroupHandleResponse(resp *http.Response) (TrafficControllerInterfaceClientListByResourceGroupResponse, error) {\n\tresult := TrafficControllerInterfaceClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.TrafficControllerListResult); err != nil {\n\t\treturn TrafficControllerInterfaceClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5c4375d3841d93d1ed70a1281c2ebd28", "score": "0.5084774", "text": "func (client AddsServicesClient) ListMetricsSumResponder(resp *http.Response) (result Metrics, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "3a2813bbcf130a7cc059aa4141bae1fd", "score": "0.5083311", "text": "func (o *DeleteGroupInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8553fa1f6db3f25d765ef2a10ce84604", "score": "0.50790423", "text": "func (client *SubscriptionLevelClient) listByResourceGroupHandleResponse(resp *http.Response) (SubscriptionLevelClientListByResourceGroupResponse, error) {\n\tresult := SubscriptionLevelClientListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ResourceResponseWithContinuation); err != nil {\n\t\treturn SubscriptionLevelClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "41650f98ba2d532962f8ab71f5293142", "score": "0.50788033", "text": "func (client *ContainerServicesClient) listByResourceGroupHandleResponse(resp *azcore.Response) (ContainerServiceListResultResponse, error) {\n\tvar val *ContainerServiceListResult\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn ContainerServiceListResultResponse{}, err\n\t}\n\treturn ContainerServiceListResultResponse{RawResponse: resp.Response, ContainerServiceListResult: val}, nil\n}", "title": "" }, { "docid": "837518d1db5a65ea79ade15d3e6b34d5", "score": "0.50747055", "text": "func (client *RouteFiltersClient) listByResourceGroupHandleResponse(resp *http.Response) (RouteFiltersListByResourceGroupResponse, error) {\n\tresult := RouteFiltersListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterListResult); err != nil {\n\t\treturn RouteFiltersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "0596a58b49577d5a215abae33fc6a049", "score": "0.5073153", "text": "func (client *ConnectorsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectorsClientListByResourceGroupResponse, error) {\n\tresult := ConnectorsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ConnectorsList); err != nil {\n\t\treturn ConnectorsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "79e69e5f2fe877279e4012ca201075f6", "score": "0.50726944", "text": "func (t *ThingGroupHandler) HandleUpdateGroup(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", t.ContentType)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tctx := helpers.GetContext(r)\n\tgroup := models.ThingGroup{}\n\tif err := json.NewDecoder(r.Body).Decode(&group); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tbytes, err := json.Marshal(group)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\trsp, err := t.ThingGroupSvc.UpdateGroup(ctx, &pb.ThingGroup{Item: bytes})\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(rsp.GetItem())\n}", "title": "" }, { "docid": "e331650ca8c881316e07801bb103374c", "score": "0.505358", "text": "func (client *ConnectedEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectedEnvironmentsClientListByResourceGroupResponse, error) {\n\tresult := ConnectedEnvironmentsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ConnectedEnvironmentCollection); err != nil {\n\t\treturn ConnectedEnvironmentsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a2e9a91be6c22e4c9b9dae326df66bb7", "score": "0.5051144", "text": "func (client *ExpressRouteGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRouteGatewaysClientListByResourceGroupResponse, error) {\n\tresult := ExpressRouteGatewaysClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGatewayList); err != nil {\n\t\treturn ExpressRouteGatewaysClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "aed6fe92aef08312fca7f94a28b56644", "score": "0.5046459", "text": "func (client PolicyStatesClient) SummarizeForResourceGroupSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "dd88555b82f1bb17288389dc8558b356", "score": "0.5044368", "text": "func (client *ProvisionedClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ProvisionedClustersClientListByResourceGroupResponse, error) {\n\tresult := ProvisionedClustersClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClustersResponseListResult); err != nil {\n\t\treturn ProvisionedClustersClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a78cd881917c7f7049b845323659caa4", "score": "0.5042006", "text": "func (client *VirtualHubsClient) listByResourceGroupHandleResponse(resp *azcore.Response) (ListVirtualHubsResultResponse, error) {\n\tvar val *ListVirtualHubsResult\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn ListVirtualHubsResultResponse{}, err\n\t}\n\treturn ListVirtualHubsResultResponse{RawResponse: resp.Response, ListVirtualHubsResult: val}, nil\n}", "title": "" }, { "docid": "9efe1be531fa6be0c81184c333019e72", "score": "0.50371164", "text": "func (client *ConfigurationsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConfigurationsListByResourceGroupResponse, error) {\n\tresult := ConfigurationsListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil {\n\t\treturn ConfigurationsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d5c2e21606c8d2ab4dd44723ddb77eae", "score": "0.5035268", "text": "func (client *DatabaseAccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (DatabaseAccountsClientListByResourceGroupResponse, error) {\n\tresult := DatabaseAccountsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountsListResult); err != nil {\n\t\treturn DatabaseAccountsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e0469f835e059e37e831ba82293d8d31", "score": "0.5030373", "text": "func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *azcore.Response) (SnapshotListResponse, error) {\n\tvar val *SnapshotList\n\tif err := resp.UnmarshalAsJSON(&val); err != nil {\n\t\treturn SnapshotListResponse{}, err\n\t}\n\treturn SnapshotListResponse{RawResponse: resp.Response, SnapshotList: val}, nil\n}", "title": "" }, { "docid": "b3a0fea375ffc6bf40b308e15f6a50da", "score": "0.5014787", "text": "func (o *CreateGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Configuration-Version\n\n\tconfigurationVersion := o.ConfigurationVersion\n\tif configurationVersion != \"\" {\n\t\trw.Header().Set(\"Configuration-Version\", configurationVersion)\n\t}\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "46dfaf8b7f1ff29af404743cbb6193cb", "score": "0.5013453", "text": "func handleCreateGroup(c *Context, w http.ResponseWriter, r *http.Request) {\n\tcreateGroupRequest, err := model.NewCreateGroupRequestFromReader(r.Body)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to decode request\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tgroup := model.Group{\n\t\tName: createGroupRequest.Name,\n\t\tDescription: createGroupRequest.Description,\n\t\tVersion: createGroupRequest.Version,\n\t}\n\n\terr = c.Store.CreateGroup(&group)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to create group\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc.Supervisor.Do()\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\toutputJSON(c, w, group)\n}", "title": "" }, { "docid": "e925226ded56443c00b3ab088c91bbcf", "score": "0.5012869", "text": "func (client *MoveCollectionsClient) listMoveCollectionsByResourceGroupHandleResponse(resp *http.Response) (MoveCollectionsClientListMoveCollectionsByResourceGroupResponse, error) {\n\tresult := MoveCollectionsClientListMoveCollectionsByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.MoveCollectionResultList); err != nil {\n\t\treturn MoveCollectionsClientListMoveCollectionsByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "bc4d1aebecde592272deba7742e97788", "score": "0.50095", "text": "func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkspacesClientListByResourceGroupResponse, error) {\n\tresult := WorkspacesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceList); err != nil {\n\t\treturn WorkspacesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "158948567d0f1f190af55d26dc5787d7", "score": "0.4999936", "text": "func (client *SQLServerInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (SQLServerInstancesClientListByResourceGroupResponse, error) {\n\tresult := SQLServerInstancesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SQLServerInstanceListResult); err != nil {\n\t\treturn SQLServerInstancesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d6dc34e3199e038371168fd84bc1da79", "score": "0.49985042", "text": "func (client *FirewallsClient) listByResourceGroupHandleResponse(resp *http.Response) (FirewallsClientListByResourceGroupResponse, error) {\n\tresult := FirewallsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.FirewallResourceListResult); err != nil {\n\t\treturn FirewallsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2b413f7039c519676e556b317a202a36", "score": "0.4991848", "text": "func (client ManagedClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "c7491a40af60e136e8f6f5674cd11d4b", "score": "0.49881873", "text": "func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsClientListByResourceGroupResponse, error) {\n\tresult := AccountsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Accounts); err != nil {\n\t\treturn AccountsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a1b02b38255a33f0f4ad25fd979b3db5", "score": "0.49836266", "text": "func (client *FarmBeatsModelsClient) listByResourceGroupHandleResponse(resp *http.Response) (FarmBeatsModelsClientListByResourceGroupResponse, error) {\n\tresult := FarmBeatsModelsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsListResponse); err != nil {\n\t\treturn FarmBeatsModelsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "13b6377d9dbb0e414de9fcf4b00e6c11", "score": "0.49788845", "text": "func GroupHandler(w http.ResponseWriter, r *http.Request) {\n\tviewData, err := db.GetDefaultViewData(server.Core.DB, r)\n\tif err != nil {\n\t\tlog.Print(\"Error getting default viewData: \", err)\n\t}\n\n\tvars := mux.Vars(r)\n\tgroupIDstr := vars[\"id\"]\n\n\tgroupIDint, err := strconv.Atoi(groupIDstr)\n\tif err != nil {\n\t\tlog.Printf(\"Error converting string to int on %s group page: %s\", groupIDstr, err)\n\t}\n\n\tviewData.GroupData, err = db.GetGroupbyID(server.Core.DB, groupIDint)\n\tif err != nil {\n\t\tlog.Printf(\"Error getting info about %d group: %s\", groupIDint, err)\n\t}\n\n\terr = server.Core.Rnd.HTML(w, http.StatusOK, \"group\", viewData)\n\tif err != nil {\n\t\tlog.Print(\"Error parse template: \", err)\n\t}\n}", "title": "" }, { "docid": "ced6e469ddcf232b1a26503d55cdd0a5", "score": "0.497859", "text": "func (o *DeleteGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b0831b262ef94545079672e8d485e2c8", "score": "0.4976349", "text": "func (client *SolutionsClient) listByResourceGroupHandleResponse(resp *http.Response) (SolutionsListByResourceGroupResponse, error) {\n\tresult := SolutionsListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SolutionPropertiesList); err != nil {\n\t\treturn SolutionsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3699cea53553e8226a9075a32c2b7d61", "score": "0.49691772", "text": "func (client *AmlFilesystemsClient) listByResourceGroupHandleResponse(resp *http.Response) (AmlFilesystemsClientListByResourceGroupResponse, error) {\n\tresult := AmlFilesystemsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.AmlFilesystemsListResult); err != nil {\n\t\treturn AmlFilesystemsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9fb79ffe43864c1c343635be3366dc98", "score": "0.4957284", "text": "func (client *DiskPoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskPoolsClientListByResourceGroupResponse, error) {\n\tresult := DiskPoolsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.DiskPoolListResult); err != nil {\n\t\treturn DiskPoolsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "cb4235a3048af8978c743415464bfcad", "score": "0.49557936", "text": "func (client *FarmBeatsModelsClient) listByResourceGroupHandleResponse(resp *http.Response) (FarmBeatsModelsListByResourceGroupResponse, error) {\n\tresult := FarmBeatsModelsListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsListResponse); err != nil {\n\t\treturn FarmBeatsModelsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "863e58499d9b1e3f8bd06128102f72fc", "score": "0.4952211", "text": "func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersClientListByResourceGroupResponse, error) {\n\tresult := ServersClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Servers); err != nil {\n\t\treturn ServersClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "743d92126d1dc035a277866145c91746", "score": "0.49489924", "text": "func (client *NetworkTapsClient) listByResourceGroupHandleResponse(resp *http.Response) (NetworkTapsClientListByResourceGroupResponse, error) {\n\tresult := NetworkTapsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.NetworkTapsListResult); err != nil {\n\t\treturn NetworkTapsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "80b7c51e6f3d3b98334688f5e2d47f83", "score": "0.49433374", "text": "func (o *GetNamespaceByGroupIDAndNamespaceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "099331eb32c79d19c376b43913544e61", "score": "0.493847", "text": "func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsClientListByResourceGroupResponse, error) {\n\tresult := ExpressRouteCrossConnectionsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionListResult); err != nil {\n\t\treturn ExpressRouteCrossConnectionsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8ca40187ef57930909e902d3c5998869", "score": "0.49381253", "text": "func (t *ThingGroupHandler) HandleGetGroup(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", t.ContentType)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tctx := helpers.GetContext(r)\n\tvars := mux.Vars(r)\n\trsp, err := t.ThingGroupSvc.GetGroup(ctx, &pb.GroupIDRequest{ID: vars[\"id\"]})\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(rsp.GetItem())\n}", "title": "" }, { "docid": "a2e5c7f930e0e1a2b0cb49aa8eb53656", "score": "0.49364176", "text": "func (client *ComponentsClient) listByResourceGroupHandleResponse(resp *http.Response) (ComponentsClientListByResourceGroupResponse, error) {\n\tresult := ComponentsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ComponentListResult); err != nil {\n\t\treturn ComponentsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "cc14361db29c6044e239029f8424220f", "score": "0.49315843", "text": "func (client *WebTestsClient) listByResourceGroupHandleResponse(resp *http.Response) (WebTestsClientListByResourceGroupResponse, error) {\n\tresult := WebTestsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.WebTestListResult); err != nil {\n\t\treturn WebTestsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "da7916376eb121d9de0dee3fad6f41b4", "score": "0.49239266", "text": "func (client ResourceOperationsClient) ListEventHubConsumerGroupsResponder(resp *http.Response) (result EventHubConsumerGroupsListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "41c3519bc63f7ed8f53586722431767c", "score": "0.49238014", "text": "func (client *ConnectedClusterClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectedClusterClientListByResourceGroupResponse, error) {\n\tresult := ConnectedClusterClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ConnectedClusterList); err != nil {\n\t\treturn ConnectedClusterClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6ca8b468b261dbabdb787352d55e8b35", "score": "0.49192896", "text": "func (client *AggregatedCostClient) getForBillingPeriodByManagementGroupHandleResponse(resp *http.Response) (AggregatedCostClientGetForBillingPeriodByManagementGroupResponse, error) {\n\tresult := AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroupAggregatedCostResult); err != nil {\n\t\treturn AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8f986e34c732e49e65bfdd8efdc0d698", "score": "0.49184045", "text": "func (client *VolumeClient) listByResourceGroupHandleResponse(resp *http.Response) (VolumeClientListByResourceGroupResponse, error) {\n\tresult := VolumeClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VolumeResourceDescriptionList); err != nil {\n\t\treturn VolumeClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2ed9039c3bc28bcd474d5c032ffc76d4", "score": "0.49171934", "text": "func (client *ResourceClient) createEventHubConsumerGroupHandleResponse(resp *http.Response) (ResourceClientCreateEventHubConsumerGroupResponse, error) {\n\tresult := ResourceClientCreateEventHubConsumerGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupInfo); err != nil {\n\t\treturn ResourceClientCreateEventHubConsumerGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b011de30e3ecbeda0bc0a0b5670d76bb", "score": "0.4916191", "text": "func (client *StreamingJobsClient) listByResourceGroupHandleResponse(resp *http.Response) (StreamingJobsListByResourceGroupResponse, error) {\n\tresult := StreamingJobsListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.StreamingJobListResult); err != nil {\n\t\treturn StreamingJobsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9b6e245e2e414f02e4a8f53e609536e8", "score": "0.49156305", "text": "func (a *DhcpApiService) DhcpGroupInfoExecute(r ApiDhcpGroupInfoRequest) (DhcpGroupData, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue DhcpGroupData\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DhcpApiService.DhcpGroupInfo\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/dhcp/group/info\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.groupId != nil {\n\t\tlocalVarQueryParams.Add(\"group_id\", parameterToString(*r.groupId, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"HttpHeaderLoginKey\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"X-IPM-Username\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"HttpHeaderPasswordKey\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"X-IPM-Password\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ApiResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, executionError\n}", "title": "" }, { "docid": "6a73561bd8cb9a32330d6fc38ea0dc3c", "score": "0.4911098", "text": "func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceList, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "ca5499df7e2dbcb8a4493fd2bea052cb", "score": "0.4910029", "text": "func (client *VirtualNetworkTapsClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualNetworkTapsListByResourceGroupResponse, error) {\n\tresult := VirtualNetworkTapsListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTapListResult); err != nil {\n\t\treturn VirtualNetworkTapsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "0cb7f20515fb793ec70546c8bb874ee4", "score": "0.490149", "text": "func (o *GetApiregistrationAPIGroupUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(401)\n}", "title": "" }, { "docid": "c89b802295b8b70bc062d9fb53b4bcc9", "score": "0.48946315", "text": "func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "ba1c90db3e2e273493721c4bf8b3dea6", "score": "0.48711956", "text": "func CreateModifyGroupResponse() (response *ModifyGroupResponse) {\n\tresponse = &ModifyGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "c831a67c6f4a9ec5f41684212065c1d3", "score": "0.4861369", "text": "func (client *CustomEntityStoreAssignmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsClientListByResourceGroupResponse, error) {\n\tresult := CustomEntityStoreAssignmentsClientListByResourceGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignmentsListResult); err != nil {\n\t\treturn CustomEntityStoreAssignmentsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "88e2086e7882b88235eaa44ce52a2970", "score": "0.48486418", "text": "func (p *WorkloadNetworksClientUpdateVMGroupPoller) FinalResponse(ctx context.Context) (WorkloadNetworksClientUpdateVMGroupResponse, error) {\n\trespType := WorkloadNetworksClientUpdateVMGroupResponse{}\n\tresp, err := p.pt.FinalResponse(ctx, &respType.WorkloadNetworkVMGroup)\n\tif err != nil {\n\t\treturn WorkloadNetworksClientUpdateVMGroupResponse{}, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "d38428056c71ad4f37e12aabca740e78", "score": "0.48430255", "text": "func (o *GetDataContextTopologyUUIDNodeNodeUUIDNodeRuleGroupNodeRuleGroupUUIDInterRuleGroupInterRuleGroupUUIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6990d09fb4700d6b1fe6ba847c07708", "score": "0.4841377", "text": "func (client *ResourceClient) listEventHubConsumerGroupsHandleResponse(resp *http.Response) (ResourceClientListEventHubConsumerGroupsResponse, error) {\n\tresult := ResourceClientListEventHubConsumerGroupsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupsListResult); err != nil {\n\t\treturn ResourceClientListEventHubConsumerGroupsResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "dca5cd1761f601e3003734152de03b6d", "score": "0.48393992", "text": "func (server *Server) readGroupHandler(w http.ResponseWriter, r *http.Request) {\n\tlogRequest(r)\n\tparams := mux.Vars(r)\n\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\tlog.Println(err)\n\t\trespondHeader(w, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tgroup, ok := readGroup(server.DB, id)\n\tif !ok {\n\t\trespondHeader(w, http.StatusNotFound)\n\t\treturn\n\t}\n\n\tresponse, err := json.Marshal(group)\n\tif err != nil {\n\t\tlog.Println()\n\t}\n\n\trespondJSON(w, http.StatusOK, response)\n}", "title": "" }, { "docid": "2db55fb7a3ed205e62446a5634d8d0af", "score": "0.48381087", "text": "func CreateModifyMonitorGroupInstancesResponse() (response *ModifyMonitorGroupInstancesResponse) {\n\tresponse = &ModifyMonitorGroupInstancesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "c4c5365577a86f89d84d3c10bf4e5189", "score": "0.4834215", "text": "func (client PolicyStatesClient) SummarizeForManagementGroupPreparer(ctx context.Context, managementGroupName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"managementGroupName\": autorest.Encode(\"path\", managementGroupName),\n\t\t\"managementGroupsNamespace\": autorest.Encode(\"path\", \"Microsoft.Management\"),\n\t\t\"policyStatesSummaryResource\": autorest.Encode(\"path\", \"latest\"),\n\t}\n\n\tconst APIVersion = \"2017-12-12-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif top != nil {\n\t\tqueryParameters[\"$top\"] = autorest.Encode(\"query\", *top)\n\t}\n\tif from != nil {\n\t\tqueryParameters[\"$from\"] = autorest.Encode(\"query\", *from)\n\t}\n\tif toParameter != nil {\n\t\tqueryParameters[\"$to\"] = autorest.Encode(\"query\", *toParameter)\n\t}\n\tif len(filter) > 0 {\n\t\tqueryParameters[\"$filter\"] = autorest.Encode(\"query\", filter)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d2a1ee88abf03d2f73b2c1b193d7732e", "score": "0.48300976", "text": "func (client *EnterprisePoliciesClient) listByResourceGroupHandleResponse(resp *http.Response) (EnterprisePoliciesClientListByResourceGroupResponse, error) {\n\tresult := EnterprisePoliciesClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.EnterprisePolicyList); err != nil {\n\t\treturn EnterprisePoliciesClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "81b64d46941122f563dd8978950f7eb3", "score": "0.48224744", "text": "func (p *WorkloadNetworksClientCreateVMGroupPoller) FinalResponse(ctx context.Context) (WorkloadNetworksClientCreateVMGroupResponse, error) {\n\trespType := WorkloadNetworksClientCreateVMGroupResponse{}\n\tresp, err := p.pt.FinalResponse(ctx, &respType.WorkloadNetworkVMGroup)\n\tif err != nil {\n\t\treturn WorkloadNetworksClientCreateVMGroupResponse{}, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "be8d6cb5a1fe6e5ea40c5045d58ccefa", "score": "0.48201564", "text": "func (*CChatRoom_GetChatRoomGroupSummary_Response) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_chat_steamclient_proto_rawDescGZIP(), []int{79}\n}", "title": "" }, { "docid": "c8043ff1d32ac0af0e867b0a6579d847", "score": "0.48193234", "text": "func (p *GoPluginServer) ProcessGroup(opts PluginOpts, res *PluginResult) error {\n\ttmp, err := p.Mux.HandleGroup(opts)\n\tres.Group = tmp.Group\n\treturn err\n}", "title": "" } ]
15ff77631b469e118de7c3d0e7a28896
ProcessElement encodes a as a Pair.
[ { "docid": "83a356f8beec948ebdca4e80bcbcf233", "score": "0.7476587", "text": "func (fn *EncodeFn) ProcessElement(k beam.T, v beam.V) Pair {\n\tvar bufK bytes.Buffer\n\tif err := fn.kEnc.Encode(k, &bufK); err != nil {\n\t\tlog.Exitf(\"kv.EncodeFn.ProcessElement: couldn't encode key %v: %v\", k, err)\n\t}\n\tvar bufV bytes.Buffer\n\tif err := fn.vEnc.Encode(v, &bufV); err != nil {\n\t\tlog.Exitf(\"kv.EncodeFn.ProcessElement: couldn't encode value %v: %v\", v, err)\n\t}\n\treturn Pair{\n\t\tK: bufK.Bytes(),\n\t\tV: bufV.Bytes(),\n\t}\n}", "title": "" } ]
[ { "docid": "ea8c7f00b920b1f2063911e90c863961", "score": "0.6301693", "text": "func (fn *DecodeFn) ProcessElement(c Pair) (beam.T, beam.V) {\n\tk, err := fn.kDec.Decode(bytes.NewBuffer(c.K))\n\tif err != nil {\n\t\tlog.Exitf(\"kv.DecodeFn.ProcessElement: couldn't decode key %v: %v\", k, err)\n\t}\n\tv, err := fn.vDec.Decode(bytes.NewBuffer(c.V))\n\tif err != nil {\n\t\tlog.Exitf(\"kv.DecodeFn.ProcessElement: couldn't decode value %v: %v\", v, err)\n\t}\n\treturn k, v\n}", "title": "" }, { "docid": "1e0f123fbbe9d08cd6a6a132cce8b7dc", "score": "0.5812264", "text": "func Pair(children ...Element) *PairElement {\n\treturn &PairElement{\n\t\tChildren: children,\n\t}\n}", "title": "" }, { "docid": "bf18daf0bd6163b7f7fa5b9005827e64", "score": "0.56332314", "text": "func (u *UUIDEncrypter) EncodePair(a, b int) string {\n\ttext := make([]byte, aes.BlockSize)\n\tbinary.BigEndian.PutUint32(text[8:12], uint32(a))\n\tbinary.BigEndian.PutUint32(text[12:16], uint32(b))\n\tstream := cipher.NewCTR(u.c, u.iv)\n\tstream.XORKeyStream(text, text)\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", text[0:4], text[4:6], text[6:8], text[8:10], text[10:])\n}", "title": "" }, { "docid": "7d4b8e850e909d123629d932f10e4eef", "score": "0.5206793", "text": "func encodePair(key string, value interface{}) string {\n\tpair := map[string]interface{}{\n\t\tkey: value,\n\t}\n\n\tb, _ := json.Marshal(pair)\n\treturn string(b)\n}", "title": "" }, { "docid": "5a76deca50b97dafc940ef2c00efcb7c", "score": "0.5119124", "text": "func MakePair(elem interface{}, val float64) *Pair {\n\treturn &Pair{\n\t\tElement: elem,\n\t\tValue: val,\n\t}\n}", "title": "" }, { "docid": "810fb23e72c776b54d9fba4ead853718", "score": "0.5087732", "text": "func (s *SecureChannelSession) pair(p1 uint8, data []byte) (*responseAPDU, error) {\n\treturn transmit(s.card, &commandAPDU{\n\t\tCla: claSCWallet,\n\t\tIns: insPair,\n\t\tP1: p1,\n\t\tP2: 0,\n\t\tData: data,\n\t\tLe: 0,\n\t})\n}", "title": "" }, { "docid": "b904de9a2fd2e1783437633000c1d6c1", "score": "0.5079956", "text": "func NewPair(elem interface{}, val float64) *Pair {\n\treturn &Pair{\n\t\tElement: elem,\n\t\tValue: val,\n\t}\n}", "title": "" }, { "docid": "630729c25ad7c91c274f01973e6600c5", "score": "0.5071189", "text": "func (f *Foo) ProcessElement(b CustomType) int {\n\treturn f.A + b.val\n}", "title": "" }, { "docid": "fb2c3f51cd2e4c86b401035ae67c03ea", "score": "0.50523144", "text": "func (s *scanner) Pair() (key string, value *string) {\n\n\ts.Garbage() //consumer the possible garbage\n\tkey = s.Identifier()\n\n\ts.Garbage() //consumer the possible garbage\n\n\tif r := s.Read(); r == '=' {\n\t\t// separator there might be a value\n\t\ts.Garbage() //consumer extra space after =\n\t\t//then attempt to read the value (might not exist)\n\t\tv := s.Value()\n\t\tvalue = &v\n\t\ts.Garbage() //consumer extra space\n\t\treturn\n\t}\n\ts.Unread()\n\treturn\n}", "title": "" }, { "docid": "e01e5caf9db455319bc540e0b7e33d94", "score": "0.5013839", "text": "func (w *writeFileFn) ProcessElement(ctx context.Context, key int, values func(*string) bool) error {\n\tfs, err := filesystem.New(ctx, w.Filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fs.Close()\n\n\tfd, err := fs.OpenWrite(ctx, w.Filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fd.Close()\n\n\tgz := gzip.NewWriter(fd)\n\tdefer gz.Close()\n\n\tbuf := bufio.NewWriterSize(gz, 1<<20) // use 1MB buffer\n\n\tvar line string\n\tfor values(&line) {\n\t\tif _, err := buf.WriteString(line); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := buf.Write([]byte{'\\n'}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := buf.Flush(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7f739b6a7308f494b15803eba3bda1e4", "score": "0.5010901", "text": "func (r *Root) RegisterRemovedElementPair(parent Container, elem Element) {\n\tr.removedElementPairMapByCreatedAt[elem.CreatedAt().Key()] = ElementPair{\n\t\tparent,\n\t\telem,\n\t}\n}", "title": "" }, { "docid": "21be9cf8ed0acbc5fdc3608a421c861c", "score": "0.493071", "text": "func (p *Pair) Next() *Pair {\n\treturn listElementToPair(p.element.Next())\n}", "title": "" }, { "docid": "9f73ef8bc456d8841e04f0e308834b92", "score": "0.48734835", "text": "func attributeToStringPair(kv attribute.KeyValue) (string, string) {\n\tswitch kv.Value.Type() {\n\t// For slice attributes, serialize as JSON list string.\n\tcase attribute.BOOLSLICE:\n\t\tdata, _ := json.Marshal(kv.Value.AsBoolSlice())\n\t\treturn (string)(kv.Key), (string)(data)\n\tcase attribute.INT64SLICE:\n\t\tdata, _ := json.Marshal(kv.Value.AsInt64Slice())\n\t\treturn (string)(kv.Key), (string)(data)\n\tcase attribute.FLOAT64SLICE:\n\t\tdata, _ := json.Marshal(kv.Value.AsFloat64Slice())\n\t\treturn (string)(kv.Key), (string)(data)\n\tcase attribute.STRINGSLICE:\n\t\tdata, _ := json.Marshal(kv.Value.AsStringSlice())\n\t\treturn (string)(kv.Key), (string)(data)\n\tdefault:\n\t\treturn (string)(kv.Key), kv.Value.Emit()\n\t}\n}", "title": "" }, { "docid": "33529cd01977128745872bd6a1fb1db1", "score": "0.4855948", "text": "func xmlPairs(indent string, vals ...string) []byte {\n\t// make sure we have pairs\n\tif len(vals)%2 != 0 {\n\t\tpanic(fmt.Errorf(\"xmlPairs can only accept pairs of strings, length: %d\", len(vals)))\n\t}\n\n\tvar buf bytes.Buffer\n\n\t// loop over pairs\n\tfor i := 0; i < len(vals); i += 2 {\n\t\tbuf.WriteString(fmt.Sprintf(\"%s<%s>%s</%s>\\n\", indent, vals[i], vals[i+1], vals[i]))\n\t}\n\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "8e5700a19a16400921f21c5c1cd794c0", "score": "0.47671834", "text": "func (s *Scram) ProcessElement(ctx context.Context, elem stravaganza.Element) (stravaganza.Element, *SASLError) {\n\tswitch elem.Name() {\n\tcase \"auth\":\n\t\tif s.state == startScramState {\n\t\t\treturn s.handleStart(ctx, elem)\n\t\t}\n\tcase \"response\":\n\t\tif s.state == challengedScramState {\n\t\t\treturn s.handleChallenged(elem)\n\t\t}\n\t}\n\treturn nil, newSASLError(NotAuthorized, nil)\n}", "title": "" }, { "docid": "bcf8b6d0c1b2e9064c3007cc0a2d04be", "score": "0.4753207", "text": "func (a *OrderData) pairToAccount() (*types.Account, *types.Account, error) {\n\tstrs := strings.Split(a.Pair, \"_\")\n\tif len(strs) != 2 {\n\t\treturn nil, nil, errors.New(\"pair error\")\n\t}\n\tbase, err := types.AccountFromString(strs[0])\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tquote, err := types.AccountFromString(strs[1])\n\treturn base, quote, err\n}", "title": "" }, { "docid": "6090975cfef84de6e7fa623a3538b38d", "score": "0.47166455", "text": "func encodeElement(element float64, precision uint32) string {\n\n\telementInt := int32(math.Round(element * math.Pow10(int(precision))))\n\telementInt = elementInt << 1\n\tif element < 0 {\n\t\telementInt = ^elementInt\n\t}\n\n\tc := chunks{}\n\tc.Parse(elementInt)\n\n\treturn c.String()\n\n}", "title": "" }, { "docid": "15cdffa3a7a23b234d6fc82486de853a", "score": "0.47059658", "text": "func (n *ParDo) ProcessElement(_ context.Context, elm *FullValue, values ...ReStream) error {\n\tif n.status != Active {\n\t\treturn errors.Errorf(\"invalid status for pardo %v: %v, want Active\", n.UID, n.status)\n\t}\n\n\treturn n.processMainInput(&MainInput{Key: *elm, Values: values})\n}", "title": "" }, { "docid": "e6f1338d9e74b5dd3d29ca3dd27743ec", "score": "0.46996436", "text": "func (e *Element) EncodeElement() []byte {\n\tb := make([]byte, 13)\n\tcopy(b[:elementKeyLen], e.TypeKey)\n\tbinary.BigEndian.PutUint64(b[elementKeyLen:], uint64(e.ID))\n\treturn b\n}", "title": "" }, { "docid": "54145a9671bfa1564cf2185bc8ea6fda", "score": "0.4693773", "text": "func (m *KeyStringValuePair) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.KeyTypedValuePair.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"value\", m.GetValue())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "1b89c3ff9d12d9d37f74343ee6ee0548", "score": "0.46378583", "text": "func (d DeviceValues) ToPairs() *[]interface{} {\n\tresult := make([]interface{}, 0)\n\tfor k, v := range d {\n\t\tresult = append(result, k, v)\n\t}\n\treturn &result\n}", "title": "" }, { "docid": "0ccd02f1f424ef3e4fe71e7bc39b7dce", "score": "0.4594028", "text": "func serializeKVpair(w io.Writer, key []byte, value []byte) error {\n\tif err := wire.WriteVarBytes(w, 0, key); err != nil {\n\t\treturn err\n\t}\n\n\treturn wire.WriteVarBytes(w, 0, value)\n}", "title": "" }, { "docid": "66dd03d9250e825745442015625dc28d", "score": "0.45746022", "text": "func (fn *VetKvSdf) ProcessElement(rt *VetRTracker, i, j int, emit func(*VetRestriction)) sdf.ProcessContinuation {\n\trest := rt.Rest\n\trest.Key = i\n\trest.Val = j\n\trest.ProcessElm = true\n\temit(rest)\n\treturn sdf.ResumeProcessingIn(1 * time.Second)\n}", "title": "" }, { "docid": "ca2ee13c6f3e6db00f6c472df4f96f07", "score": "0.45681944", "text": "func (p *PairWiseIterator) Pair() (*model.StockDoc, *model.StockDoc) {\n\treturn p.slice[p.firstIdx], p.slice[p.secondIdx]\n}", "title": "" }, { "docid": "48a3df97d8edcf6069c418273e38674a", "score": "0.4551375", "text": "func (this stringValue) DescendantPairs(buffer []util.IPair) []util.IPair {\n\treturn buffer\n}", "title": "" }, { "docid": "812cb1eead612b3438a1f8ad4764cc86", "score": "0.4540439", "text": "func encodePairs(code []byte, lat, lng float64, codeLen int) []byte {\n\tlat += latMax\n\tlng += lngMax\n\tfor digits := 0; digits < codeLen; {\n\t\t// value of digits in this place, in decimal degrees\n\t\tplaceValue := pairResolutions[digits/2]\n\n\t\tdigitValue := int(lat / placeValue)\n\t\tlat -= float64(digitValue) * placeValue\n\t\tcode = append(code, Alphabet[digitValue])\n\t\tdigits++\n\n\t\tdigitValue = int(lng / placeValue)\n\t\tlng -= float64(digitValue) * placeValue\n\t\tcode = append(code, Alphabet[digitValue])\n\t\tdigits++\n\n\t\tif digits == sepPos && digits < codeLen {\n\t\t\tcode = append(code, Separator)\n\t\t}\n\t}\n\tfor len(code) < sepPos {\n\t\tcode = append(code, Padding)\n\t}\n\tif len(code) == sepPos {\n\t\tcode = append(code, Separator)\n\t}\n\n\treturn code\n}", "title": "" }, { "docid": "c14ff85e4236631b02e6c9cc8b1021fb", "score": "0.452712", "text": "func (n *DiskNode) insertPair(value *pairs, bt *btree) error {\r\n\t_, _, _, err := n.insert(value, bt)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "61c034527af7ef0c842a60609421841e", "score": "0.4523816", "text": "func (b *pairBehavior) emitPair(ctx context.Context, timestamp time.Time, data interface{}) {\n\tb.cell.EmitNew(ctx, TopicPair, cells.PayloadValues{\n\t\tPayloadPairFirstTime: *b.hit,\n\t\tPayloadPairFirstData: b.hitData,\n\t\tPayloadPairSecondTime: timestamp,\n\t\tPayloadPairSecondData: data,\n\t})\n\tb.hit = nil\n}", "title": "" }, { "docid": "fd029f6605587d25b7d7bd7312d8a8c5", "score": "0.45053384", "text": "func (m *FieldTypeMutation) SetPair(s schema.Pair) {\n\tm.pair = &s\n}", "title": "" }, { "docid": "dd67c158cb65cf64f46e4af4ecdb539a", "score": "0.44861495", "text": "func (s *BaseBundListener) EnterPair(ctx *PairContext) {}", "title": "" }, { "docid": "3d9daa24bfe9191dde3e8813a5e9f0a8", "score": "0.44578454", "text": "func ExchangePairs(args ...objects.Object) (objects.Object, error) {\n\tif len(args) != 3 {\n\t\treturn nil, objects.ErrWrongNumArguments\n\t}\n\n\texchangeName, ok := objects.ToString(args[0])\n\tif !ok {\n\t\treturn nil, constructRuntimeError(1, pairsFunc, \"string\", args[0])\n\t}\n\tenabledOnly, ok := objects.ToBool(args[1])\n\tif !ok {\n\t\treturn nil, constructRuntimeError(2, pairsFunc, \"bool\", args[1])\n\t}\n\tassetTypeParam, ok := objects.ToString(args[2])\n\tif !ok {\n\t\treturn nil, constructRuntimeError(3, pairsFunc, \"string\", args[2])\n\t}\n\tassetType, err := asset.New(assetTypeParam)\n\tif err != nil {\n\t\treturn errorResponsef(standardFormatting, err)\n\t}\n\n\tpairs, err := wrappers.GetWrapper().Pairs(exchangeName, enabledOnly, assetType)\n\tif err != nil {\n\t\treturn errorResponsef(standardFormatting, err)\n\t}\n\n\tr := objects.Array{\n\t\tValue: make([]objects.Object, len(*pairs)),\n\t}\n\n\tfor x := range *pairs {\n\t\tr.Value[x] = &objects.String{Value: (*pairs)[x].String()}\n\t}\n\treturn &r, nil\n}", "title": "" }, { "docid": "87bff90dde2b895cdfffadcc2451ee51", "score": "0.44567776", "text": "func (s *TransactionResultPair) EncodeTo(e *xdr.Encoder) error {\n\tvar err error\n\tif err = s.TransactionHash.EncodeTo(e); err != nil {\n\t\treturn err\n\t}\n\tif err = s.Result.EncodeTo(e); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ebfe39e9d64b3e3a06590fcd2412d7a6", "score": "0.44489473", "text": "func (c *ComparableCursor) Pair() (Comparable, interface{}) {\n\treturn c.l.runts[c.i], c.l.values[c.i]\n}", "title": "" }, { "docid": "97c0013fb1b50cdb9798d7e4fa520bbe", "score": "0.44438666", "text": "func (z *Float64) SetPair(a, b float64) *Float64 {\n\tz.l = a\n\tz.r = b\n\treturn z\n}", "title": "" }, { "docid": "8a547c2b31c04c9a114ed6276a213e16", "score": "0.4392249", "text": "func (this floatValue) DescendantPairs(buffer []util.IPair) []util.IPair {\n\treturn buffer\n}", "title": "" }, { "docid": "1f618b2a62436d7906c1132250a5ed3b", "score": "0.43587795", "text": "func (h *profiles) convertAPIToKVPair(a unversioned.Resource) (*model.KVPair, error) {\n\treturn h.ConvertAPIToKVPair(a)\n}", "title": "" }, { "docid": "20fff70f53b4bfa9ea1ce7a253974109", "score": "0.434746", "text": "func (h *StringHash) EachPair(consumer func(key string, value interface{})) {\n\tfor _, e := range h.entries {\n\t\tconsumer(e.key, e.value)\n\t}\n}", "title": "" }, { "docid": "734495b92f36e5439c642b8a15d2fa8b", "score": "0.4345443", "text": "func ElementNext(e *list.Element,) *list.Element", "title": "" }, { "docid": "792dbacec486e4868865f507d29f01bf", "score": "0.43399784", "text": "func (w *WorkloadEndpointConverter) ConvertAPIToKVPair(a unversioned.Resource) (*model.KVPair, error) {\n\tah := a.(api.WorkloadEndpoint)\n\tk, err := w.ConvertMetadataToKey(ah.Metadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// IP networks are stored in the datastore in separate IPv4 and IPv6\n\t// fields. We normalise the network to ensure the IP is correctly\n\t// masked.\n\tipv4Nets := []net.IPNet{}\n\tipv6Nets := []net.IPNet{}\n\tfor _, n := range ah.Spec.IPNetworks {\n\t\tn = *(n.Network())\n\t\tif n.Version() == 4 {\n\t\t\tipv4Nets = append(ipv4Nets, n)\n\t\t} else {\n\t\t\tipv6Nets = append(ipv6Nets, n)\n\t\t}\n\t}\n\n\tipv4NAT := []model.IPNAT{}\n\tipv6NAT := []model.IPNAT{}\n\tfor _, n := range ah.Spec.IPNATs {\n\t\tnat := model.IPNAT{IntIP: n.InternalIP, ExtIP: n.ExternalIP}\n\t\tif n.InternalIP.Version() == 4 {\n\t\t\tipv4NAT = append(ipv4NAT, nat)\n\t\t} else {\n\t\t\tipv6NAT = append(ipv6NAT, nat)\n\t\t}\n\t}\n\n\tvar ports []model.EndpointPort\n\tfor _, port := range ah.Spec.Ports {\n\t\tports = append(ports, model.EndpointPort{\n\t\t\tName: port.Name,\n\t\t\tProtocol: port.Protocol,\n\t\t\tPort: port.Port,\n\t\t})\n\t}\n\n\td := model.KVPair{\n\t\tKey: k,\n\t\tValue: &model.WorkloadEndpoint{\n\t\t\tLabels: ah.Metadata.Labels,\n\t\t\tActiveInstanceID: ah.Metadata.ActiveInstanceID,\n\t\t\tState: \"active\",\n\t\t\tName: ah.Spec.InterfaceName,\n\t\t\tMac: ah.Spec.MAC,\n\t\t\tProfileIDs: ah.Spec.Profiles,\n\t\t\tIPv4Nets: ipv4Nets,\n\t\t\tIPv6Nets: ipv6Nets,\n\t\t\tIPv4NAT: ipv4NAT,\n\t\t\tIPv6NAT: ipv6NAT,\n\t\t\tIPv4Gateway: ah.Spec.IPv4Gateway,\n\t\t\tIPv6Gateway: ah.Spec.IPv6Gateway,\n\t\t\tPorts: ports,\n\t\t\tAllowSpoofedSourcePrefixes: ah.Spec.AllowSpoofedSourcePrefixes,\n\t\t},\n\t\tRevision: ah.Metadata.Revision,\n\t}\n\n\treturn &d, nil\n}", "title": "" }, { "docid": "ce209b2dd0eb2d8d30feb74d1812e957", "score": "0.43320468", "text": "func (s *InnerTransactionResultPair) EncodeTo(e *xdr.Encoder) error {\n\tvar err error\n\tif err = s.TransactionHash.EncodeTo(e); err != nil {\n\t\treturn err\n\t}\n\tif err = s.Result.EncodeTo(e); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e74671c8118b41ef608e90954dc07543", "score": "0.43218222", "text": "func (c *crypto) KeyPair(seed Seed) KeyPair {\n\tsk, pk := c.generateKeyPair(string(seed))\n\treturn KeyPair{\n\t\tPrivateKey: PrivateKey(base58.Encode(sk)),\n\t\tPublicKey: PublicKey(base58.Encode(pk)),\n\t}\n}", "title": "" }, { "docid": "f91ef808f49a342f46997bdd83605583", "score": "0.43188405", "text": "func (ps *pathStack) PushPair(sym runtime.Symbol, pr arithm.Pair) {\n\tpn := &pathNode{\n\t\tSymbol: sym,\n\t\tPair: pr,\n\t}\n\tps.Push(pn)\n}", "title": "" }, { "docid": "93790fb7413584d9683a51b1c8b7f9f1", "score": "0.43139064", "text": "func (up UniswapPair) MarshalJSON() ([]byte, error) {\n\tupp := uniswapPairPretty{\n\t\tID: up.ID,\n\t\tReserve0: up.Reserve0.String(),\n\t\tReserve1: up.Reserve1.String(),\n\t\tReserveUSD: up.ReserveUSD.String(),\n\t\tToken0: uniswapTokenPretty{\n\t\t\tID: up.Token0.ID,\n\t\t\tDecimals: strconv.FormatUint(up.Token0.Decimals, 10),\n\t\t},\n\t\tToken1: uniswapTokenPretty{\n\t\t\tID: up.Token1.ID,\n\t\t\tDecimals: strconv.FormatUint(up.Token1.Decimals, 10),\n\t\t},\n\t\tToken0Price: up.Token0Price.String(),\n\t\tToken1Price: up.Token1Price.String(),\n\t\tTotalSupply: up.TotalSupply.String(),\n\t}\n\n\treturn json.Marshal(upp)\n}", "title": "" }, { "docid": "ce936d432cc52cddebbdba4ae76f817c", "score": "0.4313544", "text": "func parsePairs(p []string) map[string]string {\n\tparams := map[string]string{}\n\tfor _, i := range p {\n\t\tparts := strings.Split(i, \"=\")\n\t\tif len(parts) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tparams[parts[0]] = parts[1]\n\t}\n\treturn params\n}", "title": "" }, { "docid": "0b88b3fdb2b602c526e898068d5b70fd", "score": "0.4312707", "text": "func StringOfPair(a Pair) string {\n\tif a == nil {\n\t\ta = nilPair{}\n\t} // Note: now StringOfPair(a) differs from fmt.Print(a)\n\n\tswitch t := a.(type) {\n\tcase fmt.Stringer: // nilPair, name, ID, Index, Cardinality, nest, kind, Head, Tail ...\n\t\treturn t.String()\n\tcase Pair:\n\t\taten, apep := t.Both()\n\t\treturn StringOfTwos(aten, apep)\n\tdefault:\n\t\treturn StringOfOnes(t)\n\t}\n}", "title": "" }, { "docid": "cf8fae3830af0e61ae065ab6df4391f7", "score": "0.42996106", "text": "func (codec *Codec) Encode(k, v any) (Pair, error) {\n\tvar bufK, bufV bytes.Buffer\n\tif err := codec.kEnc.Encode(k, &bufK); err != nil {\n\t\treturn Pair{}, fmt.Errorf(\"kv.Codec.Encode: couldn't Encode key %v: %v\", k, err)\n\t}\n\tif err := codec.vEnc.Encode(v, &bufV); err != nil {\n\t\treturn Pair{}, fmt.Errorf(\"kv.Codec.Encode: couldn't Encode value %v: %v\", v, err)\n\t}\n\treturn Pair{\n\t\tK: bufK.Bytes(),\n\t\tV: bufV.Bytes(),\n\t}, nil\n}", "title": "" }, { "docid": "fb6ff4108829315b0257dad047e0e982", "score": "0.42994353", "text": "func NewPair(key, value interface{}) *Pair {\n\treturn &Pair{\n\t\tkey: key,\n\t\tvalue: value,\n\t}\n}", "title": "" }, { "docid": "b003be386d63a9c131b3a3e7a16b7aee", "score": "0.42693883", "text": "func (v Values) Pairs() Pairs {\n\tif len(v) == 0 {\n\t\treturn nil\n\t}\n\tval := make(Pairs, 0, len(v)/2)\n\tsize := len(v)\n\tfor i := 0; i+1 < size; i += 2 {\n\t\tval = append(val, Pair{\n\t\t\tKey: v[i],\n\t\t\tValue: v[i+1],\n\t\t})\n\t}\n\treturn val\n}", "title": "" }, { "docid": "7e284b0390e5e00185a277d08e8dec1a", "score": "0.4250782", "text": "func serializeKVPairWithType(w io.Writer, kt uint8, keydata []byte,\n\tvalue []byte) error {\n\n\t// If the key has no data, then we write a blank slice.\n\tif keydata == nil {\n\t\tkeydata = []byte{}\n\t}\n\n\t// The final key to be written is: {type} || {keyData}\n\tserializedKey := append([]byte{kt}, keydata...)\n\treturn serializeKVpair(w, serializedKey, value)\n}", "title": "" }, { "docid": "e3f3a9b44715b50e6c14ce7e384bf943", "score": "0.42364308", "text": "func (pairs PairContainer) WriteAssociative(ctx types.Context) {\n\tcolumns, expressions := pairs.Values()\n\n\tfor i := range columns {\n\t\tif i != 0 {\n\t\t\tctx.Write(\", \")\n\t\t}\n\n\t\tcolumns[i].Write(ctx)\n\t\tctx.Write(\" = \")\n\t\texpressions[i].Write(ctx)\n\t}\n}", "title": "" }, { "docid": "18b0ac9da892ebe0f37ff58f0c2fe97f", "score": "0.42291638", "text": "func (m *FieldTypeMutation) Pair() (r schema.Pair, exists bool) {\n\tv := m.pair\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "d305c558872ef49293337f0b6018b47d", "score": "0.42166713", "text": "func MakeEndpointPair(tuple BaseTuple, processTuple *ProcessTuple) (src Endpoint, dst Endpoint) {\n\tsrc = Endpoint{\n\t\tIP: tuple.SrcIP.String(),\n\t\tPort: tuple.SrcPort,\n\t}\n\tdst = Endpoint{\n\t\tIP: tuple.DstIP.String(),\n\t\tPort: tuple.DstPort,\n\t}\n\tif processTuple != nil {\n\t\tsrc.Process = processTuple.Src\n\t\tdst.Process = processTuple.Dst\n\t}\n\treturn src, dst\n}", "title": "" }, { "docid": "03b5716ce1f79728f63faa041d453324", "score": "0.4208797", "text": "func (db *Database) AddPair(pair token.TokensPair) error {\n\tctx := context.TODO()\n\tsession, err := db.client.StartSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = session.StartTransaction()\n\tif err != nil {\n\t\tsession.EndSession(ctx)\n\t\treturn err\n\t}\n\tbSon, err := createBSON(pair)\n\tif err != nil {\n\t\tsession.EndSession(ctx)\n\t\treturn err\n\t}\n\tcollection := db.client.Database(\"JWT\").Collection(\"pairs\")\n\tres, err := collection.InsertOne(ctx, bSon)\n\tif err != nil {\n\t\tsession.EndSession(ctx)\n\t\treturn err\n\t}\n\tif err = session.CommitTransaction(context.TODO()); err != nil {\n\t\tsession.EndSession(ctx)\n\t\treturn err\n\t}\n\tlog.Print(res.InsertedID)\n\tsession.EndSession(ctx)\n\treturn nil\n}", "title": "" }, { "docid": "7a0016281963752577fadd8d75e8d30c", "score": "0.41933", "text": "func Pair2Str(pair *api.Pair) (v string, ok bool) {\n\tif pair == nil {\n\t\treturn \"\", false\n\t}\n\tif len(pair.Values) == 0 {\n\t\treturn \"\", true\n\t}\n\treturn pair.Values[0], true\n}", "title": "" }, { "docid": "87b8893e0b681854604243946050961c", "score": "0.41785735", "text": "func (mss ModeSeqs) AddPair(set, reset ansi.Seq) ModeSeqs {\n\tvar b [128]byte\n\tmss.Set = set.AppendTo(mss.Set)\n\tmss.Reset = append(reset.AppendTo(b[:0]), mss.Reset...)\n\treturn mss\n}", "title": "" }, { "docid": "4b9494ed964d63d965e7a27d0ebfe6c1", "score": "0.41651314", "text": "func Pair(key string, l Loggable) Loggable {\n\treturn LoggableMap{\n\t\tkey: l,\n\t}\n}", "title": "" }, { "docid": "2d04ddfb94902bac2aa145d4888fe560", "score": "0.413311", "text": "func writeElement(w io.Writer, element interface{}) error {\n\tvar scratch [8]byte\n\n\t// Attempt to write the element based on the concrete type via fast\n\t// type assertions first.\n\tswitch e := element.(type) {\n\tcase int32:\n\t\tb := scratch[0:4]\n\t\tbinary.LittleEndian.PutUint32(b, uint32(e))\n\t\t_, err := w.Write(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\tcase uint32:\n\t\tb := scratch[0:4]\n\t\tbinary.LittleEndian.PutUint32(b, e)\n\t\t_, err := w.Write(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\tcase int64:\n\t\tb := scratch[0:8]\n\t\tbinary.LittleEndian.PutUint64(b, uint64(e))\n\t\t_, err := w.Write(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\tcase uint64:\n\t\tb := scratch[0:8]\n\t\tbinary.LittleEndian.PutUint64(b, e)\n\t\t_, err := w.Write(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\tcase bool:\n\t\tb := scratch[0:1]\n\t\tif e == true {\n\t\t\tb[0] = 0x01\n\t\t} else {\n\t\t\tb[0] = 0x00\n\t\t}\n\t\t_, err := w.Write(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\t// Message header checksum.\n\tcase [4]byte:\n\t\t_, err := w.Write(e[:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\t// IP address.\n\tcase [16]byte:\n\t\t_, err := w.Write(e[:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\tcase *chainhash.Hash:\n\t\t_, err := w.Write(e[:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Fall back to the slower binary.Write if a fast path was not available\n\t// above.\n\treturn binary.Write(w, binary.LittleEndian, element)\n}", "title": "" }, { "docid": "9ca3675a3f1c075e2ba8f163589b9b54", "score": "0.41327846", "text": "func mapToPairs(m map[string]string) []string {\n\tvar i int\n\tp := make([]string, len(m)*2)\n\tfor k, v := range m {\n\t\tp[i] = k\n\t\tp[i+1] = v\n\t\ti += 2\n\t}\n\treturn p\n}", "title": "" }, { "docid": "9ca3675a3f1c075e2ba8f163589b9b54", "score": "0.41327846", "text": "func mapToPairs(m map[string]string) []string {\n\tvar i int\n\tp := make([]string, len(m)*2)\n\tfor k, v := range m {\n\t\tp[i] = k\n\t\tp[i+1] = v\n\t\ti += 2\n\t}\n\treturn p\n}", "title": "" }, { "docid": "2d665e1f283862936dfbda672a91e351", "score": "0.41320163", "text": "func NewAssetPairEntryExt(v LedgerVersion, value interface{}) (result AssetPairEntryExt, err error) {\n\tresult.V = v\n\tswitch LedgerVersion(v) {\n\tcase LedgerVersionEmptyVersion:\n\t\t// void\n\t}\n\treturn\n}", "title": "" }, { "docid": "57f2ae2352461a3c60154c75fed4f864", "score": "0.41190544", "text": "func (s *SecureChannelSession) Pair(pairingPassword []byte) error {\n\tsecretHash := pbkdf2.Key(norm.NFKD.Bytes(pairingPassword), norm.NFKD.Bytes([]byte(pairingSalt)), 50000, 32, sha256.New)\n\n\tchallenge := make([]byte, 32)\n\tif _, err := rand.Read(challenge); err != nil {\n\t\treturn err\n\t}\n\n\tresponse, err := s.pair(pairP1FirstStep, challenge)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmd := sha256.New()\n\tmd.Write(secretHash[:])\n\tmd.Write(challenge)\n\n\texpectedCryptogram := md.Sum(nil)\n\tcardCryptogram := response.Data[:32]\n\tcardChallenge := response.Data[32:64]\n\n\tif !bytes.Equal(expectedCryptogram, cardCryptogram) {\n\t\treturn fmt.Errorf(\"Invalid card cryptogram %v != %v\", expectedCryptogram, cardCryptogram)\n\t}\n\n\tmd.Reset()\n\tmd.Write(secretHash[:])\n\tmd.Write(cardChallenge)\n\tresponse, err = s.pair(pairP1LastStep, md.Sum(nil))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmd.Reset()\n\tmd.Write(secretHash[:])\n\tmd.Write(response.Data[1:])\n\ts.PairingKey = md.Sum(nil)\n\ts.PairingIndex = response.Data[0]\n\n\treturn nil\n}", "title": "" }, { "docid": "75f464270dd91c40612f51cd97c71900", "score": "0.41179457", "text": "func (s *BaseBundListener) ExitPair(ctx *PairContext) {}", "title": "" }, { "docid": "8fe7176b56fb2af1573dd2a103172bca", "score": "0.41174445", "text": "func (this *ObjectInnerPairs) Evaluate(item value.Value, context Context) (value.Value, error) {\n\targ, err := this.operands[0].Evaluate(item, context)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := removeMissing(arg)\n\n\tvar nameBuf [_NAME_CAP]string\n\tvar names []string\n\tif len(oa) <= len(nameBuf) {\n\t\tnames = nameBuf[0:0]\n\t} else {\n\t\tnames = _NAME_POOL.GetCapped(len(oa))\n\t\tdefer _NAME_POOL.Put(names)\n\t}\n\n\tfor name, _ := range oa {\n\t\tnames = append(names, name)\n\t}\n\n\tsort.Strings(names)\n\tra := make([]interface{}, len(names))\n\tfor i, n := range names {\n\t\tra[i] = map[string]interface{}{\"name\": n, \"val\": oa[n]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "title": "" }, { "docid": "c73a7d396caef05d42b12310d065e266", "score": "0.41071492", "text": "func (p *printer) Pair(username, password string) error {\n\t_, err := fmt.Fprintf(p.Out, \"| %-30s| %-60s|\\n\", username, password)\n\treturn err\n}", "title": "" }, { "docid": "b9c51bea32ce3cf3d09b11dc718b2cfb", "score": "0.4104769", "text": "func ProcessElements(reader ElementReader, writer ElementWriter, omap map[uint]Obj){\n element := reader.Next() // Read page contents\n for element.GetMp_elem().Swigcptr() != 0{\n etype := element.GetType()\n if etype == ElementE_image{\n // remove all images by skipping them\n }else if etype == ElementE_inline_image{ \n // remove all images by skipping them\n }else if etype == ElementE_path{\n // Set all paths to red color.\n gs := element.GetGState()\n gs.SetFillColorSpace(ColorSpaceCreateDeviceRGB())\n gs.SetFillColor(NewColorPt(1.0, 0.0, 0.0))\n writer.WriteElement(element)\n }else if etype == ElementE_text{ // Process text strings...\n // Set all text to blue color.\n gs := element.GetGState()\n gs.SetFillColorSpace(ColorSpaceCreateDeviceRGB())\n cp := NewColorPt(0.0, 0.0, 1.0)\n gs.SetFillColor(cp)\n writer.WriteElement(element)\n }else if etype == ElementE_form{ // Recursively process form XObjects\n o := element.GetXObject()\n omap[o.GetObjNum()] = o\n writer.WriteElement(element)\n }else{\n writer.WriteElement(element)\n\t\t}\n element = reader.Next()\n\t}\n}", "title": "" }, { "docid": "02cb8edbf39ce4767922739039cf8089", "score": "0.4101832", "text": "func NewPair(startingSymbol string, endingSymbol string) Pair {\n\tstartingSymbol = strings.ToUpper(startingSymbol)\n\tendingSymbol = strings.ToUpper(endingSymbol)\n\n\tif startingSymbol != endingSymbol && common.StringInSlice(startingSymbol, common.AvailableSymbols) && common.StringInSlice(endingSymbol, common.AvailableSymbols) && startingSymbol != endingSymbol {\n\t\treturn Pair{StartingSymbol: startingSymbol, EndingSymbol: endingSymbol}\n\t}\n\treturn Pair{}\n}", "title": "" }, { "docid": "96e0cf7be5ca7666be0d87c57fc647f9", "score": "0.41018075", "text": "func (fn *VetEmptyInitialSplitSdf) ProcessElement(rt *VetRTracker, i int, emit func(*VetRestriction)) sdf.ProcessContinuation {\n\trest := rt.Rest\n\trest.Key = nil\n\trest.Val = i\n\trest.ProcessElm = true\n\temit(rest)\n\treturn sdf.ResumeProcessingIn(1 * time.Second)\n}", "title": "" }, { "docid": "81c96c0b3dc8b4c914cd1a2fb3ffac9f", "score": "0.4085718", "text": "func (o GetInstanceV2ResultOutput) KeyPair() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstanceV2Result) string { return v.KeyPair }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8c74ab1f3389052e10cb735cdd36f15a", "score": "0.40814236", "text": "func (o LookupInfrastructureConfigurationResultOutput) KeyPair() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupInfrastructureConfigurationResult) *string { return v.KeyPair }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3e97881d7551ed8f99916c25350db2dc", "score": "0.4075435", "text": "func (u *UUIDEncrypter) DecodePair(uuid string) (int, int, error) {\n\ttext := make([]byte, aes.BlockSize)\n\ttext, err := hex.DecodeString(strings.Replace(uuid, \"-\", \"\", -1))\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tstream := cipher.NewCTR(u.c, u.iv)\n\tstream.XORKeyStream(text, text)\n\ta := int(binary.BigEndian.Uint32(text[8:12]))\n\tb := int(binary.BigEndian.Uint32(text[12:16]))\n\treturn a, b, nil\n}", "title": "" }, { "docid": "bd03bc024a600211d9d759d671c1f8ba", "score": "0.40716076", "text": "func (r *Redis) toPairs(zs []redis.Z) (pairs []*Pair) {\n\tfor _, z := range zs {\n\t\tpair := &Pair{}\n\t\tpair.Score = int64(z.Score)\n\t\tif member, ok := z.Member.(string); ok {\n\t\t\tpair.Member = member\n\t\t}\n\t\tpairs = append(pairs, pair)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bdf3c9c284a7be6ac2dd6b760e4ef00b", "score": "0.406765", "text": "func (p Pairs) AppendFormat(b []byte) []byte {\n\tfor i, pair := range p {\n\t\tb = append(b, pair.Key...)\n\t\tb = append(b, '=')\n\n\t\tif needsQuoting(pair.Value) {\n\t\t\tb = append(b, strconv.Quote(pair.Value)...)\n\t\t} else {\n\t\t\tb = append(b, pair.Value...)\n\t\t}\n\n\t\tif i+1 < len(p) {\n\t\t\tb = append(b, ' ')\n\t\t}\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "2d1937ab15c1fd21a2ef55aed8c094f6", "score": "0.4065451", "text": "func (fn *VetSdf) ProcessElement(rt *VetRTracker, i int, emit func(*VetRestriction)) sdf.ProcessContinuation {\n\trest := rt.Rest\n\trest.Key = nil\n\trest.Val = i\n\trest.ProcessElm = true\n\temit(rest)\n\treturn sdf.ResumeProcessingIn(1 * time.Second)\n}", "title": "" }, { "docid": "732dae9db78465f7eac00e97fec97278", "score": "0.4065054", "text": "func (m Metadata) Pairs() []string {\n\tvar kvs = make([]string, 0, len(m)*2)\n\tfor k, v := range m {\n\t\tkvs = append(kvs, k, v)\n\t}\n\treturn kvs\n}", "title": "" }, { "docid": "5734d8f503270e20852d39a56eb109ec", "score": "0.4064264", "text": "func getTokenPairs() TokenPairs {\n\ttokenPairs := TokenPairs{}\n\n\tWETH := Token{Symbol: \"WETH\", Address: HexToAddress(\"0x5d564669ab4cfd96b785d3d05e8c7d66a073daf0\")}\n\tZRX := Token{Symbol: \"ZRX\", Address: HexToAddress(\"0x9792845456a0075df8a03123e7dac62bb0f69440\")}\n\tEOS := Token{Symbol: \"EOS\", Address: HexToAddress(\"0x27cb1d4b335ec45512088eea990238344d776714\")}\n\n\tZRX_WETH := TokenPair{BaseToken: ZRX, QuoteToken: WETH}\n\tEOS_WETH := TokenPair{BaseToken: EOS, QuoteToken: WETH}\n\n\tZRX_WETH = NewPair(ZRX, WETH)\n\tEOS_WETH = NewPair(EOS, WETH)\n\n\ttokenPairs[\"ZRXWETH\"] = ZRX_WETH\n\ttokenPairs[\"EOSWETH\"] = EOS_WETH\n\treturn tokenPairs\n}", "title": "" }, { "docid": "0a1006051c2bd7f8ee821c8301226078", "score": "0.4062987", "text": "func (e *PairElement) Append(children ...Element) *PairElement {\n\te.Children = append(e.Children, children...)\n\treturn e\n}", "title": "" }, { "docid": "d8530fd3a57bfb8585539c596165b069", "score": "0.40625745", "text": "func pairs(f, x T) (r T) {\n\txv, o := x.(vector)\n\tif o == false {\n\t\tpanic(\"type\")\n\t}\n\treturn pairs2(f, xv.zero(), x)\n}", "title": "" }, { "docid": "3152dc89d2f3156c4dec6d9238d94bdc", "score": "0.40560547", "text": "func Append(p *Pair, key, value interface{}) *Pair {\n\treturn p.Append(key, value)\n}", "title": "" }, { "docid": "3152dc89d2f3156c4dec6d9238d94bdc", "score": "0.40560547", "text": "func Append(p *Pair, key, value interface{}) *Pair {\n\treturn p.Append(key, value)\n}", "title": "" }, { "docid": "e313549b800e5125cc61a145f40a0a7e", "score": "0.4048984", "text": "func KVPair(kv map[string]interface{}) *Log {\n\tl := newLog()\n\tfor k, v := range kv {\n\t\tl.kvpair = append(l.kvpair, k, v)\n\t}\n\treturn l\n}", "title": "" }, { "docid": "a274faa60edd43fea67c277ee031c2c9", "score": "0.40476054", "text": "func (pa *pairArray) append(key string, value string) {\n\tp := pair{\n\t\tkey: key,\n\t\tvalue: value,\n\t}\n\tpa.pairs = append(pa.pairs, p)\n}", "title": "" }, { "docid": "41c7c03e547da72e0d672ba56744f103", "score": "0.40409178", "text": "func NewOrderPair() *OrderPair {\n\treturn &OrderPair{*NewOrderUnit(), *NewOrderUnit()}\n}", "title": "" }, { "docid": "1f1fede934eaed5e98b37b507af4372a", "score": "0.40391293", "text": "func (*WhisperListElement_Pair) Descriptor() ([]byte, []int) {\n\treturn file_whisper_proto_rawDescGZIP(), []int{15, 0}\n}", "title": "" }, { "docid": "60e5691c57787a0ca8e79b47075c06fa", "score": "0.402854", "text": "func (b *ObjectBuilder) AddPairs(pairs map[string]string, omitEmpty bool, rawValues bool) (int, error) {\n\tn := 0\n\tif m, err := b.writePrefix(); err != nil {\n\t\treturn m, err\n\t} else {\n\t\tn += m\n\t}\n\n\tm, err := b.concatenateKeyValuePairs(pairs, omitEmpty, rawValues)\n\treturn n + m, err\n}", "title": "" }, { "docid": "8a59bc18d306341428d22e8d5b024d4a", "score": "0.40157574", "text": "func (a *Adapter1) SetPairable(v bool) error {\n\treturn a.SetProperty(\"Pairable\", v)\n}", "title": "" }, { "docid": "cec0da0b128f5e91df9139498d22c494", "score": "0.40046433", "text": "func (p *PairWiseIterator) NextPair() bool {\n\tif p.firstPair {\n\t\tp.firstPair = false\n\t\treturn true\n\t}\n\tif p.secondIdx == p.lastIdx {\n\t\treturn false\n\t}\n\tp.firstIdx++\n\tp.secondIdx++\n\treturn true\n}", "title": "" }, { "docid": "12503064a32a5fd45a1c5d3501ea2044", "score": "0.40009606", "text": "func (p PublicPrivateKeyPair) EncodePrivateKey() (string, error) {\n\tmBytes, err := x509.MarshalECPrivateKey(p.PrivateKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn hex.EncodeToString(mBytes), nil\n}", "title": "" }, { "docid": "fde93593abe14da42c40953b26de09c9", "score": "0.39823788", "text": "func addElementToMap(parameter *map[string]interface{}, key string, value interface{}) {\n\t(*parameter)[key] = map[string]interface{}{\n\t\t\"value\": value,\n\t}\n}", "title": "" }, { "docid": "02cbc26d8cd3bd6db720c43e6229a88c", "score": "0.3981406", "text": "func (e env) AsPairs() []string {\n\tvar m []string\n\tfor k, v := range e {\n\t\tm = append(m, k+\"=\"+v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "2b57e93ffe34e276422e15432f04add7", "score": "0.39786765", "text": "func (p *Pair) Append(key, val interface{}) *Pair {\n\treturn &Pair{\n\t\tprev: p,\n\t\tkey: key,\n\t\tvalue: val,\n\t}\n}", "title": "" }, { "docid": "2b57e93ffe34e276422e15432f04add7", "score": "0.39786765", "text": "func (p *Pair) Append(key, val interface{}) *Pair {\n\treturn &Pair{\n\t\tprev: p,\n\t\tkey: key,\n\t\tvalue: val,\n\t}\n}", "title": "" }, { "docid": "2bf22e82beeb15bd561b25ee6b4ee278", "score": "0.39765942", "text": "func (b *Bitfinex) CurrencyPairToSymbol(p pair.CurrencyPair) string {\n\treturn p.\n\t\tDisplay(b.RequestCurrencyPairFormat.Delimiter, b.RequestCurrencyPairFormat.Uppercase).\n\t\tString()\n}", "title": "" }, { "docid": "797d66c1b4dc7775f4e55976b7980889", "score": "0.39719734", "text": "func (c *Controller) CreatePair(guid string) (*token.TokensPair, error) {\n\tif len(guid) < 1 {\n\t\treturn nil, errors.New(\"GUID can't be empty\")\n\t}\n\tpattern := \"(\\\\{){0,1}[0-9a-fA-F]{8}\\\\-[0-9a-fA-F]{4}\\\\-[0-9a-fA-F]{4}\\\\-[0-9a-fA-F]{4}\\\\-[0-9a-fA-F]{12}(\\\\}){0,1}\"\n\tisGUID, err := regexp.Match(pattern, []byte(guid))\n\tif err != nil || isGUID == false {\n\t\treturn nil, errors.New(\"GUID should be like (a0e9b0af-206a-4cc9-92e2-0dc3e8676059)\")\n\t}\n\n\tpair, err := token.CreatePair(guid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = c.database.AddPair(*pair); err != nil {\n\t\treturn nil, err\n\t}\n\treturn pair, nil\n}", "title": "" }, { "docid": "dc36e6ae65466e1b7b3ca54c980d7f52", "score": "0.39633608", "text": "func (this *ObjectPairs) Evaluate(item value.Value, context Context) (value.Value, error) {\n\targ, err := this.operands[0].Evaluate(item, context)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\n\tvar nameBuf [_NAME_CAP]string\n\tvar names []string\n\tif len(oa) <= len(nameBuf) {\n\t\tnames = nameBuf[0:0]\n\t} else {\n\t\tnames = _NAME_POOL.GetCapped(len(oa))\n\t\tdefer _NAME_POOL.Put(names)\n\t}\n\n\tfor name, _ := range oa {\n\t\tnames = append(names, name)\n\t}\n\n\tsort.Strings(names)\n\tra := make([]interface{}, len(names))\n\tfor i, n := range names {\n\t\tra[i] = map[string]interface{}{\"name\": n, \"val\": oa[n]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "title": "" }, { "docid": "3ddf51bc739c574172ecff9b24cece5c", "score": "0.3963212", "text": "func (p *pretty)mapToXmlIndent(s *string, key string, value interface{}) error {\n\tvar endTag bool\n\tvar isSimple bool\n\n\tswitch value.(type) {\n\tcase map[string]interface{}, []byte, string, float64, bool, int, int32, int64, float32:\n\t\t*s += p.padding + `<` + key\n\t}\n\tswitch value.(type) {\n\tcase map[string]interface{}:\n\t\tvv := value.(map[string]interface{})\n\t\tlenvv := len(vv)\n\t\t// scan out attributes - keys have prepended hyphen, '-'\n\t\tvar cntAttr int\n\t\tfor k, v := range vv {\n\t\t\tif k[:1] == \"-\" {\n\t\t\t\tswitch v.(type) {\n\t\t\t\tcase string, float64, bool, int, int32, int64, float32:\n\t\t\t\t\t*s += ` ` + k[1:] + `=\"` + fmt.Sprintf(\"%v\", v) + `\"`\n\t\t\t\t\tcntAttr++\n\t\t\t\tcase []byte: // allow standard xml pkg []byte transform, as below\n\t\t\t\t\t*s += ` ` + k[1:] + `=\"` + fmt.Sprintf(\"%v\", string(v.([]byte))) + `\"`\n\t\t\t\t\tcntAttr++\n\t\t\t\tdefault:\n\t\t\t\t\treturn errors.New(\"invalid attribute value for: \" + k)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// only attributes?\n\t\tif cntAttr == lenvv {\n\t\t\tbreak\n\t\t}\n\t\t// simple element? Note: '#text\" is an invalid XML tag.\n\t\tif v, ok := vv[\"#text\"]; ok {\n\t\t\tif cntAttr+1 < lenvv {\n\t\t\t\treturn errors.New(\"#text key occurs with other non-attribute keys\")\n\t\t\t}\n\t\t\t*s += \">\" + fmt.Sprintf(\"%v\", v)\n\t\t\tendTag = true\n\t\t\tbreak\n\t\t}\n\t\t// close tag with possible attributes\n\t\t*s += \">\"\n\t\t*s += \"\\n\"\n\t\t// something more complex\n\t\tp.inMap = true\n\t\tfor k, v := range vv {\n\t\t\tif k[:1] == \"-\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch v.(type) {\n\t\t\tcase []interface{}:\n\t\t\tdefault:\n\t\t\t\tp.Indent()\n\t\t\t}\n\t\t\tp.mapToXmlIndent(s, k, v)\n\t\t\tswitch v.(type) {\n\t\t\tcase []interface{}:\t// handled in []interface{} case\n\t\t\tdefault:\n\t\t\t\tif !p.inList { p.Dedent() }\n\t\t\t}\n\t\t}\n\t\tp.inMap = false\n\t\tendTag = true\n\tcase []interface{}:\n\t\tp.inList = true\n\t\tfor _, v := range value.([]interface{}) {\n\t\t\tp.Indent()\n\t\t\tp.mapToXmlIndent(s, key, v)\n\t\t\tp.Dedent()\n\t\t}\n\t\tp.inList = false\n\t\treturn nil\n\tcase nil:\n\t\t// terminate the tag\n\t\tbreak\n\tdefault: // handle anything - even goofy stuff\n\t\tswitch value.(type) {\n\t\tcase string, float64, bool, int, int32, int64, float32:\n\t\t\t*s += \">\" + fmt.Sprintf(\"%v\", value)\n\t\tcase []byte: // NOTE: byte is just an alias for uint8\n\t\t\t// similar to how xml.Marshal handles []byte structure members\n\t\t\t*s += \">\" + fmt.Sprintf(\"%v\", string(value.([]byte)))\n\t\tdefault:\n\t\t\tvar v []byte\n\t\t\tvar err error\n\t\t\t\tv, err = xml.MarshalIndent(value,p.padding,p.indent)\n\t\t\tif err != nil {\n\t\t\t\t*s += \">UNKNOWN\"\n\t\t\t} else {\n\t\t\t\t*s += string(v)\n\t\t\t}\n\t\t}\n\t\tisSimple = true\n\t\tendTag = true\n\t}\n\n\tif endTag {\n\t\tif !isSimple {\n\t\t\tif p.inList { p.Dedent() }\n\t\t\t*s += p.padding\n\t\t}\n\t\tswitch value.(type) {\n\t\tcase map[string]interface{}, []byte, string, float64, bool, int, int32, int64, float32:\n\t\t\t*s += `</` + key + \">\"\n\t\t}\n\t\t// *s += \"</\" + key + \">\"\n\t} else {\n\t\t*s += \"/>\"\n\t}\n\t*s += \"\\n\"\n\tif !p.inList && !p.inMap {\n\t\tp.Dedent()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "440bfc2f25a519ddac2f0bf352ef21ea", "score": "0.39606205", "text": "func (ElementConstructor) Array(key string, a *Array) *Element {\n\tsize := uint32(1 + len(key) + 1)\n\tb := make([]byte, size)\n\telem := newElement(0, size)\n\t_, err := elements.Byte.Encode(0, b, '\\x04')\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = elements.CString.Encode(1, b, key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\telem.value.data = b\n\telem.value.d = a.doc\n\treturn elem\n}", "title": "" }, { "docid": "7f157866043584c5134ed4a4a11c9cc0", "score": "0.39504874", "text": "func (b *Bitfinex) SymbolToCurrencyPair(symbol string) (pair.CurrencyPair, error) {\n\tif len(symbol) != 6 {\n\t\treturn pair.CurrencyPair{}, fmt.Errorf(\"symbol %s is longer than expected\", symbol)\n\t}\n\tp := pair.NewCurrencyPair(symbol[0:3], symbol[3:])\n\treturn p.FormatPair(b.RequestCurrencyPairFormat.Delimiter, b.RequestCurrencyPairFormat.Uppercase), nil\n}", "title": "" }, { "docid": "5b1a1c90edeae2e228bd4975df37c4da", "score": "0.39488682", "text": "func (b *BloomFilter) HashElement(elem []byte) (uint64, uint64) {\n\treturn murmur3.Sum128(elem)\n}", "title": "" }, { "docid": "d868ca510d87c2416d3b376121decaa1", "score": "0.39401874", "text": "func (s *ScSpecTypeTuple) EncodeTo(e *xdr.Encoder) error {\n\tvar err error\n\tif _, err = e.EncodeUint(uint32(len(s.ValueTypes))); err != nil {\n\t\treturn err\n\t}\n\tfor i := 0; i < len(s.ValueTypes); i++ {\n\t\tif err = s.ValueTypes[i].EncodeTo(e); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f5a7a796ffd9ab62edd6a3161ff1dc26", "score": "0.39358357", "text": "func CreateVethPair(name1, name2 string) error {\n\treturn nil\n}", "title": "" } ]
d110018c7b5fd6df372401129b259441
SetE164PhoneNumber sets the E164PhoneNumber field's value.
[ { "docid": "4f2dbaff3d1528aac8251c979fca9077", "score": "0.8651583", "text": "func (s *PhoneNumber) SetE164PhoneNumber(v string) *PhoneNumber {\n\ts.E164PhoneNumber = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "fba373319c12016f009b8aeb3e94eaf4", "score": "0.84479666", "text": "func (s *OrderedPhoneNumber) SetE164PhoneNumber(v string) *OrderedPhoneNumber {\n\ts.E164PhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "9ff2dfc1bcd5750b0da69bf8cad1f248", "score": "0.80342054", "text": "func (s *SearchAvailablePhoneNumbersOutput) SetE164PhoneNumbers(v []*string) *SearchAvailablePhoneNumbersOutput {\n\ts.E164PhoneNumbers = v\n\treturn s\n}", "title": "" }, { "docid": "5dee1f576b429a78111c5ab90635429a", "score": "0.7721845", "text": "func (s *CreatePhoneNumberOrderInput) SetE164PhoneNumbers(v []*string) *CreatePhoneNumberOrderInput {\n\ts.E164PhoneNumbers = v\n\treturn s\n}", "title": "" }, { "docid": "cf6b82c1dee2bd73b5fb34aca38049c3", "score": "0.77084035", "text": "func (s *DisassociatePhoneNumbersFromVoiceConnectorGroupInput) SetE164PhoneNumbers(v []*string) *DisassociatePhoneNumbersFromVoiceConnectorGroupInput {\n\ts.E164PhoneNumbers = v\n\treturn s\n}", "title": "" }, { "docid": "80d7c8b3a66f5b8e6ffefd6910cffd17", "score": "0.7695564", "text": "func (s *DisassociatePhoneNumbersFromVoiceConnectorInput) SetE164PhoneNumbers(v []*string) *DisassociatePhoneNumbersFromVoiceConnectorInput {\n\ts.E164PhoneNumbers = v\n\treturn s\n}", "title": "" }, { "docid": "73a699c91823b798aebcec7d290084e8", "score": "0.76712435", "text": "func (s *AssociatePhoneNumbersWithVoiceConnectorInput) SetE164PhoneNumbers(v []*string) *AssociatePhoneNumbersWithVoiceConnectorInput {\n\ts.E164PhoneNumbers = v\n\treturn s\n}", "title": "" }, { "docid": "c3e880ce62b770a2c14c4aac91aeab62", "score": "0.7665288", "text": "func (s *AssociatePhoneNumbersWithVoiceConnectorGroupInput) SetE164PhoneNumbers(v []*string) *AssociatePhoneNumbersWithVoiceConnectorGroupInput {\n\ts.E164PhoneNumbers = v\n\treturn s\n}", "title": "" }, { "docid": "6cd8b416c2bb6b5ddda0f3d9e70fb7d5", "score": "0.55881506", "text": "func (o *GetSMSEventsParams) SetPhoneNumber(phoneNumber *string) {\n\to.PhoneNumber = phoneNumber\n}", "title": "" }, { "docid": "4f7b5e84aa6afdcbdf7ea41f1edc46bb", "score": "0.55264926", "text": "func (u OrganizationUpdater) SetPhoneNumber(phoneNumber string) OrganizationUpdater {\n\tu.fields[string(OrganizationDBSchema.PhoneNumber)] = phoneNumber\n\treturn u\n}", "title": "" }, { "docid": "9bd0bf0c21da9f19ec2df6cae5f32b53", "score": "0.54409915", "text": "func (m *subaccount) SetPhoneNumber(val *string) {\n\tm.phoneNumberField = val\n}", "title": "" }, { "docid": "803e968d8711cbca35a5e6e62f6173ab", "score": "0.54210556", "text": "func (o *PostPagesPageIdIncidentsIncidentIdSubscribersSubscriber) SetPhoneNumber(v string) {\n\to.PhoneNumber = &v\n}", "title": "" }, { "docid": "e2f2afb0d6098b53008e873bb20bb206", "score": "0.5419858", "text": "func (cu *CompanyUpdate) SetPhoneNumber(s string) *CompanyUpdate {\n\tcu.mutation.SetPhoneNumber(s)\n\treturn cu\n}", "title": "" }, { "docid": "f75f089078130a8bb838bae6ce08dae1", "score": "0.5391987", "text": "func (a *API) validateE164Format(phone string) bool {\n\t// match should never fail as long as regexp is valid\n\tmatched, _ := regexp.Match(e164Format, []byte(phone))\n\treturn matched\n}", "title": "" }, { "docid": "36848259db50aad6ae0093271d7ff187", "score": "0.5357811", "text": "func (cuo *CompanyUpdateOne) SetPhoneNumber(s string) *CompanyUpdateOne {\n\tcuo.mutation.SetPhoneNumber(s)\n\treturn cuo\n}", "title": "" }, { "docid": "5a6a70d1dcdc977431b67116eb176202", "score": "0.52972966", "text": "func (o *UpdateAccountRequest) SetPhoneNumber(v string) {\n\to.PhoneNumber = &v\n}", "title": "" }, { "docid": "083a9f2ae49de755b7ab3f3f813f98e8", "score": "0.5254409", "text": "func (o *GetRestapiV10AccountAccountIDExtensionExtensionIDCallLogParams) SetPhoneNumber(phoneNumber *string) {\n\to.PhoneNumber = phoneNumber\n}", "title": "" }, { "docid": "ad4128188f27fc84185bd2931af783df", "score": "0.5224191", "text": "func (o *Me) SetPhoneNumber(v string) {\n\to.PhoneNumber = &v\n}", "title": "" }, { "docid": "0d6bcf95f6ddd8fa6f315ab8f488c1b8", "score": "0.5155418", "text": "func (o *LinkTokenCreateRequestUser) SetPhoneNumber(v string) {\n\to.PhoneNumber = &v\n}", "title": "" }, { "docid": "affa005c2a77925e5fefdc740da2ac88", "score": "0.5151993", "text": "func (o *ClientCreate) SetPhoneNumber(v string) {\n\to.PhoneNumber.Set(&v)\n}", "title": "" }, { "docid": "12bc9862966c12b72723adbcfac51166", "score": "0.5096773", "text": "func (s *DNISEmergencyCallingConfiguration) SetEmergencyPhoneNumber(v string) *DNISEmergencyCallingConfiguration {\n\ts.EmergencyPhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "1f27860ab29dd3ff462897a6d33003cf", "score": "0.5043346", "text": "func isE164(fl FieldLevel) bool {\n\treturn e164Regex.MatchString(fl.Field().String())\n}", "title": "" }, { "docid": "318d1379c7b3bb46be5f0d28ec85ccff", "score": "0.49843338", "text": "func (s *Participant) SetPhoneNumber(v string) *Participant {\n\ts.PhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "19b6de87f95db56a77a7e5694c9db213", "score": "0.49799538", "text": "func (o *ContractUser) SetPhoneNumber(v string) {\n\to.PhoneNumber = &v\n}", "title": "" }, { "docid": "82a6111db005db957ada9a480cb89f66", "score": "0.494962", "text": "func (s *UpdatePhoneNumberOutput) SetPhoneNumber(v *PhoneNumber) *UpdatePhoneNumberOutput {\n\ts.PhoneNumber = v\n\treturn s\n}", "title": "" }, { "docid": "2121627e0a9388e25b0210b92d5600ac", "score": "0.4940474", "text": "func (o *ClientDetail) SetPhoneNumber(v string) {\n\to.PhoneNumber.Set(&v)\n}", "title": "" }, { "docid": "bc47394df32a632f5da3f89574f75ccc", "score": "0.4940119", "text": "func (s *GetPhoneNumberOutput) SetPhoneNumber(v *PhoneNumber) *GetPhoneNumberOutput {\n\ts.PhoneNumber = v\n\treturn s\n}", "title": "" }, { "docid": "4cd874d953b9e43a5281c545b09e9a68", "score": "0.49174577", "text": "func (s *RestorePhoneNumberOutput) SetPhoneNumber(v *PhoneNumber) *RestorePhoneNumberOutput {\n\ts.PhoneNumber = v\n\treturn s\n}", "title": "" }, { "docid": "8210321f526428b1c95db95d7105b321", "score": "0.48805672", "text": "func FormatNumber(phoneNumber string) (string, error) {\n\t// \"twilioPhoneNumber\": \"+1 832-981-1702\"\n\tvar digits []rune\n\tfor _, char := range phoneNumber {\n\t\tif unicode.IsDigit(char) {\n\t\t\tdigits = append(digits, char)\n\t\t}\n\t}\n\n\tif len(digits) == 11 {\n\t\tif digits[0] != '1' {\n\t\t\treturn phoneNumber, fmt.Errorf(\"Failed to convert phone number to E.164 format, wrong length (%d): %s\", len(digits), phoneNumber)\n\t\t}\n\t\tdigits = digits[1:]\n\t}\n\n\tif len(digits) != 10 {\n\t\treturn phoneNumber, fmt.Errorf(\"Failed to convert phone number to E.164 format, wrong length (%d): %s\", len(digits), phoneNumber)\n\t}\n\n\treturn fmt.Sprintf(\"+1 %s-%s-%s\", string(digits[0:3]), string(digits[3:6]), string(digits[6:])), nil\n}", "title": "" }, { "docid": "50e4fe70ed2a97ae4636d8d8bfee7dee", "score": "0.4830647", "text": "func (s *DNISEmergencyCallingConfiguration) SetTestPhoneNumber(v string) *DNISEmergencyCallingConfiguration {\n\ts.TestPhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "4ad6b8be72d99015f8fe006b6340f17c", "score": "0.4744933", "text": "func (m *Employee) SetPhoneNumber(value *string)() {\n err := m.GetBackingStore().Set(\"phoneNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "dc46cabaf1a491cea2d810a7039046f5", "score": "0.4637224", "text": "func (o *WhatsAppTemplatePhoneNumberButtonApiData) SetPhoneNumber(v string) {\n\to.PhoneNumber = v\n}", "title": "" }, { "docid": "2d1d6b60f0caf9f7d7ac308729490e54", "score": "0.46356192", "text": "func (m *ManagedDevice) SetPhoneNumber(value *string)() {\n m.phoneNumber = value\n}", "title": "" }, { "docid": "99601f4c1a296b10adde085655eb2942", "score": "0.46210548", "text": "func (iu *InviteeUpdate) SetPhone(s string) *InviteeUpdate {\n\tiu.mutation.SetPhone(s)\n\treturn iu\n}", "title": "" }, { "docid": "185405844291df27edd94b652ced446d", "score": "0.4584599", "text": "func (osu *OutboundShippingUpdate) SetConsigneePhone(s string) *OutboundShippingUpdate {\n\tosu.mutation.SetConsigneePhone(s)\n\treturn osu\n}", "title": "" }, { "docid": "f4b3dfab8af90f3f3d1ffaa4de0dbf61", "score": "0.45761475", "text": "func (su *SurgeryappointmentUpdate) SetPhone(s string) *SurgeryappointmentUpdate {\n\tsu.mutation.SetPhone(s)\n\treturn su\n}", "title": "" }, { "docid": "bafa84cafbed34ac9b1d5df373b70fec", "score": "0.45358622", "text": "func (iuo *InviteeUpdateOne) SetPhone(s string) *InviteeUpdateOne {\n\tiuo.mutation.SetPhone(s)\n\treturn iuo\n}", "title": "" }, { "docid": "62be838cab9d2026566113add991402b", "score": "0.4479927", "text": "func (suo *SurgeryappointmentUpdateOne) SetPhone(s string) *SurgeryappointmentUpdateOne {\n\tsuo.mutation.SetPhone(s)\n\treturn suo\n}", "title": "" }, { "docid": "d213b375c44d964bf9276095aecef92e", "score": "0.44424486", "text": "func (osc *OutboundShippingCreate) SetConsigneePhone(s string) *OutboundShippingCreate {\n\tosc.mutation.SetConsigneePhone(s)\n\treturn osc\n}", "title": "" }, { "docid": "329076c1da0bb663328e6c756ff38e6d", "score": "0.44284955", "text": "func (oauo *OrderAddressUpdateOne) SetPhone(s string) *OrderAddressUpdateOne {\n\toauo.mutation.SetPhone(s)\n\treturn oauo\n}", "title": "" }, { "docid": "805ddbabec2d27a3d61cf471c9cf808c", "score": "0.44235435", "text": "func (oau *OrderAddressUpdate) SetPhone(s string) *OrderAddressUpdate {\n\toau.mutation.SetPhone(s)\n\treturn oau\n}", "title": "" }, { "docid": "a07828c96fc80fa37ff60bb34a30d21a", "score": "0.44006413", "text": "func (suu *SysUserUpdate) SetPhone(s string) *SysUserUpdate {\n\tsuu.mutation.SetPhone(s)\n\treturn suu\n}", "title": "" }, { "docid": "640b01ba032ae1e6eb1772650529819c", "score": "0.43895778", "text": "func (m *DepEnrollmentProfile) SetSupportPhoneNumber(value *string)() {\n err := m.GetBackingStore().Set(\"supportPhoneNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c1d8feb59cece6615a364b3909118cba", "score": "0.4378465", "text": "func (client *Client) SetAuthenticationPhoneNumber(request *SetAuthenticationPhoneNumberRequest) (*Ok, error) {\n\t// Unlock receive function at the end of this function to mark received event as processed\n\tdefer client.Unlock(\"SetAuthenticationPhoneNumber\")\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"setAuthenticationPhoneNumber\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"phone_number\": request.PhoneNumber,\n\t\t\t\"allow_flash_call\": request.AllowFlashCall,\n\t\t\t\"is_current_phone_number\": request.IsCurrentPhoneNumber,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif result.Type == \"error\" {\n\t\treturn nil, buildResponseError(result.Data)\n\t}\n\n\treturn UnmarshalOk(result.Data)\n}", "title": "" }, { "docid": "67010ad5ad5c8c03d4b6cde58359b5d6", "score": "0.43782768", "text": "func (osuo *OutboundShippingUpdateOne) SetConsigneePhone(s string) *OutboundShippingUpdateOne {\n\tosuo.mutation.SetConsigneePhone(s)\n\treturn osuo\n}", "title": "" }, { "docid": "2afb88f0220c114c9d0e8e26b60fd4e9", "score": "0.43511167", "text": "func (suuo *SysUserUpdateOne) SetPhone(s string) *SysUserUpdateOne {\n\tsuuo.mutation.SetPhone(s)\n\treturn suuo\n}", "title": "" }, { "docid": "a3d11b973c25b5a20a6a6d8ec6eba3fd", "score": "0.43497247", "text": "func (vu *VeterinarianUpdate) SetPhone(s string) *VeterinarianUpdate {\n\tvu.mutation.SetPhone(s)\n\treturn vu\n}", "title": "" }, { "docid": "010f0d3d15fbbf6d9119dcff6e7909dc", "score": "0.43352365", "text": "func (s *PutVoiceConnectorProxyInput) SetFallBackPhoneNumber(v string) *PutVoiceConnectorProxyInput {\n\ts.FallBackPhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "4978b2381489c6cfbb322de8e8f3a5e6", "score": "0.43333143", "text": "func (s *Proxy) SetFallBackPhoneNumber(v string) *Proxy {\n\ts.FallBackPhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "24844d524e6339ca37882842d68b86f1", "score": "0.43284974", "text": "func (uu *UserUpdate) SetPhone(s string) *UserUpdate {\n\tuu.mutation.SetPhone(s)\n\treturn uu\n}", "title": "" }, { "docid": "cc3a15503fa9e53d8da397f1d1e526cd", "score": "0.4305544", "text": "func (o *PeoplePersonOfPeople) SetPhoneNumberOfficeExt(v string) {\n\to.PhoneNumberOfficeExt = &v\n}", "title": "" }, { "docid": "5ca70f8c9f34c9a4b8b948b94e98f675", "score": "0.42901367", "text": "func (o *ClientDetail) UnsetPhoneNumber() {\n\to.PhoneNumber.Unset()\n}", "title": "" }, { "docid": "646694f069896f75d4717052d0c5bf4f", "score": "0.4288539", "text": "func (m *UserMutation) SetPhone(s string) {\n\tm.phone = &s\n}", "title": "" }, { "docid": "646694f069896f75d4717052d0c5bf4f", "score": "0.4288539", "text": "func (m *UserMutation) SetPhone(s string) {\n\tm.phone = &s\n}", "title": "" }, { "docid": "47bb51983e1b3b57bb8d589e3006a935", "score": "0.42883408", "text": "func (m *ClubMutation) SetPhone(s string) {\n\tm.phone = &s\n}", "title": "" }, { "docid": "4eaa7a4d6eef998e09a9c86b17a6db32", "score": "0.42827263", "text": "func (m *DoctorMutation) SetPhone(s string) {\n\tm.phone = &s\n}", "title": "" }, { "docid": "5e3d1b08fa35c371709629905d23af22", "score": "0.42724073", "text": "func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne {\n\tuuo.mutation.SetPhone(s)\n\treturn uuo\n}", "title": "" }, { "docid": "2cf26b985f9d2a8fc8dd61d0d9f18422", "score": "0.42654282", "text": "func (vuo *VeterinarianUpdateOne) SetPhone(s string) *VeterinarianUpdateOne {\n\tvuo.mutation.SetPhone(s)\n\treturn vuo\n}", "title": "" }, { "docid": "8700dcb1494ebfddcf45f0b440d135be", "score": "0.42064485", "text": "func (o GetUserPhoneConfigOutput) DeskPhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserPhoneConfig) string { return v.DeskPhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "57af5e3d9eaf4ccf0569ed1d029ded35", "score": "0.41934144", "text": "func (o *CustomerFiscalEntitiesRequest) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "0e8103addab24fa0914dda251b0a5562", "score": "0.41917932", "text": "func (m *DetailMutation) SetPhone(s string) {\n\tm.phone = &s\n}", "title": "" }, { "docid": "4990a84185ab73208373b7f6d27da193", "score": "0.41897792", "text": "func (s *CreateChannelGroupOutput) SetEgressDomain(v string) *CreateChannelGroupOutput {\n\ts.EgressDomain = &v\n\treturn s\n}", "title": "" }, { "docid": "45c0552f99aa07b2cafcea64c41299b6", "score": "0.41878214", "text": "func (m *Office365GroupsActivityDetail) SetExchangeReceivedEmailCount(value *int64)() {\n err := m.GetBackingStore().Set(\"exchangeReceivedEmailCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f841f96c06c3d199f1f7442d245217b7", "score": "0.4182504", "text": "func (o *BusinessSettings) SetServerPhoneNumber(v string) {\n\to.ServerPhoneNumber = v\n}", "title": "" }, { "docid": "f2994ca12fe50b0acbdef05fd53e2136", "score": "0.4182125", "text": "func (o *PostPagesPageIdIncidentsIncidentIdSubscribersSubscriber) GetPhoneNumber() string {\n\tif o == nil || o.PhoneNumber == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneNumber\n}", "title": "" }, { "docid": "43e39c34ca9f577aeb4847ae4d5f43a3", "score": "0.41762826", "text": "func (uc *UserCreate) SetPhone(s string) *UserCreate {\n\tuc.mutation.SetPhone(s)\n\treturn uc\n}", "title": "" }, { "docid": "eccd326ce2d4153df3bfce72596708b6", "score": "0.41660944", "text": "func (cuo *CustomerUpdateOne) SetPhone(s string) *CustomerUpdateOne {\n\tcuo.mutation.SetPhone(s)\n\treturn cuo\n}", "title": "" }, { "docid": "142e43cc10ab3613a0d8e49d1c12197b", "score": "0.4157247", "text": "func (s *GetChannelGroupOutput) SetEgressDomain(v string) *GetChannelGroupOutput {\n\ts.EgressDomain = &v\n\treturn s\n}", "title": "" }, { "docid": "3a60736c8026b2d405b80d918021bab3", "score": "0.41521972", "text": "func (cu *CustomerUpdate) SetPhone(s string) *CustomerUpdate {\n\tcu.mutation.SetPhone(s)\n\treturn cu\n}", "title": "" }, { "docid": "1882443b46bbdaa577dcaff284b88d8a", "score": "0.41461155", "text": "func (o UserPhoneConfigOutput) DeskPhoneNumber() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserPhoneConfig) *string { return v.DeskPhoneNumber }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ec2e2956199fe78614b89b536d742ba0", "score": "0.4144756", "text": "func (emp *Employee) ChangePhone(newNumber string) {\n\temp.PhoneNumber = newNumber\n\tfmt.Println(\"New phone number set.\")\n}", "title": "" }, { "docid": "bc20fcf5e0bd5487558a72e0a4096cf6", "score": "0.4124673", "text": "func (s *UpdateChannelGroupOutput) SetEgressDomain(v string) *UpdateChannelGroupOutput {\n\ts.EgressDomain = &v\n\treturn s\n}", "title": "" }, { "docid": "3a97b7e6508094195dbb821406d7d14a", "score": "0.41161123", "text": "func ValidatePhoneNumber(fl validator.FieldLevel) bool {\n\tregion := fl.Parent().Elem().FieldByName(\"Region\")\n\tif !region.IsValid() {\n\t\treturn false\n\t}\n\tnum, err := libphonenumber.Parse(fl.Field().String(), region.String())\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn libphonenumber.IsValidNumber(num)\n}", "title": "" }, { "docid": "d8d1b3ad3b0ab8f65cfcd470f51e8407", "score": "0.41127843", "text": "func (s *CreateSipMediaApplicationCallInput) SetToPhoneNumber(v string) *CreateSipMediaApplicationCallInput {\n\ts.ToPhoneNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "95950b103021ede8d11a49d91f3bd043", "score": "0.41127178", "text": "func (o *CompanyFiscalInfoResponse) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "6088df50e6ba9a444105bd35b8ace44d", "score": "0.40897924", "text": "func (o QuickConnectQuickConnectConfigPhoneConfigOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QuickConnectQuickConnectConfigPhoneConfig) string { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c2cc6a5f1ab584f12185548cf2e43555", "score": "0.4070481", "text": "func (c *Client) ReleasePhoneNumber(ctx context.Context, params *ReleasePhoneNumberInput, optFns ...func(*Options)) (*ReleasePhoneNumberOutput, error) {\n\tif params == nil {\n\t\tparams = &ReleasePhoneNumberInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ReleasePhoneNumber\", params, optFns, c.addOperationReleasePhoneNumberMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ReleasePhoneNumberOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "82e269fdf58859987182d163ccb435c9", "score": "0.40619677", "text": "func (o *ClientCreate) UnsetPhoneNumber() {\n\to.PhoneNumber.Unset()\n}", "title": "" }, { "docid": "9198f37a1b9be3d782d5d6d33205e373", "score": "0.4058538", "text": "func (r *AlibabaEleEnterpriseCartnewQueryAPIRequest) SetPhone(_phone string) error {\n\tr._phone = _phone\n\tr.Set(\"phone\", _phone)\n\treturn nil\n}", "title": "" }, { "docid": "2c4b038f18b3369b78bbc3fca788b81b", "score": "0.40539187", "text": "func (o *PeoplePersonOfPeople) SetPhoneNumberOffice(v string) {\n\to.PhoneNumberOffice = &v\n}", "title": "" }, { "docid": "dffd5bb5dfed54ce079d9e28d990c5d7", "score": "0.4047725", "text": "func (o UserPhoneConfigPtrOutput) DeskPhoneNumber() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UserPhoneConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DeskPhoneNumber\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "308c07b30d8c90208cb1c0a37e016bcf", "score": "0.4043264", "text": "func (o *Me) GetPhoneNumber() string {\n\tif o == nil || o.PhoneNumber == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneNumber\n}", "title": "" }, { "docid": "301f1a91c8193cbca7305a0bbeddafba", "score": "0.40390542", "text": "func (m *EducationUser) SetMobilePhone(value *string)() {\n m.mobilePhone = value\n}", "title": "" }, { "docid": "24f207d5cb83c34dd90cdc21ad9eff54", "score": "0.40267324", "text": "func (m *ComplaintMutation) SetPhonenumber(s string) {\n\tm.phonenumber = &s\n}", "title": "" }, { "docid": "2226db2943c8628d4925fab50fe7b887", "score": "0.40248522", "text": "func (dal *DAL) SetUserPhone(user *model.User) error {\n\t_, err := dal.db.Model(user).\n\t\tSet(\"phone = ?phone\").\n\t\tUpdate()\n\n\treturn err\n}", "title": "" }, { "docid": "9e4f5f7c88a28bfe77bbb316ee9a0a35", "score": "0.4023452", "text": "func (o *PeoplePersonOfPeople) SetPhoneNumberFax(v string) {\n\to.PhoneNumberFax = &v\n}", "title": "" }, { "docid": "788c0b23d722e0171acfd18e5d218479", "score": "0.40141097", "text": "func (m *SurveyQuestionMutation) SetPhoneData(s string) {\n\tm.phone_data = &s\n}", "title": "" }, { "docid": "fa4a220116c225540d3b88278bb76261", "score": "0.4011665", "text": "func (cc *CustomerCreate) SetPhone(s string) *CustomerCreate {\n\tcc.mutation.SetPhone(s)\n\treturn cc\n}", "title": "" }, { "docid": "831af06872a8218f633c12d6712df17e", "score": "0.400496", "text": "func WithPhoneNumber(ctx context.Context, phoneNumber string) context.Context {\n\treturn context.WithValue(ctx, ctxKeyPhoneNumber, phoneNumber)\n}", "title": "" }, { "docid": "94e294c94553eaaf15f7d0d940856b5c", "score": "0.39969274", "text": "func (o *User) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "d77e3bbf6e807e0561d8bc0812f17e5e", "score": "0.39954776", "text": "func (m *Employee) SetMobilePhone(value *string)() {\n err := m.GetBackingStore().Set(\"mobilePhone\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "577c5b8eefcdbb0bf8efdb7eb39dd290", "score": "0.39915097", "text": "func (o GetQuickConnectQuickConnectConfigPhoneConfigOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetQuickConnectQuickConnectConfigPhoneConfig) string { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "75ddea18d5239328ec6aeeb5044e90b3", "score": "0.39852473", "text": "func (o VoiceReceiverOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VoiceReceiver) string { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "75ddea18d5239328ec6aeeb5044e90b3", "score": "0.39852473", "text": "func (o VoiceReceiverOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VoiceReceiver) string { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "486f322ce7a9bc461c3dc620c6609c4b", "score": "0.3983891", "text": "func (a *AuthenticationCodeInfo) GetPhoneNumber() (value string) {\n\tif a == nil {\n\t\treturn\n\t}\n\treturn a.PhoneNumber\n}", "title": "" }, { "docid": "267b362b8dc485b33f7b353e05707624", "score": "0.3971742", "text": "func (o *PeoplePersonOfPeople) SetPhoneNumberMobile(v string) {\n\to.PhoneNumberMobile = &v\n}", "title": "" }, { "docid": "3536849fad967ba7da29e4fa738c41b5", "score": "0.3965622", "text": "func (c *ContactDetails) GetPhoneNumber() string {\n\tif c == nil || c.PhoneNumber == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.PhoneNumber\n}", "title": "" }, { "docid": "e39c36a2f17cc245d712e6d1e5756fcb", "score": "0.39636153", "text": "func (o AlternativeContactOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AlternativeContact) pulumi.StringOutput { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6e360c73448fddb024409467d0c83d15", "score": "0.3962613", "text": "func (o SmsReceiverOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SmsReceiver) string { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6e360c73448fddb024409467d0c83d15", "score": "0.3962613", "text": "func (o SmsReceiverOutput) PhoneNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SmsReceiver) string { return v.PhoneNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "16078dda2ced4772d372e11017c5b55d", "score": "0.39554816", "text": "func (twilio *Twilio) UpdateIncomingPhoneNumber(phoneNumberSid string, req *IncomingPhoneNumber) (incomingPhoneNumberResponse *IncomingPhoneNumber, exception *Exception, err error) {\n\ttwilioURL := fmt.Sprintf(\"%v/Accounts/%v/IncomingPhoneNumbers/%v.json\", twilio.BaseUrl, twilio.AccountSid, phoneNumberSid)\n\n\tresponse, err := twilio.post(incomingPhoneNumberFormValues(req), twilioURL)\n\tif err != nil {\n\t\treturn incomingPhoneNumberResponse, exception, err\n\t}\n\tdefer response.Body.Close()\n\n\tresponseBody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn incomingPhoneNumberResponse, exception, err\n\t}\n\n\tif response.StatusCode != http.StatusOK {\n\t\texception := new(Exception)\n\t\terr = json.Unmarshal(responseBody, exception)\n\n\t\treturn incomingPhoneNumberResponse, exception, err\n\n\t}\n\n\tincomingPhoneNumberResponse = new(IncomingPhoneNumber)\n\terr = json.Unmarshal(responseBody, incomingPhoneNumberResponse)\n\treturn incomingPhoneNumberResponse, exception, err\n}", "title": "" } ]
ae832e03b4f004b31f264ffee1a9a3bc
handleTCPConnection services an individual TCP connection for the Graphite input.
[ { "docid": "c094b990dca75b446c83ba89f1fe601a", "score": "0.7262487", "text": "func (s *Service) handleTCPConnection(conn net.Conn) {\n\tdefer s.wg.Done()\n\tdefer conn.Close()\n\tdefer atomic.AddInt64(&s.stats.ActiveConnections, -1)\n\tdefer s.untrackConnection(conn)\n\tatomic.AddInt64(&s.stats.ActiveConnections, 1)\n\tatomic.AddInt64(&s.stats.HandledConnections, 1)\n\ts.trackConnection(conn)\n\n\treader := bufio.NewReader(conn)\n\n\tfor {\n\t\t// Read up to the next newline.\n\t\tbuf, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Trim the buffer, even though there should be no padding\n\t\tline := strings.TrimSpace(string(buf))\n\n\t\tatomic.AddInt64(&s.stats.PointsReceived, 1)\n\t\tatomic.AddInt64(&s.stats.BytesReceived, int64(len(buf)))\n\t\ts.handleLine(line)\n\t}\n}", "title": "" } ]
[ { "docid": "18458ba754f988b6d4d467640bbe0bd0", "score": "0.764903", "text": "func (g *Graphite) handleTCPConnection(conn net.Conn) {\n\tdefer conn.Close()\n\n\tvar metric string\n\treader := bufio.NewReader(conn)\n\tfor {\n\t\tbuf, _, err := reader.ReadLine()\n\t\tif err == io.EOF {\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": err,\n\t\t\t\t\"buf\": buf,\n\t\t\t}).Warn(\"unable to read TCP payload\")\n\t\t\treturn\n\t\t}\n\n\t\tmetric = strings.TrimSpace(string(buf))\n\t\tdatapoint, err := g.parseLine(metric)\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": err,\n\t\t\t\t\"metric\": metric,\n\t\t\t}).Info(\"unable to parse line\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Debug(datapoint)\n\t\tg.Writer.Write(datapoint)\n\t}\n}", "title": "" }, { "docid": "6860512ca30a03c6c5a061bb33f78739", "score": "0.7093363", "text": "func (s *Service) handleTCPConnection(conn net.Conn) {\n\tdefer conn.Close()\n\tdefer s.wg.Done()\n\n\treader := bufio.NewReader(conn)\n\n\tfor {\n\t\t// Read up to the next newline.\n\t\tbuf, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Trim the buffer, even though there should be no padding\n\t\tline := strings.TrimSpace(string(buf))\n\n\t\ts.handleLine(line)\n\t}\n}", "title": "" }, { "docid": "920ef9222904e2c661d72971f28361aa", "score": "0.6878633", "text": "func handleConnectionTCP(player *PlayerTCP) {\n\tfmt.Println(\"Handled new connection:\", player.GetAddr())\n\n\tb := make([]byte, 1024)\n\tvar buf bytes.Buffer\n\n\tfor {\n\t\t// Handling a single packet\n\t\tfor {\n\t\t\tlen, err := player.Read(b)\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tfmt.Println(\"Connection closed!\")\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"Read error:\", err)\n\t\t\t\t}\n\n\t\t\t\t// Disconnect logic\n\t\t\t\tplayer.Disconnect()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbuf.Write(b[:len])\n\n\t\t\tif len < 1024 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Packet has been fully read, dispatch\n\t\tresponse := server.HandlePacket(player, &buf)\n\n\t\tfmt.Println(\"Writing response of length\", response.Len())\n\t\tplayer.Write(response.Bytes())\n\n\t\t// Trigger broadcast, if any\n\t\tplayer.Room().broadcast <- true\n\t}\n}", "title": "" }, { "docid": "88940bb9f1d6567bad701d6a228f67c5", "score": "0.67923653", "text": "func handleTCPConn(conn net.Conn) {\n\tvar remoteConn *net.TCPConn\n\tvar err error\n\n\tlog.Printf(\"Accepting TCP connection from %s with destination of %s\", conn.RemoteAddr().String(), conn.LocalAddr().String())\n\tif machineSourceIP.Equal(conn.LocalAddr().(*net.TCPAddr).IP) || conn.LocalAddr().(*net.TCPAddr).IP.String() == \"127.0.0.1\" {\n\t\tremoteConn, err = conn.(*semitproxy.Conn).DialOriginalDestination(false, &machineSourceIP, &virtualMachineIP)\n\t} else {\n\t\tremoteConn, err = conn.(*semitproxy.Conn).DialOriginalDestination(true, &machineSourceIP, &virtualMachineIP)\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"Failed to connect to original destination [%s]: %s\", conn.LocalAddr().String(), err)\n\t} else {\n\t\tdefer remoteConn.Close()\n\t\tdefer conn.Close()\n\t}\n\n\tvar streamWait sync.WaitGroup\n\tstreamWait.Add(2)\n\n\tstreamConn := func(dst io.Writer, src io.Reader) {\n\t\tio.Copy(dst, src)\n\t\tstreamWait.Done()\n\t}\n\n\tgo streamConn(remoteConn, conn)\n\tgo streamConn(conn, remoteConn)\n\n\tstreamWait.Wait()\n}", "title": "" }, { "docid": "3f2017a8d3fac875c1aed7c3774d515a", "score": "0.6771939", "text": "func (handler *TCPConnectionHandler) HandleTCPConnection(conn net.Conn) {\n\tdefer conn.Close()\n\tconnectionKey := conn.RemoteAddr().String() + \";\" + string(rand.Intn(1000000))\n\tconnections.Store(connectionKey, conn)\n\tatomic.AddUint32(&activeConnectionCount, 1)\n\tdefer connections.Delete(connectionKey)\n\tdefer atomic.AddUint32(&activeConnectionCount, ^uint32(0)) // This is the documented way to decrement a uint atomically\n\tbuf := make([]byte, 1024)\n\tfor {\n\t\treqLen, err := conn.Read(buf)\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Printf(\"Error reading from %s: %s\\n\", conn.RemoteAddr().String(), err)\n\t\t\t}\n\t\t\tlog.Printf(\"Connection to %s lost\\n\", conn.RemoteAddr().String())\n\t\t\treturn\n\t\t}\n\t\tfor i := 0; i < reqLen; i++ {\n\t\t\tif handler.Parser.ParseByte(buf[i]) {\n\t\t\t\tpoints := handler.Parser.ParsePacket()\n\t\t\t\tfor _, point := range points {\n\t\t\t\t\thandler.Publisher.Publish(point)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "25de28f2fdba15808a9cf9ca2c4604c0", "score": "0.6650341", "text": "func handleTCPConnection(conn *net.TCPConn, noteChannel chan synth.DelayedNoteData) {\n\tdefer conn.Close()\n\tbuffer := make([]byte, 256)\n\tfor {\n\t\trlen, err := conn.Read(buffer)\n\t\tif err == io.EOF {\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\tfmt.Println(\"Failed to read from TCP socket: \" + err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif rlen > 0 {\n\t\t\tstrs := strings.Split(strings.TrimSpace(string(buffer[:rlen])), \"\\n\")\n\t\t\tfor _, v := range strs {\n\t\t\t\terr = HandleMessage(v, noteChannel)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Failed to handle message \\\"\" + v + \"\\\": \" + err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbuffer = make([]byte, 256)\n\t\ttime.Sleep(1 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "1c964cf3d1b94c49b7457e3dbfcb0e62", "score": "0.6565162", "text": "func HandleTCPConnection(client Conn, backendAddr *net.TCPAddr, quit <-chan struct{}) error {\n\tbackend, err := net.DialTCP(\"tcp\", nil, backendAddr)\n\tif err != nil {\n\t\tif errIsConnectionRefused(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"can't forward traffic to backend tcp/%v: %s\", backendAddr, err)\n\t}\n\treturn ProxyStream(client, backend, quit)\n}", "title": "" }, { "docid": "8b9347b2ff8dd780b8360ceb3578e549", "score": "0.65457463", "text": "func handleTCPClient(conn net.Conn) {\n\tdefer conn.Close()\n\tdefer fmt.Println(\"closing connection for \", conn.RemoteAddr())\n\n\tvar buf [2048]byte\n\tfor {\n\t\t// read input \n\t\t_, err := conn.Read(buf[0:])\t\t\n\t\t// if there was an error exit\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t// convert message to string\n\t\tmessage := string(buf[0:])\n\t\tfmt.Println(message)\t\t\n\n\t\t// compose reponse to message\n\t\tresponse := composeResponse(message, strings.Split(conn.LocalAddr().String(), \":\")[0])\n\t\t// write the response to the socket\n\t\t_, err2 := conn.Write(response.ToBytes())\n\t\tif err2 != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "875655cc70edc2ffcccc1aa9304d3f83", "score": "0.6521168", "text": "func (c *CiscoTelemetryMDT) handleTCPClient(conn net.Conn) error {\n\t// TCP Dialout telemetry framing header\n\tvar hdr struct {\n\t\tMsgType uint16\n\t\tMsgEncap uint16\n\t\tMsgHdrVersion uint16\n\t\tMsgFlags uint16\n\t\tMsgLen uint32\n\t}\n\n\tvar payload bytes.Buffer\n\n\tfor {\n\t\t// Read and validate dialout telemetry header\n\t\tif err := binary.Read(conn, binary.BigEndian, &hdr); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmaxMsgSize := tcpMaxMsgLen\n\t\tif c.MaxMsgSize > 0 {\n\t\t\tmaxMsgSize = uint32(c.MaxMsgSize)\n\t\t}\n\n\t\tif hdr.MsgLen > maxMsgSize {\n\t\t\treturn fmt.Errorf(\"dialout packet too long: %v\", hdr.MsgLen)\n\t\t} else if hdr.MsgFlags != 0 {\n\t\t\treturn fmt.Errorf(\"invalid dialout flags: %v\", hdr.MsgFlags)\n\t\t}\n\n\t\t// Read and handle telemetry packet\n\t\tpayload.Reset()\n\t\tif size, err := payload.ReadFrom(io.LimitReader(conn, int64(hdr.MsgLen))); size != int64(hdr.MsgLen) {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"TCP dialout premature EOF\")\n\t\t}\n\n\t\tc.handleTelemetry(payload.Bytes())\n\t}\n}", "title": "" }, { "docid": "409f7b4c85f9e848c58e3a13b1c7657d", "score": "0.65147144", "text": "func acceptTCPConn(l *net.TCPListener, ds *DataSink) {\n for {\n // Listen for an incoming connection.\n conn, err := l.Accept()\n if err != nil {\n fmt.Println(\"Error accepting: \", err.Error())\n os.Exit(1)\n }\n // Handle connections in a new goroutine.\n go handleRequest(conn, ds)\n }\n}", "title": "" }, { "docid": "5d89e6cc7274def390ff24425e035f92", "score": "0.6498048", "text": "func (l *TCPListener) AcceptTCP() (*TCPConn, error) {}", "title": "" }, { "docid": "7371a391a68cc7f4324059f87e2cc648", "score": "0.6347961", "text": "func HandleTCPRequest(rw net.Conn) {\n\tdefer func() {\n\t\tatomic.AddInt64(&counter, -1)\n\t}()\n\n\tcount := atomic.AddInt64(&counter, +1)\n\tif count > 20 {\n\t\treturn\n\t}\n\n\tdType := &network.RequestType{}\n\terr := dType.Read(rw)\n\tif err != nil {\n\t\tlog.Errorf(\"read request type failed: %s\", err)\n\t\treturn\n\t}\n\n\tlog.WithFields(log.Fields{\"request_type\": dType.Type}).Debug(\"tcpserver got request type\")\n\tvar response interface{}\n\n\tswitch dType.Type {\n\tcase network.RequestTypeFullNode:\n\t\tif service.IsNodePaused() {\n\t\t\treturn\n\t\t}\n\t\terr = Type1(rw)\n\n\tcase network.RequestTypeNotFullNode:\n\t\tif service.IsNodePaused() {\n\t\t\treturn\n\t\t}\n\t\tresponse, err = Type2(rw)\n\n\tcase network.RequestTypeStopNetwork:\n\t\treq := &network.StopNetworkRequest{}\n\t\tif err = req.Read(rw); err == nil {\n\t\t\terr = Type3(req, rw)\n\t\t}\n\n\tcase network.RequestTypeConfirmation:\n\t\tif service.IsNodePaused() {\n\t\t\treturn\n\t\t}\n\n\t\treq := &network.ConfirmRequest{}\n\t\tif err = req.Read(rw); err == nil {\n\t\t\tresponse, err = Type4(req)\n\t\t}\n\n\tcase network.RequestTypeBlockCollection:\n\t\treq := &network.GetBodiesRequest{}\n\t\tif err = req.Read(rw); err == nil {\n\t\t\terr = Type7(req, rw)\n\t\t}\n\n\tcase network.RequestTypeMaxBlock:\n\t\tresponse, err = Type10()\n\t}\n\n\tif err != nil || response == nil {\n\t\treturn\n\t}\n\n\tlog.WithFields(log.Fields{\"response\": response, \"request_type\": dType.Type}).Debug(\"tcpserver responded\")\n\tif err = response.(network.SelfReaderWriter).Write(rw); err != nil {\n\t\t// err = SendRequest(response, rw)\n\t\tlog.Errorf(\"tcpserver handle error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "7c66c46690c81af41d54b6fe1ed41f62", "score": "0.6338361", "text": "func (m *Manager) HandleTCPConn(conn net.Conn, srcAddr netip.AddrPort) {\n\ts := dnsTCPSession{\n\t\tm: m,\n\t\tconn: conn,\n\t\tsrcAddr: srcAddr,\n\t\tresponses: make(chan []byte),\n\t\treadClosing: make(chan struct{}),\n\t}\n\ts.ctx, s.closeCtx = context.WithCancel(m.ctx)\n\tgo s.handleReads()\n\ts.handleWrites()\n}", "title": "" }, { "docid": "bb1211d3fd91a7887171842911516d27", "score": "0.6320507", "text": "func (service *DispatcherService) ServeTCPConnection(conn net.Conn) {\n\ttcpConn := conn.(*net.TCPConn)\n\ttcpConn.SetReadBuffer(consts.DISPATCHER_CLIENT_PROXY_READ_BUFFER_SIZE)\n\ttcpConn.SetWriteBuffer(consts.DISPATCHER_CLIENT_PROXY_WRITE_BUFFER_SIZE)\n\n\tclient := newDispatcherClientProxy(service, conn)\n\tclient.serve()\n}", "title": "" }, { "docid": "dcc3843489a9f59f2ffcb3075a8c19b0", "score": "0.63132674", "text": "func (s *TcpServer) handleConnection(conn net.Conn) {\n\tatomic.AddInt64(&s.stats.connections, 1)\n\tdefer atomic.AddInt64(&s.stats.connections, -1)\n\tdefer conn.Close()\n\n\tr := bufio.NewReader(conn)\n\n\tfor {\n\t\tline, err := r.ReadBytes('\\n')\n\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\n\t\t\t}\n\t\t}\n\n\t\tif *debug {\n\t\t\tlog.Printf(\"DEBUG: Received TCP message: bytes=%d client=%s\",\n\t\t\t\tlen(line), conn.RemoteAddr())\n\t\t}\n\n\t\ts.handleMessage(line, conn.RemoteAddr())\n\t}\n}", "title": "" }, { "docid": "17099022b57d950bd7c42d5ce5aad40d", "score": "0.62526375", "text": "func HandleConnection(conn net.Conn, clientId string) {\n b := bufio.NewReader(conn)\n for {\n line, err := b.ReadBytes('\\n')\n if err != nil {\n conn.Close()\n // if the connection is lost, delete its listening channel from global map\n DeleteConnetionRequest(clientId)\n break\n }\n ParseContent(string(line), clientId)\n }\n}", "title": "" }, { "docid": "cacd43363283898b23d0a2d00f036ac6", "score": "0.618377", "text": "func (t *TCPServer) handleConnection(conn net.Conn) {\n\tdefer conn.Close()\n\n\treader := bufio.NewReader(conn)\n\tfor {\n\t\t// Read up to the next newline.\n\t\tbuf, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Trim the buffer, even though there should be no padding\n\t\tline := strings.TrimSpace(string(buf))\n\n\t\t// Parse it.\n\t\tpoint, err := t.parser.Parse(line)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"unable to parse data: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Send the data to database\n\t\tt.writer.WriteSeries(t.Database, \"\", []influxdb.Point{point})\n\t}\n}", "title": "" }, { "docid": "651bf89ff5475f4240401729025de0ba", "score": "0.61655104", "text": "func handleTCPConnection(c net.Conn) {\n\tlogger.Debug().Msg(\"Handling incoming socket: \"+ c.RemoteAddr().String())\n\n\t// Create buffer to which data can be written\n\t// Ensure buffer can be read with bufio package from Golang\n\tdataBuffer := make([]byte, 4096)\n\tbufferReader := bufio.NewReader(c)\n\t\n\t// Create loop to get the size of the message and thereby outputting the entire message\n\tfor {\n\t\t// Start preparing capability to read from the generated buffer\n\t\tbufferByteReader, err := bufferReader.ReadByte()\n\t\tif err != nil {\n\t\t\t// fmt.Println(\"Error hit in bytereader: \",err)\n\t\t\tlogger.Error().Err(err).Msg(\"Error hit in bytereader function\")\n\t\t\treturn\n\t\t}\n\n\t\t// Based on the amount of data buffered in the dataBuffer buffer we can get data from it\n\t\t// For some reason this function only works with bufferByteReader active\n\t\tdataInBuffer := bufferReader.Buffered()\n\t\t// fmt.Println(\"Buffersize is \", dataInBuffer)\n\n\t\t// read the full message, or return an error\n\t\treadBytes, err := io.ReadFull(bufferReader, dataBuffer[:int(dataInBuffer)])\n\t\tif err != nil {\n\t\t\t// fmt.Println(\"Error hit in readbyte function: \",err)\n\t\t\tlogger.Error().Err(err).Msg(\"Error hit in readbyte function\")\n\t\t\treturn\n\t\t}\n\n\t\t// Convert buffer to string if there is more than 0 bytes available to convert\n\t\tif bufferByteReader > 0 && readBytes > 0 {\n\t\t\t// Convert data to string for logging purposes\n\t\t\tbytesConvertedToString := string(dataBuffer[:int(dataInBuffer)])\n\n\t\t\t// Validate message index based on available log messages\n\t\t\tmessageIndex := strings.IndexAny(bytesConvertedToString, \"ABCDEGHMNOPQRSTUV\")\n\t\t\tlogger.Trace().Str(\"Index\", string(messageIndex)).Msg(\"Calculated messageindex for message\")\n\n\t\t\t// Use index to get full message\n\t\t\tindexedMessage := string(dataBuffer[messageIndex:int(dataInBuffer)])\n\t\t\t\n\t\t\t// OR Create regexp to ensure all unwanted characters are stripped\n\t\t\t// avrRegex, err := regexp.Compile(\"[^a-zA-Z0-9|\\n ]+\")\n\t\t\t// if err != nil {\n\t\t\t// \tlogger.Trace().Err(err).Msg(\"regular expression error\")\n\t\t\t// }\n\t\t\t// processedAvrString := avrRegex.ReplaceAllString(bytesConvertedToString, \"\")\n\t\t\t\n\t\t\t// Strip of all unwanted characters from the regular expression\n\t\t\t// stripProcessedString := strings.TrimLeft(processedAvrString, \"abcdefghikjlmnopqrstuvwxyz1234567890{}?!@#$%^&*()[]123456789�\")\t\t\t\n\t\t\t\n\t\t\t// Optional loglines for debugging\n\t\t\tlogger.Trace().Str(\"bytesize\", string(bufferByteReader)).Msg(\"BufferBytereader calculated\")\n\n\t\t\t// Create goroutine that stores data to different functions\n\t\t\tgo writeToDataStore(indexedMessage)\n\t\t\t// go writeToRemoteEndpoint(stringConversion)\n\t\t\tc.Close()\n\t\t\treturn\n\t\t}\n\t\tc.Close()\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "1da0587910be4ade7f695bab8e6a2fff", "score": "0.6116998", "text": "func (gate *GSGate) ServeTCPConnection(conn net.Conn) {\n\t// called from TCP Service\n\tvlog.Debug(\"%s: new connection %s ...\", gate, conn.RemoteAddr())\n\tclient := newGSClient(gate, conn)\n\tgate.clientsLock.Lock()\n\tgate.clients[client.ClientID] = client // add client to gate clients-map\n\tgate.clientsLock.Unlock()\n\n\tbootEntityKindName := gameserverConfig.BootEntityKind\n\tentityID := nilSpace.CreateEntity(bootEntityKindName, Vec3{})\n\t// set entity client\n\n\tclient.setOwner(entityID)\n\tclient.letClientCreateEntity(bootEntityKindName, entityID) // create entity on client side\n\tentityID.notifyGetClient(gate.ID, client.ClientID)\n\n\tgo client.serve()\n}", "title": "" }, { "docid": "e8a8f515a1f22b3baf2779b4a3cd7773", "score": "0.6060491", "text": "func TCPAsClient(m *model.BaseConfiguration, tc model.TCPconnection) {\n\tTCPReady = make(chan bool)\n\tvar err error\n\thosting := &net.TCPAddr{\n\t\tIP: net.ParseIP(tc.Host),\n\t\tPort: tc.RemotePort,\n\t}\n\tm.TCPConn, err = net.DialTCP(\"tcp\", nil, hosting)\n\tif err != nil {\n\t\tinfLog := fmt.Sprintf(\"Connection TCP is error : %+v\", err)\n\t\tfmt.Println(infLog)\n\t\tos.Exit(2)\n\t}\n\tgo func() {\n\t\tfmt.Println(\"New Server Connection is Accepted\")\n\t\tTCPReady <- true\n\t}()\n\ttime.Sleep(1 * time.Second)\n}", "title": "" }, { "docid": "10578cc30b17d46b02e5515fe5dbda11", "score": "0.6044992", "text": "func NewTCPConnectionHandler(publisher *DatapointPublisher, parser *PacketParser) *TCPConnectionHandler {\n\treturn &TCPConnectionHandler{\n\t\tPublisher: publisher,\n\t\tParser: parser,\n\t}\n}", "title": "" }, { "docid": "7ad12c2842d46db603934bd77b6ab846", "score": "0.60440266", "text": "func TCPServerConnection() {\n\t// Listening TCP Connection on port 4040\n\tln, err := net.Listen(\"tcp\", \":4040\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer ln.Close()\n\n\t//Show message in the server\n\tfmt.Println(\"Server is running\")\n\n\t// Geting all record from csv file\n\tallRecord := loadCsvData()\n\n\tfor {\n\t\t// New Connection starting\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t//Show message to the client\n\t\t_, err = conn.Write([]byte(\"Connected to server, send the query in the form of JSON object\\n\\n\"))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor {\n\t\t\t// We are making a buffer to read data and then reading the data provided by the client\n\t\t\tbs := make([]byte, 1024)\n\t\t\tn, err := conn.Read(bs)\n\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Geting query date and region separately\n\t\t\tqueryRegion, queryDate := processInputData(string(bs[:n]))\n\n\t\t\t// Performing selection on the basis of query\n\t\t\tresultRecord := selection(allRecord, queryDate, queryRegion)\n\n\t\t\t// converting data into json and []byte to send it to the client\n\t\t\tresultInByte := processOutputData(resultRecord)\n\n\t\t\t_, err = conn.Write(resultInByte[:])\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tconn.Close()\n\t}\n}", "title": "" }, { "docid": "61f923ecfc5b48bd41cf37dc20eaf602", "score": "0.6036433", "text": "func TCPListen() {\n\tgo reportConnections()\n\tgo writerThread()\n\tgo monitorConnection()\n\tcanConfigs, err := configs.LoadConfigs()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading CAN configs: %s\", err)\n\t}\n\tconnListener, err := net.Listen(connType, fmt.Sprintf(\"%s:%d\", connHost, connPort))\n\tif err != nil {\n\t\tlog.Fatalf(\"Error listening on TCP port: %s\", err)\n\t}\n\tdefer connListener.Close()\n\tlog.Printf(\"Listening on %s:%d TCP\\n\", connHost, connPort)\n\tconsecutiveFailures := 0\n\tfor {\n\t\tconn, err := connListener.Accept()\n\t\tif err == nil {\n\t\t\tconsecutiveFailures = 0\n\t\t\tlog.Println(\"Received connection from\", conn.RemoteAddr().String())\n\t\t\thandler := NewTCPConnectionHandler(GetDatapointPublisher(), NewPacketParser(canConfigs))\n\t\t\tgo handler.HandleTCPConnection(conn)\n\t\t} else {\n\t\t\tconsecutiveFailures++\n\t\t\tlog.Println(\"Error accepting connection in function Listen: listener/listener.go\")\n\t\t\tlog.Printf(\"Consecutive connection failures: %d\\n\", consecutiveFailures)\n\t\t\tif consecutiveFailures >= 5 {\n\t\t\t\tlog.Fatal(\"Consecutive connection failures exceeded maximum limit\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f55176055b20686e95716b9f4d2ef9e7", "score": "0.6007501", "text": "func handle_client_tcp(conn *net.TCPConn) {\n\t// network loop\n\tstreamid := atomic.AddUint32(&_streamid, 1)\n\tseqid := uint32(0)\n\tClientStreamInstance.connect(streamid, conn)\n\n\tdefer func() {\n\t\tClientStreamInstance.close(streamid)\n\t}()\n\n\tfor {\n\t\theader := make([]byte, 2)\n\t\tn, err := io.ReadFull(conn, header)\n\t\tif err != nil {\n\t\t\tutils.WARN(\"error receiving header, bytes:\", n, \"reason:\", err)\n\t\t\treturn\n\t\t}\n\t\tsize := binary.BigEndian.Uint16(header)\n\t\tdata := make([]byte, size)\n\t\tn, err = io.ReadFull(conn, data)\n\n\t\tif err != nil {\n\t\t\tutils.WARN(\"error receiving msg, bytes:\", n, \"reason:\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// 完整packet\n\t\tdata = append(header, data...)\n\t\tfragments := fragment(data)\n\t\tfor k := range fragments {\n\t\t\tseqid++\n\t\t\tClientStreamInstance.send(streamid, seqid, fragments[k])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9cb5bd3e1d6b623823bd87a063281bcf", "score": "0.5983186", "text": "func (s *Server) handleInboundConnection(c net.Conn) {\n\tlog.WithFields(log.Fields{\n\t\t\"pkg\": \"nntp-server\",\n\t\t\"addr\": c.RemoteAddr(),\n\t}).Debug(\"handling inbound connection\")\n\tvar nc Conn\n\tnc = newInboundConn(s, c)\n\terr := nc.Negotiate(true)\n\tif err == nil {\n\t\t// do they want to stream?\n\t\tif nc.WantsStreaming() {\n\t\t\t// yeeeeeh let's stream\n\t\t\tvar chnl chan ArticleEntry\n\t\t\tchnl, err = nc.StartStreaming()\n\t\t\t// for inbound we will recv messages\n\t\t\tgo s.recvInboundStream(chnl)\n\t\t\tnc.StreamAndQuit()\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"pkg\": \"nntp-server\",\n\t\t\t\t\"addr\": c.RemoteAddr(),\n\t\t\t}).Info(\"streaming finished\")\n\t\t\treturn\n\t\t} else {\n\t\t\t// handle non streaming commands\n\t\t\tnc.ProcessInbound(s)\n\t\t}\n\t} else {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pkg\": \"nntp-server\",\n\t\t\t\"addr\": c.RemoteAddr(),\n\t\t}).Warn(\"failed to negotiate with inbound connection\", err)\n\t\tc.Close()\n\t}\n}", "title": "" }, { "docid": "45e9d05d878fdd9cec9459d511184ab7", "score": "0.5965391", "text": "func (p *Processor) HandleConnection(conn net.Conn, hdfs net.Conn) {\n\tutil.Log(\"Handling connection...\")\n\tfor {\n\t\tbyteBuffer := make([]byte, 1024)\n\t\tbytesRead := 0\n\t\tvar read_err error\n\n\t\t//if we're still on the first packet, we can't read in the length\n\t\tif(!p.HandledFirstPacket) {\n\t\t\t//fmt.Println(\"HAVE NOT HANDLED FIRST PACKET YET.\")\n\t\t\tbytesRead, read_err = conn.Read(byteBuffer);\n\t\t\tbyteBuffer = byteBuffer[0:bytesRead]\n\t\t\tp.HandledFirstPacket = true\n\t\t} else {\n\t\t\t//fmt.Println(\"Processing a full request.\");\n\t\t\tlen, err := p.readLength(conn)\n\t\t\tutil.DebugLog(\"Read length: \" + string(len));\n\n\t\t\tif err != nil || len == 0 {\n\t\t\t\t//if we get an error reading the length, that\n\t\t\t\t//means the socket was closed, so we will \n\t\t\t\t//just return this socket\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbyteBuffer = make([]byte, len-4)\n\t\t\tbytesRead, read_err = conn.Read(byteBuffer)\n\t\t\tbyteBuffer = byteBuffer[0:bytesRead]\n\n\t\t\tvar finalBuffer bytes.Buffer\n\t\t\tbinary.Write(&finalBuffer, binary.BigEndian, len)\n\t\t\tfinalBuffer.Write(byteBuffer)\n\n\t\t\tbyteBuffer = finalBuffer.Bytes()\n\t\t}\n\t\t/* else if p.PacketsProcessed == 1 {\n\t\t\tauthenticationLength, _ := p.readLength(conn)\n\t\t\tbyteBuffer = make([]byte, authenticationLength)\n\t\t} */\n\n\n\t\tif read_err != nil {\n\t\t\tutil.LogError(read_err.Error())\n\t\t\t//fmt.Println(\"error: \", read_err.Error())\n\t\t\tconn.Close()\n\t\t\thdfs.Close()\n\t\t\treturn\n\t\t}\n\n\t\tutil.Log(\"Handling the packet...\")\n\n\t\tTIMECOUNTER = time.Now()\n\t\t//fmt.Println(\"BYTES READ: \", bytesRead)\n\t\t\n\t\tif bytesRead > 0 {\n\t\t\trp := namenode_rpc.NewRequestPacket()\n\t\t\terr := rp.Load(byteBuffer)\n\t\t\tif err != nil {\n\t\t\t\tutil.LogError(\"Error in loading request packet: \" + err.Error())\n\t\t\t} else {\n\t\t\t\t//first we process the request in case we want to \n\t\t\t\t//weed out anything (e.g. port numbers for the DN)\n\t\t\t\trp, modified := p.Preprocess(rp)\n\t\t\t\t//fmt.Println(\"Method name: \", string(rp.MethodName))\n\t\t\t\t//fmt.Println(\"Modified: \", modified)\n\n\t\t\t\t//deal with checking the cache\n\t\t\t\tresp := p.Process(rp)\n\t\t\t\tlog.Println(\"Resp: \", resp)\n\n\t\t\t\t//if a response was found in one the caches currently running\n\t\t\t\t//we can respond to the client immediately, we don't need to \n\t\t\t\t//wait for HDFS do anything\n\t\t\t\tif resp != nil {\n\t\t\t\t\tfmt.Println(\"Cache hit!\")\n\t\t\t\t\tconn.Write(resp.Bytes())\n\t\t\t\t\t//hdfs.Write(byteBuffer)\n\t\t\t\t\t//fmt.Println(\"Sent to client, time elapsed (ns): \", time.Now().Sub(TIMECOUNTER).Nanoseconds())\n\t\t\t\t\tp.cachedTimeLogger.Println(time.Now().Sub(TIMECOUNTER).\n\t\t\t\t\tNanoseconds())\n\t\t\t\t} else {\n\t\t\t\t\t//fmt.Println(\"Cache miss!, methodname: \", string(rp.MethodName))\n\t\t\t\t\t//if it wasn't found in any of the\n\t\t\t\t\t//caches, we should cache the request\n\t\t\t\t\tutil.Log(\"Trying to cache a request...\")\n\t\t\t\t\t//fmt.Println(\"Rp.length: \", rp.Length)\n\t\t\t\t\tp.CacheRequest(rp)\n\n\t\t\t\t\tutil.Log(\"not found in cache\")\n\n\t\t\t\t\t/*\n\t\t\t\t\tif !reflect.DeepEqual(byteBuffer, rp.Bytes()) {\n\t\t\t\t\t\tfmt.Println(\"Byte comparison FAILED\")\n\t\t\t\t\t\tif modified {\n\t\t\t\t\t\t\tp.randomLogger.Println(\"not equal: \")\n\t\t\t\t\t\t\tp.randomLogger.Println(\"correct: \", byteBuffer)\n\t\t\t\t\t\t\tp.randomLogger.Println(\"bytes(): \", rp.Bytes())\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Byte comparison SUCCESSFUL\")\n\t\t\t\t\t} */\n\t\t\t\t\tif !modified {\n\t\t\t\t\t\thdfs.Write(byteBuffer)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//fmt.Println(\"modified true, byteBuffer: \", byteBuffer)\n\t\t\t\t\t\t//fmt.Println(\"loadedBytes: \", rp.LoadedBytes())\n\t\t\t\t\t\thdfs.Write(rp.LoadedBytes())\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t}\n\t\t\tp.PacketsProcessed += 1\n\t\t}\n\t}\n}", "title": "" }, { "docid": "192492bb509f2762e471572a1625c904", "score": "0.5939604", "text": "func (t *UnixInput) handleConnection(conn net.Conn) {\n\tdeliverer := t.ir.NewDeliverer(\"\")\n\tsr := t.ir.NewSplitterRunner(\"\")\n\n\tdefer func() {\n\t\tconn.Close()\n\t\tt.wg.Done()\n\t\tdeliverer.Done()\n\t}()\n\n\tif !sr.UseMsgBytes() {\n\t\tname := t.ir.Name()\n\t\tpackDec := func(pack *PipelinePack) {\n\t\t\tpack.Message.SetHostname(\"localhost\")\n\t\t\tpack.Message.SetType(name)\n\t\t}\n\t\tsr.SetPackDecorator(packDec)\n\t}\n\n\tstopped := false\n\tfor !stopped {\n\t\tconn.SetReadDeadline(time.Now().Add(5 * time.Second))\n\t\tselect {\n\t\tcase <-t.stopChan:\n\t\t\tstopped = true\n\t\tdefault:\n\t\t\terr := sr.SplitStream(conn, deliverer)\n\t\t\tif err != nil {\n\t\t\t\tif neterr, ok := err.(net.Error); ok && neterr.Timeout() {\n\t\t\t\t\t// keep the connection open, we are just checking to see if\n\t\t\t\t\t// we are shutting down: Issue #354\n\t\t\t\t} else {\n\t\t\t\t\tstopped = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "690358b322d7963fb719fdf91517e53d", "score": "0.5924503", "text": "func (s *Sock) handleTcpConn(conn net.Conn) {\n\tdefer conn.Close()\n\trd := bufio.NewReaderSize(conn, s.c.TcpBatchMaxBytes)\n\tfor {\n\t\tconn.SetReadDeadline(time.Now().Add(time.Duration(s.c.TcpReadTimeout)))\n\t\tb, err := rd.ReadSlice(_logSeparator)\n\n\t\tif err == nil && len(b) <= _logLancerHeaderLen {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err == nil {\n\t\t\te := s.preproccess(b[:len(b)-1])\n\t\t\tif e != nil {\n\t\t\t\ts.writeToReadChan(e)\n\t\t\t\tflowmonitor.Fm.AddEvent(e, \"log-agent.input.sock\", \"OK\", \"received\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// conn closed and return EOF\n\t\tif err == io.EOF {\n\t\t\te := s.preproccess(b)\n\t\t\tif e != nil {\n\t\t\t\ts.writeToReadChan(e)\n\t\t\t\tflowmonitor.Fm.AddEvent(e, \"log-agent.input.sock\", \"OK\", \"received\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Info(\"get EOF from conn, close conn\")\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(\"read from tcp conn error(%v). close conn\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "8caa578a7fd74df72b917f5ae3c35314", "score": "0.588008", "text": "func handleConnection(conn net.Conn) {\n\tfmt.Println(\"new connection\")\n\n\tmessage, err := util.GetProto(conn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmessage_type := message.GetMessageType()\n\tswitch message_type {\n\tcase comm.OhHai_HEARTBEAT_REQUEST:\n\t\tfmt.Println(\"Hearbeat\")\n\t\theartBeatResponse(conn)\n\tcase comm.OhHai_READ_REQUEST:\n\t\tfmt.Println(\"Read\")\n\t\treadResponse(message.GetReadRequest(), conn)\n\tcase comm.OhHai_WRITE_REQUEST:\n\t\tfmt.Println(\"Write\")\n\tdefault:\n\t\tfmt.Println(\"WAT?\")\n\t}\n}", "title": "" }, { "docid": "b5277e55850da4440ec019f3d9a5dc38", "score": "0.58746123", "text": "func httpConHandler(TcpConnection *net.TCPConn, ConID int) {\n\n\t//Handle Http stuff\n\tHttpReader := httputil.NewServerConn(TcpConnection, nil)\n\tHandleHTTPClient(HttpReader, ConID, TcpConnection.RemoteAddr().String(), \"http\")\n}", "title": "" }, { "docid": "f635e6262a1f50258577c16c19c8a5c0", "score": "0.58710814", "text": "func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWorkConn, encKey []byte) {\n\txl := pxy.xl\n\tbaseConfig := pxy.baseProxyConfig\n\tvar (\n\t\tremote io.ReadWriteCloser\n\t\terr error\n\t)\n\tremote = workConn\n\tif pxy.limiter != nil {\n\t\tremote = libio.WrapReadWriteCloser(limit.NewReader(workConn, pxy.limiter), limit.NewWriter(workConn, pxy.limiter), func() error {\n\t\t\treturn workConn.Close()\n\t\t})\n\t}\n\n\txl.Trace(\"handle tcp work connection, use_encryption: %t, use_compression: %t\",\n\t\tbaseConfig.UseEncryption, baseConfig.UseCompression)\n\tif baseConfig.UseEncryption {\n\t\tremote, err = libio.WithEncryption(remote, encKey)\n\t\tif err != nil {\n\t\t\tworkConn.Close()\n\t\t\txl.Error(\"create encryption stream error: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\tvar compressionResourceRecycleFn func()\n\tif baseConfig.UseCompression {\n\t\tremote, compressionResourceRecycleFn = libio.WithCompressionFromPool(remote)\n\t}\n\n\t// check if we need to send proxy protocol info\n\tvar extraInfo []byte\n\tif baseConfig.ProxyProtocolVersion != \"\" {\n\t\tif m.SrcAddr != \"\" && m.SrcPort != 0 {\n\t\t\tif m.DstAddr == \"\" {\n\t\t\t\tm.DstAddr = \"127.0.0.1\"\n\t\t\t}\n\t\t\tsrcAddr, _ := net.ResolveTCPAddr(\"tcp\", net.JoinHostPort(m.SrcAddr, strconv.Itoa(int(m.SrcPort))))\n\t\t\tdstAddr, _ := net.ResolveTCPAddr(\"tcp\", net.JoinHostPort(m.DstAddr, strconv.Itoa(int(m.DstPort))))\n\t\t\th := &pp.Header{\n\t\t\t\tCommand: pp.PROXY,\n\t\t\t\tSourceAddr: srcAddr,\n\t\t\t\tDestinationAddr: dstAddr,\n\t\t\t}\n\n\t\t\tif strings.Contains(m.SrcAddr, \".\") {\n\t\t\t\th.TransportProtocol = pp.TCPv4\n\t\t\t} else {\n\t\t\t\th.TransportProtocol = pp.TCPv6\n\t\t\t}\n\n\t\t\tif baseConfig.ProxyProtocolVersion == \"v1\" {\n\t\t\t\th.Version = 1\n\t\t\t} else if baseConfig.ProxyProtocolVersion == \"v2\" {\n\t\t\t\th.Version = 2\n\t\t\t}\n\n\t\t\tbuf := bytes.NewBuffer(nil)\n\t\t\t_, _ = h.WriteTo(buf)\n\t\t\textraInfo = buf.Bytes()\n\t\t}\n\t}\n\n\tif pxy.proxyPlugin != nil {\n\t\t// if plugin is set, let plugin handle connection first\n\t\txl.Debug(\"handle by plugin: %s\", pxy.proxyPlugin.Name())\n\t\tpxy.proxyPlugin.Handle(remote, workConn, extraInfo)\n\t\txl.Debug(\"handle by plugin finished\")\n\t\treturn\n\t}\n\n\tlocalConn, err := libdial.Dial(\n\t\tnet.JoinHostPort(baseConfig.LocalIP, strconv.Itoa(baseConfig.LocalPort)),\n\t\tlibdial.WithTimeout(10*time.Second),\n\t)\n\tif err != nil {\n\t\tworkConn.Close()\n\t\txl.Error(\"connect to local service [%s:%d] error: %v\", baseConfig.LocalIP, baseConfig.LocalPort, err)\n\t\treturn\n\t}\n\n\txl.Debug(\"join connections, localConn(l[%s] r[%s]) workConn(l[%s] r[%s])\", localConn.LocalAddr().String(),\n\t\tlocalConn.RemoteAddr().String(), workConn.LocalAddr().String(), workConn.RemoteAddr().String())\n\n\tif len(extraInfo) > 0 {\n\t\tif _, err := localConn.Write(extraInfo); err != nil {\n\t\t\tworkConn.Close()\n\t\t\txl.Error(\"write extraInfo to local conn error: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t_, _, errs := libio.Join(localConn, remote)\n\txl.Debug(\"join connections closed\")\n\tif len(errs) > 0 {\n\t\txl.Trace(\"join connections errors: %v\", errs)\n\t}\n\tif compressionResourceRecycleFn != nil {\n\t\tcompressionResourceRecycleFn()\n\t}\n}", "title": "" }, { "docid": "6aa1a288db5c06002a012f94e656d8cc", "score": "0.5870057", "text": "func (p *TCPPeer) handleConn() {\n\tvar err error\n\n\tp.server.register <- p\n\n\tgo p.handleQueues()\n\tgo p.handleIncoming()\n\t// When a new peer is connected we send out our version immediately.\n\terr = p.SendVersion()\n\tif err == nil {\n\t\tr := io.NewBinReaderFromIO(p.conn)\n\t\tfor {\n\t\t\tmsg := &Message{StateRootInHeader: p.server.stateRootInHeader}\n\t\t\terr = msg.Decode(r)\n\n\t\t\tif err == payload.ErrTooManyHeaders {\n\t\t\t\tp.server.log.Warn(\"not all headers were processed\")\n\t\t\t\tr.Err = nil\n\t\t\t} else if err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tp.incoming <- msg\n\t\t}\n\t}\n\tp.Disconnect(err)\n\tclose(p.incoming)\n}", "title": "" }, { "docid": "773408a3d4a5ba9721c015646173496d", "score": "0.5868789", "text": "func StartTCPConnection(m *model.BaseConfiguration, repo repository.IRepositoryTCP, respon func(isodata.Message) isodata.Message) {\n\tServiceID = m.ServiceID\n\tdelivery := tcpdelivery{\n\t\tbaseconf: m,\n\t\tresponfunc: respon,\n\t\tsend: repo,\n\t}\n\n\t// create triggered Activation tcp\n\t// poolingConnection, _ := ants.NewPool(m.PoolSize)\n\n\tfor {\n\t\t<-TCPReady\n\t\tfmt.Println()\n\t\tfmt.Println(\"TCP Connection is Ready\")\n\n\t\tbuff1 := make([]byte, 1)\n\t\tbuff2 := make([]byte, 1)\n\t\ttime.Sleep(2 * time.Second)\n\t\tfor {\n\t\t\t// read Input\n\t\t\t// get first byte\n\t\t\t_, err := m.TCPConn.Read(buff1)\n\t\t\tif err != nil {\n\t\t\t\terr = errors.New(\"Error TCP Connection when Read First byte : \" + err.Error())\n\t\t\t\tfmt.Print(err)\n\t\t\t\tbreak // testing\n\t\t\t}\n\t\t\tlenbit1, _ := strconv.ParseInt(fmt.Sprintf(\"%x\", buff1), 16, 64)\n\t\t\t// get second byte\n\t\t\t_, err = m.TCPConn.Read(buff2)\n\t\t\tif err != nil {\n\t\t\t\terr = errors.New(\"Error TCP Connection when Read Second byte : \" + err.Error())\n\t\t\t\tfmt.Print(err)\n\t\t\t\tbreak // testing\n\t\t\t}\n\t\t\tlenbit2, err := strconv.ParseInt(fmt.Sprintf(\"%x\", buff2), 16, 64)\n\t\t\tif err != nil {\n\t\t\t\terr = errors.New(\"Error Read Length Byte : \" + err.Error())\n\t\t\t\tfmt.Print(err)\n\t\t\t}\n\t\t\tisolen := lenbit1*256 + lenbit2\n\t\t\tif isolen > 4096 {\n\t\t\t\tisolen = 4096\n\t\t\t}\n\t\t\tif isolen <= 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tbufferisomessage := make([]byte, isolen)\n\t\t\t_, err = m.TCPConn.Read(bufferisomessage)\n\t\t\t// fmt.Println(c)\n\t\t\tif err != nil {\n\t\t\t\tinfoLog := fmt.Sprintf(\"Error TCP Connection when Read ISO message %+v\", err)\n\t\t\t\tfmt.Print(infoLog)\n\t\t\t}\n\n\t\t\t// input to goroutine function\n\t\t\ttimeIn := time.Now()\n\n\t\t\tgo delivery.messageReceived(bufferisomessage, timeIn)\n\n\t\t\t// task := func(isoMsgBuffer []byte, timeIn time.Time) func() {\n\t\t\t// \treturn func() {\n\t\t\t// \t\tdelivery.messageReceived(bufferisomessage, timeIn)\n\t\t\t// \t}\n\t\t\t// }\n\t\t\t// poolingConnection.Submit(task(bufferisomessage, timeIn))\n\t\t}\n\t\ttime.Sleep(2 * time.Second)\n\t}\n}", "title": "" }, { "docid": "806f6216f5290b360dbe6644622ce316", "score": "0.58595544", "text": "func handleConnection(conn net.Conn, disconnectTime, tcpKeepAlive time.Duration, TLSconfig *tls.Config) {\n\tdefer conn.Close()\n\ttc, ok := conn.(*net.TCPConn)\n\tif !ok {\n\t\tlogger.Error(\"Could not grab tcp conn\")\n\t\treturn\n\t}\n\tif tcpKeepAlive > 0 {\n\t\ttc.SetKeepAlive(true)\n\t\ttc.SetKeepAlivePeriod(tcpKeepAlive)\n\t\tlogger.Debug(\"Set TCP-keepalive to %ds\\n\", tcpKeepAlive)\n\t} else {\n\t\ttc.SetKeepAlive(false)\n\t}\n\tif TLSconfig != nil {\n\t\tif debug {\n\t\t\tlogger.Info(\"Accepted TLS connection\")\n\t\t}\n\t\tconn = tls.Server(conn, TLSconfig)\n\t} else {\n\t\tif debug {\n\t\t\tlogger.Warning(\"Accepted TCP-only connection\")\n\t\t}\n\t}\n\n\tinCh := make(chan []byte)\n\teCh := make(chan error)\n\t// Start a goroutine to read from our net connection\n\tgo func(conn net.Conn, ch chan []byte, eCh chan error) {\n\t\tdata := make([]byte, 512)\n\t\tfirstTime := true\n\t\tfor {\n\t\t\t// try to read the data\n\t\t\t_, err := conn.Read(data)\n\t\t\tif err != nil {\n\t\t\t\t// send an error if it's encountered\n\t\t\t\teCh <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif firstTime {\n\t\t\t\ttlsconn, ok := conn.(*tls.Conn)\n\t\t\t\tif ok {\n\t\t\t\t\tstate := tlsconn.ConnectionState()\n\t\t\t\t\tif !state.HandshakeComplete {\n\t\t\t\t\t\teCh <- errors.New(\"TLS Handshake not completed\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfirstTime = false\n\t\t\t}\n\t\t\t// send data if we read some.\n\t\t\tch <- data\n\t\t}\n\t}(conn, inCh, eCh)\n\n\tremote := conn.RemoteAddr().String()\n\tlogger.Info(\"%s: Got connection\\n\", remote)\n\tactiveConnections++\n\n\tvar timer *time.Timer\n\tif disconnectTime > 0 {\n\t\ttimer = time.NewTimer(disconnectTime)\n\t} else {\n\t\ttimer = time.NewTimer(time.Duration(1000000 * time.Hour)) // let's call this infinity\n\t}\n\tdefer timer.Stop()\n\n\t// continuously read from the connection\n\tfor {\n\t\tvar exitLoop = false\n\t\tif disconnectTime > 0 {\n\t\t\tlogger.Debug(\"%s: Waiting %d seconds for something to happen\\n\", remote, disconnectTime/time.Second)\n\t\t}\n\t\tselect {\n\t\t// This case means we recieved data on the connection\n\t\tcase data := <-inCh:\n\t\t\t// just write the data back. We are the ultimate echo.\n\t\t\tif debug {\n\t\t\t\tlogger.Debug(\"Received data and sending it back: %s\\n\", string(data))\n\t\t\t}\n\t\t\tn, err := conn.Write(data)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error(\"%v\\n\", err)\n\t\t\t} else {\n\t\t\t\tlogger.Debug(\"Sent %d bytes\\n\", n)\n\t\t\t}\n\n\t\t// This case means we got an error and the goroutine has finished\n\t\tcase err := <-eCh:\n\t\t\t// handle our error then exit for loop\n\t\t\tif err == io.EOF {\n\t\t\t\tlogger.Info(\"%s: Connection closed\\n\", remote)\n\t\t\t} else {\n\t\t\t\tlogger.Error(\"%s: %s\\n\", remote, err.Error())\n\t\t\t}\n\t\t\texitLoop = true\n\n\t\tcase <-timer.C:\n\t\t\tlogger.Info(\"%s: Timer expired.\\n\", remote)\n\t\t\texitLoop = true\n\t\t}\n\t\tif exitLoop {\n\t\t\tbreak\n\t\t}\n\t}\n\tlogger.Info(\"%s: Closing connection\\n\", remote)\n\tactiveConnections--\n}", "title": "" }, { "docid": "305532a1876b048dc5db0dd2dbb4d009", "score": "0.5851003", "text": "func (p *Pool) handleConnection(nc net.Conn) {\n\t// Set up connection\n\tconn := MiningConn{}\n\tconn.Conn = nc\n\tconn.Enc = gob.NewEncoder(nc)\n\tconn.Dec = gob.NewDecoder(nc)\n\n\t// Wait for Hello message\n\tmsg, err := RecvMsg(conn)\n\tif err != nil {\n\t\tErr.Printf(\n\t\t\t\"Received error %v when processing Hello message from %v\\n\",\n\t\t\terr,\n\t\t\tconn.Conn.RemoteAddr(),\n\t\t)\n\t\tconn.Conn.Close() // Close the connection\n\t\treturn\n\t}\n\n\tswitch msg.Type {\n\tcase MinerHello:\n\t\tp.handleMinerConnection(conn)\n\tcase ClientHello:\n\t\tp.handleClientConnection(conn)\n\tdefault:\n\t\tDebug.Printf(\"Pool %v received unexpected msg %v from %v\\n\", p.Addr, msg.Type, conn.Conn.RemoteAddr())\n\t\tSendMsg(conn, ErrorMsg(\"Unexpected message type\"))\n\t}\n}", "title": "" }, { "docid": "7414f131aaa7ef539222b6a2fac89f5d", "score": "0.5840524", "text": "func StartTCPServer() {\n\tfmt.Println(\"Starting TCP Server...\")\n\tlistener, err := net.Listen(\"tcp\", \"0.0.0.0:9999\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer listener.Close()\n \n\tfor {\n\t\tcon, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n \n\t\t// If you want, you can increment a counter here and inject to handleClientRequest below as client identifier\n\t\tgo handleConnection(con)\n\t}\n\n\n}", "title": "" }, { "docid": "bdca4c8df995078c1cc1a92fc04fedf2", "score": "0.58343375", "text": "func (s *Server) dispatchTCP(conn *net.TCPConn) {\n\n\t// bbr 限流\n\tf, err := s.LimitBbr.Get(\"dispatchTCP\").Allow(context.TODO())\n\tif err != nil {\n\t\tlog.Errorf(\"bbr_dispatchTCP.error(%v)\", err)\n\t\treturn\n\t} else {\n\t\tcount := rand.Intn(100)\n\t\ttime.Sleep(time.Millisecond * time.Duration(count))\n\t\tf(limit.DoneInfo{Op: limit.Success})\n\t}\n\n\t// 当前连接的用户id\n\tuser := NewUser()\n\tdefer func() {\n\t\t// 捕获异常\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Errorln(\"dispatchTCP defer recover error:\", err)\n\t\t}\n\t\t// 清除用户数据\n\t\tif user.UserID > 0 {\n\t\t\ts.removeUser(user.UserID, conn)\n\t\t\tlog.Errorln(\"dispatchTCP defer conn.close, clientIP:\"+conn.RemoteAddr().String(), \"userID:\", user.UserID)\n\t\t}\n\t\tconn.Close()\n\t\t// runtime.Goexit()\n\t}()\n\n\tgo user.handleLoop(s, conn)\n\tuser.readLoop(conn)\n\n}", "title": "" }, { "docid": "6a5388f9da3e8cdc4bde1d1d75e1b30e", "score": "0.5833897", "text": "func handleShortTCP(ln *net.TCPListener, cache Cacher) {\n\tvar (\n\t\tonce sync.Once\n\t\tincome = make(chan *net.TCPConn, 10)\n\t\twg sync.WaitGroup\n\t\tstopper = func() {\n\t\t\tclose(income)\n\t\t\tln.Close()\n\t\t}\n\t)\n\thandler := func(inCon <-chan *net.TCPConn) {\n\t\tdefer wg.Done()\n\t\tfor c := range inCon {\n\t\t\tdata, err := ioutil.ReadAll(c) //End client should close write tcp we wait eof\n\n\t\t\tvar t *ItemMessage\n\t\t\terr = proto.Unmarshal(data, t)\n\t\t\tif err != nil {\n\t\t\t\tc.Close()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresult, err := handleRequest(t, cache)\n\t\t\tif err == errDead {\n\t\t\t\tc.Close()\n\t\t\t\tonce.Do(stopper)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(result) > 0 {\n\t\t\t\tc.Write(result) //Do not care about error we can't do anything with error\n\t\t\t}\n\t\t\tc.Close()\n\t\t}\n\t}\n\n\twg.Add(runtime.NumCPU())\n\tfor i := 0; i < runtime.NumCPU(); i++ {\n\t\tgo handler(income)\n\t}\n\n\tfor {\n\t\tconn, err := ln.AcceptTCP()\n\n\t\tif err != nil {\n\t\t\terrStr := err.Error()\n\t\t\t//How to check closed conn better ?\n\t\t\tif strings.Contains(errStr, closendErrorMessage) {\n\t\t\t\tonce.Do(stopper)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif conn != nil {\n\t\t\t\tconn.Close() // some error appear do not try to handle income request\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tincome <- conn\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "46a5cf0182f42cd7ac9a442072ed1fec", "score": "0.58109003", "text": "func newTCPClientHandler(conn net.Conn, requests chan<- *keystore.Request) *TCPClientHandler {\n\tclient := &TCPClientHandler{requestChannel: requests, conn: conn, quit: make(chan bool)}\n\tclient.encoder = gob.NewEncoder(conn)\n\tclient.decoder = gob.NewDecoder(conn)\n\treturn client\n}", "title": "" }, { "docid": "6a440ad1306c843bd9a01db31a1351ae", "score": "0.57951474", "text": "func handleTCP(conn net.Conn) {\n\tvar logEntry NATLogEntry\n\tfor {\n\t\tbuffer := make([]byte, maxBufferSize)\n\n\t\tn, err := conn.Read(buffer)\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t\tif logEntry.Protocol != \"\" {\n\t\t\t\tlog.Printf(\"[%s] Error reading TCP connection %s, error: %s. Interval: %s.\", logEntry.TraceID, conn.RemoteAddr().String(), err.Error(), strconv.Itoa(logEntry.Message.Interval))\n\t\t\t\t// Store log from previous interval\n\t\t\t\tlogEntry.Timeout = true\n\t\t\t\twriteLog <- logEntry\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Error reading TCP connection %s, error: %s\", conn.RemoteAddr().String(), err.Error())\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif logEntry.Protocol != \"\" {\n\t\t\t// Store log from previous interval\n\t\t\twriteLog <- logEntry\n\t\t}\n\n\t\tvar retBuffer []byte\n\t\tretBuffer, logEntry, err = HandleData(buffer[:n-1], \"TCP\", conn.RemoteAddr().String())\n\t\tif err != nil {\n\t\t\tlog.Printf(\"HandleData Error: %s\\nConnection to %s terminated.\\n\", err.Error(), conn.RemoteAddr().String())\n\t\t\tconn.Write(genericErrorMessage)\n\t\t\tconn.Close()\n\t\t\tbreak\n\t\t}\n\n\t\t_, err = conn.Write(retBuffer)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[%s] TCP write to %s failed. Connection terminated. Interval: %s.\\n\", logEntry.TraceID, conn.RemoteAddr().String(), strconv.Itoa(logEntry.Message.Interval))\n\t\t\tlogEntry.Timeout = true\n\t\t\twriteLog <- logEntry\n\t\t\tconn.Close()\n\t\t\tbreak\n\t\t}\n\t\tlog.Printf(\"[%s] TCP Packet sent to %s. Interval: %s.\\n\", logEntry.TraceID, conn.RemoteAddr().String(), strconv.Itoa(logEntry.Message.Interval))\n\t}\n}", "title": "" }, { "docid": "a2a7b31ba1545460312cbc3d137eb580", "score": "0.57945335", "text": "func TCPAsServer(m *model.BaseConfiguration, tc model.TCPconnection) {\n\tTCPReady = make(chan bool)\n\thosting := &net.TCPAddr{\n\t\tPort: tc.ListenPort,\n\t}\n\tl, err := net.ListenTCP(\"tcp\", hosting)\n\tif err != nil {\n\t\terr = errors.New(\"Connection TCP is error : \" + err.Error())\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tgo func() {\n\t\tfor {\n\t\t\tm.TCPConn, err = l.AcceptTCP()\n\t\t\tfmt.Println()\n\t\t\tfmt.Println(\"New Client Connection is Accepted\")\n\t\t\tTCPReady <- true\n\t\t\tif err != nil {\n\t\t\t\terr = errors.New(\"Listen TCP is error : \" + err.Error())\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(2)\n\t\t\t}\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}()\n\n}", "title": "" }, { "docid": "8dd789365feded32024f666ff4c40bbe", "score": "0.5794519", "text": "func (t *TcollectorInput) handleConnection(conn net.Conn) {\n\tdefer func() {\n\t\tconn.Close()\n\t\tt.wg.Done()\n\t}()\n\n\tvar (\n\t\tdr DecoderRunner\n\t\tok bool\n\t)\n\tif t.config.Decoder != \"\" {\n\t\traddr := conn.RemoteAddr().String()\n\t\thost, _, err := net.SplitHostPort(raddr)\n\t\tif err != nil {\n\t\t\thost = raddr\n\t\t}\n\t\tif dr, ok = t.h.DecoderRunner(t.config.Decoder,\n\t\t\tfmt.Sprintf(\"%s-%s-%s\", t.name, host, t.config.Decoder)); !ok {\n\t\t\tt.ir.LogError(fmt.Errorf(\"Error getting decoder: %s\", t.config.Decoder))\n\t\t\treturn\n\t\t}\n\t}\n\n\tparser := NewTokenParser()\n\n\tvar err error\n\tstopped := false\n\tfor !stopped {\n\t\tconn.SetReadDeadline(time.Now().Add(5 * time.Second))\n\t\tselect {\n\t\tcase <-t.stopChan:\n\t\t\tstopped = true\n\t\tdefault:\n\t\t\terr = NetworkPayloadParserAndAnswer(conn, parser, t.ir, t.config.Signers, dr)\n\t\t\tif err != nil {\n\t\t\t\tif neterr, ok := err.(net.Error); ok && neterr.Timeout() {\n\t\t\t\t\t// keep the connection open, we are just checking to see if\n\t\t\t\t\t// we are shutting down: Issue #354\n\t\t\t\t} else {\n\t\t\t\t\tstopped = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Stop the decoder, see Issue #713.\n\tif dr != nil {\n\t\tt.h.StopDecoderRunner(dr)\n\t}\n}", "title": "" }, { "docid": "e87096c6f135873face1f76fb72fbc43", "score": "0.579331", "text": "func (tx *Transaction) ProcessConnection(client string, cPort int, server string, sPort int) {\n\tp := strconv.Itoa(cPort)\n\tp2 := strconv.Itoa(sPort)\n\n\t// Modsecurity removed this, so maybe we do the same, such a copycat\n\t// addr, err := net.LookupAddr(client)\n\t// if err == nil {\n\t// \ttx.GetCollection(VARIABLE_REMOTE_HOST).Set(\"\", []string{addr[0]})\n\t// }else{\n\t// \ttx.GetCollection(VARIABLE_REMOTE_HOST).Set(\"\", []string{client})\n\t// }\n\n\ttx.GetCollection(VARIABLE_REMOTE_ADDR).Add(\"\", client)\n\ttx.GetCollection(VARIABLE_REMOTE_PORT).Add(\"\", p)\n\ttx.GetCollection(VARIABLE_SERVER_ADDR).Add(\"\", server)\n\ttx.GetCollection(VARIABLE_SERVER_PORT).Add(\"\", p2)\n\ttx.GetCollection(VARIABLE_UNIQUE_ID).Add(\"\", tx.Id)\n\n\t//TODO maybe evaluate phase 0?\n}", "title": "" }, { "docid": "2f50106def725b490e4c4a7688226bcc", "score": "0.57891285", "text": "func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) {\n\txl := xlog.FromContextSafe(pxy.Context())\n\tdefer userConn.Close()\n\n\tserverCfg := pxy.serverCfg\n\tcfg := pxy.pxyConf.GetBaseConfig()\n\t// server plugin hook\n\trc := pxy.GetResourceController()\n\tcontent := &plugin.NewUserConnContent{\n\t\tUser: pxy.GetUserInfo(),\n\t\tProxyName: pxy.GetName(),\n\t\tProxyType: cfg.ProxyType,\n\t\tRemoteAddr: userConn.RemoteAddr().String(),\n\t}\n\t_, err := rc.PluginManager.NewUserConn(content)\n\tif err != nil {\n\t\txl.Warn(\"the user conn [%s] was rejected, err:%v\", content.RemoteAddr, err)\n\t\treturn\n\t}\n\n\t// try all connections from the pool\n\tworkConn, err := pxy.GetWorkConnFromPool(userConn.RemoteAddr(), userConn.LocalAddr())\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer workConn.Close()\n\n\tvar local io.ReadWriteCloser = workConn\n\txl.Trace(\"handler user tcp connection, use_encryption: %t, use_compression: %t\", cfg.UseEncryption, cfg.UseCompression)\n\tif cfg.UseEncryption {\n\t\tlocal, err = libio.WithEncryption(local, []byte(serverCfg.Token))\n\t\tif err != nil {\n\t\t\txl.Error(\"create encryption stream error: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\tif cfg.UseCompression {\n\t\tvar recycleFn func()\n\t\tlocal, recycleFn = libio.WithCompressionFromPool(local)\n\t\tdefer recycleFn()\n\t}\n\n\tif pxy.GetLimiter() != nil {\n\t\tlocal = libio.WrapReadWriteCloser(limit.NewReader(local, pxy.GetLimiter()), limit.NewWriter(local, pxy.GetLimiter()), func() error {\n\t\t\treturn local.Close()\n\t\t})\n\t}\n\n\txl.Debug(\"join connections, workConn(l[%s] r[%s]) userConn(l[%s] r[%s])\", workConn.LocalAddr().String(),\n\t\tworkConn.RemoteAddr().String(), userConn.LocalAddr().String(), userConn.RemoteAddr().String())\n\n\tname := pxy.GetName()\n\tproxyType := cfg.ProxyType\n\tmetrics.Server.OpenConnection(name, proxyType)\n\tinCount, outCount, _ := libio.Join(local, userConn)\n\tmetrics.Server.CloseConnection(name, proxyType)\n\tmetrics.Server.AddTrafficIn(name, proxyType, inCount)\n\tmetrics.Server.AddTrafficOut(name, proxyType, outCount)\n\txl.Debug(\"join connections closed\")\n}", "title": "" }, { "docid": "93ed841e857758ae8b8fb0c71d28daf5", "score": "0.57796705", "text": "func (peer *Peer) handleIncomingConnection(conn *net.TCPConn) {\n\tdefer conn.Close()\n\n\tlog.Debug(fmt.Sprintf(\"Server handling connection (%s <- %s)\", conn.LocalAddr().String(), conn.RemoteAddr().String()))\n\tvar decoder = json.NewDecoder(conn)\n\t// listen for messages in connection\n\tfor peer.server.enabled {\n\t\tvar rq Message\n\t\terr := decoder.Decode(&rq)\n\t\tif nil != err {\n\t\t\tlog.Debug(\"Connection to prev. peer probably lost\")\n\t\t\tpeer.stopServer()\n\t\t}\n\n\t\tif peer.handleRequestMessageWithExitFlag(&rq, conn) {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "854d8c31d7b751eb52ea23ad8d4c6ec9", "score": "0.57761586", "text": "func (c TCP_Connection) Handle() {\n\t// Defer cleanup for when connection drops.\n\tvar addr string\n\tif c.TLSConn != nil {\n\t\taddr = c.TLSConn.RemoteAddr().String()\n\t} else {\n\t\taddr = c.NetConn.RemoteAddr().String()\n\t}\n\tdefer func() {\n\t\trecover()\n\t\tNewMessageError(MessageErrorResponseTypeConnectionLost, addr).Send(ConnectID{})\n\t\tUnregisterConnection(c.ID)\n\t\tThisNodeInfo.RemoveConnector(c.ID)\n\t}()\n\n\t// Notify of new connection\n\tNewConnection(addr).Send(ConnectID{})\n\tThisNodeInfo.AddConnector(c.ID, ConnectorType_TCPTLS, addr)\n\n\tfor {\n\t\tmsg := &Message{}\n\t\terr := c.Decoder.Decode(&msg)\n\t\tif err == nil {\n\t\t\tgo msg.Handle(c.ID)\n\t\t} else if err == io.EOF {\n\t\t\tif c.TLSConn != nil {\n\t\t\t\tc.TLSConn.Close()\n\t\t\t} else {\n\t\t\t\tc.NetConn.Close()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e10bb291425e5fa82d20525e6b72ad3", "score": "0.5774308", "text": "func (t *TLSHandler) ServeTCP(conn WriteCloser) {\n\tt.Next.ServeTCP(tls.Server(conn, t.Config))\n}", "title": "" }, { "docid": "23287799c0b71c283cbcd7511a272118", "score": "0.5756304", "text": "func (p *Pool) handleConnection(nc net.Conn) {\n\t// Set up connection\n\tconn := MiningConn{}\n\tconn.Conn = nc\n\tconn.Enc = gob.NewEncoder(nc)\n\tconn.Dec = gob.NewDecoder(nc)\n\n\t// Wait for Hello message\n\tmsg, err := RecvMsg(conn)\n\tif err != nil {\n\t\tErr.Printf(\n\t\t\t\"Received error %v when processing Hello message from %v\\n\",\n\t\t\terr,\n\t\t\tconn.Conn.RemoteAddr(),\n\t\t)\n\t\tconn.Conn.Close() // Close the connection\n\t\treturn\n\t}\n\n\tswitch msg.Type {\n\tcase MinerHello:\n\t\tp.handleMinerConnection(conn)\n\tcase ClientHello:\n\t\tp.handleClientConnection(conn)\n\tdefault:\n\t\tErr.Printf(\"Pool received unexpcted message type %v (msg=%v)\", msg.Type, msg)\n\t\tSendMsg(conn, ErrorMsg(\"Unexpected message type\"))\n\t}\n}", "title": "" }, { "docid": "c519c14980d93de4960b8ddd9452028e", "score": "0.5752959", "text": "func (t *TCPServer) handleConnection(conn net.Conn) {\n\tdefer conn.Close()\n\tdefer t.wg.Done()\n\n\tbatcher := tsdb.NewPointBatcher(t.batchSize, t.batchTimeout)\n\tbatcher.Start()\n\treader := bufio.NewReader(conn)\n\n\t// Start processing batches.\n\tvar wg sync.WaitGroup\n\tdone := make(chan struct{})\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase batch := <-batcher.Out():\n\t\t\t\t_, e := t.writer.WriteSeries(t.database, \"\", batch)\n\t\t\t\tif e != nil {\n\t\t\t\t\tt.Logger.Printf(\"failed to write point batch to database %q: %s\\n\", t.database, e)\n\t\t\t\t}\n\t\t\tcase <-done:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor {\n\t\t// Read up to the next newline.\n\t\tbuf, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\tbatcher.Flush()\n\t\t\tclose(done)\n\t\t\twg.Wait()\n\t\t\treturn\n\t\t}\n\n\t\t// Trim the buffer, even though there should be no padding\n\t\tline := strings.TrimSpace(string(buf))\n\n\t\t// Parse it.\n\t\tpoint, err := t.parser.Parse(line)\n\t\tif err != nil {\n\t\t\tt.Logger.Printf(\"unable to parse data: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tbatcher.In() <- point\n\t}\n}", "title": "" }, { "docid": "761fe8cbb9c977a769642301df05bbb2", "score": "0.57496154", "text": "func (server *TCPServer) handleClient(conn net.Conn) {\n\n\t// Create a new client connector\n\tnewTCPClientHandler(conn, server.requests).start()\n}", "title": "" }, { "docid": "18a1c214e2ab40a218753043d4da5953", "score": "0.5745566", "text": "func handleConnection(conn net.Conn, s *sdk.SDK) {\n\tlog.Printf(\"Client %s connected\", conn.RemoteAddr().String())\n\tscanner := bufio.NewScanner(conn)\n\tfor {\n\t\tif ok := scanner.Scan(); !ok {\n\t\t\tlog.Printf(\"Client %s disconnected\", conn.RemoteAddr().String())\n\t\t\treturn\n\t\t}\n\t\thandleCommand(conn, scanner.Text(), s)\n\t}\n}", "title": "" }, { "docid": "08be1a5415304a727658a596697934b8", "score": "0.5745316", "text": "func UA_ClientConnectionTCP(conf UA_ConnectionConfig, endpointUrl []byte, timeout UA_UInt32, logger UA_Logger) UA_Connection {\n\tif logger == nil {\n\t\tlogger = UA_Log_Stdout\n\t}\n\tvar connection UA_Connection\n\tnoarch.Memset((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:], byte(0), 104)\n\tconnection.state = UA_CONNECTION_CLOSED\n\tconnection.localConf = conf\n\tconnection.remoteConf = conf\n\tconnection.send = connection_write\n\tconnection.recv = connection_recv\n\tconnection.close = ClientNetworkLayerTCP_close\n\tconnection.free = nil\n\tconnection.getSendBuffer = connection_getsendbuffer\n\tconnection.releaseSendBuffer = connection_releasesendbuffer\n\tconnection.releaseRecvBuffer = connection_releaserecvbuffer\n\tvar endpointUrlString UA_String = UA_STRING([]byte(uint32((uintptr_t(endpointUrl)))))\n\tvar hostnameString UA_String = UA_STRING_NULL\n\tvar pathString UA_String = UA_STRING_NULL\n\tvar port UA_UInt16\n\tvar hostname []byte = make([]byte, 512)\n\tvar parse_retval UA_StatusCode = UA_parseEndpointUrl((*[100000000]UA_String)(unsafe.Pointer(&endpointUrlString))[:], (*[100000000]UA_String)(unsafe.Pointer(&hostnameString))[:], (*[100000000]UA_UInt16)(unsafe.Pointer(&port))[:], (*[100000000]UA_String)(unsafe.Pointer(&pathString))[:])\n\tif parse_retval != UA_StatusCode((uint32_t((uint32((0)))))) || uint(hostnameString.length) > uint((511)) {\n\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Server url is invalid: %s\\x00\"), endpointUrl)\n\t\treturn UA_Connection(connection)\n\t}\n\tmemcpy(hostname, hostnameString.data, uint32((uint(hostnameString.length))))\n\thostname[uint(hostnameString.length)] = byte(0)\n\tif int(uint16((uint16((uint16_t((port))))))) == 0 {\n\t\tport = 4840\n\t\tUA_LOG_INFO(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"No port defined, using default port %d\\x00\"), int(uint16((uint16((uint16_t((UA_UInt16(port)))))))))\n\t}\n\tvar hints addrinfo\n\tvar server []addrinfo\n\tnoarch.Memset((*[100000000]addrinfo)(unsafe.Pointer(&hints))[:], byte(0), 48)\n\thints.ai_family = 0\n\thints.ai_socktype = SOCK_STREAM\n\tvar portStr []byte = make([]byte, 6)\n\tnoarch.Snprintf(portStr, 6, []byte(\"%d\\x00\"), int(uint16((uint16((uint16_t((UA_UInt16(port)))))))))\n\tvar error int = getaddrinfo(hostname, portStr, (*[100000000]addrinfo)(unsafe.Pointer(&hints))[:], (*[100000000][]addrinfo)(unsafe.Pointer(&server))[:])\n\tif error != 0 || server == nil {\n\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"DNS lookup of %s failed with error %s\\x00\"), hostname, gai_strerror(error))\n\t\treturn UA_Connection(connection)\n\t}\n\tvar connected UA_Boolean\n\tvar dtTimeout UA_DateTime = UA_DateTime((int64_t((__int64_t((int32(int64(uint32((uint32((uint32_t((timeout))))))) * int64(10*1000))))))))\n\tvar connStart UA_DateTime = UA_DateTime_nowMonotonic()\n\tvar clientsockfd int\n\tfor {\n\t\t// On linux connect may immediately return with ECONNREFUSED but we still\n\t\t// * want to try to connect. So use a loop and retry until timeout is\n\t\t// * reached.\n\t\t// Get a socket\n\t\tclientsockfd = socket(server[0].ai_family, server[0].ai_socktype, server[0].ai_protocol)\n\t\tif clientsockfd < 0 {\n\t\t\t{\n\t\t\t\tvar errno_str []byte = strerror(((__errno_location())[0]))\n\t\t\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Could not create client socket: %s\\x00\"), errno_str)\n\t\t\t}\n\t\t\tfreeaddrinfo(server)\n\t\t\treturn UA_Connection(connection)\n\t\t}\n\t\tconnection.state = UA_CONNECTION_OPENING\n\t\t// Connect to the server\n\t\t// cast for win32\n\t\tconnection.sockfd = UA_Int32(clientsockfd)\n\t\tif socket_set_nonblocking(clientsockfd) != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\t\t// Non blocking connect to be able to timeout\n\t\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Could not set the client socket to nonblocking\\x00\"))\n\t\t\tClientNetworkLayerTCP_close((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:])\n\t\t\tfreeaddrinfo(server)\n\t\t\treturn UA_Connection(connection)\n\t\t}\n\t\t// Non blocking connect\n\t\terror = connect(clientsockfd, __CONST_SOCKADDR_ARG{server[0].ai_addr}, socklen_t(server[0].ai_addrlen))\n\t\tif error == -1 && (__errno_location())[0] != 115 {\n\t\t\tClientNetworkLayerTCP_close((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:])\n\t\t\t{\n\t\t\t\tvar errno_str []byte = strerror(((__errno_location())[0]))\n\t\t\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Connection to %s failed with error: %s\\x00\"), endpointUrl, errno_str)\n\t\t\t}\n\t\t\tfreeaddrinfo(server)\n\t\t\treturn UA_Connection(connection)\n\t\t}\n\t\tif error == -1 && (__errno_location())[0] == 115 {\n\t\t\tvar timeSinceStart UA_DateTime = UA_DateTime_nowMonotonic() - connStart\n\t\t\tif timeSinceStart > dtTimeout {\n\t\t\t\t// Use select to wait and check if connected\n\t\t\t\t// connection in progress. Wait until connected using select\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar fdset fd_set\n\t\t\tfor {\n\t\t\t\tvar __d0 int\n\t\t\t\tvar __d1 int\n\t\t\t\t// Warning (*ast.GCCAsmStmt): $GOPATH/src/github.com/eugeis/gopen62541/gen/open62541.c:39366 :cannot transpile asm, will be ignored\n\t\t\t\tif noarch.NotInt((0)) != 0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t_ = (func() __fd_mask {\n\t\t\t\ttempVar := &(((*[100000000]fd_set)(unsafe.Pointer(&fdset))[:])[0].fds_bits)[clientsockfd/(8*int(8))]\n\t\t\t\t*tempVar |= __fd_mask((uint32(1 << uint64(clientsockfd%(8*int(8))))))\n\t\t\t\treturn *tempVar\n\t\t\t}())\n\t\t\tvar timeout_usec UA_DateTime = UA_DateTime((int64_t((__int64_t((int32(int64(int32((__int64_t((int64_t((dtTimeout - timeSinceStart))))))) / int64(10))))))))\n\t\t\tvar tmptv noarch.Timeval = noarch.Timeval{(int32((__int64_t((int64_t((timeout_usec / UA_DateTime((int64_t((__int64_t((1000000))))))))))))), (int32((__int64_t((int64_t((timeout_usec % UA_DateTime((int64_t((__int64_t((1000000)))))))))))))}\n\t\t\tvar resultsize int = select_(int((__int32_t((int32_t((UA_Int32((clientsockfd + 1)))))))), nil, (*[100000000]fd_set)(unsafe.Pointer(&fdset))[:], nil, (*[100000000]noarch.Timeval)(unsafe.Pointer(&tmptv))[:])\n\t\t\tif resultsize == 1 {\n\t\t\t\tvar so_error int\n\t\t\t\tvar len socklen_t = socklen_t((__socklen_t((4))))\n\t\t\t\tvar ret int = getsockopt(clientsockfd, 1, 4, (*[100000000]int)(unsafe.Pointer(&so_error))[:], (*[100000000]socklen_t)(unsafe.Pointer(&len))[:])\n\t\t\t\tif ret != 0 || so_error != 0 {\n\t\t\t\t\tif so_error != 111 {\n\t\t\t\t\t\t// on connection refused we should still try to connect\n\t\t\t\t\t\t// connection refused happens on localhost or local ip without timeout\n\t\t\t\t\t\tClientNetworkLayerTCP_close((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:])\n\t\t\t\t\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Connection to %s failed with error: %s\\x00\"), endpointUrl, strerror(func() int {\n\t\t\t\t\t\t\tif ret == 0 {\n\t\t\t\t\t\t\t\treturn so_error\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ((__errno_location())[0])\n\t\t\t\t\t\t}()))\n\t\t\t\t\t\tfreeaddrinfo(server)\n\t\t\t\t\t\treturn UA_Connection(connection)\n\t\t\t\t\t}\n\t\t\t\t\t// wait until we try a again. Do not make this too small, otherwise the\n\t\t\t\t\t// * timeout is somehow wrong\n\t\t\t\t\tusleep(__useconds_t(100 * 1000))\n\t\t\t\t} else {\n\t\t\t\t\tconnected = 1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconnected = 1\n\t\t\tbreak\n\t\t}\n\t\tClientNetworkLayerTCP_close((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:])\n\t\tif !(UA_DateTime_nowMonotonic()-connStart < dtTimeout) {\n\t\t\tbreak\n\t\t}\n\t}\n\tfreeaddrinfo(server)\n\tif int((int((noarch.NotUA_Boolean(UA_Boolean(connected)))))) != 0 {\n\t\tif uint32(connection.state) != uint32(UA_CONNECTION_CLOSED) {\n\t\t\t// connection timeout\n\t\t\tClientNetworkLayerTCP_close((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:])\n\t\t}\n\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Trying to connect to %s timed out\\x00\"), endpointUrl)\n\t\treturn UA_Connection(connection)\n\t}\n\tif socket_set_blocking(clientsockfd) != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\t// We are connected. Reset socket to blocking\n\t\tUA_LOG_WARNING(UA_Logger(logger), UA_LOGCATEGORY_NETWORK, []byte(\"Could not set the client socket to blocking\\x00\"))\n\t\tClientNetworkLayerTCP_close((*[100000000]UA_Connection)(unsafe.Pointer(&connection))[:])\n\t\treturn UA_Connection(connection)\n\t}\n\treturn UA_Connection(connection)\n}", "title": "" }, { "docid": "b822624807ee2c51a85b140300511540", "score": "0.57357687", "text": "func acceptTCP(s *Server, lis *net.TCPListener) {\n\tvar (\n\t\tconn *net.TCPConn\n\t\terr error\n\t\t// r int\n\t)\n\n\tfor {\n\t\tif conn, err = lis.AcceptTCP(); err != nil {\n\t\t\t// if listener close then return\n\t\t\tlog.Errorf(\"listener.Accept(\\\"%s\\\") error(%v)\", lis.Addr().String(), err)\n\t\t\treturn\n\t\t}\n\t\tgo s.dispatchTCP(conn)\n\n\t\t// if r++; r == maxInt {\n\t\t// \tr = 0\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "8de9c1c36787b1aacbdccb694e9ec20f", "score": "0.5732717", "text": "func (s *Service) AcceptTCP(port int) error {\n\top := func() error {\n\t\ts.Logger.Infof(\"Accepting traffic to TCP port %d\", port)\n\t\truleBuilder := func(action string) []string { return createPortRuleSpec(port, action) }\n\t\tif err := s.removeRuleSpecs(ruleBuilder, \"REJECT\", \"DROP\"); err != nil {\n\t\t\treturn maskAny(err)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := backoff.Retry(op, backoff.NewExponentialBackOff()); err != nil {\n\t\treturn maskAny(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "107e43d61cb75322b78bf7c1279dedf0", "score": "0.57199824", "text": "func handleConnection(conn *net.UnixConn) {\n\t// Close connection when finish handling\n\tdefer func() {\n\t\tconn.Close()\n\t}()\n\n\t// Read data and return response\n\tdata, err := parseRequest(conn)\n\n\tif err != nil {\n\t\tLogger.Error(\"read the request data error\", zap.Error(err))\n\t\treturn\n\t}\n\n\t// 反序列化\n\tvar call model.Call\n\tdecoder := gob.NewDecoder(bytes.NewReader(data))\n\tdecoder.Decode(&call)\n\n\t// 存储到 redis 交给 logstash 处理\n\tcall.Save()\n\n\t// Send back response\n\tsendResponse(conn, []byte(time.Now().String()))\n\n}", "title": "" }, { "docid": "f81199e64e49f11a3230546bd1533687", "score": "0.5718384", "text": "func HandleConnection(conn net.Conn) {\n\t//\n\t// proxy just took a new connection. increment the idel connection count.\n\t//\n\tGetStateLog().PublishStateEvent(StateEvent{eType: ConnStateEvt, shardID: 0, wType: wtypeRW, instID: 0, oldCState: Close, newCState: Idle})\n\n\tclientchannel := make(chan *encoding.Packet, 1)\n\t// closing of clientchannel will notify the coordinator to exit\n\tdefer func() {\n\t\tclose(clientchannel)\n\t\tGetStateLog().PublishStateEvent(StateEvent{eType: ConnStateEvt, shardID: 0, wType: wtypeRW, instID: 0, oldCState: Idle, newCState: Close})\n\t}()\n\n\t//TODO: create a context with timeout\n\tctx, cancel := context.WithCancel(context.Background())\n\n\t// Right now this is set to true. Set to false if you expect non-MySQL client.\n\t// Eventually, Hera should be able to detect MySQLPacket vs OCC protocol.\n\tIsMySQL := true\n\n\t// For MySQL clients, the connection expects a handshake packet from the server. We'll send this outside\n\t// of the coordinator in order to keep coordinator code limited to the command phase.\n\n\tif IsMySQL {\n\t\tlogger.GetLogger().Log(logger.Info, \"Sending handshake\")\n\t\tsendHandshake(conn)\n\t\tlogger.GetLogger().Log(logger.Info, \"Reading handshake response\")\n\t\treadHandshakeResponse(conn)\n\t}\n\n\tlogger.GetLogger().Log(logger.Info, \"Created coordinator in connection handler\")\n\n\tcrd := NewCoordinator(ctx, clientchannel, conn)\n\tgo crd.Run()\n\n\t//\n\t// clientchannel is a mechanism for request handler to pass over the client netstring\n\t// this loop blocks on the client connection.\n\t// - when receiving a netstring, it writes the netstring to the channel\n\t// - when receiving a connection error, it closes the clientchannel which is a\n\t// detectable event in coordinator such that coordinator can clean up and exit too\n\t//\n\taddr := conn.RemoteAddr()\n\tfor {\n\t\tvar ns *encoding.Packet\n\t\tselect {\n\t\tcase ns = <-wrapNewNetstring(conn, true): /* Set this to false if you expect a client with netstring */\n\t\tcase timeout := <-crd.Done():\n\t\t\tif logger.GetLogger().V(logger.Info) {\n\t\t\t\tlogger.GetLogger().Log(logger.Info, \"Connection handler idle timeout\", addr)\n\t\t\t}\n\t\t\tevt := cal.NewCalEvent(\"MUX\", \"idle_timeout_\"+strconv.Itoa(int(timeout)), cal.TransOK, \"\")\n\t\t\tevt.Completed()\n\n\t\t\tconn.Close() // this forces netstring.NewNetstring() conn.Read to exit with err=read tcp 127.0.0.1:8081->127.0.0.1:57968: use of closed network connection\n\t\t\tns = nil\n\t\t}\n\t\tif ns == nil {\n\t\t\tbreak\n\t\t}\n\t\tif logger.GetLogger().V(logger.Verbose) {\n\t\t\tlogger.GetLogger().Log(logger.Verbose, addr, \": Connection handler read <<<\", DebugString(ns.Serialized))\n\t\t}\n\n\t\t// Don't send COM_QUIT, COM_SLEEP queries into\n\t\tif ns.IsMySQL && ns.Cmd == common.COM_QUIT || ns.IsMySQL && ns.Cmd == common.COM_SLEEP || ns.IsMySQL && ns.Cmd == common.COM_SHUTDOWN {\n\t\t\tlogger.GetLogger().Log(logger.Info, \"Client closed connection\")\n\t\t\tbreak\n\t\t}\n\n\t\t//\n\t\t// coordinator is ready to go, send over the new netstring.\n\t\t// this could block when client close the connection abruptly. e.g. when coordinator write\n\t\t// is the first one to encounter the closed connection, coordinator exits. meanwhile there\n\t\t// could still be a last pending message from client that is blocked since there is not one\n\t\t// listening to clientchannel anymore. to avoid blocking, give clientchannel a buffer.\n\t\t//\n\t\tclientchannel <- ns\n\t}\n\tif logger.GetLogger().V(logger.Info) {\n\t\tlogger.GetLogger().Log(logger.Info, \"======== Connection handler exits\", addr)\n\t}\n\tconn.Close()\n\tconn = nil\n\tcancel()\n}", "title": "" }, { "docid": "2b7fc2cb755d3c6210bfe539a473c48c", "score": "0.5709861", "text": "func listenTCP() {\n\tlistener, err := net.Listen(\"tcp\", \":7070\")\n\tutil.CheckError(err)\n\n\tgo checkConnection()\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tnewClient := util.Client{Conn: conn, Name: \"none\"}\n\t\t// clients = append(clients, &newClient)\n\t\tgo handleClient(&newClient)\n\t}\n}", "title": "" }, { "docid": "11d1b167d4cb8088ff921f526dfcfa1e", "score": "0.57053983", "text": "func (h *httpForwarder) ServeTCP(conn tcp.WriteCloser) {\n\th.connChan <- conn\n}", "title": "" }, { "docid": "afcdb15537df2dfc0eb1cc0cdf0683f1", "score": "0.5701918", "text": "func (obj *TCPChannel) OnConnect() tgdb.TGError {\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"======> Entering TCPChannel:OnConnect about to tryRead w/ socket: '%+v'\", obj.socket))\n\t}\n\tmsg, err := obj.tryRead()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning TCPChannel::OnConnect obj.tryRead() failed w/ '%+v'\", err.Error()))\n\t\terrMsg := \"TCPChannel::OnConnect there is no data available to be read\"\n\t\treturn GetErrorByType(TGErrorGeneralException, \"\", errMsg, \"\")\n\t}\n\tif msg != nil {\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"======> Inside TCPChannel:OnConnect tryRead() read Message as '%+v'\", msg.String()))\n\t\t}\n\t}\n\n\tif msg != nil && msg.GetVerbId() == VerbSessionForcefullyTerminated {\n\t\tlogger.Warning(fmt.Sprint(\"WARNING: Returning TCPChannel:OnConnect since Message is of Forceful Termination Type\"))\n\t\treturn NewTGChannelDisconnectedWithMsg(msg.(*SessionForcefullyTerminatedMessage).GetKillString())\n\t}\n\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"======> Inside TCPChannel:OnConnect about to performHandshake\"))\n\t}\n\terr = obj.performHandshake(false)\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning TCPChannel::OnConnect obj.performHandshake() failed w/ '%+v'\", err.Error()))\n\t\terrMsg := \"TCPChannel::OnConnect error in performing handshake with server\"\n\t\treturn GetErrorByType(TGErrorGeneralException, \"\", errMsg, \"\")\n\t}\n\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"======> Inside TCPChannel:OnConnect about to doAuthenticate\"))\n\t}\n\terr = obj.DoAuthenticate()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning TCPChannel::OnConnect obj.doAuthenticate() failed w/ '%+v'\", err.Error()))\n\t\terrMsg := \"TCPChannel::OnConnect error in authentication with server\"\n\t\treturn GetErrorByType(TGErrorGeneralException, \"\", errMsg, \"\")\n\t}\n\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"======> Returning TCPChannel:OnConnect w/ socket: '%+v'\", obj.socket))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dcf03b9809e263e33df0280785e134a9", "score": "0.5699337", "text": "func (tcp *TCPServer) clientHandler(conn net.Conn) {\n\t// read first 1024 bytes\n\tbuffer := make([]byte, 1024)\n\n\t// read first 1024 bytes\n\tb, err := conn.Read(buffer)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// split message into payload length, identifier, and payload\n\tpayloadLength, _ := binary.Uvarint(buffer[:4])\n\tid := int(buffer[4])\n\tpayload := make([]byte, b-5)\n\tcopy(payload, buffer[5:b])\n\n\t// read rest of payload, 1024 bytes at a time\n\t// TODO: add a timeout\n\tbytesRead := len(payload)\n\tfor uint64(bytesRead) != payloadLength {\n\t\tb, err = conn.Read(buffer)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tpayload = append(payload, buffer[:b]...)\n\t\tbytesRead += b\n\t}\n\n\t// Message sent directly to TCPServer\n\t// for now, just send it to the first message handler\n\tif id == 0 {\n\t\ttcp.MessageHandlers[1].HandleMessage(payload)\n\t\treturn\n\t}\n\n\t// look up message handler and call it\n\tif id < len(tcp.MessageHandlers) {\n\t\ttcp.MessageHandlers[id].HandleMessage(payload)\n\t}\n}", "title": "" }, { "docid": "b58fc46b7775efa5741cb638ab8e5ee1", "score": "0.5697674", "text": "func tcpAcceptFn(arg unsafe.Pointer, newpcb *C.struct_tcp_pcb, err C.err_t) C.err_t {\n\tif err != C.ERR_OK {\n\t\treturn err\n\t}\n\n\tif tcpConnHandler == nil {\n\t\tpanic(\"must register a TCP connection handler\")\n\t}\n\n\tif _, nerr := newTCPConn(newpcb, tcpConnHandler); nerr != nil {\n\t\tswitch nerr.(*lwipError).Code {\n\t\tcase LWIP_ERR_ABRT:\n\t\t\treturn C.ERR_ABRT\n\t\tcase LWIP_ERR_OK:\n\t\t\treturn C.ERR_OK\n\t\tdefault:\n\t\t\treturn C.ERR_CONN\n\t\t}\n\t}\n\n\treturn C.ERR_OK\n}", "title": "" }, { "docid": "e6ed1e97ba0859fd8bd880574c85cd7e", "score": "0.5689001", "text": "func TCPConnect(TCPIP string) {\r\n\t//dial server at specified ip\r\n\ttcpconn, err := net.Dial(\"tcp\", TCPIP)\r\n\tif err != nil {\r\n\t\tlog.Println(\"error while dialing TCP\", err, TCPIP)\r\n\t}\r\n\r\n\tfmt.Println(\"Initiated TCP Connection to Server\")\r\n\t//wait for server to send the status of the data transfer\r\n\tfor {\r\n\r\n\t\t//add decoder to the connection information\r\n\t\tdecoder := json.NewDecoder(tcpconn)\r\n\t\tvar tmplist LostPackets\r\n\r\n\t\t//decode the information sent\r\n\t\terr := decoder.Decode(&tmplist)\r\n\t\tif err != nil {\r\n\t\t\tfmt.Printf(\"Client disconnected.\\n\", err)\r\n\t\t\tbreak\r\n\t\t}\r\n\t\t//create each individual packet to be resent, then pass it into the channel for the other threads\r\n\t\tfor _, k := range tmplist.Packets {\r\n\t\t\ttmppacket := Packet{\r\n\t\t\t\tHeaderNum: k,\r\n\t\t\t\tData: \"this is misc packetdata\",\r\n\t\t\t\tConnType: \"UDP\",\r\n\t\t\t}\r\n\r\n\t\t\t//pass the packet to another thread\r\n\t\t\tresendlist <- tmppacket\r\n\r\n\t\t}\r\n\r\n\t\ttime.Sleep(5 * time.Millisecond)\r\n\r\n\t}\r\n\r\n\terr = tcpconn.Close()\r\n\tif err != nil {\r\n\t\tlog.Println(\"Closing Connection\", err, TCPIP)\r\n\t}\r\n\tdefer wg.Done()\r\n}", "title": "" }, { "docid": "0fb277de9bae3b0bd0b3564e83b6d3c1", "score": "0.56758696", "text": "func handleConnection(conn net.Conn, ch chan []byte, nameChan chan string, idChan chan int, srv *serverData.Server) {\n\tdefer conn.Close()\n\n\tbufReader := bufio.NewReader(conn)\n\tconnectRequested := false\n\n\tfor {\n\t\tconn.SetReadDeadline(time.Now().Add(srv.TimeoutDuration))\n\t\tbytes, _, err := bufReader.ReadLine()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tif !connectRequested {\n\t\t\tconnectRequested = true\n\t\t\tnameChan <- string(bytes)\n\t\t\tid := <-idChan\n\t\t\tdefer func() {\n\t\t\t\tbuf := make([]byte, 4)\n\t\t\t\t_ = binary.PutVarint(buf, int64(id))\n\t\t\t\tbArray := append(buf, 128)\n\t\t\t\tch <- bArray\n\t\t\t}()\n\t\t\tconn.Write(append([]byte(strconv.Itoa(id)), '\\n'))\n\t\t} else {\n\t\t\tfmt.Println(\"Data received:\", string(bytes))\n\t\t\tch <- bytes\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1a0d4b6a2db85416ddc70086d0d3e4de", "score": "0.56733054", "text": "func openTCPConnection(nickname, port string, conn net.Conn, listener net.Listener) {\n\tlistener, err := net.Listen(\"tcp\", \":\"+port)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tconn, err = listener.Accept()\n\tif err != nil {\n\t\treturn\n\t}\n\tgo sender(nickname, conn)\n\tgo receiver(conn)\n}", "title": "" }, { "docid": "086896c896fc77c809ea97a6eab6ecb0", "score": "0.56725895", "text": "func handleServiceConnection(serviceAddress string, servicePort string, localPort string) net.Conn {\n\t// fmt.Println(\"Entering handleServiceConnection...\")\n\n\tserviceRemote := serviceAddress + \":\" + servicePort\n\n\tserviceConn, err := net.Dial(\"tcp\", serviceRemote)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//localAddress := strings.Split(conn.LocalAddr().String(), \":\")[0]\n\n\t// Setup and send message to Service\n\thostname, _ := os.Hostname()\n\tmsgToSend := \"CONNECT \" + hostname + \":\" + localPort\n\t//fmt.Println(\"SERVICEMSG: \", msgToSend)\n\tserviceConn.Write([]byte(msgToSend + \"\\n\")) //fmt.Fprintf(conn, msgToSend)\n\n\t// dec := gob.NewDecoder(conn)\n\n\tgo serviceListener(serviceConn)\n\n\treturn serviceConn\n\n}", "title": "" }, { "docid": "72edc953ac37c39f4569dec622d9696a", "score": "0.56705356", "text": "func serveTCPSocket(conn *net.TCPConn, addr *net.TCPAddr, inbound chan<- Service) {\n\tutil.Log(conn, \"Started worker\")\n\tdefer util.Log(conn, \"Worker exited\")\n\n\t// A closed inbound channel indicates to its readers that the worker has terminated.\n\tdefer close(inbound)\n\n\tconnBuffer := bufio.NewReader(conn)\n\n\tfor {\n\t\theader, err := connBuffer.Peek(6) // KNXnet/IP headers are 6 bytes long\n\t\tif err != nil {\n\t\t\tutil.Log(conn, \"Error during peeking header: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tvar serviceID ServiceID\n\t\tvar totalLen uint16\n\n\t\t_, err = UnpackHeader(header, &serviceID, &totalLen)\n\t\tif err != nil {\n\t\t\tutil.Log(conn, \"Error during header inspection: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tbuffer := make([]byte, totalLen)\n\t\tlen, err := io.ReadFull(connBuffer, buffer)\n\t\tif err != nil {\n\t\t\tutil.Log(conn, \"Error during ReadFull: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Discard empty frames\n\t\tif len == 0 {\n\t\t\tutil.Log(conn, \"Empty frame discarded\")\n\t\t\tcontinue\n\t\t}\n\n\t\tvar payload Service\n\t\t_, err = Unpack(buffer[:len], &payload)\n\t\tif err != nil {\n\t\t\tutil.Log(conn, \"Error during Unpack: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tinbound <- payload\n\t}\n}", "title": "" }, { "docid": "4fb7e24677ab7075f9c87b265a619cca", "score": "0.56683487", "text": "func (ms *ModbusServer) handleTCPClient(sock net.Conn) {\n\tvar tt\t*tcpTransport\n\n\t// create a new transport\n\ttt = newTCPTransport(sock, ms.conf.Timeout)\n\n\tms.handleTransport(tt, sock.RemoteAddr().String())\n\n\t// once done, remove our connection from the list of active client conns\n\tms.lock.Lock()\n\tfor i := range ms.tcpClients {\n\t\tif ms.tcpClients[i] == sock {\n\t\t\tms.tcpClients[i] = ms.tcpClients[len(ms.tcpClients)-1]\n\t\t\tms.tcpClients\t = ms.tcpClients[:len(ms.tcpClients)-1]\n\t\t\tbreak\n\t\t}\n\t}\n\tms.lock.Unlock()\n\n\t// close the connection\n\tsock.Close()\n\n\treturn\n}", "title": "" }, { "docid": "b2a20ed0367377c81010cf2b6193d941", "score": "0.5665832", "text": "func (g *Graphite) OpenTCPServer() error {\n\tln, err := net.Listen(\"tcp\", g.Listen)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Listen on %s\", g.Listen)\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\n\t\tif opErr, ok := err.(*net.OpError); ok && !opErr.Temporary() {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": opErr,\n\t\t\t}).Debug(\"Graphite TCP listener closed\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t}).Warn(\"Error has occurred while accepting the TCP connection\")\n\t\t\tcontinue\n\t\t}\n\n\t\tgo g.handleTCPConnection(conn)\n\t}\n}", "title": "" }, { "docid": "4172b875876d9689e837d1b4a491b102", "score": "0.5659233", "text": "func (this *Server) handleConnection(conn *net.TCPConn) {\n\tlog.Debugf(\"accept connection (%v)\", conn)\n\tlog.Infof(\"New conn accepted from %s\\n\", conn.RemoteAddr().String())\n\t// handle register first\n\tclient := waitRegister(conn)\n\tif client == nil {\n\t\treturn\n\t}\n\n\tfor {\n\t\t/*\n\t\t\tselect {\n\t\t\tcase <- this.exitCh:\n\t\t\t\tlog.Printf(\"ask me quit\\n\")\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\t\t*/\n\n\t\tvar (\n\t\t\tdata []byte = nil\n\t\t)\n\n\t\tnow := time.Now()\n\t\tif now.After(client.LastAlive.Add(this.heartbeatTimeout)) {\n\t\t\tlog.Warnf(\"heartbeat timeout\")\n\t\t\tbreak\n\t\t}\n\n\t\t//conn.SetReadDeadline(time.Now().Add(this.readTimeout))\n\t\tconn.SetReadDeadline(now.Add(10 * time.Second))\n\t\tbuf := make([]byte, HEADER_SIZE)\n\t\tn, err := io.ReadFull(conn, buf)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*net.OpError); ok && e.Timeout() {\n\t\t\t\t//log.Printf(\"read timeout, %d\", n)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Errorf(\"readfull failed (%v)\", err)\n\t\t\tbreak\n\t\t}\n\n\t\tvar header Header\n\t\tif err := header.Deserialize(buf[0:n]); err != nil {\n\t\t\tlog.Errorf(\"Deserialize header failed: %s\", err.Error())\n\t\t\tbreak\n\t\t}\n\n\t\tif header.Len > MAX_BODY_LEN {\n\t\t\tlog.Warnf(\"Msg body too big: %d\", header.Len)\n\t\t\tbreak\n\t\t}\n\n\t\tif header.Len > 0 {\n\t\t\tdata = make([]byte, header.Len)\n\t\t\tif _, err := io.ReadFull(conn, data); err != nil {\n\t\t\t\tif e, ok := err.(*net.OpError); ok && e.Timeout() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlog.Errorf(\"read from client failed: (%v)\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\thandler, ok := this.funcMap[header.Type]\n\t\tif ok {\n\t\t\tret := handler(client, &header, data)\n\t\t\tif ret < 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\t// don't use defer to improve performance\n\tlog.Infof(\"close connection %s\\n\", conn.RemoteAddr().String())\n\tCloseClient(client)\n\tconn.Close()\n}", "title": "" }, { "docid": "383207cb3460ecdd4db07765f290dca8", "score": "0.5655766", "text": "func (s *Statsd) tcpListen(listener *net.TCPListener) error {\n\tfor {\n\t\tselect {\n\t\tcase <-s.done:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\t// Accept connection:\n\t\t\tconn, err := listener.AcceptTCP()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif s.TCPKeepAlive {\n\t\t\t\tif err := conn.SetKeepAlive(true); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif s.TCPKeepAlivePeriod != nil {\n\t\t\t\t\tif err := conn.SetKeepAlivePeriod(time.Duration(*s.TCPKeepAlivePeriod)); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-s.accept:\n\t\t\t\t// not over connection limit, handle the connection properly.\n\t\t\t\ts.wg.Add(1)\n\t\t\t\t// generate a random id for this TCPConn\n\t\t\t\tid, err := internal.RandomString(6)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\ts.remember(id, conn)\n\t\t\t\tgo s.handler(conn, id)\n\t\t\tdefault:\n\t\t\t\t// We are over the connection limit, refuse & close.\n\t\t\t\ts.refuser(conn)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cd138b1ce0bd66fd710c5920232b2a9a", "score": "0.56541115", "text": "func handleListener(pool *pools.ConnPool, l *net.TCPListener) error {\n\tfor {\n\t\ttcpConn, err := l.AcceptTCP()\n\t\tconn := pools.NewConnection(tcpConn, nil)\n\n\t\t// Add connection to pool\n\t\tpool.AddToPool(conn)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Accept new connection\n\t\tgo handlers.HandleConnection(pool, conn)\n\t}\n}", "title": "" }, { "docid": "16641f7d74d3c84fcea4f95101ae364b", "score": "0.5652753", "text": "func (s *PayloadBytes) HandleConn(context.Context, stats.ConnStats) {}", "title": "" }, { "docid": "827cdaf009a865227fbdc1ff12b281ef", "score": "0.5633711", "text": "func handleConnection(conn net.Conn, reqCh chan<- Executor) {\n\trespCh := make(chan string)\n\tbuf := make([]byte, 1024)\n\tfor {\n\t\tn, err := conn.Read(buf)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"read error from %s: %v\\n\", conn.RemoteAddr().String(), err)\n\t\t\treturn\n\t\t}\n\n\t\tcmds := readCommands(buf[:n])\n\t\tresp := executeMessages(cmds, respCh, reqCh, tcpLog)\n\t\tn, err = conn.Write([]byte(resp))\n\t\tif err != nil {\n\t\t\ttcpLog.Printf(\"failed to write response to the socket: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\ttcpLog.Printf(\"%d bytes written to socket %s\\n\", n, conn.RemoteAddr().String())\n\t}\n}", "title": "" }, { "docid": "e7d45f0e7e069fb8baf7406cdaa050ec", "score": "0.5627418", "text": "func handleConnection(conn net.Conn) {\n\t// Buffer client input until a newline.\n\tbuffer, err := bufio.NewReader(conn).ReadBytes('\\n')\n\n\t// Close left clients.\n\tif err != nil {\n\t\tfmt.Println(\"Client left.\")\n\t\tconn.Close()\n\t\treturn\n\t}\n\n\t// Print response message, stripping newline character.\n\tlog.Println(\"Client message:\", string(buffer[:len(buffer)-1]))\n\n\t// Send response message to the client.\n\tconn.Write(buffer)\n\n\t// Restart the process.\n\thandleConnection(conn)\n}", "title": "" }, { "docid": "1b9f9e14b7f44172d0381322d25cee54", "score": "0.56261945", "text": "func listenTCP() {\n\tfor {\n\t\tconn, err := tcpListener.Accept()\n\t\tif err != nil {\n\t\t\tif netErr, ok := err.(net.Error); ok && netErr.Temporary() {\n\t\t\t\tlog.Printf(\"Temporary error while accepting connection: %s\", netErr)\n\t\t\t}\n\n\t\t\tlog.Fatalf(\"Unrecoverable error while accepting connection: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tgo handleTCPConn(conn)\n\t}\n}", "title": "" }, { "docid": "6dbb710090e72dd179dee4158ce83a26", "score": "0.5611445", "text": "func processClientRequest(conn net.Conn) {\n\n\tdms3libs.LogDebug(dms3libs.GetFunctionName())\n\tbuf := make([]byte, 8)\n\n\tif n, err := conn.Read(buf); err != nil {\n\t\tdms3libs.LogInfo(err.Error())\n\t} else {\n\t\tval, _ := strconv.Atoi(string(buf[:n]))\n\t\tstate := dms3libs.MotionDetectorState(val)\n\n\t\tif dms3libs.MotionDetector.SetState(state) {\n\t\t\tProcessMotionDetectorState()\n\t\t\tdms3libs.LogInfo(\"Received motion detector state as: \" + strconv.Itoa(int(state)))\n\t\t} else {\n\t\t\tdms3libs.LogInfo(\"Unanticipated motion detector state: ignored\")\n\t\t}\n\n\t}\n\n\tdms3libs.LogInfo(\"CLOSE connection from: \" + conn.RemoteAddr().String())\n\tconn.Close()\n\n}", "title": "" }, { "docid": "a82ad905cf00b199a210aea5325ac961", "score": "0.56035733", "text": "func (s *Service) openTCPServer() (net.Addr, error) {\n\tln, err := net.Listen(\"tcp\", s.bindAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.ln = ln\n\n\ts.wg.Add(1)\n\tgo func() {\n\t\tdefer s.wg.Done()\n\t\tfor {\n\t\t\tconn, err := s.ln.Accept()\n\t\t\tif opErr, ok := err.(*net.OpError); ok && !opErr.Temporary() {\n\t\t\t\ts.logger.Println(\"graphite TCP listener closed\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Println(\"error accepting TCP connection\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ts.wg.Add(1)\n\t\t\tgo s.handleTCPConnection(conn)\n\t\t}\n\t}()\n\treturn ln.Addr(), nil\n}", "title": "" }, { "docid": "e4efdfef452ad04ba5d5068095841d1f", "score": "0.5599518", "text": "func (h *proxyHandler) ServeTCP(ctx context.Context, conn tcp.Conn) {\n\t// new proxy connection\n\tconnr := conn.Reader()\n\ttunw := h.tunw\n\tconnMap := h.connMap\n\n\t// conn_reader -> tun_writer\n\tconnData := ctx.Value(proxyConnDataKey{}).(*proxyConnData)\n\ttunID := connData.tunID\n\tconnID := connData.connID\n\tconnMap.Store(connID, connData)\n\tlog.Printf(\"new proxy connection, connID %d:%d\", tunID, connID)\n\tdefer log.Printf(\"proxy connection closed, connID %d:%d\", tunID, connID)\n\n\ttunwbuf := &bytes.Buffer{} // TODO: use pool\n\tif err := packHeader(tunwbuf, CmdConnect); err != nil {\n\t\tlog.Println(\"packHeader err\", err)\n\t\treturn\n\t}\n\tif err := packBodyConnect(tunwbuf, connID); err != nil {\n\t\tlog.Println(\"packBodyConnect err\", err)\n\t\treturn\n\t}\n\tif _, err := tunw.Write(tunwbuf.Bytes()); err != nil {\n\t\tlog.Println(\"write tun err\", err)\n\t\treturn\n\t}\n\n\tif err := <-connData.connectResCh; err != nil {\n\t\treturn\n\t}\n\n\tdone := make(chan struct{})\n\tdefer func() {\n\t\tconnMap.Delete(connID)\n\tLOOP:\n\t\tfor {\n\t\t\t// clean writeCh\n\t\t\tselect {\n\t\t\tcase <-connData.writeCh:\n\t\t\tdefault:\n\t\t\t\tbreak LOOP\n\t\t\t}\n\t\t}\n\n\t\tclose(done)\n\t\tselect {\n\t\tcase <-connData.closeCh:\n\t\tdefault:\n\t\t\ttunwbuf.Reset()\n\t\t\tif err := packHeader(tunwbuf, CmdClose); err != nil {\n\t\t\t\tlog.Println(\"packHeader err\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err := packBodyClose(tunwbuf, connID); err != nil {\n\t\t\t\tlog.Println(\"packBodyClose err\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif _, err := tunw.Write(tunwbuf.Bytes()); err != nil {\n\t\t\t\tlog.Println(\"write tun err\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tconnw := conn.Writer()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase data, ok := <-connData.writeCh:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif _, err := connw.Write(data); err != nil {\n\t\t\t\t\tlog.Println(\"write conn err\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase <-connData.closeCh:\n\t\t\t\tconn.CancelContext()\n\t\t\t\tconn.AbortPendingRead()\n\t\t\t\treturn\n\t\t\tcase <-done:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tbuf := make([]byte, 40<<10)\n\tfor {\n\t\tn, err := connr.Read(buf)\n\t\tif err != nil {\n\t\t\tlog.Println(\"read conn err\", err)\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-connData.closeCh:\n\t\t\treturn // remote peer close\n\t\tdefault:\n\t\t}\n\n\t\ttunwbuf.Reset()\n\t\tif err := packHeader(tunwbuf, CmdSend); err != nil {\n\t\t\tlog.Println(\"packHeader err\", err)\n\t\t\treturn\n\t\t}\n\t\tif err := packBodySend(tunwbuf, connID, buf[:n]); err != nil {\n\t\t\tlog.Println(\"packBodySend err\", err)\n\t\t\treturn\n\t\t}\n\t\tif _, err := tunw.Write(tunwbuf.Bytes()); err != nil {\n\t\t\tlog.Println(\"write tun err\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f956401c179ee3dc885ccb2efd3c90a6", "score": "0.5593425", "text": "func (s *Service) openTCPServer() (net.Addr, error) {\n\tln, err := net.Listen(\"tcp\", s.bindAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.ln = ln\n\n\ts.wg.Add(1)\n\tgo func() {\n\t\tdefer s.wg.Done()\n\t\tfor {\n\t\t\tconn, err := s.ln.Accept()\n\t\t\tif opErr, ok := err.(*net.OpError); ok && !opErr.Temporary() {\n\t\t\t\ts.logger.Info(\"Graphite TCP listener closed\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Info(\"Error accepting TCP connection\", zap.Error(err))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ts.wg.Add(1)\n\t\t\tgo s.handleTCPConnection(conn)\n\t\t}\n\t}()\n\treturn ln.Addr(), nil\n}", "title": "" }, { "docid": "2f130798e1c77178d7ce2a1829df4f3a", "score": "0.5582718", "text": "func (pm ProtocolMultiplexer) ServeTCP(conn *net.TCPConn) error {\n\tpConn := &connpeeker.PeekTCPConn{Conn: conn}\n\tmaxPeek := pm.MaxPeek\n\tif 0 == maxPeek {\n\t\tmaxPeek = 1024\n\t}\n\tfor {\n\t\tif err := pConn.Peek(maxPeek); nil != err {\n\t\t\tconn.Close()\n\t\t\treturn err\n\t\t}\n\t\tfor _, h := range pm.Handlers {\n\t\t\tif connHandler, err := h.Detect(pConn.ReadBuffer); nil != err {\n\t\t\t\tconn.Close()\n\t\t\t\treturn err\n\t\t\t} else if nil != connHandler {\n\t\t\t\treturn connHandler.ServeConn(pConn)\n\t\t\t}\n\t\t\t// otherwise continue search for handler\n\t\t}\n\t\tif maxPeek == len(pConn.ReadBuffer) {\n\t\t\tconn.Close()\n\t\t\treturn fmt.Errorf(\"Couldn't find handler within %v bytes\", maxPeek)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "837ffefc034b96f675dccfc23bd7df4a", "score": "0.55815053", "text": "func (s *Server) handleConn(conn net.Conn, isTLS bool) {\n\t// Read a single byte\n\tbuf := make([]byte, 1)\n\tif _, err := conn.Read(buf); err != nil {\n\t\tif err != io.EOF {\n\t\t\ts.logger.Printf(\"[ERR] consul.rpc: failed to read byte: %v\", err)\n\t\t}\n\t\tconn.Close()\n\t\treturn\n\t}\n\n\t// Enforce TLS if VerifyIncoming is set\n\tif s.config.VerifyIncoming && !isTLS && RPCType(buf[0]) != rpcTLS {\n\t\ts.logger.Printf(\"[WARN] consul.rpc: Non-TLS connection attempted with VerifyIncoming set\")\n\t\tconn.Close()\n\t\treturn\n\t}\n\n\t// Switch on the byte\n\tswitch RPCType(buf[0]) {\n\tcase rpcConsul:\n\t\ts.handleConsulConn(conn)\n\n\tcase rpcRaft:\n\t\tmetrics.IncrCounter([]string{\"consul\", \"rpc\", \"raft_handoff\"}, 1)\n\t\ts.raftLayer.Handoff(conn)\n\n\tcase rpcMultiplex:\n\t\ts.handleMultiplex(conn)\n\n\tcase rpcTLS:\n\t\tif s.rpcTLS == nil {\n\t\t\ts.logger.Printf(\"[WARN] consul.rpc: TLS connection attempted, server not configured for TLS\")\n\t\t\tconn.Close()\n\t\t\treturn\n\t\t}\n\t\tconn = tls.Server(conn, s.rpcTLS)\n\t\ts.handleConn(conn, true)\n\n\tcase rpcMultiplexV2:\n\t\ts.handleMultiplexV2(conn)\n\n\tdefault:\n\t\ts.logger.Printf(\"[ERR] consul.rpc: unrecognized RPC byte: %v\", buf[0])\n\t\tconn.Close()\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0792491cee26d858037fe0a8dd1a54a2", "score": "0.5578954", "text": "func handleConn(conn *net.TCPConn) {\n\n\tfor {\n\t\tconnIsClosed(conn)\n\t\tsampleMessage := []byte(\"Hello!\\n\")\n\t\t_, err := conn.Write(sampleMessage)\n\t\tcheckErr(err)\n\t\ttime.Sleep(1000 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "832b64cd2261d8dc27acf06d56939c3d", "score": "0.556469", "text": "func (service *ElasticsearchService) handleGetConnection(body []byte) (string, error) {\n\tfmt.Println(string(body))\n\treturn service.Comm.GetConnection()\n}", "title": "" }, { "docid": "29c7bad62492747b12f86623aba109b5", "score": "0.55521685", "text": "func (udps *UDPServer) handleConnection(ctx context.Context, conn net.PacketConn) error {\n\tfor {\n\t\tinputBytes := make([]byte, 4096)\n\t\t_, addr, err := conn.ReadFrom(inputBytes) // Only blocks if input bytes is not zero\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Println(addr)\n\t\tlog.Println(\"message :\", string(inputBytes))\n\t}\n}", "title": "" }, { "docid": "4c96cb8a0e46e9366df85b0c461a6186", "score": "0.554185", "text": "func (s *Server) ListenTCP() {\n\tln, err := net.Listen(\"tcp\", s.addr)\n\tif err != nil {\n\t\tlog.Fatalf(\"listen error: %v\", err)\n\t}\n\tlog.Debugf(\"Server started at %s\", s.addr)\n conns := s.clientConns(ln)\n\tfor {\n go s.handleConn(<-conns)\n\t}\n}", "title": "" }, { "docid": "02d5a5e18ad9cb535b87e7885224c028", "score": "0.55294377", "text": "func handleTCPConnectionLogChannel(c net.Conn, logChannel chan string) {\n\tlogger.Debug().Msg(\"Handling incoming socket: \"+ c.RemoteAddr().String())\n\n\t// Create buffer to which data can be written\n\t// Ensure buffer can be read with bufio package from Golang\n\tdataBuffer := make([]byte, 4096)\n\tbufferReader := bufio.NewReader(c)\n\t\n\t// Create loop to get the size of the message and thereby outputting the entire message\n\tfor {\n\t\t// Start preparing capability to read from the generated buffer\n\t\tbufferByteReader, err := bufferReader.ReadByte()\n\t\tif err != nil {\n\t\t\t// fmt.Println(\"Error hit in bytereader: \",err)\n\t\t\tlogger.Error().Err(err).Msg(\"Error hit in bytereader function\")\n\t\t\treturn\n\t\t}\n\n\t\t// Based on the amount of data buffered in the dataBuffer buffer we can get data from it\n\t\t// For some reason this function only works with bufferByteReader active\n\t\tdataInBuffer := bufferReader.Buffered()\n\t\t// fmt.Println(\"Buffersize is \", dataInBuffer)\n\n\t\t// read the full message, or return an error\n\t\treadBytes, err := io.ReadFull(bufferReader, dataBuffer[:int(dataInBuffer)])\n\t\tif err != nil {\n\t\t\t// fmt.Println(\"Error hit in readbyte function: \",err)\n\t\t\tlogger.Error().Err(err).Msg(\"Error hit in readbyte function\")\n\t\t\treturn\n\t\t}\n\n\t\t// Convert buffer to string if there is more than 0 bytes available to convert\n\t\t// fmt.Println(dataBuffer[:int(dataInBuffer)])\n\t\tif bufferByteReader > 0 && readBytes > 0 {\n\t\t\t// Convert data to string for logging purposes\n\t\t\tbytesConvertedToString := string(dataBuffer[:int(dataInBuffer)])\n\n\t\t\t// Validate message index based on available log messages\n\t\t\tmessageIndex := strings.IndexAny(bytesConvertedToString, \"ABCDEGHMNOPQRSTUV\")\n\t\t\tlogger.Trace().Str(\"Index\", string(messageIndex)).Msg(\"Calculated messageindex for message\")\n\n\t\t\t// Use index to get full message\n\t\t\tindexedMessage := string(dataBuffer[messageIndex:int(dataInBuffer)])\n\t\t\t\n\t\t\t// OR Create regexp to ensure all unwanted characters are stripped\n\t\t\t// avrRegex, err := regexp.Compile(\"[^a-zA-Z0-9|\\n ]+\")\n\t\t\t// if err != nil {\n\t\t\t// \tlogger.Trace().Err(err).Msg(\"regular expression error\")\n\t\t\t// }\n\t\t\t// processedAvrString := avrRegex.ReplaceAllString(bytesConvertedToString, \"\")\n\t\t\t\n\t\t\t// Strip of all unwanted characters from the regular expression\n\t\t\t// stripProcessedString := strings.TrimLeft(processedAvrString, \"abcdefghikjlmnopqrstuvwxyz1234567890{}?!@#$%^&*()[]123456789�\")\t\t\t\n\t\t\t\n\t\t\t// Optional loglines for debugging\n\t\t\tlogger.Trace().Str(\"bytesize\", string(bufferByteReader)).Msg(\"BufferBytereader calculated\")\n\n\t\t\tlogChannel <- indexedMessage\n\t\t\tc.Close()\n\t\t\treturn\n\t\t}\n\t\treturn\n\t}\n\t\n}", "title": "" }, { "docid": "2358ab71bbfbdee673790caadd2f811b", "score": "0.552913", "text": "func (t *TcpRelay) handleConnection(conn io.ReadCloser) {\n\n\tstats.Add(\"connectCount\", 1)\n\tstream := NewStreamTracker(t.pool) // Allocate a StreamTracker and get buffer from pool\n\tdefer stream.CleanUp() // Return buffer to pool when we're done\n\n\tvar keepProcessing, finished bool\n\tvar msg *message.Message\n\n\tfor {\n\t\tlog.Debug(\"---------------------\")\n\t\tvar err error\n\n\t\t// Try to read from the stream and deal with the result\n\t\tkeepProcessing, finished = stream.Read(conn)\n\t\tif finished {\n\t\t\tbreak\n\t\t}\n\t\tif !keepProcessing {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stream.FindHeader() || !stream.FindMessage() {\n\t\t\t// Just need to read more data\n\t\t\tcontinue\n\t\t}\n\n\t\t// This happens if we got an unparseable header\n\t\tif !stream.IsValid() {\n\t\t\tstats.Add(\"invalidCount\", 1)\n\t\t\tlog.Warn(\"Skipping invalid message\")\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\t// We should now have a header, so let's parse it\n\t\terr = stream.ParseHeader()\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Unable to parse header: %s\", err)\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stream.HasEnoughCapacity() {\n\t\t\tlog.Warn(\"Dropping message since it would exceed buffer capacity\")\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Read until we have enough to deserialize the body\n\t\tif !stream.HasReadEntireMessage() {\n\t\t\t// We could optimize here by reading again in a loop so we\n\t\t\t// don't re-parse the header. But, once the stream is warmed up,\n\t\t\t// we almost always get a whole message on the first read. So\n\t\t\t// optimizing is kinda silly.\n\t\t\tlog.Debug(\"Not enough data, reading more\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// We got the whole thing, so count it\n\t\tstats.Add(\"receivedCount\", 1)\n\t\tatomic.AddInt64(&sentCount, 1)\n\n\t\tok, err := stream.ParseMessage()\n\t\tif err != nil {\n\t\t\tstats.Add(\"skipped\", 1)\n\t\t\tlog.Warnf(\"Unable to deserialize protobuf message: %s\", err)\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\t\tif !ok {\n\t\t\tstats.Add(\"skipped\", 1)\n\t\t\tlog.Warn(\"Nil message or missing required fields!\")\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\t// This has to happen before cleaning up the buffer.\n\t\tmsg = stream.GetMessage()\n\t\tif t.matcher == nil || t.matcher.Match(msg) {\n\t\t\t// XXX we can substantially improve performance by handling\n\t\t\t// message relaying in a thread pool instead of on the main\n\t\t\t// goroutine. Will involve holding onto the buffer, and would\n\t\t\t// require different behavior here.\n\t\t\tt.connection.RelayMessage(msg)\n\t\t}\n\n\t\t// If we took in more than one message in this read, we need to get a new\n\t\t// buffer and populate it with the remaining data and set the readLen.\n\t\tif !stream.HandleOverread() {\n\t\t\tstream.Reset()\n\t\t}\n\t}\n\n\t// This is Debug level because it's noisy if the service is health checked...\n\tlog.Debug(\"Disconnecting socket\")\n\tconn.Close()\n}", "title": "" }, { "docid": "9062026c1b011a13f3a31b4a7a14714c", "score": "0.5525421", "text": "func handle_tcp_proxy_endpoint(tcpconn net.Conn, proxy_conf ProxyTemplate) {\n\tproxyconn, err := net.Dial(\"tcp\", proxy_conf.Endpoint+\":\"+strconv.Itoa(proxy_conf.EndpointPort))\n\tif err != nil {\n\t\tlog.Print(\"error establishing endpoint connection\")\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tgo tcp_proxy_log(proxyconn, tcpconn, proxy_conf)\n\tgo tcp_proxy_log(tcpconn, proxyconn, proxy_conf)\n}", "title": "" }, { "docid": "642b31f7a9902039a69d584268d1c231", "score": "0.55063987", "text": "func handleConnection(proxy proxyBehavior,\n\tclientConn net.Conn, serverAddr string) {\n\tvar err error\n\n\t// Log disconnections\n\tdefer func() {\n\t\tif err != nil && err != io.EOF {\n\t\t\tfmt.Printf(\"Session exits with error: %v\\n\", err)\n\t\t} else {\n\t\t\tfmt.Printf(\"Session exits cleanly\\n\")\n\t\t}\n\t}()\n\n\tdefer clientConn.Close()\n\n\tc := femebe.NewMessageStream(\"Client\", clientConn, clientConn)\n\n\tserverConn, err := autoDial(serverAddr)\n\tif err != nil {\n\t\tfmt.Printf(\"Could not connect to server: %v\\n\", err)\n\t}\n\n\tb := femebe.NewMessageStream(\"Server\", serverConn, serverConn)\n\n\tdone := proxy.start(c, b)\n\terr = <-done\n}", "title": "" }, { "docid": "8ca47d4121b891f94870bf5efe2f5b27", "score": "0.54991585", "text": "func handleConnection(srv *net.Conn) {\n\t// Create and connect a non-buffered pipe to the already existing connection\n\ts, c := net.Pipe()\n\tconfig.Log.Debug(\"Piping user input to server...\")\n\tgo pipe(&s, srv, \"User\")\n\tconfig.Log.Debug(\"Piping server input to user...\")\n\tgo pipe(srv, &s, \"Server\")\n\n\t// dial the endpoint\n\tcli, err := dial(srv)\n\tif err != nil {\n\t\tconfig.Log.Error(\"Failed to contact endpoint - %v\", err)\n\t\t// write back to redis client the error (http://redis.io/topics/protocol#resp-errors)\n\t\t(*srv).Write([]byte(fmt.Sprintf(\"-ERR Failed to contact endpoint - %v\", err)))\n\t\t(*srv).Close()\n\t\treturn\n\t}\n\n\t// Connect the non-buffered pipe to the dialed client\n\tconfig.Log.Debug(\"Piping client input to endpoint...\")\n\tgo pipe(&cli, &c, \"Client\")\n\tconfig.Log.Debug(\"Piping endpoint input to client...\")\n\tpipe(&c, &cli, \"Endpoint\")\n\n\tconfig.Log.Debug(\"Piping session done\")\n}", "title": "" }, { "docid": "bf222c018faa682ea83776471c327e46", "score": "0.5476699", "text": "func connectTCP(tcpDataStream chan<- Segment, stop <-chan bool) {\n\tconn, err := net.Dial(\"tcp\", config.MEAServerAddress+\":\"+config.MEAServerTcpPort)\n\tdefer conn.Close()\n\tif err != nil {\n\t\tlog.Println(\"Error in tcp.go: \", err)\n\t\terrorhandling.Restart()\n\t}\n\tfmt.Println(\"Connected\")\n\n\t// Allocate a buffer to receive a batch from TCP\n\tbuffer := make([]byte, 60*4*config.SegmentLength)\n\tfor {\n\t\tselect {\n\t\tcase <-stop:\n\t\t\t// If we have received a message from the system to stop the connection, we do so here\n\t\t\t// Defer conn.Close() fixes the rest.\n\t\t\treturn\n\t\tdefault:\n\t\t\t//\n\t\t\t// Read the data from the TCP stream. 60 electrodes, with SegmentLength number of int32's.\n\t\t\t// Each int32 has four bytes. Thus read 60 * 4 * SegmentLength number of bytes\n\t\t\t//\n\t\t\tlr := io.LimitReader(conn, 60*4*config.SegmentLength)\n\t\t\t_, err := lr.Read(buffer)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"TCP Connection is too slow, restarting\")\n\t\t\t\terrorhandling.Restart()\n\t\t\t}\n\n\t\t\t// Data received is in BigEndian, convert this to a int32 array\n\t\t\tvar t int32\n\t\t\tvar meaSegment [60 * config.SegmentLength]int32\n\n\t\t\tfor i := 0; i < 60*config.SegmentLength; i++ {\n\t\t\t\t// Read the next four bytes and convert them to binary. Insert the finished binary\n\t\t\t\t// into the array.\n\t\t\t\tbuf := bytes.NewReader(buffer[(i * 4):(i*4 + 4)])\n\t\t\t\terr = binary.Read(buf, binary.BigEndian, &t)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Error in tcp.go, bianry ready fail: \", err)\n\t\t\t\t\terrorhandling.Restart()\n\t\t\t\t}\n\t\t\t\tmeaSegment[i] = t\n\t\t\t}\n\n\t\t\t// Pass the finished parsed int32 to the tcpDataStream.\n\t\t\ttcpDataStream <- meaSegment\n\t\t}\n\t}\n}", "title": "" }, { "docid": "db32ba298d475e7eb0cd5547a848b7cb", "score": "0.54732007", "text": "func handleConn(conn net.Conn) {\n\tdefer conn.Close()\n\tdefer fmt.Println(\"close tcp connection\")\n\tfmt.Println(\"new tcp connection: \", conn.RemoteAddr())\n\n\tresult := bytes.NewBuffer(nil)\n\tvar buf [1024]byte\n\tfor {\n\t\tn, err := conn.Read(buf[0:])\n\t\tresult.Write(buf[0:n])\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"read err:\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"recv:\", result.String())\n\t\t}\n\t\tresult.Reset()\n\t}\n}", "title": "" }, { "docid": "aff2e77570819f0676a502f47c099210", "score": "0.5465535", "text": "func connectTCP(ctx context.Context, baseLogger *logrus.Entry, address string, tx chan interface{}, onReceive onReceive) {\n\tvar dialer net.Dialer\n\n\tvar log = baseLogger.WithField(\"address\", address)\n\n\tvar conn net.Conn\n\tdialTCP := func() error {\n\n\t\tdialer.Deadline = time.Now().Add(dialTimeout)\n\t\tvar connErr error\n\t\tif conn != nil {\n\t\t\tconn.Close()\n\t\t}\n\n\t\tlog.Info(\"Dialing TCP connection.\")\n\t\tconn, connErr = dialer.DialContext(ctx, \"tcp\", address)\n\n\t\tif connErr != nil {\n\t\t\tlog.WithError(connErr).Info(\"Could not connect with Senso.\")\n\t\t}\n\t\treturn connErr\n\t}\n\n\t// Exponential backoff\n\tvar expBackoff = backoff.NewExponentialBackOff()\n\t// Never stop retrying\n\texpBackoff.MaxElapsedTime = 0\n\t// Set maximum interval to 30s\n\texpBackoff.MaxInterval = maxInterval\n\n\tvar backOffStrategy = backoff.WithContext(expBackoff, ctx)\n\n\tdefer log.Info(\"Connection closed.\")\n\n\tfor true {\n\n\t\tbackOffStrategy.Reset()\n\t\tbackoff.Retry(dialTCP, backOffStrategy)\n\n\t\t// connection/ctx has been cancelled\n\t\tif conn == nil {\n\t\t\treturn\n\t\t}\n\n\t\tlog.Info(\"Connected.\")\n\n\t\t// Close connection if we break or return\n\t\tdefer conn.Close()\n\n\t\t// create channel for reading data and go read\n\t\treadChannel := make(chan []byte)\n\t\tgo tcpReader(log, conn, readChannel)\n\n\t\t// Inner loop for handling data\n\t\tdisconnected := false\n\t\tfor !disconnected {\n\t\t\tselect {\n\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\n\t\t\tcase receivedData, more := <-readChannel:\n\t\t\t\tif more {\n\t\t\t\t\t// Attempt to send data, if can not send immediately discard\n\t\t\t\t\tonReceive(receivedData)\n\t\t\t\t} else {\n\t\t\t\t\tdisconnected = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\tcase i := <-tx:\n\t\t\t\tdata, _ := i.([]byte)\n\t\t\t\terr := write(conn, data)\n\t\t\t\tif err != nil {\n\t\t\t\t\tdisconnected = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "daf52662aee72a4c2d02576c8236532e", "score": "0.546096", "text": "func handleOpcConnection(conn net.Conn, incomingOpcMessageChan chan *OpcMessage) {\n\t// OPC protocol:\n\t// byte 0: channel number\n\t// byte 1: command\n\t// byte 2: length (high byte)\n\t// byte 3: length (low byte)\n\t// bytes 4...: data in R G B order\n\tfor {\n\t\t// get header\n\t\theaderBuf := make([]byte, 4)\n\t\tn, err := conn.Read(headerBuf)\n\t\tif err != nil {\n\t\t\treturn // err is EOF hopefully\n\t\t}\n\t\tif n != 4 {\n\t\t\tpanic(fmt.Sprintf(\"header should be 4 bytes long, got %v\", n))\n\t\t}\n\t\tchannel := headerBuf[0]\n\t\tcommand := headerBuf[1]\n\t\tlength := int(headerBuf[2])<<8 + int(headerBuf[3])\n\n\t\t// get data\n\t\tdataBuf := make([]byte, length)\n\t\t// TODO: test this with length == 0\n\t\tn, err = conn.Read(dataBuf)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif n != length {\n\t\t\tpanic(fmt.Sprintf(\"expected %v bytes of data, got %v\", length, n))\n\t\t}\n\n\t\tincomingOpcMessageChan <- &OpcMessage{channel, command, dataBuf}\n\t}\n}", "title": "" }, { "docid": "9ffbbc01f4fae4b64e101941f015364f", "score": "0.5457576", "text": "func startTCPConnection(nickname, destiny string, conn net.Conn) {\n\tconn, err := net.Dial(\"tcp\", destiny)\n\tif err != nil {\n\t\treturn\n\t}\n\tgo sender(nickname, conn)\n\tgo receiver(conn)\n}", "title": "" }, { "docid": "f3454e1a84e5d9ae19978fb78e7ca3b7", "score": "0.5454436", "text": "func TLSConHandler(TcpConnection *net.TCPConn, ConID int) {\n\n\n\t//Apply tls encryption\n\tTlsConenction := tls.Server(TcpConnection, TLSconfig)\n\n\t//Handle Http stuff\n\tHttpReader := httputil.NewServerConn(TlsConenction, nil)\n\tHandleHTTPClient(HttpReader, ConID, TcpConnection.RemoteAddr().String(), \"https\")\n}", "title": "" }, { "docid": "51d9527ffff558828daa6538f2f8bedd", "score": "0.54473996", "text": "func (a *Assembler) handleEstb(stream *Stream, timestamp time.Time) {\n\tlog.Debugf(\"TCP assembly: TCP connection %s is connected.\", stream.Addr)\n\n\tstream.State = StreamConnected\n\tstream.Client.State = TCPEstablished\n\tstream.Server.State = TCPEstablished\n\tstream.HandshakeEstabTime = timestamp\n\n\tif stream.Analyzer != nil {\n\t\tstream.Analyzer.HandleEstb(timestamp)\n\t}\n}", "title": "" }, { "docid": "8aadf6921af48dd92a0ac7dc717299f7", "score": "0.5444048", "text": "func HandleUserTcpConnection(pxy Proxy, userConn frpNet.Conn) {\n\tdefer userConn.Close()\n\n\t// try all connections from the pool\n\tworkConn, err := pxy.GetWorkConnFromPool()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer workConn.Close()\n\n\tvar local io.ReadWriteCloser = workConn\n\tcfg := pxy.GetConf().GetBaseInfo()\n\tif cfg.UseEncryption {\n\t\tlocal, err = frpIo.WithEncryption(local, []byte(config.ServerCommonCfg.PrivilegeToken))\n\t\tif err != nil {\n\t\t\tpxy.Error(\"create encryption stream error: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\tif cfg.UseCompression {\n\t\tlocal = frpIo.WithCompression(local)\n\t}\n\tpxy.Debug(\"join connections, workConn(l[%s] r[%s]) userConn(l[%s] r[%s])\", workConn.LocalAddr().String(),\n\t\tworkConn.RemoteAddr().String(), userConn.LocalAddr().String(), userConn.RemoteAddr().String())\n\n\tStatsOpenConnection(pxy.GetName())\n\tinCount, outCount := frpIo.Join(local, userConn)\n\tStatsCloseConnection(pxy.GetName())\n\tStatsAddTrafficIn(pxy.GetName(), inCount)\n\tStatsAddTrafficOut(pxy.GetName(), outCount)\n\tpxy.Debug(\"join connections closed\")\n}", "title": "" }, { "docid": "2537249ef337b2cb578ee6a12942f06b", "score": "0.5441895", "text": "func ViaTcp(route string, handler interface{}) {\n\tmainTcp.Via(route, handler)\n}", "title": "" }, { "docid": "5dce190107e3566c36d1aece16f61d4f", "score": "0.54385144", "text": "func TcpAcceptor(conn net.Conn, svc *Service, ipport string) error {\n\twrap, err := WrapTcpConnection(conn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo wrap.pump()\n\treturn nil\n}", "title": "" } ]
494b7e6b11b23423ae2c00f3e295e595
String returns a friendly representation of the classification useful for debugging.
[ { "docid": "97a2173b22cc4c83e50e2ce053106cba", "score": "0.83686244", "text": "func (c Classification) String() string {\n\tswitch c {\n\tcase ClassificationDeficient:\n\t\treturn \"deficient\"\n\tcase ClassificationAbundant:\n\t\treturn \"abundant\"\n\tcase ClassificationPerfect:\n\t\treturn \"perfect\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" } ]
[ { "docid": "5147a4981f56923cf42c9c76f0f35fcc", "score": "0.70162785", "text": "func (s GrokClassifier) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c4fb173b4dc6e74e478ec09825ff674d", "score": "0.69974667", "text": "func (s CreateClassifierOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2478f307b47354a81c8c0aae4fae9091", "score": "0.69642645", "text": "func (s GetClassifierOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "92c8d604150e893b1141f6960df0bce5", "score": "0.6940869", "text": "func (c UAX14Class) String() string {\n if c == sot {\n return \"sot\"\n } else if c == eot {\n return \"eot\"\n } else if c < 0 || c >= UAX14Class(len(_UAX14Class_index)-1) {\n return \"UAX14Class(\" + strconv.FormatInt(int64(c), 10) + \")\"\n }\n return _UAX14Class_name[_UAX14Class_index[c]:_UAX14Class_index[c+1]]\n}", "title": "" }, { "docid": "dd3baeae198d5b61854417787a4e1dd5", "score": "0.69337296", "text": "func (c class) String() string {\n\tname, ok := classMap[c]\n\tif !ok {\n\t\treturn fmt.Sprintf(\"Unknown class %#02x\", byte(c))\n\t}\n\treturn name\n}", "title": "" }, { "docid": "45bc1144f8212f17736058c12160ee66", "score": "0.6907013", "text": "func (s XMLClassifier) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27ad3bc95c8dd5d6e688f9b52c16a87f", "score": "0.6898958", "text": "func (s LogAnomalyClass) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0d304d8b2678ebc68288e5f80cf5982f", "score": "0.6762228", "text": "func (c Category) String() string {\n\tswitch c {\n\tcase Category_productivity:\n\t\treturn \"productivity\"\n\tcase Category_communications:\n\t\treturn \"communications\"\n\tcase Category_social:\n\t\treturn \"social\"\n\tcase Category_webPublishing:\n\t\treturn \"webPublishing\"\n\tcase Category_office:\n\t\treturn \"office\"\n\tcase Category_developerTools:\n\t\treturn \"developerTools\"\n\tcase Category_science:\n\t\treturn \"science\"\n\tcase Category_graphics:\n\t\treturn \"graphics\"\n\tcase Category_media:\n\t\treturn \"media\"\n\tcase Category_games:\n\t\treturn \"games\"\n\tcase Category_other:\n\t\treturn \"other\"\n\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "4aecd50decb24ff740075c76f64230ad", "score": "0.67583185", "text": "func (e DecisionType) String() string {\n\tw := int32(e)\n\tswitch w {\n\tcase 0:\n\t\treturn \"ScheduleActivityTask\"\n\tcase 1:\n\t\treturn \"RequestCancelActivityTask\"\n\tcase 2:\n\t\treturn \"StartTimer\"\n\tcase 3:\n\t\treturn \"CompleteWorkflowExecution\"\n\tcase 4:\n\t\treturn \"FailWorkflowExecution\"\n\tcase 5:\n\t\treturn \"CancelTimer\"\n\tcase 6:\n\t\treturn \"CancelWorkflowExecution\"\n\tcase 7:\n\t\treturn \"RequestCancelExternalWorkflowExecution\"\n\tcase 8:\n\t\treturn \"RecordMarker\"\n\tcase 9:\n\t\treturn \"ContinueAsNewWorkflowExecution\"\n\tcase 10:\n\t\treturn \"StartChildWorkflowExecution\"\n\tcase 11:\n\t\treturn \"SignalExternalWorkflowExecution\"\n\tcase 12:\n\t\treturn \"UpsertWorkflowSearchAttributes\"\n\t}\n\treturn fmt.Sprintf(\"DecisionType(%d)\", w)\n}", "title": "" }, { "docid": "c2e3661b74f0dbb01b04ac2ccd644646", "score": "0.67512214", "text": "func (av AttributeClass) String() string {\n\tswitch av {\n\tcase AttributeClassDatapath:\n\t\treturn \"datapath\"\n\tcase AttributeClassServices:\n\t\treturn \"services\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "4921e20531810eab024eceb3acc9655f", "score": "0.67363113", "text": "func (s CreateClassificationJobOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "956be6fa26df7c5f5d6d49a85b740a08", "score": "0.6734309", "text": "func (s JsonClassifier) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9aca0ad8d359a8467ee0d6537859ffc9", "score": "0.67229724", "text": "func (s GetClassifiersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3f68d5584fc0f130647f87ab873fbb63", "score": "0.67073935", "text": "func (tc TypeCategory) String() string {\n\tswitch tc {\n\tcase Scalar:\n\t\treturn \"scalar\"\n\tcase Enumeration:\n\t\treturn \"enumeration\"\n\tcase Composite:\n\t\treturn \"composite\"\n\tcase Entity:\n\t\treturn \"entity\"\n\tcase Relation:\n\t\treturn \"relation\"\n\t}\n\tpanic(fmt.Errorf(\"couldn't stringify invalid TypeCategory value: %d\", tc))\n}", "title": "" }, { "docid": "61f925f309c2c885e27d966974501409", "score": "0.670372", "text": "func (e MAV_ODID_CLASSIFICATION_TYPE) String() string {\n\tif l, ok := labels_MAV_ODID_CLASSIFICATION_TYPE[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "bce31802a05f6a4e058d738d8be937e3", "score": "0.6700985", "text": "func (s Classifier) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f19298da4cc91e19f47f7bc9663c940a", "score": "0.66758", "text": "func (c Category) String() string {\n\tswitch c {\n\tcase CodingCategory:\n\t\treturn codingCategoryString\n\tcase BrowsingCategory:\n\t\treturn browsingCategoryString\n\tcase BuildingCategory:\n\t\treturn buildingCategoryString\n\tcase CodeReviewingCategory:\n\t\treturn codeReviewingCategoryString\n\tcase DebuggingCategory:\n\t\treturn debuggingCategoryString\n\tcase DesigningCategory:\n\t\treturn designingCategoryString\n\tcase IndexingCategory:\n\t\treturn indexingCategoryString\n\tcase ManualTestingCategory:\n\t\treturn manualTestingCategoryString\n\tcase RunningTestsCategory:\n\t\treturn runningTestsCategoryString\n\tcase WritingTestsCategory:\n\t\treturn writingTestsCategoryString\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "3e21eff07ad5672a13ebdf4ed0ba6743", "score": "0.6622726", "text": "func (c CreditCategory) String() string {\n\tswitch c {\n\tcase CreditReceive:\n\t\treturn \"receive\"\n\tcase CreditGenerate:\n\t\treturn \"generate\"\n\tcase CreditImmature:\n\t\treturn \"immature\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "3e21eff07ad5672a13ebdf4ed0ba6743", "score": "0.6622726", "text": "func (c CreditCategory) String() string {\n\tswitch c {\n\tcase CreditReceive:\n\t\treturn \"receive\"\n\tcase CreditGenerate:\n\t\treturn \"generate\"\n\tcase CreditImmature:\n\t\treturn \"immature\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "8d1c670f413cf1de664ed8d4da5d4dd1", "score": "0.66141164", "text": "func (s CsvClassifier) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "816ecaea22dd958c7727cc13f24212ac", "score": "0.6562322", "text": "func (s CreateGrokClassifierRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8606225c81b2664bd0af51c10ace9271", "score": "0.65159917", "text": "func (e CrossClusterTaskType) String() string {\n\tw := int32(e)\n\tswitch w {\n\tcase 0:\n\t\treturn \"StartChildExecution\"\n\tcase 1:\n\t\treturn \"CancelExecution\"\n\tcase 2:\n\t\treturn \"SignalExecution\"\n\t}\n\treturn fmt.Sprintf(\"CrossClusterTaskType(%d)\", w)\n}", "title": "" }, { "docid": "ec298252dd3a3d871a8f32bde44b86ce", "score": "0.6503092", "text": "func (s LabelDetection) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e6e4e4755f429c4fe40a4553dc287c3d", "score": "0.64516693", "text": "func (me TxsdGraphicCategory) String() string { return xsdt.Nmtoken(me).String() }", "title": "" }, { "docid": "bf6524b8fc84de240fb7cbf0abad4dda", "score": "0.64346784", "text": "func (s GetClassifierInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "851856f1344366193c57e74010f0e147", "score": "0.64163303", "text": "func (s DeleteClassifierOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "183ad4138353866717fd8b998cee36af", "score": "0.64080226", "text": "func (s Sunglasses) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "302fc43062045c50bb618c5f90f080d9", "score": "0.63974637", "text": "func (s CreateClassifierInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7ea008bf0ca2d8ecc6efa8e86158e216", "score": "0.6395945", "text": "func (s StorageClassAnalysis) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70f43e8750848c713f035af4433c6e1c", "score": "0.6363431", "text": "func (s GetClassifiersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "28ff055809cf891a3fbbd4a68b2854b7", "score": "0.6361342", "text": "func (s CreateXMLClassifierRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7246cc6139b14fa4dfdf39f83af8393b", "score": "0.6356474", "text": "func (cs *ClusterModel) String() string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Id: %d, Creation date: %s, Cloud: %s, NodeInstanceType: %s, \", cs.ID, cs.CreatedAt, cs.Cloud, cs.NodeInstanceType))\n\tif cs.Cloud == constants.Azure {\n\t\t// Write AKS\n\t\tbuffer.WriteString(fmt.Sprintf(\"Agent count: %d, Agent name: %s, Kubernetes version: %s\",\n\t\t\tcs.Azure.AgentCount,\n\t\t\tcs.Azure.AgentName,\n\t\t\tcs.Azure.KubernetesVersion))\n\t} else if cs.Cloud == constants.Amazon {\n\t\t// Write AWS Master\n\t\tbuffer.WriteString(fmt.Sprintf(\"Master instance type: %s, Master image: %s\",\n\t\t\tcs.Amazon.MasterInstanceType,\n\t\t\tcs.Amazon.MasterImage))\n\t\t// Write AWS Node\n\t\tbuffer.WriteString(fmt.Sprintf(\"Spot price: %s, Min count: %d, Max count: %d, Node image: %s\",\n\t\t\tcs.Amazon.NodeSpotPrice,\n\t\t\tcs.Amazon.NodeMinCount,\n\t\t\tcs.Amazon.NodeMaxCount,\n\t\t\tcs.Amazon.NodeImage))\n\t} else if cs.Cloud == constants.Google {\n\t\t// Write GKE Master\n\t\tbuffer.WriteString(fmt.Sprintf(\"Master version: %s\",\n\t\t\tcs.Google.MasterVersion))\n\t\t// Write GKE Node\n\t\tbuffer.WriteString(fmt.Sprintf(\"Node count: %d, Node version: %s\",\n\t\t\tcs.Google.NodeCount,\n\t\t\tcs.Google.NodeVersion))\n\t}\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "afc1619ab4f7f910d0bf5bd9fb7b9edc", "score": "0.631081", "text": "func (s Severity) String() string {\n\tswitch s {\n\tcase Normal:\n\t\treturn \"normal\"\n\tcase Medium:\n\t\treturn \"medium\"\n\tcase Critical:\n\t\treturn \"critical\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "64f7161054d8249bc4c450d23ae1eca2", "score": "0.62900573", "text": "func (s CreateJsonClassifierRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50492c3f7e072ad0a8f495639fe41d97", "score": "0.62891823", "text": "func (s CreateCsvClassifierRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f40574d5741ae095d367426cb7d9b487", "score": "0.6280714", "text": "func classToString(class uint16) (string, error) {\n\tswitch class {\n\tcase 1:\n\t\treturn \"IN\", nil\n\tcase 3:\n\t\treturn \"CH\", nil\n\tcase 4:\n\t\treturn \"HS\", nil\n\tcase 254:\n\t\treturn \"NONE\", nil\n\tcase 255:\n\t\treturn \"ANY\", nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unknown class identifier %d\", class)\n\t}\n}", "title": "" }, { "docid": "fbd575273a1460ff400a04cbf2a4e06c", "score": "0.62738585", "text": "func (av AttributeThreads) String() string {\n\tswitch av {\n\tcase AttributeThreadsCached:\n\t\treturn \"cached\"\n\tcase AttributeThreadsConnected:\n\t\treturn \"connected\"\n\tcase AttributeThreadsCreated:\n\t\treturn \"created\"\n\tcase AttributeThreadsRunning:\n\t\treturn \"running\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "72762358f7929ab18900ebce92e29009", "score": "0.62637925", "text": "func (t DSTypeCategory) String() string {\n\tswitch t {\n\tcase DSTypeCategoryHTTP:\n\t\treturn \"HTTP\"\n\tcase DSTypeCategoryDNS:\n\t\treturn \"DNS\"\n\tdefault:\n\t\treturn \"INVALIDDSTYPE\"\n\t}\n}", "title": "" }, { "docid": "3b6344ab9d2be8696e909403879dbc4d", "score": "0.6233435", "text": "func (c Category) String() string {\n\treturn [...]string{\n\t\t\"docs\",\n\t\t\"search\",\n\t\t\"indices\",\n\t\t\"cat\",\n\t\t\"clusters\",\n\t\t\"misc\",\n\t\t\"user\",\n\t\t\"permission\",\n\t\t\"analytics\",\n\t\t\"streams\",\n\t\t\"rules\",\n\t}[c]\n}", "title": "" }, { "docid": "2031cac002a0eca2e4270b560c34f698", "score": "0.62229514", "text": "func (sev Severity) String() string {\n\tname := []string{\"negligible\", \"unknown\", \"low\", \"medium\", \"high\"}\n\ti := int64(sev)\n\tswitch {\n\tcase i >= 1 && i <= int64(SevHigh):\n\t\treturn name[i-1]\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "c94407dc729a993710f05eb61090fb4f", "score": "0.6217589", "text": "func (s UpdateClassifierOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "71497f9e7abf67bed972e0327721a0ec", "score": "0.62160397", "text": "func (s CreateClassificationJobInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "53a9833c084b76890ed80f4b80c2a6c4", "score": "0.62049246", "text": "func (ra *ReductionApproach) String() string {\n\tswitch *ra {\n\tcase ReduceHeuristic:\n\t\treturn \"heuristic\"\n\tcase ReduceBruteForce:\n\t\treturn \"brute-force\"\n\tcase ReduceBruteForceAll:\n\t\treturn \"full-brute-force\"\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unexpected ReductionApproach %d\", *ra))\n\t}\n}", "title": "" }, { "docid": "59f805743cf0091081ad1ddac8ef939a", "score": "0.61837274", "text": "func (t EntryCategory) String() string {\n\treturn string(t)\n}", "title": "" }, { "docid": "30144a4261122c8b997875329bf9448c", "score": "0.61542803", "text": "func (bc *BaselineClass) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"BaselineClass(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", bc.ID))\n\tbuilder.WriteString(\", baseline_class_title=\")\n\tbuilder.WriteString(bc.BaselineClassTitle)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "0f591b3259bb3a5e3d4b852c14df5ccd", "score": "0.61423546", "text": "func (s UpdateGrokClassifierRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50ef2df8499a3d99cd4fc77bfdc773de", "score": "0.6140379", "text": "func (p Facility) String() string {\n\treturn []string{\n\t\t\"kern\", \"user\", \"mail\", \"daemon\",\n\t\t\"auth\", \"syslog\", \"lpr\", \"news\",\n\t\t\"uucp\", \"cron\", \"authpriv\", \"ftp\",\n\t\t\"\", \"\", \"\", \"\",\n\t\t\"local0\", \"local1\", \"local2\", \"local3\",\n\t\t\"local4\", \"local5\", \"local6\", \"local7\",\n\t}[p]\n}", "title": "" }, { "docid": "f8d386fbe56918d36e473c15eaa00ce9", "score": "0.6134057", "text": "func (s Severity) String() string {\n\tswitch s {\n\tcase NegligibleSeverity:\n\t\treturn negligibleSeverityString\n\tcase LowSeverity:\n\t\treturn lowSeverityString\n\tcase MediumSeverity:\n\t\treturn mediumSeverityString\n\tcase HighSeverity:\n\t\treturn highSeverityString\n\tcase CriticalSeverity:\n\t\treturn criticalSeverityString\n\t}\n\treturn unknownSeverityString\n}", "title": "" }, { "docid": "beee8f712a7d3d8585cbf1c01b13a72e", "score": "0.61278874", "text": "func (c Category) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "beee8f712a7d3d8585cbf1c01b13a72e", "score": "0.61278874", "text": "func (c Category) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "54f405343493e02a4ea410ab7aaf3f64", "score": "0.6096681", "text": "func (cm *CM) String() (s string) {\n\ts += \"Confusion Matrix:\\n\"\n\n\t// Row header: column names.\n\ts += \"\\t\"\n\tfor _, col := range cm.GetColumnsName() {\n\t\ts += col + \"\\t\"\n\t}\n\ts += \"\\n\"\n\n\trows := cm.GetDataAsRows()\n\tfor x, row := range *rows {\n\t\ts += cm.rowNames[x] + \"\\t\"\n\n\t\tfor _, v := range *row {\n\t\t\ts += v.String() + \"\\t\"\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\n\ts += fmt.Sprintf(\"TP-FP indices %d %d\\n\", len(cm.tpIds), len(cm.fpIds))\n\ts += fmt.Sprintf(\"FN-TN indices %d %d\\n\", len(cm.fnIds), len(cm.tnIds))\n\n\treturn\n}", "title": "" }, { "docid": "0b25e447e3abf7accc9c86783e413429", "score": "0.6091989", "text": "func (c Categories) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "0b25e447e3abf7accc9c86783e413429", "score": "0.6091989", "text": "func (c Categories) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "2888ef405bceda0f60db03cd7974f2a2", "score": "0.60815", "text": "func (s PutClassificationExportConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "912be1c313b72db62afa6054bd83037e", "score": "0.60746664", "text": "func (c *Category) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Category(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", c.ID))\n\tbuilder.WriteString(\", name=\")\n\tbuilder.WriteString(c.Name)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "f9a9156b2e4d0faf284fa1f681d2c807", "score": "0.60697", "text": "func (av AttributeOperations) String() string {\n\tswitch av {\n\tcase AttributeOperationsFsyncs:\n\t\treturn \"fsyncs\"\n\tcase AttributeOperationsReads:\n\t\treturn \"reads\"\n\tcase AttributeOperationsWrites:\n\t\treturn \"writes\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8fc4312f981a16eea8da3afb440ec65b", "score": "0.60479295", "text": "func (x ApproximationType) String() string {\n\tswitch x {\n\tcase ApproximationTypeUnder:\n\t\treturn \"Under\"\n\tcase ApproximationTypeOver:\n\t\treturn \"Over\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "413a8e795f43366f997fb6d094882b16", "score": "0.60251117", "text": "func (category AircraftCategorySetC) ToString() string {\n\n\tswitch category {\n\tcase ACSCNoCategory:\n\t\treturn \"0 - No aircraft category information\"\n\tcase ACSCSurfaceEmergency:\n\t\treturn \"1 - Surface vehicle - emergency vehicle\"\n\tcase ACSCSurfaceService:\n\t\treturn \"2 - Surface vehicle - service vehicle\"\n\tcase ACSCFixedOrObstruction:\n\t\treturn \"3 - Fixed ground or tethered obstruction\"\n\tcase ACSCReserved1:\n\t\treturn \"4 - Reserved\"\n\tcase ACSCReserved2:\n\t\treturn \"5 - Reserved\"\n\tcase ACSCReserved3:\n\t\treturn \"6 - Reserved\"\n\tcase ACSCReserved4:\n\t\treturn \"7 - Reserved\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v - Unknown code\", category)\n\t}\n}", "title": "" }, { "docid": "e035e8972723f61e455b3a0a761b7988", "score": "0.60246634", "text": "func (s SalesByFilmCategory) String() string {\n\tres := make([]string, 2)\n\tres[0] = \"Category: \" + reform.Inspect(s.Category, true)\n\tres[1] = \"TotalSales: \" + reform.Inspect(s.TotalSales, true)\n\treturn strings.Join(res, \", \")\n}", "title": "" }, { "docid": "8d18f64f90a446251d11c13078c225af", "score": "0.60203993", "text": "func (s ConfusionMatrix) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "85264796f28ecb8e117d3e4fa527d4d2", "score": "0.6015957", "text": "func (s DetectLabelsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ff5a705ec1d73eea4b58cb6833ac6d88", "score": "0.5998925", "text": "func (typ Type) String() string {\n\tif typ.Category == \"\" {\n\t\treturn typ.Name\n\t}\n\treturn typ.Category + \":\" + typ.Name\n}", "title": "" }, { "docid": "0fb17ff7cdae3137eb5f2fa25546dff3", "score": "0.59987336", "text": "func (c *Category) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Category(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", c.ID))\n\tbuilder.WriteString(\", create_time=\")\n\tbuilder.WriteString(c.CreateTime.Format(time.ANSIC))\n\tbuilder.WriteString(\", update_time=\")\n\tbuilder.WriteString(c.UpdateTime.Format(time.ANSIC))\n\tbuilder.WriteString(\", name=\")\n\tbuilder.WriteString(c.Name)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "921df91495f9564fb53fc5d7ee2bbb83", "score": "0.5997662", "text": "func (e AIS_TYPE) String() string {\n\tif l, ok := labels_AIS_TYPE[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "4d007ff8725de9dd1eb3b2336e297d0a", "score": "0.59885293", "text": "func (ro RelationshipOperation) String() string {\n\treturn fmt.Sprintf(\"Relationship target node node: %q (Requirement index %q)\", ro.TargetNodeName, ro.RequirementIndex)\n}", "title": "" }, { "docid": "5175a7423f3318030e3942f3d2f7945c", "score": "0.5984892", "text": "func Classifier(value float64, classes map[int][2]float64, mapper map[int]string) string {\n\tcid := classifierIndex(value, classes)\n\tclass, ok := mapper[cid]\n\tif !ok {\n\t\treturn \"No classification.\"\n\t}\n\treturn class\n}", "title": "" }, { "docid": "fdaad0b1955846e3b183fa87109ad6f1", "score": "0.5983959", "text": "func (e MAV_COLLISION_THREAT_LEVEL) String() string {\n\tif l, ok := labels_MAV_COLLISION_THREAT_LEVEL[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "44b2daa8ba1ec0aa93df92aab03b2692", "score": "0.5969738", "text": "func (c Caffe) String() string {\n\treturn c.conf.Name\n}", "title": "" }, { "docid": "9a2992bf8c19641360814a1ecec877f9", "score": "0.59658176", "text": "func (av AttributeLogOperations) String() string {\n\tswitch av {\n\tcase AttributeLogOperationsWaits:\n\t\treturn \"waits\"\n\tcase AttributeLogOperationsWriteRequests:\n\t\treturn \"write_requests\"\n\tcase AttributeLogOperationsWrites:\n\t\treturn \"writes\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5d7fb68ec31c9455c48373e2b3e14db0", "score": "0.5963615", "text": "func (tpt TrafficPolicyType) String() string {\n\tswitch tpt {\n\tcase ClusterWide:\n\t\treturn \"cluster-wide\"\n\tcase NodeLocal:\n\t\treturn \"node-local\"\n\t}\n\treturn \"INVALID\"\n}", "title": "" }, { "docid": "de9f1b146cde49f48ed7ac2cb76891ef", "score": "0.5962848", "text": "func (t TaskKind) String() string {\n\tswitch t {\n\tcase JudgeSolutionTask:\n\t\treturn \"judge_solution\"\n\tcase UpdateProblemPackageTask:\n\t\treturn \"update_problem_package\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"TaskKind(%d)\", t)\n\t}\n}", "title": "" }, { "docid": "0279dc077077421e0020dd572fccbff8", "score": "0.5957874", "text": "func (s LogAnomalyShowcase) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "716735dc68ccff2d31de1a1b94ad8a3d", "score": "0.59563005", "text": "func (s CelebrityRecognition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "93e35e4f2c712e43a97d22021526b9d1", "score": "0.5956221", "text": "func (crdkinds *CrdKinds) String() string {\n\treturn crdkinds.KindsString\n}", "title": "" }, { "docid": "bc9ab0ba33e0d919cb2c72629d0617ac", "score": "0.5948169", "text": "func (s Severity) String() string {\n\tswitch s {\n\tcase SeverityDefault:\n\t\treturn \"DEFAULT\"\n\tcase SeverityDebug:\n\t\treturn \"DEBUG\"\n\tcase SeverityInfo:\n\t\treturn \"INFO\"\n\tcase SeverityNotice:\n\t\treturn \"NOTICE\"\n\tcase SeverityWarning:\n\t\treturn \"WARNING\"\n\tcase SeverityError:\n\t\treturn \"ERROR\"\n\tcase SeverityCritical:\n\t\treturn \"CRITICAL\"\n\tcase SeverityAlert:\n\t\treturn \"ALERT\"\n\tcase SeverityEmergency:\n\t\treturn \"EMERGENCY\"\n\t}\n\treturn \"UNKNOWN\"\n}", "title": "" }, { "docid": "7b1687480611ec80cd8e291759d27858", "score": "0.5944057", "text": "func (p prob) String() string {\n return fmt.Sprintf(\"(%v), %d\", p.prob_k, p.k)\n}", "title": "" }, { "docid": "821a4dfbfbbf5ae5844bea49c28b74d4", "score": "0.5940722", "text": "func (e FENCE_ACTION) String() string {\n\tif l, ok := labels_FENCE_ACTION[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "0ac84ddee44da133da69ce880bbb8688", "score": "0.59207344", "text": "func (c Crawl) String() string {\n\treturn fmt.Sprintf(\n\t\t\"<Crawl url=%s depth=%d>\",\n\t\tc.URL, c.Depth)\n}", "title": "" }, { "docid": "0bcaa62f9360e8c58fffaab3629c039d", "score": "0.5919636", "text": "func (s TrainingJobStatusCounters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e302a66819588a28eed7d96b8573656b", "score": "0.5919399", "text": "func (p Severity) String() string {\n\treturn []string{\n\t\t\"emerg\", \"alert\", \"crit\", \"err\",\n\t\t\"warning\", \"notice\", \"info\", \"debug\",\n\t}[p]\n}", "title": "" }, { "docid": "243af873d8b12dcbdabeb1a39531debb", "score": "0.5916275", "text": "func (c Scenario) String() string {\n\tvar names []string\n\tfor _, p := range c {\n\t\tnames = append(names, p.Name)\n\t}\n\treturn strings.Join(names, \"/\")\n}", "title": "" }, { "docid": "872ceee5376554d35c5d6bea9b3a0d1e", "score": "0.5889652", "text": "func (c IpNetwork) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "6f752e9211084ec150c34189f108008e", "score": "0.5887713", "text": "func (s ChoreographyLoopType) String() string {\n strings := [...]string{\"none\", \"Standard\", \"MultiInstanceSequential\", \"MultiInstanceParallel\"}\n\n return strings[s]\n}", "title": "" }, { "docid": "829029aa246c4a0be49155236f19f434", "score": "0.58853126", "text": "func (f IntelFaction) String() string {\n\tswitch f {\n\tcase factionRes:\n\t\treturn \"RESISTANCE\"\n\tcase factionEnl:\n\t\treturn \"ENLIGHTENED\"\n\tdefault:\n\t\treturn \"unset\"\n\t}\n}", "title": "" }, { "docid": "dbdececc33105c09112e883535943085", "score": "0.5885053", "text": "func (k distributionKind) String() string {\n\tswitch k {\n\tcase singlePartition:\n\t\treturn \"SINGLE_PARTITION\"\n\tcase allPartitions:\n\t\treturn \"ALL_PARTITIONS\"\n\tcase allShards:\n\t\treturn \"ALL_SHARDS\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "c84ca2f092e013bb4fd29a9dd8d01a07", "score": "0.58800155", "text": "func (s DeleteClassifierInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3210ff2ae55815c2cb6aaffdf9564dd3", "score": "0.58772725", "text": "func (s SegmentDetection) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "75f68a94565d4cd9eda3ce47d343d0a1", "score": "0.586468", "text": "func (e LANDING_TARGET_TYPE) String() string {\n\tif l, ok := labels_LANDING_TARGET_TYPE[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "6fefe2ff0f5c12679fc2486702296fc0", "score": "0.58642125", "text": "func (s EventCategoriesMap) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "acf0eb751f74babe2c166bcc00d9d85b", "score": "0.58620864", "text": "func (s DescribeEventCategoriesOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "acf0eb751f74babe2c166bcc00d9d85b", "score": "0.58620864", "text": "func (s DescribeEventCategoriesOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "00cf0711a46c9673507dd27f83b67422", "score": "0.5855438", "text": "func (e ICAROUS_TRACK_BAND_TYPES) String() string {\n\tif l, ok := labels_ICAROUS_TRACK_BAND_TYPES[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "2784db4df25e5705e98d09c039391596", "score": "0.5853939", "text": "func (c *cpu) String() string {\n\tbuf := &bytes.Buffer{}\n\tbuf.WriteString(\"-------------------------\\n\")\n\n\tfmt.Fprintf(buf, \" BUS: %s (%d)\\n\", ledString(c.bus), c.bus)\n\tfmt.Fprintf(buf, \" PC: %s (%d)\\n\", ledString(c.pc), c.pc)\n\tfmt.Fprintf(buf, \" ADDR: %s (%d)\\n\", ledString(c.addr), c.addr)\n\tfmt.Fprintf(buf, \" RAM: %s (%d)\\n\", ledString(c.ram[c.addr]), c.ram[c.addr])\n\tfmt.Fprintf(buf, \" IR: %s (%s %d)\\n\", ledString(c.ir), instructionNames[c.ir&0xF0], c.ir&0x0F)\n\tfmt.Fprintf(buf, \" A: %s (%d)\\n\", ledString(c.a), c.a)\n\tfmt.Fprintf(buf, \" B: %s (%d)\\n\", ledString(c.b), c.b)\n\tfmt.Fprintf(buf, \" OUT: %s (%d)\\n\", ledString(c.out), c.out)\n\n\tbuf.WriteString(\"FLAGS: \")\n\tfor flag, name := range flagNames {\n\t\tif c.flags&flag != 0 {\n\t\t\tfmt.Fprintf(buf, \"%s \", name)\n\t\t}\n\t}\n\tbuf.WriteString(\"\\n\")\n\tbuf.WriteString(\"-------------------------\\n\")\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "33fa91d65a848521529a1cc649357ab7", "score": "0.5851732", "text": "func (m *MultiFactor) String() string {\n\treturn Stringify(m)\n}", "title": "" }, { "docid": "c65cefc0cbf9d38ebf6273ec85d5cfe9", "score": "0.58515203", "text": "func (s DetectorModelDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "41f32fb78cd25b4cbc9ba56adccdf11c", "score": "0.58508945", "text": "func (e MAV_COLLISION_ACTION) String() string {\n\tif l, ok := labels_MAV_COLLISION_ACTION[e]; ok {\n\t\treturn l\n\t}\n\treturn \"invalid value\"\n}", "title": "" }, { "docid": "8fcb195eeeb50317f0baa1f7b138a781", "score": "0.58501136", "text": "func (s UpdateJsonClassifierRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "419605c3e52aafd5daa114bb13f83c46", "score": "0.58455485", "text": "func (inst *InstanceInfo) String() string {\n\t// FIX: inst looks silly when singular starts with a vowel.\n\treturn fmt.Sprintf(\"%s(%s)\", inst.Id, inst.Class.Singular)\n}", "title": "" }, { "docid": "95114412b88ccd51d9be29dfbc396103", "score": "0.584238", "text": "func (typ ProcessorType) String() string {\n\tswitch typ {\n\tcase Ps:\n\t\treturn \"process\"\n\tcase Fs:\n\t\treturn \"file\"\n\tcase Registry:\n\t\treturn \"registry\"\n\tcase Image:\n\t\treturn \"image\"\n\tcase Net:\n\t\treturn \"net\"\n\tcase Handle:\n\t\treturn \"handle\"\n\tcase Mem:\n\t\treturn \"mem\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "afefc5a0298079b58ded39bdfe9708aa", "score": "0.58395827", "text": "func (s ConnectivityInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
bd99d2ecefcef9e054c8bbe436177ef1
RemoveAt removes the item at the index from the list
[ { "docid": "13f7816e5ce5def4c34b28ee4544956e", "score": "0.7554148", "text": "func (list *UnrolledList_uint32) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" } ]
[ { "docid": "7008362740a37207088633079407afcd", "score": "0.7718454", "text": "func (list *UnrolledList_int64) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "8c040fd509f09d950f9ed572f29f99bd", "score": "0.7701325", "text": "func (list *UnrolledList_int) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "8121d6ba1307f3403114db2fa7873acc", "score": "0.76903963", "text": "func (list *UnrolledList_int8) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "9e07bce5b0e82100bc5ac104688aa0f0", "score": "0.7647347", "text": "func (list *UnrolledList_uint) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "334ad3ae17e881028f92e714e67ac3c6", "score": "0.7646924", "text": "func (list *UnrolledList_int16) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "b536650354572a8c8f5112b456ef255a", "score": "0.76454246", "text": "func (list *UnrolledList_uint8) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "0f9847731f52df27a171e732dafb47b0", "score": "0.76297605", "text": "func (list *UnrolledList_uint64) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "0e74ef2aa39f2bd0e78c25724eed7c38", "score": "0.7628528", "text": "func (list *UnrolledList_int32) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "d9e98ec8452bf9768736019a7c85bc20", "score": "0.759745", "text": "func (list *UnrolledList_float64) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "d8ed2e3b7f2c6e2257f2b1ff08adaf99", "score": "0.7576789", "text": "func (list *UnrolledList_complex64) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "8ee9e79498fbd096f181f7fbff2a1d66", "score": "0.7562563", "text": "func (list *UnrolledList_float32) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "a5207f79baafe3e57287e15e54fa8f29", "score": "0.745442", "text": "func (list *UnrolledList_uint16) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "59a27fe5eb47f3b43a588978f93dba68", "score": "0.73882735", "text": "func (list *List) Remove(index int) {\n\tif !list.withRange(index) {\n\t\treturn\n\t}\n\tlist.elements[index] = nil\n\tcopy(list.elements[index:], list.elements[index+1:list.size])\n\tlist.size--\n\tlist.shrink()\n}", "title": "" }, { "docid": "a907dcb992374c2edd62033431a1130b", "score": "0.73346305", "text": "func (list *UnrolledList_string) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "50e6240cdad8160e4eada5062308de16", "score": "0.72929037", "text": "func (list *UnrolledList_complex128) RemoveAt(idx int) {\n\tfor i := idx; i < list.size-1; i++ {\n\t\tlist.set(i, list.get(i+1))\n\t}\n\tlist.shrink(list.size - 1)\n}", "title": "" }, { "docid": "ac89fa5c7850f495569a168dd9c6f5b5", "score": "0.72889125", "text": "func (store *Store) remove(index int) {\n\n\tstore.List = append(store.List[:index], store.List[index+1:]...) // TODO check\n\tstore.Changed = true\n}", "title": "" }, { "docid": "cc8eb265b5c8b9b52fb4d1167f0bd7d9", "score": "0.69951934", "text": "func (s *singleton) Remove(index int) {\n\ts.UserList[index] = s.UserList[len(s.UserList)-1] // all of this resizes the array\n\ts.UserList = s.UserList[:len(s.UserList)-1] // drop the element\n}", "title": "" }, { "docid": "5245f337fdce2593e6a28bcffbeda802", "score": "0.6918971", "text": "func Remove(index int, file *os.File) {\n\tindex--\n\ttodoList = append(todoList[:index], todoList[index+1:]...)\n\tupdate(file)\n\tListFull()\n}", "title": "" }, { "docid": "83f2844159ac39fe596cb6eb98d5f83c", "score": "0.6857494", "text": "func (v *Vector) RemoveAt(index int) {\n\tv.data = append(v.data[:index], v.data[index+1:]...)\n\tv.size--\n}", "title": "" }, { "docid": "1935ef738f99d3244594eca4703e8282", "score": "0.6828589", "text": "func (l *SEList) Remove(i int) (interface{}, error) {\n\tif i < 0 || i >= l.n {\n\t\treturn nil, errors.New(\"index error\")\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "b3fe94f87bd0b7da4cd805ecebf12d6f", "score": "0.6809313", "text": "func (this *SingleList) DeleteAtIndex(index int) {\n\tp := this\n\tfor i := 1; i <= index; i++ {\n\t\tif p.Next == nil {\n\t\t\treturn\n\t\t}\n\t\tp = p.Next\n\t}\n\tif p.Next == nil {\n\t\treturn\n\t}\n\tp.Next = p.Next.Next\n}", "title": "" }, { "docid": "de875b4b1a4d9a219ad5f605fc27212d", "score": "0.67706484", "text": "func (list *UnrolledList_int8) Remove(item int8) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "d2b176ce24e0185ba913ea35662c8f18", "score": "0.6770461", "text": "func (list *UnrolledList_int) Remove(item int) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "21a24adb92030356abca3fdad5daae88", "score": "0.6765166", "text": "func (list *UnrolledList_int16) Remove(item int16) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "19dd9f7f25ed080a9baff6b9d5f7f70d", "score": "0.6761575", "text": "func (list *List) Remove(pos int) {\n\tslice := []Task(*list)\n\t*list = append(slice[:pos], slice[pos+1:]...)\n}", "title": "" }, { "docid": "d632e8b7473477c645e8765cef532415", "score": "0.6688323", "text": "func (l *list) delete(i int) string {\n \n var curr_elem *elem = l.search(i)\n \n if i <= 0 {\n l.head = curr_elem.next\n l.head.prev = nil\n } else if i >= l.size-1 {\n l.tail = curr_elem.prev\n l.tail.next = nil\n } else {\n curr_elem.prev.next, curr_elem.next.prev = curr_elem.next, curr_elem.prev\n }\n l.size--\n return curr_elem.payload\n}", "title": "" }, { "docid": "038be7a037be68849da0e6f59feea994", "score": "0.6682506", "text": "func (l *LinkedList) remove(index int) {\n\tif index > l.Length {\n\t\tpanic(\"Invalid index; given index larger than Length of the list.\")\n\t}\n}", "title": "" }, { "docid": "04a4a255cb50d4800a7654e32f9c4b75", "score": "0.6678679", "text": "func (l List) Remove(index int) List {\n\tif index == 0 {\n\t\treturn l[1:]\n\t}\n\tvar newList List\n\tnewList = append(newList, l[:index]...)\n\tnewList = append(newList, l[index+1:]...)\n\treturn newList\n}", "title": "" }, { "docid": "567cba9b7866903e141a3408cd205476", "score": "0.6666205", "text": "func (list List) remove(index int) {\n\tif index != list.length-1 && index != 0 {\n\t\t// Basic middle node logic\n\t\tnode := list.get(index)\n\t\tnode.prev.next = list.get(index).next\n\n\t} else if index == list.length-1 {\n\t\tnew_last := list.get(index - 1)\n\t\tnew_last.next = nil\n\t\t*list.last = *new_last\n\n\n\t} else {\n\t\tnew_first := list.get(0)\n\t\t*list.first = *new_first\n\t}\n}", "title": "" }, { "docid": "3e821722b4934ce97e92128a66bae3da", "score": "0.6664971", "text": "func (l *DoorCompanies) Remove(index int) {\n\tres := DoorCompanies{}\n\tfor i, v := range *l {\n\t\tif i == index {\n\t\t\tcontinue\n\t\t}\n\t\tres = append(res, v)\n\t}\n\t*l = res\n}", "title": "" }, { "docid": "e0486ee11e37db3c5276259aef9e8e96", "score": "0.66319513", "text": "func (l *SinglyLinkedList) RemoveAt(index int) interface{} {\n\treturn nil\n}", "title": "" }, { "docid": "da2b43ef301a10d3af929fdd341318c7", "score": "0.6622354", "text": "func (fl *FastList) RemoveIndex(index int) interface{} {\n\tif fl.size <= 0 || index > fl.size-1 || index < 0 {\n\t\treturn nil\n\t}\n\n\tif fl.safe {\n\t\tfl.Lock()\n\t\tdefer fl.Unlock()\n\t}\n\n\told := fl.elementData[index]\n\n\tremElement(fl, index)\n\n\treturn old\n}", "title": "" }, { "docid": "98487bfeb0a8d65efa46c85209672e2f", "score": "0.6608271", "text": "func (list *UnrolledList_float64) Remove(item float64) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "df5b8f9ddb5a1332c6d6a3c2597a507d", "score": "0.6593127", "text": "func (l *Slice) Remove(idx int) (a Atom, exists bool) {\n\ts := len(*l)\n\tif idx < 0 {\n\t\tidx += s\n\t}\n\tif exists = idx >= 0 && idx < s; exists {\n\t\ta = (*l)[idx]\n\t\tns := make(Slice, s-1)\n\t\tcopy(ns[:idx], (*l)[:idx])\n\t\tcopy(ns[idx:], (*l)[idx+1:])\n\t\t*l = ns\n\t}\n\treturn\n}", "title": "" }, { "docid": "ba6f993f01f5935822adcfc75bb2b405", "score": "0.6569198", "text": "func (list *UnrolledList_uint) Remove(item uint) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "6599c386bd3570b78772a70ce471d3c8", "score": "0.6568349", "text": "func (list *UnrolledList_float32) Remove(item float32) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "729199921b3937dba3bd754ebc4a809a", "score": "0.65572244", "text": "func (list *UnrolledList_complex128) Remove(item complex128) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "abeb7d61b14bc839290b36b3a1cc5225", "score": "0.65458155", "text": "func (sl *SortedList) RemoveAt(i int) Comparable {\n\tif i < 0 || sl.length <= i {\n\t\tpanic(\"index out of range\")\n\t}\n\n\tswitch i {\n\tcase 0:\n\t\tif sl.length == 1 {\n\t\t\tvalue := sl.head.value\n\t\t\tsl.head = nil\n\t\t\tsl.tail = nil\n\t\t\tsl.length--\n\t\t\treturn value\n\t\t}\n\n\t\tvalue := sl.head.value\n\t\tsl.head = sl.head.next\n\t\tsl.length--\n\t\treturn value\n\tcase sl.length - 1:\n\t\tif sl.length == 1 {\n\t\t\tvalue := sl.head.value\n\t\t\tsl.head = nil\n\t\t\tsl.tail = nil\n\t\t\tsl.length--\n\t\t\treturn value\n\t\t}\n\n\t\tvalue := sl.tail.value\n\t\tsl.tail = sl.tail.prev\n\t\tsl.length--\n\t\treturn value\n\tdefault:\n\t\tfor itm := sl.head; itm != nil && i < sl.length; itm = itm.next {\n\t\t\tif i == 0 {\n\t\t\t\titm.prev.next = itm.next\n\t\t\t\titm.next.prev = itm.prev\n\t\t\t\tsl.length--\n\t\t\t\treturn itm.value\n\t\t\t}\n\n\t\t\ti--\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "23677a9f0f65290c14fb459a6cdc65cf", "score": "0.6542211", "text": "func (l *todoList) removeItem(i item) (*item, error) {\n\tfor index, value := range l.list {\n\t\tif value == i {\n\t\t\t// remove\n\t\t\t// l.list[index] = nil\n\n\t\t\tl.list = append(l.list[:index], l.list[index+1:]...) // according to Stack Overflow, this is how you remove an item from a list while maintaining order\n\n\t\t\treturn &value, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"list does not contain given item\")\n}", "title": "" }, { "docid": "998396210e3ebb02a339b2e798138c2c", "score": "0.65285444", "text": "func (list *UnrolledList_int64) Remove(item int64) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "7eeefad34e5f0e626fcda716945315a3", "score": "0.652716", "text": "func (list *UnrolledList_uint16) Remove(item uint16) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "3ec31ab0267460a559eebe8f8a87b09c", "score": "0.6524236", "text": "func (list *UnrolledList_uint8) Remove(item uint8) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "19320678383bcedf06e4f4acfcb33857", "score": "0.6515705", "text": "func (list *UnrolledList_complex64) Remove(item complex64) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "dca9f08b1283de116b1614d1daff9262", "score": "0.6497724", "text": "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index < 0 || l.size <= index {\n\t\treturn\n\t}\n\n\ti, cur := -1, this.head\n\tfor i+1 < index {\n\t\ti++\n\t\tcur = cur.next\n\t}\n\n\tcur.next = cur.next.next\n\tthis.size--\n}", "title": "" }, { "docid": "a162d8608b9662c423b3bca799454467", "score": "0.6464752", "text": "func (s *PoolSlice[T]) Remove(index int) {\n\tvar zero T\n\ts.Items[index] = zero\n\ts.idxGen.Release(index)\n}", "title": "" }, { "docid": "b7820c4019efc3a6c2b90ba5e3c8ea6b", "score": "0.64289546", "text": "func (r *Recipients) RemoveByIndex(idx int) error {\n\tif idx < 0 {\n\t\treturn fmt.Errorf(\"%d is out of bound\", idx)\n\t}\n\n\tif idx >= len(*r) {\n\t\treturn fmt.Errorf(\"%d is out of bound\", idx)\n\t}\n\n\t*r = append((*r)[:idx], (*r)[idx+1:]...)\n\treturn nil\n}", "title": "" }, { "docid": "684ae8948efe7e3a2c4d36d50eb6cef3", "score": "0.6410093", "text": "func (list *UnrolledList_string) Remove(item string) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "fc5d2b3f3b7762b7512f3a8a784d7cef", "score": "0.64017856", "text": "func (list *UnrolledList_uint64) Remove(item uint64) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "d66d306a34875840372c7ed90ce25c59", "score": "0.6395908", "text": "func removeFromSlice(sl []*timer, index int) []*timer {\n\treturn append(sl[:index], sl[index+1:]...)\n}", "title": "" }, { "docid": "b2141d82acf8abbdf5dca18523cdbfcd", "score": "0.6368621", "text": "func (list *UnrolledList_int32) Remove(item int32) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "e69fd97e30444c316e5b67b232089fea", "score": "0.63679254", "text": "func (c *blockCache) remove(idx int) error {\n\tif idx >= len(c.blockList) {\n\t\treturn fmt.Errorf(\"index out of range for remove: %d\", idx)\n\t}\n\n\tc.mu.Lock()\n\tc.blockList[idx] = nil\n\tc.mu.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "1632adb8421903a5ffd028950cd14a4b", "score": "0.6362564", "text": "func (v *Vector) Remove(index int) interface{} {\n\tif !v.checkIndex(index) {\n\t\tpanic(\"Array index out of bounds\")\n\t}\n\tval := v.storage[index]\n\tv.resizeIfNeed(v.size - 1)\n\tfor i := index + 1; i < v.size; i++ {\n\t\tv.storage[i-1] = v.storage[i]\n\t}\n\tv.storage[v.size-1] = nil\n\tv.size--\n\treturn val\n}", "title": "" }, { "docid": "388f926976f64bb509305f17848f3ca0", "score": "0.63536525", "text": "func (p *txidsSlice) removeTxidEntryAtIndex(index int) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tp.m = append(p.m[:index], p.m[index+1:]...)\n}", "title": "" }, { "docid": "8d6cb80f68ac36aaa552c174212ef37f", "score": "0.6345011", "text": "func (s *LinkedList) RemoveAt(index int) (interface{}, error) {\n\tif index < 0 || index >= s.count {\n\t\treturn nil, errIndexOutOfBounds\n\t}\n\n\tif s.count == 1 {\n\t\tvalue := s.head.Value\n\t\ts.head = nil\n\t\ts.tail = nil\n\t\ts.count--\n\t\treturn value, nil\n\t}\n\n\tif index == 0 {\n\t\tcurrent := s.head\n\t\ts.head = current.Next\n\t\tcurrent.Next = nil\n\t\tvalue := current.Value\n\t\ts.count--\n\t\tcurrent = nil\n\t\treturn value, nil\n\t}\n\n\tcurrent, err := s.getNode(index - 1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvalue := current.Next.Value\n\tcurrent.Next = current.Next.Next\n\tif index == s.count-1 {\n\t\ts.tail = current\n\t}\n\ts.count--\n\tcurrent = nil\n\treturn value, nil\n}", "title": "" }, { "docid": "fc4de778ef6672e558a44e451ac8fbbe", "score": "0.6318472", "text": "func (l *State) Remove(index int) {\n\tapiCheckStackIndex(index, l.indexToValue(index))\n\ti := l.callInfo.function + l.AbsIndex(index)\n\tcopy(l.stack[i:l.top-1], l.stack[i+1:l.top])\n\tl.top--\n}", "title": "" }, { "docid": "1b54066e98bd014016a417ea30e00829", "score": "0.63111156", "text": "func (l *list) delete(i int){\n\tif i >= l.len || i < 0{\t//index validation\n\t\tfmt.Println(\"Error: index out of bound!\")\n\t\treturn\n\t}\n\n\tvar cur *node\n\tif i <= (l.len/2) {\t//find position from head\n\t\tcur = l.head\n\t\tfor ;i >= 0; i-- {\n\t\t\tcur = cur.next\n\t\t}\n\t}else{\t//find position from tail\n\t\tcur = l.tail\n\t\tfor ;i < l.len; i++ {\n\t\t\tcur = cur.previous\n\t\t}\n\t}\n\tcur.previous.next = cur.next\n\tcur.next.previous = cur.previous\n\tl.len--\n}", "title": "" }, { "docid": "8ff41f8acb205fba8aeb01a1fd5cf000", "score": "0.63080645", "text": "func (l *List) LRemByIndex(key string, indexes []int) error {\n\tif l.IsExpire(key) {\n\t\treturn ErrListNotFound\n\t}\n\n\tlist := l.Items[key]\n\n\tif list.Size() == 0 {\n\t\treturn nil\n\t}\n\n\tif len(indexes) == 1 {\n\t\tlist.Remove(indexes[0])\n\t\treturn nil\n\t}\n\n\tidxes := make(map[int]struct{})\n\tfor _, idx := range indexes {\n\t\tif idx < 0 || idx >= list.Size() {\n\t\t\tcontinue\n\t\t}\n\t\tidxes[idx] = struct{}{}\n\t}\n\n\titerator := list.Iterator()\n\titerator.Begin()\n\n\titems := make([]*Record, list.Size()-len(idxes))\n\ti := 0\n\tfor iterator.Next() {\n\t\tif _, ok := idxes[iterator.Index()]; !ok {\n\t\t\titems[i] = iterator.Value().(*Record)\n\t\t\ti++\n\t\t}\n\t}\n\n\tlist.Clear()\n\tfor _, item := range items {\n\t\tlist.Append(item)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "11b0feeac643ea2fe2181d10c4ee0f3d", "score": "0.6306928", "text": "func (list *LinkedList) deleteFromIndex(index int) error {\n\t// out of bounds\n\tif index < 0 || index > list.length {\n\t\treturn errors.New(\"index out of bound\")\n\t}\n\t// i == 0; delete from start\n\tif index == 0 {\n\t\tlist.deleteFromStart()\n\t\treturn nil\n\t}\n\t// i == list length; delete from end\n\tif index == list.length {\n\t\tlist.deleteFromEnd()\n\t\treturn nil\n\t}\n\n\tcurrNode, prevNode := list.head, &LLNode{}\n\n\tfor index != 0 {\n\t\tprevNode = currNode\n\t\tcurrNode = currNode.next\n\t\tindex--\n\t}\n\n\tprevNode.next = currNode.next\n\tlist.length--\n\n\treturn nil\n}", "title": "" }, { "docid": "3cbc135000a1f933c134378e0dca6b70", "score": "0.63020337", "text": "func (da *DynamicArray) Remove(index int) error {\n\terr := da.CheckRangeFromIndex(index)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcopy(da.ElementData[index:], da.ElementData[index+1:da.Size])\n\tda.ElementData[da.Size-1] = nil\n\n\tda.Size--\n\n\treturn nil\n}", "title": "" }, { "docid": "750362064157a705ca09b1a30ab35e1a", "score": "0.6301771", "text": "func (ix *Index) Remove(item Item) {\n\tminX, minY, maxX, maxY := item.Rect()\n\tix.r.Delete([]float64{minX, minY}, []float64{maxX, maxY}, item)\n}", "title": "" }, { "docid": "f13aa0150bcc8de1c7bf099d67a7cc93", "score": "0.62654716", "text": "func (list *UnrolledList_uint32) Remove(item uint32) {\n\tidx := list.IndexOf(item)\n\tif idx < 0 {\n\t\treturn\n\t}\n\tlist.RemoveAt(idx)\n}", "title": "" }, { "docid": "0fcc233b53a1d5e32f7e0fa55af880bb", "score": "0.6249121", "text": "func (l *List) Remove(index int) interface{} {\n\tnode, err := l.getPrior(index)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\t// If there isn't a node before the specified index, then that means either the index is 0 or\n\t// this list is empty.\n\tvar pop *hnode\n\tif node == nil {\n\t\tif l.head == nil {\n\t\t\treturn nil\n\t\t}\n\t\tpop = l.head\n\t\tl.head = l.head.next\n\t} else {\n\t\tpop = node.next\n\t\tnode.next = pop.next\n\t}\n\n\tl.length--\n\treturn pop.item\n}", "title": "" }, { "docid": "3aa4a6a4ac5b7bfbe63cfd97caedfeda", "score": "0.6246913", "text": "func (in *inode) removeAt(i int) pair {\n\tit := (*in)[i]\n\tcopy((*in)[i:], (*in)[i+1:])\n\t(*in)[len(*in)-1] = pair{}\n\t(*in) = (*in)[:len(*in)-1]\n\treturn it\n}", "title": "" }, { "docid": "9587f4f12f3d688bb279db5e8bf30efb", "score": "0.6243935", "text": "func DeleteIndexOf(i int, slc interface{}) {\n\tsliceP := reflect.ValueOf(slc)\n\tslice := sliceP.Elem()\n\tif i >= slice.Len()-1 {\n\t\ts1 := slice.Slice(0, i)\n\t\treflect.Copy(slice, s1)\n\t\tslice.SetLen(slice.Len() - 1)\n\t} else if i >= 0 {\n\t\ts1 := slice.Slice(0, i)\n\t\ts2 := slice.Slice(i+1, slice.Len())\n\t\ts3 := reflect.AppendSlice(s1, s2)\n\t\treflect.Copy(slice, s3)\n\t\t//need addressable value\n\t\tslice.SetLen(slice.Len() - 1)\n\t}\n}", "title": "" }, { "docid": "fd32fa6db97cb3f7d1c2a597c31b63ba", "score": "0.6221126", "text": "func (this *MyLinkedList) DeleteAtIndex(index int) {\n prev := this.getAt(index)\n if prev ==nil {\n return\n }\n prev.Next = prev.Next.Next\n if prev.Next == nil {\n this.Tail = prev\n }\n}", "title": "" }, { "docid": "d49fe00b814934ade4bdd4373cf8374f", "score": "0.6219144", "text": "func (dd *DropDown) RemoveAt(pos int) {\n\n\tdd.list.RemoveAt(pos)\n}", "title": "" }, { "docid": "8b651acca8baebf985055b9edb1ebcc9", "score": "0.62080306", "text": "func (p *blockHeightsSlice) removeBlockHeightEntryAtIndex(index int) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tp.m = append(p.m[:index], p.m[index+1:]...)\n}", "title": "" }, { "docid": "a7c643e68df6a0e0a53f66c6ba56d2cd", "score": "0.6205888", "text": "func (l *List) DeleteAt(pos int) {\n\n\t//Out of bounds\n\tif pos <= 0 || pos > l.len {\n\t\treturn\n\t}\n\n\t//Remove head\n\tif pos == 1 {\n\t\tl.head = l.head.next\n\t\tl.len--\n\t\treturn\n\t}\n\n\tprev := l.previousNode(pos)\n\tprev.next = prev.next.next\n\tl.len--\n}", "title": "" }, { "docid": "34f6f9c9dc174e8edd851d22e3d82b9a", "score": "0.618039", "text": "func RemoveItem(slice []int, index int) []int {\n\tif IsValidIndex(slice, index) {\n\t\tslice = append(slice[:index], slice[index+1:]...)\n\t}\n\treturn slice\n}", "title": "" }, { "docid": "25a846ca5fd058e29b1ef168ba4edaf5", "score": "0.6178038", "text": "func Remove(slice []interface{}, index int) []interface{} {\n\tif ok := checkIfIndexExist(slice, index); ok {\n\t\treturn append(slice[:index], slice[index+1:]...)\n\t}\n\treturn slice\n}", "title": "" }, { "docid": "7f569546a2bb12089b9f17a44106e8e3", "score": "0.6169874", "text": "func removeByIndex(s []string, i int) []string {\n s[i] = s[len(s)-1]\n return s[:len(s)-1]\n}", "title": "" }, { "docid": "0775d0657907ad068f45e5d6ab3e3b98", "score": "0.6164701", "text": "func (l *list) delete(i int) {\n\n if i <= l.size-1 {\n\n\te:= l.begin\n\n\tfor j:=1;j<i;j++ {\n\n\t\t\te = e.next\n\t}\n\n\tif e.prev == nil {\n\n\t\tl.begin = e.next\n\n\t} else {\n\t\t\t\n\t\te.prev.next = e.next\n\t}\n\n\tif e.next == nil {\n\t\t\t\n\t\tl.end = e.prev\t\t\t\t\n\n\t} else {\n\n\t\te.next.prev = e.prev\n\t\t\t\n\t}\n\n\te.prev = nil\n\te.next = nil\n\n\tl.size--\n\n }\t\t\n\t\t\n\n\t\t\n\n}", "title": "" }, { "docid": "c9ef614defb18f129497935edbf97a1d", "score": "0.61450213", "text": "func (m *MusicManager) Remove(index int) *MusicEntry {\n\tif index < 0 || index > len(m.musics) {\n\t\treturn nil\n\t}\n\n\tremovedMusic := &m.musics[index]\n\tm.musics = append(m.musics[:index], m.musics[index+1:]...)\n\treturn removedMusic\n}", "title": "" }, { "docid": "e4a1c2ee4698a583199dd3d09e2d2fe4", "score": "0.6140516", "text": "func (array *Array) Remove(index int, l ...int) (value []interface{}, err error) {\n\tr, size := array.checkIndex(index)\n\n\tif r {\n\t\terr = ERR_ILLEGAL_INDEX\n\t\treturn\n\t}\n\tremoveL := 1\n\tif len(l) > 0 && l[0] > 1 {\n\t\tremoveL = l[0]\n\t}\n\n\tvalue = make([]interface{}, removeL)\n\tcopy(value, array.data[index:index+removeL])\n\tfor i := index + removeL; i < array.size; i++ {\n\t\tarray.data[i-removeL] = array.data[i]\n\t\tarray.data[i] = nil\n\t}\n\n\tarray.size = size - removeL\n\tcapLen := array.CapLength()\n\tif array.size == capLen/4 && capLen/2 != 0 {\n\t\tarray.resize(capLen / 2)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c2aa73919222577fbe35fed572b11754", "score": "0.6138689", "text": "func removeIndex(i []int, index int) []int {\r\n\treturn append(i[:index], i[index+1:]...)\r\n}", "title": "" }, { "docid": "f2a305c3bf05e89bb2c5f6fefec37ac3", "score": "0.61363417", "text": "func (l *List) RemoveMatch(value interface{}) {\n\t// If the item exists in the list, then remove it at the index found.\n\tif i := l.Index(value); i >= 0 {\n\t\tl.Remove(i)\n\t}\n}", "title": "" }, { "docid": "19a040a172b068b3ab3fea2c2731e303", "score": "0.61340445", "text": "func (arr *Array) Remove(index int, l ...int) (value []interface{}, err error) {\n\tr, size := arr.checkIndex(index)\n\n\tif r {\n\t\terr = ErrIllegalIndex\n\t\treturn\n\t}\n\tremoveL := 1\n\tif len(l) > 0 && l[0] > 1 {\n\t\tremoveL = l[0]\n\t}\n\n\tvalue = make([]interface{}, removeL)\n\tcopy(value, arr.data[index:index+removeL])\n\tfor i := index + removeL; i < arr.size; i++ {\n\t\tarr.data[i-removeL] = arr.data[i]\n\t\tarr.data[i] = nil\n\t}\n\n\tarr.size = size - removeL\n\tcapLen := arr.CapLength()\n\tif arr.size == capLen/4 && capLen/2 != 0 {\n\t\tarr.resize(capLen / 2)\n\t}\n\treturn\n}", "title": "" }, { "docid": "17854f06d6fbff4652ec4c3c816677a0", "score": "0.6132189", "text": "func Delete(list []int, index int) []int {\n list = append(list[:index], list[index+1:]...)\n // list is the thing that changes/\n // it points at the same place, it removes the element at the given index, and it gets updated to have length 4.\n\n // list gets destroyed\n return list // updates the slice outside of the function to have the appropriate length\n}", "title": "" }, { "docid": "cf55c3cedf144054b31b74b35fad40eb", "score": "0.612633", "text": "func (streamSelf *StreamDef) Remove(index int) *StreamDef {\n\tif index >= 0 && index < streamSelf.Len() {\n\t\tstreamSelf.list = append(streamSelf.list[:index], streamSelf.list[index+1:]...)\n\t}\n\treturn streamSelf\n}", "title": "" }, { "docid": "994caf1b651715ec526e378683cdb5a1", "score": "0.6121516", "text": "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\ti := -1\n\tp := this\n\tfor p != nil {\n\t\tif i == index-1 {\n\t\t\tq := p.Next\n\t\t\tif q == nil {\n\t\t\t\tp.Next = nil\n\t\t\t} else {\n\t\t\t\tp.Next = q.Next\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tp, i = p.Next, i+1\n\t}\n}", "title": "" }, { "docid": "9a7a3aaa4952116f1792445d3c2b10a2", "score": "0.61113983", "text": "func RemoveAt(vs []string, i int) []string {\n\tif i < 0 {\n\t\treturn vs\n\t}\n\tif i > len(vs)-1 {\n\t\treturn vs\n\t}\n\treturn append(vs[:i], vs[i+1:]...)\n}", "title": "" }, { "docid": "86bc09dcfdaea41412d5dc1c5372f6fa", "score": "0.61103874", "text": "func RemoveItem(slice []int, index int) []int {\n\tif VerifyIndex(slice, index) {\n\t\t// golang has a weird way of removing things from slices?\n\t\tslice = append(slice[:index], slice[index+1:]...)\n\t}\n\treturn slice\n}", "title": "" }, { "docid": "bb4fba89b4765dbf57f31a6b729f75fd", "score": "0.6102193", "text": "func (l *eventList) remove() {\n\tif len(l.seqs) > 0 {\n\t\tseq := l.seqs[0]\n\t\tl.seqs = l.seqs[1:]\n\t\tdelete(l.events, seq)\n\t}\n}", "title": "" }, { "docid": "78090894e759ddb00b96c534dba8eef9", "score": "0.60960203", "text": "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index < 0 || index >= len(this.d) {\n\t\treturn\n\t}\n\tthis.d = append(this.d[:index], this.d[index+1:]...)\n}", "title": "" }, { "docid": "b0c979a3a9de004d0ea91fc8bd3b6b99", "score": "0.6091025", "text": "func Remove(slice interface{}, index int) {\n\telemsize := sizeof(slice)\n\tsliceheader := slicepointerinterface(slice)\n\tsliceheader.Cap *= elemsize\n\tsliceheader.Len *= elemsize\n\tbytes := (*[]byte)(unsafe.Pointer(sliceheader))\n\n\tcopy((*bytes)[index*elemsize:], (*bytes)[(index+1)*elemsize:])\n\tsliceheader.Len -= elemsize\n\tsliceheader.Cap /= elemsize\n\tsliceheader.Len /= elemsize\n}", "title": "" }, { "docid": "bcb1e7229a77db5dc74144735ae0efb4", "score": "0.60807234", "text": "func deleteFromPop(population *Population, index int) {\n population.Individuals = append(population.Individuals[:index], population.Individuals[index+1:]...)\n}", "title": "" }, { "docid": "4412bd271ddf0e1c18ab5ffda5b4bc75", "score": "0.60741746", "text": "func (c *AnyValueArray) Remove(index int) {\n\tc.value = append(c.value[:index], c.value[index+1:]...)\n}", "title": "" }, { "docid": "6832e08285fda04346382eb3ae3c2694", "score": "0.60692734", "text": "func remove(s []serializableModels.ClientMessage, i int) []serializableModels.ClientMessage {\n\ts[i] = s[len(s)-1]\n\treturn s[:len(s)-1]\n}", "title": "" }, { "docid": "fd8a8434d694be42af67d57b324a8c58", "score": "0.6058959", "text": "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\t// p is the index-th node\n\t// p1 is the previous node of p\n\tp1, p := this, this.next\n\ti := 0\n\tfor p != nil {\n\t\tif i == index {\n\t\t\tp1.next = p.next\n\t\t}\n\t\tp1 = p\n\t\tp = p.next\n\t\ti++\n\t}\n}", "title": "" }, { "docid": "4e44be4bf57287369ff451f3f559e466", "score": "0.6048902", "text": "func (this *MyLinkedList) DeleteAtIndex(index int) {\n\tif index > this.length-1 {\n\t\treturn\n\t}\n\tdummy := &Node{next: this.head}\n\tprev := dummy // 要删除的是 prev.next\n\tfor i := 0; i < index; i++ {\n\t\tprev = prev.next\n\t}\n\n\tif prev.next != nil {\n\t\tprev.next = prev.next.next\n\t}\n\t// 如果删除的是最后一个,要重置 tail\n\tif index == this.length-1 {\n\t\tthis.tail = prev\n\t}\n\n\t// 注意重置 head\n\tthis.head = dummy.next\n\tthis.length--\n\t// fmt.Println(\"delete at index\", index, this.length)\n\n}", "title": "" }, { "docid": "7381d01d4d4ffa87aeec3d1b27c92f57", "score": "0.60415006", "text": "func (l *List) Remove(i *Item) {\n\tif !l.contains(i) {\n\t\treturn\n\t}\n\n\tif l == nil {\n\t\treturn\n\t}\n\n\tif l.Len() == 0 {\n\t\treturn\n\t}\n\n\tdefer func() { l.size-- }()\n\n\t// head\n\tif i.Prev() == nil {\n\t\tl.head = i.Next()\n\t\treturn\n\t}\n\n\t// tail\n\tif i.Next() == nil {\n\t\tl.tail = i.Prev()\n\t\treturn\n\t}\n\n\ti.Prev().next = i.Next()\n\ti.Next().prev = i.Prev()\n}", "title": "" }, { "docid": "f8338c8861adff548c84311814a8af53", "score": "0.60252535", "text": "func (ll *MyLinkedList) DeleteAtIndex(index int) {\n\tif ll.Size == 0 {\n\t\treturn\n\t}\n\tif index >= ll.Size {\n\t\treturn\n\t}\n\tif index == 0 {\n\t\tll.Head = ll.Head.next\n\t\tll.Size = ll.Size - 1\n\t\treturn\n\t}\n\tptr := ll.Head\n\ti := 0\n\tfor i < index-1 {\n\t\tptr = ptr.next\n\t\ti++\n\t}\n\tif ptr.next.next == nil {\n\t\tptr.next = nil\n\t} else {\n\t\tptr.next = ptr.next.next\n\t}\n\tll.Size = ll.Size - 1\n\n}", "title": "" }, { "docid": "d48966d639037c07e9d7325816118cc4", "score": "0.6024505", "text": "func (u *baseList) RemoveItem(index int) {\n\tu.items = append(u.items[:index], u.items[index+1:]...)\n\tu.refreshUpdated()\n}", "title": "" }, { "docid": "15efe73502c3049d69aca82a1968eac9", "score": "0.6016608", "text": "func (fMgrs *FileMgrCollection) DeleteAtIndex(idx int) error {\n\n ePrefix := \"FileMgrCollection.DeleteAtIndex() \"\n\n if fMgrs.fileMgrs == nil {\n fMgrs.fileMgrs = make([]FileMgr, 0, 50)\n }\n\n if idx < 0 {\n return fmt.Errorf(ePrefix+\n \"Error: Input Parameter 'idx' is less than zero. \"+\n \"Index Out-Of-Range! idx='%v'\", idx)\n }\n\n arrayLen := len(fMgrs.fileMgrs)\n\n if arrayLen == 0 {\n return errors.New(ePrefix +\n \"Error: The File Manager Collection, 'FileMgrCollection', is EMPTY!\")\n }\n\n if idx >= arrayLen {\n return fmt.Errorf(ePrefix+\n \"Error: Input Parameter 'idx' is greater than the \"+\n \"length of the collection index. Index Out-Of-Range! \"+\n \"idx='%v' Array Length='%v' \", idx, arrayLen)\n }\n\n if arrayLen == 1 {\n fMgrs.fileMgrs = make([]FileMgr, 0, 100)\n } else if idx == 0 {\n // arrayLen > 1 and requested idx = 0\n fMgrs.fileMgrs = fMgrs.fileMgrs[1:]\n } else if idx == arrayLen-1 {\n // arrayLen > 1 and requested idx = last element index\n fMgrs.fileMgrs = fMgrs.fileMgrs[0 : arrayLen-1]\n } else {\n // arrayLen > 1 and idx is in between\n // first and last elements\n fMgrs.fileMgrs =\n append(fMgrs.fileMgrs[0:idx], fMgrs.fileMgrs[idx+1:]...)\n }\n\n return nil\n}", "title": "" }, { "docid": "75156c60e2c073338acdd5b6ec2eeb02", "score": "0.60159075", "text": "func remove(s []Board, i int) []Board {\n\ts[i] = s[len(s)-1]\n\treturn s[:len(s)-1]\n}", "title": "" }, { "docid": "7dbf273039bf6c06f3dc13dd5cb8fdb5", "score": "0.60151964", "text": "func ListRemove(l *list.List, e *list.Element,) interface{}", "title": "" }, { "docid": "0b873621efdee3cea3b74916051a9b88", "score": "0.60080343", "text": "func (e *EndpointStore) Remove(name string) {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\titemsLen := len(e.list)\n\tif itemsLen == 0 {\n\t\treturn\n\t}\n\tendpoint, found := e.index[name]\n\tif !found {\n\t\treturn\n\t}\n\tind := endpoint.index\n\toldList := e.list\n\tif ind == itemsLen-1 {\n\t\te.list = append([]*EndpointStoreItem{}, oldList[:ind]...)\n\t} else {\n\t\te.list = append([]*EndpointStoreItem{}, oldList[:ind]...)\n\t\te.list = append(e.list, oldList[ind+1:]...)\n\t}\n\tdelete(e.index, name)\n\tfor i := ind; i < itemsLen-1; i++ {\n\t\te.list[i].index = e.list[i].index - 1\n\t}\n}", "title": "" }, { "docid": "f0220d0c719f809de7fa8a23cd8843be", "score": "0.6006633", "text": "func (l *list) delete(i int) {\n\t//in list?\n\tif !(i < l.length && i >= 0) {\n\t\treturn\n\t}\n\n\tcurrent := l.head\n\n\tfor j := 0; j != i; j++ {\n\t\tcurrent = current.next\n\t}\n\tif current.prev != nil {\n\t\tcurrent.prev.next = current.next\n\t}\n\tif current.next != nil {\n\t\tcurrent.next.prev = current.prev\n\t}\n}", "title": "" }, { "docid": "40f68fd4d9f62be3f7ac737f59aa905e", "score": "0.60065365", "text": "func removeTicket(tickets []*stakeTicket, index int) []*stakeTicket {\n\tcopy(tickets[index:], tickets[index+1:])\n\ttickets[len(tickets)-1] = nil // Prevent memory leak\n\ttickets = tickets[:len(tickets)-1]\n\treturn tickets\n}", "title": "" }, { "docid": "8a18aa922f9baf154f9df8bf3ae1e3d4", "score": "0.6000928", "text": "func (v *ListStore) Remove(position uint) {\n\tC.g_list_store_remove(v.native(), C.guint(position))\n}", "title": "" } ]
655ece69efc59bae1432d90e2336153a
Render map iterator in ASL JSON format. Experimental.
[ { "docid": "df2e16dc7eb168972c2a6bf8fcaafa2e", "score": "0.0", "text": "func (e *jsiiProxy_EmrCancelStep) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" } ]
[ { "docid": "f7a8196cb287957762f27feff1363508", "score": "0.5925585", "text": "func (c *Chunk) renderMap() map[string]Metric {\n\tm := make(map[string]Metric)\n\tfor _, metric := range c.Metrics {\n\t\tm[metric.Key()] = metric\n\t}\n\treturn m\n}", "title": "" }, { "docid": "2c1e969a701dd8a808629359a1c3f11f", "score": "0.58804196", "text": "func jsonify(m *linkedhashmap.Map) ([]byte, error) {\n\tvar b []byte\n\tbuf := bytes.NewBuffer(b)\n\n\tbuf.WriteRune('{')\n\n\tit := m.Iterator()\n\tlastIndex := m.Size() - 1\n\tindex := 0\n\n\tfor it.Next() {\n\n\t\tkm, err := json.Marshal(it.Key())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf.Write(km)\n\n\t\tbuf.WriteRune(':')\n\n\t\tif strings.HasPrefix(it.Key().(string), \"@\") {\n\t\t\t_, ok := it.Value().(*linkedhashmap.Map)\n\n\t\t\tif ok {\n\t\t\t\titt := it.Value().(*linkedhashmap.Map).Iterator()\n\t\t\t\tvar bb = []byte{}\n\n\t\t\t\tbuftt := bytes.NewBuffer(bb)\n\t\t\t\tindextt := 0\n\t\t\t\tlastIndextt := it.Value().(*linkedhashmap.Map).Size() - 1\n\n\t\t\t\tbuftt.WriteRune('{')\n\n\t\t\t\tfor itt.Next() {\n\n\t\t\t\t\tkm, err := json.Marshal(itt.Key())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tbuftt.Write(km)\n\t\t\t\t\tbuftt.WriteRune(':')\n\t\t\t\t\tvm, err := json.Marshal(itt.Value())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tbuftt.Write(vm)\n\n\t\t\t\t\tif indextt != lastIndextt {\n\t\t\t\t\t\tbuftt.WriteRune(',')\n\t\t\t\t\t}\n\n\t\t\t\t\tindextt++\n\t\t\t\t}\n\n\t\t\t\tbuf.Write(buftt.Bytes())\n\t\t\t\tbuf.WriteRune('}')\n\t\t\t\tif index != lastIndex {\n\t\t\t\t\tbuf.WriteRune(',')\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\tvm, err := json.Marshal(it.Value())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbuf.Write(vm)\n\t\t\tif index != lastIndex {\n\t\t\t\tbuf.WriteRune(',')\n\t\t\t}\n\t\t}\n\t\tindex++\n\n\t}\n\n\tbuf.WriteRune('}')\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "bd3e08022186649855473ae31a635180", "score": "0.5492081", "text": "func (r AsciiJSON) Render(w http.ResponseWriter) (err error) {\n\tr.WriteContentType(w)\n\tret, err := json.Marshal(r.Data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar buffer bytes.Buffer\n\tfor _, r := range bytesconv.BytesToString(ret) {\n\t\tcvt := string(r)\n\t\tif r >= 128 {\n\t\t\tcvt = fmt.Sprintf(\"\\\\u%04x\", int64(r))\n\t\t}\n\t\tbuffer.WriteString(cvt)\n\t}\n\n\t_, err = w.Write(buffer.Bytes())\n\treturn err\n}", "title": "" }, { "docid": "30b4f7e89060d6c1c4a1fcdad081fad1", "score": "0.5488873", "text": "func prettifyOutput(secretMap map[string]map[string]string) {\n\tfor k, val := range secretMap {\n\t\tfmt.Println(k)\n\n\t\tb, err := json.MarshalIndent(val, \"\", \" \")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error Marshalling: %v\", err)\n\t\t}\n\t\tfmt.Printf(\"%s\\n\\n\", string(b))\n\t}\n}", "title": "" }, { "docid": "4ced0c1f23b92d00e15ebf24555f1239", "score": "0.54867953", "text": "func PrintMap() {\n\tfmt.Println(\"Sessions - Map ======================\")\n\tfor key, value := range sessions {\n\t\tfmt.Println(\"Key:\", key, \", Value:\", value)\n\t}\n\tfmt.Println(\"=====================================\")\n}", "title": "" }, { "docid": "74542505069b771ba99beb2261fee331", "score": "0.5475521", "text": "func ShowMap(p map[string]interface{}, indent string) {\n\n\tif indent == \"\" {\n\t\tfmt.Println()\n\t\tfmt.Println(\"========= ShowMap ===========\")\n\t}\n\tfor k, v := range p {\n\t\tfmt.Println()\n\n\t\t_, ok := v.(map[string]interface{})\n\t\tif ok {\n\t\t\tfmt.Printf(\"k: %v\", k)\n\t\t\tShowMap(v.(map[string]interface{}), indent+\" \")\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Printf(indent)\n\t\tfmt.Printf(\"k: %v, v: %v\", k, v)\n\t}\n\tif indent == \"\" {\n\t\tfmt.Println()\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "b2494593f324076dc2edd1d69add4441", "score": "0.54291546", "text": "func (c *jsiiProxy_CallApiGatewayHttpApiEndpoint) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "d6c9fff29a132416ddc10cee76caf9a8", "score": "0.53951496", "text": "func JSON(pretty bool) string {\n\tj := []byte{}\n\tif pretty {\n\t\tj, _ = json.MarshalIndent(Map(), \"\", \" \")\n\t} else {\n\t\tj, _ = json.Marshal(Map())\n\t}\n\treturn string(j)\n}", "title": "" }, { "docid": "bce4744701751895c4d4b3c41c878571", "score": "0.5339638", "text": "func (jsonmap OrderedMap) ToJson(sequence ...string) {\n\n\tbuffer := &bytes.Buffer{}\n\tbuffer.Write([]byte{'{', '\\n'})\n\t//iterate the given sequence of map\n\tfor _, key := range sequence {\n\t\t//check if the key is attribute or traits and form the inner json marshal\n\t\tif string(key) == \"attribute\" || string(key) == \"traits\" {\n\t\t\tformJson, _ := json.MarshalIndent(jsonmap[key], \"\\t\", \" \")\n\t\t\tfmt.Fprintf(buffer, \"\\t\\\"%s\\\": %s\", key, formJson)\n\n\t\t\tif string(key) == \"attribute\" {\n\t\t\t\tbuffer.WriteByte(',')\n\t\t\t}\n\t\t\t//else make the json format from the key and map\n\t\t} else {\n\t\t\tfmt.Fprintf(buffer, \"\\t\\\"%s\\\": \\\"%v\\\"\", key, jsonmap[key])\n\t\t\tbuffer.WriteByte(',')\n\t\t}\n\t\tbuffer.WriteByte('\\n')\n\t}\n\tbuffer.Write([]byte{'}', '\\n'})\n\n\t//convert the *bytes to []bytes for http post\n\treadBuf, _ := ioutil.ReadAll(buffer)\n\t//post the json data to http://weebhook.site and print response\n\tprint(string(readBuf))\n\tresp, _ := http.Post(POSTURL, \"/\", bytes.NewBuffer(readBuf))\n\tfmt.Println(resp)\n}", "title": "" }, { "docid": "667db7466d2efd1b8fd92a75157c3970", "score": "0.5334897", "text": "func (wcf *WhizzCliFormatter) Map(data map[string]interface{}) {\n\twcf.printMap(data, \"\")\n}", "title": "" }, { "docid": "2b2a809a0cbc96b9d1abb9cf502afe24", "score": "0.5319039", "text": "func print(m *sync.Map) string {\n\tvar b strings.Builder\n\tb.WriteString(\"map[\")\n\tn := 0\n\tm.Range(func(k, v interface{}) bool {\n\t\tif n > 0 {\n\t\t\tb.WriteRune(' ')\n\t\t}\n\t\tb.WriteString(fmt.Sprintf(\"%v:%v\", k, v))\n\t\tn++\n\t\treturn true\n\t})\n\tb.WriteRune(']')\n\treturn b.String()\n}", "title": "" }, { "docid": "9f268f110c7240377ab37d47a92a6fb0", "score": "0.5305519", "text": "func print_items() {\n for item := range bet_map.IterBuffered() {\n val := item.Val\n fmt.Println(val)\n }\n}", "title": "" }, { "docid": "e413d8fab6c4ebb9c152d8d31bc75e1d", "score": "0.5277598", "text": "func (c *jsiiProxy_CallApiGatewayRestApiEndpoint) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ee0b50a6a912acc752c368ed722a48e5", "score": "0.5241484", "text": "func printResultMap(crawler *crawl.WebCrawler, start time.Time, end time.Duration) {\n\tf, err := os.Create(\"result.txt\")\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t\tlog.Println(\"Result will be printed to stdout.\")\n\t\tf = os.NewFile(uintptr(syscall.Stdout), \"/dev/stdout\")\n\t}\n\n\tf.WriteString(\"_________MAP__________\\n\\n\")\n\tf.WriteString(fmt.Sprintf(\"Extracted %v pages\\n\", len(crawler.Fetched)))\n\tf.WriteString(fmt.Sprintf(\"Execution started at %v\\n\", start))\n\tf.WriteString(fmt.Sprintf(\"Execution took %v\\n\\n\", end))\n\n\tfor k, v := range crawler.Fetched {\n\t\tf.WriteString(fmt.Sprintf(\"Node: %v \\nUrls: %v \\nAssets: %v \\n\\n\", k, v.Urls, v.Assets))\n\t}\n}", "title": "" }, { "docid": "4d85f87c5e9090cf5462fc43bd193a9f", "score": "0.52360684", "text": "func (s *jsiiProxy_SageMakerCreateEndpointConfig) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8cfff2e40286ed1fec1d08380246ed28", "score": "0.5231694", "text": "func MapInit(){\n\tfmt.Fprintln(os.Stderr,\"\\n\\t#--------------------#\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t| |\\n\\t#--------------------#\")\n}", "title": "" }, { "docid": "74b1bdb50b5c02f5b51f11c8868b110c", "score": "0.52309036", "text": "func (e *jsiiProxy_EmrCreateCluster) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e2ce48598dc200bae784d80579a31588", "score": "0.5221557", "text": "func EncodeJSONMap(sb *StringBuilder, m Map) {\n\tconst charopen = '{'\n\tconst chardef = ':'\n\tconst charsep = ','\n\tconst charclose = '}'\n\tsb.WriteByte(charopen)\n\tfirst := true\n\tfor k, v := range m { // k type not required, but golang requires this distinction\n\t\tif !first {\n\t\t\tsb.WriteByte(charsep)\n\t\t} else {\n\t\t\tfirst = false\n\t\t}\n\t\tEncodeJSON(sb, k)\n\t\tsb.WriteByte(chardef)\n\t\tEncodeJSON(sb, v)\n\t}\n\tsb.WriteByte(charclose)\n}", "title": "" }, { "docid": "debae16ab11e4c397a1f4ef37308abd5", "score": "0.52198684", "text": "func (s *jsiiProxy_SageMakerCreateEndpoint) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5bf6473d0ee3ae8b1aee430f2ee67870", "score": "0.5201835", "text": "func (g *group) render(b *strings.Builder) {\n\tindent := indentString(g.depth)\n\tfor _, p := range g.props {\n\t\tb.WriteString(indent + p.key + \": \" + p.value + \",\\n\")\n\t}\n}", "title": "" }, { "docid": "bda76fa2290db2303cc15503dba983dc", "score": "0.52004045", "text": "func RenderLocationStatsJSON(w http.ResponseWriter, r *http.Request) {\n vars := mux.Vars(r)\n location := vars[\"location\"]\n source := r.URL.Query().Get(\"source\")\n intervalParam := r.URL.Query().Get(\"interval\")\n interval, _ := strconv.ParseInt(intervalParam, 10, 0)\n fromParam := r.URL.Query().Get(\"from\")\n toParam := r.URL.Query().Get(\"to\")\n t := time.Now()\n if fromParam == \"\" {\n from := t.Add(-24 * time.Hour)\n fromParam = from.Format(\"200601021504\")\n }\n if toParam == \"\" {\n toParam = t.Format(\"200601021504\")\n }\n if interval < 1 {\n interval = 2\n }\n wordCounts, _ := WordCountRootCollection(location, source, fromParam, toParam, int(interval), 1000)\n\n totalCounts := map[string]int {}\n\n for _, wordcount := range wordCounts {\n count := totalCounts[wordcount.Term]\n count = count + wordcount.Occurrences\n totalCounts[wordcount.Term] = count\n }\n\n stats := map[string]string {}\n stats[\"trendscount\"] = strconv.Itoa(len(totalCounts))\n\n w.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n w.Header().Add(\"Access-Control-Allow-Methods\", \"GET\")\n w.Header().Add(\"Access-Control-Allow-Headers\", \"Content-Type, api_key, Authorization\")\n json.NewEncoder(w).Encode(stats)\n}", "title": "" }, { "docid": "a57eaa991bdb5598737cf2a24fbf8372", "score": "0.5191589", "text": "func (s *jsiiProxy_SageMakerUpdateEndpoint) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "04aca7b24178cc6657feb94cab7dec92", "score": "0.5189743", "text": "func (sm *SafeMap) JSON() (json string) {\n\tdefer func() {\n\t\tsm.RUnlock()\n\t}()\n\tsm.RLock()\n\tjson, _ = com.JsonEncode(sm.M)\n\treturn\n}", "title": "" }, { "docid": "d53df349effe953b91207ebea2061fbf", "score": "0.5171246", "text": "func (ctx *Context) JSON(i interface{}) {\n\tstatusCode := ctx.ginContext.Writer.Status()\n\tctx.ginContext.JSON(statusCode, i)\n}", "title": "" }, { "docid": "78fcbee7b53d0e894fb217750a605d5f", "score": "0.51709837", "text": "func RandomMap(w http.ResponseWriter, r *http.Request) {\n\trnd := make([]byte, 30*30)\n\tvar err error\n\n\tfor items := 0; items < 30*30-1; {\n\t\tif c, err := rand.Read(rnd[items:]); err != nil {\n\t\t\thttp.Error(w, \"rand:\"+err.Error(), http.StatusInternalServerError)\n\t\t} else {\n\t\t\titems += c\n\t\t}\n\t}\n\t// Slow copy. I have to convert this to int because a slice of byte is a binary blob for json.\n\ttiles := make([]int, 30*30)\n\tfor i, v := range rnd {\n\t\ttiles[i] = int(v) % lastTerrain\n\t}\n\n\tb, err := json.Marshal(tiles)\n\tif err != nil {\n\t\thttp.Error(w, \"json:\"+err.Error(), http.StatusInternalServerError)\n\t}\n\n\t// jsonp is merely a json file with a wrapping function.\n\tcallback := r.URL.Query().Get(\"jsoncallback\")\n\tif callback == \"\" {\n\t\tcallback = \"jsonpCallback\"\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/javascript\")\n\tfmt.Fprintf(w, \"%v(%v)\", callback, string(b))\n}", "title": "" }, { "docid": "d3bb9a94de1c46653f23e7c41148887a", "score": "0.5160118", "text": "func (r ReplicationFactorMap) JSON() string {\n\tb, err := json.Marshal(r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "baeedc19768f4f83bccafe81d9190672", "score": "0.5155894", "text": "func (this Map) String() string {\n\twr := bytes.NewBuffer(nil)\n\tfmt.Fprint(wr, \"Map[\")\n\tfor k, v := range this {\n\t\tfmt.Fprintf(wr, \"%v: %v\", k, print(v))\n\t}\n\tfmt.Fprintf(wr, \"]\")\n\treturn wr.String()\n}", "title": "" }, { "docid": "9e14acd3177443c26ee3427aa9d4f63d", "score": "0.5120186", "text": "func (e *jsiiProxy_EmrAddStep) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bb91cfebc00b9a77a585e16c40d2b64f", "score": "0.5114327", "text": "func (v OrderedMapStringToInt) encodeJSON(out *jwriter.Writer) {\n\tif v == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {\n\t\tout.RawString(`null`)\n\t} else {\n\t\tout.RawByte('{')\n\t\tv2First := true\n\t\t// This part edited to use ordered map keys instead of simple range\n\t\tkeys := []string{}\n\t\tfor key, _ := range v {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t\tsort.Strings(keys)\n\t\tfor _, v2Name := range keys {\n\t\t\tif v2First {\n\t\t\t\tv2First = false\n\t\t\t} else {\n\t\t\t\tout.RawByte(',')\n\t\t\t}\n\t\t\tout.String(string(v2Name))\n\t\t\tout.RawByte(':')\n\t\t\tout.Int(int(v[v2Name]))\n\t\t}\n\t\tout.RawByte('}')\n\t}\n}", "title": "" }, { "docid": "3d7ede0bf157fdd75a6860a5577e578f", "score": "0.5098797", "text": "func (e JSONMap) Format() (string, error) {\n\toutput := \"{\"\n\titems := []string{}\n\tfor k, v := range e {\n\t\ti := k + \":\"\n\t\tswitch val := v.(type) {\n\t\tcase ArgumentFormatter:\n\t\t\tresult, err := val.Format()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\ti += result\n\t\tdefault:\n\t\t\tslice, err := json.Marshal(val)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\ti += string(slice)\n\t\t}\n\t\titems = append(items, i)\n\t}\n\n\toutput += strings.Join(items, \",\")\n\toutput += \"}\"\n\treturn output, nil\n}", "title": "" }, { "docid": "a2619f8c3651f24f68e099c1fad635d8", "score": "0.5094265", "text": "func RenderEncoder(metrics []types.Metric) ([]byte, error) {\n\tjms := make([]jsonMetric, 0, len(metrics))\n\n\tfor _, metric := range metrics {\n\t\tt := metric.StartTime\n\n\t\tjm := jsonMetric{\n\t\t\tName: metric.Name,\n\t\t\tDatapoints: make([][]interface{}, len(metric.Values)),\n\t\t}\n\n\t\tfor i := range metric.Values {\n\t\t\tdata := make([]interface{}, 2)\n\n\t\t\tif metric.IsAbsent[i] || math.IsInf(metric.Values[i], 0) || math.IsNaN(metric.Values[i]) {\n\t\t\t\tdata[0] = nil\n\t\t\t} else {\n\t\t\t\tdata[0] = metric.Values[i]\n\t\t\t}\n\n\t\t\tdata[1] = t\n\t\t\tjm.Datapoints[i] = data\n\n\t\t\tt += metric.StepTime\n\t\t}\n\n\t\tjms = append(jms, jm)\n\t}\n\n\treturn json.Marshal(jms)\n}", "title": "" }, { "docid": "e672ea94e7dd2b9f75976b9ac6f1a7de", "score": "0.50717676", "text": "func (l *jsiiProxy_LambdaInvoke) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tl,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2e739051f35434a298f2a0ee7d9994d4", "score": "0.50616336", "text": "func (d *jsiiProxy_DynamoPutItem) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8b6dbf6fb05830945738e6415ef5bc2d", "score": "0.50339794", "text": "func (m *stringMap) printMap() {\n\tfor k, v := range *m {\n\t\tif k == \"Image\" {\n\t\t\tmd5, _, err := MD5FromBase64(v)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error decoding base64 :%s\\n\", err)\n\t\t\t\tv = \"\"\n\t\t\t} else {\n\t\t\t\tv = md5\n\t\t\t}\n\n\t\t}\n\t\tfmt.Printf(\" %s = %s\\n\", k, v)\n\t}\n}", "title": "" }, { "docid": "75f8e231448ee369d4420e19afcc7532", "score": "0.50254107", "text": "func (r IndentedJSON) Render(w http.ResponseWriter) error {\n\tr.WriteContentType(w)\n\tjsonBytes, err := json.MarshalIndent(r.Data, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Write(jsonBytes)\n\treturn err\n}", "title": "" }, { "docid": "c813348a9a7bdeb9e759e0b973e2a0b7", "score": "0.49960065", "text": "func IterateOverMap(input interface{}) {\n\n\tswitch input.(type) {\n\tcase map[string]interface{}:\n\t\ttabs += \"\\t\"\n\t\tlevel++\n\t\tclose := false\n\t\tMapElement := input.(map[string]interface{})\n\t\tfor key, element := range MapElement {\n\t\t\tif element != nil {\n\t\t\t\tif !IsKeyPresent(key, KeysPresent[level]) {\n\t\t\t\t\tKeysPresent[level] = append(KeysPresent[level], key)\n\n\t\t\t\t\tFinalStruct += tabs + strings.Replace(strings.Title(key), \"_\", \"\", -1) + \" \"\n\t\t\t\t\tif element != nil {\n\t\t\t\t\t\tTypeObObj := reflect.TypeOf(element).String()\n\t\t\t\t\t\tif TypeObObj == \"[]interface {}\" {\n\t\t\t\t\t\t\tTypeObObj = \"[]struct {\"\n\t\t\t\t\t\t\tclose = true\n\t\t\t\t\t\t} else if TypeObObj == \"map[string]interface {}\" {\n\t\t\t\t\t\t\tTypeObObj = \"struct {\"\n\t\t\t\t\t\t\tclose = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclose = false\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif close {\n\t\t\t\t\t\t\tFinalStruct += TypeObObj + \"\\n\"\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tFinalStruct += TypeObObj + \"\\t`json:\\\"\" + key + \"\\\"`\" + \"\\n\"\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tIterateOverMap(element)\n\n\t\t\t\t\t\tif close {\n\t\t\t\t\t\t\tFinalStruct += tabs + \"}\\t`json:\\\"\" + key + \"\\\"`\" + \"\\n\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttabs = tabs[:len(tabs)-1]\n\t\tlevel--\n\n\tcase []interface{}:\n\t\tinputObj := input.([]interface{})\n\t\tfor _, elementObj := range inputObj {\n\t\t\t//fmt.Print(\"\\nk:\", key)\n\t\t\tIterateOverMap(elementObj)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "204a148d5b0c0de26e540903c31e4516", "score": "0.49946618", "text": "func (r JSONRenderer) Render(w io.Writer) error {\n\tb, err := json.Marshal(r.Value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(b)\n\treturn err\n}", "title": "" }, { "docid": "111e35b55a0aa37092661a4684696fcf", "score": "0.4988445", "text": "func (g *group) render(b *strings.Builder) {\n\tindent := indentString(g.depth)\n\tfor _, p := range g.props {\n\t\tb.WriteString(indent + p.key + \": \" + p.value + \",\\n\")\n\t}\n\tfor _, group := range g.groups {\n\t\tb.WriteString(indent + group.name + \": {\\n\")\n\t\tgroup.render(b)\n\t\tb.WriteString(indent + \"},\\n\")\n\t}\n}", "title": "" }, { "docid": "38e78c6e7e42904907f94e2525c4189e", "score": "0.49839067", "text": "func (render *JSONRender) Render(writer http.ResponseWriter, status int, v interface{}) error {\n\tresult, err := marshallToJson(v, render.Indent)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twriteHeader(writer, status, render.ContentType, render.Charset)\n\tif len(render.Prefix) > 0 {\n\t\twriter.Write(render.Prefix)\n\t}\n\twriter.Write(result)\n\tif render.Indent {\n\t\twriter.Write([]byte(\"\\n\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "06ecf8f56731a7b2e502e85591facd55", "score": "0.49805295", "text": "func (a *jsiiProxy_AthenaGetQueryResults) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ta,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0f093b1b2393be36f1f40a4e28b89660", "score": "0.4972213", "text": "func (ts *Tileset) arcgisServiceJSON() ([]byte, error) {\n\tdb := ts.db\n\timgFormat := db.TileFormatString()\n\tmetadata, err := db.ReadMetadata()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tname, _ := metadata[\"name\"].(string)\n\tdescription, _ := metadata[\"description\"].(string)\n\tattribution, _ := metadata[\"attribution\"].(string)\n\ttags, _ := metadata[\"tags\"].(string)\n\tcredits, _ := metadata[\"credits\"].(string)\n\n\t// TODO: make sure that min and max zoom always populated\n\tminZoom, _ := metadata[\"minzoom\"].(uint8)\n\tmaxZoom, _ := metadata[\"maxzoom\"].(uint8)\n\t// TODO: extract dpi from the image instead\n\tvar lods []arcGISLOD\n\tfor i := minZoom; i <= maxZoom; i++ {\n\t\tscale, resolution := calcScaleResolution(i, dpi)\n\t\tlods = append(lods, arcGISLOD{\n\t\t\tLevel: i,\n\t\t\tResolution: resolution,\n\t\t\tScale: scale,\n\t\t})\n\t}\n\n\tminScale := lods[0].Scale\n\tmaxScale := lods[len(lods)-1].Scale\n\n\tbounds, ok := metadata[\"bounds\"].([]float32)\n\tif !ok {\n\t\tbounds = []float32{-180, -85, 180, 85} // default to world bounds\n\t}\n\textent := geoBoundsToWMExtent(bounds)\n\n\ttileInfo := map[string]interface{}{\n\t\t\"rows\": 256,\n\t\t\"cols\": 256,\n\t\t\"dpi\": dpi,\n\t\t\"origin\": map[string]float32{\n\t\t\t\"x\": -20037508.342787,\n\t\t\t\"y\": 20037508.342787,\n\t\t},\n\t\t\"spatialReference\": webMercatorSR,\n\t\t\"lods\": lods,\n\t}\n\n\tdocumentInfo := map[string]string{\n\t\t\"Title\": name,\n\t\t\"Author\": attribution,\n\t\t\"Comments\": \"\",\n\t\t\"Subject\": \"\",\n\t\t\"Category\": \"\",\n\t\t\"Keywords\": tags,\n\t\t\"Credits\": credits,\n\t}\n\n\tout := map[string]interface{}{\n\t\t\"currentVersion\": \"10.4\",\n\t\t\"id\": ts.id,\n\t\t\"name\": name,\n\t\t\"mapName\": name,\n\t\t\"capabilities\": \"Map,TilesOnly\",\n\t\t\"description\": description,\n\t\t\"serviceDescription\": description,\n\t\t\"copyrightText\": attribution,\n\t\t\"singleFusedMapCache\": true,\n\t\t\"supportedImageFormatTypes\": strings.ToUpper(imgFormat),\n\t\t\"units\": \"esriMeters\",\n\t\t\"layers\": []arcGISLayerStub{\n\t\t\t{\n\t\t\t\tID: 0,\n\t\t\t\tName: name,\n\t\t\t\tParentLayerID: -1,\n\t\t\t\tDefaultVisibility: true,\n\t\t\t\tSubLayerIDs: nil,\n\t\t\t\tMinScale: minScale,\n\t\t\t\tMaxScale: maxScale,\n\t\t\t},\n\t\t},\n\t\t\"tables\": []string{},\n\t\t\"spatialReference\": webMercatorSR,\n\t\t\"minScale\": minScale,\n\t\t\"maxScale\": maxScale,\n\t\t\"tileInfo\": tileInfo,\n\t\t\"documentInfo\": documentInfo,\n\t\t\"initialExtent\": extent,\n\t\t\"fullExtent\": extent,\n\t\t\"exportTilesAllowed\": false,\n\t\t\"maxExportTilesCount\": 0,\n\t\t\"resampling\": false,\n\t}\n\n\tbytes, err := json.Marshal(out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes, nil\n}", "title": "" }, { "docid": "c4f30ce01114b77f2721ab6fd6488598", "score": "0.49580863", "text": "func MapToString(input map[string]interface{}, isPretty ...bool) string {\n\tvar (\n\t\tb []byte\n\t\terr error\n\t)\n\n\tif len(isPretty) > 0 && isPretty[0] {\n\t\tb, err = json.MarshalIndent(input, \"\", \" \")\n\t} else {\n\t\tb, err = json.Marshal(input)\n\t}\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "2321103f6d24a1e750ce42b2e65a5469", "score": "0.49562234", "text": "func (s *jsiiProxy_SageMakerCreateTrainingJob) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3523d1bfad69de03e6a36dfd535a2eea", "score": "0.4942523", "text": "func Maps() {\n\t// Maps\n\tuserDetails := make(map[int]string)\n\n\tuserDetails[155] = \"harish@yoyocode.dev\"\n\tuserDetails[156] = \"matta@yoyocode.dev\"\n\tuserDetails[157] = \"kumar@yoyocode.dev\"\n\n\tfmt.Println(userDetails)\n\n\tfor index, data := range userDetails {\n\t\tfmt.Printf(\"%d -> %s\\n\", index, data)\n\t}\n}", "title": "" }, { "docid": "1659f74c73ca51644dbe4b14692b7afd", "score": "0.4938313", "text": "func printMap(squareMap [][]*Square) {\n\tfor _, row := range squareMap {\n\t\tvar s strings.Builder\n\t\tfor _, square := range row {\n\t\t\tif square == nil {\n\t\t\t\ts.WriteRune('X')\n\t\t\t} else if square.Perso != nil {\n\t\t\t\tswitch square.Perso.Type {\n\t\t\t\tcase Elf:\n\t\t\t\t\ts.WriteRune('E')\n\t\t\t\tcase Goblin:\n\t\t\t\t\ts.WriteRune('G')\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch square.Type {\n\t\t\t\tcase Wall:\n\t\t\t\t\ts.WriteRune('#')\n\t\t\t\tcase Cavern:\n\t\t\t\t\ts.WriteRune('.')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfmt.Println(s.String())\n\t}\n}", "title": "" }, { "docid": "24206b42147d84bbec6370998fc8e130", "score": "0.49265704", "text": "func mapiternext(it *hiter)", "title": "" }, { "docid": "24206b42147d84bbec6370998fc8e130", "score": "0.49265704", "text": "func mapiternext(it *hiter)", "title": "" }, { "docid": "3b266ca1a56a2e8a519699ee0a2c8242", "score": "0.4917717", "text": "func sprintMap(value interface{}) (string, error) {\n\tmp, err := parseMap(value)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresult := []string{}\n\tfor k, v := range mp {\n\t\tstringValue, err := sprint(v)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif isSlice(v) {\n\t\t\tstringValue = \"\\n\" + stringValue\n\t\t}\n\n\t\tresult = append(result, fmt.Sprintf(\" %s: %s \", k, stringValue))\n\t}\n\n\tsort.Slice(result, func(i, j int) bool { return result[i] < result[j] })\n\n\treturn \"\\n\" + strings.Join(result, \"\\n\"), nil\n}", "title": "" }, { "docid": "edeec1544bdf4e72e86a3f4077d7b99b", "score": "0.4911489", "text": "func (g *jsiiProxy_GlueStartJobRun) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tg,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e7990deeeaa2d8968071a878a9ffde3a", "score": "0.49050447", "text": "func outputResults(outer Map) {\n\n count := 0\n for _, inner := range outer {\n\n outputs := make([]string, 0, 1)\n for _, str := range inner {\n outputs = append(outputs, str)\n }\n\n if len(outputs) > 1 {\n for _, str := range outputs {\n fmt.Println(str)\n }\n count++\n fmt.Println(\"\")\n }\n\n }\n fmt.Printf(\"%d sets of anagrams found\\n\", count)\n\n}", "title": "" }, { "docid": "266a40b121184647e32415c0e09a5d4d", "score": "0.48975706", "text": "func (e *jsiiProxy_EmrModifyInstanceFleetByName) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "31db8ed61ac5a2c8da676bd8667de5e6", "score": "0.4895739", "text": "func (e Entry) toJSON() []byte {\n\tjson := e.tpl\n\tfor _, df := range e.data {\n\t\treplKey := fmt.Sprintf(\"%v%v%v\", TPL_REPLACE_STRING, df.key, TPL_REPLACE_STRING)\n\t\tjson = strings.Replace(json, replKey, df.getStringValue(), -1)\n\t}\n\treturn []byte(json)\n}", "title": "" }, { "docid": "b093bbf438edfb0a536d8e6c8f79d841", "score": "0.4889178", "text": "func (e *jsiiProxy_EksCall) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "07d200a36921032f5dff9575b64186e7", "score": "0.48819453", "text": "func (e *jsiiProxy_EventBridgePutEvents) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f1bbc0a2cd216ad33b35f7bc3b1e1d69", "score": "0.4878791", "text": "func (s *jsiiProxy_SageMakerCreateTransformJob) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "b859909a10c9bff9ff4b2e2e978fb6a2", "score": "0.4874334", "text": "func (c *jsiiProxy_CodeBuildStartBuild) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bc46e822156b455585efcf075846d3d6", "score": "0.48662087", "text": "func (s *jsiiProxy_SageMakerCreateModel) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2ea7eacea0807d902b07a8096b8bb415", "score": "0.48635086", "text": "func writeResponseFromMap(writer *http.ResponseWriter, format string, data map[string]interface{}, status int) {\n\tval, err := json.Marshal(data)\n\tif err != nil {\n\t\t(*writer).WriteHeader(http.StatusInternalServerError)\n\t\t(*writer).Write([]byte(\"Internal server error: cant create json\"))\n\t\treturn\n\t}\n\n\t(*writer).WriteHeader(status)\n\t(*writer).Write(val)\n}", "title": "" }, { "docid": "dbdc2c1eda83e2fd5dd3a1e97a181317", "score": "0.48579082", "text": "func (iem IndexErrMap) MarshalJSON() ([]byte, error) {\n\ttmp := make(map[string]string, len(iem))\n\tfor k, v := range iem {\n\t\ttmp[k] = v.Error()\n\t}\n\treturn json.Marshal(tmp)\n}", "title": "" }, { "docid": "203abc2415476fc500446d8d5a1c1995", "score": "0.48549905", "text": "func (j *jsonRender) Render(w io.Writer) error {\n\treturn json.NewEncoder(w).Encode(j.Data)\n}", "title": "" }, { "docid": "2e19fc397122ad68d09869abc50ea6b7", "score": "0.48492536", "text": "func (c *Context) JSON(code int, i interface{}) (err error) {\n\tif c.response.Header().Get(HeaderContentType) == \"\" {\n\t\tc.response.Header().Set(HeaderContentType, MIMEApplicationJSONCharsetUTF8)\n\t}\n\n\tc.response.SetStatus(code)\n\tc.response.SetData(i)\n\tpretty := c.QueryBool(\"_pretty\", false)\n\tc.response.SetEncoder(codec.NewJSONCodec(codec.Indent(pretty)))\n\treturn nil\n}", "title": "" }, { "docid": "7e1d2cd7b97e83f54ed7c166bb811c47", "score": "0.484654", "text": "func (g *jsiiProxy_GlueDataBrewStartJobRun) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tg,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "172eda800f47aaab91183b8bd3339c5e", "score": "0.4842867", "text": "func (s *jsiiProxy_SnsPublish) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bef80874a6ca8d03dc1ab7de5fc4e140", "score": "0.48387977", "text": "func (a APS) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(a.Map())\n}", "title": "" }, { "docid": "25ccc3af9f69c0249f5e7168666c61cd", "score": "0.48366252", "text": "func printMap() {\n\tfor i := range mapGlobal {\n\t\tfor i2, v := range mapGlobal[i] {\n\t\t\tvar pic string\n\t\t\tswitch v {\n\t\t\tcase trackV:\n\t\t\t\tpic = \"|\"\n\t\t\tcase trackH:\n\t\t\t\tpic = \"-\"\n\t\t\tcase trackNW:\n\t\t\t\tpic = \"/\"\n\t\t\tcase trackNE:\n\t\t\t\tpic = \"\\\\\"\n\t\t\tcase trackSW:\n\t\t\t\tpic = \"\\\\\"\n\t\t\tcase trackSE:\n\t\t\t\tpic = \"/\"\n\t\t\tcase trackInt:\n\t\t\t\tpic = \"+\"\n\t\t\tdefault:\n\t\t\t\tpic = \" \"\n\t\t\t}\n\t\t\tcart := retrieveCart(i, i2)\n\t\t\tif cart.direction != trackNil {\n\t\t\t\tswitch cart.direction {\n\t\t\t\tcase trackE:\n\t\t\t\t\tpic = \">\"\n\t\t\t\tcase trackN:\n\t\t\t\t\tpic = \"^\"\n\t\t\t\tcase trackW:\n\t\t\t\t\tpic = \"<\"\n\t\t\t\tcase trackS:\n\t\t\t\t\tpic = \"v\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Printf(pic)\n\n\t\t}\n\t\tfmt.Println(\"\")\n\t}\n}", "title": "" }, { "docid": "c1ab0295bfa3c97f9bd35cb5b3bc5a07", "score": "0.48329484", "text": "func showData(w http.ResponseWriter, r *http.Request) {\n fmt.Fprintf(w, \"%s\\n\\n\", \"Current data: {\")\n\n for key, value := range dataStore {\n fmt.Fprintf(w, \"%s => %s\\n\", key, value)\n }\n\n fmt.Fprintf(w, \"\\n\\n%s\\n\", \"}\")\n}", "title": "" }, { "docid": "b98349b7ee3e5cdd0b38d6ef5a68abda", "score": "0.4825296", "text": "func JSON() string {\n\tpayload, err := json.Marshal(Map)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(payload)\n}", "title": "" }, { "docid": "9ef53b6a93aa8a4fb4d9d00c925e3dd8", "score": "0.4824134", "text": "func Display(servermeta outputs.ServerInfo, s outputs.QueryStatsSlice, w io.Writer) {\n\tc := outputs.CacheInfo{\n\t\tServer: servermeta,\n\t\tQueries: s,\n\t}\n\n\tjson, err := json.MarshalIndent(c, \"\", \"\\t\")\n\tif err != nil {\n\t\tlog.Errorf(\"unable to marshal JSON: %v\", err)\n\t}\n\n\t_, err = w.Write(json)\n\tif err != nil {\n\t\tlog.Errorf(\"unable to write JSON: %v\", err)\n\t}\n}", "title": "" }, { "docid": "b810a0b6cbb4a513aaf4528565148609", "score": "0.4823389", "text": "func dumpMaps() {\n\t// TODO: make this function part of the exporter\n\tfor name, cmap := range builtinMetricMaps {\n\t\tquery, ok := queryOverrides[name]\n\t\tif !ok {\n\t\t\tfmt.Println(name)\n\t\t} else {\n\t\t\tfor _, queryOverride := range query {\n\t\t\t\tfmt.Println(name, queryOverride.versionRange, queryOverride.query)\n\t\t\t}\n\t\t}\n\n\t\tfor column, details := range cmap {\n\t\t\tfmt.Printf(\" %-40s %v\\n\", column, details)\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "ecf917751fed41702f425ec3858c40bf", "score": "0.48189586", "text": "func (s TemplateSet) Render(ds texttemplate.Dataset) (herbtext.Map, error) {\n\toutputs := make(herbtext.Map, len(s))\n\tfor k, v := range s {\n\t\toutput, err := v.Render(ds)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\toutputs[k] = output\n\t}\n\treturn outputs, nil\n}", "title": "" }, { "docid": "1d1a8dfe1c58b777cbcac8b765cbdd78", "score": "0.48157677", "text": "func (v crateMap) MarshalJSON() ([]byte, error) {\n\tres := bytes.Buffer{}\n\tif err := encodeMap(&res, reflect.ValueOf(v)) ; err != nil {\n\t\treturn nil, err\n\t}\n\t//log.Printf(\"Result Map : %v\", res.String())\n\treturn res.Bytes(), nil\n}", "title": "" }, { "docid": "08d48aa0160cd8d89766b96620b5c070", "score": "0.48101544", "text": "func (e *ExprIndex) emitMapSet() {\n\n\tlabelAppend := makeLabel()\n\tlabelSave := makeLabel()\n\n\t// map get to check if exists\n\te.emit()\n\t// jusdge update or append\n\temit(\"cmp $0, %%rcx\")\n\temit(\"setne %%al\")\n\temit(\"movzb %%al, %%eax\")\n\temit(\"test %%rax, %%rax\")\n\temit(\"je %s # jump to append if not found\", labelAppend)\n\n\t// update\n\temit(\"push %%rcx\") // push address of the key\n\temit(\"jmp %s\", labelSave)\n\n\t// append\n\temit(\"%s: # append to a map \", labelAppend)\n\te.collection.emit() // emit pointer address to %rax\n\temit(\"push %%rax # stash head address of mapData\")\n\n\t// emit len of the map\n\telen := &ExprLen{\n\t\targ: e.collection,\n\t}\n\telen.emit()\n\temit(\"imul $%d, %%rax\", 2*8) // distance from head to tail\n\temit(\"pop %%rcx\") // head\n\temit(\"add %%rax, %%rcx\") // now rcx is the tail address\n\temit(\"push %%rcx\")\n\n\t// map len++\n\telen.emit()\n\temit(\"add $1, %%rax\")\n\temitOffsetSave(e.collection, IntSize, ptrSize) // update map len\n\n\t// Save key and value\n\temit(\"%s: # end loop\", labelSave)\n\te.index.emit()\n\temit(\"push %%rax\") // index value\n\n\tmapType := e.collection.getGtype()\n\tmapKeyType := mapType.mapKey\n\tmapValueType := mapType.mapValue\n\n\tif mapKeyType.isString() {\n\t\temit(\"pop %%rcx\") // index value\n\t\temit(\"pop %%rax\") // map tail address\n\t\temit(\"mov %%rcx, (%%rax)\") // save indexvalue to malloced area\n\t\temit(\"push %%rax\") // push map tail\n\t} else {\n\t\t// malloc(8)\n\t\temit(\"mov $%d, %%rdi\", 8) // malloc 8 bytes\n\t\temit(\"mov $0, %%rax\")\n\t\temit(\"call .malloc\")\n\t\t// %%rax : malloced address\n\t\t// stack : [map tail address, index value]\n\t\temit(\"pop %%rcx\") // index value\n\t\temit(\"mov %%rcx, (%%rax)\") // save indexvalue to malloced area\n\t\temit(\"pop %%rcx\") // map tail address\n\t\temit(\"mov %%rax, (%%rcx) #\") // save index address to the tail\n\t\temit(\"push %%rcx\") // push map tail\n\t}\n\n\t// save value\n\tif mapValueType.isString() {\n\t\temit(\"pop %%rax\") // map tail address\n\t\temit(\"pop %%rcx\") // rhs value\n\t\t// save value\n\t\temit(\"mov %%rcx, 8(%%rax)\") // save value to the tail\n\t} else {\n\t\t// malloc(8)\n\t\temit(\"mov $%d, %%rdi\", 8) // malloc 8 bytes\n\t\temit(\"mov $0, %%rax\")\n\t\temit(\"call .malloc\")\n\n\t\temit(\"pop %%rcx\") // map tail address\n\t\temit(\"mov %%rax, 8(%%rcx)\") // set malloced address to tail+8\n\n\t\temit(\"pop %%rcx\") // rhs value\n\n\t\t// save value\n\t\temit(\"mov %%rcx, (%%rax)\") // save value address to the malloced area\n\t}\n}", "title": "" }, { "docid": "d1c4ddf554443f69bd9a2bbfca3114f8", "score": "0.48062068", "text": "func (c *MetadataCore) serialize() (_ []byte, xerr fail.Error) {\n\tdefer fail.OnPanic(&xerr)\n\n\tvar (\n\t\tshieldedJSONed []byte\n\t\tshieldedMapped = map[string]interface{}{}\n\t\tpropsMapped = map[string]string{}\n\t)\n\n\tshieldedJSONed, xerr = c.shielded.Serialize()\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\terr := json.Unmarshal(shieldedJSONed, &shieldedMapped)\n\terr = debug.InjectPlannedError(err)\n\tif err != nil {\n\t\treturn nil, fail.NewErrorWithCause(err, \"*MetadataCore.Serialize(): Unmarshalling JSONed shielded into map failed!\")\n\t}\n\n\tif c.properties.Count() > 0 {\n\t\tpropsJSONed, xerr := c.properties.Serialize()\n\t\txerr = debug.InjectPlannedFail(xerr)\n\t\tif xerr != nil {\n\t\t\treturn nil, xerr\n\t\t}\n\n\t\tif len(propsJSONed) > 0 && string(propsJSONed) != `\"{}\"` {\n\t\t\tif jserr := json.Unmarshal(propsJSONed, &propsMapped); jserr != nil {\n\t\t\t\t// logrus.Tracef(\"*MetadataCore.Serialize(): Unmarshalling JSONed properties into map failed!\")\n\t\t\t\treturn nil, fail.ConvertError(jserr)\n\t\t\t}\n\t\t}\n\t}\n\n\tshieldedMapped[\"properties\"] = propsMapped\n\t// logrus.Tracef(\"everything mapped:\\n%s\\n\", spew.Sdump(shieldedMapped))\n\n\tr, err := json.Marshal(shieldedMapped)\n\terr = debug.InjectPlannedError(err)\n\tif err != nil {\n\t\treturn nil, fail.ConvertError(err)\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "fb9e9714fc010702168bdd94eb9546b1", "score": "0.48043597", "text": "func (v Echo_EchoI32Map_Result) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsIdlClientsBarBarEchoEchoI32Map(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "f1236b365cb86e85136630accd033129", "score": "0.48043343", "text": "func emitMapGet(mapType *Gtype) {\n\n\tmapType = mapType.Underlying()\n\tmapKeyType := mapType.mapKey\n\tmapValueType := mapType.mapValue\n\tis24Width := mapValueType.is24WidthType()\n\n\temit(S(\"# emitMapGet\"))\n\n\temit(S(\"pop %%r12\"))\n\temit(S(\"pop %%r11\"))\n\temit(S(\"pop %%r10\"))\n\n\tlabelBegin := makeLabel()\n\tlabelEnd := makeLabel()\n\tlabelIncr := makeLabel()\n\n\temit(S(\"mov $0, %%r13 # init loop counter\")) // i = 0\n\n\temit(S(\"%s: # begin loop \"), labelBegin)\n\n\temit(S(\"push %%r13 # loop counter\"))\n\temit(S(\"push %%r11 # map len\"))\n\temit(S(\"CMP_FROM_STACK setl\"))\n\temit(S(\"TEST_IT\"))\n\tif is24Width {\n\t\temit(S(\"LOAD_EMPTY_SLICE # NOT FOUND\"))\n\t} else if mapValueType.isClikeString() {\n\t\temitEmptyString()\n\t} else {\n\t\temit(S(\"mov $0, %%rax # key not found\"))\n\t}\n\n\tokRegister := mapOkRegister(is24Width)\n\temit(S(\"mov $0, %%%s # ok = false\"), okRegister)\n\n\temit(S(\"je %s # Exit. NOT FOUND IN ALL KEYS.\"), labelEnd)\n\n\temit(S(\"# check if key matches\"))\n\temit(S(\"mov %%r13, %%rax\")) // i\n\temit(S(\"IMUL_NUMBER 16\")) // i * 16\n\temit(S(\"PUSH_8\"))\n\n\temit(S(\"mov %%r10, %%rax\")) // head\n\temit(S(\"PUSH_8\"))\n\n\temit(S(\"SUM_FROM_STACK\")) // head + i * 16\n\n\temit(S(\"PUSH_8\")) // index address\n\temit(S(\"LOAD_8_BY_DEREF\")) // emit index address\n\n\tassert(mapKeyType != nil, nil, S(\"key kind should not be nil:%s\"), mapType.String())\n\n\tif mapKeyType.isClikeString() {\n\t\temit(S(\"push %%r13\"))\n\t\temit(S(\"push %%r11\"))\n\t\temit(S(\"push %%r10\"))\n\n\t\temit(S(\"LOAD_8_BY_DEREF\")) // dereference\n\t\temit(S(\"PUSH_8\"))\n\t\temitConvertCstringFromStackToSlice()\n\t\temit(S(\"PUSH_SLICE\"))\n\n\t\temit(S(\"push %%r12\"))\n\t\temitConvertCstringFromStackToSlice()\n\t\temit(S(\"PUSH_SLICE\"))\n\n\t\temitGoStringsEqualFromStack()\n\n\t\temit(S(\"pop %%r10\"))\n\t\temit(S(\"pop %%r11\"))\n\t\temit(S(\"pop %%r13\"))\n\t} else {\n\t\temit(S(\"LOAD_8_BY_DEREF\")) // dereference\n\t\t// primitive comparison\n\t\temit(S(\"cmp %%r12, %%rax # compare specifiedvalue vs indexvalue\"))\n\t\temit(S(\"sete %%al\"))\n\t\temit(S(\"movzb %%al, %%eax\"))\n\t}\n\n\temit(S(\"TEST_IT\"))\n\temit(S(\"pop %%rax\")) // index address\n\temit(S(\"je %s # Not match. go to next iteration\"), labelIncr)\n\n\temit(S(\"# Value found!\"))\n\temit(S(\"push %%rax # stash key address\"))\n\temit(S(\"ADD_NUMBER 8 # value address\"))\n\temit(S(\"LOAD_8_BY_DEREF # set the found value address\"))\n\tif mapValueType.is24WidthType() {\n\t\temit(S(\"LOAD_24_BY_DEREF\"))\n\t} else {\n\t\temit(S(\"LOAD_8_BY_DEREF\"))\n\t}\n\n\temit(S(\"mov $1, %%%s # ok = true\"), okRegister)\n\temit(S(\"pop %%r12 # key address. will be in map set\"))\n\temit(S(\"jmp %s # exit loop\"), labelEnd)\n\n\temit(S(\"%s: # incr\"), labelIncr)\n\temit(S(\"add $1, %%r13\")) // i++\n\temit(S(\"jmp %s\"), labelBegin)\n\n\temit(S(\"%s: # end loop\"), labelEnd)\n\n}", "title": "" }, { "docid": "f6c85fd00572f5ebf7fe2eca21697ee6", "score": "0.48031715", "text": "func (c *Context) JSON(code int, i interface{}) (err error) {\n\t_, pretty := c.QueryParams()[\"pretty\"]\n\tif pretty {\n\t\treturn c.JSONPretty(code, i, \" \")\n\t}\n\tb, err := json.Marshal(i)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn c.JSONBlob(code, b)\n}", "title": "" }, { "docid": "20149351a9be9302a4395c5843448f66", "score": "0.48023313", "text": "func (v OrderedMapStringToFilter) encodeJSON(out *jwriter.Writer) {\n\tif v == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {\n\t\tout.RawString(`null`)\n\t} else {\n\t\tout.RawByte('{')\n\t\tv2First := true\n\t\tkeys := []string{}\n\t\tfor key, _ := range v {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t\tsort.Strings(keys)\n\t\tfor _, v2Name := range keys {\n\t\t\tif v2First {\n\t\t\t\tv2First = false\n\t\t\t} else {\n\t\t\t\tout.RawByte(',')\n\t\t\t}\n\t\t\tout.String(string(v2Name))\n\t\t\tout.RawByte(':')\n\t\t\t(v[v2Name]).MarshalEasyJSON(out)\n\t\t}\n\t\tout.RawByte('}')\n\t}\n}", "title": "" }, { "docid": "10276f7bbfcc05844a2e31f03a831a6e", "score": "0.48022723", "text": "func (e *jsiiProxy_EmrModifyInstanceGroupByName) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "076ef07bdb730f74587ea3e4485cae7d", "score": "0.47984317", "text": "func (m Map) String() string {\n\tvar str strings.Builder\n\n\t// Put all carts into the map based on their datum index\n\tcartMap := make(map[int]*Cart)\n\tfor _, cart := range m.carts {\n\t\tcartMap[cart.MapIndex(m.width)] = cart\n\t}\n\n\t// Build the map string\n\tfor index, datum := range m.data {\n\t\tif index > 0 && index % m.width == 0 {\n\t\t\tstr.WriteRune('\\n')\n\t\t}\n\n\t\tif cart, exists := cartMap[index]; exists {\n\t\t\tstr.WriteString(cart.String())\n\t\t} else {\n\t\t\tstr.WriteRune(datum)\n\t\t}\n\t}\n\n\treturn str.String()\n}", "title": "" }, { "docid": "6ddf6f4c6266d3df3168132f279e7169", "score": "0.47983062", "text": "func CreateMap(w http.ResponseWriter, r *http.Request) {\n\n\tseed, _ := strconv.ParseInt(r.URL.Query().Get(\"seed\"), 10, 0)\n\tif seed == 0 {\n\t\tseed = mrand.Int63()\n\t}\n\n\t// jsonp is merely a json file with a wrapping function.\n\tcallback := r.URL.Query().Get(\"jsoncallback\")\n\tif callback == \"\" {\n\t\tcallback = \"jsonpCallback\"\n\t}\n\n\tvar err error\n\ttiles := perlinTiles(30, 30, seed)\n\n\tb, err := json.Marshal(tiles)\n\tif err != nil {\n\t\thttp.Error(w, \"json:\"+err.Error(), http.StatusInternalServerError)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/javascript\")\n\tfmt.Fprintf(w, \"%v(%v)\", callback, string(b))\n}", "title": "" }, { "docid": "b5b9901ac03c1f35b9d989d335d17ed0", "score": "0.47955877", "text": "func ExampleAnvil_Notation_map() {\n\tsource := map[string]string{\n\t\t\"One\": \"Uno\",\n\t\t\"Two\": \"Dos\",\n\t}\n\tsqueezer := &anvil.Anvil{Mode: anvil.SkipEmpty, Glue: \".\"}\n\n\titems, _ := squeezer.Notation(source)\n\n\tfor i := range items {\n\t\tfmt.Printf(\"%#v\\n\", items[i])\n\t}\n\t// Output:\n\t// anvil.Item{Key:\"[One]\", Value:\"Uno\"}\n\t// anvil.Item{Key:\"[Two]\", Value:\"Dos\"}\n}", "title": "" }, { "docid": "aa51efe78bb631af6f7f3971a8961d74", "score": "0.47926995", "text": "func WrapJSON() sarama.StringEncoder {\n\tstart := time.Now()\n\n\tdata := make(map[string]interface{})\n\tfor i := 0; i < 200; i++ {\n\t\tnum := rand.Int63()\n\t\tdata[\"field\"+string(i)] = num\n\t}\n\n\texportData, err := json.Marshal(data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tt := time.Now()\n\telapsed := t.Sub(start)\n\tlog.Println(\"GenerateJSON time elapsed: \", elapsed)\n\treturn sarama.StringEncoder(exportData)\n}", "title": "" }, { "docid": "1382c745c8ff55da0d48699eb5e0a56c", "score": "0.47874582", "text": "func encodeMap(buf *bytes.Buffer, obj reflect.Value) error{\n\tif obj.Len() == 0 {\n\t\tbuf.WriteString(\"{}\")\n\t\treturn nil\n\t}\n\tbuf.WriteByte('{')\n\tfirst := true\n\tfor _, k := range obj.MapKeys() {\n\t\tif first {\n\t\t\tfirst = false\n\t\t} else {\n\t\t\tbuf.WriteByte(',')\n\t\t}\n\t\tbuf.WriteString(fmt.Sprintf(\"\\\"%s\\\":\", k))\n\t\tfm := \"%v\"\n\t\tv := obj.MapIndex(k).Elem()\n\t\tvk := v.Kind()\n\t\tif vk == reflect.Interface {\n\t\t\tv = v.Elem()\n\t\t\tvk = v.Type().Kind()\n\t\t}\n\t\tswitch vk {\n\t\tcase reflect.Float64, reflect.Float32:\n\t\t\tf := v.Float()\n\t\t\ti := float64(int64(f))\n\t\t\tif i == f {\n\t\t\t\tfm = \"%0.1f\"\n\t\t\t}\n\t\tcase reflect.Map:\n\t\t\tt := reflect.TypeOf(v)\n\t\t\tif v.Type().Key().Kind() != reflect.String {\n\t\t\t\treturn fmt.Errorf(\"cannot encode map with keys of type %v\", t)\n\t\t\t}\n\t\t\tif err := encodeMap(buf, v) ; err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\tcase reflect.Slice, reflect.Array:\n\t\t\tif err := encodeArray(buf, v) ; err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\tcase reflect.String:\n\t\t\tbuf.WriteString(fmt.Sprintf(\"\\\"%s\\\"\" , strings.Replace(v.String(), \"\\\"\", \"\\\\\\\"\", -1)))\n\t\t\tcontinue\n\t\t}\n\t\tbuf.WriteString(fmt.Sprintf(fm , v))\n\t}\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "34e95af22681ce419b0a3653e3796eef", "score": "0.47870553", "text": "func PrintMap(m map[int]int) {\n\tfmt.Println(m)\n}", "title": "" }, { "docid": "faeb58d452553ca77dcb548f055b90dc", "score": "0.4777079", "text": "func (d *jsiiProxy_DynamoGetItem) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "022b8d94b47f549e3fa0923f86dd1b19", "score": "0.4774343", "text": "func (o *Map) MarshalJSON() (out []byte, err error) {\n\tvar b bytes.Buffer\n\twriter := bufio.NewWriter(&b)\n\twriter.WriteString(\"{\")\n\n\to.Range(func(k string, v interface{}) bool {\n\t\tvar b2 []byte\n\t\twriter.WriteString(\"\\\"\" + k + \"\\\":\")\n\t\tif b2, err = json.Marshal(v); err != nil {\n\t\t\treturn false\n\t\t}\n\t\twriter.Write(b2)\n\t\twriter.WriteString(\",\")\n\t\treturn true\n\t})\n\twriter.WriteString(\"}\")\n\twriter.Flush()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout = b.Bytes()\n\n\tout = append(out[:len(out)-2], out[len(out)-1]) // get rid of comma\n\treturn out, nil\n}", "title": "" }, { "docid": "0ba6e03e707aeb138f4289c2864e959c", "score": "0.4773961", "text": "func ShowMapOfStringArray(m map[string][]string, desc string) {\n\tlog.Printf(\"%s\\n\", desc)\n\tfor k, v := range m {\n\t\tShowStringArray(v, k)\n\t}\n\tlog.Printf(\"\\n\")\n}", "title": "" }, { "docid": "3360a8b817fdf058f93c5df15b58eb22", "score": "0.47730348", "text": "func (r JSON) Render(w http.ResponseWriter) error {\n\treturn WriteJSON(w, r.Data)\n}", "title": "" }, { "docid": "c95e6c5bde6f9ac72030013e547bd8f7", "score": "0.47714016", "text": "func (g *Generator) buildMap(runs [][]Value, typeName string) {\n\tg.Printf(\"\\n\")\n\tg.declareNameVars(runs, typeName, \"\")\n\tg.Printf(\"\\nvar _%s_map = map[%s]string{\\n\", typeName, typeName)\n\tn := 0\n\tfor _, values := range runs {\n\t\tfor _, value := range values {\n\t\t\tg.Printf(\"\\t%s: _%s_name[%d:%d],\\n\", &value, typeName, n, n+len(value.name))\n\t\t\tn += len(value.name)\n\t\t}\n\t}\n\tg.Printf(\"}\\n\\n\")\n\tg.Printf(stringMap, typeName)\n\tif generateMarshalers {\n\t\tg.Printf(stringMapMarhalers, typeName)\n\t}\n\tif g.sql {\n\t\tg.Printf(stringMapSQL, typeName)\n\t}\n}", "title": "" }, { "docid": "6e764546e5994f43f73bae6c5bfe8b86", "score": "0.47587135", "text": "func (e *jsiiProxy_EmrSetClusterTerminationProtection) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1ceaa212c62f3450ea74c68ec866c234", "score": "0.47528723", "text": "func parseMap(tx *trans, mp map[interface{}]interface{}, space string, newline bool) {\n\tdone := false\n\tfor key, value := range mp {\n\t\tif !done {\n\t\t\tif newline {\n\t\t\t\tfmt.Fprintf(tx.output, \"\\n%s\", space)\n\t\t\t}\n\t\t\tdone = true\n\t\t} else {\n\t\t\tfmt.Fprintf(tx.output, \"%s\", space)\n\t\t}\n\t\tswitch k := key.(type) {\n\t\tcase string:\n\t\t\tfmt.Fprintf(tx.output, \"%v: \", k)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"# map key unknown: %+v\", k)\n\t\t}\n\t\tswitch v := value.(type) {\n\t\tcase string:\n\t\t\ttext := strings.TrimSuffix(value.(string), \"\\n\")\n\t\t\tif !contains(tx.skips, key.(string)) {\n\t\t\t\tfmt.Fprintf(tx.output, \" >\\n%s %v\\n\", space, TRANSLATE_WITH_REPLACE(text, tx))\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(tx.output, \"%s\\n\", text)\n\t\t\t}\n\t\tcase bool:\n\t\t\tfmt.Fprintf(tx.output, \"%v\\n\", v)\n\t\tcase int:\n\t\t\tfmt.Fprintf(tx.output, \"%v\\n\", v)\n\t\tcase float64:\n\t\t\tfmt.Fprintf(tx.output, \"%v\\n\", v)\n\t\tcase map[interface{}]interface{}:\n\t\t\tparseMap(tx, v, space+SPACE, true)\n\t\tcase []interface{}:\n\t\t\tfmt.Fprintf(tx.output, \"\\n\")\n\t\t\tparseArray(tx, v, space+SPACE, key.(string))\n\t\tdefault:\n\t\t\tlog.Fatalf(\"# unknow value %+v\\n\", value, key)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9dded83691130fea7a6608912aafa73a", "score": "0.4749468", "text": "func FormatMap(m map[string]string) (fmtStr string) {\n\tfor key, value := range m {\n\t\tfmtStr += fmt.Sprintf(\"%v=%q\\n\", key, value)\n\t}\n\tfmtStr = strings.TrimSuffix(fmtStr, \"\\n\")\n\n\treturn\n}", "title": "" }, { "docid": "9dded83691130fea7a6608912aafa73a", "score": "0.4749468", "text": "func FormatMap(m map[string]string) (fmtStr string) {\n\tfor key, value := range m {\n\t\tfmtStr += fmt.Sprintf(\"%v=%q\\n\", key, value)\n\t}\n\tfmtStr = strings.TrimSuffix(fmtStr, \"\\n\")\n\n\treturn\n}", "title": "" }, { "docid": "2e53a9c41e91470312088c8fddec59af", "score": "0.4746212", "text": "func JSON(c echo.Context, code int, i interface{}, escapeJSON bool) (err error) {\n\tindent := \"\"\n\tif _, pretty := c.QueryParams()[\"pretty\"]; c.Echo().Debug || pretty {\n\t\tindent = defaultIndent\n\t}\n\treturn encodeJSON(c, code, i, indent, escapeJSON)\n}", "title": "" }, { "docid": "09116fb3021e20e3c46b98398e08a15f", "score": "0.4740531", "text": "func (r *render) JSON(w io.Writer, status int, v interface{}) error {\n\treturn r.render.JSON(w, status, v)\n}", "title": "" }, { "docid": "fedd609561327d14d9e424d07f63450d", "score": "0.47395542", "text": "func (d *jsiiProxy_DynamoUpdateItem) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "02aecc11a2eb0f55b6c28f57ea6f5d07", "score": "0.47392684", "text": "func (e *jsiiProxy_EmrTerminateCluster) RenderIterator() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderIterator\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f7309cad5d11c4447fa387b02055c8f2", "score": "0.47392124", "text": "func (LatestMap) MarshalJSON() ([]byte, error) {\n\tpanic(\"MarshalJSON shouldn't be used, use CodecEncodeSelf instead\")\n}", "title": "" }, { "docid": "3f67eb72a6f5fe1d8a803b7ad9927a82", "score": "0.47374088", "text": "func (c *jsiiProxy_CfnApiMappingV2) RenderProperties(props *map[string]interface{}) *map[string]interface{} {\n\tvar returns *map[string]interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderProperties\",\n\t\t[]interface{}{props},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "d735da09e2d1b3d1d4dd6c4136c14fa7", "score": "0.47344816", "text": "func printMap(c map[string]string) {\n\tfor key, value := range c {\n\n\t\tfmt.Println(\"Hex code for\", key, \"is\", value)\n\t}\n}", "title": "" }, { "docid": "e45fb67f8756eb9a7a21a12d3f4cb7aa", "score": "0.47279528", "text": "func OrderMap(m interface{}) string {\n\t// in particular exclude slices, which template would happily accept but\n\t// which would probably represent a coding mistake\n\tif reflect.TypeOf(m).Kind() != reflect.Map {\n\t\tpanic(\"not a map\")\n\t}\n\tt := template.Must(template.New(\"\").Parse(\n\t\t`map[{{range $k, $v := .}}{{$k}}:{{$v}} {{end}}]`))\n\tvar b bytes.Buffer\n\tif err := t.Execute(&b, m); err != nil {\n\t\tpanic(err)\n\t}\n\treturn b.String()\n}", "title": "" } ]
3baa17367467688586eff386f08a9fd3
IsDisabled returns true if FlagPluginsDynamicAngularDetectionPatterns is not enabled.
[ { "docid": "5a971bbc66a3d31c7a1b56f459a357aa", "score": "0.86868715", "text": "func (d *Dynamic) IsDisabled() bool {\n\treturn !d.features.IsEnabled(featuremgmt.FlagPluginsDynamicAngularDetectionPatterns)\n}", "title": "" } ]
[ { "docid": "a8c03f42f152d7b5ac5a8d132cf32e9c", "score": "0.59893274", "text": "func (plugin *Plugin) IsDisabled() (disabled bool) {\n\treturn plugin.disabled\n}", "title": "" }, { "docid": "e782e8e1ba3275af96eb379754dc8bcc", "score": "0.5746978", "text": "func IsEnabled() bool {\n\treturn os.Getenv(\"DEBUG\") != \"\"\n}", "title": "" }, { "docid": "146c1389f859c7378edcabc821a1281f", "score": "0.56693804", "text": "func (n *TailFileWidget) IsDisabled() bool {\n\treturn n.disabled\n}", "title": "" }, { "docid": "764f9f97d40af5d3eed6c6e4b02a1e87", "score": "0.5625409", "text": "func (o ServerlessKubernetesAddonOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v ServerlessKubernetesAddon) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "2e84ceba4dfadfb0a6ba5657f8e28202", "score": "0.5608825", "text": "func (l *Provider) IsDisabledProvider() (bool, error) {\n\treturn false, nil\n}", "title": "" }, { "docid": "a5370ed66eb1af68e5e5b3823f8e4bdd", "score": "0.5589242", "text": "func (d *disabledFaucetProcessor) IsEnabled() bool {\n\treturn false\n}", "title": "" }, { "docid": "0121ffaf99d376a1b00b7f3679f067e6", "score": "0.5527564", "text": "func (o ManagedKubernetesAddonOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v ManagedKubernetesAddon) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "fa1b294d84f33e5029d6b02180e61e09", "score": "0.5493351", "text": "func (o RegionUrlMapPathMatcherPathRuleRouteActionCorsPolicyOutput) Disabled() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v RegionUrlMapPathMatcherPathRuleRouteActionCorsPolicy) bool { return v.Disabled }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "3db3873693b1043c6c94dabd6ad902a4", "score": "0.5478622", "text": "func IsDisabled(line string) bool {\n\treturn disableRe.MatchString(line)\n}", "title": "" }, { "docid": "765807f5b6ce971d896d7bb87ba3b970", "score": "0.54708993", "text": "func (o *CollisionShape2D) IsDisabled() gdnative.Bool {\n\t//log.Println(\"Calling CollisionShape2D.IsDisabled()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"CollisionShape2D\", \"is_disabled\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "8d77c927d8c1af0a58aa1f723971c17a", "score": "0.5441217", "text": "func (o EdgeKubernetesAddonOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v EdgeKubernetesAddon) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "7e3b30b5c6a1ec9fe6203931a2e50329", "score": "0.5437286", "text": "func (o NexusSpecAutomaticUpdateOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v NexusSpecAutomaticUpdate) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "d4183c24210192544e24e745bef92355", "score": "0.5422784", "text": "func (o URLMapPathMatcherPathRuleRouteActionCorsPolicyOutput) Disabled() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v URLMapPathMatcherPathRuleRouteActionCorsPolicy) bool { return v.Disabled }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "766c3dbde586d4196543d10f355d8b1d", "score": "0.53831035", "text": "func (o KubernetesAddonTypeOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v KubernetesAddonType) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "0bf1aa2d0bcadc67fcf057b4ac091074", "score": "0.53789735", "text": "func (_this *HTMLTextAreaElement) Disabled() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"disabled\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "18c257400d6492104b2a6fae3ba039dd", "score": "0.5369685", "text": "func (o RegionUrlMapPathMatcherPathRuleRouteActionCorsPolicyPtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *RegionUrlMapPathMatcherPathRuleRouteActionCorsPolicy) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "c828bb4b3d47b4f614b20ce510822657", "score": "0.53295153", "text": "func IsEnabled() bool {\n\tif v, err := strconv.ParseBool(os.Getenv(telemetryEnv)); err == nil {\n\t\treturn v\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4fde86c49a338cc1afdc0b96cced9ea1", "score": "0.5321214", "text": "func (o WorkforcePoolProviderOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *WorkforcePoolProvider) pulumi.BoolPtrOutput { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "b932b33c7a1962615aebad9c892a6444", "score": "0.5309337", "text": "func IsProfilingDisabled(params []string) bool {\n\treturn args.HasSingleFlagArgument(\"--profiling=\", \"false\", params)\n}", "title": "" }, { "docid": "5424f131fde5c06abceeaab9924d20b0", "score": "0.5269887", "text": "func (o *Automation) GetDisabled() bool {\n\n\treturn o.Disabled\n}", "title": "" }, { "docid": "0f8ad9fca125ba1b25fe1d144d1060c5", "score": "0.5268435", "text": "func (o URLMapPathMatcherPathRuleRouteActionCorsPolicyPtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *URLMapPathMatcherPathRuleRouteActionCorsPolicy) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "1e2b3eee71c13bb760f041eaf765a928", "score": "0.52665573", "text": "func (g *containerRegistryProvider) Enabled() bool {\n\n\treturn false\n}", "title": "" }, { "docid": "995c640891c87d6e347e1019c62b3ad9", "score": "0.52617615", "text": "func (o GoogleCloudDataplexV1TaskTriggerSpecResponseOutput) Disabled() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v GoogleCloudDataplexV1TaskTriggerSpecResponse) bool { return v.Disabled }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "ff82266ff6336efdbe7ab88a7dfecbd7", "score": "0.525514", "text": "func (_this *HTMLOptGroupElement) Disabled() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"disabled\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "ae3adec250bf386aa42efac4d4386a22", "score": "0.5251504", "text": "func (o NexusSpecAutomaticUpdatePtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *NexusSpecAutomaticUpdate) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "ca5e3fc2b945a46709fdc29861948eb7", "score": "0.5230337", "text": "func (o URLMapPathMatcherDefaultRouteActionCorsPolicyOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v URLMapPathMatcherDefaultRouteActionCorsPolicy) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "727fa6824295064c350237e74a2dd23e", "score": "0.5213459", "text": "func (s *PermsSyncer) isDisabled() bool {\n\treturn globals.PermissionsUserMapping().Enabled ||\n\t\t(licensing.EnforceTiers && licensing.Check(licensing.FeatureACLs) != nil) ||\n\t\tconf.Get().DisableAutoCodeHostSyncs\n}", "title": "" }, { "docid": "313f9afd84f812f005d9d41764cadc52", "score": "0.5212874", "text": "func (o URLMapPathMatcherDefaultRouteActionCorsPolicyPtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *URLMapPathMatcherDefaultRouteActionCorsPolicy) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "66da1a95a912b676958a288ce910fdac", "score": "0.52054137", "text": "func (o RegionUrlMapPathMatcherRouteRuleRouteActionCorsPolicyPtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *RegionUrlMapPathMatcherRouteRuleRouteActionCorsPolicy) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "3848755f4f7f203fe804de1089290df6", "score": "0.51932466", "text": "func IsEnabled() bool {\n\treturn *grpcAddr != \"\"\n}", "title": "" }, { "docid": "0de61e10a58cd99c09ae82679456445f", "score": "0.5189302", "text": "func (self Remote) GetDisabled() bool {\n\tret0 := C.flatpak_remote_get_disabled(self.native())\n\treturn util.Int2Bool(int(ret0)) /*go:.util*/\n}", "title": "" }, { "docid": "4e742fdbdc1e9e9852bff57ceb7d34bb", "score": "0.5174775", "text": "func (o RegionUrlMapPathMatcherRouteRuleRouteActionCorsPolicyOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v RegionUrlMapPathMatcherRouteRuleRouteActionCorsPolicy) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "2813a08c5bab2e6264c3a6fa4074d136", "score": "0.5169424", "text": "func (o GoogleCloudDataplexV1TaskTriggerSpecOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudDataplexV1TaskTriggerSpec) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "43ae2d09b62362860cb48766238a7492", "score": "0.51170355", "text": "func IsEnabled() bool {\n\treturn enabled\n}", "title": "" }, { "docid": "291ce73987de4a11014da4323eb9f635", "score": "0.5102498", "text": "func Enabled() bool {\n\treturn false\n}", "title": "" }, { "docid": "8ec9a49f291723c448059a88961472d6", "score": "0.5087686", "text": "func IsDisabled(err error) bool {\n\treturn reasonForError(err) == disabledError\n}", "title": "" }, { "docid": "ba971f50ef817217a741717db1a1473d", "score": "0.50857556", "text": "func IsEnabled(w http.ResponseWriter, r *http.Request) {\n\tstat, err := os.Stat(config)\n\tif err != nil && os.IsNotExist(err) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tio.WriteString(w, strconv.FormatBool(stat.Mode().Perm() != 0))\n}", "title": "" }, { "docid": "8139f39cfa7b7674192aed0f467ea728", "score": "0.5080415", "text": "func (o AppSpecServiceAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v AppSpecServiceAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "12b8a25fb5f6b4756d1d2b9378100403", "score": "0.50785756", "text": "func (r *FluxMonitorSpecResolver) PollTimerDisabled() bool {\n\treturn r.spec.PollTimerDisabled\n}", "title": "" }, { "docid": "88d577edb710543f577be9b47b3dfe25", "score": "0.50721484", "text": "func (me TxsdViewTypeZoomAndPan) IsDisable() bool { return me == \"disable\" }", "title": "" }, { "docid": "be8224abc33659c8d1bb202c93828913", "score": "0.5065687", "text": "func (o GetAppSpecServiceAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GetAppSpecServiceAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "fa49759d8aeac0fdc52e1ef3765dee12", "score": "0.5061035", "text": "func (o RegionUrlMapDefaultRouteActionCorsPolicyOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v RegionUrlMapDefaultRouteActionCorsPolicy) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "914b00d62fc5198e25547d869de816ea", "score": "0.50464773", "text": "func (o *SparseAutomation) GetDisabled() (out bool) {\n\n\tif o.Disabled == nil {\n\t\treturn\n\t}\n\n\treturn *o.Disabled\n}", "title": "" }, { "docid": "22d07f21f3ff4efabf098e2215306807", "score": "0.50413066", "text": "func IsEnabled(feature Feature) bool {\n\t_, ok := global.enabled[feature]\n\n\treturn ok\n}", "title": "" }, { "docid": "67b19531312c5fb66c34010c7d95b68a", "score": "0.50381786", "text": "func (_this *HTMLOptionElement) Disabled() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"disabled\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "f9f2d0d2409c0adf189ddef6c8f769e6", "score": "0.50376165", "text": "func (o RegionUrlMapDefaultRouteActionCorsPolicyPtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *RegionUrlMapDefaultRouteActionCorsPolicy) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "000ff14466670fbda29901eb8a9d4643", "score": "0.5023792", "text": "func (o LookupFirewallResultOutput) Disabled() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupFirewallResult) bool { return v.Disabled }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "3b0f4afa485f936b3723cf81da211a4d", "score": "0.50163615", "text": "func (svc *Service) NEGEnabled() bool {\n\treturn svc.NEGExposed() || svc.NEGEnabledForIngress()\n}", "title": "" }, { "docid": "0e07cf17805344a0636ad1f7c7eb5a6a", "score": "0.50141484", "text": "func (_this *HTMLButtonElement) Disabled() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"disabled\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "902770062644ec97c0b77b55cfe876b7", "score": "0.50064635", "text": "func (o AppSpecFunctionAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v AppSpecFunctionAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "7c6fe15faa6d375133b0366bb9749e3d", "score": "0.50043446", "text": "func IsEnabled() bool {\n\treturn opt.Trace != Disabled\n}", "title": "" }, { "docid": "1352451c677d84d18eb5509e2b5fc0b8", "score": "0.5000472", "text": "func (o RegionAutoscalerAutoscalingPolicyScalingScheduleOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v RegionAutoscalerAutoscalingPolicyScalingSchedule) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "cbd071aaae3c6ea9d455fdc095575f2c", "score": "0.4996029", "text": "func Enabled() bool {\n\treturn impl != nil\n}", "title": "" }, { "docid": "39eb7b9b1d6abe059ec8b1841b079d1b", "score": "0.4985683", "text": "func (m *AgentMutation) Disabled() (r bool, exists bool) {\n\tv := m.disabled\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "675caa835f6049bb497e99ee3b6de431", "score": "0.49805316", "text": "func (o GetAppSpecFunctionAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GetAppSpecFunctionAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "951fbc04b4bb237abe9012bef2a20e31", "score": "0.49759495", "text": "func (o URLMapDefaultRouteActionCorsPolicyOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v URLMapDefaultRouteActionCorsPolicy) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "7bb785dd8342777eac3e0867464cd73e", "score": "0.49712592", "text": "func (l *StdLogger) WarnEnabled() bool {\n\treturn l.logEnable.Enabled(zap.WarnLevel)\n}", "title": "" }, { "docid": "5699605f04fef1dafa24f54c01a5ac13", "score": "0.4969487", "text": "func (_this *HTMLSelectElement) Disabled() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"disabled\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "0230ac7f12e8e778857cb243c68c8f86", "score": "0.4966764", "text": "func (a *AutoDownloadSettings) GetDisabled() (value bool) {\n\tif a == nil {\n\t\treturn\n\t}\n\treturn a.Flags.Has(0)\n}", "title": "" }, { "docid": "590af0c58adcc90a862a770b4269862e", "score": "0.4963522", "text": "func (i CUDA) HasDisableRequire() bool {\n\tif disable, exists := i[envNVDisableRequire]; exists {\n\t\t// i.logger.Debugf(\"NVIDIA_DISABLE_REQUIRE=%v; skipping requirement checks\", disable)\n\t\td, _ := strconv.ParseBool(disable)\n\t\treturn d\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "332a334636e0422a399fb9c3725a748d", "score": "0.49626985", "text": "func (kp KernelParam) Enabled() bool {\n\treturn kp == \"y\"\n}", "title": "" }, { "docid": "42fd9ddf98dc327411de483a1f3f3c7b", "score": "0.49626186", "text": "func (o DataTransferConfigOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *DataTransferConfig) pulumi.BoolPtrOutput { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "bf18c6791f108ff8a85c401795e178ac", "score": "0.49606273", "text": "func (l *Logger) IsWarningEnabled() bool {\n\treturn l.handler.IsEnabledFor(logger.LevelWarning)\n}", "title": "" }, { "docid": "1698cd1fec382dad29a5352cb4758bc9", "score": "0.49557158", "text": "func (c *Config) ZPagesDisabled() bool {\n\tif c == nil {\n\t\treturn true\n\t}\n\treturn c.ZPages != nil && c.ZPages.Disabled\n}", "title": "" }, { "docid": "e9c2e4f55b78878e6d8e4a8c130cbb10", "score": "0.49481547", "text": "func (c *client) IsEnabled(name string, defval bool) bool {\n\tfeature := c.features.Get(name)\n\tif feature == nil {\n\t\treturn defval\n\t}\n\n\tstatus, ok := feature.Status[c.environment]\n\tif !ok {\n\t\treturn defval\n\t}\n\n\treturn status\n}", "title": "" }, { "docid": "fada357c8f98da04516020040110fd78", "score": "0.49465856", "text": "func (g *metadataProvider) Enabled() bool {\n\treturn onGCEVM()\n}", "title": "" }, { "docid": "d90fb2af794e6018913562bed48b52b2", "score": "0.49442205", "text": "func (_this *HTMLInputElement) Disabled() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"disabled\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "87568b8f239a1c612c73eb51e7d0e966", "score": "0.49342874", "text": "func Disable() bool {\n\toldVal := Enable\n\tEnable = false\n\treturn oldVal\n}", "title": "" }, { "docid": "9551db70e7d088b03ba497d85230ecc7", "score": "0.4927608", "text": "func (o AppSpecAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v AppSpecAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "28fa17b57ba691c4743171812c1cea23", "score": "0.49259967", "text": "func IsDNSEnabled() bool {\n\treturn masterRTCfg.dnsEnabled\n}", "title": "" }, { "docid": "10b0e0e04c51731e677891865605bc22", "score": "0.49249732", "text": "func (o GetAppSpecAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GetAppSpecAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "6ce9892c4a35431b48ad91db86a8bac7", "score": "0.49127614", "text": "func (c *EnvConfig) GetHTTPSEnabled() bool {\n\tcallPtr, _, _, _ := runtime.Caller(0)\n\tvalue := getConfigValueFromEnv(util.NameOfFunction(callPtr))\n\n\tb, _ := strconv.ParseBool(value)\n\treturn b\n}", "title": "" }, { "docid": "18159b76073814c2658f4ba7044e2150", "score": "0.4901589", "text": "func gcpTestsDisabled() bool {\n\treturn strings.ToLower(os.Getenv(\"GCP_TESTS_OFF\")) != \"\"\n}", "title": "" }, { "docid": "c181f00688197f7aa8e0df540a793e06", "score": "0.49009353", "text": "func GetServiceDiscoveryDisable() bool {\n\treturn archaius.GetBool(\"cse.service.registry.serviceDiscovery.disabled\", false)\n}", "title": "" }, { "docid": "502f762b51e2e6a622aaa5607575a4b3", "score": "0.48993677", "text": "func (o URLMapDefaultRouteActionCorsPolicyPtrOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *URLMapDefaultRouteActionCorsPolicy) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disabled\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "486d0e814a325c6ebcd3cdaadb7678e0", "score": "0.48945436", "text": "func (f HandleFlag) IsBiasDisable() bool {\n\treturn f&HandleRequestBiasDisable != 0\n}", "title": "" }, { "docid": "965468d1ed489ffbb90d87e7b31693ff", "score": "0.4890037", "text": "func (a *Analytics) Enabled() (bool, error) {\n\t_, err := os.Stat(filepath.Join(a.root, \"disable\"))\n\n\tif os.IsNotExist(err) {\n\t\treturn true, nil\n\t}\n\n\treturn false, err\n}", "title": "" }, { "docid": "eb6aaf1a38d486787c5f5b3a129f5da7", "score": "0.48751664", "text": "func (m *MenuWidget) IsDisabled() bool {\n\treturn m.disabled\n}", "title": "" }, { "docid": "c7c183ccc06ccbd708ead61bcac590a7", "score": "0.48743674", "text": "func (o AppSpecWorkerAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v AppSpecWorkerAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "05dcbf098036382e811b639543a26251", "score": "0.48615354", "text": "func (o BillingAccountExclusionOutput) Disabled() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *BillingAccountExclusion) pulumi.BoolOutput { return v.Disabled }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "613c8d3bd4c0229f657a7d8194ceff80", "score": "0.48610684", "text": "func (p Properties) IsEnabled(builtin string) Builtin {\n\tm := p.BuiltinsMap()\n\tif b := m[Builtin(builtin)]; b {\n\t\treturn Builtin(builtin)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "96b0b5a38d95ead29c0477cab511286f", "score": "0.48562053", "text": "func hasDisableCheckFn(opt []RIBOpt) bool {\n\tfor _, o := range opt {\n\t\tif _, ok := o.(*disableCheckFn); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "79b6b5639b23b2f015f20774d76b8cad", "score": "0.48473033", "text": "func WarningEnabled() bool {\n\treturn enabledLevels[WARN]\n}", "title": "" }, { "docid": "a19a63474af3b6f1408cb5516c11c090", "score": "0.4835145", "text": "func (o VoiceConnectorOrganizationOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *VoiceConnectorOrganization) pulumi.BoolPtrOutput { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "f6d7a63d58135b52ecb36a988a405566", "score": "0.48304844", "text": "func (n *NegAnnotation) NEGEnabled() bool {\n\treturn n.NEGEnabledForIngress() || n.NEGExposed()\n}", "title": "" }, { "docid": "6067837b56bbdf5d21af42730a1d9502", "score": "0.48248598", "text": "func (o *NormalizedProjectRevision) GetHydraOidcDynamicClientRegistrationEnabled() bool {\n\tif o == nil || o.HydraOidcDynamicClientRegistrationEnabled == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.HydraOidcDynamicClientRegistrationEnabled\n}", "title": "" }, { "docid": "ed6cb5d15e6dc9bfd4ce62fcd927849e", "score": "0.48211342", "text": "func (o GetAppSpecWorkerAlertOutput) Disabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GetAppSpecWorkerAlert) *bool { return v.Disabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "11faeab5aa1c760e85be2c8eb647c49a", "score": "0.48202214", "text": "func (p *Plugin) IsEnable() bool {\n\tp.mu.RLock()\n\tdefer p.mu.RUnlock()\n\treturn p.enable\n}", "title": "" }, { "docid": "b424f60a163c4ca37a667a8c9aa74ce9", "score": "0.48108047", "text": "func (s SyncSpec) IsEnabled() bool {\n\treturn util.BoolOrDefault(s.Enabled)\n}", "title": "" }, { "docid": "ddccbb01509258809b495ad8166d8b74", "score": "0.48076397", "text": "func (r *RTContainerCheck) IsEnabled() bool {\n\trtChecksEnabled := !r.config.GetBool(\"process_config.disable_realtime_checks\")\n\treturn canEnableContainerChecks(r.config, false) && rtChecksEnabled\n}", "title": "" }, { "docid": "ce7cee3c5b1d18b56ab5114eab113f0d", "score": "0.48053658", "text": "func (o DistributionOutput) IsEnabled() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *Distribution) pulumi.BoolPtrOutput { return v.IsEnabled }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "5806cbd6999f2a13877298ef46240fec", "score": "0.48040202", "text": "func (config *BotConfig) IsModuleDisabled(module Module) string {\n\t_, ok := config.Modules.Disabled[ModuleID(strings.ToLower(module.Name()))]\n\tif ok {\n\t\treturn \" [disabled]\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d7cbbba68220e239998b813523cfbfdb", "score": "0.48029098", "text": "func (p *Aggregator) IsEnable() bool {\n\treturn p.config.Enable\n}", "title": "" }, { "docid": "d0fdf04346e1c434ac7ff781d2ca1440", "score": "0.4802482", "text": "func (r *SkippedResourceConfig) GroupDisabled(g string) bool {\n\tif _, ok := r.Groups[g]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eba013eb71a178d727432cf8471d5e97", "score": "0.47964707", "text": "func (s Storage) IsExcluded() bool {\n\tif s.Provider == \"\" {\n\t\tif !s.exclusionLogged {\n\t\t\tlog.Printf(\"[WARN] Ignoring Storage service pack due to required vars not being present.\")\n\t\t\ts.exclusionLogged = true\n\t\t}\n\t\treturn true\n\t}\n\tlog.Printf(\"[NOTICE] Storage service pack included.\")\n\treturn false\n}", "title": "" }, { "docid": "01787693b409bb53476b7e1d845c617f", "score": "0.4778451", "text": "func (c *Claimer) IsDisableRenewal() bool {\n\tif c.claims == nil || c.claims.DisableRenewal == nil {\n\t\treturn *c.global.DisableRenewal\n\t}\n\treturn *c.claims.DisableRenewal\n}", "title": "" }, { "docid": "544d31111580af464dbccea6d4b71f2d", "score": "0.47779375", "text": "func (o OtsBackupPlanOutput) Disabled() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *OtsBackupPlan) pulumi.BoolOutput { return v.Disabled }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "b0b479f9ef119c591a4009c37adc0cba", "score": "0.47757387", "text": "func (config RegisterDomainConfig) IsGetMode() bool {\n\treturn false\n}", "title": "" }, { "docid": "54364e87ea3b1de4bc20b5f9613d7fff", "score": "0.47737467", "text": "func (o *BaseButton) IsDisabled() gdnative.Bool {\n\t//log.Println(\"Calling BaseButton.IsDisabled()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"BaseButton\", \"is_disabled\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "19946dd30c9ea5262448b88bdb42f219", "score": "0.47714272", "text": "func (m *QueryParameterMatcher) GetHiddenEnvoyDeprecatedRegex() *wrappers.BoolValue {\n\tif m != nil {\n\t\treturn m.HiddenEnvoyDeprecatedRegex\n\t}\n\treturn nil\n}", "title": "" } ]
0b84d53fec91219406e012299cc5f765
TestExponentIndexMin ensures that for every valid scale, the smallest normal number and all smaller numbers map to the correct index, which is that of the smallest normal number. Tests that the lower boundary of the smallest bucket is correct, even when that number is subnormal.
[ { "docid": "4a258ec6f55ff7a81a4d6582553a7d0d", "score": "0.88117564", "text": "func TestExponentIndexMin(t *testing.T) {\n\tfor scale := MinScale; scale <= MaxScale; scale++ {\n\t\tm, err := NewMapping(scale)\n\t\trequire.NoError(t, err)\n\n\t\tminIndex := m.MapToIndex(MinValue)\n\n\t\tboundary, err := m.LowerBoundary(minIndex)\n\t\trequire.NoError(t, err)\n\n\t\tcorrectMinIndex := int64(MinNormalExponent) >> -scale\n\t\trequire.Greater(t, correctMinIndex, int64(math.MinInt32))\n\t\trequire.Equal(t, int32(correctMinIndex), minIndex)\n\n\t\tcorrectBoundary := roundedBoundary(scale, int32(correctMinIndex))\n\n\t\trequire.Equal(t, correctBoundary, boundary)\n\t\trequire.Greater(t, roundedBoundary(scale, int32(correctMinIndex+1)), boundary)\n\n\t\t// Subnormal values map to the min index:\n\t\trequire.Equal(t, m.MapToIndex(MinValue/2), int32(correctMinIndex))\n\t\trequire.Equal(t, m.MapToIndex(MinValue/3), int32(correctMinIndex))\n\t\trequire.Equal(t, m.MapToIndex(MinValue/100), int32(correctMinIndex))\n\t\trequire.Equal(t, m.MapToIndex(0x1p-1050), int32(correctMinIndex))\n\t\trequire.Equal(t, m.MapToIndex(0x1p-1073), int32(correctMinIndex))\n\t\trequire.Equal(t, m.MapToIndex(0x1.1p-1073), int32(correctMinIndex))\n\t\trequire.Equal(t, m.MapToIndex(0x1p-1074), int32(correctMinIndex))\n\n\t\t// One smaller index will underflow.\n\t\t_, err = m.LowerBoundary(minIndex - 1)\n\t\trequire.Equal(t, err, mapping.ErrUnderflow)\n\t}\n}", "title": "" } ]
[ { "docid": "c3ba896708d8b66c7dad86e115bc42c2", "score": "0.7367318", "text": "func TestExponentMappingMinScale(t *testing.T) {\n\tm, err := NewMapping(MinScale)\n\trequire.NoError(t, err)\n\n\trequire.Equal(t, MinScale, m.Scale())\n\n\tfor _, pair := range []expectMapping{\n\t\t{1, 0},\n\t\t{math.MaxFloat64 / 2, 0},\n\t\t{math.MaxFloat64, 0},\n\t\t{math.SmallestNonzeroFloat64, -1},\n\t\t{0.5, -1},\n\t} {\n\t\tt.Run(fmt.Sprint(pair.value), func(t *testing.T) {\n\t\t\tidx := m.MapToIndex(pair.value)\n\n\t\t\trequire.Equal(t, pair.index, idx)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ee32fcd82c0fc49983ecb5b02d02fe25", "score": "0.6765402", "text": "func TestExponentIndexMax(t *testing.T) {\n\tfor scale := MinScale; scale <= MaxScale; scale++ {\n\t\tm, err := NewMapping(scale)\n\t\trequire.NoError(t, err)\n\n\t\tindex := m.MapToIndex(MaxValue)\n\n\t\t// Correct max index is one less than the first index\n\t\t// that overflows math.MaxFloat64, i.e., one less than\n\t\t// the index of +Inf.\n\t\tmaxIndex := (int32(MaxNormalExponent+1) >> -scale) - 1\n\t\trequire.Equal(t, index, int32(maxIndex))\n\n\t\t// The index maps to a finite boundary.\n\t\tbound, err := m.LowerBoundary(index)\n\t\trequire.NoError(t, err)\n\n\t\trequire.Equal(t, bound, roundedBoundary(scale, maxIndex))\n\n\t\t// One larger index will overflow.\n\t\t_, err = m.LowerBoundary(index + 1)\n\t\trequire.Equal(t, err, mapping.ErrOverflow)\n\t}\n}", "title": "" }, { "docid": "f79115b8a4ba4511120690454a484e59", "score": "0.64715797", "text": "func TestFloorRootExactPowers(t *testing.T) {\n\tfor i := int64(0); i < 16; i++ {\n\t\tfor j := int64(1); j < 16; j++ {\n\t\t\tk := floorRootSmall(expSmall(i, j), j)\n\t\t\tif k != i {\n\t\t\t\tt.Error(i, j, k)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b03aebede46f566558143578d736fa00", "score": "0.6389576", "text": "func TestFloorRootSlightlyOverExactPower(t *testing.T) {\n\tfor i := int64(1); i < 16; i++ {\n\t\tfor j := int64(2); j < 16; j++ {\n\t\t\tk := floorRootSmall(expSmall(i, j)+1, j)\n\t\t\tif k != i {\n\t\t\t\tt.Error(i, j, k)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f2db0de9d1bab5e18acf4f2868c7d7c4", "score": "0.62028694", "text": "func TestFloorRootSlightlyUnderExactPower(t *testing.T) {\n\tfor i := int64(1); i < 16; i++ {\n\t\tfor j := int64(2); j < 16; j++ {\n\t\t\tk := floorRootSmall(expSmall(i+1, j)-1, j)\n\t\t\tif k != i {\n\t\t\t\tt.Error(i, j, k)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "24bf02f62c8ad32cb68eeb0bdd355f90", "score": "0.5980565", "text": "func TestFloorRootMidwayBetweenExactPowers(t *testing.T) {\n\tfor i := int64(1); i < 16; i++ {\n\t\tfor j := int64(2); j < 16; j++ {\n\t\t\tm := (expSmall(i, j) + expSmall(i+1, j)) / 2\n\t\t\tk := floorRootSmall(m, j)\n\t\t\tif k != i {\n\t\t\t\tt.Error(i, j, k)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c8bf28e043677dc23f656c46559ee8f9", "score": "0.5811138", "text": "func TestInvalidMinimum(t *testing.T) {\n\tassertionErrTest(\"x-10\", t)\n}", "title": "" }, { "docid": "7ed5a344d4de5cedf73b6bfe20b25261", "score": "0.57138497", "text": "func TestMin(t *testing.T) {\n minValue := Min(2, 4)\n\t\tif minValue != 2 {\n\t\t\tt.Error(\"expected 2 as min value: \")\n\t\t}\n\n minValue = Min(4, 4)\n if minValue != 4 {\n t.Error(\"expected 4 as min value: \")\n }\n\n minValue = Min(-2, -5)\n if minValue != -5 {\n t.Error(\"expected -5 as min value: \")\n }\n}", "title": "" }, { "docid": "e04ece618701a2cedf493ef8ac63e605", "score": "0.56709486", "text": "func TestMinAllowedPartSize(t *testing.T) {\n\tsizes := []struct {\n\t\tisMin bool\n\t\tsize int64\n\t}{\n\t\t// Test - 1 - within minimum part size.\n\t\t{\n\t\t\ttrue,\n\t\t\tglobalMinPartSize + 1,\n\t\t},\n\t\t// Test - 2 - smaller than minimum part size.\n\t\t{\n\t\t\tfalse,\n\t\t\tglobalMinPartSize - 1,\n\t\t},\n\t}\n\n\tfor i, s := range sizes {\n\t\tisMin := isMinAllowedPartSize(s.size)\n\t\tif isMin != s.isMin {\n\t\t\tt.Errorf(\"Test %d: Expected %t, got %t\", i+1, s.isMin, isMin)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7341f65bdce8b86afe5330f439497191", "score": "0.56455433", "text": "func (i IndexZYX) Min(idx ChunkIndexer) (ChunkIndexer, bool) {\n\tvar changed bool\n\tmin := i\n\tif min[0] > idx.Value(0) {\n\t\tmin[0] = idx.Value(0)\n\t\tchanged = true\n\t}\n\tif min[1] > idx.Value(1) {\n\t\tmin[1] = idx.Value(1)\n\t\tchanged = true\n\t}\n\tif min[2] > idx.Value(2) {\n\t\tmin[2] = idx.Value(2)\n\t\tchanged = true\n\t}\n\treturn min, changed\n}", "title": "" }, { "docid": "2bef079ec5e2210b9b6290cee9937bc8", "score": "0.56153345", "text": "func TestExponentMappingZero(t *testing.T) {\n\tm, err := NewMapping(0)\n\trequire.NoError(t, err)\n\n\trequire.Equal(t, int32(0), m.Scale())\n\n\tfor _, pair := range []expectMapping{\n\t\t{math.MaxFloat64, MaxNormalExponent},\n\t\t{0x1p+1023, MaxNormalExponent},\n\t\t{0x1p-1022, MinNormalExponent},\n\t\t{math.SmallestNonzeroFloat64, MinNormalExponent},\n\t\t{4, 2},\n\t\t{3, 1},\n\t\t{2, 1},\n\t\t{1.5, 0},\n\t\t{1, 0},\n\t\t{0.75, -1},\n\t\t{0.5, -1},\n\t\t{0.25, -2},\n\t} {\n\t\tidx := m.MapToIndex(pair.value)\n\n\t\trequire.Equal(t, pair.index, idx)\n\t}\n}", "title": "" }, { "docid": "a9e088dd3b4c4fec9190eac1084860b0", "score": "0.55460984", "text": "func TestExponentMappingNegFour(t *testing.T) {\n\tm, err := NewMapping(-4)\n\trequire.NoError(t, err)\n\trequire.Equal(t, int32(-4), m.Scale())\n\n\tfor _, pair := range []expectMapping{\n\t\t{float64(0x1), 0},\n\t\t{float64(0x10), 0},\n\t\t{float64(0x100), 0},\n\t\t{float64(0x1000), 0},\n\t\t{float64(0x10000), 1}, // Base == 2**16\n\t\t{float64(0x100000), 1},\n\t\t{float64(0x1000000), 1},\n\t\t{float64(0x10000000), 1},\n\t\t{float64(0x100000000), 2}, // == 2**32\n\t\t{float64(0x1000000000), 2},\n\t\t{float64(0x10000000000), 2},\n\t\t{float64(0x100000000000), 2},\n\t\t{float64(0x1000000000000), 3}, // 2**48\n\t\t{float64(0x10000000000000), 3},\n\t\t{float64(0x100000000000000), 3},\n\t\t{float64(0x1000000000000000), 3},\n\t\t{float64(0x10000000000000000), 4}, // 2**64\n\t\t{float64(0x100000000000000000), 4},\n\t\t{float64(0x1000000000000000000), 4},\n\t\t{float64(0x10000000000000000000), 4},\n\t\t{float64(0x100000000000000000000), 5},\n\n\t\t{1 / float64(0x1), 0},\n\t\t{1 / float64(0x10), -1},\n\t\t{1 / float64(0x100), -1},\n\t\t{1 / float64(0x1000), -1},\n\t\t{1 / float64(0x10000), -1}, // 2**-16\n\t\t{1 / float64(0x100000), -2},\n\t\t{1 / float64(0x1000000), -2},\n\t\t{1 / float64(0x10000000), -2},\n\t\t{1 / float64(0x100000000), -2}, // 2**-32\n\t\t{1 / float64(0x1000000000), -3},\n\t\t{1 / float64(0x10000000000), -3},\n\t\t{1 / float64(0x100000000000), -3},\n\t\t{1 / float64(0x1000000000000), -3}, // 2**-48\n\t\t{1 / float64(0x10000000000000), -4},\n\t\t{1 / float64(0x100000000000000), -4},\n\t\t{1 / float64(0x1000000000000000), -4},\n\t\t{1 / float64(0x10000000000000000), -4}, // 2**-64\n\t\t{1 / float64(0x100000000000000000), -5},\n\n\t\t// Max values\n\t\t{0x1.FFFFFFFFFFFFFp1023, 63},\n\t\t{0x1p1023, 63},\n\t\t{0x1p1019, 63},\n\t\t{0x1p1008, 63},\n\t\t{0x1p1007, 62},\n\t\t{0x1p1000, 62},\n\t\t{0x1p0992, 62},\n\t\t{0x1p0991, 61},\n\n\t\t// Min and subnormal values\n\t\t{0x1p-1074, -64},\n\t\t{0x1p-1073, -64},\n\t\t{0x1p-1072, -64},\n\t\t{0x1p-1057, -64},\n\t\t{0x1p-1056, -64},\n\t\t{0x1p-1041, -64},\n\t\t{0x1p-1040, -64},\n\t\t{0x1p-1025, -64},\n\t\t{0x1p-1024, -64},\n\t\t{0x1p-1023, -64},\n\t\t{0x1p-1022, -64},\n\t\t{0x1p-1009, -64},\n\t\t{0x1p-1008, -63},\n\t\t{0x1p-0993, -63},\n\t\t{0x1p-0992, -62},\n\t\t{0x1p-0977, -62},\n\t\t{0x1p-0976, -61},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"%x\", pair.value), func(t *testing.T) {\n\t\t\tindex := m.MapToIndex(pair.value)\n\n\t\t\trequire.Equal(t, pair.index, index, \"value: %#x\", pair.value)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4bbbad50fe4a7b52290a406886534f35", "score": "0.54935116", "text": "func TestMinIndex(t *testing.T) {\n\tdurations := []int{27, 8, 5}\n\tindex := findMinIndex(durations)\n\tprintln(\"MinIndex:\", index)\n\tprintln(\"Containg the value\", durations[index])\n}", "title": "" }, { "docid": "5fa6870e61c1b9eb1434939cfae2a9b0", "score": "0.5448108", "text": "func TestExponentMappingNegOne(t *testing.T) {\n\tm, _ := NewMapping(-1)\n\n\tfor _, pair := range []expectMapping{\n\t\t{16, 2},\n\t\t{15, 1},\n\t\t{9, 1},\n\t\t{8, 1},\n\t\t{5, 1},\n\t\t{4, 1},\n\t\t{3, 0},\n\t\t{2, 0},\n\t\t{1.5, 0},\n\t\t{1, 0},\n\t\t{0.75, -1},\n\t\t{0.5, -1},\n\t\t{0.25, -1},\n\t\t{0.20, -2},\n\t\t{0.13, -2},\n\t\t{0.125, -2},\n\t\t{0.10, -2},\n\t\t{0.0625, -2},\n\t\t{0.06, -3},\n\t} {\n\t\tidx := m.MapToIndex(pair.value)\n\t\trequire.Equal(t, pair.index, idx, \"value: %v\", pair.value)\n\t}\n}", "title": "" }, { "docid": "d3ac015b219cc1f410c5b6b4ee778519", "score": "0.5359173", "text": "func isMinLevel(index int) bool {\n\treturn bits.LeadingZeros(uint(index+1))&1 == 1\n}", "title": "" }, { "docid": "d416379ac0285abce4cfc3799680d641", "score": "0.5336102", "text": "func TestFindMin(testCase *testing.T) {\n\ttestCase.Log(\"To test the pivot point of a rotated array\")\n\n\tnums := []int{4, 5, 6, 7, 0, 1, 2}\n\tsolution := FindMin(nums)\n\n\tif solution != 0 {\n\t\ttestCase.Errorf(\"Find Min Error: Function returned the wrong value\")\n\t}\n}", "title": "" }, { "docid": "3dcb928f2e2d77fdb7728c541f50728c", "score": "0.5281245", "text": "func TestIntMinTableDriven(t *testing.T) {\n\tvar tests = []struct {\n\t\ta, b int\n\t\twant int\n\t}{\n\t\t{0, 1, 0},\n\t\t{1, 0, 0},\n\t\t{2, -2, -2},\n\t\t{0, -1, -1},\n\t\t{0, -1, -1},\n\t}\n\n\t// t.Run enables running subtests for each table entry\n\tfor _, tt := range tests {\n\t\ttestname := fmt.Sprintf(\"%d,%d\", tt.a, tt.b)\n\t\tt.Run(testname, func(t *testing.T) {\n\t\t\tans := IntMin(tt.a, tt.b)\n\t\t\tif ans != tt.want {\n\t\t\t\tt.Errorf(\"got %d, want %d\", ans, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "28a3b24b86b477e6dfe52b26c09c3591", "score": "0.52351046", "text": "func TestSmallestMultiple(t *testing.T) {\n\texp := 2520\n\trec := SmallestMultiple(10)\n\n\tif exp != rec {\n\t\tt.Errorf(\"Recieved unexpedted number. Got %d instead of %d\\n\", rec, exp)\n\t}\n}", "title": "" }, { "docid": "2aacf1c43cc4e9bad4e7796d76f162d3", "score": "0.52327096", "text": "func getMin(arr []float64) int {\r\n min := 1000.0\r\n minIndex := -1;\r\n for i,v := range arr {\r\n if v < min {\r\n min = v;\r\n minIndex = i;\r\n }\r\n }\r\n return minIndex;\r\n}", "title": "" }, { "docid": "48c0dc6c2b58a548b858c0a61a291989", "score": "0.52292055", "text": "func (c MapArrayCollection) Min(key ...string) decimal.Decimal {\n\n\tvar (\n\t\tsmallest = decimal.New(0, 0)\n\t\tnumber decimal.Decimal\n\t)\n\n\tfor i := 0; i < len(c.value); i++ {\n\t\tnumber = nd(c.value[i][key[0]])\n\t\tif i == 0 {\n\t\t\tsmallest = number\n\t\t\tcontinue\n\t\t}\n\t\tif smallest.GreaterThan(number) {\n\t\t\tsmallest = number\n\t\t}\n\t}\n\n\treturn smallest\n}", "title": "" }, { "docid": "f2d1eda74824f85d402a68c9657ac388", "score": "0.5217543", "text": "func (s *ExpDecaySample) Min() int64 {\n\treturn SampleMin(s.Values())\n}", "title": "" }, { "docid": "766deb2898963014c8a7c3c05cf72b6f", "score": "0.5203673", "text": "func main() {\n var N int\n fmt.Scan(&N)\n \n powers := make([]int, 0)\n \n for i := 0; i < N; i++ {\n var Pi int\n fmt.Scan(&Pi)\n \n if Pi > 0 {\n powers = append(powers, Pi)\n fmt.Fprintln(os.Stderr, Pi)\n }\n }\n\n fmt.Fprintln(os.Stderr, powers)\n \n sort.Ints(powers)\n \n minD := 99999999999\n \n for i := 1; i < len(powers); i++ {\n \n delta := int(math.Abs(float64(powers[i] - powers[i - 1])))\n \n if delta < minD {\n minD = delta\n }\n }\n \n fmt.Fprintln(os.Stderr, powers)\n \n fmt.Println(minD)// Write answer to stdout\n}", "title": "" }, { "docid": "e209cebed29bcbd862366389b35fc5d2", "score": "0.51912576", "text": "func min(nums ...float64) (x float64) {\n\tx := -math.MaxFloat64\n\tfor _, num := range nums {\n\t\tif (num < x) {\n\t\t\tx = num\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e336503a0b30fce4125bdfbb09706132", "score": "0.518873", "text": "func TestIntMinTableDriven(t *testing.T) {\n\n\t//Set of input values and expected output\n\tvar tests = []struct {\n\t\ta, b int\n\t\twant int\n\t}{\n\t\t{0, 1, 0},\n\t\t{1, 0, 0},\n\t\t{2, -2, -2},\n\t\t{0, -1, -1},\n\t\t{-1, 0, -1},\n\t}\n\n\t//looping through to determine test results\n\tfor _, tt := range tests {\n\t\ttestname := fmt.Sprintf(\"%d,%d\", tt.a, tt.b)\n\t\tt.Run(testname, func(t *testing.T) {\n\t\t\tans := IntMin(tt.a, tt.b)\n\t\t\tif ans != tt.want {\n\t\t\t\tt.Errorf(\"got %d, want %d\", ans, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f07b844fca556c8ff408457443e3198b", "score": "0.51830924", "text": "func ijToSTMin(i int) float64 {\n\treturn float64(i) / float64(MaxSize)\n}", "title": "" }, { "docid": "1bc36130e2fbcd4fa67c7dfb3107e1fc", "score": "0.51181924", "text": "func (b *Series) SafeMin() float64 { return b.CalcStatistics().Min }", "title": "" }, { "docid": "6206598b8bbed4a738a2ffdc5c848f33", "score": "0.510433", "text": "func (x RVec) Min() float64 {\n\tL, U := x.Ix()\n\ts := 0.0\n\tfor i := L; i <= U; i++ {\n\t\ts = math.Min(s, x.E(i))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "28cc0357606b9c3197943671d450401f", "score": "0.5093706", "text": "func MinIndex(data []int, initial int) int {\n\tminValue := data[initial]\n\tminIndex := initial\n\n\tfor i := initial; i < len(data); i++ {\n\t\tif data[i] < minValue {\n\t\t\tminIndex = i\n\t\t\tminValue = data[i]\n\t\t}\n\t}\n\n\treturn minIndex\n}", "title": "" }, { "docid": "db552c49d2b90371a516c6d7e40ed438", "score": "0.50807935", "text": "func TestHitLowest(t *testing.T) {\n\t// Given\n\ts := sphere.New()\n\ti1 := shape.NewIntersection(5.0, s)\n\ti2 := shape.NewIntersection(7.0, s)\n\ti3 := shape.NewIntersection(-3.0, s)\n\ti4 := shape.NewIntersection(2.0, s)\n\txs := shape.Intersections{i1, i2, i3, i4}\n\n\t// When\n\ti := xs.Hit()\n\n\t// Then\n\tassert.Equal(t, i4, i)\n}", "title": "" }, { "docid": "92a324e2ec4eed50d2feb381c52e9f5a", "score": "0.50725293", "text": "func TestIndexNormal(t *testing.T) {\n\tvar err error\n\tvar ind *Index\n\tvar isEqual bool\n\tvar found bool\n\tvar bits map[uint64][]uint64\n\n\tdocProt := newDocProt()\n\tif ind, err = NewIndex(docProt, \"/tmp/index_test\"); err != nil {\n\t\tt.Fatalf(\"incorrect result of NewIndex, %+v\", err)\n\t}\n\tif isEqual, err = checkers.DeepEqual(ind.DocProt, docProt); !isEqual {\n\t\tt.Fatalf(\"incorrect result of NewIndex, %+v\", err)\n\t}\n\n\tfor i := 0; i < NumDocs; i++ {\n\t\tdoc := newDocProt()\n\t\tdoc.DocID = uint64(i)\n\t\tfor j := 0; j < len(doc.UintProps); j++ {\n\t\t\tval := uint64(i * (j + 1))\n\t\t\tif val, err = cql.ParseUintProp(doc.UintProps[j], fmt.Sprintf(\"%v\", val)); err != nil {\n\t\t\t\tt.Fatalf(\"%+v\", err)\n\t\t\t}\n\t\t\tdoc.UintProps[j].Val = val\n\t\t}\n\t\tfor j := 0; j < len(doc.StrProps); j++ {\n\t\t\tdoc.StrProps[j].Val = fmt.Sprintf(\"%03d%03d and some random text\", i, j)\n\t\t}\n\t\tif err = ind.Insert(doc); err != nil {\n\t\t\tt.Fatalf(\"%+v\", err)\n\t\t}\n\t}\n\n\t// query numerical(integer) range\n\tvar qr *QueryResult\n\tvar items []datastructures.Comparable\n\tlow := uint64(30)\n\thigh := uint64(600)\n\tcs := &cql.CqlSelect{\n\t\tIndex: docProt.Index,\n\t\tUintPreds: map[string]cql.UintPred{\n\t\t\t\"price\": cql.UintPred{\n\t\t\t\tName: \"price\",\n\t\t\t\tLow: low,\n\t\t\t\tHigh: high,\n\t\t\t},\n\t\t},\n\t}\n\tif qr, err = ind.Select(cs); err != nil {\n\t\tt.Fatalf(\"%+v\", err)\n\t}\n\tfmt.Printf(\"query result: %v\\n\", qr.Bm.Bits())\n\t// low <= 2*i <= high, (low+1)/2 <= i <= high/2\n\twant := int(high/2 - (low+1)/2 + 1)\n\tif qr.Bm.Count() != uint64(want) {\n\t\tt.Fatalf(\"incorrect number of matches, have %d, want %d\", qr.Bm.Count(), want)\n\t}\n\n\t// query numerical range + order by + text\n\tcs.OrderBy = \"price\"\n\tcs.Limit = 20\n\tif qr, err = ind.Select(cs); err != nil {\n\t\tt.Fatalf(\"%+v\", err)\n\t}\n\titems = qr.Oa.Finalize()\n\tfmt.Printf(\"query result: %v\\n\", items)\n\twant = cs.Limit\n\tif len(items) != want {\n\t\tt.Fatalf(\"incorrect number of matches, have %d, want %d\", len(items), want)\n\t}\n\n\t// dump bits\n\tfor name, frame := range ind.txtFrames {\n\t\tvar termID uint64\n\t\tif termID, found = frame.td.GetTermID(\"017001\"); !found {\n\t\t\tcontinue\n\t\t}\n\t\tif bits, err = frame.Bits(); err != nil {\n\t\t\tt.Fatalf(\"%+v\", err)\n\t\t}\n\t\t//fmt.Printf(\"frmae %v bits: %v\\n\", name, bits)\n\t\tfmt.Printf(\"frame %v bits[%v]: %v\\n\", name, termID, bits[termID])\n\t}\n\n\t// query numerical range + text\n\tcs.StrPreds = map[string]cql.StrPred{\n\t\t\"note\": cql.StrPred{\n\t\t\tName: \"note\",\n\t\t\tContWord: \"017001\",\n\t\t\t//\t\t\tContWord: \"random\",\n\t\t},\n\t}\n\tcs.Limit = 20\n\tif qr, err = ind.Select(cs); err != nil {\n\t\tt.Fatalf(\"%+v\", err)\n\t}\n\titems = qr.Oa.Finalize()\n\tfmt.Printf(\"query result: %v\\n\", items)\n\twant = 1\n\tif len(items) != want {\n\t\tt.Fatalf(\"incorrect number of matches, have %d, want %d\", len(items), want)\n\t}\n\n\t// query numerical(float) range\n\tvalSs := []string{\"30\", \"600\"}\n\tvals := make([]uint64, len(valSs))\n\tfor i, valS := range valSs {\n\t\tvar val uint64\n\t\tif val, err = cql.Float64ToSortableUint64(valS); err != nil {\n\t\t\tt.Fatalf(\"%+v\", err)\n\t\t}\n\t\tvals[i] = val\n\t\tfmt.Printf(\"FLOAT64 %v\\t%v\\n\", valS, val)\n\t}\n\tlow, high = vals[0], vals[1]\n\tcs = &cql.CqlSelect{\n\t\tIndex: docProt.Index,\n\t\tUintPreds: map[string]cql.UintPred{\n\t\t\t\"priceF64\": cql.UintPred{\n\t\t\t\tName: \"priceF64\",\n\t\t\t\tLow: low,\n\t\t\t\tHigh: high,\n\t\t\t},\n\t\t},\n\t}\n\tif qr, err = ind.Select(cs); err != nil {\n\t\tt.Fatalf(\"%+v\", err)\n\t}\n\tfmt.Printf(\"query result: %v\\n\", qr.Bm.Bits())\n\t// low <= 3*i <= high, (low+2)/3 <= i <= high/3\n\twant = int(600/3 - (30+2)/3 + 1)\n\tif qr.Bm.Count() != uint64(want) {\n\t\tt.Fatalf(\"incorrect number of matches, have %d, want %d\", qr.Bm.Count(), want)\n\t}\n\n\t//delete docs\n\tfor i := 0; i < NumDocs; i++ {\n\t\tdoc := newDocProt()\n\t\tdoc.DocID = uint64(i)\n\t\tfor j := 0; j < len(doc.UintProps); j++ {\n\t\t\tdoc.UintProps[j].Val = uint64(i * (j + 1))\n\t\t}\n\t\tif found, err = ind.Del(doc.DocID); err != nil {\n\t\t\tt.Fatalf(\"%+v\", err)\n\t\t} else if !found {\n\t\t\tt.Fatalf(\"document %v not found\", doc)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8b8cd3112f382493354e835932f90b72", "score": "0.5066188", "text": "func MinIndex(a []int) int {\n\tv := math.MaxInt64\n\tindex := 0\n\tfor i, b := range a {\n\t\tif v > b {\n\t\t\tv = b\n\t\t\tindex = i\n\t\t}\n\t}\n\treturn index\n}", "title": "" }, { "docid": "bfe5b5139e9d05a489bf1358340f5b45", "score": "0.5062037", "text": "func TestCheckMinHeap(t *testing.T) {\n\tA := make([]int, 0)\n\tfor i := 0; i < 1000; i++ {\n\t\trandm := rand.Intn(1000)\n\t\tA = append(A, randm)\n\t}\n\th := BuildMinHeap(&A) // Build inplace\n\n\tvalidHeap := true\n\tprevMin, _ := h.ExtractMinimum()\n\tn := len(A)\n\tfor j := 0; j < n; j++ {\n\t\tmin, _ := h.ExtractMinimum()\n\n\t\tif prevMin > min {\n\t\t\tvalidHeap = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\ttest.AssertEqual(t, true, validHeap)\n}", "title": "" }, { "docid": "a9ac1c9c4a03803b7e27343c60810e94", "score": "0.5056907", "text": "func testMinValue(unit testUnit) func(t *testing.T) {\n\treturn func(t *testing.T) {\n\t\tans := minValue(unit.x, unit.y)\n\n\t\tif ans != unit.expected {\n\t\t\tt.Errorf(\"minValue(%d,%d) = %d; expect %d\", unit.x, unit.y, ans, unit.expected)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "94abaaad5aca2d6acd2ceb25891732c1", "score": "0.50452214", "text": "func Min(a, b float64, count int) float64 { return math.Min(a, b) }", "title": "" }, { "docid": "90b1f47bb353ec41fb96fe516ddd9b7a", "score": "0.50385684", "text": "func TestIntMinBasic(t *testing.T) {\n\tans := IntMin(2, -2)\n\tif ans != -2 {\n\t\t// t.Error* reports failures but doesn't halt the test, t.Fatal* stops the test\n\t\tt.Errorf(\"IntMin(2, -2) = %d; want -2\", ans)\n\t}\n}", "title": "" }, { "docid": "ba75c8ce5185264145c2b18db76b1f75", "score": "0.5031887", "text": "func TestMin(t *testing.T) {\n\ttype scenario struct {\n\t\ta int\n\t\tb int\n\t\texpected int\n\t}\n\n\tscenarios := []scenario{\n\t\t{\n\t\t\t1,\n\t\t\t1,\n\t\t\t1,\n\t\t},\n\t\t{\n\t\t\t1,\n\t\t\t2,\n\t\t\t1,\n\t\t},\n\t\t{\n\t\t\t2,\n\t\t\t1,\n\t\t\t1,\n\t\t},\n\t}\n\n\tfor _, s := range scenarios {\n\t\tassert.EqualValues(t, s.expected, Min(s.a, s.b))\n\t}\n}", "title": "" }, { "docid": "98ef3b5f7f9ae3f30a46550df4e5683e", "score": "0.5021044", "text": "func (V VEB) Min() int { return V.min }", "title": "" }, { "docid": "5cff86ec4ea738b6d83e6f32e2ae4436", "score": "0.50104296", "text": "func TestIntMinBasic(t *testing.T) {\n\tans := IntMin(2, -2)\n\tif ans != -2 {\n\t\tt.Errorf(\"IntMin(2, -2) = %d; want -2\", ans) //throw error\n\t}\n}", "title": "" }, { "docid": "944635466ab969c7b4910d1df9fc085d", "score": "0.50093806", "text": "func min(companies []Company) (minIndex int, e error) {\n\n\tif len(companies) == 0 {\n\t\tminIndex = -1\n\t\te = errors.New(\"empty slice\")\n\t\treturn\n\t}\n\tminIndex = 0\n\tfor i, c := range companies {\n\t\tif c.MarketValue < companies[minIndex].MarketValue {\n\t\t\tminIndex = i\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "18e0d045bd52a63ba3092d8ad847973e", "score": "0.50082564", "text": "func (i IndexZYX) MinPoint(size Point) Point {\n\treturn ChunkPoint3d(i).MinPoint(size)\n}", "title": "" }, { "docid": "4ebe734ecffbb06f258f238d0db791e6", "score": "0.5007979", "text": "func MinIndex(inReal []float64, optInTimePeriod int) []int {\n var outBegIdx int\n var outNBElement int\n n := len(inReal)\n outInteger := make([]int, n)\n ta_MinIndex(0, n - 1, (*float64)(&inReal[0]), optInTimePeriod, &outBegIdx, &outNBElement, (*int)(&outInteger[0]))\n outInteger = append(make([]int, outBegIdx), outInteger[:outNBElement]...)\n return outInteger\n}", "title": "" }, { "docid": "979b66fdff3c9bfbfe8cb6ad38e07257", "score": "0.5005039", "text": "func (c normal) isExpGreater(y *big.Float, x *big.Int) bool {\n\t// set up an upper and lower bound for possible value of\n\t// exp(-x/(2*sigma^2))\n\tupper := big.NewFloat(1)\n\tupper.SetPrec(c.n)\n\tlower := new(big.Float)\n\tlower.SetPrec(c.n)\n\tmaxBits := x.BitLen()\n\n\tlower.Set(c.preExp[maxBits])\n\tlower.Quo(lower, c.preExp[0])\n\tif lower.Cmp(y) == 1 {\n\t\treturn false\n\t}\n\n\t// based on bits of x and the precomputed values\n\t// change the upper and lower bound\n\tfor i := 0; i < maxBits; i++ {\n\t\tbit := x.Bit(maxBits - 1 - i)\n\t\tif bit == 1 {\n\t\t\tupper.Mul(upper, c.preExp[maxBits-1-i])\n\t\t\tif y.Cmp(upper) == 1 {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else {\n\t\t\tlower.Quo(lower, c.preExp[maxBits-1-i])\n\t\t\tif y.Cmp(lower) == -1 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "71310863e88d04c2714bd8fdb7a6354a", "score": "0.49915695", "text": "func BaseExp(N int, eps ...float64) (int, int, bool) {\n\te := epsilon.E13(eps...)\n\n\tl := len(strconv.FormatInt(int64(N), 2))\n\tfor i := l; 1 < i; i-- {\n\t\ta := math.Pow(float64(N), 1.0/float64(i))\n\t\tif a-math.Trunc(a) < e {\n\t\t\tif Pow(int(a), i) == N {\n\t\t\t\treturn int(a), i, true\n\t\t\t}\n\t\t}\n\n\t\tif 1-(a-math.Trunc(a)) < e {\n\t\t\tif Pow(int(a)+1, i) == N {\n\t\t\t\treturn int(a) + 1, i, true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0, 0, false\n}", "title": "" }, { "docid": "f91fd6c95acc2a5601b9ebf85aaa2578", "score": "0.49872088", "text": "func Min(a, b float32) float32 {\n\tif a <= b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "d81a434923b8cfdc36d1b5857832cc62", "score": "0.4986771", "text": "func MinTrits(value int64) int {\n\tvalueAbs := iotaGoMath.AbsInt64(value)\n\n\tvar vp uint64\n\tvar num int\n\tswitch {\n\tcase valueAbs >= 308836698141973:\n\t\tvp = 308836698141973\n\t\tnum = 31\n\tcase valueAbs >= 5230176601:\n\t\tvp = 5230176601\n\t\tnum = 21\n\tcase valueAbs >= 88573:\n\t\tvp = 88573\n\t\tnum = 11\n\tdefault:\n\t\tvp = 1\n\t\tnum = 1\n\t}\n\n\tfor valueAbs > vp {\n\t\tvp = vp*TrinaryRadix + 1\n\t\tnum++\n\t}\n\treturn num\n}", "title": "" }, { "docid": "6eafd3a0f901126d284c06fc634d6b06", "score": "0.49734968", "text": "func (v *Value) Min() int {\n\tmin := math.MaxInt64\n\tfor _, face := range v.Faces {\n\t\tif face < min {\n\t\t\tmin = face\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "6d6fa0d8e7ac5535b2d1675e9bf5ce56", "score": "0.49657208", "text": "func Min(numbers []float64) float64 {\n\tif len(numbers) == 0 {\n\t\treturn 0\n\t}\n\n\tm := numbers[0]\n\n\tfor _, n := range numbers {\n\t\tif n < m {\n\t\t\tm = n\n\t\t}\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "226b06692127a54902ec68e59f932c1c", "score": "0.49647492", "text": "func MinTrits(value int64) uint64 {\n\tvar num uint64 = 1\n\tvar vp uint64 = 1\n\n\tvalueAbs := uint64(MustAbsInt64(value))\n\n\tfor uint64(valueAbs) > vp {\n\t\tvp = vp*uint64(Radix) + 1\n\t\tnum++\n\t}\n\treturn num\n}", "title": "" }, { "docid": "f1603d884c17d25a56b39a7355b24153", "score": "0.49627718", "text": "func TestIndexBloat(t *testing.T) {\n\tvar assert = assert.New(t)\n\t_, gauges, close := prepare(t)\n\tdefer close()\n\n\tvar metrics = evaluate(t, gauges.IndexBloat())\n\tassert.Len(metrics, 0)\n\tassertNoErrs(t, gauges)\n}", "title": "" }, { "docid": "2346f71dfc9b340dae159ed4ef19c097", "score": "0.49574736", "text": "func minix(a []float64) int {\n\tif len(a) == 0 {\n\t\treturn -1\n\t}\n\tmini := 0\n\tfor i := range a {\n\t\tif a[i] < a[mini] {\n\t\t\tmini = i\n\t\t}\n\t}\n\treturn mini\n}", "title": "" }, { "docid": "723d82c45e82d336fce88e2bd85bac49", "score": "0.49420866", "text": "func (array sparseCooF64Matrix) Min() float64 {\n\treturn Min(&array)\n}", "title": "" }, { "docid": "4aec599bab1cf9e97493fce610ad293a", "score": "0.49368554", "text": "func min(values ...float64) float64 {\n\tc := values[0]\n\tfor i := 1; i < len(values); i++ {\n\t\tif values[i] < c {\n\t\t\tc = values[i]\n\t\t}\n\t}\n\treturn c\n}", "title": "" }, { "docid": "42abd22a9646bceeed0262f0c403c05d", "score": "0.4936185", "text": "func BigIntCubeRootFloor(n *big.Int) *big.Int {\n\tTHREE := big.NewInt(3)\n\tcube, x := new(big.Int), new(big.Int)\n\n\ta := new(big.Int).Set(n)\n\tfor cube.Exp(a, THREE, nil).Cmp(n) > 0 {\n\t\tx.Quo(n, x.Mul(a, a))\n\t\tx.Add(x.Add(x, a), a)\n\t\ta.Quo(x, THREE)\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "0847a3bc7c9995c7ddf2c55f52ad2f91", "score": "0.49348214", "text": "func ExpectedMinimumDifficulty(hashrate float64, spot int) uint64 {\n\t// 2^64\n\tspace := big.NewFloat(math.MaxUint64)\n\tehrF := big.NewFloat(hashrate * MiningPeriod)\n\tspotF := new(big.Float).Sub(ehrF, big.NewFloat(float64(spot)))\n\tnum := new(big.Float).Mul(space, spotF)\n\n\tden := ehrF\n\n\texpMin := new(big.Float).Quo(num, den)\n\tf, _ := expMin.Float64()\n\treturn uint64(f)\n}", "title": "" }, { "docid": "b5e0719dceb596be03c92c83ea037ae0", "score": "0.4933047", "text": "func (s *UniformSample) Min() int64 {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn SampleMin(s.values)\n}", "title": "" }, { "docid": "db12b027b18c5a48c0f8116c5dbb8b48", "score": "0.49320439", "text": "func (bng *binning1D) xMin() float64 {\n\treturn bng.xrange.Min\n}", "title": "" }, { "docid": "79c7b2eabe61b30913dee5eecd7d0a1b", "score": "0.49150735", "text": "func Min(first Decimal, rest ...Decimal) Decimal {\n\tans := first\n\tfor _, item := range rest {\n\t\tif item.Cmp(ans) < 0 {\n\t\t\tans = item\n\t\t}\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "70f4dcee5843720eaf98c161b24bfb57", "score": "0.49126047", "text": "func (d *Dense) Min() float64 {\n\tmin := math.Inf(1)\n\tfor _, v := range d.data {\n\t\tif v < min {\n\t\t\tmin = v\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "4fe3204298cddcae516da9ef7f469a2e", "score": "0.48993543", "text": "func (h *StandardHistogramFloat64) Min() float64 { return h.sample.Min() }", "title": "" }, { "docid": "762ac14089109795fce5471d79ca2895", "score": "0.48938155", "text": "func TestCalculateMultiplicativeOrderPrimePower(t *testing.T) {\n\te := calculateMultiplicativeOrderPrimePowerSmall(4, 7, 1)\n\tif e != 3 {\n\t\tt.Error(e)\n\t}\n\n\te = calculateMultiplicativeOrderPrimePowerSmall(3, 2, 10)\n\tif e != 256 {\n\t\tt.Error(e)\n\t}\n}", "title": "" }, { "docid": "cc6fc92fb814e30bb28d3e03414cda13", "score": "0.48915812", "text": "func ArgMin(target []float64) int {\n\tvar (\n\t\tindex int\n\t\tbase float64\n\t)\n\tfor i, d := range target {\n\t\tif i == 0 {\n\t\t\tindex = i\n\t\t\tbase = d\n\t\t} else {\n\t\t\tif d < base {\n\t\t\t\tindex = i\n\t\t\t\tbase = d\n\t\t\t}\n\t\t}\n\n\t}\n\treturn index\n}", "title": "" }, { "docid": "e0594a6381ddc416270d0a96d677aa72", "score": "0.4885722", "text": "func (c *Aggregator) Min() (core.Number, error) {\n\treturn c.checkpoint.Quantile(0)\n}", "title": "" }, { "docid": "334658cb98c1ab5f42afc1f7dc302e57", "score": "0.48780587", "text": "func (s *SampleSnapshot) Min() int64 { return SampleMin(s.values) }", "title": "" }, { "docid": "42df62879d9e3c217dacea22e3b0abfe", "score": "0.48718414", "text": "func Min(xs []float64) float64 {\n\tvar min float64\n\tfor i, v := range xs {\n\t\tif i == 0 || v < min {\n\t\t\tmin = v\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "2226e688bfee0ca65da4c36cc6748197", "score": "0.4869166", "text": "func TestMin(t *testing.T) {\n\tgomega.RegisterFailHandler(ginkgo.Fail)\n\tginkgo.RunSpecs(t, \"Min Suite\")\n}", "title": "" }, { "docid": "13fc137acabaa8a92e26daf58d2f23c5", "score": "0.48661312", "text": "func SampleMin(values []int64) int64 {\n\tif 0 == len(values) {\n\t\treturn 0\n\t}\n\tvar min int64 = math.MaxInt64\n\tfor _, v := range values {\n\t\tif min > v {\n\t\t\tmin = v\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "bc9e3f7704dce12a102ffef4a3d404d0", "score": "0.48526672", "text": "func (f Float64Data) Min() (float64, error) { return Min(f) }", "title": "" }, { "docid": "2ab23d1e946518ff6eff2d23f2d50999", "score": "0.48519546", "text": "func (s *Sparse) Min() int {\n\tif s.IsEmpty() {\n\t\treturn MaxInt\n\t}\n\treturn s.root.next.min(false)\n}", "title": "" }, { "docid": "77d0ad3bdd3d9278e3a7dec320611b0b", "score": "0.48505735", "text": "func (pq *indexMinPQ) minIndex() int {\n return pq.invind[1]\n}", "title": "" }, { "docid": "ab496c7c23a7f4c55360f5e4d110952a", "score": "0.48448986", "text": "func (m *SampledMetric) Min() int64 {\n\tmin := int64(math.MaxInt64)\n\tfor _, s := range m.samples {\n\t\tif min > s.value {\n\t\t\tmin = s.value\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "dd4215d9e4d71279740d52d5ccb89993", "score": "0.48366296", "text": "func (g *Generator) ExactLower(N int) *Generator {\n\tg.withLower = false\n\tg.requireLower = N\n\treturn g\n}", "title": "" }, { "docid": "8e563df4795be51c3873d855670bbce8", "score": "0.4833516", "text": "func (d FloatSlice) MinMaxIndex(stride int) (uint64, uint64) {\n var minindex, maxindex uint64\n C.gsl_stats_minmax_index((*C.size_t)(&minindex),\n (*C.size_t)(&maxindex), (*C.double)(&d[0]),\n C.size_t(stride), C.size_t(len(d)))\n return minindex, maxindex\n}", "title": "" }, { "docid": "5dc728db2ed1a2a357d40651fdd0c64d", "score": "0.48258486", "text": "func MinBigInt(x, y *big.Int) *big.Int {\n\tif x.Cmp(y) < 0 {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "dadbe74d8b238c536e4b982faef41e80", "score": "0.48157442", "text": "func (stats *FeeEstimator) lowerBucket(rate feeRate) int32 {\n\tres := sort.Search(len(stats.bucketFeeBounds), func(i int) bool {\n\t\treturn stats.bucketFeeBounds[i] >= rate\n\t})\n\treturn int32(res)\n}", "title": "" }, { "docid": "4850896004f2787acf11fc3257d4f1ad", "score": "0.48071566", "text": "func min(a, b float64) float64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "4850896004f2787acf11fc3257d4f1ad", "score": "0.48071566", "text": "func min(a, b float64) float64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "4850896004f2787acf11fc3257d4f1ad", "score": "0.48071566", "text": "func min(a, b float64) float64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "72e7886321067c51ed8feff4912be630", "score": "0.47967634", "text": "func (env *Environment) getEpsilonMin() float64 {\n\tif env.D1 != env.lastEpsilonMinD1 {\n\t\tenv.setEpsilonMinCache()\n\t\tenv.lastEpsilonMinD1 = env.D1\n\t}\n\treturn env.epsilonMinCache\n}", "title": "" }, { "docid": "54a5ef60fc0e98d30ecf6db029fb3778", "score": "0.47944304", "text": "func exp10(x int64, tmp *BigInt) (exp *BigInt, err error) {\n\tif x > MaxExponent || x < MinExponent {\n\t\treturn nil, errors.New(errExponentOutOfRangeStr)\n\t}\n\treturn tableExp10(x, tmp), nil\n}", "title": "" }, { "docid": "e01ec270dd8eafd1029617df108e8b35", "score": "0.47922269", "text": "func TestMinStack(t *testing.T) {\n\tvar stack MinStack\n\tgenericStackTest(t, &stack)\n\n\tif !stack.IsEmpty() {\n\t\tt.Error()\n\t}\n\n\tstack.Push(3)\n\tstack.Push(2)\n\tstack.Push(1)\n\n\tminVal, err := stack.Min()\n\tif minVal != 1 || err != nil {\n\t\tt.Error()\n\t}\n\n\tval, err := stack.Pop()\n\tif val != 1 || err != nil {\n\t\tt.Error()\n\t}\n\n\tval, err = stack.Min()\n\tif val != 2 || err != nil {\n\t\tt.Error()\n\t}\n\n\tstack.Push(0)\n\tval, err = stack.Peek()\n\tif val != 0 || err != nil {\n\t\tt.Error()\n\t}\n\n\tval, err = stack.Min()\n\tif val != 0 || err != nil {\n\t\tt.Error()\n\t}\n}", "title": "" }, { "docid": "f70e17517331cfec7732772661cb064d", "score": "0.47906023", "text": "func getMinValueAndPosition(nowMinValue, compareMinus1Value, comparePlus1Value *big.Int, minPosition, index int) (*big.Int, int) {\n\tposition := ((index + 1) << 1)\n\tif nowMinValue.Cmp(compareMinus1Value) > 0 {\n\t\tnowMinValue = compareMinus1Value\n\t\tminPosition = position\n\t}\n\tif nowMinValue.Cmp(comparePlus1Value) > 0 {\n\t\tposition++\n\t\tminPosition = position\n\t\tnowMinValue = comparePlus1Value\n\t}\n\treturn nowMinValue, minPosition\n}", "title": "" }, { "docid": "bedacfa43b061b567a13f448c89dfc0b", "score": "0.4788642", "text": "func (h *HistogramSnapshotFloat64) Min() float64 { return h.sample.Min() }", "title": "" }, { "docid": "2f5c2fb960d552b36619badb9fac9da9", "score": "0.4787645", "text": "func getMinValue(values []uint64) uint64 {\n\tresult := uint64(math.MaxUint64)\n\tfor _, value := range values {\n\t\tif value < result {\n\t\t\tresult = value\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "29f751e53b868a508e1c122d046818b0", "score": "0.47849858", "text": "func IsMin(unitType int, unitScale int) bool {\n\tswitch unitType {\n\tcase DATA:\n\t\tinternalUnitData := getDataUnits()\n\t\t_, ok := internalUnitData[unitScale-1]\n\t\treturn ok\n\tcase TIME:\n\t\tinternalUnitData := getTimeUnits()\n\t\t_, ok := internalUnitData[unitScale-1]\n\t\treturn ok\n\tcase BW:\n\t\tinternalUnitData := getBWUnits()\n\t\t_, ok := internalUnitData[unitScale-1]\n\t\treturn ok\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a39678845de395880b4f0ee1a5e59738", "score": "0.47783008", "text": "func TestAlgebraMinimal(t *testing.T) {\n\t// t(x) = h(x) * z(x)\n\t// where\n\t// z(x) is the minimal polynomial\n\t// <=> z(x) = (x-1) * (x-2)\n\t// h(x) = 2x\n\t// therefore\n\t// t(x) = (x-1)*(x-2)*2x = 2x^3 - 6x^2 + 4x\n\tvar p Poly = Poly([]Element{\n\t\tzero.Clone(),\n\t\tValue(4).ToFieldElement(),\n\t\tNewElement().Neg(Value(6).ToFieldElement()),\n\t\tValue(2).ToFieldElement(),\n\t})\n\n\tvar z Poly = Poly([]Element{one.Clone()})\n\tfor i := 1; i <= 2; i++ {\n\t\troot := Poly([]Element{\n\t\t\tNewElement().Neg(Value(i).ToFieldElement()),\n\t\t\tone.Clone(),\n\t\t})\n\t\tz = z.Mul(root)\n\t}\n\t// p / z should give h(x) without any remainder\n\t_, rem := p.Div2(z)\n\trequire.True(t, len(rem.Normalize()) == 0)\n}", "title": "" }, { "docid": "a9be5974db0e49bc1906596d5eea44a0", "score": "0.47761965", "text": "func (px *Paxos) Min() int {\n\tmin := int(^uint(0) >> 1)\n\n\tfor i := range px.dones {\n\t\tif min > px.dones[i] {\n\t\t\tmin = px.dones[i]\n\t\t}\n\t}\n\n\tDPrintf(\"Min is : \")\n\tDPrintf(min)\n\treturn min + 1\n}", "title": "" }, { "docid": "8c69172ff273795f7348cb05bb0a8cd2", "score": "0.47754288", "text": "func SolveMin(matrix [][]float64) map[int]map[int]float64 {\n\tvar b = Base{\n\t\tmatrix: matrix,\n\t\treduced: [][]float64{},\n\t\textremums: map[int]float64{},\n\t\treducedExtremums: map[int]map[int]float64{},\n\t}\n\n\t// inti reduced matrix with zeroes\n\tb.reduced = make([][]float64, len(matrix))\n\tfor i := range b.reduced {\n\t\tb.reduced[i] = make([]float64, len(matrix))\n\t}\n\n\tfor i, row := range matrix {\n\t\tfor j, v := range row {\n\t\t\tb.reduced[i][j] = v\n\t\t}\n\t}\n\n\tb.reduceByMin()\n\n\tb.reduceByMinMore()\n\n\tb.setValues()\n\n\tb.removeExtra()\n\n\tb.checkAndReplace()\n\n\treturn b.reducedExtremums\n}", "title": "" }, { "docid": "aa67658470b978e73b089564fb17d881", "score": "0.47563887", "text": "func (s *set) SmallestFactorOf(n uint64) (uint64, bool) {\n\tif n == 0 {\n\t\treturn 0, false\n\t}\n\tlimit := uint64(math.Ceil(math.Sqrt(float64(n))))\n\tit := s.Iterator(0)\n\tp, ok := it.Next()\n\tfor ok && p <= limit {\n\t\tif n%p == 0 {\n\t\t\treturn p, true\n\t\t}\n\t\tp, ok = it.Next()\n\t}\n\tif limit > s.LargestNumber() {\n\t\treturn n, false\n\t}\n\treturn n, true\n}", "title": "" }, { "docid": "2c716ffc9ddedc8bd1960b5f9881f621", "score": "0.47555187", "text": "func orderOfLargestPlusSign(n int, mines [][]int) int {\n table := map[[2]int]struct{}{}\n for _, mine := range mines {\n table[[2]int{mine[0], mine[1]}] = struct{}{}\n }\n maxK := (n + 1) / 2\n for ; ; maxK -= 1 {\n if _, found := table[[2]int{maxK, maxK}]; found {\n continue\n }\n }\n \n return 0\n}", "title": "" }, { "docid": "b1743b611e57ec0266ee531363a52cf7", "score": "0.47553378", "text": "func (d *Distribution) Min() float64 {\n\td.mu.Lock()\n\tv := d.min\n\tif d.count == 0 {\n\t\tv = 0.0\n\t}\n\td.mu.Unlock()\n\treturn v\n}", "title": "" }, { "docid": "dcda6874160c9459f9008f6e2094be65", "score": "0.4754456", "text": "func Min(input []int) int {\n\t// cap our minimum at the absolute max\n\tmin := 1<<31 - 1\n\tfor _, i := range input {\n\t\tif i < min {\n\t\t\tmin = i\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "4f9beb40720a938b8b1d4056809730f8", "score": "0.47528425", "text": "func Min(xs []float64) float64 {\n\tif len(xs) == 0 {\n\t\treturn 0.0\n\t}\n\tresult := xs[0]\n\tfor _, item := range xs {\n\t\tif item < result {\n\t\t\tresult = item\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "a88ae0a207e5e341ff3ea0a0d036b48c", "score": "0.47495705", "text": "func Argmin(a []float64) int {\n\tminIndex := 0\n\tfor index, value := range a {\n\t\tif value < a[minIndex] {\n\t\t\tminIndex = index\n\t\t}\n\t}\n\treturn minIndex\n}", "title": "" }, { "docid": "03da2ed749dcca0fd41de10285d41dc6", "score": "0.4745874", "text": "func min(h *HTM) float64 {\n\tvar n float64\n\tfor _, v0 := range h.Vertices {\n\t\tif n > v0.X {\n\t\t\tn = v0.X\n\t\t}\n\t\tif n > v0.Y {\n\t\t\tn = v0.Y\n\t\t}\n\t\tif n > v0.Z {\n\t\t\tn = v0.Z\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "4b6e7a3dc7f39e64e1fc01e35a2ad700", "score": "0.47429058", "text": "func (array denseF64Array) Min() float64 {\n\treturn Min(&array)\n}", "title": "" }, { "docid": "2f5593bc874277547453adf99d28cbbb", "score": "0.47286278", "text": "func (k Kind) Minimum() Number {\n\tswitch k {\n\tcase Int64Kind:\n\t\treturn NewInt64Number(math.MinInt64)\n\tcase Float64Kind:\n\t\treturn NewFloat64Number(-1. * math.MaxFloat64)\n\tdefault:\n\t\treturn Number(0)\n\t}\n}", "title": "" }, { "docid": "815a23fd586f3a58fc348f5903dd6f7c", "score": "0.47284216", "text": "func MinDistance(dist [V]int, sptSet [V]bool) int {\n\t// Initialize min value\n\tvar min = math.MaxInt32\n\tvar minIndex int\n\tfor v := 0; v < V; v++ {\n\t\tif sptSet[v] == false && dist[v] <= min {\n\t\t\tmin = dist[v]\n\t\t\tminIndex = v\n\t\t}\n\t}\n\treturn minIndex\n}", "title": "" }, { "docid": "38ae097a1141d18df43165856ec274b5", "score": "0.47261405", "text": "func (b Box) BoxMinFreeCell(maskSet [9]int) (boxID int) {\n\tminCnt := 9\n\tbin := &Binary{}\n\tfor b, boxMask := range maskSet {\n\t\tzeroCnt := bin.CountZero(boxMask)\n\t\tif zeroCnt > 0 && zeroCnt < minCnt {\n\t\t\tminCnt = zeroCnt\n\t\t\tboxID = b\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6389d24f22836961026ee1d8a04d3695", "score": "0.47202593", "text": "func MinValue(dtype tf.DataType) float64 {\n\tswitch dtype {\n\tcase tf.Double:\n\t\treturn math.SmallestNonzeroFloat64\n\tcase tf.Float:\n\t\treturn math.SmallestNonzeroFloat32\n\tcase tf.Half:\n\t\t// According to: https://www.khronos.org/opengl/wiki/Small_Float_Formats\n\t\treturn 6.10 * math.Pow10(-5)\n\tcase tf.Int16:\n\t\treturn math.MinInt16\n\tcase tf.Int32:\n\t\treturn math.MinInt32\n\tcase tf.Int64:\n\t\treturn math.MinInt64\n\tcase tf.Int8:\n\t\treturn math.MinInt8\n\tcase tf.Uint16, tf.Uint8:\n\t\treturn 0\n\t\t// No support for Quantized types\n\t}\n\tpanic(fmt.Sprintf(\"dtype %d not supported\", dtype))\n}", "title": "" }, { "docid": "a754a62cb244a7039220eca9be9b3086", "score": "0.4720179", "text": "func Min(list []float64) (min float64) {\n\tmin = list[0]\n\tfor _, number := range list {\n\t\tif number < min {\n\t\t\tmin = number\n\t\t}\n\t}\n\treturn min\n}", "title": "" } ]